feat: Update pendo IIFE handling to evaluate configured IIFE - #86
Merged
Conversation
rodmgwgu
requested changes
Nov 21, 2024
rodmgwgu
left a comment
Collaborator
There was a problem hiding this comment.
Please target a release instead of main (like palm.master or quince.master)
Contributor
Author
|
@rodmgwgu, I targeted |
Collaborator
|
@j0mc yes, you should target the specific version that Academy is running, (palm.master if you are running palm). main I think is not even updated to palm, it's still on olive I think |
The pendo feature now evaluates the IIFE passed in via the MFE configuration, and passes it two arguments, first is the base URL of the lms in `lmsUrl`, and the second is the username in `username`. Note that no error handling is provided for the IIFE, any exceptions within the IIFE will be passed up to the browser. This assists in debugging issues with the IIFE but risks causing errors for end users in the MFE if the IIFE does not catch exceptions.
j0mc
force-pushed
the
feat/pendo_iife
branch
from
November 21, 2024 23:33
2436551 to
f6fe6eb
Compare
Contributor
Author
rodmgwgu
approved these changes
Nov 22, 2024
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The pendo feature now evaluates the IIFE passed in via the MFE configuration, and passes it two arguments, first is the base URL of the lms in
lmsUrl, and the second is the username inusername. Note that no error handling is provided for the IIFE, any exceptions within the IIFE will be passed up to the browser. This assists in debugging issues with the IIFE but risks causing errors for end users in the MFE if the IIFE does not catch exceptions.We use the
Function()constructor here as it's safer thaneval(), but does not pass scope into the function so we must pass any needed data as arguments. Currently passing the LMS base URL as well as the username to assist in fetching user data.The IIFE should fetch whatever data necessary and return the dictionary that will be set into local storage with the key specified by the MFE config's
PENDO_VISITOR_KEY. An example IIFE that can be set in the MFE config entryPENDO_VISITOR_IIFEwhich fetches from the LMS user api:Overview
MFE_CONFIG:ENABLE_PENDO: true,CUSTOM_PENDO: true,PENDO_VISITOR_KEY: "currentPerson",PENDO_VISITOR_IIFEfrom the IIFE snippet abovecurrentPersonkey in the browser's local storage is set with a dictionary containing the user's email addressChecklist
i.e.
feat(CUR-###): Feature title