-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NO QA] Fullstory integration #40484
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
93ff19f
Fullstory integration.
LCOleksii 039884d
Eslint errors fixed
LCOleksii 9a991fc
Typecheck errors fixed
LCOleksii 6fcb514
Eslint errors fixed
LCOleksii 78522e9
Eslint errors fixed
LCOleksii 1928c3a
Merge pull request #40294 from LCOleksii/fullstory-integration
danieldoglas a2f7fcd
Merge branch 'main' into fullstory-integration
danieldoglas 18358c4
removing email from identification
danieldoglas 1ce4272
removing email from native implementation
danieldoglas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
type FSPageInterface = { | ||
start: jest.Mock<void, []>; | ||
}; | ||
|
||
export default function mockFSLibrary() { | ||
jest.mock('@fullstory/react-native', () => { | ||
class Fullstory { | ||
consent = jest.fn(); | ||
|
||
anonymize = jest.fn(); | ||
|
||
identify = jest.fn(); | ||
} | ||
|
||
return { | ||
FSPage(): FSPageInterface { | ||
return { | ||
start: jest.fn(), | ||
}; | ||
}, | ||
default: Fullstory, | ||
}; | ||
}); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import FullStory, {FSPage} from '@fullstory/react-native'; | ||
import type {OnyxEntry} from 'react-native-onyx'; | ||
import type Session from '@src/types/onyx/Session'; | ||
import type {UserSession} from './types'; | ||
|
||
/** | ||
* Fullstory React-Native lib adapter | ||
* Proxy function calls to React-Native lib | ||
* */ | ||
const FS = { | ||
/** | ||
* Sets the identity as anonymous using the FullStory library. | ||
*/ | ||
anonymize: () => FullStory.anonymize(), | ||
|
||
/** | ||
* Sets the identity consent status using the FullStory library. | ||
*/ | ||
consent: (c: boolean) => FullStory.consent(c), | ||
|
||
/** | ||
* Initializes the FullStory session with the provided session information. | ||
*/ | ||
consentAndIdentify: (value: OnyxEntry<Session>) => { | ||
try { | ||
const session: UserSession = { | ||
email: value?.email, | ||
accountID: value?.accountID, | ||
}; | ||
// set consent | ||
FullStory.consent(true); | ||
FS.fsIdentify(session); | ||
} catch (e) { | ||
// error handler | ||
} | ||
}, | ||
|
||
/** | ||
* Sets the FullStory user identity based on the provided session information. | ||
* If the session is null or the email is 'undefined', the user identity is anonymized. | ||
* If the session contains an email, the user identity is defined with the email and account ID. | ||
*/ | ||
fsIdentify: (session: UserSession) => { | ||
if (!session || session.email === 'undefined') { | ||
// anonymize FullStory user identity session | ||
FullStory.anonymize(); | ||
} else { | ||
// define FullStory user identity | ||
FullStory.identify(String(session.accountID), { | ||
properties: { | ||
accountID: session.accountID, | ||
}, | ||
}); | ||
} | ||
}, | ||
}; | ||
|
||
export default FS; | ||
export {FSPage}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NAB seems like we're not properly handling errors here. I think this is fine for now, but maybe we should log something here.