@pendo/agent 2.322.0 → 2.323.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dom.esm.js +37 -18
- package/dist/pendo.module.js +1079 -885
- package/dist/pendo.module.min.js +154 -8
- package/dist/pendo.preview.min.js +1 -1
- package/dist/replay.worker.min.js +1 -1
- package/dist/servers.json +7 -7
- package/package.json +1 -1
package/dist/pendo.module.js
CHANGED
|
@@ -3967,8 +3967,8 @@ let SERVER = '';
|
|
|
3967
3967
|
let ASSET_HOST = '';
|
|
3968
3968
|
let ASSET_PATH = '';
|
|
3969
3969
|
let DESIGNER_SERVER = '';
|
|
3970
|
-
let VERSION = '2.
|
|
3971
|
-
let PACKAGE_VERSION = '2.
|
|
3970
|
+
let VERSION = '2.323.0_';
|
|
3971
|
+
let PACKAGE_VERSION = '2.323.0';
|
|
3972
3972
|
let LOADER = 'xhr';
|
|
3973
3973
|
/* eslint-enable web-sdk-eslint-rules/no-gulp-env-references */
|
|
3974
3974
|
/**
|
|
@@ -4493,7 +4493,9 @@ function enableCookies(enabled) {
|
|
|
4493
4493
|
var getCookie = function (name) {
|
|
4494
4494
|
var result;
|
|
4495
4495
|
// eslint-disable-next-line no-cond-assign
|
|
4496
|
-
return (result = new RegExp('(^|; )' + name + '=([^;]*)').exec(document.cookie))
|
|
4496
|
+
return (result = new RegExp('(^|; )' + name + '=([^;]*)').exec(document.cookie))
|
|
4497
|
+
? decodeURIComponent(result[2])
|
|
4498
|
+
: null;
|
|
4497
4499
|
};
|
|
4498
4500
|
var setCookie = function (name, val, millisToExpire, isSecure) {
|
|
4499
4501
|
if (!areCookiesEnabled)
|
|
@@ -4509,7 +4511,14 @@ var setCookie = function (name, val, millisToExpire, isSecure) {
|
|
|
4509
4511
|
const canSecure = document.location.protocol === 'https:' || isSecure;
|
|
4510
4512
|
const sameSite = canSecure ? 'None' : 'Strict';
|
|
4511
4513
|
expireDate.setTime(expireDate.getTime() + cookieTTL);
|
|
4512
|
-
var cookie = name +
|
|
4514
|
+
var cookie = name +
|
|
4515
|
+
'=' +
|
|
4516
|
+
encodeURIComponent(val) +
|
|
4517
|
+
(millisToExpire ? ';expires=' + expireDate.toUTCString() : '') +
|
|
4518
|
+
'; path=/' +
|
|
4519
|
+
(canSecure ? ';secure' : '') +
|
|
4520
|
+
'; SameSite=' +
|
|
4521
|
+
sameSite;
|
|
4513
4522
|
if (cookieDomain) {
|
|
4514
4523
|
cookie += ';domain=' + cookieDomain;
|
|
4515
4524
|
}
|
|
@@ -4623,9 +4632,9 @@ class StorageRegistry {
|
|
|
4623
4632
|
* moving forward with new Agent refactoring and modularizing the code base.
|
|
4624
4633
|
*/
|
|
4625
4634
|
/*
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
*/
|
|
4635
|
+
The majority of prior existing functionality still remains where it was. The
|
|
4636
|
+
core Storage api is now in `agentStorage` with the original references still in place.
|
|
4637
|
+
*/
|
|
4629
4638
|
var agentStorage = (function () {
|
|
4630
4639
|
const registry = new StorageRegistry();
|
|
4631
4640
|
function wrapStorageWriteMethod(writeMethod, registryMethod) {
|
|
@@ -4657,18 +4666,18 @@ var agentStorage = (function () {
|
|
|
4657
4666
|
return true;
|
|
4658
4667
|
}
|
|
4659
4668
|
catch (e) {
|
|
4660
|
-
return e instanceof DOMException &&
|
|
4661
|
-
// everything except Firefox
|
|
4662
|
-
e.code === 22 ||
|
|
4663
|
-
// Firefox
|
|
4664
|
-
e.code === 1014 ||
|
|
4665
|
-
// test name field too, because code might not be present
|
|
4669
|
+
return (e instanceof DOMException &&
|
|
4666
4670
|
// everything except Firefox
|
|
4667
|
-
e.
|
|
4668
|
-
|
|
4669
|
-
|
|
4671
|
+
(e.code === 22 ||
|
|
4672
|
+
// Firefox
|
|
4673
|
+
e.code === 1014 ||
|
|
4674
|
+
// test name field too, because code might not be present
|
|
4675
|
+
// everything except Firefox
|
|
4676
|
+
e.name === 'QuotaExceededError' ||
|
|
4677
|
+
// Firefox
|
|
4678
|
+
e.name === 'NS_ERROR_DOM_QUOTA_REACHED') &&
|
|
4670
4679
|
// acknowledge QuotaExceededError only if there's something already stored
|
|
4671
|
-
(storage && storage.length !== 0);
|
|
4680
|
+
(storage && storage.length !== 0));
|
|
4672
4681
|
}
|
|
4673
4682
|
});
|
|
4674
4683
|
function resetCache(mFn) {
|
|
@@ -4724,10 +4733,19 @@ var agentStorage = (function () {
|
|
|
4724
4733
|
try {
|
|
4725
4734
|
// JSON parsables: Numbers, Booleans, and Objects
|
|
4726
4735
|
var obj = JSON.parse(value);
|
|
4727
|
-
|
|
4736
|
+
// value is either a TimedStorageItem or just a PlainOldStorageItem
|
|
4737
|
+
// a TimedStorageItem will have both a ttl and value property
|
|
4738
|
+
const isTimedStorageItem = obj !== null && typeof obj === 'object' && 'ttl' in obj && 'value' in obj;
|
|
4739
|
+
if (!isTimedStorageItem) {
|
|
4728
4740
|
return value;
|
|
4729
4741
|
}
|
|
4730
|
-
|
|
4742
|
+
// ttl must always be an unsigned, non-zero number (a positive,
|
|
4743
|
+
// finite epoch-millis timestamp). Anything else (null, NaN, a
|
|
4744
|
+
// string, a negative number, 0, etc.) is treated as a missing /
|
|
4745
|
+
// invalid ttl and we fall through to returning the stored value
|
|
4746
|
+
// rather than discarding it as expired.
|
|
4747
|
+
const hasValidTtl = typeof obj.ttl === 'number' && isFinite(obj.ttl) && obj.ttl > 0;
|
|
4748
|
+
if (hasValidTtl && obj.ttl < new Date().getTime()) {
|
|
4731
4749
|
return null;
|
|
4732
4750
|
}
|
|
4733
4751
|
return String(obj.value || obj);
|
|
@@ -4813,6 +4831,7 @@ var agentStorage = (function () {
|
|
|
4813
4831
|
const wrappedPendoLocalStorage = _.extend({}, pendoLocalStorage$4);
|
|
4814
4832
|
wrappedPendoLocalStorage.setItem = wrapStorageWriteMethod(wrappedPendoLocalStorage.setItem, 'hasLocal');
|
|
4815
4833
|
return {
|
|
4834
|
+
/* API */
|
|
4816
4835
|
read,
|
|
4817
4836
|
write: wrapStorageWriteMethod(write, 'hasLocal'),
|
|
4818
4837
|
clear,
|
|
@@ -11672,7 +11691,7 @@ function isTrustedOrigin(host) {
|
|
|
11672
11691
|
return true;
|
|
11673
11692
|
// Domains that Pendo owns, will be swapped in by build patches
|
|
11674
11693
|
const patterns = [
|
|
11675
|
-
/^https:\/\/(adopt\.)?((us1)\.)?(app|via|adopt|cdn|oem)(\.(au|eu|gov|hsbc|jpn))?\.pendo\.io$/,
|
|
11694
|
+
/^https:\/\/(adopt\.)?((us1)\.)?(app|via|adopt|cdn|oem|novus-api|novus)(\.(au|eu|gov|hsbc|jpn))?\.pendo\.io$/,
|
|
11676
11695
|
/^https:\/\/([0-9]{8}t[0-9]{4}-dot-)pendo-(au|eu|govramp|hsbc|io|jp-prod|us1)\.appspot\.com$/,
|
|
11677
11696
|
/^https:\/\/hotfix-(ops|app)-([0-9]+-dot-)pendo-(au|eu|govramp|hsbc|io|jp-prod|us1)\.appspot\.com$/,
|
|
11678
11697
|
/^https:\/\/pendo-(au|eu|govramp|hsbc|io|jp-prod|us1)-static\.storage\.googleapis\.com$/,
|
|
@@ -16046,6 +16065,12 @@ const TOOLTIP_CONSTANTS = {
|
|
|
16046
16065
|
BORDER_CARET: 10
|
|
16047
16066
|
}
|
|
16048
16067
|
};
|
|
16068
|
+
const HYPHEN_BORDER_BY_SIDE = {
|
|
16069
|
+
Top: 'border-top',
|
|
16070
|
+
Right: 'border-right',
|
|
16071
|
+
Bottom: 'border-bottom',
|
|
16072
|
+
Left: 'border-left'
|
|
16073
|
+
};
|
|
16049
16074
|
var BuildingBlockTooltips = (function () {
|
|
16050
16075
|
return {
|
|
16051
16076
|
createBBTooltip,
|
|
@@ -16190,7 +16215,7 @@ var BuildingBlockTooltips = (function () {
|
|
|
16190
16215
|
guideContainer.style.position = 'absolute';
|
|
16191
16216
|
}
|
|
16192
16217
|
if (caretDimensions.height && caretDimensions.width) {
|
|
16193
|
-
buildTooltipCaret(tooltipDiv, tooltipDimensions, caretDimensions
|
|
16218
|
+
buildTooltipCaret(tooltipDiv, tooltipDimensions, caretDimensions);
|
|
16194
16219
|
}
|
|
16195
16220
|
var inheritedZIndex = TOOLTIP_CONSTANTS.Z_INDEX.DEFAULT;
|
|
16196
16221
|
if (guideContainer && guideContainer.style && guideContainer.style['z-index']) {
|
|
@@ -16250,8 +16275,21 @@ var BuildingBlockTooltips = (function () {
|
|
|
16250
16275
|
else if (tooltipDimensions.layoutDir === 'left') {
|
|
16251
16276
|
tooltipDimensions.left -= caretSizes.height;
|
|
16252
16277
|
}
|
|
16278
|
+
if (caretSizes.height && caretSizes.width) {
|
|
16279
|
+
populateCaretStyleMaps(tooltipDimensions, caretSizes, elementPos);
|
|
16280
|
+
}
|
|
16253
16281
|
return tooltipDimensions;
|
|
16254
16282
|
}
|
|
16283
|
+
function populateCaretStyleMaps(tooltipDimensions, caretSizes, elementPos) {
|
|
16284
|
+
tooltipDimensions.caret = {};
|
|
16285
|
+
if (tooltipDimensions.layoutDir === 'top' || tooltipDimensions.layoutDir === 'bottom') {
|
|
16286
|
+
_.extend(tooltipDimensions.caret, buildTopOrBottomCaretStyleMap(tooltipDimensions, caretSizes, elementPos));
|
|
16287
|
+
}
|
|
16288
|
+
if (tooltipDimensions.layoutDir === 'left' || tooltipDimensions.layoutDir === 'right') {
|
|
16289
|
+
_.extend(tooltipDimensions.caret, buildLeftOrRightCaretStyleMap(tooltipDimensions, caretSizes));
|
|
16290
|
+
}
|
|
16291
|
+
tooltipDimensions.caretBorder = buildBorderCaretStyleMap(tooltipDimensions.caret, caretSizes, tooltipDimensions.layoutDir);
|
|
16292
|
+
}
|
|
16255
16293
|
function calculateVwRelativeToLayoutDir(guideContainer, tooltipContext) {
|
|
16256
16294
|
const { elementPos, tooltipSizes, screenDimensions, caretDimensions, elementIsNotVisible } = tooltipContext;
|
|
16257
16295
|
const caretFullWidth = (parseInt(caretDimensions.width, 10) || 0);
|
|
@@ -16481,51 +16519,51 @@ var BuildingBlockTooltips = (function () {
|
|
|
16481
16519
|
caretDiv.setAttribute('class', 'pendo-tooltip-caret pendo-tooltip-caret--' + tooltipDimensions.layoutDir);
|
|
16482
16520
|
caretDiv.style.position = 'absolute';
|
|
16483
16521
|
caretDiv.style.zIndex = TOOLTIP_CONSTANTS.Z_INDEX.CARET;
|
|
16484
|
-
updateCaretStyles(caretDiv, tooltipDimensions
|
|
16522
|
+
updateCaretStyles(caretDiv, tooltipDimensions.caret);
|
|
16485
16523
|
var guideDiv = tooltipDiv.find('#pendo-guide-container')[0].parentNode;
|
|
16486
16524
|
guideDiv.appendChild(caretDiv);
|
|
16487
16525
|
if (!caretDimensions.borderWidth)
|
|
16488
16526
|
return;
|
|
16489
|
-
var borderCaret = buildBorderCaret(caretDiv,
|
|
16527
|
+
var borderCaret = buildBorderCaret(caretDiv, tooltipDimensions);
|
|
16490
16528
|
guideDiv.appendChild(borderCaret);
|
|
16491
16529
|
}
|
|
16492
|
-
function updateCaretStyles(caretDiv,
|
|
16493
|
-
|
|
16494
|
-
styleTopOrBottomCaret(caretDiv, tooltipDimensions, caretDimensions, elementPos);
|
|
16495
|
-
}
|
|
16496
|
-
if (tooltipDimensions.layoutDir === 'left' || tooltipDimensions.layoutDir === 'right') {
|
|
16497
|
-
styleLeftOrRightCaret(caretDiv, tooltipDimensions, caretDimensions);
|
|
16498
|
-
}
|
|
16530
|
+
function updateCaretStyles(caretDiv, caretStyleMap) {
|
|
16531
|
+
_.extend(caretDiv.style, caretStyleMap);
|
|
16499
16532
|
}
|
|
16500
16533
|
function styleTopOrBottomCaret(caret, tooltipDimensions, caretDimensions, elementPos) {
|
|
16501
|
-
caret.style
|
|
16502
|
-
caret
|
|
16503
|
-
|
|
16534
|
+
_.extend(caret.style, buildTopOrBottomCaretStyleMap(tooltipDimensions, caretDimensions, elementPos));
|
|
16535
|
+
return caret;
|
|
16536
|
+
}
|
|
16537
|
+
function buildTopOrBottomCaretStyleMap(tooltipDimensions, caretDimensions, elementPos) {
|
|
16538
|
+
var styleMap = {};
|
|
16539
|
+
styleMap['border-left'] = caretDimensions.width + 'px solid transparent';
|
|
16540
|
+
styleMap['border-right'] = caretDimensions.width + 'px solid transparent';
|
|
16541
|
+
styleMap.right = '';
|
|
16504
16542
|
const caretOffset = calculateCaretOffset(elementPos, tooltipDimensions, caretDimensions, tooltipDimensions.hbias);
|
|
16505
|
-
|
|
16543
|
+
styleMap.left = caretOffset + 'px';
|
|
16506
16544
|
// Tooltip is below element, put caret on the top of the tooltip
|
|
16507
16545
|
if (tooltipDimensions.layoutDir === 'bottom') {
|
|
16508
|
-
|
|
16509
|
-
|
|
16546
|
+
styleMap['border-bottom'] = caretDimensions.height + 'px solid ' + caretDimensions.backgroundColor;
|
|
16547
|
+
styleMap['border-top'] = '';
|
|
16510
16548
|
var caretTop = -1 * caretDimensions.height;
|
|
16511
16549
|
if (caretDimensions.borderWidth) {
|
|
16512
16550
|
caretTop = caretTop + caretDimensions.borderWidth;
|
|
16513
16551
|
}
|
|
16514
|
-
|
|
16515
|
-
|
|
16552
|
+
styleMap.top = caretTop + 'px';
|
|
16553
|
+
styleMap.bottom = '';
|
|
16516
16554
|
}
|
|
16517
16555
|
// Tooltip is above element, put caret on the bottom of the tooltip
|
|
16518
16556
|
if (tooltipDimensions.layoutDir === 'top') {
|
|
16519
|
-
|
|
16520
|
-
|
|
16557
|
+
styleMap['border-top'] = caretDimensions.height + 'px solid ' + caretDimensions.backgroundColor;
|
|
16558
|
+
styleMap['border-bottom'] = '';
|
|
16521
16559
|
var caretBottom = -1 * caretDimensions.height;
|
|
16522
16560
|
if (caretDimensions.borderWidth) {
|
|
16523
16561
|
caretBottom = caretBottom + caretDimensions.borderWidth;
|
|
16524
16562
|
}
|
|
16525
|
-
|
|
16526
|
-
|
|
16563
|
+
styleMap.bottom = caretBottom + 'px';
|
|
16564
|
+
styleMap.top = '';
|
|
16527
16565
|
}
|
|
16528
|
-
return
|
|
16566
|
+
return styleMap;
|
|
16529
16567
|
}
|
|
16530
16568
|
function calculateCaretOffset(elementPos, tooltipDimensions, caretDimensions, bias) {
|
|
16531
16569
|
if (elementPos && elementPos.left) {
|
|
@@ -16545,17 +16583,22 @@ var BuildingBlockTooltips = (function () {
|
|
|
16545
16583
|
}
|
|
16546
16584
|
}
|
|
16547
16585
|
function styleLeftOrRightCaret(caret, tooltipDimensions, caretDimensions) {
|
|
16586
|
+
_.extend(caret.style, buildLeftOrRightCaretStyleMap(tooltipDimensions, caretDimensions));
|
|
16587
|
+
return caret;
|
|
16588
|
+
}
|
|
16589
|
+
function buildLeftOrRightCaretStyleMap(tooltipDimensions, caretDimensions) {
|
|
16548
16590
|
var screenDimensions = getScreenDimensions();
|
|
16549
|
-
|
|
16550
|
-
|
|
16551
|
-
|
|
16591
|
+
var styleMap = {};
|
|
16592
|
+
styleMap['border-top'] = caretDimensions.width + 'px solid transparent';
|
|
16593
|
+
styleMap['border-bottom'] = caretDimensions.width + 'px solid transparent';
|
|
16594
|
+
styleMap.bottom = '';
|
|
16552
16595
|
if (tooltipDimensions.vbias === TOP) {
|
|
16553
16596
|
var maxArrowTop = tooltipDimensions.height - caretDimensions.width * 2 - caretDimensions.offset - caretDimensions.borderWidth;
|
|
16554
|
-
|
|
16597
|
+
styleMap.top = maxArrowTop + 'px';
|
|
16555
16598
|
tooltipDimensions.top += caretDimensions.offset + caretDimensions.width + caretDimensions.borderWidth;
|
|
16556
16599
|
}
|
|
16557
16600
|
else if (tooltipDimensions.vbias === BOTTOM) {
|
|
16558
|
-
|
|
16601
|
+
styleMap.top = (caretDimensions.offset + caretDimensions.borderWidth) + 'px';
|
|
16559
16602
|
tooltipDimensions.top -= caretDimensions.offset + caretDimensions.width + caretDimensions.borderWidth;
|
|
16560
16603
|
if (tooltipDimensions.top + tooltipDimensions.height > screenDimensions.height) {
|
|
16561
16604
|
tooltipDimensions.top = tooltipDimensions.top - (tooltipDimensions.top + tooltipDimensions.height - screenDimensions.height);
|
|
@@ -16563,40 +16606,64 @@ var BuildingBlockTooltips = (function () {
|
|
|
16563
16606
|
tooltipDimensions.top = Math.max(0, tooltipDimensions.top);
|
|
16564
16607
|
}
|
|
16565
16608
|
else { // ASSUME CENTER
|
|
16566
|
-
|
|
16609
|
+
styleMap.top = (tooltipDimensions.height / 2) - caretDimensions.width + 'px';
|
|
16567
16610
|
}
|
|
16568
16611
|
// Tooltip is to the left of the element, put caret on the right of the tooltip
|
|
16569
16612
|
if (tooltipDimensions.layoutDir === 'left') {
|
|
16570
|
-
|
|
16571
|
-
|
|
16613
|
+
styleMap['border-left'] = caretDimensions.height + 'px solid ' + caretDimensions.backgroundColor;
|
|
16614
|
+
styleMap['border-right'] = '';
|
|
16572
16615
|
var caretRight = -1 * caretDimensions.height;
|
|
16573
16616
|
if (caretDimensions.borderWidth) {
|
|
16574
16617
|
caretRight = caretRight + caretDimensions.borderWidth;
|
|
16575
16618
|
}
|
|
16576
|
-
|
|
16577
|
-
|
|
16619
|
+
styleMap.right = caretRight + 'px';
|
|
16620
|
+
styleMap.left = '';
|
|
16578
16621
|
}
|
|
16579
16622
|
// Tooltip is to the right of the element, put caret on the left of the tooltip
|
|
16580
16623
|
if (tooltipDimensions.layoutDir === 'right') {
|
|
16581
|
-
|
|
16582
|
-
|
|
16624
|
+
styleMap['border-right'] = caretDimensions.height + 'px solid ' + caretDimensions.backgroundColor;
|
|
16625
|
+
styleMap['border-left'] = '';
|
|
16583
16626
|
var caretLeft = -1 * caretDimensions.height;
|
|
16584
16627
|
if (caretDimensions.borderWidth) {
|
|
16585
16628
|
caretLeft = caretLeft + caretDimensions.borderWidth;
|
|
16586
16629
|
}
|
|
16587
|
-
|
|
16588
|
-
|
|
16630
|
+
styleMap.left = caretLeft + 'px';
|
|
16631
|
+
styleMap.right = '';
|
|
16589
16632
|
}
|
|
16590
|
-
return
|
|
16633
|
+
return styleMap;
|
|
16591
16634
|
}
|
|
16592
|
-
function buildBorderCaret(caret,
|
|
16635
|
+
function buildBorderCaret(caret, tooltipDimensions) {
|
|
16593
16636
|
var borderCaret = caret.cloneNode();
|
|
16594
16637
|
borderCaret.setAttribute('class', 'pendo-tooltip-caret-border');
|
|
16595
16638
|
borderCaret.style.zIndex = TOOLTIP_CONSTANTS.Z_INDEX.BORDER_CARET;
|
|
16596
|
-
|
|
16639
|
+
updateCaretStyles(borderCaret, tooltipDimensions.caretBorder);
|
|
16597
16640
|
return borderCaret;
|
|
16598
16641
|
}
|
|
16599
|
-
function
|
|
16642
|
+
function borderColorFromCaretStyleMap(caretMap, borderColorKey, hyphenKey) {
|
|
16643
|
+
if (caretMap[borderColorKey]) {
|
|
16644
|
+
return caretMap[borderColorKey];
|
|
16645
|
+
}
|
|
16646
|
+
var shorthand = caretMap[hyphenKey];
|
|
16647
|
+
if (!shorthand) {
|
|
16648
|
+
return '';
|
|
16649
|
+
}
|
|
16650
|
+
if (/transparent/i.test(shorthand)) {
|
|
16651
|
+
return 'transparent';
|
|
16652
|
+
}
|
|
16653
|
+
var solidIdx = shorthand.indexOf('solid');
|
|
16654
|
+
if (solidIdx === -1) {
|
|
16655
|
+
return '';
|
|
16656
|
+
}
|
|
16657
|
+
return shorthand.slice(solidIdx + 5).trim();
|
|
16658
|
+
}
|
|
16659
|
+
function borderWidthFromCaretStyleMap(caretMap, borderWidthKey, hyphenKey) {
|
|
16660
|
+
if (caretMap[borderWidthKey]) {
|
|
16661
|
+
return parseInt(caretMap[borderWidthKey], 10) || 0;
|
|
16662
|
+
}
|
|
16663
|
+
var shorthand = caretMap[hyphenKey];
|
|
16664
|
+
return shorthand ? (parseInt(shorthand, 10) || 0) : 0;
|
|
16665
|
+
}
|
|
16666
|
+
function buildBorderCaretStyleMap(caretMap, caretDimensions, tooltipLayoutDirection) {
|
|
16600
16667
|
var borderStyles = {
|
|
16601
16668
|
top: '',
|
|
16602
16669
|
right: '',
|
|
@@ -16605,12 +16672,15 @@ var BuildingBlockTooltips = (function () {
|
|
|
16605
16672
|
};
|
|
16606
16673
|
var borderDirections = ['Top', 'Right', 'Bottom', 'Left'];
|
|
16607
16674
|
for (var i = 0; i < borderDirections.length; i++) {
|
|
16608
|
-
var
|
|
16609
|
-
var
|
|
16610
|
-
var
|
|
16611
|
-
|
|
16612
|
-
|
|
16613
|
-
|
|
16675
|
+
var side = borderDirections[i];
|
|
16676
|
+
var borderWidthKey = 'border' + side + 'Width';
|
|
16677
|
+
var borderColorKey = 'border' + side + 'Color';
|
|
16678
|
+
var borderStyleKey = 'border' + side + 'Style';
|
|
16679
|
+
var hyphenKey = HYPHEN_BORDER_BY_SIDE[side];
|
|
16680
|
+
var widthVal = borderWidthFromCaretStyleMap(caretMap, borderWidthKey, hyphenKey);
|
|
16681
|
+
if (widthVal) {
|
|
16682
|
+
borderStyles[borderWidthKey] = widthVal + caretDimensions.borderWidth + 'px';
|
|
16683
|
+
borderStyles[borderColorKey] = determineBorderCaretColor(borderColorFromCaretStyleMap(caretMap, borderColorKey, hyphenKey), caretDimensions.borderColor);
|
|
16614
16684
|
borderStyles[borderStyleKey] = 'solid';
|
|
16615
16685
|
}
|
|
16616
16686
|
else {
|
|
@@ -16619,27 +16689,28 @@ var BuildingBlockTooltips = (function () {
|
|
|
16619
16689
|
borderStyles[borderStyleKey] = '';
|
|
16620
16690
|
}
|
|
16621
16691
|
}
|
|
16692
|
+
var bw = caretDimensions.borderWidth;
|
|
16622
16693
|
// Tooltip is above element, border moves further down
|
|
16623
16694
|
if (tooltipLayoutDirection === 'top') {
|
|
16624
|
-
borderStyles.left = parseInt(
|
|
16625
|
-
borderStyles.bottom = parseInt(
|
|
16695
|
+
borderStyles.left = parseInt(caretMap.left, 10) - bw + 'px';
|
|
16696
|
+
borderStyles.bottom = parseInt(caretMap.bottom, 10) - bw + 'px';
|
|
16626
16697
|
}
|
|
16627
16698
|
// Tooltip is below element, border moves further up
|
|
16628
16699
|
if (tooltipLayoutDirection === 'bottom') {
|
|
16629
|
-
borderStyles.left = parseInt(
|
|
16630
|
-
borderStyles.top = parseInt(
|
|
16700
|
+
borderStyles.left = parseInt(caretMap.left, 10) - bw + 'px';
|
|
16701
|
+
borderStyles.top = parseInt(caretMap.top, 10) - bw + 'px';
|
|
16631
16702
|
}
|
|
16632
16703
|
// Tooltip is to the right of the element, border moves further left
|
|
16633
16704
|
if (tooltipLayoutDirection === 'right') {
|
|
16634
|
-
borderStyles.top = parseInt(
|
|
16635
|
-
borderStyles.left = parseInt(
|
|
16705
|
+
borderStyles.top = parseInt(caretMap.top, 10) - bw + 'px';
|
|
16706
|
+
borderStyles.left = parseInt(caretMap.left, 10) - bw + 'px';
|
|
16636
16707
|
}
|
|
16637
16708
|
// Tooltip is to the left of the element, border moves further right
|
|
16638
16709
|
if (tooltipLayoutDirection === 'left') {
|
|
16639
|
-
borderStyles.top = parseInt(
|
|
16640
|
-
borderStyles.right = parseInt(
|
|
16710
|
+
borderStyles.top = parseInt(caretMap.top, 10) - bw + 'px';
|
|
16711
|
+
borderStyles.right = parseInt(caretMap.right, 10) - bw + 'px';
|
|
16641
16712
|
}
|
|
16642
|
-
|
|
16713
|
+
return borderStyles;
|
|
16643
16714
|
}
|
|
16644
16715
|
function determineBorderCaretColor(currentColor, borderColor) {
|
|
16645
16716
|
if (currentColor === 'transparent')
|
|
@@ -16690,10 +16761,10 @@ var BuildingBlockTooltips = (function () {
|
|
|
16690
16761
|
var caretDiv = ttdiv.find('.pendo-tooltip-caret')[0];
|
|
16691
16762
|
var borderCaret = ttdiv.find('.pendo-tooltip-caret-border')[0];
|
|
16692
16763
|
if (caretDiv) {
|
|
16693
|
-
updateCaretStyles(caretDiv, tooltipDimensions
|
|
16764
|
+
updateCaretStyles(caretDiv, tooltipDimensions.caret);
|
|
16694
16765
|
}
|
|
16695
16766
|
if (borderCaret) {
|
|
16696
|
-
|
|
16767
|
+
updateCaretStyles(borderCaret, tooltipDimensions.caretBorder);
|
|
16697
16768
|
}
|
|
16698
16769
|
}
|
|
16699
16770
|
// we can update the tooltipDimensions.top and tooltipDimensions.left now
|
|
@@ -17756,7 +17827,7 @@ function buildNodeFromJSON(json, step, guides) {
|
|
|
17756
17827
|
}
|
|
17757
17828
|
else if (propKey === 'data-pendo-code-block' && propValue === true && !ConfigReader.get('preventCodeInjection')) {
|
|
17758
17829
|
const htmlString = step.getContent();
|
|
17759
|
-
if (trim.call(htmlString).length === 0)
|
|
17830
|
+
if (!htmlString || trim.call(htmlString).length === 0)
|
|
17760
17831
|
return;
|
|
17761
17832
|
curNode.addClass('pendo-code-block').html(htmlString);
|
|
17762
17833
|
}
|
|
@@ -23757,11 +23828,32 @@ const captureStepRenderStatus = (step, eligible, reason) => {
|
|
|
23757
23828
|
Events.stepEligibility.trigger({ stepId: id, guideId, eligible, reason });
|
|
23758
23829
|
return eligible;
|
|
23759
23830
|
};
|
|
23831
|
+
function isHtmlTooltipStep(step) {
|
|
23832
|
+
if (_.get(step, 'attributes.buildingBlockLayoutType') !== 'tooltip')
|
|
23833
|
+
return false;
|
|
23834
|
+
return Boolean(_.get(step, 'attributes.htmlContent') || step.htmlContent || step.htmlContentUrl);
|
|
23835
|
+
}
|
|
23836
|
+
function getHtmlTooltipSelector(step) {
|
|
23837
|
+
return step.elementPathRule || _.get(step, 'attributes.elementPathRule');
|
|
23838
|
+
}
|
|
23760
23839
|
var canStepBeRendered = function (step) {
|
|
23761
23840
|
const statusWriter = _.partial(captureStepRenderStatus, step);
|
|
23762
23841
|
if (isDismissedUntilReload(step)) {
|
|
23763
23842
|
return statusWriter(false, 'dismissed');
|
|
23764
23843
|
}
|
|
23844
|
+
// HTML guide tooltips don't set step.type === 'tooltip' (they keep the
|
|
23845
|
+
// guide-level type, typically 'lightbox') and don't have step.domJson, so
|
|
23846
|
+
// the standard tooltip detection below misses them. Without filtering here,
|
|
23847
|
+
// an HTML tooltip with a missing or invisible anchor sails through eligibility
|
|
23848
|
+
// and silently falls back to a lightbox layout at render time.
|
|
23849
|
+
if (isHtmlTooltipStep(step)) {
|
|
23850
|
+
var htmlSelector = getHtmlTooltipSelector(step);
|
|
23851
|
+
var htmlAnchor = htmlSelector ? SizzleProxy(htmlSelector)[0] : null;
|
|
23852
|
+
if (isElementVisible(htmlAnchor)) {
|
|
23853
|
+
return statusWriter(true, 'target_element_html_tooltip');
|
|
23854
|
+
}
|
|
23855
|
+
return statusWriter(wouldBeVisibleAfterAutoScroll(htmlAnchor), 'target_element_html_tooltip_scroll');
|
|
23856
|
+
}
|
|
23765
23857
|
if (!step.elementPathRule && (step.type === 'lightbox' || step.type === 'whatsnew')) {
|
|
23766
23858
|
return statusWriter(true, '');
|
|
23767
23859
|
}
|
|
@@ -25765,7 +25857,7 @@ function createPreviewBar() {
|
|
|
25765
25857
|
var script = document.createElement('script');
|
|
25766
25858
|
script.src = getPreviewModeAssetUrl();
|
|
25767
25859
|
script.onload = function () {
|
|
25768
|
-
var whiteLabelSettings =
|
|
25860
|
+
var whiteLabelSettings = getWhiteLabelSettings(findStoredPreviewConfig());
|
|
25769
25861
|
if (whiteLabelSettings && frame.contentWindow) {
|
|
25770
25862
|
frame.contentWindow.postMessage({
|
|
25771
25863
|
mutation: 'preview/setWhiteLabelSettings',
|
|
@@ -25904,6 +25996,19 @@ function sendPreviewModeFailureMessage(document, errorObj) {
|
|
|
25904
25996
|
}
|
|
25905
25997
|
}, location.origin);
|
|
25906
25998
|
}
|
|
25999
|
+
function getWhiteLabelSettings(config) {
|
|
26000
|
+
var whiteLabelSettings = ConfigReader.get('whiteLabelSettings');
|
|
26001
|
+
if (!whiteLabelSettings && config && config.ux === 'novus') {
|
|
26002
|
+
whiteLabelSettings = {
|
|
26003
|
+
logoUrl: 'https://novus.pendo.io/novus-square-icon.svg',
|
|
26004
|
+
logoStyle: {
|
|
26005
|
+
maxWidth: '40px',
|
|
26006
|
+
maxHeight: '40px'
|
|
26007
|
+
}
|
|
26008
|
+
};
|
|
26009
|
+
}
|
|
26010
|
+
return whiteLabelSettings;
|
|
26011
|
+
}
|
|
25907
26012
|
function updatePreview(document, activeGuides, lastGuideStepSeen) {
|
|
25908
26013
|
if (!isInPreviewMode())
|
|
25909
26014
|
return;
|
|
@@ -25958,7 +26063,7 @@ function updatePreview(document, activeGuides, lastGuideStepSeen) {
|
|
|
25958
26063
|
hostname: SERVER
|
|
25959
26064
|
}
|
|
25960
26065
|
}, location.origin);
|
|
25961
|
-
var whiteLabelSettings =
|
|
26066
|
+
var whiteLabelSettings = getWhiteLabelSettings(config);
|
|
25962
26067
|
if (whiteLabelSettings) {
|
|
25963
26068
|
previewFrame.contentWindow.postMessage({
|
|
25964
26069
|
mutation: 'preview/setWhiteLabelSettings',
|
|
@@ -28384,12 +28489,22 @@ function registerPlugin(plugin) {
|
|
|
28384
28489
|
}
|
|
28385
28490
|
registeredPlugins.push(plugin);
|
|
28386
28491
|
if (initialized$1) {
|
|
28387
|
-
|
|
28492
|
+
try {
|
|
28493
|
+
plugin.initialize(pendo$1, PluginAPI);
|
|
28494
|
+
}
|
|
28495
|
+
catch (error) {
|
|
28496
|
+
log.error(`Error initializing plugin ${plugin.name}:`, error);
|
|
28497
|
+
}
|
|
28388
28498
|
}
|
|
28389
28499
|
}
|
|
28390
28500
|
function initializePlugins() {
|
|
28391
28501
|
_.each(registeredPlugins, function (plugin) {
|
|
28392
|
-
|
|
28502
|
+
try {
|
|
28503
|
+
plugin.initialize(pendo$1, PluginAPI);
|
|
28504
|
+
}
|
|
28505
|
+
catch (error) {
|
|
28506
|
+
log.error(`Error initializing plugin ${plugin.name}:`, error);
|
|
28507
|
+
}
|
|
28393
28508
|
});
|
|
28394
28509
|
initialized$1 = true;
|
|
28395
28510
|
return teardownPlugins;
|
|
@@ -28397,7 +28512,12 @@ function initializePlugins() {
|
|
|
28397
28512
|
function teardownPlugins() {
|
|
28398
28513
|
_.each(registeredPlugins, function (plugin) {
|
|
28399
28514
|
if (_.isFunction(plugin.teardown)) {
|
|
28400
|
-
|
|
28515
|
+
try {
|
|
28516
|
+
plugin.teardown(pendo$1, PluginAPI);
|
|
28517
|
+
}
|
|
28518
|
+
catch (error) {
|
|
28519
|
+
log.error(`Error tearing down plugin ${plugin.name}:`, error);
|
|
28520
|
+
}
|
|
28401
28521
|
}
|
|
28402
28522
|
});
|
|
28403
28523
|
initialized$1 = false;
|
|
@@ -28405,7 +28525,12 @@ function teardownPlugins() {
|
|
|
28405
28525
|
function validatePlugins(skipLogging) {
|
|
28406
28526
|
return _.map(registeredPlugins, function (plugin) {
|
|
28407
28527
|
if (plugin.validate && !skipLogging) {
|
|
28408
|
-
|
|
28528
|
+
try {
|
|
28529
|
+
plugin.validate(pendo$1, PluginAPI);
|
|
28530
|
+
}
|
|
28531
|
+
catch (error) {
|
|
28532
|
+
log.error(`Error validating plugin ${plugin.name}:`, error);
|
|
28533
|
+
}
|
|
28409
28534
|
}
|
|
28410
28535
|
return plugin.name;
|
|
28411
28536
|
});
|
|
@@ -29139,11 +29264,18 @@ function teardown() {
|
|
|
29139
29264
|
try {
|
|
29140
29265
|
Events.appHidden.trigger();
|
|
29141
29266
|
Events.appUnloaded.trigger();
|
|
29142
|
-
|
|
29143
|
-
teardownFn
|
|
29144
|
-
|
|
29267
|
+
try {
|
|
29268
|
+
_.each(teardownFns, function (teardownFn) {
|
|
29269
|
+
teardownFn();
|
|
29270
|
+
});
|
|
29271
|
+
}
|
|
29272
|
+
finally {
|
|
29273
|
+
// Always drain the registered teardown fns even if one throws;
|
|
29274
|
+
// otherwise a single bad teardown leaves stale entries that
|
|
29275
|
+
// would be re-invoked on the next initialize/teardown cycle.
|
|
29276
|
+
teardownFns.length = 0;
|
|
29277
|
+
}
|
|
29145
29278
|
pageLoad.reset();
|
|
29146
|
-
teardownFns.length = 0;
|
|
29147
29279
|
SingletonMessageHandler.close();
|
|
29148
29280
|
Eventable.clear(Events);
|
|
29149
29281
|
Eventable.clear(PublicEvents);
|
|
@@ -40715,19 +40847,17 @@ function TextCapture() {
|
|
|
40715
40847
|
}
|
|
40716
40848
|
}
|
|
40717
40849
|
|
|
40718
|
-
|
|
40719
|
-
|
|
40720
|
-
|
|
40721
|
-
|
|
40722
|
-
|
|
40723
|
-
function lookupGuideButtons(domJson, buttons) {
|
|
40724
|
-
if (buttons === void 0) { buttons = []; }
|
|
40850
|
+
const substitutionRegex = '\\{(?:\\s?)([^.\\s]?visitor|account|parentAccount)\\.([^|\\s/]*)(?:\\s?\\|\\s?([^}]+|[\\/s]+))?(?:\\s?\\/\\s?){1}\\}';
|
|
40851
|
+
const skipStepString = '{skipStep:* *(auto|\\d+)\\/}';
|
|
40852
|
+
const goToMiddleString = '(?!0)(\\d+)';
|
|
40853
|
+
const goToString = `({goto-${goToMiddleString}\\/})`;
|
|
40854
|
+
const containerSelector = '[id^="pendo-guide-container"]';
|
|
40855
|
+
function lookupGuideButtons(domJson, buttons = []) {
|
|
40725
40856
|
if (domJson.type === 'button' && domJson.actions) {
|
|
40726
40857
|
buttons.push(domJson);
|
|
40727
40858
|
}
|
|
40728
40859
|
if (domJson.children) {
|
|
40729
|
-
for (
|
|
40730
|
-
var child = _a[_i];
|
|
40860
|
+
for (const child of domJson.children) {
|
|
40731
40861
|
lookupGuideButtons(child, buttons);
|
|
40732
40862
|
}
|
|
40733
40863
|
}
|
|
@@ -40756,16 +40886,15 @@ function removeMarkdownSyntax(element, textToReplace, replacementText, pendo) {
|
|
|
40756
40886
|
}
|
|
40757
40887
|
}
|
|
40758
40888
|
var guideMarkdownUtil = {
|
|
40759
|
-
substitutionRegex
|
|
40760
|
-
skipStepString
|
|
40761
|
-
goToString
|
|
40762
|
-
containerSelector
|
|
40763
|
-
lookupGuideButtons
|
|
40764
|
-
removeMarkdownSyntax
|
|
40889
|
+
substitutionRegex,
|
|
40890
|
+
skipStepString,
|
|
40891
|
+
goToString,
|
|
40892
|
+
containerSelector,
|
|
40893
|
+
lookupGuideButtons,
|
|
40894
|
+
removeMarkdownSyntax
|
|
40765
40895
|
};
|
|
40766
40896
|
|
|
40767
|
-
function getZoneSafeMethod(_, method, target) {
|
|
40768
|
-
if (target === void 0) { target = window; }
|
|
40897
|
+
function getZoneSafeMethod(_, method, target = window) {
|
|
40769
40898
|
var zoneSymbol = '__symbol__';
|
|
40770
40899
|
/* global Zone */
|
|
40771
40900
|
if (typeof Zone !== 'undefined' && _.isFunction(Zone[zoneSymbol])) {
|
|
@@ -40778,20 +40907,20 @@ function getZoneSafeMethod(_, method, target) {
|
|
|
40778
40907
|
}
|
|
40779
40908
|
|
|
40780
40909
|
// Does not support submit and go to
|
|
40781
|
-
|
|
40782
|
-
|
|
40910
|
+
const goToRegex = new RegExp(guideMarkdownUtil.goToString);
|
|
40911
|
+
const PollBranching = {
|
|
40783
40912
|
name: 'PollBranching',
|
|
40784
|
-
script
|
|
40785
|
-
|
|
40786
|
-
|
|
40913
|
+
script(step, guide, pendo) {
|
|
40914
|
+
let isAdvanceIntercepted = false;
|
|
40915
|
+
const branchingQuestions = initialBranchingSetup(step, pendo);
|
|
40787
40916
|
if (branchingQuestions) {
|
|
40788
40917
|
// If there are too many branching questions saved, exit and run the guide normally.
|
|
40789
40918
|
if (pendo._.size(branchingQuestions) > 1)
|
|
40790
40919
|
return;
|
|
40791
|
-
this.on('beforeAdvance',
|
|
40792
|
-
|
|
40793
|
-
|
|
40794
|
-
|
|
40920
|
+
this.on('beforeAdvance', (evt) => {
|
|
40921
|
+
const noResponseSelected = step.guideElement.find('[branching] .pendo-radio:checked').length === 0;
|
|
40922
|
+
const responseLabel = step.guideElement.find('[branching] .pendo-radio:checked + label')[0];
|
|
40923
|
+
let noGotoLabel;
|
|
40795
40924
|
if (responseLabel) {
|
|
40796
40925
|
noGotoLabel = pendo._.isNull(responseLabel.getAttribute('goToStep'));
|
|
40797
40926
|
}
|
|
@@ -40802,58 +40931,58 @@ var PollBranching = {
|
|
|
40802
40931
|
});
|
|
40803
40932
|
}
|
|
40804
40933
|
},
|
|
40805
|
-
test
|
|
40934
|
+
test(step, guide, pendo) {
|
|
40806
40935
|
var _a;
|
|
40807
|
-
|
|
40936
|
+
let branchingQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
|
|
40808
40937
|
return !pendo._.isUndefined(branchingQuestions) && pendo._.size(branchingQuestions);
|
|
40809
40938
|
},
|
|
40810
|
-
designerListener
|
|
40811
|
-
|
|
40812
|
-
|
|
40939
|
+
designerListener(pendo) {
|
|
40940
|
+
const target = pendo.dom.getBody();
|
|
40941
|
+
const config = {
|
|
40813
40942
|
attributeFilter: ['data-layout'],
|
|
40814
40943
|
attributes: true,
|
|
40815
40944
|
childList: true,
|
|
40816
40945
|
characterData: true,
|
|
40817
40946
|
subtree: true
|
|
40818
40947
|
};
|
|
40819
|
-
|
|
40820
|
-
|
|
40948
|
+
const MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
|
|
40949
|
+
const observer = new MutationObserver(applyBranchingIndicators);
|
|
40821
40950
|
observer.observe(target, config);
|
|
40822
40951
|
function applyBranchingIndicators(mutations) {
|
|
40823
40952
|
pendo._.each(mutations, function (mutation) {
|
|
40824
40953
|
var _a;
|
|
40825
|
-
|
|
40954
|
+
const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelector);
|
|
40826
40955
|
if (mutation.addedNodes.length && nodeHasQuerySelector) {
|
|
40827
40956
|
if (mutation.addedNodes[0].querySelector('._pendo-multi-choice-poll-select-border')) {
|
|
40828
40957
|
if (pendo._.size(pendo.dom('._pendo-multi-choice-poll-question:contains("{branching/}")'))) {
|
|
40829
40958
|
pendo
|
|
40830
40959
|
.dom('._pendo-multi-choice-poll-question:contains("{branching/}")')
|
|
40831
|
-
.each(
|
|
40832
|
-
pendo._.each(pendo.dom(
|
|
40960
|
+
.each((question, index) => {
|
|
40961
|
+
pendo._.each(pendo.dom(`#${question.id} *`), (element) => {
|
|
40833
40962
|
guideMarkdownUtil.removeMarkdownSyntax(element, '{branching/}', '', pendo);
|
|
40834
40963
|
});
|
|
40835
40964
|
pendo
|
|
40836
|
-
.dom(
|
|
40965
|
+
.dom(`#${question.id} p`)
|
|
40837
40966
|
.css({ display: 'inline-block !important' })
|
|
40838
40967
|
.append(branchingIcon('#999', '20px'))
|
|
40839
40968
|
.attr({ title: 'Custom Branching Added' });
|
|
40840
|
-
|
|
40841
|
-
if (pendo.dom(
|
|
40969
|
+
let dataPendoPollId = question.getAttribute('data-pendo-poll-id');
|
|
40970
|
+
if (pendo.dom(`._pendo-multi-choice-poll-question[data-pendo-poll-id=${dataPendoPollId}]`)[0]) {
|
|
40842
40971
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
40843
40972
|
pendo
|
|
40844
|
-
.dom(
|
|
40973
|
+
.dom(`._pendo-multi-choice-poll-question[data-pendo-poll-id=${dataPendoPollId}]`)[0]
|
|
40845
40974
|
.textContent.trim();
|
|
40846
40975
|
}
|
|
40847
|
-
|
|
40976
|
+
let pollLabels = pendo.dom(`label[for*=${dataPendoPollId}]`);
|
|
40848
40977
|
if (pendo._.size(pollLabels)) {
|
|
40849
|
-
pendo._.forEach(pollLabels,
|
|
40978
|
+
pendo._.forEach(pollLabels, (label) => {
|
|
40850
40979
|
if (goToRegex.test(label.textContent)) {
|
|
40851
|
-
|
|
40980
|
+
let labelTitle = goToRegex.exec(label.textContent)[2];
|
|
40852
40981
|
guideMarkdownUtil.removeMarkdownSyntax(label, goToRegex, '', pendo);
|
|
40853
40982
|
pendo
|
|
40854
40983
|
.dom(label)
|
|
40855
40984
|
.append(branchingIcon('#999', '14px'))
|
|
40856
|
-
.attr({ title:
|
|
40985
|
+
.attr({ title: `Branching to step ${labelTitle}` });
|
|
40857
40986
|
}
|
|
40858
40987
|
});
|
|
40859
40988
|
}
|
|
@@ -40861,9 +40990,9 @@ var PollBranching = {
|
|
|
40861
40990
|
pendo
|
|
40862
40991
|
.dom(question)
|
|
40863
40992
|
.append(branchingErrorHTML(question.dataset.pendoPollId));
|
|
40864
|
-
pendo.dom(
|
|
40993
|
+
pendo.dom(`#${question.id} #pendo-ps-branching-svg`).remove();
|
|
40865
40994
|
pendo
|
|
40866
|
-
.dom(
|
|
40995
|
+
.dom(`#${question.id} p`)
|
|
40867
40996
|
.css({ display: 'inline-block !important' })
|
|
40868
40997
|
.append(branchingIcon('red', '20px'))
|
|
40869
40998
|
.attr({ title: 'Unsupported Branching configuration' });
|
|
@@ -40875,31 +41004,49 @@ var PollBranching = {
|
|
|
40875
41004
|
});
|
|
40876
41005
|
}
|
|
40877
41006
|
function branchingErrorHTML(dataPendoPollId) {
|
|
40878
|
-
return
|
|
41007
|
+
return `<div style="text-align:lrft; font-size: 14px; color: red;
|
|
41008
|
+
font-style: italic; margin-top: 0px;" class="branching-wrapper"
|
|
41009
|
+
name="${dataPendoPollId}">
|
|
41010
|
+
* Branching Error: Multiple branching polls not supported</div>`;
|
|
40879
41011
|
}
|
|
40880
41012
|
function branchingIcon(color, size) {
|
|
40881
|
-
return
|
|
41013
|
+
return `<svg id="pendo-ps-branching-svg" viewBox="0 0 24 24" fill="none"
|
|
41014
|
+
style="margin-left: 5px;
|
|
41015
|
+
height:${size}; width:${size}; display:inline; vertical-align:middle;" xmlns="http://www.w3.org/2000/svg">
|
|
41016
|
+
<g stroke-width="0"></g>
|
|
41017
|
+
<g stroke-linecap="round" stroke-linejoin="round"></g>
|
|
41018
|
+
<g> <circle cx="4" cy="7" r="2" stroke="${color}"
|
|
41019
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></circle>
|
|
41020
|
+
<circle cx="20" cy="7" r="2" stroke="${color}"
|
|
41021
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></circle>
|
|
41022
|
+
<circle cx="20" cy="17" r="2" stroke="${color}" stroke-width="2"
|
|
41023
|
+
stroke-linecap="round" stroke-linejoin="round"></circle>
|
|
41024
|
+
<path d="M18 7H6" stroke="${color}" stroke-width="2"
|
|
41025
|
+
stroke-linecap="round" stroke-linejoin="round"></path>
|
|
41026
|
+
<path d="M7 7V7C8.65685 7 10 8.34315 10 10V15C10 16.1046 10.8954 17 12 17H18"
|
|
41027
|
+
stroke="${color}" stroke-width="2" stroke-linecap="round"
|
|
41028
|
+
stroke-linejoin="round"></path> </g></svg>`;
|
|
40882
41029
|
}
|
|
40883
41030
|
}
|
|
40884
41031
|
};
|
|
40885
41032
|
function initialBranchingSetup(step, pendo) {
|
|
40886
|
-
|
|
40887
|
-
pendo._.forEach(questions,
|
|
40888
|
-
|
|
40889
|
-
pendo._.each(step.guideElement.find(
|
|
41033
|
+
const questions = step.guideElement.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
|
|
41034
|
+
pendo._.forEach(questions, (question) => {
|
|
41035
|
+
let dataPendoPollId = question.getAttribute('data-pendo-poll-id');
|
|
41036
|
+
pendo._.each(step.guideElement.find(`#${question.id} *`), (element) => {
|
|
40890
41037
|
guideMarkdownUtil.removeMarkdownSyntax(element, '{branching/}', '', pendo);
|
|
40891
41038
|
});
|
|
40892
|
-
|
|
40893
|
-
pendo._.forEach(pollLabels,
|
|
41039
|
+
let pollLabels = step.guideElement.find(`label[for*=${dataPendoPollId}]`);
|
|
41040
|
+
pendo._.forEach(pollLabels, (label) => {
|
|
40894
41041
|
if (pendo._.isNull(goToRegex.exec(label.textContent))) {
|
|
40895
41042
|
return;
|
|
40896
41043
|
}
|
|
40897
|
-
|
|
40898
|
-
|
|
41044
|
+
let gotoSubstring = goToRegex.exec(label.textContent)[1];
|
|
41045
|
+
let gotoIndex = goToRegex.exec(label.textContent)[2];
|
|
40899
41046
|
label.setAttribute('goToStep', gotoIndex);
|
|
40900
41047
|
guideMarkdownUtil.removeMarkdownSyntax(label, gotoSubstring, '', pendo);
|
|
40901
41048
|
});
|
|
40902
|
-
|
|
41049
|
+
let pollChoiceContainer = step.guideElement.find(`[data-pendo-poll-id=${dataPendoPollId}]._pendo-multi-choice-poll-select-border`);
|
|
40903
41050
|
if (pollChoiceContainer && pollChoiceContainer.length) {
|
|
40904
41051
|
pollChoiceContainer[0].setAttribute('branching', '');
|
|
40905
41052
|
}
|
|
@@ -40908,24 +41055,24 @@ function initialBranchingSetup(step, pendo) {
|
|
|
40908
41055
|
}
|
|
40909
41056
|
function branchingGoToStep(event, step, guide, pendo) {
|
|
40910
41057
|
var _a;
|
|
40911
|
-
|
|
40912
|
-
|
|
40913
|
-
|
|
40914
|
-
|
|
41058
|
+
let checkedPollInputId = (_a = step.guideElement.find('[branching] input.pendo-radio[data-pendo-poll-id]:checked')[0]) === null || _a === void 0 ? void 0 : _a.id;
|
|
41059
|
+
let checkedPollLabel = step.guideElement.find(`label[for="${checkedPollInputId}"]`)[0];
|
|
41060
|
+
let checkedPollLabelStepIndex = checkedPollLabel === null || checkedPollLabel === void 0 ? void 0 : checkedPollLabel.getAttribute('goToStep');
|
|
41061
|
+
let pollStepIndex = checkedPollLabelStepIndex - 1;
|
|
40915
41062
|
if (pollStepIndex < 0)
|
|
40916
41063
|
return;
|
|
40917
|
-
|
|
41064
|
+
const destinationObject = {
|
|
40918
41065
|
destinationStepId: guide.steps[pollStepIndex].id,
|
|
40919
|
-
step
|
|
41066
|
+
step
|
|
40920
41067
|
};
|
|
40921
41068
|
pendo.goToStep(destinationObject);
|
|
40922
41069
|
event.cancel = true;
|
|
40923
41070
|
}
|
|
40924
41071
|
|
|
40925
|
-
|
|
41072
|
+
const MetadataSubstitution = {
|
|
40926
41073
|
name: 'MetadataSubstitution',
|
|
40927
|
-
script
|
|
40928
|
-
|
|
41074
|
+
script(step, guide, pendo) {
|
|
41075
|
+
const placeholderData = findSubstitutableElements(pendo);
|
|
40929
41076
|
if (step.domJson) {
|
|
40930
41077
|
findSubstitutableUrlsInJson(step.domJson, placeholderData, pendo);
|
|
40931
41078
|
}
|
|
@@ -40933,22 +41080,22 @@ var MetadataSubstitution = {
|
|
|
40933
41080
|
pendo._.each(placeholderData, function (placeholder) {
|
|
40934
41081
|
processPlaceholder(placeholder, pendo);
|
|
40935
41082
|
});
|
|
40936
|
-
|
|
40937
|
-
|
|
40938
|
-
updateGuideContainer(containerId,
|
|
41083
|
+
const containerId = `pendo-g-${step.id}`;
|
|
41084
|
+
const context = step.guideElement;
|
|
41085
|
+
updateGuideContainer(containerId, context, pendo);
|
|
40939
41086
|
}
|
|
40940
41087
|
},
|
|
40941
|
-
designerListener
|
|
40942
|
-
|
|
41088
|
+
designerListener(pendo) {
|
|
41089
|
+
const target = pendo.dom.getBody();
|
|
40943
41090
|
if (pendo.designerv2) {
|
|
40944
41091
|
pendo.designerv2.runMetadataSubstitutionForDesignerPreview = function runMetadataSubstitutionForDesignerPreview() {
|
|
40945
41092
|
var _a;
|
|
40946
41093
|
if (!document.querySelector(guideMarkdownUtil.containerSelector))
|
|
40947
41094
|
return;
|
|
40948
|
-
|
|
41095
|
+
const step = (_a = pendo.designerv2.currentlyPreviewedGuide) === null || _a === void 0 ? void 0 : _a.steps[0];
|
|
40949
41096
|
if (!step)
|
|
40950
41097
|
return;
|
|
40951
|
-
|
|
41098
|
+
const placeholderData = findSubstitutableElements(pendo);
|
|
40952
41099
|
if (step.buildingBlocks) {
|
|
40953
41100
|
findSubstitutableUrlsInJson(step.buildingBlocks, placeholderData, pendo);
|
|
40954
41101
|
}
|
|
@@ -40958,32 +41105,32 @@ var MetadataSubstitution = {
|
|
|
40958
41105
|
return;
|
|
40959
41106
|
processPlaceholder(placeholder, pendo);
|
|
40960
41107
|
});
|
|
40961
|
-
|
|
40962
|
-
|
|
40963
|
-
updateGuideContainer(containerId,
|
|
41108
|
+
const containerId = `pendo-g-${step.id}`;
|
|
41109
|
+
const context = step.guideElement;
|
|
41110
|
+
updateGuideContainer(containerId, context, pendo);
|
|
40964
41111
|
}
|
|
40965
41112
|
};
|
|
40966
41113
|
}
|
|
40967
|
-
|
|
41114
|
+
const config = {
|
|
40968
41115
|
attributeFilter: ['data-layout'],
|
|
40969
41116
|
attributes: true,
|
|
40970
41117
|
childList: true,
|
|
40971
41118
|
characterData: true,
|
|
40972
41119
|
subtree: true
|
|
40973
41120
|
};
|
|
40974
|
-
|
|
40975
|
-
|
|
41121
|
+
const MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
|
|
41122
|
+
const observer = new MutationObserver(applySubstitutionIndicators);
|
|
40976
41123
|
observer.observe(target, config);
|
|
40977
41124
|
function applySubstitutionIndicators(mutations) {
|
|
40978
41125
|
pendo._.each(mutations, function (mutation) {
|
|
40979
41126
|
var _a;
|
|
40980
41127
|
if (mutation.addedNodes.length) {
|
|
40981
41128
|
if (document.querySelector(guideMarkdownUtil.containerSelector)) {
|
|
40982
|
-
|
|
40983
|
-
|
|
41129
|
+
const placeholderData = findSubstitutableElements(pendo);
|
|
41130
|
+
const step = (_a = pendo.designerv2.currentlyPreviewedGuide) === null || _a === void 0 ? void 0 : _a.steps[0];
|
|
40984
41131
|
if (!step)
|
|
40985
41132
|
return;
|
|
40986
|
-
|
|
41133
|
+
const pendoBlocks = step.buildingBlocks;
|
|
40987
41134
|
if (!pendo._.isUndefined(pendoBlocks)) {
|
|
40988
41135
|
findSubstitutableUrlsInJson(pendoBlocks, placeholderData, pendo);
|
|
40989
41136
|
}
|
|
@@ -40993,9 +41140,9 @@ var MetadataSubstitution = {
|
|
|
40993
41140
|
return;
|
|
40994
41141
|
processPlaceholder(placeholder, pendo);
|
|
40995
41142
|
});
|
|
40996
|
-
|
|
40997
|
-
|
|
40998
|
-
updateGuideContainer(containerId,
|
|
41143
|
+
const containerId = `pendo-g-${step.id}`;
|
|
41144
|
+
const context = step.guideElement;
|
|
41145
|
+
updateGuideContainer(containerId, context, pendo);
|
|
40999
41146
|
}
|
|
41000
41147
|
}
|
|
41001
41148
|
}
|
|
@@ -41004,18 +41151,18 @@ var MetadataSubstitution = {
|
|
|
41004
41151
|
}
|
|
41005
41152
|
};
|
|
41006
41153
|
function processPlaceholder(placeholder, pendo) {
|
|
41007
|
-
|
|
41008
|
-
|
|
41009
|
-
|
|
41154
|
+
let match;
|
|
41155
|
+
const { data, target } = placeholder;
|
|
41156
|
+
const subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
|
|
41010
41157
|
while ((match = matchPlaceholder(placeholder, subRegex))) {
|
|
41011
|
-
|
|
41012
|
-
|
|
41158
|
+
const usedArrayPath = Array.isArray(match) && match.length >= 2;
|
|
41159
|
+
const currentStr = target === 'textContent'
|
|
41013
41160
|
? data[target]
|
|
41014
41161
|
: decodeURI((data.getAttribute && (target === 'href' || target === 'value') ? (data.getAttribute(target) || '') : data[target]));
|
|
41015
|
-
|
|
41162
|
+
const matched = usedArrayPath ? match : subRegex.exec(currentStr);
|
|
41016
41163
|
if (!matched)
|
|
41017
41164
|
continue;
|
|
41018
|
-
|
|
41165
|
+
const mdValue = getSubstituteValue(matched, pendo);
|
|
41019
41166
|
substituteMetadataByTarget(data, target, mdValue, matched);
|
|
41020
41167
|
}
|
|
41021
41168
|
}
|
|
@@ -41024,48 +41171,48 @@ function matchPlaceholder(placeholder, regex) {
|
|
|
41024
41171
|
return placeholder.data[placeholder.target].match(regex);
|
|
41025
41172
|
}
|
|
41026
41173
|
else {
|
|
41027
|
-
|
|
41174
|
+
const raw = placeholder.data.getAttribute && (placeholder.target === 'href' || placeholder.target === 'value')
|
|
41028
41175
|
? (placeholder.data.getAttribute(placeholder.target) || '')
|
|
41029
41176
|
: placeholder.data[placeholder.target];
|
|
41030
41177
|
return decodeURI(raw).match(regex);
|
|
41031
41178
|
}
|
|
41032
41179
|
}
|
|
41033
41180
|
function getMetadataValueCaseInsensitive(metadata, type, property) {
|
|
41034
|
-
|
|
41181
|
+
const kind = metadata && metadata[type];
|
|
41035
41182
|
if (!kind || typeof kind !== 'object')
|
|
41036
41183
|
return undefined;
|
|
41037
|
-
|
|
41184
|
+
const direct = Object.prototype.hasOwnProperty.call(kind, property) ? kind[property] : undefined;
|
|
41038
41185
|
if (direct !== undefined) {
|
|
41039
41186
|
return direct;
|
|
41040
41187
|
}
|
|
41041
|
-
|
|
41042
|
-
|
|
41043
|
-
|
|
41188
|
+
const propLower = property.toLowerCase();
|
|
41189
|
+
const key = Object.keys(kind).find(k => k.toLowerCase() === propLower);
|
|
41190
|
+
const value = key !== undefined ? kind[key] : undefined;
|
|
41044
41191
|
return value;
|
|
41045
41192
|
}
|
|
41046
41193
|
function getSubstituteValue(match, pendo) {
|
|
41047
41194
|
if (pendo._.isUndefined(match[1]) || pendo._.isUndefined(match[2])) {
|
|
41048
41195
|
return;
|
|
41049
41196
|
}
|
|
41050
|
-
|
|
41051
|
-
|
|
41052
|
-
|
|
41197
|
+
let type = match[1];
|
|
41198
|
+
let property = match[2];
|
|
41199
|
+
let defaultValue = match[3];
|
|
41053
41200
|
if (pendo._.isUndefined(type) || pendo._.isUndefined(property)) {
|
|
41054
41201
|
return;
|
|
41055
41202
|
}
|
|
41056
|
-
|
|
41057
|
-
|
|
41203
|
+
const metadata = pendo.getSerializedMetadata();
|
|
41204
|
+
let mdValue = getMetadataValueCaseInsensitive(metadata, type, property);
|
|
41058
41205
|
if (mdValue === undefined || mdValue === null)
|
|
41059
41206
|
mdValue = defaultValue || '';
|
|
41060
41207
|
return mdValue;
|
|
41061
41208
|
}
|
|
41062
41209
|
function substituteMetadataByTarget(data, target, mdValue, matched) {
|
|
41063
|
-
|
|
41064
|
-
|
|
41210
|
+
const isElement = data && typeof data.getAttribute === 'function';
|
|
41211
|
+
const current = (target === 'href' || target === 'value') && isElement
|
|
41065
41212
|
? (data.getAttribute(target) || '')
|
|
41066
41213
|
: data[target];
|
|
41067
41214
|
if (target === 'href' || target === 'value') {
|
|
41068
|
-
|
|
41215
|
+
const safeValue = window.encodeURIComponent(String(mdValue === undefined || mdValue === null ? '' : mdValue));
|
|
41069
41216
|
data[target] = decodeURI(current).replace(matched[0], safeValue);
|
|
41070
41217
|
}
|
|
41071
41218
|
else {
|
|
@@ -41079,9 +41226,8 @@ function updateGuideContainer(containerId, context, pendo) {
|
|
|
41079
41226
|
pendo.flexElement(pendo.dom(guideMarkdownUtil.containerSelector));
|
|
41080
41227
|
pendo.BuildingBlocks.BuildingBlockGuides.recalculateGuideHeight(containerId, context);
|
|
41081
41228
|
}
|
|
41082
|
-
function findSubstitutableUrlsInJson(originalData, placeholderData, pendo) {
|
|
41083
|
-
|
|
41084
|
-
var subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
|
|
41229
|
+
function findSubstitutableUrlsInJson(originalData, placeholderData = [], pendo) {
|
|
41230
|
+
const subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
|
|
41085
41231
|
if ((originalData.name === 'url' || originalData.name === 'href') && originalData.value) {
|
|
41086
41232
|
if (subRegex.test(originalData.value)) {
|
|
41087
41233
|
placeholderData.push({
|
|
@@ -41091,37 +41237,37 @@ function findSubstitutableUrlsInJson(originalData, placeholderData, pendo) {
|
|
|
41091
41237
|
}
|
|
41092
41238
|
}
|
|
41093
41239
|
if (originalData.properties && originalData.id === 'href_link_block') {
|
|
41094
|
-
pendo._.each(originalData.properties,
|
|
41240
|
+
pendo._.each(originalData.properties, (prop) => {
|
|
41095
41241
|
findSubstitutableUrlsInJson(prop, placeholderData, pendo);
|
|
41096
41242
|
});
|
|
41097
41243
|
}
|
|
41098
41244
|
if (originalData.views) {
|
|
41099
|
-
pendo._.each(originalData.views,
|
|
41245
|
+
pendo._.each(originalData.views, (view) => {
|
|
41100
41246
|
findSubstitutableUrlsInJson(view, placeholderData, pendo);
|
|
41101
41247
|
});
|
|
41102
41248
|
}
|
|
41103
41249
|
if (originalData.parameters) {
|
|
41104
|
-
pendo._.each(originalData.parameters,
|
|
41250
|
+
pendo._.each(originalData.parameters, (param) => {
|
|
41105
41251
|
findSubstitutableUrlsInJson(param, placeholderData, pendo);
|
|
41106
41252
|
});
|
|
41107
41253
|
}
|
|
41108
41254
|
if (originalData.actions) {
|
|
41109
|
-
pendo._.each(originalData.actions,
|
|
41255
|
+
pendo._.each(originalData.actions, (action) => {
|
|
41110
41256
|
findSubstitutableUrlsInJson(action, placeholderData, pendo);
|
|
41111
41257
|
});
|
|
41112
41258
|
}
|
|
41113
41259
|
if (originalData.children) {
|
|
41114
|
-
pendo._.each(originalData.children,
|
|
41260
|
+
pendo._.each(originalData.children, (child) => {
|
|
41115
41261
|
findSubstitutableUrlsInJson(child, placeholderData, pendo);
|
|
41116
41262
|
});
|
|
41117
41263
|
}
|
|
41118
41264
|
return placeholderData;
|
|
41119
41265
|
}
|
|
41120
41266
|
function findSubstitutableElements(pendo) {
|
|
41121
|
-
|
|
41267
|
+
let elements = pendo.dom(`${guideMarkdownUtil.containerSelector} *:not(.pendo-inline-ui)`);
|
|
41122
41268
|
return pendo._.chain(elements)
|
|
41123
41269
|
.filter(function (placeholder) {
|
|
41124
|
-
|
|
41270
|
+
const subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
|
|
41125
41271
|
if (placeholder.localName === 'a') {
|
|
41126
41272
|
return subRegex.test(decodeURI(placeholder.href)) || subRegex.test(placeholder.textContent);
|
|
41127
41273
|
}
|
|
@@ -41177,25 +41323,51 @@ function findSubstitutableElements(pendo) {
|
|
|
41177
41323
|
.value();
|
|
41178
41324
|
}
|
|
41179
41325
|
function substitutionIcon(color, size) {
|
|
41180
|
-
return (
|
|
41181
|
-
|
|
41182
|
-
|
|
41183
|
-
|
|
41184
|
-
|
|
41185
|
-
|
|
41326
|
+
return (`<div title="Metadata Substitution added">
|
|
41327
|
+
<svg id="pendo-ps-substitution-icon" viewBox="0 0 24 24"
|
|
41328
|
+
preserveAspectRatio="xMidYMid meet"
|
|
41329
|
+
height=${size} width=${size} title="Metadata Substitution"
|
|
41330
|
+
style="bottom:5px; right:10px; position: absolute;"
|
|
41331
|
+
fill="none" xmlns="http://www.w3.org/2000/svg" stroke="${color}"
|
|
41332
|
+
transform="matrix(1, 0, 0, 1, 0, 0)rotate(0)">
|
|
41333
|
+
<g stroke-width="0"></g>
|
|
41334
|
+
<g stroke-linecap="round" stroke-linejoin="round"
|
|
41335
|
+
stroke="${color}" stroke-width="0.528"></g>
|
|
41336
|
+
<g><path fill-rule="evenodd" clip-rule="evenodd"
|
|
41337
|
+
d="M5 5.5C4.17157 5.5 3.5 6.17157 3.5 7V10C3.5 10.8284
|
|
41338
|
+
4.17157 11.5 5 11.5H8C8.82843 11.5 9.5 10.8284 9.5
|
|
41339
|
+
10V9H17V11C17 11.2761 17.2239 11.5 17.5 11.5C17.7761
|
|
41340
|
+
11.5 18 11.2761 18 11V8.5C18 8.22386 17.7761 8 17.5
|
|
41341
|
+
8H9.5V7C9.5 6.17157 8.82843 5.5 8 5.5H5ZM8.5 7C8.5
|
|
41342
|
+
6.72386 8.27614 6.5 8 6.5H5C4.72386 6.5 4.5 6.72386
|
|
41343
|
+
4.5 7V10C4.5 10.2761 4.72386 10.5 5 10.5H8C8.27614
|
|
41344
|
+
10.5 8.5 10.2761 8.5 10V7Z" fill="${color}"></path>
|
|
41345
|
+
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
41346
|
+
d="M7 13C7 12.7239 6.77614 12.5 6.5 12.5C6.22386 12.5
|
|
41347
|
+
6 12.7239 6 13V15.5C6 15.7761 6.22386 16 6.5
|
|
41348
|
+
16H14.5V17C14.5 17.8284 15.1716 18.5 16 18.5H19C19.8284
|
|
41349
|
+
18.5 20.5 17.8284 20.5 17V14C20.5 13.1716 19.8284 12.5
|
|
41350
|
+
19 12.5H16C15.1716 12.5 14.5 13.1716 14.5
|
|
41351
|
+
14V15H7V13ZM15.5 17C15.5 17.2761 15.7239 17.5 16
|
|
41352
|
+
17.5H19C19.2761 17.5 19.5 17.2761 19.5 17V14C19.5
|
|
41353
|
+
13.7239 19.2761 13.5 19 13.5H16C15.7239 13.5 15.5
|
|
41354
|
+
13.7239 15.5 14V17Z" fill="${color}"></path> </g></svg></div>`);
|
|
41355
|
+
}
|
|
41356
|
+
|
|
41357
|
+
const requiredElement = '<span class="_pendo-required-indicator" style="color:red; font-style:italic;" title="Question is required"> *</span>';
|
|
41358
|
+
const requiredSyntax = '{required/}';
|
|
41359
|
+
const RequiredQuestions = {
|
|
41186
41360
|
name: 'RequiredQuestions',
|
|
41187
|
-
script
|
|
41361
|
+
script(step, guide, pendo) {
|
|
41188
41362
|
var _a;
|
|
41189
|
-
|
|
41190
|
-
|
|
41191
|
-
|
|
41192
|
-
});
|
|
41193
|
-
var requiredQuestions = processRequiredQuestions();
|
|
41363
|
+
let requiredPollIds = [];
|
|
41364
|
+
let submitButtons = (_a = guideMarkdownUtil.lookupGuideButtons(step.domJson)) === null || _a === void 0 ? void 0 : _a.filter(button => button.actions.find(action => action.action === 'submitPoll' || action.action === 'submitPollAndGoToStep'));
|
|
41365
|
+
const requiredQuestions = processRequiredQuestions();
|
|
41194
41366
|
if (requiredQuestions) {
|
|
41195
|
-
pendo._.forEach(requiredQuestions,
|
|
41367
|
+
pendo._.forEach(requiredQuestions, (question) => {
|
|
41196
41368
|
if (question.classList.contains('_pendo-open-text-poll-question')) {
|
|
41197
|
-
|
|
41198
|
-
step.attachEvent(step.guideElement.find(
|
|
41369
|
+
let pollId = question.dataset.pendoPollId;
|
|
41370
|
+
step.attachEvent(step.guideElement.find(`[data-pendo-poll-id=${pollId}]._pendo-open-text-poll-input`)[0], 'input', function () {
|
|
41199
41371
|
evaluateRequiredQuestions(requiredQuestions);
|
|
41200
41372
|
});
|
|
41201
41373
|
}
|
|
@@ -41207,8 +41379,8 @@ var RequiredQuestions = {
|
|
|
41207
41379
|
});
|
|
41208
41380
|
}
|
|
41209
41381
|
function getEligibleQuestions() {
|
|
41210
|
-
|
|
41211
|
-
return pendo._.reduce(allQuestions,
|
|
41382
|
+
const allQuestions = step.guideElement.find(`[class*=-poll-question]:contains(${requiredSyntax})`);
|
|
41383
|
+
return pendo._.reduce(allQuestions, (eligibleQuestions, question) => {
|
|
41212
41384
|
if (question.classList.contains('_pendo-yes-no-poll-question'))
|
|
41213
41385
|
return eligibleQuestions;
|
|
41214
41386
|
eligibleQuestions.push(question);
|
|
@@ -41216,19 +41388,27 @@ var RequiredQuestions = {
|
|
|
41216
41388
|
}, []);
|
|
41217
41389
|
}
|
|
41218
41390
|
function processRequiredQuestions() {
|
|
41219
|
-
|
|
41391
|
+
let questions = getEligibleQuestions();
|
|
41220
41392
|
if (questions) {
|
|
41221
|
-
pendo._.forEach(questions,
|
|
41222
|
-
|
|
41393
|
+
pendo._.forEach(questions, question => {
|
|
41394
|
+
let dataPendoPollId = question.getAttribute('data-pendo-poll-id');
|
|
41223
41395
|
requiredPollIds.push(dataPendoPollId);
|
|
41224
|
-
pendo._.each(step.guideElement.find(
|
|
41396
|
+
pendo._.each(step.guideElement.find(`#${question.id} *, #${question.id}`), (element) => {
|
|
41225
41397
|
guideMarkdownUtil.removeMarkdownSyntax(element, requiredSyntax, '', pendo);
|
|
41226
41398
|
});
|
|
41227
|
-
step.guideElement.find(
|
|
41399
|
+
step.guideElement.find(`#${question.id} p`).append(requiredElement);
|
|
41228
41400
|
});
|
|
41229
41401
|
}
|
|
41230
41402
|
if (pendo._.size(requiredPollIds)) {
|
|
41231
|
-
|
|
41403
|
+
const disabledButtonStyles = `<style type=text/css
|
|
41404
|
+
id=_pendo-guide-required-disabled>
|
|
41405
|
+
._pendo-button:disabled, ._pendo-buttons[disabled] {
|
|
41406
|
+
border: 1px solid #999999 !important;
|
|
41407
|
+
background-color: #cccccc !important;
|
|
41408
|
+
color: #666666 !important;
|
|
41409
|
+
pointer-events: none !important;
|
|
41410
|
+
}
|
|
41411
|
+
</style>`;
|
|
41232
41412
|
if (pendo.dom('#_pendo-guide-required-disabled').length === 0) {
|
|
41233
41413
|
pendo.dom('head').append(disabledButtonStyles);
|
|
41234
41414
|
}
|
|
@@ -41239,11 +41419,15 @@ var RequiredQuestions = {
|
|
|
41239
41419
|
function evaluateRequiredQuestions(questions) {
|
|
41240
41420
|
if (questions.length === 0)
|
|
41241
41421
|
return;
|
|
41242
|
-
|
|
41243
|
-
|
|
41244
|
-
responses = responses.concat(pendo._.map(questions,
|
|
41245
|
-
|
|
41246
|
-
|
|
41422
|
+
let allRequiredComplete = true;
|
|
41423
|
+
let responses = [];
|
|
41424
|
+
responses = responses.concat(pendo._.map(questions, (question) => {
|
|
41425
|
+
let pollId = question.getAttribute('data-pendo-poll-id');
|
|
41426
|
+
let input = step.guideElement.find(`
|
|
41427
|
+
[data-pendo-poll-id=${pollId}] textarea,
|
|
41428
|
+
[data-pendo-poll-id=${pollId}] input:text,
|
|
41429
|
+
[data-pendo-poll-id=${pollId}] select,
|
|
41430
|
+
[data-pendo-poll-id=${pollId}] input:radio:checked`);
|
|
41247
41431
|
if (input && input.length && input[0].value) {
|
|
41248
41432
|
return input[0].value;
|
|
41249
41433
|
}
|
|
@@ -41260,48 +41444,48 @@ var RequiredQuestions = {
|
|
|
41260
41444
|
}
|
|
41261
41445
|
function disableEligibleButtons(buttons) {
|
|
41262
41446
|
pendo._.each(buttons, function (button) {
|
|
41263
|
-
if (step.guideElement.find(
|
|
41264
|
-
step.guideElement.find(
|
|
41265
|
-
step.guideElement.find(
|
|
41447
|
+
if (step.guideElement.find(`#${button.props.id}`)[0]) {
|
|
41448
|
+
step.guideElement.find(`#${button.props.id}`)[0].disabled = true;
|
|
41449
|
+
step.guideElement.find(`#${button.props.id}`)[0].parentElement.title = 'Please complete all required questions.';
|
|
41266
41450
|
}
|
|
41267
41451
|
});
|
|
41268
41452
|
}
|
|
41269
41453
|
function enableEligibleButtons(buttons) {
|
|
41270
41454
|
pendo._.each(buttons, function (button) {
|
|
41271
|
-
if (step.guideElement.find(
|
|
41272
|
-
step.guideElement.find(
|
|
41273
|
-
step.guideElement.find(
|
|
41455
|
+
if (step.guideElement.find(`#${button.props.id}`)[0]) {
|
|
41456
|
+
step.guideElement.find(`#${button.props.id}`)[0].disabled = false;
|
|
41457
|
+
step.guideElement.find(`#${button.props.id}`)[0].parentElement.title = '';
|
|
41274
41458
|
}
|
|
41275
41459
|
});
|
|
41276
41460
|
}
|
|
41277
41461
|
},
|
|
41278
|
-
test
|
|
41462
|
+
test(step, guide, pendo) {
|
|
41279
41463
|
var _a;
|
|
41280
|
-
|
|
41464
|
+
let requiredQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find(`[class*=-poll-question]:contains(${requiredSyntax})`);
|
|
41281
41465
|
return !pendo._.isUndefined(requiredQuestions) && pendo._.size(requiredQuestions);
|
|
41282
41466
|
},
|
|
41283
|
-
designerListener
|
|
41284
|
-
|
|
41285
|
-
|
|
41286
|
-
|
|
41467
|
+
designerListener(pendo) {
|
|
41468
|
+
const requiredQuestions = [];
|
|
41469
|
+
const target = pendo.dom.getBody();
|
|
41470
|
+
const config = {
|
|
41287
41471
|
attributeFilter: ['data-layout'],
|
|
41288
41472
|
attributes: true,
|
|
41289
41473
|
childList: true,
|
|
41290
41474
|
characterData: true,
|
|
41291
41475
|
subtree: true
|
|
41292
41476
|
};
|
|
41293
|
-
|
|
41294
|
-
|
|
41477
|
+
const MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
|
|
41478
|
+
const observer = new MutationObserver(applyRequiredIndicators);
|
|
41295
41479
|
observer.observe(target, config);
|
|
41296
41480
|
function applyRequiredIndicators(mutations) {
|
|
41297
41481
|
pendo._.each(mutations, function (mutation) {
|
|
41298
41482
|
var _a;
|
|
41299
|
-
|
|
41483
|
+
const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
|
|
41300
41484
|
if (mutation.addedNodes.length && nodeHasQuerySelector) {
|
|
41301
|
-
|
|
41485
|
+
let eligiblePolls = mutation.addedNodes[0].querySelectorAll('[class*=-poll-wrapper], [class*=-poll-select-border]');
|
|
41302
41486
|
if (eligiblePolls) {
|
|
41303
41487
|
pendo._.each(eligiblePolls, function (poll) {
|
|
41304
|
-
|
|
41488
|
+
let dataPendoPollId;
|
|
41305
41489
|
if (poll.classList.contains('_pendo-open-text-poll-wrapper') ||
|
|
41306
41490
|
poll.classList.contains('_pendo-number-scale-poll-wrapper')) {
|
|
41307
41491
|
dataPendoPollId = poll.getAttribute('name');
|
|
@@ -41309,27 +41493,27 @@ var RequiredQuestions = {
|
|
|
41309
41493
|
else {
|
|
41310
41494
|
dataPendoPollId = poll.getAttribute('data-pendo-poll-id');
|
|
41311
41495
|
}
|
|
41312
|
-
|
|
41313
|
-
|
|
41496
|
+
let questionText;
|
|
41497
|
+
const pollQuesiton = pendo.dom(`[class*="-poll-question"][data-pendo-poll-id=${dataPendoPollId}]`)[0];
|
|
41314
41498
|
if (pollQuesiton) {
|
|
41315
|
-
questionText = pendo.dom(
|
|
41499
|
+
questionText = pendo.dom(`[class*="-poll-question"][data-pendo-poll-id=${dataPendoPollId}]`)[0].textContent;
|
|
41316
41500
|
}
|
|
41317
|
-
|
|
41501
|
+
const requiredSyntaxIndex = questionText.indexOf(requiredSyntax);
|
|
41318
41502
|
if (requiredSyntaxIndex > -1) {
|
|
41319
|
-
pendo._.each(pendo.dom(
|
|
41320
|
-
pendo._.each(pendo.dom(
|
|
41503
|
+
pendo._.each(pendo.dom(`[data-pendo-poll-id=${dataPendoPollId}]:not(.pendo-radio)`), (element) => {
|
|
41504
|
+
pendo._.each(pendo.dom(`#${element.id} *:not(".pendo-radio"), #${element.id}:not(".pendo-radio")`), (item) => {
|
|
41321
41505
|
guideMarkdownUtil.removeMarkdownSyntax(item, requiredSyntax, '', pendo);
|
|
41322
41506
|
});
|
|
41323
41507
|
});
|
|
41324
|
-
if (pendo.dom(
|
|
41325
|
-
pendo.dom(
|
|
41326
|
-
pendo.dom(
|
|
41508
|
+
if (pendo.dom(`.bb-text[data-pendo-poll-id=${dataPendoPollId}] p`).length !== 0 || pendo.dom(`.bb-text[data-pendo-poll-id=${dataPendoPollId}] li`).length !== 0) {
|
|
41509
|
+
pendo.dom(`.bb-text[data-pendo-poll-id=${dataPendoPollId}] p`).append(requiredElement);
|
|
41510
|
+
pendo.dom(`.bb-text[data-pendo-poll-id=${dataPendoPollId}] li`).append(requiredElement);
|
|
41327
41511
|
}
|
|
41328
41512
|
else {
|
|
41329
|
-
pendo.dom(
|
|
41513
|
+
pendo.dom(`.bb-text[data-pendo-poll-id=${dataPendoPollId}]`).append(requiredElement);
|
|
41330
41514
|
}
|
|
41331
41515
|
if (pendo._.contains(requiredQuestions, dataPendoPollId)) {
|
|
41332
|
-
|
|
41516
|
+
let questionIndex = requiredQuestions.indexOf(dataPendoPollId);
|
|
41333
41517
|
if (questionIndex !== -1) {
|
|
41334
41518
|
requiredQuestions.splice(questionIndex, 1);
|
|
41335
41519
|
}
|
|
@@ -41340,7 +41524,7 @@ var RequiredQuestions = {
|
|
|
41340
41524
|
}
|
|
41341
41525
|
else {
|
|
41342
41526
|
if (pendo._.contains(requiredQuestions, dataPendoPollId)) {
|
|
41343
|
-
|
|
41527
|
+
let index = requiredQuestions.indexOf(dataPendoPollId);
|
|
41344
41528
|
if (index !== -1) {
|
|
41345
41529
|
requiredQuestions.splice(index, 1);
|
|
41346
41530
|
}
|
|
@@ -41354,54 +41538,54 @@ var RequiredQuestions = {
|
|
|
41354
41538
|
}
|
|
41355
41539
|
};
|
|
41356
41540
|
|
|
41357
|
-
|
|
41358
|
-
|
|
41359
|
-
script
|
|
41360
|
-
|
|
41361
|
-
|
|
41362
|
-
|
|
41363
|
-
|
|
41364
|
-
|
|
41541
|
+
const skipStepRegex = new RegExp(guideMarkdownUtil.skipStepString);
|
|
41542
|
+
const SkipToEligibleStep = {
|
|
41543
|
+
script(step, guide, pendo) {
|
|
41544
|
+
let isAdvanceIntercepted = false;
|
|
41545
|
+
let isPreviousIntercepted = false;
|
|
41546
|
+
let guideContainer = step.guideElement.find(guideMarkdownUtil.containerSelector);
|
|
41547
|
+
let guideContainerAriaLabel = guideContainer.attr('aria-label');
|
|
41548
|
+
let stepNumberOrAuto = skipStepRegex.exec(guideContainerAriaLabel)[1];
|
|
41365
41549
|
if (guideContainer) {
|
|
41366
41550
|
guideContainer.attr({ 'aria-label': guideContainer.attr('aria-label').replace(skipStepRegex, '') });
|
|
41367
41551
|
}
|
|
41368
|
-
this.on('beforeAdvance',
|
|
41552
|
+
this.on('beforeAdvance', (evt) => {
|
|
41369
41553
|
if (guide.getPositionOfStep(step) === guide.steps.length || pendo._.isUndefined(stepNumberOrAuto))
|
|
41370
41554
|
return; // exit on the last step of a guide or when we don't have an argument
|
|
41371
|
-
|
|
41555
|
+
let eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'next');
|
|
41372
41556
|
if (!isAdvanceIntercepted && stepNumberOrAuto) {
|
|
41373
41557
|
isAdvanceIntercepted = true;
|
|
41374
|
-
pendo.goToStep({ destinationStepId: eligibleStep.id, step
|
|
41558
|
+
pendo.goToStep({ destinationStepId: eligibleStep.id, step });
|
|
41375
41559
|
evt.cancel = true;
|
|
41376
41560
|
}
|
|
41377
41561
|
});
|
|
41378
|
-
this.on('beforePrevious',
|
|
41562
|
+
this.on('beforePrevious', (evt) => {
|
|
41379
41563
|
if (pendo._.isUndefined(stepNumberOrAuto))
|
|
41380
41564
|
return;
|
|
41381
|
-
|
|
41565
|
+
let eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'previous');
|
|
41382
41566
|
if (!isPreviousIntercepted && stepNumberOrAuto) {
|
|
41383
41567
|
isPreviousIntercepted = true;
|
|
41384
|
-
pendo.goToStep({ destinationStepId: eligibleStep.id, step
|
|
41568
|
+
pendo.goToStep({ destinationStepId: eligibleStep.id, step });
|
|
41385
41569
|
evt.cancel = true;
|
|
41386
41570
|
}
|
|
41387
41571
|
});
|
|
41388
41572
|
function findEligibleSkipStep(stepNumber, direction) {
|
|
41389
41573
|
// Find the next eligible step by using getPosition of step (1 based)
|
|
41390
41574
|
// getPosition - 2 gives the previous step
|
|
41391
|
-
|
|
41392
|
-
|
|
41575
|
+
let skipForwardStep = findStepOnPage(guide.getPositionOfStep(step), 'next', stepNumber);
|
|
41576
|
+
let skipPreviousStep = findStepOnPage(guide.getPositionOfStep(step) - 2, 'previous', stepNumber);
|
|
41393
41577
|
if (skipForwardStep && direction == 'next') {
|
|
41394
|
-
pendo.goToStep({ destinationStepId: skipForwardStep, step
|
|
41578
|
+
pendo.goToStep({ destinationStepId: skipForwardStep, step });
|
|
41395
41579
|
}
|
|
41396
41580
|
if (skipPreviousStep && direction == 'previous') {
|
|
41397
|
-
pendo.goToStep({ destinationStepId: skipPreviousStep, step
|
|
41581
|
+
pendo.goToStep({ destinationStepId: skipPreviousStep, step });
|
|
41398
41582
|
}
|
|
41399
41583
|
return direction === 'next' ? skipForwardStep : skipPreviousStep;
|
|
41400
41584
|
}
|
|
41401
41585
|
function findStepOnPage(stepIndex, direction, stepNumber) {
|
|
41402
41586
|
if (pendo._.isNaN(stepIndex))
|
|
41403
41587
|
return;
|
|
41404
|
-
|
|
41588
|
+
let $step = guide.steps[stepIndex];
|
|
41405
41589
|
if ($step && !$step.canShow()) {
|
|
41406
41590
|
if (stepNumber !== 'auto') {
|
|
41407
41591
|
return guide.steps[stepNumber - 1];
|
|
@@ -41418,34 +41602,34 @@ var SkipToEligibleStep = {
|
|
|
41418
41602
|
}
|
|
41419
41603
|
}
|
|
41420
41604
|
},
|
|
41421
|
-
test
|
|
41605
|
+
test(step, guide, pendo) {
|
|
41422
41606
|
var _a;
|
|
41423
|
-
|
|
41607
|
+
const guideContainerAriaLabel = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find(guideMarkdownUtil.containerSelector).attr('aria-label');
|
|
41424
41608
|
return pendo._.isString(guideContainerAriaLabel) && guideContainerAriaLabel.indexOf('{skipStep') !== -1;
|
|
41425
41609
|
},
|
|
41426
|
-
designerListener
|
|
41427
|
-
|
|
41428
|
-
|
|
41610
|
+
designerListener(pendo) {
|
|
41611
|
+
const target = pendo.dom.getBody();
|
|
41612
|
+
const config = {
|
|
41429
41613
|
attributeFilter: ['data-layout'],
|
|
41430
41614
|
attributes: true,
|
|
41431
41615
|
childList: true,
|
|
41432
41616
|
characterData: true,
|
|
41433
41617
|
subtree: true
|
|
41434
41618
|
};
|
|
41435
|
-
|
|
41436
|
-
|
|
41619
|
+
const MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
|
|
41620
|
+
const observer = new MutationObserver(applySkipStepIndicator);
|
|
41437
41621
|
observer.observe(target, config);
|
|
41438
41622
|
// create an observer instance
|
|
41439
41623
|
function applySkipStepIndicator(mutations) {
|
|
41440
41624
|
pendo._.each(mutations, function (mutation) {
|
|
41441
41625
|
var _a, _b;
|
|
41442
|
-
|
|
41626
|
+
const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
|
|
41443
41627
|
if (mutation.addedNodes.length && nodeHasQuerySelector) {
|
|
41444
|
-
|
|
41445
|
-
|
|
41628
|
+
let guideContainer = mutation.addedNodes[0].querySelectorAll(guideMarkdownUtil.containerSelector);
|
|
41629
|
+
let guideContainerAriaLabel = (_b = guideContainer[0]) === null || _b === void 0 ? void 0 : _b.getAttribute('aria-label');
|
|
41446
41630
|
if (guideContainerAriaLabel) {
|
|
41447
41631
|
if (guideContainerAriaLabel.match(skipStepRegex)) {
|
|
41448
|
-
|
|
41632
|
+
let fullSkipStepString = guideContainerAriaLabel.match(skipStepRegex)[0];
|
|
41449
41633
|
guideContainerAriaLabel.replace(fullSkipStepString, '');
|
|
41450
41634
|
if (!pendo.dom('#_pendoSkipIcon').length) {
|
|
41451
41635
|
pendo.dom(guideMarkdownUtil.containerSelector).append(skipIcon('#999', '30px').trim());
|
|
@@ -41456,30 +41640,48 @@ var SkipToEligibleStep = {
|
|
|
41456
41640
|
});
|
|
41457
41641
|
}
|
|
41458
41642
|
function skipIcon(color, size) {
|
|
41459
|
-
return (
|
|
41643
|
+
return (`<div title="Skip step added"><svg id="_pendoSkipIcon" version="1.0" xmlns="http://www.w3.org/2000/svg"
|
|
41644
|
+
width="${size}" height="${size}" viewBox="0 0 512.000000 512.000000"
|
|
41645
|
+
preserveAspectRatio="xMidYMid meet" style="bottom:5px; right:10px; position: absolute;">
|
|
41646
|
+
<g transform="translate(0.000000,512.000000) scale(0.100000,-0.100000)"
|
|
41647
|
+
fill="${color}" stroke="none">
|
|
41648
|
+
<path d="M2185 4469 c-363 -38 -739 -186 -1034 -407 -95 -71 -273 -243 -357
|
|
41649
|
+
-343 -205 -246 -364 -577 -429 -897 -25 -121 -45 -288 -45 -373 l0 -49 160 0
|
|
41650
|
+
160 0 0 48 c0 26 5 88 10 137 68 593 417 1103 940 1374 1100 570 2418 -137
|
|
41651
|
+
2560 -1374 5 -49 10 -111 10 -137 l0 -47 -155 -3 -155 -3 235 -235 235 -236
|
|
41652
|
+
235 236 235 235 -155 3 -155 3 0 48 c0 27 -5 95 -10 152 -100 989 -878 1767
|
|
41653
|
+
-1869 1868 -117 12 -298 12 -416 0z"/>
|
|
41654
|
+
<path d="M320 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
|
|
41655
|
+
<path d="M960 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
|
|
41656
|
+
<path d="M1600 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
|
|
41657
|
+
<path d="M2240 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
|
|
41658
|
+
<path d="M2880 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
|
|
41659
|
+
<path d="M3840 1440 l0 -160 480 0 480 0 0 160 0 160 -480 0 -480 0 0 -160z"/>
|
|
41660
|
+
</g></svg></div>
|
|
41661
|
+
`);
|
|
41460
41662
|
}
|
|
41461
41663
|
}
|
|
41462
41664
|
};
|
|
41463
41665
|
|
|
41464
41666
|
function GuideMarkdown() {
|
|
41465
|
-
|
|
41466
|
-
|
|
41467
|
-
|
|
41667
|
+
let guideMarkdown;
|
|
41668
|
+
let pluginApi;
|
|
41669
|
+
let globalPendo;
|
|
41468
41670
|
return {
|
|
41469
41671
|
name: 'GuideMarkdown',
|
|
41470
41672
|
initialize: init,
|
|
41471
|
-
teardown
|
|
41673
|
+
teardown
|
|
41472
41674
|
};
|
|
41473
41675
|
function init(pendo, PluginAPI) {
|
|
41474
41676
|
globalPendo = pendo;
|
|
41475
41677
|
pluginApi = PluginAPI;
|
|
41476
|
-
|
|
41477
|
-
|
|
41678
|
+
const configReader = PluginAPI.ConfigReader;
|
|
41679
|
+
const GUIDEMARKDOWN_CONFIG = 'guideMarkdown';
|
|
41478
41680
|
configReader.addOption(GUIDEMARKDOWN_CONFIG, [
|
|
41479
41681
|
configReader.sources.SNIPPET_SRC,
|
|
41480
41682
|
configReader.sources.PENDO_CONFIG_SRC
|
|
41481
41683
|
], false);
|
|
41482
|
-
|
|
41684
|
+
const markdownScriptsEnabled = configReader.get(GUIDEMARKDOWN_CONFIG);
|
|
41483
41685
|
if (!markdownScriptsEnabled)
|
|
41484
41686
|
return;
|
|
41485
41687
|
guideMarkdown = [PollBranching, MetadataSubstitution, RequiredQuestions, SkipToEligibleStep];
|
|
@@ -42518,8 +42720,8 @@ function Feedback() {
|
|
|
42518
42720
|
var widgetLoaded = false;
|
|
42519
42721
|
var feedbackAllowedProductId = '';
|
|
42520
42722
|
var initialized = false;
|
|
42521
|
-
|
|
42522
|
-
|
|
42723
|
+
const PING_COOKIE = 'feedback_ping_sent';
|
|
42724
|
+
const PING_COOKIE_EXPIRATION = 1000 * 60 * 60;
|
|
42523
42725
|
var overflowMediaQuery = '@media only screen and (max-device-width:1112px){#feedback-widget{overflow-y:scroll}}';
|
|
42524
42726
|
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%)}}';
|
|
42525
42727
|
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)}}';
|
|
@@ -42539,28 +42741,28 @@ function Feedback() {
|
|
|
42539
42741
|
feedbackStyles: 'pendo-feedback-styles',
|
|
42540
42742
|
feedbackFrameStyles: 'pendo-feedback-visible-buttons-styles'
|
|
42541
42743
|
};
|
|
42542
|
-
|
|
42543
|
-
|
|
42744
|
+
let globalPendo;
|
|
42745
|
+
let pluginApi;
|
|
42544
42746
|
return {
|
|
42545
42747
|
name: 'Feedback',
|
|
42546
|
-
initialize
|
|
42547
|
-
teardown
|
|
42548
|
-
validate
|
|
42748
|
+
initialize,
|
|
42749
|
+
teardown,
|
|
42750
|
+
validate
|
|
42549
42751
|
};
|
|
42550
42752
|
function initialize(pendo, PluginAPI) {
|
|
42551
42753
|
globalPendo = pendo;
|
|
42552
42754
|
pluginApi = PluginAPI;
|
|
42553
42755
|
var publicFeedback = {
|
|
42554
|
-
ping
|
|
42555
|
-
init
|
|
42756
|
+
ping,
|
|
42757
|
+
init,
|
|
42556
42758
|
initialized: getInitialized,
|
|
42557
|
-
loginAndRedirect
|
|
42558
|
-
openFeedback
|
|
42559
|
-
initializeFeedbackOnce
|
|
42560
|
-
isFeedbackLoaded
|
|
42561
|
-
convertPendoToFeedbackOptions
|
|
42759
|
+
loginAndRedirect,
|
|
42760
|
+
openFeedback,
|
|
42761
|
+
initializeFeedbackOnce,
|
|
42762
|
+
isFeedbackLoaded,
|
|
42763
|
+
convertPendoToFeedbackOptions,
|
|
42562
42764
|
isUnsupportedIE: pendo._.partial(isUnsupportedIE, PluginAPI),
|
|
42563
|
-
removeFeedbackWidget
|
|
42765
|
+
removeFeedbackWidget
|
|
42564
42766
|
};
|
|
42565
42767
|
pendo.feedback = publicFeedback;
|
|
42566
42768
|
pendo.getFeedbackSettings = getFeedbackSettings;
|
|
@@ -42588,7 +42790,7 @@ function Feedback() {
|
|
|
42588
42790
|
*/
|
|
42589
42791
|
PluginAPI.agentStorage.registry.addLocal(PING_COOKIE, { duration: PING_COOKIE_EXPIRATION });
|
|
42590
42792
|
return {
|
|
42591
|
-
validate
|
|
42793
|
+
validate
|
|
42592
42794
|
};
|
|
42593
42795
|
}
|
|
42594
42796
|
function teardown() {
|
|
@@ -42608,18 +42810,18 @@ function Feedback() {
|
|
|
42608
42810
|
return result;
|
|
42609
42811
|
}
|
|
42610
42812
|
function pingOrInitialize() {
|
|
42611
|
-
|
|
42813
|
+
const options = getPendoOptions();
|
|
42612
42814
|
if (initialized) {
|
|
42613
|
-
|
|
42815
|
+
const feedbackOptions = convertPendoToFeedbackOptions(options);
|
|
42614
42816
|
ping(feedbackOptions);
|
|
42615
42817
|
}
|
|
42616
42818
|
else if (shouldInitializeFeedback() && !globalPendo._.isEmpty(options)) {
|
|
42617
|
-
|
|
42618
|
-
init(options, settings)
|
|
42819
|
+
const settings = pluginApi.ConfigReader.get('feedbackSettings');
|
|
42820
|
+
init(options, settings).catch(globalPendo._.noop);
|
|
42619
42821
|
}
|
|
42620
42822
|
}
|
|
42621
42823
|
function handleIdentityChange(event) {
|
|
42622
|
-
|
|
42824
|
+
const visitorId = globalPendo._.get(event, 'data.0.visitor_id') || globalPendo._.get(event, 'data.0.options.visitor.id');
|
|
42623
42825
|
if (globalPendo.isAnonymousVisitor(visitorId)) {
|
|
42624
42826
|
removeFeedbackWidget();
|
|
42625
42827
|
return;
|
|
@@ -42689,9 +42891,9 @@ function Feedback() {
|
|
|
42689
42891
|
if (toSend.data && toSend.data !== '{}' && toSend.data !== 'null') {
|
|
42690
42892
|
return globalPendo.ajax
|
|
42691
42893
|
.postJSON(getFullUrl('/widget/pendo_ping'), toSend)
|
|
42692
|
-
.then(
|
|
42894
|
+
.then((response) => {
|
|
42693
42895
|
onWidgetPingResponse(response);
|
|
42694
|
-
})
|
|
42896
|
+
}).catch(() => { onPingFailure(); });
|
|
42695
42897
|
}
|
|
42696
42898
|
}
|
|
42697
42899
|
return pluginApi.q.resolve();
|
|
@@ -42825,10 +43027,10 @@ function Feedback() {
|
|
|
42825
43027
|
return globalPendo.ajax.postJSON(getFullUrl('/analytics'), toSend);
|
|
42826
43028
|
}
|
|
42827
43029
|
function addOverlay() {
|
|
42828
|
-
|
|
43030
|
+
const widget = globalPendo.dom(`#${elemIds.feedbackWidget}`);
|
|
42829
43031
|
if (!widget)
|
|
42830
43032
|
return;
|
|
42831
|
-
|
|
43033
|
+
const overlayStyles = {
|
|
42832
43034
|
'position': 'fixed',
|
|
42833
43035
|
'top': '0',
|
|
42834
43036
|
'right': '0',
|
|
@@ -42840,7 +43042,7 @@ function Feedback() {
|
|
|
42840
43042
|
'animation': 'pendoFeedbackFadeIn 0.5s 0s 1 alternate both',
|
|
42841
43043
|
'-webkit-animation': 'pendoFeedbackFadeIn 0.5s 0s 1 alternate both'
|
|
42842
43044
|
};
|
|
42843
|
-
|
|
43045
|
+
const overlayElement = globalPendo.dom(document.createElement('div'));
|
|
42844
43046
|
overlayElement.attr('id', 'feedback-overlay');
|
|
42845
43047
|
overlayElement.css(overlayStyles);
|
|
42846
43048
|
overlayElement.appendTo(widget.getParent());
|
|
@@ -42945,22 +43147,22 @@ function Feedback() {
|
|
|
42945
43147
|
}
|
|
42946
43148
|
}
|
|
42947
43149
|
function buildOuterTriggerDiv(positionInfo) {
|
|
42948
|
-
|
|
42949
|
-
|
|
42950
|
-
|
|
43150
|
+
const horizontalStyles = getHorizontalPositionStyles(positionInfo);
|
|
43151
|
+
const verticalStyles = getVerticalPositionStyles(positionInfo);
|
|
43152
|
+
const styles = globalPendo._.extend({
|
|
42951
43153
|
'position': 'fixed',
|
|
42952
43154
|
'height': '43px',
|
|
42953
43155
|
'opacity': '1 !important',
|
|
42954
43156
|
'z-index': '9001'
|
|
42955
43157
|
}, horizontalStyles, verticalStyles);
|
|
42956
|
-
|
|
43158
|
+
const outerTrigger = globalPendo.dom(document.createElement('div'));
|
|
42957
43159
|
outerTrigger.attr('id', elemIds.feedbackTrigger);
|
|
42958
43160
|
outerTrigger.css(styles);
|
|
42959
43161
|
outerTrigger.attr('data-turbolinks-permanent', '');
|
|
42960
43162
|
return outerTrigger;
|
|
42961
43163
|
}
|
|
42962
43164
|
function buildNotification() {
|
|
42963
|
-
|
|
43165
|
+
const styles = {
|
|
42964
43166
|
'background-color': '#D85039',
|
|
42965
43167
|
'color': '#fff',
|
|
42966
43168
|
'border-radius': '50%',
|
|
@@ -42977,20 +43179,20 @@ function Feedback() {
|
|
|
42977
43179
|
'animation-delay': '1s',
|
|
42978
43180
|
'animation-iteration-count': '1'
|
|
42979
43181
|
};
|
|
42980
|
-
|
|
43182
|
+
const notification = globalPendo.dom(document.createElement('span'));
|
|
42981
43183
|
notification.attr('id', 'feedback-trigger-notification');
|
|
42982
43184
|
notification.css(styles);
|
|
42983
43185
|
return notification;
|
|
42984
43186
|
}
|
|
42985
43187
|
function buildTriggerButton(settings, positionInfo) {
|
|
42986
|
-
|
|
43188
|
+
let borderRadius;
|
|
42987
43189
|
if (positionInfo.horizontalPosition === 'left') {
|
|
42988
43190
|
borderRadius = '0 0 5px 5px';
|
|
42989
43191
|
}
|
|
42990
43192
|
else {
|
|
42991
43193
|
borderRadius = '3px 3px 0 0';
|
|
42992
43194
|
}
|
|
42993
|
-
|
|
43195
|
+
const styles = {
|
|
42994
43196
|
'border': 'none',
|
|
42995
43197
|
'padding': '11px 18px 14px 18px',
|
|
42996
43198
|
'background-color': settings.triggerColor,
|
|
@@ -43001,21 +43203,32 @@ function Feedback() {
|
|
|
43001
43203
|
'cursor': 'pointer',
|
|
43002
43204
|
'text-align': 'left'
|
|
43003
43205
|
};
|
|
43004
|
-
|
|
43206
|
+
const triggerButton = globalPendo.dom(document.createElement('button'));
|
|
43005
43207
|
triggerButton.attr('id', elemIds.feedbackTriggerButton);
|
|
43006
43208
|
triggerButton.css(styles);
|
|
43007
43209
|
triggerButton.text(settings.triggerText);
|
|
43008
43210
|
return triggerButton;
|
|
43009
43211
|
}
|
|
43010
43212
|
function addTriggerPseudoStyles() {
|
|
43011
|
-
|
|
43213
|
+
const pseudoStyles = `
|
|
43214
|
+
#feedback-trigger button:hover {
|
|
43215
|
+
box-shadow: 0 -5px 20px rgba(0,0,0,.19) !important;
|
|
43216
|
+
outline: none !important;
|
|
43217
|
+
background: #3e566f !important;
|
|
43218
|
+
}
|
|
43219
|
+
#feedback-trigger button:focus {
|
|
43220
|
+
box-shadow: 0 -5px 20px rgba(0,0,0,.19) !important;
|
|
43221
|
+
outline: none !important;
|
|
43222
|
+
background: #3e566f !important;
|
|
43223
|
+
}
|
|
43224
|
+
`;
|
|
43012
43225
|
pluginApi.util.addInlineStyles('pendo-feedback-trigger-styles', pseudoStyles);
|
|
43013
43226
|
}
|
|
43014
43227
|
function createTrigger(settings, positionInfo) {
|
|
43015
43228
|
addTriggerPseudoStyles();
|
|
43016
|
-
|
|
43017
|
-
|
|
43018
|
-
|
|
43229
|
+
const triggerElement = buildOuterTriggerDiv(positionInfo);
|
|
43230
|
+
const notificationElement = buildNotification();
|
|
43231
|
+
const triggerButtonElement = buildTriggerButton(settings, positionInfo);
|
|
43019
43232
|
triggerElement.append(notificationElement);
|
|
43020
43233
|
triggerElement.append(triggerButtonElement);
|
|
43021
43234
|
triggerElement.appendTo(globalPendo.dom.getBody());
|
|
@@ -43039,7 +43252,7 @@ function Feedback() {
|
|
|
43039
43252
|
iframeWrapper.css(getWidgetOriginalStyles());
|
|
43040
43253
|
iframeWrapper.attr('id', elemIds.feedbackWidget);
|
|
43041
43254
|
iframeWrapper.attr('data-turbolinks-permanent', 'true');
|
|
43042
|
-
iframeWrapper.addClass(
|
|
43255
|
+
iframeWrapper.addClass(`buttonIs-${horizontalPosition}`);
|
|
43043
43256
|
return iframeWrapper;
|
|
43044
43257
|
}
|
|
43045
43258
|
function buildIframeContainer() {
|
|
@@ -43056,13 +43269,22 @@ function Feedback() {
|
|
|
43056
43269
|
return iframeContainer;
|
|
43057
43270
|
}
|
|
43058
43271
|
function addWidgetVisibleButtonStyles(buttonStylePosition) {
|
|
43059
|
-
|
|
43060
|
-
|
|
43272
|
+
let side = buttonStylePosition === 'left' ? 'left' : 'right'; // just in case something was not left or right for some reason
|
|
43273
|
+
const styles = `
|
|
43274
|
+
.buttonIs-${side}.visible {
|
|
43275
|
+
${side}: 0 !important;
|
|
43276
|
+
width: 470px !important;
|
|
43277
|
+
animation-direction: alternate-reverse !important;
|
|
43278
|
+
animation: pendoFeedbackSlideFrom-${side} 0.5s 0s 1 alternate both !important;
|
|
43279
|
+
-webkit-animation: pendoFeedbackSlideFrom-${side} 0.5s 0s 1 alternate both !important;
|
|
43280
|
+
z-index: 9002 !important;
|
|
43281
|
+
}
|
|
43282
|
+
`;
|
|
43061
43283
|
pluginApi.util.addInlineStyles(elemIds.feedbackFrameStyles, styles);
|
|
43062
43284
|
}
|
|
43063
43285
|
function initialiseWidgetFrame(horizontalPosition) {
|
|
43064
43286
|
addWidgetVisibleButtonStyles(horizontalPosition);
|
|
43065
|
-
|
|
43287
|
+
const iframeElement = buildIframeWrapper(horizontalPosition);
|
|
43066
43288
|
iframeElement.append(buildIframeContainer());
|
|
43067
43289
|
iframeElement.appendTo(globalPendo.dom.getBody());
|
|
43068
43290
|
subscribeToIframeMessages();
|
|
@@ -43086,7 +43308,7 @@ function Feedback() {
|
|
|
43086
43308
|
return widgetLoaded;
|
|
43087
43309
|
}
|
|
43088
43310
|
function getPendoOptions() {
|
|
43089
|
-
|
|
43311
|
+
let options = pluginApi.ConfigReader.getLocalConfig();
|
|
43090
43312
|
if (!globalPendo._.isObject(options))
|
|
43091
43313
|
options = {};
|
|
43092
43314
|
if (!globalPendo._.isObject(options.visitor))
|
|
@@ -43114,7 +43336,7 @@ function Feedback() {
|
|
|
43114
43336
|
return true;
|
|
43115
43337
|
}
|
|
43116
43338
|
function getQueryParam(url, paramName) {
|
|
43117
|
-
|
|
43339
|
+
const results = new RegExp('[?&]' + paramName + '=([^&#]*)').exec(url);
|
|
43118
43340
|
if (results == null) {
|
|
43119
43341
|
return null;
|
|
43120
43342
|
}
|
|
@@ -43131,13 +43353,13 @@ function Feedback() {
|
|
|
43131
43353
|
return pluginApi.q.reject();
|
|
43132
43354
|
if (!canInitFeedback(pendoOptions))
|
|
43133
43355
|
return pluginApi.q.reject();
|
|
43134
|
-
|
|
43356
|
+
const feedbackOptions = convertPendoToFeedbackOptions(pendoOptions);
|
|
43135
43357
|
try {
|
|
43136
|
-
|
|
43137
|
-
if (
|
|
43358
|
+
const fdbkDst = getQueryParam(globalPendo.url.get(), 'fdbkDst');
|
|
43359
|
+
if (fdbkDst && fdbkDst.startsWith('case')) {
|
|
43138
43360
|
initialized = true;
|
|
43139
43361
|
getFeedbackLoginUrl().then(function (loginUrl) {
|
|
43140
|
-
|
|
43362
|
+
const destinationUrl = loginUrl + '&fdbkDst=' + fdbkDst;
|
|
43141
43363
|
window.location.href = destinationUrl;
|
|
43142
43364
|
});
|
|
43143
43365
|
return;
|
|
@@ -43186,7 +43408,7 @@ function Feedback() {
|
|
|
43186
43408
|
function convertPendoToFeedbackOptions(options) {
|
|
43187
43409
|
var jwtOptions = pluginApi.agent.getJwtInfoCopy();
|
|
43188
43410
|
if (globalPendo._.isEmpty(jwtOptions)) {
|
|
43189
|
-
|
|
43411
|
+
const feedbackOptions = {};
|
|
43190
43412
|
feedbackOptions.user = globalPendo._.pick(options.visitor, 'id', 'full_name', 'firstName', 'lastName', 'email', 'tags', 'custom_allowed_products');
|
|
43191
43413
|
globalPendo._.extend(feedbackOptions.user, { allowed_products: [{ id: feedbackAllowedProductId }] });
|
|
43192
43414
|
feedbackOptions.account = globalPendo._.pick(options.account, 'id', 'name', 'monthly_value', 'is_paying', 'tags');
|
|
@@ -48721,32 +48943,31 @@ var n;
|
|
|
48721
48943
|
}(n || (n = {}));
|
|
48722
48944
|
return record; }
|
|
48723
48945
|
|
|
48724
|
-
|
|
48725
|
-
|
|
48726
|
-
if (maxCount === void 0) { maxCount = Infinity; }
|
|
48946
|
+
class SessionRecorderBuffer {
|
|
48947
|
+
constructor(interval, maxCount = Infinity) {
|
|
48727
48948
|
this.data = [];
|
|
48728
48949
|
this.sequenceNumber = 0;
|
|
48729
48950
|
this.interval = interval;
|
|
48730
48951
|
this.maxCount = maxCount;
|
|
48731
48952
|
this.doubledMaxCount = maxCount * 2;
|
|
48732
48953
|
}
|
|
48733
|
-
|
|
48954
|
+
isEmpty() {
|
|
48734
48955
|
return this.data.length === 0;
|
|
48735
|
-
}
|
|
48736
|
-
|
|
48956
|
+
}
|
|
48957
|
+
count() {
|
|
48737
48958
|
return this.data.length;
|
|
48738
|
-
}
|
|
48739
|
-
|
|
48959
|
+
}
|
|
48960
|
+
clear() {
|
|
48740
48961
|
this.data.length = 0;
|
|
48741
|
-
}
|
|
48742
|
-
|
|
48962
|
+
}
|
|
48963
|
+
clearSequence() {
|
|
48743
48964
|
this.sequenceNumber = 0;
|
|
48744
|
-
}
|
|
48745
|
-
|
|
48965
|
+
}
|
|
48966
|
+
push(event) {
|
|
48746
48967
|
this.data.push(event);
|
|
48747
48968
|
this.checkRateLimit();
|
|
48748
|
-
}
|
|
48749
|
-
|
|
48969
|
+
}
|
|
48970
|
+
pack(envelope, _) {
|
|
48750
48971
|
var eventsToSend = this.data.splice(0, this.maxCount);
|
|
48751
48972
|
envelope.recordingPayload = eventsToSend;
|
|
48752
48973
|
envelope.sequence = this.sequenceNumber;
|
|
@@ -48754,8 +48975,8 @@ var SessionRecorderBuffer = /** @class */ (function () {
|
|
|
48754
48975
|
if (eventsToSend.length) {
|
|
48755
48976
|
envelope.browserTime = eventsToSend[0].timestamp;
|
|
48756
48977
|
}
|
|
48757
|
-
envelope.recordingPayloadMetadata = _.map(eventsToSend,
|
|
48758
|
-
|
|
48978
|
+
envelope.recordingPayloadMetadata = _.map(eventsToSend, event => {
|
|
48979
|
+
const metadata = _.pick(event, 'type', 'timestamp');
|
|
48759
48980
|
if (event.data) {
|
|
48760
48981
|
metadata.data = _.pick(event.data, 'source', 'type', 'x', 'y', 'id', 'height', 'width', 'href');
|
|
48761
48982
|
}
|
|
@@ -48763,30 +48984,18 @@ var SessionRecorderBuffer = /** @class */ (function () {
|
|
|
48763
48984
|
});
|
|
48764
48985
|
this.sequenceNumber += eventsToSend.length;
|
|
48765
48986
|
return envelope;
|
|
48766
|
-
}
|
|
48767
|
-
|
|
48768
|
-
|
|
48987
|
+
}
|
|
48988
|
+
checkRateLimit() {
|
|
48989
|
+
const length = this.data.length;
|
|
48769
48990
|
if (length >= this.doubledMaxCount && length % this.maxCount === 0) {
|
|
48770
|
-
|
|
48991
|
+
const elapsed = this.data[length - 1].timestamp - this.data[length - this.doubledMaxCount].timestamp;
|
|
48771
48992
|
if (elapsed <= this.interval && this.onRateLimit) {
|
|
48772
48993
|
this.onRateLimit();
|
|
48773
48994
|
}
|
|
48774
48995
|
}
|
|
48775
|
-
}
|
|
48776
|
-
|
|
48777
|
-
}());
|
|
48996
|
+
}
|
|
48997
|
+
}
|
|
48778
48998
|
|
|
48779
|
-
var __assign = function() {
|
|
48780
|
-
__assign = Object.assign || function __assign(t) {
|
|
48781
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
48782
|
-
s = arguments[i];
|
|
48783
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
48784
|
-
}
|
|
48785
|
-
return t;
|
|
48786
|
-
};
|
|
48787
|
-
return __assign.apply(this, arguments);
|
|
48788
|
-
};
|
|
48789
|
-
|
|
48790
48999
|
function __rest(s, e) {
|
|
48791
49000
|
var t = {};
|
|
48792
49001
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -48809,52 +49018,24 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
48809
49018
|
});
|
|
48810
49019
|
}
|
|
48811
49020
|
|
|
48812
|
-
function __generator(thisArg, body) {
|
|
48813
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
48814
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
48815
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
48816
|
-
function step(op) {
|
|
48817
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
48818
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
48819
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
48820
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
48821
|
-
switch (op[0]) {
|
|
48822
|
-
case 0: case 1: t = op; break;
|
|
48823
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
48824
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
48825
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48826
|
-
default:
|
|
48827
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
48828
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
48829
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
48830
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
48831
|
-
if (t[2]) _.ops.pop();
|
|
48832
|
-
_.trys.pop(); continue;
|
|
48833
|
-
}
|
|
48834
|
-
op = body.call(thisArg, _);
|
|
48835
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
48836
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
48837
|
-
}
|
|
48838
|
-
}
|
|
48839
|
-
|
|
48840
49021
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
48841
49022
|
var e = new Error(message);
|
|
48842
49023
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
48843
49024
|
};
|
|
48844
49025
|
|
|
48845
|
-
|
|
48846
|
-
|
|
48847
|
-
|
|
48848
|
-
|
|
48849
|
-
|
|
49026
|
+
const RECORDING_CONFIG_WORKERURL$1 = 'recording.workerUrl';
|
|
49027
|
+
const MAX_SIZE = 2000000;
|
|
49028
|
+
const RESOURCE_CACHING$1 = 'resourceCaching';
|
|
49029
|
+
class Transport {
|
|
49030
|
+
constructor(WorkerClass, pendo, api) {
|
|
48850
49031
|
this.WorkerClass = WorkerClass;
|
|
48851
49032
|
this.pendo = pendo;
|
|
48852
49033
|
this.api = api;
|
|
48853
49034
|
this.maxSize = MAX_SIZE;
|
|
48854
|
-
this.lockID =
|
|
49035
|
+
this.lockID = `worker-lock-${this.pendo.randomString(16)}`;
|
|
48855
49036
|
this.isResourceCachingEnabled = this.api.ConfigReader.get(RESOURCE_CACHING$1);
|
|
48856
49037
|
}
|
|
48857
|
-
|
|
49038
|
+
start(config) {
|
|
48858
49039
|
if (config.disableWorker)
|
|
48859
49040
|
return;
|
|
48860
49041
|
if (!this.worker) {
|
|
@@ -48864,7 +49045,7 @@ var Transport = /** @class */ (function () {
|
|
|
48864
49045
|
this.worker = config.workerOverride;
|
|
48865
49046
|
}
|
|
48866
49047
|
else {
|
|
48867
|
-
|
|
49048
|
+
const workerUrl = this.api.ConfigReader.get(RECORDING_CONFIG_WORKERURL$1);
|
|
48868
49049
|
this.usesSelfHostedWorker = workerUrl != null;
|
|
48869
49050
|
this.worker = workerUrl ? new Worker(workerUrl) : new this.WorkerClass();
|
|
48870
49051
|
}
|
|
@@ -48878,35 +49059,34 @@ var Transport = /** @class */ (function () {
|
|
|
48878
49059
|
this.worker = null;
|
|
48879
49060
|
}
|
|
48880
49061
|
}
|
|
48881
|
-
}
|
|
48882
|
-
|
|
49062
|
+
}
|
|
49063
|
+
stop() {
|
|
48883
49064
|
if (this.worker) {
|
|
48884
49065
|
this.worker.terminate();
|
|
48885
49066
|
delete this.worker;
|
|
48886
49067
|
}
|
|
48887
|
-
}
|
|
48888
|
-
|
|
48889
|
-
|
|
48890
|
-
|
|
48891
|
-
var payload = envelope.payload;
|
|
49068
|
+
}
|
|
49069
|
+
send(envelope, isUnload, failureCount = 0) {
|
|
49070
|
+
let { url } = envelope;
|
|
49071
|
+
const { payload } = envelope;
|
|
48892
49072
|
if (failureCount > 0) {
|
|
48893
|
-
url =
|
|
49073
|
+
url = `${url}&rt=${failureCount}`;
|
|
48894
49074
|
}
|
|
48895
49075
|
if (this.worker && !isUnload && payload) {
|
|
48896
|
-
|
|
48897
|
-
|
|
48898
|
-
|
|
48899
|
-
|
|
49076
|
+
const deferred = {};
|
|
49077
|
+
deferred.promise = new Promise$2((resolve, reject) => {
|
|
49078
|
+
deferred.resolve = resolve;
|
|
49079
|
+
deferred.reject = reject;
|
|
48900
49080
|
});
|
|
48901
|
-
this.workerResponse =
|
|
48902
|
-
this.worker.postMessage({ url
|
|
48903
|
-
return
|
|
49081
|
+
this.workerResponse = deferred;
|
|
49082
|
+
this.worker.postMessage({ url, payload, shouldCacheResources: this.isResourceCachingEnabled });
|
|
49083
|
+
return deferred.promise;
|
|
48904
49084
|
}
|
|
48905
49085
|
else {
|
|
48906
49086
|
if (!envelope.body) {
|
|
48907
|
-
|
|
49087
|
+
const strPayload = JSON.stringify(payload);
|
|
48908
49088
|
if (strPayload.length > this.maxSize) {
|
|
48909
|
-
|
|
49089
|
+
const error = new Error('maximum recording payload size exceeded');
|
|
48910
49090
|
error.reason = 'HEAVY_EVENT';
|
|
48911
49091
|
error.context = {
|
|
48912
49092
|
size: strPayload.length,
|
|
@@ -48917,14 +49097,14 @@ var Transport = /** @class */ (function () {
|
|
|
48917
49097
|
envelope.body = this.pendo.compress(strPayload, 'binary');
|
|
48918
49098
|
delete envelope.payload;
|
|
48919
49099
|
}
|
|
48920
|
-
url =
|
|
49100
|
+
url = `${url}&ct=${new Date().getTime()}`;
|
|
48921
49101
|
return this.post(url, {
|
|
48922
49102
|
keepalive: isUnload,
|
|
48923
49103
|
body: envelope.body
|
|
48924
49104
|
});
|
|
48925
49105
|
}
|
|
48926
|
-
}
|
|
48927
|
-
|
|
49106
|
+
}
|
|
49107
|
+
post(url, options) {
|
|
48928
49108
|
options.method = 'POST';
|
|
48929
49109
|
if (options.keepalive && this.api.transmit.fetchKeepalive.supported()) {
|
|
48930
49110
|
return this.api.transmit.fetchKeepalive(url, options);
|
|
@@ -48936,57 +49116,46 @@ var Transport = /** @class */ (function () {
|
|
|
48936
49116
|
else {
|
|
48937
49117
|
return this.pendo.ajax.post(url, options.body);
|
|
48938
49118
|
}
|
|
48939
|
-
}
|
|
48940
|
-
|
|
48941
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
48942
|
-
|
|
48943
|
-
|
|
48944
|
-
|
|
48945
|
-
|
|
48946
|
-
|
|
48947
|
-
|
|
48948
|
-
|
|
48949
|
-
|
|
48950
|
-
|
|
48951
|
-
|
|
48952
|
-
|
|
48953
|
-
|
|
48954
|
-
|
|
48955
|
-
|
|
48956
|
-
|
|
48957
|
-
return [2 /*return*/];
|
|
48958
|
-
}
|
|
48959
|
-
// handle POST request response from worker
|
|
48960
|
-
if (messageEvent.data && messageEvent.data.error) {
|
|
48961
|
-
if ((messageEvent.data.status && messageEvent.data.status < 500) ||
|
|
48962
|
-
messageEvent.data.sequence == null) {
|
|
48963
|
-
this.api.log.critical('Failed to send recording data from web worker', { error: messageEvent.data.error });
|
|
48964
|
-
}
|
|
48965
|
-
if (this.workerResponse) {
|
|
48966
|
-
this.workerResponse.reject();
|
|
48967
|
-
this.workerResponse = null;
|
|
48968
|
-
}
|
|
48969
|
-
}
|
|
48970
|
-
if (this.workerResponse) {
|
|
48971
|
-
this.workerResponse.resolve();
|
|
48972
|
-
this.workerResponse = null;
|
|
48973
|
-
}
|
|
48974
|
-
return [2 /*return*/];
|
|
49119
|
+
}
|
|
49120
|
+
_onMessage(messageEvent) {
|
|
49121
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49122
|
+
if (messageEvent.data && messageEvent.data.ready && navigator.locks) {
|
|
49123
|
+
// When the lock is released, we can assume the worker was terminated or closed
|
|
49124
|
+
yield navigator.locks.request(this.lockID, () => { });
|
|
49125
|
+
this.onWorkerMessage({ type: 'workerDied' });
|
|
49126
|
+
}
|
|
49127
|
+
// handle non-POST request responses from worker
|
|
49128
|
+
if (messageEvent.data && messageEvent.data.type) {
|
|
49129
|
+
this.onWorkerMessage(messageEvent.data);
|
|
49130
|
+
return;
|
|
49131
|
+
}
|
|
49132
|
+
// handle POST request response from worker
|
|
49133
|
+
if (messageEvent.data && messageEvent.data.error) {
|
|
49134
|
+
if ((messageEvent.data.status && messageEvent.data.status < 500) ||
|
|
49135
|
+
messageEvent.data.sequence == null) {
|
|
49136
|
+
this.api.log.critical('Failed to send recording data from web worker', { error: messageEvent.data.error });
|
|
48975
49137
|
}
|
|
48976
|
-
|
|
49138
|
+
if (this.workerResponse) {
|
|
49139
|
+
this.workerResponse.reject();
|
|
49140
|
+
this.workerResponse = null;
|
|
49141
|
+
}
|
|
49142
|
+
}
|
|
49143
|
+
if (this.workerResponse) {
|
|
49144
|
+
this.workerResponse.resolve();
|
|
49145
|
+
this.workerResponse = null;
|
|
49146
|
+
}
|
|
48977
49147
|
});
|
|
48978
|
-
}
|
|
48979
|
-
|
|
49148
|
+
}
|
|
49149
|
+
_onError() {
|
|
48980
49150
|
if (this.onError) {
|
|
48981
49151
|
this.onError();
|
|
48982
49152
|
}
|
|
48983
|
-
}
|
|
48984
|
-
|
|
48985
|
-
}());
|
|
49153
|
+
}
|
|
49154
|
+
}
|
|
48986
49155
|
|
|
48987
|
-
|
|
48988
|
-
|
|
48989
|
-
|
|
49156
|
+
const ELEMENT_NODE = 1;
|
|
49157
|
+
const INPUT_MASK = '*'.repeat(10);
|
|
49158
|
+
const NUMBER_INPUT_MASK = '0'.repeat(10);
|
|
48990
49159
|
function isElementNode(node) {
|
|
48991
49160
|
if (!node)
|
|
48992
49161
|
return false;
|
|
@@ -48995,12 +49164,10 @@ function isElementNode(node) {
|
|
|
48995
49164
|
return true;
|
|
48996
49165
|
}
|
|
48997
49166
|
function getParent(elem) {
|
|
48998
|
-
|
|
49167
|
+
const isElementShadowRoot = typeof window.ShadowRoot !== 'undefined' && elem instanceof window.ShadowRoot && elem.host;
|
|
48999
49168
|
return isElementShadowRoot ? elem.host : elem.parentNode;
|
|
49000
49169
|
}
|
|
49001
|
-
function distanceToMatch(node, selector, limit, distance) {
|
|
49002
|
-
if (limit === void 0) { limit = Infinity; }
|
|
49003
|
-
if (distance === void 0) { distance = 0; }
|
|
49170
|
+
function distanceToMatch(node, selector, limit = Infinity, distance = 0) {
|
|
49004
49171
|
if (distance > limit)
|
|
49005
49172
|
return -1;
|
|
49006
49173
|
if (!node)
|
|
@@ -49014,13 +49181,13 @@ function distanceToMatch(node, selector, limit, distance) {
|
|
|
49014
49181
|
return distanceToMatch(getParent(node), selector, limit, distance + 1);
|
|
49015
49182
|
}
|
|
49016
49183
|
function shouldMask(node, options) {
|
|
49017
|
-
|
|
49184
|
+
const { maskAllText, maskTextSelector, unmaskTextSelector } = options;
|
|
49018
49185
|
try {
|
|
49019
|
-
|
|
49186
|
+
const el = isElementNode(node) ? node : node.parentElement;
|
|
49020
49187
|
if (el === null)
|
|
49021
49188
|
return false;
|
|
49022
|
-
|
|
49023
|
-
|
|
49189
|
+
let maskDistance = -1;
|
|
49190
|
+
let unmaskDistance = -1;
|
|
49024
49191
|
if (maskAllText) {
|
|
49025
49192
|
unmaskDistance = distanceToMatch(el, unmaskTextSelector);
|
|
49026
49193
|
if (unmaskDistance < 0) {
|
|
@@ -49053,8 +49220,8 @@ function isNumberInput(element) {
|
|
|
49053
49220
|
}
|
|
49054
49221
|
function shouldMaskInput(element, maskInputOptions) {
|
|
49055
49222
|
if (maskInputOptions && isElementNode(element)) {
|
|
49056
|
-
|
|
49057
|
-
|
|
49223
|
+
const tagName = (element.tagName || '').toLowerCase();
|
|
49224
|
+
const type = (element.type || '').toLowerCase();
|
|
49058
49225
|
if (maskInputOptions[tagName] || maskInputOptions[type]) {
|
|
49059
49226
|
return true;
|
|
49060
49227
|
}
|
|
@@ -50541,12 +50708,12 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
|
|
|
50541
50708
|
}
|
|
50542
50709
|
}
|
|
50543
50710
|
|
|
50544
|
-
|
|
50711
|
+
const ONE_HUNDRED_MB_IN_BYTES = 100 * 1024 * 1024;
|
|
50545
50712
|
function matchHostedResources(recordingEvent, stringifiedRecordingPayload) {
|
|
50546
|
-
|
|
50547
|
-
|
|
50713
|
+
const fontURLRegex = /https:\/\/[^"\\\s]+?\.(woff2?|ttf|otf|eot)(\?[^"\\\s]*)?\b/g;
|
|
50714
|
+
const matches = stringifiedRecordingPayload.match(fontURLRegex);
|
|
50548
50715
|
// de-duplicate matches
|
|
50549
|
-
|
|
50716
|
+
const hostedResources = matches ? Array.from(new Set(matches)) : [];
|
|
50550
50717
|
return {
|
|
50551
50718
|
type: 'recording',
|
|
50552
50719
|
visitorId: recordingEvent.visitorId,
|
|
@@ -50561,75 +50728,77 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
|
|
|
50561
50728
|
recordingPayloadMetadata: [],
|
|
50562
50729
|
sequence: 0,
|
|
50563
50730
|
recordingPayloadCount: 0,
|
|
50564
|
-
hostedResources
|
|
50731
|
+
hostedResources
|
|
50565
50732
|
};
|
|
50566
50733
|
}
|
|
50567
50734
|
// keep in mind changes here may need addressing in the extension worker proxy as well
|
|
50568
50735
|
self.onmessage = function (e) {
|
|
50569
50736
|
try {
|
|
50570
50737
|
if (e.data.type === 'init' && e.data.lockID) {
|
|
50571
|
-
navigator.locks
|
|
50572
|
-
|
|
50573
|
-
|
|
50574
|
-
|
|
50575
|
-
|
|
50576
|
-
|
|
50738
|
+
if (navigator.locks) {
|
|
50739
|
+
navigator.locks.request(e.data.lockID, () => {
|
|
50740
|
+
postMessage({ ready: true });
|
|
50741
|
+
// This unresolved promise keeps the lock held with the worker until the worker is
|
|
50742
|
+
// terminated at which point the lock is released.
|
|
50743
|
+
return new Promise$2(() => { });
|
|
50744
|
+
});
|
|
50745
|
+
}
|
|
50577
50746
|
return;
|
|
50578
50747
|
}
|
|
50579
50748
|
if (e.data.url && e.data.payload) {
|
|
50580
|
-
|
|
50749
|
+
let { url, payload, shouldCacheResources } = e.data;
|
|
50581
50750
|
if (Object.keys(payload).length === 0) {
|
|
50582
50751
|
postMessage({
|
|
50583
50752
|
type: 'emptyPayload'
|
|
50584
50753
|
});
|
|
50585
50754
|
}
|
|
50586
|
-
|
|
50587
|
-
|
|
50755
|
+
const { sequence } = payload;
|
|
50756
|
+
const stringifiedRecordingPayload = JSON.stringify(payload.recordingPayload);
|
|
50588
50757
|
// calculate and post back the recording payload size before the payload is compressed
|
|
50589
|
-
|
|
50590
|
-
|
|
50758
|
+
const recordingPayloadSize = new TextEncoder().encode(stringifiedRecordingPayload).length;
|
|
50759
|
+
const exceedsPayloadSizeLimit = recordingPayloadSize >= ONE_HUNDRED_MB_IN_BYTES;
|
|
50591
50760
|
postMessage({
|
|
50592
50761
|
type: 'recordingPayloadSize',
|
|
50593
|
-
recordingPayloadSize
|
|
50594
|
-
exceedsPayloadSizeLimit
|
|
50762
|
+
recordingPayloadSize,
|
|
50763
|
+
exceedsPayloadSizeLimit
|
|
50595
50764
|
});
|
|
50596
50765
|
// don't attempt to send the payload if it exceeds the allowed limit
|
|
50597
50766
|
if (exceedsPayloadSizeLimit)
|
|
50598
50767
|
return;
|
|
50599
50768
|
if (shouldCacheResources) {
|
|
50600
|
-
|
|
50769
|
+
const hostedResourcesEvent = matchHostedResources(payload, stringifiedRecordingPayload);
|
|
50601
50770
|
if (hostedResourcesEvent.hostedResources.length) {
|
|
50602
50771
|
postMessage({
|
|
50603
50772
|
type: 'hostedResources',
|
|
50604
|
-
hostedResourcesEvent
|
|
50773
|
+
hostedResourcesEvent
|
|
50605
50774
|
});
|
|
50606
50775
|
}
|
|
50607
50776
|
}
|
|
50608
50777
|
payload.recordingSize = recordingPayloadSize;
|
|
50609
|
-
|
|
50778
|
+
const body = compress(payload, 'binary');
|
|
50610
50779
|
// we want to calculate ct (current time) as close as we can to the actual POST request
|
|
50611
50780
|
// so that it's as accurate as possible
|
|
50612
|
-
url =
|
|
50781
|
+
url = `${url}&ct=${new Date().getTime()}`;
|
|
50613
50782
|
fetch(url, {
|
|
50614
50783
|
method: 'POST',
|
|
50615
|
-
body
|
|
50784
|
+
body
|
|
50616
50785
|
}).then(function (response) {
|
|
50617
50786
|
if (response.status < 200 || response.status >= 300) {
|
|
50618
50787
|
postMessage({
|
|
50619
|
-
error: new Error(
|
|
50788
|
+
error: new Error(`received status code ${response.status}: ${response.statusText}`),
|
|
50620
50789
|
status: response.status,
|
|
50621
|
-
sequence
|
|
50790
|
+
sequence
|
|
50622
50791
|
});
|
|
50623
50792
|
}
|
|
50624
50793
|
else {
|
|
50625
50794
|
postMessage({
|
|
50626
|
-
sequence
|
|
50795
|
+
sequence
|
|
50627
50796
|
});
|
|
50628
50797
|
}
|
|
50629
|
-
})
|
|
50798
|
+
}).catch(function (e) {
|
|
50630
50799
|
postMessage({
|
|
50631
50800
|
error: e,
|
|
50632
|
-
sequence
|
|
50801
|
+
sequence
|
|
50633
50802
|
});
|
|
50634
50803
|
});
|
|
50635
50804
|
}
|
|
@@ -50664,12 +50833,12 @@ function createReplayPlugin() {
|
|
|
50664
50833
|
* limit of number of keys in an object
|
|
50665
50834
|
* if an object contains more keys than this limit, we would call its toString function directly
|
|
50666
50835
|
*/
|
|
50667
|
-
|
|
50836
|
+
const NUM_OF_KEYS_LIMIT = 50;
|
|
50668
50837
|
/**
|
|
50669
50838
|
* limit number of depth in an object
|
|
50670
50839
|
* if an object is too deep, toString process may cause browser OOM
|
|
50671
50840
|
*/
|
|
50672
|
-
|
|
50841
|
+
const DEPTH_OF_LIMIT = 4;
|
|
50673
50842
|
/**
|
|
50674
50843
|
* serialize an HTML element by creating a shallow clone of it with text content
|
|
50675
50844
|
* and return the resulting outerHTML string (without the subtree)
|
|
@@ -50680,8 +50849,8 @@ function serializeHTML(node) {
|
|
|
50680
50849
|
if (!node || node.nodeType !== node.ELEMENT_NODE) {
|
|
50681
50850
|
return '';
|
|
50682
50851
|
}
|
|
50683
|
-
|
|
50684
|
-
|
|
50852
|
+
const nodeClone = node.cloneNode(false);
|
|
50853
|
+
const { textContent } = node;
|
|
50685
50854
|
if (textContent) {
|
|
50686
50855
|
nodeClone.textContent = textContent;
|
|
50687
50856
|
}
|
|
@@ -50695,7 +50864,7 @@ function isObject(obj) {
|
|
|
50695
50864
|
return false;
|
|
50696
50865
|
if (typeof obj !== 'object')
|
|
50697
50866
|
return false;
|
|
50698
|
-
|
|
50867
|
+
const proto = Object.getPrototypeOf(obj);
|
|
50699
50868
|
return proto === Object.prototype || proto === null;
|
|
50700
50869
|
}
|
|
50701
50870
|
/**
|
|
@@ -50704,11 +50873,11 @@ function isObject(obj) {
|
|
|
50704
50873
|
function isObjTooDeep(obj, limit) {
|
|
50705
50874
|
if (limit === 0)
|
|
50706
50875
|
return true;
|
|
50707
|
-
|
|
50876
|
+
const keys = Object.keys(obj);
|
|
50708
50877
|
if (keys.length === 0)
|
|
50709
50878
|
return false;
|
|
50710
|
-
return keys.some(
|
|
50711
|
-
|
|
50879
|
+
return keys.some(key => {
|
|
50880
|
+
const value = obj[key];
|
|
50712
50881
|
return isObject(value) && isObjTooDeep(value, limit - 1);
|
|
50713
50882
|
});
|
|
50714
50883
|
}
|
|
@@ -50724,7 +50893,7 @@ function shouldIgnore(_obj) {
|
|
|
50724
50893
|
return false;
|
|
50725
50894
|
}
|
|
50726
50895
|
// out of keys limit
|
|
50727
|
-
|
|
50896
|
+
const keys = Object.keys(_obj);
|
|
50728
50897
|
if (keys.length > NUM_OF_KEYS_LIMIT) {
|
|
50729
50898
|
return true;
|
|
50730
50899
|
}
|
|
@@ -50756,7 +50925,7 @@ function stringify(arg) {
|
|
|
50756
50925
|
return value.toString ? value.toString() : '[object Object]';
|
|
50757
50926
|
}
|
|
50758
50927
|
if (value instanceof ArrayBuffer)
|
|
50759
|
-
return
|
|
50928
|
+
return `ArrayBuffer { byteLength: ${value.byteLength} }`;
|
|
50760
50929
|
if (value instanceof Error)
|
|
50761
50930
|
return value.name + ': ' + value.message;
|
|
50762
50931
|
if (value instanceof Node) {
|
|
@@ -50764,10 +50933,10 @@ function stringify(arg) {
|
|
|
50764
50933
|
}
|
|
50765
50934
|
// Handle events
|
|
50766
50935
|
if (value instanceof Event) {
|
|
50767
|
-
|
|
50936
|
+
const eventResult = {};
|
|
50768
50937
|
// eslint-disable-next-line guard-for-in
|
|
50769
|
-
for (
|
|
50770
|
-
|
|
50938
|
+
for (const eventKey in value) {
|
|
50939
|
+
const eventValue = value[eventKey];
|
|
50771
50940
|
eventResult[eventKey] = Array.isArray(eventValue) && eventValue[0] instanceof HTMLElement
|
|
50772
50941
|
? serializeHTML(eventValue[0])
|
|
50773
50942
|
: eventValue;
|
|
@@ -50778,31 +50947,30 @@ function stringify(arg) {
|
|
|
50778
50947
|
});
|
|
50779
50948
|
}
|
|
50780
50949
|
|
|
50781
|
-
|
|
50782
|
-
|
|
50950
|
+
class StackFrame {
|
|
50951
|
+
constructor(obj) {
|
|
50783
50952
|
this.fileName = obj.fileName || '';
|
|
50784
50953
|
this.functionName = obj.functionName || '';
|
|
50785
50954
|
this.lineNumber = obj.lineNumber;
|
|
50786
50955
|
this.columnNumber = obj.columnNumber;
|
|
50787
50956
|
}
|
|
50788
|
-
|
|
50789
|
-
|
|
50957
|
+
toString() {
|
|
50958
|
+
const { fileName, functionName, lineNumber = '', columnNumber = '' } = this;
|
|
50790
50959
|
return functionName
|
|
50791
|
-
?
|
|
50792
|
-
:
|
|
50793
|
-
}
|
|
50794
|
-
|
|
50795
|
-
|
|
50796
|
-
|
|
50797
|
-
|
|
50798
|
-
|
|
50799
|
-
|
|
50800
|
-
|
|
50801
|
-
var ErrorStackParser = {
|
|
50960
|
+
? `${functionName} (${fileName}:${lineNumber}:${columnNumber})`
|
|
50961
|
+
: `${fileName}:${lineNumber}:${columnNumber}`;
|
|
50962
|
+
}
|
|
50963
|
+
}
|
|
50964
|
+
const FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
|
|
50965
|
+
const CHROME_EDGE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
|
|
50966
|
+
const SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/;
|
|
50967
|
+
const LOCATION_REGEXP = /(.+?)(?::(\d+))?(?::(\d+))?$/;
|
|
50968
|
+
const DEFAULT_NUM_FRAMES_TO_SKIP = 5;
|
|
50969
|
+
const ErrorStackParser = {
|
|
50802
50970
|
/**
|
|
50803
50971
|
* Given an Error object, extract the most information from it.
|
|
50804
50972
|
*/
|
|
50805
|
-
parse
|
|
50973
|
+
parse(error, maxFramesToSave) {
|
|
50806
50974
|
if (!(error === null || error === void 0 ? void 0 : error.stack))
|
|
50807
50975
|
return [];
|
|
50808
50976
|
// Chrome, Edge, Opera ≥15
|
|
@@ -50816,25 +50984,24 @@ var ErrorStackParser = {
|
|
|
50816
50984
|
return [];
|
|
50817
50985
|
},
|
|
50818
50986
|
// Separate line and column numbers from a string of the form: (URI:Line:Column)
|
|
50819
|
-
extractLocation
|
|
50987
|
+
extractLocation(urlLike) {
|
|
50820
50988
|
// Fail-fast but return locations like "(native)"
|
|
50821
50989
|
if (urlLike.indexOf(':') === -1) {
|
|
50822
50990
|
return [urlLike];
|
|
50823
50991
|
}
|
|
50824
|
-
|
|
50992
|
+
const parts = LOCATION_REGEXP.exec(urlLike.replace(/[()]/g, ''));
|
|
50825
50993
|
if (!parts)
|
|
50826
|
-
throw new Error(
|
|
50994
|
+
throw new Error(`Cannot parse given url: ${urlLike}`);
|
|
50827
50995
|
return [parts[1], parts[2] || undefined, parts[3] || undefined];
|
|
50828
50996
|
},
|
|
50829
|
-
parseHelper
|
|
50830
|
-
|
|
50831
|
-
|
|
50832
|
-
|
|
50833
|
-
|
|
50834
|
-
|
|
50835
|
-
|
|
50836
|
-
|
|
50837
|
-
var shouldSkipLine = (includeMatchedLine && !lineMatchesRegex) || // if line doesn't match regex and we want matched lines, skip it
|
|
50997
|
+
parseHelper({ regex, includeMatchedLine }, error, maxFramesToSave, callback) {
|
|
50998
|
+
const lines = error.stack.split('\n');
|
|
50999
|
+
const frames = [];
|
|
51000
|
+
let validFramesFound = 0;
|
|
51001
|
+
for (let i = 0; i < lines.length; i++) {
|
|
51002
|
+
const line = lines[i];
|
|
51003
|
+
const lineMatchesRegex = regex.test(line);
|
|
51004
|
+
const shouldSkipLine = (includeMatchedLine && !lineMatchesRegex) || // if line doesn't match regex and we want matched lines, skip it
|
|
50838
51005
|
(!includeMatchedLine && lineMatchesRegex); // if line does match regex but we don't want matched lines, skip it
|
|
50839
51006
|
if (shouldSkipLine)
|
|
50840
51007
|
continue;
|
|
@@ -50849,12 +51016,11 @@ var ErrorStackParser = {
|
|
|
50849
51016
|
}
|
|
50850
51017
|
return frames;
|
|
50851
51018
|
},
|
|
50852
|
-
parseChromiumStack
|
|
50853
|
-
|
|
50854
|
-
|
|
50855
|
-
var sanitizedLine;
|
|
51019
|
+
parseChromiumStack(error, maxFramesToSave) {
|
|
51020
|
+
return this.parseHelper({ regex: CHROME_EDGE_STACK_REGEXP, includeMatchedLine: true }, error, maxFramesToSave, (line, frames) => {
|
|
51021
|
+
let sanitizedLine;
|
|
50856
51022
|
if (line.indexOf('(eval ') > -1) {
|
|
50857
|
-
|
|
51023
|
+
const processedLine = line
|
|
50858
51024
|
.replace(/eval code/g, 'eval')
|
|
50859
51025
|
.replace(/(\(eval at [^()]*)|(\),.*$)/g, '');
|
|
50860
51026
|
sanitizedLine = processedLine.replace(/^\s+/, '').replace(/\(eval code/g, '(');
|
|
@@ -50864,7 +51030,7 @@ var ErrorStackParser = {
|
|
|
50864
51030
|
}
|
|
50865
51031
|
// capture and preserve the parenthesized location "(/foo/my bar.js:12:87)"
|
|
50866
51032
|
// in case it has spaces in it, as the string is split on \s+ later on
|
|
50867
|
-
|
|
51033
|
+
let location;
|
|
50868
51034
|
if (sanitizedLine.indexOf('(') > -1 && sanitizedLine.indexOf('):') > -1) {
|
|
50869
51035
|
location = sanitizedLine.match(/ (\((.+):(\d+):(\d+)\)$)/);
|
|
50870
51036
|
}
|
|
@@ -50872,23 +51038,22 @@ var ErrorStackParser = {
|
|
|
50872
51038
|
sanitizedLine = location
|
|
50873
51039
|
? sanitizedLine.replace(location[0], '')
|
|
50874
51040
|
: sanitizedLine;
|
|
50875
|
-
|
|
51041
|
+
const tokens = sanitizedLine.split(/\s+/).slice(1);
|
|
50876
51042
|
// if a location was matched, pass it to extractLocation() otherwise pop the last token
|
|
50877
|
-
|
|
50878
|
-
|
|
50879
|
-
|
|
51043
|
+
const locationParts = this.extractLocation(location ? location[1] : tokens.pop() || '');
|
|
51044
|
+
const functionName = tokens.join(' ') || undefined;
|
|
51045
|
+
const fileName = (locationParts[0] === 'eval' || locationParts[0] === '<anonymous>') ? undefined : locationParts[0];
|
|
50880
51046
|
frames.push(new StackFrame({
|
|
50881
|
-
functionName
|
|
50882
|
-
fileName
|
|
51047
|
+
functionName,
|
|
51048
|
+
fileName,
|
|
50883
51049
|
lineNumber: locationParts[1],
|
|
50884
51050
|
columnNumber: locationParts[2]
|
|
50885
51051
|
}));
|
|
50886
51052
|
});
|
|
50887
51053
|
},
|
|
50888
|
-
parseFirefoxSafariStack
|
|
50889
|
-
|
|
50890
|
-
|
|
50891
|
-
var processedLine = line;
|
|
51054
|
+
parseFirefoxSafariStack(error, maxFramesToSave) {
|
|
51055
|
+
return this.parseHelper({ regex: SAFARI_NATIVE_CODE_REGEXP, includeMatchedLine: false }, error, maxFramesToSave, (line, frames) => {
|
|
51056
|
+
let processedLine = line;
|
|
50892
51057
|
// Throw away eval information until we implement stacktrace.js/stackframe#8
|
|
50893
51058
|
if (processedLine.indexOf(' > eval') > -1) {
|
|
50894
51059
|
processedLine = processedLine.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ':$1');
|
|
@@ -50900,12 +51065,12 @@ var ErrorStackParser = {
|
|
|
50900
51065
|
}));
|
|
50901
51066
|
return;
|
|
50902
51067
|
}
|
|
50903
|
-
|
|
50904
|
-
|
|
50905
|
-
|
|
50906
|
-
|
|
51068
|
+
const functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
|
|
51069
|
+
const matches = processedLine.match(functionNameRegex);
|
|
51070
|
+
const functionName = matches && matches[1] ? matches[1] : undefined;
|
|
51071
|
+
const locationParts = this.extractLocation(processedLine.replace(functionNameRegex, ''));
|
|
50907
51072
|
frames.push(new StackFrame({
|
|
50908
|
-
functionName
|
|
51073
|
+
functionName,
|
|
50909
51074
|
fileName: locationParts[0],
|
|
50910
51075
|
lineNumber: locationParts[1],
|
|
50911
51076
|
columnNumber: locationParts[2]
|
|
@@ -50940,7 +51105,7 @@ function includes(str, substring) {
|
|
|
50940
51105
|
function getResourceType(blockedURI, directive) {
|
|
50941
51106
|
if (!directive || typeof directive !== 'string')
|
|
50942
51107
|
return 'resource';
|
|
50943
|
-
|
|
51108
|
+
const d = directive.toLowerCase();
|
|
50944
51109
|
if (blockedURI === 'inline') {
|
|
50945
51110
|
if (includes(d, 'script-src-attr')) {
|
|
50946
51111
|
return 'inline event handler';
|
|
@@ -50999,12 +51164,11 @@ function getResourceType(blockedURI, directive) {
|
|
|
50999
51164
|
function getDirective(policy, directiveName) {
|
|
51000
51165
|
if (!policy || !directiveName)
|
|
51001
51166
|
return '';
|
|
51002
|
-
|
|
51003
|
-
for (
|
|
51004
|
-
|
|
51005
|
-
|
|
51006
|
-
|
|
51007
|
-
if (lower === needle || lower.startsWith("".concat(needle, " "))) {
|
|
51167
|
+
const needle = directiveName.toLowerCase();
|
|
51168
|
+
for (const directive of policy.split(';')) {
|
|
51169
|
+
const trimmed = directive.trim();
|
|
51170
|
+
const lower = trimmed.toLowerCase();
|
|
51171
|
+
if (lower === needle || lower.startsWith(`${needle} `)) {
|
|
51008
51172
|
return trimmed;
|
|
51009
51173
|
}
|
|
51010
51174
|
}
|
|
@@ -51026,7 +51190,7 @@ function getDirective(policy, directiveName) {
|
|
|
51026
51190
|
function getArticle(phrase) {
|
|
51027
51191
|
if (!phrase || typeof phrase !== 'string')
|
|
51028
51192
|
return 'A';
|
|
51029
|
-
|
|
51193
|
+
const c = phrase.trim().charAt(0).toLowerCase();
|
|
51030
51194
|
return includes('aeiou', c) ? 'An' : 'A';
|
|
51031
51195
|
}
|
|
51032
51196
|
/**
|
|
@@ -51069,47 +51233,46 @@ function createCspViolationMessage(blockedURI, directive, isReportOnly, original
|
|
|
51069
51233
|
return 'Content Security Policy: Unknown violation occurred.';
|
|
51070
51234
|
}
|
|
51071
51235
|
try {
|
|
51072
|
-
|
|
51236
|
+
const reportOnlyText = isReportOnly ? ' (Report-Only)' : '';
|
|
51073
51237
|
// special case for frame-ancestors since it doesn't fit our template at all
|
|
51074
51238
|
if ((directive === null || directive === void 0 ? void 0 : directive.toLowerCase()) === 'frame-ancestors') {
|
|
51075
|
-
return
|
|
51239
|
+
return `Content Security Policy${reportOnlyText}: The display of ${blockedURI} in a frame was blocked because an ancestor violates your site's frame-ancestors policy.\nCurrent CSP: "${originalPolicy}".`;
|
|
51076
51240
|
}
|
|
51077
|
-
|
|
51078
|
-
|
|
51079
|
-
|
|
51080
|
-
|
|
51081
|
-
|
|
51082
|
-
|
|
51083
|
-
return
|
|
51241
|
+
const resourceType = getResourceType(blockedURI, directive);
|
|
51242
|
+
const article = getArticle(resourceType);
|
|
51243
|
+
const source = formatBlockedUri(blockedURI);
|
|
51244
|
+
const directiveValue = getDirective(originalPolicy, directive);
|
|
51245
|
+
const policyDisplay = directiveValue || directive;
|
|
51246
|
+
const resourceDescription = `${article} ${resourceType}${source ? ` from ${source}` : ''}`;
|
|
51247
|
+
return `Content Security Policy${reportOnlyText}: ${resourceDescription} was blocked by your site's \`${policyDisplay}\` policy.\nCurrent CSP: "${originalPolicy}".`;
|
|
51084
51248
|
}
|
|
51085
51249
|
catch (error) {
|
|
51086
|
-
return
|
|
51250
|
+
return `Content Security Policy: Error formatting violation message: ${error.message}`;
|
|
51087
51251
|
}
|
|
51088
51252
|
}
|
|
51089
51253
|
|
|
51090
|
-
|
|
51091
|
-
|
|
51254
|
+
const MAX_LENGTH = 1000;
|
|
51255
|
+
const PII_PATTERN = {
|
|
51092
51256
|
ip: /\b(?:\d{1,3}\.){3}\d{1,3}\b/g,
|
|
51093
51257
|
ssn: /\b\d{3}-\d{2}-\d{4}\b/g,
|
|
51094
51258
|
creditCard: /\b(?:\d[ -]?){12,18}\d\b/g,
|
|
51095
51259
|
httpsUrls: /https:\/\/[^\s]+/g,
|
|
51096
51260
|
email: /[\w._+-]+@[\w.-]+\.\w+/g
|
|
51097
51261
|
};
|
|
51098
|
-
|
|
51099
|
-
|
|
51100
|
-
|
|
51101
|
-
|
|
51102
|
-
|
|
51262
|
+
const PII_REPLACEMENT = '*'.repeat(10);
|
|
51263
|
+
const JSON_PII_KEYS = ['password', 'email', 'key', 'token', 'auth', 'authentication', 'phone', 'address', 'ssn'];
|
|
51264
|
+
const UNABLE_TO_DISPLAY_BODY = '[Unable to display body: detected PII could not be redacted]';
|
|
51265
|
+
const joinedKeys = JSON_PII_KEYS.join('|');
|
|
51266
|
+
const keyPattern = `"([^"]*(?:${joinedKeys})[^"]*)"`;
|
|
51103
51267
|
// only scrub strings, numbers, and booleans
|
|
51104
|
-
|
|
51268
|
+
const acceptedValues = '("([^"\\\\]*(?:\\\\.[^"\\\\]*)*")|(\\d+)|(true|false))';
|
|
51105
51269
|
/**
|
|
51106
51270
|
* Truncates a string to the max length
|
|
51107
51271
|
* @access private
|
|
51108
51272
|
* @param {String} string
|
|
51109
51273
|
* @returns {String}
|
|
51110
51274
|
*/
|
|
51111
|
-
function truncate(string, includeEllipsis) {
|
|
51112
|
-
if (includeEllipsis === void 0) { includeEllipsis = false; }
|
|
51275
|
+
function truncate(string, includeEllipsis = false) {
|
|
51113
51276
|
if (string.length <= MAX_LENGTH)
|
|
51114
51277
|
return string;
|
|
51115
51278
|
if (includeEllipsis) {
|
|
@@ -51126,7 +51289,7 @@ function truncate(string, includeEllipsis) {
|
|
|
51126
51289
|
* @returns {String}
|
|
51127
51290
|
*/
|
|
51128
51291
|
function generateLogKey(methodName, message, stackTrace) {
|
|
51129
|
-
return
|
|
51292
|
+
return `${methodName}|${message}|${stackTrace}`;
|
|
51130
51293
|
}
|
|
51131
51294
|
/**
|
|
51132
51295
|
* Checks if a string has 2 or more digits, a https URL, or an email address
|
|
@@ -51143,13 +51306,12 @@ function mightContainPII(string) {
|
|
|
51143
51306
|
* @param {String} string
|
|
51144
51307
|
* @returns {String}
|
|
51145
51308
|
*/
|
|
51146
|
-
function scrubPII(
|
|
51147
|
-
var string = _a.string, _ = _a._;
|
|
51309
|
+
function scrubPII({ string, _ }) {
|
|
51148
51310
|
if (!string || typeof string !== 'string')
|
|
51149
51311
|
return string;
|
|
51150
51312
|
if (!mightContainPII(string))
|
|
51151
51313
|
return string;
|
|
51152
|
-
return _.reduce(_.values(PII_PATTERN),
|
|
51314
|
+
return _.reduce(_.values(PII_PATTERN), (str, pattern) => str.replace(pattern, PII_REPLACEMENT), string);
|
|
51153
51315
|
}
|
|
51154
51316
|
/**
|
|
51155
51317
|
* Scrub PII from a stringified JSON object
|
|
@@ -51158,14 +51320,12 @@ function scrubPII(_a) {
|
|
|
51158
51320
|
* @returns {String}
|
|
51159
51321
|
*/
|
|
51160
51322
|
function scrubJsonPII(string) {
|
|
51161
|
-
|
|
51323
|
+
const fullScrubRegex = new RegExp(`${keyPattern}\\s*:\\s*[\\{\\[]`, 'i');
|
|
51162
51324
|
if (fullScrubRegex.test(string)) {
|
|
51163
51325
|
return UNABLE_TO_DISPLAY_BODY;
|
|
51164
51326
|
}
|
|
51165
|
-
|
|
51166
|
-
return string.replace(keyValueScrubRegex,
|
|
51167
|
-
return "\"".concat(key, "\":\"").concat(PII_REPLACEMENT, "\"");
|
|
51168
|
-
});
|
|
51327
|
+
const keyValueScrubRegex = new RegExp(`${keyPattern}\\s*:\\s*${acceptedValues}`, 'gi');
|
|
51328
|
+
return string.replace(keyValueScrubRegex, (match, key) => `"${key}":"${PII_REPLACEMENT}"`);
|
|
51169
51329
|
}
|
|
51170
51330
|
/**
|
|
51171
51331
|
* Checks if a string is a JSON object
|
|
@@ -51177,7 +51337,7 @@ function scrubJsonPII(string) {
|
|
|
51177
51337
|
function mightContainJson(string, contentType) {
|
|
51178
51338
|
if (!string || typeof string !== 'string')
|
|
51179
51339
|
return false;
|
|
51180
|
-
|
|
51340
|
+
const firstChar = string.charAt(0);
|
|
51181
51341
|
if (contentType && contentType.indexOf('application/json') !== -1) {
|
|
51182
51342
|
return true;
|
|
51183
51343
|
}
|
|
@@ -51190,20 +51350,19 @@ function mightContainJson(string, contentType) {
|
|
|
51190
51350
|
* @param {String} contentType
|
|
51191
51351
|
* @returns {String}
|
|
51192
51352
|
*/
|
|
51193
|
-
function maskSensitiveFields(
|
|
51194
|
-
var string = _a.string, contentType = _a.contentType, _ = _a._;
|
|
51353
|
+
function maskSensitiveFields({ string, contentType, _ }) {
|
|
51195
51354
|
if (!string || typeof string !== 'string')
|
|
51196
51355
|
return string;
|
|
51197
51356
|
if (mightContainJson(string, contentType)) {
|
|
51198
51357
|
string = scrubJsonPII(string);
|
|
51199
51358
|
}
|
|
51200
51359
|
if (mightContainPII(string)) {
|
|
51201
|
-
string = scrubPII({ string
|
|
51360
|
+
string = scrubPII({ string, _ });
|
|
51202
51361
|
}
|
|
51203
51362
|
return string;
|
|
51204
51363
|
}
|
|
51205
51364
|
|
|
51206
|
-
|
|
51365
|
+
const DEV_LOG_TYPE = 'devlog';
|
|
51207
51366
|
function createDevLogEnvelope(pluginAPI, globalPendo) {
|
|
51208
51367
|
return {
|
|
51209
51368
|
browser_time: pluginAPI.util.getNow(),
|
|
@@ -51214,12 +51373,12 @@ function createDevLogEnvelope(pluginAPI, globalPendo) {
|
|
|
51214
51373
|
};
|
|
51215
51374
|
}
|
|
51216
51375
|
|
|
51217
|
-
|
|
51218
|
-
|
|
51219
|
-
|
|
51220
|
-
|
|
51221
|
-
|
|
51222
|
-
|
|
51376
|
+
const TOKEN_MAX_SIZE = 100;
|
|
51377
|
+
const TOKEN_REFILL_RATE = 10;
|
|
51378
|
+
const TOKEN_REFRESH_INTERVAL = 1000;
|
|
51379
|
+
const MAX_UNCOMPRESSED_SIZE = 125000; // 125KB
|
|
51380
|
+
class DevlogBuffer {
|
|
51381
|
+
constructor(pendo, pluginAPI) {
|
|
51223
51382
|
this.pendo = pendo;
|
|
51224
51383
|
this.pluginAPI = pluginAPI;
|
|
51225
51384
|
this.events = [];
|
|
@@ -51230,36 +51389,36 @@ var DevlogBuffer = /** @class */ (function () {
|
|
|
51230
51389
|
this.lastRefillTime = this.pluginAPI.util.getNow();
|
|
51231
51390
|
this.nextRefillTime = this.lastRefillTime + TOKEN_REFRESH_INTERVAL;
|
|
51232
51391
|
}
|
|
51233
|
-
|
|
51392
|
+
isEmpty() {
|
|
51234
51393
|
return this.events.length === 0 && this.payloads.length === 0;
|
|
51235
|
-
}
|
|
51236
|
-
|
|
51237
|
-
|
|
51394
|
+
}
|
|
51395
|
+
refillTokens() {
|
|
51396
|
+
const now = this.pluginAPI.util.getNow();
|
|
51238
51397
|
if (now >= this.nextRefillTime) {
|
|
51239
|
-
|
|
51240
|
-
|
|
51241
|
-
|
|
51398
|
+
const timeSinceLastRefill = now - this.lastRefillTime;
|
|
51399
|
+
const secondsSinceLastRefill = Math.floor(timeSinceLastRefill / TOKEN_REFRESH_INTERVAL);
|
|
51400
|
+
const tokensToRefill = secondsSinceLastRefill * TOKEN_REFILL_RATE;
|
|
51242
51401
|
this.tokens = Math.min(this.tokens + tokensToRefill, TOKEN_MAX_SIZE);
|
|
51243
51402
|
this.lastRefillTime = now;
|
|
51244
51403
|
this.nextRefillTime = now + TOKEN_REFRESH_INTERVAL;
|
|
51245
51404
|
}
|
|
51246
|
-
}
|
|
51247
|
-
|
|
51405
|
+
}
|
|
51406
|
+
clear() {
|
|
51248
51407
|
this.events = [];
|
|
51249
51408
|
this.lastEvent = null;
|
|
51250
51409
|
this.uncompressedSize = 0;
|
|
51251
|
-
}
|
|
51252
|
-
|
|
51410
|
+
}
|
|
51411
|
+
hasTokenAvailable() {
|
|
51253
51412
|
this.refillTokens();
|
|
51254
51413
|
return this.tokens > 0;
|
|
51255
|
-
}
|
|
51256
|
-
|
|
51414
|
+
}
|
|
51415
|
+
estimateEventSize(event) {
|
|
51257
51416
|
return JSON.stringify(event).length;
|
|
51258
|
-
}
|
|
51259
|
-
|
|
51417
|
+
}
|
|
51418
|
+
push(event) {
|
|
51260
51419
|
if (!this.hasTokenAvailable())
|
|
51261
51420
|
return false;
|
|
51262
|
-
|
|
51421
|
+
const eventSize = this.estimateEventSize(event);
|
|
51263
51422
|
if (this.uncompressedSize + eventSize > MAX_UNCOMPRESSED_SIZE) {
|
|
51264
51423
|
this.compressCurrentChunk();
|
|
51265
51424
|
}
|
|
@@ -51268,55 +51427,54 @@ var DevlogBuffer = /** @class */ (function () {
|
|
|
51268
51427
|
this.events.push(event);
|
|
51269
51428
|
this.tokens = Math.max(this.tokens - 1, 0);
|
|
51270
51429
|
return true;
|
|
51271
|
-
}
|
|
51272
|
-
|
|
51430
|
+
}
|
|
51431
|
+
compressCurrentChunk() {
|
|
51273
51432
|
if (this.events.length === 0)
|
|
51274
51433
|
return;
|
|
51275
|
-
|
|
51434
|
+
const jzb = this.pendo.compress(this.events);
|
|
51276
51435
|
this.payloads.push(jzb);
|
|
51277
51436
|
this.clear();
|
|
51278
|
-
}
|
|
51279
|
-
|
|
51280
|
-
|
|
51437
|
+
}
|
|
51438
|
+
generateUrl() {
|
|
51439
|
+
const queryParams = {
|
|
51281
51440
|
v: this.pendo.VERSION,
|
|
51282
51441
|
ct: this.pluginAPI.util.getNow()
|
|
51283
51442
|
};
|
|
51284
51443
|
return this.pluginAPI.transmit.buildBaseDataUrl(DEV_LOG_TYPE, this.pendo.apiKey, queryParams);
|
|
51285
|
-
}
|
|
51286
|
-
|
|
51444
|
+
}
|
|
51445
|
+
pack() {
|
|
51287
51446
|
if (this.isEmpty())
|
|
51288
51447
|
return;
|
|
51289
|
-
|
|
51448
|
+
const url = this.generateUrl();
|
|
51290
51449
|
this.compressCurrentChunk();
|
|
51291
|
-
|
|
51292
|
-
jzb
|
|
51293
|
-
url
|
|
51294
|
-
})
|
|
51450
|
+
const payloads = this.pendo._.map(this.payloads, (jzb) => ({
|
|
51451
|
+
jzb,
|
|
51452
|
+
url
|
|
51453
|
+
}));
|
|
51295
51454
|
this.payloads = [];
|
|
51296
51455
|
return payloads;
|
|
51297
|
-
}
|
|
51298
|
-
|
|
51299
|
-
}());
|
|
51456
|
+
}
|
|
51457
|
+
}
|
|
51300
51458
|
|
|
51301
|
-
|
|
51302
|
-
|
|
51459
|
+
class DevlogTransport {
|
|
51460
|
+
constructor(globalPendo, pluginAPI) {
|
|
51303
51461
|
this.pendo = globalPendo;
|
|
51304
51462
|
this.pluginAPI = pluginAPI;
|
|
51305
51463
|
}
|
|
51306
|
-
|
|
51307
|
-
|
|
51464
|
+
buildGetUrl(baseUrl, jzb) {
|
|
51465
|
+
const params = {};
|
|
51308
51466
|
if (this.pluginAPI.agent.treatAsAdoptPartner()) {
|
|
51309
51467
|
this.pluginAPI.agent.addAccountIdParams(params, this.pendo.get_account_id(), this.pluginAPI.ConfigReader.get('oemAccountId'));
|
|
51310
51468
|
}
|
|
51311
|
-
|
|
51469
|
+
const jwtOptions = this.pluginAPI.agent.getJwtInfoCopy();
|
|
51312
51470
|
if (!this.pendo._.isEmpty(jwtOptions)) {
|
|
51313
51471
|
this.pendo._.extend(params, jwtOptions);
|
|
51314
51472
|
}
|
|
51315
51473
|
params.jzb = jzb;
|
|
51316
|
-
|
|
51317
|
-
return
|
|
51318
|
-
}
|
|
51319
|
-
|
|
51474
|
+
const queryString = this.pendo._.map(params, (value, key) => `${key}=${value}`).join('&');
|
|
51475
|
+
return `${baseUrl}${baseUrl.indexOf('?') !== -1 ? '&' : '?'}${queryString}`;
|
|
51476
|
+
}
|
|
51477
|
+
get(url, options) {
|
|
51320
51478
|
options.method = 'GET';
|
|
51321
51479
|
if (this.pluginAPI.transmit.fetchKeepalive.supported()) {
|
|
51322
51480
|
return this.pluginAPI.transmit.fetchKeepalive(url, options);
|
|
@@ -51324,90 +51482,86 @@ var DevlogTransport = /** @class */ (function () {
|
|
|
51324
51482
|
else {
|
|
51325
51483
|
return this.pendo.ajax.get(url);
|
|
51326
51484
|
}
|
|
51327
|
-
}
|
|
51328
|
-
|
|
51329
|
-
|
|
51330
|
-
var getUrl = this.buildGetUrl(url, jzb);
|
|
51485
|
+
}
|
|
51486
|
+
sendRequestWithGet({ url, jzb }) {
|
|
51487
|
+
const getUrl = this.buildGetUrl(url, jzb);
|
|
51331
51488
|
return this.get(getUrl, {
|
|
51332
51489
|
headers: {
|
|
51333
51490
|
'Content-Type': 'application/octet-stream'
|
|
51334
51491
|
}
|
|
51335
51492
|
});
|
|
51336
|
-
}
|
|
51337
|
-
|
|
51493
|
+
}
|
|
51494
|
+
post(url, options) {
|
|
51338
51495
|
options.method = 'POST';
|
|
51339
51496
|
if (options.keepalive && this.pluginAPI.transmit.fetchKeepalive.supported()) {
|
|
51340
51497
|
return this.pluginAPI.transmit.fetchKeepalive(url, options);
|
|
51341
51498
|
}
|
|
51342
51499
|
else if (options.keepalive && this.pluginAPI.transmit.sendBeacon.supported()) {
|
|
51343
|
-
|
|
51500
|
+
const result = this.pluginAPI.transmit.sendBeacon(url, new Blob([options.body]));
|
|
51344
51501
|
return result ? Promise$2.resolve() : Promise$2.reject(new Error('sendBeacon failed to send devlog data'));
|
|
51345
51502
|
}
|
|
51346
51503
|
else {
|
|
51347
51504
|
return this.pendo.ajax.post(url, options.body);
|
|
51348
51505
|
}
|
|
51349
|
-
}
|
|
51350
|
-
|
|
51351
|
-
|
|
51352
|
-
|
|
51353
|
-
var bodyPayload = {
|
|
51506
|
+
}
|
|
51507
|
+
sendRequestWithPost({ url, jzb }, isUnload) {
|
|
51508
|
+
const jwtOptions = this.pluginAPI.agent.getJwtInfoCopy();
|
|
51509
|
+
const bodyPayload = {
|
|
51354
51510
|
events: jzb,
|
|
51355
51511
|
browser_time: this.pluginAPI.util.getNow()
|
|
51356
51512
|
};
|
|
51357
51513
|
if (this.pluginAPI.agent.treatAsAdoptPartner()) {
|
|
51358
51514
|
this.pluginAPI.agent.addAccountIdParams(bodyPayload, this.pendo.get_account_id(), this.pluginAPI.ConfigReader.get('oemAccountId'));
|
|
51359
51515
|
}
|
|
51360
|
-
|
|
51516
|
+
const body = JSON.stringify(this.pendo._.extend(bodyPayload, jwtOptions));
|
|
51361
51517
|
return this.post(url, {
|
|
51362
|
-
body
|
|
51518
|
+
body,
|
|
51363
51519
|
headers: {
|
|
51364
51520
|
'Content-Type': 'application/json'
|
|
51365
51521
|
},
|
|
51366
51522
|
keepalive: isUnload
|
|
51367
51523
|
});
|
|
51368
|
-
}
|
|
51369
|
-
|
|
51370
|
-
|
|
51371
|
-
var compressedLength = jzb.length;
|
|
51524
|
+
}
|
|
51525
|
+
sendRequest({ url, jzb }, isUnload) {
|
|
51526
|
+
const compressedLength = jzb.length;
|
|
51372
51527
|
if (compressedLength <= this.pluginAPI.constants.ENCODED_EVENT_MAX_LENGTH && !this.pluginAPI.ConfigReader.get('sendEventsWithPostOnly')) {
|
|
51373
|
-
return this.sendRequestWithGet({ url
|
|
51528
|
+
return this.sendRequestWithGet({ url, jzb });
|
|
51374
51529
|
}
|
|
51375
|
-
return this.sendRequestWithPost({ url
|
|
51376
|
-
}
|
|
51377
|
-
|
|
51378
|
-
}());
|
|
51530
|
+
return this.sendRequestWithPost({ url, jzb }, isUnload);
|
|
51531
|
+
}
|
|
51532
|
+
}
|
|
51379
51533
|
|
|
51380
51534
|
function ConsoleCapture() {
|
|
51381
|
-
|
|
51382
|
-
|
|
51383
|
-
|
|
51384
|
-
|
|
51385
|
-
|
|
51386
|
-
|
|
51387
|
-
|
|
51388
|
-
|
|
51389
|
-
|
|
51390
|
-
|
|
51391
|
-
|
|
51392
|
-
|
|
51535
|
+
let pluginAPI;
|
|
51536
|
+
let _;
|
|
51537
|
+
let globalPendo;
|
|
51538
|
+
let buffer;
|
|
51539
|
+
let sendQueue;
|
|
51540
|
+
let sendInterval;
|
|
51541
|
+
let transport;
|
|
51542
|
+
let isPtmPaused;
|
|
51543
|
+
let isCapturingConsoleLogs = false;
|
|
51544
|
+
const CAPTURE_CONSOLE_CONFIG = 'captureConsoleLogs';
|
|
51545
|
+
const CONSOLE_METHODS = ['log', 'warn', 'error', 'info'];
|
|
51546
|
+
const DEV_LOG_SUB_TYPE = 'console';
|
|
51393
51547
|
// deduplicate logs
|
|
51394
|
-
|
|
51548
|
+
let lastLogKey = '';
|
|
51395
51549
|
return {
|
|
51396
51550
|
name: 'ConsoleCapture',
|
|
51397
|
-
initialize
|
|
51398
|
-
teardown
|
|
51399
|
-
addIntercepts
|
|
51400
|
-
createConsoleEvent
|
|
51401
|
-
captureStackTrace
|
|
51402
|
-
send
|
|
51403
|
-
setCaptureState
|
|
51404
|
-
recordingStarted
|
|
51405
|
-
recordingStopped
|
|
51406
|
-
onAppHidden
|
|
51407
|
-
onAppUnloaded
|
|
51408
|
-
onPtmPaused
|
|
51409
|
-
onPtmUnpaused
|
|
51410
|
-
securityPolicyViolationFn
|
|
51551
|
+
initialize,
|
|
51552
|
+
teardown,
|
|
51553
|
+
addIntercepts,
|
|
51554
|
+
createConsoleEvent,
|
|
51555
|
+
captureStackTrace,
|
|
51556
|
+
send,
|
|
51557
|
+
setCaptureState,
|
|
51558
|
+
recordingStarted,
|
|
51559
|
+
recordingStopped,
|
|
51560
|
+
onAppHidden,
|
|
51561
|
+
onAppUnloaded,
|
|
51562
|
+
onPtmPaused,
|
|
51563
|
+
onPtmUnpaused,
|
|
51564
|
+
securityPolicyViolationFn,
|
|
51411
51565
|
get isCapturingConsoleLogs() {
|
|
51412
51566
|
return isCapturingConsoleLogs;
|
|
51413
51567
|
},
|
|
@@ -51424,16 +51578,16 @@ function ConsoleCapture() {
|
|
|
51424
51578
|
function initialize(pendo, PluginAPI) {
|
|
51425
51579
|
_ = pendo._;
|
|
51426
51580
|
pluginAPI = PluginAPI;
|
|
51427
|
-
|
|
51581
|
+
const { ConfigReader } = pluginAPI;
|
|
51428
51582
|
ConfigReader.addOption(CAPTURE_CONSOLE_CONFIG, [ConfigReader.sources.PENDO_CONFIG_SRC], false);
|
|
51429
|
-
|
|
51583
|
+
const captureConsoleEnabled = ConfigReader.get(CAPTURE_CONSOLE_CONFIG);
|
|
51430
51584
|
if (!captureConsoleEnabled)
|
|
51431
51585
|
return;
|
|
51432
51586
|
globalPendo = pendo;
|
|
51433
51587
|
buffer = new DevlogBuffer(pendo, pluginAPI);
|
|
51434
51588
|
transport = new DevlogTransport(pendo, pluginAPI);
|
|
51435
51589
|
sendQueue = new pluginAPI.SendQueue(transport.sendRequest.bind(transport));
|
|
51436
|
-
sendInterval = setInterval(
|
|
51590
|
+
sendInterval = setInterval(() => {
|
|
51437
51591
|
if (!sendQueue.failed()) {
|
|
51438
51592
|
send();
|
|
51439
51593
|
}
|
|
@@ -51459,19 +51613,17 @@ function ConsoleCapture() {
|
|
|
51459
51613
|
function onPtmUnpaused() {
|
|
51460
51614
|
isPtmPaused = false;
|
|
51461
51615
|
if (!buffer.isEmpty()) {
|
|
51462
|
-
for (
|
|
51463
|
-
|
|
51464
|
-
pluginAPI.Events.eventCaptured.trigger(event_1);
|
|
51616
|
+
for (const event of buffer.events) {
|
|
51617
|
+
pluginAPI.Events.eventCaptured.trigger(event);
|
|
51465
51618
|
}
|
|
51466
51619
|
send();
|
|
51467
51620
|
}
|
|
51468
51621
|
}
|
|
51469
|
-
function setCaptureState(
|
|
51470
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.shouldCapture, shouldCapture = _c === void 0 ? false : _c, _d = _b.reason, reason = _d === void 0 ? '' : _d;
|
|
51622
|
+
function setCaptureState({ shouldCapture = false, reason = '' } = {}) {
|
|
51471
51623
|
if (shouldCapture === isCapturingConsoleLogs)
|
|
51472
51624
|
return;
|
|
51473
51625
|
isCapturingConsoleLogs = shouldCapture;
|
|
51474
|
-
pluginAPI.log.info(
|
|
51626
|
+
pluginAPI.log.info(`[ConsoleCapture] Console log capture ${shouldCapture ? 'started' : 'stopped'}${reason ? `: ${reason}` : ''}`);
|
|
51475
51627
|
}
|
|
51476
51628
|
function recordingStarted() {
|
|
51477
51629
|
setCaptureState({ shouldCapture: true, reason: 'recording started' });
|
|
@@ -51480,17 +51632,23 @@ function ConsoleCapture() {
|
|
|
51480
51632
|
setCaptureState({ shouldCapture: false, reason: 'recording stopped' });
|
|
51481
51633
|
}
|
|
51482
51634
|
function readyHandler() {
|
|
51483
|
-
|
|
51484
|
-
|
|
51635
|
+
try {
|
|
51636
|
+
addIntercepts();
|
|
51637
|
+
pluginAPI.attachEventInternal(window, 'securitypolicyviolation', securityPolicyViolationFn);
|
|
51638
|
+
}
|
|
51639
|
+
catch (error) {
|
|
51640
|
+
pluginAPI.log.error('Error setting up console capture intercepts: ', error);
|
|
51641
|
+
teardown();
|
|
51642
|
+
}
|
|
51485
51643
|
}
|
|
51486
51644
|
function addIntercepts() {
|
|
51487
51645
|
_.each(CONSOLE_METHODS, function (methodName) {
|
|
51488
|
-
|
|
51646
|
+
const originalMethod = console[methodName];
|
|
51489
51647
|
if (!originalMethod)
|
|
51490
51648
|
return;
|
|
51491
51649
|
console[methodName] = _.wrap(originalMethod, function (originalFn) {
|
|
51492
51650
|
// slice 1 to omit originalFn
|
|
51493
|
-
|
|
51651
|
+
const args = _.toArray(arguments).slice(1);
|
|
51494
51652
|
originalFn.apply(console, args);
|
|
51495
51653
|
createConsoleEvent(args, methodName);
|
|
51496
51654
|
});
|
|
@@ -51502,10 +51660,10 @@ function ConsoleCapture() {
|
|
|
51502
51660
|
function securityPolicyViolationFn(evt) {
|
|
51503
51661
|
if (!evt || typeof evt !== 'object')
|
|
51504
51662
|
return;
|
|
51505
|
-
|
|
51506
|
-
|
|
51507
|
-
|
|
51508
|
-
|
|
51663
|
+
const { blockedURI, violatedDirective, effectiveDirective, disposition, originalPolicy } = evt;
|
|
51664
|
+
const directive = violatedDirective || effectiveDirective;
|
|
51665
|
+
const isReportOnly = disposition === 'report';
|
|
51666
|
+
const message = createCspViolationMessage(blockedURI, directive, isReportOnly, originalPolicy);
|
|
51509
51667
|
if (isReportOnly) {
|
|
51510
51668
|
createConsoleEvent([message], 'warn', { skipStackTrace: true, skipScrubPII: true });
|
|
51511
51669
|
}
|
|
@@ -51513,13 +51671,12 @@ function ConsoleCapture() {
|
|
|
51513
51671
|
createConsoleEvent([message], 'error', { skipStackTrace: true, skipScrubPII: true });
|
|
51514
51672
|
}
|
|
51515
51673
|
}
|
|
51516
|
-
function createConsoleEvent(args, methodName,
|
|
51517
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.skipStackTrace, skipStackTrace = _c === void 0 ? false : _c, _d = _b.skipScrubPII, skipScrubPII = _d === void 0 ? false : _d;
|
|
51674
|
+
function createConsoleEvent(args, methodName, { skipStackTrace = false, skipScrubPII = false } = {}) {
|
|
51518
51675
|
if (!isCapturingConsoleLogs || !args || args.length === 0 || !_.contains(CONSOLE_METHODS, methodName))
|
|
51519
51676
|
return;
|
|
51520
51677
|
// stringify args
|
|
51521
|
-
|
|
51522
|
-
|
|
51678
|
+
let message = _.compact(_.map(args, arg => {
|
|
51679
|
+
let stringifiedArg;
|
|
51523
51680
|
try {
|
|
51524
51681
|
stringifiedArg = stringify(arg);
|
|
51525
51682
|
}
|
|
@@ -51531,22 +51688,22 @@ function ConsoleCapture() {
|
|
|
51531
51688
|
if (!message)
|
|
51532
51689
|
return;
|
|
51533
51690
|
// capture stack trace
|
|
51534
|
-
|
|
51691
|
+
let stackTrace = '';
|
|
51535
51692
|
if (!skipStackTrace) {
|
|
51536
|
-
|
|
51693
|
+
const maxStackFrames = methodName === 'error' ? 4 : 1;
|
|
51537
51694
|
stackTrace = captureStackTrace(maxStackFrames);
|
|
51538
51695
|
}
|
|
51539
51696
|
// truncate message and stack trace
|
|
51540
51697
|
message = truncate(message);
|
|
51541
51698
|
stackTrace = truncate(stackTrace);
|
|
51542
51699
|
// de-duplicate log
|
|
51543
|
-
|
|
51700
|
+
const logKey = generateLogKey(methodName, message, stackTrace);
|
|
51544
51701
|
if (isExistingDuplicateLog(logKey)) {
|
|
51545
51702
|
buffer.lastEvent.devLogCount++;
|
|
51546
51703
|
return;
|
|
51547
51704
|
}
|
|
51548
|
-
|
|
51549
|
-
|
|
51705
|
+
const devLogEnvelope = createDevLogEnvelope(pluginAPI, globalPendo);
|
|
51706
|
+
const consoleEvent = Object.assign(Object.assign({}, devLogEnvelope), { subType: DEV_LOG_SUB_TYPE, devLogLevel: methodName === 'log' ? 'info' : methodName, devLogMessage: skipScrubPII ? message : scrubPII({ string: message, _ }), devLogTrace: stackTrace, devLogCount: 1 });
|
|
51550
51707
|
if (!buffer.hasTokenAvailable())
|
|
51551
51708
|
return consoleEvent;
|
|
51552
51709
|
if (!isPtmPaused) {
|
|
@@ -51558,8 +51715,8 @@ function ConsoleCapture() {
|
|
|
51558
51715
|
}
|
|
51559
51716
|
function captureStackTrace(maxStackFrames) {
|
|
51560
51717
|
try {
|
|
51561
|
-
|
|
51562
|
-
return _.map(stackFrames,
|
|
51718
|
+
const stackFrames = ErrorStackParser.parse(new Error(), maxStackFrames);
|
|
51719
|
+
return _.map(stackFrames, frame => frame.toString()).join('\n');
|
|
51563
51720
|
}
|
|
51564
51721
|
catch (error) {
|
|
51565
51722
|
return '';
|
|
@@ -51571,22 +51728,21 @@ function ConsoleCapture() {
|
|
|
51571
51728
|
function updateLastLog(logKey) {
|
|
51572
51729
|
lastLogKey = logKey;
|
|
51573
51730
|
}
|
|
51574
|
-
function send(
|
|
51575
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.unload, unload = _c === void 0 ? false : _c, _d = _b.hidden, hidden = _d === void 0 ? false : _d;
|
|
51731
|
+
function send({ unload = false, hidden = false } = {}) {
|
|
51576
51732
|
if (!buffer || buffer.isEmpty())
|
|
51577
51733
|
return;
|
|
51578
51734
|
if (!globalPendo.isSendingEvents()) {
|
|
51579
51735
|
buffer.clear();
|
|
51580
51736
|
return;
|
|
51581
51737
|
}
|
|
51582
|
-
|
|
51738
|
+
const payloads = buffer.pack();
|
|
51583
51739
|
if (!payloads || payloads.length === 0)
|
|
51584
51740
|
return;
|
|
51585
51741
|
if (unload || hidden) {
|
|
51586
51742
|
sendQueue.drain(payloads, unload);
|
|
51587
51743
|
}
|
|
51588
51744
|
else {
|
|
51589
|
-
sendQueue.push
|
|
51745
|
+
sendQueue.push(...payloads);
|
|
51590
51746
|
}
|
|
51591
51747
|
}
|
|
51592
51748
|
function teardown() {
|
|
@@ -51610,7 +51766,7 @@ function ConsoleCapture() {
|
|
|
51610
51766
|
_.each(CONSOLE_METHODS, function (methodName) {
|
|
51611
51767
|
if (!console[methodName])
|
|
51612
51768
|
return _.noop;
|
|
51613
|
-
|
|
51769
|
+
const unwrap = console[methodName]._pendoUnwrap;
|
|
51614
51770
|
if (_.isFunction(unwrap)) {
|
|
51615
51771
|
unwrap();
|
|
51616
51772
|
}
|
|
@@ -52016,20 +52172,18 @@ function NetworkCapture() {
|
|
|
52016
52172
|
}
|
|
52017
52173
|
}
|
|
52018
52174
|
|
|
52019
|
-
|
|
52020
|
-
|
|
52021
|
-
|
|
52022
|
-
|
|
52023
|
-
|
|
52024
|
-
|
|
52025
|
-
|
|
52026
|
-
|
|
52027
|
-
|
|
52028
|
-
|
|
52029
|
-
|
|
52030
|
-
|
|
52031
|
-
for (var i = 0; i < entries.length; i++) {
|
|
52032
|
-
var _a = entries[i], key = _a[0], value = _a[1];
|
|
52175
|
+
const PREDICT_STEP_REGEX = /\$\$predict\$\$/;
|
|
52176
|
+
const DRAG_THRESHOLD = 5;
|
|
52177
|
+
const STYLE_ID = 'pendo-predict-plugin-styles';
|
|
52178
|
+
const PREDICT_BASE_URL = 'https://predict.pendo.io';
|
|
52179
|
+
const GUIDE_BUTTON_IDENTIFIER = 'button:contains("token")';
|
|
52180
|
+
const pluginVersion = '1.0.1';
|
|
52181
|
+
const $ = (id) => document.getElementById(id);
|
|
52182
|
+
const createElement = (tag, attrs = {}, parent = null) => {
|
|
52183
|
+
const el = document.createElement(tag);
|
|
52184
|
+
const entries = Object.entries(attrs);
|
|
52185
|
+
for (let i = 0; i < entries.length; i++) {
|
|
52186
|
+
const [key, value] = entries[i];
|
|
52033
52187
|
if (key === 'className')
|
|
52034
52188
|
el.className = value;
|
|
52035
52189
|
else if (key === 'innerHTML')
|
|
@@ -52041,28 +52195,69 @@ var createElement = function (tag, attrs, parent) {
|
|
|
52041
52195
|
parent.appendChild(el);
|
|
52042
52196
|
return el;
|
|
52043
52197
|
};
|
|
52044
|
-
|
|
52045
|
-
|
|
52046
|
-
var styleId = "".concat(STYLE_ID, "-").concat(pendoContainerId);
|
|
52198
|
+
const injectStyles = (pendoContainerId, log = () => { }) => {
|
|
52199
|
+
const styleId = `${STYLE_ID}-${pendoContainerId}`;
|
|
52047
52200
|
if ($(styleId)) {
|
|
52048
|
-
log(
|
|
52201
|
+
log(`[predict] style already exists, skipping: ${styleId}`);
|
|
52049
52202
|
return;
|
|
52050
52203
|
}
|
|
52051
|
-
log(
|
|
52204
|
+
log(`[predict] injecting styles: ${styleId}`);
|
|
52052
52205
|
createElement('style', {
|
|
52053
52206
|
id: styleId,
|
|
52054
|
-
textContent:
|
|
52207
|
+
textContent: `
|
|
52208
|
+
#${pendoContainerId} {
|
|
52209
|
+
display: none !important;
|
|
52210
|
+
}
|
|
52211
|
+
.frame-explanation {
|
|
52212
|
+
aspect-ratio: 16/9; overflow: hidden; min-height: 300px;
|
|
52213
|
+
width: 100vw; height: 100vh; background: transparent;
|
|
52214
|
+
position: fixed; bottom: 0; right: 0; z-index: 999999; border: none;
|
|
52215
|
+
visibility: hidden; opacity: 0; pointer-events: none;
|
|
52216
|
+
transition: opacity 0.1s ease-out, visibility 0s linear 0.1s;
|
|
52217
|
+
display: none;
|
|
52218
|
+
}
|
|
52219
|
+
.frame-explanation.is-visible {
|
|
52220
|
+
visibility: visible; opacity: 1; pointer-events: auto;
|
|
52221
|
+
transition: opacity 0.1s ease-out, visibility 0s linear 0s;
|
|
52222
|
+
}
|
|
52223
|
+
.frame-explanation.is-exists {
|
|
52224
|
+
display: block !important;
|
|
52225
|
+
}
|
|
52226
|
+
.floating-modal-container {
|
|
52227
|
+
position: fixed; top: 20px; right: 20px; z-index: 500000;
|
|
52228
|
+
visibility: hidden; opacity: 0; pointer-events: none;
|
|
52229
|
+
transition: opacity 0.1s ease-out, visibility 0s linear 0.1s;
|
|
52230
|
+
border-radius: 8px; box-shadow: 0px 4px 12px 0px rgba(0,0,0,0.15);
|
|
52231
|
+
overflow: hidden; width: 384px; height: 176px;
|
|
52232
|
+
}
|
|
52233
|
+
.floating-modal-container.is-visible {
|
|
52234
|
+
visibility: visible; opacity: 1; pointer-events: auto;
|
|
52235
|
+
transition: opacity 0.1s ease-out, visibility 0s linear 0s;
|
|
52236
|
+
}
|
|
52237
|
+
.floating-modal-container.is-dragging { will-change: left, top; }
|
|
52238
|
+
.floating-modal-drag-handle {
|
|
52239
|
+
position: absolute; left: 50%; transform: translateX(-50%);
|
|
52240
|
+
top: 5px; width: calc(100% - 46px); min-width: 166px; height: 17px;
|
|
52241
|
+
z-index: 9999; transition: left 0.2s ease, right 0.2s ease;
|
|
52242
|
+
display: flex; justify-content: center; align-items: center;
|
|
52243
|
+
}
|
|
52244
|
+
.floating-modal-drag-handle svg g { fill: #A0A0A0; }
|
|
52245
|
+
.floating-modal-drag-handle:hover { cursor: grab; }
|
|
52246
|
+
.floating-modal-drag-handle:hover svg g { fill: #1f2937; }
|
|
52247
|
+
.floating-modal-drag-handle.is-dragging { cursor: grabbing; }
|
|
52248
|
+
.floating-modal-drag-handle.is-collapsed { top: 0px; }
|
|
52249
|
+
.frame-floating-modal { width: 100%; height: 100%; background: white; border: none; display: block; }
|
|
52250
|
+
`
|
|
52055
52251
|
}, document.head);
|
|
52056
52252
|
};
|
|
52057
|
-
|
|
52253
|
+
const getRecordIdFromUrl = (recordRegex, log = () => { }) => {
|
|
52058
52254
|
var _a;
|
|
52059
|
-
|
|
52060
|
-
|
|
52061
|
-
|
|
52062
|
-
log("[predict] recordId found: ".concat(recordId));
|
|
52255
|
+
const match = window.location.href.match(recordRegex);
|
|
52256
|
+
const recordId = (_a = match === null || match === void 0 ? void 0 : match[1]) !== null && _a !== void 0 ? _a : null;
|
|
52257
|
+
log(`[predict] recordId found: ${recordId}`);
|
|
52063
52258
|
return recordId;
|
|
52064
52259
|
};
|
|
52065
|
-
|
|
52260
|
+
const safeStringify = (value, fallback) => {
|
|
52066
52261
|
try {
|
|
52067
52262
|
return JSON.stringify(value);
|
|
52068
52263
|
}
|
|
@@ -52070,22 +52265,21 @@ var safeStringify = function (value, fallback) {
|
|
|
52070
52265
|
return fallback !== null && fallback !== void 0 ? fallback : '';
|
|
52071
52266
|
}
|
|
52072
52267
|
};
|
|
52073
|
-
|
|
52074
|
-
if (log === void 0) { log = function () { }; }
|
|
52268
|
+
const safeParse = (value, fallback, log = () => { }) => {
|
|
52075
52269
|
try {
|
|
52076
52270
|
return JSON.parse(value);
|
|
52077
52271
|
}
|
|
52078
52272
|
catch (error) {
|
|
52079
|
-
log(
|
|
52273
|
+
log(`[predict] JSON parse error: ${error}`);
|
|
52080
52274
|
return fallback;
|
|
52081
52275
|
}
|
|
52082
52276
|
};
|
|
52083
|
-
|
|
52084
|
-
|
|
52085
|
-
|
|
52277
|
+
const buildQueryParams = (params) => {
|
|
52278
|
+
const urlParams = new URLSearchParams();
|
|
52279
|
+
const entries = Object.entries(params);
|
|
52086
52280
|
urlParams.set('pluginVersion', pluginVersion);
|
|
52087
|
-
for (
|
|
52088
|
-
|
|
52281
|
+
for (let i = 0; i < entries.length; i++) {
|
|
52282
|
+
const [key, value] = entries[i];
|
|
52089
52283
|
if (value != null) {
|
|
52090
52284
|
urlParams.set(key, typeof value === 'object' ? safeStringify(value) : String(value));
|
|
52091
52285
|
}
|
|
@@ -52093,17 +52287,17 @@ var buildQueryParams = function (params) {
|
|
|
52093
52287
|
return urlParams.toString();
|
|
52094
52288
|
};
|
|
52095
52289
|
// ----- Drag & Drop -----
|
|
52096
|
-
|
|
52097
|
-
|
|
52098
|
-
|
|
52099
|
-
|
|
52100
|
-
|
|
52101
|
-
|
|
52102
|
-
|
|
52103
|
-
|
|
52104
|
-
|
|
52105
|
-
|
|
52106
|
-
|
|
52290
|
+
const setupDragAndDrop = (handle, container) => {
|
|
52291
|
+
let isDragging = false;
|
|
52292
|
+
let hasMoved = false;
|
|
52293
|
+
let isCollapsed = false;
|
|
52294
|
+
let startX = 0;
|
|
52295
|
+
let startY = 0;
|
|
52296
|
+
let initialLeft = 0;
|
|
52297
|
+
let initialTop = 0;
|
|
52298
|
+
let rafId = null;
|
|
52299
|
+
const iframe = container.querySelector('iframe');
|
|
52300
|
+
const onMouseDown = (e) => {
|
|
52107
52301
|
if (e.button !== 0)
|
|
52108
52302
|
return;
|
|
52109
52303
|
e.preventDefault();
|
|
@@ -52113,35 +52307,35 @@ var setupDragAndDrop = function (handle, container) {
|
|
|
52113
52307
|
container.classList.add('is-dragging');
|
|
52114
52308
|
if (iframe)
|
|
52115
52309
|
iframe.style.pointerEvents = 'none';
|
|
52116
|
-
|
|
52310
|
+
const rect = container.getBoundingClientRect();
|
|
52117
52311
|
initialLeft = rect.left;
|
|
52118
52312
|
initialTop = rect.top;
|
|
52119
|
-
container.style.left =
|
|
52313
|
+
container.style.left = `${initialLeft}px`;
|
|
52120
52314
|
container.style.right = 'auto';
|
|
52121
52315
|
startX = e.clientX;
|
|
52122
52316
|
startY = e.clientY;
|
|
52123
52317
|
document.addEventListener('mousemove', onMouseMove);
|
|
52124
52318
|
document.addEventListener('mouseup', onMouseUp);
|
|
52125
52319
|
};
|
|
52126
|
-
|
|
52320
|
+
const onMouseMove = (e) => {
|
|
52127
52321
|
if (!isDragging)
|
|
52128
52322
|
return;
|
|
52129
|
-
|
|
52130
|
-
|
|
52323
|
+
const deltaX = e.clientX - startX;
|
|
52324
|
+
const deltaY = e.clientY - startY;
|
|
52131
52325
|
if (Math.abs(deltaX) > DRAG_THRESHOLD || Math.abs(deltaY) > DRAG_THRESHOLD) {
|
|
52132
52326
|
hasMoved = true;
|
|
52133
52327
|
}
|
|
52134
52328
|
if (rafId)
|
|
52135
52329
|
cancelAnimationFrame(rafId);
|
|
52136
|
-
rafId = requestAnimationFrame(
|
|
52137
|
-
|
|
52138
|
-
|
|
52139
|
-
|
|
52140
|
-
container.style.left =
|
|
52141
|
-
container.style.top =
|
|
52330
|
+
rafId = requestAnimationFrame(() => {
|
|
52331
|
+
const rect = container.getBoundingClientRect();
|
|
52332
|
+
const newLeft = Math.max(0, Math.min(initialLeft + deltaX, window.innerWidth - rect.width));
|
|
52333
|
+
const newTop = Math.max(0, Math.min(initialTop + deltaY, window.innerHeight - rect.height));
|
|
52334
|
+
container.style.left = `${newLeft}px`;
|
|
52335
|
+
container.style.top = `${newTop}px`;
|
|
52142
52336
|
});
|
|
52143
52337
|
};
|
|
52144
|
-
|
|
52338
|
+
const onMouseUp = (e) => {
|
|
52145
52339
|
var _a;
|
|
52146
52340
|
if (!isDragging)
|
|
52147
52341
|
return;
|
|
@@ -52159,12 +52353,12 @@ var setupDragAndDrop = function (handle, container) {
|
|
|
52159
52353
|
(_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage({ type: 'TRIGGER_EXPAND' }, PREDICT_BASE_URL);
|
|
52160
52354
|
}
|
|
52161
52355
|
};
|
|
52162
|
-
handle.setCollapsedState =
|
|
52356
|
+
handle.setCollapsedState = (collapsed) => {
|
|
52163
52357
|
isCollapsed = collapsed;
|
|
52164
52358
|
handle.classList.toggle('is-collapsed', collapsed);
|
|
52165
52359
|
};
|
|
52166
52360
|
handle.addEventListener('mousedown', onMouseDown);
|
|
52167
|
-
handle.cleanup =
|
|
52361
|
+
handle.cleanup = () => {
|
|
52168
52362
|
handle.removeEventListener('mousedown', onMouseDown);
|
|
52169
52363
|
document.removeEventListener('mousemove', onMouseMove);
|
|
52170
52364
|
document.removeEventListener('mouseup', onMouseUp);
|
|
@@ -52174,13 +52368,12 @@ var setupDragAndDrop = function (handle, container) {
|
|
|
52174
52368
|
return handle;
|
|
52175
52369
|
};
|
|
52176
52370
|
// ----- Explanation Iframe Creation -----
|
|
52177
|
-
|
|
52178
|
-
var
|
|
52179
|
-
|
|
52180
|
-
|
|
52181
|
-
|
|
52182
|
-
|
|
52183
|
-
var params = buildQueryParams(configuration);
|
|
52371
|
+
const createExplanationIframe = ({ analysisId, recordId, configuration }) => {
|
|
52372
|
+
var _a;
|
|
52373
|
+
const frameId = `frameExplanation-${analysisId}`;
|
|
52374
|
+
(_a = $(frameId)) === null || _a === void 0 ? void 0 : _a.remove();
|
|
52375
|
+
const base = `${PREDICT_BASE_URL}/external/analysis/${analysisId}/prediction/drilldown/${recordId}`;
|
|
52376
|
+
const params = buildQueryParams(configuration);
|
|
52184
52377
|
createElement('iframe', {
|
|
52185
52378
|
id: frameId,
|
|
52186
52379
|
className: 'frame-explanation',
|
|
@@ -52188,24 +52381,28 @@ var createExplanationIframe = function (_a) {
|
|
|
52188
52381
|
loading: 'lazy',
|
|
52189
52382
|
referrerPolicy: 'strict-origin-when-cross-origin',
|
|
52190
52383
|
allowFullscreen: true,
|
|
52191
|
-
src:
|
|
52384
|
+
src: `${base}?${params}`
|
|
52192
52385
|
}, document.body);
|
|
52193
52386
|
};
|
|
52194
52387
|
// ----- Floating Modal Creation -----
|
|
52195
|
-
|
|
52196
|
-
var
|
|
52197
|
-
|
|
52198
|
-
|
|
52199
|
-
|
|
52200
|
-
|
|
52201
|
-
}
|
|
52202
|
-
|
|
52203
|
-
var dragHandle = createElement('div', {
|
|
52388
|
+
const createFloatingModal = ({ recordId, configuration }) => {
|
|
52389
|
+
var _a;
|
|
52390
|
+
const flatIds = (_a = configuration.analysisIds) === null || _a === void 0 ? void 0 : _a.flat(Infinity);
|
|
52391
|
+
for (let i = 0; i < flatIds.length; i++) {
|
|
52392
|
+
createExplanationIframe({ analysisId: flatIds[i], recordId, configuration });
|
|
52393
|
+
}
|
|
52394
|
+
const container = createElement('div', { id: 'floatingModalContainer', className: 'floating-modal-container' }, document.body);
|
|
52395
|
+
const dragHandle = createElement('div', {
|
|
52204
52396
|
className: 'floating-modal-drag-handle',
|
|
52205
|
-
innerHTML:
|
|
52397
|
+
innerHTML: `<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
|
|
52398
|
+
<g fill="#EBEBEB">
|
|
52399
|
+
<circle cx="3.33" cy="6" r="1.5"/><circle cx="8" cy="6" r="1.5"/><circle cx="12.67" cy="6" r="1.5"/>
|
|
52400
|
+
<circle cx="3.33" cy="10" r="1.5"/><circle cx="8" cy="10" r="1.5"/><circle cx="12.67" cy="10" r="1.5"/>
|
|
52401
|
+
</g>
|
|
52402
|
+
</svg>`
|
|
52206
52403
|
}, container);
|
|
52207
|
-
|
|
52208
|
-
|
|
52404
|
+
const baseUrl = `${PREDICT_BASE_URL}/external/analysis/prediction/summary/${recordId}`;
|
|
52405
|
+
const params = buildQueryParams(configuration);
|
|
52209
52406
|
createElement('iframe', {
|
|
52210
52407
|
id: 'frameFloatingModal',
|
|
52211
52408
|
className: 'frame-floating-modal',
|
|
@@ -52213,136 +52410,133 @@ var createFloatingModal = function (_a) {
|
|
|
52213
52410
|
referrerPolicy: 'strict-origin-when-cross-origin',
|
|
52214
52411
|
allowFullscreen: true,
|
|
52215
52412
|
title: 'Floating Modal',
|
|
52216
|
-
src:
|
|
52413
|
+
src: `${baseUrl}?${params}`
|
|
52217
52414
|
}, container);
|
|
52218
52415
|
container.dragHandle = setupDragAndDrop(dragHandle, container);
|
|
52219
|
-
return
|
|
52416
|
+
return () => {
|
|
52220
52417
|
var _a, _b;
|
|
52221
52418
|
(_b = (_a = container.dragHandle) === null || _a === void 0 ? void 0 : _a.cleanup) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
52222
52419
|
container.remove();
|
|
52223
|
-
for (
|
|
52224
|
-
|
|
52420
|
+
for (let i = 0; i < flatIds.length; i++) {
|
|
52421
|
+
const frame = $(`frameExplanation-${flatIds[i]}`);
|
|
52225
52422
|
if (frame)
|
|
52226
52423
|
frame.remove();
|
|
52227
52424
|
}
|
|
52228
52425
|
};
|
|
52229
52426
|
};
|
|
52230
|
-
|
|
52231
|
-
|
|
52232
|
-
|
|
52233
|
-
var _b;
|
|
52234
|
-
var origin = _a.origin, data = _a.data;
|
|
52427
|
+
const setupMessageListener = ({ token, forceAccountId, cleanup, pendo }) => {
|
|
52428
|
+
const messageHandler = ({ origin, data }) => {
|
|
52429
|
+
var _a;
|
|
52235
52430
|
if (origin !== PREDICT_BASE_URL || !data || typeof data !== 'object')
|
|
52236
52431
|
return;
|
|
52237
|
-
|
|
52238
|
-
|
|
52239
|
-
|
|
52240
|
-
|
|
52432
|
+
const { type, analysisId, height, width } = data;
|
|
52433
|
+
const explanationFrame = $(`frameExplanation-${analysisId}`);
|
|
52434
|
+
const floatingModal = $('floatingModalContainer');
|
|
52435
|
+
const setFloatingModalSize = () => {
|
|
52241
52436
|
if (floatingModal) {
|
|
52242
|
-
floatingModal.style.height =
|
|
52243
|
-
floatingModal.style.width =
|
|
52437
|
+
floatingModal.style.height = `${height}px`;
|
|
52438
|
+
floatingModal.style.width = `${width}px`;
|
|
52244
52439
|
}
|
|
52245
52440
|
};
|
|
52246
|
-
|
|
52441
|
+
const setFloatingModalCollapsedState = (collapsed) => {
|
|
52247
52442
|
var _a, _b;
|
|
52248
52443
|
if (floatingModal)
|
|
52249
52444
|
(_b = (_a = floatingModal.dragHandle) === null || _a === void 0 ? void 0 : _a.setCollapsedState) === null || _b === void 0 ? void 0 : _b.call(_a, collapsed);
|
|
52250
52445
|
};
|
|
52251
|
-
|
|
52252
|
-
MODAL_INITIALIZED:
|
|
52446
|
+
const actions = {
|
|
52447
|
+
MODAL_INITIALIZED: () => {
|
|
52253
52448
|
var _a, _b, _c;
|
|
52254
|
-
|
|
52449
|
+
const iframe = $('frameFloatingModal');
|
|
52255
52450
|
if (iframe) {
|
|
52256
|
-
|
|
52257
|
-
|
|
52258
|
-
|
|
52451
|
+
let idToken = null;
|
|
52452
|
+
let extensionAPIKeys = null;
|
|
52453
|
+
const retrieveIDPToken = pendo.getConfigValue('retrieveIDPToken');
|
|
52259
52454
|
if (pendo._.isFunction(retrieveIDPToken)) {
|
|
52260
|
-
|
|
52455
|
+
const result = retrieveIDPToken();
|
|
52261
52456
|
if (result) {
|
|
52262
52457
|
idToken = result.idToken;
|
|
52263
52458
|
extensionAPIKeys = result.extensionAPIKeys;
|
|
52264
52459
|
}
|
|
52265
52460
|
}
|
|
52266
|
-
|
|
52267
|
-
|
|
52268
|
-
(_c = iframe.contentWindow) === null || _c === void 0 ? void 0 : _c.postMessage({ type: 'TOKEN_RECEIVED', token
|
|
52461
|
+
const visitorId = (_a = pendo === null || pendo === void 0 ? void 0 : pendo.getVisitorId) === null || _a === void 0 ? void 0 : _a.call(pendo);
|
|
52462
|
+
const accountId = forceAccountId !== null && forceAccountId !== void 0 ? forceAccountId : (_b = pendo === null || pendo === void 0 ? void 0 : pendo.getAccountId) === null || _b === void 0 ? void 0 : _b.call(pendo);
|
|
52463
|
+
(_c = iframe.contentWindow) === null || _c === void 0 ? void 0 : _c.postMessage({ type: 'TOKEN_RECEIVED', token, idToken, extensionAPIKeys, visitorId, accountId }, PREDICT_BASE_URL);
|
|
52269
52464
|
}
|
|
52270
52465
|
},
|
|
52271
|
-
OPEN_EXPLANATION:
|
|
52466
|
+
OPEN_EXPLANATION: () => {
|
|
52272
52467
|
var _a;
|
|
52273
52468
|
explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.add('is-visible');
|
|
52274
52469
|
(_a = explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(data, PREDICT_BASE_URL);
|
|
52275
52470
|
},
|
|
52276
|
-
CLOSE_EXPLANATION:
|
|
52277
|
-
AUTH_ERROR_EXPLANATION:
|
|
52471
|
+
CLOSE_EXPLANATION: () => explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.remove('is-visible'),
|
|
52472
|
+
AUTH_ERROR_EXPLANATION: () => {
|
|
52278
52473
|
explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.remove('is-visible');
|
|
52279
|
-
|
|
52474
|
+
const iframe = $('frameFloatingModal');
|
|
52280
52475
|
// eslint-disable-next-line no-self-assign
|
|
52281
52476
|
if (iframe)
|
|
52282
52477
|
iframe.src = iframe.src;
|
|
52283
52478
|
},
|
|
52284
|
-
DATA_READY:
|
|
52479
|
+
DATA_READY: () => {
|
|
52285
52480
|
floatingModal === null || floatingModal === void 0 ? void 0 : floatingModal.classList.add('is-visible');
|
|
52286
52481
|
setFloatingModalSize();
|
|
52287
52482
|
// Use analysisIds from the message data if available, otherwise use all IDs
|
|
52288
|
-
|
|
52289
|
-
for (
|
|
52290
|
-
|
|
52483
|
+
const idsToShow = data.analysisIds || [];
|
|
52484
|
+
for (let i = 0; i < idsToShow.length; i++) {
|
|
52485
|
+
const frame = $(`frameExplanation-${idsToShow[i]}`);
|
|
52291
52486
|
if (frame)
|
|
52292
52487
|
frame.classList.add('is-exists');
|
|
52293
52488
|
}
|
|
52294
52489
|
},
|
|
52295
|
-
AUTH_ERROR:
|
|
52490
|
+
AUTH_ERROR: () => {
|
|
52296
52491
|
floatingModal === null || floatingModal === void 0 ? void 0 : floatingModal.classList.add('is-visible');
|
|
52297
52492
|
setFloatingModalSize();
|
|
52298
52493
|
},
|
|
52299
52494
|
CLOSE_FLOATING_MODAL: cleanup,
|
|
52300
|
-
EXPAND_FLOATING_MODAL:
|
|
52495
|
+
EXPAND_FLOATING_MODAL: () => {
|
|
52301
52496
|
setFloatingModalSize();
|
|
52302
52497
|
setFloatingModalCollapsedState(false);
|
|
52303
52498
|
},
|
|
52304
|
-
COLLAPSE_FLOATING_MODAL:
|
|
52499
|
+
COLLAPSE_FLOATING_MODAL: () => {
|
|
52305
52500
|
setFloatingModalSize();
|
|
52306
52501
|
setFloatingModalCollapsedState(true);
|
|
52307
52502
|
}
|
|
52308
52503
|
};
|
|
52309
52504
|
if (type && type in actions) {
|
|
52310
|
-
(
|
|
52505
|
+
(_a = actions === null || actions === void 0 ? void 0 : actions[type]) === null || _a === void 0 ? void 0 : _a.call(actions);
|
|
52311
52506
|
}
|
|
52312
52507
|
};
|
|
52313
52508
|
window.addEventListener('message', messageHandler);
|
|
52314
|
-
return
|
|
52509
|
+
return () => window.removeEventListener('message', messageHandler);
|
|
52315
52510
|
};
|
|
52316
|
-
|
|
52317
|
-
var
|
|
52318
|
-
var step = _a.step, pendo = _a.pendo, cleanupArray = _a.cleanupArray, cleanup = _a.cleanup, log = _a.log;
|
|
52511
|
+
const predictGuidesScript = ({ step, pendo, cleanupArray, cleanup, log }) => {
|
|
52512
|
+
var _a;
|
|
52319
52513
|
log('[predict] initializing');
|
|
52320
52514
|
// Before anything else, inject styles so that the guide will be hidden
|
|
52321
|
-
|
|
52515
|
+
const pendoContainerId = step === null || step === void 0 ? void 0 : step.containerId;
|
|
52322
52516
|
injectStyles(pendoContainerId, log);
|
|
52323
52517
|
if (cleanupArray.length > 0) {
|
|
52324
52518
|
log('[predict] cleanupArray is not empty');
|
|
52325
52519
|
return;
|
|
52326
52520
|
}
|
|
52327
52521
|
// ----- Extract Configuration -----
|
|
52328
|
-
|
|
52522
|
+
const guideButton = (_a = step.guideElement.find(GUIDE_BUTTON_IDENTIFIER)) === null || _a === void 0 ? void 0 : _a[0];
|
|
52329
52523
|
if (!guideButton) {
|
|
52330
52524
|
log('[predict] no guide button found, aborting');
|
|
52331
52525
|
return;
|
|
52332
52526
|
}
|
|
52333
|
-
|
|
52527
|
+
const _b = safeParse(guideButton.textContent, {}, log), { token } = _b, configuration = __rest(_b, ["token"]);
|
|
52334
52528
|
if (!configuration || !token) {
|
|
52335
52529
|
log('[predict] no configuration found, aborting');
|
|
52336
52530
|
return;
|
|
52337
52531
|
}
|
|
52338
|
-
|
|
52339
|
-
|
|
52532
|
+
const recordRegex = new RegExp(`/${configuration.recordRegexName}/([a-zA-Z0-9]+)(?:/|$)`);
|
|
52533
|
+
const recordId = getRecordIdFromUrl(recordRegex, log);
|
|
52340
52534
|
if (!recordId) {
|
|
52341
52535
|
log('[predict] no recordId found in URL, aborting');
|
|
52342
52536
|
return;
|
|
52343
52537
|
}
|
|
52344
|
-
cleanupArray.push(setupMessageListener({ token
|
|
52345
|
-
cleanupArray.push(createFloatingModal({ recordId
|
|
52538
|
+
cleanupArray.push(setupMessageListener({ token, forceAccountId: configuration === null || configuration === void 0 ? void 0 : configuration.forceAccountId, cleanup, pendo }));
|
|
52539
|
+
cleanupArray.push(createFloatingModal({ recordId, configuration }));
|
|
52346
52540
|
};
|
|
52347
52541
|
|
|
52348
52542
|
const PredictGuides = () => {
|