@pendo/agent 2.322.1 → 2.323.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dom.esm.js +37 -18
- package/dist/pendo.module.js +1048 -881
- 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.1_';
|
|
3971
|
+
let PACKAGE_VERSION = '2.323.1';
|
|
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
|
}
|
|
@@ -24080,7 +24172,6 @@ function createGuideEvent(name, guideId, stepId, visitorId, reason, language) {
|
|
|
24080
24172
|
type: name,
|
|
24081
24173
|
guideId,
|
|
24082
24174
|
stepId,
|
|
24083
|
-
visitorId,
|
|
24084
24175
|
language
|
|
24085
24176
|
};
|
|
24086
24177
|
}
|
|
@@ -24096,7 +24187,7 @@ function createGuideEvent(name, guideId, stepId, visitorId, reason, language) {
|
|
|
24096
24187
|
}, _.omit(params, 'type', 'guideId', 'stepId', 'visitorId'));
|
|
24097
24188
|
var event = EventTracer.addTracerIds({
|
|
24098
24189
|
type: params.type,
|
|
24099
|
-
visitor_id:
|
|
24190
|
+
visitor_id: get_visitor_id({ generate: true }),
|
|
24100
24191
|
account_id: get_account_id(),
|
|
24101
24192
|
browser_time: new Date().getTime(),
|
|
24102
24193
|
url: pendoDotUrl.externalizeURL(),
|
|
@@ -25765,7 +25856,7 @@ function createPreviewBar() {
|
|
|
25765
25856
|
var script = document.createElement('script');
|
|
25766
25857
|
script.src = getPreviewModeAssetUrl();
|
|
25767
25858
|
script.onload = function () {
|
|
25768
|
-
var whiteLabelSettings =
|
|
25859
|
+
var whiteLabelSettings = getWhiteLabelSettings(findStoredPreviewConfig());
|
|
25769
25860
|
if (whiteLabelSettings && frame.contentWindow) {
|
|
25770
25861
|
frame.contentWindow.postMessage({
|
|
25771
25862
|
mutation: 'preview/setWhiteLabelSettings',
|
|
@@ -25904,6 +25995,19 @@ function sendPreviewModeFailureMessage(document, errorObj) {
|
|
|
25904
25995
|
}
|
|
25905
25996
|
}, location.origin);
|
|
25906
25997
|
}
|
|
25998
|
+
function getWhiteLabelSettings(config) {
|
|
25999
|
+
var whiteLabelSettings = ConfigReader.get('whiteLabelSettings');
|
|
26000
|
+
if (!whiteLabelSettings && config && config.ux === 'novus') {
|
|
26001
|
+
whiteLabelSettings = {
|
|
26002
|
+
logoUrl: 'https://novus.pendo.io/novus-square-icon.svg',
|
|
26003
|
+
logoStyle: {
|
|
26004
|
+
maxWidth: '40px',
|
|
26005
|
+
maxHeight: '40px'
|
|
26006
|
+
}
|
|
26007
|
+
};
|
|
26008
|
+
}
|
|
26009
|
+
return whiteLabelSettings;
|
|
26010
|
+
}
|
|
25907
26011
|
function updatePreview(document, activeGuides, lastGuideStepSeen) {
|
|
25908
26012
|
if (!isInPreviewMode())
|
|
25909
26013
|
return;
|
|
@@ -25958,7 +26062,7 @@ function updatePreview(document, activeGuides, lastGuideStepSeen) {
|
|
|
25958
26062
|
hostname: SERVER
|
|
25959
26063
|
}
|
|
25960
26064
|
}, location.origin);
|
|
25961
|
-
var whiteLabelSettings =
|
|
26065
|
+
var whiteLabelSettings = getWhiteLabelSettings(config);
|
|
25962
26066
|
if (whiteLabelSettings) {
|
|
25963
26067
|
previewFrame.contentWindow.postMessage({
|
|
25964
26068
|
mutation: 'preview/setWhiteLabelSettings',
|
|
@@ -29159,11 +29263,18 @@ function teardown() {
|
|
|
29159
29263
|
try {
|
|
29160
29264
|
Events.appHidden.trigger();
|
|
29161
29265
|
Events.appUnloaded.trigger();
|
|
29162
|
-
|
|
29163
|
-
teardownFn
|
|
29164
|
-
|
|
29266
|
+
try {
|
|
29267
|
+
_.each(teardownFns, function (teardownFn) {
|
|
29268
|
+
teardownFn();
|
|
29269
|
+
});
|
|
29270
|
+
}
|
|
29271
|
+
finally {
|
|
29272
|
+
// Always drain the registered teardown fns even if one throws;
|
|
29273
|
+
// otherwise a single bad teardown leaves stale entries that
|
|
29274
|
+
// would be re-invoked on the next initialize/teardown cycle.
|
|
29275
|
+
teardownFns.length = 0;
|
|
29276
|
+
}
|
|
29165
29277
|
pageLoad.reset();
|
|
29166
|
-
teardownFns.length = 0;
|
|
29167
29278
|
SingletonMessageHandler.close();
|
|
29168
29279
|
Eventable.clear(Events);
|
|
29169
29280
|
Eventable.clear(PublicEvents);
|
|
@@ -40735,19 +40846,17 @@ function TextCapture() {
|
|
|
40735
40846
|
}
|
|
40736
40847
|
}
|
|
40737
40848
|
|
|
40738
|
-
|
|
40739
|
-
|
|
40740
|
-
|
|
40741
|
-
|
|
40742
|
-
|
|
40743
|
-
function lookupGuideButtons(domJson, buttons) {
|
|
40744
|
-
if (buttons === void 0) { buttons = []; }
|
|
40849
|
+
const substitutionRegex = '\\{(?:\\s?)([^.\\s]?visitor|account|parentAccount)\\.([^|\\s/]*)(?:\\s?\\|\\s?([^}]+|[\\/s]+))?(?:\\s?\\/\\s?){1}\\}';
|
|
40850
|
+
const skipStepString = '{skipStep:* *(auto|\\d+)\\/}';
|
|
40851
|
+
const goToMiddleString = '(?!0)(\\d+)';
|
|
40852
|
+
const goToString = `({goto-${goToMiddleString}\\/})`;
|
|
40853
|
+
const containerSelector = '[id^="pendo-guide-container"]';
|
|
40854
|
+
function lookupGuideButtons(domJson, buttons = []) {
|
|
40745
40855
|
if (domJson.type === 'button' && domJson.actions) {
|
|
40746
40856
|
buttons.push(domJson);
|
|
40747
40857
|
}
|
|
40748
40858
|
if (domJson.children) {
|
|
40749
|
-
for (
|
|
40750
|
-
var child = _a[_i];
|
|
40859
|
+
for (const child of domJson.children) {
|
|
40751
40860
|
lookupGuideButtons(child, buttons);
|
|
40752
40861
|
}
|
|
40753
40862
|
}
|
|
@@ -40776,16 +40885,15 @@ function removeMarkdownSyntax(element, textToReplace, replacementText, pendo) {
|
|
|
40776
40885
|
}
|
|
40777
40886
|
}
|
|
40778
40887
|
var guideMarkdownUtil = {
|
|
40779
|
-
substitutionRegex
|
|
40780
|
-
skipStepString
|
|
40781
|
-
goToString
|
|
40782
|
-
containerSelector
|
|
40783
|
-
lookupGuideButtons
|
|
40784
|
-
removeMarkdownSyntax
|
|
40888
|
+
substitutionRegex,
|
|
40889
|
+
skipStepString,
|
|
40890
|
+
goToString,
|
|
40891
|
+
containerSelector,
|
|
40892
|
+
lookupGuideButtons,
|
|
40893
|
+
removeMarkdownSyntax
|
|
40785
40894
|
};
|
|
40786
40895
|
|
|
40787
|
-
function getZoneSafeMethod(_, method, target) {
|
|
40788
|
-
if (target === void 0) { target = window; }
|
|
40896
|
+
function getZoneSafeMethod(_, method, target = window) {
|
|
40789
40897
|
var zoneSymbol = '__symbol__';
|
|
40790
40898
|
/* global Zone */
|
|
40791
40899
|
if (typeof Zone !== 'undefined' && _.isFunction(Zone[zoneSymbol])) {
|
|
@@ -40798,20 +40906,20 @@ function getZoneSafeMethod(_, method, target) {
|
|
|
40798
40906
|
}
|
|
40799
40907
|
|
|
40800
40908
|
// Does not support submit and go to
|
|
40801
|
-
|
|
40802
|
-
|
|
40909
|
+
const goToRegex = new RegExp(guideMarkdownUtil.goToString);
|
|
40910
|
+
const PollBranching = {
|
|
40803
40911
|
name: 'PollBranching',
|
|
40804
|
-
script
|
|
40805
|
-
|
|
40806
|
-
|
|
40912
|
+
script(step, guide, pendo) {
|
|
40913
|
+
let isAdvanceIntercepted = false;
|
|
40914
|
+
const branchingQuestions = initialBranchingSetup(step, pendo);
|
|
40807
40915
|
if (branchingQuestions) {
|
|
40808
40916
|
// If there are too many branching questions saved, exit and run the guide normally.
|
|
40809
40917
|
if (pendo._.size(branchingQuestions) > 1)
|
|
40810
40918
|
return;
|
|
40811
|
-
this.on('beforeAdvance',
|
|
40812
|
-
|
|
40813
|
-
|
|
40814
|
-
|
|
40919
|
+
this.on('beforeAdvance', (evt) => {
|
|
40920
|
+
const noResponseSelected = step.guideElement.find('[branching] .pendo-radio:checked').length === 0;
|
|
40921
|
+
const responseLabel = step.guideElement.find('[branching] .pendo-radio:checked + label')[0];
|
|
40922
|
+
let noGotoLabel;
|
|
40815
40923
|
if (responseLabel) {
|
|
40816
40924
|
noGotoLabel = pendo._.isNull(responseLabel.getAttribute('goToStep'));
|
|
40817
40925
|
}
|
|
@@ -40822,58 +40930,58 @@ var PollBranching = {
|
|
|
40822
40930
|
});
|
|
40823
40931
|
}
|
|
40824
40932
|
},
|
|
40825
|
-
test
|
|
40933
|
+
test(step, guide, pendo) {
|
|
40826
40934
|
var _a;
|
|
40827
|
-
|
|
40935
|
+
let branchingQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
|
|
40828
40936
|
return !pendo._.isUndefined(branchingQuestions) && pendo._.size(branchingQuestions);
|
|
40829
40937
|
},
|
|
40830
|
-
designerListener
|
|
40831
|
-
|
|
40832
|
-
|
|
40938
|
+
designerListener(pendo) {
|
|
40939
|
+
const target = pendo.dom.getBody();
|
|
40940
|
+
const config = {
|
|
40833
40941
|
attributeFilter: ['data-layout'],
|
|
40834
40942
|
attributes: true,
|
|
40835
40943
|
childList: true,
|
|
40836
40944
|
characterData: true,
|
|
40837
40945
|
subtree: true
|
|
40838
40946
|
};
|
|
40839
|
-
|
|
40840
|
-
|
|
40947
|
+
const MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
|
|
40948
|
+
const observer = new MutationObserver(applyBranchingIndicators);
|
|
40841
40949
|
observer.observe(target, config);
|
|
40842
40950
|
function applyBranchingIndicators(mutations) {
|
|
40843
40951
|
pendo._.each(mutations, function (mutation) {
|
|
40844
40952
|
var _a;
|
|
40845
|
-
|
|
40953
|
+
const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelector);
|
|
40846
40954
|
if (mutation.addedNodes.length && nodeHasQuerySelector) {
|
|
40847
40955
|
if (mutation.addedNodes[0].querySelector('._pendo-multi-choice-poll-select-border')) {
|
|
40848
40956
|
if (pendo._.size(pendo.dom('._pendo-multi-choice-poll-question:contains("{branching/}")'))) {
|
|
40849
40957
|
pendo
|
|
40850
40958
|
.dom('._pendo-multi-choice-poll-question:contains("{branching/}")')
|
|
40851
|
-
.each(
|
|
40852
|
-
pendo._.each(pendo.dom(
|
|
40959
|
+
.each((question, index) => {
|
|
40960
|
+
pendo._.each(pendo.dom(`#${question.id} *`), (element) => {
|
|
40853
40961
|
guideMarkdownUtil.removeMarkdownSyntax(element, '{branching/}', '', pendo);
|
|
40854
40962
|
});
|
|
40855
40963
|
pendo
|
|
40856
|
-
.dom(
|
|
40964
|
+
.dom(`#${question.id} p`)
|
|
40857
40965
|
.css({ display: 'inline-block !important' })
|
|
40858
40966
|
.append(branchingIcon('#999', '20px'))
|
|
40859
40967
|
.attr({ title: 'Custom Branching Added' });
|
|
40860
|
-
|
|
40861
|
-
if (pendo.dom(
|
|
40968
|
+
let dataPendoPollId = question.getAttribute('data-pendo-poll-id');
|
|
40969
|
+
if (pendo.dom(`._pendo-multi-choice-poll-question[data-pendo-poll-id=${dataPendoPollId}]`)[0]) {
|
|
40862
40970
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
40863
40971
|
pendo
|
|
40864
|
-
.dom(
|
|
40972
|
+
.dom(`._pendo-multi-choice-poll-question[data-pendo-poll-id=${dataPendoPollId}]`)[0]
|
|
40865
40973
|
.textContent.trim();
|
|
40866
40974
|
}
|
|
40867
|
-
|
|
40975
|
+
let pollLabels = pendo.dom(`label[for*=${dataPendoPollId}]`);
|
|
40868
40976
|
if (pendo._.size(pollLabels)) {
|
|
40869
|
-
pendo._.forEach(pollLabels,
|
|
40977
|
+
pendo._.forEach(pollLabels, (label) => {
|
|
40870
40978
|
if (goToRegex.test(label.textContent)) {
|
|
40871
|
-
|
|
40979
|
+
let labelTitle = goToRegex.exec(label.textContent)[2];
|
|
40872
40980
|
guideMarkdownUtil.removeMarkdownSyntax(label, goToRegex, '', pendo);
|
|
40873
40981
|
pendo
|
|
40874
40982
|
.dom(label)
|
|
40875
40983
|
.append(branchingIcon('#999', '14px'))
|
|
40876
|
-
.attr({ title:
|
|
40984
|
+
.attr({ title: `Branching to step ${labelTitle}` });
|
|
40877
40985
|
}
|
|
40878
40986
|
});
|
|
40879
40987
|
}
|
|
@@ -40881,9 +40989,9 @@ var PollBranching = {
|
|
|
40881
40989
|
pendo
|
|
40882
40990
|
.dom(question)
|
|
40883
40991
|
.append(branchingErrorHTML(question.dataset.pendoPollId));
|
|
40884
|
-
pendo.dom(
|
|
40992
|
+
pendo.dom(`#${question.id} #pendo-ps-branching-svg`).remove();
|
|
40885
40993
|
pendo
|
|
40886
|
-
.dom(
|
|
40994
|
+
.dom(`#${question.id} p`)
|
|
40887
40995
|
.css({ display: 'inline-block !important' })
|
|
40888
40996
|
.append(branchingIcon('red', '20px'))
|
|
40889
40997
|
.attr({ title: 'Unsupported Branching configuration' });
|
|
@@ -40895,31 +41003,49 @@ var PollBranching = {
|
|
|
40895
41003
|
});
|
|
40896
41004
|
}
|
|
40897
41005
|
function branchingErrorHTML(dataPendoPollId) {
|
|
40898
|
-
return
|
|
41006
|
+
return `<div style="text-align:lrft; font-size: 14px; color: red;
|
|
41007
|
+
font-style: italic; margin-top: 0px;" class="branching-wrapper"
|
|
41008
|
+
name="${dataPendoPollId}">
|
|
41009
|
+
* Branching Error: Multiple branching polls not supported</div>`;
|
|
40899
41010
|
}
|
|
40900
41011
|
function branchingIcon(color, size) {
|
|
40901
|
-
return
|
|
41012
|
+
return `<svg id="pendo-ps-branching-svg" viewBox="0 0 24 24" fill="none"
|
|
41013
|
+
style="margin-left: 5px;
|
|
41014
|
+
height:${size}; width:${size}; display:inline; vertical-align:middle;" xmlns="http://www.w3.org/2000/svg">
|
|
41015
|
+
<g stroke-width="0"></g>
|
|
41016
|
+
<g stroke-linecap="round" stroke-linejoin="round"></g>
|
|
41017
|
+
<g> <circle cx="4" cy="7" r="2" stroke="${color}"
|
|
41018
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></circle>
|
|
41019
|
+
<circle cx="20" cy="7" r="2" stroke="${color}"
|
|
41020
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></circle>
|
|
41021
|
+
<circle cx="20" cy="17" r="2" stroke="${color}" stroke-width="2"
|
|
41022
|
+
stroke-linecap="round" stroke-linejoin="round"></circle>
|
|
41023
|
+
<path d="M18 7H6" stroke="${color}" stroke-width="2"
|
|
41024
|
+
stroke-linecap="round" stroke-linejoin="round"></path>
|
|
41025
|
+
<path d="M7 7V7C8.65685 7 10 8.34315 10 10V15C10 16.1046 10.8954 17 12 17H18"
|
|
41026
|
+
stroke="${color}" stroke-width="2" stroke-linecap="round"
|
|
41027
|
+
stroke-linejoin="round"></path> </g></svg>`;
|
|
40902
41028
|
}
|
|
40903
41029
|
}
|
|
40904
41030
|
};
|
|
40905
41031
|
function initialBranchingSetup(step, pendo) {
|
|
40906
|
-
|
|
40907
|
-
pendo._.forEach(questions,
|
|
40908
|
-
|
|
40909
|
-
pendo._.each(step.guideElement.find(
|
|
41032
|
+
const questions = step.guideElement.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
|
|
41033
|
+
pendo._.forEach(questions, (question) => {
|
|
41034
|
+
let dataPendoPollId = question.getAttribute('data-pendo-poll-id');
|
|
41035
|
+
pendo._.each(step.guideElement.find(`#${question.id} *`), (element) => {
|
|
40910
41036
|
guideMarkdownUtil.removeMarkdownSyntax(element, '{branching/}', '', pendo);
|
|
40911
41037
|
});
|
|
40912
|
-
|
|
40913
|
-
pendo._.forEach(pollLabels,
|
|
41038
|
+
let pollLabels = step.guideElement.find(`label[for*=${dataPendoPollId}]`);
|
|
41039
|
+
pendo._.forEach(pollLabels, (label) => {
|
|
40914
41040
|
if (pendo._.isNull(goToRegex.exec(label.textContent))) {
|
|
40915
41041
|
return;
|
|
40916
41042
|
}
|
|
40917
|
-
|
|
40918
|
-
|
|
41043
|
+
let gotoSubstring = goToRegex.exec(label.textContent)[1];
|
|
41044
|
+
let gotoIndex = goToRegex.exec(label.textContent)[2];
|
|
40919
41045
|
label.setAttribute('goToStep', gotoIndex);
|
|
40920
41046
|
guideMarkdownUtil.removeMarkdownSyntax(label, gotoSubstring, '', pendo);
|
|
40921
41047
|
});
|
|
40922
|
-
|
|
41048
|
+
let pollChoiceContainer = step.guideElement.find(`[data-pendo-poll-id=${dataPendoPollId}]._pendo-multi-choice-poll-select-border`);
|
|
40923
41049
|
if (pollChoiceContainer && pollChoiceContainer.length) {
|
|
40924
41050
|
pollChoiceContainer[0].setAttribute('branching', '');
|
|
40925
41051
|
}
|
|
@@ -40928,24 +41054,24 @@ function initialBranchingSetup(step, pendo) {
|
|
|
40928
41054
|
}
|
|
40929
41055
|
function branchingGoToStep(event, step, guide, pendo) {
|
|
40930
41056
|
var _a;
|
|
40931
|
-
|
|
40932
|
-
|
|
40933
|
-
|
|
40934
|
-
|
|
41057
|
+
let checkedPollInputId = (_a = step.guideElement.find('[branching] input.pendo-radio[data-pendo-poll-id]:checked')[0]) === null || _a === void 0 ? void 0 : _a.id;
|
|
41058
|
+
let checkedPollLabel = step.guideElement.find(`label[for="${checkedPollInputId}"]`)[0];
|
|
41059
|
+
let checkedPollLabelStepIndex = checkedPollLabel === null || checkedPollLabel === void 0 ? void 0 : checkedPollLabel.getAttribute('goToStep');
|
|
41060
|
+
let pollStepIndex = checkedPollLabelStepIndex - 1;
|
|
40935
41061
|
if (pollStepIndex < 0)
|
|
40936
41062
|
return;
|
|
40937
|
-
|
|
41063
|
+
const destinationObject = {
|
|
40938
41064
|
destinationStepId: guide.steps[pollStepIndex].id,
|
|
40939
|
-
step
|
|
41065
|
+
step
|
|
40940
41066
|
};
|
|
40941
41067
|
pendo.goToStep(destinationObject);
|
|
40942
41068
|
event.cancel = true;
|
|
40943
41069
|
}
|
|
40944
41070
|
|
|
40945
|
-
|
|
41071
|
+
const MetadataSubstitution = {
|
|
40946
41072
|
name: 'MetadataSubstitution',
|
|
40947
|
-
script
|
|
40948
|
-
|
|
41073
|
+
script(step, guide, pendo) {
|
|
41074
|
+
const placeholderData = findSubstitutableElements(pendo);
|
|
40949
41075
|
if (step.domJson) {
|
|
40950
41076
|
findSubstitutableUrlsInJson(step.domJson, placeholderData, pendo);
|
|
40951
41077
|
}
|
|
@@ -40953,22 +41079,22 @@ var MetadataSubstitution = {
|
|
|
40953
41079
|
pendo._.each(placeholderData, function (placeholder) {
|
|
40954
41080
|
processPlaceholder(placeholder, pendo);
|
|
40955
41081
|
});
|
|
40956
|
-
|
|
40957
|
-
|
|
40958
|
-
updateGuideContainer(containerId,
|
|
41082
|
+
const containerId = `pendo-g-${step.id}`;
|
|
41083
|
+
const context = step.guideElement;
|
|
41084
|
+
updateGuideContainer(containerId, context, pendo);
|
|
40959
41085
|
}
|
|
40960
41086
|
},
|
|
40961
|
-
designerListener
|
|
40962
|
-
|
|
41087
|
+
designerListener(pendo) {
|
|
41088
|
+
const target = pendo.dom.getBody();
|
|
40963
41089
|
if (pendo.designerv2) {
|
|
40964
41090
|
pendo.designerv2.runMetadataSubstitutionForDesignerPreview = function runMetadataSubstitutionForDesignerPreview() {
|
|
40965
41091
|
var _a;
|
|
40966
41092
|
if (!document.querySelector(guideMarkdownUtil.containerSelector))
|
|
40967
41093
|
return;
|
|
40968
|
-
|
|
41094
|
+
const step = (_a = pendo.designerv2.currentlyPreviewedGuide) === null || _a === void 0 ? void 0 : _a.steps[0];
|
|
40969
41095
|
if (!step)
|
|
40970
41096
|
return;
|
|
40971
|
-
|
|
41097
|
+
const placeholderData = findSubstitutableElements(pendo);
|
|
40972
41098
|
if (step.buildingBlocks) {
|
|
40973
41099
|
findSubstitutableUrlsInJson(step.buildingBlocks, placeholderData, pendo);
|
|
40974
41100
|
}
|
|
@@ -40978,32 +41104,32 @@ var MetadataSubstitution = {
|
|
|
40978
41104
|
return;
|
|
40979
41105
|
processPlaceholder(placeholder, pendo);
|
|
40980
41106
|
});
|
|
40981
|
-
|
|
40982
|
-
|
|
40983
|
-
updateGuideContainer(containerId,
|
|
41107
|
+
const containerId = `pendo-g-${step.id}`;
|
|
41108
|
+
const context = step.guideElement;
|
|
41109
|
+
updateGuideContainer(containerId, context, pendo);
|
|
40984
41110
|
}
|
|
40985
41111
|
};
|
|
40986
41112
|
}
|
|
40987
|
-
|
|
41113
|
+
const config = {
|
|
40988
41114
|
attributeFilter: ['data-layout'],
|
|
40989
41115
|
attributes: true,
|
|
40990
41116
|
childList: true,
|
|
40991
41117
|
characterData: true,
|
|
40992
41118
|
subtree: true
|
|
40993
41119
|
};
|
|
40994
|
-
|
|
40995
|
-
|
|
41120
|
+
const MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
|
|
41121
|
+
const observer = new MutationObserver(applySubstitutionIndicators);
|
|
40996
41122
|
observer.observe(target, config);
|
|
40997
41123
|
function applySubstitutionIndicators(mutations) {
|
|
40998
41124
|
pendo._.each(mutations, function (mutation) {
|
|
40999
41125
|
var _a;
|
|
41000
41126
|
if (mutation.addedNodes.length) {
|
|
41001
41127
|
if (document.querySelector(guideMarkdownUtil.containerSelector)) {
|
|
41002
|
-
|
|
41003
|
-
|
|
41128
|
+
const placeholderData = findSubstitutableElements(pendo);
|
|
41129
|
+
const step = (_a = pendo.designerv2.currentlyPreviewedGuide) === null || _a === void 0 ? void 0 : _a.steps[0];
|
|
41004
41130
|
if (!step)
|
|
41005
41131
|
return;
|
|
41006
|
-
|
|
41132
|
+
const pendoBlocks = step.buildingBlocks;
|
|
41007
41133
|
if (!pendo._.isUndefined(pendoBlocks)) {
|
|
41008
41134
|
findSubstitutableUrlsInJson(pendoBlocks, placeholderData, pendo);
|
|
41009
41135
|
}
|
|
@@ -41013,9 +41139,9 @@ var MetadataSubstitution = {
|
|
|
41013
41139
|
return;
|
|
41014
41140
|
processPlaceholder(placeholder, pendo);
|
|
41015
41141
|
});
|
|
41016
|
-
|
|
41017
|
-
|
|
41018
|
-
updateGuideContainer(containerId,
|
|
41142
|
+
const containerId = `pendo-g-${step.id}`;
|
|
41143
|
+
const context = step.guideElement;
|
|
41144
|
+
updateGuideContainer(containerId, context, pendo);
|
|
41019
41145
|
}
|
|
41020
41146
|
}
|
|
41021
41147
|
}
|
|
@@ -41024,18 +41150,18 @@ var MetadataSubstitution = {
|
|
|
41024
41150
|
}
|
|
41025
41151
|
};
|
|
41026
41152
|
function processPlaceholder(placeholder, pendo) {
|
|
41027
|
-
|
|
41028
|
-
|
|
41029
|
-
|
|
41153
|
+
let match;
|
|
41154
|
+
const { data, target } = placeholder;
|
|
41155
|
+
const subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
|
|
41030
41156
|
while ((match = matchPlaceholder(placeholder, subRegex))) {
|
|
41031
|
-
|
|
41032
|
-
|
|
41157
|
+
const usedArrayPath = Array.isArray(match) && match.length >= 2;
|
|
41158
|
+
const currentStr = target === 'textContent'
|
|
41033
41159
|
? data[target]
|
|
41034
41160
|
: decodeURI((data.getAttribute && (target === 'href' || target === 'value') ? (data.getAttribute(target) || '') : data[target]));
|
|
41035
|
-
|
|
41161
|
+
const matched = usedArrayPath ? match : subRegex.exec(currentStr);
|
|
41036
41162
|
if (!matched)
|
|
41037
41163
|
continue;
|
|
41038
|
-
|
|
41164
|
+
const mdValue = getSubstituteValue(matched, pendo);
|
|
41039
41165
|
substituteMetadataByTarget(data, target, mdValue, matched);
|
|
41040
41166
|
}
|
|
41041
41167
|
}
|
|
@@ -41044,48 +41170,48 @@ function matchPlaceholder(placeholder, regex) {
|
|
|
41044
41170
|
return placeholder.data[placeholder.target].match(regex);
|
|
41045
41171
|
}
|
|
41046
41172
|
else {
|
|
41047
|
-
|
|
41173
|
+
const raw = placeholder.data.getAttribute && (placeholder.target === 'href' || placeholder.target === 'value')
|
|
41048
41174
|
? (placeholder.data.getAttribute(placeholder.target) || '')
|
|
41049
41175
|
: placeholder.data[placeholder.target];
|
|
41050
41176
|
return decodeURI(raw).match(regex);
|
|
41051
41177
|
}
|
|
41052
41178
|
}
|
|
41053
41179
|
function getMetadataValueCaseInsensitive(metadata, type, property) {
|
|
41054
|
-
|
|
41180
|
+
const kind = metadata && metadata[type];
|
|
41055
41181
|
if (!kind || typeof kind !== 'object')
|
|
41056
41182
|
return undefined;
|
|
41057
|
-
|
|
41183
|
+
const direct = Object.prototype.hasOwnProperty.call(kind, property) ? kind[property] : undefined;
|
|
41058
41184
|
if (direct !== undefined) {
|
|
41059
41185
|
return direct;
|
|
41060
41186
|
}
|
|
41061
|
-
|
|
41062
|
-
|
|
41063
|
-
|
|
41187
|
+
const propLower = property.toLowerCase();
|
|
41188
|
+
const key = Object.keys(kind).find(k => k.toLowerCase() === propLower);
|
|
41189
|
+
const value = key !== undefined ? kind[key] : undefined;
|
|
41064
41190
|
return value;
|
|
41065
41191
|
}
|
|
41066
41192
|
function getSubstituteValue(match, pendo) {
|
|
41067
41193
|
if (pendo._.isUndefined(match[1]) || pendo._.isUndefined(match[2])) {
|
|
41068
41194
|
return;
|
|
41069
41195
|
}
|
|
41070
|
-
|
|
41071
|
-
|
|
41072
|
-
|
|
41196
|
+
let type = match[1];
|
|
41197
|
+
let property = match[2];
|
|
41198
|
+
let defaultValue = match[3];
|
|
41073
41199
|
if (pendo._.isUndefined(type) || pendo._.isUndefined(property)) {
|
|
41074
41200
|
return;
|
|
41075
41201
|
}
|
|
41076
|
-
|
|
41077
|
-
|
|
41202
|
+
const metadata = pendo.getSerializedMetadata();
|
|
41203
|
+
let mdValue = getMetadataValueCaseInsensitive(metadata, type, property);
|
|
41078
41204
|
if (mdValue === undefined || mdValue === null)
|
|
41079
41205
|
mdValue = defaultValue || '';
|
|
41080
41206
|
return mdValue;
|
|
41081
41207
|
}
|
|
41082
41208
|
function substituteMetadataByTarget(data, target, mdValue, matched) {
|
|
41083
|
-
|
|
41084
|
-
|
|
41209
|
+
const isElement = data && typeof data.getAttribute === 'function';
|
|
41210
|
+
const current = (target === 'href' || target === 'value') && isElement
|
|
41085
41211
|
? (data.getAttribute(target) || '')
|
|
41086
41212
|
: data[target];
|
|
41087
41213
|
if (target === 'href' || target === 'value') {
|
|
41088
|
-
|
|
41214
|
+
const safeValue = window.encodeURIComponent(String(mdValue === undefined || mdValue === null ? '' : mdValue));
|
|
41089
41215
|
data[target] = decodeURI(current).replace(matched[0], safeValue);
|
|
41090
41216
|
}
|
|
41091
41217
|
else {
|
|
@@ -41099,9 +41225,8 @@ function updateGuideContainer(containerId, context, pendo) {
|
|
|
41099
41225
|
pendo.flexElement(pendo.dom(guideMarkdownUtil.containerSelector));
|
|
41100
41226
|
pendo.BuildingBlocks.BuildingBlockGuides.recalculateGuideHeight(containerId, context);
|
|
41101
41227
|
}
|
|
41102
|
-
function findSubstitutableUrlsInJson(originalData, placeholderData, pendo) {
|
|
41103
|
-
|
|
41104
|
-
var subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
|
|
41228
|
+
function findSubstitutableUrlsInJson(originalData, placeholderData = [], pendo) {
|
|
41229
|
+
const subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
|
|
41105
41230
|
if ((originalData.name === 'url' || originalData.name === 'href') && originalData.value) {
|
|
41106
41231
|
if (subRegex.test(originalData.value)) {
|
|
41107
41232
|
placeholderData.push({
|
|
@@ -41111,37 +41236,37 @@ function findSubstitutableUrlsInJson(originalData, placeholderData, pendo) {
|
|
|
41111
41236
|
}
|
|
41112
41237
|
}
|
|
41113
41238
|
if (originalData.properties && originalData.id === 'href_link_block') {
|
|
41114
|
-
pendo._.each(originalData.properties,
|
|
41239
|
+
pendo._.each(originalData.properties, (prop) => {
|
|
41115
41240
|
findSubstitutableUrlsInJson(prop, placeholderData, pendo);
|
|
41116
41241
|
});
|
|
41117
41242
|
}
|
|
41118
41243
|
if (originalData.views) {
|
|
41119
|
-
pendo._.each(originalData.views,
|
|
41244
|
+
pendo._.each(originalData.views, (view) => {
|
|
41120
41245
|
findSubstitutableUrlsInJson(view, placeholderData, pendo);
|
|
41121
41246
|
});
|
|
41122
41247
|
}
|
|
41123
41248
|
if (originalData.parameters) {
|
|
41124
|
-
pendo._.each(originalData.parameters,
|
|
41249
|
+
pendo._.each(originalData.parameters, (param) => {
|
|
41125
41250
|
findSubstitutableUrlsInJson(param, placeholderData, pendo);
|
|
41126
41251
|
});
|
|
41127
41252
|
}
|
|
41128
41253
|
if (originalData.actions) {
|
|
41129
|
-
pendo._.each(originalData.actions,
|
|
41254
|
+
pendo._.each(originalData.actions, (action) => {
|
|
41130
41255
|
findSubstitutableUrlsInJson(action, placeholderData, pendo);
|
|
41131
41256
|
});
|
|
41132
41257
|
}
|
|
41133
41258
|
if (originalData.children) {
|
|
41134
|
-
pendo._.each(originalData.children,
|
|
41259
|
+
pendo._.each(originalData.children, (child) => {
|
|
41135
41260
|
findSubstitutableUrlsInJson(child, placeholderData, pendo);
|
|
41136
41261
|
});
|
|
41137
41262
|
}
|
|
41138
41263
|
return placeholderData;
|
|
41139
41264
|
}
|
|
41140
41265
|
function findSubstitutableElements(pendo) {
|
|
41141
|
-
|
|
41266
|
+
let elements = pendo.dom(`${guideMarkdownUtil.containerSelector} *:not(.pendo-inline-ui)`);
|
|
41142
41267
|
return pendo._.chain(elements)
|
|
41143
41268
|
.filter(function (placeholder) {
|
|
41144
|
-
|
|
41269
|
+
const subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
|
|
41145
41270
|
if (placeholder.localName === 'a') {
|
|
41146
41271
|
return subRegex.test(decodeURI(placeholder.href)) || subRegex.test(placeholder.textContent);
|
|
41147
41272
|
}
|
|
@@ -41197,25 +41322,51 @@ function findSubstitutableElements(pendo) {
|
|
|
41197
41322
|
.value();
|
|
41198
41323
|
}
|
|
41199
41324
|
function substitutionIcon(color, size) {
|
|
41200
|
-
return (
|
|
41201
|
-
|
|
41202
|
-
|
|
41203
|
-
|
|
41204
|
-
|
|
41205
|
-
|
|
41325
|
+
return (`<div title="Metadata Substitution added">
|
|
41326
|
+
<svg id="pendo-ps-substitution-icon" viewBox="0 0 24 24"
|
|
41327
|
+
preserveAspectRatio="xMidYMid meet"
|
|
41328
|
+
height=${size} width=${size} title="Metadata Substitution"
|
|
41329
|
+
style="bottom:5px; right:10px; position: absolute;"
|
|
41330
|
+
fill="none" xmlns="http://www.w3.org/2000/svg" stroke="${color}"
|
|
41331
|
+
transform="matrix(1, 0, 0, 1, 0, 0)rotate(0)">
|
|
41332
|
+
<g stroke-width="0"></g>
|
|
41333
|
+
<g stroke-linecap="round" stroke-linejoin="round"
|
|
41334
|
+
stroke="${color}" stroke-width="0.528"></g>
|
|
41335
|
+
<g><path fill-rule="evenodd" clip-rule="evenodd"
|
|
41336
|
+
d="M5 5.5C4.17157 5.5 3.5 6.17157 3.5 7V10C3.5 10.8284
|
|
41337
|
+
4.17157 11.5 5 11.5H8C8.82843 11.5 9.5 10.8284 9.5
|
|
41338
|
+
10V9H17V11C17 11.2761 17.2239 11.5 17.5 11.5C17.7761
|
|
41339
|
+
11.5 18 11.2761 18 11V8.5C18 8.22386 17.7761 8 17.5
|
|
41340
|
+
8H9.5V7C9.5 6.17157 8.82843 5.5 8 5.5H5ZM8.5 7C8.5
|
|
41341
|
+
6.72386 8.27614 6.5 8 6.5H5C4.72386 6.5 4.5 6.72386
|
|
41342
|
+
4.5 7V10C4.5 10.2761 4.72386 10.5 5 10.5H8C8.27614
|
|
41343
|
+
10.5 8.5 10.2761 8.5 10V7Z" fill="${color}"></path>
|
|
41344
|
+
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
41345
|
+
d="M7 13C7 12.7239 6.77614 12.5 6.5 12.5C6.22386 12.5
|
|
41346
|
+
6 12.7239 6 13V15.5C6 15.7761 6.22386 16 6.5
|
|
41347
|
+
16H14.5V17C14.5 17.8284 15.1716 18.5 16 18.5H19C19.8284
|
|
41348
|
+
18.5 20.5 17.8284 20.5 17V14C20.5 13.1716 19.8284 12.5
|
|
41349
|
+
19 12.5H16C15.1716 12.5 14.5 13.1716 14.5
|
|
41350
|
+
14V15H7V13ZM15.5 17C15.5 17.2761 15.7239 17.5 16
|
|
41351
|
+
17.5H19C19.2761 17.5 19.5 17.2761 19.5 17V14C19.5
|
|
41352
|
+
13.7239 19.2761 13.5 19 13.5H16C15.7239 13.5 15.5
|
|
41353
|
+
13.7239 15.5 14V17Z" fill="${color}"></path> </g></svg></div>`);
|
|
41354
|
+
}
|
|
41355
|
+
|
|
41356
|
+
const requiredElement = '<span class="_pendo-required-indicator" style="color:red; font-style:italic;" title="Question is required"> *</span>';
|
|
41357
|
+
const requiredSyntax = '{required/}';
|
|
41358
|
+
const RequiredQuestions = {
|
|
41206
41359
|
name: 'RequiredQuestions',
|
|
41207
|
-
script
|
|
41360
|
+
script(step, guide, pendo) {
|
|
41208
41361
|
var _a;
|
|
41209
|
-
|
|
41210
|
-
|
|
41211
|
-
|
|
41212
|
-
});
|
|
41213
|
-
var requiredQuestions = processRequiredQuestions();
|
|
41362
|
+
let requiredPollIds = [];
|
|
41363
|
+
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'));
|
|
41364
|
+
const requiredQuestions = processRequiredQuestions();
|
|
41214
41365
|
if (requiredQuestions) {
|
|
41215
|
-
pendo._.forEach(requiredQuestions,
|
|
41366
|
+
pendo._.forEach(requiredQuestions, (question) => {
|
|
41216
41367
|
if (question.classList.contains('_pendo-open-text-poll-question')) {
|
|
41217
|
-
|
|
41218
|
-
step.attachEvent(step.guideElement.find(
|
|
41368
|
+
let pollId = question.dataset.pendoPollId;
|
|
41369
|
+
step.attachEvent(step.guideElement.find(`[data-pendo-poll-id=${pollId}]._pendo-open-text-poll-input`)[0], 'input', function () {
|
|
41219
41370
|
evaluateRequiredQuestions(requiredQuestions);
|
|
41220
41371
|
});
|
|
41221
41372
|
}
|
|
@@ -41227,8 +41378,8 @@ var RequiredQuestions = {
|
|
|
41227
41378
|
});
|
|
41228
41379
|
}
|
|
41229
41380
|
function getEligibleQuestions() {
|
|
41230
|
-
|
|
41231
|
-
return pendo._.reduce(allQuestions,
|
|
41381
|
+
const allQuestions = step.guideElement.find(`[class*=-poll-question]:contains(${requiredSyntax})`);
|
|
41382
|
+
return pendo._.reduce(allQuestions, (eligibleQuestions, question) => {
|
|
41232
41383
|
if (question.classList.contains('_pendo-yes-no-poll-question'))
|
|
41233
41384
|
return eligibleQuestions;
|
|
41234
41385
|
eligibleQuestions.push(question);
|
|
@@ -41236,19 +41387,27 @@ var RequiredQuestions = {
|
|
|
41236
41387
|
}, []);
|
|
41237
41388
|
}
|
|
41238
41389
|
function processRequiredQuestions() {
|
|
41239
|
-
|
|
41390
|
+
let questions = getEligibleQuestions();
|
|
41240
41391
|
if (questions) {
|
|
41241
|
-
pendo._.forEach(questions,
|
|
41242
|
-
|
|
41392
|
+
pendo._.forEach(questions, question => {
|
|
41393
|
+
let dataPendoPollId = question.getAttribute('data-pendo-poll-id');
|
|
41243
41394
|
requiredPollIds.push(dataPendoPollId);
|
|
41244
|
-
pendo._.each(step.guideElement.find(
|
|
41395
|
+
pendo._.each(step.guideElement.find(`#${question.id} *, #${question.id}`), (element) => {
|
|
41245
41396
|
guideMarkdownUtil.removeMarkdownSyntax(element, requiredSyntax, '', pendo);
|
|
41246
41397
|
});
|
|
41247
|
-
step.guideElement.find(
|
|
41398
|
+
step.guideElement.find(`#${question.id} p`).append(requiredElement);
|
|
41248
41399
|
});
|
|
41249
41400
|
}
|
|
41250
41401
|
if (pendo._.size(requiredPollIds)) {
|
|
41251
|
-
|
|
41402
|
+
const disabledButtonStyles = `<style type=text/css
|
|
41403
|
+
id=_pendo-guide-required-disabled>
|
|
41404
|
+
._pendo-button:disabled, ._pendo-buttons[disabled] {
|
|
41405
|
+
border: 1px solid #999999 !important;
|
|
41406
|
+
background-color: #cccccc !important;
|
|
41407
|
+
color: #666666 !important;
|
|
41408
|
+
pointer-events: none !important;
|
|
41409
|
+
}
|
|
41410
|
+
</style>`;
|
|
41252
41411
|
if (pendo.dom('#_pendo-guide-required-disabled').length === 0) {
|
|
41253
41412
|
pendo.dom('head').append(disabledButtonStyles);
|
|
41254
41413
|
}
|
|
@@ -41259,11 +41418,15 @@ var RequiredQuestions = {
|
|
|
41259
41418
|
function evaluateRequiredQuestions(questions) {
|
|
41260
41419
|
if (questions.length === 0)
|
|
41261
41420
|
return;
|
|
41262
|
-
|
|
41263
|
-
|
|
41264
|
-
responses = responses.concat(pendo._.map(questions,
|
|
41265
|
-
|
|
41266
|
-
|
|
41421
|
+
let allRequiredComplete = true;
|
|
41422
|
+
let responses = [];
|
|
41423
|
+
responses = responses.concat(pendo._.map(questions, (question) => {
|
|
41424
|
+
let pollId = question.getAttribute('data-pendo-poll-id');
|
|
41425
|
+
let input = step.guideElement.find(`
|
|
41426
|
+
[data-pendo-poll-id=${pollId}] textarea,
|
|
41427
|
+
[data-pendo-poll-id=${pollId}] input:text,
|
|
41428
|
+
[data-pendo-poll-id=${pollId}] select,
|
|
41429
|
+
[data-pendo-poll-id=${pollId}] input:radio:checked`);
|
|
41267
41430
|
if (input && input.length && input[0].value) {
|
|
41268
41431
|
return input[0].value;
|
|
41269
41432
|
}
|
|
@@ -41280,48 +41443,48 @@ var RequiredQuestions = {
|
|
|
41280
41443
|
}
|
|
41281
41444
|
function disableEligibleButtons(buttons) {
|
|
41282
41445
|
pendo._.each(buttons, function (button) {
|
|
41283
|
-
if (step.guideElement.find(
|
|
41284
|
-
step.guideElement.find(
|
|
41285
|
-
step.guideElement.find(
|
|
41446
|
+
if (step.guideElement.find(`#${button.props.id}`)[0]) {
|
|
41447
|
+
step.guideElement.find(`#${button.props.id}`)[0].disabled = true;
|
|
41448
|
+
step.guideElement.find(`#${button.props.id}`)[0].parentElement.title = 'Please complete all required questions.';
|
|
41286
41449
|
}
|
|
41287
41450
|
});
|
|
41288
41451
|
}
|
|
41289
41452
|
function enableEligibleButtons(buttons) {
|
|
41290
41453
|
pendo._.each(buttons, function (button) {
|
|
41291
|
-
if (step.guideElement.find(
|
|
41292
|
-
step.guideElement.find(
|
|
41293
|
-
step.guideElement.find(
|
|
41454
|
+
if (step.guideElement.find(`#${button.props.id}`)[0]) {
|
|
41455
|
+
step.guideElement.find(`#${button.props.id}`)[0].disabled = false;
|
|
41456
|
+
step.guideElement.find(`#${button.props.id}`)[0].parentElement.title = '';
|
|
41294
41457
|
}
|
|
41295
41458
|
});
|
|
41296
41459
|
}
|
|
41297
41460
|
},
|
|
41298
|
-
test
|
|
41461
|
+
test(step, guide, pendo) {
|
|
41299
41462
|
var _a;
|
|
41300
|
-
|
|
41463
|
+
let requiredQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find(`[class*=-poll-question]:contains(${requiredSyntax})`);
|
|
41301
41464
|
return !pendo._.isUndefined(requiredQuestions) && pendo._.size(requiredQuestions);
|
|
41302
41465
|
},
|
|
41303
|
-
designerListener
|
|
41304
|
-
|
|
41305
|
-
|
|
41306
|
-
|
|
41466
|
+
designerListener(pendo) {
|
|
41467
|
+
const requiredQuestions = [];
|
|
41468
|
+
const target = pendo.dom.getBody();
|
|
41469
|
+
const config = {
|
|
41307
41470
|
attributeFilter: ['data-layout'],
|
|
41308
41471
|
attributes: true,
|
|
41309
41472
|
childList: true,
|
|
41310
41473
|
characterData: true,
|
|
41311
41474
|
subtree: true
|
|
41312
41475
|
};
|
|
41313
|
-
|
|
41314
|
-
|
|
41476
|
+
const MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
|
|
41477
|
+
const observer = new MutationObserver(applyRequiredIndicators);
|
|
41315
41478
|
observer.observe(target, config);
|
|
41316
41479
|
function applyRequiredIndicators(mutations) {
|
|
41317
41480
|
pendo._.each(mutations, function (mutation) {
|
|
41318
41481
|
var _a;
|
|
41319
|
-
|
|
41482
|
+
const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
|
|
41320
41483
|
if (mutation.addedNodes.length && nodeHasQuerySelector) {
|
|
41321
|
-
|
|
41484
|
+
let eligiblePolls = mutation.addedNodes[0].querySelectorAll('[class*=-poll-wrapper], [class*=-poll-select-border]');
|
|
41322
41485
|
if (eligiblePolls) {
|
|
41323
41486
|
pendo._.each(eligiblePolls, function (poll) {
|
|
41324
|
-
|
|
41487
|
+
let dataPendoPollId;
|
|
41325
41488
|
if (poll.classList.contains('_pendo-open-text-poll-wrapper') ||
|
|
41326
41489
|
poll.classList.contains('_pendo-number-scale-poll-wrapper')) {
|
|
41327
41490
|
dataPendoPollId = poll.getAttribute('name');
|
|
@@ -41329,27 +41492,27 @@ var RequiredQuestions = {
|
|
|
41329
41492
|
else {
|
|
41330
41493
|
dataPendoPollId = poll.getAttribute('data-pendo-poll-id');
|
|
41331
41494
|
}
|
|
41332
|
-
|
|
41333
|
-
|
|
41495
|
+
let questionText;
|
|
41496
|
+
const pollQuesiton = pendo.dom(`[class*="-poll-question"][data-pendo-poll-id=${dataPendoPollId}]`)[0];
|
|
41334
41497
|
if (pollQuesiton) {
|
|
41335
|
-
questionText = pendo.dom(
|
|
41498
|
+
questionText = pendo.dom(`[class*="-poll-question"][data-pendo-poll-id=${dataPendoPollId}]`)[0].textContent;
|
|
41336
41499
|
}
|
|
41337
|
-
|
|
41500
|
+
const requiredSyntaxIndex = questionText.indexOf(requiredSyntax);
|
|
41338
41501
|
if (requiredSyntaxIndex > -1) {
|
|
41339
|
-
pendo._.each(pendo.dom(
|
|
41340
|
-
pendo._.each(pendo.dom(
|
|
41502
|
+
pendo._.each(pendo.dom(`[data-pendo-poll-id=${dataPendoPollId}]:not(.pendo-radio)`), (element) => {
|
|
41503
|
+
pendo._.each(pendo.dom(`#${element.id} *:not(".pendo-radio"), #${element.id}:not(".pendo-radio")`), (item) => {
|
|
41341
41504
|
guideMarkdownUtil.removeMarkdownSyntax(item, requiredSyntax, '', pendo);
|
|
41342
41505
|
});
|
|
41343
41506
|
});
|
|
41344
|
-
if (pendo.dom(
|
|
41345
|
-
pendo.dom(
|
|
41346
|
-
pendo.dom(
|
|
41507
|
+
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) {
|
|
41508
|
+
pendo.dom(`.bb-text[data-pendo-poll-id=${dataPendoPollId}] p`).append(requiredElement);
|
|
41509
|
+
pendo.dom(`.bb-text[data-pendo-poll-id=${dataPendoPollId}] li`).append(requiredElement);
|
|
41347
41510
|
}
|
|
41348
41511
|
else {
|
|
41349
|
-
pendo.dom(
|
|
41512
|
+
pendo.dom(`.bb-text[data-pendo-poll-id=${dataPendoPollId}]`).append(requiredElement);
|
|
41350
41513
|
}
|
|
41351
41514
|
if (pendo._.contains(requiredQuestions, dataPendoPollId)) {
|
|
41352
|
-
|
|
41515
|
+
let questionIndex = requiredQuestions.indexOf(dataPendoPollId);
|
|
41353
41516
|
if (questionIndex !== -1) {
|
|
41354
41517
|
requiredQuestions.splice(questionIndex, 1);
|
|
41355
41518
|
}
|
|
@@ -41360,7 +41523,7 @@ var RequiredQuestions = {
|
|
|
41360
41523
|
}
|
|
41361
41524
|
else {
|
|
41362
41525
|
if (pendo._.contains(requiredQuestions, dataPendoPollId)) {
|
|
41363
|
-
|
|
41526
|
+
let index = requiredQuestions.indexOf(dataPendoPollId);
|
|
41364
41527
|
if (index !== -1) {
|
|
41365
41528
|
requiredQuestions.splice(index, 1);
|
|
41366
41529
|
}
|
|
@@ -41374,54 +41537,54 @@ var RequiredQuestions = {
|
|
|
41374
41537
|
}
|
|
41375
41538
|
};
|
|
41376
41539
|
|
|
41377
|
-
|
|
41378
|
-
|
|
41379
|
-
script
|
|
41380
|
-
|
|
41381
|
-
|
|
41382
|
-
|
|
41383
|
-
|
|
41384
|
-
|
|
41540
|
+
const skipStepRegex = new RegExp(guideMarkdownUtil.skipStepString);
|
|
41541
|
+
const SkipToEligibleStep = {
|
|
41542
|
+
script(step, guide, pendo) {
|
|
41543
|
+
let isAdvanceIntercepted = false;
|
|
41544
|
+
let isPreviousIntercepted = false;
|
|
41545
|
+
let guideContainer = step.guideElement.find(guideMarkdownUtil.containerSelector);
|
|
41546
|
+
let guideContainerAriaLabel = guideContainer.attr('aria-label');
|
|
41547
|
+
let stepNumberOrAuto = skipStepRegex.exec(guideContainerAriaLabel)[1];
|
|
41385
41548
|
if (guideContainer) {
|
|
41386
41549
|
guideContainer.attr({ 'aria-label': guideContainer.attr('aria-label').replace(skipStepRegex, '') });
|
|
41387
41550
|
}
|
|
41388
|
-
this.on('beforeAdvance',
|
|
41551
|
+
this.on('beforeAdvance', (evt) => {
|
|
41389
41552
|
if (guide.getPositionOfStep(step) === guide.steps.length || pendo._.isUndefined(stepNumberOrAuto))
|
|
41390
41553
|
return; // exit on the last step of a guide or when we don't have an argument
|
|
41391
|
-
|
|
41554
|
+
let eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'next');
|
|
41392
41555
|
if (!isAdvanceIntercepted && stepNumberOrAuto) {
|
|
41393
41556
|
isAdvanceIntercepted = true;
|
|
41394
|
-
pendo.goToStep({ destinationStepId: eligibleStep.id, step
|
|
41557
|
+
pendo.goToStep({ destinationStepId: eligibleStep.id, step });
|
|
41395
41558
|
evt.cancel = true;
|
|
41396
41559
|
}
|
|
41397
41560
|
});
|
|
41398
|
-
this.on('beforePrevious',
|
|
41561
|
+
this.on('beforePrevious', (evt) => {
|
|
41399
41562
|
if (pendo._.isUndefined(stepNumberOrAuto))
|
|
41400
41563
|
return;
|
|
41401
|
-
|
|
41564
|
+
let eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'previous');
|
|
41402
41565
|
if (!isPreviousIntercepted && stepNumberOrAuto) {
|
|
41403
41566
|
isPreviousIntercepted = true;
|
|
41404
|
-
pendo.goToStep({ destinationStepId: eligibleStep.id, step
|
|
41567
|
+
pendo.goToStep({ destinationStepId: eligibleStep.id, step });
|
|
41405
41568
|
evt.cancel = true;
|
|
41406
41569
|
}
|
|
41407
41570
|
});
|
|
41408
41571
|
function findEligibleSkipStep(stepNumber, direction) {
|
|
41409
41572
|
// Find the next eligible step by using getPosition of step (1 based)
|
|
41410
41573
|
// getPosition - 2 gives the previous step
|
|
41411
|
-
|
|
41412
|
-
|
|
41574
|
+
let skipForwardStep = findStepOnPage(guide.getPositionOfStep(step), 'next', stepNumber);
|
|
41575
|
+
let skipPreviousStep = findStepOnPage(guide.getPositionOfStep(step) - 2, 'previous', stepNumber);
|
|
41413
41576
|
if (skipForwardStep && direction == 'next') {
|
|
41414
|
-
pendo.goToStep({ destinationStepId: skipForwardStep, step
|
|
41577
|
+
pendo.goToStep({ destinationStepId: skipForwardStep, step });
|
|
41415
41578
|
}
|
|
41416
41579
|
if (skipPreviousStep && direction == 'previous') {
|
|
41417
|
-
pendo.goToStep({ destinationStepId: skipPreviousStep, step
|
|
41580
|
+
pendo.goToStep({ destinationStepId: skipPreviousStep, step });
|
|
41418
41581
|
}
|
|
41419
41582
|
return direction === 'next' ? skipForwardStep : skipPreviousStep;
|
|
41420
41583
|
}
|
|
41421
41584
|
function findStepOnPage(stepIndex, direction, stepNumber) {
|
|
41422
41585
|
if (pendo._.isNaN(stepIndex))
|
|
41423
41586
|
return;
|
|
41424
|
-
|
|
41587
|
+
let $step = guide.steps[stepIndex];
|
|
41425
41588
|
if ($step && !$step.canShow()) {
|
|
41426
41589
|
if (stepNumber !== 'auto') {
|
|
41427
41590
|
return guide.steps[stepNumber - 1];
|
|
@@ -41438,34 +41601,34 @@ var SkipToEligibleStep = {
|
|
|
41438
41601
|
}
|
|
41439
41602
|
}
|
|
41440
41603
|
},
|
|
41441
|
-
test
|
|
41604
|
+
test(step, guide, pendo) {
|
|
41442
41605
|
var _a;
|
|
41443
|
-
|
|
41606
|
+
const guideContainerAriaLabel = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find(guideMarkdownUtil.containerSelector).attr('aria-label');
|
|
41444
41607
|
return pendo._.isString(guideContainerAriaLabel) && guideContainerAriaLabel.indexOf('{skipStep') !== -1;
|
|
41445
41608
|
},
|
|
41446
|
-
designerListener
|
|
41447
|
-
|
|
41448
|
-
|
|
41609
|
+
designerListener(pendo) {
|
|
41610
|
+
const target = pendo.dom.getBody();
|
|
41611
|
+
const config = {
|
|
41449
41612
|
attributeFilter: ['data-layout'],
|
|
41450
41613
|
attributes: true,
|
|
41451
41614
|
childList: true,
|
|
41452
41615
|
characterData: true,
|
|
41453
41616
|
subtree: true
|
|
41454
41617
|
};
|
|
41455
|
-
|
|
41456
|
-
|
|
41618
|
+
const MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
|
|
41619
|
+
const observer = new MutationObserver(applySkipStepIndicator);
|
|
41457
41620
|
observer.observe(target, config);
|
|
41458
41621
|
// create an observer instance
|
|
41459
41622
|
function applySkipStepIndicator(mutations) {
|
|
41460
41623
|
pendo._.each(mutations, function (mutation) {
|
|
41461
41624
|
var _a, _b;
|
|
41462
|
-
|
|
41625
|
+
const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
|
|
41463
41626
|
if (mutation.addedNodes.length && nodeHasQuerySelector) {
|
|
41464
|
-
|
|
41465
|
-
|
|
41627
|
+
let guideContainer = mutation.addedNodes[0].querySelectorAll(guideMarkdownUtil.containerSelector);
|
|
41628
|
+
let guideContainerAriaLabel = (_b = guideContainer[0]) === null || _b === void 0 ? void 0 : _b.getAttribute('aria-label');
|
|
41466
41629
|
if (guideContainerAriaLabel) {
|
|
41467
41630
|
if (guideContainerAriaLabel.match(skipStepRegex)) {
|
|
41468
|
-
|
|
41631
|
+
let fullSkipStepString = guideContainerAriaLabel.match(skipStepRegex)[0];
|
|
41469
41632
|
guideContainerAriaLabel.replace(fullSkipStepString, '');
|
|
41470
41633
|
if (!pendo.dom('#_pendoSkipIcon').length) {
|
|
41471
41634
|
pendo.dom(guideMarkdownUtil.containerSelector).append(skipIcon('#999', '30px').trim());
|
|
@@ -41476,30 +41639,48 @@ var SkipToEligibleStep = {
|
|
|
41476
41639
|
});
|
|
41477
41640
|
}
|
|
41478
41641
|
function skipIcon(color, size) {
|
|
41479
|
-
return (
|
|
41642
|
+
return (`<div title="Skip step added"><svg id="_pendoSkipIcon" version="1.0" xmlns="http://www.w3.org/2000/svg"
|
|
41643
|
+
width="${size}" height="${size}" viewBox="0 0 512.000000 512.000000"
|
|
41644
|
+
preserveAspectRatio="xMidYMid meet" style="bottom:5px; right:10px; position: absolute;">
|
|
41645
|
+
<g transform="translate(0.000000,512.000000) scale(0.100000,-0.100000)"
|
|
41646
|
+
fill="${color}" stroke="none">
|
|
41647
|
+
<path d="M2185 4469 c-363 -38 -739 -186 -1034 -407 -95 -71 -273 -243 -357
|
|
41648
|
+
-343 -205 -246 -364 -577 -429 -897 -25 -121 -45 -288 -45 -373 l0 -49 160 0
|
|
41649
|
+
160 0 0 48 c0 26 5 88 10 137 68 593 417 1103 940 1374 1100 570 2418 -137
|
|
41650
|
+
2560 -1374 5 -49 10 -111 10 -137 l0 -47 -155 -3 -155 -3 235 -235 235 -236
|
|
41651
|
+
235 236 235 235 -155 3 -155 3 0 48 c0 27 -5 95 -10 152 -100 989 -878 1767
|
|
41652
|
+
-1869 1868 -117 12 -298 12 -416 0z"/>
|
|
41653
|
+
<path d="M320 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
|
|
41654
|
+
<path d="M960 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
|
|
41655
|
+
<path d="M1600 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
|
|
41656
|
+
<path d="M2240 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
|
|
41657
|
+
<path d="M2880 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
|
|
41658
|
+
<path d="M3840 1440 l0 -160 480 0 480 0 0 160 0 160 -480 0 -480 0 0 -160z"/>
|
|
41659
|
+
</g></svg></div>
|
|
41660
|
+
`);
|
|
41480
41661
|
}
|
|
41481
41662
|
}
|
|
41482
41663
|
};
|
|
41483
41664
|
|
|
41484
41665
|
function GuideMarkdown() {
|
|
41485
|
-
|
|
41486
|
-
|
|
41487
|
-
|
|
41666
|
+
let guideMarkdown;
|
|
41667
|
+
let pluginApi;
|
|
41668
|
+
let globalPendo;
|
|
41488
41669
|
return {
|
|
41489
41670
|
name: 'GuideMarkdown',
|
|
41490
41671
|
initialize: init,
|
|
41491
|
-
teardown
|
|
41672
|
+
teardown
|
|
41492
41673
|
};
|
|
41493
41674
|
function init(pendo, PluginAPI) {
|
|
41494
41675
|
globalPendo = pendo;
|
|
41495
41676
|
pluginApi = PluginAPI;
|
|
41496
|
-
|
|
41497
|
-
|
|
41677
|
+
const configReader = PluginAPI.ConfigReader;
|
|
41678
|
+
const GUIDEMARKDOWN_CONFIG = 'guideMarkdown';
|
|
41498
41679
|
configReader.addOption(GUIDEMARKDOWN_CONFIG, [
|
|
41499
41680
|
configReader.sources.SNIPPET_SRC,
|
|
41500
41681
|
configReader.sources.PENDO_CONFIG_SRC
|
|
41501
41682
|
], false);
|
|
41502
|
-
|
|
41683
|
+
const markdownScriptsEnabled = configReader.get(GUIDEMARKDOWN_CONFIG);
|
|
41503
41684
|
if (!markdownScriptsEnabled)
|
|
41504
41685
|
return;
|
|
41505
41686
|
guideMarkdown = [PollBranching, MetadataSubstitution, RequiredQuestions, SkipToEligibleStep];
|
|
@@ -42538,8 +42719,8 @@ function Feedback() {
|
|
|
42538
42719
|
var widgetLoaded = false;
|
|
42539
42720
|
var feedbackAllowedProductId = '';
|
|
42540
42721
|
var initialized = false;
|
|
42541
|
-
|
|
42542
|
-
|
|
42722
|
+
const PING_COOKIE = 'feedback_ping_sent';
|
|
42723
|
+
const PING_COOKIE_EXPIRATION = 1000 * 60 * 60;
|
|
42543
42724
|
var overflowMediaQuery = '@media only screen and (max-device-width:1112px){#feedback-widget{overflow-y:scroll}}';
|
|
42544
42725
|
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%)}}';
|
|
42545
42726
|
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)}}';
|
|
@@ -42559,28 +42740,28 @@ function Feedback() {
|
|
|
42559
42740
|
feedbackStyles: 'pendo-feedback-styles',
|
|
42560
42741
|
feedbackFrameStyles: 'pendo-feedback-visible-buttons-styles'
|
|
42561
42742
|
};
|
|
42562
|
-
|
|
42563
|
-
|
|
42743
|
+
let globalPendo;
|
|
42744
|
+
let pluginApi;
|
|
42564
42745
|
return {
|
|
42565
42746
|
name: 'Feedback',
|
|
42566
|
-
initialize
|
|
42567
|
-
teardown
|
|
42568
|
-
validate
|
|
42747
|
+
initialize,
|
|
42748
|
+
teardown,
|
|
42749
|
+
validate
|
|
42569
42750
|
};
|
|
42570
42751
|
function initialize(pendo, PluginAPI) {
|
|
42571
42752
|
globalPendo = pendo;
|
|
42572
42753
|
pluginApi = PluginAPI;
|
|
42573
42754
|
var publicFeedback = {
|
|
42574
|
-
ping
|
|
42575
|
-
init
|
|
42755
|
+
ping,
|
|
42756
|
+
init,
|
|
42576
42757
|
initialized: getInitialized,
|
|
42577
|
-
loginAndRedirect
|
|
42578
|
-
openFeedback
|
|
42579
|
-
initializeFeedbackOnce
|
|
42580
|
-
isFeedbackLoaded
|
|
42581
|
-
convertPendoToFeedbackOptions
|
|
42758
|
+
loginAndRedirect,
|
|
42759
|
+
openFeedback,
|
|
42760
|
+
initializeFeedbackOnce,
|
|
42761
|
+
isFeedbackLoaded,
|
|
42762
|
+
convertPendoToFeedbackOptions,
|
|
42582
42763
|
isUnsupportedIE: pendo._.partial(isUnsupportedIE, PluginAPI),
|
|
42583
|
-
removeFeedbackWidget
|
|
42764
|
+
removeFeedbackWidget
|
|
42584
42765
|
};
|
|
42585
42766
|
pendo.feedback = publicFeedback;
|
|
42586
42767
|
pendo.getFeedbackSettings = getFeedbackSettings;
|
|
@@ -42608,7 +42789,7 @@ function Feedback() {
|
|
|
42608
42789
|
*/
|
|
42609
42790
|
PluginAPI.agentStorage.registry.addLocal(PING_COOKIE, { duration: PING_COOKIE_EXPIRATION });
|
|
42610
42791
|
return {
|
|
42611
|
-
validate
|
|
42792
|
+
validate
|
|
42612
42793
|
};
|
|
42613
42794
|
}
|
|
42614
42795
|
function teardown() {
|
|
@@ -42628,18 +42809,18 @@ function Feedback() {
|
|
|
42628
42809
|
return result;
|
|
42629
42810
|
}
|
|
42630
42811
|
function pingOrInitialize() {
|
|
42631
|
-
|
|
42812
|
+
const options = getPendoOptions();
|
|
42632
42813
|
if (initialized) {
|
|
42633
|
-
|
|
42814
|
+
const feedbackOptions = convertPendoToFeedbackOptions(options);
|
|
42634
42815
|
ping(feedbackOptions);
|
|
42635
42816
|
}
|
|
42636
42817
|
else if (shouldInitializeFeedback() && !globalPendo._.isEmpty(options)) {
|
|
42637
|
-
|
|
42638
|
-
init(options, settings)
|
|
42818
|
+
const settings = pluginApi.ConfigReader.get('feedbackSettings');
|
|
42819
|
+
init(options, settings).catch(globalPendo._.noop);
|
|
42639
42820
|
}
|
|
42640
42821
|
}
|
|
42641
42822
|
function handleIdentityChange(event) {
|
|
42642
|
-
|
|
42823
|
+
const visitorId = globalPendo._.get(event, 'data.0.visitor_id') || globalPendo._.get(event, 'data.0.options.visitor.id');
|
|
42643
42824
|
if (globalPendo.isAnonymousVisitor(visitorId)) {
|
|
42644
42825
|
removeFeedbackWidget();
|
|
42645
42826
|
return;
|
|
@@ -42709,9 +42890,9 @@ function Feedback() {
|
|
|
42709
42890
|
if (toSend.data && toSend.data !== '{}' && toSend.data !== 'null') {
|
|
42710
42891
|
return globalPendo.ajax
|
|
42711
42892
|
.postJSON(getFullUrl('/widget/pendo_ping'), toSend)
|
|
42712
|
-
.then(
|
|
42893
|
+
.then((response) => {
|
|
42713
42894
|
onWidgetPingResponse(response);
|
|
42714
|
-
})
|
|
42895
|
+
}).catch(() => { onPingFailure(); });
|
|
42715
42896
|
}
|
|
42716
42897
|
}
|
|
42717
42898
|
return pluginApi.q.resolve();
|
|
@@ -42845,10 +43026,10 @@ function Feedback() {
|
|
|
42845
43026
|
return globalPendo.ajax.postJSON(getFullUrl('/analytics'), toSend);
|
|
42846
43027
|
}
|
|
42847
43028
|
function addOverlay() {
|
|
42848
|
-
|
|
43029
|
+
const widget = globalPendo.dom(`#${elemIds.feedbackWidget}`);
|
|
42849
43030
|
if (!widget)
|
|
42850
43031
|
return;
|
|
42851
|
-
|
|
43032
|
+
const overlayStyles = {
|
|
42852
43033
|
'position': 'fixed',
|
|
42853
43034
|
'top': '0',
|
|
42854
43035
|
'right': '0',
|
|
@@ -42860,7 +43041,7 @@ function Feedback() {
|
|
|
42860
43041
|
'animation': 'pendoFeedbackFadeIn 0.5s 0s 1 alternate both',
|
|
42861
43042
|
'-webkit-animation': 'pendoFeedbackFadeIn 0.5s 0s 1 alternate both'
|
|
42862
43043
|
};
|
|
42863
|
-
|
|
43044
|
+
const overlayElement = globalPendo.dom(document.createElement('div'));
|
|
42864
43045
|
overlayElement.attr('id', 'feedback-overlay');
|
|
42865
43046
|
overlayElement.css(overlayStyles);
|
|
42866
43047
|
overlayElement.appendTo(widget.getParent());
|
|
@@ -42965,22 +43146,22 @@ function Feedback() {
|
|
|
42965
43146
|
}
|
|
42966
43147
|
}
|
|
42967
43148
|
function buildOuterTriggerDiv(positionInfo) {
|
|
42968
|
-
|
|
42969
|
-
|
|
42970
|
-
|
|
43149
|
+
const horizontalStyles = getHorizontalPositionStyles(positionInfo);
|
|
43150
|
+
const verticalStyles = getVerticalPositionStyles(positionInfo);
|
|
43151
|
+
const styles = globalPendo._.extend({
|
|
42971
43152
|
'position': 'fixed',
|
|
42972
43153
|
'height': '43px',
|
|
42973
43154
|
'opacity': '1 !important',
|
|
42974
43155
|
'z-index': '9001'
|
|
42975
43156
|
}, horizontalStyles, verticalStyles);
|
|
42976
|
-
|
|
43157
|
+
const outerTrigger = globalPendo.dom(document.createElement('div'));
|
|
42977
43158
|
outerTrigger.attr('id', elemIds.feedbackTrigger);
|
|
42978
43159
|
outerTrigger.css(styles);
|
|
42979
43160
|
outerTrigger.attr('data-turbolinks-permanent', '');
|
|
42980
43161
|
return outerTrigger;
|
|
42981
43162
|
}
|
|
42982
43163
|
function buildNotification() {
|
|
42983
|
-
|
|
43164
|
+
const styles = {
|
|
42984
43165
|
'background-color': '#D85039',
|
|
42985
43166
|
'color': '#fff',
|
|
42986
43167
|
'border-radius': '50%',
|
|
@@ -42997,20 +43178,20 @@ function Feedback() {
|
|
|
42997
43178
|
'animation-delay': '1s',
|
|
42998
43179
|
'animation-iteration-count': '1'
|
|
42999
43180
|
};
|
|
43000
|
-
|
|
43181
|
+
const notification = globalPendo.dom(document.createElement('span'));
|
|
43001
43182
|
notification.attr('id', 'feedback-trigger-notification');
|
|
43002
43183
|
notification.css(styles);
|
|
43003
43184
|
return notification;
|
|
43004
43185
|
}
|
|
43005
43186
|
function buildTriggerButton(settings, positionInfo) {
|
|
43006
|
-
|
|
43187
|
+
let borderRadius;
|
|
43007
43188
|
if (positionInfo.horizontalPosition === 'left') {
|
|
43008
43189
|
borderRadius = '0 0 5px 5px';
|
|
43009
43190
|
}
|
|
43010
43191
|
else {
|
|
43011
43192
|
borderRadius = '3px 3px 0 0';
|
|
43012
43193
|
}
|
|
43013
|
-
|
|
43194
|
+
const styles = {
|
|
43014
43195
|
'border': 'none',
|
|
43015
43196
|
'padding': '11px 18px 14px 18px',
|
|
43016
43197
|
'background-color': settings.triggerColor,
|
|
@@ -43021,21 +43202,32 @@ function Feedback() {
|
|
|
43021
43202
|
'cursor': 'pointer',
|
|
43022
43203
|
'text-align': 'left'
|
|
43023
43204
|
};
|
|
43024
|
-
|
|
43205
|
+
const triggerButton = globalPendo.dom(document.createElement('button'));
|
|
43025
43206
|
triggerButton.attr('id', elemIds.feedbackTriggerButton);
|
|
43026
43207
|
triggerButton.css(styles);
|
|
43027
43208
|
triggerButton.text(settings.triggerText);
|
|
43028
43209
|
return triggerButton;
|
|
43029
43210
|
}
|
|
43030
43211
|
function addTriggerPseudoStyles() {
|
|
43031
|
-
|
|
43212
|
+
const pseudoStyles = `
|
|
43213
|
+
#feedback-trigger button:hover {
|
|
43214
|
+
box-shadow: 0 -5px 20px rgba(0,0,0,.19) !important;
|
|
43215
|
+
outline: none !important;
|
|
43216
|
+
background: #3e566f !important;
|
|
43217
|
+
}
|
|
43218
|
+
#feedback-trigger button:focus {
|
|
43219
|
+
box-shadow: 0 -5px 20px rgba(0,0,0,.19) !important;
|
|
43220
|
+
outline: none !important;
|
|
43221
|
+
background: #3e566f !important;
|
|
43222
|
+
}
|
|
43223
|
+
`;
|
|
43032
43224
|
pluginApi.util.addInlineStyles('pendo-feedback-trigger-styles', pseudoStyles);
|
|
43033
43225
|
}
|
|
43034
43226
|
function createTrigger(settings, positionInfo) {
|
|
43035
43227
|
addTriggerPseudoStyles();
|
|
43036
|
-
|
|
43037
|
-
|
|
43038
|
-
|
|
43228
|
+
const triggerElement = buildOuterTriggerDiv(positionInfo);
|
|
43229
|
+
const notificationElement = buildNotification();
|
|
43230
|
+
const triggerButtonElement = buildTriggerButton(settings, positionInfo);
|
|
43039
43231
|
triggerElement.append(notificationElement);
|
|
43040
43232
|
triggerElement.append(triggerButtonElement);
|
|
43041
43233
|
triggerElement.appendTo(globalPendo.dom.getBody());
|
|
@@ -43059,7 +43251,7 @@ function Feedback() {
|
|
|
43059
43251
|
iframeWrapper.css(getWidgetOriginalStyles());
|
|
43060
43252
|
iframeWrapper.attr('id', elemIds.feedbackWidget);
|
|
43061
43253
|
iframeWrapper.attr('data-turbolinks-permanent', 'true');
|
|
43062
|
-
iframeWrapper.addClass(
|
|
43254
|
+
iframeWrapper.addClass(`buttonIs-${horizontalPosition}`);
|
|
43063
43255
|
return iframeWrapper;
|
|
43064
43256
|
}
|
|
43065
43257
|
function buildIframeContainer() {
|
|
@@ -43076,13 +43268,22 @@ function Feedback() {
|
|
|
43076
43268
|
return iframeContainer;
|
|
43077
43269
|
}
|
|
43078
43270
|
function addWidgetVisibleButtonStyles(buttonStylePosition) {
|
|
43079
|
-
|
|
43080
|
-
|
|
43271
|
+
let side = buttonStylePosition === 'left' ? 'left' : 'right'; // just in case something was not left or right for some reason
|
|
43272
|
+
const styles = `
|
|
43273
|
+
.buttonIs-${side}.visible {
|
|
43274
|
+
${side}: 0 !important;
|
|
43275
|
+
width: 470px !important;
|
|
43276
|
+
animation-direction: alternate-reverse !important;
|
|
43277
|
+
animation: pendoFeedbackSlideFrom-${side} 0.5s 0s 1 alternate both !important;
|
|
43278
|
+
-webkit-animation: pendoFeedbackSlideFrom-${side} 0.5s 0s 1 alternate both !important;
|
|
43279
|
+
z-index: 9002 !important;
|
|
43280
|
+
}
|
|
43281
|
+
`;
|
|
43081
43282
|
pluginApi.util.addInlineStyles(elemIds.feedbackFrameStyles, styles);
|
|
43082
43283
|
}
|
|
43083
43284
|
function initialiseWidgetFrame(horizontalPosition) {
|
|
43084
43285
|
addWidgetVisibleButtonStyles(horizontalPosition);
|
|
43085
|
-
|
|
43286
|
+
const iframeElement = buildIframeWrapper(horizontalPosition);
|
|
43086
43287
|
iframeElement.append(buildIframeContainer());
|
|
43087
43288
|
iframeElement.appendTo(globalPendo.dom.getBody());
|
|
43088
43289
|
subscribeToIframeMessages();
|
|
@@ -43106,7 +43307,7 @@ function Feedback() {
|
|
|
43106
43307
|
return widgetLoaded;
|
|
43107
43308
|
}
|
|
43108
43309
|
function getPendoOptions() {
|
|
43109
|
-
|
|
43310
|
+
let options = pluginApi.ConfigReader.getLocalConfig();
|
|
43110
43311
|
if (!globalPendo._.isObject(options))
|
|
43111
43312
|
options = {};
|
|
43112
43313
|
if (!globalPendo._.isObject(options.visitor))
|
|
@@ -43134,7 +43335,7 @@ function Feedback() {
|
|
|
43134
43335
|
return true;
|
|
43135
43336
|
}
|
|
43136
43337
|
function getQueryParam(url, paramName) {
|
|
43137
|
-
|
|
43338
|
+
const results = new RegExp('[?&]' + paramName + '=([^&#]*)').exec(url);
|
|
43138
43339
|
if (results == null) {
|
|
43139
43340
|
return null;
|
|
43140
43341
|
}
|
|
@@ -43151,13 +43352,13 @@ function Feedback() {
|
|
|
43151
43352
|
return pluginApi.q.reject();
|
|
43152
43353
|
if (!canInitFeedback(pendoOptions))
|
|
43153
43354
|
return pluginApi.q.reject();
|
|
43154
|
-
|
|
43355
|
+
const feedbackOptions = convertPendoToFeedbackOptions(pendoOptions);
|
|
43155
43356
|
try {
|
|
43156
|
-
|
|
43157
|
-
if (
|
|
43357
|
+
const fdbkDst = getQueryParam(globalPendo.url.get(), 'fdbkDst');
|
|
43358
|
+
if (fdbkDst && fdbkDst.startsWith('case')) {
|
|
43158
43359
|
initialized = true;
|
|
43159
43360
|
getFeedbackLoginUrl().then(function (loginUrl) {
|
|
43160
|
-
|
|
43361
|
+
const destinationUrl = loginUrl + '&fdbkDst=' + fdbkDst;
|
|
43161
43362
|
window.location.href = destinationUrl;
|
|
43162
43363
|
});
|
|
43163
43364
|
return;
|
|
@@ -43206,7 +43407,7 @@ function Feedback() {
|
|
|
43206
43407
|
function convertPendoToFeedbackOptions(options) {
|
|
43207
43408
|
var jwtOptions = pluginApi.agent.getJwtInfoCopy();
|
|
43208
43409
|
if (globalPendo._.isEmpty(jwtOptions)) {
|
|
43209
|
-
|
|
43410
|
+
const feedbackOptions = {};
|
|
43210
43411
|
feedbackOptions.user = globalPendo._.pick(options.visitor, 'id', 'full_name', 'firstName', 'lastName', 'email', 'tags', 'custom_allowed_products');
|
|
43211
43412
|
globalPendo._.extend(feedbackOptions.user, { allowed_products: [{ id: feedbackAllowedProductId }] });
|
|
43212
43413
|
feedbackOptions.account = globalPendo._.pick(options.account, 'id', 'name', 'monthly_value', 'is_paying', 'tags');
|
|
@@ -48741,32 +48942,31 @@ var n;
|
|
|
48741
48942
|
}(n || (n = {}));
|
|
48742
48943
|
return record; }
|
|
48743
48944
|
|
|
48744
|
-
|
|
48745
|
-
|
|
48746
|
-
if (maxCount === void 0) { maxCount = Infinity; }
|
|
48945
|
+
class SessionRecorderBuffer {
|
|
48946
|
+
constructor(interval, maxCount = Infinity) {
|
|
48747
48947
|
this.data = [];
|
|
48748
48948
|
this.sequenceNumber = 0;
|
|
48749
48949
|
this.interval = interval;
|
|
48750
48950
|
this.maxCount = maxCount;
|
|
48751
48951
|
this.doubledMaxCount = maxCount * 2;
|
|
48752
48952
|
}
|
|
48753
|
-
|
|
48953
|
+
isEmpty() {
|
|
48754
48954
|
return this.data.length === 0;
|
|
48755
|
-
}
|
|
48756
|
-
|
|
48955
|
+
}
|
|
48956
|
+
count() {
|
|
48757
48957
|
return this.data.length;
|
|
48758
|
-
}
|
|
48759
|
-
|
|
48958
|
+
}
|
|
48959
|
+
clear() {
|
|
48760
48960
|
this.data.length = 0;
|
|
48761
|
-
}
|
|
48762
|
-
|
|
48961
|
+
}
|
|
48962
|
+
clearSequence() {
|
|
48763
48963
|
this.sequenceNumber = 0;
|
|
48764
|
-
}
|
|
48765
|
-
|
|
48964
|
+
}
|
|
48965
|
+
push(event) {
|
|
48766
48966
|
this.data.push(event);
|
|
48767
48967
|
this.checkRateLimit();
|
|
48768
|
-
}
|
|
48769
|
-
|
|
48968
|
+
}
|
|
48969
|
+
pack(envelope, _) {
|
|
48770
48970
|
var eventsToSend = this.data.splice(0, this.maxCount);
|
|
48771
48971
|
envelope.recordingPayload = eventsToSend;
|
|
48772
48972
|
envelope.sequence = this.sequenceNumber;
|
|
@@ -48774,8 +48974,8 @@ var SessionRecorderBuffer = /** @class */ (function () {
|
|
|
48774
48974
|
if (eventsToSend.length) {
|
|
48775
48975
|
envelope.browserTime = eventsToSend[0].timestamp;
|
|
48776
48976
|
}
|
|
48777
|
-
envelope.recordingPayloadMetadata = _.map(eventsToSend,
|
|
48778
|
-
|
|
48977
|
+
envelope.recordingPayloadMetadata = _.map(eventsToSend, event => {
|
|
48978
|
+
const metadata = _.pick(event, 'type', 'timestamp');
|
|
48779
48979
|
if (event.data) {
|
|
48780
48980
|
metadata.data = _.pick(event.data, 'source', 'type', 'x', 'y', 'id', 'height', 'width', 'href');
|
|
48781
48981
|
}
|
|
@@ -48783,30 +48983,18 @@ var SessionRecorderBuffer = /** @class */ (function () {
|
|
|
48783
48983
|
});
|
|
48784
48984
|
this.sequenceNumber += eventsToSend.length;
|
|
48785
48985
|
return envelope;
|
|
48786
|
-
}
|
|
48787
|
-
|
|
48788
|
-
|
|
48986
|
+
}
|
|
48987
|
+
checkRateLimit() {
|
|
48988
|
+
const length = this.data.length;
|
|
48789
48989
|
if (length >= this.doubledMaxCount && length % this.maxCount === 0) {
|
|
48790
|
-
|
|
48990
|
+
const elapsed = this.data[length - 1].timestamp - this.data[length - this.doubledMaxCount].timestamp;
|
|
48791
48991
|
if (elapsed <= this.interval && this.onRateLimit) {
|
|
48792
48992
|
this.onRateLimit();
|
|
48793
48993
|
}
|
|
48794
48994
|
}
|
|
48795
|
-
}
|
|
48796
|
-
|
|
48797
|
-
}());
|
|
48995
|
+
}
|
|
48996
|
+
}
|
|
48798
48997
|
|
|
48799
|
-
var __assign = function() {
|
|
48800
|
-
__assign = Object.assign || function __assign(t) {
|
|
48801
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
48802
|
-
s = arguments[i];
|
|
48803
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
48804
|
-
}
|
|
48805
|
-
return t;
|
|
48806
|
-
};
|
|
48807
|
-
return __assign.apply(this, arguments);
|
|
48808
|
-
};
|
|
48809
|
-
|
|
48810
48998
|
function __rest(s, e) {
|
|
48811
48999
|
var t = {};
|
|
48812
49000
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -48829,52 +49017,24 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
48829
49017
|
});
|
|
48830
49018
|
}
|
|
48831
49019
|
|
|
48832
|
-
function __generator(thisArg, body) {
|
|
48833
|
-
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);
|
|
48834
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
48835
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
48836
|
-
function step(op) {
|
|
48837
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
48838
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
48839
|
-
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;
|
|
48840
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
48841
|
-
switch (op[0]) {
|
|
48842
|
-
case 0: case 1: t = op; break;
|
|
48843
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
48844
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
48845
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48846
|
-
default:
|
|
48847
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
48848
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
48849
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
48850
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
48851
|
-
if (t[2]) _.ops.pop();
|
|
48852
|
-
_.trys.pop(); continue;
|
|
48853
|
-
}
|
|
48854
|
-
op = body.call(thisArg, _);
|
|
48855
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
48856
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
48857
|
-
}
|
|
48858
|
-
}
|
|
48859
|
-
|
|
48860
49020
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
48861
49021
|
var e = new Error(message);
|
|
48862
49022
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
48863
49023
|
};
|
|
48864
49024
|
|
|
48865
|
-
|
|
48866
|
-
|
|
48867
|
-
|
|
48868
|
-
|
|
48869
|
-
|
|
49025
|
+
const RECORDING_CONFIG_WORKERURL$1 = 'recording.workerUrl';
|
|
49026
|
+
const MAX_SIZE = 2000000;
|
|
49027
|
+
const RESOURCE_CACHING$1 = 'resourceCaching';
|
|
49028
|
+
class Transport {
|
|
49029
|
+
constructor(WorkerClass, pendo, api) {
|
|
48870
49030
|
this.WorkerClass = WorkerClass;
|
|
48871
49031
|
this.pendo = pendo;
|
|
48872
49032
|
this.api = api;
|
|
48873
49033
|
this.maxSize = MAX_SIZE;
|
|
48874
|
-
this.lockID =
|
|
49034
|
+
this.lockID = `worker-lock-${this.pendo.randomString(16)}`;
|
|
48875
49035
|
this.isResourceCachingEnabled = this.api.ConfigReader.get(RESOURCE_CACHING$1);
|
|
48876
49036
|
}
|
|
48877
|
-
|
|
49037
|
+
start(config) {
|
|
48878
49038
|
if (config.disableWorker)
|
|
48879
49039
|
return;
|
|
48880
49040
|
if (!this.worker) {
|
|
@@ -48884,7 +49044,7 @@ var Transport = /** @class */ (function () {
|
|
|
48884
49044
|
this.worker = config.workerOverride;
|
|
48885
49045
|
}
|
|
48886
49046
|
else {
|
|
48887
|
-
|
|
49047
|
+
const workerUrl = this.api.ConfigReader.get(RECORDING_CONFIG_WORKERURL$1);
|
|
48888
49048
|
this.usesSelfHostedWorker = workerUrl != null;
|
|
48889
49049
|
this.worker = workerUrl ? new Worker(workerUrl) : new this.WorkerClass();
|
|
48890
49050
|
}
|
|
@@ -48898,35 +49058,34 @@ var Transport = /** @class */ (function () {
|
|
|
48898
49058
|
this.worker = null;
|
|
48899
49059
|
}
|
|
48900
49060
|
}
|
|
48901
|
-
}
|
|
48902
|
-
|
|
49061
|
+
}
|
|
49062
|
+
stop() {
|
|
48903
49063
|
if (this.worker) {
|
|
48904
49064
|
this.worker.terminate();
|
|
48905
49065
|
delete this.worker;
|
|
48906
49066
|
}
|
|
48907
|
-
}
|
|
48908
|
-
|
|
48909
|
-
|
|
48910
|
-
|
|
48911
|
-
var payload = envelope.payload;
|
|
49067
|
+
}
|
|
49068
|
+
send(envelope, isUnload, failureCount = 0) {
|
|
49069
|
+
let { url } = envelope;
|
|
49070
|
+
const { payload } = envelope;
|
|
48912
49071
|
if (failureCount > 0) {
|
|
48913
|
-
url =
|
|
49072
|
+
url = `${url}&rt=${failureCount}`;
|
|
48914
49073
|
}
|
|
48915
49074
|
if (this.worker && !isUnload && payload) {
|
|
48916
|
-
|
|
48917
|
-
|
|
48918
|
-
|
|
48919
|
-
|
|
49075
|
+
const deferred = {};
|
|
49076
|
+
deferred.promise = new Promise$2((resolve, reject) => {
|
|
49077
|
+
deferred.resolve = resolve;
|
|
49078
|
+
deferred.reject = reject;
|
|
48920
49079
|
});
|
|
48921
|
-
this.workerResponse =
|
|
48922
|
-
this.worker.postMessage({ url
|
|
48923
|
-
return
|
|
49080
|
+
this.workerResponse = deferred;
|
|
49081
|
+
this.worker.postMessage({ url, payload, shouldCacheResources: this.isResourceCachingEnabled });
|
|
49082
|
+
return deferred.promise;
|
|
48924
49083
|
}
|
|
48925
49084
|
else {
|
|
48926
49085
|
if (!envelope.body) {
|
|
48927
|
-
|
|
49086
|
+
const strPayload = JSON.stringify(payload);
|
|
48928
49087
|
if (strPayload.length > this.maxSize) {
|
|
48929
|
-
|
|
49088
|
+
const error = new Error('maximum recording payload size exceeded');
|
|
48930
49089
|
error.reason = 'HEAVY_EVENT';
|
|
48931
49090
|
error.context = {
|
|
48932
49091
|
size: strPayload.length,
|
|
@@ -48937,14 +49096,14 @@ var Transport = /** @class */ (function () {
|
|
|
48937
49096
|
envelope.body = this.pendo.compress(strPayload, 'binary');
|
|
48938
49097
|
delete envelope.payload;
|
|
48939
49098
|
}
|
|
48940
|
-
url =
|
|
49099
|
+
url = `${url}&ct=${new Date().getTime()}`;
|
|
48941
49100
|
return this.post(url, {
|
|
48942
49101
|
keepalive: isUnload,
|
|
48943
49102
|
body: envelope.body
|
|
48944
49103
|
});
|
|
48945
49104
|
}
|
|
48946
|
-
}
|
|
48947
|
-
|
|
49105
|
+
}
|
|
49106
|
+
post(url, options) {
|
|
48948
49107
|
options.method = 'POST';
|
|
48949
49108
|
if (options.keepalive && this.api.transmit.fetchKeepalive.supported()) {
|
|
48950
49109
|
return this.api.transmit.fetchKeepalive(url, options);
|
|
@@ -48956,57 +49115,46 @@ var Transport = /** @class */ (function () {
|
|
|
48956
49115
|
else {
|
|
48957
49116
|
return this.pendo.ajax.post(url, options.body);
|
|
48958
49117
|
}
|
|
48959
|
-
}
|
|
48960
|
-
|
|
48961
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
48962
|
-
|
|
48963
|
-
|
|
48964
|
-
|
|
48965
|
-
|
|
48966
|
-
|
|
48967
|
-
|
|
48968
|
-
|
|
48969
|
-
|
|
48970
|
-
|
|
48971
|
-
|
|
48972
|
-
|
|
48973
|
-
|
|
48974
|
-
|
|
48975
|
-
|
|
48976
|
-
|
|
48977
|
-
return [2 /*return*/];
|
|
48978
|
-
}
|
|
48979
|
-
// handle POST request response from worker
|
|
48980
|
-
if (messageEvent.data && messageEvent.data.error) {
|
|
48981
|
-
if ((messageEvent.data.status && messageEvent.data.status < 500) ||
|
|
48982
|
-
messageEvent.data.sequence == null) {
|
|
48983
|
-
this.api.log.critical('Failed to send recording data from web worker', { error: messageEvent.data.error });
|
|
48984
|
-
}
|
|
48985
|
-
if (this.workerResponse) {
|
|
48986
|
-
this.workerResponse.reject();
|
|
48987
|
-
this.workerResponse = null;
|
|
48988
|
-
}
|
|
48989
|
-
}
|
|
48990
|
-
if (this.workerResponse) {
|
|
48991
|
-
this.workerResponse.resolve();
|
|
48992
|
-
this.workerResponse = null;
|
|
48993
|
-
}
|
|
48994
|
-
return [2 /*return*/];
|
|
49118
|
+
}
|
|
49119
|
+
_onMessage(messageEvent) {
|
|
49120
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49121
|
+
if (messageEvent.data && messageEvent.data.ready && navigator.locks) {
|
|
49122
|
+
// When the lock is released, we can assume the worker was terminated or closed
|
|
49123
|
+
yield navigator.locks.request(this.lockID, () => { });
|
|
49124
|
+
this.onWorkerMessage({ type: 'workerDied' });
|
|
49125
|
+
}
|
|
49126
|
+
// handle non-POST request responses from worker
|
|
49127
|
+
if (messageEvent.data && messageEvent.data.type) {
|
|
49128
|
+
this.onWorkerMessage(messageEvent.data);
|
|
49129
|
+
return;
|
|
49130
|
+
}
|
|
49131
|
+
// handle POST request response from worker
|
|
49132
|
+
if (messageEvent.data && messageEvent.data.error) {
|
|
49133
|
+
if ((messageEvent.data.status && messageEvent.data.status < 500) ||
|
|
49134
|
+
messageEvent.data.sequence == null) {
|
|
49135
|
+
this.api.log.critical('Failed to send recording data from web worker', { error: messageEvent.data.error });
|
|
48995
49136
|
}
|
|
48996
|
-
|
|
49137
|
+
if (this.workerResponse) {
|
|
49138
|
+
this.workerResponse.reject();
|
|
49139
|
+
this.workerResponse = null;
|
|
49140
|
+
}
|
|
49141
|
+
}
|
|
49142
|
+
if (this.workerResponse) {
|
|
49143
|
+
this.workerResponse.resolve();
|
|
49144
|
+
this.workerResponse = null;
|
|
49145
|
+
}
|
|
48997
49146
|
});
|
|
48998
|
-
}
|
|
48999
|
-
|
|
49147
|
+
}
|
|
49148
|
+
_onError() {
|
|
49000
49149
|
if (this.onError) {
|
|
49001
49150
|
this.onError();
|
|
49002
49151
|
}
|
|
49003
|
-
}
|
|
49004
|
-
|
|
49005
|
-
}());
|
|
49152
|
+
}
|
|
49153
|
+
}
|
|
49006
49154
|
|
|
49007
|
-
|
|
49008
|
-
|
|
49009
|
-
|
|
49155
|
+
const ELEMENT_NODE = 1;
|
|
49156
|
+
const INPUT_MASK = '*'.repeat(10);
|
|
49157
|
+
const NUMBER_INPUT_MASK = '0'.repeat(10);
|
|
49010
49158
|
function isElementNode(node) {
|
|
49011
49159
|
if (!node)
|
|
49012
49160
|
return false;
|
|
@@ -49015,12 +49163,10 @@ function isElementNode(node) {
|
|
|
49015
49163
|
return true;
|
|
49016
49164
|
}
|
|
49017
49165
|
function getParent(elem) {
|
|
49018
|
-
|
|
49166
|
+
const isElementShadowRoot = typeof window.ShadowRoot !== 'undefined' && elem instanceof window.ShadowRoot && elem.host;
|
|
49019
49167
|
return isElementShadowRoot ? elem.host : elem.parentNode;
|
|
49020
49168
|
}
|
|
49021
|
-
function distanceToMatch(node, selector, limit, distance) {
|
|
49022
|
-
if (limit === void 0) { limit = Infinity; }
|
|
49023
|
-
if (distance === void 0) { distance = 0; }
|
|
49169
|
+
function distanceToMatch(node, selector, limit = Infinity, distance = 0) {
|
|
49024
49170
|
if (distance > limit)
|
|
49025
49171
|
return -1;
|
|
49026
49172
|
if (!node)
|
|
@@ -49034,13 +49180,13 @@ function distanceToMatch(node, selector, limit, distance) {
|
|
|
49034
49180
|
return distanceToMatch(getParent(node), selector, limit, distance + 1);
|
|
49035
49181
|
}
|
|
49036
49182
|
function shouldMask(node, options) {
|
|
49037
|
-
|
|
49183
|
+
const { maskAllText, maskTextSelector, unmaskTextSelector } = options;
|
|
49038
49184
|
try {
|
|
49039
|
-
|
|
49185
|
+
const el = isElementNode(node) ? node : node.parentElement;
|
|
49040
49186
|
if (el === null)
|
|
49041
49187
|
return false;
|
|
49042
|
-
|
|
49043
|
-
|
|
49188
|
+
let maskDistance = -1;
|
|
49189
|
+
let unmaskDistance = -1;
|
|
49044
49190
|
if (maskAllText) {
|
|
49045
49191
|
unmaskDistance = distanceToMatch(el, unmaskTextSelector);
|
|
49046
49192
|
if (unmaskDistance < 0) {
|
|
@@ -49073,8 +49219,8 @@ function isNumberInput(element) {
|
|
|
49073
49219
|
}
|
|
49074
49220
|
function shouldMaskInput(element, maskInputOptions) {
|
|
49075
49221
|
if (maskInputOptions && isElementNode(element)) {
|
|
49076
|
-
|
|
49077
|
-
|
|
49222
|
+
const tagName = (element.tagName || '').toLowerCase();
|
|
49223
|
+
const type = (element.type || '').toLowerCase();
|
|
49078
49224
|
if (maskInputOptions[tagName] || maskInputOptions[type]) {
|
|
49079
49225
|
return true;
|
|
49080
49226
|
}
|
|
@@ -50561,12 +50707,12 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
|
|
|
50561
50707
|
}
|
|
50562
50708
|
}
|
|
50563
50709
|
|
|
50564
|
-
|
|
50710
|
+
const ONE_HUNDRED_MB_IN_BYTES = 100 * 1024 * 1024;
|
|
50565
50711
|
function matchHostedResources(recordingEvent, stringifiedRecordingPayload) {
|
|
50566
|
-
|
|
50567
|
-
|
|
50712
|
+
const fontURLRegex = /https:\/\/[^"\\\s]+?\.(woff2?|ttf|otf|eot)(\?[^"\\\s]*)?\b/g;
|
|
50713
|
+
const matches = stringifiedRecordingPayload.match(fontURLRegex);
|
|
50568
50714
|
// de-duplicate matches
|
|
50569
|
-
|
|
50715
|
+
const hostedResources = matches ? Array.from(new Set(matches)) : [];
|
|
50570
50716
|
return {
|
|
50571
50717
|
type: 'recording',
|
|
50572
50718
|
visitorId: recordingEvent.visitorId,
|
|
@@ -50581,75 +50727,77 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
|
|
|
50581
50727
|
recordingPayloadMetadata: [],
|
|
50582
50728
|
sequence: 0,
|
|
50583
50729
|
recordingPayloadCount: 0,
|
|
50584
|
-
hostedResources
|
|
50730
|
+
hostedResources
|
|
50585
50731
|
};
|
|
50586
50732
|
}
|
|
50587
50733
|
// keep in mind changes here may need addressing in the extension worker proxy as well
|
|
50588
50734
|
self.onmessage = function (e) {
|
|
50589
50735
|
try {
|
|
50590
50736
|
if (e.data.type === 'init' && e.data.lockID) {
|
|
50591
|
-
navigator.locks
|
|
50592
|
-
|
|
50593
|
-
|
|
50594
|
-
|
|
50595
|
-
|
|
50596
|
-
|
|
50737
|
+
if (navigator.locks) {
|
|
50738
|
+
navigator.locks.request(e.data.lockID, () => {
|
|
50739
|
+
postMessage({ ready: true });
|
|
50740
|
+
// This unresolved promise keeps the lock held with the worker until the worker is
|
|
50741
|
+
// terminated at which point the lock is released.
|
|
50742
|
+
return new Promise$2(() => { });
|
|
50743
|
+
});
|
|
50744
|
+
}
|
|
50597
50745
|
return;
|
|
50598
50746
|
}
|
|
50599
50747
|
if (e.data.url && e.data.payload) {
|
|
50600
|
-
|
|
50748
|
+
let { url, payload, shouldCacheResources } = e.data;
|
|
50601
50749
|
if (Object.keys(payload).length === 0) {
|
|
50602
50750
|
postMessage({
|
|
50603
50751
|
type: 'emptyPayload'
|
|
50604
50752
|
});
|
|
50605
50753
|
}
|
|
50606
|
-
|
|
50607
|
-
|
|
50754
|
+
const { sequence } = payload;
|
|
50755
|
+
const stringifiedRecordingPayload = JSON.stringify(payload.recordingPayload);
|
|
50608
50756
|
// calculate and post back the recording payload size before the payload is compressed
|
|
50609
|
-
|
|
50610
|
-
|
|
50757
|
+
const recordingPayloadSize = new TextEncoder().encode(stringifiedRecordingPayload).length;
|
|
50758
|
+
const exceedsPayloadSizeLimit = recordingPayloadSize >= ONE_HUNDRED_MB_IN_BYTES;
|
|
50611
50759
|
postMessage({
|
|
50612
50760
|
type: 'recordingPayloadSize',
|
|
50613
|
-
recordingPayloadSize
|
|
50614
|
-
exceedsPayloadSizeLimit
|
|
50761
|
+
recordingPayloadSize,
|
|
50762
|
+
exceedsPayloadSizeLimit
|
|
50615
50763
|
});
|
|
50616
50764
|
// don't attempt to send the payload if it exceeds the allowed limit
|
|
50617
50765
|
if (exceedsPayloadSizeLimit)
|
|
50618
50766
|
return;
|
|
50619
50767
|
if (shouldCacheResources) {
|
|
50620
|
-
|
|
50768
|
+
const hostedResourcesEvent = matchHostedResources(payload, stringifiedRecordingPayload);
|
|
50621
50769
|
if (hostedResourcesEvent.hostedResources.length) {
|
|
50622
50770
|
postMessage({
|
|
50623
50771
|
type: 'hostedResources',
|
|
50624
|
-
hostedResourcesEvent
|
|
50772
|
+
hostedResourcesEvent
|
|
50625
50773
|
});
|
|
50626
50774
|
}
|
|
50627
50775
|
}
|
|
50628
50776
|
payload.recordingSize = recordingPayloadSize;
|
|
50629
|
-
|
|
50777
|
+
const body = compress(payload, 'binary');
|
|
50630
50778
|
// we want to calculate ct (current time) as close as we can to the actual POST request
|
|
50631
50779
|
// so that it's as accurate as possible
|
|
50632
|
-
url =
|
|
50780
|
+
url = `${url}&ct=${new Date().getTime()}`;
|
|
50633
50781
|
fetch(url, {
|
|
50634
50782
|
method: 'POST',
|
|
50635
|
-
body
|
|
50783
|
+
body
|
|
50636
50784
|
}).then(function (response) {
|
|
50637
50785
|
if (response.status < 200 || response.status >= 300) {
|
|
50638
50786
|
postMessage({
|
|
50639
|
-
error: new Error(
|
|
50787
|
+
error: new Error(`received status code ${response.status}: ${response.statusText}`),
|
|
50640
50788
|
status: response.status,
|
|
50641
|
-
sequence
|
|
50789
|
+
sequence
|
|
50642
50790
|
});
|
|
50643
50791
|
}
|
|
50644
50792
|
else {
|
|
50645
50793
|
postMessage({
|
|
50646
|
-
sequence
|
|
50794
|
+
sequence
|
|
50647
50795
|
});
|
|
50648
50796
|
}
|
|
50649
|
-
})
|
|
50797
|
+
}).catch(function (e) {
|
|
50650
50798
|
postMessage({
|
|
50651
50799
|
error: e,
|
|
50652
|
-
sequence
|
|
50800
|
+
sequence
|
|
50653
50801
|
});
|
|
50654
50802
|
});
|
|
50655
50803
|
}
|
|
@@ -50684,12 +50832,12 @@ function createReplayPlugin() {
|
|
|
50684
50832
|
* limit of number of keys in an object
|
|
50685
50833
|
* if an object contains more keys than this limit, we would call its toString function directly
|
|
50686
50834
|
*/
|
|
50687
|
-
|
|
50835
|
+
const NUM_OF_KEYS_LIMIT = 50;
|
|
50688
50836
|
/**
|
|
50689
50837
|
* limit number of depth in an object
|
|
50690
50838
|
* if an object is too deep, toString process may cause browser OOM
|
|
50691
50839
|
*/
|
|
50692
|
-
|
|
50840
|
+
const DEPTH_OF_LIMIT = 4;
|
|
50693
50841
|
/**
|
|
50694
50842
|
* serialize an HTML element by creating a shallow clone of it with text content
|
|
50695
50843
|
* and return the resulting outerHTML string (without the subtree)
|
|
@@ -50700,8 +50848,8 @@ function serializeHTML(node) {
|
|
|
50700
50848
|
if (!node || node.nodeType !== node.ELEMENT_NODE) {
|
|
50701
50849
|
return '';
|
|
50702
50850
|
}
|
|
50703
|
-
|
|
50704
|
-
|
|
50851
|
+
const nodeClone = node.cloneNode(false);
|
|
50852
|
+
const { textContent } = node;
|
|
50705
50853
|
if (textContent) {
|
|
50706
50854
|
nodeClone.textContent = textContent;
|
|
50707
50855
|
}
|
|
@@ -50715,7 +50863,7 @@ function isObject(obj) {
|
|
|
50715
50863
|
return false;
|
|
50716
50864
|
if (typeof obj !== 'object')
|
|
50717
50865
|
return false;
|
|
50718
|
-
|
|
50866
|
+
const proto = Object.getPrototypeOf(obj);
|
|
50719
50867
|
return proto === Object.prototype || proto === null;
|
|
50720
50868
|
}
|
|
50721
50869
|
/**
|
|
@@ -50724,11 +50872,11 @@ function isObject(obj) {
|
|
|
50724
50872
|
function isObjTooDeep(obj, limit) {
|
|
50725
50873
|
if (limit === 0)
|
|
50726
50874
|
return true;
|
|
50727
|
-
|
|
50875
|
+
const keys = Object.keys(obj);
|
|
50728
50876
|
if (keys.length === 0)
|
|
50729
50877
|
return false;
|
|
50730
|
-
return keys.some(
|
|
50731
|
-
|
|
50878
|
+
return keys.some(key => {
|
|
50879
|
+
const value = obj[key];
|
|
50732
50880
|
return isObject(value) && isObjTooDeep(value, limit - 1);
|
|
50733
50881
|
});
|
|
50734
50882
|
}
|
|
@@ -50744,7 +50892,7 @@ function shouldIgnore(_obj) {
|
|
|
50744
50892
|
return false;
|
|
50745
50893
|
}
|
|
50746
50894
|
// out of keys limit
|
|
50747
|
-
|
|
50895
|
+
const keys = Object.keys(_obj);
|
|
50748
50896
|
if (keys.length > NUM_OF_KEYS_LIMIT) {
|
|
50749
50897
|
return true;
|
|
50750
50898
|
}
|
|
@@ -50776,7 +50924,7 @@ function stringify(arg) {
|
|
|
50776
50924
|
return value.toString ? value.toString() : '[object Object]';
|
|
50777
50925
|
}
|
|
50778
50926
|
if (value instanceof ArrayBuffer)
|
|
50779
|
-
return
|
|
50927
|
+
return `ArrayBuffer { byteLength: ${value.byteLength} }`;
|
|
50780
50928
|
if (value instanceof Error)
|
|
50781
50929
|
return value.name + ': ' + value.message;
|
|
50782
50930
|
if (value instanceof Node) {
|
|
@@ -50784,10 +50932,10 @@ function stringify(arg) {
|
|
|
50784
50932
|
}
|
|
50785
50933
|
// Handle events
|
|
50786
50934
|
if (value instanceof Event) {
|
|
50787
|
-
|
|
50935
|
+
const eventResult = {};
|
|
50788
50936
|
// eslint-disable-next-line guard-for-in
|
|
50789
|
-
for (
|
|
50790
|
-
|
|
50937
|
+
for (const eventKey in value) {
|
|
50938
|
+
const eventValue = value[eventKey];
|
|
50791
50939
|
eventResult[eventKey] = Array.isArray(eventValue) && eventValue[0] instanceof HTMLElement
|
|
50792
50940
|
? serializeHTML(eventValue[0])
|
|
50793
50941
|
: eventValue;
|
|
@@ -50798,31 +50946,30 @@ function stringify(arg) {
|
|
|
50798
50946
|
});
|
|
50799
50947
|
}
|
|
50800
50948
|
|
|
50801
|
-
|
|
50802
|
-
|
|
50949
|
+
class StackFrame {
|
|
50950
|
+
constructor(obj) {
|
|
50803
50951
|
this.fileName = obj.fileName || '';
|
|
50804
50952
|
this.functionName = obj.functionName || '';
|
|
50805
50953
|
this.lineNumber = obj.lineNumber;
|
|
50806
50954
|
this.columnNumber = obj.columnNumber;
|
|
50807
50955
|
}
|
|
50808
|
-
|
|
50809
|
-
|
|
50956
|
+
toString() {
|
|
50957
|
+
const { fileName, functionName, lineNumber = '', columnNumber = '' } = this;
|
|
50810
50958
|
return functionName
|
|
50811
|
-
?
|
|
50812
|
-
:
|
|
50813
|
-
}
|
|
50814
|
-
|
|
50815
|
-
|
|
50816
|
-
|
|
50817
|
-
|
|
50818
|
-
|
|
50819
|
-
|
|
50820
|
-
|
|
50821
|
-
var ErrorStackParser = {
|
|
50959
|
+
? `${functionName} (${fileName}:${lineNumber}:${columnNumber})`
|
|
50960
|
+
: `${fileName}:${lineNumber}:${columnNumber}`;
|
|
50961
|
+
}
|
|
50962
|
+
}
|
|
50963
|
+
const FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
|
|
50964
|
+
const CHROME_EDGE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
|
|
50965
|
+
const SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/;
|
|
50966
|
+
const LOCATION_REGEXP = /(.+?)(?::(\d+))?(?::(\d+))?$/;
|
|
50967
|
+
const DEFAULT_NUM_FRAMES_TO_SKIP = 5;
|
|
50968
|
+
const ErrorStackParser = {
|
|
50822
50969
|
/**
|
|
50823
50970
|
* Given an Error object, extract the most information from it.
|
|
50824
50971
|
*/
|
|
50825
|
-
parse
|
|
50972
|
+
parse(error, maxFramesToSave) {
|
|
50826
50973
|
if (!(error === null || error === void 0 ? void 0 : error.stack))
|
|
50827
50974
|
return [];
|
|
50828
50975
|
// Chrome, Edge, Opera ≥15
|
|
@@ -50836,25 +50983,24 @@ var ErrorStackParser = {
|
|
|
50836
50983
|
return [];
|
|
50837
50984
|
},
|
|
50838
50985
|
// Separate line and column numbers from a string of the form: (URI:Line:Column)
|
|
50839
|
-
extractLocation
|
|
50986
|
+
extractLocation(urlLike) {
|
|
50840
50987
|
// Fail-fast but return locations like "(native)"
|
|
50841
50988
|
if (urlLike.indexOf(':') === -1) {
|
|
50842
50989
|
return [urlLike];
|
|
50843
50990
|
}
|
|
50844
|
-
|
|
50991
|
+
const parts = LOCATION_REGEXP.exec(urlLike.replace(/[()]/g, ''));
|
|
50845
50992
|
if (!parts)
|
|
50846
|
-
throw new Error(
|
|
50993
|
+
throw new Error(`Cannot parse given url: ${urlLike}`);
|
|
50847
50994
|
return [parts[1], parts[2] || undefined, parts[3] || undefined];
|
|
50848
50995
|
},
|
|
50849
|
-
parseHelper
|
|
50850
|
-
|
|
50851
|
-
|
|
50852
|
-
|
|
50853
|
-
|
|
50854
|
-
|
|
50855
|
-
|
|
50856
|
-
|
|
50857
|
-
var shouldSkipLine = (includeMatchedLine && !lineMatchesRegex) || // if line doesn't match regex and we want matched lines, skip it
|
|
50996
|
+
parseHelper({ regex, includeMatchedLine }, error, maxFramesToSave, callback) {
|
|
50997
|
+
const lines = error.stack.split('\n');
|
|
50998
|
+
const frames = [];
|
|
50999
|
+
let validFramesFound = 0;
|
|
51000
|
+
for (let i = 0; i < lines.length; i++) {
|
|
51001
|
+
const line = lines[i];
|
|
51002
|
+
const lineMatchesRegex = regex.test(line);
|
|
51003
|
+
const shouldSkipLine = (includeMatchedLine && !lineMatchesRegex) || // if line doesn't match regex and we want matched lines, skip it
|
|
50858
51004
|
(!includeMatchedLine && lineMatchesRegex); // if line does match regex but we don't want matched lines, skip it
|
|
50859
51005
|
if (shouldSkipLine)
|
|
50860
51006
|
continue;
|
|
@@ -50869,12 +51015,11 @@ var ErrorStackParser = {
|
|
|
50869
51015
|
}
|
|
50870
51016
|
return frames;
|
|
50871
51017
|
},
|
|
50872
|
-
parseChromiumStack
|
|
50873
|
-
|
|
50874
|
-
|
|
50875
|
-
var sanitizedLine;
|
|
51018
|
+
parseChromiumStack(error, maxFramesToSave) {
|
|
51019
|
+
return this.parseHelper({ regex: CHROME_EDGE_STACK_REGEXP, includeMatchedLine: true }, error, maxFramesToSave, (line, frames) => {
|
|
51020
|
+
let sanitizedLine;
|
|
50876
51021
|
if (line.indexOf('(eval ') > -1) {
|
|
50877
|
-
|
|
51022
|
+
const processedLine = line
|
|
50878
51023
|
.replace(/eval code/g, 'eval')
|
|
50879
51024
|
.replace(/(\(eval at [^()]*)|(\),.*$)/g, '');
|
|
50880
51025
|
sanitizedLine = processedLine.replace(/^\s+/, '').replace(/\(eval code/g, '(');
|
|
@@ -50884,7 +51029,7 @@ var ErrorStackParser = {
|
|
|
50884
51029
|
}
|
|
50885
51030
|
// capture and preserve the parenthesized location "(/foo/my bar.js:12:87)"
|
|
50886
51031
|
// in case it has spaces in it, as the string is split on \s+ later on
|
|
50887
|
-
|
|
51032
|
+
let location;
|
|
50888
51033
|
if (sanitizedLine.indexOf('(') > -1 && sanitizedLine.indexOf('):') > -1) {
|
|
50889
51034
|
location = sanitizedLine.match(/ (\((.+):(\d+):(\d+)\)$)/);
|
|
50890
51035
|
}
|
|
@@ -50892,23 +51037,22 @@ var ErrorStackParser = {
|
|
|
50892
51037
|
sanitizedLine = location
|
|
50893
51038
|
? sanitizedLine.replace(location[0], '')
|
|
50894
51039
|
: sanitizedLine;
|
|
50895
|
-
|
|
51040
|
+
const tokens = sanitizedLine.split(/\s+/).slice(1);
|
|
50896
51041
|
// if a location was matched, pass it to extractLocation() otherwise pop the last token
|
|
50897
|
-
|
|
50898
|
-
|
|
50899
|
-
|
|
51042
|
+
const locationParts = this.extractLocation(location ? location[1] : tokens.pop() || '');
|
|
51043
|
+
const functionName = tokens.join(' ') || undefined;
|
|
51044
|
+
const fileName = (locationParts[0] === 'eval' || locationParts[0] === '<anonymous>') ? undefined : locationParts[0];
|
|
50900
51045
|
frames.push(new StackFrame({
|
|
50901
|
-
functionName
|
|
50902
|
-
fileName
|
|
51046
|
+
functionName,
|
|
51047
|
+
fileName,
|
|
50903
51048
|
lineNumber: locationParts[1],
|
|
50904
51049
|
columnNumber: locationParts[2]
|
|
50905
51050
|
}));
|
|
50906
51051
|
});
|
|
50907
51052
|
},
|
|
50908
|
-
parseFirefoxSafariStack
|
|
50909
|
-
|
|
50910
|
-
|
|
50911
|
-
var processedLine = line;
|
|
51053
|
+
parseFirefoxSafariStack(error, maxFramesToSave) {
|
|
51054
|
+
return this.parseHelper({ regex: SAFARI_NATIVE_CODE_REGEXP, includeMatchedLine: false }, error, maxFramesToSave, (line, frames) => {
|
|
51055
|
+
let processedLine = line;
|
|
50912
51056
|
// Throw away eval information until we implement stacktrace.js/stackframe#8
|
|
50913
51057
|
if (processedLine.indexOf(' > eval') > -1) {
|
|
50914
51058
|
processedLine = processedLine.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ':$1');
|
|
@@ -50920,12 +51064,12 @@ var ErrorStackParser = {
|
|
|
50920
51064
|
}));
|
|
50921
51065
|
return;
|
|
50922
51066
|
}
|
|
50923
|
-
|
|
50924
|
-
|
|
50925
|
-
|
|
50926
|
-
|
|
51067
|
+
const functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
|
|
51068
|
+
const matches = processedLine.match(functionNameRegex);
|
|
51069
|
+
const functionName = matches && matches[1] ? matches[1] : undefined;
|
|
51070
|
+
const locationParts = this.extractLocation(processedLine.replace(functionNameRegex, ''));
|
|
50927
51071
|
frames.push(new StackFrame({
|
|
50928
|
-
functionName
|
|
51072
|
+
functionName,
|
|
50929
51073
|
fileName: locationParts[0],
|
|
50930
51074
|
lineNumber: locationParts[1],
|
|
50931
51075
|
columnNumber: locationParts[2]
|
|
@@ -50960,7 +51104,7 @@ function includes(str, substring) {
|
|
|
50960
51104
|
function getResourceType(blockedURI, directive) {
|
|
50961
51105
|
if (!directive || typeof directive !== 'string')
|
|
50962
51106
|
return 'resource';
|
|
50963
|
-
|
|
51107
|
+
const d = directive.toLowerCase();
|
|
50964
51108
|
if (blockedURI === 'inline') {
|
|
50965
51109
|
if (includes(d, 'script-src-attr')) {
|
|
50966
51110
|
return 'inline event handler';
|
|
@@ -51019,12 +51163,11 @@ function getResourceType(blockedURI, directive) {
|
|
|
51019
51163
|
function getDirective(policy, directiveName) {
|
|
51020
51164
|
if (!policy || !directiveName)
|
|
51021
51165
|
return '';
|
|
51022
|
-
|
|
51023
|
-
for (
|
|
51024
|
-
|
|
51025
|
-
|
|
51026
|
-
|
|
51027
|
-
if (lower === needle || lower.startsWith("".concat(needle, " "))) {
|
|
51166
|
+
const needle = directiveName.toLowerCase();
|
|
51167
|
+
for (const directive of policy.split(';')) {
|
|
51168
|
+
const trimmed = directive.trim();
|
|
51169
|
+
const lower = trimmed.toLowerCase();
|
|
51170
|
+
if (lower === needle || lower.startsWith(`${needle} `)) {
|
|
51028
51171
|
return trimmed;
|
|
51029
51172
|
}
|
|
51030
51173
|
}
|
|
@@ -51046,7 +51189,7 @@ function getDirective(policy, directiveName) {
|
|
|
51046
51189
|
function getArticle(phrase) {
|
|
51047
51190
|
if (!phrase || typeof phrase !== 'string')
|
|
51048
51191
|
return 'A';
|
|
51049
|
-
|
|
51192
|
+
const c = phrase.trim().charAt(0).toLowerCase();
|
|
51050
51193
|
return includes('aeiou', c) ? 'An' : 'A';
|
|
51051
51194
|
}
|
|
51052
51195
|
/**
|
|
@@ -51089,47 +51232,46 @@ function createCspViolationMessage(blockedURI, directive, isReportOnly, original
|
|
|
51089
51232
|
return 'Content Security Policy: Unknown violation occurred.';
|
|
51090
51233
|
}
|
|
51091
51234
|
try {
|
|
51092
|
-
|
|
51235
|
+
const reportOnlyText = isReportOnly ? ' (Report-Only)' : '';
|
|
51093
51236
|
// special case for frame-ancestors since it doesn't fit our template at all
|
|
51094
51237
|
if ((directive === null || directive === void 0 ? void 0 : directive.toLowerCase()) === 'frame-ancestors') {
|
|
51095
|
-
return
|
|
51238
|
+
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}".`;
|
|
51096
51239
|
}
|
|
51097
|
-
|
|
51098
|
-
|
|
51099
|
-
|
|
51100
|
-
|
|
51101
|
-
|
|
51102
|
-
|
|
51103
|
-
return
|
|
51240
|
+
const resourceType = getResourceType(blockedURI, directive);
|
|
51241
|
+
const article = getArticle(resourceType);
|
|
51242
|
+
const source = formatBlockedUri(blockedURI);
|
|
51243
|
+
const directiveValue = getDirective(originalPolicy, directive);
|
|
51244
|
+
const policyDisplay = directiveValue || directive;
|
|
51245
|
+
const resourceDescription = `${article} ${resourceType}${source ? ` from ${source}` : ''}`;
|
|
51246
|
+
return `Content Security Policy${reportOnlyText}: ${resourceDescription} was blocked by your site's \`${policyDisplay}\` policy.\nCurrent CSP: "${originalPolicy}".`;
|
|
51104
51247
|
}
|
|
51105
51248
|
catch (error) {
|
|
51106
|
-
return
|
|
51249
|
+
return `Content Security Policy: Error formatting violation message: ${error.message}`;
|
|
51107
51250
|
}
|
|
51108
51251
|
}
|
|
51109
51252
|
|
|
51110
|
-
|
|
51111
|
-
|
|
51253
|
+
const MAX_LENGTH = 1000;
|
|
51254
|
+
const PII_PATTERN = {
|
|
51112
51255
|
ip: /\b(?:\d{1,3}\.){3}\d{1,3}\b/g,
|
|
51113
51256
|
ssn: /\b\d{3}-\d{2}-\d{4}\b/g,
|
|
51114
51257
|
creditCard: /\b(?:\d[ -]?){12,18}\d\b/g,
|
|
51115
51258
|
httpsUrls: /https:\/\/[^\s]+/g,
|
|
51116
51259
|
email: /[\w._+-]+@[\w.-]+\.\w+/g
|
|
51117
51260
|
};
|
|
51118
|
-
|
|
51119
|
-
|
|
51120
|
-
|
|
51121
|
-
|
|
51122
|
-
|
|
51261
|
+
const PII_REPLACEMENT = '*'.repeat(10);
|
|
51262
|
+
const JSON_PII_KEYS = ['password', 'email', 'key', 'token', 'auth', 'authentication', 'phone', 'address', 'ssn'];
|
|
51263
|
+
const UNABLE_TO_DISPLAY_BODY = '[Unable to display body: detected PII could not be redacted]';
|
|
51264
|
+
const joinedKeys = JSON_PII_KEYS.join('|');
|
|
51265
|
+
const keyPattern = `"([^"]*(?:${joinedKeys})[^"]*)"`;
|
|
51123
51266
|
// only scrub strings, numbers, and booleans
|
|
51124
|
-
|
|
51267
|
+
const acceptedValues = '("([^"\\\\]*(?:\\\\.[^"\\\\]*)*")|(\\d+)|(true|false))';
|
|
51125
51268
|
/**
|
|
51126
51269
|
* Truncates a string to the max length
|
|
51127
51270
|
* @access private
|
|
51128
51271
|
* @param {String} string
|
|
51129
51272
|
* @returns {String}
|
|
51130
51273
|
*/
|
|
51131
|
-
function truncate(string, includeEllipsis) {
|
|
51132
|
-
if (includeEllipsis === void 0) { includeEllipsis = false; }
|
|
51274
|
+
function truncate(string, includeEllipsis = false) {
|
|
51133
51275
|
if (string.length <= MAX_LENGTH)
|
|
51134
51276
|
return string;
|
|
51135
51277
|
if (includeEllipsis) {
|
|
@@ -51146,7 +51288,7 @@ function truncate(string, includeEllipsis) {
|
|
|
51146
51288
|
* @returns {String}
|
|
51147
51289
|
*/
|
|
51148
51290
|
function generateLogKey(methodName, message, stackTrace) {
|
|
51149
|
-
return
|
|
51291
|
+
return `${methodName}|${message}|${stackTrace}`;
|
|
51150
51292
|
}
|
|
51151
51293
|
/**
|
|
51152
51294
|
* Checks if a string has 2 or more digits, a https URL, or an email address
|
|
@@ -51163,13 +51305,12 @@ function mightContainPII(string) {
|
|
|
51163
51305
|
* @param {String} string
|
|
51164
51306
|
* @returns {String}
|
|
51165
51307
|
*/
|
|
51166
|
-
function scrubPII(
|
|
51167
|
-
var string = _a.string, _ = _a._;
|
|
51308
|
+
function scrubPII({ string, _ }) {
|
|
51168
51309
|
if (!string || typeof string !== 'string')
|
|
51169
51310
|
return string;
|
|
51170
51311
|
if (!mightContainPII(string))
|
|
51171
51312
|
return string;
|
|
51172
|
-
return _.reduce(_.values(PII_PATTERN),
|
|
51313
|
+
return _.reduce(_.values(PII_PATTERN), (str, pattern) => str.replace(pattern, PII_REPLACEMENT), string);
|
|
51173
51314
|
}
|
|
51174
51315
|
/**
|
|
51175
51316
|
* Scrub PII from a stringified JSON object
|
|
@@ -51178,14 +51319,12 @@ function scrubPII(_a) {
|
|
|
51178
51319
|
* @returns {String}
|
|
51179
51320
|
*/
|
|
51180
51321
|
function scrubJsonPII(string) {
|
|
51181
|
-
|
|
51322
|
+
const fullScrubRegex = new RegExp(`${keyPattern}\\s*:\\s*[\\{\\[]`, 'i');
|
|
51182
51323
|
if (fullScrubRegex.test(string)) {
|
|
51183
51324
|
return UNABLE_TO_DISPLAY_BODY;
|
|
51184
51325
|
}
|
|
51185
|
-
|
|
51186
|
-
return string.replace(keyValueScrubRegex,
|
|
51187
|
-
return "\"".concat(key, "\":\"").concat(PII_REPLACEMENT, "\"");
|
|
51188
|
-
});
|
|
51326
|
+
const keyValueScrubRegex = new RegExp(`${keyPattern}\\s*:\\s*${acceptedValues}`, 'gi');
|
|
51327
|
+
return string.replace(keyValueScrubRegex, (match, key) => `"${key}":"${PII_REPLACEMENT}"`);
|
|
51189
51328
|
}
|
|
51190
51329
|
/**
|
|
51191
51330
|
* Checks if a string is a JSON object
|
|
@@ -51197,7 +51336,7 @@ function scrubJsonPII(string) {
|
|
|
51197
51336
|
function mightContainJson(string, contentType) {
|
|
51198
51337
|
if (!string || typeof string !== 'string')
|
|
51199
51338
|
return false;
|
|
51200
|
-
|
|
51339
|
+
const firstChar = string.charAt(0);
|
|
51201
51340
|
if (contentType && contentType.indexOf('application/json') !== -1) {
|
|
51202
51341
|
return true;
|
|
51203
51342
|
}
|
|
@@ -51210,20 +51349,19 @@ function mightContainJson(string, contentType) {
|
|
|
51210
51349
|
* @param {String} contentType
|
|
51211
51350
|
* @returns {String}
|
|
51212
51351
|
*/
|
|
51213
|
-
function maskSensitiveFields(
|
|
51214
|
-
var string = _a.string, contentType = _a.contentType, _ = _a._;
|
|
51352
|
+
function maskSensitiveFields({ string, contentType, _ }) {
|
|
51215
51353
|
if (!string || typeof string !== 'string')
|
|
51216
51354
|
return string;
|
|
51217
51355
|
if (mightContainJson(string, contentType)) {
|
|
51218
51356
|
string = scrubJsonPII(string);
|
|
51219
51357
|
}
|
|
51220
51358
|
if (mightContainPII(string)) {
|
|
51221
|
-
string = scrubPII({ string
|
|
51359
|
+
string = scrubPII({ string, _ });
|
|
51222
51360
|
}
|
|
51223
51361
|
return string;
|
|
51224
51362
|
}
|
|
51225
51363
|
|
|
51226
|
-
|
|
51364
|
+
const DEV_LOG_TYPE = 'devlog';
|
|
51227
51365
|
function createDevLogEnvelope(pluginAPI, globalPendo) {
|
|
51228
51366
|
return {
|
|
51229
51367
|
browser_time: pluginAPI.util.getNow(),
|
|
@@ -51234,12 +51372,12 @@ function createDevLogEnvelope(pluginAPI, globalPendo) {
|
|
|
51234
51372
|
};
|
|
51235
51373
|
}
|
|
51236
51374
|
|
|
51237
|
-
|
|
51238
|
-
|
|
51239
|
-
|
|
51240
|
-
|
|
51241
|
-
|
|
51242
|
-
|
|
51375
|
+
const TOKEN_MAX_SIZE = 100;
|
|
51376
|
+
const TOKEN_REFILL_RATE = 10;
|
|
51377
|
+
const TOKEN_REFRESH_INTERVAL = 1000;
|
|
51378
|
+
const MAX_UNCOMPRESSED_SIZE = 125000; // 125KB
|
|
51379
|
+
class DevlogBuffer {
|
|
51380
|
+
constructor(pendo, pluginAPI) {
|
|
51243
51381
|
this.pendo = pendo;
|
|
51244
51382
|
this.pluginAPI = pluginAPI;
|
|
51245
51383
|
this.events = [];
|
|
@@ -51250,36 +51388,36 @@ var DevlogBuffer = /** @class */ (function () {
|
|
|
51250
51388
|
this.lastRefillTime = this.pluginAPI.util.getNow();
|
|
51251
51389
|
this.nextRefillTime = this.lastRefillTime + TOKEN_REFRESH_INTERVAL;
|
|
51252
51390
|
}
|
|
51253
|
-
|
|
51391
|
+
isEmpty() {
|
|
51254
51392
|
return this.events.length === 0 && this.payloads.length === 0;
|
|
51255
|
-
}
|
|
51256
|
-
|
|
51257
|
-
|
|
51393
|
+
}
|
|
51394
|
+
refillTokens() {
|
|
51395
|
+
const now = this.pluginAPI.util.getNow();
|
|
51258
51396
|
if (now >= this.nextRefillTime) {
|
|
51259
|
-
|
|
51260
|
-
|
|
51261
|
-
|
|
51397
|
+
const timeSinceLastRefill = now - this.lastRefillTime;
|
|
51398
|
+
const secondsSinceLastRefill = Math.floor(timeSinceLastRefill / TOKEN_REFRESH_INTERVAL);
|
|
51399
|
+
const tokensToRefill = secondsSinceLastRefill * TOKEN_REFILL_RATE;
|
|
51262
51400
|
this.tokens = Math.min(this.tokens + tokensToRefill, TOKEN_MAX_SIZE);
|
|
51263
51401
|
this.lastRefillTime = now;
|
|
51264
51402
|
this.nextRefillTime = now + TOKEN_REFRESH_INTERVAL;
|
|
51265
51403
|
}
|
|
51266
|
-
}
|
|
51267
|
-
|
|
51404
|
+
}
|
|
51405
|
+
clear() {
|
|
51268
51406
|
this.events = [];
|
|
51269
51407
|
this.lastEvent = null;
|
|
51270
51408
|
this.uncompressedSize = 0;
|
|
51271
|
-
}
|
|
51272
|
-
|
|
51409
|
+
}
|
|
51410
|
+
hasTokenAvailable() {
|
|
51273
51411
|
this.refillTokens();
|
|
51274
51412
|
return this.tokens > 0;
|
|
51275
|
-
}
|
|
51276
|
-
|
|
51413
|
+
}
|
|
51414
|
+
estimateEventSize(event) {
|
|
51277
51415
|
return JSON.stringify(event).length;
|
|
51278
|
-
}
|
|
51279
|
-
|
|
51416
|
+
}
|
|
51417
|
+
push(event) {
|
|
51280
51418
|
if (!this.hasTokenAvailable())
|
|
51281
51419
|
return false;
|
|
51282
|
-
|
|
51420
|
+
const eventSize = this.estimateEventSize(event);
|
|
51283
51421
|
if (this.uncompressedSize + eventSize > MAX_UNCOMPRESSED_SIZE) {
|
|
51284
51422
|
this.compressCurrentChunk();
|
|
51285
51423
|
}
|
|
@@ -51288,55 +51426,54 @@ var DevlogBuffer = /** @class */ (function () {
|
|
|
51288
51426
|
this.events.push(event);
|
|
51289
51427
|
this.tokens = Math.max(this.tokens - 1, 0);
|
|
51290
51428
|
return true;
|
|
51291
|
-
}
|
|
51292
|
-
|
|
51429
|
+
}
|
|
51430
|
+
compressCurrentChunk() {
|
|
51293
51431
|
if (this.events.length === 0)
|
|
51294
51432
|
return;
|
|
51295
|
-
|
|
51433
|
+
const jzb = this.pendo.compress(this.events);
|
|
51296
51434
|
this.payloads.push(jzb);
|
|
51297
51435
|
this.clear();
|
|
51298
|
-
}
|
|
51299
|
-
|
|
51300
|
-
|
|
51436
|
+
}
|
|
51437
|
+
generateUrl() {
|
|
51438
|
+
const queryParams = {
|
|
51301
51439
|
v: this.pendo.VERSION,
|
|
51302
51440
|
ct: this.pluginAPI.util.getNow()
|
|
51303
51441
|
};
|
|
51304
51442
|
return this.pluginAPI.transmit.buildBaseDataUrl(DEV_LOG_TYPE, this.pendo.apiKey, queryParams);
|
|
51305
|
-
}
|
|
51306
|
-
|
|
51443
|
+
}
|
|
51444
|
+
pack() {
|
|
51307
51445
|
if (this.isEmpty())
|
|
51308
51446
|
return;
|
|
51309
|
-
|
|
51447
|
+
const url = this.generateUrl();
|
|
51310
51448
|
this.compressCurrentChunk();
|
|
51311
|
-
|
|
51312
|
-
jzb
|
|
51313
|
-
url
|
|
51314
|
-
})
|
|
51449
|
+
const payloads = this.pendo._.map(this.payloads, (jzb) => ({
|
|
51450
|
+
jzb,
|
|
51451
|
+
url
|
|
51452
|
+
}));
|
|
51315
51453
|
this.payloads = [];
|
|
51316
51454
|
return payloads;
|
|
51317
|
-
}
|
|
51318
|
-
|
|
51319
|
-
}());
|
|
51455
|
+
}
|
|
51456
|
+
}
|
|
51320
51457
|
|
|
51321
|
-
|
|
51322
|
-
|
|
51458
|
+
class DevlogTransport {
|
|
51459
|
+
constructor(globalPendo, pluginAPI) {
|
|
51323
51460
|
this.pendo = globalPendo;
|
|
51324
51461
|
this.pluginAPI = pluginAPI;
|
|
51325
51462
|
}
|
|
51326
|
-
|
|
51327
|
-
|
|
51463
|
+
buildGetUrl(baseUrl, jzb) {
|
|
51464
|
+
const params = {};
|
|
51328
51465
|
if (this.pluginAPI.agent.treatAsAdoptPartner()) {
|
|
51329
51466
|
this.pluginAPI.agent.addAccountIdParams(params, this.pendo.get_account_id(), this.pluginAPI.ConfigReader.get('oemAccountId'));
|
|
51330
51467
|
}
|
|
51331
|
-
|
|
51468
|
+
const jwtOptions = this.pluginAPI.agent.getJwtInfoCopy();
|
|
51332
51469
|
if (!this.pendo._.isEmpty(jwtOptions)) {
|
|
51333
51470
|
this.pendo._.extend(params, jwtOptions);
|
|
51334
51471
|
}
|
|
51335
51472
|
params.jzb = jzb;
|
|
51336
|
-
|
|
51337
|
-
return
|
|
51338
|
-
}
|
|
51339
|
-
|
|
51473
|
+
const queryString = this.pendo._.map(params, (value, key) => `${key}=${value}`).join('&');
|
|
51474
|
+
return `${baseUrl}${baseUrl.indexOf('?') !== -1 ? '&' : '?'}${queryString}`;
|
|
51475
|
+
}
|
|
51476
|
+
get(url, options) {
|
|
51340
51477
|
options.method = 'GET';
|
|
51341
51478
|
if (this.pluginAPI.transmit.fetchKeepalive.supported()) {
|
|
51342
51479
|
return this.pluginAPI.transmit.fetchKeepalive(url, options);
|
|
@@ -51344,90 +51481,86 @@ var DevlogTransport = /** @class */ (function () {
|
|
|
51344
51481
|
else {
|
|
51345
51482
|
return this.pendo.ajax.get(url);
|
|
51346
51483
|
}
|
|
51347
|
-
}
|
|
51348
|
-
|
|
51349
|
-
|
|
51350
|
-
var getUrl = this.buildGetUrl(url, jzb);
|
|
51484
|
+
}
|
|
51485
|
+
sendRequestWithGet({ url, jzb }) {
|
|
51486
|
+
const getUrl = this.buildGetUrl(url, jzb);
|
|
51351
51487
|
return this.get(getUrl, {
|
|
51352
51488
|
headers: {
|
|
51353
51489
|
'Content-Type': 'application/octet-stream'
|
|
51354
51490
|
}
|
|
51355
51491
|
});
|
|
51356
|
-
}
|
|
51357
|
-
|
|
51492
|
+
}
|
|
51493
|
+
post(url, options) {
|
|
51358
51494
|
options.method = 'POST';
|
|
51359
51495
|
if (options.keepalive && this.pluginAPI.transmit.fetchKeepalive.supported()) {
|
|
51360
51496
|
return this.pluginAPI.transmit.fetchKeepalive(url, options);
|
|
51361
51497
|
}
|
|
51362
51498
|
else if (options.keepalive && this.pluginAPI.transmit.sendBeacon.supported()) {
|
|
51363
|
-
|
|
51499
|
+
const result = this.pluginAPI.transmit.sendBeacon(url, new Blob([options.body]));
|
|
51364
51500
|
return result ? Promise$2.resolve() : Promise$2.reject(new Error('sendBeacon failed to send devlog data'));
|
|
51365
51501
|
}
|
|
51366
51502
|
else {
|
|
51367
51503
|
return this.pendo.ajax.post(url, options.body);
|
|
51368
51504
|
}
|
|
51369
|
-
}
|
|
51370
|
-
|
|
51371
|
-
|
|
51372
|
-
|
|
51373
|
-
var bodyPayload = {
|
|
51505
|
+
}
|
|
51506
|
+
sendRequestWithPost({ url, jzb }, isUnload) {
|
|
51507
|
+
const jwtOptions = this.pluginAPI.agent.getJwtInfoCopy();
|
|
51508
|
+
const bodyPayload = {
|
|
51374
51509
|
events: jzb,
|
|
51375
51510
|
browser_time: this.pluginAPI.util.getNow()
|
|
51376
51511
|
};
|
|
51377
51512
|
if (this.pluginAPI.agent.treatAsAdoptPartner()) {
|
|
51378
51513
|
this.pluginAPI.agent.addAccountIdParams(bodyPayload, this.pendo.get_account_id(), this.pluginAPI.ConfigReader.get('oemAccountId'));
|
|
51379
51514
|
}
|
|
51380
|
-
|
|
51515
|
+
const body = JSON.stringify(this.pendo._.extend(bodyPayload, jwtOptions));
|
|
51381
51516
|
return this.post(url, {
|
|
51382
|
-
body
|
|
51517
|
+
body,
|
|
51383
51518
|
headers: {
|
|
51384
51519
|
'Content-Type': 'application/json'
|
|
51385
51520
|
},
|
|
51386
51521
|
keepalive: isUnload
|
|
51387
51522
|
});
|
|
51388
|
-
}
|
|
51389
|
-
|
|
51390
|
-
|
|
51391
|
-
var compressedLength = jzb.length;
|
|
51523
|
+
}
|
|
51524
|
+
sendRequest({ url, jzb }, isUnload) {
|
|
51525
|
+
const compressedLength = jzb.length;
|
|
51392
51526
|
if (compressedLength <= this.pluginAPI.constants.ENCODED_EVENT_MAX_LENGTH && !this.pluginAPI.ConfigReader.get('sendEventsWithPostOnly')) {
|
|
51393
|
-
return this.sendRequestWithGet({ url
|
|
51527
|
+
return this.sendRequestWithGet({ url, jzb });
|
|
51394
51528
|
}
|
|
51395
|
-
return this.sendRequestWithPost({ url
|
|
51396
|
-
}
|
|
51397
|
-
|
|
51398
|
-
}());
|
|
51529
|
+
return this.sendRequestWithPost({ url, jzb }, isUnload);
|
|
51530
|
+
}
|
|
51531
|
+
}
|
|
51399
51532
|
|
|
51400
51533
|
function ConsoleCapture() {
|
|
51401
|
-
|
|
51402
|
-
|
|
51403
|
-
|
|
51404
|
-
|
|
51405
|
-
|
|
51406
|
-
|
|
51407
|
-
|
|
51408
|
-
|
|
51409
|
-
|
|
51410
|
-
|
|
51411
|
-
|
|
51412
|
-
|
|
51534
|
+
let pluginAPI;
|
|
51535
|
+
let _;
|
|
51536
|
+
let globalPendo;
|
|
51537
|
+
let buffer;
|
|
51538
|
+
let sendQueue;
|
|
51539
|
+
let sendInterval;
|
|
51540
|
+
let transport;
|
|
51541
|
+
let isPtmPaused;
|
|
51542
|
+
let isCapturingConsoleLogs = false;
|
|
51543
|
+
const CAPTURE_CONSOLE_CONFIG = 'captureConsoleLogs';
|
|
51544
|
+
const CONSOLE_METHODS = ['log', 'warn', 'error', 'info'];
|
|
51545
|
+
const DEV_LOG_SUB_TYPE = 'console';
|
|
51413
51546
|
// deduplicate logs
|
|
51414
|
-
|
|
51547
|
+
let lastLogKey = '';
|
|
51415
51548
|
return {
|
|
51416
51549
|
name: 'ConsoleCapture',
|
|
51417
|
-
initialize
|
|
51418
|
-
teardown
|
|
51419
|
-
addIntercepts
|
|
51420
|
-
createConsoleEvent
|
|
51421
|
-
captureStackTrace
|
|
51422
|
-
send
|
|
51423
|
-
setCaptureState
|
|
51424
|
-
recordingStarted
|
|
51425
|
-
recordingStopped
|
|
51426
|
-
onAppHidden
|
|
51427
|
-
onAppUnloaded
|
|
51428
|
-
onPtmPaused
|
|
51429
|
-
onPtmUnpaused
|
|
51430
|
-
securityPolicyViolationFn
|
|
51550
|
+
initialize,
|
|
51551
|
+
teardown,
|
|
51552
|
+
addIntercepts,
|
|
51553
|
+
createConsoleEvent,
|
|
51554
|
+
captureStackTrace,
|
|
51555
|
+
send,
|
|
51556
|
+
setCaptureState,
|
|
51557
|
+
recordingStarted,
|
|
51558
|
+
recordingStopped,
|
|
51559
|
+
onAppHidden,
|
|
51560
|
+
onAppUnloaded,
|
|
51561
|
+
onPtmPaused,
|
|
51562
|
+
onPtmUnpaused,
|
|
51563
|
+
securityPolicyViolationFn,
|
|
51431
51564
|
get isCapturingConsoleLogs() {
|
|
51432
51565
|
return isCapturingConsoleLogs;
|
|
51433
51566
|
},
|
|
@@ -51444,16 +51577,16 @@ function ConsoleCapture() {
|
|
|
51444
51577
|
function initialize(pendo, PluginAPI) {
|
|
51445
51578
|
_ = pendo._;
|
|
51446
51579
|
pluginAPI = PluginAPI;
|
|
51447
|
-
|
|
51580
|
+
const { ConfigReader } = pluginAPI;
|
|
51448
51581
|
ConfigReader.addOption(CAPTURE_CONSOLE_CONFIG, [ConfigReader.sources.PENDO_CONFIG_SRC], false);
|
|
51449
|
-
|
|
51582
|
+
const captureConsoleEnabled = ConfigReader.get(CAPTURE_CONSOLE_CONFIG);
|
|
51450
51583
|
if (!captureConsoleEnabled)
|
|
51451
51584
|
return;
|
|
51452
51585
|
globalPendo = pendo;
|
|
51453
51586
|
buffer = new DevlogBuffer(pendo, pluginAPI);
|
|
51454
51587
|
transport = new DevlogTransport(pendo, pluginAPI);
|
|
51455
51588
|
sendQueue = new pluginAPI.SendQueue(transport.sendRequest.bind(transport));
|
|
51456
|
-
sendInterval = setInterval(
|
|
51589
|
+
sendInterval = setInterval(() => {
|
|
51457
51590
|
if (!sendQueue.failed()) {
|
|
51458
51591
|
send();
|
|
51459
51592
|
}
|
|
@@ -51479,19 +51612,17 @@ function ConsoleCapture() {
|
|
|
51479
51612
|
function onPtmUnpaused() {
|
|
51480
51613
|
isPtmPaused = false;
|
|
51481
51614
|
if (!buffer.isEmpty()) {
|
|
51482
|
-
for (
|
|
51483
|
-
|
|
51484
|
-
pluginAPI.Events.eventCaptured.trigger(event_1);
|
|
51615
|
+
for (const event of buffer.events) {
|
|
51616
|
+
pluginAPI.Events.eventCaptured.trigger(event);
|
|
51485
51617
|
}
|
|
51486
51618
|
send();
|
|
51487
51619
|
}
|
|
51488
51620
|
}
|
|
51489
|
-
function setCaptureState(
|
|
51490
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.shouldCapture, shouldCapture = _c === void 0 ? false : _c, _d = _b.reason, reason = _d === void 0 ? '' : _d;
|
|
51621
|
+
function setCaptureState({ shouldCapture = false, reason = '' } = {}) {
|
|
51491
51622
|
if (shouldCapture === isCapturingConsoleLogs)
|
|
51492
51623
|
return;
|
|
51493
51624
|
isCapturingConsoleLogs = shouldCapture;
|
|
51494
|
-
pluginAPI.log.info(
|
|
51625
|
+
pluginAPI.log.info(`[ConsoleCapture] Console log capture ${shouldCapture ? 'started' : 'stopped'}${reason ? `: ${reason}` : ''}`);
|
|
51495
51626
|
}
|
|
51496
51627
|
function recordingStarted() {
|
|
51497
51628
|
setCaptureState({ shouldCapture: true, reason: 'recording started' });
|
|
@@ -51511,12 +51642,12 @@ function ConsoleCapture() {
|
|
|
51511
51642
|
}
|
|
51512
51643
|
function addIntercepts() {
|
|
51513
51644
|
_.each(CONSOLE_METHODS, function (methodName) {
|
|
51514
|
-
|
|
51645
|
+
const originalMethod = console[methodName];
|
|
51515
51646
|
if (!originalMethod)
|
|
51516
51647
|
return;
|
|
51517
51648
|
console[methodName] = _.wrap(originalMethod, function (originalFn) {
|
|
51518
51649
|
// slice 1 to omit originalFn
|
|
51519
|
-
|
|
51650
|
+
const args = _.toArray(arguments).slice(1);
|
|
51520
51651
|
originalFn.apply(console, args);
|
|
51521
51652
|
createConsoleEvent(args, methodName);
|
|
51522
51653
|
});
|
|
@@ -51528,10 +51659,10 @@ function ConsoleCapture() {
|
|
|
51528
51659
|
function securityPolicyViolationFn(evt) {
|
|
51529
51660
|
if (!evt || typeof evt !== 'object')
|
|
51530
51661
|
return;
|
|
51531
|
-
|
|
51532
|
-
|
|
51533
|
-
|
|
51534
|
-
|
|
51662
|
+
const { blockedURI, violatedDirective, effectiveDirective, disposition, originalPolicy } = evt;
|
|
51663
|
+
const directive = violatedDirective || effectiveDirective;
|
|
51664
|
+
const isReportOnly = disposition === 'report';
|
|
51665
|
+
const message = createCspViolationMessage(blockedURI, directive, isReportOnly, originalPolicy);
|
|
51535
51666
|
if (isReportOnly) {
|
|
51536
51667
|
createConsoleEvent([message], 'warn', { skipStackTrace: true, skipScrubPII: true });
|
|
51537
51668
|
}
|
|
@@ -51539,13 +51670,12 @@ function ConsoleCapture() {
|
|
|
51539
51670
|
createConsoleEvent([message], 'error', { skipStackTrace: true, skipScrubPII: true });
|
|
51540
51671
|
}
|
|
51541
51672
|
}
|
|
51542
|
-
function createConsoleEvent(args, methodName,
|
|
51543
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.skipStackTrace, skipStackTrace = _c === void 0 ? false : _c, _d = _b.skipScrubPII, skipScrubPII = _d === void 0 ? false : _d;
|
|
51673
|
+
function createConsoleEvent(args, methodName, { skipStackTrace = false, skipScrubPII = false } = {}) {
|
|
51544
51674
|
if (!isCapturingConsoleLogs || !args || args.length === 0 || !_.contains(CONSOLE_METHODS, methodName))
|
|
51545
51675
|
return;
|
|
51546
51676
|
// stringify args
|
|
51547
|
-
|
|
51548
|
-
|
|
51677
|
+
let message = _.compact(_.map(args, arg => {
|
|
51678
|
+
let stringifiedArg;
|
|
51549
51679
|
try {
|
|
51550
51680
|
stringifiedArg = stringify(arg);
|
|
51551
51681
|
}
|
|
@@ -51557,22 +51687,22 @@ function ConsoleCapture() {
|
|
|
51557
51687
|
if (!message)
|
|
51558
51688
|
return;
|
|
51559
51689
|
// capture stack trace
|
|
51560
|
-
|
|
51690
|
+
let stackTrace = '';
|
|
51561
51691
|
if (!skipStackTrace) {
|
|
51562
|
-
|
|
51692
|
+
const maxStackFrames = methodName === 'error' ? 4 : 1;
|
|
51563
51693
|
stackTrace = captureStackTrace(maxStackFrames);
|
|
51564
51694
|
}
|
|
51565
51695
|
// truncate message and stack trace
|
|
51566
51696
|
message = truncate(message);
|
|
51567
51697
|
stackTrace = truncate(stackTrace);
|
|
51568
51698
|
// de-duplicate log
|
|
51569
|
-
|
|
51699
|
+
const logKey = generateLogKey(methodName, message, stackTrace);
|
|
51570
51700
|
if (isExistingDuplicateLog(logKey)) {
|
|
51571
51701
|
buffer.lastEvent.devLogCount++;
|
|
51572
51702
|
return;
|
|
51573
51703
|
}
|
|
51574
|
-
|
|
51575
|
-
|
|
51704
|
+
const devLogEnvelope = createDevLogEnvelope(pluginAPI, globalPendo);
|
|
51705
|
+
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 });
|
|
51576
51706
|
if (!buffer.hasTokenAvailable())
|
|
51577
51707
|
return consoleEvent;
|
|
51578
51708
|
if (!isPtmPaused) {
|
|
@@ -51584,8 +51714,8 @@ function ConsoleCapture() {
|
|
|
51584
51714
|
}
|
|
51585
51715
|
function captureStackTrace(maxStackFrames) {
|
|
51586
51716
|
try {
|
|
51587
|
-
|
|
51588
|
-
return _.map(stackFrames,
|
|
51717
|
+
const stackFrames = ErrorStackParser.parse(new Error(), maxStackFrames);
|
|
51718
|
+
return _.map(stackFrames, frame => frame.toString()).join('\n');
|
|
51589
51719
|
}
|
|
51590
51720
|
catch (error) {
|
|
51591
51721
|
return '';
|
|
@@ -51597,22 +51727,21 @@ function ConsoleCapture() {
|
|
|
51597
51727
|
function updateLastLog(logKey) {
|
|
51598
51728
|
lastLogKey = logKey;
|
|
51599
51729
|
}
|
|
51600
|
-
function send(
|
|
51601
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.unload, unload = _c === void 0 ? false : _c, _d = _b.hidden, hidden = _d === void 0 ? false : _d;
|
|
51730
|
+
function send({ unload = false, hidden = false } = {}) {
|
|
51602
51731
|
if (!buffer || buffer.isEmpty())
|
|
51603
51732
|
return;
|
|
51604
51733
|
if (!globalPendo.isSendingEvents()) {
|
|
51605
51734
|
buffer.clear();
|
|
51606
51735
|
return;
|
|
51607
51736
|
}
|
|
51608
|
-
|
|
51737
|
+
const payloads = buffer.pack();
|
|
51609
51738
|
if (!payloads || payloads.length === 0)
|
|
51610
51739
|
return;
|
|
51611
51740
|
if (unload || hidden) {
|
|
51612
51741
|
sendQueue.drain(payloads, unload);
|
|
51613
51742
|
}
|
|
51614
51743
|
else {
|
|
51615
|
-
sendQueue.push
|
|
51744
|
+
sendQueue.push(...payloads);
|
|
51616
51745
|
}
|
|
51617
51746
|
}
|
|
51618
51747
|
function teardown() {
|
|
@@ -51636,7 +51765,7 @@ function ConsoleCapture() {
|
|
|
51636
51765
|
_.each(CONSOLE_METHODS, function (methodName) {
|
|
51637
51766
|
if (!console[methodName])
|
|
51638
51767
|
return _.noop;
|
|
51639
|
-
|
|
51768
|
+
const unwrap = console[methodName]._pendoUnwrap;
|
|
51640
51769
|
if (_.isFunction(unwrap)) {
|
|
51641
51770
|
unwrap();
|
|
51642
51771
|
}
|
|
@@ -52042,20 +52171,18 @@ function NetworkCapture() {
|
|
|
52042
52171
|
}
|
|
52043
52172
|
}
|
|
52044
52173
|
|
|
52045
|
-
|
|
52046
|
-
|
|
52047
|
-
|
|
52048
|
-
|
|
52049
|
-
|
|
52050
|
-
|
|
52051
|
-
|
|
52052
|
-
|
|
52053
|
-
|
|
52054
|
-
|
|
52055
|
-
|
|
52056
|
-
|
|
52057
|
-
for (var i = 0; i < entries.length; i++) {
|
|
52058
|
-
var _a = entries[i], key = _a[0], value = _a[1];
|
|
52174
|
+
const PREDICT_STEP_REGEX = /\$\$predict\$\$/;
|
|
52175
|
+
const DRAG_THRESHOLD = 5;
|
|
52176
|
+
const STYLE_ID = 'pendo-predict-plugin-styles';
|
|
52177
|
+
const PREDICT_BASE_URL = 'https://predict.pendo.io';
|
|
52178
|
+
const GUIDE_BUTTON_IDENTIFIER = 'button:contains("token")';
|
|
52179
|
+
const pluginVersion = '1.0.1';
|
|
52180
|
+
const $ = (id) => document.getElementById(id);
|
|
52181
|
+
const createElement = (tag, attrs = {}, parent = null) => {
|
|
52182
|
+
const el = document.createElement(tag);
|
|
52183
|
+
const entries = Object.entries(attrs);
|
|
52184
|
+
for (let i = 0; i < entries.length; i++) {
|
|
52185
|
+
const [key, value] = entries[i];
|
|
52059
52186
|
if (key === 'className')
|
|
52060
52187
|
el.className = value;
|
|
52061
52188
|
else if (key === 'innerHTML')
|
|
@@ -52067,28 +52194,69 @@ var createElement = function (tag, attrs, parent) {
|
|
|
52067
52194
|
parent.appendChild(el);
|
|
52068
52195
|
return el;
|
|
52069
52196
|
};
|
|
52070
|
-
|
|
52071
|
-
|
|
52072
|
-
var styleId = "".concat(STYLE_ID, "-").concat(pendoContainerId);
|
|
52197
|
+
const injectStyles = (pendoContainerId, log = () => { }) => {
|
|
52198
|
+
const styleId = `${STYLE_ID}-${pendoContainerId}`;
|
|
52073
52199
|
if ($(styleId)) {
|
|
52074
|
-
log(
|
|
52200
|
+
log(`[predict] style already exists, skipping: ${styleId}`);
|
|
52075
52201
|
return;
|
|
52076
52202
|
}
|
|
52077
|
-
log(
|
|
52203
|
+
log(`[predict] injecting styles: ${styleId}`);
|
|
52078
52204
|
createElement('style', {
|
|
52079
52205
|
id: styleId,
|
|
52080
|
-
textContent:
|
|
52206
|
+
textContent: `
|
|
52207
|
+
#${pendoContainerId} {
|
|
52208
|
+
display: none !important;
|
|
52209
|
+
}
|
|
52210
|
+
.frame-explanation {
|
|
52211
|
+
aspect-ratio: 16/9; overflow: hidden; min-height: 300px;
|
|
52212
|
+
width: 100vw; height: 100vh; background: transparent;
|
|
52213
|
+
position: fixed; bottom: 0; right: 0; z-index: 999999; border: none;
|
|
52214
|
+
visibility: hidden; opacity: 0; pointer-events: none;
|
|
52215
|
+
transition: opacity 0.1s ease-out, visibility 0s linear 0.1s;
|
|
52216
|
+
display: none;
|
|
52217
|
+
}
|
|
52218
|
+
.frame-explanation.is-visible {
|
|
52219
|
+
visibility: visible; opacity: 1; pointer-events: auto;
|
|
52220
|
+
transition: opacity 0.1s ease-out, visibility 0s linear 0s;
|
|
52221
|
+
}
|
|
52222
|
+
.frame-explanation.is-exists {
|
|
52223
|
+
display: block !important;
|
|
52224
|
+
}
|
|
52225
|
+
.floating-modal-container {
|
|
52226
|
+
position: fixed; top: 20px; right: 20px; z-index: 500000;
|
|
52227
|
+
visibility: hidden; opacity: 0; pointer-events: none;
|
|
52228
|
+
transition: opacity 0.1s ease-out, visibility 0s linear 0.1s;
|
|
52229
|
+
border-radius: 8px; box-shadow: 0px 4px 12px 0px rgba(0,0,0,0.15);
|
|
52230
|
+
overflow: hidden; width: 384px; height: 176px;
|
|
52231
|
+
}
|
|
52232
|
+
.floating-modal-container.is-visible {
|
|
52233
|
+
visibility: visible; opacity: 1; pointer-events: auto;
|
|
52234
|
+
transition: opacity 0.1s ease-out, visibility 0s linear 0s;
|
|
52235
|
+
}
|
|
52236
|
+
.floating-modal-container.is-dragging { will-change: left, top; }
|
|
52237
|
+
.floating-modal-drag-handle {
|
|
52238
|
+
position: absolute; left: 50%; transform: translateX(-50%);
|
|
52239
|
+
top: 5px; width: calc(100% - 46px); min-width: 166px; height: 17px;
|
|
52240
|
+
z-index: 9999; transition: left 0.2s ease, right 0.2s ease;
|
|
52241
|
+
display: flex; justify-content: center; align-items: center;
|
|
52242
|
+
}
|
|
52243
|
+
.floating-modal-drag-handle svg g { fill: #A0A0A0; }
|
|
52244
|
+
.floating-modal-drag-handle:hover { cursor: grab; }
|
|
52245
|
+
.floating-modal-drag-handle:hover svg g { fill: #1f2937; }
|
|
52246
|
+
.floating-modal-drag-handle.is-dragging { cursor: grabbing; }
|
|
52247
|
+
.floating-modal-drag-handle.is-collapsed { top: 0px; }
|
|
52248
|
+
.frame-floating-modal { width: 100%; height: 100%; background: white; border: none; display: block; }
|
|
52249
|
+
`
|
|
52081
52250
|
}, document.head);
|
|
52082
52251
|
};
|
|
52083
|
-
|
|
52252
|
+
const getRecordIdFromUrl = (recordRegex, log = () => { }) => {
|
|
52084
52253
|
var _a;
|
|
52085
|
-
|
|
52086
|
-
|
|
52087
|
-
|
|
52088
|
-
log("[predict] recordId found: ".concat(recordId));
|
|
52254
|
+
const match = window.location.href.match(recordRegex);
|
|
52255
|
+
const recordId = (_a = match === null || match === void 0 ? void 0 : match[1]) !== null && _a !== void 0 ? _a : null;
|
|
52256
|
+
log(`[predict] recordId found: ${recordId}`);
|
|
52089
52257
|
return recordId;
|
|
52090
52258
|
};
|
|
52091
|
-
|
|
52259
|
+
const safeStringify = (value, fallback) => {
|
|
52092
52260
|
try {
|
|
52093
52261
|
return JSON.stringify(value);
|
|
52094
52262
|
}
|
|
@@ -52096,22 +52264,21 @@ var safeStringify = function (value, fallback) {
|
|
|
52096
52264
|
return fallback !== null && fallback !== void 0 ? fallback : '';
|
|
52097
52265
|
}
|
|
52098
52266
|
};
|
|
52099
|
-
|
|
52100
|
-
if (log === void 0) { log = function () { }; }
|
|
52267
|
+
const safeParse = (value, fallback, log = () => { }) => {
|
|
52101
52268
|
try {
|
|
52102
52269
|
return JSON.parse(value);
|
|
52103
52270
|
}
|
|
52104
52271
|
catch (error) {
|
|
52105
|
-
log(
|
|
52272
|
+
log(`[predict] JSON parse error: ${error}`);
|
|
52106
52273
|
return fallback;
|
|
52107
52274
|
}
|
|
52108
52275
|
};
|
|
52109
|
-
|
|
52110
|
-
|
|
52111
|
-
|
|
52276
|
+
const buildQueryParams = (params) => {
|
|
52277
|
+
const urlParams = new URLSearchParams();
|
|
52278
|
+
const entries = Object.entries(params);
|
|
52112
52279
|
urlParams.set('pluginVersion', pluginVersion);
|
|
52113
|
-
for (
|
|
52114
|
-
|
|
52280
|
+
for (let i = 0; i < entries.length; i++) {
|
|
52281
|
+
const [key, value] = entries[i];
|
|
52115
52282
|
if (value != null) {
|
|
52116
52283
|
urlParams.set(key, typeof value === 'object' ? safeStringify(value) : String(value));
|
|
52117
52284
|
}
|
|
@@ -52119,17 +52286,17 @@ var buildQueryParams = function (params) {
|
|
|
52119
52286
|
return urlParams.toString();
|
|
52120
52287
|
};
|
|
52121
52288
|
// ----- Drag & Drop -----
|
|
52122
|
-
|
|
52123
|
-
|
|
52124
|
-
|
|
52125
|
-
|
|
52126
|
-
|
|
52127
|
-
|
|
52128
|
-
|
|
52129
|
-
|
|
52130
|
-
|
|
52131
|
-
|
|
52132
|
-
|
|
52289
|
+
const setupDragAndDrop = (handle, container) => {
|
|
52290
|
+
let isDragging = false;
|
|
52291
|
+
let hasMoved = false;
|
|
52292
|
+
let isCollapsed = false;
|
|
52293
|
+
let startX = 0;
|
|
52294
|
+
let startY = 0;
|
|
52295
|
+
let initialLeft = 0;
|
|
52296
|
+
let initialTop = 0;
|
|
52297
|
+
let rafId = null;
|
|
52298
|
+
const iframe = container.querySelector('iframe');
|
|
52299
|
+
const onMouseDown = (e) => {
|
|
52133
52300
|
if (e.button !== 0)
|
|
52134
52301
|
return;
|
|
52135
52302
|
e.preventDefault();
|
|
@@ -52139,35 +52306,35 @@ var setupDragAndDrop = function (handle, container) {
|
|
|
52139
52306
|
container.classList.add('is-dragging');
|
|
52140
52307
|
if (iframe)
|
|
52141
52308
|
iframe.style.pointerEvents = 'none';
|
|
52142
|
-
|
|
52309
|
+
const rect = container.getBoundingClientRect();
|
|
52143
52310
|
initialLeft = rect.left;
|
|
52144
52311
|
initialTop = rect.top;
|
|
52145
|
-
container.style.left =
|
|
52312
|
+
container.style.left = `${initialLeft}px`;
|
|
52146
52313
|
container.style.right = 'auto';
|
|
52147
52314
|
startX = e.clientX;
|
|
52148
52315
|
startY = e.clientY;
|
|
52149
52316
|
document.addEventListener('mousemove', onMouseMove);
|
|
52150
52317
|
document.addEventListener('mouseup', onMouseUp);
|
|
52151
52318
|
};
|
|
52152
|
-
|
|
52319
|
+
const onMouseMove = (e) => {
|
|
52153
52320
|
if (!isDragging)
|
|
52154
52321
|
return;
|
|
52155
|
-
|
|
52156
|
-
|
|
52322
|
+
const deltaX = e.clientX - startX;
|
|
52323
|
+
const deltaY = e.clientY - startY;
|
|
52157
52324
|
if (Math.abs(deltaX) > DRAG_THRESHOLD || Math.abs(deltaY) > DRAG_THRESHOLD) {
|
|
52158
52325
|
hasMoved = true;
|
|
52159
52326
|
}
|
|
52160
52327
|
if (rafId)
|
|
52161
52328
|
cancelAnimationFrame(rafId);
|
|
52162
|
-
rafId = requestAnimationFrame(
|
|
52163
|
-
|
|
52164
|
-
|
|
52165
|
-
|
|
52166
|
-
container.style.left =
|
|
52167
|
-
container.style.top =
|
|
52329
|
+
rafId = requestAnimationFrame(() => {
|
|
52330
|
+
const rect = container.getBoundingClientRect();
|
|
52331
|
+
const newLeft = Math.max(0, Math.min(initialLeft + deltaX, window.innerWidth - rect.width));
|
|
52332
|
+
const newTop = Math.max(0, Math.min(initialTop + deltaY, window.innerHeight - rect.height));
|
|
52333
|
+
container.style.left = `${newLeft}px`;
|
|
52334
|
+
container.style.top = `${newTop}px`;
|
|
52168
52335
|
});
|
|
52169
52336
|
};
|
|
52170
|
-
|
|
52337
|
+
const onMouseUp = (e) => {
|
|
52171
52338
|
var _a;
|
|
52172
52339
|
if (!isDragging)
|
|
52173
52340
|
return;
|
|
@@ -52185,12 +52352,12 @@ var setupDragAndDrop = function (handle, container) {
|
|
|
52185
52352
|
(_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage({ type: 'TRIGGER_EXPAND' }, PREDICT_BASE_URL);
|
|
52186
52353
|
}
|
|
52187
52354
|
};
|
|
52188
|
-
handle.setCollapsedState =
|
|
52355
|
+
handle.setCollapsedState = (collapsed) => {
|
|
52189
52356
|
isCollapsed = collapsed;
|
|
52190
52357
|
handle.classList.toggle('is-collapsed', collapsed);
|
|
52191
52358
|
};
|
|
52192
52359
|
handle.addEventListener('mousedown', onMouseDown);
|
|
52193
|
-
handle.cleanup =
|
|
52360
|
+
handle.cleanup = () => {
|
|
52194
52361
|
handle.removeEventListener('mousedown', onMouseDown);
|
|
52195
52362
|
document.removeEventListener('mousemove', onMouseMove);
|
|
52196
52363
|
document.removeEventListener('mouseup', onMouseUp);
|
|
@@ -52200,13 +52367,12 @@ var setupDragAndDrop = function (handle, container) {
|
|
|
52200
52367
|
return handle;
|
|
52201
52368
|
};
|
|
52202
52369
|
// ----- Explanation Iframe Creation -----
|
|
52203
|
-
|
|
52204
|
-
var
|
|
52205
|
-
|
|
52206
|
-
|
|
52207
|
-
|
|
52208
|
-
|
|
52209
|
-
var params = buildQueryParams(configuration);
|
|
52370
|
+
const createExplanationIframe = ({ analysisId, recordId, configuration }) => {
|
|
52371
|
+
var _a;
|
|
52372
|
+
const frameId = `frameExplanation-${analysisId}`;
|
|
52373
|
+
(_a = $(frameId)) === null || _a === void 0 ? void 0 : _a.remove();
|
|
52374
|
+
const base = `${PREDICT_BASE_URL}/external/analysis/${analysisId}/prediction/drilldown/${recordId}`;
|
|
52375
|
+
const params = buildQueryParams(configuration);
|
|
52210
52376
|
createElement('iframe', {
|
|
52211
52377
|
id: frameId,
|
|
52212
52378
|
className: 'frame-explanation',
|
|
@@ -52214,24 +52380,28 @@ var createExplanationIframe = function (_a) {
|
|
|
52214
52380
|
loading: 'lazy',
|
|
52215
52381
|
referrerPolicy: 'strict-origin-when-cross-origin',
|
|
52216
52382
|
allowFullscreen: true,
|
|
52217
|
-
src:
|
|
52383
|
+
src: `${base}?${params}`
|
|
52218
52384
|
}, document.body);
|
|
52219
52385
|
};
|
|
52220
52386
|
// ----- Floating Modal Creation -----
|
|
52221
|
-
|
|
52222
|
-
var
|
|
52223
|
-
|
|
52224
|
-
|
|
52225
|
-
|
|
52226
|
-
|
|
52227
|
-
}
|
|
52228
|
-
|
|
52229
|
-
var dragHandle = createElement('div', {
|
|
52387
|
+
const createFloatingModal = ({ recordId, configuration }) => {
|
|
52388
|
+
var _a;
|
|
52389
|
+
const flatIds = (_a = configuration.analysisIds) === null || _a === void 0 ? void 0 : _a.flat(Infinity);
|
|
52390
|
+
for (let i = 0; i < flatIds.length; i++) {
|
|
52391
|
+
createExplanationIframe({ analysisId: flatIds[i], recordId, configuration });
|
|
52392
|
+
}
|
|
52393
|
+
const container = createElement('div', { id: 'floatingModalContainer', className: 'floating-modal-container' }, document.body);
|
|
52394
|
+
const dragHandle = createElement('div', {
|
|
52230
52395
|
className: 'floating-modal-drag-handle',
|
|
52231
|
-
innerHTML:
|
|
52396
|
+
innerHTML: `<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
|
|
52397
|
+
<g fill="#EBEBEB">
|
|
52398
|
+
<circle cx="3.33" cy="6" r="1.5"/><circle cx="8" cy="6" r="1.5"/><circle cx="12.67" cy="6" r="1.5"/>
|
|
52399
|
+
<circle cx="3.33" cy="10" r="1.5"/><circle cx="8" cy="10" r="1.5"/><circle cx="12.67" cy="10" r="1.5"/>
|
|
52400
|
+
</g>
|
|
52401
|
+
</svg>`
|
|
52232
52402
|
}, container);
|
|
52233
|
-
|
|
52234
|
-
|
|
52403
|
+
const baseUrl = `${PREDICT_BASE_URL}/external/analysis/prediction/summary/${recordId}`;
|
|
52404
|
+
const params = buildQueryParams(configuration);
|
|
52235
52405
|
createElement('iframe', {
|
|
52236
52406
|
id: 'frameFloatingModal',
|
|
52237
52407
|
className: 'frame-floating-modal',
|
|
@@ -52239,136 +52409,133 @@ var createFloatingModal = function (_a) {
|
|
|
52239
52409
|
referrerPolicy: 'strict-origin-when-cross-origin',
|
|
52240
52410
|
allowFullscreen: true,
|
|
52241
52411
|
title: 'Floating Modal',
|
|
52242
|
-
src:
|
|
52412
|
+
src: `${baseUrl}?${params}`
|
|
52243
52413
|
}, container);
|
|
52244
52414
|
container.dragHandle = setupDragAndDrop(dragHandle, container);
|
|
52245
|
-
return
|
|
52415
|
+
return () => {
|
|
52246
52416
|
var _a, _b;
|
|
52247
52417
|
(_b = (_a = container.dragHandle) === null || _a === void 0 ? void 0 : _a.cleanup) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
52248
52418
|
container.remove();
|
|
52249
|
-
for (
|
|
52250
|
-
|
|
52419
|
+
for (let i = 0; i < flatIds.length; i++) {
|
|
52420
|
+
const frame = $(`frameExplanation-${flatIds[i]}`);
|
|
52251
52421
|
if (frame)
|
|
52252
52422
|
frame.remove();
|
|
52253
52423
|
}
|
|
52254
52424
|
};
|
|
52255
52425
|
};
|
|
52256
|
-
|
|
52257
|
-
|
|
52258
|
-
|
|
52259
|
-
var _b;
|
|
52260
|
-
var origin = _a.origin, data = _a.data;
|
|
52426
|
+
const setupMessageListener = ({ token, forceAccountId, cleanup, pendo }) => {
|
|
52427
|
+
const messageHandler = ({ origin, data }) => {
|
|
52428
|
+
var _a;
|
|
52261
52429
|
if (origin !== PREDICT_BASE_URL || !data || typeof data !== 'object')
|
|
52262
52430
|
return;
|
|
52263
|
-
|
|
52264
|
-
|
|
52265
|
-
|
|
52266
|
-
|
|
52431
|
+
const { type, analysisId, height, width } = data;
|
|
52432
|
+
const explanationFrame = $(`frameExplanation-${analysisId}`);
|
|
52433
|
+
const floatingModal = $('floatingModalContainer');
|
|
52434
|
+
const setFloatingModalSize = () => {
|
|
52267
52435
|
if (floatingModal) {
|
|
52268
|
-
floatingModal.style.height =
|
|
52269
|
-
floatingModal.style.width =
|
|
52436
|
+
floatingModal.style.height = `${height}px`;
|
|
52437
|
+
floatingModal.style.width = `${width}px`;
|
|
52270
52438
|
}
|
|
52271
52439
|
};
|
|
52272
|
-
|
|
52440
|
+
const setFloatingModalCollapsedState = (collapsed) => {
|
|
52273
52441
|
var _a, _b;
|
|
52274
52442
|
if (floatingModal)
|
|
52275
52443
|
(_b = (_a = floatingModal.dragHandle) === null || _a === void 0 ? void 0 : _a.setCollapsedState) === null || _b === void 0 ? void 0 : _b.call(_a, collapsed);
|
|
52276
52444
|
};
|
|
52277
|
-
|
|
52278
|
-
MODAL_INITIALIZED:
|
|
52445
|
+
const actions = {
|
|
52446
|
+
MODAL_INITIALIZED: () => {
|
|
52279
52447
|
var _a, _b, _c;
|
|
52280
|
-
|
|
52448
|
+
const iframe = $('frameFloatingModal');
|
|
52281
52449
|
if (iframe) {
|
|
52282
|
-
|
|
52283
|
-
|
|
52284
|
-
|
|
52450
|
+
let idToken = null;
|
|
52451
|
+
let extensionAPIKeys = null;
|
|
52452
|
+
const retrieveIDPToken = pendo.getConfigValue('retrieveIDPToken');
|
|
52285
52453
|
if (pendo._.isFunction(retrieveIDPToken)) {
|
|
52286
|
-
|
|
52454
|
+
const result = retrieveIDPToken();
|
|
52287
52455
|
if (result) {
|
|
52288
52456
|
idToken = result.idToken;
|
|
52289
52457
|
extensionAPIKeys = result.extensionAPIKeys;
|
|
52290
52458
|
}
|
|
52291
52459
|
}
|
|
52292
|
-
|
|
52293
|
-
|
|
52294
|
-
(_c = iframe.contentWindow) === null || _c === void 0 ? void 0 : _c.postMessage({ type: 'TOKEN_RECEIVED', token
|
|
52460
|
+
const visitorId = (_a = pendo === null || pendo === void 0 ? void 0 : pendo.getVisitorId) === null || _a === void 0 ? void 0 : _a.call(pendo);
|
|
52461
|
+
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);
|
|
52462
|
+
(_c = iframe.contentWindow) === null || _c === void 0 ? void 0 : _c.postMessage({ type: 'TOKEN_RECEIVED', token, idToken, extensionAPIKeys, visitorId, accountId }, PREDICT_BASE_URL);
|
|
52295
52463
|
}
|
|
52296
52464
|
},
|
|
52297
|
-
OPEN_EXPLANATION:
|
|
52465
|
+
OPEN_EXPLANATION: () => {
|
|
52298
52466
|
var _a;
|
|
52299
52467
|
explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.add('is-visible');
|
|
52300
52468
|
(_a = explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(data, PREDICT_BASE_URL);
|
|
52301
52469
|
},
|
|
52302
|
-
CLOSE_EXPLANATION:
|
|
52303
|
-
AUTH_ERROR_EXPLANATION:
|
|
52470
|
+
CLOSE_EXPLANATION: () => explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.remove('is-visible'),
|
|
52471
|
+
AUTH_ERROR_EXPLANATION: () => {
|
|
52304
52472
|
explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.remove('is-visible');
|
|
52305
|
-
|
|
52473
|
+
const iframe = $('frameFloatingModal');
|
|
52306
52474
|
// eslint-disable-next-line no-self-assign
|
|
52307
52475
|
if (iframe)
|
|
52308
52476
|
iframe.src = iframe.src;
|
|
52309
52477
|
},
|
|
52310
|
-
DATA_READY:
|
|
52478
|
+
DATA_READY: () => {
|
|
52311
52479
|
floatingModal === null || floatingModal === void 0 ? void 0 : floatingModal.classList.add('is-visible');
|
|
52312
52480
|
setFloatingModalSize();
|
|
52313
52481
|
// Use analysisIds from the message data if available, otherwise use all IDs
|
|
52314
|
-
|
|
52315
|
-
for (
|
|
52316
|
-
|
|
52482
|
+
const idsToShow = data.analysisIds || [];
|
|
52483
|
+
for (let i = 0; i < idsToShow.length; i++) {
|
|
52484
|
+
const frame = $(`frameExplanation-${idsToShow[i]}`);
|
|
52317
52485
|
if (frame)
|
|
52318
52486
|
frame.classList.add('is-exists');
|
|
52319
52487
|
}
|
|
52320
52488
|
},
|
|
52321
|
-
AUTH_ERROR:
|
|
52489
|
+
AUTH_ERROR: () => {
|
|
52322
52490
|
floatingModal === null || floatingModal === void 0 ? void 0 : floatingModal.classList.add('is-visible');
|
|
52323
52491
|
setFloatingModalSize();
|
|
52324
52492
|
},
|
|
52325
52493
|
CLOSE_FLOATING_MODAL: cleanup,
|
|
52326
|
-
EXPAND_FLOATING_MODAL:
|
|
52494
|
+
EXPAND_FLOATING_MODAL: () => {
|
|
52327
52495
|
setFloatingModalSize();
|
|
52328
52496
|
setFloatingModalCollapsedState(false);
|
|
52329
52497
|
},
|
|
52330
|
-
COLLAPSE_FLOATING_MODAL:
|
|
52498
|
+
COLLAPSE_FLOATING_MODAL: () => {
|
|
52331
52499
|
setFloatingModalSize();
|
|
52332
52500
|
setFloatingModalCollapsedState(true);
|
|
52333
52501
|
}
|
|
52334
52502
|
};
|
|
52335
52503
|
if (type && type in actions) {
|
|
52336
|
-
(
|
|
52504
|
+
(_a = actions === null || actions === void 0 ? void 0 : actions[type]) === null || _a === void 0 ? void 0 : _a.call(actions);
|
|
52337
52505
|
}
|
|
52338
52506
|
};
|
|
52339
52507
|
window.addEventListener('message', messageHandler);
|
|
52340
|
-
return
|
|
52508
|
+
return () => window.removeEventListener('message', messageHandler);
|
|
52341
52509
|
};
|
|
52342
|
-
|
|
52343
|
-
var
|
|
52344
|
-
var step = _a.step, pendo = _a.pendo, cleanupArray = _a.cleanupArray, cleanup = _a.cleanup, log = _a.log;
|
|
52510
|
+
const predictGuidesScript = ({ step, pendo, cleanupArray, cleanup, log }) => {
|
|
52511
|
+
var _a;
|
|
52345
52512
|
log('[predict] initializing');
|
|
52346
52513
|
// Before anything else, inject styles so that the guide will be hidden
|
|
52347
|
-
|
|
52514
|
+
const pendoContainerId = step === null || step === void 0 ? void 0 : step.containerId;
|
|
52348
52515
|
injectStyles(pendoContainerId, log);
|
|
52349
52516
|
if (cleanupArray.length > 0) {
|
|
52350
52517
|
log('[predict] cleanupArray is not empty');
|
|
52351
52518
|
return;
|
|
52352
52519
|
}
|
|
52353
52520
|
// ----- Extract Configuration -----
|
|
52354
|
-
|
|
52521
|
+
const guideButton = (_a = step.guideElement.find(GUIDE_BUTTON_IDENTIFIER)) === null || _a === void 0 ? void 0 : _a[0];
|
|
52355
52522
|
if (!guideButton) {
|
|
52356
52523
|
log('[predict] no guide button found, aborting');
|
|
52357
52524
|
return;
|
|
52358
52525
|
}
|
|
52359
|
-
|
|
52526
|
+
const _b = safeParse(guideButton.textContent, {}, log), { token } = _b, configuration = __rest(_b, ["token"]);
|
|
52360
52527
|
if (!configuration || !token) {
|
|
52361
52528
|
log('[predict] no configuration found, aborting');
|
|
52362
52529
|
return;
|
|
52363
52530
|
}
|
|
52364
|
-
|
|
52365
|
-
|
|
52531
|
+
const recordRegex = new RegExp(`/${configuration.recordRegexName}/([a-zA-Z0-9]+)(?:/|$)`);
|
|
52532
|
+
const recordId = getRecordIdFromUrl(recordRegex, log);
|
|
52366
52533
|
if (!recordId) {
|
|
52367
52534
|
log('[predict] no recordId found in URL, aborting');
|
|
52368
52535
|
return;
|
|
52369
52536
|
}
|
|
52370
|
-
cleanupArray.push(setupMessageListener({ token
|
|
52371
|
-
cleanupArray.push(createFloatingModal({ recordId
|
|
52537
|
+
cleanupArray.push(setupMessageListener({ token, forceAccountId: configuration === null || configuration === void 0 ? void 0 : configuration.forceAccountId, cleanup, pendo }));
|
|
52538
|
+
cleanupArray.push(createFloatingModal({ recordId, configuration }));
|
|
52372
52539
|
};
|
|
52373
52540
|
|
|
52374
52541
|
const PredictGuides = () => {
|