@pendo/agent 2.286.1 → 2.287.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dom.esm.js 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.1_';
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.1_';
3907
+ var PACKAGE_VERSION = '2.287.1';
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
  });
@@ -12147,8 +12149,13 @@ class LocalStorageEventBuffer {
12147
12149
  * @label UNSENT_EVENTS_KEY
12148
12150
  */
12149
12151
  storage.registry.addLocal(UNSENT_EVENTS_KEY);
12150
- this.events = JSON.parse(storage.read(UNSENT_EVENTS_KEY) || '{}');
12151
- storage.clear(UNSENT_EVENTS_KEY);
12152
+ try {
12153
+ this.events = JSON.parse(storage.read(UNSENT_EVENTS_KEY) || '{}');
12154
+ storage.clear(UNSENT_EVENTS_KEY);
12155
+ }
12156
+ catch (e) {
12157
+ this.events = {};
12158
+ }
12152
12159
  }
12153
12160
  write(storage) {
12154
12161
  if (_.size(this.events) > 0) {
@@ -12803,6 +12810,7 @@ function initializeEventBuffer(options) {
12803
12810
  buffersClearAll();
12804
12811
  removeEventQueue(eventQueue);
12805
12812
  removeEventQueue(trackEventQueue);
12813
+ eventQueue = trackEventQueue = undefined;
12806
12814
  };
12807
12815
  }
12808
12816
 
@@ -14970,7 +14978,8 @@ var GuideRuntime = (function (agentEvents) {
14970
14978
  addGlobalScript,
14971
14979
  removeGlobalScript,
14972
14980
  getContext,
14973
- runCustomScripts
14981
+ runCustomScripts,
14982
+ handleEvent
14974
14983
  };
14975
14984
  })(Events);
14976
14985
 
