@pendo/agent 2.330.0 → 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.
@@ -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.0_';
4014
- let PACKAGE_VERSION = '2.330.0';
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
  /**
@@ -4587,11 +4587,20 @@ function hasCookieDomain() {
4587
4587
  return !!cookieDomain;
4588
4588
  }
4589
4589
  function clearCookie(name) {
4590
- if (hasCookieDomain()) {
4591
- setCookie(name, '');
4592
- return;
4590
+ // Always expire the cookie rather than overwriting it with an empty value.
4591
+ // When a cookieDomain is set the domain attribute must be included or the
4592
+ // domain-scoped cookie can't be matched for deletion -- omitting it (or
4593
+ // writing a blank value) leaves a permanent empty cookie that still costs
4594
+ // request-header space via its name.
4595
+ var expiry = '=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT';
4596
+ if (cookieDomain) {
4597
+ document.cookie = name + expiry + ';domain=' + cookieDomain;
4593
4598
  }
4594
- document.cookie = name + '=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT';
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;
4595
4604
  }
4596
4605
  var getPendoCookieKey = function (name, cookieSuffix) {
4597
4606
  return `_pendo_${name}.${cookieSuffix || pendo$1.apiKey}`;
@@ -24998,7 +25007,10 @@ var initGuides = function (observer) {
24998
25007
  * @access public
24999
25008
  * @label AD_BLOCK_STORAGE_KEY
25000
25009
  */
25001
- agentStorage.registry.addLocal(AD_BLOCK_STORAGE_KEY, { duration: 14400000 }); // 4 hours default duration
25010
+ agentStorage.registry.addLocal(AD_BLOCK_STORAGE_KEY, {
25011
+ duration: 14400000,
25012
+ localStorageOnly: true
25013
+ });
25002
25014
  GuideRuntime.initialize();
25003
25015
  registerPostrenderScripts(GuideRuntime);
