Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions src/FullstoryInitHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {useEffect} from 'react';
import CONST from './CONST';
import useOnyx from './hooks/useOnyx';
import FS from './libs/Fullstory';
import Log from './libs/Log';
import ONYXKEYS from './ONYXKEYS';

/**
Expand All @@ -15,12 +16,18 @@ function FullstoryInitHandler() {

useEffect(() => {
FS.init(userMetadata);
FS.getSessionURL().then((url) => {
if (!url) {
return;
}
Sentry.setContext(CONST.TELEMETRY.CONTEXT_FULLSTORY, {url});
});
FS.getSessionURL()
.then((url) => {
if (!url) {
return;
}
Sentry.setContext(CONST.TELEMETRY.CONTEXT_FULLSTORY, {url});
})
.catch((error: unknown) => {
Log.warn('[FullstoryInitHandler] getSessionURL failed.', {
error: error instanceof Error ? error.message : String(error),
});
});
}, [userMetadata]);

return null;
Expand Down
6 changes: 3 additions & 3 deletions src/libs/Fullstory/index.native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const FS: Fullstory = {

init: (userMetadata) => FS.consentAndIdentify(userMetadata),

onReady: () => FullStory.onReady(),
onReady: async () => FullStory.onReady(),

shouldInitialize: shouldInitializeFullstory,

Expand Down Expand Up @@ -49,11 +49,11 @@ const FS: Fullstory = {

anonymize: () => FullStory.anonymize(),

getSessionId: () => {
getSessionId: async () => {
return FullStory.getCurrentSession();
},

getSessionURL: () => {
getSessionURL: async () => {
return FullStory.getCurrentSessionURL();
},

Expand Down
6 changes: 3 additions & 3 deletions src/libs/Fullstory/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {FullStory, init, isInitialized} from '@fullstory/browser';
import * as Session from '@userActions/Session';
import {isSupportAuthToken} from '@userActions/Session';
import CONST from '@src/CONST';
import getEnvironment from '@src/libs/Environment/getEnvironment';
import {getChatFSClass, shouldInitializeFullstory} from './common';
Expand All @@ -17,7 +17,7 @@ const FS: Fullstory = {

init: () => {},

onReady: () =>
onReady: async () =>
new Promise((resolve) => {
if (!isInitialized()) {
init({orgId: 'o-1WN56P-na1'}, resolve);
Expand All @@ -32,7 +32,7 @@ const FS: Fullstory = {
}
}),

shouldInitialize: (userMetadata, envName) => shouldInitializeFullstory(userMetadata, envName) && !Session.isSupportAuthToken(),
shouldInitialize: (userMetadata, envName) => shouldInitializeFullstory(userMetadata, envName) && !isSupportAuthToken(),

consent: (shouldConsent) => FullStory(CONST.FULLSTORY.OPERATION.SET_IDENTITY, {consent: shouldConsent}),

Expand Down
Loading