@pendo/agent 2.286.1 → 2.287.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dom.esm.js CHANGED
@@ -7287,7 +7287,7 @@ function getScreenPosition(element) {
7287
7287
  };
7288
7288
  }
7289
7289
 
7290
- var VERSION = '2.286.1_';
7290
+ var VERSION = '2.287.0_';
7291
7291
 
7292
7292
  var decodeURIComponent = _.isFunction(window.decodeURIComponent) ? window.decodeURIComponent : _.identity;
7293
7293
 
@@ -3903,8 +3903,8 @@ var SERVER = '';
3903
3903
  var ASSET_HOST = '';
3904
3904
  var ASSET_PATH = '';
3905
3905
  var DESIGNER_SERVER = '';
3906
- var VERSION = '2.286.1_';
3907
- var PACKAGE_VERSION = '2.286.1';
3906
+ var VERSION = '2.287.0_';
3907
+ var PACKAGE_VERSION = '2.287.0';
3908
3908
  var LOADER = 'xhr';
3909
3909
  /* eslint-enable agent-eslint-rules/no-gulp-env-references */
3910
3910
  /**
@@ -9248,6 +9248,7 @@ function startPoller() {
9248
9248
  }
9249
9249
  return () => {
9250
9250
  clearTimeout(pollTimeout);
9251
+ pollTimeout = undefined;
9251
9252
  };
9252
9253
  }
9253
9254
  // ////////////////////////////////////////////////////////////
@@ -9308,6 +9309,7 @@ var onUrlChange = function (callback) {
9308
9309
  setTimeout$1(fireUrlChange, 0);
9309
9310
  return returnValue;
9310
9311
  });
9312
+ history[method]._pendoUnwrapped = origHistoryFn;
9311
9313
  unwatch.push(() => {
9312
9314
  history[method] = origHistoryFn;
9313
9315
  });
@@ -12803,6 +12805,7 @@ function initializeEventBuffer(options) {
12803
12805
  buffersClearAll();
12804
12806
  removeEventQueue(eventQueue);
12805
12807
  removeEventQueue(trackEventQueue);
12808
+ eventQueue = trackEventQueue = undefined;
12806
12809
  };
12807
12810
  }
12808
12811
 
@@ -14970,7 +14973,8 @@ var GuideRuntime = (function (agentEvents) {
14970
14973
  addGlobalScript,
14971
14974
  removeGlobalScript,
14972
14975
  getContext,
14973
- runCustomScripts
14976
+ runCustomScripts,
14977
+ handleEvent
14974
14978
  };
14975
14979
  })(Events);
14976
14980
 
@@ -18141,6 +18145,9 @@ var addExtension = (function setupExtensionService(ExtService) {
18141
18145
  var pending = [];
18142
18146
  var extensions = [];
18143
18147
  var uses = {};
18148
+ ExtService.getExtensions = function () {
18149
+ return extensions;
18150
+ };
18144
18151
  function addExtensionPublic(obj) {
18145
18152
  obj = [].concat(obj);
18146
18153
  var validExtensions = _.filter(obj, validateExtension);
@@ -18971,7 +18978,7 @@ var BuildingBlockResourceCenter = (function () {
18971
18978
  webWidgetWrapper(provider, 'webWidget', 'hide');
18972
18979
  endNativeChatExperience();
18973
18980
  });
18974
- if (resourceCenter.isInProgress()) {
18981
+ if (resourceCenter.isInProgress() && !resourceCenter.attributes.doNotResume) {
18975
18982
  handleNativeIntegrationContinuation(resourceCenter.activeModule);
18976
18983
  }
18977
18984
  webWidgetWrapper(provider, 'webWidget:on', 'chat:unreadMessages', function (unreadCount) {
@@ -24961,6 +24968,14 @@ function handleDoNotProcess() {
24961
24968
  store.commit('debugger/doNotProcess', true);
24962
24969
  log.info('not tracking visitor due to 451 response');
24963
24970
  }
24971
+ function resetCachedGuide(guide) {
24972
+ _.each(guide.steps, function (step) {
24973
+ if (_.get(step, 'attributes.stayHidden')) {
24974
+ delete step.attributes.stayHidden;
24975
+ }
24976
+ });
24977
+ return guide;
24978
+ }
24964
24979
  function guidesPayload(guidesJson) {
24965
24980
  if (!mostRecentGuideRequest)
24966
24981
  return;
@@ -24974,7 +24989,7 @@ function guidesPayload(guidesJson) {
24974
24989
  _.extend(pendo$1, guidesJson);
24975
24990
  pendo$1.guides = _.map(pendo$1.guides, function (guide) {
24976
24991
  if (_.keys(guide).length == 1 && guide.id) {
24977
- return cachedGuides[guide.id];
24992
+ return resetCachedGuide(cachedGuides[guide.id]);
24978
24993
  }
24979
24994
  else {
24980
24995
  return guide;
@@ -25962,6 +25977,7 @@ var EventRouter = function () {
25962
25977
  this.confirmGuide = confirmGuide;
25963
25978
  this.getTransitionParams = getTransitionParams;
25964
25979
  this.launchGuide = launchGuide;
25980
+ this.handleConditionalSplit = handleConditionalSplit;
25965
25981
  this.debounceAnnounceResults = _.debounce((element, string) => {
25966
25982
  element.innerHTML = string;
25967
25983
  }, 300);
@@ -25982,7 +25998,8 @@ var EventRouter = function () {
25982
25998
  openLink: 'openLink',
25983
25999
  searchGuides: 'searchGuides',
25984
26000
  submitPollAndGoToStep: 'submitPollAndGoToStep',
25985
- confirmation: 'confirmation'
26001
+ confirmation: 'confirmation',
26002
+ conditionalSplit: 'conditionalSplit'
25986
26003
  };
25987
26004
  function eventHandler(evt) {
25988
26005
  var containerJSON;
@@ -26063,6 +26080,9 @@ var EventRouter = function () {
26063
26080
  case actionKeys.confirmation:
26064
26081
  this.confirmGuide(evt);
26065
26082
  break;
26083
+ case actionKeys.conditionalSplit:
26084
+ this.handleConditionalSplit(evt);
26085
+ break;
26066
26086
  }
26067
26087
  var registeredActions = EventRouter.prototype.registeredActions;
26068
26088
  var actionCallback = registeredActions && registeredActions[evt.action];
@@ -26288,6 +26308,50 @@ var EventRouter = function () {
26288
26308
  }
26289
26309
  }
26290
26310
  }
26311
+ function handleConditionalSplit(evt) {
26312
+ var _a;
26313
+ var conditionTypeParam = _.find(evt.params, function (param) { return param.name === 'conditionType'; });
26314
+ var configParam = _.find(evt.params, function (param) { return param.name === 'config'; });
26315
+ var casesParam = _.find(evt.params, function (param) { return param.name === 'cases'; });
26316
+ if (!conditionTypeParam || !configParam || !casesParam) {
26317
+ return;
26318
+ }
26319
+ var conditionType = conditionTypeParam.value;
26320
+ var config = configParam.value;
26321
+ var cases = casesParam.value;
26322
+ var conditionResult = evaluateCondition(conditionType, config);
26323
+ var matchingCase = _.find(cases, function (caseItem) {
26324
+ return caseItem.value === conditionResult;
26325
+ });
26326
+ if (((_a = matchingCase === null || matchingCase === void 0 ? void 0 : matchingCase.actions) === null || _a === void 0 ? void 0 : _a.length) > 0) {
26327
+ _.forEach(matchingCase.actions, function (action) {
26328
+ var actionEvent = {
26329
+ action: action.action,
26330
+ params: action.parameters,
26331
+ step: evt.step,
26332
+ srcElement: evt.srcElement
26333
+ };
26334
+ self.eventHandler(actionEvent);
26335
+ });
26336
+ }
26337
+ else {
26338
+ log.warn('No matching case found for condition result:', conditionResult);
26339
+ }
26340
+ }
26341
+ function evaluateCondition(conditionType, config) {
26342
+ switch (conditionType) {
26343
+ case 'elementExists':
26344
+ try {
26345
+ var elements = pendo$1.Sizzle(config.elementSelector);
26346
+ return elements && elements.length > 0;
26347
+ }
26348
+ catch (error) {
26349
+ return false;
26350
+ }
26351
+ default:
26352
+ return false;
26353
+ }
26354
+ }
26291
26355
  return this;
26292
26356
  };
26293
26357
  EventRouter.registerAction = function registerAction(action, callback) {
@@ -27561,13 +27625,15 @@ var BuildingBlockGuides = (function () {
27561
27625
  var isGuideContainerAvailable = function () {
27562
27626
  var elem = dom(guideContainer).find('#pendo-guide-container');
27563
27627
  elem = elem[0] || elem;
27564
- return elem && isElementVisible(elem) && isElemInViewport(elem) && isElemIsFocusable(elem)
27628
+ return elem && isElementVisible(elem) && isElemIsFocusable(elem)
27565
27629
  ? elem
27566
27630
  : null;
27567
27631
  };
27568
27632
  var setContainerFocus = function (elem) {
27569
27633
  if (!elem)
27570
27634
  return false;
27635
+ if (!isElemInViewport(elem))
27636
+ scrollIntoView(elem);
27571
27637
  elem.focus();
27572
27638
  return elem === dom.getRootNode(elem).activeElement;
27573
27639
  };
@@ -29101,7 +29167,10 @@ function exportPublicApi(pendo) {
29101
29167
  pendo.TEMP_PREFIX = TEMP_PREFIX;
29102
29168
  pendo.SIZE_UNIQUE_ID = SIZE_UNIQUE_ID;
29103
29169
  // launcher (filled in by P1 plugin)
29104
- pendo.defaultLauncher = _.noop;
29170
+ pendo._defaultLauncher_queue = [];
29171
+ pendo.defaultLauncher = () => {
29172
+ pendo._defaultLauncher_queue.push(arguments);
29173
+ };
29105
29174
  pendo.toggleLauncher = _.noop;
29106
29175
  pendo.showLauncher = _.noop;
29107
29176
  pendo.hideLauncher = _.noop;
@@ -33547,7 +33616,7 @@ var PromoteMetadata = (function () {
33547
33616
  function removePrefixes(metadata) {
33548
33617
  const result = _.mapObject(metadata, (val, kind) => {
33549
33618
  const kindWithoutPrefix = {};
33550
- Object.keys(val).forEach(key => {
33619
+ _.each(Object.keys(val), function (key) {
33551
33620
  kindWithoutPrefix[key.replace('agent__', '')] = val[key];
33552
33621
  });
33553
33622
  return kindWithoutPrefix;
@@ -34790,7 +34859,7 @@ function Launcher() {
34790
34859
  if (!target) {
34791
34860
  return;
34792
34861
  }
34793
- var config = this.data;
34862
+ var config = this.data || {};
34794
34863
  var elementPos = getOffsetPosition(target);
34795
34864
  var dim = getTooltipDimensions(elementPos, this.height, this.width);
34796
34865
  var launcherElement = dom(launcherTooltipDiv);
@@ -35276,6 +35345,10 @@ var initLauncher = function () {
35276
35345
  var loadLauncherPublicFunctions = function (pendo) {
35277
35346
  // fill in exports
35278
35347
  pendo.defaultLauncher = defaultLauncher;
35348
+ _.each(pendo._defaultLauncher_queue, (a) => {
35349
+ defaultLauncher.apply(null, a);
35350
+ });
35351
+ pendo._defaultLauncher_queue = [];
35279
35352
  pendo.toggleLauncher = toggleLauncher;
35280
35353
  pendo.showLauncher = expandLauncherList;
35281
35354
  pendo.hideLauncher = collapseLauncherList;
@@ -35398,7 +35471,7 @@ var P1GuidePlugin = (function () {
35398
35471
  removeBehaviors();
35399
35472
  }
35400
35473
  function removeBehaviors() {
35401
- p1Behaviors.forEach((behavior) => {
35474
+ globalPendo._.each(p1Behaviors, function (behavior) {
35402
35475
  var i = _.indexOf(GuideStepFactory.behaviors, behavior);
35403
35476
  if (i >= 0) {
35404
35477
  GuideStepFactory.behaviors.splice(i, 1);
@@ -35837,7 +35910,7 @@ const EventProperties = (function () {
35837
35910
  function createClickEventProperties(eventPropertyHandler) {
35838
35911
  if (globalPendo.eventProperties && globalPendo.eventProperties.length) {
35839
35912
  const eventProps = createFeatureEventPropertyMap(eventPropertyHandler.target);
35840
- globalPendo._.pairs(eventProps).forEach(([key, value]) => {
35913
+ globalPendo._.each(globalPendo._.pairs(eventProps), ([key, value]) => {
35841
35914
  eventPropertyHandler.addEventProperty(key, value);
35842
35915
  });
35843
35916
  }
@@ -38114,7 +38187,7 @@ class PromptPlugin {
38114
38187
  if (networkAgents.length > 0) {
38115
38188
  this.networkAgents = networkAgents;
38116
38189
  this.patchNetwork(({ method, url, body }) => {
38117
- this.networkAgents.forEach(aiAgent => {
38190
+ this._.each(this.networkAgents, aiAgent => {
38118
38191
  let compiledFilter = null;
38119
38192
  if (aiAgent.privacyFilters) {
38120
38193
  try {
@@ -38257,14 +38330,14 @@ function safelySerializeBody(body) {
38257
38330
  function extractHeaders(headers = {}) {
38258
38331
  const result = {};
38259
38332
  if (headers instanceof Headers) {
38260
- headers.forEach((value, key) => {
38333
+ for (const [key, value] of headers.entries()) {
38261
38334
  result[key] = value;
38262
- });
38335
+ }
38263
38336
  }
38264
38337
  else if (typeof headers === 'object') {
38265
- Object.entries(headers).forEach(([key, value]) => {
38338
+ for (const [key, value] of Object.entries(headers)) {
38266
38339
  result[key] = value;
38267
- });
38340
+ }
38268
38341
  }
38269
38342
  return result;
38270
38343
  }
@@ -38458,9 +38531,9 @@ function lookupGuideButtons(domJson, buttons = []) {
38458
38531
  buttons.push(domJson);
38459
38532
  }
38460
38533
  if (domJson.children) {
38461
- domJson.children.forEach((child) => {
38534
+ for (const child of domJson.children) {
38462
38535
  lookupGuideButtons(child, buttons);
38463
- });
38536
+ }
38464
38537
  }
38465
38538
  return buttons;
38466
38539
  }
@@ -38549,7 +38622,7 @@ const PollBranching = {
38549
38622
  const observer = new MutationObserver(applyBranchingIndicators);
38550
38623
  observer.observe(target, config);
38551
38624
  function applyBranchingIndicators(mutations) {
38552
- mutations.forEach(function (mutation) {
38625
+ pendo._.each(mutations, function (mutation) {
38553
38626
  var _a;
38554
38627
  const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelector);
38555
38628
  if (mutation.addedNodes.length && nodeHasQuerySelector) {
@@ -38697,7 +38770,7 @@ const MetadataSubstitution = {
38697
38770
  const observer = new MutationObserver(applySubstitutionIndicators);
38698
38771
  observer.observe(target, config);
38699
38772
  function applySubstitutionIndicators(mutations) {
38700
- mutations.forEach(function (mutation) {
38773
+ pendo._.each(mutations, function (mutation) {
38701
38774
  var _a;
38702
38775
  if (mutation.addedNodes.length) {
38703
38776
  if (document.querySelector(containerSelector)) {
@@ -38979,7 +39052,7 @@ const RequiredQuestions = {
38979
39052
  }
38980
39053
  }
38981
39054
  function disableEligibleButtons(buttons) {
38982
- buttons.forEach(function (button) {
39055
+ pendo._.each(buttons, function (button) {
38983
39056
  if (step.guideElement.find(`#${button.props.id}`)[0]) {
38984
39057
  step.guideElement.find(`#${button.props.id}`)[0].disabled = true;
38985
39058
  step.guideElement.find(`#${button.props.id}`)[0].parentElement.title = 'Please complete all required questions.';
@@ -38987,7 +39060,7 @@ const RequiredQuestions = {
38987
39060
  });
38988
39061
  }
38989
39062
  function enableEligibleButtons(buttons) {
38990
- buttons.forEach(function (button) {
39063
+ pendo._.each(buttons, function (button) {
38991
39064
  if (step.guideElement.find(`#${button.props.id}`)[0]) {
38992
39065
  step.guideElement.find(`#${button.props.id}`)[0].disabled = false;
38993
39066
  step.guideElement.find(`#${button.props.id}`)[0].parentElement.title = '';
@@ -39013,13 +39086,13 @@ const RequiredQuestions = {
39013
39086
  const observer = new MutationObserver(applyRequiredIndicators);
39014
39087
  observer.observe(target, config);
39015
39088
  function applyRequiredIndicators(mutations) {
39016
- mutations.forEach(function (mutation) {
39089
+ pendo._.each(mutations, function (mutation) {
39017
39090
  var _a;
39018
39091
  const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
39019
39092
  if (mutation.addedNodes.length && nodeHasQuerySelector) {
39020
39093
  let eligiblePolls = mutation.addedNodes[0].querySelectorAll('[class*=-poll-wrapper], [class*=-poll-select-border]');
39021
39094
  if (eligiblePolls) {
39022
- eligiblePolls.forEach(function (poll) {
39095
+ pendo._.each(eligiblePolls, function (poll) {
39023
39096
  let dataPendoPollId;
39024
39097
  if (poll.classList.contains('_pendo-open-text-poll-wrapper') ||
39025
39098
  poll.classList.contains('_pendo-number-scale-poll-wrapper')) {
@@ -39137,7 +39210,7 @@ const SkipToEligibleStep = {
39137
39210
  observer.observe(target, config);
39138
39211
  // create an observer instance
39139
39212
  function applySkipStepIndicator(mutations) {
39140
- mutations.forEach(function (mutation) {
39213
+ pendo._.each(mutations, function (mutation) {
39141
39214
  var _a, _b;
39142
39215
  const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
39143
39216
  if (mutation.addedNodes.length && nodeHasQuerySelector) {
@@ -39202,7 +39275,7 @@ function GuideMarkdown() {
39202
39275
  return;
39203
39276
  guideMarkdown = [PollBranching, MetadataSubstitution, RequiredQuestions, SkipToEligibleStep];
39204
39277
  if (!pendo.designer) {
39205
- guideMarkdown.forEach(script => {
39278
+ pendo._.each(guideMarkdown, function (script) {
39206
39279
  PluginAPI.GlobalRuntime.addGlobalScript(script);
39207
39280
  });
39208
39281
  }
@@ -39210,7 +39283,7 @@ function GuideMarkdown() {
39210
39283
  }
39211
39284
  function teardown() {
39212
39285
  pluginApi.Events.off('designerLaunched', designerLaunchedHandler);
39213
- guideMarkdown.forEach(script => {
39286
+ globalPendo._.each(guideMarkdown, function (script) {
39214
39287
  pluginApi.GlobalRuntime.removeGlobalScript(script);
39215
39288
  });
39216
39289
  }
@@ -39218,7 +39291,7 @@ function GuideMarkdown() {
39218
39291
  addDesignerListeners(guideMarkdown);
39219
39292
  }
39220
39293
  function addDesignerListeners(scripts) {
39221
- scripts.forEach(script => {
39294
+ globalPendo._.each(scripts, function (script) {
39222
39295
  if (script.designerListener) {
39223
39296
  script.designerListener(globalPendo, pluginApi);
39224
39297
  }