@pendo/agent 2.286.0 → 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.0_';
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.0_';
3907
- var PACKAGE_VERSION = '2.286.0';
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
 
@@ -16015,7 +16019,7 @@ var BuildingBlockTooltips = (function () {
16015
16019
  if (containerDomJson.props.style.border) {
16016
16020
  var guideBorderArray = containerDomJson.props.style.border.split(' ');
16017
16021
  caretDimensions.borderColor = guideBorderArray[2];
16018
- caretDimensions.borderWidth = parseInt(guideBorderArray[0], 10);
16022
+ caretDimensions.borderWidth = parseInt(guideBorderArray[0], 10) || 0;
16019
16023
  }
16020
16024
  const tooltipSizes = {
16021
16025
  width: guideContainer.offsetWidth,
@@ -16272,7 +16276,11 @@ var BuildingBlockTooltips = (function () {
16272
16276
  };
16273
16277
  }
16274
16278
  function calculateCaretPadding(caretSizes) {
16275
- return caretSizes.offset + caretSizes.width + caretSizes.borderWidth;
16279
+ const offset = parseInt(caretSizes.offset, 10) || 0;
16280
+ const width = parseInt(caretSizes.width, 10) || 0;
16281
+ const borderWidth = parseInt(caretSizes.borderWidth, 10) || 0;
16282
+ const result = offset + width + borderWidth;
16283
+ return isNaN(result) ? 0 : result;
16276
16284
  }
16277
16285
  function calculateRightBiasPosition(elementPosition, tooltipDimensions, caretSizes, screenDimensions, rightBoundary, leftBoundary) {
16278
16286
  const caretPadding = calculateCaretPadding(caretSizes);
@@ -16576,7 +16584,7 @@ var BuildingBlockTooltips = (function () {
16576
16584
  backgroundColor: ttContainer[0].style['background-color'],
16577
16585
  offset: TOOLTIP_CONSTANTS.DEFAULT_CARET_OFFSET,
16578
16586
  borderColor: ttContainerStyles.borderColor,
16579
- borderWidth: parseInt(ttContainerStyles.borderWidth, 10)
16587
+ borderWidth: parseInt(ttContainerStyles.borderWidth, 10) || 0
16580
16588
  };
16581
16589
  var tooltipDimensions = this.getBBTooltipDimensions(elPos, tooltipSizes, caretStyles, layoutDir, screenPos);
16582
16590
  if (caretStyles.height && caretStyles.width) {
@@ -18137,6 +18145,9 @@ var addExtension = (function setupExtensionService(ExtService) {
18137
18145
  var pending = [];
18138
18146
  var extensions = [];
18139
18147
  var uses = {};
18148
+ ExtService.getExtensions = function () {
18149
+ return extensions;
18150
+ };
18140
18151
  function addExtensionPublic(obj) {
18141
18152
  obj = [].concat(obj);
18142
18153
  var validExtensions = _.filter(obj, validateExtension);
@@ -18967,7 +18978,7 @@ var BuildingBlockResourceCenter = (function () {
18967
18978
  webWidgetWrapper(provider, 'webWidget', 'hide');
18968
18979
  endNativeChatExperience();
18969
18980
  });
18970
- if (resourceCenter.isInProgress()) {
18981
+ if (resourceCenter.isInProgress() && !resourceCenter.attributes.doNotResume) {
18971
18982
  handleNativeIntegrationContinuation(resourceCenter.activeModule);
18972
18983
  }
18973
18984
  webWidgetWrapper(provider, 'webWidget:on', 'chat:unreadMessages', function (unreadCount) {
@@ -24957,6 +24968,14 @@ function handleDoNotProcess() {
24957
24968
  store.commit('debugger/doNotProcess', true);
24958
24969
  log.info('not tracking visitor due to 451 response');
24959
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
+ }
24960
24979
  function guidesPayload(guidesJson) {
24961
24980
  if (!mostRecentGuideRequest)
24962
24981
  return;
@@ -24970,7 +24989,7 @@ function guidesPayload(guidesJson) {
24970
24989
  _.extend(pendo$1, guidesJson);
24971
24990
  pendo$1.guides = _.map(pendo$1.guides, function (guide) {
24972
24991
  if (_.keys(guide).length == 1 && guide.id) {
24973
- return cachedGuides[guide.id];
24992
+ return resetCachedGuide(cachedGuides[guide.id]);
24974
24993
  }
24975
24994
  else {
24976
24995
  return guide;
@@ -25958,6 +25977,7 @@ var EventRouter = function () {
25958
25977
  this.confirmGuide = confirmGuide;
25959
25978
  this.getTransitionParams = getTransitionParams;
25960
25979
  this.launchGuide = launchGuide;
25980
+ this.handleConditionalSplit = handleConditionalSplit;
25961
25981
  this.debounceAnnounceResults = _.debounce((element, string) => {
25962
25982
  element.innerHTML = string;
25963
25983
  }, 300);
@@ -25978,7 +25998,8 @@ var EventRouter = function () {
25978
25998
  openLink: 'openLink',
25979
25999
  searchGuides: 'searchGuides',
25980
26000
  submitPollAndGoToStep: 'submitPollAndGoToStep',
25981
- confirmation: 'confirmation'
26001
+ confirmation: 'confirmation',
26002
+ conditionalSplit: 'conditionalSplit'
25982
26003
  };
25983
26004
  function eventHandler(evt) {
25984
26005
  var containerJSON;
@@ -26059,6 +26080,9 @@ var EventRouter = function () {
26059
26080
  case actionKeys.confirmation:
26060
26081
  this.confirmGuide(evt);
26061
26082
  break;
26083
+ case actionKeys.conditionalSplit:
26084
+ this.handleConditionalSplit(evt);
26085
+ break;
26062
26086
  }
26063
26087
  var registeredActions = EventRouter.prototype.registeredActions;
26064
26088
  var actionCallback = registeredActions && registeredActions[evt.action];
@@ -26284,6 +26308,50 @@ var EventRouter = function () {
26284
26308
  }
26285
26309
  }
26286
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
+ }
26287
26355
  return this;
26288
26356
  };
26289
26357
  EventRouter.registerAction = function registerAction(action, callback) {
@@ -27557,13 +27625,15 @@ var BuildingBlockGuides = (function () {
27557
27625
  var isGuideContainerAvailable = function () {
27558
27626
  var elem = dom(guideContainer).find('#pendo-guide-container');
27559
27627
  elem = elem[0] || elem;
27560
- return elem && isElementVisible(elem) && isElemInViewport(elem) && isElemIsFocusable(elem)
27628
+ return elem && isElementVisible(elem) && isElemIsFocusable(elem)
27561
27629
  ? elem
27562
27630
  : null;
27563
27631
  };
27564
27632
  var setContainerFocus = function (elem) {
27565
27633
  if (!elem)
27566
27634
  return false;
27635
+ if (!isElemInViewport(elem))
27636
+ scrollIntoView(elem);
27567
27637
  elem.focus();
27568
27638
  return elem === dom.getRootNode(elem).activeElement;
27569
27639
  };
@@ -29097,7 +29167,10 @@ function exportPublicApi(pendo) {
29097
29167
  pendo.TEMP_PREFIX = TEMP_PREFIX;
29098
29168
  pendo.SIZE_UNIQUE_ID = SIZE_UNIQUE_ID;
29099
29169
  // launcher (filled in by P1 plugin)
29100
- pendo.defaultLauncher = _.noop;
29170
+ pendo._defaultLauncher_queue = [];
29171
+ pendo.defaultLauncher = () => {
29172
+ pendo._defaultLauncher_queue.push(arguments);
29173
+ };
29101
29174
  pendo.toggleLauncher = _.noop;
29102
29175
  pendo.showLauncher = _.noop;
29103
29176
  pendo.hideLauncher = _.noop;
@@ -33543,7 +33616,7 @@ var PromoteMetadata = (function () {
33543
33616
  function removePrefixes(metadata) {
33544
33617
  const result = _.mapObject(metadata, (val, kind) => {
33545
33618
  const kindWithoutPrefix = {};
33546
- Object.keys(val).forEach(key => {
33619
+ _.each(Object.keys(val), function (key) {
33547
33620
  kindWithoutPrefix[key.replace('agent__', '')] = val[key];
33548
33621
  });
33549
33622
  return kindWithoutPrefix;
@@ -34786,7 +34859,7 @@ function Launcher() {
34786
34859
  if (!target) {
34787
34860
  return;
34788
34861
  }
34789
- var config = this.data;
34862
+ var config = this.data || {};
34790
34863
  var elementPos = getOffsetPosition(target);
34791
34864
  var dim = getTooltipDimensions(elementPos, this.height, this.width);
34792
34865
  var launcherElement = dom(launcherTooltipDiv);
@@ -35272,6 +35345,10 @@ var initLauncher = function () {
35272
35345
  var loadLauncherPublicFunctions = function (pendo) {
35273
35346
  // fill in exports
35274
35347
  pendo.defaultLauncher = defaultLauncher;
35348
+ _.each(pendo._defaultLauncher_queue, (a) => {
35349
+ defaultLauncher.apply(null, a);
35350
+ });
35351
+ pendo._defaultLauncher_queue = [];
35275
35352
  pendo.toggleLauncher = toggleLauncher;
35276
35353
  pendo.showLauncher = expandLauncherList;
35277
35354
  pendo.hideLauncher = collapseLauncherList;
@@ -35394,7 +35471,7 @@ var P1GuidePlugin = (function () {
35394
35471
  removeBehaviors();
35395
35472
  }
35396
35473
  function removeBehaviors() {
35397
- p1Behaviors.forEach((behavior) => {
35474
+ globalPendo._.each(p1Behaviors, function (behavior) {
35398
35475
  var i = _.indexOf(GuideStepFactory.behaviors, behavior);
35399
35476
  if (i >= 0) {
35400
35477
  GuideStepFactory.behaviors.splice(i, 1);
@@ -35833,7 +35910,7 @@ const EventProperties = (function () {
35833
35910
  function createClickEventProperties(eventPropertyHandler) {
35834
35911
  if (globalPendo.eventProperties && globalPendo.eventProperties.length) {
35835
35912
  const eventProps = createFeatureEventPropertyMap(eventPropertyHandler.target);
35836
- globalPendo._.pairs(eventProps).forEach(([key, value]) => {
35913
+ globalPendo._.each(globalPendo._.pairs(eventProps), ([key, value]) => {
35837
35914
  eventPropertyHandler.addEventProperty(key, value);
35838
35915
  });
35839
35916
  }
@@ -36907,7 +36984,6 @@ class SessionManager {
36907
36984
  return;
36908
36985
  const { visitor_id, old_visitor_id } = identifyEvent.data[0];
36909
36986
  if (visitor_id !== old_visitor_id &&
36910
- !this.pendo.isAnonymousVisitor(visitor_id) &&
36911
36987
  !this.pendo.isAnonymousVisitor(old_visitor_id)) {
36912
36988
  this.expireSession();
36913
36989
  }
@@ -38111,7 +38187,7 @@ class PromptPlugin {
38111
38187
  if (networkAgents.length > 0) {
38112
38188
  this.networkAgents = networkAgents;
38113
38189
  this.patchNetwork(({ method, url, body }) => {
38114
- this.networkAgents.forEach(aiAgent => {
38190
+ this._.each(this.networkAgents, aiAgent => {
38115
38191
  let compiledFilter = null;
38116
38192
  if (aiAgent.privacyFilters) {
38117
38193
  try {
@@ -38254,14 +38330,14 @@ function safelySerializeBody(body) {
38254
38330
  function extractHeaders(headers = {}) {
38255
38331
  const result = {};
38256
38332
  if (headers instanceof Headers) {
38257
- headers.forEach((value, key) => {
38333
+ for (const [key, value] of headers.entries()) {
38258
38334
  result[key] = value;
38259
- });
38335
+ }
38260
38336
  }
38261
38337
  else if (typeof headers === 'object') {
38262
- Object.entries(headers).forEach(([key, value]) => {
38338
+ for (const [key, value] of Object.entries(headers)) {
38263
38339
  result[key] = value;
38264
- });
38340
+ }
38265
38341
  }
38266
38342
  return result;
38267
38343
  }
@@ -38455,9 +38531,9 @@ function lookupGuideButtons(domJson, buttons = []) {
38455
38531
  buttons.push(domJson);
38456
38532
  }
38457
38533
  if (domJson.children) {
38458
- domJson.children.forEach((child) => {
38534
+ for (const child of domJson.children) {
38459
38535
  lookupGuideButtons(child, buttons);
38460
- });
38536
+ }
38461
38537
  }
38462
38538
  return buttons;
38463
38539
  }
@@ -38546,7 +38622,7 @@ const PollBranching = {
38546
38622
  const observer = new MutationObserver(applyBranchingIndicators);
38547
38623
  observer.observe(target, config);
38548
38624
  function applyBranchingIndicators(mutations) {
38549
- mutations.forEach(function (mutation) {
38625
+ pendo._.each(mutations, function (mutation) {
38550
38626
  var _a;
38551
38627
  const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelector);
38552
38628
  if (mutation.addedNodes.length && nodeHasQuerySelector) {
@@ -38694,7 +38770,7 @@ const MetadataSubstitution = {
38694
38770
  const observer = new MutationObserver(applySubstitutionIndicators);
38695
38771
  observer.observe(target, config);
38696
38772
  function applySubstitutionIndicators(mutations) {
38697
- mutations.forEach(function (mutation) {
38773
+ pendo._.each(mutations, function (mutation) {
38698
38774
  var _a;
38699
38775
  if (mutation.addedNodes.length) {
38700
38776
  if (document.querySelector(containerSelector)) {
@@ -38976,7 +39052,7 @@ const RequiredQuestions = {
38976
39052
  }
38977
39053
  }
38978
39054
  function disableEligibleButtons(buttons) {
38979
- buttons.forEach(function (button) {
39055
+ pendo._.each(buttons, function (button) {
38980
39056
  if (step.guideElement.find(`#${button.props.id}`)[0]) {
38981
39057
  step.guideElement.find(`#${button.props.id}`)[0].disabled = true;
38982
39058
  step.guideElement.find(`#${button.props.id}`)[0].parentElement.title = 'Please complete all required questions.';
@@ -38984,7 +39060,7 @@ const RequiredQuestions = {
38984
39060
  });
38985
39061
  }
38986
39062
  function enableEligibleButtons(buttons) {
38987
- buttons.forEach(function (button) {
39063
+ pendo._.each(buttons, function (button) {
38988
39064
  if (step.guideElement.find(`#${button.props.id}`)[0]) {
38989
39065
  step.guideElement.find(`#${button.props.id}`)[0].disabled = false;
38990
39066
  step.guideElement.find(`#${button.props.id}`)[0].parentElement.title = '';
@@ -39010,13 +39086,13 @@ const RequiredQuestions = {
39010
39086
  const observer = new MutationObserver(applyRequiredIndicators);
39011
39087
  observer.observe(target, config);
39012
39088
  function applyRequiredIndicators(mutations) {
39013
- mutations.forEach(function (mutation) {
39089
+ pendo._.each(mutations, function (mutation) {
39014
39090
  var _a;
39015
39091
  const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
39016
39092
  if (mutation.addedNodes.length && nodeHasQuerySelector) {
39017
39093
  let eligiblePolls = mutation.addedNodes[0].querySelectorAll('[class*=-poll-wrapper], [class*=-poll-select-border]');
39018
39094
  if (eligiblePolls) {
39019
- eligiblePolls.forEach(function (poll) {
39095
+ pendo._.each(eligiblePolls, function (poll) {
39020
39096
  let dataPendoPollId;
39021
39097
  if (poll.classList.contains('_pendo-open-text-poll-wrapper') ||
39022
39098
  poll.classList.contains('_pendo-number-scale-poll-wrapper')) {
@@ -39134,7 +39210,7 @@ const SkipToEligibleStep = {
39134
39210
  observer.observe(target, config);
39135
39211
  // create an observer instance
39136
39212
  function applySkipStepIndicator(mutations) {
39137
- mutations.forEach(function (mutation) {
39213
+ pendo._.each(mutations, function (mutation) {
39138
39214
  var _a, _b;
39139
39215
  const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
39140
39216
  if (mutation.addedNodes.length && nodeHasQuerySelector) {
@@ -39199,7 +39275,7 @@ function GuideMarkdown() {
39199
39275
  return;
39200
39276
  guideMarkdown = [PollBranching, MetadataSubstitution, RequiredQuestions, SkipToEligibleStep];
39201
39277
  if (!pendo.designer) {
39202
- guideMarkdown.forEach(script => {
39278
+ pendo._.each(guideMarkdown, function (script) {
39203
39279
  PluginAPI.GlobalRuntime.addGlobalScript(script);
39204
39280
  });
39205
39281
  }
@@ -39207,7 +39283,7 @@ function GuideMarkdown() {
39207
39283
  }
39208
39284
  function teardown() {
39209
39285
  pluginApi.Events.off('designerLaunched', designerLaunchedHandler);
39210
- guideMarkdown.forEach(script => {
39286
+ globalPendo._.each(guideMarkdown, function (script) {
39211
39287
  pluginApi.GlobalRuntime.removeGlobalScript(script);
39212
39288
  });
39213
39289
  }
@@ -39215,7 +39291,7 @@ function GuideMarkdown() {
39215
39291
  addDesignerListeners(guideMarkdown);
39216
39292
  }
39217
39293
  function addDesignerListeners(scripts) {
39218
- scripts.forEach(script => {
39294
+ globalPendo._.each(scripts, function (script) {
39219
39295
  if (script.designerListener) {
39220
39296
  script.designerListener(globalPendo, pluginApi);
39221
39297
  }