@pendo/agent 2.330.1 → 2.330.2
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 +7 -3
- package/dist/pendo.module.js +799 -806
- package/dist/pendo.module.min.js +3 -101
- package/dist/servers.json +7 -7
- package/package.json +1 -1
package/dist/pendo.module.js
CHANGED
|
@@ -4010,8 +4010,8 @@ let SERVER = '';
|
|
|
4010
4010
|
let ASSET_HOST = '';
|
|
4011
4011
|
let ASSET_PATH = '';
|
|
4012
4012
|
let DESIGNER_SERVER = '';
|
|
4013
|
-
let VERSION = '2.330.
|
|
4014
|
-
let PACKAGE_VERSION = '2.330.
|
|
4013
|
+
let VERSION = '2.330.2_';
|
|
4014
|
+
let PACKAGE_VERSION = '2.330.2';
|
|
4015
4015
|
let LOADER = 'xhr';
|
|
4016
4016
|
/* eslint-enable web-sdk-eslint-rules/no-gulp-env-references */
|
|
4017
4017
|
/**
|
|
@@ -4592,11 +4592,15 @@ function clearCookie(name) {
|
|
|
4592
4592
|
// domain-scoped cookie can't be matched for deletion -- omitting it (or
|
|
4593
4593
|
// writing a blank value) leaves a permanent empty cookie that still costs
|
|
4594
4594
|
// request-header space via its name.
|
|
4595
|
-
var
|
|
4595
|
+
var expiry = '=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT';
|
|
4596
4596
|
if (cookieDomain) {
|
|
4597
|
-
cookie
|
|
4597
|
+
document.cookie = name + expiry + ';domain=' + cookieDomain;
|
|
4598
4598
|
}
|
|
4599
|
-
|
|
4599
|
+
// Also expire the host-only variant (no domain attribute). A domain-scoped
|
|
4600
|
+
// cookie and a host-only cookie with the same name are distinct, so if
|
|
4601
|
+
// cookieDomain was set/changed after the cookie was first written, the
|
|
4602
|
+
// other scope would otherwise be orphaned on the current host.
|
|
4603
|
+
document.cookie = name + expiry;
|
|
4600
4604
|
}
|
|
4601
4605
|
var getPendoCookieKey = function (name, cookieSuffix) {
|
|
4602
4606
|
return `_pendo_${name}.${cookieSuffix || pendo$1.apiKey}`;
|
|
@@ -41234,20 +41238,20 @@ function getZoneSafeMethod(_, method, target) {
|
|
|
41234
41238
|
}
|
|
41235
41239
|
|
|
41236
41240
|
// Does not support submit and go to
|
|
41237
|
-
|
|
41238
|
-
|
|
41241
|
+
var goToRegex = new RegExp(guideMarkdownUtil.goToString);
|
|
41242
|
+
var PollBranching = {
|
|
41239
41243
|
name: 'PollBranching',
|
|
41240
|
-
script(step, guide, pendo) {
|
|
41241
|
-
|
|
41242
|
-
|
|
41244
|
+
script: function (step, guide, pendo) {
|
|
41245
|
+
var isAdvanceIntercepted = false;
|
|
41246
|
+
var branchingQuestions = initialBranchingSetup(step, pendo);
|
|
41243
41247
|
if (branchingQuestions) {
|
|
41244
41248
|
// If there are too many branching questions saved, exit and run the guide normally.
|
|
41245
41249
|
if (pendo._.size(branchingQuestions) > 1)
|
|
41246
41250
|
return;
|
|
41247
|
-
this.on('beforeAdvance', (evt)
|
|
41248
|
-
|
|
41249
|
-
|
|
41250
|
-
|
|
41251
|
+
this.on('beforeAdvance', function (evt) {
|
|
41252
|
+
var noResponseSelected = step.guideElement.find('[branching] .pendo-radio:checked').length === 0;
|
|
41253
|
+
var responseLabel = step.guideElement.find('[branching] .pendo-radio:checked + label')[0];
|
|
41254
|
+
var noGotoLabel;
|
|
41251
41255
|
if (responseLabel) {
|
|
41252
41256
|
noGotoLabel = pendo._.isNull(responseLabel.getAttribute('goToStep'));
|
|
41253
41257
|
}
|
|
@@ -41258,58 +41262,58 @@ const PollBranching = {
|
|
|
41258
41262
|
});
|
|
41259
41263
|
}
|
|
41260
41264
|
},
|
|
41261
|
-
test(step, guide, pendo) {
|
|
41265
|
+
test: function (step, guide, pendo) {
|
|
41262
41266
|
var _a;
|
|
41263
|
-
|
|
41267
|
+
var branchingQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
|
|
41264
41268
|
return !pendo._.isUndefined(branchingQuestions) && pendo._.size(branchingQuestions);
|
|
41265
41269
|
},
|
|
41266
|
-
designerListener(pendo) {
|
|
41267
|
-
|
|
41268
|
-
|
|
41270
|
+
designerListener: function (pendo) {
|
|
41271
|
+
var target = pendo.dom.getBody();
|
|
41272
|
+
var config = {
|
|
41269
41273
|
attributeFilter: ['data-layout'],
|
|
41270
41274
|
attributes: true,
|
|
41271
41275
|
childList: true,
|
|
41272
41276
|
characterData: true,
|
|
41273
41277
|
subtree: true
|
|
41274
41278
|
};
|
|
41275
|
-
|
|
41276
|
-
|
|
41279
|
+
var MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
|
|
41280
|
+
var observer = new MutationObserver(applyBranchingIndicators);
|
|
41277
41281
|
observer.observe(target, config);
|
|
41278
41282
|
function applyBranchingIndicators(mutations) {
|
|
41279
41283
|
pendo._.each(mutations, function (mutation) {
|
|
41280
41284
|
var _a;
|
|
41281
|
-
|
|
41285
|
+
var nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelector);
|
|
41282
41286
|
if (mutation.addedNodes.length && nodeHasQuerySelector) {
|
|
41283
41287
|
if (mutation.addedNodes[0].querySelector('._pendo-multi-choice-poll-select-border')) {
|
|
41284
41288
|
if (pendo._.size(pendo.dom('._pendo-multi-choice-poll-question:contains("{branching/}")'))) {
|
|
41285
41289
|
pendo
|
|
41286
41290
|
.dom('._pendo-multi-choice-poll-question:contains("{branching/}")')
|
|
41287
|
-
.each((question, index)
|
|
41288
|
-
pendo._.each(pendo.dom(
|
|
41291
|
+
.each(function (question, index) {
|
|
41292
|
+
pendo._.each(pendo.dom("#".concat(question.id, " *")), function (element) {
|
|
41289
41293
|
guideMarkdownUtil.removeMarkdownSyntax(element, '{branching/}', '', pendo);
|
|
41290
41294
|
});
|
|
41291
41295
|
pendo
|
|
41292
|
-
.dom(
|
|
41296
|
+
.dom("#".concat(question.id, " p"))
|
|
41293
41297
|
.css({ display: 'inline-block !important' })
|
|
41294
41298
|
.append(branchingIcon('#999', '20px'))
|
|
41295
41299
|
.attr({ title: 'Custom Branching Added' });
|
|
41296
|
-
|
|
41297
|
-
if (pendo.dom(
|
|
41300
|
+
var dataPendoPollId = question.getAttribute('data-pendo-poll-id');
|
|
41301
|
+
if (pendo.dom("._pendo-multi-choice-poll-question[data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0]) {
|
|
41298
41302
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
41299
41303
|
pendo
|
|
41300
|
-
.dom(
|
|
41304
|
+
.dom("._pendo-multi-choice-poll-question[data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0]
|
|
41301
41305
|
.textContent.trim();
|
|
41302
41306
|
}
|
|
41303
|
-
|
|
41307
|
+
var pollLabels = pendo.dom("label[for*=".concat(dataPendoPollId, "]"));
|
|
41304
41308
|
if (pendo._.size(pollLabels)) {
|
|
41305
|
-
pendo._.forEach(pollLabels, (label)
|
|
41309
|
+
pendo._.forEach(pollLabels, function (label) {
|
|
41306
41310
|
if (goToRegex.test(label.textContent)) {
|
|
41307
|
-
|
|
41311
|
+
var labelTitle = goToRegex.exec(label.textContent)[2];
|
|
41308
41312
|
guideMarkdownUtil.removeMarkdownSyntax(label, goToRegex, '', pendo);
|
|
41309
41313
|
pendo
|
|
41310
41314
|
.dom(label)
|
|
41311
41315
|
.append(branchingIcon('#999', '14px'))
|
|
41312
|
-
.attr({ title:
|
|
41316
|
+
.attr({ title: "Branching to step ".concat(labelTitle) });
|
|
41313
41317
|
}
|
|
41314
41318
|
});
|
|
41315
41319
|
}
|
|
@@ -41317,9 +41321,9 @@ const PollBranching = {
|
|
|
41317
41321
|
pendo
|
|
41318
41322
|
.dom(question)
|
|
41319
41323
|
.append(branchingErrorHTML(question.dataset.pendoPollId));
|
|
41320
|
-
pendo.dom(
|
|
41324
|
+
pendo.dom("#".concat(question.id, " #pendo-ps-branching-svg")).remove();
|
|
41321
41325
|
pendo
|
|
41322
|
-
.dom(
|
|
41326
|
+
.dom("#".concat(question.id, " p"))
|
|
41323
41327
|
.css({ display: 'inline-block !important' })
|
|
41324
41328
|
.append(branchingIcon('red', '20px'))
|
|
41325
41329
|
.attr({ title: 'Unsupported Branching configuration' });
|
|
@@ -41331,49 +41335,31 @@ const PollBranching = {
|
|
|
41331
41335
|
});
|
|
41332
41336
|
}
|
|
41333
41337
|
function branchingErrorHTML(dataPendoPollId) {
|
|
41334
|
-
return
|
|
41335
|
-
font-style: italic; margin-top: 0px;" class="branching-wrapper"
|
|
41336
|
-
name="${dataPendoPollId}">
|
|
41337
|
-
* Branching Error: Multiple branching polls not supported</div>`;
|
|
41338
|
+
return "<div style=\"text-align:lrft; font-size: 14px; color: red;\n font-style: italic; margin-top: 0px;\" class=\"branching-wrapper\"\n name=\"".concat(dataPendoPollId, "\">\n * Branching Error: Multiple branching polls not supported</div>");
|
|
41338
41339
|
}
|
|
41339
41340
|
function branchingIcon(color, size) {
|
|
41340
|
-
return
|
|
41341
|
-
style="margin-left: 5px;
|
|
41342
|
-
height:${size}; width:${size}; display:inline; vertical-align:middle;" xmlns="http://www.w3.org/2000/svg">
|
|
41343
|
-
<g stroke-width="0"></g>
|
|
41344
|
-
<g stroke-linecap="round" stroke-linejoin="round"></g>
|
|
41345
|
-
<g> <circle cx="4" cy="7" r="2" stroke="${color}"
|
|
41346
|
-
stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></circle>
|
|
41347
|
-
<circle cx="20" cy="7" r="2" stroke="${color}"
|
|
41348
|
-
stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></circle>
|
|
41349
|
-
<circle cx="20" cy="17" r="2" stroke="${color}" stroke-width="2"
|
|
41350
|
-
stroke-linecap="round" stroke-linejoin="round"></circle>
|
|
41351
|
-
<path d="M18 7H6" stroke="${color}" stroke-width="2"
|
|
41352
|
-
stroke-linecap="round" stroke-linejoin="round"></path>
|
|
41353
|
-
<path d="M7 7V7C8.65685 7 10 8.34315 10 10V15C10 16.1046 10.8954 17 12 17H18"
|
|
41354
|
-
stroke="${color}" stroke-width="2" stroke-linecap="round"
|
|
41355
|
-
stroke-linejoin="round"></path> </g></svg>`;
|
|
41341
|
+
return "<svg id=\"pendo-ps-branching-svg\" viewBox=\"0 0 24 24\" fill=\"none\"\n style=\"margin-left: 5px;\n height:".concat(size, "; width:").concat(size, "; display:inline; vertical-align:middle;\" xmlns=\"http://www.w3.org/2000/svg\">\n <g stroke-width=\"0\"></g>\n <g stroke-linecap=\"round\" stroke-linejoin=\"round\"></g>\n <g> <circle cx=\"4\" cy=\"7\" r=\"2\" stroke=\"").concat(color, "\"\n stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></circle>\n <circle cx=\"20\" cy=\"7\" r=\"2\" stroke=\"").concat(color, "\"\n stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></circle>\n <circle cx=\"20\" cy=\"17\" r=\"2\" stroke=\"").concat(color, "\" stroke-width=\"2\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\"></circle>\n <path d=\"M18 7H6\" stroke=\"").concat(color, "\" stroke-width=\"2\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n <path d=\"M7 7V7C8.65685 7 10 8.34315 10 10V15C10 16.1046 10.8954 17 12 17H18\"\n stroke=\"").concat(color, "\" stroke-width=\"2\" stroke-linecap=\"round\"\n stroke-linejoin=\"round\"></path> </g></svg>");
|
|
41356
41342
|
}
|
|
41357
41343
|
}
|
|
41358
41344
|
};
|
|
41359
41345
|
function initialBranchingSetup(step, pendo) {
|
|
41360
|
-
|
|
41361
|
-
pendo._.forEach(questions, (question)
|
|
41362
|
-
|
|
41363
|
-
pendo._.each(step.guideElement.find(
|
|
41346
|
+
var questions = step.guideElement.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
|
|
41347
|
+
pendo._.forEach(questions, function (question) {
|
|
41348
|
+
var dataPendoPollId = question.getAttribute('data-pendo-poll-id');
|
|
41349
|
+
pendo._.each(step.guideElement.find("#".concat(question.id, " *")), function (element) {
|
|
41364
41350
|
guideMarkdownUtil.removeMarkdownSyntax(element, '{branching/}', '', pendo);
|
|
41365
41351
|
});
|
|
41366
|
-
|
|
41367
|
-
pendo._.forEach(pollLabels, (label)
|
|
41352
|
+
var pollLabels = step.guideElement.find("label[for*=".concat(dataPendoPollId, "]"));
|
|
41353
|
+
pendo._.forEach(pollLabels, function (label) {
|
|
41368
41354
|
if (pendo._.isNull(goToRegex.exec(label.textContent))) {
|
|
41369
41355
|
return;
|
|
41370
41356
|
}
|
|
41371
|
-
|
|
41372
|
-
|
|
41357
|
+
var gotoSubstring = goToRegex.exec(label.textContent)[1];
|
|
41358
|
+
var gotoIndex = goToRegex.exec(label.textContent)[2];
|
|
41373
41359
|
label.setAttribute('goToStep', gotoIndex);
|
|
41374
41360
|
guideMarkdownUtil.removeMarkdownSyntax(label, gotoSubstring, '', pendo);
|
|
41375
41361
|
});
|
|
41376
|
-
|
|
41362
|
+
var pollChoiceContainer = step.guideElement.find("[data-pendo-poll-id=".concat(dataPendoPollId, "]._pendo-multi-choice-poll-select-border"));
|
|
41377
41363
|
if (pollChoiceContainer && pollChoiceContainer.length) {
|
|
41378
41364
|
pollChoiceContainer[0].setAttribute('branching', '');
|
|
41379
41365
|
}
|
|
@@ -41382,15 +41368,15 @@ function initialBranchingSetup(step, pendo) {
|
|
|
41382
41368
|
}
|
|
41383
41369
|
function branchingGoToStep(event, step, guide, pendo) {
|
|
41384
41370
|
var _a;
|
|
41385
|
-
|
|
41386
|
-
|
|
41387
|
-
|
|
41388
|
-
|
|
41371
|
+
var checkedPollInputId = (_a = step.guideElement.find('[branching] input.pendo-radio[data-pendo-poll-id]:checked')[0]) === null || _a === void 0 ? void 0 : _a.id;
|
|
41372
|
+
var checkedPollLabel = step.guideElement.find("label[for=\"".concat(checkedPollInputId, "\"]"))[0];
|
|
41373
|
+
var checkedPollLabelStepIndex = checkedPollLabel === null || checkedPollLabel === void 0 ? void 0 : checkedPollLabel.getAttribute('goToStep');
|
|
41374
|
+
var pollStepIndex = checkedPollLabelStepIndex - 1;
|
|
41389
41375
|
if (pollStepIndex < 0)
|
|
41390
41376
|
return;
|
|
41391
|
-
|
|
41377
|
+
var destinationObject = {
|
|
41392
41378
|
destinationStepId: guide.steps[pollStepIndex].id,
|
|
41393
|
-
step
|
|
41379
|
+
step: step
|
|
41394
41380
|
};
|
|
41395
41381
|
pendo.goToStep(destinationObject);
|
|
41396
41382
|
event.cancel = true;
|
|
@@ -41411,10 +41397,10 @@ function encodeMetadataForUrl(value, urlBeforePlaceholder) {
|
|
|
41411
41397
|
return window.encodeURI(str);
|
|
41412
41398
|
}
|
|
41413
41399
|
|
|
41414
|
-
|
|
41400
|
+
var MetadataSubstitution = {
|
|
41415
41401
|
name: 'MetadataSubstitution',
|
|
41416
|
-
script(step, guide, pendo) {
|
|
41417
|
-
|
|
41402
|
+
script: function (step, guide, pendo) {
|
|
41403
|
+
var placeholderData = findSubstitutableElements(pendo);
|
|
41418
41404
|
if (step.domJson) {
|
|
41419
41405
|
findSubstitutableUrlsInJson(step.domJson, placeholderData, pendo);
|
|
41420
41406
|
}
|
|
@@ -41422,22 +41408,22 @@ const MetadataSubstitution = {
|
|
|
41422
41408
|
pendo._.each(placeholderData, function (placeholder) {
|
|
41423
41409
|
processPlaceholder(placeholder, pendo);
|
|
41424
41410
|
});
|
|
41425
|
-
|
|
41426
|
-
|
|
41427
|
-
updateGuideContainer(containerId,
|
|
41411
|
+
var containerId = "pendo-g-".concat(step.id);
|
|
41412
|
+
var context_1 = step.guideElement;
|
|
41413
|
+
updateGuideContainer(containerId, context_1, pendo);
|
|
41428
41414
|
}
|
|
41429
41415
|
},
|
|
41430
|
-
designerListener(pendo) {
|
|
41431
|
-
|
|
41416
|
+
designerListener: function (pendo) {
|
|
41417
|
+
var target = pendo.dom.getBody();
|
|
41432
41418
|
if (pendo.designerv2) {
|
|
41433
41419
|
pendo.designerv2.runMetadataSubstitutionForDesignerPreview = function runMetadataSubstitutionForDesignerPreview() {
|
|
41434
41420
|
var _a;
|
|
41435
41421
|
if (!document.querySelector(guideMarkdownUtil.containerSelector))
|
|
41436
41422
|
return;
|
|
41437
|
-
|
|
41423
|
+
var step = (_a = pendo.designerv2.currentlyPreviewedGuide) === null || _a === void 0 ? void 0 : _a.steps[0];
|
|
41438
41424
|
if (!step)
|
|
41439
41425
|
return;
|
|
41440
|
-
|
|
41426
|
+
var placeholderData = findSubstitutableElements(pendo);
|
|
41441
41427
|
if (step.buildingBlocks) {
|
|
41442
41428
|
findSubstitutableUrlsInJson(step.buildingBlocks, placeholderData, pendo);
|
|
41443
41429
|
}
|
|
@@ -41447,32 +41433,32 @@ const MetadataSubstitution = {
|
|
|
41447
41433
|
return;
|
|
41448
41434
|
processPlaceholder(placeholder, pendo);
|
|
41449
41435
|
});
|
|
41450
|
-
|
|
41451
|
-
|
|
41452
|
-
updateGuideContainer(containerId,
|
|
41436
|
+
var containerId = "pendo-g-".concat(step.id);
|
|
41437
|
+
var context_2 = step.guideElement;
|
|
41438
|
+
updateGuideContainer(containerId, context_2, pendo);
|
|
41453
41439
|
}
|
|
41454
41440
|
};
|
|
41455
41441
|
}
|
|
41456
|
-
|
|
41442
|
+
var config = {
|
|
41457
41443
|
attributeFilter: ['data-layout'],
|
|
41458
41444
|
attributes: true,
|
|
41459
41445
|
childList: true,
|
|
41460
41446
|
characterData: true,
|
|
41461
41447
|
subtree: true
|
|
41462
41448
|
};
|
|
41463
|
-
|
|
41464
|
-
|
|
41449
|
+
var MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
|
|
41450
|
+
var observer = new MutationObserver(applySubstitutionIndicators);
|
|
41465
41451
|
observer.observe(target, config);
|
|
41466
41452
|
function applySubstitutionIndicators(mutations) {
|
|
41467
41453
|
pendo._.each(mutations, function (mutation) {
|
|
41468
41454
|
var _a;
|
|
41469
41455
|
if (mutation.addedNodes.length) {
|
|
41470
41456
|
if (document.querySelector(guideMarkdownUtil.containerSelector)) {
|
|
41471
|
-
|
|
41472
|
-
|
|
41457
|
+
var placeholderData = findSubstitutableElements(pendo);
|
|
41458
|
+
var step = (_a = pendo.designerv2.currentlyPreviewedGuide) === null || _a === void 0 ? void 0 : _a.steps[0];
|
|
41473
41459
|
if (!step)
|
|
41474
41460
|
return;
|
|
41475
|
-
|
|
41461
|
+
var pendoBlocks = step.buildingBlocks;
|
|
41476
41462
|
if (!pendo._.isUndefined(pendoBlocks)) {
|
|
41477
41463
|
findSubstitutableUrlsInJson(pendoBlocks, placeholderData, pendo);
|
|
41478
41464
|
}
|
|
@@ -41482,9 +41468,9 @@ const MetadataSubstitution = {
|
|
|
41482
41468
|
return;
|
|
41483
41469
|
processPlaceholder(placeholder, pendo);
|
|
41484
41470
|
});
|
|
41485
|
-
|
|
41486
|
-
|
|
41487
|
-
updateGuideContainer(containerId,
|
|
41471
|
+
var containerId = "pendo-g-".concat(step.id);
|
|
41472
|
+
var context_3 = step.guideElement;
|
|
41473
|
+
updateGuideContainer(containerId, context_3, pendo);
|
|
41488
41474
|
}
|
|
41489
41475
|
}
|
|
41490
41476
|
}
|
|
@@ -41493,18 +41479,18 @@ const MetadataSubstitution = {
|
|
|
41493
41479
|
}
|
|
41494
41480
|
};
|
|
41495
41481
|
function processPlaceholder(placeholder, pendo) {
|
|
41496
|
-
|
|
41497
|
-
|
|
41498
|
-
|
|
41482
|
+
var match;
|
|
41483
|
+
var data = placeholder.data, target = placeholder.target;
|
|
41484
|
+
var subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
|
|
41499
41485
|
while ((match = matchPlaceholder(placeholder, subRegex))) {
|
|
41500
|
-
|
|
41501
|
-
|
|
41486
|
+
var usedArrayPath = Array.isArray(match) && match.length >= 2;
|
|
41487
|
+
var currentStr = target === 'textContent'
|
|
41502
41488
|
? data[target]
|
|
41503
41489
|
: decodeURI((data.getAttribute && (target === 'href' || target === 'value') ? (data.getAttribute(target) || '') : data[target]));
|
|
41504
|
-
|
|
41490
|
+
var matched = usedArrayPath ? match : subRegex.exec(currentStr);
|
|
41505
41491
|
if (!matched)
|
|
41506
41492
|
continue;
|
|
41507
|
-
|
|
41493
|
+
var mdValue = getSubstituteValue(matched, pendo);
|
|
41508
41494
|
substituteMetadataByTarget(data, target, mdValue, matched);
|
|
41509
41495
|
}
|
|
41510
41496
|
}
|
|
@@ -41513,50 +41499,50 @@ function matchPlaceholder(placeholder, regex) {
|
|
|
41513
41499
|
return placeholder.data[placeholder.target].match(regex);
|
|
41514
41500
|
}
|
|
41515
41501
|
else {
|
|
41516
|
-
|
|
41502
|
+
var raw = placeholder.data.getAttribute && (placeholder.target === 'href' || placeholder.target === 'value')
|
|
41517
41503
|
? (placeholder.data.getAttribute(placeholder.target) || '')
|
|
41518
41504
|
: placeholder.data[placeholder.target];
|
|
41519
41505
|
return decodeURI(raw).match(regex);
|
|
41520
41506
|
}
|
|
41521
41507
|
}
|
|
41522
41508
|
function getMetadataValueCaseInsensitive(metadata, type, property) {
|
|
41523
|
-
|
|
41509
|
+
var kind = metadata && metadata[type];
|
|
41524
41510
|
if (!kind || typeof kind !== 'object')
|
|
41525
41511
|
return undefined;
|
|
41526
|
-
|
|
41512
|
+
var direct = Object.prototype.hasOwnProperty.call(kind, property) ? kind[property] : undefined;
|
|
41527
41513
|
if (direct !== undefined) {
|
|
41528
41514
|
return direct;
|
|
41529
41515
|
}
|
|
41530
|
-
|
|
41531
|
-
|
|
41532
|
-
|
|
41516
|
+
var propLower = property.toLowerCase();
|
|
41517
|
+
var key = Object.keys(kind).find(function (k) { return k.toLowerCase() === propLower; });
|
|
41518
|
+
var value = key !== undefined ? kind[key] : undefined;
|
|
41533
41519
|
return value;
|
|
41534
41520
|
}
|
|
41535
41521
|
function getSubstituteValue(match, pendo) {
|
|
41536
41522
|
if (pendo._.isUndefined(match[1]) || pendo._.isUndefined(match[2])) {
|
|
41537
41523
|
return;
|
|
41538
41524
|
}
|
|
41539
|
-
|
|
41540
|
-
|
|
41541
|
-
|
|
41525
|
+
var type = match[1];
|
|
41526
|
+
var property = match[2];
|
|
41527
|
+
var defaultValue = match[3];
|
|
41542
41528
|
if (pendo._.isUndefined(type) || pendo._.isUndefined(property)) {
|
|
41543
41529
|
return;
|
|
41544
41530
|
}
|
|
41545
|
-
|
|
41546
|
-
|
|
41531
|
+
var metadata = pendo.getSerializedMetadata();
|
|
41532
|
+
var mdValue = getMetadataValueCaseInsensitive(metadata, type, property);
|
|
41547
41533
|
if (mdValue === undefined || mdValue === null)
|
|
41548
41534
|
mdValue = defaultValue || '';
|
|
41549
41535
|
return mdValue;
|
|
41550
41536
|
}
|
|
41551
41537
|
function substituteMetadataByTarget(data, target, mdValue, matched) {
|
|
41552
|
-
|
|
41553
|
-
|
|
41538
|
+
var isElement = data && typeof data.getAttribute === 'function';
|
|
41539
|
+
var current = (target === 'href' || target === 'value') && isElement
|
|
41554
41540
|
? (data.getAttribute(target) || '')
|
|
41555
41541
|
: data[target];
|
|
41556
41542
|
if (target === 'href' || target === 'value') {
|
|
41557
|
-
|
|
41558
|
-
|
|
41559
|
-
|
|
41543
|
+
var decodedUrl = decodeURI(current);
|
|
41544
|
+
var urlBeforePlaceholder = decodedUrl.slice(0, decodedUrl.indexOf(matched[0]));
|
|
41545
|
+
var safeValue = encodeMetadataForUrl(mdValue, urlBeforePlaceholder);
|
|
41560
41546
|
data[target] = decodedUrl.replace(matched[0], safeValue);
|
|
41561
41547
|
}
|
|
41562
41548
|
else {
|
|
@@ -41570,8 +41556,9 @@ function updateGuideContainer(containerId, context, pendo) {
|
|
|
41570
41556
|
pendo.flexElement(pendo.dom(guideMarkdownUtil.containerSelector));
|
|
41571
41557
|
pendo.BuildingBlocks.BuildingBlockGuides.recalculateGuideHeight(containerId, context);
|
|
41572
41558
|
}
|
|
41573
|
-
function findSubstitutableUrlsInJson(originalData, placeholderData
|
|
41574
|
-
|
|
41559
|
+
function findSubstitutableUrlsInJson(originalData, placeholderData, pendo) {
|
|
41560
|
+
if (placeholderData === void 0) { placeholderData = []; }
|
|
41561
|
+
var subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
|
|
41575
41562
|
if ((originalData.name === 'url' || originalData.name === 'href') && originalData.value) {
|
|
41576
41563
|
if (subRegex.test(originalData.value)) {
|
|
41577
41564
|
placeholderData.push({
|
|
@@ -41581,37 +41568,37 @@ function findSubstitutableUrlsInJson(originalData, placeholderData = [], pendo)
|
|
|
41581
41568
|
}
|
|
41582
41569
|
}
|
|
41583
41570
|
if (originalData.properties && originalData.id === 'href_link_block') {
|
|
41584
|
-
pendo._.each(originalData.properties, (prop)
|
|
41571
|
+
pendo._.each(originalData.properties, function (prop) {
|
|
41585
41572
|
findSubstitutableUrlsInJson(prop, placeholderData, pendo);
|
|
41586
41573
|
});
|
|
41587
41574
|
}
|
|
41588
41575
|
if (originalData.views) {
|
|
41589
|
-
pendo._.each(originalData.views, (view)
|
|
41576
|
+
pendo._.each(originalData.views, function (view) {
|
|
41590
41577
|
findSubstitutableUrlsInJson(view, placeholderData, pendo);
|
|
41591
41578
|
});
|
|
41592
41579
|
}
|
|
41593
41580
|
if (originalData.parameters) {
|
|
41594
|
-
pendo._.each(originalData.parameters, (param)
|
|
41581
|
+
pendo._.each(originalData.parameters, function (param) {
|
|
41595
41582
|
findSubstitutableUrlsInJson(param, placeholderData, pendo);
|
|
41596
41583
|
});
|
|
41597
41584
|
}
|
|
41598
41585
|
if (originalData.actions) {
|
|
41599
|
-
pendo._.each(originalData.actions, (action)
|
|
41586
|
+
pendo._.each(originalData.actions, function (action) {
|
|
41600
41587
|
findSubstitutableUrlsInJson(action, placeholderData, pendo);
|
|
41601
41588
|
});
|
|
41602
41589
|
}
|
|
41603
41590
|
if (originalData.children) {
|
|
41604
|
-
pendo._.each(originalData.children, (child)
|
|
41591
|
+
pendo._.each(originalData.children, function (child) {
|
|
41605
41592
|
findSubstitutableUrlsInJson(child, placeholderData, pendo);
|
|
41606
41593
|
});
|
|
41607
41594
|
}
|
|
41608
41595
|
return placeholderData;
|
|
41609
41596
|
}
|
|
41610
41597
|
function findSubstitutableElements(pendo) {
|
|
41611
|
-
|
|
41598
|
+
var elements = pendo.dom("".concat(guideMarkdownUtil.containerSelector, " *:not(.pendo-inline-ui)"));
|
|
41612
41599
|
return pendo._.chain(elements)
|
|
41613
41600
|
.filter(function (placeholder) {
|
|
41614
|
-
|
|
41601
|
+
var subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
|
|
41615
41602
|
if (placeholder.localName === 'a') {
|
|
41616
41603
|
return subRegex.test(decodeURI(placeholder.href)) || subRegex.test(placeholder.textContent);
|
|
41617
41604
|
}
|
|
@@ -41667,51 +41654,25 @@ function findSubstitutableElements(pendo) {
|
|
|
41667
41654
|
.value();
|
|
41668
41655
|
}
|
|
41669
41656
|
function substitutionIcon(color, size) {
|
|
41670
|
-
return (
|
|
41671
|
-
|
|
41672
|
-
|
|
41673
|
-
|
|
41674
|
-
|
|
41675
|
-
|
|
41676
|
-
transform="matrix(1, 0, 0, 1, 0, 0)rotate(0)">
|
|
41677
|
-
<g stroke-width="0"></g>
|
|
41678
|
-
<g stroke-linecap="round" stroke-linejoin="round"
|
|
41679
|
-
stroke="${color}" stroke-width="0.528"></g>
|
|
41680
|
-
<g><path fill-rule="evenodd" clip-rule="evenodd"
|
|
41681
|
-
d="M5 5.5C4.17157 5.5 3.5 6.17157 3.5 7V10C3.5 10.8284
|
|
41682
|
-
4.17157 11.5 5 11.5H8C8.82843 11.5 9.5 10.8284 9.5
|
|
41683
|
-
10V9H17V11C17 11.2761 17.2239 11.5 17.5 11.5C17.7761
|
|
41684
|
-
11.5 18 11.2761 18 11V8.5C18 8.22386 17.7761 8 17.5
|
|
41685
|
-
8H9.5V7C9.5 6.17157 8.82843 5.5 8 5.5H5ZM8.5 7C8.5
|
|
41686
|
-
6.72386 8.27614 6.5 8 6.5H5C4.72386 6.5 4.5 6.72386
|
|
41687
|
-
4.5 7V10C4.5 10.2761 4.72386 10.5 5 10.5H8C8.27614
|
|
41688
|
-
10.5 8.5 10.2761 8.5 10V7Z" fill="${color}"></path>
|
|
41689
|
-
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
41690
|
-
d="M7 13C7 12.7239 6.77614 12.5 6.5 12.5C6.22386 12.5
|
|
41691
|
-
6 12.7239 6 13V15.5C6 15.7761 6.22386 16 6.5
|
|
41692
|
-
16H14.5V17C14.5 17.8284 15.1716 18.5 16 18.5H19C19.8284
|
|
41693
|
-
18.5 20.5 17.8284 20.5 17V14C20.5 13.1716 19.8284 12.5
|
|
41694
|
-
19 12.5H16C15.1716 12.5 14.5 13.1716 14.5
|
|
41695
|
-
14V15H7V13ZM15.5 17C15.5 17.2761 15.7239 17.5 16
|
|
41696
|
-
17.5H19C19.2761 17.5 19.5 17.2761 19.5 17V14C19.5
|
|
41697
|
-
13.7239 19.2761 13.5 19 13.5H16C15.7239 13.5 15.5
|
|
41698
|
-
13.7239 15.5 14V17Z" fill="${color}"></path> </g></svg></div>`);
|
|
41699
|
-
}
|
|
41700
|
-
|
|
41701
|
-
const requiredElement = '<span class="_pendo-required-indicator" style="color:red; font-style:italic;" title="Question is required"> *</span>';
|
|
41702
|
-
const requiredSyntax = '{required/}';
|
|
41703
|
-
const RequiredQuestions = {
|
|
41657
|
+
return ("<div title=\"Metadata Substitution added\">\n <svg id=\"pendo-ps-substitution-icon\" viewBox=\"0 0 24 24\"\n preserveAspectRatio=\"xMidYMid meet\"\n height=".concat(size, " width=").concat(size, " title=\"Metadata Substitution\"\n style=\"bottom:5px; right:10px; position: absolute;\"\n fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" stroke=\"").concat(color, "\"\n transform=\"matrix(1, 0, 0, 1, 0, 0)rotate(0)\">\n <g stroke-width=\"0\"></g>\n <g stroke-linecap=\"round\" stroke-linejoin=\"round\"\n stroke=\"").concat(color, "\" stroke-width=\"0.528\"></g>\n <g><path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n d=\"M5 5.5C4.17157 5.5 3.5 6.17157 3.5 7V10C3.5 10.8284\n 4.17157 11.5 5 11.5H8C8.82843 11.5 9.5 10.8284 9.5\n 10V9H17V11C17 11.2761 17.2239 11.5 17.5 11.5C17.7761\n 11.5 18 11.2761 18 11V8.5C18 8.22386 17.7761 8 17.5\n 8H9.5V7C9.5 6.17157 8.82843 5.5 8 5.5H5ZM8.5 7C8.5\n 6.72386 8.27614 6.5 8 6.5H5C4.72386 6.5 4.5 6.72386\n 4.5 7V10C4.5 10.2761 4.72386 10.5 5 10.5H8C8.27614\n 10.5 8.5 10.2761 8.5 10V7Z\" fill=\"").concat(color, "\"></path>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n d=\"M7 13C7 12.7239 6.77614 12.5 6.5 12.5C6.22386 12.5\n 6 12.7239 6 13V15.5C6 15.7761 6.22386 16 6.5\n 16H14.5V17C14.5 17.8284 15.1716 18.5 16 18.5H19C19.8284\n 18.5 20.5 17.8284 20.5 17V14C20.5 13.1716 19.8284 12.5\n 19 12.5H16C15.1716 12.5 14.5 13.1716 14.5\n 14V15H7V13ZM15.5 17C15.5 17.2761 15.7239 17.5 16\n 17.5H19C19.2761 17.5 19.5 17.2761 19.5 17V14C19.5\n 13.7239 19.2761 13.5 19 13.5H16C15.7239 13.5 15.5\n 13.7239 15.5 14V17Z\" fill=\"").concat(color, "\"></path> </g></svg></div>"));
|
|
41658
|
+
}
|
|
41659
|
+
|
|
41660
|
+
var requiredElement = '<span class="_pendo-required-indicator" style="color:red; font-style:italic;" title="Question is required"> *</span>';
|
|
41661
|
+
var requiredSyntax = '{required/}';
|
|
41662
|
+
var RequiredQuestions = {
|
|
41704
41663
|
name: 'RequiredQuestions',
|
|
41705
|
-
script(step, guide, pendo) {
|
|
41664
|
+
script: function (step, guide, pendo) {
|
|
41706
41665
|
var _a;
|
|
41707
|
-
|
|
41708
|
-
|
|
41709
|
-
|
|
41666
|
+
var requiredPollIds = [];
|
|
41667
|
+
var submitButtons = (_a = guideMarkdownUtil.lookupGuideButtons(step.domJson)) === null || _a === void 0 ? void 0 : _a.filter(function (button) {
|
|
41668
|
+
return button.actions.find(function (action) { return action.action === 'submitPoll' || action.action === 'submitPollAndGoToStep'; });
|
|
41669
|
+
});
|
|
41670
|
+
var requiredQuestions = processRequiredQuestions();
|
|
41710
41671
|
if (requiredQuestions) {
|
|
41711
|
-
pendo._.forEach(requiredQuestions, (question)
|
|
41672
|
+
pendo._.forEach(requiredQuestions, function (question) {
|
|
41712
41673
|
if (question.classList.contains('_pendo-open-text-poll-question')) {
|
|
41713
|
-
|
|
41714
|
-
step.attachEvent(step.guideElement.find(
|
|
41674
|
+
var pollId = question.dataset.pendoPollId;
|
|
41675
|
+
step.attachEvent(step.guideElement.find("[data-pendo-poll-id=".concat(pollId, "]._pendo-open-text-poll-input"))[0], 'input', function () {
|
|
41715
41676
|
evaluateRequiredQuestions(requiredQuestions);
|
|
41716
41677
|
});
|
|
41717
41678
|
}
|
|
@@ -41723,11 +41684,13 @@ const RequiredQuestions = {
|
|
|
41723
41684
|
});
|
|
41724
41685
|
}
|
|
41725
41686
|
function getEligibleQuestions() {
|
|
41726
|
-
|
|
41727
|
-
|
|
41728
|
-
|
|
41729
|
-
|
|
41730
|
-
|
|
41687
|
+
var pollQuestions = pendo._.toArray(step.guideElement.find("[class*=-poll-question]:contains(".concat(requiredSyntax, ")")));
|
|
41688
|
+
var surveyMatches = pendo._.toArray(step.guideElement.find("[data-pendo-poll-id]:contains(".concat(requiredSyntax, ")")));
|
|
41689
|
+
var surveyQuestions = pendo._.filter(surveyMatches, function (candidate) {
|
|
41690
|
+
return !pendo._.some(surveyMatches, function (other) { return other !== candidate && candidate.contains(other); });
|
|
41691
|
+
});
|
|
41692
|
+
var allQuestions = pendo._.uniq(pollQuestions.concat(surveyQuestions));
|
|
41693
|
+
return pendo._.reduce(allQuestions, function (eligibleQuestions, question) {
|
|
41731
41694
|
if (question.classList.contains('_pendo-yes-no-poll-question'))
|
|
41732
41695
|
return eligibleQuestions;
|
|
41733
41696
|
eligibleQuestions.push(question);
|
|
@@ -41735,22 +41698,24 @@ const RequiredQuestions = {
|
|
|
41735
41698
|
}, []);
|
|
41736
41699
|
}
|
|
41737
41700
|
function ownsRequiredText(element) {
|
|
41738
|
-
return pendo._.some(element.childNodes, (node)
|
|
41701
|
+
return pendo._.some(element.childNodes, function (node) {
|
|
41702
|
+
return node.nodeType === 3 && node.nodeValue && node.nodeValue.indexOf(requiredSyntax) !== -1;
|
|
41703
|
+
});
|
|
41739
41704
|
}
|
|
41740
41705
|
function processRequiredQuestions() {
|
|
41741
|
-
|
|
41706
|
+
var questions = getEligibleQuestions();
|
|
41742
41707
|
if (questions) {
|
|
41743
|
-
pendo._.forEach(questions, question
|
|
41744
|
-
|
|
41708
|
+
pendo._.forEach(questions, function (question) {
|
|
41709
|
+
var dataPendoPollId = question.getAttribute('data-pendo-poll-id');
|
|
41745
41710
|
requiredPollIds.push(dataPendoPollId);
|
|
41746
|
-
|
|
41747
|
-
|
|
41748
|
-
pendo._.each(candidates, (element)
|
|
41711
|
+
var candidates = step.guideElement.find("#".concat(question.id, " *, #").concat(question.id));
|
|
41712
|
+
var textHost = pendo._.find(candidates, ownsRequiredText) || question;
|
|
41713
|
+
pendo._.each(candidates, function (element) {
|
|
41749
41714
|
guideMarkdownUtil.removeMarkdownSyntax(element, requiredSyntax, '', pendo);
|
|
41750
41715
|
});
|
|
41751
|
-
|
|
41716
|
+
var textHostEl = pendo.dom(textHost);
|
|
41752
41717
|
if (textHostEl.find('._pendo-required-indicator').length === 0) {
|
|
41753
|
-
|
|
41718
|
+
var questionParagraph = textHostEl.find('p');
|
|
41754
41719
|
if (questionParagraph && questionParagraph.length) {
|
|
41755
41720
|
pendo.dom(questionParagraph[0]).append(requiredElement);
|
|
41756
41721
|
}
|
|
@@ -41761,15 +41726,7 @@ const RequiredQuestions = {
|
|
|
41761
41726
|
});
|
|
41762
41727
|
}
|
|
41763
41728
|
if (pendo._.size(requiredPollIds)) {
|
|
41764
|
-
|
|
41765
|
-
id=_pendo-guide-required-disabled>
|
|
41766
|
-
._pendo-button:disabled, ._pendo-buttons[disabled] {
|
|
41767
|
-
border: 1px solid #999999 !important;
|
|
41768
|
-
background-color: #cccccc !important;
|
|
41769
|
-
color: #666666 !important;
|
|
41770
|
-
pointer-events: none !important;
|
|
41771
|
-
}
|
|
41772
|
-
</style>`;
|
|
41729
|
+
var disabledButtonStyles = "<style type=text/css\n id=_pendo-guide-required-disabled>\n ._pendo-button:disabled, ._pendo-buttons[disabled] {\n border: 1px solid #999999 !important;\n background-color: #cccccc !important;\n color: #666666 !important;\n pointer-events: none !important;\n }\n </style>";
|
|
41773
41730
|
if (pendo.dom('#_pendo-guide-required-disabled').length === 0) {
|
|
41774
41731
|
pendo.dom('head').append(disabledButtonStyles);
|
|
41775
41732
|
}
|
|
@@ -41780,15 +41737,11 @@ const RequiredQuestions = {
|
|
|
41780
41737
|
function evaluateRequiredQuestions(questions) {
|
|
41781
41738
|
if (questions.length === 0)
|
|
41782
41739
|
return;
|
|
41783
|
-
|
|
41784
|
-
|
|
41785
|
-
responses = responses.concat(pendo._.map(questions, (question)
|
|
41786
|
-
|
|
41787
|
-
|
|
41788
|
-
[data-pendo-poll-id=${pollId}] textarea,
|
|
41789
|
-
[data-pendo-poll-id=${pollId}] input:text,
|
|
41790
|
-
[data-pendo-poll-id=${pollId}] select,
|
|
41791
|
-
[data-pendo-poll-id=${pollId}] input:radio:checked`);
|
|
41740
|
+
var allRequiredComplete = true;
|
|
41741
|
+
var responses = [];
|
|
41742
|
+
responses = responses.concat(pendo._.map(questions, function (question) {
|
|
41743
|
+
var pollId = question.getAttribute('data-pendo-poll-id');
|
|
41744
|
+
var input = step.guideElement.find("\n [data-pendo-poll-id=".concat(pollId, "] textarea,\n [data-pendo-poll-id=").concat(pollId, "] input:text,\n [data-pendo-poll-id=").concat(pollId, "] select,\n [data-pendo-poll-id=").concat(pollId, "] input:radio:checked"));
|
|
41792
41745
|
if (input && input.length && input[0].value) {
|
|
41793
41746
|
return input[0].value;
|
|
41794
41747
|
}
|
|
@@ -41805,50 +41758,50 @@ const RequiredQuestions = {
|
|
|
41805
41758
|
}
|
|
41806
41759
|
function disableEligibleButtons(buttons) {
|
|
41807
41760
|
pendo._.each(buttons, function (button) {
|
|
41808
|
-
if (step.guideElement.find(
|
|
41809
|
-
step.guideElement.find(
|
|
41810
|
-
step.guideElement.find(
|
|
41761
|
+
if (step.guideElement.find("#".concat(button.props.id))[0]) {
|
|
41762
|
+
step.guideElement.find("#".concat(button.props.id))[0].disabled = true;
|
|
41763
|
+
step.guideElement.find("#".concat(button.props.id))[0].parentElement.title = 'Please complete all required questions.';
|
|
41811
41764
|
}
|
|
41812
41765
|
});
|
|
41813
41766
|
}
|
|
41814
41767
|
function enableEligibleButtons(buttons) {
|
|
41815
41768
|
pendo._.each(buttons, function (button) {
|
|
41816
|
-
if (step.guideElement.find(
|
|
41817
|
-
step.guideElement.find(
|
|
41818
|
-
step.guideElement.find(
|
|
41769
|
+
if (step.guideElement.find("#".concat(button.props.id))[0]) {
|
|
41770
|
+
step.guideElement.find("#".concat(button.props.id))[0].disabled = false;
|
|
41771
|
+
step.guideElement.find("#".concat(button.props.id))[0].parentElement.title = '';
|
|
41819
41772
|
}
|
|
41820
41773
|
});
|
|
41821
41774
|
}
|
|
41822
41775
|
},
|
|
41823
|
-
test(step, guide, pendo) {
|
|
41776
|
+
test: function (step, guide, pendo) {
|
|
41824
41777
|
var _a, _b;
|
|
41825
|
-
|
|
41826
|
-
|
|
41778
|
+
var pollQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find("[class*=-poll-question]:contains(".concat(requiredSyntax, ")"));
|
|
41779
|
+
var surveyQuestions = (_b = step.guideElement) === null || _b === void 0 ? void 0 : _b.find("[data-pendo-poll-id]:contains(".concat(requiredSyntax, ")"));
|
|
41827
41780
|
return (!pendo._.isUndefined(pollQuestions) && pendo._.size(pollQuestions)) ||
|
|
41828
41781
|
(!pendo._.isUndefined(surveyQuestions) && pendo._.size(surveyQuestions));
|
|
41829
41782
|
},
|
|
41830
|
-
designerListener(pendo) {
|
|
41831
|
-
|
|
41832
|
-
|
|
41833
|
-
|
|
41783
|
+
designerListener: function (pendo) {
|
|
41784
|
+
var requiredQuestions = [];
|
|
41785
|
+
var target = pendo.dom.getBody();
|
|
41786
|
+
var config = {
|
|
41834
41787
|
attributeFilter: ['data-layout'],
|
|
41835
41788
|
attributes: true,
|
|
41836
41789
|
childList: true,
|
|
41837
41790
|
characterData: true,
|
|
41838
41791
|
subtree: true
|
|
41839
41792
|
};
|
|
41840
|
-
|
|
41841
|
-
|
|
41793
|
+
var MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
|
|
41794
|
+
var observer = new MutationObserver(applyRequiredIndicators);
|
|
41842
41795
|
observer.observe(target, config);
|
|
41843
41796
|
function applyRequiredIndicators(mutations) {
|
|
41844
41797
|
pendo._.each(mutations, function (mutation) {
|
|
41845
41798
|
var _a;
|
|
41846
|
-
|
|
41799
|
+
var nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
|
|
41847
41800
|
if (mutation.addedNodes.length && nodeHasQuerySelector) {
|
|
41848
|
-
|
|
41801
|
+
var eligiblePolls = mutation.addedNodes[0].querySelectorAll('[class*=-poll-wrapper], [class*=-poll-select-border], [id^=survey-item-wrapper__]');
|
|
41849
41802
|
if (eligiblePolls) {
|
|
41850
41803
|
pendo._.each(eligiblePolls, function (poll) {
|
|
41851
|
-
|
|
41804
|
+
var dataPendoPollId;
|
|
41852
41805
|
if (poll.classList.contains('_pendo-open-text-poll-wrapper') ||
|
|
41853
41806
|
poll.classList.contains('_pendo-number-scale-poll-wrapper')) {
|
|
41854
41807
|
dataPendoPollId = poll.getAttribute('name');
|
|
@@ -41856,31 +41809,31 @@ const RequiredQuestions = {
|
|
|
41856
41809
|
else {
|
|
41857
41810
|
dataPendoPollId = poll.getAttribute('data-pendo-poll-id');
|
|
41858
41811
|
}
|
|
41859
|
-
|
|
41860
|
-
|
|
41861
|
-
pendo.dom(
|
|
41812
|
+
var questionText;
|
|
41813
|
+
var questionElement = pendo.dom("[class*=\"-poll-question\"][data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0] ||
|
|
41814
|
+
pendo.dom(".bb-text[data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0];
|
|
41862
41815
|
if (questionElement) {
|
|
41863
41816
|
questionText = questionElement.textContent;
|
|
41864
41817
|
}
|
|
41865
|
-
|
|
41818
|
+
var requiredSyntaxIndex = questionText ? questionText.indexOf(requiredSyntax) : -1;
|
|
41866
41819
|
if (requiredSyntaxIndex > -1) {
|
|
41867
|
-
pendo._.each(pendo.dom(
|
|
41868
|
-
pendo._.each(pendo.dom(
|
|
41820
|
+
pendo._.each(pendo.dom("[data-pendo-poll-id=".concat(dataPendoPollId, "]:not(.pendo-radio)")), function (element) {
|
|
41821
|
+
pendo._.each(pendo.dom("#".concat(element.id, " *:not(\".pendo-radio\"), #").concat(element.id, ":not(\".pendo-radio\")")), function (item) {
|
|
41869
41822
|
guideMarkdownUtil.removeMarkdownSyntax(item, requiredSyntax, '', pendo);
|
|
41870
41823
|
});
|
|
41871
41824
|
});
|
|
41872
|
-
|
|
41873
|
-
|
|
41874
|
-
|
|
41875
|
-
|
|
41876
|
-
pendo._.each(pendo.dom(
|
|
41877
|
-
pendo._.each(el.childNodes, (node)
|
|
41825
|
+
var pollTextSelector = ".bb-text[data-pendo-poll-id=".concat(dataPendoPollId, "]");
|
|
41826
|
+
var pollParagraphSelector = "".concat(pollTextSelector, " p");
|
|
41827
|
+
var pollListItemSelector = "".concat(pollTextSelector, " li");
|
|
41828
|
+
var pollIndicatorSelector = "".concat(pollTextSelector, " ._pendo-required-indicator");
|
|
41829
|
+
pendo._.each(pendo.dom("".concat(pollParagraphSelector, ", ").concat(pollListItemSelector)), function (el) {
|
|
41830
|
+
pendo._.each(el.childNodes, function (node) {
|
|
41878
41831
|
if (node.nodeType === 3 && node.nodeValue.indexOf(requiredSyntax) !== -1) {
|
|
41879
41832
|
node.nodeValue = node.nodeValue.split(requiredSyntax).join('');
|
|
41880
41833
|
}
|
|
41881
41834
|
});
|
|
41882
41835
|
});
|
|
41883
|
-
|
|
41836
|
+
var hasIndicator = pendo.dom(pollIndicatorSelector).length !== 0;
|
|
41884
41837
|
if (!hasIndicator) {
|
|
41885
41838
|
if (pendo.dom(pollParagraphSelector).length !== 0 || pendo.dom(pollListItemSelector).length !== 0) {
|
|
41886
41839
|
pendo.dom(pollParagraphSelector).append(requiredElement);
|
|
@@ -41891,7 +41844,7 @@ const RequiredQuestions = {
|
|
|
41891
41844
|
}
|
|
41892
41845
|
}
|
|
41893
41846
|
if (pendo._.contains(requiredQuestions, dataPendoPollId)) {
|
|
41894
|
-
|
|
41847
|
+
var questionIndex = requiredQuestions.indexOf(dataPendoPollId);
|
|
41895
41848
|
if (questionIndex !== -1) {
|
|
41896
41849
|
requiredQuestions.splice(questionIndex, 1);
|
|
41897
41850
|
}
|
|
@@ -41902,7 +41855,7 @@ const RequiredQuestions = {
|
|
|
41902
41855
|
}
|
|
41903
41856
|
else {
|
|
41904
41857
|
if (pendo._.contains(requiredQuestions, dataPendoPollId)) {
|
|
41905
|
-
|
|
41858
|
+
var index = requiredQuestions.indexOf(dataPendoPollId);
|
|
41906
41859
|
if (index !== -1) {
|
|
41907
41860
|
requiredQuestions.splice(index, 1);
|
|
41908
41861
|
}
|
|
@@ -41916,54 +41869,54 @@ const RequiredQuestions = {
|
|
|
41916
41869
|
}
|
|
41917
41870
|
};
|
|
41918
41871
|
|
|
41919
|
-
|
|
41920
|
-
|
|
41921
|
-
script(step, guide, pendo) {
|
|
41922
|
-
|
|
41923
|
-
|
|
41924
|
-
|
|
41925
|
-
|
|
41926
|
-
|
|
41872
|
+
var skipStepRegex = new RegExp(guideMarkdownUtil.skipStepString);
|
|
41873
|
+
var SkipToEligibleStep = {
|
|
41874
|
+
script: function (step, guide, pendo) {
|
|
41875
|
+
var isAdvanceIntercepted = false;
|
|
41876
|
+
var isPreviousIntercepted = false;
|
|
41877
|
+
var guideContainer = step.guideElement.find(guideMarkdownUtil.containerSelector);
|
|
41878
|
+
var guideContainerAriaLabel = guideContainer.attr('aria-label');
|
|
41879
|
+
var stepNumberOrAuto = skipStepRegex.exec(guideContainerAriaLabel)[1];
|
|
41927
41880
|
if (guideContainer) {
|
|
41928
41881
|
guideContainer.attr({ 'aria-label': guideContainer.attr('aria-label').replace(skipStepRegex, '') });
|
|
41929
41882
|
}
|
|
41930
|
-
this.on('beforeAdvance', (evt)
|
|
41883
|
+
this.on('beforeAdvance', function (evt) {
|
|
41931
41884
|
if (guide.getPositionOfStep(step) === guide.steps.length || pendo._.isUndefined(stepNumberOrAuto))
|
|
41932
41885
|
return; // exit on the last step of a guide or when we don't have an argument
|
|
41933
|
-
|
|
41886
|
+
var eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'next');
|
|
41934
41887
|
if (!isAdvanceIntercepted && stepNumberOrAuto) {
|
|
41935
41888
|
isAdvanceIntercepted = true;
|
|
41936
|
-
pendo.goToStep({ destinationStepId: eligibleStep.id, step });
|
|
41889
|
+
pendo.goToStep({ destinationStepId: eligibleStep.id, step: step });
|
|
41937
41890
|
evt.cancel = true;
|
|
41938
41891
|
}
|
|
41939
41892
|
});
|
|
41940
|
-
this.on('beforePrevious', (evt)
|
|
41893
|
+
this.on('beforePrevious', function (evt) {
|
|
41941
41894
|
if (pendo._.isUndefined(stepNumberOrAuto))
|
|
41942
41895
|
return;
|
|
41943
|
-
|
|
41896
|
+
var eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'previous');
|
|
41944
41897
|
if (!isPreviousIntercepted && stepNumberOrAuto) {
|
|
41945
41898
|
isPreviousIntercepted = true;
|
|
41946
|
-
pendo.goToStep({ destinationStepId: eligibleStep.id, step });
|
|
41899
|
+
pendo.goToStep({ destinationStepId: eligibleStep.id, step: step });
|
|
41947
41900
|
evt.cancel = true;
|
|
41948
41901
|
}
|
|
41949
41902
|
});
|
|
41950
41903
|
function findEligibleSkipStep(stepNumber, direction) {
|
|
41951
41904
|
// Find the next eligible step by using getPosition of step (1 based)
|
|
41952
41905
|
// getPosition - 2 gives the previous step
|
|
41953
|
-
|
|
41954
|
-
|
|
41906
|
+
var skipForwardStep = findStepOnPage(guide.getPositionOfStep(step), 'next', stepNumber);
|
|
41907
|
+
var skipPreviousStep = findStepOnPage(guide.getPositionOfStep(step) - 2, 'previous', stepNumber);
|
|
41955
41908
|
if (skipForwardStep && direction == 'next') {
|
|
41956
|
-
pendo.goToStep({ destinationStepId: skipForwardStep, step });
|
|
41909
|
+
pendo.goToStep({ destinationStepId: skipForwardStep, step: step });
|
|
41957
41910
|
}
|
|
41958
41911
|
if (skipPreviousStep && direction == 'previous') {
|
|
41959
|
-
pendo.goToStep({ destinationStepId: skipPreviousStep, step });
|
|
41912
|
+
pendo.goToStep({ destinationStepId: skipPreviousStep, step: step });
|
|
41960
41913
|
}
|
|
41961
41914
|
return direction === 'next' ? skipForwardStep : skipPreviousStep;
|
|
41962
41915
|
}
|
|
41963
41916
|
function findStepOnPage(stepIndex, direction, stepNumber) {
|
|
41964
41917
|
if (pendo._.isNaN(stepIndex))
|
|
41965
41918
|
return;
|
|
41966
|
-
|
|
41919
|
+
var $step = guide.steps[stepIndex];
|
|
41967
41920
|
if ($step && !$step.canShow()) {
|
|
41968
41921
|
if (stepNumber !== 'auto') {
|
|
41969
41922
|
return guide.steps[stepNumber - 1];
|
|
@@ -41980,34 +41933,34 @@ const SkipToEligibleStep = {
|
|
|
41980
41933
|
}
|
|
41981
41934
|
}
|
|
41982
41935
|
},
|
|
41983
|
-
test(step, guide, pendo) {
|
|
41936
|
+
test: function (step, guide, pendo) {
|
|
41984
41937
|
var _a;
|
|
41985
|
-
|
|
41938
|
+
var guideContainerAriaLabel = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find(guideMarkdownUtil.containerSelector).attr('aria-label');
|
|
41986
41939
|
return pendo._.isString(guideContainerAriaLabel) && guideContainerAriaLabel.indexOf('{skipStep') !== -1;
|
|
41987
41940
|
},
|
|
41988
|
-
designerListener(pendo) {
|
|
41989
|
-
|
|
41990
|
-
|
|
41941
|
+
designerListener: function (pendo) {
|
|
41942
|
+
var target = pendo.dom.getBody();
|
|
41943
|
+
var config = {
|
|
41991
41944
|
attributeFilter: ['data-layout'],
|
|
41992
41945
|
attributes: true,
|
|
41993
41946
|
childList: true,
|
|
41994
41947
|
characterData: true,
|
|
41995
41948
|
subtree: true
|
|
41996
41949
|
};
|
|
41997
|
-
|
|
41998
|
-
|
|
41950
|
+
var MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
|
|
41951
|
+
var observer = new MutationObserver(applySkipStepIndicator);
|
|
41999
41952
|
observer.observe(target, config);
|
|
42000
41953
|
// create an observer instance
|
|
42001
41954
|
function applySkipStepIndicator(mutations) {
|
|
42002
41955
|
pendo._.each(mutations, function (mutation) {
|
|
42003
41956
|
var _a, _b;
|
|
42004
|
-
|
|
41957
|
+
var nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
|
|
42005
41958
|
if (mutation.addedNodes.length && nodeHasQuerySelector) {
|
|
42006
|
-
|
|
42007
|
-
|
|
41959
|
+
var guideContainer = mutation.addedNodes[0].querySelectorAll(guideMarkdownUtil.containerSelector);
|
|
41960
|
+
var guideContainerAriaLabel = (_b = guideContainer[0]) === null || _b === void 0 ? void 0 : _b.getAttribute('aria-label');
|
|
42008
41961
|
if (guideContainerAriaLabel) {
|
|
42009
41962
|
if (guideContainerAriaLabel.match(skipStepRegex)) {
|
|
42010
|
-
|
|
41963
|
+
var fullSkipStepString = guideContainerAriaLabel.match(skipStepRegex)[0];
|
|
42011
41964
|
guideContainerAriaLabel.replace(fullSkipStepString, '');
|
|
42012
41965
|
if (!pendo.dom('#_pendoSkipIcon').length) {
|
|
42013
41966
|
pendo.dom(guideMarkdownUtil.containerSelector).append(skipIcon('#999', '30px').trim());
|
|
@@ -42018,48 +41971,30 @@ const SkipToEligibleStep = {
|
|
|
42018
41971
|
});
|
|
42019
41972
|
}
|
|
42020
41973
|
function skipIcon(color, size) {
|
|
42021
|
-
return (
|
|
42022
|
-
width="${size}" height="${size}" viewBox="0 0 512.000000 512.000000"
|
|
42023
|
-
preserveAspectRatio="xMidYMid meet" style="bottom:5px; right:10px; position: absolute;">
|
|
42024
|
-
<g transform="translate(0.000000,512.000000) scale(0.100000,-0.100000)"
|
|
42025
|
-
fill="${color}" stroke="none">
|
|
42026
|
-
<path d="M2185 4469 c-363 -38 -739 -186 -1034 -407 -95 -71 -273 -243 -357
|
|
42027
|
-
-343 -205 -246 -364 -577 -429 -897 -25 -121 -45 -288 -45 -373 l0 -49 160 0
|
|
42028
|
-
160 0 0 48 c0 26 5 88 10 137 68 593 417 1103 940 1374 1100 570 2418 -137
|
|
42029
|
-
2560 -1374 5 -49 10 -111 10 -137 l0 -47 -155 -3 -155 -3 235 -235 235 -236
|
|
42030
|
-
235 236 235 235 -155 3 -155 3 0 48 c0 27 -5 95 -10 152 -100 989 -878 1767
|
|
42031
|
-
-1869 1868 -117 12 -298 12 -416 0z"/>
|
|
42032
|
-
<path d="M320 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
|
|
42033
|
-
<path d="M960 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
|
|
42034
|
-
<path d="M1600 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
|
|
42035
|
-
<path d="M2240 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
|
|
42036
|
-
<path d="M2880 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
|
|
42037
|
-
<path d="M3840 1440 l0 -160 480 0 480 0 0 160 0 160 -480 0 -480 0 0 -160z"/>
|
|
42038
|
-
</g></svg></div>
|
|
42039
|
-
`);
|
|
41974
|
+
return ("<div title=\"Skip step added\"><svg id=\"_pendoSkipIcon\" version=\"1.0\" xmlns=\"http://www.w3.org/2000/svg\"\n width=\"".concat(size, "\" height=\"").concat(size, "\" viewBox=\"0 0 512.000000 512.000000\"\n preserveAspectRatio=\"xMidYMid meet\" style=\"bottom:5px; right:10px; position: absolute;\">\n <g transform=\"translate(0.000000,512.000000) scale(0.100000,-0.100000)\"\n fill=\"").concat(color, "\" stroke=\"none\">\n <path d=\"M2185 4469 c-363 -38 -739 -186 -1034 -407 -95 -71 -273 -243 -357\n -343 -205 -246 -364 -577 -429 -897 -25 -121 -45 -288 -45 -373 l0 -49 160 0\n 160 0 0 48 c0 26 5 88 10 137 68 593 417 1103 940 1374 1100 570 2418 -137\n 2560 -1374 5 -49 10 -111 10 -137 l0 -47 -155 -3 -155 -3 235 -235 235 -236\n 235 236 235 235 -155 3 -155 3 0 48 c0 27 -5 95 -10 152 -100 989 -878 1767\n -1869 1868 -117 12 -298 12 -416 0z\"/>\n <path d=\"M320 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z\"/>\n <path d=\"M960 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z\"/>\n <path d=\"M1600 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z\"/>\n <path d=\"M2240 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z\"/>\n <path d=\"M2880 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z\"/>\n <path d=\"M3840 1440 l0 -160 480 0 480 0 0 160 0 160 -480 0 -480 0 0 -160z\"/>\n </g></svg></div>\n "));
|
|
42040
41975
|
}
|
|
42041
41976
|
}
|
|
42042
41977
|
};
|
|
42043
41978
|
|
|
42044
41979
|
function GuideMarkdown() {
|
|
42045
|
-
|
|
42046
|
-
|
|
42047
|
-
|
|
41980
|
+
var guideMarkdown;
|
|
41981
|
+
var pluginApi;
|
|
41982
|
+
var globalPendo;
|
|
42048
41983
|
return {
|
|
42049
41984
|
name: 'GuideMarkdown',
|
|
42050
41985
|
initialize: init,
|
|
42051
|
-
teardown
|
|
41986
|
+
teardown: teardown
|
|
42052
41987
|
};
|
|
42053
41988
|
function init(pendo, PluginAPI) {
|
|
42054
41989
|
globalPendo = pendo;
|
|
42055
41990
|
pluginApi = PluginAPI;
|
|
42056
|
-
|
|
42057
|
-
|
|
41991
|
+
var configReader = PluginAPI.ConfigReader;
|
|
41992
|
+
var GUIDEMARKDOWN_CONFIG = 'guideMarkdown';
|
|
42058
41993
|
configReader.addOption(GUIDEMARKDOWN_CONFIG, [
|
|
42059
41994
|
configReader.sources.SNIPPET_SRC,
|
|
42060
41995
|
configReader.sources.PENDO_CONFIG_SRC
|
|
42061
41996
|
], false);
|
|
42062
|
-
|
|
41997
|
+
var markdownScriptsEnabled = configReader.get(GUIDEMARKDOWN_CONFIG);
|
|
42063
41998
|
if (!markdownScriptsEnabled)
|
|
42064
41999
|
return;
|
|
42065
42000
|
guideMarkdown = [PollBranching, MetadataSubstitution, RequiredQuestions, SkipToEligibleStep];
|
|
@@ -43098,8 +43033,8 @@ function Feedback() {
|
|
|
43098
43033
|
var widgetLoaded = false;
|
|
43099
43034
|
var feedbackAllowedProductId = '';
|
|
43100
43035
|
var initialized = false;
|
|
43101
|
-
|
|
43102
|
-
|
|
43036
|
+
var PING_COOKIE = 'feedback_ping_sent';
|
|
43037
|
+
var PING_COOKIE_EXPIRATION = 1000 * 60 * 60;
|
|
43103
43038
|
var overflowMediaQuery = '@media only screen and (max-device-width:1112px){#feedback-widget{overflow-y:scroll}}';
|
|
43104
43039
|
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%)}}';
|
|
43105
43040
|
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)}}';
|
|
@@ -43119,28 +43054,28 @@ function Feedback() {
|
|
|
43119
43054
|
feedbackStyles: 'pendo-feedback-styles',
|
|
43120
43055
|
feedbackFrameStyles: 'pendo-feedback-visible-buttons-styles'
|
|
43121
43056
|
};
|
|
43122
|
-
|
|
43123
|
-
|
|
43057
|
+
var globalPendo;
|
|
43058
|
+
var pluginApi;
|
|
43124
43059
|
return {
|
|
43125
43060
|
name: 'Feedback',
|
|
43126
|
-
initialize,
|
|
43127
|
-
teardown,
|
|
43128
|
-
validate
|
|
43061
|
+
initialize: initialize,
|
|
43062
|
+
teardown: teardown,
|
|
43063
|
+
validate: validate
|
|
43129
43064
|
};
|
|
43130
43065
|
function initialize(pendo, PluginAPI) {
|
|
43131
43066
|
globalPendo = pendo;
|
|
43132
43067
|
pluginApi = PluginAPI;
|
|
43133
43068
|
var publicFeedback = {
|
|
43134
|
-
ping,
|
|
43135
|
-
init,
|
|
43069
|
+
ping: ping,
|
|
43070
|
+
init: init,
|
|
43136
43071
|
initialized: getInitialized,
|
|
43137
|
-
loginAndRedirect,
|
|
43138
|
-
openFeedback,
|
|
43139
|
-
initializeFeedbackOnce,
|
|
43140
|
-
isFeedbackLoaded,
|
|
43141
|
-
convertPendoToFeedbackOptions,
|
|
43072
|
+
loginAndRedirect: loginAndRedirect,
|
|
43073
|
+
openFeedback: openFeedback,
|
|
43074
|
+
initializeFeedbackOnce: initializeFeedbackOnce,
|
|
43075
|
+
isFeedbackLoaded: isFeedbackLoaded,
|
|
43076
|
+
convertPendoToFeedbackOptions: convertPendoToFeedbackOptions,
|
|
43142
43077
|
isUnsupportedIE: pendo._.partial(isUnsupportedIE, PluginAPI),
|
|
43143
|
-
removeFeedbackWidget
|
|
43078
|
+
removeFeedbackWidget: removeFeedbackWidget
|
|
43144
43079
|
};
|
|
43145
43080
|
pendo.feedback = publicFeedback;
|
|
43146
43081
|
pendo.getFeedbackSettings = getFeedbackSettings;
|
|
@@ -43171,7 +43106,7 @@ function Feedback() {
|
|
|
43171
43106
|
localStorageOnly: true
|
|
43172
43107
|
});
|
|
43173
43108
|
return {
|
|
43174
|
-
validate
|
|
43109
|
+
validate: validate
|
|
43175
43110
|
};
|
|
43176
43111
|
}
|
|
43177
43112
|
function teardown() {
|
|
@@ -43191,18 +43126,18 @@ function Feedback() {
|
|
|
43191
43126
|
return result;
|
|
43192
43127
|
}
|
|
43193
43128
|
function pingOrInitialize() {
|
|
43194
|
-
|
|
43129
|
+
var options = getPendoOptions();
|
|
43195
43130
|
if (initialized) {
|
|
43196
|
-
|
|
43131
|
+
var feedbackOptions = convertPendoToFeedbackOptions(options);
|
|
43197
43132
|
ping(feedbackOptions);
|
|
43198
43133
|
}
|
|
43199
43134
|
else if (shouldInitializeFeedback() && !globalPendo._.isEmpty(options)) {
|
|
43200
|
-
|
|
43201
|
-
init(options, settings)
|
|
43135
|
+
var settings = pluginApi.ConfigReader.get('feedbackSettings');
|
|
43136
|
+
init(options, settings)["catch"](globalPendo._.noop);
|
|
43202
43137
|
}
|
|
43203
43138
|
}
|
|
43204
43139
|
function handleIdentityChange(event) {
|
|
43205
|
-
|
|
43140
|
+
var visitorId = globalPendo._.get(event, 'data.0.visitor_id') || globalPendo._.get(event, 'data.0.options.visitor.id');
|
|
43206
43141
|
if (globalPendo.isAnonymousVisitor(visitorId)) {
|
|
43207
43142
|
removeFeedbackWidget();
|
|
43208
43143
|
return;
|
|
@@ -43272,9 +43207,9 @@ function Feedback() {
|
|
|
43272
43207
|
if (toSend.data && toSend.data !== '{}' && toSend.data !== 'null') {
|
|
43273
43208
|
return globalPendo.ajax
|
|
43274
43209
|
.postJSON(getFullUrl('/widget/pendo_ping'), toSend)
|
|
43275
|
-
.then((response)
|
|
43210
|
+
.then(function (response) {
|
|
43276
43211
|
onWidgetPingResponse(response);
|
|
43277
|
-
})
|
|
43212
|
+
})["catch"](function () { onPingFailure(); });
|
|
43278
43213
|
}
|
|
43279
43214
|
}
|
|
43280
43215
|
return pluginApi.q.resolve();
|
|
@@ -43408,10 +43343,10 @@ function Feedback() {
|
|
|
43408
43343
|
return globalPendo.ajax.postJSON(getFullUrl('/analytics'), toSend);
|
|
43409
43344
|
}
|
|
43410
43345
|
function addOverlay() {
|
|
43411
|
-
|
|
43346
|
+
var widget = globalPendo.dom("#".concat(elemIds.feedbackWidget));
|
|
43412
43347
|
if (!widget)
|
|
43413
43348
|
return;
|
|
43414
|
-
|
|
43349
|
+
var overlayStyles = {
|
|
43415
43350
|
'position': 'fixed',
|
|
43416
43351
|
'top': '0',
|
|
43417
43352
|
'right': '0',
|
|
@@ -43423,7 +43358,7 @@ function Feedback() {
|
|
|
43423
43358
|
'animation': 'pendoFeedbackFadeIn 0.5s 0s 1 alternate both',
|
|
43424
43359
|
'-webkit-animation': 'pendoFeedbackFadeIn 0.5s 0s 1 alternate both'
|
|
43425
43360
|
};
|
|
43426
|
-
|
|
43361
|
+
var overlayElement = globalPendo.dom(document.createElement('div'));
|
|
43427
43362
|
overlayElement.attr('id', 'feedback-overlay');
|
|
43428
43363
|
overlayElement.css(overlayStyles);
|
|
43429
43364
|
overlayElement.appendTo(widget.getParent());
|
|
@@ -43528,22 +43463,22 @@ function Feedback() {
|
|
|
43528
43463
|
}
|
|
43529
43464
|
}
|
|
43530
43465
|
function buildOuterTriggerDiv(positionInfo) {
|
|
43531
|
-
|
|
43532
|
-
|
|
43533
|
-
|
|
43466
|
+
var horizontalStyles = getHorizontalPositionStyles(positionInfo);
|
|
43467
|
+
var verticalStyles = getVerticalPositionStyles(positionInfo);
|
|
43468
|
+
var styles = globalPendo._.extend({
|
|
43534
43469
|
'position': 'fixed',
|
|
43535
43470
|
'height': '43px',
|
|
43536
43471
|
'opacity': '1 !important',
|
|
43537
43472
|
'z-index': '9001'
|
|
43538
43473
|
}, horizontalStyles, verticalStyles);
|
|
43539
|
-
|
|
43474
|
+
var outerTrigger = globalPendo.dom(document.createElement('div'));
|
|
43540
43475
|
outerTrigger.attr('id', elemIds.feedbackTrigger);
|
|
43541
43476
|
outerTrigger.css(styles);
|
|
43542
43477
|
outerTrigger.attr('data-turbolinks-permanent', '');
|
|
43543
43478
|
return outerTrigger;
|
|
43544
43479
|
}
|
|
43545
43480
|
function buildNotification() {
|
|
43546
|
-
|
|
43481
|
+
var styles = {
|
|
43547
43482
|
'background-color': '#D85039',
|
|
43548
43483
|
'color': '#fff',
|
|
43549
43484
|
'border-radius': '50%',
|
|
@@ -43560,20 +43495,20 @@ function Feedback() {
|
|
|
43560
43495
|
'animation-delay': '1s',
|
|
43561
43496
|
'animation-iteration-count': '1'
|
|
43562
43497
|
};
|
|
43563
|
-
|
|
43498
|
+
var notification = globalPendo.dom(document.createElement('span'));
|
|
43564
43499
|
notification.attr('id', 'feedback-trigger-notification');
|
|
43565
43500
|
notification.css(styles);
|
|
43566
43501
|
return notification;
|
|
43567
43502
|
}
|
|
43568
43503
|
function buildTriggerButton(settings, positionInfo) {
|
|
43569
|
-
|
|
43504
|
+
var borderRadius;
|
|
43570
43505
|
if (positionInfo.horizontalPosition === 'left') {
|
|
43571
43506
|
borderRadius = '0 0 5px 5px';
|
|
43572
43507
|
}
|
|
43573
43508
|
else {
|
|
43574
43509
|
borderRadius = '3px 3px 0 0';
|
|
43575
43510
|
}
|
|
43576
|
-
|
|
43511
|
+
var styles = {
|
|
43577
43512
|
'border': 'none',
|
|
43578
43513
|
'padding': '11px 18px 14px 18px',
|
|
43579
43514
|
'background-color': settings.triggerColor,
|
|
@@ -43584,32 +43519,21 @@ function Feedback() {
|
|
|
43584
43519
|
'cursor': 'pointer',
|
|
43585
43520
|
'text-align': 'left'
|
|
43586
43521
|
};
|
|
43587
|
-
|
|
43522
|
+
var triggerButton = globalPendo.dom(document.createElement('button'));
|
|
43588
43523
|
triggerButton.attr('id', elemIds.feedbackTriggerButton);
|
|
43589
43524
|
triggerButton.css(styles);
|
|
43590
43525
|
triggerButton.text(settings.triggerText);
|
|
43591
43526
|
return triggerButton;
|
|
43592
43527
|
}
|
|
43593
43528
|
function addTriggerPseudoStyles() {
|
|
43594
|
-
|
|
43595
|
-
#feedback-trigger button:hover {
|
|
43596
|
-
box-shadow: 0 -5px 20px rgba(0,0,0,.19) !important;
|
|
43597
|
-
outline: none !important;
|
|
43598
|
-
background: #3e566f !important;
|
|
43599
|
-
}
|
|
43600
|
-
#feedback-trigger button:focus {
|
|
43601
|
-
box-shadow: 0 -5px 20px rgba(0,0,0,.19) !important;
|
|
43602
|
-
outline: none !important;
|
|
43603
|
-
background: #3e566f !important;
|
|
43604
|
-
}
|
|
43605
|
-
`;
|
|
43529
|
+
var pseudoStyles = "\n #feedback-trigger button:hover {\n box-shadow: 0 -5px 20px rgba(0,0,0,.19) !important;\n outline: none !important;\n background: #3e566f !important;\n }\n #feedback-trigger button:focus {\n box-shadow: 0 -5px 20px rgba(0,0,0,.19) !important;\n outline: none !important;\n background: #3e566f !important;\n }\n ";
|
|
43606
43530
|
pluginApi.util.addInlineStyles('pendo-feedback-trigger-styles', pseudoStyles);
|
|
43607
43531
|
}
|
|
43608
43532
|
function createTrigger(settings, positionInfo) {
|
|
43609
43533
|
addTriggerPseudoStyles();
|
|
43610
|
-
|
|
43611
|
-
|
|
43612
|
-
|
|
43534
|
+
var triggerElement = buildOuterTriggerDiv(positionInfo);
|
|
43535
|
+
var notificationElement = buildNotification();
|
|
43536
|
+
var triggerButtonElement = buildTriggerButton(settings, positionInfo);
|
|
43613
43537
|
triggerElement.append(notificationElement);
|
|
43614
43538
|
triggerElement.append(triggerButtonElement);
|
|
43615
43539
|
triggerElement.appendTo(globalPendo.dom.getBody());
|
|
@@ -43633,7 +43557,7 @@ function Feedback() {
|
|
|
43633
43557
|
iframeWrapper.css(getWidgetOriginalStyles());
|
|
43634
43558
|
iframeWrapper.attr('id', elemIds.feedbackWidget);
|
|
43635
43559
|
iframeWrapper.attr('data-turbolinks-permanent', 'true');
|
|
43636
|
-
iframeWrapper.addClass(
|
|
43560
|
+
iframeWrapper.addClass("buttonIs-".concat(horizontalPosition));
|
|
43637
43561
|
return iframeWrapper;
|
|
43638
43562
|
}
|
|
43639
43563
|
function buildIframeContainer() {
|
|
@@ -43650,22 +43574,13 @@ function Feedback() {
|
|
|
43650
43574
|
return iframeContainer;
|
|
43651
43575
|
}
|
|
43652
43576
|
function addWidgetVisibleButtonStyles(buttonStylePosition) {
|
|
43653
|
-
|
|
43654
|
-
|
|
43655
|
-
.buttonIs-${side}.visible {
|
|
43656
|
-
${side}: 0 !important;
|
|
43657
|
-
width: 470px !important;
|
|
43658
|
-
animation-direction: alternate-reverse !important;
|
|
43659
|
-
animation: pendoFeedbackSlideFrom-${side} 0.5s 0s 1 alternate both !important;
|
|
43660
|
-
-webkit-animation: pendoFeedbackSlideFrom-${side} 0.5s 0s 1 alternate both !important;
|
|
43661
|
-
z-index: 9002 !important;
|
|
43662
|
-
}
|
|
43663
|
-
`;
|
|
43577
|
+
var side = buttonStylePosition === 'left' ? 'left' : 'right'; // just in case something was not left or right for some reason
|
|
43578
|
+
var styles = "\n .buttonIs-".concat(side, ".visible {\n ").concat(side, ": 0 !important;\n width: 470px !important;\n animation-direction: alternate-reverse !important;\n animation: pendoFeedbackSlideFrom-").concat(side, " 0.5s 0s 1 alternate both !important;\n -webkit-animation: pendoFeedbackSlideFrom-").concat(side, " 0.5s 0s 1 alternate both !important;\n z-index: 9002 !important;\n }\n ");
|
|
43664
43579
|
pluginApi.util.addInlineStyles(elemIds.feedbackFrameStyles, styles);
|
|
43665
43580
|
}
|
|
43666
43581
|
function initialiseWidgetFrame(horizontalPosition) {
|
|
43667
43582
|
addWidgetVisibleButtonStyles(horizontalPosition);
|
|
43668
|
-
|
|
43583
|
+
var iframeElement = buildIframeWrapper(horizontalPosition);
|
|
43669
43584
|
iframeElement.append(buildIframeContainer());
|
|
43670
43585
|
iframeElement.appendTo(globalPendo.dom.getBody());
|
|
43671
43586
|
subscribeToIframeMessages();
|
|
@@ -43689,7 +43604,7 @@ function Feedback() {
|
|
|
43689
43604
|
return widgetLoaded;
|
|
43690
43605
|
}
|
|
43691
43606
|
function getPendoOptions() {
|
|
43692
|
-
|
|
43607
|
+
var options = pluginApi.ConfigReader.getLocalConfig();
|
|
43693
43608
|
if (!globalPendo._.isObject(options))
|
|
43694
43609
|
options = {};
|
|
43695
43610
|
if (!globalPendo._.isObject(options.visitor))
|
|
@@ -43717,7 +43632,7 @@ function Feedback() {
|
|
|
43717
43632
|
return true;
|
|
43718
43633
|
}
|
|
43719
43634
|
function getQueryParam(url, paramName) {
|
|
43720
|
-
|
|
43635
|
+
var results = new RegExp('[?&]' + paramName + '=([^&#]*)').exec(url);
|
|
43721
43636
|
if (results == null) {
|
|
43722
43637
|
return null;
|
|
43723
43638
|
}
|
|
@@ -43734,13 +43649,13 @@ function Feedback() {
|
|
|
43734
43649
|
return pluginApi.q.reject();
|
|
43735
43650
|
if (!canInitFeedback(pendoOptions))
|
|
43736
43651
|
return pluginApi.q.reject();
|
|
43737
|
-
|
|
43652
|
+
var feedbackOptions = convertPendoToFeedbackOptions(pendoOptions);
|
|
43738
43653
|
try {
|
|
43739
|
-
|
|
43740
|
-
if (
|
|
43654
|
+
var fdbkDst_1 = getQueryParam(globalPendo.url.get(), 'fdbkDst');
|
|
43655
|
+
if (fdbkDst_1 && fdbkDst_1.startsWith('case')) {
|
|
43741
43656
|
initialized = true;
|
|
43742
43657
|
getFeedbackLoginUrl().then(function (loginUrl) {
|
|
43743
|
-
|
|
43658
|
+
var destinationUrl = loginUrl + '&fdbkDst=' + fdbkDst_1;
|
|
43744
43659
|
window.location.href = destinationUrl;
|
|
43745
43660
|
});
|
|
43746
43661
|
return;
|
|
@@ -43789,7 +43704,7 @@ function Feedback() {
|
|
|
43789
43704
|
function convertPendoToFeedbackOptions(options) {
|
|
43790
43705
|
var jwtOptions = pluginApi.agent.getJwtInfoCopy();
|
|
43791
43706
|
if (globalPendo._.isEmpty(jwtOptions)) {
|
|
43792
|
-
|
|
43707
|
+
var feedbackOptions = {};
|
|
43793
43708
|
feedbackOptions.user = globalPendo._.pick(options.visitor, 'id', 'full_name', 'firstName', 'lastName', 'email', 'tags', 'custom_allowed_products');
|
|
43794
43709
|
globalPendo._.extend(feedbackOptions.user, { allowed_products: [{ id: feedbackAllowedProductId }] });
|
|
43795
43710
|
feedbackOptions.account = globalPendo._.pick(options.account, 'id', 'name', 'monthly_value', 'is_paying', 'tags');
|
|
@@ -49324,31 +49239,32 @@ var n;
|
|
|
49324
49239
|
}(n || (n = {}));
|
|
49325
49240
|
return record; }
|
|
49326
49241
|
|
|
49327
|
-
|
|
49328
|
-
|
|
49242
|
+
var SessionRecorderBuffer = /** @class */ (function () {
|
|
49243
|
+
function SessionRecorderBuffer(interval, maxCount) {
|
|
49244
|
+
if (maxCount === void 0) { maxCount = Infinity; }
|
|
49329
49245
|
this.data = [];
|
|
49330
49246
|
this.sequenceNumber = 0;
|
|
49331
49247
|
this.interval = interval;
|
|
49332
49248
|
this.maxCount = maxCount;
|
|
49333
49249
|
this.doubledMaxCount = maxCount * 2;
|
|
49334
49250
|
}
|
|
49335
|
-
isEmpty() {
|
|
49251
|
+
SessionRecorderBuffer.prototype.isEmpty = function () {
|
|
49336
49252
|
return this.data.length === 0;
|
|
49337
|
-
}
|
|
49338
|
-
count() {
|
|
49253
|
+
};
|
|
49254
|
+
SessionRecorderBuffer.prototype.count = function () {
|
|
49339
49255
|
return this.data.length;
|
|
49340
|
-
}
|
|
49341
|
-
clear() {
|
|
49256
|
+
};
|
|
49257
|
+
SessionRecorderBuffer.prototype.clear = function () {
|
|
49342
49258
|
this.data.length = 0;
|
|
49343
|
-
}
|
|
49344
|
-
clearSequence() {
|
|
49259
|
+
};
|
|
49260
|
+
SessionRecorderBuffer.prototype.clearSequence = function () {
|
|
49345
49261
|
this.sequenceNumber = 0;
|
|
49346
|
-
}
|
|
49347
|
-
push(event) {
|
|
49262
|
+
};
|
|
49263
|
+
SessionRecorderBuffer.prototype.push = function (event) {
|
|
49348
49264
|
this.data.push(event);
|
|
49349
49265
|
this.checkRateLimit();
|
|
49350
|
-
}
|
|
49351
|
-
pack(envelope, _) {
|
|
49266
|
+
};
|
|
49267
|
+
SessionRecorderBuffer.prototype.pack = function (envelope, _) {
|
|
49352
49268
|
var eventsToSend = this.data.splice(0, this.maxCount);
|
|
49353
49269
|
envelope.recordingPayload = eventsToSend;
|
|
49354
49270
|
envelope.sequence = this.sequenceNumber;
|
|
@@ -49356,8 +49272,8 @@ class SessionRecorderBuffer {
|
|
|
49356
49272
|
if (eventsToSend.length) {
|
|
49357
49273
|
envelope.browserTime = eventsToSend[0].timestamp;
|
|
49358
49274
|
}
|
|
49359
|
-
envelope.recordingPayloadMetadata = _.map(eventsToSend, event
|
|
49360
|
-
|
|
49275
|
+
envelope.recordingPayloadMetadata = _.map(eventsToSend, function (event) {
|
|
49276
|
+
var metadata = _.pick(event, 'type', 'timestamp');
|
|
49361
49277
|
if (event.data) {
|
|
49362
49278
|
metadata.data = _.pick(event.data, 'source', 'type', 'x', 'y', 'id', 'height', 'width', 'href');
|
|
49363
49279
|
}
|
|
@@ -49365,18 +49281,30 @@ class SessionRecorderBuffer {
|
|
|
49365
49281
|
});
|
|
49366
49282
|
this.sequenceNumber += eventsToSend.length;
|
|
49367
49283
|
return envelope;
|
|
49368
|
-
}
|
|
49369
|
-
checkRateLimit() {
|
|
49370
|
-
|
|
49284
|
+
};
|
|
49285
|
+
SessionRecorderBuffer.prototype.checkRateLimit = function () {
|
|
49286
|
+
var length = this.data.length;
|
|
49371
49287
|
if (length >= this.doubledMaxCount && length % this.maxCount === 0) {
|
|
49372
|
-
|
|
49288
|
+
var elapsed = this.data[length - 1].timestamp - this.data[length - this.doubledMaxCount].timestamp;
|
|
49373
49289
|
if (elapsed <= this.interval && this.onRateLimit) {
|
|
49374
49290
|
this.onRateLimit();
|
|
49375
49291
|
}
|
|
49376
49292
|
}
|
|
49377
|
-
}
|
|
49378
|
-
|
|
49293
|
+
};
|
|
49294
|
+
return SessionRecorderBuffer;
|
|
49295
|
+
}());
|
|
49379
49296
|
|
|
49297
|
+
var __assign = function() {
|
|
49298
|
+
__assign = Object.assign || function __assign(t) {
|
|
49299
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
49300
|
+
s = arguments[i];
|
|
49301
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
49302
|
+
}
|
|
49303
|
+
return t;
|
|
49304
|
+
};
|
|
49305
|
+
return __assign.apply(this, arguments);
|
|
49306
|
+
};
|
|
49307
|
+
|
|
49380
49308
|
function __rest(s, e) {
|
|
49381
49309
|
var t = {};
|
|
49382
49310
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -49399,24 +49327,52 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
49399
49327
|
});
|
|
49400
49328
|
}
|
|
49401
49329
|
|
|
49330
|
+
function __generator(thisArg, body) {
|
|
49331
|
+
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);
|
|
49332
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
49333
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
49334
|
+
function step(op) {
|
|
49335
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
49336
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
49337
|
+
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;
|
|
49338
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
49339
|
+
switch (op[0]) {
|
|
49340
|
+
case 0: case 1: t = op; break;
|
|
49341
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
49342
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
49343
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
49344
|
+
default:
|
|
49345
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
49346
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
49347
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
49348
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
49349
|
+
if (t[2]) _.ops.pop();
|
|
49350
|
+
_.trys.pop(); continue;
|
|
49351
|
+
}
|
|
49352
|
+
op = body.call(thisArg, _);
|
|
49353
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
49354
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
49355
|
+
}
|
|
49356
|
+
}
|
|
49357
|
+
|
|
49402
49358
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
49403
49359
|
var e = new Error(message);
|
|
49404
49360
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
49405
49361
|
};
|
|
49406
49362
|
|
|
49407
|
-
|
|
49408
|
-
|
|
49409
|
-
|
|
49410
|
-
|
|
49411
|
-
|
|
49363
|
+
var RECORDING_CONFIG_WORKERURL$1 = 'recording.workerUrl';
|
|
49364
|
+
var MAX_SIZE = 2000000;
|
|
49365
|
+
var RESOURCE_CACHING$1 = 'resourceCaching';
|
|
49366
|
+
var Transport = /** @class */ (function () {
|
|
49367
|
+
function Transport(WorkerClass, pendo, api) {
|
|
49412
49368
|
this.WorkerClass = WorkerClass;
|
|
49413
49369
|
this.pendo = pendo;
|
|
49414
49370
|
this.api = api;
|
|
49415
49371
|
this.maxSize = MAX_SIZE;
|
|
49416
|
-
this.lockID =
|
|
49372
|
+
this.lockID = "worker-lock-".concat(this.pendo.randomString(16));
|
|
49417
49373
|
this.isResourceCachingEnabled = this.api.ConfigReader.get(RESOURCE_CACHING$1);
|
|
49418
49374
|
}
|
|
49419
|
-
start(config) {
|
|
49375
|
+
Transport.prototype.start = function (config) {
|
|
49420
49376
|
if (config.disableWorker)
|
|
49421
49377
|
return;
|
|
49422
49378
|
if (!this.worker) {
|
|
@@ -49426,7 +49382,7 @@ class Transport {
|
|
|
49426
49382
|
this.worker = config.workerOverride;
|
|
49427
49383
|
}
|
|
49428
49384
|
else {
|
|
49429
|
-
|
|
49385
|
+
var workerUrl = this.api.ConfigReader.get(RECORDING_CONFIG_WORKERURL$1);
|
|
49430
49386
|
this.usesSelfHostedWorker = workerUrl != null;
|
|
49431
49387
|
this.worker = workerUrl ? new Worker(workerUrl) : new this.WorkerClass();
|
|
49432
49388
|
}
|
|
@@ -49440,34 +49396,35 @@ class Transport {
|
|
|
49440
49396
|
this.worker = null;
|
|
49441
49397
|
}
|
|
49442
49398
|
}
|
|
49443
|
-
}
|
|
49444
|
-
stop() {
|
|
49399
|
+
};
|
|
49400
|
+
Transport.prototype.stop = function () {
|
|
49445
49401
|
if (this.worker) {
|
|
49446
49402
|
this.worker.terminate();
|
|
49447
49403
|
delete this.worker;
|
|
49448
49404
|
}
|
|
49449
|
-
}
|
|
49450
|
-
send(envelope, isUnload, failureCount
|
|
49451
|
-
|
|
49452
|
-
|
|
49405
|
+
};
|
|
49406
|
+
Transport.prototype.send = function (envelope, isUnload, failureCount) {
|
|
49407
|
+
if (failureCount === void 0) { failureCount = 0; }
|
|
49408
|
+
var url = envelope.url;
|
|
49409
|
+
var payload = envelope.payload;
|
|
49453
49410
|
if (failureCount > 0) {
|
|
49454
|
-
url =
|
|
49411
|
+
url = "".concat(url, "&rt=").concat(failureCount);
|
|
49455
49412
|
}
|
|
49456
49413
|
if (this.worker && !isUnload && payload) {
|
|
49457
|
-
|
|
49458
|
-
|
|
49459
|
-
|
|
49460
|
-
|
|
49414
|
+
var deferred_1 = {};
|
|
49415
|
+
deferred_1.promise = new Promise$2(function (resolve, reject) {
|
|
49416
|
+
deferred_1.resolve = resolve;
|
|
49417
|
+
deferred_1.reject = reject;
|
|
49461
49418
|
});
|
|
49462
|
-
this.workerResponse =
|
|
49463
|
-
this.worker.postMessage({ url, payload, shouldCacheResources: this.isResourceCachingEnabled });
|
|
49464
|
-
return
|
|
49419
|
+
this.workerResponse = deferred_1;
|
|
49420
|
+
this.worker.postMessage({ url: url, payload: payload, shouldCacheResources: this.isResourceCachingEnabled });
|
|
49421
|
+
return deferred_1.promise;
|
|
49465
49422
|
}
|
|
49466
49423
|
else {
|
|
49467
49424
|
if (!envelope.body) {
|
|
49468
|
-
|
|
49425
|
+
var strPayload = JSON.stringify(payload);
|
|
49469
49426
|
if (strPayload.length > this.maxSize) {
|
|
49470
|
-
|
|
49427
|
+
var error = new Error('maximum recording payload size exceeded');
|
|
49471
49428
|
error.reason = 'HEAVY_EVENT';
|
|
49472
49429
|
error.context = {
|
|
49473
49430
|
size: strPayload.length,
|
|
@@ -49478,14 +49435,14 @@ class Transport {
|
|
|
49478
49435
|
envelope.body = this.pendo.compress(strPayload, 'binary');
|
|
49479
49436
|
delete envelope.payload;
|
|
49480
49437
|
}
|
|
49481
|
-
url =
|
|
49438
|
+
url = "".concat(url, "&ct=").concat(new Date().getTime());
|
|
49482
49439
|
return this.post(url, {
|
|
49483
49440
|
keepalive: isUnload,
|
|
49484
49441
|
body: envelope.body
|
|
49485
49442
|
});
|
|
49486
49443
|
}
|
|
49487
|
-
}
|
|
49488
|
-
post(url, options) {
|
|
49444
|
+
};
|
|
49445
|
+
Transport.prototype.post = function (url, options) {
|
|
49489
49446
|
options.method = 'POST';
|
|
49490
49447
|
if (options.keepalive && this.api.transmit.fetchKeepalive.supported()) {
|
|
49491
49448
|
return this.api.transmit.fetchKeepalive(url, options);
|
|
@@ -49497,46 +49454,57 @@ class Transport {
|
|
|
49497
49454
|
else {
|
|
49498
49455
|
return this.pendo.ajax.post(url, options.body);
|
|
49499
49456
|
}
|
|
49500
|
-
}
|
|
49501
|
-
_onMessage(messageEvent) {
|
|
49502
|
-
return __awaiter(this, void 0, void 0, function
|
|
49503
|
-
|
|
49504
|
-
|
|
49505
|
-
|
|
49506
|
-
|
|
49507
|
-
|
|
49508
|
-
|
|
49509
|
-
|
|
49510
|
-
|
|
49511
|
-
|
|
49512
|
-
|
|
49513
|
-
|
|
49514
|
-
|
|
49515
|
-
|
|
49516
|
-
|
|
49517
|
-
|
|
49518
|
-
|
|
49519
|
-
|
|
49520
|
-
|
|
49521
|
-
|
|
49457
|
+
};
|
|
49458
|
+
Transport.prototype._onMessage = function (messageEvent) {
|
|
49459
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
49460
|
+
return __generator(this, function (_a) {
|
|
49461
|
+
switch (_a.label) {
|
|
49462
|
+
case 0:
|
|
49463
|
+
if (!(messageEvent.data && messageEvent.data.ready && navigator.locks)) return [3 /*break*/, 2];
|
|
49464
|
+
// When the lock is released, we can assume the worker was terminated or closed
|
|
49465
|
+
return [4 /*yield*/, navigator.locks.request(this.lockID, function () { })];
|
|
49466
|
+
case 1:
|
|
49467
|
+
// When the lock is released, we can assume the worker was terminated or closed
|
|
49468
|
+
_a.sent();
|
|
49469
|
+
this.onWorkerMessage({ type: 'workerDied' });
|
|
49470
|
+
_a.label = 2;
|
|
49471
|
+
case 2:
|
|
49472
|
+
// handle non-POST request responses from worker
|
|
49473
|
+
if (messageEvent.data && messageEvent.data.type) {
|
|
49474
|
+
this.onWorkerMessage(messageEvent.data);
|
|
49475
|
+
return [2 /*return*/];
|
|
49476
|
+
}
|
|
49477
|
+
// handle POST request response from worker
|
|
49478
|
+
if (messageEvent.data && messageEvent.data.error) {
|
|
49479
|
+
if ((messageEvent.data.status && messageEvent.data.status < 500) ||
|
|
49480
|
+
messageEvent.data.sequence == null) {
|
|
49481
|
+
this.api.log.critical('Failed to send recording data from web worker', { error: messageEvent.data.error });
|
|
49482
|
+
}
|
|
49483
|
+
if (this.workerResponse) {
|
|
49484
|
+
this.workerResponse.reject();
|
|
49485
|
+
this.workerResponse = null;
|
|
49486
|
+
}
|
|
49487
|
+
}
|
|
49488
|
+
if (this.workerResponse) {
|
|
49489
|
+
this.workerResponse.resolve();
|
|
49490
|
+
this.workerResponse = null;
|
|
49491
|
+
}
|
|
49492
|
+
return [2 /*return*/];
|
|
49522
49493
|
}
|
|
49523
|
-
}
|
|
49524
|
-
if (this.workerResponse) {
|
|
49525
|
-
this.workerResponse.resolve();
|
|
49526
|
-
this.workerResponse = null;
|
|
49527
|
-
}
|
|
49494
|
+
});
|
|
49528
49495
|
});
|
|
49529
|
-
}
|
|
49530
|
-
_onError() {
|
|
49496
|
+
};
|
|
49497
|
+
Transport.prototype._onError = function () {
|
|
49531
49498
|
if (this.onError) {
|
|
49532
49499
|
this.onError();
|
|
49533
49500
|
}
|
|
49534
|
-
}
|
|
49535
|
-
|
|
49501
|
+
};
|
|
49502
|
+
return Transport;
|
|
49503
|
+
}());
|
|
49536
49504
|
|
|
49537
|
-
|
|
49538
|
-
|
|
49539
|
-
|
|
49505
|
+
var ELEMENT_NODE = 1;
|
|
49506
|
+
var INPUT_MASK = '*'.repeat(10);
|
|
49507
|
+
var NUMBER_INPUT_MASK = '0'.repeat(10);
|
|
49540
49508
|
function isElementNode(node) {
|
|
49541
49509
|
if (!node)
|
|
49542
49510
|
return false;
|
|
@@ -49545,10 +49513,12 @@ function isElementNode(node) {
|
|
|
49545
49513
|
return true;
|
|
49546
49514
|
}
|
|
49547
49515
|
function getParent(elem) {
|
|
49548
|
-
|
|
49516
|
+
var isElementShadowRoot = typeof window.ShadowRoot !== 'undefined' && elem instanceof window.ShadowRoot && elem.host;
|
|
49549
49517
|
return isElementShadowRoot ? elem.host : elem.parentNode;
|
|
49550
49518
|
}
|
|
49551
|
-
function distanceToMatch(node, selector, limit
|
|
49519
|
+
function distanceToMatch(node, selector, limit, distance) {
|
|
49520
|
+
if (limit === void 0) { limit = Infinity; }
|
|
49521
|
+
if (distance === void 0) { distance = 0; }
|
|
49552
49522
|
if (distance > limit)
|
|
49553
49523
|
return -1;
|
|
49554
49524
|
if (!node)
|
|
@@ -49562,15 +49532,15 @@ function distanceToMatch(node, selector, limit = Infinity, distance = 0) {
|
|
|
49562
49532
|
return distanceToMatch(getParent(node), selector, limit, distance + 1);
|
|
49563
49533
|
}
|
|
49564
49534
|
function shouldMask(node, options) {
|
|
49565
|
-
|
|
49535
|
+
var maskAllText = options.maskAllText, maskTextSelector = options.maskTextSelector, unmaskTextSelector = options.unmaskTextSelector;
|
|
49566
49536
|
try {
|
|
49567
|
-
|
|
49537
|
+
var el = isElementNode(node) ? node : node.parentElement;
|
|
49568
49538
|
if (el === null)
|
|
49569
49539
|
return false;
|
|
49570
49540
|
if ((el.tagName || '').toUpperCase() === 'STYLE')
|
|
49571
49541
|
return false;
|
|
49572
|
-
|
|
49573
|
-
|
|
49542
|
+
var maskDistance = -1;
|
|
49543
|
+
var unmaskDistance = -1;
|
|
49574
49544
|
if (maskAllText) {
|
|
49575
49545
|
unmaskDistance = distanceToMatch(el, unmaskTextSelector);
|
|
49576
49546
|
if (unmaskDistance < 0) {
|
|
@@ -49603,8 +49573,8 @@ function isNumberInput(element) {
|
|
|
49603
49573
|
}
|
|
49604
49574
|
function shouldMaskInput(element, maskInputOptions) {
|
|
49605
49575
|
if (maskInputOptions && isElementNode(element)) {
|
|
49606
|
-
|
|
49607
|
-
|
|
49576
|
+
var tagName = (element.tagName || '').toLowerCase();
|
|
49577
|
+
var type = (element.type || '').toLowerCase();
|
|
49608
49578
|
if (maskInputOptions[tagName] || maskInputOptions[type]) {
|
|
49609
49579
|
return true;
|
|
49610
49580
|
}
|
|
@@ -51098,12 +51068,12 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
|
|
|
51098
51068
|
}
|
|
51099
51069
|
}
|
|
51100
51070
|
|
|
51101
|
-
|
|
51071
|
+
var ONE_HUNDRED_MB_IN_BYTES = 100 * 1024 * 1024;
|
|
51102
51072
|
function matchHostedResources(recordingEvent, stringifiedRecordingPayload) {
|
|
51103
|
-
|
|
51104
|
-
|
|
51073
|
+
var fontURLRegex = /https:\/\/[^"\\\s]+?\.(woff2?|ttf|otf|eot)(\?[^"\\\s]*)?\b/g;
|
|
51074
|
+
var matches = stringifiedRecordingPayload.match(fontURLRegex);
|
|
51105
51075
|
// de-duplicate matches
|
|
51106
|
-
|
|
51076
|
+
var hostedResources = matches ? Array.from(new Set(matches)) : [];
|
|
51107
51077
|
return {
|
|
51108
51078
|
type: 'recording',
|
|
51109
51079
|
visitorId: recordingEvent.visitorId,
|
|
@@ -51118,7 +51088,7 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
|
|
|
51118
51088
|
recordingPayloadMetadata: [],
|
|
51119
51089
|
sequence: 0,
|
|
51120
51090
|
recordingPayloadCount: 0,
|
|
51121
|
-
hostedResources
|
|
51091
|
+
hostedResources: hostedResources
|
|
51122
51092
|
};
|
|
51123
51093
|
}
|
|
51124
51094
|
// keep in mind changes here may need addressing in the extension worker proxy as well
|
|
@@ -51126,69 +51096,69 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
|
|
|
51126
51096
|
try {
|
|
51127
51097
|
if (e.data.type === 'init' && e.data.lockID) {
|
|
51128
51098
|
if (navigator.locks) {
|
|
51129
|
-
navigator.locks.request(e.data.lockID, ()
|
|
51099
|
+
navigator.locks.request(e.data.lockID, function () {
|
|
51130
51100
|
postMessage({ ready: true });
|
|
51131
51101
|
// This unresolved promise keeps the lock held with the worker until the worker is
|
|
51132
51102
|
// terminated at which point the lock is released.
|
|
51133
|
-
return new Promise$2(()
|
|
51103
|
+
return new Promise$2(function () { });
|
|
51134
51104
|
});
|
|
51135
51105
|
}
|
|
51136
51106
|
return;
|
|
51137
51107
|
}
|
|
51138
51108
|
if (e.data.url && e.data.payload) {
|
|
51139
|
-
|
|
51109
|
+
var _a = e.data, url = _a.url, payload = _a.payload, shouldCacheResources = _a.shouldCacheResources;
|
|
51140
51110
|
if (Object.keys(payload).length === 0) {
|
|
51141
51111
|
postMessage({
|
|
51142
51112
|
type: 'emptyPayload'
|
|
51143
51113
|
});
|
|
51144
51114
|
}
|
|
51145
|
-
|
|
51146
|
-
|
|
51115
|
+
var sequence_1 = payload.sequence;
|
|
51116
|
+
var stringifiedRecordingPayload = JSON.stringify(payload.recordingPayload);
|
|
51147
51117
|
// calculate and post back the recording payload size before the payload is compressed
|
|
51148
|
-
|
|
51149
|
-
|
|
51118
|
+
var recordingPayloadSize = new TextEncoder().encode(stringifiedRecordingPayload).length;
|
|
51119
|
+
var exceedsPayloadSizeLimit = recordingPayloadSize >= ONE_HUNDRED_MB_IN_BYTES;
|
|
51150
51120
|
postMessage({
|
|
51151
51121
|
type: 'recordingPayloadSize',
|
|
51152
|
-
recordingPayloadSize,
|
|
51153
|
-
exceedsPayloadSizeLimit
|
|
51122
|
+
recordingPayloadSize: recordingPayloadSize,
|
|
51123
|
+
exceedsPayloadSizeLimit: exceedsPayloadSizeLimit
|
|
51154
51124
|
});
|
|
51155
51125
|
// don't attempt to send the payload if it exceeds the allowed limit
|
|
51156
51126
|
if (exceedsPayloadSizeLimit)
|
|
51157
51127
|
return;
|
|
51158
51128
|
if (shouldCacheResources) {
|
|
51159
|
-
|
|
51129
|
+
var hostedResourcesEvent = matchHostedResources(payload, stringifiedRecordingPayload);
|
|
51160
51130
|
if (hostedResourcesEvent.hostedResources.length) {
|
|
51161
51131
|
postMessage({
|
|
51162
51132
|
type: 'hostedResources',
|
|
51163
|
-
hostedResourcesEvent
|
|
51133
|
+
hostedResourcesEvent: hostedResourcesEvent
|
|
51164
51134
|
});
|
|
51165
51135
|
}
|
|
51166
51136
|
}
|
|
51167
51137
|
payload.recordingSize = recordingPayloadSize;
|
|
51168
|
-
|
|
51138
|
+
var body = compress(payload, 'binary');
|
|
51169
51139
|
// we want to calculate ct (current time) as close as we can to the actual POST request
|
|
51170
51140
|
// so that it's as accurate as possible
|
|
51171
|
-
url =
|
|
51141
|
+
url = "".concat(url, "&ct=").concat(new Date().getTime());
|
|
51172
51142
|
fetch(url, {
|
|
51173
51143
|
method: 'POST',
|
|
51174
|
-
body
|
|
51144
|
+
body: body
|
|
51175
51145
|
}).then(function (response) {
|
|
51176
51146
|
if (response.status < 200 || response.status >= 300) {
|
|
51177
51147
|
postMessage({
|
|
51178
|
-
error: new Error(
|
|
51148
|
+
error: new Error("received status code ".concat(response.status, ": ").concat(response.statusText)),
|
|
51179
51149
|
status: response.status,
|
|
51180
|
-
sequence
|
|
51150
|
+
sequence: sequence_1
|
|
51181
51151
|
});
|
|
51182
51152
|
}
|
|
51183
51153
|
else {
|
|
51184
51154
|
postMessage({
|
|
51185
|
-
sequence
|
|
51155
|
+
sequence: sequence_1
|
|
51186
51156
|
});
|
|
51187
51157
|
}
|
|
51188
|
-
})
|
|
51158
|
+
})["catch"](function (e) {
|
|
51189
51159
|
postMessage({
|
|
51190
51160
|
error: e,
|
|
51191
|
-
sequence
|
|
51161
|
+
sequence: sequence_1
|
|
51192
51162
|
});
|
|
51193
51163
|
});
|
|
51194
51164
|
}
|
|
@@ -51499,7 +51469,7 @@ function includes(str, substring) {
|
|
|
51499
51469
|
function getResourceType(blockedURI, directive) {
|
|
51500
51470
|
if (!directive || typeof directive !== 'string')
|
|
51501
51471
|
return 'resource';
|
|
51502
|
-
|
|
51472
|
+
var d = directive.toLowerCase();
|
|
51503
51473
|
if (blockedURI === 'inline') {
|
|
51504
51474
|
if (includes(d, 'script-src-attr')) {
|
|
51505
51475
|
return 'inline event handler';
|
|
@@ -51558,11 +51528,12 @@ function getResourceType(blockedURI, directive) {
|
|
|
51558
51528
|
function getDirective(policy, directiveName) {
|
|
51559
51529
|
if (!policy || !directiveName)
|
|
51560
51530
|
return '';
|
|
51561
|
-
|
|
51562
|
-
for (
|
|
51563
|
-
|
|
51564
|
-
|
|
51565
|
-
|
|
51531
|
+
var needle = directiveName.toLowerCase();
|
|
51532
|
+
for (var _i = 0, _a = policy.split(';'); _i < _a.length; _i++) {
|
|
51533
|
+
var directive = _a[_i];
|
|
51534
|
+
var trimmed = directive.trim();
|
|
51535
|
+
var lower = trimmed.toLowerCase();
|
|
51536
|
+
if (lower === needle || lower.startsWith("".concat(needle, " "))) {
|
|
51566
51537
|
return trimmed;
|
|
51567
51538
|
}
|
|
51568
51539
|
}
|
|
@@ -51584,7 +51555,7 @@ function getDirective(policy, directiveName) {
|
|
|
51584
51555
|
function getArticle(phrase) {
|
|
51585
51556
|
if (!phrase || typeof phrase !== 'string')
|
|
51586
51557
|
return 'A';
|
|
51587
|
-
|
|
51558
|
+
var c = phrase.trim().charAt(0).toLowerCase();
|
|
51588
51559
|
return includes('aeiou', c) ? 'An' : 'A';
|
|
51589
51560
|
}
|
|
51590
51561
|
/**
|
|
@@ -51627,46 +51598,47 @@ function createCspViolationMessage(blockedURI, directive, isReportOnly, original
|
|
|
51627
51598
|
return 'Content Security Policy: Unknown violation occurred.';
|
|
51628
51599
|
}
|
|
51629
51600
|
try {
|
|
51630
|
-
|
|
51601
|
+
var reportOnlyText = isReportOnly ? ' (Report-Only)' : '';
|
|
51631
51602
|
// special case for frame-ancestors since it doesn't fit our template at all
|
|
51632
51603
|
if ((directive === null || directive === void 0 ? void 0 : directive.toLowerCase()) === 'frame-ancestors') {
|
|
51633
|
-
return
|
|
51604
|
+
return "Content Security Policy".concat(reportOnlyText, ": The display of ").concat(blockedURI, " in a frame was blocked because an ancestor violates your site's frame-ancestors policy.\nCurrent CSP: \"").concat(originalPolicy, "\".");
|
|
51634
51605
|
}
|
|
51635
|
-
|
|
51636
|
-
|
|
51637
|
-
|
|
51638
|
-
|
|
51639
|
-
|
|
51640
|
-
|
|
51641
|
-
return
|
|
51606
|
+
var resourceType = getResourceType(blockedURI, directive);
|
|
51607
|
+
var article = getArticle(resourceType);
|
|
51608
|
+
var source = formatBlockedUri(blockedURI);
|
|
51609
|
+
var directiveValue = getDirective(originalPolicy, directive);
|
|
51610
|
+
var policyDisplay = directiveValue || directive;
|
|
51611
|
+
var resourceDescription = "".concat(article, " ").concat(resourceType).concat(source ? " from ".concat(source) : '');
|
|
51612
|
+
return "Content Security Policy".concat(reportOnlyText, ": ").concat(resourceDescription, " was blocked by your site's `").concat(policyDisplay, "` policy.\nCurrent CSP: \"").concat(originalPolicy, "\".");
|
|
51642
51613
|
}
|
|
51643
51614
|
catch (error) {
|
|
51644
|
-
return
|
|
51615
|
+
return "Content Security Policy: Error formatting violation message: ".concat(error.message);
|
|
51645
51616
|
}
|
|
51646
51617
|
}
|
|
51647
51618
|
|
|
51648
|
-
|
|
51649
|
-
|
|
51619
|
+
var MAX_LENGTH = 1000;
|
|
51620
|
+
var PII_PATTERN = {
|
|
51650
51621
|
ip: /\b(?:\d{1,3}\.){3}\d{1,3}\b/g,
|
|
51651
51622
|
ssn: /\b\d{3}-\d{2}-\d{4}\b/g,
|
|
51652
51623
|
creditCard: /\b(?:\d[ -]?){12,18}\d\b/g,
|
|
51653
51624
|
httpsUrls: /https:\/\/[^\s]+/g,
|
|
51654
51625
|
email: /[\w._+-]+@[\w.-]+\.\w+/g
|
|
51655
51626
|
};
|
|
51656
|
-
|
|
51657
|
-
|
|
51658
|
-
|
|
51659
|
-
|
|
51660
|
-
|
|
51627
|
+
var PII_REPLACEMENT = '*'.repeat(10);
|
|
51628
|
+
var JSON_PII_KEYS = ['password', 'email', 'key', 'token', 'auth', 'authentication', 'phone', 'address', 'ssn'];
|
|
51629
|
+
var UNABLE_TO_DISPLAY_BODY = '[Unable to display body: detected PII could not be redacted]';
|
|
51630
|
+
var joinedKeys = JSON_PII_KEYS.join('|');
|
|
51631
|
+
var keyPattern = "\"([^\"]*(?:".concat(joinedKeys, ")[^\"]*)\"");
|
|
51661
51632
|
// only scrub strings, numbers, and booleans
|
|
51662
|
-
|
|
51633
|
+
var acceptedValues = '("([^"\\\\]*(?:\\\\.[^"\\\\]*)*")|(\\d+)|(true|false))';
|
|
51663
51634
|
/**
|
|
51664
51635
|
* Truncates a string to the max length
|
|
51665
51636
|
* @access private
|
|
51666
51637
|
* @param {String} string
|
|
51667
51638
|
* @returns {String}
|
|
51668
51639
|
*/
|
|
51669
|
-
function truncate(string, includeEllipsis
|
|
51640
|
+
function truncate(string, includeEllipsis) {
|
|
51641
|
+
if (includeEllipsis === void 0) { includeEllipsis = false; }
|
|
51670
51642
|
if (string.length <= MAX_LENGTH)
|
|
51671
51643
|
return string;
|
|
51672
51644
|
if (includeEllipsis) {
|
|
@@ -51683,7 +51655,7 @@ function truncate(string, includeEllipsis = false) {
|
|
|
51683
51655
|
* @returns {String}
|
|
51684
51656
|
*/
|
|
51685
51657
|
function generateLogKey(methodName, message, stackTrace) {
|
|
51686
|
-
return
|
|
51658
|
+
return "".concat(methodName, "|").concat(message, "|").concat(stackTrace);
|
|
51687
51659
|
}
|
|
51688
51660
|
/**
|
|
51689
51661
|
* Checks if a string has 2 or more digits, a https URL, or an email address
|
|
@@ -51700,12 +51672,13 @@ function mightContainPII(string) {
|
|
|
51700
51672
|
* @param {String} string
|
|
51701
51673
|
* @returns {String}
|
|
51702
51674
|
*/
|
|
51703
|
-
function scrubPII(
|
|
51675
|
+
function scrubPII(_a) {
|
|
51676
|
+
var string = _a.string, _ = _a._;
|
|
51704
51677
|
if (!string || typeof string !== 'string')
|
|
51705
51678
|
return string;
|
|
51706
51679
|
if (!mightContainPII(string))
|
|
51707
51680
|
return string;
|
|
51708
|
-
return _.reduce(_.values(PII_PATTERN), (str, pattern)
|
|
51681
|
+
return _.reduce(_.values(PII_PATTERN), function (str, pattern) { return str.replace(pattern, PII_REPLACEMENT); }, string);
|
|
51709
51682
|
}
|
|
51710
51683
|
/**
|
|
51711
51684
|
* Scrub PII from a stringified JSON object
|
|
@@ -51714,12 +51687,14 @@ function scrubPII({ string, _ }) {
|
|
|
51714
51687
|
* @returns {String}
|
|
51715
51688
|
*/
|
|
51716
51689
|
function scrubJsonPII(string) {
|
|
51717
|
-
|
|
51690
|
+
var fullScrubRegex = new RegExp("".concat(keyPattern, "\\s*:\\s*[\\{\\[]"), 'i');
|
|
51718
51691
|
if (fullScrubRegex.test(string)) {
|
|
51719
51692
|
return UNABLE_TO_DISPLAY_BODY;
|
|
51720
51693
|
}
|
|
51721
|
-
|
|
51722
|
-
return string.replace(keyValueScrubRegex, (match, key)
|
|
51694
|
+
var keyValueScrubRegex = new RegExp("".concat(keyPattern, "\\s*:\\s*").concat(acceptedValues), 'gi');
|
|
51695
|
+
return string.replace(keyValueScrubRegex, function (match, key) {
|
|
51696
|
+
return "\"".concat(key, "\":\"").concat(PII_REPLACEMENT, "\"");
|
|
51697
|
+
});
|
|
51723
51698
|
}
|
|
51724
51699
|
/**
|
|
51725
51700
|
* Checks if a string is a JSON object
|
|
@@ -51731,7 +51706,7 @@ function scrubJsonPII(string) {
|
|
|
51731
51706
|
function mightContainJson(string, contentType) {
|
|
51732
51707
|
if (!string || typeof string !== 'string')
|
|
51733
51708
|
return false;
|
|
51734
|
-
|
|
51709
|
+
var firstChar = string.charAt(0);
|
|
51735
51710
|
if (contentType && contentType.indexOf('application/json') !== -1) {
|
|
51736
51711
|
return true;
|
|
51737
51712
|
}
|
|
@@ -51744,19 +51719,20 @@ function mightContainJson(string, contentType) {
|
|
|
51744
51719
|
* @param {String} contentType
|
|
51745
51720
|
* @returns {String}
|
|
51746
51721
|
*/
|
|
51747
|
-
function maskSensitiveFields(
|
|
51722
|
+
function maskSensitiveFields(_a) {
|
|
51723
|
+
var string = _a.string, contentType = _a.contentType, _ = _a._;
|
|
51748
51724
|
if (!string || typeof string !== 'string')
|
|
51749
51725
|
return string;
|
|
51750
51726
|
if (mightContainJson(string, contentType)) {
|
|
51751
51727
|
string = scrubJsonPII(string);
|
|
51752
51728
|
}
|
|
51753
51729
|
if (mightContainPII(string)) {
|
|
51754
|
-
string = scrubPII({ string, _ });
|
|
51730
|
+
string = scrubPII({ string: string, _: _ });
|
|
51755
51731
|
}
|
|
51756
51732
|
return string;
|
|
51757
51733
|
}
|
|
51758
51734
|
|
|
51759
|
-
|
|
51735
|
+
var DEV_LOG_TYPE = 'devlog';
|
|
51760
51736
|
function createDevLogEnvelope(pluginAPI, globalPendo) {
|
|
51761
51737
|
return {
|
|
51762
51738
|
browser_time: pluginAPI.util.getNow(),
|
|
@@ -51767,12 +51743,12 @@ function createDevLogEnvelope(pluginAPI, globalPendo) {
|
|
|
51767
51743
|
};
|
|
51768
51744
|
}
|
|
51769
51745
|
|
|
51770
|
-
|
|
51771
|
-
|
|
51772
|
-
|
|
51773
|
-
|
|
51774
|
-
|
|
51775
|
-
|
|
51746
|
+
var TOKEN_MAX_SIZE = 100;
|
|
51747
|
+
var TOKEN_REFILL_RATE = 10;
|
|
51748
|
+
var TOKEN_REFRESH_INTERVAL = 1000;
|
|
51749
|
+
var MAX_UNCOMPRESSED_SIZE = 125000; // 125KB
|
|
51750
|
+
var DevlogBuffer = /** @class */ (function () {
|
|
51751
|
+
function DevlogBuffer(pendo, pluginAPI) {
|
|
51776
51752
|
this.pendo = pendo;
|
|
51777
51753
|
this.pluginAPI = pluginAPI;
|
|
51778
51754
|
this.events = [];
|
|
@@ -51783,36 +51759,36 @@ class DevlogBuffer {
|
|
|
51783
51759
|
this.lastRefillTime = this.pluginAPI.util.getNow();
|
|
51784
51760
|
this.nextRefillTime = this.lastRefillTime + TOKEN_REFRESH_INTERVAL;
|
|
51785
51761
|
}
|
|
51786
|
-
isEmpty() {
|
|
51762
|
+
DevlogBuffer.prototype.isEmpty = function () {
|
|
51787
51763
|
return this.events.length === 0 && this.payloads.length === 0;
|
|
51788
|
-
}
|
|
51789
|
-
refillTokens() {
|
|
51790
|
-
|
|
51764
|
+
};
|
|
51765
|
+
DevlogBuffer.prototype.refillTokens = function () {
|
|
51766
|
+
var now = this.pluginAPI.util.getNow();
|
|
51791
51767
|
if (now >= this.nextRefillTime) {
|
|
51792
|
-
|
|
51793
|
-
|
|
51794
|
-
|
|
51768
|
+
var timeSinceLastRefill = now - this.lastRefillTime;
|
|
51769
|
+
var secondsSinceLastRefill = Math.floor(timeSinceLastRefill / TOKEN_REFRESH_INTERVAL);
|
|
51770
|
+
var tokensToRefill = secondsSinceLastRefill * TOKEN_REFILL_RATE;
|
|
51795
51771
|
this.tokens = Math.min(this.tokens + tokensToRefill, TOKEN_MAX_SIZE);
|
|
51796
51772
|
this.lastRefillTime = now;
|
|
51797
51773
|
this.nextRefillTime = now + TOKEN_REFRESH_INTERVAL;
|
|
51798
51774
|
}
|
|
51799
|
-
}
|
|
51800
|
-
clear() {
|
|
51775
|
+
};
|
|
51776
|
+
DevlogBuffer.prototype.clear = function () {
|
|
51801
51777
|
this.events = [];
|
|
51802
51778
|
this.lastEvent = null;
|
|
51803
51779
|
this.uncompressedSize = 0;
|
|
51804
|
-
}
|
|
51805
|
-
hasTokenAvailable() {
|
|
51780
|
+
};
|
|
51781
|
+
DevlogBuffer.prototype.hasTokenAvailable = function () {
|
|
51806
51782
|
this.refillTokens();
|
|
51807
51783
|
return this.tokens > 0;
|
|
51808
|
-
}
|
|
51809
|
-
estimateEventSize(event) {
|
|
51784
|
+
};
|
|
51785
|
+
DevlogBuffer.prototype.estimateEventSize = function (event) {
|
|
51810
51786
|
return JSON.stringify(event).length;
|
|
51811
|
-
}
|
|
51812
|
-
push(event) {
|
|
51787
|
+
};
|
|
51788
|
+
DevlogBuffer.prototype.push = function (event) {
|
|
51813
51789
|
if (!this.hasTokenAvailable())
|
|
51814
51790
|
return false;
|
|
51815
|
-
|
|
51791
|
+
var eventSize = this.estimateEventSize(event);
|
|
51816
51792
|
if (this.uncompressedSize + eventSize > MAX_UNCOMPRESSED_SIZE) {
|
|
51817
51793
|
this.compressCurrentChunk();
|
|
51818
51794
|
}
|
|
@@ -51821,54 +51797,55 @@ class DevlogBuffer {
|
|
|
51821
51797
|
this.events.push(event);
|
|
51822
51798
|
this.tokens = Math.max(this.tokens - 1, 0);
|
|
51823
51799
|
return true;
|
|
51824
|
-
}
|
|
51825
|
-
compressCurrentChunk() {
|
|
51800
|
+
};
|
|
51801
|
+
DevlogBuffer.prototype.compressCurrentChunk = function () {
|
|
51826
51802
|
if (this.events.length === 0)
|
|
51827
51803
|
return;
|
|
51828
|
-
|
|
51804
|
+
var jzb = this.pendo.compress(this.events);
|
|
51829
51805
|
this.payloads.push(jzb);
|
|
51830
51806
|
this.clear();
|
|
51831
|
-
}
|
|
51832
|
-
generateUrl() {
|
|
51833
|
-
|
|
51807
|
+
};
|
|
51808
|
+
DevlogBuffer.prototype.generateUrl = function () {
|
|
51809
|
+
var queryParams = {
|
|
51834
51810
|
v: this.pendo.VERSION,
|
|
51835
51811
|
ct: this.pluginAPI.util.getNow()
|
|
51836
51812
|
};
|
|
51837
51813
|
return this.pluginAPI.transmit.buildBaseDataUrl(DEV_LOG_TYPE, this.pendo.apiKey, queryParams);
|
|
51838
|
-
}
|
|
51839
|
-
pack() {
|
|
51814
|
+
};
|
|
51815
|
+
DevlogBuffer.prototype.pack = function () {
|
|
51840
51816
|
if (this.isEmpty())
|
|
51841
51817
|
return;
|
|
51842
|
-
|
|
51818
|
+
var url = this.generateUrl();
|
|
51843
51819
|
this.compressCurrentChunk();
|
|
51844
|
-
|
|
51845
|
-
jzb,
|
|
51846
|
-
url
|
|
51847
|
-
}));
|
|
51820
|
+
var payloads = this.pendo._.map(this.payloads, function (jzb) { return ({
|
|
51821
|
+
jzb: jzb,
|
|
51822
|
+
url: url
|
|
51823
|
+
}); });
|
|
51848
51824
|
this.payloads = [];
|
|
51849
51825
|
return payloads;
|
|
51850
|
-
}
|
|
51851
|
-
|
|
51826
|
+
};
|
|
51827
|
+
return DevlogBuffer;
|
|
51828
|
+
}());
|
|
51852
51829
|
|
|
51853
|
-
|
|
51854
|
-
|
|
51830
|
+
var DevlogTransport = /** @class */ (function () {
|
|
51831
|
+
function DevlogTransport(globalPendo, pluginAPI) {
|
|
51855
51832
|
this.pendo = globalPendo;
|
|
51856
51833
|
this.pluginAPI = pluginAPI;
|
|
51857
51834
|
}
|
|
51858
|
-
buildGetUrl(baseUrl, jzb) {
|
|
51859
|
-
|
|
51835
|
+
DevlogTransport.prototype.buildGetUrl = function (baseUrl, jzb) {
|
|
51836
|
+
var params = {};
|
|
51860
51837
|
if (this.pluginAPI.agent.treatAsAdoptPartner()) {
|
|
51861
51838
|
this.pluginAPI.agent.addAccountIdParams(params, this.pendo.get_account_id(), this.pluginAPI.ConfigReader.get('oemAccountId'));
|
|
51862
51839
|
}
|
|
51863
|
-
|
|
51840
|
+
var jwtOptions = this.pluginAPI.agent.getJwtInfoCopy();
|
|
51864
51841
|
if (!this.pendo._.isEmpty(jwtOptions)) {
|
|
51865
51842
|
this.pendo._.extend(params, jwtOptions);
|
|
51866
51843
|
}
|
|
51867
51844
|
params.jzb = jzb;
|
|
51868
|
-
|
|
51869
|
-
return
|
|
51870
|
-
}
|
|
51871
|
-
get(url, options) {
|
|
51845
|
+
var queryString = this.pendo._.map(params, function (value, key) { return "".concat(key, "=").concat(value); }).join('&');
|
|
51846
|
+
return "".concat(baseUrl).concat(baseUrl.indexOf('?') !== -1 ? '&' : '?').concat(queryString);
|
|
51847
|
+
};
|
|
51848
|
+
DevlogTransport.prototype.get = function (url, options) {
|
|
51872
51849
|
options.method = 'GET';
|
|
51873
51850
|
if (this.pluginAPI.transmit.fetchKeepalive.supported()) {
|
|
51874
51851
|
return this.pluginAPI.transmit.fetchKeepalive(url, options);
|
|
@@ -51876,86 +51853,90 @@ class DevlogTransport {
|
|
|
51876
51853
|
else {
|
|
51877
51854
|
return this.pendo.ajax.get(url);
|
|
51878
51855
|
}
|
|
51879
|
-
}
|
|
51880
|
-
sendRequestWithGet
|
|
51881
|
-
|
|
51856
|
+
};
|
|
51857
|
+
DevlogTransport.prototype.sendRequestWithGet = function (_a) {
|
|
51858
|
+
var url = _a.url, jzb = _a.jzb;
|
|
51859
|
+
var getUrl = this.buildGetUrl(url, jzb);
|
|
51882
51860
|
return this.get(getUrl, {
|
|
51883
51861
|
headers: {
|
|
51884
51862
|
'Content-Type': 'application/octet-stream'
|
|
51885
51863
|
}
|
|
51886
51864
|
});
|
|
51887
|
-
}
|
|
51888
|
-
post(url, options) {
|
|
51865
|
+
};
|
|
51866
|
+
DevlogTransport.prototype.post = function (url, options) {
|
|
51889
51867
|
options.method = 'POST';
|
|
51890
51868
|
if (options.keepalive && this.pluginAPI.transmit.fetchKeepalive.supported()) {
|
|
51891
51869
|
return this.pluginAPI.transmit.fetchKeepalive(url, options);
|
|
51892
51870
|
}
|
|
51893
51871
|
else if (options.keepalive && this.pluginAPI.transmit.sendBeacon.supported()) {
|
|
51894
|
-
|
|
51872
|
+
var result = this.pluginAPI.transmit.sendBeacon(url, new Blob([options.body]));
|
|
51895
51873
|
return result ? Promise$2.resolve() : Promise$2.reject(new Error('sendBeacon failed to send devlog data'));
|
|
51896
51874
|
}
|
|
51897
51875
|
else {
|
|
51898
51876
|
return this.pendo.ajax.post(url, options.body);
|
|
51899
51877
|
}
|
|
51900
|
-
}
|
|
51901
|
-
sendRequestWithPost
|
|
51902
|
-
|
|
51903
|
-
|
|
51878
|
+
};
|
|
51879
|
+
DevlogTransport.prototype.sendRequestWithPost = function (_a, isUnload) {
|
|
51880
|
+
var url = _a.url, jzb = _a.jzb;
|
|
51881
|
+
var jwtOptions = this.pluginAPI.agent.getJwtInfoCopy();
|
|
51882
|
+
var bodyPayload = {
|
|
51904
51883
|
events: jzb,
|
|
51905
51884
|
browser_time: this.pluginAPI.util.getNow()
|
|
51906
51885
|
};
|
|
51907
51886
|
if (this.pluginAPI.agent.treatAsAdoptPartner()) {
|
|
51908
51887
|
this.pluginAPI.agent.addAccountIdParams(bodyPayload, this.pendo.get_account_id(), this.pluginAPI.ConfigReader.get('oemAccountId'));
|
|
51909
51888
|
}
|
|
51910
|
-
|
|
51889
|
+
var body = JSON.stringify(this.pendo._.extend(bodyPayload, jwtOptions));
|
|
51911
51890
|
return this.post(url, {
|
|
51912
|
-
body,
|
|
51891
|
+
body: body,
|
|
51913
51892
|
headers: {
|
|
51914
51893
|
'Content-Type': 'application/json'
|
|
51915
51894
|
},
|
|
51916
51895
|
keepalive: isUnload
|
|
51917
51896
|
});
|
|
51918
|
-
}
|
|
51919
|
-
sendRequest
|
|
51920
|
-
|
|
51897
|
+
};
|
|
51898
|
+
DevlogTransport.prototype.sendRequest = function (_a, isUnload) {
|
|
51899
|
+
var url = _a.url, jzb = _a.jzb;
|
|
51900
|
+
var compressedLength = jzb.length;
|
|
51921
51901
|
if (compressedLength <= this.pluginAPI.constants.ENCODED_EVENT_MAX_LENGTH && !this.pluginAPI.ConfigReader.get('sendEventsWithPostOnly')) {
|
|
51922
|
-
return this.sendRequestWithGet({ url, jzb });
|
|
51902
|
+
return this.sendRequestWithGet({ url: url, jzb: jzb });
|
|
51923
51903
|
}
|
|
51924
|
-
return this.sendRequestWithPost({ url, jzb }, isUnload);
|
|
51925
|
-
}
|
|
51926
|
-
|
|
51904
|
+
return this.sendRequestWithPost({ url: url, jzb: jzb }, isUnload);
|
|
51905
|
+
};
|
|
51906
|
+
return DevlogTransport;
|
|
51907
|
+
}());
|
|
51927
51908
|
|
|
51928
51909
|
function ConsoleCapture() {
|
|
51929
|
-
|
|
51930
|
-
|
|
51931
|
-
|
|
51932
|
-
|
|
51933
|
-
|
|
51934
|
-
|
|
51935
|
-
|
|
51936
|
-
|
|
51937
|
-
|
|
51938
|
-
|
|
51939
|
-
|
|
51940
|
-
|
|
51910
|
+
var pluginAPI;
|
|
51911
|
+
var _;
|
|
51912
|
+
var globalPendo;
|
|
51913
|
+
var buffer;
|
|
51914
|
+
var sendQueue;
|
|
51915
|
+
var sendInterval;
|
|
51916
|
+
var transport;
|
|
51917
|
+
var isPtmPaused;
|
|
51918
|
+
var isCapturingConsoleLogs = false;
|
|
51919
|
+
var CAPTURE_CONSOLE_CONFIG = 'captureConsoleLogs';
|
|
51920
|
+
var CONSOLE_METHODS = ['log', 'warn', 'error', 'info'];
|
|
51921
|
+
var DEV_LOG_SUB_TYPE = 'console';
|
|
51941
51922
|
// deduplicate logs
|
|
51942
|
-
|
|
51923
|
+
var lastLogKey = '';
|
|
51943
51924
|
return {
|
|
51944
51925
|
name: 'ConsoleCapture',
|
|
51945
|
-
initialize,
|
|
51946
|
-
teardown,
|
|
51947
|
-
addIntercepts,
|
|
51948
|
-
createConsoleEvent,
|
|
51949
|
-
captureStackTrace,
|
|
51950
|
-
send,
|
|
51951
|
-
setCaptureState,
|
|
51952
|
-
recordingStarted,
|
|
51953
|
-
recordingStopped,
|
|
51954
|
-
onAppHidden,
|
|
51955
|
-
onAppUnloaded,
|
|
51956
|
-
onPtmPaused,
|
|
51957
|
-
onPtmUnpaused,
|
|
51958
|
-
securityPolicyViolationFn,
|
|
51926
|
+
initialize: initialize,
|
|
51927
|
+
teardown: teardown,
|
|
51928
|
+
addIntercepts: addIntercepts,
|
|
51929
|
+
createConsoleEvent: createConsoleEvent,
|
|
51930
|
+
captureStackTrace: captureStackTrace,
|
|
51931
|
+
send: send,
|
|
51932
|
+
setCaptureState: setCaptureState,
|
|
51933
|
+
recordingStarted: recordingStarted,
|
|
51934
|
+
recordingStopped: recordingStopped,
|
|
51935
|
+
onAppHidden: onAppHidden,
|
|
51936
|
+
onAppUnloaded: onAppUnloaded,
|
|
51937
|
+
onPtmPaused: onPtmPaused,
|
|
51938
|
+
onPtmUnpaused: onPtmUnpaused,
|
|
51939
|
+
securityPolicyViolationFn: securityPolicyViolationFn,
|
|
51959
51940
|
get isCapturingConsoleLogs() {
|
|
51960
51941
|
return isCapturingConsoleLogs;
|
|
51961
51942
|
},
|
|
@@ -51972,16 +51953,16 @@ function ConsoleCapture() {
|
|
|
51972
51953
|
function initialize(pendo, PluginAPI) {
|
|
51973
51954
|
_ = pendo._;
|
|
51974
51955
|
pluginAPI = PluginAPI;
|
|
51975
|
-
|
|
51956
|
+
var ConfigReader = pluginAPI.ConfigReader;
|
|
51976
51957
|
ConfigReader.addOption(CAPTURE_CONSOLE_CONFIG, [ConfigReader.sources.PENDO_CONFIG_SRC], false);
|
|
51977
|
-
|
|
51958
|
+
var captureConsoleEnabled = ConfigReader.get(CAPTURE_CONSOLE_CONFIG);
|
|
51978
51959
|
if (!captureConsoleEnabled)
|
|
51979
51960
|
return;
|
|
51980
51961
|
globalPendo = pendo;
|
|
51981
51962
|
buffer = new DevlogBuffer(pendo, pluginAPI);
|
|
51982
51963
|
transport = new DevlogTransport(pendo, pluginAPI);
|
|
51983
51964
|
sendQueue = new pluginAPI.SendQueue(transport.sendRequest.bind(transport));
|
|
51984
|
-
sendInterval = setInterval(()
|
|
51965
|
+
sendInterval = setInterval(function () {
|
|
51985
51966
|
if (!sendQueue.failed()) {
|
|
51986
51967
|
send();
|
|
51987
51968
|
}
|
|
@@ -52007,17 +51988,19 @@ function ConsoleCapture() {
|
|
|
52007
51988
|
function onPtmUnpaused() {
|
|
52008
51989
|
isPtmPaused = false;
|
|
52009
51990
|
if (!buffer.isEmpty()) {
|
|
52010
|
-
for (
|
|
52011
|
-
|
|
51991
|
+
for (var _i = 0, _a = buffer.events; _i < _a.length; _i++) {
|
|
51992
|
+
var event_1 = _a[_i];
|
|
51993
|
+
pluginAPI.Events.eventCaptured.trigger(event_1);
|
|
52012
51994
|
}
|
|
52013
51995
|
send();
|
|
52014
51996
|
}
|
|
52015
51997
|
}
|
|
52016
|
-
function setCaptureState(
|
|
51998
|
+
function setCaptureState(_a) {
|
|
51999
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.shouldCapture, shouldCapture = _c === void 0 ? false : _c, _d = _b.reason, reason = _d === void 0 ? '' : _d;
|
|
52017
52000
|
if (shouldCapture === isCapturingConsoleLogs)
|
|
52018
52001
|
return;
|
|
52019
52002
|
isCapturingConsoleLogs = shouldCapture;
|
|
52020
|
-
pluginAPI.log.info(
|
|
52003
|
+
pluginAPI.log.info("[ConsoleCapture] Console log capture ".concat(shouldCapture ? 'started' : 'stopped').concat(reason ? ": ".concat(reason) : ''));
|
|
52021
52004
|
}
|
|
52022
52005
|
function recordingStarted() {
|
|
52023
52006
|
setCaptureState({ shouldCapture: true, reason: 'recording started' });
|
|
@@ -52037,12 +52020,12 @@ function ConsoleCapture() {
|
|
|
52037
52020
|
}
|
|
52038
52021
|
function addIntercepts() {
|
|
52039
52022
|
_.each(CONSOLE_METHODS, function (methodName) {
|
|
52040
|
-
|
|
52023
|
+
var originalMethod = console[methodName];
|
|
52041
52024
|
if (!originalMethod)
|
|
52042
52025
|
return;
|
|
52043
52026
|
console[methodName] = _.wrap(originalMethod, function (originalFn) {
|
|
52044
52027
|
// slice 1 to omit originalFn
|
|
52045
|
-
|
|
52028
|
+
var args = _.toArray(arguments).slice(1);
|
|
52046
52029
|
originalFn.apply(console, args);
|
|
52047
52030
|
createConsoleEvent(args, methodName);
|
|
52048
52031
|
});
|
|
@@ -52054,10 +52037,10 @@ function ConsoleCapture() {
|
|
|
52054
52037
|
function securityPolicyViolationFn(evt) {
|
|
52055
52038
|
if (!evt || typeof evt !== 'object')
|
|
52056
52039
|
return;
|
|
52057
|
-
|
|
52058
|
-
|
|
52059
|
-
|
|
52060
|
-
|
|
52040
|
+
var blockedURI = evt.blockedURI, violatedDirective = evt.violatedDirective, effectiveDirective = evt.effectiveDirective, disposition = evt.disposition, originalPolicy = evt.originalPolicy;
|
|
52041
|
+
var directive = violatedDirective || effectiveDirective;
|
|
52042
|
+
var isReportOnly = disposition === 'report';
|
|
52043
|
+
var message = createCspViolationMessage(blockedURI, directive, isReportOnly, originalPolicy);
|
|
52061
52044
|
if (isReportOnly) {
|
|
52062
52045
|
createConsoleEvent([message], 'warn', { skipStackTrace: true, skipScrubPII: true });
|
|
52063
52046
|
}
|
|
@@ -52065,12 +52048,13 @@ function ConsoleCapture() {
|
|
|
52065
52048
|
createConsoleEvent([message], 'error', { skipStackTrace: true, skipScrubPII: true });
|
|
52066
52049
|
}
|
|
52067
52050
|
}
|
|
52068
|
-
function createConsoleEvent(args, methodName,
|
|
52051
|
+
function createConsoleEvent(args, methodName, _a) {
|
|
52052
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.skipStackTrace, skipStackTrace = _c === void 0 ? false : _c, _d = _b.skipScrubPII, skipScrubPII = _d === void 0 ? false : _d;
|
|
52069
52053
|
if (!isCapturingConsoleLogs || !args || args.length === 0 || !_.contains(CONSOLE_METHODS, methodName))
|
|
52070
52054
|
return;
|
|
52071
52055
|
// stringify args
|
|
52072
|
-
|
|
52073
|
-
|
|
52056
|
+
var message = _.compact(_.map(args, function (arg) {
|
|
52057
|
+
var stringifiedArg;
|
|
52074
52058
|
try {
|
|
52075
52059
|
stringifiedArg = stringify(arg);
|
|
52076
52060
|
}
|
|
@@ -52082,22 +52066,22 @@ function ConsoleCapture() {
|
|
|
52082
52066
|
if (!message)
|
|
52083
52067
|
return;
|
|
52084
52068
|
// capture stack trace
|
|
52085
|
-
|
|
52069
|
+
var stackTrace = '';
|
|
52086
52070
|
if (!skipStackTrace) {
|
|
52087
|
-
|
|
52071
|
+
var maxStackFrames = methodName === 'error' ? 4 : 1;
|
|
52088
52072
|
stackTrace = captureStackTrace(maxStackFrames);
|
|
52089
52073
|
}
|
|
52090
52074
|
// truncate message and stack trace
|
|
52091
52075
|
message = truncate(message);
|
|
52092
52076
|
stackTrace = truncate(stackTrace);
|
|
52093
52077
|
// de-duplicate log
|
|
52094
|
-
|
|
52078
|
+
var logKey = generateLogKey(methodName, message, stackTrace);
|
|
52095
52079
|
if (isExistingDuplicateLog(logKey)) {
|
|
52096
52080
|
buffer.lastEvent.devLogCount++;
|
|
52097
52081
|
return;
|
|
52098
52082
|
}
|
|
52099
|
-
|
|
52100
|
-
|
|
52083
|
+
var devLogEnvelope = createDevLogEnvelope(pluginAPI, globalPendo);
|
|
52084
|
+
var consoleEvent = __assign(__assign({}, devLogEnvelope), { subType: DEV_LOG_SUB_TYPE, devLogLevel: methodName === 'log' ? 'info' : methodName, devLogMessage: skipScrubPII ? message : scrubPII({ string: message, _: _ }), devLogTrace: stackTrace, devLogCount: 1 });
|
|
52101
52085
|
if (!buffer.hasTokenAvailable())
|
|
52102
52086
|
return consoleEvent;
|
|
52103
52087
|
if (!isPtmPaused) {
|
|
@@ -52109,8 +52093,8 @@ function ConsoleCapture() {
|
|
|
52109
52093
|
}
|
|
52110
52094
|
function captureStackTrace(maxStackFrames) {
|
|
52111
52095
|
try {
|
|
52112
|
-
|
|
52113
|
-
return _.map(stackFrames, frame
|
|
52096
|
+
var stackFrames = ErrorStackParser.parse(new Error(), maxStackFrames);
|
|
52097
|
+
return _.map(stackFrames, function (frame) { return frame.toString(); }).join('\n');
|
|
52114
52098
|
}
|
|
52115
52099
|
catch (error) {
|
|
52116
52100
|
return '';
|
|
@@ -52122,21 +52106,22 @@ function ConsoleCapture() {
|
|
|
52122
52106
|
function updateLastLog(logKey) {
|
|
52123
52107
|
lastLogKey = logKey;
|
|
52124
52108
|
}
|
|
52125
|
-
function send(
|
|
52109
|
+
function send(_a) {
|
|
52110
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.unload, unload = _c === void 0 ? false : _c, _d = _b.hidden, hidden = _d === void 0 ? false : _d;
|
|
52126
52111
|
if (!buffer || buffer.isEmpty())
|
|
52127
52112
|
return;
|
|
52128
52113
|
if (!globalPendo.isSendingEvents()) {
|
|
52129
52114
|
buffer.clear();
|
|
52130
52115
|
return;
|
|
52131
52116
|
}
|
|
52132
|
-
|
|
52117
|
+
var payloads = buffer.pack();
|
|
52133
52118
|
if (!payloads || payloads.length === 0)
|
|
52134
52119
|
return;
|
|
52135
52120
|
if (unload || hidden) {
|
|
52136
52121
|
sendQueue.drain(payloads, unload);
|
|
52137
52122
|
}
|
|
52138
52123
|
else {
|
|
52139
|
-
sendQueue.push(
|
|
52124
|
+
sendQueue.push.apply(sendQueue, payloads);
|
|
52140
52125
|
}
|
|
52141
52126
|
}
|
|
52142
52127
|
function teardown() {
|
|
@@ -52160,7 +52145,7 @@ function ConsoleCapture() {
|
|
|
52160
52145
|
_.each(CONSOLE_METHODS, function (methodName) {
|
|
52161
52146
|
if (!console[methodName])
|
|
52162
52147
|
return _.noop;
|
|
52163
|
-
|
|
52148
|
+
var unwrap = console[methodName]._pendoUnwrap;
|
|
52164
52149
|
if (_.isFunction(unwrap)) {
|
|
52165
52150
|
unwrap();
|
|
52166
52151
|
}
|
|
@@ -52951,21 +52936,21 @@ const PredictGuides = () => {
|
|
|
52951
52936
|
};
|
|
52952
52937
|
};
|
|
52953
52938
|
|
|
52954
|
-
|
|
52955
|
-
|
|
52956
|
-
|
|
52957
|
-
|
|
52958
|
-
|
|
52959
|
-
|
|
52960
|
-
|
|
52961
|
-
|
|
52962
|
-
|
|
52963
|
-
|
|
52964
|
-
|
|
52965
|
-
|
|
52966
|
-
|
|
52967
|
-
|
|
52968
|
-
|
|
52939
|
+
var ASSISTANT_MESSAGE = 'assistantMessage';
|
|
52940
|
+
var CONVERSATION_ID_URL_PATTERN = 'conversationIdUrlPattern';
|
|
52941
|
+
var MESSAGE_ID_ATTR = 'messageIdAttr';
|
|
52942
|
+
var MESSAGE_ID_PATTERN = 'messageIdPattern';
|
|
52943
|
+
var MODEL_USED_ATTR = 'modelUsedAttr';
|
|
52944
|
+
var REACTION_ACTIVE = 'reactionActive';
|
|
52945
|
+
var STREAMING_ACTIVE = 'streamingActive';
|
|
52946
|
+
var STREAMING_ACTIVE_ATTR = 'streamingActiveAttr';
|
|
52947
|
+
var THUMB_DOWN = 'thumbDown';
|
|
52948
|
+
var THUMB_UP = 'thumbUp';
|
|
52949
|
+
var TURN_CONTAINER = 'turnContainer';
|
|
52950
|
+
var USER_MESSAGE = 'userMessage';
|
|
52951
|
+
var CUSTOM_AGENT_ID_URL_PATTERN = 'customAgentIdUrlPattern';
|
|
52952
|
+
var CUSTOM_AGENT_NAME = 'customAgentName';
|
|
52953
|
+
var REQUIRED_SELECTORS = [
|
|
52969
52954
|
ASSISTANT_MESSAGE,
|
|
52970
52955
|
CONVERSATION_ID_URL_PATTERN,
|
|
52971
52956
|
MESSAGE_ID_ATTR,
|
|
@@ -52973,38 +52958,13 @@ const REQUIRED_SELECTORS = [
|
|
|
52973
52958
|
TURN_CONTAINER,
|
|
52974
52959
|
USER_MESSAGE
|
|
52975
52960
|
];
|
|
52976
|
-
|
|
52977
|
-
|
|
52978
|
-
|
|
52979
|
-
|
|
52980
|
-
|
|
52981
|
-
|
|
52982
|
-
|
|
52983
|
-
// valid for instantiation.
|
|
52984
|
-
static validateConfig(cssSelectors) {
|
|
52985
|
-
if (!Array.isArray(cssSelectors)) {
|
|
52986
|
-
return REQUIRED_SELECTORS.slice();
|
|
52987
|
-
}
|
|
52988
|
-
const present = new Set();
|
|
52989
|
-
for (const cfg of cssSelectors) {
|
|
52990
|
-
if (!cfg || !cfg.type || !cfg.cssSelector)
|
|
52991
|
-
continue;
|
|
52992
|
-
if (cfg.type === CONVERSATION_ID_URL_PATTERN) {
|
|
52993
|
-
try {
|
|
52994
|
-
RegExp(cfg.cssSelector);
|
|
52995
|
-
}
|
|
52996
|
-
catch (e) {
|
|
52997
|
-
continue;
|
|
52998
|
-
}
|
|
52999
|
-
}
|
|
53000
|
-
present.add(cfg.type);
|
|
53001
|
-
}
|
|
53002
|
-
return REQUIRED_SELECTORS.filter((r) => !present.has(r));
|
|
53003
|
-
}
|
|
53004
|
-
static supportedPreset(preset) {
|
|
53005
|
-
return SUPPORTED_PRESETS.indexOf(preset) !== -1;
|
|
53006
|
-
}
|
|
53007
|
-
constructor(pendo, PluginAPI, id, cssSelectors) {
|
|
52961
|
+
var SUPPORTED_PRESETS = ['chatgpt-full', 'gemini-full'];
|
|
52962
|
+
var STREAMING_END_SETTLE_MS = 500;
|
|
52963
|
+
var SUBMISSION_START_RETRY_MS = 1000;
|
|
52964
|
+
var SUBMISSION_START_MAX_ATTEMPTS = 4;
|
|
52965
|
+
var DOMConversation = /** @class */ (function () {
|
|
52966
|
+
function DOMConversation(pendo, PluginAPI, id, cssSelectors) {
|
|
52967
|
+
var _this = this;
|
|
53008
52968
|
this.selectors = {};
|
|
53009
52969
|
this.listeners = [];
|
|
53010
52970
|
this.isActive = true;
|
|
@@ -53023,72 +52983,99 @@ class DOMConversation {
|
|
|
53023
52983
|
this.Sizzle = pendo.Sizzle;
|
|
53024
52984
|
this.id = id;
|
|
53025
52985
|
if (!this._.isArray(cssSelectors)) {
|
|
53026
|
-
this.api.log.error(
|
|
52986
|
+
this.api.log.error("cssSelectors must be an array, received: ".concat(typeof cssSelectors));
|
|
53027
52987
|
cssSelectors = [];
|
|
53028
52988
|
}
|
|
53029
|
-
this._.each(cssSelectors, (cfg)
|
|
52989
|
+
this._.each(cssSelectors, function (cfg) {
|
|
53030
52990
|
if (cfg && cfg.type) {
|
|
53031
|
-
|
|
52991
|
+
_this.selectors[cfg.type] = cfg.cssSelector;
|
|
53032
52992
|
}
|
|
53033
52993
|
});
|
|
53034
52994
|
this.conversationIdRegex = new RegExp(this.selectors[CONVERSATION_ID_URL_PATTERN]);
|
|
53035
|
-
|
|
52995
|
+
var customAgentIdUrlPattern = this.selectors[CUSTOM_AGENT_ID_URL_PATTERN];
|
|
53036
52996
|
if (customAgentIdUrlPattern) { // this is optional
|
|
53037
52997
|
try {
|
|
53038
52998
|
this.customAgentIdRegex = new RegExp(customAgentIdUrlPattern);
|
|
53039
52999
|
}
|
|
53040
53000
|
catch (error) {
|
|
53041
|
-
this.api.log.error(
|
|
53001
|
+
this.api.log.error("bad customAgentIdUrlPattern ".concat(customAgentIdUrlPattern), { error: error });
|
|
53042
53002
|
}
|
|
53043
53003
|
}
|
|
53044
|
-
|
|
53004
|
+
var messageIdPattern = this.selectors[MESSAGE_ID_PATTERN];
|
|
53045
53005
|
if (messageIdPattern) { // optional: gates the request node until its id is fully rendered
|
|
53046
53006
|
try {
|
|
53047
53007
|
this.messageIdRegex = new RegExp(messageIdPattern);
|
|
53048
53008
|
}
|
|
53049
53009
|
catch (error) {
|
|
53050
|
-
this.api.log.error(
|
|
53010
|
+
this.api.log.error("bad messageIdPattern ".concat(messageIdPattern), { error: error });
|
|
53051
53011
|
}
|
|
53052
53012
|
}
|
|
53053
53013
|
this.root = document.body;
|
|
53054
53014
|
this.setupReactionListener();
|
|
53055
53015
|
this.setupStreamingObserver();
|
|
53056
53016
|
}
|
|
53057
|
-
|
|
53017
|
+
// Returns the list of required selector types that are missing or empty
|
|
53018
|
+
// in the given cssSelectors config. An empty array means the config is
|
|
53019
|
+
// valid for instantiation.
|
|
53020
|
+
DOMConversation.validateConfig = function (cssSelectors) {
|
|
53021
|
+
if (!Array.isArray(cssSelectors)) {
|
|
53022
|
+
return REQUIRED_SELECTORS.slice();
|
|
53023
|
+
}
|
|
53024
|
+
var present = new Set();
|
|
53025
|
+
for (var _i = 0, cssSelectors_1 = cssSelectors; _i < cssSelectors_1.length; _i++) {
|
|
53026
|
+
var cfg = cssSelectors_1[_i];
|
|
53027
|
+
if (!cfg || !cfg.type || !cfg.cssSelector)
|
|
53028
|
+
continue;
|
|
53029
|
+
if (cfg.type === CONVERSATION_ID_URL_PATTERN) {
|
|
53030
|
+
try {
|
|
53031
|
+
RegExp(cfg.cssSelector);
|
|
53032
|
+
}
|
|
53033
|
+
catch (e) {
|
|
53034
|
+
continue;
|
|
53035
|
+
}
|
|
53036
|
+
}
|
|
53037
|
+
present.add(cfg.type);
|
|
53038
|
+
}
|
|
53039
|
+
return REQUIRED_SELECTORS.filter(function (r) { return !present.has(r); });
|
|
53040
|
+
};
|
|
53041
|
+
DOMConversation.supportedPreset = function (preset) {
|
|
53042
|
+
return SUPPORTED_PRESETS.indexOf(preset) !== -1;
|
|
53043
|
+
};
|
|
53044
|
+
DOMConversation.prototype.setupReactionListener = function () {
|
|
53058
53045
|
if (!this.findSelector(THUMB_UP) && !this.findSelector(THUMB_DOWN))
|
|
53059
53046
|
return;
|
|
53060
53047
|
this.reactionClickHandler = this.handleReactionClick.bind(this);
|
|
53061
53048
|
this.root.addEventListener('click', this.reactionClickHandler, true);
|
|
53062
|
-
}
|
|
53063
|
-
handleReactionClick(evt) {
|
|
53064
|
-
|
|
53049
|
+
};
|
|
53050
|
+
DOMConversation.prototype.handleReactionClick = function (evt) {
|
|
53051
|
+
var target = evt.target;
|
|
53065
53052
|
if (!target || target.nodeType !== 1)
|
|
53066
53053
|
return;
|
|
53067
|
-
|
|
53068
|
-
|
|
53069
|
-
|
|
53054
|
+
var upSelector = this.findSelector(THUMB_UP);
|
|
53055
|
+
var downSelector = this.findSelector(THUMB_DOWN);
|
|
53056
|
+
var thumb = this.dom(target).closest("".concat(upSelector, ", ").concat(downSelector));
|
|
53070
53057
|
if (!thumb.length)
|
|
53071
53058
|
return;
|
|
53072
|
-
|
|
53073
|
-
|
|
53074
|
-
|
|
53075
|
-
|
|
53076
|
-
|
|
53077
|
-
|
|
53059
|
+
var isUp = this.Sizzle.matchesSelector(thumb[0], upSelector);
|
|
53060
|
+
var activeSelector = this.findSelector(REACTION_ACTIVE);
|
|
53061
|
+
var wasPressed = activeSelector && this.Sizzle.matchesSelector(thumb[0], activeSelector);
|
|
53062
|
+
var direction = isUp ? 'positive' : 'negative';
|
|
53063
|
+
var content = wasPressed ? 'unreact' : direction;
|
|
53064
|
+
var assistantNode = thumb.closest(this.findSelector(TURN_CONTAINER))
|
|
53078
53065
|
.find(this.findSelector(ASSISTANT_MESSAGE));
|
|
53079
53066
|
this.emit('user_reaction', {
|
|
53080
53067
|
agentId: this.id,
|
|
53081
53068
|
messageId: this.getMessageId(assistantNode),
|
|
53082
|
-
content
|
|
53069
|
+
content: content
|
|
53083
53070
|
});
|
|
53084
|
-
}
|
|
53071
|
+
};
|
|
53085
53072
|
// observe the streaming indicator
|
|
53086
|
-
setupStreamingObserver() {
|
|
53073
|
+
DOMConversation.prototype.setupStreamingObserver = function () {
|
|
53087
53074
|
this.wasStreaming = this.select(STREAMING_ACTIVE).length > 0;
|
|
53088
53075
|
this.stopStreamingEndTimer();
|
|
53089
|
-
|
|
53090
|
-
|
|
53091
|
-
|
|
53076
|
+
var MutationObserver = getZoneSafeMethod(this._, 'MutationObserver');
|
|
53077
|
+
var observer = new MutationObserver(this.handleMutation.bind(this));
|
|
53078
|
+
var attrName = this.findSelector(STREAMING_ACTIVE_ATTR);
|
|
53092
53079
|
observer.observe(this.root, {
|
|
53093
53080
|
childList: true,
|
|
53094
53081
|
subtree: true,
|
|
@@ -53096,7 +53083,7 @@ class DOMConversation {
|
|
|
53096
53083
|
attributeFilter: attrName ? [attrName] : undefined
|
|
53097
53084
|
});
|
|
53098
53085
|
this.observers.push(observer);
|
|
53099
|
-
}
|
|
53086
|
+
};
|
|
53100
53087
|
// look for changes in the state of the streaming indicator.
|
|
53101
53088
|
// streaming started -> a prompt has been submitted
|
|
53102
53089
|
// streaming ended -> got a response
|
|
@@ -53105,8 +53092,8 @@ class DOMConversation {
|
|
|
53105
53092
|
// we don't send the agent_response immediately when the streaming indicator is cleared
|
|
53106
53093
|
// because it clears slightly before the final text chunk is committed to the DOM so the
|
|
53107
53094
|
// end-handling is deferred by a short settle window
|
|
53108
|
-
handleMutation() {
|
|
53109
|
-
|
|
53095
|
+
DOMConversation.prototype.handleMutation = function () {
|
|
53096
|
+
var isStreaming = this.select(STREAMING_ACTIVE).length > 0;
|
|
53110
53097
|
if (isStreaming === this.wasStreaming)
|
|
53111
53098
|
return;
|
|
53112
53099
|
if (isStreaming) { // started streaming
|
|
@@ -53124,8 +53111,9 @@ class DOMConversation {
|
|
|
53124
53111
|
this.startStreamingEndTimer();
|
|
53125
53112
|
}
|
|
53126
53113
|
this.wasStreaming = isStreaming;
|
|
53127
|
-
}
|
|
53128
|
-
onSubmissionStart
|
|
53114
|
+
};
|
|
53115
|
+
DOMConversation.prototype.onSubmissionStart = function (attempt) {
|
|
53116
|
+
if (attempt === void 0) { attempt = 1; }
|
|
53129
53117
|
this.requestNode = this.findLastRequestNode();
|
|
53130
53118
|
if (this.requestNode) {
|
|
53131
53119
|
this.handleUserMessage(this.requestNode);
|
|
@@ -53136,10 +53124,10 @@ class DOMConversation {
|
|
|
53136
53124
|
if (attempt < SUBMISSION_START_MAX_ATTEMPTS) {
|
|
53137
53125
|
this.startSubmissionStartRetryTimer(attempt + 1);
|
|
53138
53126
|
}
|
|
53139
|
-
}
|
|
53140
|
-
onSubmissionEnd() {
|
|
53127
|
+
};
|
|
53128
|
+
DOMConversation.prototype.onSubmissionEnd = function () {
|
|
53141
53129
|
this.stopSubmissionStartRetryTimer();
|
|
53142
|
-
|
|
53130
|
+
var requestNode = this.requestNode;
|
|
53143
53131
|
this.requestNode = null;
|
|
53144
53132
|
if (!requestNode) {
|
|
53145
53133
|
// onSubmissionStart didn't send, send it now
|
|
@@ -53148,42 +53136,42 @@ class DOMConversation {
|
|
|
53148
53136
|
return;
|
|
53149
53137
|
this.handleUserMessage(requestNode);
|
|
53150
53138
|
}
|
|
53151
|
-
|
|
53139
|
+
var requestEl = requestNode[0];
|
|
53152
53140
|
if (!requestEl)
|
|
53153
53141
|
return;
|
|
53154
53142
|
// the request is the latest user message, so any assistant message that
|
|
53155
53143
|
// follows it in the DOM is a response to it. document order is already
|
|
53156
53144
|
// chronological, so we emit as we go
|
|
53157
|
-
|
|
53158
|
-
for (
|
|
53159
|
-
|
|
53145
|
+
var assistantNodes = this.select(ASSISTANT_MESSAGE);
|
|
53146
|
+
for (var i = 0; i < assistantNodes.length; i++) {
|
|
53147
|
+
var el = assistantNodes[i];
|
|
53160
53148
|
if (requestEl.compareDocumentPosition(el) & Node.DOCUMENT_POSITION_FOLLOWING) {
|
|
53161
53149
|
this.handleAssistantMessage(this.dom(el));
|
|
53162
53150
|
}
|
|
53163
53151
|
}
|
|
53164
|
-
}
|
|
53165
|
-
extractContent(node) {
|
|
53152
|
+
};
|
|
53153
|
+
DOMConversation.prototype.extractContent = function (node) {
|
|
53166
53154
|
return { content: node.text().trim() };
|
|
53167
|
-
}
|
|
53168
|
-
getMessageId(node) {
|
|
53155
|
+
};
|
|
53156
|
+
DOMConversation.prototype.getMessageId = function (node) {
|
|
53169
53157
|
return node.attr(this.findSelector(MESSAGE_ID_ATTR));
|
|
53170
|
-
}
|
|
53171
|
-
handleUserMessage(node) {
|
|
53172
|
-
this.emit('prompt',
|
|
53173
|
-
}
|
|
53174
|
-
handleAssistantMessage(node) {
|
|
53175
|
-
|
|
53176
|
-
|
|
53177
|
-
this.emit('agent_response',
|
|
53178
|
-
}
|
|
53179
|
-
findLastRequestNode() {
|
|
53158
|
+
};
|
|
53159
|
+
DOMConversation.prototype.handleUserMessage = function (node) {
|
|
53160
|
+
this.emit('prompt', __assign({ agentId: this.id, messageId: this.getMessageId(node) }, this.extractContent(node)));
|
|
53161
|
+
};
|
|
53162
|
+
DOMConversation.prototype.handleAssistantMessage = function (node) {
|
|
53163
|
+
var modelUsedAttr = this.findSelector(MODEL_USED_ATTR);
|
|
53164
|
+
var modelUsed = modelUsedAttr && node.attr(modelUsedAttr);
|
|
53165
|
+
this.emit('agent_response', __assign({ agentId: this.id, messageId: this.getMessageId(node), agentModelsUsed: modelUsed ? [modelUsed] : [] }, this.extractContent(node)));
|
|
53166
|
+
};
|
|
53167
|
+
DOMConversation.prototype.findLastRequestNode = function () {
|
|
53180
53168
|
if (!this.getConversationId())
|
|
53181
53169
|
return null;
|
|
53182
|
-
|
|
53170
|
+
var node = this._.last(this.select(USER_MESSAGE));
|
|
53183
53171
|
if (!node)
|
|
53184
53172
|
return null;
|
|
53185
|
-
|
|
53186
|
-
|
|
53173
|
+
var $node = this.dom(node);
|
|
53174
|
+
var messageId = this.getMessageId($node);
|
|
53187
53175
|
if (!messageId)
|
|
53188
53176
|
return null;
|
|
53189
53177
|
// the node may still be rendering (e.g. a framework interpolating an
|
|
@@ -53195,87 +53183,89 @@ class DOMConversation {
|
|
|
53195
53183
|
return null;
|
|
53196
53184
|
this.lastReturnedMessageId = messageId;
|
|
53197
53185
|
return $node;
|
|
53198
|
-
}
|
|
53199
|
-
findSelector(type) {
|
|
53186
|
+
};
|
|
53187
|
+
DOMConversation.prototype.findSelector = function (type) {
|
|
53200
53188
|
return this.selectors[type];
|
|
53201
|
-
}
|
|
53202
|
-
select(type) {
|
|
53189
|
+
};
|
|
53190
|
+
DOMConversation.prototype.select = function (type) {
|
|
53203
53191
|
return this.dom(this.findSelector(type), this.root);
|
|
53204
|
-
}
|
|
53205
|
-
getConversationId() {
|
|
53206
|
-
|
|
53192
|
+
};
|
|
53193
|
+
DOMConversation.prototype.getConversationId = function () {
|
|
53194
|
+
var m = location.href.match(this.conversationIdRegex);
|
|
53207
53195
|
if (!m)
|
|
53208
53196
|
return null;
|
|
53209
53197
|
return m[1] !== undefined ? m[1] : m[0];
|
|
53210
|
-
}
|
|
53211
|
-
getCustomAgentId() {
|
|
53198
|
+
};
|
|
53199
|
+
DOMConversation.prototype.getCustomAgentId = function () {
|
|
53212
53200
|
if (!this.customAgentIdRegex)
|
|
53213
53201
|
return undefined;
|
|
53214
|
-
|
|
53202
|
+
var m = location.href.match(this.customAgentIdRegex);
|
|
53215
53203
|
if (!m)
|
|
53216
53204
|
return undefined;
|
|
53217
53205
|
return m[1] !== undefined ? m[1] : m[0];
|
|
53218
|
-
}
|
|
53219
|
-
getCustomAgentName() {
|
|
53206
|
+
};
|
|
53207
|
+
DOMConversation.prototype.getCustomAgentName = function () {
|
|
53220
53208
|
if (!this.findSelector(CUSTOM_AGENT_NAME))
|
|
53221
53209
|
return '';
|
|
53222
|
-
|
|
53210
|
+
var node = this.select(CUSTOM_AGENT_NAME);
|
|
53223
53211
|
if (!node.length)
|
|
53224
53212
|
return '';
|
|
53225
53213
|
return node.text().trim();
|
|
53226
|
-
}
|
|
53227
|
-
addCustomAgentInfo(eventPayload) {
|
|
53228
|
-
|
|
53214
|
+
};
|
|
53215
|
+
DOMConversation.prototype.addCustomAgentInfo = function (eventPayload) {
|
|
53216
|
+
var customAgentId = this.getCustomAgentId();
|
|
53229
53217
|
if (!customAgentId)
|
|
53230
53218
|
return;
|
|
53231
53219
|
eventPayload.customAgentId = customAgentId;
|
|
53232
|
-
|
|
53220
|
+
var customAgentName = this.getCustomAgentName();
|
|
53233
53221
|
if (customAgentName) {
|
|
53234
53222
|
eventPayload.customAgentName = customAgentName;
|
|
53235
53223
|
}
|
|
53236
|
-
}
|
|
53237
|
-
onSubmit(callback) {
|
|
53224
|
+
};
|
|
53225
|
+
DOMConversation.prototype.onSubmit = function (callback) {
|
|
53238
53226
|
this.listeners.push(callback);
|
|
53239
|
-
}
|
|
53240
|
-
emit(eventType, eventPayload) {
|
|
53227
|
+
};
|
|
53228
|
+
DOMConversation.prototype.emit = function (eventType, eventPayload) {
|
|
53241
53229
|
eventPayload.conversationId = this.getConversationId();
|
|
53242
53230
|
this.addCustomAgentInfo(eventPayload);
|
|
53243
|
-
this._.each(this.listeners, (cb)
|
|
53244
|
-
}
|
|
53245
|
-
startStreamingEndTimer() {
|
|
53231
|
+
this._.each(this.listeners, function (cb) { return cb(eventType, eventPayload); });
|
|
53232
|
+
};
|
|
53233
|
+
DOMConversation.prototype.startStreamingEndTimer = function () {
|
|
53234
|
+
var _this = this;
|
|
53246
53235
|
this.stopStreamingEndTimer();
|
|
53247
|
-
this.streamingEndTimer = setTimeout$1(()
|
|
53248
|
-
|
|
53249
|
-
|
|
53236
|
+
this.streamingEndTimer = setTimeout$1(function () {
|
|
53237
|
+
_this.streamingEndTimer = null;
|
|
53238
|
+
_this.onSubmissionEnd();
|
|
53250
53239
|
}, STREAMING_END_SETTLE_MS);
|
|
53251
|
-
}
|
|
53252
|
-
stopStreamingEndTimer() {
|
|
53240
|
+
};
|
|
53241
|
+
DOMConversation.prototype.stopStreamingEndTimer = function () {
|
|
53253
53242
|
if (!this.streamingEndTimer)
|
|
53254
53243
|
return;
|
|
53255
53244
|
clearTimeout(this.streamingEndTimer);
|
|
53256
53245
|
this.streamingEndTimer = null;
|
|
53257
|
-
}
|
|
53258
|
-
startSubmissionStartRetryTimer(attempt) {
|
|
53246
|
+
};
|
|
53247
|
+
DOMConversation.prototype.startSubmissionStartRetryTimer = function (attempt) {
|
|
53248
|
+
var _this = this;
|
|
53259
53249
|
this.stopSubmissionStartRetryTimer();
|
|
53260
|
-
this.submissionStartRetryTimer = setTimeout$1(()
|
|
53261
|
-
|
|
53262
|
-
|
|
53250
|
+
this.submissionStartRetryTimer = setTimeout$1(function () {
|
|
53251
|
+
_this.submissionStartRetryTimer = null;
|
|
53252
|
+
_this.onSubmissionStart(attempt);
|
|
53263
53253
|
}, SUBMISSION_START_RETRY_MS);
|
|
53264
|
-
}
|
|
53265
|
-
stopSubmissionStartRetryTimer() {
|
|
53254
|
+
};
|
|
53255
|
+
DOMConversation.prototype.stopSubmissionStartRetryTimer = function () {
|
|
53266
53256
|
if (!this.submissionStartRetryTimer)
|
|
53267
53257
|
return;
|
|
53268
53258
|
clearTimeout(this.submissionStartRetryTimer);
|
|
53269
53259
|
this.submissionStartRetryTimer = null;
|
|
53270
|
-
}
|
|
53271
|
-
suspend() {
|
|
53260
|
+
};
|
|
53261
|
+
DOMConversation.prototype.suspend = function () {
|
|
53272
53262
|
this.isActive = false;
|
|
53273
|
-
}
|
|
53274
|
-
resume() {
|
|
53263
|
+
};
|
|
53264
|
+
DOMConversation.prototype.resume = function () {
|
|
53275
53265
|
this.isActive = true;
|
|
53276
|
-
}
|
|
53277
|
-
teardown() {
|
|
53278
|
-
this._.each(this.observers, (o)
|
|
53266
|
+
};
|
|
53267
|
+
DOMConversation.prototype.teardown = function () {
|
|
53268
|
+
this._.each(this.observers, function (o) { return o && o.disconnect && o.disconnect(); });
|
|
53279
53269
|
this.observers = [];
|
|
53280
53270
|
if (this.reactionClickHandler && this.root) {
|
|
53281
53271
|
this.root.removeEventListener('click', this.reactionClickHandler, true);
|
|
@@ -53284,8 +53274,9 @@ class DOMConversation {
|
|
|
53284
53274
|
this.stopStreamingEndTimer();
|
|
53285
53275
|
this.stopSubmissionStartRetryTimer();
|
|
53286
53276
|
this.listeners = [];
|
|
53287
|
-
}
|
|
53288
|
-
|
|
53277
|
+
};
|
|
53278
|
+
return DOMConversation;
|
|
53279
|
+
}());
|
|
53289
53280
|
|
|
53290
53281
|
/*
|
|
53291
53282
|
* Conversation Analytics Plugin
|
|
@@ -53295,21 +53286,21 @@ class DOMConversation {
|
|
|
53295
53286
|
* The sibling built-in PromptAnalytics plugin owns the network + DOMPrompt AI-agents
|
|
53296
53287
|
*/
|
|
53297
53288
|
function ConversationAnalytics() {
|
|
53298
|
-
|
|
53299
|
-
|
|
53300
|
-
|
|
53301
|
-
|
|
53302
|
-
|
|
53303
|
-
|
|
53304
|
-
|
|
53289
|
+
var pendo;
|
|
53290
|
+
var api;
|
|
53291
|
+
var _;
|
|
53292
|
+
var log;
|
|
53293
|
+
var conversations = [];
|
|
53294
|
+
var agentsCache = new Map();
|
|
53295
|
+
var CONFIG_NAME = 'aiAgents';
|
|
53305
53296
|
return {
|
|
53306
53297
|
name: 'ConversationAnalytics',
|
|
53307
|
-
initialize,
|
|
53308
|
-
teardown,
|
|
53309
|
-
onConfigLoaded,
|
|
53310
|
-
observeConversation,
|
|
53311
|
-
sendConversationEvent,
|
|
53312
|
-
reEvaluatePageRules
|
|
53298
|
+
initialize: initialize,
|
|
53299
|
+
teardown: teardown,
|
|
53300
|
+
onConfigLoaded: onConfigLoaded,
|
|
53301
|
+
observeConversation: observeConversation,
|
|
53302
|
+
sendConversationEvent: sendConversationEvent,
|
|
53303
|
+
reEvaluatePageRules: reEvaluatePageRules
|
|
53313
53304
|
};
|
|
53314
53305
|
function initialize(pendoGlobal, PluginAPI) {
|
|
53315
53306
|
var _a;
|
|
@@ -53317,7 +53308,7 @@ function ConversationAnalytics() {
|
|
|
53317
53308
|
api = PluginAPI;
|
|
53318
53309
|
_ = pendo._;
|
|
53319
53310
|
log = api.log;
|
|
53320
|
-
|
|
53311
|
+
var ConfigReader = api.ConfigReader;
|
|
53321
53312
|
ConfigReader.addOption(CONFIG_NAME, [
|
|
53322
53313
|
ConfigReader.sources.PENDO_CONFIG_SRC,
|
|
53323
53314
|
ConfigReader.sources.SNIPPET_SRC
|
|
@@ -53330,12 +53321,13 @@ function ConversationAnalytics() {
|
|
|
53330
53321
|
// Test if the current URL matches the page rule for an agent. The raw matcher lives in core
|
|
53331
53322
|
// and is reached through PluginAPI (independent plugins cannot import it directly); it falls
|
|
53332
53323
|
// back to the normalized URL internally when no URL is passed.
|
|
53333
|
-
function testPageRule(pageRule, agentId
|
|
53324
|
+
function testPageRule(pageRule, agentId) {
|
|
53325
|
+
if (agentId === void 0) { agentId = 'unknown'; }
|
|
53334
53326
|
// Convert //*/agent pattern to work with full URLs
|
|
53335
|
-
|
|
53327
|
+
var fixedPageRule = pageRule;
|
|
53336
53328
|
if (Array.isArray(pageRule)) {
|
|
53337
|
-
|
|
53338
|
-
fixedPageRule = _.map(validRules, rule
|
|
53329
|
+
var validRules = _.filter(pageRule, function (rule) { return rule && rule.trim() !== ''; });
|
|
53330
|
+
fixedPageRule = _.map(validRules, function (rule) { return rule.startsWith('//*/') ? rule.substring(1) : rule; });
|
|
53339
53331
|
}
|
|
53340
53332
|
else if (typeof pageRule === 'string' && pageRule.startsWith('//*/')) {
|
|
53341
53333
|
fixedPageRule = pageRule.substring(1);
|
|
@@ -53347,9 +53339,9 @@ function ConversationAnalytics() {
|
|
|
53347
53339
|
});
|
|
53348
53340
|
}
|
|
53349
53341
|
function reEvaluatePageRules() {
|
|
53350
|
-
_.each(conversations, conversation
|
|
53351
|
-
|
|
53352
|
-
|
|
53342
|
+
_.each(conversations, function (conversation) {
|
|
53343
|
+
var agent = findAgentById(conversation.id);
|
|
53344
|
+
var shouldBeActive = agent && testPageRule(agent.pageRule, agent.id);
|
|
53353
53345
|
if (shouldBeActive) {
|
|
53354
53346
|
conversation.resume();
|
|
53355
53347
|
}
|
|
@@ -53357,14 +53349,14 @@ function ConversationAnalytics() {
|
|
|
53357
53349
|
conversation.suspend();
|
|
53358
53350
|
}
|
|
53359
53351
|
});
|
|
53360
|
-
|
|
53361
|
-
|
|
53362
|
-
_.each(allAgents, aiAgent
|
|
53352
|
+
var currentlyActiveIds = _.map(_.filter(conversations, function (conversation) { return conversation.isActive; }), function (conversation) { return conversation.id; });
|
|
53353
|
+
var allAgents = api.ConfigReader.get(CONFIG_NAME) || [];
|
|
53354
|
+
_.each(allAgents, function (aiAgent) {
|
|
53363
53355
|
if (!isConversationAgent(aiAgent)) {
|
|
53364
53356
|
return;
|
|
53365
53357
|
}
|
|
53366
|
-
|
|
53367
|
-
|
|
53358
|
+
var isCurrentlyActive = _.contains(currentlyActiveIds, aiAgent.id);
|
|
53359
|
+
var shouldBeActive = testPageRule(aiAgent.pageRule, aiAgent.id);
|
|
53368
53360
|
if (shouldBeActive && !isCurrentlyActive) {
|
|
53369
53361
|
observeConversation(aiAgent);
|
|
53370
53362
|
}
|
|
@@ -53378,12 +53370,13 @@ function ConversationAnalytics() {
|
|
|
53378
53370
|
function isConversationAgent(agent) {
|
|
53379
53371
|
return DOMConversation.supportedPreset(agent.preset);
|
|
53380
53372
|
}
|
|
53381
|
-
function onConfigLoaded(aiAgents
|
|
53373
|
+
function onConfigLoaded(aiAgents) {
|
|
53374
|
+
if (aiAgents === void 0) { aiAgents = []; }
|
|
53382
53375
|
if (!aiAgents || !_.isArray(aiAgents) || aiAgents.length === 0) {
|
|
53383
53376
|
return;
|
|
53384
53377
|
}
|
|
53385
53378
|
agentsCache.clear();
|
|
53386
|
-
_.each(aiAgents, aiAgent
|
|
53379
|
+
_.each(aiAgents, function (aiAgent) {
|
|
53387
53380
|
if (!isConversationAgent(aiAgent)) {
|
|
53388
53381
|
return;
|
|
53389
53382
|
}
|
|
@@ -53394,24 +53387,24 @@ function ConversationAnalytics() {
|
|
|
53394
53387
|
});
|
|
53395
53388
|
}
|
|
53396
53389
|
function observeConversation(config) {
|
|
53397
|
-
|
|
53390
|
+
var id = config.id, cssSelectors = config.cssSelectors;
|
|
53398
53391
|
// Check if this agent is already being tracked
|
|
53399
|
-
|
|
53392
|
+
var existing = _.find(conversations, function (conversation) { return conversation.id === id; });
|
|
53400
53393
|
if (existing) {
|
|
53401
53394
|
return;
|
|
53402
53395
|
}
|
|
53403
|
-
|
|
53396
|
+
var missing = DOMConversation.validateConfig(cssSelectors);
|
|
53404
53397
|
if (missing.length) {
|
|
53405
|
-
log.error('aiAgent config missing required selectors', { agentId: id, missing });
|
|
53398
|
+
log.error('aiAgent config missing required selectors', { agentId: id, missing: missing });
|
|
53406
53399
|
return;
|
|
53407
53400
|
}
|
|
53408
|
-
|
|
53401
|
+
var conversation = new DOMConversation(pendo, api, id, cssSelectors);
|
|
53409
53402
|
conversation.onSubmit(sendConversationEvent);
|
|
53410
53403
|
conversations.push(conversation);
|
|
53411
53404
|
}
|
|
53412
53405
|
function sendConversationEvent(eventType, eventPayload) {
|
|
53413
53406
|
// Block event if the conversation is suspended
|
|
53414
|
-
|
|
53407
|
+
var conversation = _.find(conversations, function (c) { return c.id === eventPayload.agentId; });
|
|
53415
53408
|
if (conversation && !conversation.isActive) {
|
|
53416
53409
|
return;
|
|
53417
53410
|
}
|
|
@@ -53419,7 +53412,7 @@ function ConversationAnalytics() {
|
|
|
53419
53412
|
api.analytics.collectEvent(eventType, eventPayload, undefined, 'agentic');
|
|
53420
53413
|
}
|
|
53421
53414
|
function teardown() {
|
|
53422
|
-
_.each(conversations, conversation
|
|
53415
|
+
_.each(conversations, function (conversation) { return conversation.teardown(); });
|
|
53423
53416
|
conversations = [];
|
|
53424
53417
|
agentsCache.clear();
|
|
53425
53418
|
}
|