@pendo/agent 2.332.2 → 2.333.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/debugger-plugin.min.js +1 -1
- package/dist/dom.esm.js +1 -1
- package/dist/pendo.debugger.min.js +6 -6
- package/dist/pendo.module.js +1033 -716
- package/dist/pendo.module.min.js +8 -106
- package/dist/servers.json +7 -7
- package/package.json +1 -1
package/dist/pendo.module.js
CHANGED
|
@@ -4028,8 +4028,8 @@ let SERVER = '';
|
|
|
4028
4028
|
let ASSET_HOST = '';
|
|
4029
4029
|
let ASSET_PATH = '';
|
|
4030
4030
|
let DESIGNER_SERVER = '';
|
|
4031
|
-
let VERSION = '2.
|
|
4032
|
-
let PACKAGE_VERSION = '2.
|
|
4031
|
+
let VERSION = '2.333.0_';
|
|
4032
|
+
let PACKAGE_VERSION = '2.333.0';
|
|
4033
4033
|
let LOADER = 'xhr';
|
|
4034
4034
|
/* eslint-enable web-sdk-eslint-rules/no-gulp-env-references */
|
|
4035
4035
|
/**
|
|
@@ -15080,6 +15080,16 @@ function findGuideContainerJSON(buildingBlocks) {
|
|
|
15080
15080
|
});
|
|
15081
15081
|
}
|
|
15082
15082
|
}
|
|
15083
|
+
function correctGuideContainerId(containerJSON, stepId, guideId) {
|
|
15084
|
+
if (!containerJSON || !containerJSON.props || !containerJSON.props.id)
|
|
15085
|
+
return;
|
|
15086
|
+
var currentId = containerJSON.props.id;
|
|
15087
|
+
var isCorrect = (stepId && currentId === `pendo-g-${stepId}`) ||
|
|
15088
|
+
(guideId && currentId === `pendo-g-${guideId}`);
|
|
15089
|
+
if (!isCorrect && stepId) {
|
|
15090
|
+
containerJSON.props.id = `pendo-g-${stepId}`;
|
|
15091
|
+
}
|
|
15092
|
+
}
|
|
15083
15093
|
function findDomBlockInDomJson(domJson, truthTestFn) {
|
|
15084
15094
|
if (truthTestFn(domJson))
|
|
15085
15095
|
return domJson;
|
|
@@ -23207,7 +23217,7 @@ function autofocusRuntimeScript(step, guide, pendo) {
|
|
|
23207
23217
|
if (pendo._.get(step, 'attributes.isAutoFocus')) {
|
|
23208
23218
|
BuildingBlockGuides.autofocusStep(step, guideContainer);
|
|
23209
23219
|
BuildingBlockGuides.trapFocusStep(step, guideContainer);
|
|
23210
|
-
step.hiddenElements = BuildingBlockGuides.
|
|
23220
|
+
step.hiddenElements = BuildingBlockGuides.disableOutsideGuide(step.guideElement[0]);
|
|
23211
23221
|
}
|
|
23212
23222
|
if (isGuideRCType(guide)) {
|
|
23213
23223
|
BuildingBlockGuides.attachRCFocusHandlers();
|
|
@@ -29549,7 +29559,7 @@ var BuildingBlockGuides = (function () {
|
|
|
29549
29559
|
autofocusStep,
|
|
29550
29560
|
trapFocusStep,
|
|
29551
29561
|
attachRCFocusHandlers,
|
|
29552
|
-
|
|
29562
|
+
disableOutsideGuide,
|
|
29553
29563
|
renderResourceCenterModule: BuildingBlockResourceCenter.renderResourceCenterModule,
|
|
29554
29564
|
buildNodeFromJSON,
|
|
29555
29565
|
attachImgLoadHandlers,
|
|
@@ -29609,6 +29619,7 @@ var BuildingBlockGuides = (function () {
|
|
|
29609
29619
|
detectColorMode(step);
|
|
29610
29620
|
}
|
|
29611
29621
|
var containerJSON = findGuideContainerJSON(json);
|
|
29622
|
+
correctGuideContainerId(containerJSON, step.id, guide.id);
|
|
29612
29623
|
var isResourceCenter = _.get(guide, 'attributes.resourceCenter');
|
|
29613
29624
|
if (isResourceCenter) {
|
|
29614
29625
|
BuildingBlockResourceCenter.revertRtlChanges(guide, json.props);
|
|
@@ -30134,21 +30145,22 @@ var BuildingBlockGuides = (function () {
|
|
|
30134
30145
|
domElem.append(endFocusBumper);
|
|
30135
30146
|
return [startFocusBumper, endFocusBumper];
|
|
30136
30147
|
}
|
|
30137
|
-
function
|
|
30148
|
+
function disableOutsideGuide(elem, hidden = []) {
|
|
30138
30149
|
if (!elem || elem === getBody())
|
|
30139
30150
|
return hidden;
|
|
30151
|
+
const supportsInert = isNaN(msie);
|
|
30152
|
+
const disableAttribute = supportsInert ? 'inert' : 'aria-hidden';
|
|
30140
30153
|
const siblings = getSiblings(elem);
|
|
30141
30154
|
_.each(siblings, (s) => {
|
|
30142
|
-
|
|
30143
|
-
|
|
30144
|
-
|
|
30145
|
-
|
|
30146
|
-
|
|
30147
|
-
}
|
|
30155
|
+
const tagName = s.tagName.toLowerCase();
|
|
30156
|
+
const alreadyDisabled = s.getAttribute(disableAttribute) === 'true';
|
|
30157
|
+
if (hidden.indexOf(s) === -1 && !alreadyDisabled && tagName !== 'script' && tagName !== 'style') {
|
|
30158
|
+
s.setAttribute(disableAttribute, 'true');
|
|
30159
|
+
hidden.push(s);
|
|
30148
30160
|
}
|
|
30149
30161
|
});
|
|
30150
30162
|
if (elem.parentNode) {
|
|
30151
|
-
|
|
30163
|
+
disableOutsideGuide(elem.parentNode, hidden);
|
|
30152
30164
|
}
|
|
30153
30165
|
return hidden;
|
|
30154
30166
|
}
|
|
@@ -32954,10 +32966,11 @@ function GuideStep(guide) {
|
|
|
32954
32966
|
try {
|
|
32955
32967
|
if (el && typeof el.removeAttribute === 'function') {
|
|
32956
32968
|
el.removeAttribute('aria-hidden');
|
|
32969
|
+
el.removeAttribute('inert');
|
|
32957
32970
|
}
|
|
32958
32971
|
}
|
|
32959
32972
|
catch (e) {
|
|
32960
|
-
log.error('unable to remove
|
|
32973
|
+
log.error('unable to remove attribute from element', { error: e });
|
|
32961
32974
|
}
|
|
32962
32975
|
});
|
|
32963
32976
|
this.hiddenElements.length = 0;
|
|
@@ -34792,6 +34805,201 @@ var PreviewModule = (function () {
|
|
|
34792
34805
|
};
|
|
34793
34806
|
})();
|
|
34794
34807
|
|
|
34808
|
+
const CONTAINER_ID = 'pendo-debugger-highlight-overlay';
|
|
34809
|
+
const BORDER_COLOR = '#FF4876';
|
|
34810
|
+
const BORDER_GLOW = 'rgba(255, 72, 118, 0.35)';
|
|
34811
|
+
const HIGHLIGHT_Z_INDEX = '2147483644';
|
|
34812
|
+
const ANIMATION_DURATION_MS = 500;
|
|
34813
|
+
const AUTO_CLEAR_MS = 10000;
|
|
34814
|
+
const BORDER_STYLES = {
|
|
34815
|
+
'box-sizing': 'border-box',
|
|
34816
|
+
'border': `2px solid ${BORDER_COLOR}`,
|
|
34817
|
+
'border-radius': '2px',
|
|
34818
|
+
'box-shadow': `0 0 0 2px ${BORDER_GLOW}`,
|
|
34819
|
+
'pointer-events': 'none',
|
|
34820
|
+
'z-index': HIGHLIGHT_Z_INDEX
|
|
34821
|
+
};
|
|
34822
|
+
let doc = document;
|
|
34823
|
+
let win = window;
|
|
34824
|
+
let container = null;
|
|
34825
|
+
let targets = [];
|
|
34826
|
+
let overlays = [];
|
|
34827
|
+
let resizeObserver = null;
|
|
34828
|
+
let autoClearTimer = null;
|
|
34829
|
+
function getContainer(dom) {
|
|
34830
|
+
if (container && container.isConnected)
|
|
34831
|
+
return container;
|
|
34832
|
+
container = dom('<div>').css({
|
|
34833
|
+
'position': 'absolute',
|
|
34834
|
+
'top': 0,
|
|
34835
|
+
'left': 0,
|
|
34836
|
+
'width': 0,
|
|
34837
|
+
'height': 0,
|
|
34838
|
+
'margin': 0,
|
|
34839
|
+
'padding': 0,
|
|
34840
|
+
'border': 0,
|
|
34841
|
+
'pointer-events': 'none'
|
|
34842
|
+
}).appendTo(doc.documentElement || doc.body)[0];
|
|
34843
|
+
container.id = CONTAINER_ID;
|
|
34844
|
+
return container;
|
|
34845
|
+
}
|
|
34846
|
+
function positionOverlays() {
|
|
34847
|
+
const scrollX = win.scrollX || win.pageXOffset || 0;
|
|
34848
|
+
const scrollY = win.scrollY || win.pageYOffset || 0;
|
|
34849
|
+
for (let i = 0; i < overlays.length; i++) {
|
|
34850
|
+
const { el, box } = overlays[i];
|
|
34851
|
+
if (!el || typeof el.getBoundingClientRect !== 'function')
|
|
34852
|
+
continue;
|
|
34853
|
+
const rect = el.getBoundingClientRect();
|
|
34854
|
+
box.style.top = `${rect.top + scrollY}px`;
|
|
34855
|
+
box.style.left = `${rect.left + scrollX}px`;
|
|
34856
|
+
box.style.width = `${rect.width}px`;
|
|
34857
|
+
box.style.height = `${rect.height}px`;
|
|
34858
|
+
}
|
|
34859
|
+
}
|
|
34860
|
+
function buildOverlays(dom) {
|
|
34861
|
+
const node = getContainer(dom);
|
|
34862
|
+
node.textContent = '';
|
|
34863
|
+
overlays = [];
|
|
34864
|
+
for (let i = 0; i < targets.length; i++) {
|
|
34865
|
+
const el = targets[i];
|
|
34866
|
+
if (!el || typeof el.getBoundingClientRect !== 'function')
|
|
34867
|
+
continue;
|
|
34868
|
+
const rect = el.getBoundingClientRect();
|
|
34869
|
+
if (rect.width === 0 && rect.height === 0)
|
|
34870
|
+
continue;
|
|
34871
|
+
const box = dom('<div>')
|
|
34872
|
+
.css(Object.assign({ position: 'absolute' }, BORDER_STYLES))
|
|
34873
|
+
.appendTo(node)[0];
|
|
34874
|
+
overlays.push({ el, box });
|
|
34875
|
+
}
|
|
34876
|
+
positionOverlays();
|
|
34877
|
+
}
|
|
34878
|
+
function observeLayout() {
|
|
34879
|
+
if (typeof win.ResizeObserver !== 'function')
|
|
34880
|
+
return;
|
|
34881
|
+
resizeObserver = new win.ResizeObserver(() => positionOverlays());
|
|
34882
|
+
resizeObserver.observe(doc.documentElement);
|
|
34883
|
+
for (let i = 0; i < overlays.length; i++) {
|
|
34884
|
+
resizeObserver.observe(overlays[i].el);
|
|
34885
|
+
}
|
|
34886
|
+
}
|
|
34887
|
+
function armAutoClear() {
|
|
34888
|
+
if (autoClearTimer)
|
|
34889
|
+
clearTimeout(autoClearTimer);
|
|
34890
|
+
autoClearTimer = win.setTimeout(clearHighlights, AUTO_CLEAR_MS);
|
|
34891
|
+
}
|
|
34892
|
+
function isInViewport(rect) {
|
|
34893
|
+
const vh = win.innerHeight || doc.documentElement.clientHeight;
|
|
34894
|
+
const vw = win.innerWidth || doc.documentElement.clientWidth;
|
|
34895
|
+
return rect.bottom > 0 && rect.right > 0 && rect.top < vh && rect.left < vw;
|
|
34896
|
+
}
|
|
34897
|
+
function scrollIntoViewIfNeeded(elements) {
|
|
34898
|
+
const anyVisible = elements.some(el => isInViewport(el.getBoundingClientRect()));
|
|
34899
|
+
if (anyVisible)
|
|
34900
|
+
return;
|
|
34901
|
+
const first = elements[0];
|
|
34902
|
+
if (first && typeof first.scrollIntoView === 'function') {
|
|
34903
|
+
first.scrollIntoView({ block: 'center', inline: 'center' });
|
|
34904
|
+
}
|
|
34905
|
+
}
|
|
34906
|
+
function animateFocusRing(dom, el) {
|
|
34907
|
+
if (!el || typeof el.animate !== 'function')
|
|
34908
|
+
return;
|
|
34909
|
+
const rect = el.getBoundingClientRect();
|
|
34910
|
+
if (rect.width === 0 && rect.height === 0)
|
|
34911
|
+
return;
|
|
34912
|
+
const ring = dom('<div>')
|
|
34913
|
+
.css(Object.assign({ position: 'fixed' }, BORDER_STYLES))
|
|
34914
|
+
.appendTo(doc.documentElement || doc.body)[0];
|
|
34915
|
+
const animation = ring.animate([
|
|
34916
|
+
{ top: '0px', left: '0px', width: '100vw', height: '100vh', borderRadius: '0px', opacity: 0 },
|
|
34917
|
+
{ opacity: 1, offset: 0.2 },
|
|
34918
|
+
{
|
|
34919
|
+
top: `${rect.top}px`,
|
|
34920
|
+
left: `${rect.left}px`,
|
|
34921
|
+
width: `${rect.width}px`,
|
|
34922
|
+
height: `${rect.height}px`,
|
|
34923
|
+
borderRadius: '2px',
|
|
34924
|
+
opacity: 1
|
|
34925
|
+
}
|
|
34926
|
+
], { duration: ANIMATION_DURATION_MS, easing: 'ease-in-out' });
|
|
34927
|
+
animation.onfinish = () => {
|
|
34928
|
+
if (ring.parentNode)
|
|
34929
|
+
ring.parentNode.removeChild(ring);
|
|
34930
|
+
};
|
|
34931
|
+
}
|
|
34932
|
+
function highlight(dom, elements) {
|
|
34933
|
+
clearHighlights();
|
|
34934
|
+
targets = [];
|
|
34935
|
+
for (let i = 0; i < elements.length; i++) {
|
|
34936
|
+
const el = elements[i];
|
|
34937
|
+
if (el && el.nodeType === 1)
|
|
34938
|
+
targets.push(el);
|
|
34939
|
+
}
|
|
34940
|
+
if (!targets.length)
|
|
34941
|
+
return 0;
|
|
34942
|
+
doc = targets[0].ownerDocument || document;
|
|
34943
|
+
win = doc.defaultView || window;
|
|
34944
|
+
scrollIntoViewIfNeeded(targets);
|
|
34945
|
+
buildOverlays(dom);
|
|
34946
|
+
observeLayout();
|
|
34947
|
+
animateFocusRing(dom, targets[0]);
|
|
34948
|
+
armAutoClear();
|
|
34949
|
+
return targets.length;
|
|
34950
|
+
}
|
|
34951
|
+
function highlightElements(dom, selector) {
|
|
34952
|
+
try {
|
|
34953
|
+
const query = dom(selector);
|
|
34954
|
+
const total = query ? query.length : 0;
|
|
34955
|
+
const elements = [];
|
|
34956
|
+
for (let i = 0; i < total; i++) {
|
|
34957
|
+
elements.push(query[i]);
|
|
34958
|
+
}
|
|
34959
|
+
return highlight(dom, elements);
|
|
34960
|
+
}
|
|
34961
|
+
catch (e) {
|
|
34962
|
+
clearHighlights();
|
|
34963
|
+
return 0;
|
|
34964
|
+
}
|
|
34965
|
+
}
|
|
34966
|
+
function highlightFrameElement(dom) {
|
|
34967
|
+
let frameEl = null;
|
|
34968
|
+
try {
|
|
34969
|
+
frameEl = window.frameElement;
|
|
34970
|
+
}
|
|
34971
|
+
catch (e) {
|
|
34972
|
+
frameEl = null;
|
|
34973
|
+
}
|
|
34974
|
+
if (frameEl) {
|
|
34975
|
+
try {
|
|
34976
|
+
return highlight(dom, [frameEl]);
|
|
34977
|
+
}
|
|
34978
|
+
catch (e) {
|
|
34979
|
+
clearHighlights();
|
|
34980
|
+
return 0;
|
|
34981
|
+
}
|
|
34982
|
+
}
|
|
34983
|
+
return highlightElements(dom, 'body');
|
|
34984
|
+
}
|
|
34985
|
+
function clearHighlights() {
|
|
34986
|
+
if (autoClearTimer) {
|
|
34987
|
+
clearTimeout(autoClearTimer);
|
|
34988
|
+
autoClearTimer = null;
|
|
34989
|
+
}
|
|
34990
|
+
if (resizeObserver) {
|
|
34991
|
+
resizeObserver.disconnect();
|
|
34992
|
+
resizeObserver = null;
|
|
34993
|
+
}
|
|
34994
|
+
targets = [];
|
|
34995
|
+
overlays = [];
|
|
34996
|
+
if (container) {
|
|
34997
|
+
if (container.parentNode)
|
|
34998
|
+
container.parentNode.removeChild(container);
|
|
34999
|
+
container = null;
|
|
35000
|
+
}
|
|
35001
|
+
}
|
|
35002
|
+
|
|
34795
35003
|
const DebuggerModule = (() => {
|
|
34796
35004
|
const state = {
|
|
34797
35005
|
isLeader: undefined,
|
|
@@ -34973,6 +35181,49 @@ const DebuggerModule = (() => {
|
|
|
34973
35181
|
}).then(result => JSON.parse(result));
|
|
34974
35182
|
});
|
|
34975
35183
|
q.all(framePromises).then(results => response(results));
|
|
35184
|
+
},
|
|
35185
|
+
highlightElement(context, payload) {
|
|
35186
|
+
const { selector, targetFrame, outlineFrame, response } = payload;
|
|
35187
|
+
const frames = targetFrame
|
|
35188
|
+
? _.filter(store.state.frames.frames, frame => frame.id === targetFrame)
|
|
35189
|
+
: _.values(store.state.frames.frames);
|
|
35190
|
+
const framePromises = _.map(frames, frame => {
|
|
35191
|
+
return crossFrameChannel.postMessageOrTimeout({
|
|
35192
|
+
action: 'debugger/highlightInFrame',
|
|
35193
|
+
targetFrame: frame.id,
|
|
35194
|
+
selector,
|
|
35195
|
+
outlineFrame
|
|
35196
|
+
}).then(result => JSON.parse(result)).catch(() => ({ count: 0 }));
|
|
35197
|
+
});
|
|
35198
|
+
q.all(framePromises).then(results => {
|
|
35199
|
+
const count = _.reduce(results, (sum, result) => sum + (result.count || 0), 0);
|
|
35200
|
+
if (response)
|
|
35201
|
+
response({ count });
|
|
35202
|
+
});
|
|
35203
|
+
},
|
|
35204
|
+
clearHighlight() {
|
|
35205
|
+
crossFrameChannel.postMessage({
|
|
35206
|
+
action: 'debugger/clearHighlightInFrame'
|
|
35207
|
+
});
|
|
35208
|
+
},
|
|
35209
|
+
highlightInFrame(context, payload) {
|
|
35210
|
+
const { selector, outlineFrame, sourceFrame, promiseId } = payload;
|
|
35211
|
+
const count = outlineFrame
|
|
35212
|
+
? highlightFrameElement(pendo$1.dom)
|
|
35213
|
+
: highlightElements(pendo$1.dom, selector);
|
|
35214
|
+
if (promiseId && sourceFrame) {
|
|
35215
|
+
crossFrameChannel.postMessage({
|
|
35216
|
+
action: 'debuggerHighlightResponse',
|
|
35217
|
+
targetFrame: sourceFrame,
|
|
35218
|
+
resolveId: promiseId,
|
|
35219
|
+
frameId: context.state.frameId,
|
|
35220
|
+
count
|
|
35221
|
+
});
|
|
35222
|
+
}
|
|
35223
|
+
return { count };
|
|
35224
|
+
},
|
|
35225
|
+
clearHighlightInFrame() {
|
|
35226
|
+
clearHighlights();
|
|
34976
35227
|
}
|
|
34977
35228
|
};
|
|
34978
35229
|
const getters = {};
|
|
@@ -37848,6 +38099,94 @@ const IFrameMonitor = (function () {
|
|
|
37848
38099
|
}
|
|
37849
38100
|
})();
|
|
37850
38101
|
|
|
38102
|
+
const MAX_TRACKED_PAIRS = 10;
|
|
38103
|
+
const ObjectMetadata = (function () {
|
|
38104
|
+
let globalPendo;
|
|
38105
|
+
let pluginApi;
|
|
38106
|
+
// {objectId, type} pair -> crc32(metadata), persisted so we don't resend unchanged object
|
|
38107
|
+
// metadata across page loads. This is purely a send-dedup cache and is not tied to visitor
|
|
38108
|
+
// identity. Map insertion order gives us LRU eviction: re-storing a pair moves it to newest.
|
|
38109
|
+
let sentHashes;
|
|
38110
|
+
/**
|
|
38111
|
+
* Persisted crc32 hashes of the last object metadata sent for each {objectId, type} pair. Used to avoid
|
|
38112
|
+
* resending unchanged object metadata across page loads.
|
|
38113
|
+
*
|
|
38114
|
+
* @name _pendo_objectMetadata
|
|
38115
|
+
* @category Cookies/localStorage
|
|
38116
|
+
* @access public
|
|
38117
|
+
* @label OBJECT_METADATA
|
|
38118
|
+
*/
|
|
38119
|
+
var OBJECT_METADATA = 'objectMetadata';
|
|
38120
|
+
/**
|
|
38121
|
+
* Sends metadata for an arbitrary object, identified by an id and type. Unlike `updateOptions`, which
|
|
38122
|
+
* targets the current visitor/account, this associates metadata with a caller-defined object. The metadata
|
|
38123
|
+
* is only sent when it differs from the last payload sent for the same object id + type, so calling this
|
|
38124
|
+
* repeatedly with unchanged metadata is a no-op.
|
|
38125
|
+
*
|
|
38126
|
+
* @access public
|
|
38127
|
+
* @function
|
|
38128
|
+
* @category Identity
|
|
38129
|
+
* @param {string} objectId the object's id
|
|
38130
|
+
* @param {string} type the object's type
|
|
38131
|
+
* @param {object} metadata the metadata payload to associate with the object
|
|
38132
|
+
* @example
|
|
38133
|
+
* pendo.objectMetadata('order-1234', 'order', { total: 42.5, status: 'shipped' });
|
|
38134
|
+
*/
|
|
38135
|
+
function objectMetadata(objectId, type, metadata) {
|
|
38136
|
+
if (!isValidValue(objectId) || !isValidValue(type)) {
|
|
38137
|
+
pluginApi.log.warn('objectMetadata requires a non-empty objectId and type.');
|
|
38138
|
+
return;
|
|
38139
|
+
}
|
|
38140
|
+
var key = JSON.stringify([objectId, type]);
|
|
38141
|
+
var hash = crc32(metadata);
|
|
38142
|
+
if (sentHashes.get(key) === hash) {
|
|
38143
|
+
// Unchanged since the last send; refresh recency and skip.
|
|
38144
|
+
sentHashes.delete(key);
|
|
38145
|
+
sentHashes.set(key, hash);
|
|
38146
|
+
return;
|
|
38147
|
+
}
|
|
38148
|
+
sentHashes.delete(key);
|
|
38149
|
+
sentHashes.set(key, hash);
|
|
38150
|
+
if (sentHashes.size > MAX_TRACKED_PAIRS) {
|
|
38151
|
+
sentHashes.delete(sentHashes.keys().next().value);
|
|
38152
|
+
}
|
|
38153
|
+
persistHashes();
|
|
38154
|
+
pluginApi.analytics.collectEvent('objectMetadata', { objectId, type, metadata });
|
|
38155
|
+
globalPendo.buffers.flushLater();
|
|
38156
|
+
}
|
|
38157
|
+
return {
|
|
38158
|
+
name: 'ObjectMetadata',
|
|
38159
|
+
initialize,
|
|
38160
|
+
teardown,
|
|
38161
|
+
objectMetadata
|
|
38162
|
+
};
|
|
38163
|
+
function initialize(pendo, PluginAPI) {
|
|
38164
|
+
globalPendo = pendo;
|
|
38165
|
+
pluginApi = PluginAPI;
|
|
38166
|
+
pluginApi.agentStorage.registry.addLocal(OBJECT_METADATA, {
|
|
38167
|
+
isSecure: true,
|
|
38168
|
+
localStorageOnly: true,
|
|
38169
|
+
serializer: JSON.stringify,
|
|
38170
|
+
deserializer: SafeJsonDeserializer
|
|
38171
|
+
});
|
|
38172
|
+
sentHashes = loadHashes();
|
|
38173
|
+
globalPendo.objectMetadata = objectMetadata;
|
|
38174
|
+
}
|
|
38175
|
+
function teardown() {
|
|
38176
|
+
delete globalPendo.objectMetadata;
|
|
38177
|
+
}
|
|
38178
|
+
function loadHashes() {
|
|
38179
|
+
var stored = pluginApi.agentStorage.read(OBJECT_METADATA);
|
|
38180
|
+
return Array.isArray(stored) ? new Map(stored) : new Map();
|
|
38181
|
+
}
|
|
38182
|
+
function persistHashes() {
|
|
38183
|
+
pluginApi.agentStorage.write(OBJECT_METADATA, Array.from(sentHashes));
|
|
38184
|
+
}
|
|
38185
|
+
function isValidValue(value) {
|
|
38186
|
+
return typeof value === 'string' && value.length > 0;
|
|
38187
|
+
}
|
|
38188
|
+
})();
|
|
38189
|
+
|
|
37851
38190
|
/**
|
|
37852
38191
|
* OEM Account ID Plugin
|
|
37853
38192
|
*
|
|
@@ -41072,6 +41411,7 @@ function registerBuiltInPlugins() {
|
|
|
41072
41411
|
registerPlugin(FrustrationEvent);
|
|
41073
41412
|
registerPlugin(GuideCachePlugin);
|
|
41074
41413
|
registerPlugin(IFrameMonitor);
|
|
41414
|
+
registerPlugin(ObjectMetadata);
|
|
41075
41415
|
registerPlugin(OemAccountId);
|
|
41076
41416
|
registerPlugin(P1GuidePlugin);
|
|
41077
41417
|
registerPlugin(PromoteMetadata);
|
|
@@ -41334,20 +41674,20 @@ function getZoneSafeMethod(_, method, target) {
|
|
|
41334
41674
|
}
|
|
41335
41675
|
|
|
41336
41676
|
// Does not support submit and go to
|
|
41337
|
-
|
|
41338
|
-
|
|
41677
|
+
var goToRegex = new RegExp(guideMarkdownUtil.goToString);
|
|
41678
|
+
var PollBranching = {
|
|
41339
41679
|
name: 'PollBranching',
|
|
41340
|
-
script(step, guide, pendo) {
|
|
41341
|
-
|
|
41342
|
-
|
|
41680
|
+
script: function (step, guide, pendo) {
|
|
41681
|
+
var isAdvanceIntercepted = false;
|
|
41682
|
+
var branchingQuestions = initialBranchingSetup(step, pendo);
|
|
41343
41683
|
if (branchingQuestions) {
|
|
41344
41684
|
// If there are too many branching questions saved, exit and run the guide normally.
|
|
41345
41685
|
if (pendo._.size(branchingQuestions) > 1)
|
|
41346
41686
|
return;
|
|
41347
|
-
this.on('beforeAdvance', (evt)
|
|
41348
|
-
|
|
41349
|
-
|
|
41350
|
-
|
|
41687
|
+
this.on('beforeAdvance', function (evt) {
|
|
41688
|
+
var noResponseSelected = step.guideElement.find('[branching] .pendo-radio:checked').length === 0;
|
|
41689
|
+
var responseLabel = step.guideElement.find('[branching] .pendo-radio:checked + label')[0];
|
|
41690
|
+
var noGotoLabel;
|
|
41351
41691
|
if (responseLabel) {
|
|
41352
41692
|
noGotoLabel = pendo._.isNull(responseLabel.getAttribute('goToStep'));
|
|
41353
41693
|
}
|
|
@@ -41358,58 +41698,58 @@ const PollBranching = {
|
|
|
41358
41698
|
});
|
|
41359
41699
|
}
|
|
41360
41700
|
},
|
|
41361
|
-
test(step, guide, pendo) {
|
|
41701
|
+
test: function (step, guide, pendo) {
|
|
41362
41702
|
var _a;
|
|
41363
|
-
|
|
41703
|
+
var branchingQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
|
|
41364
41704
|
return !pendo._.isUndefined(branchingQuestions) && pendo._.size(branchingQuestions);
|
|
41365
41705
|
},
|
|
41366
|
-
designerListener(pendo) {
|
|
41367
|
-
|
|
41368
|
-
|
|
41706
|
+
designerListener: function (pendo) {
|
|
41707
|
+
var target = pendo.dom.getBody();
|
|
41708
|
+
var config = {
|
|
41369
41709
|
attributeFilter: ['data-layout'],
|
|
41370
41710
|
attributes: true,
|
|
41371
41711
|
childList: true,
|
|
41372
41712
|
characterData: true,
|
|
41373
41713
|
subtree: true
|
|
41374
41714
|
};
|
|
41375
|
-
|
|
41376
|
-
|
|
41715
|
+
var MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
|
|
41716
|
+
var observer = new MutationObserver(applyBranchingIndicators);
|
|
41377
41717
|
observer.observe(target, config);
|
|
41378
41718
|
function applyBranchingIndicators(mutations) {
|
|
41379
41719
|
pendo._.each(mutations, function (mutation) {
|
|
41380
41720
|
var _a;
|
|
41381
|
-
|
|
41721
|
+
var nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelector);
|
|
41382
41722
|
if (mutation.addedNodes.length && nodeHasQuerySelector) {
|
|
41383
41723
|
if (mutation.addedNodes[0].querySelector('._pendo-multi-choice-poll-select-border')) {
|
|
41384
41724
|
if (pendo._.size(pendo.dom('._pendo-multi-choice-poll-question:contains("{branching/}")'))) {
|
|
41385
41725
|
pendo
|
|
41386
41726
|
.dom('._pendo-multi-choice-poll-question:contains("{branching/}")')
|
|
41387
|
-
.each((question, index)
|
|
41388
|
-
pendo._.each(pendo.dom(
|
|
41727
|
+
.each(function (question, index) {
|
|
41728
|
+
pendo._.each(pendo.dom("#".concat(question.id, " *")), function (element) {
|
|
41389
41729
|
guideMarkdownUtil.removeMarkdownSyntax(element, '{branching/}', '', pendo);
|
|
41390
41730
|
});
|
|
41391
41731
|
pendo
|
|
41392
|
-
.dom(
|
|
41732
|
+
.dom("#".concat(question.id, " p"))
|
|
41393
41733
|
.css({ display: 'inline-block !important' })
|
|
41394
41734
|
.append(branchingIcon('#999', '20px'))
|
|
41395
41735
|
.attr({ title: 'Custom Branching Added' });
|
|
41396
|
-
|
|
41397
|
-
if (pendo.dom(
|
|
41736
|
+
var dataPendoPollId = question.getAttribute('data-pendo-poll-id');
|
|
41737
|
+
if (pendo.dom("._pendo-multi-choice-poll-question[data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0]) {
|
|
41398
41738
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
41399
41739
|
pendo
|
|
41400
|
-
.dom(
|
|
41740
|
+
.dom("._pendo-multi-choice-poll-question[data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0]
|
|
41401
41741
|
.textContent.trim();
|
|
41402
41742
|
}
|
|
41403
|
-
|
|
41743
|
+
var pollLabels = pendo.dom("label[for*=".concat(dataPendoPollId, "]"));
|
|
41404
41744
|
if (pendo._.size(pollLabels)) {
|
|
41405
|
-
pendo._.forEach(pollLabels, (label)
|
|
41745
|
+
pendo._.forEach(pollLabels, function (label) {
|
|
41406
41746
|
if (goToRegex.test(label.textContent)) {
|
|
41407
|
-
|
|
41747
|
+
var labelTitle = goToRegex.exec(label.textContent)[2];
|
|
41408
41748
|
guideMarkdownUtil.removeMarkdownSyntax(label, goToRegex, '', pendo);
|
|
41409
41749
|
pendo
|
|
41410
41750
|
.dom(label)
|
|
41411
41751
|
.append(branchingIcon('#999', '14px'))
|
|
41412
|
-
.attr({ title:
|
|
41752
|
+
.attr({ title: "Branching to step ".concat(labelTitle) });
|
|
41413
41753
|
}
|
|
41414
41754
|
});
|
|
41415
41755
|
}
|
|
@@ -41417,9 +41757,9 @@ const PollBranching = {
|
|
|
41417
41757
|
pendo
|
|
41418
41758
|
.dom(question)
|
|
41419
41759
|
.append(branchingErrorHTML(question.dataset.pendoPollId));
|
|
41420
|
-
pendo.dom(
|
|
41760
|
+
pendo.dom("#".concat(question.id, " #pendo-ps-branching-svg")).remove();
|
|
41421
41761
|
pendo
|
|
41422
|
-
.dom(
|
|
41762
|
+
.dom("#".concat(question.id, " p"))
|
|
41423
41763
|
.css({ display: 'inline-block !important' })
|
|
41424
41764
|
.append(branchingIcon('red', '20px'))
|
|
41425
41765
|
.attr({ title: 'Unsupported Branching configuration' });
|
|
@@ -41431,49 +41771,31 @@ const PollBranching = {
|
|
|
41431
41771
|
});
|
|
41432
41772
|
}
|
|
41433
41773
|
function branchingErrorHTML(dataPendoPollId) {
|
|
41434
|
-
return
|
|
41435
|
-
font-style: italic; margin-top: 0px;" class="branching-wrapper"
|
|
41436
|
-
name="${dataPendoPollId}">
|
|
41437
|
-
* Branching Error: Multiple branching polls not supported</div>`;
|
|
41774
|
+
return "<div style=\"text-align:lrft; font-size: 14px; color: red;\n font-style: italic; margin-top: 0px;\" class=\"branching-wrapper\"\n name=\"".concat(dataPendoPollId, "\">\n * Branching Error: Multiple branching polls not supported</div>");
|
|
41438
41775
|
}
|
|
41439
41776
|
function branchingIcon(color, size) {
|
|
41440
|
-
return
|
|
41441
|
-
style="margin-left: 5px;
|
|
41442
|
-
height:${size}; width:${size}; display:inline; vertical-align:middle;" xmlns="http://www.w3.org/2000/svg">
|
|
41443
|
-
<g stroke-width="0"></g>
|
|
41444
|
-
<g stroke-linecap="round" stroke-linejoin="round"></g>
|
|
41445
|
-
<g> <circle cx="4" cy="7" r="2" stroke="${color}"
|
|
41446
|
-
stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></circle>
|
|
41447
|
-
<circle cx="20" cy="7" r="2" stroke="${color}"
|
|
41448
|
-
stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></circle>
|
|
41449
|
-
<circle cx="20" cy="17" r="2" stroke="${color}" stroke-width="2"
|
|
41450
|
-
stroke-linecap="round" stroke-linejoin="round"></circle>
|
|
41451
|
-
<path d="M18 7H6" stroke="${color}" stroke-width="2"
|
|
41452
|
-
stroke-linecap="round" stroke-linejoin="round"></path>
|
|
41453
|
-
<path d="M7 7V7C8.65685 7 10 8.34315 10 10V15C10 16.1046 10.8954 17 12 17H18"
|
|
41454
|
-
stroke="${color}" stroke-width="2" stroke-linecap="round"
|
|
41455
|
-
stroke-linejoin="round"></path> </g></svg>`;
|
|
41777
|
+
return "<svg id=\"pendo-ps-branching-svg\" viewBox=\"0 0 24 24\" fill=\"none\"\n style=\"margin-left: 5px;\n height:".concat(size, "; width:").concat(size, "; display:inline; vertical-align:middle;\" xmlns=\"http://www.w3.org/2000/svg\">\n <g stroke-width=\"0\"></g>\n <g stroke-linecap=\"round\" stroke-linejoin=\"round\"></g>\n <g> <circle cx=\"4\" cy=\"7\" r=\"2\" stroke=\"").concat(color, "\"\n stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></circle>\n <circle cx=\"20\" cy=\"7\" r=\"2\" stroke=\"").concat(color, "\"\n stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></circle>\n <circle cx=\"20\" cy=\"17\" r=\"2\" stroke=\"").concat(color, "\" stroke-width=\"2\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\"></circle>\n <path d=\"M18 7H6\" stroke=\"").concat(color, "\" stroke-width=\"2\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n <path d=\"M7 7V7C8.65685 7 10 8.34315 10 10V15C10 16.1046 10.8954 17 12 17H18\"\n stroke=\"").concat(color, "\" stroke-width=\"2\" stroke-linecap=\"round\"\n stroke-linejoin=\"round\"></path> </g></svg>");
|
|
41456
41778
|
}
|
|
41457
41779
|
}
|
|
41458
41780
|
};
|
|
41459
41781
|
function initialBranchingSetup(step, pendo) {
|
|
41460
|
-
|
|
41461
|
-
pendo._.forEach(questions, (question)
|
|
41462
|
-
|
|
41463
|
-
pendo._.each(step.guideElement.find(
|
|
41782
|
+
var questions = step.guideElement.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
|
|
41783
|
+
pendo._.forEach(questions, function (question) {
|
|
41784
|
+
var dataPendoPollId = question.getAttribute('data-pendo-poll-id');
|
|
41785
|
+
pendo._.each(step.guideElement.find("#".concat(question.id, " *")), function (element) {
|
|
41464
41786
|
guideMarkdownUtil.removeMarkdownSyntax(element, '{branching/}', '', pendo);
|
|
41465
41787
|
});
|
|
41466
|
-
|
|
41467
|
-
pendo._.forEach(pollLabels, (label)
|
|
41788
|
+
var pollLabels = step.guideElement.find("label[for*=".concat(dataPendoPollId, "]"));
|
|
41789
|
+
pendo._.forEach(pollLabels, function (label) {
|
|
41468
41790
|
if (pendo._.isNull(goToRegex.exec(label.textContent))) {
|
|
41469
41791
|
return;
|
|
41470
41792
|
}
|
|
41471
|
-
|
|
41472
|
-
|
|
41793
|
+
var gotoSubstring = goToRegex.exec(label.textContent)[1];
|
|
41794
|
+
var gotoIndex = goToRegex.exec(label.textContent)[2];
|
|
41473
41795
|
label.setAttribute('goToStep', gotoIndex);
|
|
41474
41796
|
guideMarkdownUtil.removeMarkdownSyntax(label, gotoSubstring, '', pendo);
|
|
41475
41797
|
});
|
|
41476
|
-
|
|
41798
|
+
var pollChoiceContainer = step.guideElement.find("[data-pendo-poll-id=".concat(dataPendoPollId, "]._pendo-multi-choice-poll-select-border"));
|
|
41477
41799
|
if (pollChoiceContainer && pollChoiceContainer.length) {
|
|
41478
41800
|
pollChoiceContainer[0].setAttribute('branching', '');
|
|
41479
41801
|
}
|
|
@@ -41482,15 +41804,15 @@ function initialBranchingSetup(step, pendo) {
|
|
|
41482
41804
|
}
|
|
41483
41805
|
function branchingGoToStep(event, step, guide, pendo) {
|
|
41484
41806
|
var _a;
|
|
41485
|
-
|
|
41486
|
-
|
|
41487
|
-
|
|
41488
|
-
|
|
41807
|
+
var checkedPollInputId = (_a = step.guideElement.find('[branching] input.pendo-radio[data-pendo-poll-id]:checked')[0]) === null || _a === void 0 ? void 0 : _a.id;
|
|
41808
|
+
var checkedPollLabel = step.guideElement.find("label[for=\"".concat(checkedPollInputId, "\"]"))[0];
|
|
41809
|
+
var checkedPollLabelStepIndex = checkedPollLabel === null || checkedPollLabel === void 0 ? void 0 : checkedPollLabel.getAttribute('goToStep');
|
|
41810
|
+
var pollStepIndex = checkedPollLabelStepIndex - 1;
|
|
41489
41811
|
if (pollStepIndex < 0)
|
|
41490
41812
|
return;
|
|
41491
|
-
|
|
41813
|
+
var destinationObject = {
|
|
41492
41814
|
destinationStepId: guide.steps[pollStepIndex].id,
|
|
41493
|
-
step
|
|
41815
|
+
step: step
|
|
41494
41816
|
};
|
|
41495
41817
|
pendo.goToStep(destinationObject);
|
|
41496
41818
|
event.cancel = true;
|
|
@@ -41511,10 +41833,10 @@ function encodeMetadataForUrl(value, urlBeforePlaceholder) {
|
|
|
41511
41833
|
return window.encodeURI(str);
|
|
41512
41834
|
}
|
|
41513
41835
|
|
|
41514
|
-
|
|
41836
|
+
var MetadataSubstitution = {
|
|
41515
41837
|
name: 'MetadataSubstitution',
|
|
41516
|
-
script(step, guide, pendo) {
|
|
41517
|
-
|
|
41838
|
+
script: function (step, guide, pendo) {
|
|
41839
|
+
var placeholderData = findSubstitutableElements(pendo);
|
|
41518
41840
|
if (step.domJson) {
|
|
41519
41841
|
findSubstitutableUrlsInJson(step.domJson, placeholderData, pendo);
|
|
41520
41842
|
}
|
|
@@ -41522,22 +41844,22 @@ const MetadataSubstitution = {
|
|
|
41522
41844
|
pendo._.each(placeholderData, function (placeholder) {
|
|
41523
41845
|
processPlaceholder(placeholder, pendo);
|
|
41524
41846
|
});
|
|
41525
|
-
|
|
41526
|
-
|
|
41527
|
-
updateGuideContainer(containerId,
|
|
41847
|
+
var containerId = "pendo-g-".concat(step.id);
|
|
41848
|
+
var context_1 = step.guideElement;
|
|
41849
|
+
updateGuideContainer(containerId, context_1, pendo);
|
|
41528
41850
|
}
|
|
41529
41851
|
},
|
|
41530
|
-
designerListener(pendo) {
|
|
41531
|
-
|
|
41852
|
+
designerListener: function (pendo) {
|
|
41853
|
+
var target = pendo.dom.getBody();
|
|
41532
41854
|
if (pendo.designerv2) {
|
|
41533
41855
|
pendo.designerv2.runMetadataSubstitutionForDesignerPreview = function runMetadataSubstitutionForDesignerPreview() {
|
|
41534
41856
|
var _a;
|
|
41535
41857
|
if (!document.querySelector(guideMarkdownUtil.containerSelector))
|
|
41536
41858
|
return;
|
|
41537
|
-
|
|
41859
|
+
var step = (_a = pendo.designerv2.currentlyPreviewedGuide) === null || _a === void 0 ? void 0 : _a.steps[0];
|
|
41538
41860
|
if (!step)
|
|
41539
41861
|
return;
|
|
41540
|
-
|
|
41862
|
+
var placeholderData = findSubstitutableElements(pendo);
|
|
41541
41863
|
if (step.buildingBlocks) {
|
|
41542
41864
|
findSubstitutableUrlsInJson(step.buildingBlocks, placeholderData, pendo);
|
|
41543
41865
|
}
|
|
@@ -41547,32 +41869,32 @@ const MetadataSubstitution = {
|
|
|
41547
41869
|
return;
|
|
41548
41870
|
processPlaceholder(placeholder, pendo);
|
|
41549
41871
|
});
|
|
41550
|
-
|
|
41551
|
-
|
|
41552
|
-
updateGuideContainer(containerId,
|
|
41872
|
+
var containerId = "pendo-g-".concat(step.id);
|
|
41873
|
+
var context_2 = step.guideElement;
|
|
41874
|
+
updateGuideContainer(containerId, context_2, pendo);
|
|
41553
41875
|
}
|
|
41554
41876
|
};
|
|
41555
41877
|
}
|
|
41556
|
-
|
|
41878
|
+
var config = {
|
|
41557
41879
|
attributeFilter: ['data-layout'],
|
|
41558
41880
|
attributes: true,
|
|
41559
41881
|
childList: true,
|
|
41560
41882
|
characterData: true,
|
|
41561
41883
|
subtree: true
|
|
41562
41884
|
};
|
|
41563
|
-
|
|
41564
|
-
|
|
41885
|
+
var MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
|
|
41886
|
+
var observer = new MutationObserver(applySubstitutionIndicators);
|
|
41565
41887
|
observer.observe(target, config);
|
|
41566
41888
|
function applySubstitutionIndicators(mutations) {
|
|
41567
41889
|
pendo._.each(mutations, function (mutation) {
|
|
41568
41890
|
var _a;
|
|
41569
41891
|
if (mutation.addedNodes.length) {
|
|
41570
41892
|
if (document.querySelector(guideMarkdownUtil.containerSelector)) {
|
|
41571
|
-
|
|
41572
|
-
|
|
41893
|
+
var placeholderData = findSubstitutableElements(pendo);
|
|
41894
|
+
var step = (_a = pendo.designerv2.currentlyPreviewedGuide) === null || _a === void 0 ? void 0 : _a.steps[0];
|
|
41573
41895
|
if (!step)
|
|
41574
41896
|
return;
|
|
41575
|
-
|
|
41897
|
+
var pendoBlocks = step.buildingBlocks;
|
|
41576
41898
|
if (!pendo._.isUndefined(pendoBlocks)) {
|
|
41577
41899
|
findSubstitutableUrlsInJson(pendoBlocks, placeholderData, pendo);
|
|
41578
41900
|
}
|
|
@@ -41582,9 +41904,9 @@ const MetadataSubstitution = {
|
|
|
41582
41904
|
return;
|
|
41583
41905
|
processPlaceholder(placeholder, pendo);
|
|
41584
41906
|
});
|
|
41585
|
-
|
|
41586
|
-
|
|
41587
|
-
updateGuideContainer(containerId,
|
|
41907
|
+
var containerId = "pendo-g-".concat(step.id);
|
|
41908
|
+
var context_3 = step.guideElement;
|
|
41909
|
+
updateGuideContainer(containerId, context_3, pendo);
|
|
41588
41910
|
}
|
|
41589
41911
|
}
|
|
41590
41912
|
}
|
|
@@ -41593,18 +41915,18 @@ const MetadataSubstitution = {
|
|
|
41593
41915
|
}
|
|
41594
41916
|
};
|
|
41595
41917
|
function processPlaceholder(placeholder, pendo) {
|
|
41596
|
-
|
|
41597
|
-
|
|
41598
|
-
|
|
41918
|
+
var match;
|
|
41919
|
+
var data = placeholder.data, target = placeholder.target;
|
|
41920
|
+
var subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
|
|
41599
41921
|
while ((match = matchPlaceholder(placeholder, subRegex))) {
|
|
41600
|
-
|
|
41601
|
-
|
|
41922
|
+
var usedArrayPath = Array.isArray(match) && match.length >= 2;
|
|
41923
|
+
var currentStr = target === 'textContent'
|
|
41602
41924
|
? data[target]
|
|
41603
41925
|
: decodeURI((data.getAttribute && (target === 'href' || target === 'value') ? (data.getAttribute(target) || '') : data[target]));
|
|
41604
|
-
|
|
41926
|
+
var matched = usedArrayPath ? match : subRegex.exec(currentStr);
|
|
41605
41927
|
if (!matched)
|
|
41606
41928
|
continue;
|
|
41607
|
-
|
|
41929
|
+
var mdValue = getSubstituteValue(matched, pendo);
|
|
41608
41930
|
substituteMetadataByTarget(data, target, mdValue, matched);
|
|
41609
41931
|
}
|
|
41610
41932
|
}
|
|
@@ -41613,50 +41935,50 @@ function matchPlaceholder(placeholder, regex) {
|
|
|
41613
41935
|
return placeholder.data[placeholder.target].match(regex);
|
|
41614
41936
|
}
|
|
41615
41937
|
else {
|
|
41616
|
-
|
|
41938
|
+
var raw = placeholder.data.getAttribute && (placeholder.target === 'href' || placeholder.target === 'value')
|
|
41617
41939
|
? (placeholder.data.getAttribute(placeholder.target) || '')
|
|
41618
41940
|
: placeholder.data[placeholder.target];
|
|
41619
41941
|
return decodeURI(raw).match(regex);
|
|
41620
41942
|
}
|
|
41621
41943
|
}
|
|
41622
41944
|
function getMetadataValueCaseInsensitive(metadata, type, property) {
|
|
41623
|
-
|
|
41945
|
+
var kind = metadata && metadata[type];
|
|
41624
41946
|
if (!kind || typeof kind !== 'object')
|
|
41625
41947
|
return undefined;
|
|
41626
|
-
|
|
41948
|
+
var direct = Object.prototype.hasOwnProperty.call(kind, property) ? kind[property] : undefined;
|
|
41627
41949
|
if (direct !== undefined) {
|
|
41628
41950
|
return direct;
|
|
41629
41951
|
}
|
|
41630
|
-
|
|
41631
|
-
|
|
41632
|
-
|
|
41952
|
+
var propLower = property.toLowerCase();
|
|
41953
|
+
var key = Object.keys(kind).find(function (k) { return k.toLowerCase() === propLower; });
|
|
41954
|
+
var value = key !== undefined ? kind[key] : undefined;
|
|
41633
41955
|
return value;
|
|
41634
41956
|
}
|
|
41635
41957
|
function getSubstituteValue(match, pendo) {
|
|
41636
41958
|
if (pendo._.isUndefined(match[1]) || pendo._.isUndefined(match[2])) {
|
|
41637
41959
|
return;
|
|
41638
41960
|
}
|
|
41639
|
-
|
|
41640
|
-
|
|
41641
|
-
|
|
41961
|
+
var type = match[1];
|
|
41962
|
+
var property = match[2];
|
|
41963
|
+
var defaultValue = match[3];
|
|
41642
41964
|
if (pendo._.isUndefined(type) || pendo._.isUndefined(property)) {
|
|
41643
41965
|
return;
|
|
41644
41966
|
}
|
|
41645
|
-
|
|
41646
|
-
|
|
41967
|
+
var metadata = pendo.getSerializedMetadata();
|
|
41968
|
+
var mdValue = getMetadataValueCaseInsensitive(metadata, type, property);
|
|
41647
41969
|
if (mdValue === undefined || mdValue === null)
|
|
41648
41970
|
mdValue = defaultValue || '';
|
|
41649
41971
|
return mdValue;
|
|
41650
41972
|
}
|
|
41651
41973
|
function substituteMetadataByTarget(data, target, mdValue, matched) {
|
|
41652
|
-
|
|
41653
|
-
|
|
41974
|
+
var isElement = data && typeof data.getAttribute === 'function';
|
|
41975
|
+
var current = (target === 'href' || target === 'value') && isElement
|
|
41654
41976
|
? (data.getAttribute(target) || '')
|
|
41655
41977
|
: data[target];
|
|
41656
41978
|
if (target === 'href' || target === 'value') {
|
|
41657
|
-
|
|
41658
|
-
|
|
41659
|
-
|
|
41979
|
+
var decodedUrl = decodeURI(current);
|
|
41980
|
+
var urlBeforePlaceholder = decodedUrl.slice(0, decodedUrl.indexOf(matched[0]));
|
|
41981
|
+
var safeValue = encodeMetadataForUrl(mdValue, urlBeforePlaceholder);
|
|
41660
41982
|
data[target] = decodedUrl.replace(matched[0], safeValue);
|
|
41661
41983
|
}
|
|
41662
41984
|
else {
|
|
@@ -41670,8 +41992,9 @@ function updateGuideContainer(containerId, context, pendo) {
|
|
|
41670
41992
|
pendo.flexElement(pendo.dom(guideMarkdownUtil.containerSelector));
|
|
41671
41993
|
pendo.BuildingBlocks.BuildingBlockGuides.recalculateGuideHeight(containerId, context);
|
|
41672
41994
|
}
|
|
41673
|
-
function findSubstitutableUrlsInJson(originalData, placeholderData
|
|
41674
|
-
|
|
41995
|
+
function findSubstitutableUrlsInJson(originalData, placeholderData, pendo) {
|
|
41996
|
+
if (placeholderData === void 0) { placeholderData = []; }
|
|
41997
|
+
var subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
|
|
41675
41998
|
if ((originalData.name === 'url' || originalData.name === 'href') && originalData.value) {
|
|
41676
41999
|
if (subRegex.test(originalData.value)) {
|
|
41677
42000
|
placeholderData.push({
|
|
@@ -41681,37 +42004,37 @@ function findSubstitutableUrlsInJson(originalData, placeholderData = [], pendo)
|
|
|
41681
42004
|
}
|
|
41682
42005
|
}
|
|
41683
42006
|
if (originalData.properties && originalData.id === 'href_link_block') {
|
|
41684
|
-
pendo._.each(originalData.properties, (prop)
|
|
42007
|
+
pendo._.each(originalData.properties, function (prop) {
|
|
41685
42008
|
findSubstitutableUrlsInJson(prop, placeholderData, pendo);
|
|
41686
42009
|
});
|
|
41687
42010
|
}
|
|
41688
42011
|
if (originalData.views) {
|
|
41689
|
-
pendo._.each(originalData.views, (view)
|
|
42012
|
+
pendo._.each(originalData.views, function (view) {
|
|
41690
42013
|
findSubstitutableUrlsInJson(view, placeholderData, pendo);
|
|
41691
42014
|
});
|
|
41692
42015
|
}
|
|
41693
42016
|
if (originalData.parameters) {
|
|
41694
|
-
pendo._.each(originalData.parameters, (param)
|
|
42017
|
+
pendo._.each(originalData.parameters, function (param) {
|
|
41695
42018
|
findSubstitutableUrlsInJson(param, placeholderData, pendo);
|
|
41696
42019
|
});
|
|
41697
42020
|
}
|
|
41698
42021
|
if (originalData.actions) {
|
|
41699
|
-
pendo._.each(originalData.actions, (action)
|
|
42022
|
+
pendo._.each(originalData.actions, function (action) {
|
|
41700
42023
|
findSubstitutableUrlsInJson(action, placeholderData, pendo);
|
|
41701
42024
|
});
|
|
41702
42025
|
}
|
|
41703
42026
|
if (originalData.children) {
|
|
41704
|
-
pendo._.each(originalData.children, (child)
|
|
42027
|
+
pendo._.each(originalData.children, function (child) {
|
|
41705
42028
|
findSubstitutableUrlsInJson(child, placeholderData, pendo);
|
|
41706
42029
|
});
|
|
41707
42030
|
}
|
|
41708
42031
|
return placeholderData;
|
|
41709
42032
|
}
|
|
41710
42033
|
function findSubstitutableElements(pendo) {
|
|
41711
|
-
|
|
42034
|
+
var elements = pendo.dom("".concat(guideMarkdownUtil.containerSelector, " *:not(.pendo-inline-ui)"));
|
|
41712
42035
|
return pendo._.chain(elements)
|
|
41713
42036
|
.filter(function (placeholder) {
|
|
41714
|
-
|
|
42037
|
+
var subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
|
|
41715
42038
|
if (placeholder.localName === 'a') {
|
|
41716
42039
|
return subRegex.test(decodeURI(placeholder.href)) || subRegex.test(placeholder.textContent);
|
|
41717
42040
|
}
|
|
@@ -41767,51 +42090,25 @@ function findSubstitutableElements(pendo) {
|
|
|
41767
42090
|
.value();
|
|
41768
42091
|
}
|
|
41769
42092
|
function substitutionIcon(color, size) {
|
|
41770
|
-
return (
|
|
41771
|
-
|
|
41772
|
-
|
|
41773
|
-
|
|
41774
|
-
|
|
41775
|
-
|
|
41776
|
-
transform="matrix(1, 0, 0, 1, 0, 0)rotate(0)">
|
|
41777
|
-
<g stroke-width="0"></g>
|
|
41778
|
-
<g stroke-linecap="round" stroke-linejoin="round"
|
|
41779
|
-
stroke="${color}" stroke-width="0.528"></g>
|
|
41780
|
-
<g><path fill-rule="evenodd" clip-rule="evenodd"
|
|
41781
|
-
d="M5 5.5C4.17157 5.5 3.5 6.17157 3.5 7V10C3.5 10.8284
|
|
41782
|
-
4.17157 11.5 5 11.5H8C8.82843 11.5 9.5 10.8284 9.5
|
|
41783
|
-
10V9H17V11C17 11.2761 17.2239 11.5 17.5 11.5C17.7761
|
|
41784
|
-
11.5 18 11.2761 18 11V8.5C18 8.22386 17.7761 8 17.5
|
|
41785
|
-
8H9.5V7C9.5 6.17157 8.82843 5.5 8 5.5H5ZM8.5 7C8.5
|
|
41786
|
-
6.72386 8.27614 6.5 8 6.5H5C4.72386 6.5 4.5 6.72386
|
|
41787
|
-
4.5 7V10C4.5 10.2761 4.72386 10.5 5 10.5H8C8.27614
|
|
41788
|
-
10.5 8.5 10.2761 8.5 10V7Z" fill="${color}"></path>
|
|
41789
|
-
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
41790
|
-
d="M7 13C7 12.7239 6.77614 12.5 6.5 12.5C6.22386 12.5
|
|
41791
|
-
6 12.7239 6 13V15.5C6 15.7761 6.22386 16 6.5
|
|
41792
|
-
16H14.5V17C14.5 17.8284 15.1716 18.5 16 18.5H19C19.8284
|
|
41793
|
-
18.5 20.5 17.8284 20.5 17V14C20.5 13.1716 19.8284 12.5
|
|
41794
|
-
19 12.5H16C15.1716 12.5 14.5 13.1716 14.5
|
|
41795
|
-
14V15H7V13ZM15.5 17C15.5 17.2761 15.7239 17.5 16
|
|
41796
|
-
17.5H19C19.2761 17.5 19.5 17.2761 19.5 17V14C19.5
|
|
41797
|
-
13.7239 19.2761 13.5 19 13.5H16C15.7239 13.5 15.5
|
|
41798
|
-
13.7239 15.5 14V17Z" fill="${color}"></path> </g></svg></div>`);
|
|
41799
|
-
}
|
|
41800
|
-
|
|
41801
|
-
const requiredElement = '<span class="_pendo-required-indicator" style="color:red; font-style:italic;" title="Question is required"> *</span>';
|
|
41802
|
-
const requiredSyntax = '{required/}';
|
|
41803
|
-
const RequiredQuestions = {
|
|
42093
|
+
return ("<div title=\"Metadata Substitution added\">\n <svg id=\"pendo-ps-substitution-icon\" viewBox=\"0 0 24 24\"\n preserveAspectRatio=\"xMidYMid meet\"\n height=".concat(size, " width=").concat(size, " title=\"Metadata Substitution\"\n style=\"bottom:5px; right:10px; position: absolute;\"\n fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" stroke=\"").concat(color, "\"\n transform=\"matrix(1, 0, 0, 1, 0, 0)rotate(0)\">\n <g stroke-width=\"0\"></g>\n <g stroke-linecap=\"round\" stroke-linejoin=\"round\"\n stroke=\"").concat(color, "\" stroke-width=\"0.528\"></g>\n <g><path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n d=\"M5 5.5C4.17157 5.5 3.5 6.17157 3.5 7V10C3.5 10.8284\n 4.17157 11.5 5 11.5H8C8.82843 11.5 9.5 10.8284 9.5\n 10V9H17V11C17 11.2761 17.2239 11.5 17.5 11.5C17.7761\n 11.5 18 11.2761 18 11V8.5C18 8.22386 17.7761 8 17.5\n 8H9.5V7C9.5 6.17157 8.82843 5.5 8 5.5H5ZM8.5 7C8.5\n 6.72386 8.27614 6.5 8 6.5H5C4.72386 6.5 4.5 6.72386\n 4.5 7V10C4.5 10.2761 4.72386 10.5 5 10.5H8C8.27614\n 10.5 8.5 10.2761 8.5 10V7Z\" fill=\"").concat(color, "\"></path>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n d=\"M7 13C7 12.7239 6.77614 12.5 6.5 12.5C6.22386 12.5\n 6 12.7239 6 13V15.5C6 15.7761 6.22386 16 6.5\n 16H14.5V17C14.5 17.8284 15.1716 18.5 16 18.5H19C19.8284\n 18.5 20.5 17.8284 20.5 17V14C20.5 13.1716 19.8284 12.5\n 19 12.5H16C15.1716 12.5 14.5 13.1716 14.5\n 14V15H7V13ZM15.5 17C15.5 17.2761 15.7239 17.5 16\n 17.5H19C19.2761 17.5 19.5 17.2761 19.5 17V14C19.5\n 13.7239 19.2761 13.5 19 13.5H16C15.7239 13.5 15.5\n 13.7239 15.5 14V17Z\" fill=\"").concat(color, "\"></path> </g></svg></div>"));
|
|
42094
|
+
}
|
|
42095
|
+
|
|
42096
|
+
var requiredElement = '<span class="_pendo-required-indicator" style="color:red; font-style:italic;" title="Question is required"> *</span>';
|
|
42097
|
+
var requiredSyntax = '{required/}';
|
|
42098
|
+
var RequiredQuestions = {
|
|
41804
42099
|
name: 'RequiredQuestions',
|
|
41805
|
-
script(step, guide, pendo) {
|
|
42100
|
+
script: function (step, guide, pendo) {
|
|
41806
42101
|
var _a;
|
|
41807
|
-
|
|
41808
|
-
|
|
41809
|
-
|
|
42102
|
+
var requiredPollIds = [];
|
|
42103
|
+
var submitButtons = (_a = guideMarkdownUtil.lookupGuideButtons(step.domJson)) === null || _a === void 0 ? void 0 : _a.filter(function (button) {
|
|
42104
|
+
return button.actions.find(function (action) { return action.action === 'submitPoll' || action.action === 'submitPollAndGoToStep'; });
|
|
42105
|
+
});
|
|
42106
|
+
var requiredQuestions = processRequiredQuestions();
|
|
41810
42107
|
if (requiredQuestions) {
|
|
41811
|
-
pendo._.forEach(requiredQuestions, (question)
|
|
42108
|
+
pendo._.forEach(requiredQuestions, function (question) {
|
|
41812
42109
|
if (question.classList.contains('_pendo-open-text-poll-question')) {
|
|
41813
|
-
|
|
41814
|
-
step.attachEvent(step.guideElement.find(
|
|
42110
|
+
var pollId = question.dataset.pendoPollId;
|
|
42111
|
+
step.attachEvent(step.guideElement.find("[data-pendo-poll-id=".concat(pollId, "]._pendo-open-text-poll-input"))[0], 'input', function () {
|
|
41815
42112
|
evaluateRequiredQuestions(requiredQuestions);
|
|
41816
42113
|
});
|
|
41817
42114
|
}
|
|
@@ -41823,11 +42120,13 @@ const RequiredQuestions = {
|
|
|
41823
42120
|
});
|
|
41824
42121
|
}
|
|
41825
42122
|
function getEligibleQuestions() {
|
|
41826
|
-
|
|
41827
|
-
|
|
41828
|
-
|
|
41829
|
-
|
|
41830
|
-
|
|
42123
|
+
var pollQuestions = pendo._.toArray(step.guideElement.find("[class*=-poll-question]:contains(".concat(requiredSyntax, ")")));
|
|
42124
|
+
var surveyMatches = pendo._.toArray(step.guideElement.find("[data-pendo-poll-id]:contains(".concat(requiredSyntax, ")")));
|
|
42125
|
+
var surveyQuestions = pendo._.filter(surveyMatches, function (candidate) {
|
|
42126
|
+
return !pendo._.some(surveyMatches, function (other) { return other !== candidate && candidate.contains(other); });
|
|
42127
|
+
});
|
|
42128
|
+
var allQuestions = pendo._.uniq(pollQuestions.concat(surveyQuestions));
|
|
42129
|
+
return pendo._.reduce(allQuestions, function (eligibleQuestions, question) {
|
|
41831
42130
|
if (question.classList.contains('_pendo-yes-no-poll-question'))
|
|
41832
42131
|
return eligibleQuestions;
|
|
41833
42132
|
eligibleQuestions.push(question);
|
|
@@ -41835,22 +42134,24 @@ const RequiredQuestions = {
|
|
|
41835
42134
|
}, []);
|
|
41836
42135
|
}
|
|
41837
42136
|
function ownsRequiredText(element) {
|
|
41838
|
-
return pendo._.some(element.childNodes, (node)
|
|
42137
|
+
return pendo._.some(element.childNodes, function (node) {
|
|
42138
|
+
return node.nodeType === 3 && node.nodeValue && node.nodeValue.indexOf(requiredSyntax) !== -1;
|
|
42139
|
+
});
|
|
41839
42140
|
}
|
|
41840
42141
|
function processRequiredQuestions() {
|
|
41841
|
-
|
|
42142
|
+
var questions = getEligibleQuestions();
|
|
41842
42143
|
if (questions) {
|
|
41843
|
-
pendo._.forEach(questions, question
|
|
41844
|
-
|
|
42144
|
+
pendo._.forEach(questions, function (question) {
|
|
42145
|
+
var dataPendoPollId = question.getAttribute('data-pendo-poll-id');
|
|
41845
42146
|
requiredPollIds.push(dataPendoPollId);
|
|
41846
|
-
|
|
41847
|
-
|
|
41848
|
-
pendo._.each(candidates, (element)
|
|
42147
|
+
var candidates = step.guideElement.find("#".concat(question.id, " *, #").concat(question.id));
|
|
42148
|
+
var textHost = pendo._.find(candidates, ownsRequiredText) || question;
|
|
42149
|
+
pendo._.each(candidates, function (element) {
|
|
41849
42150
|
guideMarkdownUtil.removeMarkdownSyntax(element, requiredSyntax, '', pendo);
|
|
41850
42151
|
});
|
|
41851
|
-
|
|
42152
|
+
var textHostEl = pendo.dom(textHost);
|
|
41852
42153
|
if (textHostEl.find('._pendo-required-indicator').length === 0) {
|
|
41853
|
-
|
|
42154
|
+
var questionParagraph = textHostEl.find('p');
|
|
41854
42155
|
if (questionParagraph && questionParagraph.length) {
|
|
41855
42156
|
pendo.dom(questionParagraph[0]).append(requiredElement);
|
|
41856
42157
|
}
|
|
@@ -41861,15 +42162,7 @@ const RequiredQuestions = {
|
|
|
41861
42162
|
});
|
|
41862
42163
|
}
|
|
41863
42164
|
if (pendo._.size(requiredPollIds)) {
|
|
41864
|
-
|
|
41865
|
-
id=_pendo-guide-required-disabled>
|
|
41866
|
-
._pendo-button:disabled, ._pendo-buttons[disabled] {
|
|
41867
|
-
border: 1px solid #999999 !important;
|
|
41868
|
-
background-color: #cccccc !important;
|
|
41869
|
-
color: #666666 !important;
|
|
41870
|
-
pointer-events: none !important;
|
|
41871
|
-
}
|
|
41872
|
-
</style>`;
|
|
42165
|
+
var disabledButtonStyles = "<style type=text/css\n id=_pendo-guide-required-disabled>\n ._pendo-button:disabled, ._pendo-buttons[disabled] {\n border: 1px solid #999999 !important;\n background-color: #cccccc !important;\n color: #666666 !important;\n pointer-events: none !important;\n }\n </style>";
|
|
41873
42166
|
if (pendo.dom('#_pendo-guide-required-disabled').length === 0) {
|
|
41874
42167
|
pendo.dom('head').append(disabledButtonStyles);
|
|
41875
42168
|
}
|
|
@@ -41880,15 +42173,11 @@ const RequiredQuestions = {
|
|
|
41880
42173
|
function evaluateRequiredQuestions(questions) {
|
|
41881
42174
|
if (questions.length === 0)
|
|
41882
42175
|
return;
|
|
41883
|
-
|
|
41884
|
-
|
|
41885
|
-
responses = responses.concat(pendo._.map(questions, (question)
|
|
41886
|
-
|
|
41887
|
-
|
|
41888
|
-
[data-pendo-poll-id=${pollId}] textarea,
|
|
41889
|
-
[data-pendo-poll-id=${pollId}] input:text,
|
|
41890
|
-
[data-pendo-poll-id=${pollId}] select,
|
|
41891
|
-
[data-pendo-poll-id=${pollId}] input:radio:checked`);
|
|
42176
|
+
var allRequiredComplete = true;
|
|
42177
|
+
var responses = [];
|
|
42178
|
+
responses = responses.concat(pendo._.map(questions, function (question) {
|
|
42179
|
+
var pollId = question.getAttribute('data-pendo-poll-id');
|
|
42180
|
+
var input = step.guideElement.find("\n [data-pendo-poll-id=".concat(pollId, "] textarea,\n [data-pendo-poll-id=").concat(pollId, "] input:text,\n [data-pendo-poll-id=").concat(pollId, "] select,\n [data-pendo-poll-id=").concat(pollId, "] input:radio:checked"));
|
|
41892
42181
|
if (input && input.length && input[0].value) {
|
|
41893
42182
|
return input[0].value;
|
|
41894
42183
|
}
|
|
@@ -41905,50 +42194,50 @@ const RequiredQuestions = {
|
|
|
41905
42194
|
}
|
|
41906
42195
|
function disableEligibleButtons(buttons) {
|
|
41907
42196
|
pendo._.each(buttons, function (button) {
|
|
41908
|
-
if (step.guideElement.find(
|
|
41909
|
-
step.guideElement.find(
|
|
41910
|
-
step.guideElement.find(
|
|
42197
|
+
if (step.guideElement.find("#".concat(button.props.id))[0]) {
|
|
42198
|
+
step.guideElement.find("#".concat(button.props.id))[0].disabled = true;
|
|
42199
|
+
step.guideElement.find("#".concat(button.props.id))[0].parentElement.title = 'Please complete all required questions.';
|
|
41911
42200
|
}
|
|
41912
42201
|
});
|
|
41913
42202
|
}
|
|
41914
42203
|
function enableEligibleButtons(buttons) {
|
|
41915
42204
|
pendo._.each(buttons, function (button) {
|
|
41916
|
-
if (step.guideElement.find(
|
|
41917
|
-
step.guideElement.find(
|
|
41918
|
-
step.guideElement.find(
|
|
42205
|
+
if (step.guideElement.find("#".concat(button.props.id))[0]) {
|
|
42206
|
+
step.guideElement.find("#".concat(button.props.id))[0].disabled = false;
|
|
42207
|
+
step.guideElement.find("#".concat(button.props.id))[0].parentElement.title = '';
|
|
41919
42208
|
}
|
|
41920
42209
|
});
|
|
41921
42210
|
}
|
|
41922
42211
|
},
|
|
41923
|
-
test(step, guide, pendo) {
|
|
42212
|
+
test: function (step, guide, pendo) {
|
|
41924
42213
|
var _a, _b;
|
|
41925
|
-
|
|
41926
|
-
|
|
42214
|
+
var pollQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find("[class*=-poll-question]:contains(".concat(requiredSyntax, ")"));
|
|
42215
|
+
var surveyQuestions = (_b = step.guideElement) === null || _b === void 0 ? void 0 : _b.find("[data-pendo-poll-id]:contains(".concat(requiredSyntax, ")"));
|
|
41927
42216
|
return (!pendo._.isUndefined(pollQuestions) && pendo._.size(pollQuestions)) ||
|
|
41928
42217
|
(!pendo._.isUndefined(surveyQuestions) && pendo._.size(surveyQuestions));
|
|
41929
42218
|
},
|
|
41930
|
-
designerListener(pendo) {
|
|
41931
|
-
|
|
41932
|
-
|
|
41933
|
-
|
|
42219
|
+
designerListener: function (pendo) {
|
|
42220
|
+
var requiredQuestions = [];
|
|
42221
|
+
var target = pendo.dom.getBody();
|
|
42222
|
+
var config = {
|
|
41934
42223
|
attributeFilter: ['data-layout'],
|
|
41935
42224
|
attributes: true,
|
|
41936
42225
|
childList: true,
|
|
41937
42226
|
characterData: true,
|
|
41938
42227
|
subtree: true
|
|
41939
42228
|
};
|
|
41940
|
-
|
|
41941
|
-
|
|
42229
|
+
var MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
|
|
42230
|
+
var observer = new MutationObserver(applyRequiredIndicators);
|
|
41942
42231
|
observer.observe(target, config);
|
|
41943
42232
|
function applyRequiredIndicators(mutations) {
|
|
41944
42233
|
pendo._.each(mutations, function (mutation) {
|
|
41945
42234
|
var _a;
|
|
41946
|
-
|
|
42235
|
+
var nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
|
|
41947
42236
|
if (mutation.addedNodes.length && nodeHasQuerySelector) {
|
|
41948
|
-
|
|
42237
|
+
var eligiblePolls = mutation.addedNodes[0].querySelectorAll('[class*=-poll-wrapper], [class*=-poll-select-border], [id^=survey-item-wrapper__]');
|
|
41949
42238
|
if (eligiblePolls) {
|
|
41950
42239
|
pendo._.each(eligiblePolls, function (poll) {
|
|
41951
|
-
|
|
42240
|
+
var dataPendoPollId;
|
|
41952
42241
|
if (poll.classList.contains('_pendo-open-text-poll-wrapper') ||
|
|
41953
42242
|
poll.classList.contains('_pendo-number-scale-poll-wrapper')) {
|
|
41954
42243
|
dataPendoPollId = poll.getAttribute('name');
|
|
@@ -41956,31 +42245,31 @@ const RequiredQuestions = {
|
|
|
41956
42245
|
else {
|
|
41957
42246
|
dataPendoPollId = poll.getAttribute('data-pendo-poll-id');
|
|
41958
42247
|
}
|
|
41959
|
-
|
|
41960
|
-
|
|
41961
|
-
pendo.dom(
|
|
42248
|
+
var questionText;
|
|
42249
|
+
var questionElement = pendo.dom("[class*=\"-poll-question\"][data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0] ||
|
|
42250
|
+
pendo.dom(".bb-text[data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0];
|
|
41962
42251
|
if (questionElement) {
|
|
41963
42252
|
questionText = questionElement.textContent;
|
|
41964
42253
|
}
|
|
41965
|
-
|
|
42254
|
+
var requiredSyntaxIndex = questionText ? questionText.indexOf(requiredSyntax) : -1;
|
|
41966
42255
|
if (requiredSyntaxIndex > -1) {
|
|
41967
|
-
pendo._.each(pendo.dom(
|
|
41968
|
-
pendo._.each(pendo.dom(
|
|
42256
|
+
pendo._.each(pendo.dom("[data-pendo-poll-id=".concat(dataPendoPollId, "]:not(.pendo-radio)")), function (element) {
|
|
42257
|
+
pendo._.each(pendo.dom("#".concat(element.id, " *:not(\".pendo-radio\"), #").concat(element.id, ":not(\".pendo-radio\")")), function (item) {
|
|
41969
42258
|
guideMarkdownUtil.removeMarkdownSyntax(item, requiredSyntax, '', pendo);
|
|
41970
42259
|
});
|
|
41971
42260
|
});
|
|
41972
|
-
|
|
41973
|
-
|
|
41974
|
-
|
|
41975
|
-
|
|
41976
|
-
pendo._.each(pendo.dom(
|
|
41977
|
-
pendo._.each(el.childNodes, (node)
|
|
42261
|
+
var pollTextSelector = ".bb-text[data-pendo-poll-id=".concat(dataPendoPollId, "]");
|
|
42262
|
+
var pollParagraphSelector = "".concat(pollTextSelector, " p");
|
|
42263
|
+
var pollListItemSelector = "".concat(pollTextSelector, " li");
|
|
42264
|
+
var pollIndicatorSelector = "".concat(pollTextSelector, " ._pendo-required-indicator");
|
|
42265
|
+
pendo._.each(pendo.dom("".concat(pollParagraphSelector, ", ").concat(pollListItemSelector)), function (el) {
|
|
42266
|
+
pendo._.each(el.childNodes, function (node) {
|
|
41978
42267
|
if (node.nodeType === 3 && node.nodeValue.indexOf(requiredSyntax) !== -1) {
|
|
41979
42268
|
node.nodeValue = node.nodeValue.split(requiredSyntax).join('');
|
|
41980
42269
|
}
|
|
41981
42270
|
});
|
|
41982
42271
|
});
|
|
41983
|
-
|
|
42272
|
+
var hasIndicator = pendo.dom(pollIndicatorSelector).length !== 0;
|
|
41984
42273
|
if (!hasIndicator) {
|
|
41985
42274
|
if (pendo.dom(pollParagraphSelector).length !== 0 || pendo.dom(pollListItemSelector).length !== 0) {
|
|
41986
42275
|
pendo.dom(pollParagraphSelector).append(requiredElement);
|
|
@@ -41991,7 +42280,7 @@ const RequiredQuestions = {
|
|
|
41991
42280
|
}
|
|
41992
42281
|
}
|
|
41993
42282
|
if (pendo._.contains(requiredQuestions, dataPendoPollId)) {
|
|
41994
|
-
|
|
42283
|
+
var questionIndex = requiredQuestions.indexOf(dataPendoPollId);
|
|
41995
42284
|
if (questionIndex !== -1) {
|
|
41996
42285
|
requiredQuestions.splice(questionIndex, 1);
|
|
41997
42286
|
}
|
|
@@ -42002,7 +42291,7 @@ const RequiredQuestions = {
|
|
|
42002
42291
|
}
|
|
42003
42292
|
else {
|
|
42004
42293
|
if (pendo._.contains(requiredQuestions, dataPendoPollId)) {
|
|
42005
|
-
|
|
42294
|
+
var index = requiredQuestions.indexOf(dataPendoPollId);
|
|
42006
42295
|
if (index !== -1) {
|
|
42007
42296
|
requiredQuestions.splice(index, 1);
|
|
42008
42297
|
}
|
|
@@ -42016,54 +42305,54 @@ const RequiredQuestions = {
|
|
|
42016
42305
|
}
|
|
42017
42306
|
};
|
|
42018
42307
|
|
|
42019
|
-
|
|
42020
|
-
|
|
42021
|
-
script(step, guide, pendo) {
|
|
42022
|
-
|
|
42023
|
-
|
|
42024
|
-
|
|
42025
|
-
|
|
42026
|
-
|
|
42308
|
+
var skipStepRegex = new RegExp(guideMarkdownUtil.skipStepString);
|
|
42309
|
+
var SkipToEligibleStep = {
|
|
42310
|
+
script: function (step, guide, pendo) {
|
|
42311
|
+
var isAdvanceIntercepted = false;
|
|
42312
|
+
var isPreviousIntercepted = false;
|
|
42313
|
+
var guideContainer = step.guideElement.find(guideMarkdownUtil.containerSelector);
|
|
42314
|
+
var guideContainerAriaLabel = guideContainer.attr('aria-label');
|
|
42315
|
+
var stepNumberOrAuto = skipStepRegex.exec(guideContainerAriaLabel)[1];
|
|
42027
42316
|
if (guideContainer) {
|
|
42028
42317
|
guideContainer.attr({ 'aria-label': guideContainer.attr('aria-label').replace(skipStepRegex, '') });
|
|
42029
42318
|
}
|
|
42030
|
-
this.on('beforeAdvance', (evt)
|
|
42319
|
+
this.on('beforeAdvance', function (evt) {
|
|
42031
42320
|
if (guide.getPositionOfStep(step) === guide.steps.length || pendo._.isUndefined(stepNumberOrAuto))
|
|
42032
42321
|
return; // exit on the last step of a guide or when we don't have an argument
|
|
42033
|
-
|
|
42322
|
+
var eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'next');
|
|
42034
42323
|
if (!isAdvanceIntercepted && stepNumberOrAuto) {
|
|
42035
42324
|
isAdvanceIntercepted = true;
|
|
42036
|
-
pendo.goToStep({ destinationStepId: eligibleStep.id, step });
|
|
42325
|
+
pendo.goToStep({ destinationStepId: eligibleStep.id, step: step });
|
|
42037
42326
|
evt.cancel = true;
|
|
42038
42327
|
}
|
|
42039
42328
|
});
|
|
42040
|
-
this.on('beforePrevious', (evt)
|
|
42329
|
+
this.on('beforePrevious', function (evt) {
|
|
42041
42330
|
if (pendo._.isUndefined(stepNumberOrAuto))
|
|
42042
42331
|
return;
|
|
42043
|
-
|
|
42332
|
+
var eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'previous');
|
|
42044
42333
|
if (!isPreviousIntercepted && stepNumberOrAuto) {
|
|
42045
42334
|
isPreviousIntercepted = true;
|
|
42046
|
-
pendo.goToStep({ destinationStepId: eligibleStep.id, step });
|
|
42335
|
+
pendo.goToStep({ destinationStepId: eligibleStep.id, step: step });
|
|
42047
42336
|
evt.cancel = true;
|
|
42048
42337
|
}
|
|
42049
42338
|
});
|
|
42050
42339
|
function findEligibleSkipStep(stepNumber, direction) {
|
|
42051
42340
|
// Find the next eligible step by using getPosition of step (1 based)
|
|
42052
42341
|
// getPosition - 2 gives the previous step
|
|
42053
|
-
|
|
42054
|
-
|
|
42342
|
+
var skipForwardStep = findStepOnPage(guide.getPositionOfStep(step), 'next', stepNumber);
|
|
42343
|
+
var skipPreviousStep = findStepOnPage(guide.getPositionOfStep(step) - 2, 'previous', stepNumber);
|
|
42055
42344
|
if (skipForwardStep && direction == 'next') {
|
|
42056
|
-
pendo.goToStep({ destinationStepId: skipForwardStep, step });
|
|
42345
|
+
pendo.goToStep({ destinationStepId: skipForwardStep, step: step });
|
|
42057
42346
|
}
|
|
42058
42347
|
if (skipPreviousStep && direction == 'previous') {
|
|
42059
|
-
pendo.goToStep({ destinationStepId: skipPreviousStep, step });
|
|
42348
|
+
pendo.goToStep({ destinationStepId: skipPreviousStep, step: step });
|
|
42060
42349
|
}
|
|
42061
42350
|
return direction === 'next' ? skipForwardStep : skipPreviousStep;
|
|
42062
42351
|
}
|
|
42063
42352
|
function findStepOnPage(stepIndex, direction, stepNumber) {
|
|
42064
42353
|
if (pendo._.isNaN(stepIndex))
|
|
42065
42354
|
return;
|
|
42066
|
-
|
|
42355
|
+
var $step = guide.steps[stepIndex];
|
|
42067
42356
|
if ($step && !$step.canShow()) {
|
|
42068
42357
|
if (stepNumber !== 'auto') {
|
|
42069
42358
|
return guide.steps[stepNumber - 1];
|
|
@@ -42080,34 +42369,34 @@ const SkipToEligibleStep = {
|
|
|
42080
42369
|
}
|
|
42081
42370
|
}
|
|
42082
42371
|
},
|
|
42083
|
-
test(step, guide, pendo) {
|
|
42372
|
+
test: function (step, guide, pendo) {
|
|
42084
42373
|
var _a;
|
|
42085
|
-
|
|
42374
|
+
var guideContainerAriaLabel = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find(guideMarkdownUtil.containerSelector).attr('aria-label');
|
|
42086
42375
|
return pendo._.isString(guideContainerAriaLabel) && guideContainerAriaLabel.indexOf('{skipStep') !== -1;
|
|
42087
42376
|
},
|
|
42088
|
-
designerListener(pendo) {
|
|
42089
|
-
|
|
42090
|
-
|
|
42377
|
+
designerListener: function (pendo) {
|
|
42378
|
+
var target = pendo.dom.getBody();
|
|
42379
|
+
var config = {
|
|
42091
42380
|
attributeFilter: ['data-layout'],
|
|
42092
42381
|
attributes: true,
|
|
42093
42382
|
childList: true,
|
|
42094
42383
|
characterData: true,
|
|
42095
42384
|
subtree: true
|
|
42096
42385
|
};
|
|
42097
|
-
|
|
42098
|
-
|
|
42386
|
+
var MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
|
|
42387
|
+
var observer = new MutationObserver(applySkipStepIndicator);
|
|
42099
42388
|
observer.observe(target, config);
|
|
42100
42389
|
// create an observer instance
|
|
42101
42390
|
function applySkipStepIndicator(mutations) {
|
|
42102
42391
|
pendo._.each(mutations, function (mutation) {
|
|
42103
42392
|
var _a, _b;
|
|
42104
|
-
|
|
42393
|
+
var nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
|
|
42105
42394
|
if (mutation.addedNodes.length && nodeHasQuerySelector) {
|
|
42106
|
-
|
|
42107
|
-
|
|
42395
|
+
var guideContainer = mutation.addedNodes[0].querySelectorAll(guideMarkdownUtil.containerSelector);
|
|
42396
|
+
var guideContainerAriaLabel = (_b = guideContainer[0]) === null || _b === void 0 ? void 0 : _b.getAttribute('aria-label');
|
|
42108
42397
|
if (guideContainerAriaLabel) {
|
|
42109
42398
|
if (guideContainerAriaLabel.match(skipStepRegex)) {
|
|
42110
|
-
|
|
42399
|
+
var fullSkipStepString = guideContainerAriaLabel.match(skipStepRegex)[0];
|
|
42111
42400
|
guideContainerAriaLabel.replace(fullSkipStepString, '');
|
|
42112
42401
|
if (!pendo.dom('#_pendoSkipIcon').length) {
|
|
42113
42402
|
pendo.dom(guideMarkdownUtil.containerSelector).append(skipIcon('#999', '30px').trim());
|
|
@@ -42118,48 +42407,30 @@ const SkipToEligibleStep = {
|
|
|
42118
42407
|
});
|
|
42119
42408
|
}
|
|
42120
42409
|
function skipIcon(color, size) {
|
|
42121
|
-
return (
|
|
42122
|
-
width="${size}" height="${size}" viewBox="0 0 512.000000 512.000000"
|
|
42123
|
-
preserveAspectRatio="xMidYMid meet" style="bottom:5px; right:10px; position: absolute;">
|
|
42124
|
-
<g transform="translate(0.000000,512.000000) scale(0.100000,-0.100000)"
|
|
42125
|
-
fill="${color}" stroke="none">
|
|
42126
|
-
<path d="M2185 4469 c-363 -38 -739 -186 -1034 -407 -95 -71 -273 -243 -357
|
|
42127
|
-
-343 -205 -246 -364 -577 -429 -897 -25 -121 -45 -288 -45 -373 l0 -49 160 0
|
|
42128
|
-
160 0 0 48 c0 26 5 88 10 137 68 593 417 1103 940 1374 1100 570 2418 -137
|
|
42129
|
-
2560 -1374 5 -49 10 -111 10 -137 l0 -47 -155 -3 -155 -3 235 -235 235 -236
|
|
42130
|
-
235 236 235 235 -155 3 -155 3 0 48 c0 27 -5 95 -10 152 -100 989 -878 1767
|
|
42131
|
-
-1869 1868 -117 12 -298 12 -416 0z"/>
|
|
42132
|
-
<path d="M320 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
|
|
42133
|
-
<path d="M960 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
|
|
42134
|
-
<path d="M1600 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
|
|
42135
|
-
<path d="M2240 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
|
|
42136
|
-
<path d="M2880 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
|
|
42137
|
-
<path d="M3840 1440 l0 -160 480 0 480 0 0 160 0 160 -480 0 -480 0 0 -160z"/>
|
|
42138
|
-
</g></svg></div>
|
|
42139
|
-
`);
|
|
42410
|
+
return ("<div title=\"Skip step added\"><svg id=\"_pendoSkipIcon\" version=\"1.0\" xmlns=\"http://www.w3.org/2000/svg\"\n width=\"".concat(size, "\" height=\"").concat(size, "\" viewBox=\"0 0 512.000000 512.000000\"\n preserveAspectRatio=\"xMidYMid meet\" style=\"bottom:5px; right:10px; position: absolute;\">\n <g transform=\"translate(0.000000,512.000000) scale(0.100000,-0.100000)\"\n fill=\"").concat(color, "\" stroke=\"none\">\n <path d=\"M2185 4469 c-363 -38 -739 -186 -1034 -407 -95 -71 -273 -243 -357\n -343 -205 -246 -364 -577 -429 -897 -25 -121 -45 -288 -45 -373 l0 -49 160 0\n 160 0 0 48 c0 26 5 88 10 137 68 593 417 1103 940 1374 1100 570 2418 -137\n 2560 -1374 5 -49 10 -111 10 -137 l0 -47 -155 -3 -155 -3 235 -235 235 -236\n 235 236 235 235 -155 3 -155 3 0 48 c0 27 -5 95 -10 152 -100 989 -878 1767\n -1869 1868 -117 12 -298 12 -416 0z\"/>\n <path d=\"M320 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z\"/>\n <path d=\"M960 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z\"/>\n <path d=\"M1600 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z\"/>\n <path d=\"M2240 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z\"/>\n <path d=\"M2880 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z\"/>\n <path d=\"M3840 1440 l0 -160 480 0 480 0 0 160 0 160 -480 0 -480 0 0 -160z\"/>\n </g></svg></div>\n "));
|
|
42140
42411
|
}
|
|
42141
42412
|
}
|
|
42142
42413
|
};
|
|
42143
42414
|
|
|
42144
42415
|
function GuideMarkdown() {
|
|
42145
|
-
|
|
42146
|
-
|
|
42147
|
-
|
|
42416
|
+
var guideMarkdown;
|
|
42417
|
+
var pluginApi;
|
|
42418
|
+
var globalPendo;
|
|
42148
42419
|
return {
|
|
42149
42420
|
name: 'GuideMarkdown',
|
|
42150
42421
|
initialize: init,
|
|
42151
|
-
teardown
|
|
42422
|
+
teardown: teardown
|
|
42152
42423
|
};
|
|
42153
42424
|
function init(pendo, PluginAPI) {
|
|
42154
42425
|
globalPendo = pendo;
|
|
42155
42426
|
pluginApi = PluginAPI;
|
|
42156
|
-
|
|
42157
|
-
|
|
42427
|
+
var configReader = PluginAPI.ConfigReader;
|
|
42428
|
+
var GUIDEMARKDOWN_CONFIG = 'guideMarkdown';
|
|
42158
42429
|
configReader.addOption(GUIDEMARKDOWN_CONFIG, [
|
|
42159
42430
|
configReader.sources.SNIPPET_SRC,
|
|
42160
42431
|
configReader.sources.PENDO_CONFIG_SRC
|
|
42161
42432
|
], false);
|
|
42162
|
-
|
|
42433
|
+
var markdownScriptsEnabled = configReader.get(GUIDEMARKDOWN_CONFIG);
|
|
42163
42434
|
if (!markdownScriptsEnabled)
|
|
42164
42435
|
return;
|
|
42165
42436
|
guideMarkdown = [PollBranching, MetadataSubstitution, RequiredQuestions, SkipToEligibleStep];
|
|
@@ -43218,8 +43489,8 @@ function Feedback() {
|
|
|
43218
43489
|
var widgetLoaded = false;
|
|
43219
43490
|
var feedbackAllowedProductId = '';
|
|
43220
43491
|
var initialized = false;
|
|
43221
|
-
|
|
43222
|
-
|
|
43492
|
+
var PING_COOKIE = 'feedback_ping_sent';
|
|
43493
|
+
var PING_COOKIE_EXPIRATION = 1000 * 60 * 60;
|
|
43223
43494
|
var overflowMediaQuery = '@media only screen and (max-device-width:1112px){#feedback-widget{overflow-y:scroll}}';
|
|
43224
43495
|
var slideIn = '@-webkit-keyframes pendoFeedbackSlideIn{from{opacity:0;transform:translate(145px,0) rotate(270deg) translateY(-50%)}to{opacity:1;transform:translate(50%,0) rotate(270deg) translateY(-50%)}}@keyframes pendoFeedbackSlideIn{from{opacity:0;transform:translate(145px,0) rotate(270deg) translateY(-50%)}to{opacity:1;transform:translate(50%,0) rotate(270deg) translateY(-50%)}}';
|
|
43225
43496
|
var slideInLeft = '@-webkit-keyframes pendoFeedbackSlideIn-left{from{opacity:0;transform:rotate(270deg) translateX(-55%) translateY(-55%)}to{opacity:1;transform:rotate(270deg) translateX(-55%) translateY(0)}}@keyframes pendoFeedbackSlideIn-left{from{opacity:0;transform:rotate(270deg) translateX(-55%) translateY(-55%)}to{opacity:1;transform:rotate(270deg) translateX(-55%) translateY(0)}}';
|
|
@@ -43239,28 +43510,28 @@ function Feedback() {
|
|
|
43239
43510
|
feedbackStyles: 'pendo-feedback-styles',
|
|
43240
43511
|
feedbackFrameStyles: 'pendo-feedback-visible-buttons-styles'
|
|
43241
43512
|
};
|
|
43242
|
-
|
|
43243
|
-
|
|
43513
|
+
var globalPendo;
|
|
43514
|
+
var pluginApi;
|
|
43244
43515
|
return {
|
|
43245
43516
|
name: 'Feedback',
|
|
43246
|
-
initialize,
|
|
43247
|
-
teardown,
|
|
43248
|
-
validate
|
|
43517
|
+
initialize: initialize,
|
|
43518
|
+
teardown: teardown,
|
|
43519
|
+
validate: validate
|
|
43249
43520
|
};
|
|
43250
43521
|
function initialize(pendo, PluginAPI) {
|
|
43251
43522
|
globalPendo = pendo;
|
|
43252
43523
|
pluginApi = PluginAPI;
|
|
43253
43524
|
var publicFeedback = {
|
|
43254
|
-
ping,
|
|
43255
|
-
init,
|
|
43525
|
+
ping: ping,
|
|
43526
|
+
init: init,
|
|
43256
43527
|
initialized: getInitialized,
|
|
43257
|
-
loginAndRedirect,
|
|
43258
|
-
openFeedback,
|
|
43259
|
-
initializeFeedbackOnce,
|
|
43260
|
-
isFeedbackLoaded,
|
|
43261
|
-
convertPendoToFeedbackOptions,
|
|
43528
|
+
loginAndRedirect: loginAndRedirect,
|
|
43529
|
+
openFeedback: openFeedback,
|
|
43530
|
+
initializeFeedbackOnce: initializeFeedbackOnce,
|
|
43531
|
+
isFeedbackLoaded: isFeedbackLoaded,
|
|
43532
|
+
convertPendoToFeedbackOptions: convertPendoToFeedbackOptions,
|
|
43262
43533
|
isUnsupportedIE: pendo._.partial(isUnsupportedIE, PluginAPI),
|
|
43263
|
-
removeFeedbackWidget
|
|
43534
|
+
removeFeedbackWidget: removeFeedbackWidget
|
|
43264
43535
|
};
|
|
43265
43536
|
pendo.feedback = publicFeedback;
|
|
43266
43537
|
pendo.getFeedbackSettings = getFeedbackSettings;
|
|
@@ -43291,7 +43562,7 @@ function Feedback() {
|
|
|
43291
43562
|
localStorageOnly: true
|
|
43292
43563
|
});
|
|
43293
43564
|
return {
|
|
43294
|
-
validate
|
|
43565
|
+
validate: validate
|
|
43295
43566
|
};
|
|
43296
43567
|
}
|
|
43297
43568
|
function teardown() {
|
|
@@ -43311,18 +43582,18 @@ function Feedback() {
|
|
|
43311
43582
|
return result;
|
|
43312
43583
|
}
|
|
43313
43584
|
function pingOrInitialize() {
|
|
43314
|
-
|
|
43585
|
+
var options = getPendoOptions();
|
|
43315
43586
|
if (initialized) {
|
|
43316
|
-
|
|
43587
|
+
var feedbackOptions = convertPendoToFeedbackOptions(options);
|
|
43317
43588
|
ping(feedbackOptions);
|
|
43318
43589
|
}
|
|
43319
43590
|
else if (shouldInitializeFeedback() && !globalPendo._.isEmpty(options)) {
|
|
43320
|
-
|
|
43321
|
-
init(options, settings)
|
|
43591
|
+
var settings = pluginApi.ConfigReader.get('feedbackSettings');
|
|
43592
|
+
init(options, settings)["catch"](globalPendo._.noop);
|
|
43322
43593
|
}
|
|
43323
43594
|
}
|
|
43324
43595
|
function handleIdentityChange(event) {
|
|
43325
|
-
|
|
43596
|
+
var visitorId = globalPendo._.get(event, 'data.0.visitor_id') || globalPendo._.get(event, 'data.0.options.visitor.id');
|
|
43326
43597
|
if (globalPendo.isAnonymousVisitor(visitorId)) {
|
|
43327
43598
|
removeFeedbackWidget();
|
|
43328
43599
|
return;
|
|
@@ -43392,9 +43663,9 @@ function Feedback() {
|
|
|
43392
43663
|
if (toSend.data && toSend.data !== '{}' && toSend.data !== 'null') {
|
|
43393
43664
|
return globalPendo.ajax
|
|
43394
43665
|
.postJSON(getFullUrl('/widget/pendo_ping'), toSend)
|
|
43395
|
-
.then((response)
|
|
43666
|
+
.then(function (response) {
|
|
43396
43667
|
onWidgetPingResponse(response);
|
|
43397
|
-
})
|
|
43668
|
+
})["catch"](function () { onPingFailure(); });
|
|
43398
43669
|
}
|
|
43399
43670
|
}
|
|
43400
43671
|
return pluginApi.q.resolve();
|
|
@@ -43528,10 +43799,10 @@ function Feedback() {
|
|
|
43528
43799
|
return globalPendo.ajax.postJSON(getFullUrl('/analytics'), toSend);
|
|
43529
43800
|
}
|
|
43530
43801
|
function addOverlay() {
|
|
43531
|
-
|
|
43802
|
+
var widget = globalPendo.dom("#".concat(elemIds.feedbackWidget));
|
|
43532
43803
|
if (!widget)
|
|
43533
43804
|
return;
|
|
43534
|
-
|
|
43805
|
+
var overlayStyles = {
|
|
43535
43806
|
'position': 'fixed',
|
|
43536
43807
|
'top': '0',
|
|
43537
43808
|
'right': '0',
|
|
@@ -43543,7 +43814,7 @@ function Feedback() {
|
|
|
43543
43814
|
'animation': 'pendoFeedbackFadeIn 0.5s 0s 1 alternate both',
|
|
43544
43815
|
'-webkit-animation': 'pendoFeedbackFadeIn 0.5s 0s 1 alternate both'
|
|
43545
43816
|
};
|
|
43546
|
-
|
|
43817
|
+
var overlayElement = globalPendo.dom(document.createElement('div'));
|
|
43547
43818
|
overlayElement.attr('id', 'feedback-overlay');
|
|
43548
43819
|
overlayElement.css(overlayStyles);
|
|
43549
43820
|
overlayElement.appendTo(widget.getParent());
|
|
@@ -43648,22 +43919,22 @@ function Feedback() {
|
|
|
43648
43919
|
}
|
|
43649
43920
|
}
|
|
43650
43921
|
function buildOuterTriggerDiv(positionInfo) {
|
|
43651
|
-
|
|
43652
|
-
|
|
43653
|
-
|
|
43922
|
+
var horizontalStyles = getHorizontalPositionStyles(positionInfo);
|
|
43923
|
+
var verticalStyles = getVerticalPositionStyles(positionInfo);
|
|
43924
|
+
var styles = globalPendo._.extend({
|
|
43654
43925
|
'position': 'fixed',
|
|
43655
43926
|
'height': '43px',
|
|
43656
43927
|
'opacity': '1 !important',
|
|
43657
43928
|
'z-index': '9001'
|
|
43658
43929
|
}, horizontalStyles, verticalStyles);
|
|
43659
|
-
|
|
43930
|
+
var outerTrigger = globalPendo.dom(document.createElement('div'));
|
|
43660
43931
|
outerTrigger.attr('id', elemIds.feedbackTrigger);
|
|
43661
43932
|
outerTrigger.css(styles);
|
|
43662
43933
|
outerTrigger.attr('data-turbolinks-permanent', '');
|
|
43663
43934
|
return outerTrigger;
|
|
43664
43935
|
}
|
|
43665
43936
|
function buildNotification() {
|
|
43666
|
-
|
|
43937
|
+
var styles = {
|
|
43667
43938
|
'background-color': '#D85039',
|
|
43668
43939
|
'color': '#fff',
|
|
43669
43940
|
'border-radius': '50%',
|
|
@@ -43680,20 +43951,20 @@ function Feedback() {
|
|
|
43680
43951
|
'animation-delay': '1s',
|
|
43681
43952
|
'animation-iteration-count': '1'
|
|
43682
43953
|
};
|
|
43683
|
-
|
|
43954
|
+
var notification = globalPendo.dom(document.createElement('span'));
|
|
43684
43955
|
notification.attr('id', 'feedback-trigger-notification');
|
|
43685
43956
|
notification.css(styles);
|
|
43686
43957
|
return notification;
|
|
43687
43958
|
}
|
|
43688
43959
|
function buildTriggerButton(settings, positionInfo) {
|
|
43689
|
-
|
|
43960
|
+
var borderRadius;
|
|
43690
43961
|
if (positionInfo.horizontalPosition === 'left') {
|
|
43691
43962
|
borderRadius = '0 0 5px 5px';
|
|
43692
43963
|
}
|
|
43693
43964
|
else {
|
|
43694
43965
|
borderRadius = '3px 3px 0 0';
|
|
43695
43966
|
}
|
|
43696
|
-
|
|
43967
|
+
var styles = {
|
|
43697
43968
|
'border': 'none',
|
|
43698
43969
|
'padding': '11px 18px 14px 18px',
|
|
43699
43970
|
'background-color': settings.triggerColor,
|
|
@@ -43704,32 +43975,21 @@ function Feedback() {
|
|
|
43704
43975
|
'cursor': 'pointer',
|
|
43705
43976
|
'text-align': 'left'
|
|
43706
43977
|
};
|
|
43707
|
-
|
|
43978
|
+
var triggerButton = globalPendo.dom(document.createElement('button'));
|
|
43708
43979
|
triggerButton.attr('id', elemIds.feedbackTriggerButton);
|
|
43709
43980
|
triggerButton.css(styles);
|
|
43710
43981
|
triggerButton.text(settings.triggerText);
|
|
43711
43982
|
return triggerButton;
|
|
43712
43983
|
}
|
|
43713
43984
|
function addTriggerPseudoStyles() {
|
|
43714
|
-
|
|
43715
|
-
#feedback-trigger button:hover {
|
|
43716
|
-
box-shadow: 0 -5px 20px rgba(0,0,0,.19) !important;
|
|
43717
|
-
outline: none !important;
|
|
43718
|
-
background: #3e566f !important;
|
|
43719
|
-
}
|
|
43720
|
-
#feedback-trigger button:focus {
|
|
43721
|
-
box-shadow: 0 -5px 20px rgba(0,0,0,.19) !important;
|
|
43722
|
-
outline: none !important;
|
|
43723
|
-
background: #3e566f !important;
|
|
43724
|
-
}
|
|
43725
|
-
`;
|
|
43985
|
+
var pseudoStyles = "\n #feedback-trigger button:hover {\n box-shadow: 0 -5px 20px rgba(0,0,0,.19) !important;\n outline: none !important;\n background: #3e566f !important;\n }\n #feedback-trigger button:focus {\n box-shadow: 0 -5px 20px rgba(0,0,0,.19) !important;\n outline: none !important;\n background: #3e566f !important;\n }\n ";
|
|
43726
43986
|
pluginApi.util.addInlineStyles('pendo-feedback-trigger-styles', pseudoStyles);
|
|
43727
43987
|
}
|
|
43728
43988
|
function createTrigger(settings, positionInfo) {
|
|
43729
43989
|
addTriggerPseudoStyles();
|
|
43730
|
-
|
|
43731
|
-
|
|
43732
|
-
|
|
43990
|
+
var triggerElement = buildOuterTriggerDiv(positionInfo);
|
|
43991
|
+
var notificationElement = buildNotification();
|
|
43992
|
+
var triggerButtonElement = buildTriggerButton(settings, positionInfo);
|
|
43733
43993
|
triggerElement.append(notificationElement);
|
|
43734
43994
|
triggerElement.append(triggerButtonElement);
|
|
43735
43995
|
triggerElement.appendTo(globalPendo.dom.getBody());
|
|
@@ -43753,7 +44013,7 @@ function Feedback() {
|
|
|
43753
44013
|
iframeWrapper.css(getWidgetOriginalStyles());
|
|
43754
44014
|
iframeWrapper.attr('id', elemIds.feedbackWidget);
|
|
43755
44015
|
iframeWrapper.attr('data-turbolinks-permanent', 'true');
|
|
43756
|
-
iframeWrapper.addClass(
|
|
44016
|
+
iframeWrapper.addClass("buttonIs-".concat(horizontalPosition));
|
|
43757
44017
|
return iframeWrapper;
|
|
43758
44018
|
}
|
|
43759
44019
|
function buildIframeContainer() {
|
|
@@ -43770,22 +44030,13 @@ function Feedback() {
|
|
|
43770
44030
|
return iframeContainer;
|
|
43771
44031
|
}
|
|
43772
44032
|
function addWidgetVisibleButtonStyles(buttonStylePosition) {
|
|
43773
|
-
|
|
43774
|
-
|
|
43775
|
-
.buttonIs-${side}.visible {
|
|
43776
|
-
${side}: 0 !important;
|
|
43777
|
-
width: 470px !important;
|
|
43778
|
-
animation-direction: alternate-reverse !important;
|
|
43779
|
-
animation: pendoFeedbackSlideFrom-${side} 0.5s 0s 1 alternate both !important;
|
|
43780
|
-
-webkit-animation: pendoFeedbackSlideFrom-${side} 0.5s 0s 1 alternate both !important;
|
|
43781
|
-
z-index: 9002 !important;
|
|
43782
|
-
}
|
|
43783
|
-
`;
|
|
44033
|
+
var side = buttonStylePosition === 'left' ? 'left' : 'right'; // just in case something was not left or right for some reason
|
|
44034
|
+
var styles = "\n .buttonIs-".concat(side, ".visible {\n ").concat(side, ": 0 !important;\n width: 470px !important;\n animation-direction: alternate-reverse !important;\n animation: pendoFeedbackSlideFrom-").concat(side, " 0.5s 0s 1 alternate both !important;\n -webkit-animation: pendoFeedbackSlideFrom-").concat(side, " 0.5s 0s 1 alternate both !important;\n z-index: 9002 !important;\n }\n ");
|
|
43784
44035
|
pluginApi.util.addInlineStyles(elemIds.feedbackFrameStyles, styles);
|
|
43785
44036
|
}
|
|
43786
44037
|
function initialiseWidgetFrame(horizontalPosition) {
|
|
43787
44038
|
addWidgetVisibleButtonStyles(horizontalPosition);
|
|
43788
|
-
|
|
44039
|
+
var iframeElement = buildIframeWrapper(horizontalPosition);
|
|
43789
44040
|
iframeElement.append(buildIframeContainer());
|
|
43790
44041
|
iframeElement.appendTo(globalPendo.dom.getBody());
|
|
43791
44042
|
subscribeToIframeMessages();
|
|
@@ -43809,7 +44060,7 @@ function Feedback() {
|
|
|
43809
44060
|
return widgetLoaded;
|
|
43810
44061
|
}
|
|
43811
44062
|
function getPendoOptions() {
|
|
43812
|
-
|
|
44063
|
+
var options = pluginApi.ConfigReader.getLocalConfig();
|
|
43813
44064
|
if (!globalPendo._.isObject(options))
|
|
43814
44065
|
options = {};
|
|
43815
44066
|
if (!globalPendo._.isObject(options.visitor))
|
|
@@ -43837,7 +44088,7 @@ function Feedback() {
|
|
|
43837
44088
|
return true;
|
|
43838
44089
|
}
|
|
43839
44090
|
function getQueryParam(url, paramName) {
|
|
43840
|
-
|
|
44091
|
+
var results = new RegExp('[?&]' + paramName + '=([^&#]*)').exec(url);
|
|
43841
44092
|
if (results == null) {
|
|
43842
44093
|
return null;
|
|
43843
44094
|
}
|
|
@@ -43854,13 +44105,13 @@ function Feedback() {
|
|
|
43854
44105
|
return pluginApi.q.reject();
|
|
43855
44106
|
if (!canInitFeedback(pendoOptions))
|
|
43856
44107
|
return pluginApi.q.reject();
|
|
43857
|
-
|
|
44108
|
+
var feedbackOptions = convertPendoToFeedbackOptions(pendoOptions);
|
|
43858
44109
|
try {
|
|
43859
|
-
|
|
43860
|
-
if (
|
|
44110
|
+
var fdbkDst_1 = getQueryParam(globalPendo.url.get(), 'fdbkDst');
|
|
44111
|
+
if (fdbkDst_1 && fdbkDst_1.startsWith('case')) {
|
|
43861
44112
|
initialized = true;
|
|
43862
44113
|
getFeedbackLoginUrl().then(function (loginUrl) {
|
|
43863
|
-
|
|
44114
|
+
var destinationUrl = loginUrl + '&fdbkDst=' + fdbkDst_1;
|
|
43864
44115
|
window.location.href = destinationUrl;
|
|
43865
44116
|
});
|
|
43866
44117
|
return;
|
|
@@ -43909,7 +44160,7 @@ function Feedback() {
|
|
|
43909
44160
|
function convertPendoToFeedbackOptions(options) {
|
|
43910
44161
|
var jwtOptions = pluginApi.agent.getJwtInfoCopy();
|
|
43911
44162
|
if (globalPendo._.isEmpty(jwtOptions)) {
|
|
43912
|
-
|
|
44163
|
+
var feedbackOptions = {};
|
|
43913
44164
|
feedbackOptions.user = globalPendo._.pick(options.visitor, 'id', 'full_name', 'firstName', 'lastName', 'email', 'tags', 'custom_allowed_products');
|
|
43914
44165
|
globalPendo._.extend(feedbackOptions.user, { allowed_products: [{ id: feedbackAllowedProductId }] });
|
|
43915
44166
|
feedbackOptions.account = globalPendo._.pick(options.account, 'id', 'name', 'monthly_value', 'is_paying', 'tags');
|
|
@@ -49499,6 +49750,17 @@ var SessionRecorderBuffer = /** @class */ (function () {
|
|
|
49499
49750
|
return SessionRecorderBuffer;
|
|
49500
49751
|
}());
|
|
49501
49752
|
|
|
49753
|
+
var __assign = function() {
|
|
49754
|
+
__assign = Object.assign || function __assign(t) {
|
|
49755
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
49756
|
+
s = arguments[i];
|
|
49757
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
49758
|
+
}
|
|
49759
|
+
return t;
|
|
49760
|
+
};
|
|
49761
|
+
return __assign.apply(this, arguments);
|
|
49762
|
+
};
|
|
49763
|
+
|
|
49502
49764
|
function __rest(s, e) {
|
|
49503
49765
|
var t = {};
|
|
49504
49766
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -51683,7 +51945,7 @@ function includes(str, substring) {
|
|
|
51683
51945
|
function getResourceType(blockedURI, directive) {
|
|
51684
51946
|
if (!directive || typeof directive !== 'string')
|
|
51685
51947
|
return 'resource';
|
|
51686
|
-
|
|
51948
|
+
var d = directive.toLowerCase();
|
|
51687
51949
|
if (blockedURI === 'inline') {
|
|
51688
51950
|
if (includes(d, 'script-src-attr')) {
|
|
51689
51951
|
return 'inline event handler';
|
|
@@ -51742,11 +52004,12 @@ function getResourceType(blockedURI, directive) {
|
|
|
51742
52004
|
function getDirective(policy, directiveName) {
|
|
51743
52005
|
if (!policy || !directiveName)
|
|
51744
52006
|
return '';
|
|
51745
|
-
|
|
51746
|
-
for (
|
|
51747
|
-
|
|
51748
|
-
|
|
51749
|
-
|
|
52007
|
+
var needle = directiveName.toLowerCase();
|
|
52008
|
+
for (var _i = 0, _a = policy.split(';'); _i < _a.length; _i++) {
|
|
52009
|
+
var directive = _a[_i];
|
|
52010
|
+
var trimmed = directive.trim();
|
|
52011
|
+
var lower = trimmed.toLowerCase();
|
|
52012
|
+
if (lower === needle || lower.startsWith("".concat(needle, " "))) {
|
|
51750
52013
|
return trimmed;
|
|
51751
52014
|
}
|
|
51752
52015
|
}
|
|
@@ -51768,7 +52031,7 @@ function getDirective(policy, directiveName) {
|
|
|
51768
52031
|
function getArticle(phrase) {
|
|
51769
52032
|
if (!phrase || typeof phrase !== 'string')
|
|
51770
52033
|
return 'A';
|
|
51771
|
-
|
|
52034
|
+
var c = phrase.trim().charAt(0).toLowerCase();
|
|
51772
52035
|
return includes('aeiou', c) ? 'An' : 'A';
|
|
51773
52036
|
}
|
|
51774
52037
|
/**
|
|
@@ -51811,46 +52074,47 @@ function createCspViolationMessage(blockedURI, directive, isReportOnly, original
|
|
|
51811
52074
|
return 'Content Security Policy: Unknown violation occurred.';
|
|
51812
52075
|
}
|
|
51813
52076
|
try {
|
|
51814
|
-
|
|
52077
|
+
var reportOnlyText = isReportOnly ? ' (Report-Only)' : '';
|
|
51815
52078
|
// special case for frame-ancestors since it doesn't fit our template at all
|
|
51816
52079
|
if ((directive === null || directive === void 0 ? void 0 : directive.toLowerCase()) === 'frame-ancestors') {
|
|
51817
|
-
return
|
|
52080
|
+
return "Content Security Policy".concat(reportOnlyText, ": The display of ").concat(blockedURI, " in a frame was blocked because an ancestor violates your site's frame-ancestors policy.\nCurrent CSP: \"").concat(originalPolicy, "\".");
|
|
51818
52081
|
}
|
|
51819
|
-
|
|
51820
|
-
|
|
51821
|
-
|
|
51822
|
-
|
|
51823
|
-
|
|
51824
|
-
|
|
51825
|
-
return
|
|
52082
|
+
var resourceType = getResourceType(blockedURI, directive);
|
|
52083
|
+
var article = getArticle(resourceType);
|
|
52084
|
+
var source = formatBlockedUri(blockedURI);
|
|
52085
|
+
var directiveValue = getDirective(originalPolicy, directive);
|
|
52086
|
+
var policyDisplay = directiveValue || directive;
|
|
52087
|
+
var resourceDescription = "".concat(article, " ").concat(resourceType).concat(source ? " from ".concat(source) : '');
|
|
52088
|
+
return "Content Security Policy".concat(reportOnlyText, ": ").concat(resourceDescription, " was blocked by your site's `").concat(policyDisplay, "` policy.\nCurrent CSP: \"").concat(originalPolicy, "\".");
|
|
51826
52089
|
}
|
|
51827
52090
|
catch (error) {
|
|
51828
|
-
return
|
|
52091
|
+
return "Content Security Policy: Error formatting violation message: ".concat(error.message);
|
|
51829
52092
|
}
|
|
51830
52093
|
}
|
|
51831
52094
|
|
|
51832
|
-
|
|
51833
|
-
|
|
52095
|
+
var MAX_LENGTH = 1000;
|
|
52096
|
+
var PII_PATTERN = {
|
|
51834
52097
|
ip: /\b(?:\d{1,3}\.){3}\d{1,3}\b/g,
|
|
51835
52098
|
ssn: /\b\d{3}-\d{2}-\d{4}\b/g,
|
|
51836
52099
|
creditCard: /\b(?:\d[ -]?){12,18}\d\b/g,
|
|
51837
52100
|
httpsUrls: /https:\/\/[^\s]+/g,
|
|
51838
52101
|
email: /[\w._+-]+@[\w.-]+\.\w+/g
|
|
51839
52102
|
};
|
|
51840
|
-
|
|
51841
|
-
|
|
51842
|
-
|
|
51843
|
-
|
|
51844
|
-
|
|
52103
|
+
var PII_REPLACEMENT = '*'.repeat(10);
|
|
52104
|
+
var JSON_PII_KEYS = ['password', 'email', 'key', 'token', 'auth', 'authentication', 'phone', 'address', 'ssn'];
|
|
52105
|
+
var UNABLE_TO_DISPLAY_BODY = '[Unable to display body: detected PII could not be redacted]';
|
|
52106
|
+
var joinedKeys = JSON_PII_KEYS.join('|');
|
|
52107
|
+
var keyPattern = "\"([^\"]*(?:".concat(joinedKeys, ")[^\"]*)\"");
|
|
51845
52108
|
// only scrub strings, numbers, and booleans
|
|
51846
|
-
|
|
52109
|
+
var acceptedValues = '("([^"\\\\]*(?:\\\\.[^"\\\\]*)*")|(\\d+)|(true|false))';
|
|
51847
52110
|
/**
|
|
51848
52111
|
* Truncates a string to the max length
|
|
51849
52112
|
* @access private
|
|
51850
52113
|
* @param {String} string
|
|
51851
52114
|
* @returns {String}
|
|
51852
52115
|
*/
|
|
51853
|
-
function truncate(string, includeEllipsis
|
|
52116
|
+
function truncate(string, includeEllipsis) {
|
|
52117
|
+
if (includeEllipsis === void 0) { includeEllipsis = false; }
|
|
51854
52118
|
if (string.length <= MAX_LENGTH)
|
|
51855
52119
|
return string;
|
|
51856
52120
|
if (includeEllipsis) {
|
|
@@ -51867,7 +52131,7 @@ function truncate(string, includeEllipsis = false) {
|
|
|
51867
52131
|
* @returns {String}
|
|
51868
52132
|
*/
|
|
51869
52133
|
function generateLogKey(methodName, message, stackTrace) {
|
|
51870
|
-
return
|
|
52134
|
+
return "".concat(methodName, "|").concat(message, "|").concat(stackTrace);
|
|
51871
52135
|
}
|
|
51872
52136
|
/**
|
|
51873
52137
|
* Checks if a string has 2 or more digits, a https URL, or an email address
|
|
@@ -51884,12 +52148,13 @@ function mightContainPII(string) {
|
|
|
51884
52148
|
* @param {String} string
|
|
51885
52149
|
* @returns {String}
|
|
51886
52150
|
*/
|
|
51887
|
-
function scrubPII(
|
|
52151
|
+
function scrubPII(_a) {
|
|
52152
|
+
var string = _a.string, _ = _a._;
|
|
51888
52153
|
if (!string || typeof string !== 'string')
|
|
51889
52154
|
return string;
|
|
51890
52155
|
if (!mightContainPII(string))
|
|
51891
52156
|
return string;
|
|
51892
|
-
return _.reduce(_.values(PII_PATTERN), (str, pattern)
|
|
52157
|
+
return _.reduce(_.values(PII_PATTERN), function (str, pattern) { return str.replace(pattern, PII_REPLACEMENT); }, string);
|
|
51893
52158
|
}
|
|
51894
52159
|
/**
|
|
51895
52160
|
* Scrub PII from a stringified JSON object
|
|
@@ -51898,12 +52163,14 @@ function scrubPII({ string, _ }) {
|
|
|
51898
52163
|
* @returns {String}
|
|
51899
52164
|
*/
|
|
51900
52165
|
function scrubJsonPII(string) {
|
|
51901
|
-
|
|
52166
|
+
var fullScrubRegex = new RegExp("".concat(keyPattern, "\\s*:\\s*[\\{\\[]"), 'i');
|
|
51902
52167
|
if (fullScrubRegex.test(string)) {
|
|
51903
52168
|
return UNABLE_TO_DISPLAY_BODY;
|
|
51904
52169
|
}
|
|
51905
|
-
|
|
51906
|
-
return string.replace(keyValueScrubRegex, (match, key)
|
|
52170
|
+
var keyValueScrubRegex = new RegExp("".concat(keyPattern, "\\s*:\\s*").concat(acceptedValues), 'gi');
|
|
52171
|
+
return string.replace(keyValueScrubRegex, function (match, key) {
|
|
52172
|
+
return "\"".concat(key, "\":\"").concat(PII_REPLACEMENT, "\"");
|
|
52173
|
+
});
|
|
51907
52174
|
}
|
|
51908
52175
|
/**
|
|
51909
52176
|
* Checks if a string is a JSON object
|
|
@@ -51915,7 +52182,7 @@ function scrubJsonPII(string) {
|
|
|
51915
52182
|
function mightContainJson(string, contentType) {
|
|
51916
52183
|
if (!string || typeof string !== 'string')
|
|
51917
52184
|
return false;
|
|
51918
|
-
|
|
52185
|
+
var firstChar = string.charAt(0);
|
|
51919
52186
|
if (contentType && contentType.indexOf('application/json') !== -1) {
|
|
51920
52187
|
return true;
|
|
51921
52188
|
}
|
|
@@ -51928,19 +52195,20 @@ function mightContainJson(string, contentType) {
|
|
|
51928
52195
|
* @param {String} contentType
|
|
51929
52196
|
* @returns {String}
|
|
51930
52197
|
*/
|
|
51931
|
-
function maskSensitiveFields(
|
|
52198
|
+
function maskSensitiveFields(_a) {
|
|
52199
|
+
var string = _a.string, contentType = _a.contentType, _ = _a._;
|
|
51932
52200
|
if (!string || typeof string !== 'string')
|
|
51933
52201
|
return string;
|
|
51934
52202
|
if (mightContainJson(string, contentType)) {
|
|
51935
52203
|
string = scrubJsonPII(string);
|
|
51936
52204
|
}
|
|
51937
52205
|
if (mightContainPII(string)) {
|
|
51938
|
-
string = scrubPII({ string, _ });
|
|
52206
|
+
string = scrubPII({ string: string, _: _ });
|
|
51939
52207
|
}
|
|
51940
52208
|
return string;
|
|
51941
52209
|
}
|
|
51942
52210
|
|
|
51943
|
-
|
|
52211
|
+
var DEV_LOG_TYPE = 'devlog';
|
|
51944
52212
|
function createDevLogEnvelope(pluginAPI, globalPendo) {
|
|
51945
52213
|
return {
|
|
51946
52214
|
browser_time: pluginAPI.util.getNow(),
|
|
@@ -51951,12 +52219,12 @@ function createDevLogEnvelope(pluginAPI, globalPendo) {
|
|
|
51951
52219
|
};
|
|
51952
52220
|
}
|
|
51953
52221
|
|
|
51954
|
-
|
|
51955
|
-
|
|
51956
|
-
|
|
51957
|
-
|
|
51958
|
-
|
|
51959
|
-
|
|
52222
|
+
var TOKEN_MAX_SIZE = 100;
|
|
52223
|
+
var TOKEN_REFILL_RATE = 10;
|
|
52224
|
+
var TOKEN_REFRESH_INTERVAL = 1000;
|
|
52225
|
+
var MAX_UNCOMPRESSED_SIZE = 125000; // 125KB
|
|
52226
|
+
var DevlogBuffer = /** @class */ (function () {
|
|
52227
|
+
function DevlogBuffer(pendo, pluginAPI) {
|
|
51960
52228
|
this.pendo = pendo;
|
|
51961
52229
|
this.pluginAPI = pluginAPI;
|
|
51962
52230
|
this.events = [];
|
|
@@ -51967,36 +52235,36 @@ class DevlogBuffer {
|
|
|
51967
52235
|
this.lastRefillTime = this.pluginAPI.util.getNow();
|
|
51968
52236
|
this.nextRefillTime = this.lastRefillTime + TOKEN_REFRESH_INTERVAL;
|
|
51969
52237
|
}
|
|
51970
|
-
isEmpty() {
|
|
52238
|
+
DevlogBuffer.prototype.isEmpty = function () {
|
|
51971
52239
|
return this.events.length === 0 && this.payloads.length === 0;
|
|
51972
|
-
}
|
|
51973
|
-
refillTokens() {
|
|
51974
|
-
|
|
52240
|
+
};
|
|
52241
|
+
DevlogBuffer.prototype.refillTokens = function () {
|
|
52242
|
+
var now = this.pluginAPI.util.getNow();
|
|
51975
52243
|
if (now >= this.nextRefillTime) {
|
|
51976
|
-
|
|
51977
|
-
|
|
51978
|
-
|
|
52244
|
+
var timeSinceLastRefill = now - this.lastRefillTime;
|
|
52245
|
+
var secondsSinceLastRefill = Math.floor(timeSinceLastRefill / TOKEN_REFRESH_INTERVAL);
|
|
52246
|
+
var tokensToRefill = secondsSinceLastRefill * TOKEN_REFILL_RATE;
|
|
51979
52247
|
this.tokens = Math.min(this.tokens + tokensToRefill, TOKEN_MAX_SIZE);
|
|
51980
52248
|
this.lastRefillTime = now;
|
|
51981
52249
|
this.nextRefillTime = now + TOKEN_REFRESH_INTERVAL;
|
|
51982
52250
|
}
|
|
51983
|
-
}
|
|
51984
|
-
clear() {
|
|
52251
|
+
};
|
|
52252
|
+
DevlogBuffer.prototype.clear = function () {
|
|
51985
52253
|
this.events = [];
|
|
51986
52254
|
this.lastEvent = null;
|
|
51987
52255
|
this.uncompressedSize = 0;
|
|
51988
|
-
}
|
|
51989
|
-
hasTokenAvailable() {
|
|
52256
|
+
};
|
|
52257
|
+
DevlogBuffer.prototype.hasTokenAvailable = function () {
|
|
51990
52258
|
this.refillTokens();
|
|
51991
52259
|
return this.tokens > 0;
|
|
51992
|
-
}
|
|
51993
|
-
estimateEventSize(event) {
|
|
52260
|
+
};
|
|
52261
|
+
DevlogBuffer.prototype.estimateEventSize = function (event) {
|
|
51994
52262
|
return JSON.stringify(event).length;
|
|
51995
|
-
}
|
|
51996
|
-
push(event) {
|
|
52263
|
+
};
|
|
52264
|
+
DevlogBuffer.prototype.push = function (event) {
|
|
51997
52265
|
if (!this.hasTokenAvailable())
|
|
51998
52266
|
return false;
|
|
51999
|
-
|
|
52267
|
+
var eventSize = this.estimateEventSize(event);
|
|
52000
52268
|
if (this.uncompressedSize + eventSize > MAX_UNCOMPRESSED_SIZE) {
|
|
52001
52269
|
this.compressCurrentChunk();
|
|
52002
52270
|
}
|
|
@@ -52005,54 +52273,55 @@ class DevlogBuffer {
|
|
|
52005
52273
|
this.events.push(event);
|
|
52006
52274
|
this.tokens = Math.max(this.tokens - 1, 0);
|
|
52007
52275
|
return true;
|
|
52008
|
-
}
|
|
52009
|
-
compressCurrentChunk() {
|
|
52276
|
+
};
|
|
52277
|
+
DevlogBuffer.prototype.compressCurrentChunk = function () {
|
|
52010
52278
|
if (this.events.length === 0)
|
|
52011
52279
|
return;
|
|
52012
|
-
|
|
52280
|
+
var jzb = this.pendo.compress(this.events);
|
|
52013
52281
|
this.payloads.push(jzb);
|
|
52014
52282
|
this.clear();
|
|
52015
|
-
}
|
|
52016
|
-
generateUrl() {
|
|
52017
|
-
|
|
52283
|
+
};
|
|
52284
|
+
DevlogBuffer.prototype.generateUrl = function () {
|
|
52285
|
+
var queryParams = {
|
|
52018
52286
|
v: this.pendo.VERSION,
|
|
52019
52287
|
ct: this.pluginAPI.util.getNow()
|
|
52020
52288
|
};
|
|
52021
52289
|
return this.pluginAPI.transmit.buildBaseDataUrl(DEV_LOG_TYPE, this.pendo.apiKey, queryParams);
|
|
52022
|
-
}
|
|
52023
|
-
pack() {
|
|
52290
|
+
};
|
|
52291
|
+
DevlogBuffer.prototype.pack = function () {
|
|
52024
52292
|
if (this.isEmpty())
|
|
52025
52293
|
return;
|
|
52026
|
-
|
|
52294
|
+
var url = this.generateUrl();
|
|
52027
52295
|
this.compressCurrentChunk();
|
|
52028
|
-
|
|
52029
|
-
jzb,
|
|
52030
|
-
url
|
|
52031
|
-
}));
|
|
52296
|
+
var payloads = this.pendo._.map(this.payloads, function (jzb) { return ({
|
|
52297
|
+
jzb: jzb,
|
|
52298
|
+
url: url
|
|
52299
|
+
}); });
|
|
52032
52300
|
this.payloads = [];
|
|
52033
52301
|
return payloads;
|
|
52034
|
-
}
|
|
52035
|
-
|
|
52302
|
+
};
|
|
52303
|
+
return DevlogBuffer;
|
|
52304
|
+
}());
|
|
52036
52305
|
|
|
52037
|
-
|
|
52038
|
-
|
|
52306
|
+
var DevlogTransport = /** @class */ (function () {
|
|
52307
|
+
function DevlogTransport(globalPendo, pluginAPI) {
|
|
52039
52308
|
this.pendo = globalPendo;
|
|
52040
52309
|
this.pluginAPI = pluginAPI;
|
|
52041
52310
|
}
|
|
52042
|
-
buildGetUrl(baseUrl, jzb) {
|
|
52043
|
-
|
|
52311
|
+
DevlogTransport.prototype.buildGetUrl = function (baseUrl, jzb) {
|
|
52312
|
+
var params = {};
|
|
52044
52313
|
if (this.pluginAPI.agent.treatAsAdoptPartner()) {
|
|
52045
52314
|
this.pluginAPI.agent.addAccountIdParams(params, this.pendo.get_account_id(), this.pluginAPI.ConfigReader.get('oemAccountId'));
|
|
52046
52315
|
}
|
|
52047
|
-
|
|
52316
|
+
var jwtOptions = this.pluginAPI.agent.getJwtInfoCopy();
|
|
52048
52317
|
if (!this.pendo._.isEmpty(jwtOptions)) {
|
|
52049
52318
|
this.pendo._.extend(params, jwtOptions);
|
|
52050
52319
|
}
|
|
52051
52320
|
params.jzb = jzb;
|
|
52052
|
-
|
|
52053
|
-
return
|
|
52054
|
-
}
|
|
52055
|
-
get(url, options) {
|
|
52321
|
+
var queryString = this.pendo._.map(params, function (value, key) { return "".concat(key, "=").concat(value); }).join('&');
|
|
52322
|
+
return "".concat(baseUrl).concat(baseUrl.indexOf('?') !== -1 ? '&' : '?').concat(queryString);
|
|
52323
|
+
};
|
|
52324
|
+
DevlogTransport.prototype.get = function (url, options) {
|
|
52056
52325
|
options.method = 'GET';
|
|
52057
52326
|
if (this.pluginAPI.transmit.fetchKeepalive.supported()) {
|
|
52058
52327
|
return this.pluginAPI.transmit.fetchKeepalive(url, options);
|
|
@@ -52060,86 +52329,90 @@ class DevlogTransport {
|
|
|
52060
52329
|
else {
|
|
52061
52330
|
return this.pendo.ajax.get(url);
|
|
52062
52331
|
}
|
|
52063
|
-
}
|
|
52064
|
-
sendRequestWithGet
|
|
52065
|
-
|
|
52332
|
+
};
|
|
52333
|
+
DevlogTransport.prototype.sendRequestWithGet = function (_a) {
|
|
52334
|
+
var url = _a.url, jzb = _a.jzb;
|
|
52335
|
+
var getUrl = this.buildGetUrl(url, jzb);
|
|
52066
52336
|
return this.get(getUrl, {
|
|
52067
52337
|
headers: {
|
|
52068
52338
|
'Content-Type': 'application/octet-stream'
|
|
52069
52339
|
}
|
|
52070
52340
|
});
|
|
52071
|
-
}
|
|
52072
|
-
post(url, options) {
|
|
52341
|
+
};
|
|
52342
|
+
DevlogTransport.prototype.post = function (url, options) {
|
|
52073
52343
|
options.method = 'POST';
|
|
52074
52344
|
if (options.keepalive && this.pluginAPI.transmit.fetchKeepalive.supported()) {
|
|
52075
52345
|
return this.pluginAPI.transmit.fetchKeepalive(url, options);
|
|
52076
52346
|
}
|
|
52077
52347
|
else if (options.keepalive && this.pluginAPI.transmit.sendBeacon.supported()) {
|
|
52078
|
-
|
|
52348
|
+
var result = this.pluginAPI.transmit.sendBeacon(url, new Blob([options.body]));
|
|
52079
52349
|
return result ? Promise$2.resolve() : Promise$2.reject(new Error('sendBeacon failed to send devlog data'));
|
|
52080
52350
|
}
|
|
52081
52351
|
else {
|
|
52082
52352
|
return this.pendo.ajax.post(url, options.body);
|
|
52083
52353
|
}
|
|
52084
|
-
}
|
|
52085
|
-
sendRequestWithPost
|
|
52086
|
-
|
|
52087
|
-
|
|
52354
|
+
};
|
|
52355
|
+
DevlogTransport.prototype.sendRequestWithPost = function (_a, isUnload) {
|
|
52356
|
+
var url = _a.url, jzb = _a.jzb;
|
|
52357
|
+
var jwtOptions = this.pluginAPI.agent.getJwtInfoCopy();
|
|
52358
|
+
var bodyPayload = {
|
|
52088
52359
|
events: jzb,
|
|
52089
52360
|
browser_time: this.pluginAPI.util.getNow()
|
|
52090
52361
|
};
|
|
52091
52362
|
if (this.pluginAPI.agent.treatAsAdoptPartner()) {
|
|
52092
52363
|
this.pluginAPI.agent.addAccountIdParams(bodyPayload, this.pendo.get_account_id(), this.pluginAPI.ConfigReader.get('oemAccountId'));
|
|
52093
52364
|
}
|
|
52094
|
-
|
|
52365
|
+
var body = JSON.stringify(this.pendo._.extend(bodyPayload, jwtOptions));
|
|
52095
52366
|
return this.post(url, {
|
|
52096
|
-
body,
|
|
52367
|
+
body: body,
|
|
52097
52368
|
headers: {
|
|
52098
52369
|
'Content-Type': 'application/json'
|
|
52099
52370
|
},
|
|
52100
52371
|
keepalive: isUnload
|
|
52101
52372
|
});
|
|
52102
|
-
}
|
|
52103
|
-
sendRequest
|
|
52104
|
-
|
|
52373
|
+
};
|
|
52374
|
+
DevlogTransport.prototype.sendRequest = function (_a, isUnload) {
|
|
52375
|
+
var url = _a.url, jzb = _a.jzb;
|
|
52376
|
+
var compressedLength = jzb.length;
|
|
52105
52377
|
if (compressedLength <= this.pluginAPI.constants.ENCODED_EVENT_MAX_LENGTH && !this.pluginAPI.ConfigReader.get('sendEventsWithPostOnly')) {
|
|
52106
|
-
return this.sendRequestWithGet({ url, jzb });
|
|
52378
|
+
return this.sendRequestWithGet({ url: url, jzb: jzb });
|
|
52107
52379
|
}
|
|
52108
|
-
return this.sendRequestWithPost({ url, jzb }, isUnload);
|
|
52109
|
-
}
|
|
52110
|
-
|
|
52380
|
+
return this.sendRequestWithPost({ url: url, jzb: jzb }, isUnload);
|
|
52381
|
+
};
|
|
52382
|
+
return DevlogTransport;
|
|
52383
|
+
}());
|
|
52111
52384
|
|
|
52112
52385
|
function ConsoleCapture() {
|
|
52113
|
-
|
|
52114
|
-
|
|
52115
|
-
|
|
52116
|
-
|
|
52117
|
-
|
|
52118
|
-
|
|
52119
|
-
|
|
52120
|
-
|
|
52121
|
-
|
|
52122
|
-
|
|
52123
|
-
|
|
52124
|
-
|
|
52386
|
+
var pluginAPI;
|
|
52387
|
+
var _;
|
|
52388
|
+
var globalPendo;
|
|
52389
|
+
var buffer;
|
|
52390
|
+
var sendQueue;
|
|
52391
|
+
var sendInterval;
|
|
52392
|
+
var transport;
|
|
52393
|
+
var isPtmPaused;
|
|
52394
|
+
var isCapturingConsoleLogs = false;
|
|
52395
|
+
var CAPTURE_CONSOLE_CONFIG = 'captureConsoleLogs';
|
|
52396
|
+
var CONSOLE_METHODS = ['log', 'warn', 'error', 'info'];
|
|
52397
|
+
var DEV_LOG_SUB_TYPE = 'console';
|
|
52125
52398
|
// deduplicate logs
|
|
52126
|
-
|
|
52399
|
+
var lastLogKey = '';
|
|
52127
52400
|
return {
|
|
52128
52401
|
name: 'ConsoleCapture',
|
|
52129
|
-
initialize,
|
|
52130
|
-
teardown,
|
|
52131
|
-
addIntercepts,
|
|
52132
|
-
createConsoleEvent,
|
|
52133
|
-
captureStackTrace,
|
|
52134
|
-
send,
|
|
52135
|
-
setCaptureState,
|
|
52136
|
-
recordingStarted,
|
|
52137
|
-
recordingStopped,
|
|
52138
|
-
onAppHidden,
|
|
52139
|
-
onAppUnloaded,
|
|
52140
|
-
onPtmPaused,
|
|
52141
|
-
onPtmUnpaused,
|
|
52142
|
-
securityPolicyViolationFn,
|
|
52402
|
+
initialize: initialize,
|
|
52403
|
+
teardown: teardown,
|
|
52404
|
+
addIntercepts: addIntercepts,
|
|
52405
|
+
createConsoleEvent: createConsoleEvent,
|
|
52406
|
+
captureStackTrace: captureStackTrace,
|
|
52407
|
+
send: send,
|
|
52408
|
+
setCaptureState: setCaptureState,
|
|
52409
|
+
recordingStarted: recordingStarted,
|
|
52410
|
+
recordingStopped: recordingStopped,
|
|
52411
|
+
onAppHidden: onAppHidden,
|
|
52412
|
+
onAppUnloaded: onAppUnloaded,
|
|
52413
|
+
onPtmPaused: onPtmPaused,
|
|
52414
|
+
onPtmUnpaused: onPtmUnpaused,
|
|
52415
|
+
securityPolicyViolationFn: securityPolicyViolationFn,
|
|
52143
52416
|
get isCapturingConsoleLogs() {
|
|
52144
52417
|
return isCapturingConsoleLogs;
|
|
52145
52418
|
},
|
|
@@ -52156,16 +52429,16 @@ function ConsoleCapture() {
|
|
|
52156
52429
|
function initialize(pendo, PluginAPI) {
|
|
52157
52430
|
_ = pendo._;
|
|
52158
52431
|
pluginAPI = PluginAPI;
|
|
52159
|
-
|
|
52432
|
+
var ConfigReader = pluginAPI.ConfigReader;
|
|
52160
52433
|
ConfigReader.addOption(CAPTURE_CONSOLE_CONFIG, [ConfigReader.sources.PENDO_CONFIG_SRC], false);
|
|
52161
|
-
|
|
52434
|
+
var captureConsoleEnabled = ConfigReader.get(CAPTURE_CONSOLE_CONFIG);
|
|
52162
52435
|
if (!captureConsoleEnabled)
|
|
52163
52436
|
return;
|
|
52164
52437
|
globalPendo = pendo;
|
|
52165
52438
|
buffer = new DevlogBuffer(pendo, pluginAPI);
|
|
52166
52439
|
transport = new DevlogTransport(pendo, pluginAPI);
|
|
52167
52440
|
sendQueue = new pluginAPI.SendQueue(transport.sendRequest.bind(transport));
|
|
52168
|
-
sendInterval = setInterval(()
|
|
52441
|
+
sendInterval = setInterval(function () {
|
|
52169
52442
|
if (!sendQueue.failed()) {
|
|
52170
52443
|
send();
|
|
52171
52444
|
}
|
|
@@ -52191,17 +52464,19 @@ function ConsoleCapture() {
|
|
|
52191
52464
|
function onPtmUnpaused() {
|
|
52192
52465
|
isPtmPaused = false;
|
|
52193
52466
|
if (!buffer.isEmpty()) {
|
|
52194
|
-
for (
|
|
52195
|
-
|
|
52467
|
+
for (var _i = 0, _a = buffer.events; _i < _a.length; _i++) {
|
|
52468
|
+
var event_1 = _a[_i];
|
|
52469
|
+
pluginAPI.Events.eventCaptured.trigger(event_1);
|
|
52196
52470
|
}
|
|
52197
52471
|
send();
|
|
52198
52472
|
}
|
|
52199
52473
|
}
|
|
52200
|
-
function setCaptureState(
|
|
52474
|
+
function setCaptureState(_a) {
|
|
52475
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.shouldCapture, shouldCapture = _c === void 0 ? false : _c, _d = _b.reason, reason = _d === void 0 ? '' : _d;
|
|
52201
52476
|
if (shouldCapture === isCapturingConsoleLogs)
|
|
52202
52477
|
return;
|
|
52203
52478
|
isCapturingConsoleLogs = shouldCapture;
|
|
52204
|
-
pluginAPI.log.info(
|
|
52479
|
+
pluginAPI.log.info("[ConsoleCapture] Console log capture ".concat(shouldCapture ? 'started' : 'stopped').concat(reason ? ": ".concat(reason) : ''));
|
|
52205
52480
|
}
|
|
52206
52481
|
function recordingStarted() {
|
|
52207
52482
|
setCaptureState({ shouldCapture: true, reason: 'recording started' });
|
|
@@ -52221,12 +52496,12 @@ function ConsoleCapture() {
|
|
|
52221
52496
|
}
|
|
52222
52497
|
function addIntercepts() {
|
|
52223
52498
|
_.each(CONSOLE_METHODS, function (methodName) {
|
|
52224
|
-
|
|
52499
|
+
var originalMethod = console[methodName];
|
|
52225
52500
|
if (!originalMethod)
|
|
52226
52501
|
return;
|
|
52227
52502
|
console[methodName] = _.wrap(originalMethod, function (originalFn) {
|
|
52228
52503
|
// slice 1 to omit originalFn
|
|
52229
|
-
|
|
52504
|
+
var args = _.toArray(arguments).slice(1);
|
|
52230
52505
|
originalFn.apply(console, args);
|
|
52231
52506
|
createConsoleEvent(args, methodName);
|
|
52232
52507
|
});
|
|
@@ -52238,10 +52513,10 @@ function ConsoleCapture() {
|
|
|
52238
52513
|
function securityPolicyViolationFn(evt) {
|
|
52239
52514
|
if (!evt || typeof evt !== 'object')
|
|
52240
52515
|
return;
|
|
52241
|
-
|
|
52242
|
-
|
|
52243
|
-
|
|
52244
|
-
|
|
52516
|
+
var blockedURI = evt.blockedURI, violatedDirective = evt.violatedDirective, effectiveDirective = evt.effectiveDirective, disposition = evt.disposition, originalPolicy = evt.originalPolicy;
|
|
52517
|
+
var directive = violatedDirective || effectiveDirective;
|
|
52518
|
+
var isReportOnly = disposition === 'report';
|
|
52519
|
+
var message = createCspViolationMessage(blockedURI, directive, isReportOnly, originalPolicy);
|
|
52245
52520
|
if (isReportOnly) {
|
|
52246
52521
|
createConsoleEvent([message], 'warn', { skipStackTrace: true, skipScrubPII: true });
|
|
52247
52522
|
}
|
|
@@ -52249,12 +52524,13 @@ function ConsoleCapture() {
|
|
|
52249
52524
|
createConsoleEvent([message], 'error', { skipStackTrace: true, skipScrubPII: true });
|
|
52250
52525
|
}
|
|
52251
52526
|
}
|
|
52252
|
-
function createConsoleEvent(args, methodName,
|
|
52527
|
+
function createConsoleEvent(args, methodName, _a) {
|
|
52528
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.skipStackTrace, skipStackTrace = _c === void 0 ? false : _c, _d = _b.skipScrubPII, skipScrubPII = _d === void 0 ? false : _d;
|
|
52253
52529
|
if (!isCapturingConsoleLogs || !args || args.length === 0 || !_.contains(CONSOLE_METHODS, methodName))
|
|
52254
52530
|
return;
|
|
52255
52531
|
// stringify args
|
|
52256
|
-
|
|
52257
|
-
|
|
52532
|
+
var message = _.compact(_.map(args, function (arg) {
|
|
52533
|
+
var stringifiedArg;
|
|
52258
52534
|
try {
|
|
52259
52535
|
stringifiedArg = stringify(arg);
|
|
52260
52536
|
}
|
|
@@ -52266,22 +52542,22 @@ function ConsoleCapture() {
|
|
|
52266
52542
|
if (!message)
|
|
52267
52543
|
return;
|
|
52268
52544
|
// capture stack trace
|
|
52269
|
-
|
|
52545
|
+
var stackTrace = '';
|
|
52270
52546
|
if (!skipStackTrace) {
|
|
52271
|
-
|
|
52547
|
+
var maxStackFrames = methodName === 'error' ? 4 : 1;
|
|
52272
52548
|
stackTrace = captureStackTrace(maxStackFrames);
|
|
52273
52549
|
}
|
|
52274
52550
|
// truncate message and stack trace
|
|
52275
52551
|
message = truncate(message);
|
|
52276
52552
|
stackTrace = truncate(stackTrace);
|
|
52277
52553
|
// de-duplicate log
|
|
52278
|
-
|
|
52554
|
+
var logKey = generateLogKey(methodName, message, stackTrace);
|
|
52279
52555
|
if (isExistingDuplicateLog(logKey)) {
|
|
52280
52556
|
buffer.lastEvent.devLogCount++;
|
|
52281
52557
|
return;
|
|
52282
52558
|
}
|
|
52283
|
-
|
|
52284
|
-
|
|
52559
|
+
var devLogEnvelope = createDevLogEnvelope(pluginAPI, globalPendo);
|
|
52560
|
+
var consoleEvent = __assign(__assign({}, devLogEnvelope), { subType: DEV_LOG_SUB_TYPE, devLogLevel: methodName === 'log' ? 'info' : methodName, devLogMessage: skipScrubPII ? message : scrubPII({ string: message, _: _ }), devLogTrace: stackTrace, devLogCount: 1 });
|
|
52285
52561
|
if (!buffer.hasTokenAvailable())
|
|
52286
52562
|
return consoleEvent;
|
|
52287
52563
|
if (!isPtmPaused) {
|
|
@@ -52293,8 +52569,8 @@ function ConsoleCapture() {
|
|
|
52293
52569
|
}
|
|
52294
52570
|
function captureStackTrace(maxStackFrames) {
|
|
52295
52571
|
try {
|
|
52296
|
-
|
|
52297
|
-
return _.map(stackFrames, frame
|
|
52572
|
+
var stackFrames = ErrorStackParser.parse(new Error(), maxStackFrames);
|
|
52573
|
+
return _.map(stackFrames, function (frame) { return frame.toString(); }).join('\n');
|
|
52298
52574
|
}
|
|
52299
52575
|
catch (error) {
|
|
52300
52576
|
return '';
|
|
@@ -52306,21 +52582,22 @@ function ConsoleCapture() {
|
|
|
52306
52582
|
function updateLastLog(logKey) {
|
|
52307
52583
|
lastLogKey = logKey;
|
|
52308
52584
|
}
|
|
52309
|
-
function send(
|
|
52585
|
+
function send(_a) {
|
|
52586
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.unload, unload = _c === void 0 ? false : _c, _d = _b.hidden, hidden = _d === void 0 ? false : _d;
|
|
52310
52587
|
if (!buffer || buffer.isEmpty())
|
|
52311
52588
|
return;
|
|
52312
52589
|
if (!globalPendo.isSendingEvents()) {
|
|
52313
52590
|
buffer.clear();
|
|
52314
52591
|
return;
|
|
52315
52592
|
}
|
|
52316
|
-
|
|
52593
|
+
var payloads = buffer.pack();
|
|
52317
52594
|
if (!payloads || payloads.length === 0)
|
|
52318
52595
|
return;
|
|
52319
52596
|
if (unload || hidden) {
|
|
52320
52597
|
sendQueue.drain(payloads, unload);
|
|
52321
52598
|
}
|
|
52322
52599
|
else {
|
|
52323
|
-
sendQueue.push(
|
|
52600
|
+
sendQueue.push.apply(sendQueue, payloads);
|
|
52324
52601
|
}
|
|
52325
52602
|
}
|
|
52326
52603
|
function teardown() {
|
|
@@ -52344,7 +52621,7 @@ function ConsoleCapture() {
|
|
|
52344
52621
|
_.each(CONSOLE_METHODS, function (methodName) {
|
|
52345
52622
|
if (!console[methodName])
|
|
52346
52623
|
return _.noop;
|
|
52347
|
-
|
|
52624
|
+
var unwrap = console[methodName]._pendoUnwrap;
|
|
52348
52625
|
if (_.isFunction(unwrap)) {
|
|
52349
52626
|
unwrap();
|
|
52350
52627
|
}
|
|
@@ -55230,61 +55507,44 @@ const PredictGuides = () => {
|
|
|
55230
55507
|
};
|
|
55231
55508
|
};
|
|
55232
55509
|
|
|
55233
|
-
|
|
55234
|
-
|
|
55235
|
-
|
|
55236
|
-
|
|
55237
|
-
|
|
55238
|
-
|
|
55239
|
-
|
|
55240
|
-
|
|
55241
|
-
|
|
55242
|
-
|
|
55243
|
-
|
|
55244
|
-
|
|
55245
|
-
|
|
55246
|
-
|
|
55247
|
-
|
|
55248
|
-
|
|
55249
|
-
|
|
55510
|
+
var ASSISTANT_MESSAGE = 'assistantMessage';
|
|
55511
|
+
var CONVERSATION_ID_URL_PATTERN = 'conversationIdUrlPattern';
|
|
55512
|
+
var MESSAGE_CONTENT = 'messageContent';
|
|
55513
|
+
var MESSAGE_ID_ATTR = 'messageIdAttr';
|
|
55514
|
+
var MESSAGE_ID_PATTERN = 'messageIdPattern';
|
|
55515
|
+
var MODEL_USED_ATTR = 'modelUsedAttr';
|
|
55516
|
+
var REACTION_ACTIVE = 'reactionActive';
|
|
55517
|
+
var STREAMING_ACTIVE = 'streamingActive';
|
|
55518
|
+
var STREAMING_ACTIVE_ATTR = 'streamingActiveAttr';
|
|
55519
|
+
var THUMB_DOWN = 'thumbDown';
|
|
55520
|
+
var THUMB_UP = 'thumbUp';
|
|
55521
|
+
var TURN_CONTAINER = 'turnContainer';
|
|
55522
|
+
var USER_MESSAGE = 'userMessage';
|
|
55523
|
+
var CUSTOM_AGENT_ID_URL_PATTERN = 'customAgentIdUrlPattern';
|
|
55524
|
+
var CUSTOM_AGENT_ID = 'customAgentId';
|
|
55525
|
+
var CUSTOM_AGENT_NAME = 'customAgentName';
|
|
55526
|
+
var REQUIRED_SELECTORS = [
|
|
55250
55527
|
ASSISTANT_MESSAGE,
|
|
55251
55528
|
CONVERSATION_ID_URL_PATTERN,
|
|
55252
55529
|
STREAMING_ACTIVE,
|
|
55253
55530
|
TURN_CONTAINER,
|
|
55254
55531
|
USER_MESSAGE
|
|
55255
55532
|
];
|
|
55256
|
-
|
|
55257
|
-
|
|
55258
|
-
|
|
55259
|
-
|
|
55260
|
-
|
|
55261
|
-
|
|
55262
|
-
|
|
55263
|
-
|
|
55264
|
-
|
|
55265
|
-
|
|
55266
|
-
|
|
55267
|
-
|
|
55268
|
-
|
|
55269
|
-
|
|
55270
|
-
|
|
55271
|
-
continue;
|
|
55272
|
-
if (cfg.type === CONVERSATION_ID_URL_PATTERN) {
|
|
55273
|
-
try {
|
|
55274
|
-
RegExp(cfg.cssSelector);
|
|
55275
|
-
}
|
|
55276
|
-
catch (e) {
|
|
55277
|
-
continue;
|
|
55278
|
-
}
|
|
55279
|
-
}
|
|
55280
|
-
present.add(cfg.type);
|
|
55281
|
-
}
|
|
55282
|
-
return REQUIRED_SELECTORS.filter((r) => !present.has(r));
|
|
55283
|
-
}
|
|
55284
|
-
static supportedPreset(preset) {
|
|
55285
|
-
return SUPPORTED_PRESETS.indexOf(preset) !== -1;
|
|
55286
|
-
}
|
|
55287
|
-
constructor(pendo, PluginAPI, id, cssSelectors) {
|
|
55533
|
+
var SUPPORTED_PRESETS = [
|
|
55534
|
+
'chatgpt-full',
|
|
55535
|
+
'gemini-full',
|
|
55536
|
+
'claude-full',
|
|
55537
|
+
'copilot-full',
|
|
55538
|
+
'copilot-m365-full'
|
|
55539
|
+
];
|
|
55540
|
+
var STREAMING_END_SETTLE_MS = 500;
|
|
55541
|
+
var SUBMISSION_START_RETRY_MS = 1000;
|
|
55542
|
+
var SUBMISSION_START_MAX_ATTEMPTS = 4;
|
|
55543
|
+
var NEW_CONVERSATION_TTL_MS = 5 * 60 * 1000;
|
|
55544
|
+
var NEW_CONVERSATION_KEY = 'pendo_pca_new_conv';
|
|
55545
|
+
var DOMConversation = /** @class */ (function () {
|
|
55546
|
+
function DOMConversation(pendo, PluginAPI, id, cssSelectors) {
|
|
55547
|
+
var _this = this;
|
|
55288
55548
|
this.selectors = {};
|
|
55289
55549
|
this.listeners = [];
|
|
55290
55550
|
this.isActive = true;
|
|
@@ -55303,61 +55563,88 @@ class DOMConversation {
|
|
|
55303
55563
|
this.Sizzle = pendo.Sizzle;
|
|
55304
55564
|
this.id = id;
|
|
55305
55565
|
if (!this._.isArray(cssSelectors)) {
|
|
55306
|
-
this.api.log.error(
|
|
55566
|
+
this.api.log.error("cssSelectors must be an array, received: ".concat(typeof cssSelectors));
|
|
55307
55567
|
cssSelectors = [];
|
|
55308
55568
|
}
|
|
55309
|
-
this._.each(cssSelectors, (cfg)
|
|
55569
|
+
this._.each(cssSelectors, function (cfg) {
|
|
55310
55570
|
if (cfg && cfg.type) {
|
|
55311
|
-
|
|
55571
|
+
_this.selectors[cfg.type] = cfg.cssSelector;
|
|
55312
55572
|
}
|
|
55313
55573
|
});
|
|
55314
55574
|
this.conversationIdRegex = new RegExp(this.selectors[CONVERSATION_ID_URL_PATTERN]);
|
|
55315
|
-
|
|
55575
|
+
var customAgentIdUrlPattern = this.selectors[CUSTOM_AGENT_ID_URL_PATTERN];
|
|
55316
55576
|
if (customAgentIdUrlPattern) { // this is optional
|
|
55317
55577
|
try {
|
|
55318
55578
|
this.customAgentIdRegex = new RegExp(customAgentIdUrlPattern);
|
|
55319
55579
|
}
|
|
55320
55580
|
catch (error) {
|
|
55321
|
-
this.api.log.error(
|
|
55581
|
+
this.api.log.error("bad customAgentIdUrlPattern ".concat(customAgentIdUrlPattern), { error: error });
|
|
55322
55582
|
}
|
|
55323
55583
|
}
|
|
55324
|
-
|
|
55584
|
+
var messageIdPattern = this.selectors[MESSAGE_ID_PATTERN];
|
|
55325
55585
|
if (messageIdPattern) { // optional: gates the request node until its id is fully rendered
|
|
55326
55586
|
try {
|
|
55327
55587
|
this.messageIdRegex = new RegExp(messageIdPattern);
|
|
55328
55588
|
}
|
|
55329
55589
|
catch (error) {
|
|
55330
|
-
this.api.log.error(
|
|
55590
|
+
this.api.log.error("bad messageIdPattern ".concat(messageIdPattern), { error: error });
|
|
55331
55591
|
}
|
|
55332
55592
|
}
|
|
55333
55593
|
this.root = document.body;
|
|
55334
55594
|
this.setupReactionListener();
|
|
55335
55595
|
this.setupStreamingObserver();
|
|
55336
55596
|
}
|
|
55337
|
-
|
|
55597
|
+
// Returns the list of required selector types that are missing or empty
|
|
55598
|
+
// in the given cssSelectors config. An empty array means the config is
|
|
55599
|
+
// valid for instantiation.
|
|
55600
|
+
DOMConversation.validateConfig = function (cssSelectors) {
|
|
55601
|
+
if (!Array.isArray(cssSelectors)) {
|
|
55602
|
+
return REQUIRED_SELECTORS.slice();
|
|
55603
|
+
}
|
|
55604
|
+
var present = new Set();
|
|
55605
|
+
for (var _i = 0, cssSelectors_1 = cssSelectors; _i < cssSelectors_1.length; _i++) {
|
|
55606
|
+
var cfg = cssSelectors_1[_i];
|
|
55607
|
+
if (!cfg || !cfg.type || !cfg.cssSelector)
|
|
55608
|
+
continue;
|
|
55609
|
+
if (cfg.type === CONVERSATION_ID_URL_PATTERN) {
|
|
55610
|
+
try {
|
|
55611
|
+
RegExp(cfg.cssSelector);
|
|
55612
|
+
}
|
|
55613
|
+
catch (e) {
|
|
55614
|
+
continue;
|
|
55615
|
+
}
|
|
55616
|
+
}
|
|
55617
|
+
present.add(cfg.type);
|
|
55618
|
+
}
|
|
55619
|
+
return REQUIRED_SELECTORS.filter(function (r) { return !present.has(r); });
|
|
55620
|
+
};
|
|
55621
|
+
DOMConversation.supportedPreset = function (preset) {
|
|
55622
|
+
return SUPPORTED_PRESETS.indexOf(preset) !== -1;
|
|
55623
|
+
};
|
|
55624
|
+
DOMConversation.prototype.setupReactionListener = function () {
|
|
55338
55625
|
if (!this.findSelector(THUMB_UP) && !this.findSelector(THUMB_DOWN))
|
|
55339
55626
|
return;
|
|
55340
55627
|
this.reactionClickHandler = this.handleReactionClick.bind(this);
|
|
55341
55628
|
this.root.addEventListener('click', this.reactionClickHandler, true);
|
|
55342
|
-
}
|
|
55343
|
-
handleReactionClick(evt) {
|
|
55344
|
-
|
|
55629
|
+
};
|
|
55630
|
+
DOMConversation.prototype.handleReactionClick = function (evt) {
|
|
55631
|
+
var target = evt.target;
|
|
55345
55632
|
if (!target || target.nodeType !== 1)
|
|
55346
55633
|
return;
|
|
55347
|
-
|
|
55348
|
-
|
|
55349
|
-
|
|
55634
|
+
var upSelector = this.findSelector(THUMB_UP);
|
|
55635
|
+
var downSelector = this.findSelector(THUMB_DOWN);
|
|
55636
|
+
var thumb = this.dom(target).closest("".concat(upSelector, ", ").concat(downSelector));
|
|
55350
55637
|
if (!thumb.length)
|
|
55351
55638
|
return;
|
|
55352
|
-
|
|
55353
|
-
|
|
55354
|
-
|
|
55355
|
-
|
|
55356
|
-
|
|
55639
|
+
var isUp = this.Sizzle.matchesSelector(thumb[0], upSelector);
|
|
55640
|
+
var activeSelector = this.findSelector(REACTION_ACTIVE);
|
|
55641
|
+
var wasPressed = activeSelector && this.Sizzle.matchesSelector(thumb[0], activeSelector);
|
|
55642
|
+
var direction = isUp ? 'positive' : 'negative';
|
|
55643
|
+
var content = wasPressed ? 'unreact' : direction;
|
|
55357
55644
|
// the thumb may live inside the assistant message (e.g. copilot) or in a separate
|
|
55358
55645
|
// turn footer alongside it (e.g. chatgpt/gemini); handle both
|
|
55359
|
-
|
|
55360
|
-
|
|
55646
|
+
var assistantSelector = this.findSelector(ASSISTANT_MESSAGE);
|
|
55647
|
+
var assistantNode = thumb.closest(assistantSelector);
|
|
55361
55648
|
if (!assistantNode.length) {
|
|
55362
55649
|
assistantNode = thumb.closest(this.findSelector(TURN_CONTAINER))
|
|
55363
55650
|
.find(assistantSelector);
|
|
@@ -55365,16 +55652,31 @@ class DOMConversation {
|
|
|
55365
55652
|
this.emit('user_reaction', {
|
|
55366
55653
|
agentId: this.id,
|
|
55367
55654
|
messageId: this.getMessageId(assistantNode),
|
|
55368
|
-
content
|
|
55655
|
+
content: content
|
|
55369
55656
|
});
|
|
55370
|
-
}
|
|
55657
|
+
};
|
|
55658
|
+
// On a new M365 conversation the browser does a full page reload to the
|
|
55659
|
+
// conversation URL. the old page sets FRESH_CONVERSATION_KEY when streaming starts
|
|
55660
|
+
// without a conversation id; the new page picks it up here and triggers onSubmissionEnd
|
|
55661
|
+
// to scan the already-rendered messages.
|
|
55662
|
+
DOMConversation.prototype.tryFlushNewConversation = function () {
|
|
55663
|
+
var ts = +this.api.sessionStorage.getItem(NEW_CONVERSATION_KEY);
|
|
55664
|
+
if (!ts)
|
|
55665
|
+
return;
|
|
55666
|
+
this.api.sessionStorage.removeItem(NEW_CONVERSATION_KEY);
|
|
55667
|
+
if (Date.now() - ts > NEW_CONVERSATION_TTL_MS)
|
|
55668
|
+
return;
|
|
55669
|
+
if (!this.getConversationId())
|
|
55670
|
+
return;
|
|
55671
|
+
this.startStreamingEndTimer();
|
|
55672
|
+
};
|
|
55371
55673
|
// observe the streaming indicator
|
|
55372
|
-
setupStreamingObserver() {
|
|
55674
|
+
DOMConversation.prototype.setupStreamingObserver = function () {
|
|
55373
55675
|
this.wasStreaming = this.select(STREAMING_ACTIVE).length > 0;
|
|
55374
55676
|
this.stopStreamingEndTimer();
|
|
55375
|
-
|
|
55376
|
-
|
|
55377
|
-
|
|
55677
|
+
var MutationObserver = getZoneSafeMethod(this._, 'MutationObserver');
|
|
55678
|
+
var observer = new MutationObserver(this.handleMutation.bind(this));
|
|
55679
|
+
var attrName = this.findSelector(STREAMING_ACTIVE_ATTR);
|
|
55378
55680
|
observer.observe(this.root, {
|
|
55379
55681
|
childList: true,
|
|
55380
55682
|
subtree: true,
|
|
@@ -55382,7 +55684,7 @@ class DOMConversation {
|
|
|
55382
55684
|
attributeFilter: attrName ? [attrName] : undefined
|
|
55383
55685
|
});
|
|
55384
55686
|
this.observers.push(observer);
|
|
55385
|
-
}
|
|
55687
|
+
};
|
|
55386
55688
|
// look for changes in the state of the streaming indicator.
|
|
55387
55689
|
// streaming started -> a prompt has been submitted
|
|
55388
55690
|
// streaming ended -> got a response
|
|
@@ -55391,12 +55693,17 @@ class DOMConversation {
|
|
|
55391
55693
|
// we don't send the agent_response immediately when the streaming indicator is cleared
|
|
55392
55694
|
// because it clears slightly before the final text chunk is committed to the DOM so the
|
|
55393
55695
|
// end-handling is deferred by a short settle window
|
|
55394
|
-
handleMutation() {
|
|
55395
|
-
|
|
55696
|
+
DOMConversation.prototype.handleMutation = function () {
|
|
55697
|
+
var isStreaming = this.select(STREAMING_ACTIVE).length > 0;
|
|
55396
55698
|
if (isStreaming === this.wasStreaming)
|
|
55397
55699
|
return;
|
|
55398
55700
|
if (isStreaming) { // started streaming
|
|
55399
55701
|
if (!this.streamingEndTimer) {
|
|
55702
|
+
if (!this.getConversationId()) {
|
|
55703
|
+
// Full-page reload expected on fresh chat: persist a flag so the
|
|
55704
|
+
// new page can emit the prompt + response after the reload.
|
|
55705
|
+
this.api.sessionStorage.setItem(NEW_CONVERSATION_KEY, String(Date.now()));
|
|
55706
|
+
}
|
|
55400
55707
|
this.onSubmissionStart();
|
|
55401
55708
|
}
|
|
55402
55709
|
else {
|
|
@@ -55410,8 +55717,9 @@ class DOMConversation {
|
|
|
55410
55717
|
this.startStreamingEndTimer();
|
|
55411
55718
|
}
|
|
55412
55719
|
this.wasStreaming = isStreaming;
|
|
55413
|
-
}
|
|
55414
|
-
onSubmissionStart
|
|
55720
|
+
};
|
|
55721
|
+
DOMConversation.prototype.onSubmissionStart = function (attempt) {
|
|
55722
|
+
if (attempt === void 0) { attempt = 1; }
|
|
55415
55723
|
this.requestNode = this.findLastRequestNode();
|
|
55416
55724
|
if (this.requestNode) {
|
|
55417
55725
|
this.handleUserMessage(this.requestNode);
|
|
@@ -55422,10 +55730,13 @@ class DOMConversation {
|
|
|
55422
55730
|
if (attempt < SUBMISSION_START_MAX_ATTEMPTS) {
|
|
55423
55731
|
this.startSubmissionStartRetryTimer(attempt + 1);
|
|
55424
55732
|
}
|
|
55425
|
-
}
|
|
55426
|
-
onSubmissionEnd() {
|
|
55733
|
+
};
|
|
55734
|
+
DOMConversation.prototype.onSubmissionEnd = function () {
|
|
55427
55735
|
this.stopSubmissionStartRetryTimer();
|
|
55428
|
-
|
|
55736
|
+
if (this.getConversationId()) {
|
|
55737
|
+
this.api.sessionStorage.removeItem(NEW_CONVERSATION_KEY);
|
|
55738
|
+
}
|
|
55739
|
+
var requestNode = this.requestNode;
|
|
55429
55740
|
this.requestNode = null;
|
|
55430
55741
|
if (!requestNode) {
|
|
55431
55742
|
// onSubmissionStart didn't send, send it now
|
|
@@ -55434,26 +55745,26 @@ class DOMConversation {
|
|
|
55434
55745
|
return;
|
|
55435
55746
|
this.handleUserMessage(requestNode);
|
|
55436
55747
|
}
|
|
55437
|
-
|
|
55748
|
+
var requestEl = requestNode[0];
|
|
55438
55749
|
if (!requestEl)
|
|
55439
55750
|
return;
|
|
55440
55751
|
// the request is the latest user message, so any assistant message that
|
|
55441
55752
|
// follows it in the DOM is a response to it. document order is already
|
|
55442
55753
|
// chronological, so we emit as we go
|
|
55443
|
-
|
|
55444
|
-
for (
|
|
55445
|
-
|
|
55754
|
+
var assistantNodes = this.select(ASSISTANT_MESSAGE);
|
|
55755
|
+
for (var i = 0; i < assistantNodes.length; i++) {
|
|
55756
|
+
var el = assistantNodes[i];
|
|
55446
55757
|
if (requestEl.compareDocumentPosition(el) & Node.DOCUMENT_POSITION_FOLLOWING) {
|
|
55447
55758
|
this.handleAssistantMessage(this.dom(el));
|
|
55448
55759
|
}
|
|
55449
55760
|
}
|
|
55450
|
-
}
|
|
55451
|
-
extractContent(node) {
|
|
55452
|
-
|
|
55761
|
+
};
|
|
55762
|
+
DOMConversation.prototype.extractContent = function (node) {
|
|
55763
|
+
var source = node;
|
|
55453
55764
|
// optional: content inside a descendant
|
|
55454
|
-
|
|
55765
|
+
var contentSelector = this.findSelector(MESSAGE_CONTENT);
|
|
55455
55766
|
if (contentSelector) {
|
|
55456
|
-
|
|
55767
|
+
var contentNode = node.find(contentSelector);
|
|
55457
55768
|
if (contentNode.length) {
|
|
55458
55769
|
source = contentNode;
|
|
55459
55770
|
}
|
|
@@ -55461,59 +55772,59 @@ class DOMConversation {
|
|
|
55461
55772
|
// .text() reads innerText, which is empty for content-visibility:auto / off-screen subtrees
|
|
55462
55773
|
// (e.g. claude.ai's scrolled-up messages). Keep innerText as the primary source so agents
|
|
55463
55774
|
// whose content already works are unchanged, and fall back to textContent only when it's empty.
|
|
55464
|
-
|
|
55775
|
+
var primary = source.text().trim();
|
|
55465
55776
|
if (primary)
|
|
55466
55777
|
return primary;
|
|
55467
55778
|
return source[0].textContent.trim();
|
|
55468
|
-
}
|
|
55469
|
-
getMessageId(node) {
|
|
55470
|
-
|
|
55779
|
+
};
|
|
55780
|
+
DOMConversation.prototype.getMessageId = function (node) {
|
|
55781
|
+
var attr = this.findSelector(MESSAGE_ID_ATTR);
|
|
55471
55782
|
if (!attr) {
|
|
55472
55783
|
return this.syntheticMessageId(node[0]);
|
|
55473
55784
|
}
|
|
55474
55785
|
return node.attr(attr);
|
|
55475
|
-
}
|
|
55786
|
+
};
|
|
55476
55787
|
// Agents with no DOM message id (e.g. claude.ai) get a synthetic id based on the role and
|
|
55477
55788
|
// position in document order.
|
|
55478
|
-
syntheticMessageId(el) {
|
|
55789
|
+
DOMConversation.prototype.syntheticMessageId = function (el) {
|
|
55479
55790
|
if (!el)
|
|
55480
55791
|
return undefined;
|
|
55481
|
-
|
|
55482
|
-
|
|
55483
|
-
|
|
55484
|
-
|
|
55485
|
-
for (
|
|
55792
|
+
var userSelector = this.findSelector(USER_MESSAGE);
|
|
55793
|
+
var isUser = userSelector && this.Sizzle.matchesSelector(el, userSelector);
|
|
55794
|
+
var role = isUser ? 'u' : 'a';
|
|
55795
|
+
var siblings = this.select(isUser ? USER_MESSAGE : ASSISTANT_MESSAGE);
|
|
55796
|
+
for (var i = 0; i < siblings.length; i++) {
|
|
55486
55797
|
if (siblings[i] === el) {
|
|
55487
|
-
return
|
|
55798
|
+
return "".concat(role, "-").concat(i);
|
|
55488
55799
|
}
|
|
55489
55800
|
}
|
|
55490
55801
|
return undefined; // el isn't among the rendered messages — no meaningful index
|
|
55491
|
-
}
|
|
55492
|
-
handleUserMessage(node) {
|
|
55802
|
+
};
|
|
55803
|
+
DOMConversation.prototype.handleUserMessage = function (node) {
|
|
55493
55804
|
this.emit('prompt', {
|
|
55494
55805
|
agentId: this.id,
|
|
55495
55806
|
messageId: this.getMessageId(node),
|
|
55496
55807
|
content: this.extractContent(node)
|
|
55497
55808
|
});
|
|
55498
|
-
}
|
|
55499
|
-
handleAssistantMessage(node) {
|
|
55500
|
-
|
|
55501
|
-
|
|
55809
|
+
};
|
|
55810
|
+
DOMConversation.prototype.handleAssistantMessage = function (node) {
|
|
55811
|
+
var modelUsedAttr = this.findSelector(MODEL_USED_ATTR);
|
|
55812
|
+
var modelUsed = modelUsedAttr && node.attr(modelUsedAttr);
|
|
55502
55813
|
this.emit('agent_response', {
|
|
55503
55814
|
agentId: this.id,
|
|
55504
55815
|
messageId: this.getMessageId(node),
|
|
55505
55816
|
agentModelsUsed: modelUsed ? [modelUsed] : [],
|
|
55506
55817
|
content: this.extractContent(node)
|
|
55507
55818
|
});
|
|
55508
|
-
}
|
|
55509
|
-
findLastRequestNode() {
|
|
55819
|
+
};
|
|
55820
|
+
DOMConversation.prototype.findLastRequestNode = function () {
|
|
55510
55821
|
if (!this.getConversationId())
|
|
55511
55822
|
return null;
|
|
55512
|
-
|
|
55823
|
+
var node = this._.last(this.select(USER_MESSAGE));
|
|
55513
55824
|
if (!node)
|
|
55514
55825
|
return null;
|
|
55515
|
-
|
|
55516
|
-
|
|
55826
|
+
var $node = this.dom(node);
|
|
55827
|
+
var messageId = this.getMessageId($node);
|
|
55517
55828
|
if (!messageId)
|
|
55518
55829
|
return null;
|
|
55519
55830
|
// the node may still be rendering (e.g. a framework interpolating an
|
|
@@ -55525,96 +55836,99 @@ class DOMConversation {
|
|
|
55525
55836
|
return null;
|
|
55526
55837
|
this.lastReturnedMessageId = messageId;
|
|
55527
55838
|
return $node;
|
|
55528
|
-
}
|
|
55529
|
-
findSelector(type) {
|
|
55839
|
+
};
|
|
55840
|
+
DOMConversation.prototype.findSelector = function (type) {
|
|
55530
55841
|
return this.selectors[type];
|
|
55531
|
-
}
|
|
55532
|
-
select(type) {
|
|
55842
|
+
};
|
|
55843
|
+
DOMConversation.prototype.select = function (type) {
|
|
55533
55844
|
return this.dom(this.findSelector(type), this.root);
|
|
55534
|
-
}
|
|
55535
|
-
getConversationId() {
|
|
55536
|
-
|
|
55845
|
+
};
|
|
55846
|
+
DOMConversation.prototype.getConversationId = function () {
|
|
55847
|
+
var m = location.href.match(this.conversationIdRegex);
|
|
55537
55848
|
if (!m)
|
|
55538
55849
|
return null;
|
|
55539
55850
|
return m[1] !== undefined ? m[1] : m[0];
|
|
55540
|
-
}
|
|
55541
|
-
getCustomAgentId() {
|
|
55851
|
+
};
|
|
55852
|
+
DOMConversation.prototype.getCustomAgentId = function () {
|
|
55542
55853
|
if (!this.customAgentIdRegex)
|
|
55543
55854
|
return undefined;
|
|
55544
55855
|
// The id may live in the page URL (e.g. gemini /gem/<id>) or,
|
|
55545
55856
|
// when customAgentId is set, in the href of a DOM element
|
|
55546
|
-
|
|
55857
|
+
var source = location.href;
|
|
55547
55858
|
if (this.findSelector(CUSTOM_AGENT_ID)) {
|
|
55548
|
-
|
|
55859
|
+
var node = this.select(CUSTOM_AGENT_ID);
|
|
55549
55860
|
if (!node.length)
|
|
55550
55861
|
return undefined;
|
|
55551
55862
|
source = node.attr('href') || '';
|
|
55552
55863
|
}
|
|
55553
|
-
|
|
55864
|
+
var m = source.match(this.customAgentIdRegex);
|
|
55554
55865
|
if (!m)
|
|
55555
55866
|
return undefined;
|
|
55556
55867
|
return m[1] !== undefined ? m[1] : m[0];
|
|
55557
|
-
}
|
|
55558
|
-
getCustomAgentName() {
|
|
55868
|
+
};
|
|
55869
|
+
DOMConversation.prototype.getCustomAgentName = function () {
|
|
55559
55870
|
if (!this.findSelector(CUSTOM_AGENT_NAME))
|
|
55560
55871
|
return '';
|
|
55561
|
-
|
|
55872
|
+
var node = this.select(CUSTOM_AGENT_NAME);
|
|
55562
55873
|
if (!node.length)
|
|
55563
55874
|
return '';
|
|
55564
55875
|
return node.text().trim();
|
|
55565
|
-
}
|
|
55566
|
-
addCustomAgentInfo(eventPayload) {
|
|
55567
|
-
|
|
55876
|
+
};
|
|
55877
|
+
DOMConversation.prototype.addCustomAgentInfo = function (eventPayload) {
|
|
55878
|
+
var customAgentId = this.getCustomAgentId();
|
|
55568
55879
|
if (!customAgentId)
|
|
55569
55880
|
return;
|
|
55570
55881
|
eventPayload.customAgentId = customAgentId;
|
|
55571
|
-
|
|
55882
|
+
var customAgentName = this.getCustomAgentName();
|
|
55572
55883
|
if (customAgentName) {
|
|
55573
55884
|
eventPayload.customAgentName = customAgentName;
|
|
55574
55885
|
}
|
|
55575
|
-
}
|
|
55576
|
-
onSubmit(callback) {
|
|
55886
|
+
};
|
|
55887
|
+
DOMConversation.prototype.onSubmit = function (callback) {
|
|
55577
55888
|
this.listeners.push(callback);
|
|
55578
|
-
}
|
|
55579
|
-
emit(eventType, eventPayload) {
|
|
55889
|
+
};
|
|
55890
|
+
DOMConversation.prototype.emit = function (eventType, eventPayload) {
|
|
55580
55891
|
eventPayload.conversationId = this.getConversationId();
|
|
55581
55892
|
this.addCustomAgentInfo(eventPayload);
|
|
55582
|
-
this._.each(this.listeners, (cb)
|
|
55583
|
-
}
|
|
55584
|
-
startStreamingEndTimer() {
|
|
55893
|
+
this._.each(this.listeners, function (cb) { return cb(eventType, eventPayload); });
|
|
55894
|
+
};
|
|
55895
|
+
DOMConversation.prototype.startStreamingEndTimer = function () {
|
|
55896
|
+
var _this = this;
|
|
55585
55897
|
this.stopStreamingEndTimer();
|
|
55586
|
-
this.streamingEndTimer = setTimeout$1(()
|
|
55587
|
-
|
|
55588
|
-
|
|
55898
|
+
this.streamingEndTimer = setTimeout$1(function () {
|
|
55899
|
+
_this.streamingEndTimer = null;
|
|
55900
|
+
_this.onSubmissionEnd();
|
|
55589
55901
|
}, STREAMING_END_SETTLE_MS);
|
|
55590
|
-
}
|
|
55591
|
-
stopStreamingEndTimer() {
|
|
55902
|
+
};
|
|
55903
|
+
DOMConversation.prototype.stopStreamingEndTimer = function () {
|
|
55592
55904
|
if (!this.streamingEndTimer)
|
|
55593
55905
|
return;
|
|
55594
55906
|
clearTimeout(this.streamingEndTimer);
|
|
55595
55907
|
this.streamingEndTimer = null;
|
|
55596
|
-
}
|
|
55597
|
-
startSubmissionStartRetryTimer(attempt) {
|
|
55908
|
+
};
|
|
55909
|
+
DOMConversation.prototype.startSubmissionStartRetryTimer = function (attempt) {
|
|
55910
|
+
var _this = this;
|
|
55598
55911
|
this.stopSubmissionStartRetryTimer();
|
|
55599
|
-
this.submissionStartRetryTimer = setTimeout$1(()
|
|
55600
|
-
|
|
55601
|
-
|
|
55912
|
+
this.submissionStartRetryTimer = setTimeout$1(function () {
|
|
55913
|
+
_this.submissionStartRetryTimer = null;
|
|
55914
|
+
_this.onSubmissionStart(attempt);
|
|
55602
55915
|
}, SUBMISSION_START_RETRY_MS);
|
|
55603
|
-
}
|
|
55604
|
-
stopSubmissionStartRetryTimer() {
|
|
55916
|
+
};
|
|
55917
|
+
DOMConversation.prototype.stopSubmissionStartRetryTimer = function () {
|
|
55605
55918
|
if (!this.submissionStartRetryTimer)
|
|
55606
55919
|
return;
|
|
55607
55920
|
clearTimeout(this.submissionStartRetryTimer);
|
|
55608
55921
|
this.submissionStartRetryTimer = null;
|
|
55609
|
-
}
|
|
55610
|
-
suspend() {
|
|
55922
|
+
};
|
|
55923
|
+
DOMConversation.prototype.suspend = function () {
|
|
55611
55924
|
this.isActive = false;
|
|
55612
|
-
}
|
|
55613
|
-
resume() {
|
|
55925
|
+
};
|
|
55926
|
+
DOMConversation.prototype.resume = function () {
|
|
55614
55927
|
this.isActive = true;
|
|
55615
|
-
|
|
55616
|
-
|
|
55617
|
-
|
|
55928
|
+
this.tryFlushNewConversation();
|
|
55929
|
+
};
|
|
55930
|
+
DOMConversation.prototype.teardown = function () {
|
|
55931
|
+
this._.each(this.observers, function (o) { return o && o.disconnect && o.disconnect(); });
|
|
55618
55932
|
this.observers = [];
|
|
55619
55933
|
if (this.reactionClickHandler && this.root) {
|
|
55620
55934
|
this.root.removeEventListener('click', this.reactionClickHandler, true);
|
|
@@ -55623,8 +55937,9 @@ class DOMConversation {
|
|
|
55623
55937
|
this.stopStreamingEndTimer();
|
|
55624
55938
|
this.stopSubmissionStartRetryTimer();
|
|
55625
55939
|
this.listeners = [];
|
|
55626
|
-
}
|
|
55627
|
-
|
|
55940
|
+
};
|
|
55941
|
+
return DOMConversation;
|
|
55942
|
+
}());
|
|
55628
55943
|
|
|
55629
55944
|
/*
|
|
55630
55945
|
* Conversation Analytics Plugin
|
|
@@ -55634,21 +55949,21 @@ class DOMConversation {
|
|
|
55634
55949
|
* The sibling built-in PromptAnalytics plugin owns the network + DOMPrompt AI-agents
|
|
55635
55950
|
*/
|
|
55636
55951
|
function ConversationAnalytics() {
|
|
55637
|
-
|
|
55638
|
-
|
|
55639
|
-
|
|
55640
|
-
|
|
55641
|
-
|
|
55642
|
-
|
|
55643
|
-
|
|
55952
|
+
var pendo;
|
|
55953
|
+
var api;
|
|
55954
|
+
var _;
|
|
55955
|
+
var log;
|
|
55956
|
+
var conversations = [];
|
|
55957
|
+
var agentsCache = new Map();
|
|
55958
|
+
var CONFIG_NAME = 'aiAgents';
|
|
55644
55959
|
return {
|
|
55645
55960
|
name: 'ConversationAnalytics',
|
|
55646
|
-
initialize,
|
|
55647
|
-
teardown,
|
|
55648
|
-
onConfigLoaded,
|
|
55649
|
-
observeConversation,
|
|
55650
|
-
sendConversationEvent,
|
|
55651
|
-
reEvaluatePageRules
|
|
55961
|
+
initialize: initialize,
|
|
55962
|
+
teardown: teardown,
|
|
55963
|
+
onConfigLoaded: onConfigLoaded,
|
|
55964
|
+
observeConversation: observeConversation,
|
|
55965
|
+
sendConversationEvent: sendConversationEvent,
|
|
55966
|
+
reEvaluatePageRules: reEvaluatePageRules
|
|
55652
55967
|
};
|
|
55653
55968
|
function initialize(pendoGlobal, PluginAPI) {
|
|
55654
55969
|
var _a;
|
|
@@ -55656,7 +55971,7 @@ function ConversationAnalytics() {
|
|
|
55656
55971
|
api = PluginAPI;
|
|
55657
55972
|
_ = pendo._;
|
|
55658
55973
|
log = api.log;
|
|
55659
|
-
|
|
55974
|
+
var ConfigReader = api.ConfigReader;
|
|
55660
55975
|
ConfigReader.addOption(CONFIG_NAME, [
|
|
55661
55976
|
ConfigReader.sources.PENDO_CONFIG_SRC,
|
|
55662
55977
|
ConfigReader.sources.SNIPPET_SRC
|
|
@@ -55669,12 +55984,13 @@ function ConversationAnalytics() {
|
|
|
55669
55984
|
// Test if the current URL matches the page rule for an agent. The raw matcher lives in core
|
|
55670
55985
|
// and is reached through PluginAPI (independent plugins cannot import it directly); it falls
|
|
55671
55986
|
// back to the normalized URL internally when no URL is passed.
|
|
55672
|
-
function testPageRule(pageRule, agentId
|
|
55987
|
+
function testPageRule(pageRule, agentId) {
|
|
55988
|
+
if (agentId === void 0) { agentId = 'unknown'; }
|
|
55673
55989
|
// Convert //*/agent pattern to work with full URLs
|
|
55674
|
-
|
|
55990
|
+
var fixedPageRule = pageRule;
|
|
55675
55991
|
if (Array.isArray(pageRule)) {
|
|
55676
|
-
|
|
55677
|
-
fixedPageRule = _.map(validRules, rule
|
|
55992
|
+
var validRules = _.filter(pageRule, function (rule) { return rule && rule.trim() !== ''; });
|
|
55993
|
+
fixedPageRule = _.map(validRules, function (rule) { return rule.startsWith('//*/') ? rule.substring(1) : rule; });
|
|
55678
55994
|
}
|
|
55679
55995
|
else if (typeof pageRule === 'string' && pageRule.startsWith('//*/')) {
|
|
55680
55996
|
fixedPageRule = pageRule.substring(1);
|
|
@@ -55686,9 +56002,9 @@ function ConversationAnalytics() {
|
|
|
55686
56002
|
});
|
|
55687
56003
|
}
|
|
55688
56004
|
function reEvaluatePageRules() {
|
|
55689
|
-
_.each(conversations, conversation
|
|
55690
|
-
|
|
55691
|
-
|
|
56005
|
+
_.each(conversations, function (conversation) {
|
|
56006
|
+
var agent = findAgentById(conversation.id);
|
|
56007
|
+
var shouldBeActive = agent && testPageRule(agent.pageRule, agent.id);
|
|
55692
56008
|
if (shouldBeActive) {
|
|
55693
56009
|
conversation.resume();
|
|
55694
56010
|
}
|
|
@@ -55696,14 +56012,14 @@ function ConversationAnalytics() {
|
|
|
55696
56012
|
conversation.suspend();
|
|
55697
56013
|
}
|
|
55698
56014
|
});
|
|
55699
|
-
|
|
55700
|
-
|
|
55701
|
-
_.each(allAgents, aiAgent
|
|
56015
|
+
var currentlyActiveIds = _.map(_.filter(conversations, function (conversation) { return conversation.isActive; }), function (conversation) { return conversation.id; });
|
|
56016
|
+
var allAgents = api.ConfigReader.get(CONFIG_NAME) || [];
|
|
56017
|
+
_.each(allAgents, function (aiAgent) {
|
|
55702
56018
|
if (!isConversationAgent(aiAgent)) {
|
|
55703
56019
|
return;
|
|
55704
56020
|
}
|
|
55705
|
-
|
|
55706
|
-
|
|
56021
|
+
var isCurrentlyActive = _.contains(currentlyActiveIds, aiAgent.id);
|
|
56022
|
+
var shouldBeActive = testPageRule(aiAgent.pageRule, aiAgent.id);
|
|
55707
56023
|
if (shouldBeActive && !isCurrentlyActive) {
|
|
55708
56024
|
observeConversation(aiAgent);
|
|
55709
56025
|
}
|
|
@@ -55717,12 +56033,13 @@ function ConversationAnalytics() {
|
|
|
55717
56033
|
function isConversationAgent(agent) {
|
|
55718
56034
|
return DOMConversation.supportedPreset(agent.preset);
|
|
55719
56035
|
}
|
|
55720
|
-
function onConfigLoaded(aiAgents
|
|
56036
|
+
function onConfigLoaded(aiAgents) {
|
|
56037
|
+
if (aiAgents === void 0) { aiAgents = []; }
|
|
55721
56038
|
if (!aiAgents || !_.isArray(aiAgents) || aiAgents.length === 0) {
|
|
55722
56039
|
return;
|
|
55723
56040
|
}
|
|
55724
56041
|
agentsCache.clear();
|
|
55725
|
-
_.each(aiAgents, aiAgent
|
|
56042
|
+
_.each(aiAgents, function (aiAgent) {
|
|
55726
56043
|
if (!isConversationAgent(aiAgent)) {
|
|
55727
56044
|
return;
|
|
55728
56045
|
}
|
|
@@ -55733,24 +56050,24 @@ function ConversationAnalytics() {
|
|
|
55733
56050
|
});
|
|
55734
56051
|
}
|
|
55735
56052
|
function observeConversation(config) {
|
|
55736
|
-
|
|
56053
|
+
var id = config.id, cssSelectors = config.cssSelectors;
|
|
55737
56054
|
// Check if this agent is already being tracked
|
|
55738
|
-
|
|
56055
|
+
var existing = _.find(conversations, function (conversation) { return conversation.id === id; });
|
|
55739
56056
|
if (existing) {
|
|
55740
56057
|
return;
|
|
55741
56058
|
}
|
|
55742
|
-
|
|
56059
|
+
var missing = DOMConversation.validateConfig(cssSelectors);
|
|
55743
56060
|
if (missing.length) {
|
|
55744
|
-
log.error('aiAgent config missing required selectors', { agentId: id, missing });
|
|
56061
|
+
log.error('aiAgent config missing required selectors', { agentId: id, missing: missing });
|
|
55745
56062
|
return;
|
|
55746
56063
|
}
|
|
55747
|
-
|
|
56064
|
+
var conversation = new DOMConversation(pendo, api, id, cssSelectors);
|
|
55748
56065
|
conversation.onSubmit(sendConversationEvent);
|
|
55749
56066
|
conversations.push(conversation);
|
|
55750
56067
|
}
|
|
55751
56068
|
function sendConversationEvent(eventType, eventPayload) {
|
|
55752
56069
|
// Block event if the conversation is suspended
|
|
55753
|
-
|
|
56070
|
+
var conversation = _.find(conversations, function (c) { return c.id === eventPayload.agentId; });
|
|
55754
56071
|
if (conversation && !conversation.isActive) {
|
|
55755
56072
|
return;
|
|
55756
56073
|
}
|
|
@@ -55758,7 +56075,7 @@ function ConversationAnalytics() {
|
|
|
55758
56075
|
api.analytics.collectEvent(eventType, eventPayload, undefined, 'agentic');
|
|
55759
56076
|
}
|
|
55760
56077
|
function teardown() {
|
|
55761
|
-
_.each(conversations, conversation
|
|
56078
|
+
_.each(conversations, function (conversation) { return conversation.teardown(); });
|
|
55762
56079
|
conversations = [];
|
|
55763
56080
|
agentsCache.clear();
|
|
55764
56081
|
}
|