@pendo/agent 2.333.1 → 2.334.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dom.esm.js +9 -3
- package/dist/pendo.module.js +545 -439
- package/dist/pendo.module.min.js +59 -10
- package/dist/servers.json +16 -7
- package/package.json +1 -1
package/dist/pendo.module.js
CHANGED
|
@@ -3407,6 +3407,7 @@ var ConfigReader = (function () {
|
|
|
3407
3407
|
* @type {boolean}
|
|
3408
3408
|
*/
|
|
3409
3409
|
addOption('disableGuidePseudoStyles', [SNIPPET_SRC, PENDO_CONFIG_SRC], false);
|
|
3410
|
+
addOption('disableImportantStyleAttributes', [SNIPPET_SRC, PENDO_CONFIG_SRC], false);
|
|
3410
3411
|
/**
|
|
3411
3412
|
* Content of badge and target element activated guides will be prefetched on load to improve guide display
|
|
3412
3413
|
* time unless set to `true`.
|
|
@@ -4028,8 +4029,8 @@ let SERVER = '';
|
|
|
4028
4029
|
let ASSET_HOST = '';
|
|
4029
4030
|
let ASSET_PATH = '';
|
|
4030
4031
|
let DESIGNER_SERVER = '';
|
|
4031
|
-
let VERSION = '2.
|
|
4032
|
-
let PACKAGE_VERSION = '2.
|
|
4032
|
+
let VERSION = '2.334.1_';
|
|
4033
|
+
let PACKAGE_VERSION = '2.334.1';
|
|
4033
4034
|
let LOADER = 'xhr';
|
|
4034
4035
|
/* eslint-enable web-sdk-eslint-rules/no-gulp-env-references */
|
|
4035
4036
|
/**
|
|
@@ -10392,8 +10393,13 @@ var setStyles = function (element, style) {
|
|
|
10392
10393
|
var importantIndex = value.indexOf('!important');
|
|
10393
10394
|
if (importantIndex !== -1) {
|
|
10394
10395
|
try {
|
|
10395
|
-
var propertyValue = trim.call(
|
|
10396
|
-
|
|
10396
|
+
var propertyValue = trim.call(value.substring(0, importantIndex));
|
|
10397
|
+
if (ConfigReader.get('disableImportantStyleAttributes')) {
|
|
10398
|
+
element.style.setProperty(key, propertyValue);
|
|
10399
|
+
}
|
|
10400
|
+
else {
|
|
10401
|
+
element.style.setProperty(key, propertyValue, 'important');
|
|
10402
|
+
}
|
|
10397
10403
|
return;
|
|
10398
10404
|
}
|
|
10399
10405
|
catch (e) { // Fallback for <=IE8
|
|
@@ -11781,12 +11787,12 @@ function isTrustedOrigin(host) {
|
|
|
11781
11787
|
return true;
|
|
11782
11788
|
// Domains that Pendo owns, will be swapped in by build patches
|
|
11783
11789
|
const patterns = [
|
|
11784
|
-
/^https:\/\/(adopt\.)?((us1)\.)?(app|via|adopt|cdn|oem|novus-api|novus)(\.(au|eu|gov|hsbc|jpn))?\.pendo\.io$/,
|
|
11785
|
-
/^https:\/\/([0-9]{8}t[0-9]{4}-dot-)(pendo-au|pendo-eu|pendo-govramp|pendo-hsbc|pendo-io|pendo-jp-prod|pendo-us1)\.appspot\.com$/,
|
|
11786
|
-
/^https:\/\/hotfix-(ops|app)-([0-9]+-dot-)(pendo-au|pendo-eu|pendo-govramp|pendo-hsbc|pendo-io|pendo-jp-prod|pendo-us1)\.appspot\.com$/,
|
|
11787
|
-
/^https:\/\/(pendo-au|pendo-eu|pendo-govramp|pendo-hsbc|pendo-io|pendo-jp-prod|pendo-us1)-static\.storage\.googleapis\.com$/,
|
|
11790
|
+
/^https:\/\/((adopt|oem)\.)?((us1)\.)?(app|via|adopt|cdn|oem|novus-api|novus)(\.(au|eu|gov|hsbc|jpn|tv))?\.pendo\.io$/,
|
|
11791
|
+
/^https:\/\/([0-9]{8}t[0-9]{4}-dot-)(pendo-au|pendo-eu|pendo-govramp|pendo-hsbc|pendo-io|pendo-jp-prod|pendo-tv|pendo-us1)\.appspot\.com$/,
|
|
11792
|
+
/^https:\/\/hotfix-(ops|app)-([0-9]+-dot-)(pendo-au|pendo-eu|pendo-govramp|pendo-hsbc|pendo-io|pendo-jp-prod|pendo-tv|pendo-us1)\.appspot\.com$/,
|
|
11793
|
+
/^https:\/\/(pendo-au|pendo-eu|pendo-govramp|pendo-hsbc|pendo-io|pendo-jp-prod|pendo-tv|pendo-us1)-static\.storage\.googleapis\.com$/,
|
|
11788
11794
|
/^https:\/\/([a-zA-Z0-9-]+\.)*pendo-dev\.com$/,
|
|
11789
|
-
/^https:\/\/([a-zA-Z0-9-]+-dot-)?(pendo-apollo|pendo-armada|pendo-atlas|pendo-batman|pendo-calypso|pendo-dap|pendo-dev|pendo-dr-us-east1|pendo-eu-dev|pendo-freeze|pendo-helix|pendo-link|pendo-magic|pendo-mango|pendo-mcfly|pendo-ml|pendo-mobile-fbi|pendo-mobile-guides|pendo-mobile-hummus|pendo-mobile-plat|pendo-perfserf|pendo-voc|pendo-wildlings|pendo-ionchef|pendo-scrum-ops|pendo-security|pendo-test|pendo-uat|pendo-au|pendo-eu|pendo-govramp|pendo-hsbc|pendo-io|pendo-jp-prod|pendo-us1)\.appspot\.com$/,
|
|
11795
|
+
/^https:\/\/([a-zA-Z0-9-]+-dot-)?(pendo-apollo|pendo-armada|pendo-atlas|pendo-batman|pendo-calypso|pendo-dap|pendo-dev|pendo-dr-us-east1|pendo-eu-dev|pendo-freeze|pendo-helix|pendo-link|pendo-magic|pendo-mango|pendo-mcfly|pendo-ml|pendo-mobile-fbi|pendo-mobile-guides|pendo-mobile-hummus|pendo-mobile-plat|pendo-perfserf|pendo-voc|pendo-wildlings|pendo-ionchef|pendo-scrum-ops|pendo-security|pendo-test|pendo-uat|pendo-au|pendo-eu|pendo-govramp|pendo-hsbc|pendo-io|pendo-jp-prod|pendo-tv|pendo-us1)\.appspot\.com$/,
|
|
11790
11796
|
/^https:\/\/(via|adopt|local)\.pendo\.(local|io):\d{4}$/,
|
|
11791
11797
|
/^https:\/\/(pendo-apollo|pendo-armada|pendo-atlas|pendo-batman|pendo-calypso|pendo-dap|pendo-dev|pendo-dr-us-east1|pendo-eu-dev|pendo-freeze|pendo-helix|pendo-link|pendo-magic|pendo-mango|pendo-mcfly|pendo-ml|pendo-mobile-fbi|pendo-mobile-guides|pendo-mobile-hummus|pendo-mobile-plat|pendo-perfserf|pendo-voc|pendo-wildlings|pendo-ionchef|pendo-scrum-ops|pendo-security|pendo-test|pendo-uat)-static\.storage\.googleapis\.com$/
|
|
11792
11798
|
]; // eslint-disable-line web-sdk-eslint-rules/no-gulp-env-references
|
|
@@ -14458,8 +14464,12 @@ function replaceWithContentHost(str) {
|
|
|
14458
14464
|
return str;
|
|
14459
14465
|
var subBucketPattern = new RegExp(`(https:)?\\/\\/${SUBSCRIPTION_BUCKET}-\\d+\\.storage\\.googleapis\\.com`, 'g');
|
|
14460
14466
|
var globalBucketPattern = new RegExp(`(https:)?\\/\\/${GLOBAL_BUCKET}\\.storage\\.googleapis\\.com`, 'g');
|
|
14467
|
+
// Content proxy hosts look like content-<subId>.static.<envDomain>, where envDomain is ASSET_HOST minus its cdn. prefix
|
|
14468
|
+
var envDomain = ASSET_HOST.replace(/^cdn\./, '');
|
|
14469
|
+
var contentProxyPattern = new RegExp(`(https:)?\\/\\/content-\\d+\\.static\\.${escapeRegExp(envDomain)}`, 'g');
|
|
14461
14470
|
return str.replace(subBucketPattern, contentHost)
|
|
14462
14471
|
.replace(globalBucketPattern, contentHost)
|
|
14472
|
+
.replace(contentProxyPattern, contentHost)
|
|
14463
14473
|
.replace(new RegExp(`(https:)?\\/\\/${escapeRegExp(ASSET_HOST)}`, 'g'), contentHost);
|
|
14464
14474
|
}
|
|
14465
14475
|
function replaceObjectWithContentHost(obj) {
|
|
@@ -17949,6 +17959,7 @@ function buildNodeFromJSON(json, step, guides) {
|
|
|
17949
17959
|
var id = json.props && json.props.id;
|
|
17950
17960
|
// This builds the 4pc backdrop to allow block clicking for any guide without changing how the backdrop is saved
|
|
17951
17961
|
if (id === 'pendo-backdrop') {
|
|
17962
|
+
step.hasBackdrop = true;
|
|
17952
17963
|
return buildBackdrop(step);
|
|
17953
17964
|
}
|
|
17954
17965
|
_.each(json.props, function (propValue, propKey) {
|
|
@@ -23234,6 +23245,20 @@ var autofocusStep = {
|
|
|
23234
23245
|
script: autofocusRuntimeScript
|
|
23235
23246
|
};
|
|
23236
23247
|
|
|
23248
|
+
function backdropInertRuntimeScript(step, guide, pendo) {
|
|
23249
|
+
if (pendo.designer || !step.guideElement)
|
|
23250
|
+
return;
|
|
23251
|
+
if (step.hasBackdrop) {
|
|
23252
|
+
const BuildingBlockGuides = pendo.BuildingBlocks.BuildingBlockGuides;
|
|
23253
|
+
const excludeElements = getTargetAreaElementsForBlockOut(step);
|
|
23254
|
+
const inertElements = BuildingBlockGuides.addInertOutsideGuide(step.guideElement[0], [], excludeElements);
|
|
23255
|
+
step.hiddenElements = (step.hiddenElements || []).concat(inertElements);
|
|
23256
|
+
}
|
|
23257
|
+
}
|
|
23258
|
+
var backdropInertStep = {
|
|
23259
|
+
script: backdropInertRuntimeScript
|
|
23260
|
+
};
|
|
23261
|
+
|
|
23237
23262
|
function isTooltip({ _ }, step) {
|
|
23238
23263
|
const tooltip = 'tooltip';
|
|
23239
23264
|
return _.get(step, 'attributes.calculatedType') === tooltip ||
|
|
@@ -23391,6 +23416,7 @@ function registerPostrenderScripts(runtime) {
|
|
|
23391
23416
|
advanceOnElement,
|
|
23392
23417
|
announcementMarkSeen,
|
|
23393
23418
|
autofocusStep,
|
|
23419
|
+
backdropInertStep,
|
|
23394
23420
|
repositionOnScroll,
|
|
23395
23421
|
setFocusToActivationElement$1,
|
|
23396
23422
|
videoLoadingAttribute
|
|
@@ -24647,7 +24673,8 @@ var loadGuides = function (apiKey, visitorId, page, callback) {
|
|
|
24647
24673
|
visitorId,
|
|
24648
24674
|
accountId: get_account_id(),
|
|
24649
24675
|
url: page,
|
|
24650
|
-
oldVisitorId: get_old_visitor_id()
|
|
24676
|
+
oldVisitorId: get_old_visitor_id(),
|
|
24677
|
+
timezoneOffset: (new Date()).getTimezoneOffset()
|
|
24651
24678
|
};
|
|
24652
24679
|
const reqId = _.uniqueId();
|
|
24653
24680
|
loadGuides.reqId = reqId;
|
|
@@ -29560,6 +29587,7 @@ var BuildingBlockGuides = (function () {
|
|
|
29560
29587
|
trapFocusStep,
|
|
29561
29588
|
attachRCFocusHandlers,
|
|
29562
29589
|
addAriaHiddenOutsideGuide,
|
|
29590
|
+
addInertOutsideGuide,
|
|
29563
29591
|
renderResourceCenterModule: BuildingBlockResourceCenter.renderResourceCenterModule,
|
|
29564
29592
|
buildNodeFromJSON,
|
|
29565
29593
|
attachImgLoadHandlers,
|
|
@@ -29627,6 +29655,7 @@ var BuildingBlockGuides = (function () {
|
|
|
29627
29655
|
}
|
|
29628
29656
|
var isAnnouncementModule = _.get(guide, 'attributes.resourceCenter.moduleId') === 'AnnouncementsModule';
|
|
29629
29657
|
step.hasEscapeListener = false;
|
|
29658
|
+
step.hasBackdrop = false;
|
|
29630
29659
|
step.containerId = containerJSON && containerJSON.props && containerJSON.props.id;
|
|
29631
29660
|
step.element = getElementForGuideStep(step, options.document);
|
|
29632
29661
|
var modifiableJSON = unwrapFirefoxObject(json);
|
|
@@ -29929,7 +29958,7 @@ var BuildingBlockGuides = (function () {
|
|
|
29929
29958
|
function trapFocusStep(step, guideContainer) {
|
|
29930
29959
|
var guideContainerElement = guideContainer.find('#pendo-guide-container');
|
|
29931
29960
|
var targetElement = _.get(step, 'attributes.blockOutUI.enabled') && getTargetElementForStep(step);
|
|
29932
|
-
trapFocus(guideContainerElement, targetElement);
|
|
29961
|
+
trapFocus(guideContainerElement, targetElement, step);
|
|
29933
29962
|
}
|
|
29934
29963
|
function getSelectedPollElementForFocus(focusableChildren, bumperElement) {
|
|
29935
29964
|
let elementToFocus;
|
|
@@ -29942,41 +29971,71 @@ var BuildingBlockGuides = (function () {
|
|
|
29942
29971
|
}
|
|
29943
29972
|
return elementToFocus || bumperElement;
|
|
29944
29973
|
}
|
|
29974
|
+
function isTabbable(element) {
|
|
29975
|
+
if (!isElementVisible(element))
|
|
29976
|
+
return false;
|
|
29977
|
+
if (element.tagName === 'IFRAME')
|
|
29978
|
+
return true;
|
|
29979
|
+
if (element.tabIndex >= 0 && !element.disabled)
|
|
29980
|
+
return true;
|
|
29981
|
+
var editable = element.getAttribute && element.getAttribute('contenteditable');
|
|
29982
|
+
return editable != null && editable !== 'false';
|
|
29983
|
+
}
|
|
29945
29984
|
function collectTargetFocusables(targetElement) {
|
|
29946
29985
|
if (!targetElement)
|
|
29947
29986
|
return [];
|
|
29948
|
-
var focusables =
|
|
29949
|
-
|
|
29950
|
-
|
|
29951
|
-
|
|
29987
|
+
var focusables = [];
|
|
29988
|
+
var collect = function (node) {
|
|
29989
|
+
if (node.nodeType === 1 && isTabbable(node)) {
|
|
29990
|
+
focusables.push(node);
|
|
29991
|
+
}
|
|
29992
|
+
if (node.shadowRoot) {
|
|
29993
|
+
_.each(node.shadowRoot.children, collect);
|
|
29994
|
+
}
|
|
29995
|
+
_.each(node.children, collect);
|
|
29996
|
+
};
|
|
29997
|
+
collect(targetElement);
|
|
29952
29998
|
return focusables;
|
|
29953
29999
|
}
|
|
29954
|
-
function
|
|
29955
|
-
var
|
|
29956
|
-
|
|
29957
|
-
|
|
29958
|
-
|
|
29959
|
-
|
|
29960
|
-
return bumper;
|
|
30000
|
+
function getDeepActiveElement() {
|
|
30001
|
+
var active = document.activeElement;
|
|
30002
|
+
while (active && active.shadowRoot && active.shadowRoot.activeElement) {
|
|
30003
|
+
active = active.shadowRoot.activeElement;
|
|
30004
|
+
}
|
|
30005
|
+
return active;
|
|
29961
30006
|
}
|
|
29962
|
-
function
|
|
29963
|
-
if (!
|
|
29964
|
-
return
|
|
29965
|
-
var
|
|
29966
|
-
|
|
29967
|
-
|
|
29968
|
-
|
|
29969
|
-
|
|
30007
|
+
function isWithinComposedTree(root, element) {
|
|
30008
|
+
if (!root || !element)
|
|
30009
|
+
return false;
|
|
30010
|
+
var node = element;
|
|
30011
|
+
while (node) {
|
|
30012
|
+
if (node.nodeType === 1 && root.contains(node))
|
|
30013
|
+
return true;
|
|
30014
|
+
var rootNode = dom.getRootNode(node);
|
|
30015
|
+
node = rootNode && rootNode.host;
|
|
30016
|
+
}
|
|
30017
|
+
return false;
|
|
29970
30018
|
}
|
|
29971
|
-
function
|
|
29972
|
-
|
|
29973
|
-
|
|
29974
|
-
|
|
29975
|
-
|
|
29976
|
-
|
|
30019
|
+
function isWithinAdditionalBlockOutAreas(element, step) {
|
|
30020
|
+
var selectors = _.get(step, 'attributes.blockOutUI.additionalElements');
|
|
30021
|
+
if (!_.isString(selectors) || !selectors.length)
|
|
30022
|
+
return false;
|
|
30023
|
+
return _.some(selectors.replace(/\s/g, '').split(','), function (selector) {
|
|
30024
|
+
if (!selector)
|
|
30025
|
+
return false;
|
|
30026
|
+
var areas;
|
|
30027
|
+
try {
|
|
30028
|
+
areas = dom(selector);
|
|
30029
|
+
}
|
|
30030
|
+
catch (e) {
|
|
30031
|
+
return false;
|
|
30032
|
+
}
|
|
30033
|
+
return _.some(areas, function (area) {
|
|
30034
|
+
return isWithinComposedTree(area, element);
|
|
30035
|
+
});
|
|
29977
30036
|
});
|
|
29978
30037
|
}
|
|
29979
|
-
function trapFocus(guideContainerElement, targetElement) {
|
|
30038
|
+
function trapFocus(guideContainerElement, targetElement, step) {
|
|
29980
30039
|
var containerNode = guideContainerElement[0];
|
|
29981
30040
|
if (!containerNode) {
|
|
29982
30041
|
return;
|
|
@@ -30007,18 +30066,16 @@ var BuildingBlockGuides = (function () {
|
|
|
30007
30066
|
var bumpers = insertTrapFocusBumpers(guideContainerElement);
|
|
30008
30067
|
var startFocusBumper = bumpers[0];
|
|
30009
30068
|
var endFocusBumper = bumpers[1];
|
|
30010
|
-
var
|
|
30011
|
-
|
|
30012
|
-
|
|
30013
|
-
|
|
30014
|
-
|
|
30015
|
-
|
|
30016
|
-
|
|
30017
|
-
|
|
30018
|
-
|
|
30019
|
-
|
|
30020
|
-
var wrapForward = firstTargetFocusable || firstFocusableEl;
|
|
30021
|
-
var wrapBackward = lastTargetFocusable || lastFocusableEl;
|
|
30069
|
+
var isOutsideTrap = function (element) {
|
|
30070
|
+
var guideRoot = step && step.guideElement && step.guideElement[0];
|
|
30071
|
+
return !!element &&
|
|
30072
|
+
element !== document.body &&
|
|
30073
|
+
element !== document.documentElement &&
|
|
30074
|
+
!containerNode.contains(element) &&
|
|
30075
|
+
!(guideRoot && isWithinComposedTree(guideRoot, element)) &&
|
|
30076
|
+
!isWithinComposedTree(targetElement, element) &&
|
|
30077
|
+
!isWithinAdditionalBlockOutAreas(element, step);
|
|
30078
|
+
};
|
|
30022
30079
|
var trapFocusCallback = function (e) {
|
|
30023
30080
|
if (!isTabEvent(e)) {
|
|
30024
30081
|
return;
|
|
@@ -30031,34 +30088,31 @@ var BuildingBlockGuides = (function () {
|
|
|
30031
30088
|
const bodyActive = document.activeElement === document.body; // if the guide is in a shadow root but you click on the backdrop, the active element is the body of the main document
|
|
30032
30089
|
const startBumperActive = activeElement === startFocusBumper;
|
|
30033
30090
|
const endBumperActive = activeElement === endFocusBumper;
|
|
30034
|
-
const
|
|
30035
|
-
const
|
|
30036
|
-
const
|
|
30037
|
-
const onLastTargetFocusable = isKeydown &&
|
|
30038
|
-
|
|
30091
|
+
const deepActive = getDeepActiveElement();
|
|
30092
|
+
const targetFocusables = collectTargetFocusables(targetElement);
|
|
30093
|
+
const activeTargetIndex = deepActive ? targetFocusables.indexOf(deepActive) : -1;
|
|
30094
|
+
const onLastTargetFocusable = isKeydown && activeTargetIndex !== -1 &&
|
|
30095
|
+
activeTargetIndex === targetFocusables.length - 1;
|
|
30096
|
+
const onFirstTargetFocusable = isKeydown && activeTargetIndex === 0;
|
|
30039
30097
|
let elementToFocus;
|
|
30040
30098
|
if (isShiftPressed) {
|
|
30041
30099
|
if (onFirstTargetFocusable)
|
|
30042
30100
|
elementToFocus = lastFocusableEl;
|
|
30043
|
-
else if (
|
|
30044
|
-
elementToFocus = lastFocusableEl;
|
|
30045
|
-
|
|
30046
|
-
elementToFocus = lastTargetFocusable;
|
|
30047
|
-
else if (startBumperActive || containerActive || bodyActive)
|
|
30048
|
-
elementToFocus = wrapBackward;
|
|
30101
|
+
else if (startBumperActive || containerActive || bodyActive) {
|
|
30102
|
+
elementToFocus = targetFocusables[targetFocusables.length - 1] || lastFocusableEl;
|
|
30103
|
+
}
|
|
30049
30104
|
}
|
|
30050
30105
|
else {
|
|
30051
30106
|
if (onLastTargetFocusable)
|
|
30052
30107
|
elementToFocus = firstFocusableEl;
|
|
30053
|
-
else if (afterTargetBumperActive)
|
|
30054
|
-
elementToFocus = firstFocusableEl;
|
|
30055
|
-
else if (beforeTargetBumperActive)
|
|
30056
|
-
elementToFocus = firstTargetFocusable;
|
|
30057
30108
|
else if (endBumperActive)
|
|
30058
|
-
elementToFocus =
|
|
30109
|
+
elementToFocus = targetFocusables[0] || firstFocusableEl;
|
|
30059
30110
|
else if (containerActive || bodyActive)
|
|
30060
30111
|
elementToFocus = firstFocusableEl;
|
|
30061
30112
|
}
|
|
30113
|
+
if (!elementToFocus && targetFocusables.length && isOutsideTrap(deepActive)) {
|
|
30114
|
+
elementToFocus = isShiftPressed ? lastFocusableEl : firstFocusableEl;
|
|
30115
|
+
}
|
|
30062
30116
|
if (elementToFocus) {
|
|
30063
30117
|
const resolved = getSelectedPollElementForFocus(focusableChildren, elementToFocus);
|
|
30064
30118
|
resolved.focus();
|
|
@@ -30068,13 +30122,23 @@ var BuildingBlockGuides = (function () {
|
|
|
30068
30122
|
e.preventDefault();
|
|
30069
30123
|
}
|
|
30070
30124
|
};
|
|
30071
|
-
|
|
30125
|
+
var iframeExitCallback = function (e) {
|
|
30126
|
+
var fromTargetIframe = e.relatedTarget && e.relatedTarget.tagName === 'IFRAME' &&
|
|
30127
|
+
isWithinComposedTree(targetElement, e.relatedTarget);
|
|
30128
|
+
if (!fromTargetIframe || !isOutsideTrap(e.target))
|
|
30129
|
+
return;
|
|
30130
|
+
var exitedForward = !!(e.relatedTarget.compareDocumentPosition(e.target) & Node.DOCUMENT_POSITION_FOLLOWING);
|
|
30131
|
+
(exitedForward ? firstFocusableEl : lastFocusableEl).focus();
|
|
30132
|
+
};
|
|
30072
30133
|
attachEvent(document, 'keyup', trapFocusCallback);
|
|
30073
30134
|
attachEvent(document, 'keydown', trapFocusCallback);
|
|
30135
|
+
if (targetElement) {
|
|
30136
|
+
attachEvent(document, 'focusin', iframeExitCallback);
|
|
30137
|
+
}
|
|
30074
30138
|
Events.one('unmounted', () => {
|
|
30075
30139
|
detachEvent(document, 'keyup', trapFocusCallback);
|
|
30076
30140
|
detachEvent(document, 'keydown', trapFocusCallback);
|
|
30077
|
-
|
|
30141
|
+
detachEvent(document, 'focusin', iframeExitCallback);
|
|
30078
30142
|
});
|
|
30079
30143
|
}
|
|
30080
30144
|
// bumpers are divs with a tabindex to allow them to be focused, but which should immediately
|
|
@@ -30163,6 +30227,27 @@ var BuildingBlockGuides = (function () {
|
|
|
30163
30227
|
}
|
|
30164
30228
|
return hidden;
|
|
30165
30229
|
}
|
|
30230
|
+
function addInertOutsideGuide(elem, hidden = [], excludeElements = []) {
|
|
30231
|
+
if (!elem || elem === getBody())
|
|
30232
|
+
return hidden;
|
|
30233
|
+
const supportsInert = isNaN(msie);
|
|
30234
|
+
if (!supportsInert)
|
|
30235
|
+
return hidden;
|
|
30236
|
+
const siblings = getSiblings(elem);
|
|
30237
|
+
_.each(siblings, (s) => {
|
|
30238
|
+
const tagName = s.tagName.toLowerCase();
|
|
30239
|
+
const alreadyDisabled = s.getAttribute('inert') === 'true';
|
|
30240
|
+
const isExcluded = _.some(excludeElements, (excluded) => excluded && (s === excluded || s.contains(excluded)));
|
|
30241
|
+
if (hidden.indexOf(s) === -1 && !alreadyDisabled && !isExcluded && tagName !== 'script' && tagName !== 'style') {
|
|
30242
|
+
s.setAttribute('inert', 'true');
|
|
30243
|
+
hidden.push(s);
|
|
30244
|
+
}
|
|
30245
|
+
});
|
|
30246
|
+
if (elem.parentNode) {
|
|
30247
|
+
addInertOutsideGuide(elem.parentNode, hidden, excludeElements);
|
|
30248
|
+
}
|
|
30249
|
+
return hidden;
|
|
30250
|
+
}
|
|
30166
30251
|
function buildStyleString(styleObject) {
|
|
30167
30252
|
var styleString = '';
|
|
30168
30253
|
_.each(styleObject, function (styleValue, styleKey) {
|
|
@@ -32965,10 +33050,11 @@ function GuideStep(guide) {
|
|
|
32965
33050
|
try {
|
|
32966
33051
|
if (el && typeof el.removeAttribute === 'function') {
|
|
32967
33052
|
el.removeAttribute('aria-hidden');
|
|
33053
|
+
el.removeAttribute('inert');
|
|
32968
33054
|
}
|
|
32969
33055
|
}
|
|
32970
33056
|
catch (e) {
|
|
32971
|
-
log.error('unable to remove
|
|
33057
|
+
log.error('unable to remove attribute from element', { error: e });
|
|
32972
33058
|
}
|
|
32973
33059
|
});
|
|
32974
33060
|
this.hiddenElements.length = 0;
|
|
@@ -36486,6 +36572,7 @@ var DOMActivation = (function () {
|
|
|
36486
36572
|
}
|
|
36487
36573
|
})();
|
|
36488
36574
|
|
|
36575
|
+
const REPOSITION_PHASE = 'embeddedGuidesReposition';
|
|
36489
36576
|
const EmbeddedGuides = (function () {
|
|
36490
36577
|
let pluginApi;
|
|
36491
36578
|
let globalPendo;
|
|
@@ -36505,15 +36592,42 @@ const EmbeddedGuides = (function () {
|
|
|
36505
36592
|
GuideStepFactory.behaviors.push(EmbeddedGuideStep);
|
|
36506
36593
|
pluginApi.Events.on('deliverablesLoaded', initializeEmbeddedGuides);
|
|
36507
36594
|
pluginApi.Events.on('eventCaptured', eventCaptured);
|
|
36595
|
+
// APP-161235: embedded guides render as auto-display guides in the guide
|
|
36596
|
+
// loop, and their dynamic-height content can shift the document position
|
|
36597
|
+
// of elements that *other* guides' tooltips are anchored to (e.g. a badge
|
|
36598
|
+
// below the embed). This phase is appended after the built-in loop phases
|
|
36599
|
+
// (so it runs once the embed has rendered this pass) and re-anchors those
|
|
36600
|
+
// tooltips to the settled layout, instead of leaving them detached until a
|
|
36601
|
+
// later pass corrects them (visibly "floating" on a heavy loop).
|
|
36602
|
+
pluginApi.GuideLoop.addUpdatePhase(repositionGuidesAfterEmbedLayout, REPOSITION_PHASE);
|
|
36508
36603
|
}
|
|
36509
36604
|
function teardown() {
|
|
36510
36605
|
pluginApi.Events.off('deliverablesLoaded', initializeEmbeddedGuides);
|
|
36511
36606
|
pluginApi.Events.off('eventCaptured', eventCaptured);
|
|
36607
|
+
pluginApi.GuideLoop.removeUpdatePhase(REPOSITION_PHASE);
|
|
36512
36608
|
const index = GuideStepFactory.behaviors.indexOf(EmbeddedGuideStep);
|
|
36513
36609
|
if (index !== -1) {
|
|
36514
36610
|
GuideStepFactory.behaviors.splice(index, 1);
|
|
36515
36611
|
}
|
|
36516
36612
|
}
|
|
36613
|
+
function isShown(guide) {
|
|
36614
|
+
return !!(guide && _.isFunction(guide.isShown) && guide.isShown());
|
|
36615
|
+
}
|
|
36616
|
+
function repositionGuidesAfterEmbedLayout() {
|
|
36617
|
+
// Only run when one of our embedded guides is actually shown — the only
|
|
36618
|
+
// condition under which the embed's layout can displace other tooltips.
|
|
36619
|
+
if (!_.some(embeddedGuides, isShown))
|
|
36620
|
+
return;
|
|
36621
|
+
_.each(globalPendo.guides, function (guide) {
|
|
36622
|
+
if (isEmbedded(guide) || !isShown(guide))
|
|
36623
|
+
return;
|
|
36624
|
+
_.each(guide.steps, function (step) {
|
|
36625
|
+
if (_.isFunction(step.isShown) && step.isShown() && _.isFunction(step.checkPlacement)) {
|
|
36626
|
+
step.checkPlacement();
|
|
36627
|
+
}
|
|
36628
|
+
});
|
|
36629
|
+
});
|
|
36630
|
+
}
|
|
36517
36631
|
function eventCaptured(event) {
|
|
36518
36632
|
const capturedEvent = _.get(event, 'data.0');
|
|
36519
36633
|
if (!capturedEvent || capturedEvent.type !== 'guideSeen')
|
|
@@ -41209,7 +41323,8 @@ const channels = [
|
|
|
41209
41323
|
}]
|
|
41210
41324
|
];
|
|
41211
41325
|
const WEB_ANALYTICS_STORAGE_KEY = 'utm';
|
|
41212
|
-
const
|
|
41326
|
+
const ENABLE_FULL_REFERRER_CONFIG_KEY = 'enableFullUtmReferrer';
|
|
41327
|
+
const DISABLE_REFERRER_CONFIG_KEY = 'disableUtmReferrer';
|
|
41213
41328
|
class WebAnalytics {
|
|
41214
41329
|
constructor() {
|
|
41215
41330
|
this.name = 'WebAnalytics';
|
|
@@ -41218,7 +41333,11 @@ class WebAnalytics {
|
|
|
41218
41333
|
this.pendo = pendo;
|
|
41219
41334
|
this.api = PluginAPI;
|
|
41220
41335
|
const { ConfigReader } = PluginAPI;
|
|
41221
|
-
ConfigReader.addOption(
|
|
41336
|
+
ConfigReader.addOption(ENABLE_FULL_REFERRER_CONFIG_KEY, [
|
|
41337
|
+
ConfigReader.sources.SNIPPET_SRC,
|
|
41338
|
+
ConfigReader.sources.PENDO_CONFIG_SRC
|
|
41339
|
+
], false);
|
|
41340
|
+
ConfigReader.addOption(DISABLE_REFERRER_CONFIG_KEY, [
|
|
41222
41341
|
ConfigReader.sources.SNIPPET_SRC,
|
|
41223
41342
|
ConfigReader.sources.PENDO_CONFIG_SRC
|
|
41224
41343
|
], false);
|
|
@@ -41266,14 +41385,16 @@ class WebAnalytics {
|
|
|
41266
41385
|
content
|
|
41267
41386
|
};
|
|
41268
41387
|
utm.channel = this.calculateUtmChannel({ referrerValue, utm, gclid, fbclid });
|
|
41269
|
-
if (
|
|
41270
|
-
|
|
41271
|
-
|
|
41272
|
-
|
|
41273
|
-
|
|
41274
|
-
|
|
41275
|
-
|
|
41276
|
-
|
|
41388
|
+
if (!this.api.ConfigReader.get(DISABLE_REFERRER_CONFIG_KEY)) {
|
|
41389
|
+
if (referrer && this.api.ConfigReader.get(ENABLE_FULL_REFERRER_CONFIG_KEY)) {
|
|
41390
|
+
utm.referrer = referrer;
|
|
41391
|
+
}
|
|
41392
|
+
else if (referrerValue === 'self') {
|
|
41393
|
+
utm.referrer = currentHost;
|
|
41394
|
+
}
|
|
41395
|
+
else if (referrerValue !== 'direct') {
|
|
41396
|
+
utm.referrer = referrerValue;
|
|
41397
|
+
}
|
|
41277
41398
|
}
|
|
41278
41399
|
return utm;
|
|
41279
41400
|
}
|
|
@@ -41611,19 +41732,17 @@ function getDefaultExportFromCjs (x) {
|
|
|
41611
41732
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
41612
41733
|
}
|
|
41613
41734
|
|
|
41614
|
-
|
|
41615
|
-
|
|
41616
|
-
|
|
41617
|
-
|
|
41618
|
-
|
|
41619
|
-
function lookupGuideButtons(domJson, buttons) {
|
|
41620
|
-
if (buttons === void 0) { buttons = []; }
|
|
41735
|
+
const substitutionRegex = '\\{(?:\\s?)([^.\\s]?visitor|account|parentAccount)\\.([^|\\s/]*)(?:\\s?\\|\\s?([^}]+|[\\/s]+))?(?:\\s?\\/\\s?){1}\\}';
|
|
41736
|
+
const skipStepString = '{skipStep:* *(auto|\\d+)\\/}';
|
|
41737
|
+
const goToMiddleString = '(?!0)(\\d+)';
|
|
41738
|
+
const goToString = `({goto-${goToMiddleString}\\/})`;
|
|
41739
|
+
const containerSelector = '[id^="pendo-guide-container"]';
|
|
41740
|
+
function lookupGuideButtons(domJson, buttons = []) {
|
|
41621
41741
|
if (domJson.type === 'button' && domJson.actions) {
|
|
41622
41742
|
buttons.push(domJson);
|
|
41623
41743
|
}
|
|
41624
41744
|
if (domJson.children) {
|
|
41625
|
-
for (
|
|
41626
|
-
var child = _a[_i];
|
|
41745
|
+
for (const child of domJson.children) {
|
|
41627
41746
|
lookupGuideButtons(child, buttons);
|
|
41628
41747
|
}
|
|
41629
41748
|
}
|
|
@@ -41650,16 +41769,15 @@ function removeMarkdownSyntax(element, textToReplace, replacementText, pendo) {
|
|
|
41650
41769
|
}
|
|
41651
41770
|
}
|
|
41652
41771
|
var guideMarkdownUtil = {
|
|
41653
|
-
substitutionRegex
|
|
41654
|
-
skipStepString
|
|
41655
|
-
goToString
|
|
41656
|
-
containerSelector
|
|
41657
|
-
lookupGuideButtons
|
|
41658
|
-
removeMarkdownSyntax
|
|
41772
|
+
substitutionRegex,
|
|
41773
|
+
skipStepString,
|
|
41774
|
+
goToString,
|
|
41775
|
+
containerSelector,
|
|
41776
|
+
lookupGuideButtons,
|
|
41777
|
+
removeMarkdownSyntax
|
|
41659
41778
|
};
|
|
41660
41779
|
|
|
41661
|
-
function getZoneSafeMethod(_, method, target) {
|
|
41662
|
-
if (target === void 0) { target = window; }
|
|
41780
|
+
function getZoneSafeMethod(_, method, target = window) {
|
|
41663
41781
|
var zoneSymbol = '__symbol__';
|
|
41664
41782
|
/* global Zone */
|
|
41665
41783
|
if (typeof Zone !== 'undefined' && _.isFunction(Zone[zoneSymbol])) {
|
|
@@ -41834,15 +41952,14 @@ function branchingGoToStep(event, step, guide, pendo) {
|
|
|
41834
41952
|
event.cancel = true;
|
|
41835
41953
|
}
|
|
41836
41954
|
|
|
41837
|
-
|
|
41838
|
-
function encodeMetadataForUrl(value, urlBeforePlaceholder) {
|
|
41839
|
-
|
|
41840
|
-
|
|
41841
|
-
var inUrlComponent = urlBeforePlaceholder.indexOf('?') !== -1 || urlBeforePlaceholder.indexOf('#') !== -1;
|
|
41955
|
+
const DANGEROUS_URL_SCHEME = /^\s*(javascript|data|vbscript):/i;
|
|
41956
|
+
function encodeMetadataForUrl(value, urlBeforePlaceholder = '') {
|
|
41957
|
+
const str = value === undefined || value === null ? '' : String(value);
|
|
41958
|
+
const inUrlComponent = urlBeforePlaceholder.indexOf('?') !== -1 || urlBeforePlaceholder.indexOf('#') !== -1;
|
|
41842
41959
|
if (inUrlComponent) {
|
|
41843
41960
|
return window.encodeURIComponent(str);
|
|
41844
41961
|
}
|
|
41845
|
-
|
|
41962
|
+
const schemeAlreadySet = urlBeforePlaceholder.indexOf(':') !== -1;
|
|
41846
41963
|
if (!schemeAlreadySet && DANGEROUS_URL_SCHEME.test(str)) {
|
|
41847
41964
|
return '';
|
|
41848
41965
|
}
|
|
@@ -49782,32 +49899,31 @@ var n;
|
|
|
49782
49899
|
}(n || (n = {}));
|
|
49783
49900
|
return record; }
|
|
49784
49901
|
|
|
49785
|
-
|
|
49786
|
-
|
|
49787
|
-
if (maxCount === void 0) { maxCount = Infinity; }
|
|
49902
|
+
class SessionRecorderBuffer {
|
|
49903
|
+
constructor(interval, maxCount = Infinity) {
|
|
49788
49904
|
this.data = [];
|
|
49789
49905
|
this.sequenceNumber = 0;
|
|
49790
49906
|
this.interval = interval;
|
|
49791
49907
|
this.maxCount = maxCount;
|
|
49792
49908
|
this.doubledMaxCount = maxCount * 2;
|
|
49793
49909
|
}
|
|
49794
|
-
|
|
49910
|
+
isEmpty() {
|
|
49795
49911
|
return this.data.length === 0;
|
|
49796
|
-
}
|
|
49797
|
-
|
|
49912
|
+
}
|
|
49913
|
+
count() {
|
|
49798
49914
|
return this.data.length;
|
|
49799
|
-
}
|
|
49800
|
-
|
|
49915
|
+
}
|
|
49916
|
+
clear() {
|
|
49801
49917
|
this.data.length = 0;
|
|
49802
|
-
}
|
|
49803
|
-
|
|
49918
|
+
}
|
|
49919
|
+
clearSequence() {
|
|
49804
49920
|
this.sequenceNumber = 0;
|
|
49805
|
-
}
|
|
49806
|
-
|
|
49921
|
+
}
|
|
49922
|
+
push(event) {
|
|
49807
49923
|
this.data.push(event);
|
|
49808
49924
|
this.checkRateLimit();
|
|
49809
|
-
}
|
|
49810
|
-
|
|
49925
|
+
}
|
|
49926
|
+
pack(envelope, _) {
|
|
49811
49927
|
var eventsToSend = this.data.splice(0, this.maxCount);
|
|
49812
49928
|
envelope.recordingPayload = eventsToSend;
|
|
49813
49929
|
envelope.sequence = this.sequenceNumber;
|
|
@@ -49815,8 +49931,8 @@ var SessionRecorderBuffer = /** @class */ (function () {
|
|
|
49815
49931
|
if (eventsToSend.length) {
|
|
49816
49932
|
envelope.browserTime = eventsToSend[0].timestamp;
|
|
49817
49933
|
}
|
|
49818
|
-
envelope.recordingPayloadMetadata = _.map(eventsToSend,
|
|
49819
|
-
|
|
49934
|
+
envelope.recordingPayloadMetadata = _.map(eventsToSend, event => {
|
|
49935
|
+
const metadata = _.pick(event, 'type', 'timestamp');
|
|
49820
49936
|
if (event.data) {
|
|
49821
49937
|
metadata.data = _.pick(event.data, 'source', 'type', 'x', 'y', 'id', 'height', 'width', 'href');
|
|
49822
49938
|
}
|
|
@@ -49824,18 +49940,17 @@ var SessionRecorderBuffer = /** @class */ (function () {
|
|
|
49824
49940
|
});
|
|
49825
49941
|
this.sequenceNumber += eventsToSend.length;
|
|
49826
49942
|
return envelope;
|
|
49827
|
-
}
|
|
49828
|
-
|
|
49829
|
-
|
|
49943
|
+
}
|
|
49944
|
+
checkRateLimit() {
|
|
49945
|
+
const length = this.data.length;
|
|
49830
49946
|
if (length >= this.doubledMaxCount && length % this.maxCount === 0) {
|
|
49831
|
-
|
|
49947
|
+
const elapsed = this.data[length - 1].timestamp - this.data[length - this.doubledMaxCount].timestamp;
|
|
49832
49948
|
if (elapsed <= this.interval && this.onRateLimit) {
|
|
49833
49949
|
this.onRateLimit();
|
|
49834
49950
|
}
|
|
49835
49951
|
}
|
|
49836
|
-
}
|
|
49837
|
-
|
|
49838
|
-
}());
|
|
49952
|
+
}
|
|
49953
|
+
}
|
|
49839
49954
|
|
|
49840
49955
|
function __rest(s, e) {
|
|
49841
49956
|
var t = {};
|
|
@@ -49859,52 +49974,24 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
49859
49974
|
});
|
|
49860
49975
|
}
|
|
49861
49976
|
|
|
49862
|
-
function __generator(thisArg, body) {
|
|
49863
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
49864
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
49865
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
49866
|
-
function step(op) {
|
|
49867
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
49868
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
49869
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
49870
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
49871
|
-
switch (op[0]) {
|
|
49872
|
-
case 0: case 1: t = op; break;
|
|
49873
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
49874
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
49875
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
49876
|
-
default:
|
|
49877
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
49878
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
49879
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
49880
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
49881
|
-
if (t[2]) _.ops.pop();
|
|
49882
|
-
_.trys.pop(); continue;
|
|
49883
|
-
}
|
|
49884
|
-
op = body.call(thisArg, _);
|
|
49885
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
49886
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
49887
|
-
}
|
|
49888
|
-
}
|
|
49889
|
-
|
|
49890
49977
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
49891
49978
|
var e = new Error(message);
|
|
49892
49979
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
49893
49980
|
};
|
|
49894
49981
|
|
|
49895
|
-
|
|
49896
|
-
|
|
49897
|
-
|
|
49898
|
-
|
|
49899
|
-
|
|
49982
|
+
const RECORDING_CONFIG_WORKERURL$1 = 'recording.workerUrl';
|
|
49983
|
+
const MAX_SIZE = 2000000;
|
|
49984
|
+
const RESOURCE_CACHING$1 = 'resourceCaching';
|
|
49985
|
+
class Transport {
|
|
49986
|
+
constructor(WorkerClass, pendo, api) {
|
|
49900
49987
|
this.WorkerClass = WorkerClass;
|
|
49901
49988
|
this.pendo = pendo;
|
|
49902
49989
|
this.api = api;
|
|
49903
49990
|
this.maxSize = MAX_SIZE;
|
|
49904
|
-
this.lockID =
|
|
49991
|
+
this.lockID = `worker-lock-${this.pendo.randomString(16)}`;
|
|
49905
49992
|
this.isResourceCachingEnabled = this.api.ConfigReader.get(RESOURCE_CACHING$1);
|
|
49906
49993
|
}
|
|
49907
|
-
|
|
49994
|
+
start(config) {
|
|
49908
49995
|
if (config.disableWorker)
|
|
49909
49996
|
return;
|
|
49910
49997
|
if (!this.worker) {
|
|
@@ -49914,7 +50001,7 @@ var Transport = /** @class */ (function () {
|
|
|
49914
50001
|
this.worker = config.workerOverride;
|
|
49915
50002
|
}
|
|
49916
50003
|
else {
|
|
49917
|
-
|
|
50004
|
+
const workerUrl = this.api.ConfigReader.get(RECORDING_CONFIG_WORKERURL$1);
|
|
49918
50005
|
this.usesSelfHostedWorker = workerUrl != null;
|
|
49919
50006
|
this.worker = workerUrl ? new Worker(workerUrl) : new this.WorkerClass();
|
|
49920
50007
|
}
|
|
@@ -49928,35 +50015,34 @@ var Transport = /** @class */ (function () {
|
|
|
49928
50015
|
this.worker = null;
|
|
49929
50016
|
}
|
|
49930
50017
|
}
|
|
49931
|
-
}
|
|
49932
|
-
|
|
50018
|
+
}
|
|
50019
|
+
stop() {
|
|
49933
50020
|
if (this.worker) {
|
|
49934
50021
|
this.worker.terminate();
|
|
49935
50022
|
delete this.worker;
|
|
49936
50023
|
}
|
|
49937
|
-
}
|
|
49938
|
-
|
|
49939
|
-
|
|
49940
|
-
|
|
49941
|
-
var payload = envelope.payload;
|
|
50024
|
+
}
|
|
50025
|
+
send(envelope, isUnload, failureCount = 0) {
|
|
50026
|
+
let { url } = envelope;
|
|
50027
|
+
const { payload } = envelope;
|
|
49942
50028
|
if (failureCount > 0) {
|
|
49943
|
-
url =
|
|
50029
|
+
url = `${url}&rt=${failureCount}`;
|
|
49944
50030
|
}
|
|
49945
50031
|
if (this.worker && !isUnload && payload) {
|
|
49946
|
-
|
|
49947
|
-
|
|
49948
|
-
|
|
49949
|
-
|
|
50032
|
+
const deferred = {};
|
|
50033
|
+
deferred.promise = new Promise$2((resolve, reject) => {
|
|
50034
|
+
deferred.resolve = resolve;
|
|
50035
|
+
deferred.reject = reject;
|
|
49950
50036
|
});
|
|
49951
|
-
this.workerResponse =
|
|
49952
|
-
this.worker.postMessage({ url
|
|
49953
|
-
return
|
|
50037
|
+
this.workerResponse = deferred;
|
|
50038
|
+
this.worker.postMessage({ url, payload, shouldCacheResources: this.isResourceCachingEnabled });
|
|
50039
|
+
return deferred.promise;
|
|
49954
50040
|
}
|
|
49955
50041
|
else {
|
|
49956
50042
|
if (!envelope.body) {
|
|
49957
|
-
|
|
50043
|
+
const strPayload = JSON.stringify(payload);
|
|
49958
50044
|
if (strPayload.length > this.maxSize) {
|
|
49959
|
-
|
|
50045
|
+
const error = new Error('maximum recording payload size exceeded');
|
|
49960
50046
|
error.reason = 'HEAVY_EVENT';
|
|
49961
50047
|
error.context = {
|
|
49962
50048
|
size: strPayload.length,
|
|
@@ -49967,14 +50053,14 @@ var Transport = /** @class */ (function () {
|
|
|
49967
50053
|
envelope.body = this.pendo.compress(strPayload, 'binary');
|
|
49968
50054
|
delete envelope.payload;
|
|
49969
50055
|
}
|
|
49970
|
-
url =
|
|
50056
|
+
url = `${url}&ct=${new Date().getTime()}`;
|
|
49971
50057
|
return this.post(url, {
|
|
49972
50058
|
keepalive: isUnload,
|
|
49973
50059
|
body: envelope.body
|
|
49974
50060
|
});
|
|
49975
50061
|
}
|
|
49976
|
-
}
|
|
49977
|
-
|
|
50062
|
+
}
|
|
50063
|
+
post(url, options) {
|
|
49978
50064
|
options.method = 'POST';
|
|
49979
50065
|
if (options.keepalive && this.api.transmit.fetchKeepalive.supported()) {
|
|
49980
50066
|
return this.api.transmit.fetchKeepalive(url, options);
|
|
@@ -49986,57 +50072,46 @@ var Transport = /** @class */ (function () {
|
|
|
49986
50072
|
else {
|
|
49987
50073
|
return this.pendo.ajax.post(url, options.body);
|
|
49988
50074
|
}
|
|
49989
|
-
}
|
|
49990
|
-
|
|
49991
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
49992
|
-
|
|
49993
|
-
|
|
49994
|
-
|
|
49995
|
-
|
|
49996
|
-
|
|
49997
|
-
|
|
49998
|
-
|
|
49999
|
-
|
|
50000
|
-
|
|
50001
|
-
|
|
50002
|
-
|
|
50003
|
-
|
|
50004
|
-
|
|
50005
|
-
|
|
50006
|
-
|
|
50007
|
-
return [2 /*return*/];
|
|
50008
|
-
}
|
|
50009
|
-
// handle POST request response from worker
|
|
50010
|
-
if (messageEvent.data && messageEvent.data.error) {
|
|
50011
|
-
if ((messageEvent.data.status && messageEvent.data.status < 500) ||
|
|
50012
|
-
messageEvent.data.sequence == null) {
|
|
50013
|
-
this.api.log.critical('Failed to send recording data from web worker', { error: messageEvent.data.error });
|
|
50014
|
-
}
|
|
50015
|
-
if (this.workerResponse) {
|
|
50016
|
-
this.workerResponse.reject();
|
|
50017
|
-
this.workerResponse = null;
|
|
50018
|
-
}
|
|
50019
|
-
}
|
|
50020
|
-
if (this.workerResponse) {
|
|
50021
|
-
this.workerResponse.resolve();
|
|
50022
|
-
this.workerResponse = null;
|
|
50023
|
-
}
|
|
50024
|
-
return [2 /*return*/];
|
|
50075
|
+
}
|
|
50076
|
+
_onMessage(messageEvent) {
|
|
50077
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50078
|
+
if (messageEvent.data && messageEvent.data.ready && navigator.locks) {
|
|
50079
|
+
// When the lock is released, we can assume the worker was terminated or closed
|
|
50080
|
+
yield navigator.locks.request(this.lockID, () => { });
|
|
50081
|
+
this.onWorkerMessage({ type: 'workerDied' });
|
|
50082
|
+
}
|
|
50083
|
+
// handle non-POST request responses from worker
|
|
50084
|
+
if (messageEvent.data && messageEvent.data.type) {
|
|
50085
|
+
this.onWorkerMessage(messageEvent.data);
|
|
50086
|
+
return;
|
|
50087
|
+
}
|
|
50088
|
+
// handle POST request response from worker
|
|
50089
|
+
if (messageEvent.data && messageEvent.data.error) {
|
|
50090
|
+
if ((messageEvent.data.status && messageEvent.data.status < 500) ||
|
|
50091
|
+
messageEvent.data.sequence == null) {
|
|
50092
|
+
this.api.log.critical('Failed to send recording data from web worker', { error: messageEvent.data.error });
|
|
50025
50093
|
}
|
|
50026
|
-
|
|
50094
|
+
if (this.workerResponse) {
|
|
50095
|
+
this.workerResponse.reject();
|
|
50096
|
+
this.workerResponse = null;
|
|
50097
|
+
}
|
|
50098
|
+
}
|
|
50099
|
+
if (this.workerResponse) {
|
|
50100
|
+
this.workerResponse.resolve();
|
|
50101
|
+
this.workerResponse = null;
|
|
50102
|
+
}
|
|
50027
50103
|
});
|
|
50028
|
-
}
|
|
50029
|
-
|
|
50104
|
+
}
|
|
50105
|
+
_onError() {
|
|
50030
50106
|
if (this.onError) {
|
|
50031
50107
|
this.onError();
|
|
50032
50108
|
}
|
|
50033
|
-
}
|
|
50034
|
-
|
|
50035
|
-
}());
|
|
50109
|
+
}
|
|
50110
|
+
}
|
|
50036
50111
|
|
|
50037
|
-
|
|
50038
|
-
|
|
50039
|
-
|
|
50112
|
+
const ELEMENT_NODE = 1;
|
|
50113
|
+
const INPUT_MASK = '*'.repeat(10);
|
|
50114
|
+
const NUMBER_INPUT_MASK = '0'.repeat(10);
|
|
50040
50115
|
function isElementNode(node) {
|
|
50041
50116
|
if (!node)
|
|
50042
50117
|
return false;
|
|
@@ -50045,12 +50120,10 @@ function isElementNode(node) {
|
|
|
50045
50120
|
return true;
|
|
50046
50121
|
}
|
|
50047
50122
|
function getParent(elem) {
|
|
50048
|
-
|
|
50123
|
+
const isElementShadowRoot = typeof window.ShadowRoot !== 'undefined' && elem instanceof window.ShadowRoot && elem.host;
|
|
50049
50124
|
return isElementShadowRoot ? elem.host : elem.parentNode;
|
|
50050
50125
|
}
|
|
50051
|
-
function distanceToMatch(node, selector, limit, distance) {
|
|
50052
|
-
if (limit === void 0) { limit = Infinity; }
|
|
50053
|
-
if (distance === void 0) { distance = 0; }
|
|
50126
|
+
function distanceToMatch(node, selector, limit = Infinity, distance = 0) {
|
|
50054
50127
|
if (distance > limit)
|
|
50055
50128
|
return -1;
|
|
50056
50129
|
if (!node)
|
|
@@ -50064,15 +50137,15 @@ function distanceToMatch(node, selector, limit, distance) {
|
|
|
50064
50137
|
return distanceToMatch(getParent(node), selector, limit, distance + 1);
|
|
50065
50138
|
}
|
|
50066
50139
|
function shouldMask(node, options) {
|
|
50067
|
-
|
|
50140
|
+
const { maskAllText, maskTextSelector, unmaskTextSelector } = options;
|
|
50068
50141
|
try {
|
|
50069
|
-
|
|
50142
|
+
const el = isElementNode(node) ? node : node.parentElement;
|
|
50070
50143
|
if (el === null)
|
|
50071
50144
|
return false;
|
|
50072
50145
|
if ((el.tagName || '').toUpperCase() === 'STYLE')
|
|
50073
50146
|
return false;
|
|
50074
|
-
|
|
50075
|
-
|
|
50147
|
+
let maskDistance = -1;
|
|
50148
|
+
let unmaskDistance = -1;
|
|
50076
50149
|
if (maskAllText) {
|
|
50077
50150
|
unmaskDistance = distanceToMatch(el, unmaskTextSelector);
|
|
50078
50151
|
if (unmaskDistance < 0) {
|
|
@@ -50105,8 +50178,8 @@ function isNumberInput(element) {
|
|
|
50105
50178
|
}
|
|
50106
50179
|
function shouldMaskInput(element, maskInputOptions) {
|
|
50107
50180
|
if (maskInputOptions && isElementNode(element)) {
|
|
50108
|
-
|
|
50109
|
-
|
|
50181
|
+
const tagName = (element.tagName || '').toLowerCase();
|
|
50182
|
+
const type = (element.type || '').toLowerCase();
|
|
50110
50183
|
if (maskInputOptions[tagName] || maskInputOptions[type]) {
|
|
50111
50184
|
return true;
|
|
50112
50185
|
}
|
|
@@ -51745,12 +51818,12 @@ function createReplayPlugin() {
|
|
|
51745
51818
|
* limit of number of keys in an object
|
|
51746
51819
|
* if an object contains more keys than this limit, we would call its toString function directly
|
|
51747
51820
|
*/
|
|
51748
|
-
|
|
51821
|
+
const NUM_OF_KEYS_LIMIT = 50;
|
|
51749
51822
|
/**
|
|
51750
51823
|
* limit number of depth in an object
|
|
51751
51824
|
* if an object is too deep, toString process may cause browser OOM
|
|
51752
51825
|
*/
|
|
51753
|
-
|
|
51826
|
+
const DEPTH_OF_LIMIT = 4;
|
|
51754
51827
|
/**
|
|
51755
51828
|
* serialize an HTML element by creating a shallow clone of it with text content
|
|
51756
51829
|
* and return the resulting outerHTML string (without the subtree)
|
|
@@ -51761,8 +51834,8 @@ function serializeHTML(node) {
|
|
|
51761
51834
|
if (!node || node.nodeType !== node.ELEMENT_NODE) {
|
|
51762
51835
|
return '';
|
|
51763
51836
|
}
|
|
51764
|
-
|
|
51765
|
-
|
|
51837
|
+
const nodeClone = node.cloneNode(false);
|
|
51838
|
+
const { textContent } = node;
|
|
51766
51839
|
if (textContent) {
|
|
51767
51840
|
nodeClone.textContent = textContent;
|
|
51768
51841
|
}
|
|
@@ -51776,7 +51849,7 @@ function isObject(obj) {
|
|
|
51776
51849
|
return false;
|
|
51777
51850
|
if (typeof obj !== 'object')
|
|
51778
51851
|
return false;
|
|
51779
|
-
|
|
51852
|
+
const proto = Object.getPrototypeOf(obj);
|
|
51780
51853
|
return proto === Object.prototype || proto === null;
|
|
51781
51854
|
}
|
|
51782
51855
|
/**
|
|
@@ -51785,11 +51858,11 @@ function isObject(obj) {
|
|
|
51785
51858
|
function isObjTooDeep(obj, limit) {
|
|
51786
51859
|
if (limit === 0)
|
|
51787
51860
|
return true;
|
|
51788
|
-
|
|
51861
|
+
const keys = Object.keys(obj);
|
|
51789
51862
|
if (keys.length === 0)
|
|
51790
51863
|
return false;
|
|
51791
|
-
return keys.some(
|
|
51792
|
-
|
|
51864
|
+
return keys.some(key => {
|
|
51865
|
+
const value = obj[key];
|
|
51793
51866
|
return isObject(value) && isObjTooDeep(value, limit - 1);
|
|
51794
51867
|
});
|
|
51795
51868
|
}
|
|
@@ -51805,7 +51878,7 @@ function shouldIgnore(_obj) {
|
|
|
51805
51878
|
return false;
|
|
51806
51879
|
}
|
|
51807
51880
|
// out of keys limit
|
|
51808
|
-
|
|
51881
|
+
const keys = Object.keys(_obj);
|
|
51809
51882
|
if (keys.length > NUM_OF_KEYS_LIMIT) {
|
|
51810
51883
|
return true;
|
|
51811
51884
|
}
|
|
@@ -51837,7 +51910,7 @@ function stringify(arg) {
|
|
|
51837
51910
|
return value.toString ? value.toString() : '[object Object]';
|
|
51838
51911
|
}
|
|
51839
51912
|
if (value instanceof ArrayBuffer)
|
|
51840
|
-
return
|
|
51913
|
+
return `ArrayBuffer { byteLength: ${value.byteLength} }`;
|
|
51841
51914
|
if (value instanceof Error)
|
|
51842
51915
|
return value.name + ': ' + value.message;
|
|
51843
51916
|
if (value instanceof Node) {
|
|
@@ -51845,10 +51918,10 @@ function stringify(arg) {
|
|
|
51845
51918
|
}
|
|
51846
51919
|
// Handle events
|
|
51847
51920
|
if (value instanceof Event) {
|
|
51848
|
-
|
|
51921
|
+
const eventResult = {};
|
|
51849
51922
|
// eslint-disable-next-line guard-for-in
|
|
51850
|
-
for (
|
|
51851
|
-
|
|
51923
|
+
for (const eventKey in value) {
|
|
51924
|
+
const eventValue = value[eventKey];
|
|
51852
51925
|
eventResult[eventKey] = Array.isArray(eventValue) && eventValue[0] instanceof HTMLElement
|
|
51853
51926
|
? serializeHTML(eventValue[0])
|
|
51854
51927
|
: eventValue;
|
|
@@ -51859,31 +51932,30 @@ function stringify(arg) {
|
|
|
51859
51932
|
});
|
|
51860
51933
|
}
|
|
51861
51934
|
|
|
51862
|
-
|
|
51863
|
-
|
|
51935
|
+
class StackFrame {
|
|
51936
|
+
constructor(obj) {
|
|
51864
51937
|
this.fileName = obj.fileName || '';
|
|
51865
51938
|
this.functionName = obj.functionName || '';
|
|
51866
51939
|
this.lineNumber = obj.lineNumber;
|
|
51867
51940
|
this.columnNumber = obj.columnNumber;
|
|
51868
51941
|
}
|
|
51869
|
-
|
|
51870
|
-
|
|
51942
|
+
toString() {
|
|
51943
|
+
const { fileName, functionName, lineNumber = '', columnNumber = '' } = this;
|
|
51871
51944
|
return functionName
|
|
51872
|
-
?
|
|
51873
|
-
:
|
|
51874
|
-
}
|
|
51875
|
-
|
|
51876
|
-
|
|
51877
|
-
|
|
51878
|
-
|
|
51879
|
-
|
|
51880
|
-
|
|
51881
|
-
|
|
51882
|
-
var ErrorStackParser = {
|
|
51945
|
+
? `${functionName} (${fileName}:${lineNumber}:${columnNumber})`
|
|
51946
|
+
: `${fileName}:${lineNumber}:${columnNumber}`;
|
|
51947
|
+
}
|
|
51948
|
+
}
|
|
51949
|
+
const FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
|
|
51950
|
+
const CHROME_EDGE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
|
|
51951
|
+
const SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/;
|
|
51952
|
+
const LOCATION_REGEXP = /(.+?)(?::(\d+))?(?::(\d+))?$/;
|
|
51953
|
+
const DEFAULT_NUM_FRAMES_TO_SKIP = 5;
|
|
51954
|
+
const ErrorStackParser = {
|
|
51883
51955
|
/**
|
|
51884
51956
|
* Given an Error object, extract the most information from it.
|
|
51885
51957
|
*/
|
|
51886
|
-
parse
|
|
51958
|
+
parse(error, maxFramesToSave) {
|
|
51887
51959
|
if (!(error === null || error === void 0 ? void 0 : error.stack))
|
|
51888
51960
|
return [];
|
|
51889
51961
|
// Chrome, Edge, Opera ≥15
|
|
@@ -51897,25 +51969,24 @@ var ErrorStackParser = {
|
|
|
51897
51969
|
return [];
|
|
51898
51970
|
},
|
|
51899
51971
|
// Separate line and column numbers from a string of the form: (URI:Line:Column)
|
|
51900
|
-
extractLocation
|
|
51972
|
+
extractLocation(urlLike) {
|
|
51901
51973
|
// Fail-fast but return locations like "(native)"
|
|
51902
51974
|
if (urlLike.indexOf(':') === -1) {
|
|
51903
51975
|
return [urlLike];
|
|
51904
51976
|
}
|
|
51905
|
-
|
|
51977
|
+
const parts = LOCATION_REGEXP.exec(urlLike.replace(/[()]/g, ''));
|
|
51906
51978
|
if (!parts)
|
|
51907
|
-
throw new Error(
|
|
51979
|
+
throw new Error(`Cannot parse given url: ${urlLike}`);
|
|
51908
51980
|
return [parts[1], parts[2] || undefined, parts[3] || undefined];
|
|
51909
51981
|
},
|
|
51910
|
-
parseHelper
|
|
51911
|
-
|
|
51912
|
-
|
|
51913
|
-
|
|
51914
|
-
|
|
51915
|
-
|
|
51916
|
-
|
|
51917
|
-
|
|
51918
|
-
var shouldSkipLine = (includeMatchedLine && !lineMatchesRegex) || // if line doesn't match regex and we want matched lines, skip it
|
|
51982
|
+
parseHelper({ regex, includeMatchedLine }, error, maxFramesToSave, callback) {
|
|
51983
|
+
const lines = error.stack.split('\n');
|
|
51984
|
+
const frames = [];
|
|
51985
|
+
let validFramesFound = 0;
|
|
51986
|
+
for (let i = 0; i < lines.length; i++) {
|
|
51987
|
+
const line = lines[i];
|
|
51988
|
+
const lineMatchesRegex = regex.test(line);
|
|
51989
|
+
const shouldSkipLine = (includeMatchedLine && !lineMatchesRegex) || // if line doesn't match regex and we want matched lines, skip it
|
|
51919
51990
|
(!includeMatchedLine && lineMatchesRegex); // if line does match regex but we don't want matched lines, skip it
|
|
51920
51991
|
if (shouldSkipLine)
|
|
51921
51992
|
continue;
|
|
@@ -51930,12 +52001,11 @@ var ErrorStackParser = {
|
|
|
51930
52001
|
}
|
|
51931
52002
|
return frames;
|
|
51932
52003
|
},
|
|
51933
|
-
parseChromiumStack
|
|
51934
|
-
|
|
51935
|
-
|
|
51936
|
-
var sanitizedLine;
|
|
52004
|
+
parseChromiumStack(error, maxFramesToSave) {
|
|
52005
|
+
return this.parseHelper({ regex: CHROME_EDGE_STACK_REGEXP, includeMatchedLine: true }, error, maxFramesToSave, (line, frames) => {
|
|
52006
|
+
let sanitizedLine;
|
|
51937
52007
|
if (line.indexOf('(eval ') > -1) {
|
|
51938
|
-
|
|
52008
|
+
const processedLine = line
|
|
51939
52009
|
.replace(/eval code/g, 'eval')
|
|
51940
52010
|
.replace(/(\(eval at [^()]*)|(\),.*$)/g, '');
|
|
51941
52011
|
sanitizedLine = processedLine.replace(/^\s+/, '').replace(/\(eval code/g, '(');
|
|
@@ -51945,7 +52015,7 @@ var ErrorStackParser = {
|
|
|
51945
52015
|
}
|
|
51946
52016
|
// capture and preserve the parenthesized location "(/foo/my bar.js:12:87)"
|
|
51947
52017
|
// in case it has spaces in it, as the string is split on \s+ later on
|
|
51948
|
-
|
|
52018
|
+
let location;
|
|
51949
52019
|
if (sanitizedLine.indexOf('(') > -1 && sanitizedLine.indexOf('):') > -1) {
|
|
51950
52020
|
location = sanitizedLine.match(/ (\((.+):(\d+):(\d+)\)$)/);
|
|
51951
52021
|
}
|
|
@@ -51953,23 +52023,22 @@ var ErrorStackParser = {
|
|
|
51953
52023
|
sanitizedLine = location
|
|
51954
52024
|
? sanitizedLine.replace(location[0], '')
|
|
51955
52025
|
: sanitizedLine;
|
|
51956
|
-
|
|
52026
|
+
const tokens = sanitizedLine.split(/\s+/).slice(1);
|
|
51957
52027
|
// if a location was matched, pass it to extractLocation() otherwise pop the last token
|
|
51958
|
-
|
|
51959
|
-
|
|
51960
|
-
|
|
52028
|
+
const locationParts = this.extractLocation(location ? location[1] : tokens.pop() || '');
|
|
52029
|
+
const functionName = tokens.join(' ') || undefined;
|
|
52030
|
+
const fileName = (locationParts[0] === 'eval' || locationParts[0] === '<anonymous>') ? undefined : locationParts[0];
|
|
51961
52031
|
frames.push(new StackFrame({
|
|
51962
|
-
functionName
|
|
51963
|
-
fileName
|
|
52032
|
+
functionName,
|
|
52033
|
+
fileName,
|
|
51964
52034
|
lineNumber: locationParts[1],
|
|
51965
52035
|
columnNumber: locationParts[2]
|
|
51966
52036
|
}));
|
|
51967
52037
|
});
|
|
51968
52038
|
},
|
|
51969
|
-
parseFirefoxSafariStack
|
|
51970
|
-
|
|
51971
|
-
|
|
51972
|
-
var processedLine = line;
|
|
52039
|
+
parseFirefoxSafariStack(error, maxFramesToSave) {
|
|
52040
|
+
return this.parseHelper({ regex: SAFARI_NATIVE_CODE_REGEXP, includeMatchedLine: false }, error, maxFramesToSave, (line, frames) => {
|
|
52041
|
+
let processedLine = line;
|
|
51973
52042
|
// Throw away eval information until we implement stacktrace.js/stackframe#8
|
|
51974
52043
|
if (processedLine.indexOf(' > eval') > -1) {
|
|
51975
52044
|
processedLine = processedLine.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ':$1');
|
|
@@ -51981,12 +52050,12 @@ var ErrorStackParser = {
|
|
|
51981
52050
|
}));
|
|
51982
52051
|
return;
|
|
51983
52052
|
}
|
|
51984
|
-
|
|
51985
|
-
|
|
51986
|
-
|
|
51987
|
-
|
|
52053
|
+
const functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
|
|
52054
|
+
const matches = processedLine.match(functionNameRegex);
|
|
52055
|
+
const functionName = matches && matches[1] ? matches[1] : undefined;
|
|
52056
|
+
const locationParts = this.extractLocation(processedLine.replace(functionNameRegex, ''));
|
|
51988
52057
|
frames.push(new StackFrame({
|
|
51989
|
-
functionName
|
|
52058
|
+
functionName,
|
|
51990
52059
|
fileName: locationParts[0],
|
|
51991
52060
|
lineNumber: locationParts[1],
|
|
51992
52061
|
columnNumber: locationParts[2]
|
|
@@ -55145,46 +55214,42 @@ var _ = /*@__PURE__*/getDefaultExportFromCjs(underscoreExports);
|
|
|
55145
55214
|
|
|
55146
55215
|
var encodeURIComponent = _.isFunction(window.encodeURIComponent) ? window.encodeURIComponent : _.identity;
|
|
55147
55216
|
|
|
55148
|
-
|
|
55149
|
-
|
|
55150
|
-
|
|
55151
|
-
|
|
55152
|
-
|
|
55153
|
-
|
|
55154
|
-
|
|
55155
|
-
|
|
55217
|
+
const PREDICT_STEP_REGEX = /\$\$predict\$\$/;
|
|
55218
|
+
const DRAG_THRESHOLD = 5;
|
|
55219
|
+
const STYLE_ID = 'pendo-predict-plugin-styles';
|
|
55220
|
+
const GUIDE_BUTTON_IDENTIFIER = 'button:contains("token")';
|
|
55221
|
+
const pluginVersion = '1.0.1';
|
|
55222
|
+
const PREDICT_SANDBOX_PAGE = 'predict-sandbox.html';
|
|
55223
|
+
const getPredictBaseUrl = (designerServer) => designerServer.replace('app', 'predict');
|
|
55224
|
+
const EXTENSION_ORIGIN_REGEX = /^(chrome|moz|safari-web)-extension:\/\//;
|
|
55156
55225
|
/**
|
|
55157
55226
|
* When running inside the Pendo Launcher extension, a host page's CSP `frame-src`
|
|
55158
55227
|
* blocks embedding predict.pendo.io directly. The extension ships a web-accessible
|
|
55159
55228
|
* `predict-sandbox.html` relay (exempt from the page CSP) that we frame instead, passing
|
|
55160
55229
|
* the real predict URL via `?target=`. assetHost is the extension origin in that context.
|
|
55161
55230
|
*/
|
|
55162
|
-
|
|
55231
|
+
const getFrameWrapperBase = (pendo) => {
|
|
55163
55232
|
var _a;
|
|
55164
|
-
|
|
55233
|
+
const assetHost = ((_a = pendo === null || pendo === void 0 ? void 0 : pendo.getConfigValue) === null || _a === void 0 ? void 0 : _a.call(pendo, 'assetHost')) || '';
|
|
55165
55234
|
return EXTENSION_ORIGIN_REGEX.test(assetHost) ? assetHost.replace(/\/$/, '') : '';
|
|
55166
55235
|
};
|
|
55167
55236
|
/**
|
|
55168
55237
|
* Builds the iframe `src`. Outside the extension this is the raw predict URL; inside it,
|
|
55169
55238
|
* the predict URL is passed as `?target=` to the extension's web-accessible relay page.
|
|
55170
55239
|
*/
|
|
55171
|
-
|
|
55172
|
-
return wrapperBase ? "".concat(wrapperBase, "/").concat(PREDICT_SANDBOX_PAGE, "?target=").concat(encodeURIComponent(url)) : url;
|
|
55173
|
-
};
|
|
55240
|
+
const buildFrameSrc = (url, wrapperBase) => wrapperBase ? `${wrapperBase}/${PREDICT_SANDBOX_PAGE}?target=${encodeURIComponent(url)}` : url;
|
|
55174
55241
|
/**
|
|
55175
55242
|
* Target origin for outbound postMessage. When wrapped, the relay frame is same-origin
|
|
55176
55243
|
* with the extension (`wrapperBase`), so we address it explicitly rather than broadcasting
|
|
55177
55244
|
* with '*' — keeping the auth token off any wildcard. Unwrapped, we post straight to predict.
|
|
55178
55245
|
*/
|
|
55179
|
-
|
|
55180
|
-
|
|
55181
|
-
|
|
55182
|
-
|
|
55183
|
-
|
|
55184
|
-
|
|
55185
|
-
|
|
55186
|
-
for (var i = 0; i < entries.length; i++) {
|
|
55187
|
-
var _a = entries[i], key = _a[0], value = _a[1];
|
|
55246
|
+
const getFrameTargetOrigin = (wrapperBase, predictBaseUrl) => wrapperBase || predictBaseUrl;
|
|
55247
|
+
const $ = (id) => document.getElementById(id);
|
|
55248
|
+
const createElement = (tag, attrs = {}, parent = null) => {
|
|
55249
|
+
const el = document.createElement(tag);
|
|
55250
|
+
const entries = Object.entries(attrs);
|
|
55251
|
+
for (let i = 0; i < entries.length; i++) {
|
|
55252
|
+
const [key, value] = entries[i];
|
|
55188
55253
|
if (key === 'className')
|
|
55189
55254
|
el.className = value;
|
|
55190
55255
|
else if (key === 'innerHTML')
|
|
@@ -55196,28 +55261,70 @@ var createElement = function (tag, attrs, parent) {
|
|
|
55196
55261
|
parent.appendChild(el);
|
|
55197
55262
|
return el;
|
|
55198
55263
|
};
|
|
55199
|
-
|
|
55200
|
-
|
|
55201
|
-
var styleId = "".concat(STYLE_ID, "-").concat(pendoContainerId);
|
|
55264
|
+
const injectStyles = (pendoContainerId, log = () => { }) => {
|
|
55265
|
+
const styleId = `${STYLE_ID}-${pendoContainerId}`;
|
|
55202
55266
|
if ($(styleId)) {
|
|
55203
|
-
log(
|
|
55267
|
+
log(`[predict] style already exists, skipping: ${styleId}`);
|
|
55204
55268
|
return;
|
|
55205
55269
|
}
|
|
55206
|
-
log(
|
|
55270
|
+
log(`[predict] injecting styles: ${styleId}`);
|
|
55207
55271
|
createElement('style', {
|
|
55208
55272
|
id: styleId,
|
|
55209
|
-
textContent:
|
|
55273
|
+
textContent: `
|
|
55274
|
+
#${pendoContainerId} {
|
|
55275
|
+
display: none !important;
|
|
55276
|
+
}
|
|
55277
|
+
.frame-explanation {
|
|
55278
|
+
aspect-ratio: 16/9; overflow: hidden; min-height: 300px;
|
|
55279
|
+
width: 100vw; height: 100vh; background: transparent;
|
|
55280
|
+
position: fixed; bottom: 0; right: 0; z-index: 1; border: none;
|
|
55281
|
+
visibility: hidden; opacity: 0; pointer-events: none;
|
|
55282
|
+
transition: opacity 0.1s ease-out, visibility 0s linear 0.1s;
|
|
55283
|
+
display: none;
|
|
55284
|
+
}
|
|
55285
|
+
.frame-explanation.is-visible {
|
|
55286
|
+
z-index: 999999;
|
|
55287
|
+
visibility: visible; opacity: 1; pointer-events: auto;
|
|
55288
|
+
transition: opacity 0.1s ease-out, visibility 0s linear 0s;
|
|
55289
|
+
}
|
|
55290
|
+
.frame-explanation.is-exists {
|
|
55291
|
+
display: block !important;
|
|
55292
|
+
}
|
|
55293
|
+
.floating-modal-container {
|
|
55294
|
+
position: fixed; top: 20px; right: 20px; z-index: 500000;
|
|
55295
|
+
visibility: hidden; opacity: 0; pointer-events: none;
|
|
55296
|
+
transition: opacity 0.1s ease-out, visibility 0s linear 0.1s;
|
|
55297
|
+
border-radius: 8px; box-shadow: 0px 4px 12px 0px rgba(0,0,0,0.15);
|
|
55298
|
+
overflow: hidden; width: 384px; height: 176px;
|
|
55299
|
+
}
|
|
55300
|
+
.floating-modal-container.is-visible {
|
|
55301
|
+
visibility: visible; opacity: 1; pointer-events: auto;
|
|
55302
|
+
transition: opacity 0.1s ease-out, visibility 0s linear 0s;
|
|
55303
|
+
}
|
|
55304
|
+
.floating-modal-container.is-dragging { will-change: left, top; }
|
|
55305
|
+
.floating-modal-drag-handle {
|
|
55306
|
+
position: absolute; left: 50%; transform: translateX(-50%);
|
|
55307
|
+
top: 5px; width: calc(100% - 46px); min-width: 166px; height: 17px;
|
|
55308
|
+
z-index: 9999; transition: left 0.2s ease, right 0.2s ease;
|
|
55309
|
+
display: flex; justify-content: center; align-items: center;
|
|
55310
|
+
}
|
|
55311
|
+
.floating-modal-drag-handle svg g { fill: #A0A0A0; }
|
|
55312
|
+
.floating-modal-drag-handle:hover { cursor: grab; }
|
|
55313
|
+
.floating-modal-drag-handle:hover svg g { fill: #1f2937; }
|
|
55314
|
+
.floating-modal-drag-handle.is-dragging { cursor: grabbing; }
|
|
55315
|
+
.floating-modal-drag-handle.is-collapsed { top: 0px; }
|
|
55316
|
+
.frame-floating-modal { width: 100%; height: 100%; background: white; border: none; display: block; }
|
|
55317
|
+
`
|
|
55210
55318
|
}, document.head);
|
|
55211
55319
|
};
|
|
55212
|
-
|
|
55320
|
+
const getRecordIdFromUrl = (recordRegex, log = () => { }) => {
|
|
55213
55321
|
var _a;
|
|
55214
|
-
|
|
55215
|
-
|
|
55216
|
-
|
|
55217
|
-
log("[predict] recordId found: ".concat(recordId));
|
|
55322
|
+
const match = window.location.href.match(recordRegex);
|
|
55323
|
+
const recordId = (_a = match === null || match === void 0 ? void 0 : match[1]) !== null && _a !== void 0 ? _a : null;
|
|
55324
|
+
log(`[predict] recordId found: ${recordId}`);
|
|
55218
55325
|
return recordId;
|
|
55219
55326
|
};
|
|
55220
|
-
|
|
55327
|
+
const safeStringify = (value, fallback) => {
|
|
55221
55328
|
try {
|
|
55222
55329
|
return JSON.stringify(value);
|
|
55223
55330
|
}
|
|
@@ -55225,22 +55332,21 @@ var safeStringify = function (value, fallback) {
|
|
|
55225
55332
|
return fallback !== null && fallback !== void 0 ? fallback : '';
|
|
55226
55333
|
}
|
|
55227
55334
|
};
|
|
55228
|
-
|
|
55229
|
-
if (log === void 0) { log = function () { }; }
|
|
55335
|
+
const safeParse = (value, fallback, log = () => { }) => {
|
|
55230
55336
|
try {
|
|
55231
55337
|
return JSON.parse(value);
|
|
55232
55338
|
}
|
|
55233
55339
|
catch (error) {
|
|
55234
|
-
log(
|
|
55340
|
+
log(`[predict] JSON parse error: ${error}`);
|
|
55235
55341
|
return fallback;
|
|
55236
55342
|
}
|
|
55237
55343
|
};
|
|
55238
|
-
|
|
55239
|
-
|
|
55240
|
-
|
|
55344
|
+
const buildQueryParams = (params) => {
|
|
55345
|
+
const urlParams = new URLSearchParams();
|
|
55346
|
+
const entries = Object.entries(params);
|
|
55241
55347
|
urlParams.set('pluginVersion', pluginVersion);
|
|
55242
|
-
for (
|
|
55243
|
-
|
|
55348
|
+
for (let i = 0; i < entries.length; i++) {
|
|
55349
|
+
const [key, value] = entries[i];
|
|
55244
55350
|
if (value != null) {
|
|
55245
55351
|
urlParams.set(key, typeof value === 'object' ? safeStringify(value) : String(value));
|
|
55246
55352
|
}
|
|
@@ -55248,17 +55354,17 @@ var buildQueryParams = function (params) {
|
|
|
55248
55354
|
return urlParams.toString();
|
|
55249
55355
|
};
|
|
55250
55356
|
// ----- Drag & Drop -----
|
|
55251
|
-
|
|
55252
|
-
|
|
55253
|
-
|
|
55254
|
-
|
|
55255
|
-
|
|
55256
|
-
|
|
55257
|
-
|
|
55258
|
-
|
|
55259
|
-
|
|
55260
|
-
|
|
55261
|
-
|
|
55357
|
+
const setupDragAndDrop = (handle, container, frameTargetOrigin) => {
|
|
55358
|
+
let isDragging = false;
|
|
55359
|
+
let hasMoved = false;
|
|
55360
|
+
let isCollapsed = false;
|
|
55361
|
+
let startX = 0;
|
|
55362
|
+
let startY = 0;
|
|
55363
|
+
let initialLeft = 0;
|
|
55364
|
+
let initialTop = 0;
|
|
55365
|
+
let rafId = null;
|
|
55366
|
+
const iframe = container.querySelector('iframe');
|
|
55367
|
+
const onMouseDown = (e) => {
|
|
55262
55368
|
if (e.button !== 0)
|
|
55263
55369
|
return;
|
|
55264
55370
|
e.preventDefault();
|
|
@@ -55268,35 +55374,35 @@ var setupDragAndDrop = function (handle, container, frameTargetOrigin) {
|
|
|
55268
55374
|
container.classList.add('is-dragging');
|
|
55269
55375
|
if (iframe)
|
|
55270
55376
|
iframe.style.pointerEvents = 'none';
|
|
55271
|
-
|
|
55377
|
+
const rect = container.getBoundingClientRect();
|
|
55272
55378
|
initialLeft = rect.left;
|
|
55273
55379
|
initialTop = rect.top;
|
|
55274
|
-
container.style.left =
|
|
55380
|
+
container.style.left = `${initialLeft}px`;
|
|
55275
55381
|
container.style.right = 'auto';
|
|
55276
55382
|
startX = e.clientX;
|
|
55277
55383
|
startY = e.clientY;
|
|
55278
55384
|
document.addEventListener('mousemove', onMouseMove);
|
|
55279
55385
|
document.addEventListener('mouseup', onMouseUp);
|
|
55280
55386
|
};
|
|
55281
|
-
|
|
55387
|
+
const onMouseMove = (e) => {
|
|
55282
55388
|
if (!isDragging)
|
|
55283
55389
|
return;
|
|
55284
|
-
|
|
55285
|
-
|
|
55390
|
+
const deltaX = e.clientX - startX;
|
|
55391
|
+
const deltaY = e.clientY - startY;
|
|
55286
55392
|
if (Math.abs(deltaX) > DRAG_THRESHOLD || Math.abs(deltaY) > DRAG_THRESHOLD) {
|
|
55287
55393
|
hasMoved = true;
|
|
55288
55394
|
}
|
|
55289
55395
|
if (rafId)
|
|
55290
55396
|
cancelAnimationFrame(rafId);
|
|
55291
|
-
rafId = requestAnimationFrame(
|
|
55292
|
-
|
|
55293
|
-
|
|
55294
|
-
|
|
55295
|
-
container.style.left =
|
|
55296
|
-
container.style.top =
|
|
55397
|
+
rafId = requestAnimationFrame(() => {
|
|
55398
|
+
const rect = container.getBoundingClientRect();
|
|
55399
|
+
const newLeft = Math.max(0, Math.min(initialLeft + deltaX, window.innerWidth - rect.width));
|
|
55400
|
+
const newTop = Math.max(0, Math.min(initialTop + deltaY, window.innerHeight - rect.height));
|
|
55401
|
+
container.style.left = `${newLeft}px`;
|
|
55402
|
+
container.style.top = `${newTop}px`;
|
|
55297
55403
|
});
|
|
55298
55404
|
};
|
|
55299
|
-
|
|
55405
|
+
const onMouseUp = (e) => {
|
|
55300
55406
|
var _a;
|
|
55301
55407
|
if (!isDragging)
|
|
55302
55408
|
return;
|
|
@@ -55314,12 +55420,12 @@ var setupDragAndDrop = function (handle, container, frameTargetOrigin) {
|
|
|
55314
55420
|
(_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage({ type: 'TRIGGER_EXPAND' }, frameTargetOrigin);
|
|
55315
55421
|
}
|
|
55316
55422
|
};
|
|
55317
|
-
handle.setCollapsedState =
|
|
55423
|
+
handle.setCollapsedState = (collapsed) => {
|
|
55318
55424
|
isCollapsed = collapsed;
|
|
55319
55425
|
handle.classList.toggle('is-collapsed', collapsed);
|
|
55320
55426
|
};
|
|
55321
55427
|
handle.addEventListener('mousedown', onMouseDown);
|
|
55322
|
-
handle.cleanup =
|
|
55428
|
+
handle.cleanup = () => {
|
|
55323
55429
|
handle.removeEventListener('mousedown', onMouseDown);
|
|
55324
55430
|
document.removeEventListener('mousemove', onMouseMove);
|
|
55325
55431
|
document.removeEventListener('mouseup', onMouseUp);
|
|
@@ -55329,13 +55435,12 @@ var setupDragAndDrop = function (handle, container, frameTargetOrigin) {
|
|
|
55329
55435
|
return handle;
|
|
55330
55436
|
};
|
|
55331
55437
|
// ----- Explanation Iframe Creation -----
|
|
55332
|
-
|
|
55333
|
-
var
|
|
55334
|
-
|
|
55335
|
-
|
|
55336
|
-
|
|
55337
|
-
|
|
55338
|
-
var params = buildQueryParams(configuration);
|
|
55438
|
+
const createExplanationIframe = ({ analysisId, recordId, configuration, predictBaseUrl, wrapperBase = '' }) => {
|
|
55439
|
+
var _a;
|
|
55440
|
+
const frameId = `frameExplanation-${analysisId}`;
|
|
55441
|
+
(_a = $(frameId)) === null || _a === void 0 ? void 0 : _a.remove();
|
|
55442
|
+
const base = `${predictBaseUrl}/external/analysis/${analysisId}/prediction/drilldown/${recordId}`;
|
|
55443
|
+
const params = buildQueryParams(configuration);
|
|
55339
55444
|
createElement('iframe', {
|
|
55340
55445
|
id: frameId,
|
|
55341
55446
|
className: 'frame-explanation',
|
|
@@ -55343,24 +55448,28 @@ var createExplanationIframe = function (_a) {
|
|
|
55343
55448
|
loading: 'lazy',
|
|
55344
55449
|
referrerPolicy: 'strict-origin-when-cross-origin',
|
|
55345
55450
|
allowFullscreen: true,
|
|
55346
|
-
src: buildFrameSrc(
|
|
55451
|
+
src: buildFrameSrc(`${base}?${params}`, wrapperBase)
|
|
55347
55452
|
}, document.body);
|
|
55348
55453
|
};
|
|
55349
55454
|
// ----- Floating Modal Creation -----
|
|
55350
|
-
|
|
55351
|
-
var
|
|
55352
|
-
|
|
55353
|
-
|
|
55354
|
-
|
|
55355
|
-
|
|
55356
|
-
}
|
|
55357
|
-
|
|
55358
|
-
var dragHandle = createElement('div', {
|
|
55455
|
+
const createFloatingModal = ({ recordId, configuration, predictBaseUrl, wrapperBase = '' }) => {
|
|
55456
|
+
var _a;
|
|
55457
|
+
const flatIds = (_a = configuration.analysisIds) === null || _a === void 0 ? void 0 : _a.flat(Infinity);
|
|
55458
|
+
for (let i = 0; i < flatIds.length; i++) {
|
|
55459
|
+
createExplanationIframe({ analysisId: flatIds[i], recordId, configuration, predictBaseUrl, wrapperBase });
|
|
55460
|
+
}
|
|
55461
|
+
const container = createElement('div', { id: 'floatingModalContainer', className: 'floating-modal-container' }, document.body);
|
|
55462
|
+
const dragHandle = createElement('div', {
|
|
55359
55463
|
className: 'floating-modal-drag-handle',
|
|
55360
|
-
innerHTML:
|
|
55464
|
+
innerHTML: `<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
|
|
55465
|
+
<g fill="#EBEBEB">
|
|
55466
|
+
<circle cx="3.33" cy="6" r="1.5"/><circle cx="8" cy="6" r="1.5"/><circle cx="12.67" cy="6" r="1.5"/>
|
|
55467
|
+
<circle cx="3.33" cy="10" r="1.5"/><circle cx="8" cy="10" r="1.5"/><circle cx="12.67" cy="10" r="1.5"/>
|
|
55468
|
+
</g>
|
|
55469
|
+
</svg>`
|
|
55361
55470
|
}, container);
|
|
55362
|
-
|
|
55363
|
-
|
|
55471
|
+
const baseUrl = `${predictBaseUrl}/external/analysis/prediction/summary/${recordId}`;
|
|
55472
|
+
const params = buildQueryParams(configuration);
|
|
55364
55473
|
createElement('iframe', {
|
|
55365
55474
|
id: 'frameFloatingModal',
|
|
55366
55475
|
className: 'frame-floating-modal',
|
|
@@ -55368,133 +55477,130 @@ var createFloatingModal = function (_a) {
|
|
|
55368
55477
|
referrerPolicy: 'strict-origin-when-cross-origin',
|
|
55369
55478
|
allowFullscreen: true,
|
|
55370
55479
|
title: 'Floating Modal',
|
|
55371
|
-
src: buildFrameSrc(
|
|
55480
|
+
src: buildFrameSrc(`${baseUrl}?${params}`, wrapperBase)
|
|
55372
55481
|
}, container);
|
|
55373
|
-
|
|
55482
|
+
const frameTargetOrigin = getFrameTargetOrigin(wrapperBase, predictBaseUrl);
|
|
55374
55483
|
container.dragHandle = setupDragAndDrop(dragHandle, container, frameTargetOrigin);
|
|
55375
|
-
return
|
|
55484
|
+
return () => {
|
|
55376
55485
|
var _a, _b;
|
|
55377
55486
|
(_b = (_a = container.dragHandle) === null || _a === void 0 ? void 0 : _a.cleanup) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
55378
55487
|
container.remove();
|
|
55379
|
-
for (
|
|
55380
|
-
|
|
55488
|
+
for (let i = 0; i < flatIds.length; i++) {
|
|
55489
|
+
const frame = $(`frameExplanation-${flatIds[i]}`);
|
|
55381
55490
|
if (frame)
|
|
55382
55491
|
frame.remove();
|
|
55383
55492
|
}
|
|
55384
55493
|
};
|
|
55385
55494
|
};
|
|
55386
|
-
|
|
55387
|
-
|
|
55388
|
-
|
|
55389
|
-
|
|
55390
|
-
|
|
55391
|
-
var _b;
|
|
55392
|
-
var origin = _a.origin, data = _a.data;
|
|
55495
|
+
const setupMessageListener = ({ token, forceAccountId, cleanup, pendo, predictBaseUrl, wrapperBase = '' }) => {
|
|
55496
|
+
const frameTargetOrigin = getFrameTargetOrigin(wrapperBase, predictBaseUrl);
|
|
55497
|
+
const isAllowedOrigin = (origin) => origin === predictBaseUrl || (!!wrapperBase && origin === wrapperBase);
|
|
55498
|
+
const messageHandler = ({ origin, data }) => {
|
|
55499
|
+
var _a;
|
|
55393
55500
|
if (!isAllowedOrigin(origin) || !data || typeof data !== 'object')
|
|
55394
55501
|
return;
|
|
55395
|
-
|
|
55396
|
-
|
|
55397
|
-
|
|
55398
|
-
|
|
55502
|
+
const { type, analysisId, height, width } = data;
|
|
55503
|
+
const explanationFrame = $(`frameExplanation-${analysisId}`);
|
|
55504
|
+
const floatingModal = $('floatingModalContainer');
|
|
55505
|
+
const setFloatingModalSize = () => {
|
|
55399
55506
|
if (floatingModal) {
|
|
55400
|
-
floatingModal.style.height =
|
|
55401
|
-
floatingModal.style.width =
|
|
55507
|
+
floatingModal.style.height = `${height}px`;
|
|
55508
|
+
floatingModal.style.width = `${width}px`;
|
|
55402
55509
|
}
|
|
55403
55510
|
};
|
|
55404
|
-
|
|
55511
|
+
const setFloatingModalCollapsedState = (collapsed) => {
|
|
55405
55512
|
var _a, _b;
|
|
55406
55513
|
if (floatingModal)
|
|
55407
55514
|
(_b = (_a = floatingModal.dragHandle) === null || _a === void 0 ? void 0 : _a.setCollapsedState) === null || _b === void 0 ? void 0 : _b.call(_a, collapsed);
|
|
55408
55515
|
};
|
|
55409
|
-
|
|
55410
|
-
MODAL_INITIALIZED:
|
|
55516
|
+
const actions = {
|
|
55517
|
+
MODAL_INITIALIZED: () => {
|
|
55411
55518
|
var _a, _b, _c;
|
|
55412
|
-
|
|
55519
|
+
const iframe = $('frameFloatingModal');
|
|
55413
55520
|
if (iframe) {
|
|
55414
|
-
|
|
55415
|
-
|
|
55416
|
-
|
|
55521
|
+
let idToken = null;
|
|
55522
|
+
let extensionAPIKeys = null;
|
|
55523
|
+
const retrieveIDPToken = pendo.getConfigValue('retrieveIDPToken');
|
|
55417
55524
|
if (pendo._.isFunction(retrieveIDPToken)) {
|
|
55418
|
-
|
|
55525
|
+
const result = retrieveIDPToken();
|
|
55419
55526
|
if (result) {
|
|
55420
55527
|
idToken = result.idToken;
|
|
55421
55528
|
extensionAPIKeys = result.extensionAPIKeys;
|
|
55422
55529
|
}
|
|
55423
55530
|
}
|
|
55424
|
-
|
|
55425
|
-
|
|
55426
|
-
(_c = iframe.contentWindow) === null || _c === void 0 ? void 0 : _c.postMessage({ type: 'TOKEN_RECEIVED', token
|
|
55531
|
+
const visitorId = (_a = pendo === null || pendo === void 0 ? void 0 : pendo.getVisitorId) === null || _a === void 0 ? void 0 : _a.call(pendo);
|
|
55532
|
+
const accountId = forceAccountId !== null && forceAccountId !== void 0 ? forceAccountId : (_b = pendo === null || pendo === void 0 ? void 0 : pendo.getAccountId) === null || _b === void 0 ? void 0 : _b.call(pendo);
|
|
55533
|
+
(_c = iframe.contentWindow) === null || _c === void 0 ? void 0 : _c.postMessage({ type: 'TOKEN_RECEIVED', token, idToken, extensionAPIKeys, visitorId, accountId }, frameTargetOrigin);
|
|
55427
55534
|
}
|
|
55428
55535
|
},
|
|
55429
|
-
OPEN_EXPLANATION:
|
|
55536
|
+
OPEN_EXPLANATION: () => {
|
|
55430
55537
|
var _a;
|
|
55431
55538
|
explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.add('is-visible');
|
|
55432
55539
|
(_a = explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(data, frameTargetOrigin);
|
|
55433
55540
|
},
|
|
55434
|
-
CLOSE_EXPLANATION:
|
|
55435
|
-
AUTH_ERROR_EXPLANATION:
|
|
55541
|
+
CLOSE_EXPLANATION: () => explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.remove('is-visible'),
|
|
55542
|
+
AUTH_ERROR_EXPLANATION: () => {
|
|
55436
55543
|
explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.remove('is-visible');
|
|
55437
|
-
|
|
55544
|
+
const iframe = $('frameFloatingModal');
|
|
55438
55545
|
// eslint-disable-next-line no-self-assign
|
|
55439
55546
|
if (iframe)
|
|
55440
55547
|
iframe.src = iframe.src;
|
|
55441
55548
|
},
|
|
55442
|
-
DATA_READY:
|
|
55549
|
+
DATA_READY: () => {
|
|
55443
55550
|
floatingModal === null || floatingModal === void 0 ? void 0 : floatingModal.classList.add('is-visible');
|
|
55444
55551
|
setFloatingModalSize();
|
|
55445
55552
|
// Use analysisIds from the message data if available, otherwise use all IDs
|
|
55446
|
-
|
|
55447
|
-
for (
|
|
55448
|
-
|
|
55553
|
+
const idsToShow = data.analysisIds || [];
|
|
55554
|
+
for (let i = 0; i < idsToShow.length; i++) {
|
|
55555
|
+
const frame = $(`frameExplanation-${idsToShow[i]}`);
|
|
55449
55556
|
if (frame)
|
|
55450
55557
|
frame.classList.add('is-exists');
|
|
55451
55558
|
}
|
|
55452
55559
|
},
|
|
55453
|
-
AUTH_ERROR:
|
|
55560
|
+
AUTH_ERROR: () => {
|
|
55454
55561
|
floatingModal === null || floatingModal === void 0 ? void 0 : floatingModal.classList.add('is-visible');
|
|
55455
55562
|
setFloatingModalSize();
|
|
55456
55563
|
},
|
|
55457
55564
|
CLOSE_FLOATING_MODAL: cleanup,
|
|
55458
|
-
EXPAND_FLOATING_MODAL:
|
|
55565
|
+
EXPAND_FLOATING_MODAL: () => {
|
|
55459
55566
|
setFloatingModalSize();
|
|
55460
55567
|
setFloatingModalCollapsedState(false);
|
|
55461
55568
|
},
|
|
55462
|
-
COLLAPSE_FLOATING_MODAL:
|
|
55569
|
+
COLLAPSE_FLOATING_MODAL: () => {
|
|
55463
55570
|
setFloatingModalSize();
|
|
55464
55571
|
setFloatingModalCollapsedState(true);
|
|
55465
55572
|
}
|
|
55466
55573
|
};
|
|
55467
55574
|
if (type && type in actions) {
|
|
55468
|
-
(
|
|
55575
|
+
(_a = actions === null || actions === void 0 ? void 0 : actions[type]) === null || _a === void 0 ? void 0 : _a.call(actions);
|
|
55469
55576
|
}
|
|
55470
55577
|
};
|
|
55471
55578
|
window.addEventListener('message', messageHandler);
|
|
55472
|
-
return
|
|
55579
|
+
return () => window.removeEventListener('message', messageHandler);
|
|
55473
55580
|
};
|
|
55474
|
-
|
|
55475
|
-
var
|
|
55476
|
-
var step = _a.step, pendo = _a.pendo, cleanupArray = _a.cleanupArray, cleanup = _a.cleanup, log = _a.log, designerServer = _a.designerServer;
|
|
55581
|
+
const predictGuidesScript = ({ step, pendo, cleanupArray, cleanup, log, designerServer }) => {
|
|
55582
|
+
var _a;
|
|
55477
55583
|
log('[predict] initializing');
|
|
55478
55584
|
// Before anything else, inject styles so that the guide will be hidden
|
|
55479
|
-
|
|
55585
|
+
const pendoContainerId = step === null || step === void 0 ? void 0 : step.containerId;
|
|
55480
55586
|
injectStyles(pendoContainerId, log);
|
|
55481
55587
|
if (cleanupArray.length > 0) {
|
|
55482
55588
|
log('[predict] cleanupArray is not empty');
|
|
55483
55589
|
return;
|
|
55484
55590
|
}
|
|
55485
55591
|
// ----- Extract Configuration -----
|
|
55486
|
-
|
|
55592
|
+
const guideButton = (_a = step.guideElement.find(GUIDE_BUTTON_IDENTIFIER)) === null || _a === void 0 ? void 0 : _a[0];
|
|
55487
55593
|
if (!guideButton) {
|
|
55488
55594
|
log('[predict] no guide button found, aborting');
|
|
55489
55595
|
return;
|
|
55490
55596
|
}
|
|
55491
|
-
|
|
55597
|
+
const _b = safeParse(guideButton.textContent, {}, log), { token } = _b, configuration = __rest(_b, ["token"]);
|
|
55492
55598
|
if (!configuration || !token) {
|
|
55493
55599
|
log('[predict] no configuration found, aborting');
|
|
55494
55600
|
return;
|
|
55495
55601
|
}
|
|
55496
|
-
|
|
55497
|
-
|
|
55602
|
+
const recordRegex = new RegExp(`/${configuration.recordRegexName}/([a-zA-Z0-9]+)(?:/|$)`);
|
|
55603
|
+
const recordId = getRecordIdFromUrl(recordRegex, log);
|
|
55498
55604
|
if (!recordId) {
|
|
55499
55605
|
log('[predict] no recordId found in URL, aborting');
|
|
55500
55606
|
return;
|
|
@@ -55503,11 +55609,11 @@ var predictGuidesScript = function (_a) {
|
|
|
55503
55609
|
log('[predict] no designerServer found, aborting');
|
|
55504
55610
|
return;
|
|
55505
55611
|
}
|
|
55506
|
-
|
|
55507
|
-
|
|
55508
|
-
log(
|
|
55509
|
-
cleanupArray.push(setupMessageListener({ token
|
|
55510
|
-
cleanupArray.push(createFloatingModal({ recordId
|
|
55612
|
+
const predictBaseUrl = getPredictBaseUrl(designerServer);
|
|
55613
|
+
const wrapperBase = getFrameWrapperBase(pendo);
|
|
55614
|
+
log(`[predict] predictBaseUrl: ${predictBaseUrl}${wrapperBase ? `, wrapping via ${wrapperBase}` : ''}`);
|
|
55615
|
+
cleanupArray.push(setupMessageListener({ token, forceAccountId: configuration === null || configuration === void 0 ? void 0 : configuration.forceAccountId, cleanup, pendo, predictBaseUrl, wrapperBase }));
|
|
55616
|
+
cleanupArray.push(createFloatingModal({ recordId, configuration, predictBaseUrl, wrapperBase }));
|
|
55511
55617
|
};
|
|
55512
55618
|
|
|
55513
55619
|
const PredictGuides = () => {
|