@@ -18141,6 +18150,9 @@ var addExtension = (function setupExtensionService(ExtService) {
18141
18150
  var pending = [];
18142
18151
  var extensions = [];
18143
18152
  var uses = {};
18153
+ ExtService.getExtensions = function () {
18154
+ return extensions;
18155
+ };
18144
18156
  function addExtensionPublic(obj) {
18145
18157
  obj = [].concat(obj);
18146
18158
  var validExtensions = _.filter(obj, validateExtension);
@@ -18971,7 +18983,7 @@ var BuildingBlockResourceCenter = (function () {
18971
18983
  webWidgetWrapper(provider, 'webWidget', 'hide');
18972
18984
  endNativeChatExperience();
18973
18985
  });
18974
- if (resourceCenter.isInProgress()) {
18986
+ if (resourceCenter.isInProgress() && !resourceCenter.attributes.doNotResume) {
18975
18987
  handleNativeIntegrationContinuation(resourceCenter.activeModule);
18976
18988
  }
18977
18989
  webWidgetWrapper(provider, 'webWidget:on', 'chat:unreadMessages', function (unreadCount) {
@@ -24961,6 +24973,14 @@ function handleDoNotProcess() {
24961
24973
  store.commit('debugger/doNotProcess', true);
24962
24974
  log.info('not tracking visitor due to 451 response');
24963
24975
  }
24976
+ function resetCachedGuide(guide) {
24977
+ _.each(guide.steps, function (step) {
24978
+ if (_.get(step, 'attributes.stayHidden')) {
24979
+ delete step.attributes.stayHidden;
24980
+ }
24981
+ });
24982
+ return guide;
24983
+ }
24964
24984
  function guidesPayload(guidesJson) {
24965
24985
  if (!mostRecentGuideRequest)
24966
24986
  return;
@@ -24974,7 +24994,7 @@ function guidesPayload(guidesJson) {
24974
24994
  _.extend(pendo$1, guidesJson);
24975
24995
  pendo$1.guides = _.map(pendo$1.guides, function (guide) {
24976
24996
  if (_.keys(guide).length == 1 && guide.id) {
24977
- return cachedGuides[guide.id];
24997
+ return resetCachedGuide(cachedGuides[guide.id]);
24978
24998
  }
24979
24999
  else {
24980
25000
  return guide;
@@ -25962,6 +25982,7 @@ var EventRouter = function () {
25962
25982
  this.confirmGuide = confirmGuide;
25963
25983
  this.getTransitionParams = getTransitionParams;
25964
25984
  this.launchGuide = launchGuide;
25985
+ this.handleConditionalSplit = handleConditionalSplit;
25965
25986
  this.debounceAnnounceResults = _.debounce((element, string) => {
25966
25987
  element.innerHTML = string;
25967
25988
  }, 300);
@@ -25982,7 +26003,8 @@ var EventRouter = function () {
25982
26003
  openLink: 'openLink',
25983
26004
  searchGuides: 'searchGuides',
25984
26005
  submitPollAndGoToStep: 'submitPollAndGoToStep',
25985
- confirmation: 'confirmation'
26006
+ confirmation: 'confirmation',
26007
+ conditionalSplit: 'conditionalSplit'
25986
26008
  };
25987
26009
  function eventHandler(evt) {
25988
26010
  var containerJSON;
@@ -26063,6 +26085,9 @@ var EventRouter = function () {
26063
26085
  case actionKeys.confirmation:
26064
26086
  this.confirmGuide(evt);
26065
26087
  break;
26088
+ case actionKeys.conditionalSplit:
26089
+ this.handleConditionalSplit(evt);
26090
+ break;
26066
26091
  }
26067
26092
  var registeredActions = EventRouter.prototype.registeredActions;
26068
26093
  var actionCallback = registeredActions && registeredActions[evt.action];
@@ -26288,6 +26313,50 @@ var EventRouter = function () {
26288
26313
  }
26289
26314
  }
26290
26315
  }
26316
+ function handleConditionalSplit(evt) {
26317
+ var _a;
26318
+ var conditionTypeParam = _.find(evt.params, function (param) { return param.name === 'conditionType'; });
26319
+ var configParam = _.find(evt.params, function (param) { return param.name === 'config'; });
26320
+ var casesParam = _.find(evt.params, function (param) { return param.name === 'cases'; });
26321
+ if (!conditionTypeParam || !configParam || !casesParam) {
26322
+ return;
26323
+ }
26324
+ var conditionType = conditionTypeParam.value;
26325
+ var config = configParam.value;
26326
+ var cases = casesParam.value;
26327
+ var conditionResult = evaluateCondition(conditionType, config);
26328
+ var matchingCase = _.find(cases, function (caseItem) {
26329
+ return caseItem.value === conditionResult;
26330
+ });
26331
+ if (((_a = matchingCase === null || matchingCase === void 0 ? void 0 : matchingCase.actions) === null || _a === void 0 ? void 0 : _a.length) > 0) {
26332
+ _.forEach(matchingCase.actions, function (action) {
26333
+ var actionEvent = {
26334
+ action: action.action,
26335
+ params: action.parameters,
26336
+ step: evt.step,
26337
+ srcElement: evt.srcElement
26338
+ };
26339
+ self.eventHandler(actionEvent);
26340
+ });
26341
+ }
26342
+ else {
26343
+ log.warn('No matching case found for condition result:', conditionResult);
26344
+ }
26345
+ }
26346
+ function evaluateCondition(conditionType, config) {
26347
+ switch (conditionType) {
26348
+ case 'elementExists':
26349
+ try {
26350
+ var elements = pendo$1.Sizzle(config.elementSelector);
26351
+ return elements && elements.length > 0;
26352
+ }
26353
+ catch (error) {
26354
+ return false;
26355
+ }
26356
+ default:
26357
+ return false;
26358
+ }
26359
+ }
26291
26360
  return this;
26292
26361
  };
26293
26362
  EventRouter.registerAction = function registerAction(action, callback) {
@@ -27561,13 +27630,15 @@ var BuildingBlockGuides = (function () {
27561
27630
  var isGuideContainerAvailable = function () {
27562
27631
  var elem = dom(guideContainer).find('#pendo-guide-container');
27563
27632
  elem = elem[0] || elem;
27564
- return elem && isElementVisible(elem) && isElemInViewport(elem) && isElemIsFocusable(elem)
27633
+ return elem && isElementVisible(elem) && isElemIsFocusable(elem)
27565
27634
  ? elem
27566
27635
  : null;
27567
27636
  };
27568
27637
  var setContainerFocus = function (elem) {
27569
27638
  if (!elem)
27570
27639
  return false;
27640
+ if (!isElemInViewport(elem))
27641
+ scrollIntoView(elem);
27571
27642
  elem.focus();
27572
27643
  return elem === dom.getRootNode(elem).activeElement;
27573
27644
  };
@@ -29101,7 +29172,10 @@ function exportPublicApi(pendo) {
29101
29172
  pendo.TEMP_PREFIX = TEMP_PREFIX;
29102
29173
  pendo.SIZE_UNIQUE_ID = SIZE_UNIQUE_ID;
29103
29174
  // launcher (filled in by P1 plugin)
29104
- pendo.defaultLauncher = _.noop;
29175
+ pendo._defaultLauncher_queue = [];
29176
+ pendo.defaultLauncher = () => {
29177
+ pendo._defaultLauncher_queue.push(arguments);
29178
+ };
29105
29179
  pendo.toggleLauncher = _.noop;
29106
29180
  pendo.showLauncher = _.noop;
29107
29181
  pendo.hideLauncher = _.noop;
@@ -33547,7 +33621,7 @@ var PromoteMetadata = (function () {
33547
33621
  function removePrefixes(metadata) {
33548
33622
  const result = _.mapObject(metadata, (val, kind) => {
33549
33623
  const kindWithoutPrefix = {};
33550
- Object.keys(val).forEach(key => {
33624
+ _.each(Object.keys(val), function (key) {
33551
33625
  kindWithoutPrefix[key.replace('agent__', '')] = val[key];
33552
33626
  });
33553
33627
  return kindWithoutPrefix;
@@ -34790,7 +34864,7 @@ function Launcher() {
34790
34864
  if (!target) {
34791
34865
  return;
34792
34866
  }
34793
- var config = this.data;
34867
+ var config = this.data || {};
34794
34868
  var elementPos = getOffsetPosition(target);
34795
34869
  var dim = getTooltipDimensions(elementPos, this.height, this.width);
34796
34870
  var launcherElement = dom(launcherTooltipDiv);
@@ -35276,6 +35350,10 @@ var initLauncher = function () {
35276
35350
  var loadLauncherPublicFunctions = function (pendo) {
35277
35351
  // fill in exports
35278
35352
  pendo.defaultLauncher = defaultLauncher;
35353
+ _.each(pendo._defaultLauncher_queue, (a) => {
35354
+ defaultLauncher.apply(null, a);
35355
+ });
35356
+ pendo._defaultLauncher_queue = [];
35279
35357
  pendo.toggleLauncher = toggleLauncher;
35280
35358
  pendo.showLauncher = expandLauncherList;
35281
35359
  pendo.hideLauncher = collapseLauncherList;
@@ -35398,7 +35476,7 @@ var P1GuidePlugin = (function () {
35398
35476
  removeBehaviors();
35399
35477
  }
35400
35478
  function removeBehaviors() {
35401
- p1Behaviors.forEach((behavior) => {
35479
+ globalPendo._.each(p1Behaviors, function (behavior) {
35402
35480
  var i = _.indexOf(GuideStepFactory.behaviors, behavior);
35403
35481
  if (i >= 0) {
35404
35482
  GuideStepFactory.behaviors.splice(i, 1);
@@ -35837,7 +35915,7 @@ const EventProperties = (function () {
35837
35915
  function createClickEventProperties(eventPropertyHandler) {
35838
35916
  if (globalPendo.eventProperties && globalPendo.eventProperties.length) {
35839
35917
  const eventProps = createFeatureEventPropertyMap(eventPropertyHandler.target);
35840
- globalPendo._.pairs(eventProps).forEach(([key, value]) => {
35918
+ globalPendo._.each(globalPendo._.pairs(eventProps), ([key, value]) => {
35841
35919
  eventPropertyHandler.addEventProperty(key, value);
35842
35920
  });
35843
35921
  }
@@ -38114,7 +38192,7 @@ class PromptPlugin {
38114
38192
  if (networkAgents.length > 0) {
38115
38193
  this.networkAgents = networkAgents;
38116
38194
  this.patchNetwork(({ method, url, body }) => {
38117
- this.networkAgents.forEach(aiAgent => {
38195
+ this._.each(this.networkAgents, aiAgent => {
38118
38196
  let compiledFilter = null;
38119
38197
  if (aiAgent.privacyFilters) {
38120
38198
  try {
@@ -38257,14 +38335,14 @@ function safelySerializeBody(body) {
38257
38335
  function extractHeaders(headers = {}) {
38258
38336
  const result = {};
38259
38337
  if (headers instanceof Headers) {
38260
- headers.forEach((value, key) => {
38338
+ for (const [key, value] of headers.entries()) {
38261
38339
  result[key] = value;
38262
- });
38340
+ }
38263
38341
  }
38264
38342
  else if (typeof headers === 'object') {
38265
- Object.entries(headers).forEach(([key, value]) => {
38343
+ for (const [key, value] of Object.entries(headers)) {
38266
38344
  result[key] = value;
38267
- });
38345
+ }
38268
38346
  }
38269
38347
  return result;
38270
38348
  }
@@ -38458,9 +38536,9 @@ function lookupGuideButtons(domJson, buttons = []) {
38458
38536
  buttons.push(domJson);
38459
38537
  }
38460
38538
  if (domJson.children) {
38461
- domJson.children.forEach((child) => {
38539
+ for (const child of domJson.children) {
38462
38540
  lookupGuideButtons(child, buttons);
38463
- });
38541
+ }
38464
38542
  }
38465
38543
  return buttons;
38466
38544
  }
@@ -38549,7 +38627,7 @@ const PollBranching = {
38549
38627
  const observer = new MutationObserver(applyBranchingIndicators);
38550
38628
  observer.observe(target, config);
38551
38629
  function applyBranchingIndicators(mutations) {
38552
- mutations.forEach(function (mutation) {
38630
+ pendo._.each(mutations, function (mutation) {
38553
38631
  var _a;
38554
38632
  const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelector);
38555
38633
  if (mutation.addedNodes.length && nodeHasQuerySelector) {
@@ -38697,7 +38775,7 @@ const MetadataSubstitution = {
38697
38775
  const observer = new MutationObserver(applySubstitutionIndicators);
38698
38776
  observer.observe(target, config);
38699
38777
  function applySubstitutionIndicators(mutations) {
38700
- mutations.forEach(function (mutation) {
38778
+ pendo._.each(mutations, function (mutation) {
38701
38779
  var _a;
38702
38780
  if (mutation.addedNodes.length) {
38703
38781
  if (document.querySelector(containerSelector)) {
@@ -38979,7 +39057,7 @@ const RequiredQuestions = {
38979
39057
  }
38980
39058
  }
38981
39059
  function disableEligibleButtons(buttons) {
38982
- buttons.forEach(function (button) {
39060
+ pendo._.each(buttons, function (button) {
38983
39061
  if (step.guideElement.find(`#${button.props.id}`)[0]) {
38984
39062
  step.guideElement.find(`#${button.props.id}`)[0].disabled = true;
38985
39063
  step.guideElement.find(`#${button.props.id}`)[0].parentElement.title = 'Please complete all required questions.';
@@ -38987,7 +39065,7 @@ const RequiredQuestions = {
38987
39065
  });
38988
39066
  }
38989
39067
  function enableEligibleButtons(buttons) {
38990
- buttons.forEach(function (button) {
39068
+ pendo._.each(buttons, function (button) {
38991
39069
  if (step.guideElement.find(`#${button.props.id}`)[0]) {
38992
39070
  step.guideElement.find(`#${button.props.id}`)[0].disabled = false;
38993
39071
  step.guideElement.find(`#${button.props.id}`)[0].parentElement.title = '';
@@ -39013,13 +39091,13 @@ const RequiredQuestions = {
39013
39091
  const observer = new MutationObserver(applyRequiredIndicators);
39014
39092
  observer.observe(target, config);
39015
39093
  function applyRequiredIndicators(mutations) {
39016
- mutations.forEach(function (mutation) {
39094
+ pendo._.each(mutations, function (mutation) {
39017
39095
  var _a;
39018
39096
  const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
39019
39097
  if (mutation.addedNodes.length && nodeHasQuerySelector) {
39020
39098
  let eligiblePolls = mutation.addedNodes[0].querySelectorAll('[class*=-poll-wrapper], [class*=-poll-select-border]');
39021
39099
  if (eligiblePolls) {
39022
- eligiblePolls.forEach(function (poll) {
39100
+ pendo._.each(eligiblePolls, function (poll) {
39023
39101
  let dataPendoPollId;
39024
39102
  if (poll.classList.contains('_pendo-open-text-poll-wrapper') ||
39025
39103
  poll.classList.contains('_pendo-number-scale-poll-wrapper')) {
@@ -39137,7 +39215,7 @@ const SkipToEligibleStep = {
39137
39215
  observer.observe(target, config);
39138
39216
  // create an observer instance
39139
39217
  function applySkipStepIndicator(mutations) {
39140
- mutations.forEach(function (mutation) {
39218
+ pendo._.each(mutations, function (mutation) {
39141
39219
  var _a, _b;
39142
39220
  const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
39143
39221
  if (mutation.addedNodes.length && nodeHasQuerySelector) {
@@ -39202,7 +39280,7 @@ function GuideMarkdown() {
39202
39280
  return;
39203
39281
  guideMarkdown = [PollBranching, MetadataSubstitution, RequiredQuestions, SkipToEligibleStep];
39204
39282
  if (!pendo.designer) {
39205
- guideMarkdown.forEach(script => {
39283
+ pendo._.each(guideMarkdown, function (script) {
39206
39284
  PluginAPI.GlobalRuntime.addGlobalScript(script);
39207
39285
  });
39208
39286
  }
@@ -39210,7 +39288,7 @@ function GuideMarkdown() {
39210
39288
  }
39211
39289
  function teardown() {
39212
39290
  pluginApi.Events.off('designerLaunched', designerLaunchedHandler);
39213
- guideMarkdown.forEach(script => {
39291
+ globalPendo._.each(guideMarkdown, function (script) {
39214
39292
  pluginApi.GlobalRuntime.removeGlobalScript(script);
39215
39293
  });
39216
39294
  }
@@ -39218,7 +39296,7 @@ function GuideMarkdown() {
39218
39296
  addDesignerListeners(guideMarkdown);
39219
39297
  }
39220
39298
  function addDesignerListeners(scripts) {
39221
- scripts.forEach(script => {
39299
+ globalPendo._.each(scripts, function (script) {
39222
39300
  if (script.designerListener) {
39223
39301
  script.designerListener(globalPendo, pluginApi);
39224
39302
  }