@pendo/agent 2.323.1 → 2.325.0
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 +21 -2
- package/dist/pendo.module.js +497 -423
- package/dist/pendo.module.min.js +9 -59
- package/dist/servers.json +7 -7
- package/package.json +1 -1
package/dist/pendo.module.js
CHANGED
|
@@ -3367,6 +3367,18 @@ var ConfigReader = (function () {
|
|
|
3367
3367
|
* @type {boolean}
|
|
3368
3368
|
*/
|
|
3369
3369
|
addOption('disablePrefetch', [SNIPPET_SRC, PENDO_CONFIG_SRC]);
|
|
3370
|
+
/**
|
|
3371
|
+
* Visitors will be tracked under a single anonymized visitor id. Disables
|
|
3372
|
+
* cookies, localStorage, click tracking, and metadata. Only displays guides
|
|
3373
|
+
* that have been configured explicitly to show to this visitor.
|
|
3374
|
+
*
|
|
3375
|
+
* @access public
|
|
3376
|
+
* @category Config/Guides
|
|
3377
|
+
* @name doNotTrackGuides
|
|
3378
|
+
* @default false
|
|
3379
|
+
* @type {boolean}
|
|
3380
|
+
*/
|
|
3381
|
+
addOption('doNotTrackGuides', [SNIPPET_SRC, PENDO_CONFIG_SRC]);
|
|
3370
3382
|
/**
|
|
3371
3383
|
* If `true`, the web SDK will listen for `alt+shift+8` on the keyboard and try to launch the designer (). The
|
|
3372
3384
|
* keyboard shortcut requires the guide launch modal of Engage to be open in another tab showing the shortcut.
|
|
@@ -3967,8 +3979,8 @@ let SERVER = '';
|
|
|
3967
3979
|
let ASSET_HOST = '';
|
|
3968
3980
|
let ASSET_PATH = '';
|
|
3969
3981
|
let DESIGNER_SERVER = '';
|
|
3970
|
-
let VERSION = '2.
|
|
3971
|
-
let PACKAGE_VERSION = '2.
|
|
3982
|
+
let VERSION = '2.325.0_';
|
|
3983
|
+
let PACKAGE_VERSION = '2.325.0';
|
|
3972
3984
|
let LOADER = 'xhr';
|
|
3973
3985
|
/* eslint-enable web-sdk-eslint-rules/no-gulp-env-references */
|
|
3974
3986
|
/**
|
|
@@ -4806,7 +4818,6 @@ var agentStorage = (function () {
|
|
|
4806
4818
|
var key = !isPlain ? getPendoCookieKey(name, cookieSuffix) : name;
|
|
4807
4819
|
if (storageIsDisabled()) {
|
|
4808
4820
|
delete inMemoryStorage[key];
|
|
4809
|
-
return;
|
|
4810
4821
|
}
|
|
4811
4822
|
if (shouldUseLocalStorage(keyLocalStorageOnly)) {
|
|
4812
4823
|
if (storageAvailable('localStorage')) {
|
|
@@ -4826,6 +4837,13 @@ var agentStorage = (function () {
|
|
|
4826
4837
|
}
|
|
4827
4838
|
delete inMemoryStorage[key];
|
|
4828
4839
|
}
|
|
4840
|
+
function clearAll() {
|
|
4841
|
+
_.each(registry.keys, (config, name) => {
|
|
4842
|
+
if (config.type === 'local') {
|
|
4843
|
+
clear(name);
|
|
4844
|
+
}
|
|
4845
|
+
});
|
|
4846
|
+
}
|
|
4829
4847
|
const wrappedPendoSessionStorage = _.extend({}, pendoSessionStorage$2);
|
|
4830
4848
|
wrappedPendoSessionStorage.setItem = wrapStorageWriteMethod(wrappedPendoSessionStorage.setItem, 'hasSession');
|
|
4831
4849
|
const wrappedPendoLocalStorage = _.extend({}, pendoLocalStorage$4);
|
|
@@ -4835,6 +4853,7 @@ var agentStorage = (function () {
|
|
|
4835
4853
|
read,
|
|
4836
4854
|
write: wrapStorageWriteMethod(write, 'hasLocal'),
|
|
4837
4855
|
clear,
|
|
4856
|
+
clearAll,
|
|
4838
4857
|
registry,
|
|
4839
4858
|
getLocal: () => wrappedPendoLocalStorage,
|
|
4840
4859
|
getSession: () => wrappedPendoSessionStorage
|
|
@@ -12939,6 +12958,13 @@ function filterAnalyticsDisabled(silo, next) {
|
|
|
12939
12958
|
return;
|
|
12940
12959
|
next(silo);
|
|
12941
12960
|
}
|
|
12961
|
+
function filterBrokenTimestamps(silo, next) {
|
|
12962
|
+
if (!_.isNumber(silo.browser_time) || isNaN(silo.browser_time)) {
|
|
12963
|
+
log.critical(new Error('Event missing browser_time'));
|
|
12964
|
+
return;
|
|
12965
|
+
}
|
|
12966
|
+
next(silo);
|
|
12967
|
+
}
|
|
12942
12968
|
function fireEventCaptured(silo, next) {
|
|
12943
12969
|
var captureEvent = Events.eventCaptured.trigger(silo);
|
|
12944
12970
|
if (captureEvent.cancel) {
|
|
@@ -13287,7 +13313,7 @@ class EventQueue {
|
|
|
13287
13313
|
}
|
|
13288
13314
|
function createEventQueue(options) {
|
|
13289
13315
|
const processSilos = createSiloQueue(options);
|
|
13290
|
-
const packageSilos = pipeline(filterNonGuideAnalytics(options.beacon), filterAnalyticsByType, eventSequence, siloReducer(options.cache), filterSiloCapacity({
|
|
13316
|
+
const packageSilos = pipeline(filterBrokenTimestamps, filterNonGuideAnalytics(options.beacon), filterAnalyticsByType, eventSequence, siloReducer(options.cache), filterSiloCapacity({
|
|
13291
13317
|
overhead: jwtSizeOverhead,
|
|
13292
13318
|
lower: ConfigReader.get('sendEventsWithPostOnly') ? ENCODED_EVENT_MAX_POST_LENGTH : ENCODED_EVENT_MAX_LENGTH,
|
|
13293
13319
|
upper: ENCODED_EVENT_MAX_POST_LENGTH,
|
|
@@ -18905,7 +18931,7 @@ var BuildingBlockResourceCenter = (function () {
|
|
|
18905
18931
|
integrationIframe.css({ display: 'none' });
|
|
18906
18932
|
}
|
|
18907
18933
|
function getSupportedNativeIntegrations() {
|
|
18908
|
-
return ['drift-native-chat', 'intercom-chat', 'zendesk-chat', 'zendesk-native-kb', 'zendesk-messaging'];
|
|
18934
|
+
return ['drift-native-chat', 'intercom-chat', 'zendesk-chat', 'zendesk-native-kb', 'zendesk-messaging', 'visitorAssist'];
|
|
18909
18935
|
}
|
|
18910
18936
|
function isSupportedNativeIntegration(provider) {
|
|
18911
18937
|
if (!provider)
|
|
@@ -18932,6 +18958,8 @@ var BuildingBlockResourceCenter = (function () {
|
|
|
18932
18958
|
return 'Intercom';
|
|
18933
18959
|
case 'drift-native-chat':
|
|
18934
18960
|
return 'drift';
|
|
18961
|
+
case 'visitorAssist':
|
|
18962
|
+
return 'visitorAssist';
|
|
18935
18963
|
default:
|
|
18936
18964
|
return null;
|
|
18937
18965
|
}
|
|
@@ -19029,6 +19057,9 @@ var BuildingBlockResourceCenter = (function () {
|
|
|
19029
19057
|
break;
|
|
19030
19058
|
case 'drift-native-chat':
|
|
19031
19059
|
configureDriftChatSettings();
|
|
19060
|
+
break;
|
|
19061
|
+
case 'visitorAssist':
|
|
19062
|
+
configureVisitorAssistChatSettings();
|
|
19032
19063
|
}
|
|
19033
19064
|
}
|
|
19034
19065
|
function webWidgetWrapper(provider, ...webWidgetArgs) {
|
|
@@ -19134,6 +19165,11 @@ var BuildingBlockResourceCenter = (function () {
|
|
|
19134
19165
|
endNativeChatExperience();
|
|
19135
19166
|
});
|
|
19136
19167
|
}
|
|
19168
|
+
function configureVisitorAssistChatSettings() {
|
|
19169
|
+
window.visitorAssist.onClose(function () {
|
|
19170
|
+
endNativeChatExperience();
|
|
19171
|
+
});
|
|
19172
|
+
}
|
|
19137
19173
|
function flattenMetadata(metadata) {
|
|
19138
19174
|
const flatMetadata = {};
|
|
19139
19175
|
for (const key in metadata) {
|
|
@@ -19243,6 +19279,9 @@ var BuildingBlockResourceCenter = (function () {
|
|
|
19243
19279
|
});
|
|
19244
19280
|
}
|
|
19245
19281
|
break;
|
|
19282
|
+
case 'visitorAssist':
|
|
19283
|
+
window.visitorAssist.launch();
|
|
19284
|
+
break;
|
|
19246
19285
|
}
|
|
19247
19286
|
// reset chat notification count
|
|
19248
19287
|
updateNotificationBubbleCount(0, 'chat');
|
|
@@ -23828,32 +23867,11 @@ const captureStepRenderStatus = (step, eligible, reason) => {
|
|
|
23828
23867
|
Events.stepEligibility.trigger({ stepId: id, guideId, eligible, reason });
|
|
23829
23868
|
return eligible;
|
|
23830
23869
|
};
|
|
23831
|
-
function isHtmlTooltipStep(step) {
|
|
23832
|
-
if (_.get(step, 'attributes.buildingBlockLayoutType') !== 'tooltip')
|
|
23833
|
-
return false;
|
|
23834
|
-
return Boolean(_.get(step, 'attributes.htmlContent') || step.htmlContent || step.htmlContentUrl);
|
|
23835
|
-
}
|
|
23836
|
-
function getHtmlTooltipSelector(step) {
|
|
23837
|
-
return step.elementPathRule || _.get(step, 'attributes.elementPathRule');
|
|
23838
|
-
}
|
|
23839
23870
|
var canStepBeRendered = function (step) {
|
|
23840
23871
|
const statusWriter = _.partial(captureStepRenderStatus, step);
|
|
23841
23872
|
if (isDismissedUntilReload(step)) {
|
|
23842
23873
|
return statusWriter(false, 'dismissed');
|
|
23843
23874
|
}
|
|
23844
|
-
// HTML guide tooltips don't set step.type === 'tooltip' (they keep the
|
|
23845
|
-
// guide-level type, typically 'lightbox') and don't have step.domJson, so
|
|
23846
|
-
// the standard tooltip detection below misses them. Without filtering here,
|
|
23847
|
-
// an HTML tooltip with a missing or invisible anchor sails through eligibility
|
|
23848
|
-
// and silently falls back to a lightbox layout at render time.
|
|
23849
|
-
if (isHtmlTooltipStep(step)) {
|
|
23850
|
-
var htmlSelector = getHtmlTooltipSelector(step);
|
|
23851
|
-
var htmlAnchor = htmlSelector ? SizzleProxy(htmlSelector)[0] : null;
|
|
23852
|
-
if (isElementVisible(htmlAnchor)) {
|
|
23853
|
-
return statusWriter(true, 'target_element_html_tooltip');
|
|
23854
|
-
}
|
|
23855
|
-
return statusWriter(wouldBeVisibleAfterAutoScroll(htmlAnchor), 'target_element_html_tooltip_scroll');
|
|
23856
|
-
}
|
|
23857
23875
|
if (!step.elementPathRule && (step.type === 'lightbox' || step.type === 'whatsnew')) {
|
|
23858
23876
|
return statusWriter(true, '');
|
|
23859
23877
|
}
|
|
@@ -24759,7 +24777,7 @@ var getGuideEventCache = function () {
|
|
|
24759
24777
|
};
|
|
24760
24778
|
function createGuideEventQueue(options) {
|
|
24761
24779
|
const processSilos = pipeline(filterAnalyticsDisabled, splitSiloOnFieldChange('visitor_id'), splitSiloOnFieldChange('props.source'), filterAccountIdsForSendQueue, compressSilo, errorLogger(), addSiloParams(options), addAccountIdParamIfAdoptPartner, addSourceParamIfPresent, convertSiloToObject);
|
|
24762
|
-
const packageSilos = pipeline(fireEventCaptured, eventSequence, siloReducer(options.cache), _.noop // do not move to the silo queue until manual flush
|
|
24780
|
+
const packageSilos = pipeline(filterBrokenTimestamps, fireEventCaptured, eventSequence, siloReducer(options.cache), _.noop // do not move to the silo queue until manual flush
|
|
24763
24781
|
);
|
|
24764
24782
|
return new EventQueue(_.extend({ processSilos, packageSilos }, options));
|
|
24765
24783
|
}
|
|
@@ -28425,6 +28443,7 @@ const PluginAPI = {
|
|
|
28425
28443
|
frames: {
|
|
28426
28444
|
getChannel: () => channel
|
|
28427
28445
|
},
|
|
28446
|
+
getAssetHost,
|
|
28428
28447
|
getAssetUrl,
|
|
28429
28448
|
getEventable: () => Eventable.call({}),
|
|
28430
28449
|
getScreenPosition,
|
|
@@ -28443,7 +28462,8 @@ const PluginAPI = {
|
|
|
28443
28462
|
},
|
|
28444
28463
|
guides: {
|
|
28445
28464
|
GuideFactory,
|
|
28446
|
-
GuideStepFactory
|
|
28465
|
+
GuideStepFactory,
|
|
28466
|
+
getElementForGuideStep
|
|
28447
28467
|
},
|
|
28448
28468
|
hosts: {
|
|
28449
28469
|
SERVER
|
|
@@ -28959,6 +28979,13 @@ function registerEventHandlers({ events = [] }) {
|
|
|
28959
28979
|
}
|
|
28960
28980
|
});
|
|
28961
28981
|
}
|
|
28982
|
+
function applyDoNotTrackConfigOverrides(options) {
|
|
28983
|
+
options.excludeNonGuideAnalytics = true;
|
|
28984
|
+
options.disableCookies = true;
|
|
28985
|
+
options.visitor = { id: 'cookieless_visitor' };
|
|
28986
|
+
delete options.account;
|
|
28987
|
+
delete options.parentAccount;
|
|
28988
|
+
}
|
|
28962
28989
|
// ----------------------------------------------------------------------------------
|
|
28963
28990
|
let initializeCounter = 0;
|
|
28964
28991
|
const initializeImmediately = 'initializeImmediately';
|
|
@@ -29036,6 +29063,11 @@ function initialize(options) {
|
|
|
29036
29063
|
});
|
|
29037
29064
|
}
|
|
29038
29065
|
store.dispatch('location/init', options.location || {});
|
|
29066
|
+
const doNotTrackGuides = 'doNotTrackGuides';
|
|
29067
|
+
const isDoNotTrackGuides = _.get(options, doNotTrackGuides) || ConfigReader.get(doNotTrackGuides);
|
|
29068
|
+
if (isDoNotTrackGuides) {
|
|
29069
|
+
applyDoNotTrackConfigOverrides(options);
|
|
29070
|
+
}
|
|
29039
29071
|
// Save the options somewhere
|
|
29040
29072
|
ConfigReader.setLocalConfig(options);
|
|
29041
29073
|
initDataHost();
|
|
@@ -29154,6 +29186,9 @@ function initialize(options) {
|
|
|
29154
29186
|
initializeCounter++;
|
|
29155
29187
|
announceFrameToDesignerPlugin();
|
|
29156
29188
|
flushCallQueue();
|
|
29189
|
+
if (isDoNotTrackGuides) {
|
|
29190
|
+
agentStorage.clearAll();
|
|
29191
|
+
}
|
|
29157
29192
|
}
|
|
29158
29193
|
catch (e) {
|
|
29159
29194
|
log.critical('An exception occurred during pendo.initialize.', e);
|
|
@@ -40846,17 +40881,19 @@ function TextCapture() {
|
|
|
40846
40881
|
}
|
|
40847
40882
|
}
|
|
40848
40883
|
|
|
40849
|
-
|
|
40850
|
-
|
|
40851
|
-
|
|
40852
|
-
|
|
40853
|
-
|
|
40854
|
-
function lookupGuideButtons(domJson, buttons
|
|
40884
|
+
var substitutionRegex = '\\{(?:\\s?)([^.\\s]?visitor|account|parentAccount)\\.([^|\\s/]*)(?:\\s?\\|\\s?([^}]+|[\\/s]+))?(?:\\s?\\/\\s?){1}\\}';
|
|
40885
|
+
var skipStepString = '{skipStep:* *(auto|\\d+)\\/}';
|
|
40886
|
+
var goToMiddleString = '(?!0)(\\d+)';
|
|
40887
|
+
var goToString = "({goto-".concat(goToMiddleString, "\\/})");
|
|
40888
|
+
var containerSelector = '[id^="pendo-guide-container"]';
|
|
40889
|
+
function lookupGuideButtons(domJson, buttons) {
|
|
40890
|
+
if (buttons === void 0) { buttons = []; }
|
|
40855
40891
|
if (domJson.type === 'button' && domJson.actions) {
|
|
40856
40892
|
buttons.push(domJson);
|
|
40857
40893
|
}
|
|
40858
40894
|
if (domJson.children) {
|
|
40859
|
-
for (
|
|
40895
|
+
for (var _i = 0, _a = domJson.children; _i < _a.length; _i++) {
|
|
40896
|
+
var child = _a[_i];
|
|
40860
40897
|
lookupGuideButtons(child, buttons);
|
|
40861
40898
|
}
|
|
40862
40899
|
}
|
|
@@ -40885,15 +40922,16 @@ function removeMarkdownSyntax(element, textToReplace, replacementText, pendo) {
|
|
|
40885
40922
|
}
|
|
40886
40923
|
}
|
|
40887
40924
|
var guideMarkdownUtil = {
|
|
40888
|
-
substitutionRegex,
|
|
40889
|
-
skipStepString,
|
|
40890
|
-
goToString,
|
|
40891
|
-
containerSelector,
|
|
40892
|
-
lookupGuideButtons,
|
|
40893
|
-
removeMarkdownSyntax
|
|
40925
|
+
substitutionRegex: substitutionRegex,
|
|
40926
|
+
skipStepString: skipStepString,
|
|
40927
|
+
goToString: goToString,
|
|
40928
|
+
containerSelector: containerSelector,
|
|
40929
|
+
lookupGuideButtons: lookupGuideButtons,
|
|
40930
|
+
removeMarkdownSyntax: removeMarkdownSyntax
|
|
40894
40931
|
};
|
|
40895
40932
|
|
|
40896
|
-
function getZoneSafeMethod(_, method, target
|
|
40933
|
+
function getZoneSafeMethod(_, method, target) {
|
|
40934
|
+
if (target === void 0) { target = window; }
|
|
40897
40935
|
var zoneSymbol = '__symbol__';
|
|
40898
40936
|
/* global Zone */
|
|
40899
40937
|
if (typeof Zone !== 'undefined' && _.isFunction(Zone[zoneSymbol])) {
|
|
@@ -41504,12 +41542,26 @@ const RequiredQuestions = {
|
|
|
41504
41542
|
guideMarkdownUtil.removeMarkdownSyntax(item, requiredSyntax, '', pendo);
|
|
41505
41543
|
});
|
|
41506
41544
|
});
|
|
41507
|
-
|
|
41508
|
-
|
|
41509
|
-
|
|
41510
|
-
}
|
|
41511
|
-
|
|
41512
|
-
pendo.
|
|
41545
|
+
const pollTextSelector = `.bb-text[data-pendo-poll-id=${dataPendoPollId}]`;
|
|
41546
|
+
const pollParagraphSelector = `${pollTextSelector} p`;
|
|
41547
|
+
const pollListItemSelector = `${pollTextSelector} li`;
|
|
41548
|
+
const pollIndicatorSelector = `${pollTextSelector} ._pendo-required-indicator`;
|
|
41549
|
+
pendo._.each(pendo.dom(`${pollParagraphSelector}, ${pollListItemSelector}`), (el) => {
|
|
41550
|
+
pendo._.each(el.childNodes, (node) => {
|
|
41551
|
+
if (node.nodeType === 3 && node.nodeValue.indexOf(requiredSyntax) !== -1) {
|
|
41552
|
+
node.nodeValue = node.nodeValue.split(requiredSyntax).join('');
|
|
41553
|
+
}
|
|
41554
|
+
});
|
|
41555
|
+
});
|
|
41556
|
+
const hasIndicator = pendo.dom(pollIndicatorSelector).length !== 0;
|
|
41557
|
+
if (!hasIndicator) {
|
|
41558
|
+
if (pendo.dom(pollParagraphSelector).length !== 0 || pendo.dom(pollListItemSelector).length !== 0) {
|
|
41559
|
+
pendo.dom(pollParagraphSelector).append(requiredElement);
|
|
41560
|
+
pendo.dom(pollListItemSelector).append(requiredElement);
|
|
41561
|
+
}
|
|
41562
|
+
else {
|
|
41563
|
+
pendo.dom(pollTextSelector).append(requiredElement);
|
|
41564
|
+
}
|
|
41513
41565
|
}
|
|
41514
41566
|
if (pendo._.contains(requiredQuestions, dataPendoPollId)) {
|
|
41515
41567
|
let questionIndex = requiredQuestions.indexOf(dataPendoPollId);
|
|
@@ -48942,31 +48994,32 @@ var n;
|
|
|
48942
48994
|
}(n || (n = {}));
|
|
48943
48995
|
return record; }
|
|
48944
48996
|
|
|
48945
|
-
|
|
48946
|
-
|
|
48997
|
+
var SessionRecorderBuffer = /** @class */ (function () {
|
|
48998
|
+
function SessionRecorderBuffer(interval, maxCount) {
|
|
48999
|
+
if (maxCount === void 0) { maxCount = Infinity; }
|
|
48947
49000
|
this.data = [];
|
|
48948
49001
|
this.sequenceNumber = 0;
|
|
48949
49002
|
this.interval = interval;
|
|
48950
49003
|
this.maxCount = maxCount;
|
|
48951
49004
|
this.doubledMaxCount = maxCount * 2;
|
|
48952
49005
|
}
|
|
48953
|
-
isEmpty() {
|
|
49006
|
+
SessionRecorderBuffer.prototype.isEmpty = function () {
|
|
48954
49007
|
return this.data.length === 0;
|
|
48955
|
-
}
|
|
48956
|
-
count() {
|
|
49008
|
+
};
|
|
49009
|
+
SessionRecorderBuffer.prototype.count = function () {
|
|
48957
49010
|
return this.data.length;
|
|
48958
|
-
}
|
|
48959
|
-
clear() {
|
|
49011
|
+
};
|
|
49012
|
+
SessionRecorderBuffer.prototype.clear = function () {
|
|
48960
49013
|
this.data.length = 0;
|
|
48961
|
-
}
|
|
48962
|
-
clearSequence() {
|
|
49014
|
+
};
|
|
49015
|
+
SessionRecorderBuffer.prototype.clearSequence = function () {
|
|
48963
49016
|
this.sequenceNumber = 0;
|
|
48964
|
-
}
|
|
48965
|
-
push(event) {
|
|
49017
|
+
};
|
|
49018
|
+
SessionRecorderBuffer.prototype.push = function (event) {
|
|
48966
49019
|
this.data.push(event);
|
|
48967
49020
|
this.checkRateLimit();
|
|
48968
|
-
}
|
|
48969
|
-
pack(envelope, _) {
|
|
49021
|
+
};
|
|
49022
|
+
SessionRecorderBuffer.prototype.pack = function (envelope, _) {
|
|
48970
49023
|
var eventsToSend = this.data.splice(0, this.maxCount);
|
|
48971
49024
|
envelope.recordingPayload = eventsToSend;
|
|
48972
49025
|
envelope.sequence = this.sequenceNumber;
|
|
@@ -48974,8 +49027,8 @@ class SessionRecorderBuffer {
|
|
|
48974
49027
|
if (eventsToSend.length) {
|
|
48975
49028
|
envelope.browserTime = eventsToSend[0].timestamp;
|
|
48976
49029
|
}
|
|
48977
|
-
envelope.recordingPayloadMetadata = _.map(eventsToSend, event
|
|
48978
|
-
|
|
49030
|
+
envelope.recordingPayloadMetadata = _.map(eventsToSend, function (event) {
|
|
49031
|
+
var metadata = _.pick(event, 'type', 'timestamp');
|
|
48979
49032
|
if (event.data) {
|
|
48980
49033
|
metadata.data = _.pick(event.data, 'source', 'type', 'x', 'y', 'id', 'height', 'width', 'href');
|
|
48981
49034
|
}
|
|
@@ -48983,17 +49036,18 @@ class SessionRecorderBuffer {
|
|
|
48983
49036
|
});
|
|
48984
49037
|
this.sequenceNumber += eventsToSend.length;
|
|
48985
49038
|
return envelope;
|
|
48986
|
-
}
|
|
48987
|
-
checkRateLimit() {
|
|
48988
|
-
|
|
49039
|
+
};
|
|
49040
|
+
SessionRecorderBuffer.prototype.checkRateLimit = function () {
|
|
49041
|
+
var length = this.data.length;
|
|
48989
49042
|
if (length >= this.doubledMaxCount && length % this.maxCount === 0) {
|
|
48990
|
-
|
|
49043
|
+
var elapsed = this.data[length - 1].timestamp - this.data[length - this.doubledMaxCount].timestamp;
|
|
48991
49044
|
if (elapsed <= this.interval && this.onRateLimit) {
|
|
48992
49045
|
this.onRateLimit();
|
|
48993
49046
|
}
|
|
48994
49047
|
}
|
|
48995
|
-
}
|
|
48996
|
-
|
|
49048
|
+
};
|
|
49049
|
+
return SessionRecorderBuffer;
|
|
49050
|
+
}());
|
|
48997
49051
|
|
|
48998
49052
|
function __rest(s, e) {
|
|
48999
49053
|
var t = {};
|
|
@@ -49017,24 +49071,52 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
49017
49071
|
});
|
|
49018
49072
|
}
|
|
49019
49073
|
|
|
49074
|
+
function __generator(thisArg, body) {
|
|
49075
|
+
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);
|
|
49076
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
49077
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
49078
|
+
function step(op) {
|
|
49079
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
49080
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
49081
|
+
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;
|
|
49082
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
49083
|
+
switch (op[0]) {
|
|
49084
|
+
case 0: case 1: t = op; break;
|
|
49085
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
49086
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
49087
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
49088
|
+
default:
|
|
49089
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
49090
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
49091
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
49092
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
49093
|
+
if (t[2]) _.ops.pop();
|
|
49094
|
+
_.trys.pop(); continue;
|
|
49095
|
+
}
|
|
49096
|
+
op = body.call(thisArg, _);
|
|
49097
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
49098
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
49099
|
+
}
|
|
49100
|
+
}
|
|
49101
|
+
|
|
49020
49102
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
49021
49103
|
var e = new Error(message);
|
|
49022
49104
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
49023
49105
|
};
|
|
49024
49106
|
|
|
49025
|
-
|
|
49026
|
-
|
|
49027
|
-
|
|
49028
|
-
|
|
49029
|
-
|
|
49107
|
+
var RECORDING_CONFIG_WORKERURL$1 = 'recording.workerUrl';
|
|
49108
|
+
var MAX_SIZE = 2000000;
|
|
49109
|
+
var RESOURCE_CACHING$1 = 'resourceCaching';
|
|
49110
|
+
var Transport = /** @class */ (function () {
|
|
49111
|
+
function Transport(WorkerClass, pendo, api) {
|
|
49030
49112
|
this.WorkerClass = WorkerClass;
|
|
49031
49113
|
this.pendo = pendo;
|
|
49032
49114
|
this.api = api;
|
|
49033
49115
|
this.maxSize = MAX_SIZE;
|
|
49034
|
-
this.lockID =
|
|
49116
|
+
this.lockID = "worker-lock-".concat(this.pendo.randomString(16));
|
|
49035
49117
|
this.isResourceCachingEnabled = this.api.ConfigReader.get(RESOURCE_CACHING$1);
|
|
49036
49118
|
}
|
|
49037
|
-
start(config) {
|
|
49119
|
+
Transport.prototype.start = function (config) {
|
|
49038
49120
|
if (config.disableWorker)
|
|
49039
49121
|
return;
|
|
49040
49122
|
if (!this.worker) {
|
|
@@ -49044,7 +49126,7 @@ class Transport {
|
|
|
49044
49126
|
this.worker = config.workerOverride;
|
|
49045
49127
|
}
|
|
49046
49128
|
else {
|
|
49047
|
-
|
|
49129
|
+
var workerUrl = this.api.ConfigReader.get(RECORDING_CONFIG_WORKERURL$1);
|
|
49048
49130
|
this.usesSelfHostedWorker = workerUrl != null;
|
|
49049
49131
|
this.worker = workerUrl ? new Worker(workerUrl) : new this.WorkerClass();
|
|
49050
49132
|
}
|
|
@@ -49058,34 +49140,35 @@ class Transport {
|
|
|
49058
49140
|
this.worker = null;
|
|
49059
49141
|
}
|
|
49060
49142
|
}
|
|
49061
|
-
}
|
|
49062
|
-
stop() {
|
|
49143
|
+
};
|
|
49144
|
+
Transport.prototype.stop = function () {
|
|
49063
49145
|
if (this.worker) {
|
|
49064
49146
|
this.worker.terminate();
|
|
49065
49147
|
delete this.worker;
|
|
49066
49148
|
}
|
|
49067
|
-
}
|
|
49068
|
-
send(envelope, isUnload, failureCount
|
|
49069
|
-
|
|
49070
|
-
|
|
49149
|
+
};
|
|
49150
|
+
Transport.prototype.send = function (envelope, isUnload, failureCount) {
|
|
49151
|
+
if (failureCount === void 0) { failureCount = 0; }
|
|
49152
|
+
var url = envelope.url;
|
|
49153
|
+
var payload = envelope.payload;
|
|
49071
49154
|
if (failureCount > 0) {
|
|
49072
|
-
url =
|
|
49155
|
+
url = "".concat(url, "&rt=").concat(failureCount);
|
|
49073
49156
|
}
|
|
49074
49157
|
if (this.worker && !isUnload && payload) {
|
|
49075
|
-
|
|
49076
|
-
|
|
49077
|
-
|
|
49078
|
-
|
|
49158
|
+
var deferred_1 = {};
|
|
49159
|
+
deferred_1.promise = new Promise$2(function (resolve, reject) {
|
|
49160
|
+
deferred_1.resolve = resolve;
|
|
49161
|
+
deferred_1.reject = reject;
|
|
49079
49162
|
});
|
|
49080
|
-
this.workerResponse =
|
|
49081
|
-
this.worker.postMessage({ url, payload, shouldCacheResources: this.isResourceCachingEnabled });
|
|
49082
|
-
return
|
|
49163
|
+
this.workerResponse = deferred_1;
|
|
49164
|
+
this.worker.postMessage({ url: url, payload: payload, shouldCacheResources: this.isResourceCachingEnabled });
|
|
49165
|
+
return deferred_1.promise;
|
|
49083
49166
|
}
|
|
49084
49167
|
else {
|
|
49085
49168
|
if (!envelope.body) {
|
|
49086
|
-
|
|
49169
|
+
var strPayload = JSON.stringify(payload);
|
|
49087
49170
|
if (strPayload.length > this.maxSize) {
|
|
49088
|
-
|
|
49171
|
+
var error = new Error('maximum recording payload size exceeded');
|
|
49089
49172
|
error.reason = 'HEAVY_EVENT';
|
|
49090
49173
|
error.context = {
|
|
49091
49174
|
size: strPayload.length,
|
|
@@ -49096,14 +49179,14 @@ class Transport {
|
|
|
49096
49179
|
envelope.body = this.pendo.compress(strPayload, 'binary');
|
|
49097
49180
|
delete envelope.payload;
|
|
49098
49181
|
}
|
|
49099
|
-
url =
|
|
49182
|
+
url = "".concat(url, "&ct=").concat(new Date().getTime());
|
|
49100
49183
|
return this.post(url, {
|
|
49101
49184
|
keepalive: isUnload,
|
|
49102
49185
|
body: envelope.body
|
|
49103
49186
|
});
|
|
49104
49187
|
}
|
|
49105
|
-
}
|
|
49106
|
-
post(url, options) {
|
|
49188
|
+
};
|
|
49189
|
+
Transport.prototype.post = function (url, options) {
|
|
49107
49190
|
options.method = 'POST';
|
|
49108
49191
|
if (options.keepalive && this.api.transmit.fetchKeepalive.supported()) {
|
|
49109
49192
|
return this.api.transmit.fetchKeepalive(url, options);
|
|
@@ -49115,46 +49198,57 @@ class Transport {
|
|
|
49115
49198
|
else {
|
|
49116
49199
|
return this.pendo.ajax.post(url, options.body);
|
|
49117
49200
|
}
|
|
49118
|
-
}
|
|
49119
|
-
_onMessage(messageEvent) {
|
|
49120
|
-
return __awaiter(this, void 0, void 0, function
|
|
49121
|
-
|
|
49122
|
-
|
|
49123
|
-
|
|
49124
|
-
|
|
49125
|
-
|
|
49126
|
-
|
|
49127
|
-
|
|
49128
|
-
|
|
49129
|
-
|
|
49130
|
-
|
|
49131
|
-
|
|
49132
|
-
|
|
49133
|
-
|
|
49134
|
-
|
|
49135
|
-
|
|
49136
|
-
|
|
49137
|
-
|
|
49138
|
-
|
|
49139
|
-
|
|
49201
|
+
};
|
|
49202
|
+
Transport.prototype._onMessage = function (messageEvent) {
|
|
49203
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
49204
|
+
return __generator(this, function (_a) {
|
|
49205
|
+
switch (_a.label) {
|
|
49206
|
+
case 0:
|
|
49207
|
+
if (!(messageEvent.data && messageEvent.data.ready && navigator.locks)) return [3 /*break*/, 2];
|
|
49208
|
+
// When the lock is released, we can assume the worker was terminated or closed
|
|
49209
|
+
return [4 /*yield*/, navigator.locks.request(this.lockID, function () { })];
|
|
49210
|
+
case 1:
|
|
49211
|
+
// When the lock is released, we can assume the worker was terminated or closed
|
|
49212
|
+
_a.sent();
|
|
49213
|
+
this.onWorkerMessage({ type: 'workerDied' });
|
|
49214
|
+
_a.label = 2;
|
|
49215
|
+
case 2:
|
|
49216
|
+
// handle non-POST request responses from worker
|
|
49217
|
+
if (messageEvent.data && messageEvent.data.type) {
|
|
49218
|
+
this.onWorkerMessage(messageEvent.data);
|
|
49219
|
+
return [2 /*return*/];
|
|
49220
|
+
}
|
|
49221
|
+
// handle POST request response from worker
|
|
49222
|
+
if (messageEvent.data && messageEvent.data.error) {
|
|
49223
|
+
if ((messageEvent.data.status && messageEvent.data.status < 500) ||
|
|
49224
|
+
messageEvent.data.sequence == null) {
|
|
49225
|
+
this.api.log.critical('Failed to send recording data from web worker', { error: messageEvent.data.error });
|
|
49226
|
+
}
|
|
49227
|
+
if (this.workerResponse) {
|
|
49228
|
+
this.workerResponse.reject();
|
|
49229
|
+
this.workerResponse = null;
|
|
49230
|
+
}
|
|
49231
|
+
}
|
|
49232
|
+
if (this.workerResponse) {
|
|
49233
|
+
this.workerResponse.resolve();
|
|
49234
|
+
this.workerResponse = null;
|
|
49235
|
+
}
|
|
49236
|
+
return [2 /*return*/];
|
|
49140
49237
|
}
|
|
49141
|
-
}
|
|
49142
|
-
if (this.workerResponse) {
|
|
49143
|
-
this.workerResponse.resolve();
|
|
49144
|
-
this.workerResponse = null;
|
|
49145
|
-
}
|
|
49238
|
+
});
|
|
49146
49239
|
});
|
|
49147
|
-
}
|
|
49148
|
-
_onError() {
|
|
49240
|
+
};
|
|
49241
|
+
Transport.prototype._onError = function () {
|
|
49149
49242
|
if (this.onError) {
|
|
49150
49243
|
this.onError();
|
|
49151
49244
|
}
|
|
49152
|
-
}
|
|
49153
|
-
|
|
49245
|
+
};
|
|
49246
|
+
return Transport;
|
|
49247
|
+
}());
|
|
49154
49248
|
|
|
49155
|
-
|
|
49156
|
-
|
|
49157
|
-
|
|
49249
|
+
var ELEMENT_NODE = 1;
|
|
49250
|
+
var INPUT_MASK = '*'.repeat(10);
|
|
49251
|
+
var NUMBER_INPUT_MASK = '0'.repeat(10);
|
|
49158
49252
|
function isElementNode(node) {
|
|
49159
49253
|
if (!node)
|
|
49160
49254
|
return false;
|
|
@@ -49163,10 +49257,12 @@ function isElementNode(node) {
|
|
|
49163
49257
|
return true;
|
|
49164
49258
|
}
|
|
49165
49259
|
function getParent(elem) {
|
|
49166
|
-
|
|
49260
|
+
var isElementShadowRoot = typeof window.ShadowRoot !== 'undefined' && elem instanceof window.ShadowRoot && elem.host;
|
|
49167
49261
|
return isElementShadowRoot ? elem.host : elem.parentNode;
|
|
49168
49262
|
}
|
|
49169
|
-
function distanceToMatch(node, selector, limit
|
|
49263
|
+
function distanceToMatch(node, selector, limit, distance) {
|
|
49264
|
+
if (limit === void 0) { limit = Infinity; }
|
|
49265
|
+
if (distance === void 0) { distance = 0; }
|
|
49170
49266
|
if (distance > limit)
|
|
49171
49267
|
return -1;
|
|
49172
49268
|
if (!node)
|
|
@@ -49180,13 +49276,13 @@ function distanceToMatch(node, selector, limit = Infinity, distance = 0) {
|
|
|
49180
49276
|
return distanceToMatch(getParent(node), selector, limit, distance + 1);
|
|
49181
49277
|
}
|
|
49182
49278
|
function shouldMask(node, options) {
|
|
49183
|
-
|
|
49279
|
+
var maskAllText = options.maskAllText, maskTextSelector = options.maskTextSelector, unmaskTextSelector = options.unmaskTextSelector;
|
|
49184
49280
|
try {
|
|
49185
|
-
|
|
49281
|
+
var el = isElementNode(node) ? node : node.parentElement;
|
|
49186
49282
|
if (el === null)
|
|
49187
49283
|
return false;
|
|
49188
|
-
|
|
49189
|
-
|
|
49284
|
+
var maskDistance = -1;
|
|
49285
|
+
var unmaskDistance = -1;
|
|
49190
49286
|
if (maskAllText) {
|
|
49191
49287
|
unmaskDistance = distanceToMatch(el, unmaskTextSelector);
|
|
49192
49288
|
if (unmaskDistance < 0) {
|
|
@@ -49219,8 +49315,8 @@ function isNumberInput(element) {
|
|
|
49219
49315
|
}
|
|
49220
49316
|
function shouldMaskInput(element, maskInputOptions) {
|
|
49221
49317
|
if (maskInputOptions && isElementNode(element)) {
|
|
49222
|
-
|
|
49223
|
-
|
|
49318
|
+
var tagName = (element.tagName || '').toLowerCase();
|
|
49319
|
+
var type = (element.type || '').toLowerCase();
|
|
49224
49320
|
if (maskInputOptions[tagName] || maskInputOptions[type]) {
|
|
49225
49321
|
return true;
|
|
49226
49322
|
}
|
|
@@ -49419,9 +49515,15 @@ class SessionRecorder {
|
|
|
49419
49515
|
this.api.attachEvent(this.api.Events, 'eventCaptured', bind(this.addRecordingId, this)),
|
|
49420
49516
|
this.api.attachEvent(this.api.Events, 'transmit:locked', bind(this.stop, this)),
|
|
49421
49517
|
this.api.attachEvent(this.api.Events, 'transmit:unlocked', bind(this._start, this)),
|
|
49422
|
-
this.api.attachEvent(this.api.frames.getChannel(), 'message', bind(this._frameMessage, this)),
|
|
49423
49518
|
this.api.attachEvent(this.api.Events, 'tabIdChanged:self', bind(this.handleTabIdChange, this))
|
|
49424
49519
|
];
|
|
49520
|
+
// APP-153357 Zone.js could bypass filterCrossWindowMessages (don't use attachEvent)
|
|
49521
|
+
const channel = this.api.frames.getChannel();
|
|
49522
|
+
const frameMessageHandler = bind(this._frameMessage, this);
|
|
49523
|
+
channel.addEventListener('message', frameMessageHandler);
|
|
49524
|
+
this.subscriptions.push(() => {
|
|
49525
|
+
channel.removeEventListener('message', frameMessageHandler);
|
|
49526
|
+
});
|
|
49425
49527
|
if (this.api.store.getters['frames/isReady']()) {
|
|
49426
49528
|
this.ready();
|
|
49427
49529
|
}
|
|
@@ -50707,12 +50809,12 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
|
|
|
50707
50809
|
}
|
|
50708
50810
|
}
|
|
50709
50811
|
|
|
50710
|
-
|
|
50812
|
+
var ONE_HUNDRED_MB_IN_BYTES = 100 * 1024 * 1024;
|
|
50711
50813
|
function matchHostedResources(recordingEvent, stringifiedRecordingPayload) {
|
|
50712
|
-
|
|
50713
|
-
|
|
50814
|
+
var fontURLRegex = /https:\/\/[^"\\\s]+?\.(woff2?|ttf|otf|eot)(\?[^"\\\s]*)?\b/g;
|
|
50815
|
+
var matches = stringifiedRecordingPayload.match(fontURLRegex);
|
|
50714
50816
|
// de-duplicate matches
|
|
50715
|
-
|
|
50817
|
+
var hostedResources = matches ? Array.from(new Set(matches)) : [];
|
|
50716
50818
|
return {
|
|
50717
50819
|
type: 'recording',
|
|
50718
50820
|
visitorId: recordingEvent.visitorId,
|
|
@@ -50727,7 +50829,7 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
|
|
|
50727
50829
|
recordingPayloadMetadata: [],
|
|
50728
50830
|
sequence: 0,
|
|
50729
50831
|
recordingPayloadCount: 0,
|
|
50730
|
-
hostedResources
|
|
50832
|
+
hostedResources: hostedResources
|
|
50731
50833
|
};
|
|
50732
50834
|
}
|
|
50733
50835
|
// keep in mind changes here may need addressing in the extension worker proxy as well
|
|
@@ -50735,69 +50837,69 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
|
|
|
50735
50837
|
try {
|
|
50736
50838
|
if (e.data.type === 'init' && e.data.lockID) {
|
|
50737
50839
|
if (navigator.locks) {
|
|
50738
|
-
navigator.locks.request(e.data.lockID, ()
|
|
50840
|
+
navigator.locks.request(e.data.lockID, function () {
|
|
50739
50841
|
postMessage({ ready: true });
|
|
50740
50842
|
// This unresolved promise keeps the lock held with the worker until the worker is
|
|
50741
50843
|
// terminated at which point the lock is released.
|
|
50742
|
-
return new Promise$2(()
|
|
50844
|
+
return new Promise$2(function () { });
|
|
50743
50845
|
});
|
|
50744
50846
|
}
|
|
50745
50847
|
return;
|
|
50746
50848
|
}
|
|
50747
50849
|
if (e.data.url && e.data.payload) {
|
|
50748
|
-
|
|
50850
|
+
var _a = e.data, url = _a.url, payload = _a.payload, shouldCacheResources = _a.shouldCacheResources;
|
|
50749
50851
|
if (Object.keys(payload).length === 0) {
|
|
50750
50852
|
postMessage({
|
|
50751
50853
|
type: 'emptyPayload'
|
|
50752
50854
|
});
|
|
50753
50855
|
}
|
|
50754
|
-
|
|
50755
|
-
|
|
50856
|
+
var sequence_1 = payload.sequence;
|
|
50857
|
+
var stringifiedRecordingPayload = JSON.stringify(payload.recordingPayload);
|
|
50756
50858
|
// calculate and post back the recording payload size before the payload is compressed
|
|
50757
|
-
|
|
50758
|
-
|
|
50859
|
+
var recordingPayloadSize = new TextEncoder().encode(stringifiedRecordingPayload).length;
|
|
50860
|
+
var exceedsPayloadSizeLimit = recordingPayloadSize >= ONE_HUNDRED_MB_IN_BYTES;
|
|
50759
50861
|
postMessage({
|
|
50760
50862
|
type: 'recordingPayloadSize',
|
|
50761
|
-
recordingPayloadSize,
|
|
50762
|
-
exceedsPayloadSizeLimit
|
|
50863
|
+
recordingPayloadSize: recordingPayloadSize,
|
|
50864
|
+
exceedsPayloadSizeLimit: exceedsPayloadSizeLimit
|
|
50763
50865
|
});
|
|
50764
50866
|
// don't attempt to send the payload if it exceeds the allowed limit
|
|
50765
50867
|
if (exceedsPayloadSizeLimit)
|
|
50766
50868
|
return;
|
|
50767
50869
|
if (shouldCacheResources) {
|
|
50768
|
-
|
|
50870
|
+
var hostedResourcesEvent = matchHostedResources(payload, stringifiedRecordingPayload);
|
|
50769
50871
|
if (hostedResourcesEvent.hostedResources.length) {
|
|
50770
50872
|
postMessage({
|
|
50771
50873
|
type: 'hostedResources',
|
|
50772
|
-
hostedResourcesEvent
|
|
50874
|
+
hostedResourcesEvent: hostedResourcesEvent
|
|
50773
50875
|
});
|
|
50774
50876
|
}
|
|
50775
50877
|
}
|
|
50776
50878
|
payload.recordingSize = recordingPayloadSize;
|
|
50777
|
-
|
|
50879
|
+
var body = compress(payload, 'binary');
|
|
50778
50880
|
// we want to calculate ct (current time) as close as we can to the actual POST request
|
|
50779
50881
|
// so that it's as accurate as possible
|
|
50780
|
-
url =
|
|
50882
|
+
url = "".concat(url, "&ct=").concat(new Date().getTime());
|
|
50781
50883
|
fetch(url, {
|
|
50782
50884
|
method: 'POST',
|
|
50783
|
-
body
|
|
50885
|
+
body: body
|
|
50784
50886
|
}).then(function (response) {
|
|
50785
50887
|
if (response.status < 200 || response.status >= 300) {
|
|
50786
50888
|
postMessage({
|
|
50787
|
-
error: new Error(
|
|
50889
|
+
error: new Error("received status code ".concat(response.status, ": ").concat(response.statusText)),
|
|
50788
50890
|
status: response.status,
|
|
50789
|
-
sequence
|
|
50891
|
+
sequence: sequence_1
|
|
50790
50892
|
});
|
|
50791
50893
|
}
|
|
50792
50894
|
else {
|
|
50793
50895
|
postMessage({
|
|
50794
|
-
sequence
|
|
50896
|
+
sequence: sequence_1
|
|
50795
50897
|
});
|
|
50796
50898
|
}
|
|
50797
|
-
})
|
|
50899
|
+
})["catch"](function (e) {
|
|
50798
50900
|
postMessage({
|
|
50799
50901
|
error: e,
|
|
50800
|
-
sequence
|
|
50902
|
+
sequence: sequence_1
|
|
50801
50903
|
});
|
|
50802
50904
|
});
|
|
50803
50905
|
}
|
|
@@ -50832,12 +50934,12 @@ function createReplayPlugin() {
|
|
|
50832
50934
|
* limit of number of keys in an object
|
|
50833
50935
|
* if an object contains more keys than this limit, we would call its toString function directly
|
|
50834
50936
|
*/
|
|
50835
|
-
|
|
50937
|
+
var NUM_OF_KEYS_LIMIT = 50;
|
|
50836
50938
|
/**
|
|
50837
50939
|
* limit number of depth in an object
|
|
50838
50940
|
* if an object is too deep, toString process may cause browser OOM
|
|
50839
50941
|
*/
|
|
50840
|
-
|
|
50942
|
+
var DEPTH_OF_LIMIT = 4;
|
|
50841
50943
|
/**
|
|
50842
50944
|
* serialize an HTML element by creating a shallow clone of it with text content
|
|
50843
50945
|
* and return the resulting outerHTML string (without the subtree)
|
|
@@ -50848,8 +50950,8 @@ function serializeHTML(node) {
|
|
|
50848
50950
|
if (!node || node.nodeType !== node.ELEMENT_NODE) {
|
|
50849
50951
|
return '';
|
|
50850
50952
|
}
|
|
50851
|
-
|
|
50852
|
-
|
|
50953
|
+
var nodeClone = node.cloneNode(false);
|
|
50954
|
+
var textContent = node.textContent;
|
|
50853
50955
|
if (textContent) {
|
|
50854
50956
|
nodeClone.textContent = textContent;
|
|
50855
50957
|
}
|
|
@@ -50863,7 +50965,7 @@ function isObject(obj) {
|
|
|
50863
50965
|
return false;
|
|
50864
50966
|
if (typeof obj !== 'object')
|
|
50865
50967
|
return false;
|
|
50866
|
-
|
|
50968
|
+
var proto = Object.getPrototypeOf(obj);
|
|
50867
50969
|
return proto === Object.prototype || proto === null;
|
|
50868
50970
|
}
|
|
50869
50971
|
/**
|
|
@@ -50872,11 +50974,11 @@ function isObject(obj) {
|
|
|
50872
50974
|
function isObjTooDeep(obj, limit) {
|
|
50873
50975
|
if (limit === 0)
|
|
50874
50976
|
return true;
|
|
50875
|
-
|
|
50977
|
+
var keys = Object.keys(obj);
|
|
50876
50978
|
if (keys.length === 0)
|
|
50877
50979
|
return false;
|
|
50878
|
-
return keys.some(key
|
|
50879
|
-
|
|
50980
|
+
return keys.some(function (key) {
|
|
50981
|
+
var value = obj[key];
|
|
50880
50982
|
return isObject(value) && isObjTooDeep(value, limit - 1);
|
|
50881
50983
|
});
|
|
50882
50984
|
}
|
|
@@ -50892,7 +50994,7 @@ function shouldIgnore(_obj) {
|
|
|
50892
50994
|
return false;
|
|
50893
50995
|
}
|
|
50894
50996
|
// out of keys limit
|
|
50895
|
-
|
|
50997
|
+
var keys = Object.keys(_obj);
|
|
50896
50998
|
if (keys.length > NUM_OF_KEYS_LIMIT) {
|
|
50897
50999
|
return true;
|
|
50898
51000
|
}
|
|
@@ -50924,7 +51026,7 @@ function stringify(arg) {
|
|
|
50924
51026
|
return value.toString ? value.toString() : '[object Object]';
|
|
50925
51027
|
}
|
|
50926
51028
|
if (value instanceof ArrayBuffer)
|
|
50927
|
-
return
|
|
51029
|
+
return "ArrayBuffer { byteLength: ".concat(value.byteLength, " }");
|
|
50928
51030
|
if (value instanceof Error)
|
|
50929
51031
|
return value.name + ': ' + value.message;
|
|
50930
51032
|
if (value instanceof Node) {
|
|
@@ -50932,10 +51034,10 @@ function stringify(arg) {
|
|
|
50932
51034
|
}
|
|
50933
51035
|
// Handle events
|
|
50934
51036
|
if (value instanceof Event) {
|
|
50935
|
-
|
|
51037
|
+
var eventResult = {};
|
|
50936
51038
|
// eslint-disable-next-line guard-for-in
|
|
50937
|
-
for (
|
|
50938
|
-
|
|
51039
|
+
for (var eventKey in value) {
|
|
51040
|
+
var eventValue = value[eventKey];
|
|
50939
51041
|
eventResult[eventKey] = Array.isArray(eventValue) && eventValue[0] instanceof HTMLElement
|
|
50940
51042
|
? serializeHTML(eventValue[0])
|
|
50941
51043
|
: eventValue;
|
|
@@ -50946,30 +51048,31 @@ function stringify(arg) {
|
|
|
50946
51048
|
});
|
|
50947
51049
|
}
|
|
50948
51050
|
|
|
50949
|
-
|
|
50950
|
-
|
|
51051
|
+
var StackFrame = /** @class */ (function () {
|
|
51052
|
+
function StackFrame(obj) {
|
|
50951
51053
|
this.fileName = obj.fileName || '';
|
|
50952
51054
|
this.functionName = obj.functionName || '';
|
|
50953
51055
|
this.lineNumber = obj.lineNumber;
|
|
50954
51056
|
this.columnNumber = obj.columnNumber;
|
|
50955
51057
|
}
|
|
50956
|
-
toString() {
|
|
50957
|
-
|
|
51058
|
+
StackFrame.prototype.toString = function () {
|
|
51059
|
+
var _a = this, fileName = _a.fileName, functionName = _a.functionName, _b = _a.lineNumber, lineNumber = _b === void 0 ? '' : _b, _c = _a.columnNumber, columnNumber = _c === void 0 ? '' : _c;
|
|
50958
51060
|
return functionName
|
|
50959
|
-
?
|
|
50960
|
-
:
|
|
50961
|
-
}
|
|
50962
|
-
|
|
50963
|
-
|
|
50964
|
-
|
|
50965
|
-
|
|
50966
|
-
|
|
50967
|
-
|
|
50968
|
-
|
|
51061
|
+
? "".concat(functionName, " (").concat(fileName, ":").concat(lineNumber, ":").concat(columnNumber, ")")
|
|
51062
|
+
: "".concat(fileName, ":").concat(lineNumber, ":").concat(columnNumber);
|
|
51063
|
+
};
|
|
51064
|
+
return StackFrame;
|
|
51065
|
+
}());
|
|
51066
|
+
var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
|
|
51067
|
+
var CHROME_EDGE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
|
|
51068
|
+
var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/;
|
|
51069
|
+
var LOCATION_REGEXP = /(.+?)(?::(\d+))?(?::(\d+))?$/;
|
|
51070
|
+
var DEFAULT_NUM_FRAMES_TO_SKIP = 5;
|
|
51071
|
+
var ErrorStackParser = {
|
|
50969
51072
|
/**
|
|
50970
51073
|
* Given an Error object, extract the most information from it.
|
|
50971
51074
|
*/
|
|
50972
|
-
parse(error, maxFramesToSave) {
|
|
51075
|
+
parse: function (error, maxFramesToSave) {
|
|
50973
51076
|
if (!(error === null || error === void 0 ? void 0 : error.stack))
|
|
50974
51077
|
return [];
|
|
50975
51078
|
// Chrome, Edge, Opera ≥15
|
|
@@ -50983,24 +51086,25 @@ const ErrorStackParser = {
|
|
|
50983
51086
|
return [];
|
|
50984
51087
|
},
|
|
50985
51088
|
// Separate line and column numbers from a string of the form: (URI:Line:Column)
|
|
50986
|
-
extractLocation(urlLike) {
|
|
51089
|
+
extractLocation: function (urlLike) {
|
|
50987
51090
|
// Fail-fast but return locations like "(native)"
|
|
50988
51091
|
if (urlLike.indexOf(':') === -1) {
|
|
50989
51092
|
return [urlLike];
|
|
50990
51093
|
}
|
|
50991
|
-
|
|
51094
|
+
var parts = LOCATION_REGEXP.exec(urlLike.replace(/[()]/g, ''));
|
|
50992
51095
|
if (!parts)
|
|
50993
|
-
throw new Error(
|
|
51096
|
+
throw new Error("Cannot parse given url: ".concat(urlLike));
|
|
50994
51097
|
return [parts[1], parts[2] || undefined, parts[3] || undefined];
|
|
50995
51098
|
},
|
|
50996
|
-
parseHelper
|
|
50997
|
-
|
|
50998
|
-
|
|
50999
|
-
|
|
51000
|
-
|
|
51001
|
-
|
|
51002
|
-
|
|
51003
|
-
|
|
51099
|
+
parseHelper: function (_a, error, maxFramesToSave, callback) {
|
|
51100
|
+
var regex = _a.regex, includeMatchedLine = _a.includeMatchedLine;
|
|
51101
|
+
var lines = error.stack.split('\n');
|
|
51102
|
+
var frames = [];
|
|
51103
|
+
var validFramesFound = 0;
|
|
51104
|
+
for (var i = 0; i < lines.length; i++) {
|
|
51105
|
+
var line = lines[i];
|
|
51106
|
+
var lineMatchesRegex = regex.test(line);
|
|
51107
|
+
var shouldSkipLine = (includeMatchedLine && !lineMatchesRegex) || // if line doesn't match regex and we want matched lines, skip it
|
|
51004
51108
|
(!includeMatchedLine && lineMatchesRegex); // if line does match regex but we don't want matched lines, skip it
|
|
51005
51109
|
if (shouldSkipLine)
|
|
51006
51110
|
continue;
|
|
@@ -51015,11 +51119,12 @@ const ErrorStackParser = {
|
|
|
51015
51119
|
}
|
|
51016
51120
|
return frames;
|
|
51017
51121
|
},
|
|
51018
|
-
parseChromiumStack(error, maxFramesToSave) {
|
|
51019
|
-
|
|
51020
|
-
|
|
51122
|
+
parseChromiumStack: function (error, maxFramesToSave) {
|
|
51123
|
+
var _this = this;
|
|
51124
|
+
return this.parseHelper({ regex: CHROME_EDGE_STACK_REGEXP, includeMatchedLine: true }, error, maxFramesToSave, function (line, frames) {
|
|
51125
|
+
var sanitizedLine;
|
|
51021
51126
|
if (line.indexOf('(eval ') > -1) {
|
|
51022
|
-
|
|
51127
|
+
var processedLine = line
|
|
51023
51128
|
.replace(/eval code/g, 'eval')
|
|
51024
51129
|
.replace(/(\(eval at [^()]*)|(\),.*$)/g, '');
|
|
51025
51130
|
sanitizedLine = processedLine.replace(/^\s+/, '').replace(/\(eval code/g, '(');
|
|
@@ -51029,7 +51134,7 @@ const ErrorStackParser = {
|
|
|
51029
51134
|
}
|
|
51030
51135
|
// capture and preserve the parenthesized location "(/foo/my bar.js:12:87)"
|
|
51031
51136
|
// in case it has spaces in it, as the string is split on \s+ later on
|
|
51032
|
-
|
|
51137
|
+
var location;
|
|
51033
51138
|
if (sanitizedLine.indexOf('(') > -1 && sanitizedLine.indexOf('):') > -1) {
|
|
51034
51139
|
location = sanitizedLine.match(/ (\((.+):(\d+):(\d+)\)$)/);
|
|
51035
51140
|
}
|
|
@@ -51037,22 +51142,23 @@ const ErrorStackParser = {
|
|
|
51037
51142
|
sanitizedLine = location
|
|
51038
51143
|
? sanitizedLine.replace(location[0], '')
|
|
51039
51144
|
: sanitizedLine;
|
|
51040
|
-
|
|
51145
|
+
var tokens = sanitizedLine.split(/\s+/).slice(1);
|
|
51041
51146
|
// if a location was matched, pass it to extractLocation() otherwise pop the last token
|
|
51042
|
-
|
|
51043
|
-
|
|
51044
|
-
|
|
51147
|
+
var locationParts = _this.extractLocation(location ? location[1] : tokens.pop() || '');
|
|
51148
|
+
var functionName = tokens.join(' ') || undefined;
|
|
51149
|
+
var fileName = (locationParts[0] === 'eval' || locationParts[0] === '<anonymous>') ? undefined : locationParts[0];
|
|
51045
51150
|
frames.push(new StackFrame({
|
|
51046
|
-
functionName,
|
|
51047
|
-
fileName,
|
|
51151
|
+
functionName: functionName,
|
|
51152
|
+
fileName: fileName,
|
|
51048
51153
|
lineNumber: locationParts[1],
|
|
51049
51154
|
columnNumber: locationParts[2]
|
|
51050
51155
|
}));
|
|
51051
51156
|
});
|
|
51052
51157
|
},
|
|
51053
|
-
parseFirefoxSafariStack(error, maxFramesToSave) {
|
|
51054
|
-
|
|
51055
|
-
|
|
51158
|
+
parseFirefoxSafariStack: function (error, maxFramesToSave) {
|
|
51159
|
+
var _this = this;
|
|
51160
|
+
return this.parseHelper({ regex: SAFARI_NATIVE_CODE_REGEXP, includeMatchedLine: false }, error, maxFramesToSave, function (line, frames) {
|
|
51161
|
+
var processedLine = line;
|
|
51056
51162
|
// Throw away eval information until we implement stacktrace.js/stackframe#8
|
|
51057
51163
|
if (processedLine.indexOf(' > eval') > -1) {
|
|
51058
51164
|
processedLine = processedLine.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ':$1');
|
|
@@ -51064,12 +51170,12 @@ const ErrorStackParser = {
|
|
|
51064
51170
|
}));
|
|
51065
51171
|
return;
|
|
51066
51172
|
}
|
|
51067
|
-
|
|
51068
|
-
|
|
51069
|
-
|
|
51070
|
-
|
|
51173
|
+
var functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
|
|
51174
|
+
var matches = processedLine.match(functionNameRegex);
|
|
51175
|
+
var functionName = matches && matches[1] ? matches[1] : undefined;
|
|
51176
|
+
var locationParts = _this.extractLocation(processedLine.replace(functionNameRegex, ''));
|
|
51071
51177
|
frames.push(new StackFrame({
|
|
51072
|
-
functionName,
|
|
51178
|
+
functionName: functionName,
|
|
51073
51179
|
fileName: locationParts[0],
|
|
51074
51180
|
lineNumber: locationParts[1],
|
|
51075
51181
|
columnNumber: locationParts[2]
|
|
@@ -51104,7 +51210,7 @@ function includes(str, substring) {
|
|
|
51104
51210
|
function getResourceType(blockedURI, directive) {
|
|
51105
51211
|
if (!directive || typeof directive !== 'string')
|
|
51106
51212
|
return 'resource';
|
|
51107
|
-
|
|
51213
|
+
var d = directive.toLowerCase();
|
|
51108
51214
|
if (blockedURI === 'inline') {
|
|
51109
51215
|
if (includes(d, 'script-src-attr')) {
|
|
51110
51216
|
return 'inline event handler';
|
|
@@ -51163,11 +51269,12 @@ function getResourceType(blockedURI, directive) {
|
|
|
51163
51269
|
function getDirective(policy, directiveName) {
|
|
51164
51270
|
if (!policy || !directiveName)
|
|
51165
51271
|
return '';
|
|
51166
|
-
|
|
51167
|
-
for (
|
|
51168
|
-
|
|
51169
|
-
|
|
51170
|
-
|
|
51272
|
+
var needle = directiveName.toLowerCase();
|
|
51273
|
+
for (var _i = 0, _a = policy.split(';'); _i < _a.length; _i++) {
|
|
51274
|
+
var directive = _a[_i];
|
|
51275
|
+
var trimmed = directive.trim();
|
|
51276
|
+
var lower = trimmed.toLowerCase();
|
|
51277
|
+
if (lower === needle || lower.startsWith("".concat(needle, " "))) {
|
|
51171
51278
|
return trimmed;
|
|
51172
51279
|
}
|
|
51173
51280
|
}
|
|
@@ -51189,7 +51296,7 @@ function getDirective(policy, directiveName) {
|
|
|
51189
51296
|
function getArticle(phrase) {
|
|
51190
51297
|
if (!phrase || typeof phrase !== 'string')
|
|
51191
51298
|
return 'A';
|
|
51192
|
-
|
|
51299
|
+
var c = phrase.trim().charAt(0).toLowerCase();
|
|
51193
51300
|
return includes('aeiou', c) ? 'An' : 'A';
|
|
51194
51301
|
}
|
|
51195
51302
|
/**
|
|
@@ -51232,46 +51339,47 @@ function createCspViolationMessage(blockedURI, directive, isReportOnly, original
|
|
|
51232
51339
|
return 'Content Security Policy: Unknown violation occurred.';
|
|
51233
51340
|
}
|
|
51234
51341
|
try {
|
|
51235
|
-
|
|
51342
|
+
var reportOnlyText = isReportOnly ? ' (Report-Only)' : '';
|
|
51236
51343
|
// special case for frame-ancestors since it doesn't fit our template at all
|
|
51237
51344
|
if ((directive === null || directive === void 0 ? void 0 : directive.toLowerCase()) === 'frame-ancestors') {
|
|
51238
|
-
return
|
|
51345
|
+
return "Content Security Policy".concat(reportOnlyText, ": The display of ").concat(blockedURI, " in a frame was blocked because an ancestor violates your site's frame-ancestors policy.\nCurrent CSP: \"").concat(originalPolicy, "\".");
|
|
51239
51346
|
}
|
|
51240
|
-
|
|
51241
|
-
|
|
51242
|
-
|
|
51243
|
-
|
|
51244
|
-
|
|
51245
|
-
|
|
51246
|
-
return
|
|
51347
|
+
var resourceType = getResourceType(blockedURI, directive);
|
|
51348
|
+
var article = getArticle(resourceType);
|
|
51349
|
+
var source = formatBlockedUri(blockedURI);
|
|
51350
|
+
var directiveValue = getDirective(originalPolicy, directive);
|
|
51351
|
+
var policyDisplay = directiveValue || directive;
|
|
51352
|
+
var resourceDescription = "".concat(article, " ").concat(resourceType).concat(source ? " from ".concat(source) : '');
|
|
51353
|
+
return "Content Security Policy".concat(reportOnlyText, ": ").concat(resourceDescription, " was blocked by your site's `").concat(policyDisplay, "` policy.\nCurrent CSP: \"").concat(originalPolicy, "\".");
|
|
51247
51354
|
}
|
|
51248
51355
|
catch (error) {
|
|
51249
|
-
return
|
|
51356
|
+
return "Content Security Policy: Error formatting violation message: ".concat(error.message);
|
|
51250
51357
|
}
|
|
51251
51358
|
}
|
|
51252
51359
|
|
|
51253
|
-
|
|
51254
|
-
|
|
51360
|
+
var MAX_LENGTH = 1000;
|
|
51361
|
+
var PII_PATTERN = {
|
|
51255
51362
|
ip: /\b(?:\d{1,3}\.){3}\d{1,3}\b/g,
|
|
51256
51363
|
ssn: /\b\d{3}-\d{2}-\d{4}\b/g,
|
|
51257
51364
|
creditCard: /\b(?:\d[ -]?){12,18}\d\b/g,
|
|
51258
51365
|
httpsUrls: /https:\/\/[^\s]+/g,
|
|
51259
51366
|
email: /[\w._+-]+@[\w.-]+\.\w+/g
|
|
51260
51367
|
};
|
|
51261
|
-
|
|
51262
|
-
|
|
51263
|
-
|
|
51264
|
-
|
|
51265
|
-
|
|
51368
|
+
var PII_REPLACEMENT = '*'.repeat(10);
|
|
51369
|
+
var JSON_PII_KEYS = ['password', 'email', 'key', 'token', 'auth', 'authentication', 'phone', 'address', 'ssn'];
|
|
51370
|
+
var UNABLE_TO_DISPLAY_BODY = '[Unable to display body: detected PII could not be redacted]';
|
|
51371
|
+
var joinedKeys = JSON_PII_KEYS.join('|');
|
|
51372
|
+
var keyPattern = "\"([^\"]*(?:".concat(joinedKeys, ")[^\"]*)\"");
|
|
51266
51373
|
// only scrub strings, numbers, and booleans
|
|
51267
|
-
|
|
51374
|
+
var acceptedValues = '("([^"\\\\]*(?:\\\\.[^"\\\\]*)*")|(\\d+)|(true|false))';
|
|
51268
51375
|
/**
|
|
51269
51376
|
* Truncates a string to the max length
|
|
51270
51377
|
* @access private
|
|
51271
51378
|
* @param {String} string
|
|
51272
51379
|
* @returns {String}
|
|
51273
51380
|
*/
|
|
51274
|
-
function truncate(string, includeEllipsis
|
|
51381
|
+
function truncate(string, includeEllipsis) {
|
|
51382
|
+
if (includeEllipsis === void 0) { includeEllipsis = false; }
|
|
51275
51383
|
if (string.length <= MAX_LENGTH)
|
|
51276
51384
|
return string;
|
|
51277
51385
|
if (includeEllipsis) {
|
|
@@ -51288,7 +51396,7 @@ function truncate(string, includeEllipsis = false) {
|
|
|
51288
51396
|
* @returns {String}
|
|
51289
51397
|
*/
|
|
51290
51398
|
function generateLogKey(methodName, message, stackTrace) {
|
|
51291
|
-
return
|
|
51399
|
+
return "".concat(methodName, "|").concat(message, "|").concat(stackTrace);
|
|
51292
51400
|
}
|
|
51293
51401
|
/**
|
|
51294
51402
|
* Checks if a string has 2 or more digits, a https URL, or an email address
|
|
@@ -51305,12 +51413,13 @@ function mightContainPII(string) {
|
|
|
51305
51413
|
* @param {String} string
|
|
51306
51414
|
* @returns {String}
|
|
51307
51415
|
*/
|
|
51308
|
-
function scrubPII(
|
|
51416
|
+
function scrubPII(_a) {
|
|
51417
|
+
var string = _a.string, _ = _a._;
|
|
51309
51418
|
if (!string || typeof string !== 'string')
|
|
51310
51419
|
return string;
|
|
51311
51420
|
if (!mightContainPII(string))
|
|
51312
51421
|
return string;
|
|
51313
|
-
return _.reduce(_.values(PII_PATTERN), (str, pattern)
|
|
51422
|
+
return _.reduce(_.values(PII_PATTERN), function (str, pattern) { return str.replace(pattern, PII_REPLACEMENT); }, string);
|
|
51314
51423
|
}
|
|
51315
51424
|
/**
|
|
51316
51425
|
* Scrub PII from a stringified JSON object
|
|
@@ -51319,12 +51428,14 @@ function scrubPII({ string, _ }) {
|
|
|
51319
51428
|
* @returns {String}
|
|
51320
51429
|
*/
|
|
51321
51430
|
function scrubJsonPII(string) {
|
|
51322
|
-
|
|
51431
|
+
var fullScrubRegex = new RegExp("".concat(keyPattern, "\\s*:\\s*[\\{\\[]"), 'i');
|
|
51323
51432
|
if (fullScrubRegex.test(string)) {
|
|
51324
51433
|
return UNABLE_TO_DISPLAY_BODY;
|
|
51325
51434
|
}
|
|
51326
|
-
|
|
51327
|
-
return string.replace(keyValueScrubRegex, (match, key)
|
|
51435
|
+
var keyValueScrubRegex = new RegExp("".concat(keyPattern, "\\s*:\\s*").concat(acceptedValues), 'gi');
|
|
51436
|
+
return string.replace(keyValueScrubRegex, function (match, key) {
|
|
51437
|
+
return "\"".concat(key, "\":\"").concat(PII_REPLACEMENT, "\"");
|
|
51438
|
+
});
|
|
51328
51439
|
}
|
|
51329
51440
|
/**
|
|
51330
51441
|
* Checks if a string is a JSON object
|
|
@@ -51336,7 +51447,7 @@ function scrubJsonPII(string) {
|
|
|
51336
51447
|
function mightContainJson(string, contentType) {
|
|
51337
51448
|
if (!string || typeof string !== 'string')
|
|
51338
51449
|
return false;
|
|
51339
|
-
|
|
51450
|
+
var firstChar = string.charAt(0);
|
|
51340
51451
|
if (contentType && contentType.indexOf('application/json') !== -1) {
|
|
51341
51452
|
return true;
|
|
51342
51453
|
}
|
|
@@ -51349,19 +51460,20 @@ function mightContainJson(string, contentType) {
|
|
|
51349
51460
|
* @param {String} contentType
|
|
51350
51461
|
* @returns {String}
|
|
51351
51462
|
*/
|
|
51352
|
-
function maskSensitiveFields(
|
|
51463
|
+
function maskSensitiveFields(_a) {
|
|
51464
|
+
var string = _a.string, contentType = _a.contentType, _ = _a._;
|
|
51353
51465
|
if (!string || typeof string !== 'string')
|
|
51354
51466
|
return string;
|
|
51355
51467
|
if (mightContainJson(string, contentType)) {
|
|
51356
51468
|
string = scrubJsonPII(string);
|
|
51357
51469
|
}
|
|
51358
51470
|
if (mightContainPII(string)) {
|
|
51359
|
-
string = scrubPII({ string, _ });
|
|
51471
|
+
string = scrubPII({ string: string, _: _ });
|
|
51360
51472
|
}
|
|
51361
51473
|
return string;
|
|
51362
51474
|
}
|
|
51363
51475
|
|
|
51364
|
-
|
|
51476
|
+
var DEV_LOG_TYPE = 'devlog';
|
|
51365
51477
|
function createDevLogEnvelope(pluginAPI, globalPendo) {
|
|
51366
51478
|
return {
|
|
51367
51479
|
browser_time: pluginAPI.util.getNow(),
|
|
@@ -52171,18 +52283,20 @@ function NetworkCapture() {
|
|
|
52171
52283
|
}
|
|
52172
52284
|
}
|
|
52173
52285
|
|
|
52174
|
-
|
|
52175
|
-
|
|
52176
|
-
|
|
52177
|
-
|
|
52178
|
-
|
|
52179
|
-
|
|
52180
|
-
|
|
52181
|
-
|
|
52182
|
-
|
|
52183
|
-
|
|
52184
|
-
|
|
52185
|
-
|
|
52286
|
+
var PREDICT_STEP_REGEX = /\$\$predict\$\$/;
|
|
52287
|
+
var DRAG_THRESHOLD = 5;
|
|
52288
|
+
var STYLE_ID = 'pendo-predict-plugin-styles';
|
|
52289
|
+
var PREDICT_BASE_URL = 'https://predict.pendo.io';
|
|
52290
|
+
var GUIDE_BUTTON_IDENTIFIER = 'button:contains("token")';
|
|
52291
|
+
var pluginVersion = '1.0.1';
|
|
52292
|
+
var $ = function (id) { return document.getElementById(id); };
|
|
52293
|
+
var createElement = function (tag, attrs, parent) {
|
|
52294
|
+
if (attrs === void 0) { attrs = {}; }
|
|
52295
|
+
if (parent === void 0) { parent = null; }
|
|
52296
|
+
var el = document.createElement(tag);
|
|
52297
|
+
var entries = Object.entries(attrs);
|
|
52298
|
+
for (var i = 0; i < entries.length; i++) {
|
|
52299
|
+
var _a = entries[i], key = _a[0], value = _a[1];
|
|
52186
52300
|
if (key === 'className')
|
|
52187
52301
|
el.className = value;
|
|
52188
52302
|
else if (key === 'innerHTML')
|
|
@@ -52194,69 +52308,28 @@ const createElement = (tag, attrs = {}, parent = null) => {
|
|
|
52194
52308
|
parent.appendChild(el);
|
|
52195
52309
|
return el;
|
|
52196
52310
|
};
|
|
52197
|
-
|
|
52198
|
-
|
|
52311
|
+
var injectStyles = function (pendoContainerId, log) {
|
|
52312
|
+
if (log === void 0) { log = function () { }; }
|
|
52313
|
+
var styleId = "".concat(STYLE_ID, "-").concat(pendoContainerId);
|
|
52199
52314
|
if ($(styleId)) {
|
|
52200
|
-
log(
|
|
52315
|
+
log("[predict] style already exists, skipping: ".concat(styleId));
|
|
52201
52316
|
return;
|
|
52202
52317
|
}
|
|
52203
|
-
log(
|
|
52318
|
+
log("[predict] injecting styles: ".concat(styleId));
|
|
52204
52319
|
createElement('style', {
|
|
52205
52320
|
id: styleId,
|
|
52206
|
-
textContent:
|
|
52207
|
-
#${pendoContainerId} {
|
|
52208
|
-
display: none !important;
|
|
52209
|
-
}
|
|
52210
|
-
.frame-explanation {
|
|
52211
|
-
aspect-ratio: 16/9; overflow: hidden; min-height: 300px;
|
|
52212
|
-
width: 100vw; height: 100vh; background: transparent;
|
|
52213
|
-
position: fixed; bottom: 0; right: 0; z-index: 999999; border: none;
|
|
52214
|
-
visibility: hidden; opacity: 0; pointer-events: none;
|
|
52215
|
-
transition: opacity 0.1s ease-out, visibility 0s linear 0.1s;
|
|
52216
|
-
display: none;
|
|
52217
|
-
}
|
|
52218
|
-
.frame-explanation.is-visible {
|
|
52219
|
-
visibility: visible; opacity: 1; pointer-events: auto;
|
|
52220
|
-
transition: opacity 0.1s ease-out, visibility 0s linear 0s;
|
|
52221
|
-
}
|
|
52222
|
-
.frame-explanation.is-exists {
|
|
52223
|
-
display: block !important;
|
|
52224
|
-
}
|
|
52225
|
-
.floating-modal-container {
|
|
52226
|
-
position: fixed; top: 20px; right: 20px; z-index: 500000;
|
|
52227
|
-
visibility: hidden; opacity: 0; pointer-events: none;
|
|
52228
|
-
transition: opacity 0.1s ease-out, visibility 0s linear 0.1s;
|
|
52229
|
-
border-radius: 8px; box-shadow: 0px 4px 12px 0px rgba(0,0,0,0.15);
|
|
52230
|
-
overflow: hidden; width: 384px; height: 176px;
|
|
52231
|
-
}
|
|
52232
|
-
.floating-modal-container.is-visible {
|
|
52233
|
-
visibility: visible; opacity: 1; pointer-events: auto;
|
|
52234
|
-
transition: opacity 0.1s ease-out, visibility 0s linear 0s;
|
|
52235
|
-
}
|
|
52236
|
-
.floating-modal-container.is-dragging { will-change: left, top; }
|
|
52237
|
-
.floating-modal-drag-handle {
|
|
52238
|
-
position: absolute; left: 50%; transform: translateX(-50%);
|
|
52239
|
-
top: 5px; width: calc(100% - 46px); min-width: 166px; height: 17px;
|
|
52240
|
-
z-index: 9999; transition: left 0.2s ease, right 0.2s ease;
|
|
52241
|
-
display: flex; justify-content: center; align-items: center;
|
|
52242
|
-
}
|
|
52243
|
-
.floating-modal-drag-handle svg g { fill: #A0A0A0; }
|
|
52244
|
-
.floating-modal-drag-handle:hover { cursor: grab; }
|
|
52245
|
-
.floating-modal-drag-handle:hover svg g { fill: #1f2937; }
|
|
52246
|
-
.floating-modal-drag-handle.is-dragging { cursor: grabbing; }
|
|
52247
|
-
.floating-modal-drag-handle.is-collapsed { top: 0px; }
|
|
52248
|
-
.frame-floating-modal { width: 100%; height: 100%; background: white; border: none; display: block; }
|
|
52249
|
-
`
|
|
52321
|
+
textContent: "\n #".concat(pendoContainerId, " {\n display: none !important;\n }\n .frame-explanation {\n aspect-ratio: 16/9; overflow: hidden; min-height: 300px;\n width: 100vw; height: 100vh; background: transparent;\n position: fixed; bottom: 0; right: 0; z-index: 999999; border: none;\n visibility: hidden; opacity: 0; pointer-events: none;\n transition: opacity 0.1s ease-out, visibility 0s linear 0.1s;\n display: none;\n }\n .frame-explanation.is-visible {\n visibility: visible; opacity: 1; pointer-events: auto;\n transition: opacity 0.1s ease-out, visibility 0s linear 0s;\n }\n .frame-explanation.is-exists {\n display: block !important;\n }\n .floating-modal-container {\n position: fixed; top: 20px; right: 20px; z-index: 500000;\n visibility: hidden; opacity: 0; pointer-events: none;\n transition: opacity 0.1s ease-out, visibility 0s linear 0.1s;\n border-radius: 8px; box-shadow: 0px 4px 12px 0px rgba(0,0,0,0.15);\n overflow: hidden; width: 384px; height: 176px;\n }\n .floating-modal-container.is-visible {\n visibility: visible; opacity: 1; pointer-events: auto;\n transition: opacity 0.1s ease-out, visibility 0s linear 0s;\n }\n .floating-modal-container.is-dragging { will-change: left, top; }\n .floating-modal-drag-handle {\n position: absolute; left: 50%; transform: translateX(-50%);\n top: 5px; width: calc(100% - 46px); min-width: 166px; height: 17px;\n z-index: 9999; transition: left 0.2s ease, right 0.2s ease;\n display: flex; justify-content: center; align-items: center;\n }\n .floating-modal-drag-handle svg g { fill: #A0A0A0; }\n .floating-modal-drag-handle:hover { cursor: grab; }\n .floating-modal-drag-handle:hover svg g { fill: #1f2937; }\n .floating-modal-drag-handle.is-dragging { cursor: grabbing; }\n .floating-modal-drag-handle.is-collapsed { top: 0px; }\n .frame-floating-modal { width: 100%; height: 100%; background: white; border: none; display: block; }\n ")
|
|
52250
52322
|
}, document.head);
|
|
52251
52323
|
};
|
|
52252
|
-
|
|
52324
|
+
var getRecordIdFromUrl = function (recordRegex, log) {
|
|
52253
52325
|
var _a;
|
|
52254
|
-
|
|
52255
|
-
|
|
52256
|
-
|
|
52326
|
+
if (log === void 0) { log = function () { }; }
|
|
52327
|
+
var match = window.location.href.match(recordRegex);
|
|
52328
|
+
var recordId = (_a = match === null || match === void 0 ? void 0 : match[1]) !== null && _a !== void 0 ? _a : null;
|
|
52329
|
+
log("[predict] recordId found: ".concat(recordId));
|
|
52257
52330
|
return recordId;
|
|
52258
52331
|
};
|
|
52259
|
-
|
|
52332
|
+
var safeStringify = function (value, fallback) {
|
|
52260
52333
|
try {
|
|
52261
52334
|
return JSON.stringify(value);
|
|
52262
52335
|
}
|
|
@@ -52264,21 +52337,22 @@ const safeStringify = (value, fallback) => {
|
|
|
52264
52337
|
return fallback !== null && fallback !== void 0 ? fallback : '';
|
|
52265
52338
|
}
|
|
52266
52339
|
};
|
|
52267
|
-
|
|
52340
|
+
var safeParse = function (value, fallback, log) {
|
|
52341
|
+
if (log === void 0) { log = function () { }; }
|
|
52268
52342
|
try {
|
|
52269
52343
|
return JSON.parse(value);
|
|
52270
52344
|
}
|
|
52271
52345
|
catch (error) {
|
|
52272
|
-
log(
|
|
52346
|
+
log("[predict] JSON parse error: ".concat(error));
|
|
52273
52347
|
return fallback;
|
|
52274
52348
|
}
|
|
52275
52349
|
};
|
|
52276
|
-
|
|
52277
|
-
|
|
52278
|
-
|
|
52350
|
+
var buildQueryParams = function (params) {
|
|
52351
|
+
var urlParams = new URLSearchParams();
|
|
52352
|
+
var entries = Object.entries(params);
|
|
52279
52353
|
urlParams.set('pluginVersion', pluginVersion);
|
|
52280
|
-
for (
|
|
52281
|
-
|
|
52354
|
+
for (var i = 0; i < entries.length; i++) {
|
|
52355
|
+
var _a = entries[i], key = _a[0], value = _a[1];
|
|
52282
52356
|
if (value != null) {
|
|
52283
52357
|
urlParams.set(key, typeof value === 'object' ? safeStringify(value) : String(value));
|
|
52284
52358
|
}
|
|
@@ -52286,17 +52360,17 @@ const buildQueryParams = (params) => {
|
|
|
52286
52360
|
return urlParams.toString();
|
|
52287
52361
|
};
|
|
52288
52362
|
// ----- Drag & Drop -----
|
|
52289
|
-
|
|
52290
|
-
|
|
52291
|
-
|
|
52292
|
-
|
|
52293
|
-
|
|
52294
|
-
|
|
52295
|
-
|
|
52296
|
-
|
|
52297
|
-
|
|
52298
|
-
|
|
52299
|
-
|
|
52363
|
+
var setupDragAndDrop = function (handle, container) {
|
|
52364
|
+
var isDragging = false;
|
|
52365
|
+
var hasMoved = false;
|
|
52366
|
+
var isCollapsed = false;
|
|
52367
|
+
var startX = 0;
|
|
52368
|
+
var startY = 0;
|
|
52369
|
+
var initialLeft = 0;
|
|
52370
|
+
var initialTop = 0;
|
|
52371
|
+
var rafId = null;
|
|
52372
|
+
var iframe = container.querySelector('iframe');
|
|
52373
|
+
var onMouseDown = function (e) {
|
|
52300
52374
|
if (e.button !== 0)
|
|
52301
52375
|
return;
|
|
52302
52376
|
e.preventDefault();
|
|
@@ -52306,35 +52380,35 @@ const setupDragAndDrop = (handle, container) => {
|
|
|
52306
52380
|
container.classList.add('is-dragging');
|
|
52307
52381
|
if (iframe)
|
|
52308
52382
|
iframe.style.pointerEvents = 'none';
|
|
52309
|
-
|
|
52383
|
+
var rect = container.getBoundingClientRect();
|
|
52310
52384
|
initialLeft = rect.left;
|
|
52311
52385
|
initialTop = rect.top;
|
|
52312
|
-
container.style.left =
|
|
52386
|
+
container.style.left = "".concat(initialLeft, "px");
|
|
52313
52387
|
container.style.right = 'auto';
|
|
52314
52388
|
startX = e.clientX;
|
|
52315
52389
|
startY = e.clientY;
|
|
52316
52390
|
document.addEventListener('mousemove', onMouseMove);
|
|
52317
52391
|
document.addEventListener('mouseup', onMouseUp);
|
|
52318
52392
|
};
|
|
52319
|
-
|
|
52393
|
+
var onMouseMove = function (e) {
|
|
52320
52394
|
if (!isDragging)
|
|
52321
52395
|
return;
|
|
52322
|
-
|
|
52323
|
-
|
|
52396
|
+
var deltaX = e.clientX - startX;
|
|
52397
|
+
var deltaY = e.clientY - startY;
|
|
52324
52398
|
if (Math.abs(deltaX) > DRAG_THRESHOLD || Math.abs(deltaY) > DRAG_THRESHOLD) {
|
|
52325
52399
|
hasMoved = true;
|
|
52326
52400
|
}
|
|
52327
52401
|
if (rafId)
|
|
52328
52402
|
cancelAnimationFrame(rafId);
|
|
52329
|
-
rafId = requestAnimationFrame(()
|
|
52330
|
-
|
|
52331
|
-
|
|
52332
|
-
|
|
52333
|
-
container.style.left =
|
|
52334
|
-
container.style.top =
|
|
52403
|
+
rafId = requestAnimationFrame(function () {
|
|
52404
|
+
var rect = container.getBoundingClientRect();
|
|
52405
|
+
var newLeft = Math.max(0, Math.min(initialLeft + deltaX, window.innerWidth - rect.width));
|
|
52406
|
+
var newTop = Math.max(0, Math.min(initialTop + deltaY, window.innerHeight - rect.height));
|
|
52407
|
+
container.style.left = "".concat(newLeft, "px");
|
|
52408
|
+
container.style.top = "".concat(newTop, "px");
|
|
52335
52409
|
});
|
|
52336
52410
|
};
|
|
52337
|
-
|
|
52411
|
+
var onMouseUp = function (e) {
|
|
52338
52412
|
var _a;
|
|
52339
52413
|
if (!isDragging)
|
|
52340
52414
|
return;
|
|
@@ -52352,12 +52426,12 @@ const setupDragAndDrop = (handle, container) => {
|
|
|
52352
52426
|
(_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage({ type: 'TRIGGER_EXPAND' }, PREDICT_BASE_URL);
|
|
52353
52427
|
}
|
|
52354
52428
|
};
|
|
52355
|
-
handle.setCollapsedState = (collapsed)
|
|
52429
|
+
handle.setCollapsedState = function (collapsed) {
|
|
52356
52430
|
isCollapsed = collapsed;
|
|
52357
52431
|
handle.classList.toggle('is-collapsed', collapsed);
|
|
52358
52432
|
};
|
|
52359
52433
|
handle.addEventListener('mousedown', onMouseDown);
|
|
52360
|
-
handle.cleanup = ()
|
|
52434
|
+
handle.cleanup = function () {
|
|
52361
52435
|
handle.removeEventListener('mousedown', onMouseDown);
|
|
52362
52436
|
document.removeEventListener('mousemove', onMouseMove);
|
|
52363
52437
|
document.removeEventListener('mouseup', onMouseUp);
|
|
@@ -52367,12 +52441,13 @@ const setupDragAndDrop = (handle, container) => {
|
|
|
52367
52441
|
return handle;
|
|
52368
52442
|
};
|
|
52369
52443
|
// ----- Explanation Iframe Creation -----
|
|
52370
|
-
|
|
52371
|
-
var
|
|
52372
|
-
|
|
52373
|
-
|
|
52374
|
-
|
|
52375
|
-
|
|
52444
|
+
var createExplanationIframe = function (_a) {
|
|
52445
|
+
var _b;
|
|
52446
|
+
var analysisId = _a.analysisId, recordId = _a.recordId, configuration = _a.configuration;
|
|
52447
|
+
var frameId = "frameExplanation-".concat(analysisId);
|
|
52448
|
+
(_b = $(frameId)) === null || _b === void 0 ? void 0 : _b.remove();
|
|
52449
|
+
var base = "".concat(PREDICT_BASE_URL, "/external/analysis/").concat(analysisId, "/prediction/drilldown/").concat(recordId);
|
|
52450
|
+
var params = buildQueryParams(configuration);
|
|
52376
52451
|
createElement('iframe', {
|
|
52377
52452
|
id: frameId,
|
|
52378
52453
|
className: 'frame-explanation',
|
|
@@ -52380,28 +52455,24 @@ const createExplanationIframe = ({ analysisId, recordId, configuration }) => {
|
|
|
52380
52455
|
loading: 'lazy',
|
|
52381
52456
|
referrerPolicy: 'strict-origin-when-cross-origin',
|
|
52382
52457
|
allowFullscreen: true,
|
|
52383
|
-
src:
|
|
52458
|
+
src: "".concat(base, "?").concat(params)
|
|
52384
52459
|
}, document.body);
|
|
52385
52460
|
};
|
|
52386
52461
|
// ----- Floating Modal Creation -----
|
|
52387
|
-
|
|
52388
|
-
var
|
|
52389
|
-
|
|
52390
|
-
|
|
52391
|
-
|
|
52392
|
-
|
|
52393
|
-
|
|
52394
|
-
|
|
52462
|
+
var createFloatingModal = function (_a) {
|
|
52463
|
+
var _b;
|
|
52464
|
+
var recordId = _a.recordId, configuration = _a.configuration;
|
|
52465
|
+
var flatIds = (_b = configuration.analysisIds) === null || _b === void 0 ? void 0 : _b.flat(Infinity);
|
|
52466
|
+
for (var i = 0; i < flatIds.length; i++) {
|
|
52467
|
+
createExplanationIframe({ analysisId: flatIds[i], recordId: recordId, configuration: configuration });
|
|
52468
|
+
}
|
|
52469
|
+
var container = createElement('div', { id: 'floatingModalContainer', className: 'floating-modal-container' }, document.body);
|
|
52470
|
+
var dragHandle = createElement('div', {
|
|
52395
52471
|
className: 'floating-modal-drag-handle',
|
|
52396
|
-
innerHTML:
|
|
52397
|
-
<g fill="#EBEBEB">
|
|
52398
|
-
<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"/>
|
|
52399
|
-
<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"/>
|
|
52400
|
-
</g>
|
|
52401
|
-
</svg>`
|
|
52472
|
+
innerHTML: "<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/svg\">\n <g fill=\"#EBEBEB\">\n <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\"/>\n <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\"/>\n </g>\n </svg>"
|
|
52402
52473
|
}, container);
|
|
52403
|
-
|
|
52404
|
-
|
|
52474
|
+
var baseUrl = "".concat(PREDICT_BASE_URL, "/external/analysis/prediction/summary/").concat(recordId);
|
|
52475
|
+
var params = buildQueryParams(configuration);
|
|
52405
52476
|
createElement('iframe', {
|
|
52406
52477
|
id: 'frameFloatingModal',
|
|
52407
52478
|
className: 'frame-floating-modal',
|
|
@@ -52409,133 +52480,136 @@ const createFloatingModal = ({ recordId, configuration }) => {
|
|
|
52409
52480
|
referrerPolicy: 'strict-origin-when-cross-origin',
|
|
52410
52481
|
allowFullscreen: true,
|
|
52411
52482
|
title: 'Floating Modal',
|
|
52412
|
-
src:
|
|
52483
|
+
src: "".concat(baseUrl, "?").concat(params)
|
|
52413
52484
|
}, container);
|
|
52414
52485
|
container.dragHandle = setupDragAndDrop(dragHandle, container);
|
|
52415
|
-
return ()
|
|
52486
|
+
return function () {
|
|
52416
52487
|
var _a, _b;
|
|
52417
52488
|
(_b = (_a = container.dragHandle) === null || _a === void 0 ? void 0 : _a.cleanup) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
52418
52489
|
container.remove();
|
|
52419
|
-
for (
|
|
52420
|
-
|
|
52490
|
+
for (var i = 0; i < flatIds.length; i++) {
|
|
52491
|
+
var frame = $("frameExplanation-".concat(flatIds[i]));
|
|
52421
52492
|
if (frame)
|
|
52422
52493
|
frame.remove();
|
|
52423
52494
|
}
|
|
52424
52495
|
};
|
|
52425
52496
|
};
|
|
52426
|
-
|
|
52427
|
-
|
|
52428
|
-
|
|
52497
|
+
var setupMessageListener = function (_a) {
|
|
52498
|
+
var token = _a.token, forceAccountId = _a.forceAccountId, cleanup = _a.cleanup, pendo = _a.pendo;
|
|
52499
|
+
var messageHandler = function (_a) {
|
|
52500
|
+
var _b;
|
|
52501
|
+
var origin = _a.origin, data = _a.data;
|
|
52429
52502
|
if (origin !== PREDICT_BASE_URL || !data || typeof data !== 'object')
|
|
52430
52503
|
return;
|
|
52431
|
-
|
|
52432
|
-
|
|
52433
|
-
|
|
52434
|
-
|
|
52504
|
+
var _c = data, type = _c.type, analysisId = _c.analysisId, height = _c.height, width = _c.width;
|
|
52505
|
+
var explanationFrame = $("frameExplanation-".concat(analysisId));
|
|
52506
|
+
var floatingModal = $('floatingModalContainer');
|
|
52507
|
+
var setFloatingModalSize = function () {
|
|
52435
52508
|
if (floatingModal) {
|
|
52436
|
-
floatingModal.style.height =
|
|
52437
|
-
floatingModal.style.width =
|
|
52509
|
+
floatingModal.style.height = "".concat(height, "px");
|
|
52510
|
+
floatingModal.style.width = "".concat(width, "px");
|
|
52438
52511
|
}
|
|
52439
52512
|
};
|
|
52440
|
-
|
|
52513
|
+
var setFloatingModalCollapsedState = function (collapsed) {
|
|
52441
52514
|
var _a, _b;
|
|
52442
52515
|
if (floatingModal)
|
|
52443
52516
|
(_b = (_a = floatingModal.dragHandle) === null || _a === void 0 ? void 0 : _a.setCollapsedState) === null || _b === void 0 ? void 0 : _b.call(_a, collapsed);
|
|
52444
52517
|
};
|
|
52445
|
-
|
|
52446
|
-
MODAL_INITIALIZED: ()
|
|
52518
|
+
var actions = {
|
|
52519
|
+
MODAL_INITIALIZED: function () {
|
|
52447
52520
|
var _a, _b, _c;
|
|
52448
|
-
|
|
52521
|
+
var iframe = $('frameFloatingModal');
|
|
52449
52522
|
if (iframe) {
|
|
52450
|
-
|
|
52451
|
-
|
|
52452
|
-
|
|
52523
|
+
var idToken = null;
|
|
52524
|
+
var extensionAPIKeys = null;
|
|
52525
|
+
var retrieveIDPToken = pendo.getConfigValue('retrieveIDPToken');
|
|
52453
52526
|
if (pendo._.isFunction(retrieveIDPToken)) {
|
|
52454
|
-
|
|
52527
|
+
var result = retrieveIDPToken();
|
|
52455
52528
|
if (result) {
|
|
52456
52529
|
idToken = result.idToken;
|
|
52457
52530
|
extensionAPIKeys = result.extensionAPIKeys;
|
|
52458
52531
|
}
|
|
52459
52532
|
}
|
|
52460
|
-
|
|
52461
|
-
|
|
52462
|
-
(_c = iframe.contentWindow) === null || _c === void 0 ? void 0 : _c.postMessage({ type: 'TOKEN_RECEIVED', token, idToken, extensionAPIKeys, visitorId, accountId }, PREDICT_BASE_URL);
|
|
52533
|
+
var visitorId = (_a = pendo === null || pendo === void 0 ? void 0 : pendo.getVisitorId) === null || _a === void 0 ? void 0 : _a.call(pendo);
|
|
52534
|
+
var 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);
|
|
52535
|
+
(_c = iframe.contentWindow) === null || _c === void 0 ? void 0 : _c.postMessage({ type: 'TOKEN_RECEIVED', token: token, idToken: idToken, extensionAPIKeys: extensionAPIKeys, visitorId: visitorId, accountId: accountId }, PREDICT_BASE_URL);
|
|
52463
52536
|
}
|
|
52464
52537
|
},
|
|
52465
|
-
OPEN_EXPLANATION: ()
|
|
52538
|
+
OPEN_EXPLANATION: function () {
|
|
52466
52539
|
var _a;
|
|
52467
52540
|
explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.add('is-visible');
|
|
52468
52541
|
(_a = explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(data, PREDICT_BASE_URL);
|
|
52469
52542
|
},
|
|
52470
|
-
CLOSE_EXPLANATION: ()
|
|
52471
|
-
AUTH_ERROR_EXPLANATION: ()
|
|
52543
|
+
CLOSE_EXPLANATION: function () { return explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.remove('is-visible'); },
|
|
52544
|
+
AUTH_ERROR_EXPLANATION: function () {
|
|
52472
52545
|
explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.remove('is-visible');
|
|
52473
|
-
|
|
52546
|
+
var iframe = $('frameFloatingModal');
|
|
52474
52547
|
// eslint-disable-next-line no-self-assign
|
|
52475
52548
|
if (iframe)
|
|
52476
52549
|
iframe.src = iframe.src;
|
|
52477
52550
|
},
|
|
52478
|
-
DATA_READY: ()
|
|
52551
|
+
DATA_READY: function () {
|
|
52479
52552
|
floatingModal === null || floatingModal === void 0 ? void 0 : floatingModal.classList.add('is-visible');
|
|
52480
52553
|
setFloatingModalSize();
|
|
52481
52554
|
// Use analysisIds from the message data if available, otherwise use all IDs
|
|
52482
|
-
|
|
52483
|
-
for (
|
|
52484
|
-
|
|
52555
|
+
var idsToShow = data.analysisIds || [];
|
|
52556
|
+
for (var i = 0; i < idsToShow.length; i++) {
|
|
52557
|
+
var frame = $("frameExplanation-".concat(idsToShow[i]));
|
|
52485
52558
|
if (frame)
|
|
52486
52559
|
frame.classList.add('is-exists');
|
|
52487
52560
|
}
|
|
52488
52561
|
},
|
|
52489
|
-
AUTH_ERROR: ()
|
|
52562
|
+
AUTH_ERROR: function () {
|
|
52490
52563
|
floatingModal === null || floatingModal === void 0 ? void 0 : floatingModal.classList.add('is-visible');
|
|
52491
52564
|
setFloatingModalSize();
|
|
52492
52565
|
},
|
|
52493
52566
|
CLOSE_FLOATING_MODAL: cleanup,
|
|
52494
|
-
EXPAND_FLOATING_MODAL: ()
|
|
52567
|
+
EXPAND_FLOATING_MODAL: function () {
|
|
52495
52568
|
setFloatingModalSize();
|
|
52496
52569
|
setFloatingModalCollapsedState(false);
|
|
52497
52570
|
},
|
|
52498
|
-
COLLAPSE_FLOATING_MODAL: ()
|
|
52571
|
+
COLLAPSE_FLOATING_MODAL: function () {
|
|
52499
52572
|
setFloatingModalSize();
|
|
52500
52573
|
setFloatingModalCollapsedState(true);
|
|
52501
52574
|
}
|
|
52502
52575
|
};
|
|
52503
52576
|
if (type && type in actions) {
|
|
52504
|
-
(
|
|
52577
|
+
(_b = actions === null || actions === void 0 ? void 0 : actions[type]) === null || _b === void 0 ? void 0 : _b.call(actions);
|
|
52505
52578
|
}
|
|
52506
52579
|
};
|
|
52507
52580
|
window.addEventListener('message', messageHandler);
|
|
52508
|
-
return ()
|
|
52581
|
+
return function () { return window.removeEventListener('message', messageHandler); };
|
|
52509
52582
|
};
|
|
52510
|
-
|
|
52511
|
-
var
|
|
52583
|
+
var predictGuidesScript = function (_a) {
|
|
52584
|
+
var _b;
|
|
52585
|
+
var step = _a.step, pendo = _a.pendo, cleanupArray = _a.cleanupArray, cleanup = _a.cleanup, log = _a.log;
|
|
52512
52586
|
log('[predict] initializing');
|
|
52513
52587
|
// Before anything else, inject styles so that the guide will be hidden
|
|
52514
|
-
|
|
52588
|
+
var pendoContainerId = step === null || step === void 0 ? void 0 : step.containerId;
|
|
52515
52589
|
injectStyles(pendoContainerId, log);
|
|
52516
52590
|
if (cleanupArray.length > 0) {
|
|
52517
52591
|
log('[predict] cleanupArray is not empty');
|
|
52518
52592
|
return;
|
|
52519
52593
|
}
|
|
52520
52594
|
// ----- Extract Configuration -----
|
|
52521
|
-
|
|
52595
|
+
var guideButton = (_b = step.guideElement.find(GUIDE_BUTTON_IDENTIFIER)) === null || _b === void 0 ? void 0 : _b[0];
|
|
52522
52596
|
if (!guideButton) {
|
|
52523
52597
|
log('[predict] no guide button found, aborting');
|
|
52524
52598
|
return;
|
|
52525
52599
|
}
|
|
52526
|
-
|
|
52600
|
+
var _c = safeParse(guideButton.textContent, {}, log), token = _c.token, configuration = __rest(_c, ["token"]);
|
|
52527
52601
|
if (!configuration || !token) {
|
|
52528
52602
|
log('[predict] no configuration found, aborting');
|
|
52529
52603
|
return;
|
|
52530
52604
|
}
|
|
52531
|
-
|
|
52532
|
-
|
|
52605
|
+
var recordRegex = new RegExp("/".concat(configuration.recordRegexName, "/([a-zA-Z0-9]+)(?:/|$)"));
|
|
52606
|
+
var recordId = getRecordIdFromUrl(recordRegex, log);
|
|
52533
52607
|
if (!recordId) {
|
|
52534
52608
|
log('[predict] no recordId found in URL, aborting');
|
|
52535
52609
|
return;
|
|
52536
52610
|
}
|
|
52537
|
-
cleanupArray.push(setupMessageListener({ token, forceAccountId: configuration === null || configuration === void 0 ? void 0 : configuration.forceAccountId, cleanup, pendo }));
|
|
52538
|
-
cleanupArray.push(createFloatingModal({ recordId, configuration }));
|
|
52611
|
+
cleanupArray.push(setupMessageListener({ token: token, forceAccountId: configuration === null || configuration === void 0 ? void 0 : configuration.forceAccountId, cleanup: cleanup, pendo: pendo }));
|
|
52612
|
+
cleanupArray.push(createFloatingModal({ recordId: recordId, configuration: configuration }));
|
|
52539
52613
|
};
|
|
52540
52614
|
|
|
52541
52615
|
const PredictGuides = () => {
|