@pendo/agent 2.330.2 → 2.332.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/bin/cli.js +1 -1
- package/dist/debugger-plugin.min.js +1 -1
- package/dist/dom.esm.js +2 -5
- package/dist/pendo.debugger.min.js +13 -13
- package/dist/pendo.module.js +646 -500
- package/dist/pendo.module.min.js +7 -14
- package/dist/pendo.preview.min.js +5 -5
- package/dist/servers.json +7 -7
- package/package.json +1 -1
- package/setup.js +6 -2
- package/setup.test.js +65 -0
package/dist/pendo.module.js
CHANGED
|
@@ -3569,7 +3569,7 @@ var ConfigReader = (function () {
|
|
|
3569
3569
|
* @default false
|
|
3570
3570
|
* @type {boolean}
|
|
3571
3571
|
*/
|
|
3572
|
-
addOption('preventCodeInjection', [PENDO_CONFIG_SRC, SNIPPET_SRC, GLOBAL_SRC], false);
|
|
3572
|
+
addOption('preventCodeInjection', [PENDO_CONFIG_SRC, SNIPPET_SRC, GLOBAL_SRC], false, true);
|
|
3573
3573
|
addOption('previewModeAssetPath');
|
|
3574
3574
|
addOption('useAssetHostForDesigner', [SNIPPET_SRC, PENDO_CONFIG_SRC], false);
|
|
3575
3575
|
addOption('storage.allowKeys', [SNIPPET_SRC], '*');
|
|
@@ -3733,7 +3733,6 @@ var ConfigReader = (function () {
|
|
|
3733
3733
|
});
|
|
3734
3734
|
return results;
|
|
3735
3735
|
}
|
|
3736
|
-
/* eslint-disable no-console */
|
|
3737
3736
|
return {
|
|
3738
3737
|
audit,
|
|
3739
3738
|
get(optionName, defaultValue) {
|
|
@@ -3774,7 +3773,6 @@ var ConfigReader = (function () {
|
|
|
3774
3773
|
console.groupEnd();
|
|
3775
3774
|
}
|
|
3776
3775
|
};
|
|
3777
|
-
/* eslint-enable no-console */
|
|
3778
3776
|
})();
|
|
3779
3777
|
|
|
3780
3778
|
const EXTENSION_INSTALL_TYPE = 'extension';
|
|
@@ -4010,8 +4008,8 @@ let SERVER = '';
|
|
|
4010
4008
|
let ASSET_HOST = '';
|
|
4011
4009
|
let ASSET_PATH = '';
|
|
4012
4010
|
let DESIGNER_SERVER = '';
|
|
4013
|
-
let VERSION = '2.
|
|
4014
|
-
let PACKAGE_VERSION = '2.
|
|
4011
|
+
let VERSION = '2.332.0_';
|
|
4012
|
+
let PACKAGE_VERSION = '2.332.0';
|
|
4015
4013
|
let LOADER = 'xhr';
|
|
4016
4014
|
/* eslint-enable web-sdk-eslint-rules/no-gulp-env-references */
|
|
4017
4015
|
/**
|
|
@@ -8962,7 +8960,6 @@ function dom(selection, context) {
|
|
|
8962
8960
|
return selection;
|
|
8963
8961
|
}
|
|
8964
8962
|
if (!(self instanceof dom)) {
|
|
8965
|
-
// eslint-disable-next-line new-cap
|
|
8966
8963
|
return new dom(selection, context);
|
|
8967
8964
|
}
|
|
8968
8965
|
if (!selection) {
|
|
@@ -22432,7 +22429,7 @@ function OverPosition() {
|
|
|
22432
22429
|
var badgeElem = this.element();
|
|
22433
22430
|
var target = this.target();
|
|
22434
22431
|
var elemPos = getOffsetPosition(target);
|
|
22435
|
-
var badgeStyleString = 'position:absolute;top:' + elemPos.top + 'px;left:' + elemPos.left + 'px;';
|
|
22432
|
+
var badgeStyleString = 'position:' + (elemPos.fixed ? 'fixed' : 'absolute') + ';top:' + elemPos.top + 'px;left:' + elemPos.left + 'px;';
|
|
22436
22433
|
badgeStyleString += 'height:' + elemPos.height + 'px;width:' + elemPos.width + 'px;';
|
|
22437
22434
|
badgeStyleString += 'background-color:transparent;';
|
|
22438
22435
|
setStyle(badgeElem, badgeStyleString);
|
|
@@ -28018,7 +28015,7 @@ var EventRouter = function () {
|
|
|
28018
28015
|
if (!currentGuideTerms)
|
|
28019
28016
|
return false;
|
|
28020
28017
|
return currentGuideTerms.some(function (term) {
|
|
28021
|
-
return _.contains(haystack, (term)) && term === text;
|
|
28018
|
+
return _.contains(haystack, (term)) && term.toLowerCase() === text.toLowerCase();
|
|
28022
28019
|
});
|
|
28023
28020
|
}
|
|
28024
28021
|
function searchGuides(evt) {
|
|
@@ -28458,15 +28455,28 @@ var GuideActivity = (function () {
|
|
|
28458
28455
|
return _.isString(appData.id) && appData.id.indexOf('pendo-guide-container') === 0;
|
|
28459
28456
|
}
|
|
28460
28457
|
function getGuideForEvent(appData) {
|
|
28461
|
-
|
|
28462
|
-
|
|
28458
|
+
// A `pendo-g-<id>` container id can be either a stepId or a guideId
|
|
28459
|
+
// (see building-block-guides.js / fetchAndMigrateGuide), so resolve
|
|
28460
|
+
// against both before falling back to the active guide. Without the
|
|
28461
|
+
// guideId match, a click in a guide whose container carries the guideId
|
|
28462
|
+
// drops into the element-blind getActiveGuide() fallback, which can
|
|
28463
|
+
// resolve to a different, higher-priority co-displayed guide.
|
|
28464
|
+
const containerId = getStepIdFromAppData(appData);
|
|
28465
|
+
if (containerId) {
|
|
28463
28466
|
let step;
|
|
28464
|
-
const
|
|
28465
|
-
step = _.find(guide.steps, (step) => step.id ===
|
|
28467
|
+
const guideByStep = _.find(getLocalActiveGuides(), function (guide) {
|
|
28468
|
+
step = _.find(guide.steps, (step) => step.id === containerId);
|
|
28466
28469
|
return !!step;
|
|
28467
28470
|
});
|
|
28468
|
-
if (
|
|
28469
|
-
return { guide, step };
|
|
28471
|
+
if (guideByStep && step) {
|
|
28472
|
+
return { guide: guideByStep, step };
|
|
28473
|
+
}
|
|
28474
|
+
const guideById = _.find(getLocalActiveGuides(), (guide) => guide.id === containerId);
|
|
28475
|
+
if (guideById) {
|
|
28476
|
+
const shownStep = _.find(guideById.steps, (step) => step.isShown());
|
|
28477
|
+
if (shownStep) {
|
|
28478
|
+
return { guide: guideById, step: shownStep };
|
|
28479
|
+
}
|
|
28470
28480
|
}
|
|
28471
28481
|
}
|
|
28472
28482
|
return getActiveGuide();
|
|
@@ -28523,7 +28533,8 @@ const PluginAPI = {
|
|
|
28523
28533
|
getAssetHost,
|
|
28524
28534
|
getAssetUrl,
|
|
28525
28535
|
getDataHost,
|
|
28526
|
-
SERVER
|
|
28536
|
+
SERVER,
|
|
28537
|
+
DESIGNER_SERVER
|
|
28527
28538
|
},
|
|
28528
28539
|
NodeSerializer,
|
|
28529
28540
|
q,
|
|
@@ -29161,7 +29172,7 @@ function initialize(options) {
|
|
|
29161
29172
|
if (_.isString(options)) { // treat as URL
|
|
29162
29173
|
return ajax.get(options)
|
|
29163
29174
|
.then((response) => {
|
|
29164
|
-
// eslint-disable-next-line no-global-assign
|
|
29175
|
+
// eslint-disable-next-line no-global-assign
|
|
29165
29176
|
setPendoConfig(PendoConfig = response.data);
|
|
29166
29177
|
return initialize();
|
|
29167
29178
|
});
|
|
@@ -32552,10 +32563,25 @@ var GuideDisplay = (function () {
|
|
|
32552
32563
|
// Ensure RC has completely rendered before replacing RC content
|
|
32553
32564
|
return showLocal(resourceCenter.steps[0], reason);
|
|
32554
32565
|
}
|
|
32566
|
+
function showWithDelay(step, reason, showFn) {
|
|
32567
|
+
const delay = step.getGuide().displayDelayMs;
|
|
32568
|
+
if (delay > 0 && (reason === 'auto' || reason === 'repeatGuide')) {
|
|
32569
|
+
step.lock();
|
|
32570
|
+
step._autoDisplayDelayTimer = setTimeout$1(function () {
|
|
32571
|
+
step._autoDisplayDelayTimer = null;
|
|
32572
|
+
step.unlock();
|
|
32573
|
+
showFn();
|
|
32574
|
+
}, delay);
|
|
32575
|
+
return step.isShown();
|
|
32576
|
+
}
|
|
32577
|
+
showFn();
|
|
32578
|
+
return step.isShown();
|
|
32579
|
+
}
|
|
32555
32580
|
function showLocal(step, reason) {
|
|
32556
32581
|
if (AsyncContent.hasContent(step) && ContentValidation.valid(step)) {
|
|
32557
|
-
step
|
|
32558
|
-
|
|
32582
|
+
return showWithDelay(step, reason, function () {
|
|
32583
|
+
step._show(reason);
|
|
32584
|
+
});
|
|
32559
32585
|
}
|
|
32560
32586
|
if (AsyncContent.hasContent(step) && ContentValidation.invalid(step)) {
|
|
32561
32587
|
return false;
|
|
@@ -32579,8 +32605,9 @@ var GuideDisplay = (function () {
|
|
|
32579
32605
|
return false;
|
|
32580
32606
|
}
|
|
32581
32607
|
step.unlock();
|
|
32582
|
-
step
|
|
32583
|
-
|
|
32608
|
+
return showWithDelay(step, reason, function () {
|
|
32609
|
+
step._show(reason);
|
|
32610
|
+
});
|
|
32584
32611
|
});
|
|
32585
32612
|
}
|
|
32586
32613
|
function show(step, reason) {
|
|
@@ -32736,6 +32763,8 @@ function GuideStep(guide) {
|
|
|
32736
32763
|
locked = true;
|
|
32737
32764
|
};
|
|
32738
32765
|
this.unlock = function () {
|
|
32766
|
+
clearTimeout(this._autoDisplayDelayTimer);
|
|
32767
|
+
this._autoDisplayDelayTimer = null;
|
|
32739
32768
|
locked = false;
|
|
32740
32769
|
};
|
|
32741
32770
|
this.isTimedOut = function () {
|
|
@@ -34745,7 +34774,6 @@ var PreviewModule = (function () {
|
|
|
34745
34774
|
|
|
34746
34775
|
const DebuggerModule = (() => {
|
|
34747
34776
|
const state = {
|
|
34748
|
-
isTop: undefined,
|
|
34749
34777
|
isLeader: undefined,
|
|
34750
34778
|
frameId: null,
|
|
34751
34779
|
tabId: null,
|
|
@@ -34761,7 +34789,7 @@ const DebuggerModule = (() => {
|
|
|
34761
34789
|
};
|
|
34762
34790
|
const SYNC_TYPES = {
|
|
34763
34791
|
TOP_DOWN: 'top-down',
|
|
34764
|
-
BOTTOM_UP: 'bottom-up' // changes in
|
|
34792
|
+
BOTTOM_UP: 'bottom-up' // changes in another frame update values in the leader's frames map
|
|
34765
34793
|
};
|
|
34766
34794
|
const frameSyncFields = {
|
|
34767
34795
|
debuggingEnabled: { type: SYNC_TYPES.TOP_DOWN, defaultValue: false },
|
|
@@ -34775,10 +34803,8 @@ const DebuggerModule = (() => {
|
|
|
34775
34803
|
context.commit('setFrameId', EventTracer.getFrameId());
|
|
34776
34804
|
context.commit('setTabId', EventTracer.getTabId());
|
|
34777
34805
|
context.commit('setInstallType', getInstallType());
|
|
34778
|
-
|
|
34779
|
-
|
|
34780
|
-
context.commit('isLeader', isLeader());
|
|
34781
|
-
if (isTop) {
|
|
34806
|
+
context.commit('setIsLeader', isLeader());
|
|
34807
|
+
if (isLeader()) {
|
|
34782
34808
|
const debugging = getDebuggingStorage();
|
|
34783
34809
|
context.commit('debuggingEnabled', debugging.enabled === true);
|
|
34784
34810
|
if (debugging.enableEventLogging) {
|
|
@@ -34793,6 +34819,32 @@ const DebuggerModule = (() => {
|
|
|
34793
34819
|
}
|
|
34794
34820
|
_.each(buffer.events, (event) => store.dispatch('debugger/eventCaptured', event));
|
|
34795
34821
|
},
|
|
34822
|
+
updateLeader: (context) => {
|
|
34823
|
+
const wasLeader = context.state.isLeader;
|
|
34824
|
+
const nowLeader = isLeader();
|
|
34825
|
+
context.commit('setIsLeader', nowLeader);
|
|
34826
|
+
if (nowLeader && getDebuggingStorage().enabled) {
|
|
34827
|
+
// A frame that just became the leader has no history of the other frames' synced
|
|
34828
|
+
// state, so ask them to resend it. Gate on the persisted debug-enabled storage
|
|
34829
|
+
// rather than context.state.debuggingEnabled: updateLeader runs before mount
|
|
34830
|
+
// sets that flag on a newly promoted leader, so it would still be false here.
|
|
34831
|
+
crossFrameChannel.postMessage({
|
|
34832
|
+
action: 'debugger/requestSync',
|
|
34833
|
+
frameId: context.state.frameId
|
|
34834
|
+
});
|
|
34835
|
+
}
|
|
34836
|
+
else if (wasLeader && !nowLeader) {
|
|
34837
|
+
// Was the leader, now a follower: bottom-up fields collected while we were the
|
|
34838
|
+
// leader (e.g. a top frame that briefly led before forcedLeader promoted a child)
|
|
34839
|
+
// were never synced out, so push them to the new leader now.
|
|
34840
|
+
resendBottomUpFields(context.state);
|
|
34841
|
+
}
|
|
34842
|
+
},
|
|
34843
|
+
requestSync: (context, data) => {
|
|
34844
|
+
if (context.state.frameId === data.frameId)
|
|
34845
|
+
return;
|
|
34846
|
+
resendBottomUpFields(context.state);
|
|
34847
|
+
},
|
|
34796
34848
|
join: (context, data) => {
|
|
34797
34849
|
if (context.state.frameId === data.frameId)
|
|
34798
34850
|
return;
|
|
@@ -34815,9 +34867,9 @@ const DebuggerModule = (() => {
|
|
|
34815
34867
|
if (!frameSyncFields[fieldName])
|
|
34816
34868
|
return;
|
|
34817
34869
|
const { type } = frameSyncFields[fieldName];
|
|
34818
|
-
if (type === SYNC_TYPES.TOP_DOWN && context.state.
|
|
34870
|
+
if (type === SYNC_TYPES.TOP_DOWN && context.state.isLeader)
|
|
34819
34871
|
return;
|
|
34820
|
-
if (type === SYNC_TYPES.BOTTOM_UP && !context.state.
|
|
34872
|
+
if (type === SYNC_TYPES.BOTTOM_UP && !context.state.isLeader)
|
|
34821
34873
|
return;
|
|
34822
34874
|
// To handle capturing the state change and recording it
|
|
34823
34875
|
context.commit(`_sync_${fieldName}`, { value, frameId });
|
|
@@ -34829,7 +34881,7 @@ const DebuggerModule = (() => {
|
|
|
34829
34881
|
eventCaptured: (context, data) => {
|
|
34830
34882
|
if (pendo$1.designerEnabled || isInPreviewMode() || isInDesignerPreviewMode())
|
|
34831
34883
|
return;
|
|
34832
|
-
if (!context.state.
|
|
34884
|
+
if (!context.state.isLeader) {
|
|
34833
34885
|
crossFrameChannel.postMessage({
|
|
34834
34886
|
action: 'debugger/receiveEventCaptured',
|
|
34835
34887
|
frameId: context.state.frameId,
|
|
@@ -34841,7 +34893,7 @@ const DebuggerModule = (() => {
|
|
|
34841
34893
|
}
|
|
34842
34894
|
},
|
|
34843
34895
|
receiveEventCaptured: (context, data) => {
|
|
34844
|
-
if (!context.state.
|
|
34896
|
+
if (!context.state.isLeader)
|
|
34845
34897
|
return;
|
|
34846
34898
|
context.commit('eventsCaptured', data.event);
|
|
34847
34899
|
},
|
|
@@ -34849,7 +34901,7 @@ const DebuggerModule = (() => {
|
|
|
34849
34901
|
context.commit('eventsCaptured', []);
|
|
34850
34902
|
},
|
|
34851
34903
|
onCspError: (context, data) => {
|
|
34852
|
-
if (!context.state.
|
|
34904
|
+
if (!context.state.isLeader) {
|
|
34853
34905
|
crossFrameChannel.postMessage({
|
|
34854
34906
|
action: 'debugger/recieveCspError',
|
|
34855
34907
|
frameId: context.state.frameId,
|
|
@@ -34861,7 +34913,7 @@ const DebuggerModule = (() => {
|
|
|
34861
34913
|
}
|
|
34862
34914
|
},
|
|
34863
34915
|
recieveCspError: (context, message) => {
|
|
34864
|
-
if (!context.state.
|
|
34916
|
+
if (!context.state.isLeader)
|
|
34865
34917
|
return;
|
|
34866
34918
|
context.commit('cspError', message.data);
|
|
34867
34919
|
},
|
|
@@ -34911,10 +34963,7 @@ const DebuggerModule = (() => {
|
|
|
34911
34963
|
setTabId(state, tabId) {
|
|
34912
34964
|
state.tabId = tabId;
|
|
34913
34965
|
},
|
|
34914
|
-
|
|
34915
|
-
state.isTop = isTop;
|
|
34916
|
-
},
|
|
34917
|
-
isLeader(state, isLeader) {
|
|
34966
|
+
setIsLeader(state, isLeader) {
|
|
34918
34967
|
state.isLeader = isLeader;
|
|
34919
34968
|
},
|
|
34920
34969
|
setInstallType(state, installType) {
|
|
@@ -34937,7 +34986,7 @@ const DebuggerModule = (() => {
|
|
|
34937
34986
|
},
|
|
34938
34987
|
debuggingEnabled(state, enabled) {
|
|
34939
34988
|
state.debuggingEnabled = enabled;
|
|
34940
|
-
onDebuggingEnabledChange(enabled, state.
|
|
34989
|
+
onDebuggingEnabledChange(enabled, state.isLeader);
|
|
34941
34990
|
},
|
|
34942
34991
|
excludedGuides(state, excludedGuides) {
|
|
34943
34992
|
state.excludedGuides = excludedGuides;
|
|
@@ -34988,6 +35037,17 @@ const DebuggerModule = (() => {
|
|
|
34988
35037
|
function eventCapturedFn(evt) {
|
|
34989
35038
|
store.dispatch('debugger/eventCaptured', evt.data[0]);
|
|
34990
35039
|
}
|
|
35040
|
+
function resendBottomUpFields(state) {
|
|
35041
|
+
_.each(frameSyncFields, ({ type }, fieldName) => {
|
|
35042
|
+
if (type !== SYNC_TYPES.BOTTOM_UP)
|
|
35043
|
+
return;
|
|
35044
|
+
crossFrameChannel.postMessage({
|
|
35045
|
+
action: 'debugger/sync',
|
|
35046
|
+
frameId: state.frameId,
|
|
35047
|
+
fields: { [fieldName]: state[fieldName] }
|
|
35048
|
+
});
|
|
35049
|
+
});
|
|
35050
|
+
}
|
|
34991
35051
|
function identityFn(event) {
|
|
34992
35052
|
store.commit('debugger/identity', {
|
|
34993
35053
|
visitorId: _.get(event, 'data.0.visitor_id') || pendo$1.get_visitor_id(),
|
|
@@ -35006,7 +35066,7 @@ const DebuggerModule = (() => {
|
|
|
35006
35066
|
}
|
|
35007
35067
|
const guideLoopRunning = _.partial(toggleGuideLoopRunning, true);
|
|
35008
35068
|
const guideLoopStopped = _.partial(toggleGuideLoopRunning, false);
|
|
35009
|
-
function onDebuggingEnabledChange(enabled,
|
|
35069
|
+
function onDebuggingEnabledChange(enabled, isLeader) {
|
|
35010
35070
|
if (state.debuggingEnabled === enabled)
|
|
35011
35071
|
return;
|
|
35012
35072
|
if (enabled) {
|
|
@@ -35018,7 +35078,7 @@ const DebuggerModule = (() => {
|
|
|
35018
35078
|
Events.on('eventCaptured', eventCapturedFn);
|
|
35019
35079
|
Events.on('identify', identityFn);
|
|
35020
35080
|
Events.on('urlChanged', locationFn);
|
|
35021
|
-
if (
|
|
35081
|
+
if (isLeader) {
|
|
35022
35082
|
guidesLoadedFn();
|
|
35023
35083
|
Events.on('guidesLoaded', guidesLoadedFn);
|
|
35024
35084
|
}
|
|
@@ -35030,7 +35090,7 @@ const DebuggerModule = (() => {
|
|
|
35030
35090
|
Events.off('eventCaptured', eventCapturedFn);
|
|
35031
35091
|
Events.off('identify', identityFn);
|
|
35032
35092
|
Events.off('urlChanged', locationFn);
|
|
35033
|
-
if (
|
|
35093
|
+
if (isLeader) {
|
|
35034
35094
|
Events.off('guidesLoaded', guidesLoadedFn);
|
|
35035
35095
|
}
|
|
35036
35096
|
}
|
|
@@ -35043,12 +35103,12 @@ const DebuggerModule = (() => {
|
|
|
35043
35103
|
// and wrapping it to provide standard logic around edge cases.
|
|
35044
35104
|
let setter = mutations[fieldName] || ((state, value) => { state[fieldName] = value; });
|
|
35045
35105
|
mutations[fieldName] = _.wrap(setter, (mutFn, state, value) => {
|
|
35046
|
-
// don't save fields
|
|
35047
|
-
if (!state.
|
|
35106
|
+
// don't save top-down fields locally unless we're the leader (source of them)
|
|
35107
|
+
if (!state.isLeader && type === SYNC_TYPES.TOP_DOWN)
|
|
35048
35108
|
return;
|
|
35049
35109
|
mutFn(state, value);
|
|
35050
|
-
//
|
|
35051
|
-
if (state.
|
|
35110
|
+
// the leader doesn't sync bottom-up fields outward (it's the collector)
|
|
35111
|
+
if (state.isLeader && type === SYNC_TYPES.BOTTOM_UP)
|
|
35052
35112
|
return;
|
|
35053
35113
|
crossFrameChannel.postMessage({
|
|
35054
35114
|
action: 'debugger/sync',
|
|
@@ -35065,9 +35125,9 @@ const DebuggerModule = (() => {
|
|
|
35065
35125
|
state.frames[frameId][fieldName] = frameSyncFields[fieldName].defaultValue;
|
|
35066
35126
|
}
|
|
35067
35127
|
setter(state.frames[frameId], value);
|
|
35068
|
-
// Also set as
|
|
35128
|
+
// Also set as our own value for a top-down field when we're not the leader
|
|
35069
35129
|
// conversely, we could make the getter read from the frame object *shrug*
|
|
35070
|
-
if (!state.
|
|
35130
|
+
if (!state.isLeader && type === SYNC_TYPES.TOP_DOWN) {
|
|
35071
35131
|
setter(state, value);
|
|
35072
35132
|
}
|
|
35073
35133
|
};
|
|
@@ -35500,7 +35560,7 @@ function debuggerExports() {
|
|
|
35500
35560
|
}
|
|
35501
35561
|
function startDebuggingModuleIfEnabled() {
|
|
35502
35562
|
const debugging = getDebuggingStorage();
|
|
35503
|
-
if (!debugging.enabled)
|
|
35563
|
+
if (!debugging.enabled || !isLeader())
|
|
35504
35564
|
return;
|
|
35505
35565
|
store.commit('debugger/debuggingEnabled', true);
|
|
35506
35566
|
addDebuggingFunctions();
|
|
@@ -35514,7 +35574,7 @@ function startDebuggingModuleIfEnabled() {
|
|
|
35514
35574
|
else if (typeof agentDebuggerPluginLoader === 'function') {
|
|
35515
35575
|
agentDebuggerPluginLoader();
|
|
35516
35576
|
}
|
|
35517
|
-
else {
|
|
35577
|
+
else if (!dom('#pendo-debugger-plugin').length) {
|
|
35518
35578
|
const script = document.createElement('script');
|
|
35519
35579
|
script.src = getPolicy(pendo$1).createScriptURL(getAssetUrl('debugger-plugin.min.js'));
|
|
35520
35580
|
script.setAttribute('id', 'pendo-debugger-plugin');
|
|
@@ -35628,6 +35688,12 @@ const DebuggerLauncher = (function () {
|
|
|
35628
35688
|
}
|
|
35629
35689
|
buffer.clear();
|
|
35630
35690
|
});
|
|
35691
|
+
Events.on('leaderChanged', () => {
|
|
35692
|
+
store.dispatch('debugger/updateLeader');
|
|
35693
|
+
if (store.getters['frames/isLeader']()) {
|
|
35694
|
+
startDebuggingModuleIfEnabled();
|
|
35695
|
+
}
|
|
35696
|
+
});
|
|
35631
35697
|
registerMessageHandler('pendo-debugger::launch', (data, msg) => {
|
|
35632
35698
|
if (data.config.apiKey !== pendo.apiKey)
|
|
35633
35699
|
return;
|
|
@@ -36749,7 +36815,7 @@ var validators = {
|
|
|
36749
36815
|
if (hasMax && num > max)
|
|
36750
36816
|
return false;
|
|
36751
36817
|
if (!allowDecimal && num % 1 !== 0)
|
|
36752
|
-
return false;
|
|
36818
|
+
return false;
|
|
36753
36819
|
return true;
|
|
36754
36820
|
},
|
|
36755
36821
|
characterLength(value, options = {}) {
|
|
@@ -36763,7 +36829,7 @@ var validators = {
|
|
|
36763
36829
|
if (hasMin && value.length < min)
|
|
36764
36830
|
return false;
|
|
36765
36831
|
if (hasMax && value.length > max)
|
|
36766
|
-
return false;
|
|
36832
|
+
return false;
|
|
36767
36833
|
return true;
|
|
36768
36834
|
}
|
|
36769
36835
|
};
|
|
@@ -40235,7 +40301,7 @@ class PromptPlugin {
|
|
|
40235
40301
|
this.prompts = [];
|
|
40236
40302
|
}
|
|
40237
40303
|
initialize(pendo, PluginAPI) {
|
|
40238
|
-
var _a;
|
|
40304
|
+
var _a, _b;
|
|
40239
40305
|
this.pendo = pendo;
|
|
40240
40306
|
this.api = PluginAPI;
|
|
40241
40307
|
this._ = this.pendo._;
|
|
@@ -40245,10 +40311,14 @@ class PromptPlugin {
|
|
|
40245
40311
|
this.loadConfig(this.configName)
|
|
40246
40312
|
.then(config => this.onConfigLoaded(config)).catch(() => { });
|
|
40247
40313
|
// Listen for URL changes to re-evaluate page rules
|
|
40248
|
-
//
|
|
40314
|
+
// guidesLoaded: normalizedUrl comes back from the guides payload
|
|
40315
|
+
// urlChanged: handles SPA navigation where guides may already be cached and guidesLoaded won't re-fire
|
|
40249
40316
|
(_a = this.api.Events.guidesLoaded) === null || _a === void 0 ? void 0 : _a.on(() => {
|
|
40250
40317
|
this.reEvaluatePageRules();
|
|
40251
40318
|
});
|
|
40319
|
+
(_b = this.api.Events.urlChanged) === null || _b === void 0 ? void 0 : _b.on(() => {
|
|
40320
|
+
this.reEvaluatePageRules();
|
|
40321
|
+
});
|
|
40252
40322
|
}
|
|
40253
40323
|
// a-fake-sync method - puts the api expectation of a promise in place now
|
|
40254
40324
|
// making it easier in the future if the config looking becomes a network call
|
|
@@ -41093,12 +41163,12 @@ function TextCapture() {
|
|
|
41093
41163
|
return {
|
|
41094
41164
|
name: 'TextCapture',
|
|
41095
41165
|
initialize: init,
|
|
41096
|
-
teardown,
|
|
41097
|
-
isEnabled,
|
|
41098
|
-
isTextCapturable,
|
|
41099
|
-
hasWhitelist,
|
|
41166
|
+
teardown: teardown,
|
|
41167
|
+
isEnabled: isEnabled,
|
|
41168
|
+
isTextCapturable: isTextCapturable,
|
|
41169
|
+
hasWhitelist: hasWhitelist,
|
|
41100
41170
|
serializer: textSerializer,
|
|
41101
|
-
guideActivity
|
|
41171
|
+
guideActivity: guideActivity
|
|
41102
41172
|
};
|
|
41103
41173
|
// technically not idempotent but might actually be right. not sure.
|
|
41104
41174
|
function init(pendo, PluginAPI) {
|
|
@@ -41137,30 +41207,30 @@ function TextCapture() {
|
|
|
41137
41207
|
function guideActivity(pendo, event) {
|
|
41138
41208
|
if (!isEnabled())
|
|
41139
41209
|
return;
|
|
41140
|
-
|
|
41141
|
-
|
|
41210
|
+
var _ = pendo._;
|
|
41211
|
+
var eventData = event.data[0];
|
|
41142
41212
|
if (eventData && eventData.type === 'guideActivity') {
|
|
41143
|
-
|
|
41213
|
+
var shownSteps = _.reduce(pendo.getActiveGuides({ channel: '*' }), function (shown, guide) {
|
|
41144
41214
|
if (guide.isShown()) {
|
|
41145
|
-
return shown.concat(_.filter(guide.steps, (step)
|
|
41215
|
+
return shown.concat(_.filter(guide.steps, function (step) { return step.isShown(); }));
|
|
41146
41216
|
}
|
|
41147
41217
|
return shown;
|
|
41148
41218
|
}, []);
|
|
41149
41219
|
if (!shownSteps.length)
|
|
41150
41220
|
return;
|
|
41151
|
-
|
|
41152
|
-
|
|
41153
|
-
_.find(shownSteps, (step)
|
|
41221
|
+
var findDomBlockInDomJson_1 = pendo.BuildingBlocks.BuildingBlockGuides.findDomBlockInDomJson;
|
|
41222
|
+
var elementJson_1;
|
|
41223
|
+
_.find(shownSteps, function (step) {
|
|
41154
41224
|
if (!step.domJson)
|
|
41155
41225
|
return false;
|
|
41156
|
-
|
|
41226
|
+
elementJson_1 = findDomBlockInDomJson_1(step.domJson, function (domJson) {
|
|
41157
41227
|
return domJson.props && domJson.props.id && domJson.props.id === eventData.props.ui_element_id;
|
|
41158
41228
|
});
|
|
41159
|
-
return
|
|
41229
|
+
return elementJson_1;
|
|
41160
41230
|
});
|
|
41161
|
-
if (!
|
|
41231
|
+
if (!elementJson_1)
|
|
41162
41232
|
return;
|
|
41163
|
-
eventData.props.ui_element_text =
|
|
41233
|
+
eventData.props.ui_element_text = elementJson_1.content;
|
|
41164
41234
|
}
|
|
41165
41235
|
}
|
|
41166
41236
|
function isEnabled() {
|
|
@@ -42923,22 +42993,22 @@ const startListening = (
|
|
|
42923
42993
|
};
|
|
42924
42994
|
|
|
42925
42995
|
function VocPortal() {
|
|
42926
|
-
|
|
42927
|
-
|
|
42996
|
+
var pendoGlobal;
|
|
42997
|
+
var pluginAPI;
|
|
42928
42998
|
return {
|
|
42929
42999
|
name: 'VocPortal',
|
|
42930
|
-
initialize,
|
|
42931
|
-
routeHandlerLookup,
|
|
42932
|
-
queryMessageHandler,
|
|
42933
|
-
resizeMessageHandler,
|
|
42934
|
-
teardown
|
|
43000
|
+
initialize: initialize,
|
|
43001
|
+
routeHandlerLookup: routeHandlerLookup,
|
|
43002
|
+
queryMessageHandler: queryMessageHandler,
|
|
43003
|
+
resizeMessageHandler: resizeMessageHandler,
|
|
43004
|
+
teardown: teardown
|
|
42935
43005
|
};
|
|
42936
43006
|
function initialize(pendo, PluginAPI) {
|
|
42937
43007
|
pendoGlobal = pendo;
|
|
42938
43008
|
pluginAPI = PluginAPI;
|
|
42939
|
-
|
|
43009
|
+
var frameId = PluginAPI.EventTracer.addTracerIds({}).frameId;
|
|
42940
43010
|
this.removeResizeEvent = pendoGlobal.attachEvent(window, 'resize', resizePortalIframe);
|
|
42941
|
-
startListening('VocPortal', frameId, routeHandlerLookup, ()
|
|
43011
|
+
startListening('VocPortal', frameId, routeHandlerLookup, function () { return '*'; });
|
|
42942
43012
|
}
|
|
42943
43013
|
function routeHandlerLookup(path) {
|
|
42944
43014
|
switch (path) {
|
|
@@ -42951,14 +43021,14 @@ function VocPortal() {
|
|
|
42951
43021
|
}
|
|
42952
43022
|
}
|
|
42953
43023
|
function resizePortalIframe() {
|
|
42954
|
-
|
|
42955
|
-
|
|
43024
|
+
var vocPortalRcContainer = document.getElementById('pendo-resource-center-container');
|
|
43025
|
+
var vocPortalRcDOM = pendoGlobal.dom(vocPortalRcContainer);
|
|
42956
43026
|
pluginAPI.sizeElements(vocPortalRcDOM);
|
|
42957
43027
|
}
|
|
42958
43028
|
function queryMessageHandler(_, responseHandler) {
|
|
42959
|
-
|
|
42960
|
-
|
|
42961
|
-
|
|
43029
|
+
var metadata = pendoGlobal.getSerializedMetadata();
|
|
43030
|
+
var sandBoxMode = !!pendoGlobal.designer || pluginAPI.store.getters['preview/isInPreviewMode']();
|
|
43031
|
+
var response = {
|
|
42962
43032
|
apiKey: pendoGlobal.apiKey,
|
|
42963
43033
|
url: pendoGlobal.url.externalizeURL(),
|
|
42964
43034
|
visitor: metadata.visitor,
|
|
@@ -42972,26 +43042,19 @@ function VocPortal() {
|
|
|
42972
43042
|
}
|
|
42973
43043
|
function resizeMessageHandler(msg) {
|
|
42974
43044
|
try {
|
|
42975
|
-
|
|
42976
|
-
|
|
43045
|
+
var _a = msg.data.width, widthValue = _a["value"], widthUnit = _a["unit"], widthIsImportant = _a["isImportant"];
|
|
43046
|
+
var _b = msg.data.height, heightValue = _b["value"], heightUnit = _b["unit"], heightIsImportant = _b["isImportant"];
|
|
42977
43047
|
if (typeof widthValue !== 'number' || typeof heightValue !== 'number') {
|
|
42978
43048
|
return;
|
|
42979
43049
|
}
|
|
42980
|
-
|
|
43050
|
+
var validUnits = ['px', '%', 'vh', 'vw'];
|
|
42981
43051
|
if (!pendoGlobal._.contains(validUnits, widthUnit) || !pendoGlobal._.contains(validUnits, heightUnit)) {
|
|
42982
43052
|
return;
|
|
42983
43053
|
}
|
|
42984
|
-
|
|
42985
|
-
|
|
42986
|
-
|
|
42987
|
-
pluginAPI.util.addInlineStyles('pendo-voc-portal-styles',
|
|
42988
|
-
width: ${width};
|
|
42989
|
-
height: ${height};
|
|
42990
|
-
._pendo-step-container-size {
|
|
42991
|
-
width: ${width};
|
|
42992
|
-
height: ${height};
|
|
42993
|
-
}
|
|
42994
|
-
}`, container);
|
|
43054
|
+
var width = "".concat(widthValue).concat(widthUnit).concat(widthIsImportant ? ' !important' : '');
|
|
43055
|
+
var height = "".concat(heightValue).concat(heightUnit).concat(heightIsImportant ? ' !important' : '');
|
|
43056
|
+
var container = document.getElementById('pendo-resource-center-container');
|
|
43057
|
+
pluginAPI.util.addInlineStyles('pendo-voc-portal-styles', "#pendo-resource-center-container:has(iframe[src*=\"portal\"][src*=\"mode=rc\"]) {\n width: ".concat(width, ";\n height: ").concat(height, ";\n ._pendo-step-container-size {\n width: ").concat(width, ";\n height: ").concat(height, ";\n }\n }"), container);
|
|
42995
43058
|
resizePortalIframe();
|
|
42996
43059
|
clampContainerToViewport(container);
|
|
42997
43060
|
}
|
|
@@ -43002,10 +43065,10 @@ function VocPortal() {
|
|
|
43002
43065
|
function clampContainerToViewport(container) {
|
|
43003
43066
|
if (!container)
|
|
43004
43067
|
return;
|
|
43005
|
-
|
|
43006
|
-
|
|
43068
|
+
var leftPadding = 10;
|
|
43069
|
+
var rect = container.getBoundingClientRect();
|
|
43007
43070
|
if (rect.left < leftPadding) {
|
|
43008
|
-
container.style.transform =
|
|
43071
|
+
container.style.transform = "translateX(".concat(leftPadding - rect.left, "px)");
|
|
43009
43072
|
}
|
|
43010
43073
|
else {
|
|
43011
43074
|
container.style.transform = '';
|
|
@@ -49239,61 +49302,6 @@ var n;
|
|
|
49239
49302
|
}(n || (n = {}));
|
|
49240
49303
|
return record; }
|
|
49241
49304
|
|
|
49242
|
-
var SessionRecorderBuffer = /** @class */ (function () {
|
|
49243
|
-
function SessionRecorderBuffer(interval, maxCount) {
|
|
49244
|
-
if (maxCount === void 0) { maxCount = Infinity; }
|
|
49245
|
-
this.data = [];
|
|
49246
|
-
this.sequenceNumber = 0;
|
|
49247
|
-
this.interval = interval;
|
|
49248
|
-
this.maxCount = maxCount;
|
|
49249
|
-
this.doubledMaxCount = maxCount * 2;
|
|
49250
|
-
}
|
|
49251
|
-
SessionRecorderBuffer.prototype.isEmpty = function () {
|
|
49252
|
-
return this.data.length === 0;
|
|
49253
|
-
};
|
|
49254
|
-
SessionRecorderBuffer.prototype.count = function () {
|
|
49255
|
-
return this.data.length;
|
|
49256
|
-
};
|
|
49257
|
-
SessionRecorderBuffer.prototype.clear = function () {
|
|
49258
|
-
this.data.length = 0;
|
|
49259
|
-
};
|
|
49260
|
-
SessionRecorderBuffer.prototype.clearSequence = function () {
|
|
49261
|
-
this.sequenceNumber = 0;
|
|
49262
|
-
};
|
|
49263
|
-
SessionRecorderBuffer.prototype.push = function (event) {
|
|
49264
|
-
this.data.push(event);
|
|
49265
|
-
this.checkRateLimit();
|
|
49266
|
-
};
|
|
49267
|
-
SessionRecorderBuffer.prototype.pack = function (envelope, _) {
|
|
49268
|
-
var eventsToSend = this.data.splice(0, this.maxCount);
|
|
49269
|
-
envelope.recordingPayload = eventsToSend;
|
|
49270
|
-
envelope.sequence = this.sequenceNumber;
|
|
49271
|
-
envelope.recordingPayloadCount = eventsToSend.length;
|
|
49272
|
-
if (eventsToSend.length) {
|
|
49273
|
-
envelope.browserTime = eventsToSend[0].timestamp;
|
|
49274
|
-
}
|
|
49275
|
-
envelope.recordingPayloadMetadata = _.map(eventsToSend, function (event) {
|
|
49276
|
-
var metadata = _.pick(event, 'type', 'timestamp');
|
|
49277
|
-
if (event.data) {
|
|
49278
|
-
metadata.data = _.pick(event.data, 'source', 'type', 'x', 'y', 'id', 'height', 'width', 'href');
|
|
49279
|
-
}
|
|
49280
|
-
return metadata;
|
|
49281
|
-
});
|
|
49282
|
-
this.sequenceNumber += eventsToSend.length;
|
|
49283
|
-
return envelope;
|
|
49284
|
-
};
|
|
49285
|
-
SessionRecorderBuffer.prototype.checkRateLimit = function () {
|
|
49286
|
-
var length = this.data.length;
|
|
49287
|
-
if (length >= this.doubledMaxCount && length % this.maxCount === 0) {
|
|
49288
|
-
var elapsed = this.data[length - 1].timestamp - this.data[length - this.doubledMaxCount].timestamp;
|
|
49289
|
-
if (elapsed <= this.interval && this.onRateLimit) {
|
|
49290
|
-
this.onRateLimit();
|
|
49291
|
-
}
|
|
49292
|
-
}
|
|
49293
|
-
};
|
|
49294
|
-
return SessionRecorderBuffer;
|
|
49295
|
-
}());
|
|
49296
|
-
|
|
49297
49305
|
var __assign = function() {
|
|
49298
49306
|
__assign = Object.assign || function __assign(t) {
|
|
49299
49307
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -49360,6 +49368,61 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
49360
49368
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
49361
49369
|
};
|
|
49362
49370
|
|
|
49371
|
+
var SessionRecorderBuffer = /** @class */ (function () {
|
|
49372
|
+
function SessionRecorderBuffer(interval, maxCount) {
|
|
49373
|
+
if (maxCount === void 0) { maxCount = Infinity; }
|
|
49374
|
+
this.data = [];
|
|
49375
|
+
this.sequenceNumber = 0;
|
|
49376
|
+
this.interval = interval;
|
|
49377
|
+
this.maxCount = maxCount;
|
|
49378
|
+
this.doubledMaxCount = maxCount * 2;
|
|
49379
|
+
}
|
|
49380
|
+
SessionRecorderBuffer.prototype.isEmpty = function () {
|
|
49381
|
+
return this.data.length === 0;
|
|
49382
|
+
};
|
|
49383
|
+
SessionRecorderBuffer.prototype.count = function () {
|
|
49384
|
+
return this.data.length;
|
|
49385
|
+
};
|
|
49386
|
+
SessionRecorderBuffer.prototype.clear = function () {
|
|
49387
|
+
this.data.length = 0;
|
|
49388
|
+
};
|
|
49389
|
+
SessionRecorderBuffer.prototype.clearSequence = function () {
|
|
49390
|
+
this.sequenceNumber = 0;
|
|
49391
|
+
};
|
|
49392
|
+
SessionRecorderBuffer.prototype.push = function (event) {
|
|
49393
|
+
this.data.push(event);
|
|
49394
|
+
this.checkRateLimit();
|
|
49395
|
+
};
|
|
49396
|
+
SessionRecorderBuffer.prototype.pack = function (envelope, _) {
|
|
49397
|
+
var eventsToSend = this.data.splice(0, this.maxCount);
|
|
49398
|
+
envelope.recordingPayload = eventsToSend;
|
|
49399
|
+
envelope.sequence = this.sequenceNumber;
|
|
49400
|
+
envelope.recordingPayloadCount = eventsToSend.length;
|
|
49401
|
+
if (eventsToSend.length) {
|
|
49402
|
+
envelope.browserTime = eventsToSend[0].timestamp;
|
|
49403
|
+
}
|
|
49404
|
+
envelope.recordingPayloadMetadata = _.map(eventsToSend, function (event) {
|
|
49405
|
+
var metadata = _.pick(event, 'type', 'timestamp');
|
|
49406
|
+
if (event.data) {
|
|
49407
|
+
metadata.data = _.pick(event.data, 'source', 'type', 'x', 'y', 'id', 'height', 'width', 'href');
|
|
49408
|
+
}
|
|
49409
|
+
return metadata;
|
|
49410
|
+
});
|
|
49411
|
+
this.sequenceNumber += eventsToSend.length;
|
|
49412
|
+
return envelope;
|
|
49413
|
+
};
|
|
49414
|
+
SessionRecorderBuffer.prototype.checkRateLimit = function () {
|
|
49415
|
+
var length = this.data.length;
|
|
49416
|
+
if (length >= this.doubledMaxCount && length % this.maxCount === 0) {
|
|
49417
|
+
var elapsed = this.data[length - 1].timestamp - this.data[length - this.doubledMaxCount].timestamp;
|
|
49418
|
+
if (elapsed <= this.interval && this.onRateLimit) {
|
|
49419
|
+
this.onRateLimit();
|
|
49420
|
+
}
|
|
49421
|
+
}
|
|
49422
|
+
};
|
|
49423
|
+
return SessionRecorderBuffer;
|
|
49424
|
+
}());
|
|
49425
|
+
|
|
49363
49426
|
var RECORDING_CONFIG_WORKERURL$1 = 'recording.workerUrl';
|
|
49364
49427
|
var MAX_SIZE = 2000000;
|
|
49365
49428
|
var RESOURCE_CACHING$1 = 'resourceCaching';
|
|
@@ -49596,33 +49659,33 @@ function maskText(options, text, element) {
|
|
|
49596
49659
|
return text;
|
|
49597
49660
|
}
|
|
49598
49661
|
|
|
49599
|
-
|
|
49600
|
-
|
|
49601
|
-
|
|
49602
|
-
|
|
49603
|
-
|
|
49604
|
-
|
|
49605
|
-
|
|
49606
|
-
|
|
49607
|
-
|
|
49608
|
-
|
|
49609
|
-
|
|
49610
|
-
|
|
49611
|
-
|
|
49612
|
-
|
|
49613
|
-
|
|
49614
|
-
|
|
49615
|
-
|
|
49616
|
-
|
|
49617
|
-
|
|
49662
|
+
var RECORDING_CONFIG = 'recording';
|
|
49663
|
+
var RECORDING_CONFIG_ENABLED = 'recording.enabled';
|
|
49664
|
+
var RECORDING_CONFIG_AUTO_START = 'recording.autoStart';
|
|
49665
|
+
var RECORDING_CONFIG_WORKERURL = 'recording.workerUrl';
|
|
49666
|
+
var RECORDING_CONFIG_ON_RECORDING_START = 'recording.onRecordingStart';
|
|
49667
|
+
var RECORDING_CONFIG_ON_RECORDING_STOP = 'recording.onRecordingStop';
|
|
49668
|
+
var RECORDING_CONFIG_WORKER_OVERRIDE = 'recording.workerOverride';
|
|
49669
|
+
var RECORDING_CONFIG_TREAT_IFRAME_AS_ROOT = 'recording.treatIframeAsRoot';
|
|
49670
|
+
var RECORDING_CONFIG_DISABLE_UNLOAD = 'recording.disableUnload';
|
|
49671
|
+
var RESOURCE_CACHING = 'resourceCaching';
|
|
49672
|
+
var ONE_DAY_IN_MILLISECONDS = 24 * 60 * 60 * 1000;
|
|
49673
|
+
var ONE_MINUTE_IN_MILLISECONDS = 60 * 1000;
|
|
49674
|
+
var THIRTY_MINUTES = 1000 * 60 * 30;
|
|
49675
|
+
var ONE_HUNDRED_MB_IN_BYTES = 100 * 1024 * 1024;
|
|
49676
|
+
var SESSION_RECORDING_ID = 'pendo_srId';
|
|
49677
|
+
var SESSION_RECORDING_LAST_USER_INTERACTION_EVENT = 'pendo_srLastUserInteractionEvent';
|
|
49678
|
+
var SEND_INTERVAL = 5000;
|
|
49679
|
+
var MAX_SEND_COUNT = 20000;
|
|
49680
|
+
var EVENT_TYPES = {
|
|
49618
49681
|
INCREMENTAL_SOURCE_MUTATION: 0,
|
|
49619
49682
|
FULL_SNAPSHOT: 2,
|
|
49620
49683
|
INCREMENTAL_SNAPSHOT: 3,
|
|
49621
49684
|
META: 4,
|
|
49622
49685
|
INCREMENTAL_SOURCE_INPUT: 5
|
|
49623
49686
|
};
|
|
49624
|
-
|
|
49625
|
-
|
|
49687
|
+
var SessionRecorder = /** @class */ (function () {
|
|
49688
|
+
function SessionRecorder(rrwebRecord, WorkerClass) {
|
|
49626
49689
|
this.name = 'Replay';
|
|
49627
49690
|
this.record = rrwebRecord;
|
|
49628
49691
|
this.WorkerClass = WorkerClass;
|
|
@@ -49630,8 +49693,8 @@ class SessionRecorder {
|
|
|
49630
49693
|
this.eventsSinceLastKeyFrame = 0;
|
|
49631
49694
|
this.currentRecordingSize = 0;
|
|
49632
49695
|
}
|
|
49633
|
-
addConfigOptions() {
|
|
49634
|
-
|
|
49696
|
+
SessionRecorder.prototype.addConfigOptions = function () {
|
|
49697
|
+
var cf = this.api.ConfigReader;
|
|
49635
49698
|
cf.addOption(RECORDING_CONFIG, [cf.sources.PENDO_CONFIG_SRC], {});
|
|
49636
49699
|
/**
|
|
49637
49700
|
* Determines if replay will immediately begin collecting data. If false, you can resume collecting
|
|
@@ -49717,12 +49780,12 @@ class SessionRecorder {
|
|
|
49717
49780
|
*/
|
|
49718
49781
|
cf.addOption(RECORDING_CONFIG_TREAT_IFRAME_AS_ROOT, [cf.sources.SNIPPET_SRC], undefined);
|
|
49719
49782
|
cf.addOption(RESOURCE_CACHING, [cf.sources.PENDO_CONFIG_SRC], undefined);
|
|
49720
|
-
}
|
|
49721
|
-
initialize(pendo, PluginAPI) {
|
|
49783
|
+
};
|
|
49784
|
+
SessionRecorder.prototype.initialize = function (pendo, PluginAPI) {
|
|
49722
49785
|
this.pendo = pendo;
|
|
49723
49786
|
this.api = PluginAPI;
|
|
49724
|
-
|
|
49725
|
-
|
|
49787
|
+
var bind = this.pendo._.bind;
|
|
49788
|
+
var configReader = this.api.ConfigReader;
|
|
49726
49789
|
this.buffer = new SessionRecorderBuffer(SEND_INTERVAL, MAX_SEND_COUNT);
|
|
49727
49790
|
this.buffer.onRateLimit = bind(this.rateLimitExceeded, this);
|
|
49728
49791
|
this.transport = new Transport(this.WorkerClass, this.pendo, this.api);
|
|
@@ -49740,8 +49803,8 @@ class SessionRecorder {
|
|
|
49740
49803
|
? configReader.get(RECORDING_CONFIG_ON_RECORDING_START) : function () { };
|
|
49741
49804
|
this.onRecordingStop = this.pendo._.isFunction(configReader.get(RECORDING_CONFIG_ON_RECORDING_STOP))
|
|
49742
49805
|
? configReader.get(RECORDING_CONFIG_ON_RECORDING_STOP) : function () { };
|
|
49743
|
-
|
|
49744
|
-
|
|
49806
|
+
var isSessionReplayEnabled = false;
|
|
49807
|
+
var snippetOverrideValue = configReader.get(RECORDING_CONFIG_ENABLED);
|
|
49745
49808
|
// The snippet config value should take precedence over whatever value the backend returns,
|
|
49746
49809
|
// but ONLY for replay being enabled - all other values should be taken from the backend
|
|
49747
49810
|
if (this.pendo._.isBoolean(snippetOverrideValue)) {
|
|
@@ -49760,7 +49823,7 @@ class SessionRecorder {
|
|
|
49760
49823
|
this.api.log.info('Session Replay is disabled because excludeNonGuideAnalytics is enabled');
|
|
49761
49824
|
return;
|
|
49762
49825
|
}
|
|
49763
|
-
|
|
49826
|
+
var sessionIdKey = this.sessionIdKey = "".concat(SESSION_RECORDING_ID, ".").concat(this.pendo.apiKey);
|
|
49764
49827
|
this.pendo.recording = {
|
|
49765
49828
|
start: bind(this.start, this),
|
|
49766
49829
|
stop: bind(this.stop, this)
|
|
@@ -49776,10 +49839,10 @@ class SessionRecorder {
|
|
|
49776
49839
|
this.api.attachEvent(this.api.Events, 'tabIdChanged:self', bind(this.handleTabIdChange, this))
|
|
49777
49840
|
];
|
|
49778
49841
|
// APP-153357 Zone.js could bypass filterCrossWindowMessages (don't use attachEvent)
|
|
49779
|
-
|
|
49780
|
-
|
|
49842
|
+
var channel = this.api.frames.getChannel();
|
|
49843
|
+
var frameMessageHandler = bind(this._frameMessage, this);
|
|
49781
49844
|
channel.addEventListener('message', frameMessageHandler);
|
|
49782
|
-
this.subscriptions.push(()
|
|
49845
|
+
this.subscriptions.push(function () {
|
|
49783
49846
|
channel.removeEventListener('message', frameMessageHandler);
|
|
49784
49847
|
});
|
|
49785
49848
|
if (this.api.store.getters['frames/isReady']()) {
|
|
@@ -49807,8 +49870,8 @@ class SessionRecorder {
|
|
|
49807
49870
|
* @label SESSION_RECORDING_LAST_USER_INTERACTION_EVENT
|
|
49808
49871
|
*/
|
|
49809
49872
|
this.api.agentStorage.registry.addSession(SESSION_RECORDING_LAST_USER_INTERACTION_EVENT);
|
|
49810
|
-
}
|
|
49811
|
-
teardown() {
|
|
49873
|
+
};
|
|
49874
|
+
SessionRecorder.prototype.teardown = function () {
|
|
49812
49875
|
delete this.pendo.recording;
|
|
49813
49876
|
delete this.allowStart;
|
|
49814
49877
|
this.pendo._.each(this.subscriptions, function (unsubscribe) {
|
|
@@ -49818,35 +49881,36 @@ class SessionRecorder {
|
|
|
49818
49881
|
this.subscriptions.length = 0;
|
|
49819
49882
|
this.stop();
|
|
49820
49883
|
this.transport.stop();
|
|
49821
|
-
}
|
|
49822
|
-
ready() {
|
|
49884
|
+
};
|
|
49885
|
+
SessionRecorder.prototype.ready = function () {
|
|
49823
49886
|
if (this.api.ConfigReader.get(RECORDING_CONFIG_AUTO_START) !== false) {
|
|
49824
49887
|
this.start();
|
|
49825
49888
|
}
|
|
49826
|
-
}
|
|
49827
|
-
addPageLifecycleListeners() {
|
|
49889
|
+
};
|
|
49890
|
+
SessionRecorder.prototype.addPageLifecycleListeners = function () {
|
|
49891
|
+
var _this = this;
|
|
49828
49892
|
// It's important these event listeners use the capture phase, so making it explicit.
|
|
49829
|
-
|
|
49830
|
-
this.pendo._.each(['pageshow', 'focus', 'blur', 'visibilitychange', 'resume'], (type)
|
|
49831
|
-
|
|
49893
|
+
var useCapture = true;
|
|
49894
|
+
this.pendo._.each(['pageshow', 'focus', 'blur', 'visibilitychange', 'resume'], function (type) {
|
|
49895
|
+
_this.pageLifecycleListeners.push(_this.api.attachEventInternal(window, type, _this.pendo._.bind(_this.checkPageLifecycleState, _this), useCapture));
|
|
49832
49896
|
});
|
|
49833
|
-
}
|
|
49834
|
-
removePageLifecycleListeners() {
|
|
49897
|
+
};
|
|
49898
|
+
SessionRecorder.prototype.removePageLifecycleListeners = function () {
|
|
49835
49899
|
this.pendo._.each(this.pageLifecycleListeners, function (teardownFn) {
|
|
49836
49900
|
teardownFn();
|
|
49837
49901
|
});
|
|
49838
49902
|
this.pageLifecycleListeners = [];
|
|
49839
|
-
}
|
|
49840
|
-
checkPageLifecycleState() {
|
|
49841
|
-
|
|
49903
|
+
};
|
|
49904
|
+
SessionRecorder.prototype.checkPageLifecycleState = function () {
|
|
49905
|
+
var state = this.getPageLifecycleState();
|
|
49842
49906
|
if (state === 'active' || state === 'passive') {
|
|
49843
49907
|
if (!this.isRecording() && this.allowStart) {
|
|
49844
49908
|
this.removePageLifecycleListeners();
|
|
49845
49909
|
this.ready();
|
|
49846
49910
|
}
|
|
49847
49911
|
}
|
|
49848
|
-
}
|
|
49849
|
-
getPageLifecycleState() {
|
|
49912
|
+
};
|
|
49913
|
+
SessionRecorder.prototype.getPageLifecycleState = function () {
|
|
49850
49914
|
if (document.visibilityState === 'hidden') {
|
|
49851
49915
|
return 'hidden';
|
|
49852
49916
|
}
|
|
@@ -49854,8 +49918,9 @@ class SessionRecorder {
|
|
|
49854
49918
|
return 'active';
|
|
49855
49919
|
}
|
|
49856
49920
|
return 'passive';
|
|
49857
|
-
}
|
|
49858
|
-
changeIdentity(identifyEvent) {
|
|
49921
|
+
};
|
|
49922
|
+
SessionRecorder.prototype.changeIdentity = function (identifyEvent) {
|
|
49923
|
+
var _this = this;
|
|
49859
49924
|
if (!this.allowStart)
|
|
49860
49925
|
return;
|
|
49861
49926
|
clearTimeout(this._changeIdentityTimer);
|
|
@@ -49870,55 +49935,56 @@ class SessionRecorder {
|
|
|
49870
49935
|
}
|
|
49871
49936
|
this.visitorId = identifyEvent.data[0].visitor_id;
|
|
49872
49937
|
this.accountId = identifyEvent.data[0].account_id;
|
|
49873
|
-
this._changeIdentityTimer = setTimeout$1(()
|
|
49874
|
-
|
|
49938
|
+
this._changeIdentityTimer = setTimeout$1(function () {
|
|
49939
|
+
_this._start();
|
|
49875
49940
|
}, 500);
|
|
49876
|
-
}
|
|
49877
|
-
changeMetadata(metadataEvent) {
|
|
49878
|
-
|
|
49941
|
+
};
|
|
49942
|
+
SessionRecorder.prototype.changeMetadata = function (metadataEvent) {
|
|
49943
|
+
var _a = metadataEvent.data[0], hashChanged = _a.hashChanged, options = _a.options;
|
|
49879
49944
|
if (this.allowStart && hashChanged) {
|
|
49880
49945
|
clearTimeout(this._changeIdentityTimer);
|
|
49881
49946
|
this.visitorId = options.visitor.id;
|
|
49882
49947
|
this.accountId = options.account.id;
|
|
49883
49948
|
return this.checkVisitorEligibility();
|
|
49884
49949
|
}
|
|
49885
|
-
}
|
|
49886
|
-
checkVisitorEligibility(continuationCallback) {
|
|
49950
|
+
};
|
|
49951
|
+
SessionRecorder.prototype.checkVisitorEligibility = function (continuationCallback) {
|
|
49952
|
+
var _this = this;
|
|
49887
49953
|
if (!this.isRecording() && this.pendo._.isNull(this.visitorId) && this.pendo._.isNull(this.accountId))
|
|
49888
49954
|
return;
|
|
49889
49955
|
this.isCheckingVisitorEligibility = true;
|
|
49890
|
-
return this.fetchVisitorConfig().then(visitorConfig
|
|
49891
|
-
if ((!visitorConfig || !visitorConfig.enable) &&
|
|
49892
|
-
|
|
49956
|
+
return this.fetchVisitorConfig().then(function (visitorConfig) {
|
|
49957
|
+
if ((!visitorConfig || !visitorConfig.enable) && _this.isRecording()) {
|
|
49958
|
+
_this.stop();
|
|
49893
49959
|
}
|
|
49894
|
-
if (visitorConfig && visitorConfig.enable &&
|
|
49960
|
+
if (visitorConfig && visitorConfig.enable && _this.isRecording()) {
|
|
49895
49961
|
if (continuationCallback) {
|
|
49896
|
-
continuationCallback.call(
|
|
49962
|
+
continuationCallback.call(_this);
|
|
49897
49963
|
}
|
|
49898
|
-
|
|
49964
|
+
_this.api.Events.trigger('recording:unpaused');
|
|
49899
49965
|
}
|
|
49900
|
-
if (visitorConfig && visitorConfig.enable && !
|
|
49901
|
-
|
|
49966
|
+
if (visitorConfig && visitorConfig.enable && !_this.isRecording()) {
|
|
49967
|
+
_this._startRecordingForVisitor(visitorConfig);
|
|
49902
49968
|
}
|
|
49903
|
-
|
|
49904
|
-
})
|
|
49905
|
-
|
|
49906
|
-
|
|
49907
|
-
|
|
49969
|
+
_this.isCheckingVisitorEligibility = false;
|
|
49970
|
+
})["catch"](function (e) {
|
|
49971
|
+
_this.isCheckingVisitorEligibility = false;
|
|
49972
|
+
_this.api.log.critical('Failed to re-fetch recording config', { error: e });
|
|
49973
|
+
_this.logStopReason('VISITOR_CONFIG_ERROR');
|
|
49908
49974
|
});
|
|
49909
|
-
}
|
|
49910
|
-
snapshot() {
|
|
49975
|
+
};
|
|
49976
|
+
SessionRecorder.prototype.snapshot = function () {
|
|
49911
49977
|
if (!this.isRecording())
|
|
49912
49978
|
return;
|
|
49913
49979
|
this.send();
|
|
49914
49980
|
this.record.takeFullSnapshot();
|
|
49915
|
-
}
|
|
49916
|
-
isRecording() {
|
|
49981
|
+
};
|
|
49982
|
+
SessionRecorder.prototype.isRecording = function () {
|
|
49917
49983
|
return this.interval != null;
|
|
49918
|
-
}
|
|
49919
|
-
recordingConfig(visitorConfig) {
|
|
49920
|
-
|
|
49921
|
-
|
|
49984
|
+
};
|
|
49985
|
+
SessionRecorder.prototype.recordingConfig = function (visitorConfig) {
|
|
49986
|
+
var recordingOptions = this.pendo._.extend({}, this.config.options, visitorConfig);
|
|
49987
|
+
var maskOptions = {
|
|
49922
49988
|
maskAllText: recordingOptions.privateByDefault != null ? recordingOptions.privateByDefault : true,
|
|
49923
49989
|
maskTextSelector: ['.pendo-sr-mask'].concat(recordingOptions.maskedSelectors || []).join(','),
|
|
49924
49990
|
unmaskTextSelector: ['.pendo-sr-unmask'].concat(recordingOptions.unmaskedSelectors || []).join(','),
|
|
@@ -49933,9 +49999,9 @@ class SessionRecorder {
|
|
|
49933
49999
|
password: true,
|
|
49934
50000
|
tel: true
|
|
49935
50001
|
});
|
|
49936
|
-
|
|
49937
|
-
|
|
49938
|
-
|
|
50002
|
+
var blockedSelectors = ['.pendo-ignore', '.pendo-sr-ignore'].concat(recordingOptions.blockedSelectors || []);
|
|
50003
|
+
var hiddenSelectors = ['.pendo-sr-hide'].concat(recordingOptions.hiddenSelectors || []);
|
|
50004
|
+
var config = {
|
|
49939
50005
|
maskInputFn: this.pendo._.partial(maskInput, maskOptions),
|
|
49940
50006
|
maskTextFn: this.pendo._.partial(maskText, maskOptions),
|
|
49941
50007
|
maskTextSelector: '*',
|
|
@@ -49949,7 +50015,7 @@ class SessionRecorder {
|
|
|
49949
50015
|
emitFromIframe: !!this.api.ConfigReader.get(RECORDING_CONFIG_TREAT_IFRAME_AS_ROOT)
|
|
49950
50016
|
};
|
|
49951
50017
|
return config;
|
|
49952
|
-
}
|
|
50018
|
+
};
|
|
49953
50019
|
/**
|
|
49954
50020
|
* Used to start collecting replay data.
|
|
49955
50021
|
*
|
|
@@ -49960,67 +50026,71 @@ class SessionRecorder {
|
|
|
49960
50026
|
* @example
|
|
49961
50027
|
* pendo.recording.start()
|
|
49962
50028
|
*/
|
|
49963
|
-
start() {
|
|
50029
|
+
SessionRecorder.prototype.start = function () {
|
|
49964
50030
|
this._restartPtm = this.api.analytics.ptm().pause();
|
|
49965
50031
|
this.allowStart = true;
|
|
49966
50032
|
this.visitorId = this.pendo.get_visitor_id();
|
|
49967
50033
|
this.accountId = this.pendo.get_account_id();
|
|
49968
50034
|
this._start();
|
|
49969
|
-
}
|
|
49970
|
-
_markEvents(events) {
|
|
50035
|
+
};
|
|
50036
|
+
SessionRecorder.prototype._markEvents = function (events) {
|
|
49971
50037
|
if (!this.recordingId || !this.isRecording())
|
|
49972
50038
|
return;
|
|
49973
|
-
for (var
|
|
50039
|
+
for (var _i = 0, events_1 = events; _i < events_1.length; _i++) {
|
|
50040
|
+
var e = events_1[_i];
|
|
49974
50041
|
if ((e.visitor_id === this.visitorId || e.visitorId === this.visitorId) && e.type !== 'identify') {
|
|
49975
50042
|
e.recordingId = this.recordingId;
|
|
49976
50043
|
e.recordingSessionId = this.sessionId(this.recordingId);
|
|
49977
50044
|
}
|
|
49978
50045
|
}
|
|
49979
|
-
}
|
|
49980
|
-
restartPtm() {
|
|
50046
|
+
};
|
|
50047
|
+
SessionRecorder.prototype.restartPtm = function () {
|
|
49981
50048
|
if (this.pendo._.isFunction(this._restartPtm)) {
|
|
49982
50049
|
this._markEvents(this.pendo.buffers.events);
|
|
49983
|
-
for (var
|
|
50050
|
+
for (var _i = 0, _a = this.pendo.buffers.silos; _i < _a.length; _i++) {
|
|
50051
|
+
var silo = _a[_i];
|
|
49984
50052
|
this._markEvents(silo);
|
|
49985
50053
|
}
|
|
49986
50054
|
this._restartPtm();
|
|
49987
50055
|
this._restartPtm = null;
|
|
49988
50056
|
}
|
|
49989
|
-
}
|
|
49990
|
-
_start() {
|
|
50057
|
+
};
|
|
50058
|
+
SessionRecorder.prototype._start = function () {
|
|
50059
|
+
var _this = this;
|
|
49991
50060
|
if (this.isRecording())
|
|
49992
50061
|
return;
|
|
49993
50062
|
if (!this.pendo.isSendingEvents())
|
|
49994
50063
|
return;
|
|
49995
50064
|
if (!this.allowStart)
|
|
49996
50065
|
return;
|
|
49997
|
-
return this.fetchVisitorConfig().then(visitorConfig
|
|
49998
|
-
if (!
|
|
50066
|
+
return this.fetchVisitorConfig().then(function (visitorConfig) {
|
|
50067
|
+
if (!_this.allowStart)
|
|
49999
50068
|
return;
|
|
50000
50069
|
if (!visitorConfig || !visitorConfig.enable) {
|
|
50001
|
-
|
|
50002
|
-
|
|
50070
|
+
_this.restartPtm();
|
|
50071
|
+
_this.logStopReason('VISITOR_DISABLED');
|
|
50003
50072
|
return;
|
|
50004
50073
|
}
|
|
50005
|
-
|
|
50006
|
-
})
|
|
50007
|
-
|
|
50074
|
+
_this._startRecordingForVisitor(visitorConfig);
|
|
50075
|
+
})["catch"](function (e) {
|
|
50076
|
+
_this.restartPtm();
|
|
50008
50077
|
if (e && /Failed to fetch/.test(e.toString())) {
|
|
50009
50078
|
return;
|
|
50010
50079
|
}
|
|
50011
|
-
|
|
50080
|
+
_this.api.log.critical('Failed to fetch recording config', {
|
|
50012
50081
|
error: e,
|
|
50013
|
-
visitorId:
|
|
50014
|
-
accountId:
|
|
50015
|
-
url:
|
|
50082
|
+
visitorId: _this.visitorId,
|
|
50083
|
+
accountId: _this.accountId,
|
|
50084
|
+
url: _this.pendo.url.get()
|
|
50016
50085
|
});
|
|
50017
|
-
|
|
50086
|
+
_this.logStopReason('VISITOR_CONFIG_ERROR');
|
|
50018
50087
|
});
|
|
50019
|
-
}
|
|
50020
|
-
_startRecordingForVisitor(visitorConfig) {
|
|
50088
|
+
};
|
|
50089
|
+
SessionRecorder.prototype._startRecordingForVisitor = function (visitorConfig) {
|
|
50090
|
+
var _this = this;
|
|
50021
50091
|
this.api.Events.trigger('recording:unpaused');
|
|
50022
50092
|
this.transport.start(this.config);
|
|
50023
|
-
|
|
50093
|
+
var disableFallback = this.pendo._.get(this.config, 'disableFallback', true);
|
|
50024
50094
|
if (disableFallback && !this.transport.worker) {
|
|
50025
50095
|
this.restartPtm();
|
|
50026
50096
|
this.pendo.log('Worker failed to start and main thread fallback is disabled. Recording prevented from starting.');
|
|
@@ -50032,9 +50102,9 @@ class SessionRecorder {
|
|
|
50032
50102
|
this.visitorConfig = visitorConfig;
|
|
50033
50103
|
this.clearOldSessionId();
|
|
50034
50104
|
this.sendQueue.start();
|
|
50035
|
-
this.interval = setInterval(()
|
|
50036
|
-
if (!
|
|
50037
|
-
|
|
50105
|
+
this.interval = setInterval(function () {
|
|
50106
|
+
if (!_this.sendQueue.failed()) {
|
|
50107
|
+
_this.send();
|
|
50038
50108
|
}
|
|
50039
50109
|
}, SEND_INTERVAL);
|
|
50040
50110
|
var config = this.recordingConfig(visitorConfig);
|
|
@@ -50049,8 +50119,8 @@ class SessionRecorder {
|
|
|
50049
50119
|
this.restartPtm();
|
|
50050
50120
|
this.logStopReason('RECORDING_ERROR');
|
|
50051
50121
|
}
|
|
50052
|
-
}
|
|
50053
|
-
_sendIds() {
|
|
50122
|
+
};
|
|
50123
|
+
SessionRecorder.prototype._sendIds = function () {
|
|
50054
50124
|
if (window != window.top)
|
|
50055
50125
|
return;
|
|
50056
50126
|
this.api.frames.getChannel().postMessage({
|
|
@@ -50059,16 +50129,16 @@ class SessionRecorder {
|
|
|
50059
50129
|
_sessionId: this._sessionId,
|
|
50060
50130
|
topId: this.api.store.state.frames.topId
|
|
50061
50131
|
});
|
|
50062
|
-
}
|
|
50063
|
-
_refreshIds() {
|
|
50132
|
+
};
|
|
50133
|
+
SessionRecorder.prototype._refreshIds = function () {
|
|
50064
50134
|
if (window == window.top)
|
|
50065
50135
|
return;
|
|
50066
50136
|
this.api.frames.getChannel().postMessage({
|
|
50067
50137
|
type: 'pendo:sr:refresh'
|
|
50068
50138
|
});
|
|
50069
|
-
}
|
|
50070
|
-
_frameMessage(e) {
|
|
50071
|
-
|
|
50139
|
+
};
|
|
50140
|
+
SessionRecorder.prototype._frameMessage = function (e) {
|
|
50141
|
+
var message = e.data;
|
|
50072
50142
|
if (message.type === 'pendo:sr:id') {
|
|
50073
50143
|
// When useBroadcastChannel is true, code in filterCrossWindowMessages restricts messages to frames in the
|
|
50074
50144
|
// current browser window/tab. Due to a race condition in clone-detection, you can have two tabs that
|
|
@@ -50084,17 +50154,18 @@ class SessionRecorder {
|
|
|
50084
50154
|
else if (message.type === 'pendo:sr:refresh' && window == window.top) {
|
|
50085
50155
|
this._sendIds();
|
|
50086
50156
|
}
|
|
50087
|
-
}
|
|
50088
|
-
clearSessionId() {
|
|
50157
|
+
};
|
|
50158
|
+
SessionRecorder.prototype.clearSessionId = function () {
|
|
50089
50159
|
delete this._sessionId;
|
|
50090
50160
|
this.api.sessionStorage.removeItem(SESSION_RECORDING_ID);
|
|
50091
50161
|
this.api.sessionStorage.removeItem(this.sessionIdKey);
|
|
50092
|
-
}
|
|
50093
|
-
sessionId
|
|
50162
|
+
};
|
|
50163
|
+
SessionRecorder.prototype.sessionId = function (defaultId) {
|
|
50164
|
+
if (defaultId === void 0) { defaultId = this.pendo.randomString(16); }
|
|
50094
50165
|
if (!this._sessionId) {
|
|
50095
|
-
|
|
50166
|
+
var currentSessionId = this.api.sessionStorage.getItem(this.sessionIdKey);
|
|
50096
50167
|
if (!currentSessionId) {
|
|
50097
|
-
|
|
50168
|
+
var legacySessionId = this.api.sessionStorage.getItem(SESSION_RECORDING_ID);
|
|
50098
50169
|
if (legacySessionId) {
|
|
50099
50170
|
currentSessionId = legacySessionId;
|
|
50100
50171
|
this.api.sessionStorage.removeItem(SESSION_RECORDING_ID);
|
|
@@ -50107,41 +50178,41 @@ class SessionRecorder {
|
|
|
50107
50178
|
this._sessionId = currentSessionId;
|
|
50108
50179
|
}
|
|
50109
50180
|
return this._sessionId;
|
|
50110
|
-
}
|
|
50111
|
-
clearOldSessionId() {
|
|
50112
|
-
|
|
50181
|
+
};
|
|
50182
|
+
SessionRecorder.prototype.clearOldSessionId = function () {
|
|
50183
|
+
var lastUserInteractionEventInfo = this.getLastUserInteractionEventInformation();
|
|
50113
50184
|
if (lastUserInteractionEventInfo) {
|
|
50114
|
-
|
|
50115
|
-
|
|
50116
|
-
|
|
50185
|
+
var lastEmitTime = lastUserInteractionEventInfo.timestamp;
|
|
50186
|
+
var sameVisitor = lastUserInteractionEventInfo.visitorId === this.visitorId && lastUserInteractionEventInfo.accountId === this.accountId;
|
|
50187
|
+
var withinInactivityLimit = lastEmitTime > Date.now() - this.pendo._.get(this.visitorConfig, 'inactivityDuration', THIRTY_MINUTES);
|
|
50117
50188
|
if (sameVisitor && withinInactivityLimit)
|
|
50118
50189
|
return;
|
|
50119
50190
|
}
|
|
50120
50191
|
this.clearSessionInfo();
|
|
50121
50192
|
this.isNewSession = true;
|
|
50122
|
-
}
|
|
50123
|
-
clearSessionInfo() {
|
|
50193
|
+
};
|
|
50194
|
+
SessionRecorder.prototype.clearSessionInfo = function () {
|
|
50124
50195
|
this.currentRecordingSize = 0;
|
|
50125
50196
|
this.clearSessionId();
|
|
50126
50197
|
this.clearLastUserInteractionEventInformation();
|
|
50127
|
-
}
|
|
50128
|
-
isUserInteraction(event) {
|
|
50198
|
+
};
|
|
50199
|
+
SessionRecorder.prototype.isUserInteraction = function (event) {
|
|
50129
50200
|
if (event.type !== EVENT_TYPES.INCREMENTAL_SNAPSHOT) {
|
|
50130
50201
|
return false;
|
|
50131
50202
|
}
|
|
50132
50203
|
return event.data.source > EVENT_TYPES.INCREMENTAL_SOURCE_MUTATION && event.data.source <= EVENT_TYPES.INCREMENTAL_SOURCE_INPUT;
|
|
50133
|
-
}
|
|
50134
|
-
storeLastUserInteractionEventInformation(event, visitorId, accountId, skipUserInteractionCheck) {
|
|
50204
|
+
};
|
|
50205
|
+
SessionRecorder.prototype.storeLastUserInteractionEventInformation = function (event, visitorId, accountId, skipUserInteractionCheck) {
|
|
50135
50206
|
if (this.isUserInteraction(event) || skipUserInteractionCheck) {
|
|
50136
|
-
this.lastUserInteractionEventInfo = { timestamp: event.timestamp, visitorId, accountId };
|
|
50207
|
+
this.lastUserInteractionEventInfo = { timestamp: event.timestamp, visitorId: visitorId, accountId: accountId };
|
|
50137
50208
|
this.api.sessionStorage.setItem(SESSION_RECORDING_LAST_USER_INTERACTION_EVENT, JSON.stringify(this.lastUserInteractionEventInfo));
|
|
50138
50209
|
}
|
|
50139
|
-
}
|
|
50140
|
-
clearLastUserInteractionEventInformation() {
|
|
50210
|
+
};
|
|
50211
|
+
SessionRecorder.prototype.clearLastUserInteractionEventInformation = function () {
|
|
50141
50212
|
delete this.lastUserInteractionEventInfo;
|
|
50142
50213
|
this.api.sessionStorage.removeItem(SESSION_RECORDING_LAST_USER_INTERACTION_EVENT);
|
|
50143
|
-
}
|
|
50144
|
-
getLastUserInteractionEventInformation() {
|
|
50214
|
+
};
|
|
50215
|
+
SessionRecorder.prototype.getLastUserInteractionEventInformation = function () {
|
|
50145
50216
|
if (this.lastUserInteractionEventInfo)
|
|
50146
50217
|
return this.lastUserInteractionEventInfo;
|
|
50147
50218
|
try {
|
|
@@ -50151,7 +50222,7 @@ class SessionRecorder {
|
|
|
50151
50222
|
catch (e) { // nothing here yet or failed to be written; don't need to log
|
|
50152
50223
|
return null;
|
|
50153
50224
|
}
|
|
50154
|
-
}
|
|
50225
|
+
};
|
|
50155
50226
|
/**
|
|
50156
50227
|
* Handle new rrweb events coming in. This will also make sure that we are properly sending a "keyframe"
|
|
50157
50228
|
* as the BE expects it. A "keyframe" should consist of only the events needed to start a recording. This includes
|
|
@@ -50162,19 +50233,19 @@ class SessionRecorder {
|
|
|
50162
50233
|
* @param event.type The enum type of the specific event (e.g. meta, full snapshot, incremental snapshot)
|
|
50163
50234
|
* @param event.data The specific data to describe the event, this is different depending on what the type is
|
|
50164
50235
|
*/
|
|
50165
|
-
emit(event) {
|
|
50166
|
-
|
|
50167
|
-
|
|
50168
|
-
|
|
50169
|
-
|
|
50170
|
-
|
|
50236
|
+
SessionRecorder.prototype.emit = function (event) {
|
|
50237
|
+
var isMeta = event.type === EVENT_TYPES.META;
|
|
50238
|
+
var isSnapshot = event.type === EVENT_TYPES.FULL_SNAPSHOT;
|
|
50239
|
+
var prevLastEmitTime = this.pendo._.get(this.getLastUserInteractionEventInformation(), 'timestamp');
|
|
50240
|
+
var inactivityDuration = this.pendo._.get(this.visitorConfig, 'inactivityDuration', THIRTY_MINUTES);
|
|
50241
|
+
var skipUserInteractionCheck = false;
|
|
50171
50242
|
if (event.timestamp && event.timestamp.getTime) {
|
|
50172
50243
|
event.timestamp = event.timestamp.getTime();
|
|
50173
50244
|
}
|
|
50174
50245
|
if (!event.timestamp) {
|
|
50175
50246
|
event.timestamp = (new Date()).getTime();
|
|
50176
50247
|
}
|
|
50177
|
-
|
|
50248
|
+
var withinInactivityLimit = prevLastEmitTime && event.timestamp - prevLastEmitTime <= inactivityDuration;
|
|
50178
50249
|
// If we don't have a last emit time and a META event is emitted, store the META event as the last user interaction
|
|
50179
50250
|
// event. This most commonly happens when a replay is first started and establishes a baseline timestamp to
|
|
50180
50251
|
// to compare inactivity against. For subsequent META events that are part of the same replay, we should have
|
|
@@ -50197,7 +50268,7 @@ class SessionRecorder {
|
|
|
50197
50268
|
this.logStopReason('INACTIVE_HIDDEN_TAB');
|
|
50198
50269
|
}
|
|
50199
50270
|
if (!this.isCheckingVisitorEligibility) {
|
|
50200
|
-
|
|
50271
|
+
var continuationCallback = function () {
|
|
50201
50272
|
this.send();
|
|
50202
50273
|
this.clearSessionInfo();
|
|
50203
50274
|
this.snapshot();
|
|
@@ -50233,13 +50304,13 @@ class SessionRecorder {
|
|
|
50233
50304
|
}
|
|
50234
50305
|
else if (!isMeta) {
|
|
50235
50306
|
this.eventsSinceLastKeyFrame += 1;
|
|
50236
|
-
|
|
50237
|
-
|
|
50238
|
-
|
|
50239
|
-
|
|
50240
|
-
|
|
50307
|
+
var timeSinceLastKeyFrame = event.timestamp - this.lastKeyFrameTime;
|
|
50308
|
+
var exceeds24Hours = timeSinceLastKeyFrame >= ONE_DAY_IN_MILLISECONDS;
|
|
50309
|
+
var exceedsTimeFreq = timeSinceLastKeyFrame >= this.pendo._.get(this.visitorConfig, 'keyframeTimeFrequency', 30645047); // Defaults determined by BE originally, shouldn't really ever be used
|
|
50310
|
+
var exceedsEventFreq = this.eventsSinceLastKeyFrame >= this.pendo._.get(this.visitorConfig, 'keyframeEventFrequency', 4548); // Defaults determined by BE originally, shouldn't really ever be used
|
|
50311
|
+
var exceedsRecordingSizeLimit = this.currentRecordingSize >= this.pendo._.get(this.visitorConfig, 'recordingSizeLimit', ONE_HUNDRED_MB_IN_BYTES);
|
|
50241
50312
|
if (exceeds24Hours || (exceedsTimeFreq && exceedsEventFreq) || exceedsRecordingSizeLimit) {
|
|
50242
|
-
|
|
50313
|
+
var continuationCallback = function () {
|
|
50243
50314
|
this.currentRecordingSize = 0;
|
|
50244
50315
|
this.snapshot();
|
|
50245
50316
|
};
|
|
@@ -50251,18 +50322,18 @@ class SessionRecorder {
|
|
|
50251
50322
|
}
|
|
50252
50323
|
}
|
|
50253
50324
|
}
|
|
50254
|
-
}
|
|
50255
|
-
updateCurrentRecordingSize(recordingPayloadSize) {
|
|
50325
|
+
};
|
|
50326
|
+
SessionRecorder.prototype.updateCurrentRecordingSize = function (recordingPayloadSize) {
|
|
50256
50327
|
this.currentRecordingSize += recordingPayloadSize;
|
|
50257
|
-
}
|
|
50258
|
-
onWorkerMessage(messageData) {
|
|
50328
|
+
};
|
|
50329
|
+
SessionRecorder.prototype.onWorkerMessage = function (messageData) {
|
|
50259
50330
|
switch (messageData.type) {
|
|
50260
50331
|
case 'workerDied': {
|
|
50261
50332
|
this.logStopReason('WORKER_DIED');
|
|
50262
50333
|
break;
|
|
50263
50334
|
}
|
|
50264
50335
|
case 'recordingPayloadSize': {
|
|
50265
|
-
|
|
50336
|
+
var recordingPayloadSize = messageData.recordingPayloadSize, exceedsPayloadSizeLimit = messageData.exceedsPayloadSizeLimit;
|
|
50266
50337
|
if (!recordingPayloadSize)
|
|
50267
50338
|
return;
|
|
50268
50339
|
// stop recording if recording payload exceeds allowed payload size
|
|
@@ -50275,7 +50346,7 @@ class SessionRecorder {
|
|
|
50275
50346
|
break;
|
|
50276
50347
|
}
|
|
50277
50348
|
case 'hostedResources': {
|
|
50278
|
-
|
|
50349
|
+
var hostedResourcesEvent = messageData.hostedResourcesEvent;
|
|
50279
50350
|
if (!hostedResourcesEvent)
|
|
50280
50351
|
return;
|
|
50281
50352
|
this.sendHostedResources(hostedResourcesEvent);
|
|
@@ -50286,12 +50357,12 @@ class SessionRecorder {
|
|
|
50286
50357
|
break;
|
|
50287
50358
|
}
|
|
50288
50359
|
case 'missingData': {
|
|
50289
|
-
this.logStopReason(
|
|
50360
|
+
this.logStopReason("MISSING_".concat(messageData.missingData));
|
|
50290
50361
|
break;
|
|
50291
50362
|
}
|
|
50292
50363
|
}
|
|
50293
|
-
}
|
|
50294
|
-
addRecordingId(event) {
|
|
50364
|
+
};
|
|
50365
|
+
SessionRecorder.prototype.addRecordingId = function (event) {
|
|
50295
50366
|
if (!this.isRecording())
|
|
50296
50367
|
return;
|
|
50297
50368
|
if (!this.recordingId || !event || !event.data || !event.data.length)
|
|
@@ -50310,7 +50381,7 @@ class SessionRecorder {
|
|
|
50310
50381
|
return;
|
|
50311
50382
|
}
|
|
50312
50383
|
this._markEvents([capturedEvent]);
|
|
50313
|
-
}
|
|
50384
|
+
};
|
|
50314
50385
|
/**
|
|
50315
50386
|
* Used to stop collecting replay data.
|
|
50316
50387
|
*
|
|
@@ -50321,7 +50392,7 @@ class SessionRecorder {
|
|
|
50321
50392
|
* @example
|
|
50322
50393
|
* pendo.recording.stop()
|
|
50323
50394
|
*/
|
|
50324
|
-
stop() {
|
|
50395
|
+
SessionRecorder.prototype.stop = function () {
|
|
50325
50396
|
if (this._stop) {
|
|
50326
50397
|
this._stop();
|
|
50327
50398
|
}
|
|
@@ -50339,32 +50410,33 @@ class SessionRecorder {
|
|
|
50339
50410
|
this.accountId = null;
|
|
50340
50411
|
this.clearSessionInfo();
|
|
50341
50412
|
this.onRecordingStop();
|
|
50342
|
-
}
|
|
50343
|
-
handleHidden() {
|
|
50413
|
+
};
|
|
50414
|
+
SessionRecorder.prototype.handleHidden = function () {
|
|
50344
50415
|
this.send({ hidden: true });
|
|
50345
|
-
}
|
|
50346
|
-
handleUnload() {
|
|
50416
|
+
};
|
|
50417
|
+
SessionRecorder.prototype.handleUnload = function () {
|
|
50347
50418
|
if (this.api.ConfigReader.get(RECORDING_CONFIG_DISABLE_UNLOAD))
|
|
50348
50419
|
return;
|
|
50349
50420
|
this.send({ unload: true });
|
|
50350
|
-
}
|
|
50351
|
-
buildRequestUrl(baseUrl, queryObj) {
|
|
50421
|
+
};
|
|
50422
|
+
SessionRecorder.prototype.buildRequestUrl = function (baseUrl, queryObj) {
|
|
50352
50423
|
var authedQueryObj = this.pendo._.extend({}, this.api.agent.getJwtInfoCopy(), queryObj);
|
|
50353
50424
|
var queryString = this.pendo._.map(authedQueryObj, function (value, key) {
|
|
50354
|
-
return
|
|
50425
|
+
return "".concat(key, "=").concat(value);
|
|
50355
50426
|
}).join('&');
|
|
50356
|
-
return queryString.length ?
|
|
50357
|
-
}
|
|
50358
|
-
sendFailure(reason) {
|
|
50427
|
+
return queryString.length ? "".concat(baseUrl, "?").concat(queryString) : baseUrl;
|
|
50428
|
+
};
|
|
50429
|
+
SessionRecorder.prototype.sendFailure = function (reason) {
|
|
50359
50430
|
this.stop();
|
|
50360
50431
|
this.logStopReason(reason);
|
|
50361
|
-
}
|
|
50362
|
-
rateLimitExceeded() {
|
|
50432
|
+
};
|
|
50433
|
+
SessionRecorder.prototype.rateLimitExceeded = function () {
|
|
50363
50434
|
this.send(); // sends first chunk of 20k
|
|
50364
50435
|
this.stop(); // sends 2nd chunk of 20k, rest is ignored
|
|
50365
50436
|
this.logStopReason('DATA_OVERLOAD');
|
|
50366
|
-
}
|
|
50367
|
-
send
|
|
50437
|
+
};
|
|
50438
|
+
SessionRecorder.prototype.send = function (_a) {
|
|
50439
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.unload, unload = _c === void 0 ? false : _c, _d = _b.keyframe, keyframe = _d === void 0 ? false : _d, _e = _b.hidden, hidden = _e === void 0 ? false : _e;
|
|
50368
50440
|
if (!this.isRecording())
|
|
50369
50441
|
return;
|
|
50370
50442
|
if (!this.buffer)
|
|
@@ -50394,7 +50466,7 @@ class SessionRecorder {
|
|
|
50394
50466
|
}
|
|
50395
50467
|
// Used to add promoted metadata onto the recording event
|
|
50396
50468
|
this.api.Events.eventCaptured.trigger(payload);
|
|
50397
|
-
|
|
50469
|
+
var params = {
|
|
50398
50470
|
v: this.pendo.VERSION,
|
|
50399
50471
|
recordingId: this.recordingId
|
|
50400
50472
|
};
|
|
@@ -50405,11 +50477,11 @@ class SessionRecorder {
|
|
|
50405
50477
|
params.ns = 1;
|
|
50406
50478
|
this.isNewSession = false;
|
|
50407
50479
|
}
|
|
50408
|
-
var url = this.buildRequestUrl(
|
|
50480
|
+
var url = this.buildRequestUrl("".concat(this.pendo.HOST, "/data/rec/").concat(this.pendo.apiKey), params);
|
|
50409
50481
|
payload = this.buffer.pack(payload, this.pendo._);
|
|
50410
50482
|
if (unload || hidden) {
|
|
50411
50483
|
try {
|
|
50412
|
-
this.sendQueue.drain([{ url, payload }], unload);
|
|
50484
|
+
this.sendQueue.drain([{ url: url, payload: payload }], unload);
|
|
50413
50485
|
}
|
|
50414
50486
|
catch (e) {
|
|
50415
50487
|
if (e.reason) {
|
|
@@ -50421,29 +50493,30 @@ class SessionRecorder {
|
|
|
50421
50493
|
}
|
|
50422
50494
|
}
|
|
50423
50495
|
else {
|
|
50424
|
-
this.sendQueue.push({ url, payload });
|
|
50496
|
+
this.sendQueue.push({ url: url, payload: payload });
|
|
50425
50497
|
}
|
|
50426
50498
|
if (!this.buffer.isEmpty()) {
|
|
50427
|
-
this.send({ unload });
|
|
50499
|
+
this.send({ unload: unload });
|
|
50428
50500
|
}
|
|
50429
|
-
}
|
|
50430
|
-
fetchVisitorConfig() {
|
|
50431
|
-
|
|
50501
|
+
};
|
|
50502
|
+
SessionRecorder.prototype.fetchVisitorConfig = function () {
|
|
50503
|
+
var jzb = this.pendo.compress({
|
|
50432
50504
|
url: this.pendo.url.get(),
|
|
50433
50505
|
metadata: this.pendo.getSerializedMetadata(),
|
|
50434
50506
|
visitorId: this.visitorId,
|
|
50435
50507
|
accountId: this.accountId
|
|
50436
50508
|
});
|
|
50437
|
-
|
|
50438
|
-
jzb,
|
|
50509
|
+
var url = this.buildRequestUrl("".concat(this.pendo.HOST, "/data/recordingconf/").concat(this.pendo.apiKey), {
|
|
50510
|
+
jzb: jzb,
|
|
50439
50511
|
ct: (new Date().getTime()),
|
|
50440
50512
|
v: this.pendo.VERSION
|
|
50441
50513
|
});
|
|
50442
50514
|
return fetch(url, {
|
|
50443
50515
|
method: 'GET'
|
|
50444
|
-
}).then(response
|
|
50445
|
-
}
|
|
50446
|
-
logStopReason(reason, error) {
|
|
50516
|
+
}).then(function (response) { return response.json(); });
|
|
50517
|
+
};
|
|
50518
|
+
SessionRecorder.prototype.logStopReason = function (reason, error) {
|
|
50519
|
+
var _this = this;
|
|
50447
50520
|
var tracer = this.api.EventTracer.addTracerIds({});
|
|
50448
50521
|
var payload = this.pendo._.extend({
|
|
50449
50522
|
type: 'recording',
|
|
@@ -50459,51 +50532,53 @@ class SessionRecorder {
|
|
|
50459
50532
|
recordingPayload: [],
|
|
50460
50533
|
sequence: 0,
|
|
50461
50534
|
recordingPayloadCount: 0,
|
|
50462
|
-
props:
|
|
50535
|
+
props: __assign({ reason: reason }, (error && { error: error instanceof Error ? error === null || error === void 0 ? void 0 : error.message : error }))
|
|
50463
50536
|
}, tracer);
|
|
50464
50537
|
var jzb = this.pendo.compress(payload);
|
|
50465
|
-
var url = this.buildRequestUrl(
|
|
50466
|
-
jzb,
|
|
50538
|
+
var url = this.buildRequestUrl("".concat(this.pendo.HOST, "/data/rec/").concat(this.pendo.apiKey), {
|
|
50539
|
+
jzb: jzb,
|
|
50467
50540
|
ct: (new Date().getTime()),
|
|
50468
50541
|
v: this.pendo.VERSION,
|
|
50469
50542
|
recordingId: payload.recordingId
|
|
50470
50543
|
});
|
|
50471
50544
|
var body = this.pendo.compress(payload, 'binary');
|
|
50472
50545
|
return this.transport.post(url, {
|
|
50473
|
-
body,
|
|
50546
|
+
body: body,
|
|
50474
50547
|
keepalive: true
|
|
50475
|
-
})
|
|
50476
|
-
|
|
50548
|
+
})["catch"](function (e) {
|
|
50549
|
+
_this.api.log.critical('Failed to send reason for stopping recording', { error: e });
|
|
50477
50550
|
});
|
|
50478
|
-
}
|
|
50479
|
-
sendHostedResources(event) {
|
|
50551
|
+
};
|
|
50552
|
+
SessionRecorder.prototype.sendHostedResources = function (event) {
|
|
50553
|
+
var _this = this;
|
|
50480
50554
|
var tracer = this.api.EventTracer.addTracerIds({});
|
|
50481
|
-
var payload = this.pendo._.extend(
|
|
50482
|
-
var url = this.buildRequestUrl(
|
|
50555
|
+
var payload = this.pendo._.extend(__assign(__assign({}, event), { browserTime: new Date().getTime() }), tracer);
|
|
50556
|
+
var url = this.buildRequestUrl("".concat(this.pendo.HOST, "/data/rec/").concat(this.pendo.apiKey), {
|
|
50483
50557
|
ct: (new Date().getTime()),
|
|
50484
50558
|
v: this.pendo.VERSION,
|
|
50485
50559
|
recordingId: payload.recordingId
|
|
50486
50560
|
});
|
|
50487
50561
|
var body = this.pendo.compress(payload, 'binary');
|
|
50488
50562
|
return this.transport.post(url, {
|
|
50489
|
-
body,
|
|
50563
|
+
body: body,
|
|
50490
50564
|
keepalive: true
|
|
50491
|
-
})
|
|
50492
|
-
|
|
50565
|
+
})["catch"](function (e) {
|
|
50566
|
+
_this.api.log.critical('Failed to send hosted resources for recording event', { error: e });
|
|
50493
50567
|
});
|
|
50494
|
-
}
|
|
50568
|
+
};
|
|
50495
50569
|
/**
|
|
50496
50570
|
* This should fire when an event is triggered in clearClonedStorage. Under normal circumstances, the event will be
|
|
50497
50571
|
* triggered before recording begins in the cloned tab. On the off chance tabId changes again though, create a new
|
|
50498
50572
|
* replay. We want to avoid scenarios where a single recordingId is associated with multiple tabIds. This can happen if
|
|
50499
50573
|
* clone detection runs in a duplicated tab before it runs in the original tab.
|
|
50500
50574
|
*/
|
|
50501
|
-
handleTabIdChange() {
|
|
50575
|
+
SessionRecorder.prototype.handleTabIdChange = function () {
|
|
50502
50576
|
this.send();
|
|
50503
50577
|
this.clearSessionInfo();
|
|
50504
50578
|
this.snapshot();
|
|
50505
|
-
}
|
|
50506
|
-
|
|
50579
|
+
};
|
|
50580
|
+
return SessionRecorder;
|
|
50581
|
+
}());
|
|
50507
50582
|
|
|
50508
50583
|
function wrapMethodWithCatch(method) {
|
|
50509
50584
|
return function () {
|
|
@@ -50524,7 +50599,8 @@ function errorLogger(recorder) {
|
|
|
50524
50599
|
return recorder;
|
|
50525
50600
|
if (!recorder.constructor || !recorder.constructor.prototype)
|
|
50526
50601
|
return recorder;
|
|
50527
|
-
for (
|
|
50602
|
+
for (var _i = 0, _a = Object.getOwnPropertyNames(recorder.constructor.prototype); _i < _a.length; _i++) {
|
|
50603
|
+
var methodName = _a[_i];
|
|
50528
50604
|
if (methodName === 'constructor')
|
|
50529
50605
|
continue;
|
|
50530
50606
|
recorder[methodName] = wrapMethodWithCatch(recorder[methodName]);
|
|
@@ -52154,59 +52230,59 @@ function ConsoleCapture() {
|
|
|
52154
52230
|
}
|
|
52155
52231
|
|
|
52156
52232
|
function NetworkCapture() {
|
|
52157
|
-
|
|
52158
|
-
|
|
52159
|
-
|
|
52160
|
-
|
|
52161
|
-
|
|
52162
|
-
|
|
52163
|
-
|
|
52164
|
-
|
|
52165
|
-
|
|
52166
|
-
|
|
52167
|
-
|
|
52168
|
-
|
|
52169
|
-
|
|
52170
|
-
|
|
52171
|
-
|
|
52172
|
-
|
|
52173
|
-
|
|
52174
|
-
|
|
52175
|
-
|
|
52176
|
-
|
|
52177
|
-
|
|
52178
|
-
|
|
52233
|
+
var pluginAPI;
|
|
52234
|
+
var globalPendo;
|
|
52235
|
+
var requestMap = {};
|
|
52236
|
+
var buffer;
|
|
52237
|
+
var sendQueue;
|
|
52238
|
+
var sendInterval;
|
|
52239
|
+
var transport;
|
|
52240
|
+
var isPtmPaused;
|
|
52241
|
+
var requestBodyCb;
|
|
52242
|
+
var responseBodyCb;
|
|
52243
|
+
var pendoDevlogBaseUrl;
|
|
52244
|
+
var isCapturingNetworkLogs = false;
|
|
52245
|
+
var excludeRequestUrls = [];
|
|
52246
|
+
var CAPTURE_NETWORK_CONFIG = 'captureNetworkRequests';
|
|
52247
|
+
var NETWORK_SUB_TYPE = 'network';
|
|
52248
|
+
var NETWORK_LOGS_CONFIG = 'networkLogs';
|
|
52249
|
+
var NETWORK_LOGS_CONFIG_ALLOWED_REQUEST_HEADERS = 'networkLogs.allowedRequestHeaders';
|
|
52250
|
+
var NETWORK_LOGS_CONFIG_ALLOWED_RESPONSE_HEADERS = 'networkLogs.allowedResponseHeaders';
|
|
52251
|
+
var NETWORK_LOGS_CONFIG_CAPTURE_REQUEST_BODY = 'networkLogs.captureRequestBody';
|
|
52252
|
+
var NETWORK_LOGS_CONFIG_CAPTURE_RESPONSE_BODY = 'networkLogs.captureResponseBody';
|
|
52253
|
+
var NETWORK_LOGS_CONFIG_EXCLUDE_REQUEST_URLS = 'networkLogs.excludeRequestUrls';
|
|
52254
|
+
var allowedRequestHeaders = {
|
|
52179
52255
|
'content-type': true, 'content-length': true, 'accept': true, 'accept-language': true
|
|
52180
52256
|
};
|
|
52181
|
-
|
|
52257
|
+
var allowedResponseHeaders = {
|
|
52182
52258
|
'cache-control': true, 'content-length': true, 'content-type': true, 'content-language': true
|
|
52183
52259
|
};
|
|
52184
52260
|
return {
|
|
52185
52261
|
name: 'NetworkCapture',
|
|
52186
|
-
initialize,
|
|
52187
|
-
teardown,
|
|
52188
|
-
handleRequest,
|
|
52189
|
-
handleResponse,
|
|
52190
|
-
handleError,
|
|
52191
|
-
startCapture,
|
|
52192
|
-
createNetworkEvent,
|
|
52193
|
-
send,
|
|
52194
|
-
onPtmPaused,
|
|
52195
|
-
onPtmUnpaused,
|
|
52196
|
-
onAppHidden,
|
|
52197
|
-
onAppUnloaded,
|
|
52198
|
-
setCaptureState,
|
|
52199
|
-
recordingStarted,
|
|
52200
|
-
recordingStopped,
|
|
52201
|
-
addConfigOptions,
|
|
52202
|
-
processHeaderConfig,
|
|
52203
|
-
extractHeaders,
|
|
52204
|
-
setupBodyCallbacks,
|
|
52205
|
-
processBody,
|
|
52206
|
-
processRequestBody,
|
|
52207
|
-
processResponseBody,
|
|
52208
|
-
buildExcludeRequestUrls,
|
|
52209
|
-
isUrlExcluded,
|
|
52262
|
+
initialize: initialize,
|
|
52263
|
+
teardown: teardown,
|
|
52264
|
+
handleRequest: handleRequest,
|
|
52265
|
+
handleResponse: handleResponse,
|
|
52266
|
+
handleError: handleError,
|
|
52267
|
+
startCapture: startCapture,
|
|
52268
|
+
createNetworkEvent: createNetworkEvent,
|
|
52269
|
+
send: send,
|
|
52270
|
+
onPtmPaused: onPtmPaused,
|
|
52271
|
+
onPtmUnpaused: onPtmUnpaused,
|
|
52272
|
+
onAppHidden: onAppHidden,
|
|
52273
|
+
onAppUnloaded: onAppUnloaded,
|
|
52274
|
+
setCaptureState: setCaptureState,
|
|
52275
|
+
recordingStarted: recordingStarted,
|
|
52276
|
+
recordingStopped: recordingStopped,
|
|
52277
|
+
addConfigOptions: addConfigOptions,
|
|
52278
|
+
processHeaderConfig: processHeaderConfig,
|
|
52279
|
+
extractHeaders: extractHeaders,
|
|
52280
|
+
setupBodyCallbacks: setupBodyCallbacks,
|
|
52281
|
+
processBody: processBody,
|
|
52282
|
+
processRequestBody: processRequestBody,
|
|
52283
|
+
processResponseBody: processResponseBody,
|
|
52284
|
+
buildExcludeRequestUrls: buildExcludeRequestUrls,
|
|
52285
|
+
isUrlExcluded: isUrlExcluded,
|
|
52210
52286
|
get isCapturingNetworkLogs() {
|
|
52211
52287
|
return isCapturingNetworkLogs;
|
|
52212
52288
|
},
|
|
@@ -52241,9 +52317,9 @@ function NetworkCapture() {
|
|
|
52241
52317
|
function initialize(pendo, PluginAPI) {
|
|
52242
52318
|
pluginAPI = PluginAPI;
|
|
52243
52319
|
globalPendo = pendo;
|
|
52244
|
-
|
|
52320
|
+
var ConfigReader = pluginAPI.ConfigReader;
|
|
52245
52321
|
ConfigReader.addOption(CAPTURE_NETWORK_CONFIG, [ConfigReader.sources.PENDO_CONFIG_SRC], false);
|
|
52246
|
-
|
|
52322
|
+
var captureNetworkEnabled = ConfigReader.get(CAPTURE_NETWORK_CONFIG);
|
|
52247
52323
|
if (!captureNetworkEnabled)
|
|
52248
52324
|
return;
|
|
52249
52325
|
buffer = new DevlogBuffer(pendo, pluginAPI);
|
|
@@ -52254,7 +52330,7 @@ function NetworkCapture() {
|
|
|
52254
52330
|
processHeaderConfig(NETWORK_LOGS_CONFIG_ALLOWED_RESPONSE_HEADERS, allowedResponseHeaders);
|
|
52255
52331
|
setupBodyCallbacks();
|
|
52256
52332
|
buildExcludeRequestUrls();
|
|
52257
|
-
sendInterval = setInterval(()
|
|
52333
|
+
sendInterval = setInterval(function () {
|
|
52258
52334
|
if (!sendQueue.failed()) {
|
|
52259
52335
|
send();
|
|
52260
52336
|
}
|
|
@@ -52270,7 +52346,7 @@ function NetworkCapture() {
|
|
|
52270
52346
|
pendoDevlogBaseUrl = pluginAPI.transmit.buildBaseDataUrl(DEV_LOG_TYPE, globalPendo.apiKey);
|
|
52271
52347
|
}
|
|
52272
52348
|
function addConfigOptions() {
|
|
52273
|
-
|
|
52349
|
+
var ConfigReader = pluginAPI.ConfigReader;
|
|
52274
52350
|
ConfigReader.addOption(NETWORK_LOGS_CONFIG, [ConfigReader.sources.SNIPPET_SRC], {});
|
|
52275
52351
|
/**
|
|
52276
52352
|
* Additional request headers to capture in network logs.
|
|
@@ -52330,17 +52406,17 @@ function NetworkCapture() {
|
|
|
52330
52406
|
ConfigReader.addOption(NETWORK_LOGS_CONFIG_EXCLUDE_REQUEST_URLS, [ConfigReader.sources.SNIPPET_SRC], []);
|
|
52331
52407
|
}
|
|
52332
52408
|
function processHeaderConfig(configHeaderName, targetHeaders) {
|
|
52333
|
-
|
|
52409
|
+
var configHeaders = pluginAPI.ConfigReader.get(configHeaderName);
|
|
52334
52410
|
if (!configHeaders || configHeaders.length === 0)
|
|
52335
52411
|
return;
|
|
52336
|
-
globalPendo._.each(configHeaders, (header)
|
|
52412
|
+
globalPendo._.each(configHeaders, function (header) {
|
|
52337
52413
|
if (!header || !globalPendo._.isString(header))
|
|
52338
52414
|
return;
|
|
52339
52415
|
targetHeaders[header.toLowerCase()] = true;
|
|
52340
52416
|
});
|
|
52341
52417
|
}
|
|
52342
52418
|
function setupBodyCallbacks() {
|
|
52343
|
-
|
|
52419
|
+
var config = pluginAPI.ConfigReader.get(NETWORK_LOGS_CONFIG);
|
|
52344
52420
|
if (!config)
|
|
52345
52421
|
return;
|
|
52346
52422
|
if (globalPendo._.isFunction(config.captureRequestBody)) {
|
|
@@ -52351,11 +52427,11 @@ function NetworkCapture() {
|
|
|
52351
52427
|
}
|
|
52352
52428
|
}
|
|
52353
52429
|
function buildExcludeRequestUrls() {
|
|
52354
|
-
|
|
52430
|
+
var requestUrls = pluginAPI.ConfigReader.get(NETWORK_LOGS_CONFIG_EXCLUDE_REQUEST_URLS);
|
|
52355
52431
|
if (!requestUrls || requestUrls.length === 0)
|
|
52356
52432
|
return;
|
|
52357
|
-
globalPendo._.each(requestUrls, (requestUrl)
|
|
52358
|
-
|
|
52433
|
+
globalPendo._.each(requestUrls, function (requestUrl) {
|
|
52434
|
+
var processedRequestUrl = processUrlPattern(requestUrl);
|
|
52359
52435
|
if (!processedRequestUrl)
|
|
52360
52436
|
return;
|
|
52361
52437
|
excludeRequestUrls.push(processedRequestUrl);
|
|
@@ -52364,13 +52440,13 @@ function NetworkCapture() {
|
|
|
52364
52440
|
function processUrlPattern(url) {
|
|
52365
52441
|
if (!url)
|
|
52366
52442
|
return;
|
|
52367
|
-
|
|
52443
|
+
var isRegex = globalPendo._.isRegExp(url);
|
|
52368
52444
|
if (!globalPendo._.isString(url) && !isRegex)
|
|
52369
52445
|
return;
|
|
52370
52446
|
if (isRegex)
|
|
52371
52447
|
return url;
|
|
52372
|
-
|
|
52373
|
-
return new RegExp(
|
|
52448
|
+
var escapedUrl = pluginAPI.util.escapeRegExp(url);
|
|
52449
|
+
return new RegExp("^".concat(escapedUrl, "$"));
|
|
52374
52450
|
}
|
|
52375
52451
|
function onPtmPaused() {
|
|
52376
52452
|
isPtmPaused = true;
|
|
@@ -52378,8 +52454,9 @@ function NetworkCapture() {
|
|
|
52378
52454
|
function onPtmUnpaused() {
|
|
52379
52455
|
isPtmPaused = false;
|
|
52380
52456
|
if (!buffer.isEmpty()) {
|
|
52381
|
-
for (
|
|
52382
|
-
|
|
52457
|
+
for (var _i = 0, _a = buffer.events; _i < _a.length; _i++) {
|
|
52458
|
+
var event_1 = _a[_i];
|
|
52459
|
+
pluginAPI.Events.eventCaptured.trigger(event_1);
|
|
52383
52460
|
}
|
|
52384
52461
|
send();
|
|
52385
52462
|
}
|
|
@@ -52390,11 +52467,12 @@ function NetworkCapture() {
|
|
|
52390
52467
|
function onAppUnloaded() {
|
|
52391
52468
|
send({ unload: true });
|
|
52392
52469
|
}
|
|
52393
|
-
function setCaptureState(
|
|
52470
|
+
function setCaptureState(_a) {
|
|
52471
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.shouldCapture, shouldCapture = _c === void 0 ? false : _c, _d = _b.reason, reason = _d === void 0 ? '' : _d;
|
|
52394
52472
|
if (shouldCapture === isCapturingNetworkLogs)
|
|
52395
52473
|
return;
|
|
52396
52474
|
isCapturingNetworkLogs = shouldCapture;
|
|
52397
|
-
pluginAPI.log.info(
|
|
52475
|
+
pluginAPI.log.info("[NetworkCapture] Network request capture ".concat(shouldCapture ? 'started' : 'stopped').concat(reason ? ": ".concat(reason) : ''));
|
|
52398
52476
|
}
|
|
52399
52477
|
function recordingStarted() {
|
|
52400
52478
|
return setCaptureState({ shouldCapture: true, reason: 'recording started' });
|
|
@@ -52429,7 +52507,7 @@ function NetworkCapture() {
|
|
|
52429
52507
|
return false;
|
|
52430
52508
|
if (excludeRequestUrls.length === 0)
|
|
52431
52509
|
return false;
|
|
52432
|
-
return globalPendo._.some(excludeRequestUrls, (excludeRequestUrl)
|
|
52510
|
+
return globalPendo._.some(excludeRequestUrls, function (excludeRequestUrl) {
|
|
52433
52511
|
return excludeRequestUrl.test(url);
|
|
52434
52512
|
});
|
|
52435
52513
|
}
|
|
@@ -52443,7 +52521,7 @@ function NetworkCapture() {
|
|
|
52443
52521
|
return;
|
|
52444
52522
|
if (!response)
|
|
52445
52523
|
return;
|
|
52446
|
-
|
|
52524
|
+
var request = requestMap[response.requestId];
|
|
52447
52525
|
if (!request)
|
|
52448
52526
|
return;
|
|
52449
52527
|
// Skip capturing successful devlog events to avoid infinite loops
|
|
@@ -52455,9 +52533,9 @@ function NetworkCapture() {
|
|
|
52455
52533
|
delete requestMap[response.requestId];
|
|
52456
52534
|
return;
|
|
52457
52535
|
}
|
|
52458
|
-
|
|
52459
|
-
request,
|
|
52460
|
-
response
|
|
52536
|
+
var networkEvent = createNetworkEvent({
|
|
52537
|
+
request: request,
|
|
52538
|
+
response: response
|
|
52461
52539
|
});
|
|
52462
52540
|
if (!isPtmPaused) {
|
|
52463
52541
|
pluginAPI.Events.eventCaptured.trigger(networkEvent);
|
|
@@ -52465,7 +52543,8 @@ function NetworkCapture() {
|
|
|
52465
52543
|
buffer.push(networkEvent);
|
|
52466
52544
|
delete requestMap[response.requestId];
|
|
52467
52545
|
}
|
|
52468
|
-
function handleError(
|
|
52546
|
+
function handleError(_a) {
|
|
52547
|
+
var error = _a.error, context = _a.context;
|
|
52469
52548
|
if (!isCapturingNetworkLogs)
|
|
52470
52549
|
return;
|
|
52471
52550
|
if (error.requestId && requestMap[error.requestId]) {
|
|
@@ -52479,13 +52558,13 @@ function NetworkCapture() {
|
|
|
52479
52558
|
}
|
|
52480
52559
|
}
|
|
52481
52560
|
function extractHeaders(headers, allowedHeaders) {
|
|
52482
|
-
|
|
52561
|
+
var _a = globalPendo._, keys = _a.keys, reduce = _a.reduce;
|
|
52483
52562
|
if (!headers || !allowedHeaders)
|
|
52484
52563
|
return [];
|
|
52485
|
-
return reduce(keys(headers), (acc, key)
|
|
52486
|
-
|
|
52564
|
+
return reduce(keys(headers), function (acc, key) {
|
|
52565
|
+
var normalizedKey = key.toLowerCase();
|
|
52487
52566
|
if (allowedHeaders[normalizedKey]) {
|
|
52488
|
-
acc.push(
|
|
52567
|
+
acc.push("".concat(key, ": ").concat(headers[key]));
|
|
52489
52568
|
}
|
|
52490
52569
|
return acc;
|
|
52491
52570
|
}, []);
|
|
@@ -52493,15 +52572,16 @@ function NetworkCapture() {
|
|
|
52493
52572
|
function processBody(body, contentType) {
|
|
52494
52573
|
if (!body || !globalPendo._.isString(body))
|
|
52495
52574
|
return '';
|
|
52496
|
-
|
|
52575
|
+
var processedBody = maskSensitiveFields({ string: body, contentType: contentType, _: globalPendo._ });
|
|
52497
52576
|
return truncate(processedBody, true);
|
|
52498
52577
|
}
|
|
52499
|
-
function processRequestBody(
|
|
52578
|
+
function processRequestBody(_a) {
|
|
52579
|
+
var request = _a.request;
|
|
52500
52580
|
if (!request || !request.body || !requestBodyCb)
|
|
52501
52581
|
return '';
|
|
52502
52582
|
try {
|
|
52503
|
-
|
|
52504
|
-
|
|
52583
|
+
var body = requestBodyCb(request.body, { request: request });
|
|
52584
|
+
var contentType = globalPendo._.get(request, 'headers.content-type', '');
|
|
52505
52585
|
return processBody(body, contentType);
|
|
52506
52586
|
}
|
|
52507
52587
|
catch (error) {
|
|
@@ -52509,12 +52589,13 @@ function NetworkCapture() {
|
|
|
52509
52589
|
return '[Failed to process request body]';
|
|
52510
52590
|
}
|
|
52511
52591
|
}
|
|
52512
|
-
function processResponseBody(
|
|
52592
|
+
function processResponseBody(_a) {
|
|
52593
|
+
var response = _a.response;
|
|
52513
52594
|
if (!response || !response.body || !responseBodyCb)
|
|
52514
52595
|
return '';
|
|
52515
52596
|
try {
|
|
52516
|
-
|
|
52517
|
-
|
|
52597
|
+
var body = responseBodyCb(response.body, { response: response });
|
|
52598
|
+
var contentType = globalPendo._.get(response, 'headers.content-type', '');
|
|
52518
52599
|
return processBody(body, contentType);
|
|
52519
52600
|
}
|
|
52520
52601
|
catch (error) {
|
|
@@ -52522,32 +52603,34 @@ function NetworkCapture() {
|
|
|
52522
52603
|
return '[Failed to process response body]';
|
|
52523
52604
|
}
|
|
52524
52605
|
}
|
|
52525
|
-
function createNetworkEvent(
|
|
52526
|
-
|
|
52527
|
-
|
|
52528
|
-
|
|
52529
|
-
|
|
52606
|
+
function createNetworkEvent(_a) {
|
|
52607
|
+
var request = _a.request, response = _a.response;
|
|
52608
|
+
var devLogEnvelope = createDevLogEnvelope(pluginAPI, globalPendo);
|
|
52609
|
+
var requestHeaders = extractHeaders(request.headers, allowedRequestHeaders);
|
|
52610
|
+
var responseHeaders = extractHeaders(response.headers, allowedResponseHeaders);
|
|
52611
|
+
var networkEvent = __assign(__assign({}, devLogEnvelope), { subType: NETWORK_SUB_TYPE, devLogMethod: request.method, devLogStatusCode: response.status, devLogRequestUrl: request.url, devLogRequestHeaders: requestHeaders, devLogResponseHeaders: responseHeaders, devLogCount: 1 });
|
|
52530
52612
|
if (requestBodyCb) {
|
|
52531
|
-
networkEvent.devLogRequestBody = processRequestBody({ request });
|
|
52613
|
+
networkEvent.devLogRequestBody = processRequestBody({ request: request });
|
|
52532
52614
|
}
|
|
52533
52615
|
if (responseBodyCb) {
|
|
52534
|
-
networkEvent.devLogResponseBody = processResponseBody({ response });
|
|
52616
|
+
networkEvent.devLogResponseBody = processResponseBody({ response: response });
|
|
52535
52617
|
}
|
|
52536
52618
|
return networkEvent;
|
|
52537
52619
|
}
|
|
52538
|
-
function send(
|
|
52620
|
+
function send(_a) {
|
|
52621
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.unload, unload = _c === void 0 ? false : _c, _d = _b.hidden, hidden = _d === void 0 ? false : _d;
|
|
52539
52622
|
if (!buffer || buffer.isEmpty())
|
|
52540
52623
|
return;
|
|
52541
52624
|
if (!globalPendo.isSendingEvents()) {
|
|
52542
52625
|
buffer.clear();
|
|
52543
52626
|
return;
|
|
52544
52627
|
}
|
|
52545
|
-
|
|
52628
|
+
var payloads = buffer.pack();
|
|
52546
52629
|
if (unload || hidden) {
|
|
52547
52630
|
sendQueue.drain(payloads, unload);
|
|
52548
52631
|
}
|
|
52549
52632
|
else {
|
|
52550
|
-
sendQueue.push(
|
|
52633
|
+
sendQueue.push.apply(sendQueue, payloads);
|
|
52551
52634
|
}
|
|
52552
52635
|
}
|
|
52553
52636
|
}
|
|
@@ -52555,9 +52638,9 @@ function NetworkCapture() {
|
|
|
52555
52638
|
var PREDICT_STEP_REGEX = /\$\$predict\$\$/;
|
|
52556
52639
|
var DRAG_THRESHOLD = 5;
|
|
52557
52640
|
var STYLE_ID = 'pendo-predict-plugin-styles';
|
|
52558
|
-
var PREDICT_BASE_URL = 'https://predict.pendo.io';
|
|
52559
52641
|
var GUIDE_BUTTON_IDENTIFIER = 'button:contains("token")';
|
|
52560
52642
|
var pluginVersion = '1.0.1';
|
|
52643
|
+
var getPredictBaseUrl = function (designerServer) { return designerServer.replace('app', 'predict'); };
|
|
52561
52644
|
var $ = function (id) { return document.getElementById(id); };
|
|
52562
52645
|
var createElement = function (tag, attrs, parent) {
|
|
52563
52646
|
if (attrs === void 0) { attrs = {}; }
|
|
@@ -52629,7 +52712,7 @@ var buildQueryParams = function (params) {
|
|
|
52629
52712
|
return urlParams.toString();
|
|
52630
52713
|
};
|
|
52631
52714
|
// ----- Drag & Drop -----
|
|
52632
|
-
var setupDragAndDrop = function (handle, container) {
|
|
52715
|
+
var setupDragAndDrop = function (handle, container, predictBaseUrl) {
|
|
52633
52716
|
var isDragging = false;
|
|
52634
52717
|
var hasMoved = false;
|
|
52635
52718
|
var isCollapsed = false;
|
|
@@ -52692,7 +52775,7 @@ var setupDragAndDrop = function (handle, container) {
|
|
|
52692
52775
|
document.removeEventListener('mousemove', onMouseMove);
|
|
52693
52776
|
document.removeEventListener('mouseup', onMouseUp);
|
|
52694
52777
|
if (!hasMoved && isCollapsed && iframe) {
|
|
52695
|
-
(_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage({ type: 'TRIGGER_EXPAND' },
|
|
52778
|
+
(_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage({ type: 'TRIGGER_EXPAND' }, predictBaseUrl);
|
|
52696
52779
|
}
|
|
52697
52780
|
};
|
|
52698
52781
|
handle.setCollapsedState = function (collapsed) {
|
|
@@ -52712,10 +52795,10 @@ var setupDragAndDrop = function (handle, container) {
|
|
|
52712
52795
|
// ----- Explanation Iframe Creation -----
|
|
52713
52796
|
var createExplanationIframe = function (_a) {
|
|
52714
52797
|
var _b;
|
|
52715
|
-
var analysisId = _a.analysisId, recordId = _a.recordId, configuration = _a.configuration;
|
|
52798
|
+
var analysisId = _a.analysisId, recordId = _a.recordId, configuration = _a.configuration, predictBaseUrl = _a.predictBaseUrl;
|
|
52716
52799
|
var frameId = "frameExplanation-".concat(analysisId);
|
|
52717
52800
|
(_b = $(frameId)) === null || _b === void 0 ? void 0 : _b.remove();
|
|
52718
|
-
var base = "".concat(
|
|
52801
|
+
var base = "".concat(predictBaseUrl, "/external/analysis/").concat(analysisId, "/prediction/drilldown/").concat(recordId);
|
|
52719
52802
|
var params = buildQueryParams(configuration);
|
|
52720
52803
|
createElement('iframe', {
|
|
52721
52804
|
id: frameId,
|
|
@@ -52730,17 +52813,17 @@ var createExplanationIframe = function (_a) {
|
|
|
52730
52813
|
// ----- Floating Modal Creation -----
|
|
52731
52814
|
var createFloatingModal = function (_a) {
|
|
52732
52815
|
var _b;
|
|
52733
|
-
var recordId = _a.recordId, configuration = _a.configuration;
|
|
52816
|
+
var recordId = _a.recordId, configuration = _a.configuration, predictBaseUrl = _a.predictBaseUrl;
|
|
52734
52817
|
var flatIds = (_b = configuration.analysisIds) === null || _b === void 0 ? void 0 : _b.flat(Infinity);
|
|
52735
52818
|
for (var i = 0; i < flatIds.length; i++) {
|
|
52736
|
-
createExplanationIframe({ analysisId: flatIds[i], recordId: recordId, configuration: configuration });
|
|
52819
|
+
createExplanationIframe({ analysisId: flatIds[i], recordId: recordId, configuration: configuration, predictBaseUrl: predictBaseUrl });
|
|
52737
52820
|
}
|
|
52738
52821
|
var container = createElement('div', { id: 'floatingModalContainer', className: 'floating-modal-container' }, document.body);
|
|
52739
52822
|
var dragHandle = createElement('div', {
|
|
52740
52823
|
className: 'floating-modal-drag-handle',
|
|
52741
52824
|
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>"
|
|
52742
52825
|
}, container);
|
|
52743
|
-
var baseUrl = "".concat(
|
|
52826
|
+
var baseUrl = "".concat(predictBaseUrl, "/external/analysis/prediction/summary/").concat(recordId);
|
|
52744
52827
|
var params = buildQueryParams(configuration);
|
|
52745
52828
|
createElement('iframe', {
|
|
52746
52829
|
id: 'frameFloatingModal',
|
|
@@ -52751,7 +52834,7 @@ var createFloatingModal = function (_a) {
|
|
|
52751
52834
|
title: 'Floating Modal',
|
|
52752
52835
|
src: "".concat(baseUrl, "?").concat(params)
|
|
52753
52836
|
}, container);
|
|
52754
|
-
container.dragHandle = setupDragAndDrop(dragHandle, container);
|
|
52837
|
+
container.dragHandle = setupDragAndDrop(dragHandle, container, predictBaseUrl);
|
|
52755
52838
|
return function () {
|
|
52756
52839
|
var _a, _b;
|
|
52757
52840
|
(_b = (_a = container.dragHandle) === null || _a === void 0 ? void 0 : _a.cleanup) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
@@ -52764,11 +52847,11 @@ var createFloatingModal = function (_a) {
|
|
|
52764
52847
|
};
|
|
52765
52848
|
};
|
|
52766
52849
|
var setupMessageListener = function (_a) {
|
|
52767
|
-
var token = _a.token, forceAccountId = _a.forceAccountId, cleanup = _a.cleanup, pendo = _a.pendo;
|
|
52850
|
+
var token = _a.token, forceAccountId = _a.forceAccountId, cleanup = _a.cleanup, pendo = _a.pendo, predictBaseUrl = _a.predictBaseUrl;
|
|
52768
52851
|
var messageHandler = function (_a) {
|
|
52769
52852
|
var _b;
|
|
52770
52853
|
var origin = _a.origin, data = _a.data;
|
|
52771
|
-
if (origin !==
|
|
52854
|
+
if (origin !== predictBaseUrl || !data || typeof data !== 'object')
|
|
52772
52855
|
return;
|
|
52773
52856
|
var _c = data, type = _c.type, analysisId = _c.analysisId, height = _c.height, width = _c.width;
|
|
52774
52857
|
var explanationFrame = $("frameExplanation-".concat(analysisId));
|
|
@@ -52801,13 +52884,13 @@ var setupMessageListener = function (_a) {
|
|
|
52801
52884
|
}
|
|
52802
52885
|
var visitorId = (_a = pendo === null || pendo === void 0 ? void 0 : pendo.getVisitorId) === null || _a === void 0 ? void 0 : _a.call(pendo);
|
|
52803
52886
|
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);
|
|
52804
|
-
(_c = iframe.contentWindow) === null || _c === void 0 ? void 0 : _c.postMessage({ type: 'TOKEN_RECEIVED', token: token, idToken: idToken, extensionAPIKeys: extensionAPIKeys, visitorId: visitorId, accountId: accountId },
|
|
52887
|
+
(_c = iframe.contentWindow) === null || _c === void 0 ? void 0 : _c.postMessage({ type: 'TOKEN_RECEIVED', token: token, idToken: idToken, extensionAPIKeys: extensionAPIKeys, visitorId: visitorId, accountId: accountId }, predictBaseUrl);
|
|
52805
52888
|
}
|
|
52806
52889
|
},
|
|
52807
52890
|
OPEN_EXPLANATION: function () {
|
|
52808
52891
|
var _a;
|
|
52809
52892
|
explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.add('is-visible');
|
|
52810
|
-
(_a = explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(data,
|
|
52893
|
+
(_a = explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(data, predictBaseUrl);
|
|
52811
52894
|
},
|
|
52812
52895
|
CLOSE_EXPLANATION: function () { return explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.remove('is-visible'); },
|
|
52813
52896
|
AUTH_ERROR_EXPLANATION: function () {
|
|
@@ -52851,7 +52934,7 @@ var setupMessageListener = function (_a) {
|
|
|
52851
52934
|
};
|
|
52852
52935
|
var predictGuidesScript = function (_a) {
|
|
52853
52936
|
var _b;
|
|
52854
|
-
var step = _a.step, pendo = _a.pendo, cleanupArray = _a.cleanupArray, cleanup = _a.cleanup, log = _a.log;
|
|
52937
|
+
var step = _a.step, pendo = _a.pendo, cleanupArray = _a.cleanupArray, cleanup = _a.cleanup, log = _a.log, designerServer = _a.designerServer;
|
|
52855
52938
|
log('[predict] initializing');
|
|
52856
52939
|
// Before anything else, inject styles so that the guide will be hidden
|
|
52857
52940
|
var pendoContainerId = step === null || step === void 0 ? void 0 : step.containerId;
|
|
@@ -52877,17 +52960,18 @@ var predictGuidesScript = function (_a) {
|
|
|
52877
52960
|
log('[predict] no recordId found in URL, aborting');
|
|
52878
52961
|
return;
|
|
52879
52962
|
}
|
|
52880
|
-
|
|
52881
|
-
cleanupArray.push(
|
|
52963
|
+
var predictBaseUrl = getPredictBaseUrl(designerServer);
|
|
52964
|
+
cleanupArray.push(setupMessageListener({ token: token, forceAccountId: configuration === null || configuration === void 0 ? void 0 : configuration.forceAccountId, cleanup: cleanup, pendo: pendo, predictBaseUrl: predictBaseUrl }));
|
|
52965
|
+
cleanupArray.push(createFloatingModal({ recordId: recordId, configuration: configuration, predictBaseUrl: predictBaseUrl }));
|
|
52882
52966
|
};
|
|
52883
52967
|
|
|
52884
|
-
|
|
52885
|
-
|
|
52886
|
-
|
|
52887
|
-
|
|
52968
|
+
var PredictGuides = function () {
|
|
52969
|
+
var pluginApiRef = null;
|
|
52970
|
+
var cleanupArray = [];
|
|
52971
|
+
var cleanup = function () {
|
|
52888
52972
|
var _a;
|
|
52889
52973
|
(_a = pluginApiRef === null || pluginApiRef === void 0 ? void 0 : pluginApiRef.log) === null || _a === void 0 ? void 0 : _a.debug('[predict] cleaning up');
|
|
52890
|
-
for (
|
|
52974
|
+
for (var i = 0; i < cleanupArray.length; i++) {
|
|
52891
52975
|
try {
|
|
52892
52976
|
cleanupArray[i]();
|
|
52893
52977
|
}
|
|
@@ -52895,49 +52979,52 @@ const PredictGuides = () => {
|
|
|
52895
52979
|
}
|
|
52896
52980
|
cleanupArray = [];
|
|
52897
52981
|
};
|
|
52898
|
-
|
|
52982
|
+
var initialize = function (_pendo, PluginAPI) {
|
|
52983
|
+
var _a;
|
|
52899
52984
|
pluginApiRef = PluginAPI;
|
|
52900
|
-
|
|
52901
|
-
|
|
52985
|
+
var configReader = PluginAPI.ConfigReader;
|
|
52986
|
+
var PREDICT_GUIDES_CONFIG = 'predictGuides';
|
|
52902
52987
|
configReader.addOption(PREDICT_GUIDES_CONFIG, [
|
|
52903
52988
|
configReader.sources.SNIPPET_SRC,
|
|
52904
52989
|
configReader.sources.PENDO_CONFIG_SRC
|
|
52905
52990
|
], false);
|
|
52906
|
-
|
|
52991
|
+
var predictGuidesEnabled = configReader.get(PREDICT_GUIDES_CONFIG);
|
|
52907
52992
|
if (!predictGuidesEnabled)
|
|
52908
52993
|
return;
|
|
52909
|
-
|
|
52994
|
+
var log = PluginAPI.log.debug.bind(PluginAPI.log);
|
|
52995
|
+
var designerServer = (_a = PluginAPI.hosts) === null || _a === void 0 ? void 0 : _a.DESIGNER_SERVER;
|
|
52910
52996
|
pluginApiRef.Events.urlChanged.on(cleanup);
|
|
52911
|
-
|
|
52997
|
+
var script = {
|
|
52912
52998
|
name: 'PredictFrameScript',
|
|
52913
|
-
script(step, _guide, pendo) {
|
|
52914
|
-
predictGuidesScript({ step, pendo, cleanupArray, cleanup, log });
|
|
52915
|
-
this.on('unmounted', (evt)
|
|
52999
|
+
script: function (step, _guide, pendo) {
|
|
53000
|
+
predictGuidesScript({ step: step, pendo: pendo, cleanupArray: cleanupArray, cleanup: cleanup, log: log, designerServer: designerServer });
|
|
53001
|
+
this.on('unmounted', function (evt) {
|
|
52916
53002
|
if (evt.reason !== 'hidden')
|
|
52917
53003
|
cleanup();
|
|
52918
53004
|
});
|
|
52919
53005
|
},
|
|
52920
|
-
test(step, _guide) {
|
|
52921
|
-
|
|
53006
|
+
test: function (step, _guide) {
|
|
53007
|
+
var stepName = step.name || '';
|
|
52922
53008
|
return PREDICT_STEP_REGEX.test(stepName);
|
|
52923
53009
|
}
|
|
52924
53010
|
};
|
|
52925
53011
|
pluginApiRef.GlobalRuntime.addGlobalScript(script);
|
|
52926
53012
|
};
|
|
52927
|
-
|
|
53013
|
+
var teardown = function () {
|
|
52928
53014
|
var _a, _b;
|
|
52929
53015
|
cleanup();
|
|
52930
53016
|
(_b = (_a = pluginApiRef === null || pluginApiRef === void 0 ? void 0 : pluginApiRef.Events) === null || _a === void 0 ? void 0 : _a.urlChanged) === null || _b === void 0 ? void 0 : _b.off(cleanup);
|
|
52931
53017
|
};
|
|
52932
53018
|
return {
|
|
52933
53019
|
name: 'PredictGuides',
|
|
52934
|
-
initialize,
|
|
52935
|
-
teardown
|
|
53020
|
+
initialize: initialize,
|
|
53021
|
+
teardown: teardown
|
|
52936
53022
|
};
|
|
52937
53023
|
};
|
|
52938
53024
|
|
|
52939
53025
|
var ASSISTANT_MESSAGE = 'assistantMessage';
|
|
52940
53026
|
var CONVERSATION_ID_URL_PATTERN = 'conversationIdUrlPattern';
|
|
53027
|
+
var MESSAGE_CONTENT = 'messageContent';
|
|
52941
53028
|
var MESSAGE_ID_ATTR = 'messageIdAttr';
|
|
52942
53029
|
var MESSAGE_ID_PATTERN = 'messageIdPattern';
|
|
52943
53030
|
var MODEL_USED_ATTR = 'modelUsedAttr';
|
|
@@ -52949,16 +53036,16 @@ var THUMB_UP = 'thumbUp';
|
|
|
52949
53036
|
var TURN_CONTAINER = 'turnContainer';
|
|
52950
53037
|
var USER_MESSAGE = 'userMessage';
|
|
52951
53038
|
var CUSTOM_AGENT_ID_URL_PATTERN = 'customAgentIdUrlPattern';
|
|
53039
|
+
var CUSTOM_AGENT_ID = 'customAgentId';
|
|
52952
53040
|
var CUSTOM_AGENT_NAME = 'customAgentName';
|
|
52953
53041
|
var REQUIRED_SELECTORS = [
|
|
52954
53042
|
ASSISTANT_MESSAGE,
|
|
52955
53043
|
CONVERSATION_ID_URL_PATTERN,
|
|
52956
|
-
MESSAGE_ID_ATTR,
|
|
52957
53044
|
STREAMING_ACTIVE,
|
|
52958
53045
|
TURN_CONTAINER,
|
|
52959
53046
|
USER_MESSAGE
|
|
52960
53047
|
];
|
|
52961
|
-
var SUPPORTED_PRESETS = ['chatgpt-full', 'gemini-full'];
|
|
53048
|
+
var SUPPORTED_PRESETS = ['chatgpt-full', 'gemini-full', 'claude-full', 'copilot-full'];
|
|
52962
53049
|
var STREAMING_END_SETTLE_MS = 500;
|
|
52963
53050
|
var SUBMISSION_START_RETRY_MS = 1000;
|
|
52964
53051
|
var SUBMISSION_START_MAX_ATTEMPTS = 4;
|
|
@@ -53061,8 +53148,14 @@ var DOMConversation = /** @class */ (function () {
|
|
|
53061
53148
|
var wasPressed = activeSelector && this.Sizzle.matchesSelector(thumb[0], activeSelector);
|
|
53062
53149
|
var direction = isUp ? 'positive' : 'negative';
|
|
53063
53150
|
var content = wasPressed ? 'unreact' : direction;
|
|
53064
|
-
|
|
53065
|
-
|
|
53151
|
+
// the thumb may live inside the assistant message (e.g. copilot) or in a separate
|
|
53152
|
+
// turn footer alongside it (e.g. chatgpt/gemini); handle both
|
|
53153
|
+
var assistantSelector = this.findSelector(ASSISTANT_MESSAGE);
|
|
53154
|
+
var assistantNode = thumb.closest(assistantSelector);
|
|
53155
|
+
if (!assistantNode.length) {
|
|
53156
|
+
assistantNode = thumb.closest(this.findSelector(TURN_CONTAINER))
|
|
53157
|
+
.find(assistantSelector);
|
|
53158
|
+
}
|
|
53066
53159
|
this.emit('user_reaction', {
|
|
53067
53160
|
agentId: this.id,
|
|
53068
53161
|
messageId: this.getMessageId(assistantNode),
|
|
@@ -53151,18 +53244,62 @@ var DOMConversation = /** @class */ (function () {
|
|
|
53151
53244
|
}
|
|
53152
53245
|
};
|
|
53153
53246
|
DOMConversation.prototype.extractContent = function (node) {
|
|
53154
|
-
|
|
53247
|
+
var source = node;
|
|
53248
|
+
// optional: content inside a descendant
|
|
53249
|
+
var contentSelector = this.findSelector(MESSAGE_CONTENT);
|
|
53250
|
+
if (contentSelector) {
|
|
53251
|
+
var contentNode = node.find(contentSelector);
|
|
53252
|
+
if (contentNode.length) {
|
|
53253
|
+
source = contentNode;
|
|
53254
|
+
}
|
|
53255
|
+
}
|
|
53256
|
+
// .text() reads innerText, which is empty for content-visibility:auto / off-screen subtrees
|
|
53257
|
+
// (e.g. claude.ai's scrolled-up messages). Keep innerText as the primary source so agents
|
|
53258
|
+
// whose content already works are unchanged, and fall back to textContent only when it's empty.
|
|
53259
|
+
var primary = source.text().trim();
|
|
53260
|
+
if (primary)
|
|
53261
|
+
return primary;
|
|
53262
|
+
return source[0].textContent.trim();
|
|
53155
53263
|
};
|
|
53156
53264
|
DOMConversation.prototype.getMessageId = function (node) {
|
|
53157
|
-
|
|
53265
|
+
var attr = this.findSelector(MESSAGE_ID_ATTR);
|
|
53266
|
+
if (!attr) {
|
|
53267
|
+
return this.syntheticMessageId(node[0]);
|
|
53268
|
+
}
|
|
53269
|
+
return node.attr(attr);
|
|
53270
|
+
};
|
|
53271
|
+
// Agents with no DOM message id (e.g. claude.ai) get a synthetic id based on the role and
|
|
53272
|
+
// position in document order.
|
|
53273
|
+
DOMConversation.prototype.syntheticMessageId = function (el) {
|
|
53274
|
+
if (!el)
|
|
53275
|
+
return undefined;
|
|
53276
|
+
var userSelector = this.findSelector(USER_MESSAGE);
|
|
53277
|
+
var isUser = userSelector && this.Sizzle.matchesSelector(el, userSelector);
|
|
53278
|
+
var role = isUser ? 'u' : 'a';
|
|
53279
|
+
var siblings = this.select(isUser ? USER_MESSAGE : ASSISTANT_MESSAGE);
|
|
53280
|
+
for (var i = 0; i < siblings.length; i++) {
|
|
53281
|
+
if (siblings[i] === el) {
|
|
53282
|
+
return "".concat(role, "-").concat(i);
|
|
53283
|
+
}
|
|
53284
|
+
}
|
|
53285
|
+
return undefined; // el isn't among the rendered messages — no meaningful index
|
|
53158
53286
|
};
|
|
53159
53287
|
DOMConversation.prototype.handleUserMessage = function (node) {
|
|
53160
|
-
this.emit('prompt',
|
|
53288
|
+
this.emit('prompt', {
|
|
53289
|
+
agentId: this.id,
|
|
53290
|
+
messageId: this.getMessageId(node),
|
|
53291
|
+
content: this.extractContent(node)
|
|
53292
|
+
});
|
|
53161
53293
|
};
|
|
53162
53294
|
DOMConversation.prototype.handleAssistantMessage = function (node) {
|
|
53163
53295
|
var modelUsedAttr = this.findSelector(MODEL_USED_ATTR);
|
|
53164
53296
|
var modelUsed = modelUsedAttr && node.attr(modelUsedAttr);
|
|
53165
|
-
this.emit('agent_response',
|
|
53297
|
+
this.emit('agent_response', {
|
|
53298
|
+
agentId: this.id,
|
|
53299
|
+
messageId: this.getMessageId(node),
|
|
53300
|
+
agentModelsUsed: modelUsed ? [modelUsed] : [],
|
|
53301
|
+
content: this.extractContent(node)
|
|
53302
|
+
});
|
|
53166
53303
|
};
|
|
53167
53304
|
DOMConversation.prototype.findLastRequestNode = function () {
|
|
53168
53305
|
if (!this.getConversationId())
|
|
@@ -53199,7 +53336,16 @@ var DOMConversation = /** @class */ (function () {
|
|
|
53199
53336
|
DOMConversation.prototype.getCustomAgentId = function () {
|
|
53200
53337
|
if (!this.customAgentIdRegex)
|
|
53201
53338
|
return undefined;
|
|
53202
|
-
|
|
53339
|
+
// The id may live in the page URL (e.g. gemini /gem/<id>) or,
|
|
53340
|
+
// when customAgentId is set, in the href of a DOM element
|
|
53341
|
+
var source = location.href;
|
|
53342
|
+
if (this.findSelector(CUSTOM_AGENT_ID)) {
|
|
53343
|
+
var node = this.select(CUSTOM_AGENT_ID);
|
|
53344
|
+
if (!node.length)
|
|
53345
|
+
return undefined;
|
|
53346
|
+
source = node.attr('href') || '';
|
|
53347
|
+
}
|
|
53348
|
+
var m = source.match(this.customAgentIdRegex);
|
|
53203
53349
|
if (!m)
|
|
53204
53350
|
return undefined;
|
|
53205
53351
|
return m[1] !== undefined ? m[1] : m[0];
|