25004
25016
  return () => {
@@ -27269,7 +27281,7 @@ function launchDesignerOrPreview(options) {
27269
27281
  * @access public
27270
27282
  * @label pendoPreview
27271
27283
  */
27272
- agentStorage.registry.addLocal(pendoPreview$1);
27284
+ agentStorage.registry.addLocal(pendoPreview$1, { localStorageOnly: true });
27273
27285
  /**
27274
27286
  * Application state while previewing a guide from the designer. Used while designer preview is active
27275
27287
  * to track step, status, etc., and cleared when designer preview is exited.
@@ -27279,7 +27291,7 @@ function launchDesignerOrPreview(options) {
27279
27291
  * @access public
27280
27292
  * @label designerPreview
27281
27293
  */
27282
- agentStorage.registry.addLocal(designerPreview$1);
27294
+ agentStorage.registry.addLocal(designerPreview$1, { localStorageOnly: true });
27283
27295
  // in order, try to launch:
27284
27296
  // 1) designer
27285
27297
  // 2) preview
@@ -30209,7 +30221,10 @@ function initLogging() {
30209
30221
  * @access public
30210
30222
  * @label LOG_ENABLED
30211
30223
  */
30212
- agentStorage.registry.addLocal(LOG_ENABLED, { isPlain: true });
30224
+ agentStorage.registry.addLocal(LOG_ENABLED, {
30225
+ isPlain: true,
30226
+ localStorageOnly: true
30227
+ });
30213
30228
  /**
30214
30229
  * DEPRECATED: Stores the active contexts for logging.
30215
30230
  *
@@ -30218,7 +30233,10 @@ function initLogging() {
30218
30233
  * @access private
30219
30234
  * @label ACTIVE_CONTEXTS
30220
30235
  */
30221
- agentStorage.registry.addLocal(ACTIVE_CONTEXTS, { isPlain: true });
30236
+ agentStorage.registry.addLocal(ACTIVE_CONTEXTS, {
30237
+ isPlain: true,
30238
+ localStorageOnly: true
30239
+ });
30222
30240
  }
30223
30241
  var createContexts = function (contexts, args) {
30224
30242
  return _.compact([].concat(contexts, args));
@@ -39414,7 +39432,10 @@ var initLauncherPlugin = function (pendo, PluginAPI) {
39414
39432
  * @access public
39415
39433
  * @label LAUNCHER_CLOSED
39416
39434
  */
39417
- PluginAPI.agentStorage.registry.addLocal(LAUNCHER_CLOSED, { duration: 10 * 24 * 60 * 60 * 1000 }); // 10 days default duration
39435
+ PluginAPI.agentStorage.registry.addLocal(LAUNCHER_CLOSED, {
39436
+ duration: 10 * 24 * 60 * 60 * 1000,
39437
+ localStorageOnly: true
39438
+ });
39418
39439
  };
39419
39440
  var teardownLauncherPlugin = function (pendo, PluginAPI) {
39420
39441
  deregisterLoadGuideJobs(loadLauncherContentHandler);
@@ -41017,7 +41038,12 @@ function initAgent(pendo, PendoConfig) {
41017
41038
  * @access public
41018
41039
  * @label debugEnabled
41019
41040
  */
41020
- agentStorage.registry.addLocal(debugEnabled, { isPlain: true, serializer: JSON.stringify, deserializer: SafeJsonDeserializer });
41041
+ agentStorage.registry.addLocal(debugEnabled, {
41042
+ isPlain: true,
41043
+ serializer: JSON.stringify,
41044
+ deserializer: SafeJsonDeserializer,
41045
+ localStorageOnly: true
41046
+ });
41021
41047
  setPendoConfig(PendoConfig);
41022
41048
  overwriteBuiltConfigWithPendoConfig();
41023
41049
  if (!loadAsModule(PendoConfig) && loadAlternateAgent(PendoConfig, pendo, isDebuggingEnabled()))
@@ -41212,20 +41238,20 @@ function getZoneSafeMethod(_, method, target) {
41212
41238
  }
41213
41239
 
41214
41240
  // Does not support submit and go to
41215
- const goToRegex = new RegExp(guideMarkdownUtil.goToString);
41216
- const PollBranching = {
41241
+ var goToRegex = new RegExp(guideMarkdownUtil.goToString);
41242
+ var PollBranching = {
41217
41243
  name: 'PollBranching',
41218
- script(step, guide, pendo) {
41219
- let isAdvanceIntercepted = false;
41220
- const branchingQuestions = initialBranchingSetup(step, pendo);
41244
+ script: function (step, guide, pendo) {
41245
+ var isAdvanceIntercepted = false;
41246
+ var branchingQuestions = initialBranchingSetup(step, pendo);
41221
41247
  if (branchingQuestions) {
41222
41248
  // If there are too many branching questions saved, exit and run the guide normally.
41223
41249
  if (pendo._.size(branchingQuestions) > 1)
41224
41250
  return;
41225
- this.on('beforeAdvance', (evt) => {
41226
- const noResponseSelected = step.guideElement.find('[branching] .pendo-radio:checked').length === 0;
41227
- const responseLabel = step.guideElement.find('[branching] .pendo-radio:checked + label')[0];
41228
- let noGotoLabel;
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;
41229
41255
  if (responseLabel) {
41230
41256
  noGotoLabel = pendo._.isNull(responseLabel.getAttribute('goToStep'));
41231
41257
  }
@@ -41236,58 +41262,58 @@ const PollBranching = {
41236
41262
  });
41237
41263
  }
41238
41264
  },
41239
- test(step, guide, pendo) {
41265
+ test: function (step, guide, pendo) {
41240
41266
  var _a;
41241
- let branchingQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
41267
+ var branchingQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
41242
41268
  return !pendo._.isUndefined(branchingQuestions) && pendo._.size(branchingQuestions);
41243
41269
  },
41244
- designerListener(pendo) {
41245
- const target = pendo.dom.getBody();
41246
- const config = {
41270
+ designerListener: function (pendo) {
41271
+ var target = pendo.dom.getBody();
41272
+ var config = {
41247
41273
  attributeFilter: ['data-layout'],
41248
41274
  attributes: true,
41249
41275
  childList: true,
41250
41276
  characterData: true,
41251
41277
  subtree: true
41252
41278
  };
41253
- const MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
41254
- const observer = new MutationObserver(applyBranchingIndicators);
41279
+ var MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
41280
+ var observer = new MutationObserver(applyBranchingIndicators);
41255
41281
  observer.observe(target, config);
41256
41282
  function applyBranchingIndicators(mutations) {
41257
41283
  pendo._.each(mutations, function (mutation) {
41258
41284
  var _a;
41259
- const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelector);
41285
+ var nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelector);
41260
41286
  if (mutation.addedNodes.length && nodeHasQuerySelector) {
41261
41287
  if (mutation.addedNodes[0].querySelector('._pendo-multi-choice-poll-select-border')) {
41262
41288
  if (pendo._.size(pendo.dom('._pendo-multi-choice-poll-question:contains("{branching/}")'))) {
41263
41289
  pendo
41264
41290
  .dom('._pendo-multi-choice-poll-question:contains("{branching/}")')
41265
- .each((question, index) => {
41266
- pendo._.each(pendo.dom(`#${question.id} *`), (element) => {
41291
+ .each(function (question, index) {
41292
+ pendo._.each(pendo.dom("#".concat(question.id, " *")), function (element) {
41267
41293
  guideMarkdownUtil.removeMarkdownSyntax(element, '{branching/}', '', pendo);
41268
41294
  });
41269
41295
  pendo
41270
- .dom(`#${question.id} p`)
41296
+ .dom("#".concat(question.id, " p"))
41271
41297
  .css({ display: 'inline-block !important' })
41272
41298
  .append(branchingIcon('#999', '20px'))
41273
41299
  .attr({ title: 'Custom Branching Added' });
41274
- let dataPendoPollId = question.getAttribute('data-pendo-poll-id');
41275
- if (pendo.dom(`._pendo-multi-choice-poll-question[data-pendo-poll-id=${dataPendoPollId}]`)[0]) {
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]) {
41276
41302
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
41277
41303
  pendo
41278
- .dom(`._pendo-multi-choice-poll-question[data-pendo-poll-id=${dataPendoPollId}]`)[0]
41304
+ .dom("._pendo-multi-choice-poll-question[data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0]
41279
41305
  .textContent.trim();
41280
41306
  }
41281
- let pollLabels = pendo.dom(`label[for*=${dataPendoPollId}]`);
41307
+ var pollLabels = pendo.dom("label[for*=".concat(dataPendoPollId, "]"));
41282
41308
  if (pendo._.size(pollLabels)) {
41283
- pendo._.forEach(pollLabels, (label) => {
41309
+ pendo._.forEach(pollLabels, function (label) {
41284
41310
  if (goToRegex.test(label.textContent)) {
41285
- let labelTitle = goToRegex.exec(label.textContent)[2];
41311
+ var labelTitle = goToRegex.exec(label.textContent)[2];
41286
41312
  guideMarkdownUtil.removeMarkdownSyntax(label, goToRegex, '', pendo);
41287
41313
  pendo
41288
41314
  .dom(label)
41289
41315
  .append(branchingIcon('#999', '14px'))
41290
- .attr({ title: `Branching to step ${labelTitle}` });
41316
+ .attr({ title: "Branching to step ".concat(labelTitle) });
41291
41317
  }
41292
41318
  });
41293
41319
  }
@@ -41295,9 +41321,9 @@ const PollBranching = {
41295
41321
  pendo
41296
41322
  .dom(question)
41297
41323
  .append(branchingErrorHTML(question.dataset.pendoPollId));
41298
- pendo.dom(`#${question.id} #pendo-ps-branching-svg`).remove();
41324
+ pendo.dom("#".concat(question.id, " #pendo-ps-branching-svg")).remove();
41299
41325
  pendo
41300
- .dom(`#${question.id} p`)
41326
+ .dom("#".concat(question.id, " p"))
41301
41327
  .css({ display: 'inline-block !important' })
41302
41328
  .append(branchingIcon('red', '20px'))
41303
41329
  .attr({ title: 'Unsupported Branching configuration' });
@@ -41309,49 +41335,31 @@ const PollBranching = {
41309
41335
  });
41310
41336
  }
41311
41337
  function branchingErrorHTML(dataPendoPollId) {
41312
- return `<div style="text-align:lrft; font-size: 14px; color: red;
41313
- font-style: italic; margin-top: 0px;" class="branching-wrapper"
41314
- name="${dataPendoPollId}">
41315
- * 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>");
41316
41339
  }
41317
41340
  function branchingIcon(color, size) {
41318
- return `<svg id="pendo-ps-branching-svg" viewBox="0 0 24 24" fill="none"
41319
- style="margin-left: 5px;
41320
- height:${size}; width:${size}; display:inline; vertical-align:middle;" xmlns="http://www.w3.org/2000/svg">
41321
- <g stroke-width="0"></g>
41322
- <g stroke-linecap="round" stroke-linejoin="round"></g>
41323
- <g> <circle cx="4" cy="7" r="2" stroke="${color}"
41324
- stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></circle>
41325
- <circle cx="20" cy="7" r="2" stroke="${color}"
41326
- stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></circle>
41327
- <circle cx="20" cy="17" r="2" stroke="${color}" stroke-width="2"
41328
- stroke-linecap="round" stroke-linejoin="round"></circle>
41329
- <path d="M18 7H6" stroke="${color}" stroke-width="2"
41330
- stroke-linecap="round" stroke-linejoin="round"></path>
41331
- <path d="M7 7V7C8.65685 7 10 8.34315 10 10V15C10 16.1046 10.8954 17 12 17H18"
41332
- stroke="${color}" stroke-width="2" stroke-linecap="round"
41333
- 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>");
41334
41342
  }
41335
41343
  }
41336
41344
  };
41337
41345
  function initialBranchingSetup(step, pendo) {
41338
- const questions = step.guideElement.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
41339
- pendo._.forEach(questions, (question) => {
41340
- let dataPendoPollId = question.getAttribute('data-pendo-poll-id');
41341
- pendo._.each(step.guideElement.find(`#${question.id} *`), (element) => {
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) {
41342
41350
  guideMarkdownUtil.removeMarkdownSyntax(element, '{branching/}', '', pendo);
41343
41351
  });
41344
- let pollLabels = step.guideElement.find(`label[for*=${dataPendoPollId}]`);
41345
- pendo._.forEach(pollLabels, (label) => {
41352
+ var pollLabels = step.guideElement.find("label[for*=".concat(dataPendoPollId, "]"));
41353
+ pendo._.forEach(pollLabels, function (label) {
41346
41354
  if (pendo._.isNull(goToRegex.exec(label.textContent))) {
41347
41355
  return;
41348
41356
  }
41349
- let gotoSubstring = goToRegex.exec(label.textContent)[1];
41350
- let gotoIndex = goToRegex.exec(label.textContent)[2];
41357
+ var gotoSubstring = goToRegex.exec(label.textContent)[1];
41358
+ var gotoIndex = goToRegex.exec(label.textContent)[2];
41351
41359
  label.setAttribute('goToStep', gotoIndex);
41352
41360
  guideMarkdownUtil.removeMarkdownSyntax(label, gotoSubstring, '', pendo);
41353
41361
  });
41354
- let pollChoiceContainer = step.guideElement.find(`[data-pendo-poll-id=${dataPendoPollId}]._pendo-multi-choice-poll-select-border`);
41362
+ var pollChoiceContainer = step.guideElement.find("[data-pendo-poll-id=".concat(dataPendoPollId, "]._pendo-multi-choice-poll-select-border"));
41355
41363
  if (pollChoiceContainer && pollChoiceContainer.length) {
41356
41364
  pollChoiceContainer[0].setAttribute('branching', '');
41357
41365
  }
@@ -41360,15 +41368,15 @@ function initialBranchingSetup(step, pendo) {
41360
41368
  }
41361
41369
  function branchingGoToStep(event, step, guide, pendo) {
41362
41370
  var _a;
41363
- let checkedPollInputId = (_a = step.guideElement.find('[branching] input.pendo-radio[data-pendo-poll-id]:checked')[0]) === null || _a === void 0 ? void 0 : _a.id;
41364
- let checkedPollLabel = step.guideElement.find(`label[for="${checkedPollInputId}"]`)[0];
41365
- let checkedPollLabelStepIndex = checkedPollLabel === null || checkedPollLabel === void 0 ? void 0 : checkedPollLabel.getAttribute('goToStep');
41366
- let pollStepIndex = checkedPollLabelStepIndex - 1;
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;
41367
41375
  if (pollStepIndex < 0)
41368
41376
  return;
41369
- const destinationObject = {
41377
+ var destinationObject = {
41370
41378
  destinationStepId: guide.steps[pollStepIndex].id,
41371
- step
41379
+ step: step
41372
41380
  };
41373
41381
  pendo.goToStep(destinationObject);
41374
41382
  event.cancel = true;
@@ -41389,10 +41397,10 @@ function encodeMetadataForUrl(value, urlBeforePlaceholder) {
41389
41397
  return window.encodeURI(str);
41390
41398
  }
41391
41399
 
41392
- const MetadataSubstitution = {
41400
+ var MetadataSubstitution = {
41393
41401
  name: 'MetadataSubstitution',
41394
- script(step, guide, pendo) {
41395
- const placeholderData = findSubstitutableElements(pendo);
41402
+ script: function (step, guide, pendo) {
41403
+ var placeholderData = findSubstitutableElements(pendo);
41396
41404
  if (step.domJson) {
41397
41405
  findSubstitutableUrlsInJson(step.domJson, placeholderData, pendo);
41398
41406
  }
@@ -41400,22 +41408,22 @@ const MetadataSubstitution = {
41400
41408
  pendo._.each(placeholderData, function (placeholder) {
41401
41409
  processPlaceholder(placeholder, pendo);
41402
41410
  });
41403
- const containerId = `pendo-g-${step.id}`;
41404
- const context = step.guideElement;
41405
- updateGuideContainer(containerId, context, pendo);
41411
+ var containerId = "pendo-g-".concat(step.id);
41412
+ var context_1 = step.guideElement;
41413
+ updateGuideContainer(containerId, context_1, pendo);
41406
41414
  }
41407
41415
  },
41408
- designerListener(pendo) {
41409
- const target = pendo.dom.getBody();
41416
+ designerListener: function (pendo) {
41417
+ var target = pendo.dom.getBody();
41410
41418
  if (pendo.designerv2) {
41411
41419
  pendo.designerv2.runMetadataSubstitutionForDesignerPreview = function runMetadataSubstitutionForDesignerPreview() {
41412
41420
  var _a;
41413
41421
  if (!document.querySelector(guideMarkdownUtil.containerSelector))
41414
41422
  return;
41415
- const step = (_a = pendo.designerv2.currentlyPreviewedGuide) === null || _a === void 0 ? void 0 : _a.steps[0];
41423
+ var step = (_a = pendo.designerv2.currentlyPreviewedGuide) === null || _a === void 0 ? void 0 : _a.steps[0];
41416
41424
  if (!step)
41417
41425
  return;
41418
- const placeholderData = findSubstitutableElements(pendo);
41426
+ var placeholderData = findSubstitutableElements(pendo);
41419
41427
  if (step.buildingBlocks) {
41420
41428
  findSubstitutableUrlsInJson(step.buildingBlocks, placeholderData, pendo);
41421
41429
  }
@@ -41425,32 +41433,32 @@ const MetadataSubstitution = {
41425
41433
  return;
41426
41434
  processPlaceholder(placeholder, pendo);
41427
41435
  });
41428
- const containerId = `pendo-g-${step.id}`;
41429
- const context = step.guideElement;
41430
- updateGuideContainer(containerId, context, pendo);
41436
+ var containerId = "pendo-g-".concat(step.id);
41437
+ var context_2 = step.guideElement;
41438
+ updateGuideContainer(containerId, context_2, pendo);
41431
41439
  }
41432
41440
  };
41433
41441
  }
41434
- const config = {
41442
+ var config = {
41435
41443
  attributeFilter: ['data-layout'],
41436
41444
  attributes: true,
41437
41445
  childList: true,
41438
41446
  characterData: true,
41439
41447
  subtree: true
41440
41448
  };
41441
- const MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
41442
- const observer = new MutationObserver(applySubstitutionIndicators);
41449
+ var MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
41450
+ var observer = new MutationObserver(applySubstitutionIndicators);
41443
41451
  observer.observe(target, config);
41444
41452
  function applySubstitutionIndicators(mutations) {
41445
41453
  pendo._.each(mutations, function (mutation) {
41446
41454
  var _a;
41447
41455
  if (mutation.addedNodes.length) {
41448
41456
  if (document.querySelector(guideMarkdownUtil.containerSelector)) {
41449
- const placeholderData = findSubstitutableElements(pendo);
41450
- const step = (_a = pendo.designerv2.currentlyPreviewedGuide) === null || _a === void 0 ? void 0 : _a.steps[0];
41457
+ var placeholderData = findSubstitutableElements(pendo);
41458
+ var step = (_a = pendo.designerv2.currentlyPreviewedGuide) === null || _a === void 0 ? void 0 : _a.steps[0];
41451
41459
  if (!step)
41452
41460
  return;
41453
- const pendoBlocks = step.buildingBlocks;
41461
+ var pendoBlocks = step.buildingBlocks;
41454
41462
  if (!pendo._.isUndefined(pendoBlocks)) {
41455
41463
  findSubstitutableUrlsInJson(pendoBlocks, placeholderData, pendo);
41456
41464
  }
@@ -41460,9 +41468,9 @@ const MetadataSubstitution = {
41460
41468
  return;
41461
41469
  processPlaceholder(placeholder, pendo);
41462
41470
  });
41463
- const containerId = `pendo-g-${step.id}`;
41464
- const context = step.guideElement;
41465
- updateGuideContainer(containerId, context, pendo);
41471
+ var containerId = "pendo-g-".concat(step.id);
41472
+ var context_3 = step.guideElement;
41473
+ updateGuideContainer(containerId, context_3, pendo);
41466
41474
  }
41467
41475
  }
41468
41476
  }
@@ -41471,18 +41479,18 @@ const MetadataSubstitution = {
41471
41479
  }
41472
41480
  };
41473
41481
  function processPlaceholder(placeholder, pendo) {
41474
- let match;
41475
- const { data, target } = placeholder;
41476
- const subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
41482
+ var match;
41483
+ var data = placeholder.data, target = placeholder.target;
41484
+ var subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
41477
41485
  while ((match = matchPlaceholder(placeholder, subRegex))) {
41478
- const usedArrayPath = Array.isArray(match) && match.length >= 2;
41479
- const currentStr = target === 'textContent'
41486
+ var usedArrayPath = Array.isArray(match) && match.length >= 2;
41487
+ var currentStr = target === 'textContent'
41480
41488
  ? data[target]
41481
41489
  : decodeURI((data.getAttribute && (target === 'href' || target === 'value') ? (data.getAttribute(target) || '') : data[target]));
41482
- const matched = usedArrayPath ? match : subRegex.exec(currentStr);
41490
+ var matched = usedArrayPath ? match : subRegex.exec(currentStr);
41483
41491
  if (!matched)
41484
41492
  continue;
41485
- const mdValue = getSubstituteValue(matched, pendo);
41493
+ var mdValue = getSubstituteValue(matched, pendo);
41486
41494
  substituteMetadataByTarget(data, target, mdValue, matched);
41487
41495
  }
41488
41496
  }
@@ -41491,50 +41499,50 @@ function matchPlaceholder(placeholder, regex) {
41491
41499
  return placeholder.data[placeholder.target].match(regex);
41492
41500
  }
41493
41501
  else {
41494
- const raw = placeholder.data.getAttribute && (placeholder.target === 'href' || placeholder.target === 'value')
41502
+ var raw = placeholder.data.getAttribute && (placeholder.target === 'href' || placeholder.target === 'value')
41495
41503
  ? (placeholder.data.getAttribute(placeholder.target) || '')
41496
41504
  : placeholder.data[placeholder.target];
41497
41505
  return decodeURI(raw).match(regex);
41498
41506
  }
41499
41507
  }
41500
41508
  function getMetadataValueCaseInsensitive(metadata, type, property) {
41501
- const kind = metadata && metadata[type];
41509
+ var kind = metadata && metadata[type];
41502
41510
  if (!kind || typeof kind !== 'object')
41503
41511
  return undefined;
41504
- const direct = Object.prototype.hasOwnProperty.call(kind, property) ? kind[property] : undefined;
41512
+ var direct = Object.prototype.hasOwnProperty.call(kind, property) ? kind[property] : undefined;
41505
41513
  if (direct !== undefined) {
41506
41514
  return direct;
41507
41515
  }
41508
- const propLower = property.toLowerCase();
41509
- const key = Object.keys(kind).find(k => k.toLowerCase() === propLower);
41510
- const value = key !== undefined ? kind[key] : undefined;
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;
41511
41519
  return value;
41512
41520
  }
41513
41521
  function getSubstituteValue(match, pendo) {
41514
41522
  if (pendo._.isUndefined(match[1]) || pendo._.isUndefined(match[2])) {
41515
41523
  return;
41516
41524
  }
41517
- let type = match[1];
41518
- let property = match[2];
41519
- let defaultValue = match[3];
41525
+ var type = match[1];
41526
+ var property = match[2];
41527
+ var defaultValue = match[3];
41520
41528
  if (pendo._.isUndefined(type) || pendo._.isUndefined(property)) {
41521
41529
  return;
41522
41530
  }
41523
- const metadata = pendo.getSerializedMetadata();
41524
- let mdValue = getMetadataValueCaseInsensitive(metadata, type, property);
41531
+ var metadata = pendo.getSerializedMetadata();
41532
+ var mdValue = getMetadataValueCaseInsensitive(metadata, type, property);
41525
41533
  if (mdValue === undefined || mdValue === null)
41526
41534
  mdValue = defaultValue || '';
41527
41535
  return mdValue;
41528
41536
  }
41529
41537
  function substituteMetadataByTarget(data, target, mdValue, matched) {
41530
- const isElement = data && typeof data.getAttribute === 'function';
41531
- const current = (target === 'href' || target === 'value') && isElement
41538
+ var isElement = data && typeof data.getAttribute === 'function';
41539
+ var current = (target === 'href' || target === 'value') && isElement
41532
41540
  ? (data.getAttribute(target) || '')
41533
41541
  : data[target];
41534
41542
  if (target === 'href' || target === 'value') {
41535
- const decodedUrl = decodeURI(current);
41536
- const urlBeforePlaceholder = decodedUrl.slice(0, decodedUrl.indexOf(matched[0]));
41537
- const safeValue = encodeMetadataForUrl(mdValue, urlBeforePlaceholder);
41543
+ var decodedUrl = decodeURI(current);
41544
+ var urlBeforePlaceholder = decodedUrl.slice(0, decodedUrl.indexOf(matched[0]));
41545
+ var safeValue = encodeMetadataForUrl(mdValue, urlBeforePlaceholder);
41538
41546
  data[target] = decodedUrl.replace(matched[0], safeValue);
41539
41547
  }
41540
41548
  else {
@@ -41548,8 +41556,9 @@ function updateGuideContainer(containerId, context, pendo) {
41548
41556
  pendo.flexElement(pendo.dom(guideMarkdownUtil.containerSelector));
41549
41557
  pendo.BuildingBlocks.BuildingBlockGuides.recalculateGuideHeight(containerId, context);
41550
41558
  }
41551
- function findSubstitutableUrlsInJson(originalData, placeholderData = [], pendo) {
41552
- const subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
41559
+ function findSubstitutableUrlsInJson(originalData, placeholderData, pendo) {
41560
+ if (placeholderData === void 0) { placeholderData = []; }
41561
+ var subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
41553
41562
  if ((originalData.name === 'url' || originalData.name === 'href') && originalData.value) {
41554
41563
  if (subRegex.test(originalData.value)) {
41555
41564
  placeholderData.push({
@@ -41559,37 +41568,37 @@ function findSubstitutableUrlsInJson(originalData, placeholderData = [], pendo)
41559
41568
  }
41560
41569
  }
41561
41570
  if (originalData.properties && originalData.id === 'href_link_block') {
41562
- pendo._.each(originalData.properties, (prop) => {
41571
+ pendo._.each(originalData.properties, function (prop) {
41563
41572
  findSubstitutableUrlsInJson(prop, placeholderData, pendo);
41564
41573
  });
41565
41574
  }
41566
41575
  if (originalData.views) {
41567
- pendo._.each(originalData.views, (view) => {
41576
+ pendo._.each(originalData.views, function (view) {
41568
41577
  findSubstitutableUrlsInJson(view, placeholderData, pendo);
41569
41578
  });
41570
41579
  }
41571
41580
  if (originalData.parameters) {
41572
- pendo._.each(originalData.parameters, (param) => {
41581
+ pendo._.each(originalData.parameters, function (param) {
41573
41582
  findSubstitutableUrlsInJson(param, placeholderData, pendo);
41574
41583
  });
41575
41584
  }
41576
41585
  if (originalData.actions) {
41577
- pendo._.each(originalData.actions, (action) => {
41586
+ pendo._.each(originalData.actions, function (action) {
41578
41587
  findSubstitutableUrlsInJson(action, placeholderData, pendo);
41579
41588
  });
41580
41589
  }
41581
41590
  if (originalData.children) {
41582
- pendo._.each(originalData.children, (child) => {
41591
+ pendo._.each(originalData.children, function (child) {
41583
41592
  findSubstitutableUrlsInJson(child, placeholderData, pendo);
41584
41593
  });
41585
41594
  }
41586
41595
  return placeholderData;
41587
41596
  }
41588
41597
  function findSubstitutableElements(pendo) {
41589
- let elements = pendo.dom(`${guideMarkdownUtil.containerSelector} *:not(.pendo-inline-ui)`);
41598
+ var elements = pendo.dom("".concat(guideMarkdownUtil.containerSelector, " *:not(.pendo-inline-ui)"));
41590
41599
  return pendo._.chain(elements)
41591
41600
  .filter(function (placeholder) {
41592
- const subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
41601
+ var subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
41593
41602
  if (placeholder.localName === 'a') {
41594
41603
  return subRegex.test(decodeURI(placeholder.href)) || subRegex.test(placeholder.textContent);
41595
41604
  }
@@ -41645,51 +41654,25 @@ function findSubstitutableElements(pendo) {
41645
41654
  .value();
41646
41655
  }
41647
41656
  function substitutionIcon(color, size) {
41648
- return (`<div title="Metadata Substitution added">
41649
- <svg id="pendo-ps-substitution-icon" viewBox="0 0 24 24"
41650
- preserveAspectRatio="xMidYMid meet"
41651
- height=${size} width=${size} title="Metadata Substitution"
41652
- style="bottom:5px; right:10px; position: absolute;"
41653
- fill="none" xmlns="http://www.w3.org/2000/svg" stroke="${color}"
41654
- transform="matrix(1, 0, 0, 1, 0, 0)rotate(0)">
41655
- <g stroke-width="0"></g>
41656
- <g stroke-linecap="round" stroke-linejoin="round"
41657
- stroke="${color}" stroke-width="0.528"></g>
41658
- <g><path fill-rule="evenodd" clip-rule="evenodd"
41659
- d="M5 5.5C4.17157 5.5 3.5 6.17157 3.5 7V10C3.5 10.8284
41660
- 4.17157 11.5 5 11.5H8C8.82843 11.5 9.5 10.8284 9.5
41661
- 10V9H17V11C17 11.2761 17.2239 11.5 17.5 11.5C17.7761
41662
- 11.5 18 11.2761 18 11V8.5C18 8.22386 17.7761 8 17.5
41663
- 8H9.5V7C9.5 6.17157 8.82843 5.5 8 5.5H5ZM8.5 7C8.5
41664
- 6.72386 8.27614 6.5 8 6.5H5C4.72386 6.5 4.5 6.72386
41665
- 4.5 7V10C4.5 10.2761 4.72386 10.5 5 10.5H8C8.27614
41666
- 10.5 8.5 10.2761 8.5 10V7Z" fill="${color}"></path>
41667
- <path fill-rule="evenodd" clip-rule="evenodd"
41668
- d="M7 13C7 12.7239 6.77614 12.5 6.5 12.5C6.22386 12.5
41669
- 6 12.7239 6 13V15.5C6 15.7761 6.22386 16 6.5
41670
- 16H14.5V17C14.5 17.8284 15.1716 18.5 16 18.5H19C19.8284
41671
- 18.5 20.5 17.8284 20.5 17V14C20.5 13.1716 19.8284 12.5
41672
- 19 12.5H16C15.1716 12.5 14.5 13.1716 14.5
41673
- 14V15H7V13ZM15.5 17C15.5 17.2761 15.7239 17.5 16
41674
- 17.5H19C19.2761 17.5 19.5 17.2761 19.5 17V14C19.5
41675
- 13.7239 19.2761 13.5 19 13.5H16C15.7239 13.5 15.5
41676
- 13.7239 15.5 14V17Z" fill="${color}"></path> </g></svg></div>`);
41677
- }
41678
-
41679
- const requiredElement = '<span class="_pendo-required-indicator" style="color:red; font-style:italic;" title="Question is required"> *</span>';
41680
- const requiredSyntax = '{required/}';
41681
- 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 = {
41682
41663
  name: 'RequiredQuestions',
41683
- script(step, guide, pendo) {
41664
+ script: function (step, guide, pendo) {
41684
41665
  var _a;
41685
- let requiredPollIds = [];
41686
- let submitButtons = (_a = guideMarkdownUtil.lookupGuideButtons(step.domJson)) === null || _a === void 0 ? void 0 : _a.filter(button => button.actions.find(action => action.action === 'submitPoll' || action.action === 'submitPollAndGoToStep'));
41687
- const requiredQuestions = processRequiredQuestions();
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();
41688
41671
  if (requiredQuestions) {
41689
- pendo._.forEach(requiredQuestions, (question) => {
41672
+ pendo._.forEach(requiredQuestions, function (question) {
41690
41673
  if (question.classList.contains('_pendo-open-text-poll-question')) {
41691
- let pollId = question.dataset.pendoPollId;
41692
- step.attachEvent(step.guideElement.find(`[data-pendo-poll-id=${pollId}]._pendo-open-text-poll-input`)[0], 'input', function () {
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 () {
41693
41676
  evaluateRequiredQuestions(requiredQuestions);
41694
41677
  });
41695
41678
  }
@@ -41701,11 +41684,13 @@ const RequiredQuestions = {
41701
41684
  });
41702
41685
  }
41703
41686
  function getEligibleQuestions() {
41704
- const pollQuestions = pendo._.toArray(step.guideElement.find(`[class*=-poll-question]:contains(${requiredSyntax})`));
41705
- const surveyMatches = pendo._.toArray(step.guideElement.find(`[data-pendo-poll-id]:contains(${requiredSyntax})`));
41706
- const surveyQuestions = pendo._.filter(surveyMatches, (candidate) => !pendo._.some(surveyMatches, (other) => other !== candidate && candidate.contains(other)));
41707
- const allQuestions = pendo._.uniq(pollQuestions.concat(surveyQuestions));
41708
- return pendo._.reduce(allQuestions, (eligibleQuestions, question) => {
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) {
41709
41694
  if (question.classList.contains('_pendo-yes-no-poll-question'))
41710
41695
  return eligibleQuestions;
41711
41696
  eligibleQuestions.push(question);
@@ -41713,22 +41698,24 @@ const RequiredQuestions = {
41713
41698
  }, []);
41714
41699
  }
41715
41700
  function ownsRequiredText(element) {
41716
- return pendo._.some(element.childNodes, (node) => node.nodeType === 3 && node.nodeValue && node.nodeValue.indexOf(requiredSyntax) !== -1);
41701
+ return pendo._.some(element.childNodes, function (node) {
41702
+ return node.nodeType === 3 && node.nodeValue && node.nodeValue.indexOf(requiredSyntax) !== -1;
41703
+ });
41717
41704
  }
41718
41705
  function processRequiredQuestions() {
41719
- let questions = getEligibleQuestions();
41706
+ var questions = getEligibleQuestions();
41720
41707
  if (questions) {
41721
- pendo._.forEach(questions, question => {
41722
- let dataPendoPollId = question.getAttribute('data-pendo-poll-id');
41708
+ pendo._.forEach(questions, function (question) {
41709
+ var dataPendoPollId = question.getAttribute('data-pendo-poll-id');
41723
41710
  requiredPollIds.push(dataPendoPollId);
41724
- const candidates = step.guideElement.find(`#${question.id} *, #${question.id}`);
41725
- const textHost = pendo._.find(candidates, ownsRequiredText) || question;
41726
- 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) {
41727
41714
  guideMarkdownUtil.removeMarkdownSyntax(element, requiredSyntax, '', pendo);
41728
41715
  });
41729
- const textHostEl = pendo.dom(textHost);
41716
+ var textHostEl = pendo.dom(textHost);
41730
41717
  if (textHostEl.find('._pendo-required-indicator').length === 0) {
41731
- const questionParagraph = textHostEl.find('p');
41718
+ var questionParagraph = textHostEl.find('p');
41732
41719
  if (questionParagraph && questionParagraph.length) {
41733
41720
  pendo.dom(questionParagraph[0]).append(requiredElement);
41734
41721
  }
@@ -41739,15 +41726,7 @@ const RequiredQuestions = {
41739
41726
  });
41740
41727
  }
41741
41728
  if (pendo._.size(requiredPollIds)) {
41742
- const disabledButtonStyles = `<style type=text/css
41743
- id=_pendo-guide-required-disabled>
41744
- ._pendo-button:disabled, ._pendo-buttons[disabled] {
41745
- border: 1px solid #999999 !important;
41746
- background-color: #cccccc !important;
41747
- color: #666666 !important;
41748
- pointer-events: none !important;
41749
- }
41750
- </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>";
41751
41730
  if (pendo.dom('#_pendo-guide-required-disabled').length === 0) {
41752
41731
  pendo.dom('head').append(disabledButtonStyles);
41753
41732
  }
@@ -41758,15 +41737,11 @@ const RequiredQuestions = {
41758
41737
  function evaluateRequiredQuestions(questions) {
41759
41738
  if (questions.length === 0)
41760
41739
  return;
41761
- let allRequiredComplete = true;
41762
- let responses = [];
41763
- responses = responses.concat(pendo._.map(questions, (question) => {
41764
- let pollId = question.getAttribute('data-pendo-poll-id');
41765
- let input = step.guideElement.find(`
41766
- [data-pendo-poll-id=${pollId}] textarea,
41767
- [data-pendo-poll-id=${pollId}] input:text,
41768
- [data-pendo-poll-id=${pollId}] select,
41769
- [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"));
41770
41745
  if (input && input.length && input[0].value) {
41771
41746
  return input[0].value;
41772
41747
  }
@@ -41783,50 +41758,50 @@ const RequiredQuestions = {
41783
41758
  }
41784
41759
  function disableEligibleButtons(buttons) {
41785
41760
  pendo._.each(buttons, function (button) {
41786
- if (step.guideElement.find(`#${button.props.id}`)[0]) {
41787
- step.guideElement.find(`#${button.props.id}`)[0].disabled = true;
41788
- step.guideElement.find(`#${button.props.id}`)[0].parentElement.title = 'Please complete all required questions.';
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.';
41789
41764
  }
41790
41765
  });
41791
41766
  }
41792
41767
  function enableEligibleButtons(buttons) {
41793
41768
  pendo._.each(buttons, function (button) {
41794
- if (step.guideElement.find(`#${button.props.id}`)[0]) {
41795
- step.guideElement.find(`#${button.props.id}`)[0].disabled = false;
41796
- step.guideElement.find(`#${button.props.id}`)[0].parentElement.title = '';
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 = '';
41797
41772
  }
41798
41773
  });
41799
41774
  }
41800
41775
  },
41801
- test(step, guide, pendo) {
41776
+ test: function (step, guide, pendo) {
41802
41777
  var _a, _b;
41803
- const pollQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find(`[class*=-poll-question]:contains(${requiredSyntax})`);
41804
- const surveyQuestions = (_b = step.guideElement) === null || _b === void 0 ? void 0 : _b.find(`[data-pendo-poll-id]:contains(${requiredSyntax})`);
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, ")"));
41805
41780
  return (!pendo._.isUndefined(pollQuestions) && pendo._.size(pollQuestions)) ||
41806
41781
  (!pendo._.isUndefined(surveyQuestions) && pendo._.size(surveyQuestions));
41807
41782
  },
41808
- designerListener(pendo) {
41809
- const requiredQuestions = [];
41810
- const target = pendo.dom.getBody();
41811
- const config = {
41783
+ designerListener: function (pendo) {
41784
+ var requiredQuestions = [];
41785
+ var target = pendo.dom.getBody();
41786
+ var config = {
41812
41787
  attributeFilter: ['data-layout'],
41813
41788
  attributes: true,
41814
41789
  childList: true,
41815
41790
  characterData: true,
41816
41791
  subtree: true
41817
41792
  };
41818
- const MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
41819
- const observer = new MutationObserver(applyRequiredIndicators);
41793
+ var MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
41794
+ var observer = new MutationObserver(applyRequiredIndicators);
41820
41795
  observer.observe(target, config);
41821
41796
  function applyRequiredIndicators(mutations) {
41822
41797
  pendo._.each(mutations, function (mutation) {
41823
41798
  var _a;
41824
- const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
41799
+ var nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
41825
41800
  if (mutation.addedNodes.length && nodeHasQuerySelector) {
41826
- let eligiblePolls = mutation.addedNodes[0].querySelectorAll('[class*=-poll-wrapper], [class*=-poll-select-border], [id^=survey-item-wrapper__]');
41801
+ var eligiblePolls = mutation.addedNodes[0].querySelectorAll('[class*=-poll-wrapper], [class*=-poll-select-border], [id^=survey-item-wrapper__]');
41827
41802
  if (eligiblePolls) {
41828
41803
  pendo._.each(eligiblePolls, function (poll) {
41829
- let dataPendoPollId;
41804
+ var dataPendoPollId;
41830
41805
  if (poll.classList.contains('_pendo-open-text-poll-wrapper') ||
41831
41806
  poll.classList.contains('_pendo-number-scale-poll-wrapper')) {
41832
41807
  dataPendoPollId = poll.getAttribute('name');
@@ -41834,31 +41809,31 @@ const RequiredQuestions = {
41834
41809
  else {
41835
41810
  dataPendoPollId = poll.getAttribute('data-pendo-poll-id');
41836
41811
  }
41837
- let questionText;
41838
- const questionElement = pendo.dom(`[class*="-poll-question"][data-pendo-poll-id=${dataPendoPollId}]`)[0] ||
41839
- pendo.dom(`.bb-text[data-pendo-poll-id=${dataPendoPollId}]`)[0];
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];
41840
41815
  if (questionElement) {
41841
41816
  questionText = questionElement.textContent;
41842
41817
  }
41843
- const requiredSyntaxIndex = questionText ? questionText.indexOf(requiredSyntax) : -1;
41818
+ var requiredSyntaxIndex = questionText ? questionText.indexOf(requiredSyntax) : -1;
41844
41819
  if (requiredSyntaxIndex > -1) {
41845
- pendo._.each(pendo.dom(`[data-pendo-poll-id=${dataPendoPollId}]:not(.pendo-radio)`), (element) => {
41846
- pendo._.each(pendo.dom(`#${element.id} *:not(".pendo-radio"), #${element.id}:not(".pendo-radio")`), (item) => {
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) {
41847
41822
  guideMarkdownUtil.removeMarkdownSyntax(item, requiredSyntax, '', pendo);
41848
41823
  });
41849
41824
  });
41850
- const pollTextSelector = `.bb-text[data-pendo-poll-id=${dataPendoPollId}]`;
41851
- const pollParagraphSelector = `${pollTextSelector} p`;
41852
- const pollListItemSelector = `${pollTextSelector} li`;
41853
- const pollIndicatorSelector = `${pollTextSelector} ._pendo-required-indicator`;
41854
- pendo._.each(pendo.dom(`${pollParagraphSelector}, ${pollListItemSelector}`), (el) => {
41855
- 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) {
41856
41831
  if (node.nodeType === 3 && node.nodeValue.indexOf(requiredSyntax) !== -1) {
41857
41832
  node.nodeValue = node.nodeValue.split(requiredSyntax).join('');
41858
41833
  }
41859
41834
  });
41860
41835
  });
41861
- const hasIndicator = pendo.dom(pollIndicatorSelector).length !== 0;
41836
+ var hasIndicator = pendo.dom(pollIndicatorSelector).length !== 0;
41862
41837
  if (!hasIndicator) {
41863
41838
  if (pendo.dom(pollParagraphSelector).length !== 0 || pendo.dom(pollListItemSelector).length !== 0) {
41864
41839
  pendo.dom(pollParagraphSelector).append(requiredElement);
@@ -41869,7 +41844,7 @@ const RequiredQuestions = {
41869
41844
  }
41870
41845
  }
41871
41846
  if (pendo._.contains(requiredQuestions, dataPendoPollId)) {
41872
- let questionIndex = requiredQuestions.indexOf(dataPendoPollId);
41847
+ var questionIndex = requiredQuestions.indexOf(dataPendoPollId);
41873
41848
  if (questionIndex !== -1) {
41874
41849
  requiredQuestions.splice(questionIndex, 1);
41875
41850
  }
@@ -41880,7 +41855,7 @@ const RequiredQuestions = {
41880
41855
  }
41881
41856
  else {
41882
41857
  if (pendo._.contains(requiredQuestions, dataPendoPollId)) {
41883
- let index = requiredQuestions.indexOf(dataPendoPollId);
41858
+ var index = requiredQuestions.indexOf(dataPendoPollId);
41884
41859
  if (index !== -1) {
41885
41860
  requiredQuestions.splice(index, 1);
41886
41861
  }
@@ -41894,54 +41869,54 @@ const RequiredQuestions = {
41894
41869
  }
41895
41870
  };
41896
41871
 
41897
- const skipStepRegex = new RegExp(guideMarkdownUtil.skipStepString);
41898
- const SkipToEligibleStep = {
41899
- script(step, guide, pendo) {
41900
- let isAdvanceIntercepted = false;
41901
- let isPreviousIntercepted = false;
41902
- let guideContainer = step.guideElement.find(guideMarkdownUtil.containerSelector);
41903
- let guideContainerAriaLabel = guideContainer.attr('aria-label');
41904
- let stepNumberOrAuto = skipStepRegex.exec(guideContainerAriaLabel)[1];
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];
41905
41880
  if (guideContainer) {
41906
41881
  guideContainer.attr({ 'aria-label': guideContainer.attr('aria-label').replace(skipStepRegex, '') });
41907
41882
  }
41908
- this.on('beforeAdvance', (evt) => {
41883
+ this.on('beforeAdvance', function (evt) {
41909
41884
  if (guide.getPositionOfStep(step) === guide.steps.length || pendo._.isUndefined(stepNumberOrAuto))
41910
41885
  return; // exit on the last step of a guide or when we don't have an argument
41911
- let eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'next');
41886
+ var eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'next');
41912
41887
  if (!isAdvanceIntercepted && stepNumberOrAuto) {
41913
41888
  isAdvanceIntercepted = true;
41914
- pendo.goToStep({ destinationStepId: eligibleStep.id, step });
41889
+ pendo.goToStep({ destinationStepId: eligibleStep.id, step: step });
41915
41890
  evt.cancel = true;
41916
41891
  }
41917
41892
  });
41918
- this.on('beforePrevious', (evt) => {
41893
+ this.on('beforePrevious', function (evt) {
41919
41894
  if (pendo._.isUndefined(stepNumberOrAuto))
41920
41895
  return;
41921
- let eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'previous');
41896
+ var eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'previous');
41922
41897
  if (!isPreviousIntercepted && stepNumberOrAuto) {
41923
41898
  isPreviousIntercepted = true;
41924
- pendo.goToStep({ destinationStepId: eligibleStep.id, step });
41899
+ pendo.goToStep({ destinationStepId: eligibleStep.id, step: step });
41925
41900
  evt.cancel = true;
41926
41901
  }
41927
41902
  });
41928
41903
  function findEligibleSkipStep(stepNumber, direction) {
41929
41904
  // Find the next eligible step by using getPosition of step (1 based)
41930
41905
  // getPosition - 2 gives the previous step
41931
- let skipForwardStep = findStepOnPage(guide.getPositionOfStep(step), 'next', stepNumber);
41932
- let skipPreviousStep = findStepOnPage(guide.getPositionOfStep(step) - 2, 'previous', stepNumber);
41906
+ var skipForwardStep = findStepOnPage(guide.getPositionOfStep(step), 'next', stepNumber);
41907
+ var skipPreviousStep = findStepOnPage(guide.getPositionOfStep(step) - 2, 'previous', stepNumber);
41933
41908
  if (skipForwardStep && direction == 'next') {
41934
- pendo.goToStep({ destinationStepId: skipForwardStep, step });
41909
+ pendo.goToStep({ destinationStepId: skipForwardStep, step: step });
41935
41910
  }
41936
41911
  if (skipPreviousStep && direction == 'previous') {
41937
- pendo.goToStep({ destinationStepId: skipPreviousStep, step });
41912
+ pendo.goToStep({ destinationStepId: skipPreviousStep, step: step });
41938
41913
  }
41939
41914
  return direction === 'next' ? skipForwardStep : skipPreviousStep;
41940
41915
  }
41941
41916
  function findStepOnPage(stepIndex, direction, stepNumber) {
41942
41917
  if (pendo._.isNaN(stepIndex))
41943
41918
  return;
41944
- let $step = guide.steps[stepIndex];
41919
+ var $step = guide.steps[stepIndex];
41945
41920
  if ($step && !$step.canShow()) {
41946
41921
  if (stepNumber !== 'auto') {
41947
41922
  return guide.steps[stepNumber - 1];
@@ -41958,34 +41933,34 @@ const SkipToEligibleStep = {
41958
41933
  }
41959
41934
  }
41960
41935
  },
41961
- test(step, guide, pendo) {
41936
+ test: function (step, guide, pendo) {
41962
41937
  var _a;
41963
- const guideContainerAriaLabel = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find(guideMarkdownUtil.containerSelector).attr('aria-label');
41938
+ var guideContainerAriaLabel = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find(guideMarkdownUtil.containerSelector).attr('aria-label');
41964
41939
  return pendo._.isString(guideContainerAriaLabel) && guideContainerAriaLabel.indexOf('{skipStep') !== -1;
41965
41940
  },
41966
- designerListener(pendo) {
41967
- const target = pendo.dom.getBody();
41968
- const config = {
41941
+ designerListener: function (pendo) {
41942
+ var target = pendo.dom.getBody();
41943
+ var config = {
41969
41944
  attributeFilter: ['data-layout'],
41970
41945
  attributes: true,
41971
41946
  childList: true,
41972
41947
  characterData: true,
41973
41948
  subtree: true
41974
41949
  };
41975
- const MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
41976
- const observer = new MutationObserver(applySkipStepIndicator);
41950
+ var MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
41951
+ var observer = new MutationObserver(applySkipStepIndicator);
41977
41952
  observer.observe(target, config);
41978
41953
  // create an observer instance
41979
41954
  function applySkipStepIndicator(mutations) {
41980
41955
  pendo._.each(mutations, function (mutation) {
41981
41956
  var _a, _b;
41982
- const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
41957
+ var nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
41983
41958
  if (mutation.addedNodes.length && nodeHasQuerySelector) {
41984
- let guideContainer = mutation.addedNodes[0].querySelectorAll(guideMarkdownUtil.containerSelector);
41985
- let guideContainerAriaLabel = (_b = guideContainer[0]) === null || _b === void 0 ? void 0 : _b.getAttribute('aria-label');
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');
41986
41961
  if (guideContainerAriaLabel) {
41987
41962
  if (guideContainerAriaLabel.match(skipStepRegex)) {
41988
- let fullSkipStepString = guideContainerAriaLabel.match(skipStepRegex)[0];
41963
+ var fullSkipStepString = guideContainerAriaLabel.match(skipStepRegex)[0];
41989
41964
  guideContainerAriaLabel.replace(fullSkipStepString, '');
41990
41965
  if (!pendo.dom('#_pendoSkipIcon').length) {
41991
41966
  pendo.dom(guideMarkdownUtil.containerSelector).append(skipIcon('#999', '30px').trim());
@@ -41996,48 +41971,30 @@ const SkipToEligibleStep = {
41996
41971
  });
41997
41972
  }
41998
41973
  function skipIcon(color, size) {
41999
- return (`<div title="Skip step added"><svg id="_pendoSkipIcon" version="1.0" xmlns="http://www.w3.org/2000/svg"
42000
- width="${size}" height="${size}" viewBox="0 0 512.000000 512.000000"
42001
- preserveAspectRatio="xMidYMid meet" style="bottom:5px; right:10px; position: absolute;">
42002
- <g transform="translate(0.000000,512.000000) scale(0.100000,-0.100000)"
42003
- fill="${color}" stroke="none">
42004
- <path d="M2185 4469 c-363 -38 -739 -186 -1034 -407 -95 -71 -273 -243 -357
42005
- -343 -205 -246 -364 -577 -429 -897 -25 -121 -45 -288 -45 -373 l0 -49 160 0
42006
- 160 0 0 48 c0 26 5 88 10 137 68 593 417 1103 940 1374 1100 570 2418 -137
42007
- 2560 -1374 5 -49 10 -111 10 -137 l0 -47 -155 -3 -155 -3 235 -235 235 -236
42008
- 235 236 235 235 -155 3 -155 3 0 48 c0 27 -5 95 -10 152 -100 989 -878 1767
42009
- -1869 1868 -117 12 -298 12 -416 0z"/>
42010
- <path d="M320 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
42011
- <path d="M960 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
42012
- <path d="M1600 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
42013
- <path d="M2240 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
42014
- <path d="M2880 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
42015
- <path d="M3840 1440 l0 -160 480 0 480 0 0 160 0 160 -480 0 -480 0 0 -160z"/>
42016
- </g></svg></div>
42017
- `);
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 "));
42018
41975
  }
42019
41976
  }
42020
41977
  };
42021
41978
 
42022
41979
  function GuideMarkdown() {
42023
- let guideMarkdown;
42024
- let pluginApi;
42025
- let globalPendo;
41980
+ var guideMarkdown;
41981
+ var pluginApi;
41982
+ var globalPendo;
42026
41983
  return {
42027
41984
  name: 'GuideMarkdown',
42028
41985
  initialize: init,
42029
- teardown
41986
+ teardown: teardown
42030
41987
  };
42031
41988
  function init(pendo, PluginAPI) {
42032
41989
  globalPendo = pendo;
42033
41990
  pluginApi = PluginAPI;
42034
- const configReader = PluginAPI.ConfigReader;
42035
- const GUIDEMARKDOWN_CONFIG = 'guideMarkdown';
41991
+ var configReader = PluginAPI.ConfigReader;
41992
+ var GUIDEMARKDOWN_CONFIG = 'guideMarkdown';
42036
41993
  configReader.addOption(GUIDEMARKDOWN_CONFIG, [
42037
41994
  configReader.sources.SNIPPET_SRC,
42038
41995
  configReader.sources.PENDO_CONFIG_SRC
42039
41996
  ], false);
42040
- const markdownScriptsEnabled = configReader.get(GUIDEMARKDOWN_CONFIG);
41997
+ var markdownScriptsEnabled = configReader.get(GUIDEMARKDOWN_CONFIG);
42041
41998
  if (!markdownScriptsEnabled)
42042
41999
  return;
42043
42000
  guideMarkdown = [PollBranching, MetadataSubstitution, RequiredQuestions, SkipToEligibleStep];
@@ -43076,8 +43033,8 @@ function Feedback() {
43076
43033
  var widgetLoaded = false;
43077
43034
  var feedbackAllowedProductId = '';
43078
43035
  var initialized = false;
43079
- const PING_COOKIE = 'feedback_ping_sent';
43080
- const PING_COOKIE_EXPIRATION = 1000 * 60 * 60;
43036
+ var PING_COOKIE = 'feedback_ping_sent';
43037
+ var PING_COOKIE_EXPIRATION = 1000 * 60 * 60;
43081
43038
  var overflowMediaQuery = '@media only screen and (max-device-width:1112px){#feedback-widget{overflow-y:scroll}}';
43082
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%)}}';
43083
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)}}';
@@ -43097,28 +43054,28 @@ function Feedback() {
43097
43054
  feedbackStyles: 'pendo-feedback-styles',
43098
43055
  feedbackFrameStyles: 'pendo-feedback-visible-buttons-styles'
43099
43056
  };
43100
- let globalPendo;
43101
- let pluginApi;
43057
+ var globalPendo;
43058
+ var pluginApi;
43102
43059
  return {
43103
43060
  name: 'Feedback',
43104
- initialize,
43105
- teardown,
43106
- validate
43061
+ initialize: initialize,
43062
+ teardown: teardown,
43063
+ validate: validate
43107
43064
  };
43108
43065
  function initialize(pendo, PluginAPI) {
43109
43066
  globalPendo = pendo;
43110
43067
  pluginApi = PluginAPI;
43111
43068
  var publicFeedback = {
43112
- ping,
43113
- init,
43069
+ ping: ping,
43070
+ init: init,
43114
43071
  initialized: getInitialized,
43115
- loginAndRedirect,
43116
- openFeedback,
43117
- initializeFeedbackOnce,
43118
- isFeedbackLoaded,
43119
- convertPendoToFeedbackOptions,
43072
+ loginAndRedirect: loginAndRedirect,
43073
+ openFeedback: openFeedback,
43074
+ initializeFeedbackOnce: initializeFeedbackOnce,
43075
+ isFeedbackLoaded: isFeedbackLoaded,
43076
+ convertPendoToFeedbackOptions: convertPendoToFeedbackOptions,
43120
43077
  isUnsupportedIE: pendo._.partial(isUnsupportedIE, PluginAPI),
43121
- removeFeedbackWidget
43078
+ removeFeedbackWidget: removeFeedbackWidget
43122
43079
  };
43123
43080
  pendo.feedback = publicFeedback;
43124
43081
  pendo.getFeedbackSettings = getFeedbackSettings;
@@ -43134,7 +43091,7 @@ function Feedback() {
43134
43091
  * @access public
43135
43092
  * @label notificationCountCookie
43136
43093
  */
43137
- PluginAPI.agentStorage.registry.addLocal(notificationCountCookie);
43094
+ PluginAPI.agentStorage.registry.addLocal(notificationCountCookie, { localStorageOnly: true });
43138
43095
  /**
43139
43096
  * Stores the last ping time for the legacy Feedback widget. Used to control the
43140
43097
  * frequency of communication with the Feedback server.
@@ -43144,9 +43101,12 @@ function Feedback() {
43144
43101
  * @access public
43145
43102
  * @label PING_COOKIE
43146
43103
  */
43147
- PluginAPI.agentStorage.registry.addLocal(PING_COOKIE, { duration: PING_COOKIE_EXPIRATION });
43104
+ PluginAPI.agentStorage.registry.addLocal(PING_COOKIE, {
43105
+ duration: PING_COOKIE_EXPIRATION,
43106
+ localStorageOnly: true
43107
+ });
43148
43108
  return {
43149
- validate
43109
+ validate: validate
43150
43110
  };
43151
43111
  }
43152
43112
  function teardown() {
@@ -43166,18 +43126,18 @@ function Feedback() {
43166
43126
  return result;
43167
43127
  }
43168
43128
  function pingOrInitialize() {
43169
- const options = getPendoOptions();
43129
+ var options = getPendoOptions();
43170
43130
  if (initialized) {
43171
- const feedbackOptions = convertPendoToFeedbackOptions(options);
43131
+ var feedbackOptions = convertPendoToFeedbackOptions(options);
43172
43132
  ping(feedbackOptions);
43173
43133
  }
43174
43134
  else if (shouldInitializeFeedback() && !globalPendo._.isEmpty(options)) {
43175
- const settings = pluginApi.ConfigReader.get('feedbackSettings');
43176
- init(options, settings).catch(globalPendo._.noop);
43135
+ var settings = pluginApi.ConfigReader.get('feedbackSettings');
43136
+ init(options, settings)["catch"](globalPendo._.noop);
43177
43137
  }
43178
43138
  }
43179
43139
  function handleIdentityChange(event) {
43180
- const visitorId = globalPendo._.get(event, 'data.0.visitor_id') || globalPendo._.get(event, 'data.0.options.visitor.id');
43140
+ var visitorId = globalPendo._.get(event, 'data.0.visitor_id') || globalPendo._.get(event, 'data.0.options.visitor.id');
43181
43141
  if (globalPendo.isAnonymousVisitor(visitorId)) {
43182
43142
  removeFeedbackWidget();
43183
43143
  return;
@@ -43247,9 +43207,9 @@ function Feedback() {
43247
43207
  if (toSend.data && toSend.data !== '{}' && toSend.data !== 'null') {
43248
43208
  return globalPendo.ajax
43249
43209
  .postJSON(getFullUrl('/widget/pendo_ping'), toSend)
43250
- .then((response) => {
43210
+ .then(function (response) {
43251
43211
  onWidgetPingResponse(response);
43252
- }).catch(() => { onPingFailure(); });
43212
+ })["catch"](function () { onPingFailure(); });
43253
43213
  }
43254
43214
  }
43255
43215
  return pluginApi.q.resolve();
@@ -43383,10 +43343,10 @@ function Feedback() {
43383
43343
  return globalPendo.ajax.postJSON(getFullUrl('/analytics'), toSend);
43384
43344
  }
43385
43345
  function addOverlay() {
43386
- const widget = globalPendo.dom(`#${elemIds.feedbackWidget}`);
43346
+ var widget = globalPendo.dom("#".concat(elemIds.feedbackWidget));
43387
43347
  if (!widget)
43388
43348
  return;
43389
- const overlayStyles = {
43349
+ var overlayStyles = {
43390
43350
  'position': 'fixed',
43391
43351
  'top': '0',
43392
43352
  'right': '0',
@@ -43398,7 +43358,7 @@ function Feedback() {
43398
43358
  'animation': 'pendoFeedbackFadeIn 0.5s 0s 1 alternate both',
43399
43359
  '-webkit-animation': 'pendoFeedbackFadeIn 0.5s 0s 1 alternate both'
43400
43360
  };
43401
- const overlayElement = globalPendo.dom(document.createElement('div'));
43361
+ var overlayElement = globalPendo.dom(document.createElement('div'));
43402
43362
  overlayElement.attr('id', 'feedback-overlay');
43403
43363
  overlayElement.css(overlayStyles);
43404
43364
  overlayElement.appendTo(widget.getParent());
@@ -43503,22 +43463,22 @@ function Feedback() {
43503
43463
  }
43504
43464
  }
43505
43465
  function buildOuterTriggerDiv(positionInfo) {
43506
- const horizontalStyles = getHorizontalPositionStyles(positionInfo);
43507
- const verticalStyles = getVerticalPositionStyles(positionInfo);
43508
- const styles = globalPendo._.extend({
43466
+ var horizontalStyles = getHorizontalPositionStyles(positionInfo);
43467
+ var verticalStyles = getVerticalPositionStyles(positionInfo);
43468
+ var styles = globalPendo._.extend({
43509
43469
  'position': 'fixed',
43510
43470
  'height': '43px',
43511
43471
  'opacity': '1 !important',
43512
43472
  'z-index': '9001'
43513
43473
  }, horizontalStyles, verticalStyles);
43514
- const outerTrigger = globalPendo.dom(document.createElement('div'));
43474
+ var outerTrigger = globalPendo.dom(document.createElement('div'));
43515
43475
  outerTrigger.attr('id', elemIds.feedbackTrigger);
43516
43476
  outerTrigger.css(styles);
43517
43477
  outerTrigger.attr('data-turbolinks-permanent', '');
43518
43478
  return outerTrigger;
43519
43479
  }
43520
43480
  function buildNotification() {
43521
- const styles = {
43481
+ var styles = {
43522
43482
  'background-color': '#D85039',
43523
43483
  'color': '#fff',
43524
43484
  'border-radius': '50%',
@@ -43535,20 +43495,20 @@ function Feedback() {
43535
43495
  'animation-delay': '1s',
43536
43496
  'animation-iteration-count': '1'
43537
43497
  };
43538
- const notification = globalPendo.dom(document.createElement('span'));
43498
+ var notification = globalPendo.dom(document.createElement('span'));
43539
43499
  notification.attr('id', 'feedback-trigger-notification');
43540
43500
  notification.css(styles);
43541
43501
  return notification;
43542
43502
  }
43543
43503
  function buildTriggerButton(settings, positionInfo) {
43544
- let borderRadius;
43504
+ var borderRadius;
43545
43505
  if (positionInfo.horizontalPosition === 'left') {
43546
43506
  borderRadius = '0 0 5px 5px';
43547
43507
  }
43548
43508
  else {
43549
43509
  borderRadius = '3px 3px 0 0';
43550
43510
  }
43551
- const styles = {
43511
+ var styles = {
43552
43512
  'border': 'none',
43553
43513
  'padding': '11px 18px 14px 18px',
43554
43514
  'background-color': settings.triggerColor,
@@ -43559,32 +43519,21 @@ function Feedback() {
43559
43519
  'cursor': 'pointer',
43560
43520
  'text-align': 'left'
43561
43521
  };
43562
- const triggerButton = globalPendo.dom(document.createElement('button'));
43522
+ var triggerButton = globalPendo.dom(document.createElement('button'));
43563
43523
  triggerButton.attr('id', elemIds.feedbackTriggerButton);
43564
43524
  triggerButton.css(styles);
43565
43525
  triggerButton.text(settings.triggerText);
43566
43526
  return triggerButton;
43567
43527
  }
43568
43528
  function addTriggerPseudoStyles() {
43569
- const pseudoStyles = `
43570
- #feedback-trigger button:hover {
43571
- box-shadow: 0 -5px 20px rgba(0,0,0,.19) !important;
43572
- outline: none !important;
43573
- background: #3e566f !important;
43574
- }
43575
- #feedback-trigger button:focus {
43576
- box-shadow: 0 -5px 20px rgba(0,0,0,.19) !important;
43577
- outline: none !important;
43578
- background: #3e566f !important;
43579
- }
43580
- `;
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 ";
43581
43530
  pluginApi.util.addInlineStyles('pendo-feedback-trigger-styles', pseudoStyles);
43582
43531
  }
43583
43532
  function createTrigger(settings, positionInfo) {
43584
43533
  addTriggerPseudoStyles();
43585
- const triggerElement = buildOuterTriggerDiv(positionInfo);
43586
- const notificationElement = buildNotification();
43587
- const triggerButtonElement = buildTriggerButton(settings, positionInfo);
43534
+ var triggerElement = buildOuterTriggerDiv(positionInfo);
43535
+ var notificationElement = buildNotification();
43536
+ var triggerButtonElement = buildTriggerButton(settings, positionInfo);
43588
43537
  triggerElement.append(notificationElement);
43589
43538
  triggerElement.append(triggerButtonElement);
43590
43539
  triggerElement.appendTo(globalPendo.dom.getBody());
@@ -43608,7 +43557,7 @@ function Feedback() {
43608
43557
  iframeWrapper.css(getWidgetOriginalStyles());
43609
43558
  iframeWrapper.attr('id', elemIds.feedbackWidget);
43610
43559
  iframeWrapper.attr('data-turbolinks-permanent', 'true');
43611
- iframeWrapper.addClass(`buttonIs-${horizontalPosition}`);
43560
+ iframeWrapper.addClass("buttonIs-".concat(horizontalPosition));
43612
43561
  return iframeWrapper;
43613
43562
  }
43614
43563
  function buildIframeContainer() {
@@ -43625,22 +43574,13 @@ function Feedback() {
43625
43574
  return iframeContainer;
43626
43575
  }
43627
43576
  function addWidgetVisibleButtonStyles(buttonStylePosition) {
43628
- let side = buttonStylePosition === 'left' ? 'left' : 'right'; // just in case something was not left or right for some reason
43629
- const styles = `
43630
- .buttonIs-${side}.visible {
43631
- ${side}: 0 !important;
43632
- width: 470px !important;
43633
- animation-direction: alternate-reverse !important;
43634
- animation: pendoFeedbackSlideFrom-${side} 0.5s 0s 1 alternate both !important;
43635
- -webkit-animation: pendoFeedbackSlideFrom-${side} 0.5s 0s 1 alternate both !important;
43636
- z-index: 9002 !important;
43637
- }
43638
- `;
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 ");
43639
43579
  pluginApi.util.addInlineStyles(elemIds.feedbackFrameStyles, styles);
43640
43580
  }
43641
43581
  function initialiseWidgetFrame(horizontalPosition) {
43642
43582
  addWidgetVisibleButtonStyles(horizontalPosition);
43643
- const iframeElement = buildIframeWrapper(horizontalPosition);
43583
+ var iframeElement = buildIframeWrapper(horizontalPosition);
43644
43584
  iframeElement.append(buildIframeContainer());
43645
43585
  iframeElement.appendTo(globalPendo.dom.getBody());
43646
43586
  subscribeToIframeMessages();
@@ -43664,7 +43604,7 @@ function Feedback() {
43664
43604
  return widgetLoaded;
43665
43605
  }
43666
43606
  function getPendoOptions() {
43667
- let options = pluginApi.ConfigReader.getLocalConfig();
43607
+ var options = pluginApi.ConfigReader.getLocalConfig();
43668
43608
  if (!globalPendo._.isObject(options))
43669
43609
  options = {};
43670
43610
  if (!globalPendo._.isObject(options.visitor))
@@ -43692,7 +43632,7 @@ function Feedback() {
43692
43632
  return true;
43693
43633
  }
43694
43634
  function getQueryParam(url, paramName) {
43695
- const results = new RegExp('[?&]' + paramName + '=([^&#]*)').exec(url);
43635
+ var results = new RegExp('[?&]' + paramName + '=([^&#]*)').exec(url);
43696
43636
  if (results == null) {
43697
43637
  return null;
43698
43638
  }
@@ -43709,13 +43649,13 @@ function Feedback() {
43709
43649
  return pluginApi.q.reject();
43710
43650
  if (!canInitFeedback(pendoOptions))
43711
43651
  return pluginApi.q.reject();
43712
- const feedbackOptions = convertPendoToFeedbackOptions(pendoOptions);
43652
+ var feedbackOptions = convertPendoToFeedbackOptions(pendoOptions);
43713
43653
  try {
43714
- const fdbkDst = getQueryParam(globalPendo.url.get(), 'fdbkDst');
43715
- if (fdbkDst && fdbkDst.startsWith('case')) {
43654
+ var fdbkDst_1 = getQueryParam(globalPendo.url.get(), 'fdbkDst');
43655
+ if (fdbkDst_1 && fdbkDst_1.startsWith('case')) {
43716
43656
  initialized = true;
43717
43657
  getFeedbackLoginUrl().then(function (loginUrl) {
43718
- const destinationUrl = loginUrl + '&fdbkDst=' + fdbkDst;
43658
+ var destinationUrl = loginUrl + '&fdbkDst=' + fdbkDst_1;
43719
43659
  window.location.href = destinationUrl;
43720
43660
  });
43721
43661
  return;
@@ -43764,7 +43704,7 @@ function Feedback() {
43764
43704
  function convertPendoToFeedbackOptions(options) {
43765
43705
  var jwtOptions = pluginApi.agent.getJwtInfoCopy();
43766
43706
  if (globalPendo._.isEmpty(jwtOptions)) {
43767
- const feedbackOptions = {};
43707
+ var feedbackOptions = {};
43768
43708
  feedbackOptions.user = globalPendo._.pick(options.visitor, 'id', 'full_name', 'firstName', 'lastName', 'email', 'tags', 'custom_allowed_products');
43769
43709
  globalPendo._.extend(feedbackOptions.user, { allowed_products: [{ id: feedbackAllowedProductId }] });
43770
43710
  feedbackOptions.account = globalPendo._.pick(options.account, 'id', 'name', 'monthly_value', 'is_paying', 'tags');
@@ -49354,6 +49294,17 @@ var SessionRecorderBuffer = /** @class */ (function () {
49354
49294
  return SessionRecorderBuffer;
49355
49295
  }());
49356
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
+
49357
49308
  function __rest(s, e) {
49358
49309
  var t = {};
49359
49310
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -51518,7 +51469,7 @@ function includes(str, substring) {
51518
51469
  function getResourceType(blockedURI, directive) {
51519
51470
  if (!directive || typeof directive !== 'string')
51520
51471
  return 'resource';
51521
- const d = directive.toLowerCase();
51472
+ var d = directive.toLowerCase();
51522
51473
  if (blockedURI === 'inline') {
51523
51474
  if (includes(d, 'script-src-attr')) {
51524
51475
  return 'inline event handler';
@@ -51577,11 +51528,12 @@ function getResourceType(blockedURI, directive) {
51577
51528
  function getDirective(policy, directiveName) {
51578
51529
  if (!policy || !directiveName)
51579
51530
  return '';
51580
- const needle = directiveName.toLowerCase();
51581
- for (const directive of policy.split(';')) {
51582
- const trimmed = directive.trim();
51583
- const lower = trimmed.toLowerCase();
51584
- if (lower === needle || lower.startsWith(`${needle} `)) {
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, " "))) {
51585
51537
  return trimmed;
51586
51538
  }
51587
51539
  }
@@ -51603,7 +51555,7 @@ function getDirective(policy, directiveName) {
51603
51555
  function getArticle(phrase) {
51604
51556
  if (!phrase || typeof phrase !== 'string')
51605
51557
  return 'A';
51606
- const c = phrase.trim().charAt(0).toLowerCase();
51558
+ var c = phrase.trim().charAt(0).toLowerCase();
51607
51559
  return includes('aeiou', c) ? 'An' : 'A';
51608
51560
  }
51609
51561
  /**
@@ -51646,46 +51598,47 @@ function createCspViolationMessage(blockedURI, directive, isReportOnly, original
51646
51598
  return 'Content Security Policy: Unknown violation occurred.';
51647
51599
  }
51648
51600
  try {
51649
- const reportOnlyText = isReportOnly ? ' (Report-Only)' : '';
51601
+ var reportOnlyText = isReportOnly ? ' (Report-Only)' : '';
51650
51602
  // special case for frame-ancestors since it doesn't fit our template at all
51651
51603
  if ((directive === null || directive === void 0 ? void 0 : directive.toLowerCase()) === 'frame-ancestors') {
51652
- return `Content Security Policy${reportOnlyText}: The display of ${blockedURI} in a frame was blocked because an ancestor violates your site's frame-ancestors policy.\nCurrent CSP: "${originalPolicy}".`;
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, "\".");
51653
51605
  }
51654
- const resourceType = getResourceType(blockedURI, directive);
51655
- const article = getArticle(resourceType);
51656
- const source = formatBlockedUri(blockedURI);
51657
- const directiveValue = getDirective(originalPolicy, directive);
51658
- const policyDisplay = directiveValue || directive;
51659
- const resourceDescription = `${article} ${resourceType}${source ? ` from ${source}` : ''}`;
51660
- return `Content Security Policy${reportOnlyText}: ${resourceDescription} was blocked by your site's \`${policyDisplay}\` policy.\nCurrent CSP: "${originalPolicy}".`;
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, "\".");
51661
51613
  }
51662
51614
  catch (error) {
51663
- return `Content Security Policy: Error formatting violation message: ${error.message}`;
51615
+ return "Content Security Policy: Error formatting violation message: ".concat(error.message);
51664
51616
  }
51665
51617
  }
51666
51618
 
51667
- const MAX_LENGTH = 1000;
51668
- const PII_PATTERN = {
51619
+ var MAX_LENGTH = 1000;
51620
+ var PII_PATTERN = {
51669
51621
  ip: /\b(?:\d{1,3}\.){3}\d{1,3}\b/g,
51670
51622
  ssn: /\b\d{3}-\d{2}-\d{4}\b/g,
51671
51623
  creditCard: /\b(?:\d[ -]?){12,18}\d\b/g,
51672
51624
  httpsUrls: /https:\/\/[^\s]+/g,
51673
51625
  email: /[\w._+-]+@[\w.-]+\.\w+/g
51674
51626
  };
51675
- const PII_REPLACEMENT = '*'.repeat(10);
51676
- const JSON_PII_KEYS = ['password', 'email', 'key', 'token', 'auth', 'authentication', 'phone', 'address', 'ssn'];
51677
- const UNABLE_TO_DISPLAY_BODY = '[Unable to display body: detected PII could not be redacted]';
51678
- const joinedKeys = JSON_PII_KEYS.join('|');
51679
- const keyPattern = `"([^"]*(?:${joinedKeys})[^"]*)"`;
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, ")[^\"]*)\"");
51680
51632
  // only scrub strings, numbers, and booleans
51681
- const acceptedValues = '("([^"\\\\]*(?:\\\\.[^"\\\\]*)*")|(\\d+)|(true|false))';
51633
+ var acceptedValues = '("([^"\\\\]*(?:\\\\.[^"\\\\]*)*")|(\\d+)|(true|false))';
51682
51634
  /**
51683
51635
  * Truncates a string to the max length
51684
51636
  * @access private
51685
51637
  * @param {String} string
51686
51638
  * @returns {String}
51687
51639
  */
51688
- function truncate(string, includeEllipsis = false) {
51640
+ function truncate(string, includeEllipsis) {
51641
+ if (includeEllipsis === void 0) { includeEllipsis = false; }
51689
51642
  if (string.length <= MAX_LENGTH)
51690
51643
  return string;
51691
51644
  if (includeEllipsis) {
@@ -51702,7 +51655,7 @@ function truncate(string, includeEllipsis = false) {
51702
51655
  * @returns {String}
51703
51656
  */
51704
51657
  function generateLogKey(methodName, message, stackTrace) {
51705
- return `${methodName}|${message}|${stackTrace}`;
51658
+ return "".concat(methodName, "|").concat(message, "|").concat(stackTrace);
51706
51659
  }
51707
51660
  /**
51708
51661
  * Checks if a string has 2 or more digits, a https URL, or an email address
@@ -51719,12 +51672,13 @@ function mightContainPII(string) {
51719
51672
  * @param {String} string
51720
51673
  * @returns {String}
51721
51674
  */
51722
- function scrubPII({ string, _ }) {
51675
+ function scrubPII(_a) {
51676
+ var string = _a.string, _ = _a._;
51723
51677
  if (!string || typeof string !== 'string')
51724
51678
  return string;
51725
51679
  if (!mightContainPII(string))
51726
51680
  return string;
51727
- return _.reduce(_.values(PII_PATTERN), (str, pattern) => str.replace(pattern, PII_REPLACEMENT), string);
51681
+ return _.reduce(_.values(PII_PATTERN), function (str, pattern) { return str.replace(pattern, PII_REPLACEMENT); }, string);
51728
51682
  }
51729
51683
  /**
51730
51684
  * Scrub PII from a stringified JSON object
@@ -51733,12 +51687,14 @@ function scrubPII({ string, _ }) {
51733
51687
  * @returns {String}
51734
51688
  */
51735
51689
  function scrubJsonPII(string) {
51736
- const fullScrubRegex = new RegExp(`${keyPattern}\\s*:\\s*[\\{\\[]`, 'i');
51690
+ var fullScrubRegex = new RegExp("".concat(keyPattern, "\\s*:\\s*[\\{\\[]"), 'i');
51737
51691
  if (fullScrubRegex.test(string)) {
51738
51692
  return UNABLE_TO_DISPLAY_BODY;
51739
51693
  }
51740
- const keyValueScrubRegex = new RegExp(`${keyPattern}\\s*:\\s*${acceptedValues}`, 'gi');
51741
- return string.replace(keyValueScrubRegex, (match, key) => `"${key}":"${PII_REPLACEMENT}"`);
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
+ });
51742
51698
  }
51743
51699
  /**
51744
51700
  * Checks if a string is a JSON object
@@ -51750,7 +51706,7 @@ function scrubJsonPII(string) {
51750
51706
  function mightContainJson(string, contentType) {
51751
51707
  if (!string || typeof string !== 'string')
51752
51708
  return false;
51753
- const firstChar = string.charAt(0);
51709
+ var firstChar = string.charAt(0);
51754
51710
  if (contentType && contentType.indexOf('application/json') !== -1) {
51755
51711
  return true;
51756
51712
  }
@@ -51763,19 +51719,20 @@ function mightContainJson(string, contentType) {
51763
51719
  * @param {String} contentType
51764
51720
  * @returns {String}
51765
51721
  */
51766
- function maskSensitiveFields({ string, contentType, _ }) {
51722
+ function maskSensitiveFields(_a) {
51723
+ var string = _a.string, contentType = _a.contentType, _ = _a._;
51767
51724
  if (!string || typeof string !== 'string')
51768
51725
  return string;
51769
51726
  if (mightContainJson(string, contentType)) {
51770
51727
  string = scrubJsonPII(string);
51771
51728
  }
51772
51729
  if (mightContainPII(string)) {
51773
- string = scrubPII({ string, _ });
51730
+ string = scrubPII({ string: string, _: _ });
51774
51731
  }
51775
51732
  return string;
51776
51733
  }
51777
51734
 
51778
- const DEV_LOG_TYPE = 'devlog';
51735
+ var DEV_LOG_TYPE = 'devlog';
51779
51736
  function createDevLogEnvelope(pluginAPI, globalPendo) {
51780
51737
  return {
51781
51738
  browser_time: pluginAPI.util.getNow(),
@@ -51786,12 +51743,12 @@ function createDevLogEnvelope(pluginAPI, globalPendo) {
51786
51743
  };
51787
51744
  }
51788
51745
 
51789
- const TOKEN_MAX_SIZE = 100;
51790
- const TOKEN_REFILL_RATE = 10;
51791
- const TOKEN_REFRESH_INTERVAL = 1000;
51792
- const MAX_UNCOMPRESSED_SIZE = 125000; // 125KB
51793
- class DevlogBuffer {
51794
- constructor(pendo, pluginAPI) {
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) {
51795
51752
  this.pendo = pendo;
51796
51753
  this.pluginAPI = pluginAPI;
51797
51754
  this.events = [];
@@ -51802,36 +51759,36 @@ class DevlogBuffer {
51802
51759
  this.lastRefillTime = this.pluginAPI.util.getNow();
51803
51760
  this.nextRefillTime = this.lastRefillTime + TOKEN_REFRESH_INTERVAL;
51804
51761
  }
51805
- isEmpty() {
51762
+ DevlogBuffer.prototype.isEmpty = function () {
51806
51763
  return this.events.length === 0 && this.payloads.length === 0;
51807
- }
51808
- refillTokens() {
51809
- const now = this.pluginAPI.util.getNow();
51764
+ };
51765
+ DevlogBuffer.prototype.refillTokens = function () {
51766
+ var now = this.pluginAPI.util.getNow();
51810
51767
  if (now >= this.nextRefillTime) {
51811
- const timeSinceLastRefill = now - this.lastRefillTime;
51812
- const secondsSinceLastRefill = Math.floor(timeSinceLastRefill / TOKEN_REFRESH_INTERVAL);
51813
- const tokensToRefill = secondsSinceLastRefill * TOKEN_REFILL_RATE;
51768
+ var timeSinceLastRefill = now - this.lastRefillTime;
51769
+ var secondsSinceLastRefill = Math.floor(timeSinceLastRefill / TOKEN_REFRESH_INTERVAL);
51770
+ var tokensToRefill = secondsSinceLastRefill * TOKEN_REFILL_RATE;
51814
51771
  this.tokens = Math.min(this.tokens + tokensToRefill, TOKEN_MAX_SIZE);
51815
51772
  this.lastRefillTime = now;
51816
51773
  this.nextRefillTime = now + TOKEN_REFRESH_INTERVAL;
51817
51774
  }
51818
- }
51819
- clear() {
51775
+ };
51776
+ DevlogBuffer.prototype.clear = function () {
51820
51777
  this.events = [];
51821
51778
  this.lastEvent = null;
51822
51779
  this.uncompressedSize = 0;
51823
- }
51824
- hasTokenAvailable() {
51780
+ };
51781
+ DevlogBuffer.prototype.hasTokenAvailable = function () {
51825
51782
  this.refillTokens();
51826
51783
  return this.tokens > 0;
51827
- }
51828
- estimateEventSize(event) {
51784
+ };
51785
+ DevlogBuffer.prototype.estimateEventSize = function (event) {
51829
51786
  return JSON.stringify(event).length;
51830
- }
51831
- push(event) {
51787
+ };
51788
+ DevlogBuffer.prototype.push = function (event) {
51832
51789
  if (!this.hasTokenAvailable())
51833
51790
  return false;
51834
- const eventSize = this.estimateEventSize(event);
51791
+ var eventSize = this.estimateEventSize(event);
51835
51792
  if (this.uncompressedSize + eventSize > MAX_UNCOMPRESSED_SIZE) {
51836
51793
  this.compressCurrentChunk();
51837
51794
  }
@@ -51840,54 +51797,55 @@ class DevlogBuffer {
51840
51797
  this.events.push(event);
51841
51798
  this.tokens = Math.max(this.tokens - 1, 0);
51842
51799
  return true;
51843
- }
51844
- compressCurrentChunk() {
51800
+ };
51801
+ DevlogBuffer.prototype.compressCurrentChunk = function () {
51845
51802
  if (this.events.length === 0)
51846
51803
  return;
51847
- const jzb = this.pendo.compress(this.events);
51804
+ var jzb = this.pendo.compress(this.events);
51848
51805
  this.payloads.push(jzb);
51849
51806
  this.clear();
51850
- }
51851
- generateUrl() {
51852
- const queryParams = {
51807
+ };
51808
+ DevlogBuffer.prototype.generateUrl = function () {
51809
+ var queryParams = {
51853
51810
  v: this.pendo.VERSION,
51854
51811
  ct: this.pluginAPI.util.getNow()
51855
51812
  };
51856
51813
  return this.pluginAPI.transmit.buildBaseDataUrl(DEV_LOG_TYPE, this.pendo.apiKey, queryParams);
51857
- }
51858
- pack() {
51814
+ };
51815
+ DevlogBuffer.prototype.pack = function () {
51859
51816
  if (this.isEmpty())
51860
51817
  return;
51861
- const url = this.generateUrl();
51818
+ var url = this.generateUrl();
51862
51819
  this.compressCurrentChunk();
51863
- const payloads = this.pendo._.map(this.payloads, (jzb) => ({
51864
- jzb,
51865
- url
51866
- }));
51820
+ var payloads = this.pendo._.map(this.payloads, function (jzb) { return ({
51821
+ jzb: jzb,
51822
+ url: url
51823
+ }); });
51867
51824
  this.payloads = [];
51868
51825
  return payloads;
51869
- }
51870
- }
51826
+ };
51827
+ return DevlogBuffer;
51828
+ }());
51871
51829
 
51872
- class DevlogTransport {
51873
- constructor(globalPendo, pluginAPI) {
51830
+ var DevlogTransport = /** @class */ (function () {
51831
+ function DevlogTransport(globalPendo, pluginAPI) {
51874
51832
  this.pendo = globalPendo;
51875
51833
  this.pluginAPI = pluginAPI;
51876
51834
  }
51877
- buildGetUrl(baseUrl, jzb) {
51878
- const params = {};
51835
+ DevlogTransport.prototype.buildGetUrl = function (baseUrl, jzb) {
51836
+ var params = {};
51879
51837
  if (this.pluginAPI.agent.treatAsAdoptPartner()) {
51880
51838
  this.pluginAPI.agent.addAccountIdParams(params, this.pendo.get_account_id(), this.pluginAPI.ConfigReader.get('oemAccountId'));
51881
51839
  }
51882
- const jwtOptions = this.pluginAPI.agent.getJwtInfoCopy();
51840
+ var jwtOptions = this.pluginAPI.agent.getJwtInfoCopy();
51883
51841
  if (!this.pendo._.isEmpty(jwtOptions)) {
51884
51842
  this.pendo._.extend(params, jwtOptions);
51885
51843
  }
51886
51844
  params.jzb = jzb;
51887
- const queryString = this.pendo._.map(params, (value, key) => `${key}=${value}`).join('&');
51888
- return `${baseUrl}${baseUrl.indexOf('?') !== -1 ? '&' : '?'}${queryString}`;
51889
- }
51890
- 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) {
51891
51849
  options.method = 'GET';
51892
51850
  if (this.pluginAPI.transmit.fetchKeepalive.supported()) {
51893
51851
  return this.pluginAPI.transmit.fetchKeepalive(url, options);
@@ -51895,86 +51853,90 @@ class DevlogTransport {
51895
51853
  else {
51896
51854
  return this.pendo.ajax.get(url);
51897
51855
  }
51898
- }
51899
- sendRequestWithGet({ url, jzb }) {
51900
- const getUrl = this.buildGetUrl(url, jzb);
51856
+ };
51857
+ DevlogTransport.prototype.sendRequestWithGet = function (_a) {
51858
+ var url = _a.url, jzb = _a.jzb;
51859
+ var getUrl = this.buildGetUrl(url, jzb);
51901
51860
  return this.get(getUrl, {
51902
51861
  headers: {
51903
51862
  'Content-Type': 'application/octet-stream'
51904
51863
  }
51905
51864
  });
51906
- }
51907
- post(url, options) {
51865
+ };
51866
+ DevlogTransport.prototype.post = function (url, options) {
51908
51867
  options.method = 'POST';
51909
51868
  if (options.keepalive && this.pluginAPI.transmit.fetchKeepalive.supported()) {
51910
51869
  return this.pluginAPI.transmit.fetchKeepalive(url, options);
51911
51870
  }
51912
51871
  else if (options.keepalive && this.pluginAPI.transmit.sendBeacon.supported()) {
51913
- const result = this.pluginAPI.transmit.sendBeacon(url, new Blob([options.body]));
51872
+ var result = this.pluginAPI.transmit.sendBeacon(url, new Blob([options.body]));
51914
51873
  return result ? Promise$2.resolve() : Promise$2.reject(new Error('sendBeacon failed to send devlog data'));
51915
51874
  }
51916
51875
  else {
51917
51876
  return this.pendo.ajax.post(url, options.body);
51918
51877
  }
51919
- }
51920
- sendRequestWithPost({ url, jzb }, isUnload) {
51921
- const jwtOptions = this.pluginAPI.agent.getJwtInfoCopy();
51922
- const bodyPayload = {
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 = {
51923
51883
  events: jzb,
51924
51884
  browser_time: this.pluginAPI.util.getNow()
51925
51885
  };
51926
51886
  if (this.pluginAPI.agent.treatAsAdoptPartner()) {
51927
51887
  this.pluginAPI.agent.addAccountIdParams(bodyPayload, this.pendo.get_account_id(), this.pluginAPI.ConfigReader.get('oemAccountId'));
51928
51888
  }
51929
- const body = JSON.stringify(this.pendo._.extend(bodyPayload, jwtOptions));
51889
+ var body = JSON.stringify(this.pendo._.extend(bodyPayload, jwtOptions));
51930
51890
  return this.post(url, {
51931
- body,
51891
+ body: body,
51932
51892
  headers: {
51933
51893
  'Content-Type': 'application/json'
51934
51894
  },
51935
51895
  keepalive: isUnload
51936
51896
  });
51937
- }
51938
- sendRequest({ url, jzb }, isUnload) {
51939
- const compressedLength = jzb.length;
51897
+ };
51898
+ DevlogTransport.prototype.sendRequest = function (_a, isUnload) {
51899
+ var url = _a.url, jzb = _a.jzb;
51900
+ var compressedLength = jzb.length;
51940
51901
  if (compressedLength <= this.pluginAPI.constants.ENCODED_EVENT_MAX_LENGTH && !this.pluginAPI.ConfigReader.get('sendEventsWithPostOnly')) {
51941
- return this.sendRequestWithGet({ url, jzb });
51902
+ return this.sendRequestWithGet({ url: url, jzb: jzb });
51942
51903
  }
51943
- return this.sendRequestWithPost({ url, jzb }, isUnload);
51944
- }
51945
- }
51904
+ return this.sendRequestWithPost({ url: url, jzb: jzb }, isUnload);
51905
+ };
51906
+ return DevlogTransport;
51907
+ }());
51946
51908
 
51947
51909
  function ConsoleCapture() {
51948
- let pluginAPI;
51949
- let _;
51950
- let globalPendo;
51951
- let buffer;
51952
- let sendQueue;
51953
- let sendInterval;
51954
- let transport;
51955
- let isPtmPaused;
51956
- let isCapturingConsoleLogs = false;
51957
- const CAPTURE_CONSOLE_CONFIG = 'captureConsoleLogs';
51958
- const CONSOLE_METHODS = ['log', 'warn', 'error', 'info'];
51959
- const DEV_LOG_SUB_TYPE = 'console';
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';
51960
51922
  // deduplicate logs
51961
- let lastLogKey = '';
51923
+ var lastLogKey = '';
51962
51924
  return {
51963
51925
  name: 'ConsoleCapture',
51964
- initialize,
51965
- teardown,
51966
- addIntercepts,
51967
- createConsoleEvent,
51968
- captureStackTrace,
51969
- send,
51970
- setCaptureState,
51971
- recordingStarted,
51972
- recordingStopped,
51973
- onAppHidden,
51974
- onAppUnloaded,
51975
- onPtmPaused,
51976
- onPtmUnpaused,
51977
- 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,
51978
51940
  get isCapturingConsoleLogs() {
51979
51941
  return isCapturingConsoleLogs;
51980
51942
  },
@@ -51991,16 +51953,16 @@ function ConsoleCapture() {
51991
51953
  function initialize(pendo, PluginAPI) {
51992
51954
  _ = pendo._;
51993
51955
  pluginAPI = PluginAPI;
51994
- const { ConfigReader } = pluginAPI;
51956
+ var ConfigReader = pluginAPI.ConfigReader;
51995
51957
  ConfigReader.addOption(CAPTURE_CONSOLE_CONFIG, [ConfigReader.sources.PENDO_CONFIG_SRC], false);
51996
- const captureConsoleEnabled = ConfigReader.get(CAPTURE_CONSOLE_CONFIG);
51958
+ var captureConsoleEnabled = ConfigReader.get(CAPTURE_CONSOLE_CONFIG);
51997
51959
  if (!captureConsoleEnabled)
51998
51960
  return;
51999
51961
  globalPendo = pendo;
52000
51962
  buffer = new DevlogBuffer(pendo, pluginAPI);
52001
51963
  transport = new DevlogTransport(pendo, pluginAPI);
52002
51964
  sendQueue = new pluginAPI.SendQueue(transport.sendRequest.bind(transport));
52003
- sendInterval = setInterval(() => {
51965
+ sendInterval = setInterval(function () {
52004
51966
  if (!sendQueue.failed()) {
52005
51967
  send();
52006
51968
  }
@@ -52026,17 +51988,19 @@ function ConsoleCapture() {
52026
51988
  function onPtmUnpaused() {
52027
51989
  isPtmPaused = false;
52028
51990
  if (!buffer.isEmpty()) {
52029
- for (const event of buffer.events) {
52030
- pluginAPI.Events.eventCaptured.trigger(event);
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);
52031
51994
  }
52032
51995
  send();
52033
51996
  }
52034
51997
  }
52035
- function setCaptureState({ shouldCapture = false, reason = '' } = {}) {
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;
52036
52000
  if (shouldCapture === isCapturingConsoleLogs)
52037
52001
  return;
52038
52002
  isCapturingConsoleLogs = shouldCapture;
52039
- pluginAPI.log.info(`[ConsoleCapture] Console log capture ${shouldCapture ? 'started' : 'stopped'}${reason ? `: ${reason}` : ''}`);
52003
+ pluginAPI.log.info("[ConsoleCapture] Console log capture ".concat(shouldCapture ? 'started' : 'stopped').concat(reason ? ": ".concat(reason) : ''));
52040
52004
  }
52041
52005
  function recordingStarted() {
52042
52006
  setCaptureState({ shouldCapture: true, reason: 'recording started' });
@@ -52056,12 +52020,12 @@ function ConsoleCapture() {
52056
52020
  }
52057
52021
  function addIntercepts() {
52058
52022
  _.each(CONSOLE_METHODS, function (methodName) {
52059
- const originalMethod = console[methodName];
52023
+ var originalMethod = console[methodName];
52060
52024
  if (!originalMethod)
52061
52025
  return;
52062
52026
  console[methodName] = _.wrap(originalMethod, function (originalFn) {
52063
52027
  // slice 1 to omit originalFn
52064
- const args = _.toArray(arguments).slice(1);
52028
+ var args = _.toArray(arguments).slice(1);
52065
52029
  originalFn.apply(console, args);
52066
52030
  createConsoleEvent(args, methodName);
52067
52031
  });
@@ -52073,10 +52037,10 @@ function ConsoleCapture() {
52073
52037
  function securityPolicyViolationFn(evt) {
52074
52038
  if (!evt || typeof evt !== 'object')
52075
52039
  return;
52076
- const { blockedURI, violatedDirective, effectiveDirective, disposition, originalPolicy } = evt;
52077
- const directive = violatedDirective || effectiveDirective;
52078
- const isReportOnly = disposition === 'report';
52079
- const message = createCspViolationMessage(blockedURI, directive, isReportOnly, originalPolicy);
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);
52080
52044
  if (isReportOnly) {
52081
52045
  createConsoleEvent([message], 'warn', { skipStackTrace: true, skipScrubPII: true });
52082
52046
  }
@@ -52084,12 +52048,13 @@ function ConsoleCapture() {
52084
52048
  createConsoleEvent([message], 'error', { skipStackTrace: true, skipScrubPII: true });
52085
52049
  }
52086
52050
  }
52087
- function createConsoleEvent(args, methodName, { skipStackTrace = false, skipScrubPII = false } = {}) {
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;
52088
52053
  if (!isCapturingConsoleLogs || !args || args.length === 0 || !_.contains(CONSOLE_METHODS, methodName))
52089
52054
  return;
52090
52055
  // stringify args
52091
- let message = _.compact(_.map(args, arg => {
52092
- let stringifiedArg;
52056
+ var message = _.compact(_.map(args, function (arg) {
52057
+ var stringifiedArg;
52093
52058
  try {
52094
52059
  stringifiedArg = stringify(arg);
52095
52060
  }
@@ -52101,22 +52066,22 @@ function ConsoleCapture() {
52101
52066
  if (!message)
52102
52067
  return;
52103
52068
  // capture stack trace
52104
- let stackTrace = '';
52069
+ var stackTrace = '';
52105
52070
  if (!skipStackTrace) {
52106
- const maxStackFrames = methodName === 'error' ? 4 : 1;
52071
+ var maxStackFrames = methodName === 'error' ? 4 : 1;
52107
52072
  stackTrace = captureStackTrace(maxStackFrames);
52108
52073
  }
52109
52074
  // truncate message and stack trace
52110
52075
  message = truncate(message);
52111
52076
  stackTrace = truncate(stackTrace);
52112
52077
  // de-duplicate log
52113
- const logKey = generateLogKey(methodName, message, stackTrace);
52078
+ var logKey = generateLogKey(methodName, message, stackTrace);
52114
52079
  if (isExistingDuplicateLog(logKey)) {
52115
52080
  buffer.lastEvent.devLogCount++;
52116
52081
  return;
52117
52082
  }
52118
- const devLogEnvelope = createDevLogEnvelope(pluginAPI, globalPendo);
52119
- const consoleEvent = Object.assign(Object.assign({}, devLogEnvelope), { subType: DEV_LOG_SUB_TYPE, devLogLevel: methodName === 'log' ? 'info' : methodName, devLogMessage: skipScrubPII ? message : scrubPII({ string: message, _ }), devLogTrace: stackTrace, devLogCount: 1 });
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 });
52120
52085
  if (!buffer.hasTokenAvailable())
52121
52086
  return consoleEvent;
52122
52087
  if (!isPtmPaused) {
@@ -52128,8 +52093,8 @@ function ConsoleCapture() {
52128
52093
  }
52129
52094
  function captureStackTrace(maxStackFrames) {
52130
52095
  try {
52131
- const stackFrames = ErrorStackParser.parse(new Error(), maxStackFrames);
52132
- return _.map(stackFrames, frame => frame.toString()).join('\n');
52096
+ var stackFrames = ErrorStackParser.parse(new Error(), maxStackFrames);
52097
+ return _.map(stackFrames, function (frame) { return frame.toString(); }).join('\n');
52133
52098
  }
52134
52099
  catch (error) {
52135
52100
  return '';
@@ -52141,21 +52106,22 @@ function ConsoleCapture() {
52141
52106
  function updateLastLog(logKey) {
52142
52107
  lastLogKey = logKey;
52143
52108
  }
52144
- function send({ unload = false, hidden = false } = {}) {
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;
52145
52111
  if (!buffer || buffer.isEmpty())
52146
52112
  return;
52147
52113
  if (!globalPendo.isSendingEvents()) {
52148
52114
  buffer.clear();
52149
52115
  return;
52150
52116
  }
52151
- const payloads = buffer.pack();
52117
+ var payloads = buffer.pack();
52152
52118
  if (!payloads || payloads.length === 0)
52153
52119
  return;
52154
52120
  if (unload || hidden) {
52155
52121
  sendQueue.drain(payloads, unload);
52156
52122
  }
52157
52123
  else {
52158
- sendQueue.push(...payloads);
52124
+ sendQueue.push.apply(sendQueue, payloads);
52159
52125
  }
52160
52126
  }
52161
52127
  function teardown() {
@@ -52179,7 +52145,7 @@ function ConsoleCapture() {
52179
52145
  _.each(CONSOLE_METHODS, function (methodName) {
52180
52146
  if (!console[methodName])
52181
52147
  return _.noop;
52182
- const unwrap = console[methodName]._pendoUnwrap;
52148
+ var unwrap = console[methodName]._pendoUnwrap;
52183
52149
  if (_.isFunction(unwrap)) {
52184
52150
  unwrap();
52185
52151
  }
@@ -52970,21 +52936,21 @@ const PredictGuides = () => {
52970
52936
  };
52971
52937
  };
52972
52938
 
52973
- const ASSISTANT_MESSAGE = 'assistantMessage';
52974
- const CONVERSATION_ID_URL_PATTERN = 'conversationIdUrlPattern';
52975
- const MESSAGE_ID_ATTR = 'messageIdAttr';
52976
- const MESSAGE_ID_PATTERN = 'messageIdPattern';
52977
- const MODEL_USED_ATTR = 'modelUsedAttr';
52978
- const REACTION_ACTIVE = 'reactionActive';
52979
- const STREAMING_ACTIVE = 'streamingActive';
52980
- const STREAMING_ACTIVE_ATTR = 'streamingActiveAttr';
52981
- const THUMB_DOWN = 'thumbDown';
52982
- const THUMB_UP = 'thumbUp';
52983
- const TURN_CONTAINER = 'turnContainer';
52984
- const USER_MESSAGE = 'userMessage';
52985
- const CUSTOM_AGENT_ID_URL_PATTERN = 'customAgentIdUrlPattern';
52986
- const CUSTOM_AGENT_NAME = 'customAgentName';
52987
- const REQUIRED_SELECTORS = [
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 = [
52988
52954
  ASSISTANT_MESSAGE,
52989
52955
  CONVERSATION_ID_URL_PATTERN,
52990
52956
  MESSAGE_ID_ATTR,
@@ -52992,38 +52958,13 @@ const REQUIRED_SELECTORS = [
52992
52958
  TURN_CONTAINER,
52993
52959
  USER_MESSAGE
52994
52960
  ];
52995
- const SUPPORTED_PRESETS = ['chatgpt-full', 'gemini-full'];
52996
- const STREAMING_END_SETTLE_MS = 500;
52997
- const SUBMISSION_START_RETRY_MS = 1000;
52998
- const SUBMISSION_START_MAX_ATTEMPTS = 4;
52999
- class DOMConversation {
53000
- // Returns the list of required selector types that are missing or empty
53001
- // in the given cssSelectors config. An empty array means the config is
53002
- // valid for instantiation.
53003
- static validateConfig(cssSelectors) {
53004
- if (!Array.isArray(cssSelectors)) {
53005
- return REQUIRED_SELECTORS.slice();
53006
- }
53007
- const present = new Set();
53008
- for (const cfg of cssSelectors) {
53009
- if (!cfg || !cfg.type || !cfg.cssSelector)
53010
- continue;
53011
- if (cfg.type === CONVERSATION_ID_URL_PATTERN) {
53012
- try {
53013
- RegExp(cfg.cssSelector);
53014
- }
53015
- catch (e) {
53016
- continue;
53017
- }
53018
- }
53019
- present.add(cfg.type);
53020
- }
53021
- return REQUIRED_SELECTORS.filter((r) => !present.has(r));
53022
- }
53023
- static supportedPreset(preset) {
53024
- return SUPPORTED_PRESETS.indexOf(preset) !== -1;
53025
- }
53026
- 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;
53027
52968
  this.selectors = {};
53028
52969
  this.listeners = [];
53029
52970
  this.isActive = true;
@@ -53042,72 +52983,99 @@ class DOMConversation {
53042
52983
  this.Sizzle = pendo.Sizzle;
53043
52984
  this.id = id;
53044
52985
  if (!this._.isArray(cssSelectors)) {
53045
- this.api.log.error(`cssSelectors must be an array, received: ${typeof cssSelectors}`);
52986
+ this.api.log.error("cssSelectors must be an array, received: ".concat(typeof cssSelectors));
53046
52987
  cssSelectors = [];
53047
52988
  }
53048
- this._.each(cssSelectors, (cfg) => {
52989
+ this._.each(cssSelectors, function (cfg) {
53049
52990
  if (cfg && cfg.type) {
53050
- this.selectors[cfg.type] = cfg.cssSelector;
52991
+ _this.selectors[cfg.type] = cfg.cssSelector;
53051
52992
  }
53052
52993
  });
53053
52994
  this.conversationIdRegex = new RegExp(this.selectors[CONVERSATION_ID_URL_PATTERN]);
53054
- const customAgentIdUrlPattern = this.selectors[CUSTOM_AGENT_ID_URL_PATTERN];
52995
+ var customAgentIdUrlPattern = this.selectors[CUSTOM_AGENT_ID_URL_PATTERN];
53055
52996
  if (customAgentIdUrlPattern) { // this is optional
53056
52997
  try {
53057
52998
  this.customAgentIdRegex = new RegExp(customAgentIdUrlPattern);
53058
52999
  }
53059
53000
  catch (error) {
53060
- this.api.log.error(`bad customAgentIdUrlPattern ${customAgentIdUrlPattern}`, { error });
53001
+ this.api.log.error("bad customAgentIdUrlPattern ".concat(customAgentIdUrlPattern), { error: error });
53061
53002
  }
53062
53003
  }
53063
- const messageIdPattern = this.selectors[MESSAGE_ID_PATTERN];
53004
+ var messageIdPattern = this.selectors[MESSAGE_ID_PATTERN];
53064
53005
  if (messageIdPattern) { // optional: gates the request node until its id is fully rendered
53065
53006
  try {
53066
53007
  this.messageIdRegex = new RegExp(messageIdPattern);
53067
53008
  }
53068
53009
  catch (error) {
53069
- this.api.log.error(`bad messageIdPattern ${messageIdPattern}`, { error });
53010
+ this.api.log.error("bad messageIdPattern ".concat(messageIdPattern), { error: error });
53070
53011
  }
53071
53012
  }
53072
53013
  this.root = document.body;
53073
53014
  this.setupReactionListener();
53074
53015
  this.setupStreamingObserver();
53075
53016
  }
53076
- setupReactionListener() {
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 () {
53077
53045
  if (!this.findSelector(THUMB_UP) && !this.findSelector(THUMB_DOWN))
53078
53046
  return;
53079
53047
  this.reactionClickHandler = this.handleReactionClick.bind(this);
53080
53048
  this.root.addEventListener('click', this.reactionClickHandler, true);
53081
- }
53082
- handleReactionClick(evt) {
53083
- const target = evt.target;
53049
+ };
53050
+ DOMConversation.prototype.handleReactionClick = function (evt) {
53051
+ var target = evt.target;
53084
53052
  if (!target || target.nodeType !== 1)
53085
53053
  return;
53086
- const upSelector = this.findSelector(THUMB_UP);
53087
- const downSelector = this.findSelector(THUMB_DOWN);
53088
- const thumb = this.dom(target).closest(`${upSelector}, ${downSelector}`);
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));
53089
53057
  if (!thumb.length)
53090
53058
  return;
53091
- const isUp = this.Sizzle.matchesSelector(thumb[0], upSelector);
53092
- const activeSelector = this.findSelector(REACTION_ACTIVE);
53093
- const wasPressed = activeSelector && this.Sizzle.matchesSelector(thumb[0], activeSelector);
53094
- const direction = isUp ? 'positive' : 'negative';
53095
- const content = wasPressed ? 'unreact' : direction;
53096
- const assistantNode = thumb.closest(this.findSelector(TURN_CONTAINER))
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))
53097
53065
  .find(this.findSelector(ASSISTANT_MESSAGE));
53098
53066
  this.emit('user_reaction', {
53099
53067
  agentId: this.id,
53100
53068
  messageId: this.getMessageId(assistantNode),
53101
- content
53069
+ content: content
53102
53070
  });
53103
- }
53071
+ };
53104
53072
  // observe the streaming indicator
53105
- setupStreamingObserver() {
53073
+ DOMConversation.prototype.setupStreamingObserver = function () {
53106
53074
  this.wasStreaming = this.select(STREAMING_ACTIVE).length > 0;
53107
53075
  this.stopStreamingEndTimer();
53108
- const MutationObserver = getZoneSafeMethod(this._, 'MutationObserver');
53109
- const observer = new MutationObserver(this.handleMutation.bind(this));
53110
- const attrName = this.findSelector(STREAMING_ACTIVE_ATTR);
53076
+ var MutationObserver = getZoneSafeMethod(this._, 'MutationObserver');
53077
+ var observer = new MutationObserver(this.handleMutation.bind(this));
53078
+ var attrName = this.findSelector(STREAMING_ACTIVE_ATTR);
53111
53079
  observer.observe(this.root, {
53112
53080
  childList: true,
53113
53081
  subtree: true,
@@ -53115,7 +53083,7 @@ class DOMConversation {
53115
53083
  attributeFilter: attrName ? [attrName] : undefined
53116
53084
  });
53117
53085
  this.observers.push(observer);
53118
- }
53086
+ };
53119
53087
  // look for changes in the state of the streaming indicator.
53120
53088
  // streaming started -> a prompt has been submitted
53121
53089
  // streaming ended -> got a response
@@ -53124,8 +53092,8 @@ class DOMConversation {
53124
53092
  // we don't send the agent_response immediately when the streaming indicator is cleared
53125
53093
  // because it clears slightly before the final text chunk is committed to the DOM so the
53126
53094
  // end-handling is deferred by a short settle window
53127
- handleMutation() {
53128
- const isStreaming = this.select(STREAMING_ACTIVE).length > 0;
53095
+ DOMConversation.prototype.handleMutation = function () {
53096
+ var isStreaming = this.select(STREAMING_ACTIVE).length > 0;
53129
53097
  if (isStreaming === this.wasStreaming)
53130
53098
  return;
53131
53099
  if (isStreaming) { // started streaming
@@ -53143,8 +53111,9 @@ class DOMConversation {
53143
53111
  this.startStreamingEndTimer();
53144
53112
  }
53145
53113
  this.wasStreaming = isStreaming;
53146
- }
53147
- onSubmissionStart(attempt = 1) {
53114
+ };
53115
+ DOMConversation.prototype.onSubmissionStart = function (attempt) {
53116
+ if (attempt === void 0) { attempt = 1; }
53148
53117
  this.requestNode = this.findLastRequestNode();
53149
53118
  if (this.requestNode) {
53150
53119
  this.handleUserMessage(this.requestNode);
@@ -53155,10 +53124,10 @@ class DOMConversation {
53155
53124
  if (attempt < SUBMISSION_START_MAX_ATTEMPTS) {
53156
53125
  this.startSubmissionStartRetryTimer(attempt + 1);
53157
53126
  }
53158
- }
53159
- onSubmissionEnd() {
53127
+ };
53128
+ DOMConversation.prototype.onSubmissionEnd = function () {
53160
53129
  this.stopSubmissionStartRetryTimer();
53161
- let requestNode = this.requestNode;
53130
+ var requestNode = this.requestNode;
53162
53131
  this.requestNode = null;
53163
53132
  if (!requestNode) {
53164
53133
  // onSubmissionStart didn't send, send it now
@@ -53167,42 +53136,42 @@ class DOMConversation {
53167
53136
  return;
53168
53137
  this.handleUserMessage(requestNode);
53169
53138
  }
53170
- const requestEl = requestNode[0];
53139
+ var requestEl = requestNode[0];
53171
53140
  if (!requestEl)
53172
53141
  return;
53173
53142
  // the request is the latest user message, so any assistant message that
53174
53143
  // follows it in the DOM is a response to it. document order is already
53175
53144
  // chronological, so we emit as we go
53176
- const assistantNodes = this.select(ASSISTANT_MESSAGE);
53177
- for (let i = 0; i < assistantNodes.length; i++) {
53178
- const el = assistantNodes[i];
53145
+ var assistantNodes = this.select(ASSISTANT_MESSAGE);
53146
+ for (var i = 0; i < assistantNodes.length; i++) {
53147
+ var el = assistantNodes[i];
53179
53148
  if (requestEl.compareDocumentPosition(el) & Node.DOCUMENT_POSITION_FOLLOWING) {
53180
53149
  this.handleAssistantMessage(this.dom(el));
53181
53150
  }
53182
53151
  }
53183
- }
53184
- extractContent(node) {
53152
+ };
53153
+ DOMConversation.prototype.extractContent = function (node) {
53185
53154
  return { content: node.text().trim() };
53186
- }
53187
- getMessageId(node) {
53155
+ };
53156
+ DOMConversation.prototype.getMessageId = function (node) {
53188
53157
  return node.attr(this.findSelector(MESSAGE_ID_ATTR));
53189
- }
53190
- handleUserMessage(node) {
53191
- this.emit('prompt', Object.assign({ agentId: this.id, messageId: this.getMessageId(node) }, this.extractContent(node)));
53192
- }
53193
- handleAssistantMessage(node) {
53194
- const modelUsedAttr = this.findSelector(MODEL_USED_ATTR);
53195
- const modelUsed = modelUsedAttr && node.attr(modelUsedAttr);
53196
- this.emit('agent_response', Object.assign({ agentId: this.id, messageId: this.getMessageId(node), agentModelsUsed: modelUsed ? [modelUsed] : [] }, this.extractContent(node)));
53197
- }
53198
- 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 () {
53199
53168
  if (!this.getConversationId())
53200
53169
  return null;
53201
- const node = this._.last(this.select(USER_MESSAGE));
53170
+ var node = this._.last(this.select(USER_MESSAGE));
53202
53171
  if (!node)
53203
53172
  return null;
53204
- const $node = this.dom(node);
53205
- const messageId = this.getMessageId($node);
53173
+ var $node = this.dom(node);
53174
+ var messageId = this.getMessageId($node);
53206
53175
  if (!messageId)
53207
53176
  return null;
53208
53177
  // the node may still be rendering (e.g. a framework interpolating an
@@ -53214,87 +53183,89 @@ class DOMConversation {
53214
53183
  return null;
53215
53184
  this.lastReturnedMessageId = messageId;
53216
53185
  return $node;
53217
- }
53218
- findSelector(type) {
53186
+ };
53187
+ DOMConversation.prototype.findSelector = function (type) {
53219
53188
  return this.selectors[type];
53220
- }
53221
- select(type) {
53189
+ };
53190
+ DOMConversation.prototype.select = function (type) {
53222
53191
  return this.dom(this.findSelector(type), this.root);
53223
- }
53224
- getConversationId() {
53225
- const m = location.href.match(this.conversationIdRegex);
53192
+ };
53193
+ DOMConversation.prototype.getConversationId = function () {
53194
+ var m = location.href.match(this.conversationIdRegex);
53226
53195
  if (!m)
53227
53196
  return null;
53228
53197
  return m[1] !== undefined ? m[1] : m[0];
53229
- }
53230
- getCustomAgentId() {
53198
+ };
53199
+ DOMConversation.prototype.getCustomAgentId = function () {
53231
53200
  if (!this.customAgentIdRegex)
53232
53201
  return undefined;
53233
- const m = location.href.match(this.customAgentIdRegex);
53202
+ var m = location.href.match(this.customAgentIdRegex);
53234
53203
  if (!m)
53235
53204
  return undefined;
53236
53205
  return m[1] !== undefined ? m[1] : m[0];
53237
- }
53238
- getCustomAgentName() {
53206
+ };
53207
+ DOMConversation.prototype.getCustomAgentName = function () {
53239
53208
  if (!this.findSelector(CUSTOM_AGENT_NAME))
53240
53209
  return '';
53241
- const node = this.select(CUSTOM_AGENT_NAME);
53210
+ var node = this.select(CUSTOM_AGENT_NAME);
53242
53211
  if (!node.length)
53243
53212
  return '';
53244
53213
  return node.text().trim();
53245
- }
53246
- addCustomAgentInfo(eventPayload) {
53247
- const customAgentId = this.getCustomAgentId();
53214
+ };
53215
+ DOMConversation.prototype.addCustomAgentInfo = function (eventPayload) {
53216
+ var customAgentId = this.getCustomAgentId();
53248
53217
  if (!customAgentId)
53249
53218
  return;
53250
53219
  eventPayload.customAgentId = customAgentId;
53251
- const customAgentName = this.getCustomAgentName();
53220
+ var customAgentName = this.getCustomAgentName();
53252
53221
  if (customAgentName) {
53253
53222
  eventPayload.customAgentName = customAgentName;
53254
53223
  }
53255
- }
53256
- onSubmit(callback) {
53224
+ };
53225
+ DOMConversation.prototype.onSubmit = function (callback) {
53257
53226
  this.listeners.push(callback);
53258
- }
53259
- emit(eventType, eventPayload) {
53227
+ };
53228
+ DOMConversation.prototype.emit = function (eventType, eventPayload) {
53260
53229
  eventPayload.conversationId = this.getConversationId();
53261
53230
  this.addCustomAgentInfo(eventPayload);
53262
- this._.each(this.listeners, (cb) => cb(eventType, eventPayload));
53263
- }
53264
- startStreamingEndTimer() {
53231
+ this._.each(this.listeners, function (cb) { return cb(eventType, eventPayload); });
53232
+ };
53233
+ DOMConversation.prototype.startStreamingEndTimer = function () {
53234
+ var _this = this;
53265
53235
  this.stopStreamingEndTimer();
53266
- this.streamingEndTimer = setTimeout$1(() => {
53267
- this.streamingEndTimer = null;
53268
- this.onSubmissionEnd();
53236
+ this.streamingEndTimer = setTimeout$1(function () {
53237
+ _this.streamingEndTimer = null;
53238
+ _this.onSubmissionEnd();
53269
53239
  }, STREAMING_END_SETTLE_MS);
53270
- }
53271
- stopStreamingEndTimer() {
53240
+ };
53241
+ DOMConversation.prototype.stopStreamingEndTimer = function () {
53272
53242
  if (!this.streamingEndTimer)
53273
53243
  return;
53274
53244
  clearTimeout(this.streamingEndTimer);
53275
53245
  this.streamingEndTimer = null;
53276
- }
53277
- startSubmissionStartRetryTimer(attempt) {
53246
+ };
53247
+ DOMConversation.prototype.startSubmissionStartRetryTimer = function (attempt) {
53248
+ var _this = this;
53278
53249
  this.stopSubmissionStartRetryTimer();
53279
- this.submissionStartRetryTimer = setTimeout$1(() => {
53280
- this.submissionStartRetryTimer = null;
53281
- this.onSubmissionStart(attempt);
53250
+ this.submissionStartRetryTimer = setTimeout$1(function () {
53251
+ _this.submissionStartRetryTimer = null;
53252
+ _this.onSubmissionStart(attempt);
53282
53253
  }, SUBMISSION_START_RETRY_MS);
53283
- }
53284
- stopSubmissionStartRetryTimer() {
53254
+ };
53255
+ DOMConversation.prototype.stopSubmissionStartRetryTimer = function () {
53285
53256
  if (!this.submissionStartRetryTimer)
53286
53257
  return;
53287
53258
  clearTimeout(this.submissionStartRetryTimer);
53288
53259
  this.submissionStartRetryTimer = null;
53289
- }
53290
- suspend() {
53260
+ };
53261
+ DOMConversation.prototype.suspend = function () {
53291
53262
  this.isActive = false;
53292
- }
53293
- resume() {
53263
+ };
53264
+ DOMConversation.prototype.resume = function () {
53294
53265
  this.isActive = true;
53295
- }
53296
- teardown() {
53297
- this._.each(this.observers, (o) => o && o.disconnect && o.disconnect());
53266
+ };
53267
+ DOMConversation.prototype.teardown = function () {
53268
+ this._.each(this.observers, function (o) { return o && o.disconnect && o.disconnect(); });
53298
53269
  this.observers = [];
53299
53270
  if (this.reactionClickHandler && this.root) {
53300
53271
  this.root.removeEventListener('click', this.reactionClickHandler, true);
@@ -53303,8 +53274,9 @@ class DOMConversation {
53303
53274
  this.stopStreamingEndTimer();
53304
53275
  this.stopSubmissionStartRetryTimer();
53305
53276
  this.listeners = [];
53306
- }
53307
- }
53277
+ };
53278
+ return DOMConversation;
53279
+ }());
53308
53280
 
53309
53281
  /*
53310
53282
  * Conversation Analytics Plugin
@@ -53314,21 +53286,21 @@ class DOMConversation {
53314
53286
  * The sibling built-in PromptAnalytics plugin owns the network + DOMPrompt AI-agents
53315
53287
  */
53316
53288
  function ConversationAnalytics() {
53317
- let pendo;
53318
- let api;
53319
- let _;
53320
- let log;
53321
- let conversations = [];
53322
- let agentsCache = new Map();
53323
- const CONFIG_NAME = 'aiAgents';
53289
+ var pendo;
53290
+ var api;
53291
+ var _;
53292
+ var log;
53293
+ var conversations = [];
53294
+ var agentsCache = new Map();
53295
+ var CONFIG_NAME = 'aiAgents';
53324
53296
  return {
53325
53297
  name: 'ConversationAnalytics',
53326
- initialize,
53327
- teardown,
53328
- onConfigLoaded,
53329
- observeConversation,
53330
- sendConversationEvent,
53331
- reEvaluatePageRules
53298
+ initialize: initialize,
53299
+ teardown: teardown,
53300
+ onConfigLoaded: onConfigLoaded,
53301
+ observeConversation: observeConversation,
53302
+ sendConversationEvent: sendConversationEvent,
53303
+ reEvaluatePageRules: reEvaluatePageRules
53332
53304
  };
53333
53305
  function initialize(pendoGlobal, PluginAPI) {
53334
53306
  var _a;
@@ -53336,7 +53308,7 @@ function ConversationAnalytics() {
53336
53308
  api = PluginAPI;
53337
53309
  _ = pendo._;
53338
53310
  log = api.log;
53339
- const { ConfigReader } = api;
53311
+ var ConfigReader = api.ConfigReader;
53340
53312
  ConfigReader.addOption(CONFIG_NAME, [
53341
53313
  ConfigReader.sources.PENDO_CONFIG_SRC,
53342
53314
  ConfigReader.sources.SNIPPET_SRC
@@ -53349,12 +53321,13 @@ function ConversationAnalytics() {
53349
53321
  // Test if the current URL matches the page rule for an agent. The raw matcher lives in core
53350
53322
  // and is reached through PluginAPI (independent plugins cannot import it directly); it falls
53351
53323
  // back to the normalized URL internally when no URL is passed.
53352
- function testPageRule(pageRule, agentId = 'unknown') {
53324
+ function testPageRule(pageRule, agentId) {
53325
+ if (agentId === void 0) { agentId = 'unknown'; }
53353
53326
  // Convert //*/agent pattern to work with full URLs
53354
- let fixedPageRule = pageRule;
53327
+ var fixedPageRule = pageRule;
53355
53328
  if (Array.isArray(pageRule)) {
53356
- const validRules = _.filter(pageRule, rule => rule && rule.trim() !== '');
53357
- fixedPageRule = _.map(validRules, rule => rule.startsWith('//*/') ? rule.substring(1) : 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; });
53358
53331
  }
53359
53332
  else if (typeof pageRule === 'string' && pageRule.startsWith('//*/')) {
53360
53333
  fixedPageRule = pageRule.substring(1);
@@ -53366,9 +53339,9 @@ function ConversationAnalytics() {
53366
53339
  });
53367
53340
  }
53368
53341
  function reEvaluatePageRules() {
53369
- _.each(conversations, conversation => {
53370
- const agent = findAgentById(conversation.id);
53371
- const shouldBeActive = agent && testPageRule(agent.pageRule, agent.id);
53342
+ _.each(conversations, function (conversation) {
53343
+ var agent = findAgentById(conversation.id);
53344
+ var shouldBeActive = agent && testPageRule(agent.pageRule, agent.id);
53372
53345
  if (shouldBeActive) {
53373
53346
  conversation.resume();
53374
53347
  }
@@ -53376,14 +53349,14 @@ function ConversationAnalytics() {
53376
53349
  conversation.suspend();
53377
53350
  }
53378
53351
  });
53379
- const currentlyActiveIds = _.map(_.filter(conversations, conversation => conversation.isActive), conversation => conversation.id);
53380
- const allAgents = api.ConfigReader.get(CONFIG_NAME) || [];
53381
- _.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) {
53382
53355
  if (!isConversationAgent(aiAgent)) {
53383
53356
  return;
53384
53357
  }
53385
- const isCurrentlyActive = _.contains(currentlyActiveIds, aiAgent.id);
53386
- const shouldBeActive = testPageRule(aiAgent.pageRule, aiAgent.id);
53358
+ var isCurrentlyActive = _.contains(currentlyActiveIds, aiAgent.id);
53359
+ var shouldBeActive = testPageRule(aiAgent.pageRule, aiAgent.id);
53387
53360
  if (shouldBeActive && !isCurrentlyActive) {
53388
53361
  observeConversation(aiAgent);
53389
53362
  }
@@ -53397,12 +53370,13 @@ function ConversationAnalytics() {
53397
53370
  function isConversationAgent(agent) {
53398
53371
  return DOMConversation.supportedPreset(agent.preset);
53399
53372
  }
53400
- function onConfigLoaded(aiAgents = []) {
53373
+ function onConfigLoaded(aiAgents) {
53374
+ if (aiAgents === void 0) { aiAgents = []; }
53401
53375
  if (!aiAgents || !_.isArray(aiAgents) || aiAgents.length === 0) {
53402
53376
  return;
53403
53377
  }
53404
53378
  agentsCache.clear();
53405
- _.each(aiAgents, aiAgent => {
53379
+ _.each(aiAgents, function (aiAgent) {
53406
53380
  if (!isConversationAgent(aiAgent)) {
53407
53381
  return;
53408
53382
  }
@@ -53413,24 +53387,24 @@ function ConversationAnalytics() {
53413
53387
  });
53414
53388
  }
53415
53389
  function observeConversation(config) {
53416
- const { id, cssSelectors } = config;
53390
+ var id = config.id, cssSelectors = config.cssSelectors;
53417
53391
  // Check if this agent is already being tracked
53418
- const existing = _.find(conversations, conversation => conversation.id === id);
53392
+ var existing = _.find(conversations, function (conversation) { return conversation.id === id; });
53419
53393
  if (existing) {
53420
53394
  return;
53421
53395
  }
53422
- const missing = DOMConversation.validateConfig(cssSelectors);
53396
+ var missing = DOMConversation.validateConfig(cssSelectors);
53423
53397
  if (missing.length) {
53424
- log.error('aiAgent config missing required selectors', { agentId: id, missing });
53398
+ log.error('aiAgent config missing required selectors', { agentId: id, missing: missing });
53425
53399
  return;
53426
53400
  }
53427
- const conversation = new DOMConversation(pendo, api, id, cssSelectors);
53401
+ var conversation = new DOMConversation(pendo, api, id, cssSelectors);
53428
53402
  conversation.onSubmit(sendConversationEvent);
53429
53403
  conversations.push(conversation);
53430
53404
  }
53431
53405
  function sendConversationEvent(eventType, eventPayload) {
53432
53406
  // Block event if the conversation is suspended
53433
- const conversation = _.find(conversations, c => c.id === eventPayload.agentId);
53407
+ var conversation = _.find(conversations, function (c) { return c.id === eventPayload.agentId; });
53434
53408
  if (conversation && !conversation.isActive) {
53435
53409
  return;
53436
53410
  }
@@ -53438,7 +53412,7 @@ function ConversationAnalytics() {
53438
53412
  api.analytics.collectEvent(eventType, eventPayload, undefined, 'agentic');
53439
53413
  }
53440
53414
  function teardown() {
53441
- _.each(conversations, conversation => conversation.teardown());
53415
+ _.each(conversations, function (conversation) { return conversation.teardown(); });
53442
53416
  conversations = [];
53443
53417
  agentsCache.clear();
53444
53418
  }