@pendo/agent 2.317.1 → 2.318.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.
@@ -3585,7 +3585,7 @@ var ConfigReader = (function () {
3585
3585
  addOption('formValidation', [PENDO_CONFIG_SRC], false);
3586
3586
  // Performance Metrics
3587
3587
  addOption('performanceMetricsEnabled', [SNIPPET_SRC, PENDO_CONFIG_SRC], true);
3588
- addOption('performanceMetricsSampleRate', [SNIPPET_SRC, PENDO_CONFIG_SRC], 0);
3588
+ addOption('performanceMetricsSampleRate', [SNIPPET_SRC, PENDO_CONFIG_SRC], 10);
3589
3589
  }
3590
3590
  initializeOptions();
3591
3591
  var sourceGetters = {};
@@ -3956,8 +3956,8 @@ let SERVER = '';
3956
3956
  let ASSET_HOST = '';
3957
3957
  let ASSET_PATH = '';
3958
3958
  let DESIGNER_SERVER = '';
3959
- let VERSION = '2.317.1_';
3960
- let PACKAGE_VERSION = '2.317.1';
3959
+ let VERSION = '2.318.0_';
3960
+ let PACKAGE_VERSION = '2.318.0';
3961
3961
  let LOADER = 'xhr';
3962
3962
  /* eslint-enable web-sdk-eslint-rules/no-gulp-env-references */
3963
3963
  /**
@@ -5606,6 +5606,8 @@ var Events = (function () {
5606
5606
  new EventType('guidesFailed', [DEBUG, LIFECYCLE]),
5607
5607
  new EventType('guidesLoaded', [DEBUG, LIFECYCLE]),
5608
5608
  new EventType('segmentFlagsUpdated', [DEBUG, LIFECYCLE]),
5609
+ new EventType('segmentFlagsReady', [DEBUG, LIFECYCLE]),
5610
+ new EventType('segmentFlagsError', [DEBUG, LIFECYCLE]),
5609
5611
  new EventType('guideListChanged', [DEBUG, LIFECYCLE]),
5610
5612
  new EventType('guideSeen', [DEBUG, LIFECYCLE]),
5611
5613
  new EventType('guideNotSeen', [DEBUG, LIFECYCLE]),
@@ -13541,6 +13543,11 @@ function setActiveGuides(guideArray) {
13541
13543
  guideIds: _.pluck(guideArray, 'id')
13542
13544
  });
13543
13545
  }
13546
+ function isGuideShown(options = {}) {
13547
+ return _.any(getActiveGuides(options), function (guide) {
13548
+ return guide.isShown();
13549
+ });
13550
+ }
13544
13551
  /*
13545
13552
  * Adding in support for tombstoning Guides that are determined to be *bad*.
13546
13553
  * Bad includes: renderFailed, ?JS throws an exception?, Expired
@@ -13793,11 +13800,15 @@ const internalEvents = {
13793
13800
  guidesFailed: 1,
13794
13801
  guidesLoaded: 1,
13795
13802
  onClickCaptured: 1,
13796
- segmentFlagsUpdated: 1
13803
+ segmentFlagsUpdated: 1,
13804
+ segmentFlagsReady: 1,
13805
+ segmentFlagsError: 1
13797
13806
  };
13798
13807
  const browserEvents = {
13799
13808
  ready: 1,
13800
- segmentFlagsUpdated: 1
13809
+ segmentFlagsUpdated: 1,
13810
+ segmentFlagsReady: 1,
13811
+ segmentFlagsError: 1
13801
13812
  };
13802
13813
  const supportedPublicEvents = [
13803
13814
  'ready',
@@ -13806,6 +13817,8 @@ const supportedPublicEvents = [
13806
13817
  'guidesFailed',
13807
13818
  'guidesLoaded',
13808
13819
  'segmentFlagsUpdated',
13820
+ 'segmentFlagsReady',
13821
+ 'segmentFlagsError',
13809
13822
  'validateGuide',
13810
13823
  'validateLauncher',
13811
13824
  'validateGlobalScript'
@@ -14024,7 +14037,7 @@ var ContentValidation = (function () {
14024
14037
  return q.resolve();
14025
14038
  }
14026
14039
  try {
14027
- return isResourceCenter(guide) ? validateResourceCenter(guide) : validateGuide(guide);
14040
+ return _.isArray(guide) ? validateGuideList(guide) : validateGuide(guide);
14028
14041
  }
14029
14042
  catch (e) {
14030
14043
  Events.contentValidationFail.trigger(guide, e);
@@ -14047,13 +14060,8 @@ var ContentValidation = (function () {
14047
14060
  return false;
14048
14061
  return guideState.status === deny;
14049
14062
  }
14050
- function isResourceCenter(guide) {
14051
- return _.get(guide, 'attributes.resourceCenter.isTopLevel', false);
14052
- }
14053
- function validateResourceCenter(resourceCenter) {
14054
- var modules = BuildingBlockResourceCenter.findResourceCenterModules(resourceCenter, getActiveGuides());
14055
- var resourceCenterAndModules = [resourceCenter].concat(modules);
14056
- return q.all(_.map(resourceCenterAndModules, validateGuide));
14063
+ function validateGuideList(guideList) {
14064
+ return q.all(_.map(guideList, validateGuide));
14057
14065
  }
14058
14066
  function validateGuide(guide) {
14059
14067
  var guideState = state[guide.id];
@@ -14738,13 +14746,16 @@ var GuideRuntime = (function (agentEvents) {
14738
14746
  }
14739
14747
  });
14740
14748
  }
14741
- function getCustomScripts(step, guide, scriptProp = 'script') {
14749
+ function getCustomScripts(step, guide, isPreviewing, scriptProp = 'script') {
14742
14750
  var allScripts = [];
14743
- if (scriptProp === 'script' && _.isFunction(step.script)) {
14751
+ if (scriptProp === 'script' && _.isFunction(step.script) && !isPreviewing) {
14744
14752
  allScripts.push(step.script);
14745
14753
  }
14746
14754
  if (_.size(pluginAddGlobalScripts)) {
14747
14755
  var matches = filterGlobalScripts(pluginAddGlobalScripts, step, guide, scriptProp);
14756
+ if (isPreviewing) {
14757
+ matches = _.filter(matches, (match) => match.designer);
14758
+ }
14748
14759
  _.each(matches, function (match) {
14749
14760
  allScripts.push(match[scriptProp]);
14750
14761
  });
@@ -14755,7 +14766,7 @@ var GuideRuntime = (function (agentEvents) {
14755
14766
  const guide = step.guide;
14756
14767
  if (!guide)
14757
14768
  return;
14758
- return _.all(getCustomScripts(step, guide, 'beforeMount'), function (beforeMount) {
14769
+ return _.all(getCustomScripts(step, guide, false, 'beforeMount'), function (beforeMount) {
14759
14770
  try {
14760
14771
  beforeMount.call(context, evt);
14761
14772
  return !evt.cancel;
@@ -14771,8 +14782,8 @@ var GuideRuntime = (function (agentEvents) {
14771
14782
  }
14772
14783
  });
14773
14784
  }
14774
- function runCustomScripts(step, guide) {
14775
- _.each(getCustomScripts(step, guide), function (script) {
14785
+ function runCustomScripts(step, guide, isPreviewing = false) {
14786
+ _.each(getCustomScripts(step, guide, isPreviewing), function (script) {
14776
14787
  try {
14777
14788
  const context = GuideRuntime.getContext(step);
14778
14789
  script.call(context, step, guide, pendo$1);
@@ -16038,7 +16049,6 @@ var BuildingBlockTooltips = (function () {
16038
16049
  buildBorderCaret,
16039
16050
  determineBorderCaretColor,
16040
16051
  placeBBTooltip,
16041
- attachScrollHandlers,
16042
16052
  isBuildingBlockGuideRelativeToElement,
16043
16053
  positionStepForGuide,
16044
16054
  patchGuideContainerWidthForResponsiveTooltips
@@ -16199,18 +16209,8 @@ var BuildingBlockTooltips = (function () {
16199
16209
  bottom: '100%'
16200
16210
  });
16201
16211
  }
16202
- attachScrollHandlers(step, onscroll);
16203
16212
  return tooltipDiv[0];
16204
16213
  }
16205
- function attachScrollHandlers(step, scrollCallback) {
16206
- if (!step || !_.isFunction(step.attachEvent))
16207
- return;
16208
- if (isPreviewing() && step.element === dom.getBody())
16209
- return;
16210
- const throttledScrollCallback = _.throttle(_.bind(scrollCallback, step, step), 10);
16211
- step.attachEvent(window, 'scroll', throttledScrollCallback, true);
16212
- attachShadowScrollHandlers(_.bind(step.attachEvent, step), step.targetElement, throttledScrollCallback);
16213
- }
16214
16214
  function getBBTooltipDimensions(elementPos, tooltipSizes, caretSizes, layoutDir, screenPos, screenDimensions) {
16215
16215
  var layoutDirection = layoutDir || 'auto';
16216
16216
  var tooltipDimensions = {
@@ -16691,17 +16691,6 @@ var BuildingBlockTooltips = (function () {
16691
16691
  position: elPos.fixed ? 'fixed' : 'absolute'
16692
16692
  });
16693
16693
  }
16694
- function onscroll(step) {
16695
- if (isElementVisible(step.element)) {
16696
- BuildingBlockTooltips.placeBBTooltip(step);
16697
- // show step if element is in view
16698
- dom(step.elements[0]).css({ display: 'block' });
16699
- }
16700
- else {
16701
- // Hide if element is scrolled out of view
16702
- dom(step.elements[0]).css({ display: 'none' });
16703
- }
16704
- }
16705
16694
  function isBuildingBlockGuideRelativeToElement(step) {
16706
16695
  if (!step.domJson || !_.isObject(step.domJson))
16707
16696
  return false;
@@ -17743,9 +17732,6 @@ function buildNodeFromJSON(json, step, guides) {
17743
17732
  var id = json.props && json.props.id;
17744
17733
  // This builds the 4pc backdrop to allow block clicking for any guide without changing how the backdrop is saved
17745
17734
  if (id === 'pendo-backdrop') {
17746
- if (step.attributes && step.attributes.blockOutUI && step.attributes.blockOutUI.enabled) {
17747
- BuildingBlockTooltips.attachScrollHandlers(step, updateBackdrop);
17748
- }
17749
17735
  return buildBackdrop(step);
17750
17736
  }
17751
17737
  _.each(json.props, function (propValue, propKey) {
@@ -18456,10 +18442,14 @@ var BuildingBlockResourceCenter = (function () {
18456
18442
  var promises = _.reduce(resourceCenterModules, function (acc, module) {
18457
18443
  if (!hasFetchContentMethod(module))
18458
18444
  return acc;
18459
- return acc.concat(module.steps[0].fetchContent());
18445
+ var contentPromise = q.resolve(module.steps[0].fetchContent()).catch(function () {
18446
+ module.hasResourceCenterContent = false;
18447
+ log.error('Failed to load content for Resource Center module: ' + module.id);
18448
+ });
18449
+ return acc.concat(contentPromise);
18460
18450
  }, []);
18461
18451
  // capture here
18462
- promises.push(ContentValidation.validate(resourceCenter).then(_.noop, function () {
18452
+ promises.push(ContentValidation.validate([resourceCenter].concat(resourceCenterModules)).then(_.noop, function () {
18463
18453
  // prevent RC badge from displaying if content fails validation
18464
18454
  // (note that validate is a noop if content validation is not enabled)
18465
18455
  resourceCenter.launchMethod = 'api';
@@ -23991,7 +23981,9 @@ var P2AutoLaunch = (function () {
23991
23981
  });
23992
23982
  }
23993
23983
  function removeElement(id) {
23994
- document.getElementById(id) && document.getElementById(id).remove();
23984
+ var el = document.getElementById(id);
23985
+ if (el)
23986
+ el.remove();
23995
23987
  }
23996
23988
  function removePendoComms() {
23997
23989
  var el = document.querySelector('#' + ids.commIframeId + '[src*="pendo"]');
@@ -24534,12 +24526,29 @@ _.extend(PostMessageImpl.prototype, ImplCommon, {
24534
24526
  }
24535
24527
  });
24536
24528
 
24529
+ function getLocationOrigin(window) {
24530
+ const strNull = 'null';
24531
+ const origin = window.location.origin;
24532
+ if (origin === strNull && window.parent && window.parent != window) {
24533
+ try {
24534
+ const parentOrigin = window.parent.location.origin;
24535
+ if (parentOrigin && parentOrigin !== strNull) {
24536
+ return parentOrigin;
24537
+ }
24538
+ }
24539
+ catch (e) {
24540
+ // cross-origin ancestor; cannot read top location
24541
+ }
24542
+ }
24543
+ return origin;
24544
+ }
24545
+
24537
24546
  function createSingletonMessageHandler(window, isTrustedOriginFn) {
24538
24547
  var listeners = [];
24539
24548
  var secure = false;
24540
24549
  return {
24541
24550
  targetOrigin() {
24542
- return secure ? location.origin : '*';
24551
+ return secure ? getLocationOrigin(window) : '*';
24543
24552
  },
24544
24553
  secure(toggle) {
24545
24554
  secure = toggle;
@@ -24923,9 +24932,56 @@ var advanceOnElement = {
24923
24932
  script: attachAdvanceActions
24924
24933
  };
24925
24934
 
24935
+ function isTooltip({ _ }, step) {
24936
+ const tooltip = 'tooltip';
24937
+ return _.get(step, 'attributes.calculatedType') === tooltip ||
24938
+ _.get(step, 'attributes.buildingBlockLayoutType', step.buildingBlockLayoutType) === tooltip ||
24939
+ step.type === tooltip;
24940
+ }
24941
+ function attachScrollHandlers({ _ }, step, scrollCallback) {
24942
+ const throttledScrollCallback = _.throttle(_.bind(scrollCallback, step, step), 10);
24943
+ step.attachEvent(window, 'scroll', throttledScrollCallback, true);
24944
+ attachShadowScrollHandlers(_.bind(step.attachEvent, step), step.targetElement, throttledScrollCallback);
24945
+ }
24946
+ function tooltipOnScroll({ dom }, step, repositionCallback) {
24947
+ if (dom.isElementVisible(step.element)) {
24948
+ repositionCallback(step);
24949
+ dom(step.elements[0]).css({ display: 'block' });
24950
+ }
24951
+ else {
24952
+ dom(step.elements[0]).css({ display: 'none' });
24953
+ }
24954
+ }
24955
+ function bbRepositionTooltip(step) {
24956
+ BuildingBlockTooltips.placeBBTooltip(step);
24957
+ }
24958
+ function p1RepositionTooltip(step) {
24959
+ step.reposition();
24960
+ }
24961
+ function attachStepScrollHandlers(step, guide, pendo) {
24962
+ const { _, dom } = pendo;
24963
+ if (!step || !_.isFunction(step.attachEvent))
24964
+ return;
24965
+ // APP-68789
24966
+ if (isPreviewing() && step.element === dom.getBody())
24967
+ return;
24968
+ if (isTooltip(pendo, step)) {
24969
+ const repositionCallback = step.domJson ? bbRepositionTooltip : p1RepositionTooltip;
24970
+ attachScrollHandlers(pendo, step, _.partial(tooltipOnScroll, pendo, step, repositionCallback));
24971
+ }
24972
+ if (_.get(step, 'attributes.blockOutUI.enabled')) {
24973
+ attachScrollHandlers(pendo, step, updateBackdrop);
24974
+ }
24975
+ }
24976
+ var repositionOnScroll = {
24977
+ designer: true,
24978
+ script: attachStepScrollHandlers
24979
+ };
24980
+
24926
24981
  function registerPostrenderScripts(runtime) {
24927
24982
  _.each([
24928
- advanceOnElement
24983
+ advanceOnElement,
24984
+ repositionOnScroll
24929
24985
  ], (script) => {
24930
24986
  runtime.addGlobalScript(script);
24931
24987
  });
@@ -24969,11 +25025,6 @@ function setSeenTime(time) {
24969
25025
  function getSeenTime() {
24970
25026
  return seenTime;
24971
25027
  }
24972
- var isGuideShown = function (options = {}) {
24973
- return _.any(getActiveGuides(options), function (guide) {
24974
- return guide.isShown();
24975
- });
24976
- };
24977
25028
  var addCloseButton = function (elem, cb) {
24978
25029
  var closeButton = dom('._pendo-close-guide_', elem);
24979
25030
  if (closeButton.length) {
@@ -27730,15 +27781,16 @@ var EventRouter = function () {
27730
27781
  for (var element in guides) {
27731
27782
  if (element && guides[element]) {
27732
27783
  var displayResult = false;
27784
+ var $guideElement = dom(guides[element]);
27733
27785
  // 1st order - partial text match; otherwise hide
27734
- if (dom(guides[element]).text()) {
27735
- if (dom(guides[element]).text().toLowerCase().indexOf(searchText.toLowerCase()) !== -1) {
27736
- dom(guides[element]).css({ display: 'list-item' });
27786
+ if ($guideElement.text()) {
27787
+ if ($guideElement.text().toLowerCase().indexOf(searchText.toLowerCase()) !== -1) {
27788
+ $guideElement.css({ display: 'list-item' });
27737
27789
  noMatches = false;
27738
27790
  displayResult = true;
27739
27791
  }
27740
27792
  else {
27741
- dom(guides[element]).css({ display: 'none' });
27793
+ $guideElement.css({ display: 'none' });
27742
27794
  }
27743
27795
  }
27744
27796
  // 2nd order - all guides that fully match against one of a guides search terms
@@ -27751,7 +27803,7 @@ var EventRouter = function () {
27751
27803
  }
27752
27804
  var isGuideMatch = this.searchAllTerms(allSearchTerms, searchTerms, searchText);
27753
27805
  if (isGuideMatch && guides[element]) {
27754
- dom(guides[element]).css({ display: 'list-item' });
27806
+ $guideElement.css({ display: 'list-item' });
27755
27807
  noMatches = false;
27756
27808
  displayResult = true;
27757
27809
  }
@@ -29048,7 +29100,8 @@ var advanceOn = function (eventType, elementPath) {
29048
29100
  attachEvent(btn, eventType, onEvent, true);
29049
29101
  };
29050
29102
  var smartFirstStep = function () {
29051
- dom('._pendo-guide_').css('display:none;');
29103
+ var $guides = dom('._pendo-guide_');
29104
+ $guides.css('display:none;');
29052
29105
  // look through steps to see which are applicable for the current url.
29053
29106
  var url = getNormalizedUrl();
29054
29107
  var activeObj = getActiveDefaultGuide();
@@ -29061,7 +29114,7 @@ var smartFirstStep = function () {
29061
29114
  }));
29062
29115
  log.info('startingPoint is ' + startingPoint);
29063
29116
  if (startingPoint == -1) {
29064
- dom('._pendo-guide_').css('display:block;');
29117
+ $guides.css('display:block;');
29065
29118
  return;
29066
29119
  }
29067
29120
  var prevStep = steps[Math.max(0, startingPoint - 1)];
@@ -32683,8 +32736,8 @@ function GuideStep(guide) {
32683
32736
  snoozeCanceledGuide(guide.id, step.id, get_visitor_id(), reason, guide.language);
32684
32737
  }
32685
32738
  });
32686
- GuideRuntime.runCustomScripts(step, guide);
32687
32739
  }
32740
+ GuideRuntime.runCustomScripts(step, guide, isPreviewing());
32688
32741
  store.dispatch('frames/guideStepShownInFrame', {
32689
32742
  guideId: guide.id,
32690
32743
  stepId: step.id,
@@ -33955,7 +34008,7 @@ var FramesModule = (function () {
33955
34008
  requests
33956
34009
  };
33957
34010
  function cloneGuide(guide) {
33958
- var clonedGuide = _.pick(guide, 'id', 'name', 'launchMethod', 'isMultiStep', 'steps', 'control', 'lastUpdatedAt', 'language', 'state', 'polls', 'redisplay');
34011
+ var clonedGuide = _.pick(guide, 'id', 'name', 'launchMethod', 'isMultiStep', 'steps', 'control', 'lastUpdatedAt', 'language', 'state', 'polls', 'redisplay', 'channel');
33959
34012
  clonedGuide.attributes = _.pick(guide.attributes, 'overrideAutoThrottling', 'priority', 'isAnnouncement', 'resourceCenter', 'device', 'sharedServiceVersion', 'embedConfig');
33960
34013
  clonedGuide._shouldBeAddedToLauncher = _.isFunction(guide.shouldBeAddedToLauncher) ? guide.shouldBeAddedToLauncher() : (guide._shouldBeAddedToLauncher || false);
33961
34014
  clonedGuide._shouldBeAddedToResourceCenter = _.isFunction(guide.shouldBeAddedToResourceCenter) ? guide.shouldBeAddedToResourceCenter() : (guide._shouldBeAddedToResourceCenter || false);
@@ -34757,6 +34810,17 @@ const NodeAttrModule = (function (global) {
34757
34810
  };
34758
34811
  })();
34759
34812
 
34813
+ function createUrlInstance(url, window) {
34814
+ if (url instanceof URL) {
34815
+ return url;
34816
+ }
34817
+ try {
34818
+ return new URL(url);
34819
+ }
34820
+ catch (e) {
34821
+ }
34822
+ return new URL(url, getLocationOrigin(window));
34823
+ }
34760
34824
  const NetworkUrlModule = (function (global) {
34761
34825
  const state = {
34762
34826
  transforms: []
@@ -34783,7 +34847,7 @@ const NetworkUrlModule = (function (global) {
34783
34847
  getTransformedUrl(state) {
34784
34848
  return function (url) {
34785
34849
  try {
34786
- let urlObj = url instanceof URL ? url : new URL(url, window.location.origin);
34850
+ let urlObj = createUrlInstance(url, window);
34787
34851
  if (_.size(state.transforms) < 1) {
34788
34852
  return urlObj.href;
34789
34853
  }
@@ -36007,9 +36071,7 @@ function Tooltip(guide) {
36007
36071
  };
36008
36072
  this.after('render', function () {
36009
36073
  var step = this;
36010
- if (showTooltipGuide(step, step.elements)) {
36011
- BuildingBlockTooltips.attachScrollHandlers(step, step.onscroll);
36012
- }
36074
+ showTooltipGuide(step, step.elements);
36013
36075
  });
36014
36076
  this.reposition = function () {
36015
36077
  var step = this;
@@ -36039,17 +36101,6 @@ function Tooltip(guide) {
36039
36101
  step.dim = dim;
36040
36102
  addBlockOutUI(step);
36041
36103
  };
36042
- this.onscroll = function (step) {
36043
- if (isElementVisible(step.element)) {
36044
- step.reposition();
36045
- // Show if element is in view
36046
- setStyle(step.elements[0], 'display:block');
36047
- }
36048
- else {
36049
- // Hide if element is scrolled out of view
36050
- setStyle(step.elements[0], 'display:none');
36051
- }
36052
- };
36053
36104
  this.after('hide', function () {
36054
36105
  // clean up from block
36055
36106
  dom('._pendo-guide-tt-region-block_').remove();
@@ -38397,6 +38448,7 @@ const FrustrationEvent = (function () {
38397
38448
  if (!_.contains(frustrationTypes, type)) {
38398
38449
  frustrationTypes.push(type);
38399
38450
  event.frustrationTypes = frustrationTypes;
38451
+ pendoGlobal.buffers.flushLater();
38400
38452
  }
38401
38453
  }
38402
38454
  /**
@@ -38788,23 +38840,35 @@ class SessionManager {
38788
38840
  var SessionManager$1 = new SessionManager();
38789
38841
 
38790
38842
  const SEGMENT_FLAGS_CACHE = 'segmentFlagsCache';
38791
- class SegmentFlags {
38792
- constructor() {
38793
- this.name = 'SegmentFlags';
38794
- }
38795
- initialize(pendo, PluginAPI) {
38843
+ function SegmentFlags() {
38844
+ let globalPendo;
38845
+ let pluginApi;
38846
+ let segmentFlagsEnabled;
38847
+ let mostRecentSegmentsRequest = null;
38848
+ let segmentFlagsReadyFired = false;
38849
+ let segmentFlagsObject = {};
38850
+ let segmentFlagsTimestamp;
38851
+ let segmentFlagsHash;
38852
+ let ready = false;
38853
+ return {
38854
+ name: 'SegmentFlags',
38855
+ initialize,
38856
+ teardown
38857
+ };
38858
+ function initialize(pendo, PluginAPI) {
38796
38859
  const REQUEST_SEGMENT_FLAGS = 'requestSegmentFlags';
38797
- this.pendo = pendo;
38798
- this.api = PluginAPI;
38860
+ globalPendo = pendo;
38861
+ pluginApi = PluginAPI;
38799
38862
  const configReader = PluginAPI.ConfigReader;
38800
38863
  configReader.addOption(REQUEST_SEGMENT_FLAGS, [
38801
38864
  configReader.sources.SNIPPET_SRC,
38802
38865
  configReader.sources.PENDO_CONFIG_SRC
38803
38866
  ], false);
38804
- this.segmentFlagsEnabled = configReader.get(REQUEST_SEGMENT_FLAGS);
38805
- if (!this.segmentFlagsEnabled)
38867
+ segmentFlagsEnabled = configReader.get(REQUEST_SEGMENT_FLAGS);
38868
+ if (!segmentFlagsEnabled)
38806
38869
  return;
38807
- this.mostRecentSegmentsRequest = null;
38870
+ mostRecentSegmentsRequest = null;
38871
+ segmentFlagsReadyFired = false;
38808
38872
  /**
38809
38873
  * Stores the cached segment flags for the current visitor.
38810
38874
  * Cleared on identity change and refreshed from server on page load.
@@ -38817,128 +38881,198 @@ class SegmentFlags {
38817
38881
  PluginAPI.agentStorage.registry.addLocal(SEGMENT_FLAGS_CACHE, {
38818
38882
  isSecure: true,
38819
38883
  localStorageOnly: true,
38884
+ duration: 30 * 24 * 60 * 60 * 1000,
38820
38885
  serializer: JSON.stringify,
38821
38886
  deserializer: SafeJsonDeserializer
38822
38887
  });
38888
+ segmentFlagsObject = {};
38823
38889
  if (shouldPersist()) {
38824
38890
  try {
38825
38891
  const cached = PluginAPI.agentStorage.read(SEGMENT_FLAGS_CACHE);
38826
- if (cached) {
38827
- this.pendo.segmentFlags = cached;
38892
+ if (cached && cached.flags) {
38893
+ segmentFlagsObject = cached.flags;
38894
+ globalPendo.segmentFlags = Object.keys(cached.flags);
38895
+ segmentFlagsTimestamp = cached.timestamp || null;
38896
+ segmentFlagsHash = cached.hash || null;
38897
+ segmentFlagsReadyFired = true;
38898
+ pluginApi.Events.segmentFlagsReady.trigger({
38899
+ flags: globalPendo.segmentFlags,
38900
+ fromCache: true,
38901
+ cacheTimestamp: segmentFlagsTimestamp
38902
+ });
38828
38903
  }
38829
38904
  }
38830
38905
  catch (e) {
38831
- // ignore read errors
38906
+ pluginApi.Events.segmentFlagsError.trigger('Error reading segment flags from cache');
38832
38907
  }
38833
38908
  }
38834
- this.pendo.segmentsPayload = this.pendo._.bind(this.segmentsPayload, this);
38835
- this.handleReadyBound = this.pendo._.bind(this.handleReady, this);
38836
- this.handleIdentityChangeBound = this.pendo._.bind(this.handleIdentityChange, this);
38837
- this.api.Events.ready.on(this.handleReadyBound);
38838
- this.api.Events.identify.on(this.handleIdentityChangeBound);
38839
- this.api.Events.metadata.on(this.handleIdentityChangeBound);
38909
+ globalPendo.getSegmentFlag = getSegmentFlag;
38910
+ globalPendo.segmentsPayload = segmentsPayload;
38911
+ pluginApi.Events.ready.on(handleReady);
38912
+ pluginApi.Events.identify.on(requestSegmentFlags);
38913
+ pluginApi.Events.metadata.on(requestSegmentFlags);
38914
+ pluginApi.Events.eventCaptured.on(handleEventCaptured);
38840
38915
  }
38841
- teardown() {
38842
- if (!this.segmentFlagsEnabled)
38916
+ function teardown() {
38917
+ if (!segmentFlagsEnabled)
38843
38918
  return;
38844
- this.pendo.segmentsPayload = this.pendo._.noop;
38845
- this.api.Events.ready.off(this.handleReadyBound);
38846
- this.api.Events.identify.off(this.handleIdentityChangeBound);
38847
- this.api.Events.metadata.off(this.handleIdentityChangeBound);
38919
+ globalPendo.segmentsPayload = globalPendo._.noop;
38920
+ pluginApi.Events.ready.off(handleReady);
38921
+ pluginApi.Events.identify.off(requestSegmentFlags);
38922
+ pluginApi.Events.metadata.off(requestSegmentFlags);
38923
+ pluginApi.Events.eventCaptured.off(handleEventCaptured);
38924
+ mostRecentSegmentsRequest = null;
38925
+ segmentFlagsReadyFired = false;
38926
+ segmentFlagsObject = {};
38927
+ segmentFlagsTimestamp = null;
38928
+ segmentFlagsHash = null;
38929
+ ready = false;
38848
38930
  }
38849
- handleReady() {
38850
- this.ready = true;
38851
- this.requestSegmentFlags();
38931
+ function handleReady() {
38932
+ ready = true;
38933
+ requestSegmentFlags();
38852
38934
  }
38853
- handleIdentityChange(event) {
38854
- if (this.pendo._.get(event, 'data[0].wasCleared')) {
38855
- this.api.agentStorage.clear(SEGMENT_FLAGS_CACHE);
38856
- delete this.pendo.segmentFlags;
38935
+ function handleEventCaptured(event) {
38936
+ if (!segmentFlagsHash)
38937
+ return;
38938
+ if (!event || !event.data || !event.data.length)
38939
+ return;
38940
+ const capturedEvent = event.data[0];
38941
+ if (capturedEvent && typeof capturedEvent === 'object') {
38942
+ capturedEvent.segmentFlagsHash = segmentFlagsHash;
38857
38943
  }
38858
- this.requestSegmentFlags();
38859
38944
  }
38860
- requestSegmentFlags() {
38861
- if (!this.ready)
38945
+ function requestSegmentFlags() {
38946
+ if (!ready)
38862
38947
  return;
38863
- const segmentRequestId = this.pendo._.uniqueId();
38864
- this.mostRecentSegmentsRequest = segmentRequestId;
38948
+ const segmentRequestId = globalPendo._.uniqueId();
38949
+ mostRecentSegmentsRequest = segmentRequestId;
38865
38950
  const params = {
38866
- visitorId: this.pendo.get_visitor_id(),
38867
- accountId: this.pendo.get_account_id(),
38868
- metadata: this.pendo.getSerializedMetadata(),
38869
- url: this.pendo.url.get()
38951
+ visitorId: globalPendo.get_visitor_id(),
38952
+ accountId: globalPendo.get_account_id(),
38953
+ metadata: globalPendo.getSerializedMetadata(),
38954
+ url: globalPendo.url.get()
38870
38955
  };
38871
- const jzb = this.pendo.compress(params);
38956
+ const jzb = globalPendo.compress(params);
38872
38957
  const queryString = {
38873
38958
  id: segmentRequestId,
38874
38959
  jzb,
38875
- v: this.pendo.VERSION,
38960
+ v: globalPendo.VERSION,
38876
38961
  ct: (new Date()).getTime()
38877
38962
  };
38878
- if (this.api.agent.treatAsAdoptPartner()) {
38879
- this.api.agent.addAccountIdParams(queryString, params.accountId, this.api.ConfigReader.get('oemAccountId'));
38963
+ if (pluginApi.agent.treatAsAdoptPartner()) {
38964
+ pluginApi.agent.addAccountIdParams(queryString, params.accountId, pluginApi.ConfigReader.get('oemAccountId'));
38880
38965
  }
38881
- const endpoint = this.pendo.LOADER === 'script' ? 'segmentflag.js' : 'segmentflag.json';
38882
- let url = this.api.transmit.buildBaseDataUrl(endpoint, this.pendo.apiKey, queryString);
38883
- const jwtOptions = this.api.agent.getJwtInfoCopy();
38966
+ const endpoint = globalPendo.LOADER === 'script' ? 'segmentflag.js' : 'segmentflag.json';
38967
+ let url = pluginApi.transmit.buildBaseDataUrl(endpoint, globalPendo.apiKey, queryString);
38968
+ const jwtOptions = pluginApi.agent.getJwtInfoCopy();
38884
38969
  let payload;
38885
38970
  try {
38886
- if (url.length > this.api.constants.URL_MAX_LENGTH || !this.pendo._.isEmpty(jwtOptions)) {
38971
+ if (url.length > pluginApi.constants.URL_MAX_LENGTH || !globalPendo._.isEmpty(jwtOptions)) {
38887
38972
  delete queryString.jzb;
38888
- url = this.api.transmit.buildBaseDataUrl('segmentflag.json', this.pendo.apiKey, queryString);
38889
- payload = this.pendo._.extend({ events: jzb }, jwtOptions);
38890
- this.postLoad(url, payload);
38973
+ url = pluginApi.transmit.buildBaseDataUrl('segmentflag.json', globalPendo.apiKey, queryString);
38974
+ payload = globalPendo._.extend({ events: jzb }, jwtOptions);
38975
+ postLoad(url, payload);
38891
38976
  }
38892
- else if (this.pendo.LOADER === 'script') {
38893
- this.scriptLoad(url);
38977
+ else if (globalPendo.LOADER === 'script') {
38978
+ scriptLoad(url);
38894
38979
  }
38895
38980
  else {
38896
- this.getLoad(url);
38981
+ getLoad(url);
38897
38982
  }
38898
38983
  }
38899
38984
  catch (err) {
38900
- this.api.log.error('Failed to load segment flags', { error: err });
38985
+ pluginApi.log.error('Failed to load segment flags', { error: err });
38986
+ pluginApi.Events.segmentFlagsError.trigger('Error requesting new segment flags');
38987
+ }
38988
+ }
38989
+ function getSegmentFlag(flagName) {
38990
+ if (segmentFlagsObject && segmentFlagsObject[flagName] !== undefined) {
38991
+ return segmentFlagsObject[flagName];
38901
38992
  }
38993
+ return false;
38902
38994
  }
38903
- segmentsPayload(payload) {
38904
- if (!this.mostRecentSegmentsRequest)
38995
+ function segmentsPayload(payload) {
38996
+ if (!mostRecentSegmentsRequest)
38905
38997
  return;
38906
- if (this.pendo._.isString(payload.id) && payload.id !== this.mostRecentSegmentsRequest)
38998
+ if (globalPendo._.isString(payload.id) && payload.id !== mostRecentSegmentsRequest)
38907
38999
  return;
38908
- const changed = this.flagsChanged(this.pendo.segmentFlags, payload.segmentFlags);
38909
- this.pendo.segmentFlags = payload.segmentFlags;
39000
+ let objectForm = {};
39001
+ let arrayForm = [];
39002
+ if (payload.segmentFlags) {
39003
+ arrayForm = payload.segmentFlags;
39004
+ for (let i = 0; i < arrayForm.length; i++) {
39005
+ objectForm[arrayForm[i]] = true;
39006
+ }
39007
+ }
39008
+ else if (payload.flags) {
39009
+ objectForm = payload.flags;
39010
+ arrayForm = Object.keys(objectForm);
39011
+ }
39012
+ const changed = flagsChanged(segmentFlagsObject, objectForm);
39013
+ globalPendo.segmentFlags = arrayForm;
39014
+ segmentFlagsObject = objectForm;
39015
+ segmentFlagsTimestamp = Date.now();
39016
+ segmentFlagsHash = payload.hash || null;
38910
39017
  if (shouldPersist()) {
38911
- this.api.agentStorage.write(SEGMENT_FLAGS_CACHE, payload.segmentFlags);
39018
+ pluginApi.agentStorage.write(SEGMENT_FLAGS_CACHE, {
39019
+ flags: objectForm,
39020
+ timestamp: segmentFlagsTimestamp,
39021
+ hash: segmentFlagsHash
39022
+ });
39023
+ }
39024
+ if (!segmentFlagsReadyFired) {
39025
+ segmentFlagsReadyFired = true;
39026
+ pluginApi.Events.segmentFlagsReady.trigger({
39027
+ flags: globalPendo.segmentFlags,
39028
+ fromCache: false,
39029
+ cacheTimestamp: segmentFlagsTimestamp
39030
+ });
38912
39031
  }
38913
- if (changed) {
38914
- this.api.Events.segmentFlagsUpdated.trigger(this.pendo.segmentFlags);
39032
+ else if (changed) {
39033
+ pluginApi.Events.segmentFlagsUpdated.trigger(globalPendo.segmentFlags);
38915
39034
  }
38916
- this.api.log.info('successfully loaded segment flags');
38917
- this.mostRecentSegmentsRequest = null;
39035
+ pluginApi.log.info('successfully loaded segment flags');
39036
+ mostRecentSegmentsRequest = null;
38918
39037
  }
38919
- flagsChanged(oldFlags = [], newFlags = []) {
38920
- if (oldFlags.length !== newFlags.length)
39038
+ function flagsChanged(oldFlags = {}, newFlags = {}) {
39039
+ const oldKeys = Object.keys(oldFlags);
39040
+ const newKeys = Object.keys(newFlags);
39041
+ if (oldKeys.length !== newKeys.length)
38921
39042
  return true;
38922
- const intersection = this.pendo._.intersection(oldFlags, newFlags);
38923
- return intersection.length !== oldFlags.length;
39043
+ for (let i = 0; i < oldKeys.length; i++) {
39044
+ const key = oldKeys[i];
39045
+ if (oldFlags[key] !== newFlags[key])
39046
+ return true;
39047
+ }
39048
+ return false;
38924
39049
  }
38925
- scriptLoad(url) {
38926
- this.pendo.loadResource(url, this.pendo._.noop);
39050
+ function scriptLoad(url) {
39051
+ globalPendo.loadResource(url, globalPendo._.noop);
38927
39052
  }
38928
- getLoad(url) {
39053
+ function getLoad(url) {
38929
39054
  return __awaiter(this, void 0, void 0, function* () {
38930
- const response = yield this.pendo.ajax.get(url);
38931
- this.segmentsPayload(response.data);
39055
+ try {
39056
+ const response = yield globalPendo.ajax.get(url);
39057
+ segmentsPayload(response.data);
39058
+ }
39059
+ catch (err) {
39060
+ pluginApi.Events.segmentFlagsError.trigger('Error requesting new segment flags');
39061
+ }
38932
39062
  });
38933
39063
  }
38934
- postLoad(url, payload) {
39064
+ function postLoad(url, payload) {
38935
39065
  return __awaiter(this, void 0, void 0, function* () {
38936
- const response = yield this.pendo.ajax.postJSON(url, payload);
38937
- this.segmentsPayload(response.data);
39066
+ try {
39067
+ const response = yield globalPendo.ajax.postJSON(url, payload);
39068
+ segmentsPayload(response.data);
39069
+ }
39070
+ catch (err) {
39071
+ pluginApi.Events.segmentFlagsError.trigger('Error requesting new segment flags');
39072
+ }
38938
39073
  });
38939
39074
  }
38940
39075
  }
38941
- var SegmentFlags$1 = new SegmentFlags();
38942
39076
 
38943
39077
  const searchProviders = [
38944
39078
  'google',
@@ -40318,7 +40452,7 @@ function registerBuiltInPlugins() {
40318
40452
  registerPlugin(FrustrationEvent);
40319
40453
  registerPlugin(EmbeddedGuides);
40320
40454
  registerPlugin(SessionManager$1);
40321
- registerPlugin(SegmentFlags$1);
40455
+ registerPlugin(SegmentFlags());
40322
40456
  registerPlugin(WebAnalytics$1);
40323
40457
  registerPlugin(FormValidation);
40324
40458
  registerPlugin(PromptAnalytics);
@@ -40509,17 +40643,19 @@ function getDefaultExportFromCjs (x) {
40509
40643
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
40510
40644
  }
40511
40645
 
40512
- const substitutionRegex = '\\{(?:\\s?)([^.\\s]?visitor|account|parentAccount)\\.([^|\\s/]*)(?:\\s?\\|\\s?([^}]+|[\\/s]+))?(?:\\s?\\/\\s?){1}\\}';
40513
- const skipStepString = '{skipStep:* *(auto|\\d+)\\/}';
40514
- const goToMiddleString = '(?!0)(\\d+)';
40515
- const goToString = `({goto-${goToMiddleString}\\/})`;
40516
- const containerSelector = '[id^="pendo-guide-container"]';
40517
- function lookupGuideButtons(domJson, buttons = []) {
40646
+ var substitutionRegex = '\\{(?:\\s?)([^.\\s]?visitor|account|parentAccount)\\.([^|\\s/]*)(?:\\s?\\|\\s?([^}]+|[\\/s]+))?(?:\\s?\\/\\s?){1}\\}';
40647
+ var skipStepString = '{skipStep:* *(auto|\\d+)\\/}';
40648
+ var goToMiddleString = '(?!0)(\\d+)';
40649
+ var goToString = "({goto-".concat(goToMiddleString, "\\/})");
40650
+ var containerSelector = '[id^="pendo-guide-container"]';
40651
+ function lookupGuideButtons(domJson, buttons) {
40652
+ if (buttons === void 0) { buttons = []; }
40518
40653
  if (domJson.type === 'button' && domJson.actions) {
40519
40654
  buttons.push(domJson);
40520
40655
  }
40521
40656
  if (domJson.children) {
40522
- for (const child of domJson.children) {
40657
+ for (var _i = 0, _a = domJson.children; _i < _a.length; _i++) {
40658
+ var child = _a[_i];
40523
40659
  lookupGuideButtons(child, buttons);
40524
40660
  }
40525
40661
  }
@@ -40548,15 +40684,16 @@ function removeMarkdownSyntax(element, textToReplace, replacementText, pendo) {
40548
40684
  }
40549
40685
  }
40550
40686
  var guideMarkdownUtil = {
40551
- substitutionRegex,
40552
- skipStepString,
40553
- goToString,
40554
- containerSelector,
40555
- lookupGuideButtons,
40556
- removeMarkdownSyntax
40687
+ substitutionRegex: substitutionRegex,
40688
+ skipStepString: skipStepString,
40689
+ goToString: goToString,
40690
+ containerSelector: containerSelector,
40691
+ lookupGuideButtons: lookupGuideButtons,
40692
+ removeMarkdownSyntax: removeMarkdownSyntax
40557
40693
  };
40558
40694
 
40559
- function getZoneSafeMethod$1(_, method, target = window) {
40695
+ function getZoneSafeMethod$1(_, method, target) {
40696
+ if (target === void 0) { target = window; }
40560
40697
  var zoneSymbol = '__symbol__';
40561
40698
  /* global Zone */
40562
40699
  if (typeof Zone !== 'undefined' && _.isFunction(Zone[zoneSymbol])) {
@@ -42702,8 +42839,7 @@ function Feedback() {
42702
42839
  if (!widget || !overlay) {
42703
42840
  return;
42704
42841
  }
42705
- var overlayElementToRemove = document.getElementById(elemIds.feedbackOverlay);
42706
- overlayElementToRemove.parentNode.removeChild(overlayElementToRemove);
42842
+ overlay.parentNode.removeChild(overlay);
42707
42843
  }
42708
42844
  function originIsFeedback(origin) {
42709
42845
  if (feedbackLoginHost) {
@@ -48598,11 +48734,11 @@ class SessionRecorderBuffer {
48598
48734
  }
48599
48735
  }
48600
48736
 
48601
- const MAX_RETRY_DELAY_MS = 5 * 60 * 1000; // 5 minutes
48602
- const ONE_HOUR = 60 * 60 * 1000; // 1 hour
48603
- const FAILURE_WINDOW_MS = 2 * ONE_HOUR;
48604
- class SendQueue {
48605
- constructor(sendFn) {
48737
+ var MAX_RETRY_DELAY_MS = 5 * 60 * 1000; // 5 minutes
48738
+ var ONE_HOUR = 60 * 60 * 1000; // 1 hour
48739
+ var FAILURE_WINDOW_MS = 2 * ONE_HOUR;
48740
+ var SendQueue = /** @class */ (function () {
48741
+ function SendQueue(sendFn) {
48606
48742
  this.queue = [];
48607
48743
  this.unloads = new Set();
48608
48744
  this.pending = new Set();
@@ -48610,10 +48746,10 @@ class SendQueue {
48610
48746
  this.firstFailureTime = null;
48611
48747
  this.sendFn = sendFn;
48612
48748
  }
48613
- isEmpty() {
48749
+ SendQueue.prototype.isEmpty = function () {
48614
48750
  return this.queue.length <= 0;
48615
- }
48616
- stop() {
48751
+ };
48752
+ SendQueue.prototype.stop = function () {
48617
48753
  this.queue.length = 0;
48618
48754
  this.unloads.clear();
48619
48755
  this.pending.clear();
@@ -48622,49 +48758,56 @@ class SendQueue {
48622
48758
  this.stopped = true;
48623
48759
  clearTimeout(this.timer);
48624
48760
  delete this.timer;
48625
- }
48626
- start() {
48761
+ };
48762
+ SendQueue.prototype.start = function () {
48627
48763
  this.stopped = false;
48628
- }
48629
- push(...payload) {
48630
- this.queue.push(...payload);
48764
+ };
48765
+ SendQueue.prototype.push = function () {
48766
+ var _a;
48767
+ var payload = [];
48768
+ for (var _i = 0; _i < arguments.length; _i++) {
48769
+ payload[_i] = arguments[_i];
48770
+ }
48771
+ (_a = this.queue).push.apply(_a, payload);
48631
48772
  this.next();
48632
- }
48633
- next() {
48773
+ };
48774
+ SendQueue.prototype.next = function () {
48634
48775
  if (this.queue.length && this.pending.size < 1) {
48635
- const nextPayload = this.queue[0];
48776
+ var nextPayload = this.queue[0];
48636
48777
  return this.send(nextPayload, false, true);
48637
48778
  }
48638
- }
48639
- incrementFailure(payload) {
48640
- const failureCount = (this.failures.get(payload) || 0) + 1;
48779
+ };
48780
+ SendQueue.prototype.incrementFailure = function (payload) {
48781
+ var failureCount = (this.failures.get(payload) || 0) + 1;
48641
48782
  this.failures.set(payload, failureCount);
48642
48783
  if (this.firstFailureTime == null) {
48643
48784
  this.firstFailureTime = new Date().getTime();
48644
48785
  }
48645
48786
  return failureCount;
48646
- }
48647
- pass(payload, dequeue = true) {
48648
- this.unloads.delete(payload);
48649
- this.pending.delete(payload);
48650
- this.failures.delete(payload);
48787
+ };
48788
+ SendQueue.prototype.pass = function (payload, dequeue) {
48789
+ if (dequeue === void 0) { dequeue = true; }
48790
+ this.unloads["delete"](payload);
48791
+ this.pending["delete"](payload);
48792
+ this.failures["delete"](payload);
48651
48793
  this.firstFailureTime = null;
48652
- const index = this.queue.indexOf(payload);
48794
+ var index = this.queue.indexOf(payload);
48653
48795
  if (index >= 0) {
48654
48796
  this.queue.splice(index, 1);
48655
48797
  }
48656
48798
  if (!this.stopped && dequeue) {
48657
48799
  this.next();
48658
48800
  }
48659
- }
48660
- fail(payload, retry = true) {
48661
- this.unloads.delete(payload);
48662
- this.pending.delete(payload);
48663
- const failureCount = this.incrementFailure(payload);
48801
+ };
48802
+ SendQueue.prototype.fail = function (payload, retry) {
48803
+ if (retry === void 0) { retry = true; }
48804
+ this.unloads["delete"](payload);
48805
+ this.pending["delete"](payload);
48806
+ var failureCount = this.incrementFailure(payload);
48664
48807
  if (this.stopped || !retry)
48665
48808
  return;
48666
- const now = new Date().getTime();
48667
- const elapsed = now - (this.firstFailureTime || now);
48809
+ var now = new Date().getTime();
48810
+ var elapsed = now - (this.firstFailureTime || now);
48668
48811
  if (elapsed >= FAILURE_WINDOW_MS) {
48669
48812
  if (this.onTimeout) {
48670
48813
  this.onTimeout();
@@ -48674,33 +48817,38 @@ class SendQueue {
48674
48817
  return;
48675
48818
  }
48676
48819
  this.retryLater(Math.min(Math.pow(2, failureCount - 1) * 1000, MAX_RETRY_DELAY_MS));
48677
- }
48678
- retryNow() {
48820
+ };
48821
+ SendQueue.prototype.retryNow = function () {
48679
48822
  clearTimeout(this.timer);
48680
48823
  delete this.timer;
48681
48824
  this.next();
48682
- }
48683
- retryLater(delay) {
48684
- this.timer = setTimeout$1(() => {
48685
- this.retryNow();
48825
+ };
48826
+ SendQueue.prototype.retryLater = function (delay) {
48827
+ var _this = this;
48828
+ this.timer = setTimeout$1(function () {
48829
+ _this.retryNow();
48686
48830
  }, delay);
48687
- }
48688
- failed() {
48831
+ };
48832
+ SendQueue.prototype.failed = function () {
48689
48833
  return this.failures.get(this.queue[0]) > 0 && this.timer != null;
48690
- }
48691
- send(payload, isUnload, retry) {
48834
+ };
48835
+ SendQueue.prototype.send = function (payload, isUnload, retry) {
48836
+ var _this = this;
48692
48837
  this.pending.add(payload);
48693
48838
  if (isUnload) {
48694
48839
  this.unloads.add(payload);
48695
48840
  }
48696
- return this.sendFn(payload, isUnload, this.failures.get(payload) || 0).then(() => this.pass(payload, retry), () => this.fail(payload, retry));
48697
- }
48698
- drain(finalPayloadArray, isUnload = true) {
48699
- this.queue.push(...finalPayloadArray);
48841
+ return this.sendFn(payload, isUnload, this.failures.get(payload) || 0).then(function () { return _this.pass(payload, retry); }, function () { return _this.fail(payload, retry); });
48842
+ };
48843
+ SendQueue.prototype.drain = function (finalPayloadArray, isUnload) {
48844
+ var _a;
48845
+ if (isUnload === void 0) { isUnload = true; }
48846
+ (_a = this.queue).push.apply(_a, finalPayloadArray);
48700
48847
  if (this.failed() && !this.allowDrainWhileFailed)
48701
48848
  return Promise$2.reject();
48702
- const promises = [];
48703
- for (const payload of this.queue) {
48849
+ var promises = [];
48850
+ for (var _i = 0, _b = this.queue; _i < _b.length; _i++) {
48851
+ var payload = _b[_i];
48704
48852
  if (this.pending.has(payload)) {
48705
48853
  if (this.retryPending && isUnload && !this.unloads.has(payload)) {
48706
48854
  this.incrementFailure(payload); // make sure the request is marked as a retry
@@ -48712,9 +48860,41 @@ class SendQueue {
48712
48860
  }
48713
48861
  }
48714
48862
  return Promise$2.all(promises);
48715
- }
48716
- }
48863
+ };
48864
+ return SendQueue;
48865
+ }());
48717
48866
 
48867
+ /******************************************************************************
48868
+ Copyright (c) Microsoft Corporation.
48869
+
48870
+ Permission to use, copy, modify, and/or distribute this software for any
48871
+ purpose with or without fee is hereby granted.
48872
+
48873
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
48874
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
48875
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
48876
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
48877
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
48878
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
48879
+ PERFORMANCE OF THIS SOFTWARE.
48880
+ ***************************************************************************** */
48881
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
48882
+
48883
+ var extendStatics = function(d, b) {
48884
+ extendStatics = Object.setPrototypeOf ||
48885
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
48886
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
48887
+ return extendStatics(d, b);
48888
+ };
48889
+
48890
+ function __extends(d, b) {
48891
+ if (typeof b !== "function" && b !== null)
48892
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
48893
+ extendStatics(d, b);
48894
+ function __() { this.constructor = d; }
48895
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
48896
+ }
48897
+
48718
48898
  function __rest(s, e) {
48719
48899
  var t = {};
48720
48900
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -51106,7 +51286,8 @@ function randomString(length) {
51106
51286
  }
51107
51287
  return R;
51108
51288
  }
51109
- function getZoneSafeMethod(method, target = window) {
51289
+ function getZoneSafeMethod(method, target) {
51290
+ if (target === void 0) { target = window; }
51110
51291
  return getZoneSafeMethod$1(_, method, target);
51111
51292
  }
51112
51293
  function getIsFiniteImpl(window) {
@@ -51118,10 +51299,10 @@ function getIsFiniteImpl(window) {
51118
51299
  }
51119
51300
  getIsFiniteImpl(window);
51120
51301
 
51121
- let policy;
51122
- const policyOptions = {
51123
- createScriptURL: (str) => str,
51124
- createHTML: (str) => str
51302
+ var policy;
51303
+ var policyOptions = {
51304
+ createScriptURL: function (str) { return str; },
51305
+ createHTML: function (str) { return str; }
51125
51306
  };
51126
51307
  function getPolicy(pendo) {
51127
51308
  if (!policy) {
@@ -53666,7 +53847,8 @@ function wrapSizzle(Sizzle) {
53666
53847
  proxy.matchesSelector = Sizzle.matchesSelector;
53667
53848
  proxy.matches = Sizzle.matches;
53668
53849
  };
53669
- proxy.intercept = function (fn, methodName = 'Sizzle') {
53850
+ proxy.intercept = function (fn, methodName) {
53851
+ if (methodName === void 0) { methodName = 'Sizzle'; }
53670
53852
  proxy[methodName] = _.wrap(proxy[methodName], fn);
53671
53853
  };
53672
53854
  proxy.reset();
@@ -53678,7 +53860,7 @@ function DomData() {
53678
53860
  this.ownerKey = '_pendo_' + randomString(8);
53679
53861
  }
53680
53862
  _.extend(DomData.prototype, {
53681
- cache(owner) {
53863
+ cache: function (owner) {
53682
53864
  if (!_.isObject(owner))
53683
53865
  return {};
53684
53866
  var cache = owner[this.ownerKey];
@@ -53688,15 +53870,15 @@ _.extend(DomData.prototype, {
53688
53870
  }
53689
53871
  return cache;
53690
53872
  },
53691
- set(owner, key, value) {
53873
+ set: function (owner, key, value) {
53692
53874
  var cache = this.cache(owner);
53693
53875
  cache[key] = value;
53694
53876
  return cache;
53695
53877
  },
53696
- get(owner, key) {
53878
+ get: function (owner, key) {
53697
53879
  return key === undefined ? this.cache(owner) : owner[this.ownerKey] && owner[this.ownerKey][key];
53698
53880
  },
53699
- remove(owner, key) {
53881
+ remove: function (owner, key) {
53700
53882
  var cache = this.cache(owner);
53701
53883
  delete cache[key];
53702
53884
  if (key === undefined || _.isEmpty(cache)) {
@@ -53706,6 +53888,67 @@ _.extend(DomData.prototype, {
53706
53888
  });
53707
53889
  new DomData();
53708
53890
 
53891
+ var EventTarget = /** @class */ (function () {
53892
+ function EventTarget() {
53893
+ this.listeners = {};
53894
+ }
53895
+ EventTarget.prototype.addEventListener = function (type, fn) {
53896
+ var listenersForType = this.listeners[type];
53897
+ if (!listenersForType) {
53898
+ listenersForType = [];
53899
+ this.listeners[type] = listenersForType;
53900
+ }
53901
+ var i = _.findIndex(listenersForType, function (listener) { return fn === listener; });
53902
+ if (i < 0) {
53903
+ listenersForType.push(fn);
53904
+ }
53905
+ };
53906
+ EventTarget.prototype.removeEventListener = function (type, fn) {
53907
+ var listenersForType = this.listeners[type];
53908
+ if (!listenersForType)
53909
+ return;
53910
+ var i = _.findIndex(listenersForType, function (listener) { return fn === listener; });
53911
+ if (i >= 0) {
53912
+ listenersForType.splice(i, 1);
53913
+ if (!listenersForType.length) {
53914
+ delete this.listeners[type];
53915
+ }
53916
+ }
53917
+ };
53918
+ EventTarget.prototype.dispatchEvent = function (event) {
53919
+ var listenersForType = this.listeners[event.type];
53920
+ if (!listenersForType)
53921
+ return;
53922
+ _.each(listenersForType, function (listener) {
53923
+ listener(event);
53924
+ });
53925
+ };
53926
+ return EventTarget;
53927
+ }());
53928
+
53929
+ var LogEvent = /** @class */ (function () {
53930
+ function LogEvent(level, message, attributes) {
53931
+ this.type = 'log';
53932
+ this.logged = false;
53933
+ this.level = level;
53934
+ this.message = message;
53935
+ this.attributes = attributes;
53936
+ }
53937
+ LogEvent.prototype.toString = function () {
53938
+ var msg = this.message;
53939
+ if (this.error && msg !== this.error.message) {
53940
+ msg = "".concat(msg, ":").concat(this.error.message);
53941
+ }
53942
+ if (this.attributes) {
53943
+ msg += ": ".concat(_.map(this.attributes, function (value, key) { return "".concat(key, "=").concat(value); }));
53944
+ }
53945
+ return msg;
53946
+ };
53947
+ LogEvent.prototype.hashCode = function () {
53948
+ return this.toString();
53949
+ };
53950
+ return LogEvent;
53951
+ }());
53709
53952
  var LogLevel;
53710
53953
  (function (LogLevel) {
53711
53954
  LogLevel["Debug"] = "debug";
@@ -53714,6 +53957,51 @@ var LogLevel;
53714
53957
  LogLevel["Error"] = "error";
53715
53958
  LogLevel["Critical"] = "critical";
53716
53959
  })(LogLevel || (LogLevel = {}));
53960
+ var LogEmitter = /** @class */ (function (_super) {
53961
+ __extends(LogEmitter, _super);
53962
+ function LogEmitter() {
53963
+ return _super !== null && _super.apply(this, arguments) || this;
53964
+ }
53965
+ LogEmitter.prototype.write = function (message, level, attrs) {
53966
+ this.dispatchEvent(new LogEvent(level, message, attrs));
53967
+ };
53968
+ LogEmitter.prototype.writeError = function (error, level, attrs) {
53969
+ var message;
53970
+ var errorObj;
53971
+ if (_.isString(error)) {
53972
+ message = error;
53973
+ errorObj = { message: message };
53974
+ }
53975
+ else {
53976
+ errorObj = error;
53977
+ message = errorObj.message;
53978
+ }
53979
+ if (attrs && attrs.error) {
53980
+ errorObj = attrs.error;
53981
+ delete attrs.error;
53982
+ }
53983
+ var logEvent = new LogEvent(level, message, attrs);
53984
+ logEvent.error = errorObj;
53985
+ this.dispatchEvent(logEvent);
53986
+ };
53987
+ LogEmitter.prototype.debug = function (message, attrs) {
53988
+ this.write(message, LogLevel.Debug, attrs);
53989
+ };
53990
+ LogEmitter.prototype.info = function (message, attrs) {
53991
+ this.write(message, LogLevel.Info, attrs);
53992
+ };
53993
+ LogEmitter.prototype.warn = function (error, attrs) {
53994
+ this.writeError(error, LogLevel.Warn, attrs);
53995
+ };
53996
+ LogEmitter.prototype.error = function (error, attrs) {
53997
+ this.writeError(error, LogLevel.Error, attrs);
53998
+ };
53999
+ LogEmitter.prototype.critical = function (error, attrs) {
54000
+ this.writeError(error, LogLevel.Critical, attrs);
54001
+ };
54002
+ return LogEmitter;
54003
+ }(EventTarget));
54004
+ new LogEmitter();
53717
54005
 
53718
54006
  function attachEventInternal(element, evt, fn, useCapture) {
53719
54007
  if (!(element && evt && fn)) {
@@ -53722,13 +54010,13 @@ function attachEventInternal(element, evt, fn, useCapture) {
53722
54010
  if (!useCapture)
53723
54011
  useCapture = false;
53724
54012
  if (element.addEventListener) {
53725
- const addEventListener = getZoneSafeMethod('addEventListener', element);
53726
- addEventListener.call(element, evt, fn, useCapture);
54013
+ var addEventListener_1 = getZoneSafeMethod('addEventListener', element);
54014
+ addEventListener_1.call(element, evt, fn, useCapture);
53727
54015
  }
53728
54016
  else if (element.attachEvent) {
53729
54017
  element.attachEvent('on' + evt, fn);
53730
54018
  }
53731
- return () => {
54019
+ return function () {
53732
54020
  detachEventInternal(element, evt, fn, useCapture);
53733
54021
  };
53734
54022
  }
@@ -53739,8 +54027,8 @@ function detachEventInternal(element, evt, fn, useCapture) {
53739
54027
  if (!useCapture)
53740
54028
  useCapture = false;
53741
54029
  if (element.removeEventListener) {
53742
- const removeEventListener = getZoneSafeMethod('removeEventListener', element);
53743
- removeEventListener.call(element, evt, fn, useCapture);
54030
+ var removeEventListener_1 = getZoneSafeMethod('removeEventListener', element);
54031
+ removeEventListener_1.call(element, evt, fn, useCapture);
53744
54032
  }
53745
54033
  else if (element.detachEvent) {
53746
54034
  element.detachEvent('on' + evt, fn);
@@ -55335,12 +55623,12 @@ function createReplayPlugin() {
55335
55623
  * limit of number of keys in an object
55336
55624
  * if an object contains more keys than this limit, we would call its toString function directly
55337
55625
  */
55338
- const NUM_OF_KEYS_LIMIT = 50;
55626
+ var NUM_OF_KEYS_LIMIT = 50;
55339
55627
  /**
55340
55628
  * limit number of depth in an object
55341
55629
  * if an object is too deep, toString process may cause browser OOM
55342
55630
  */
55343
- const DEPTH_OF_LIMIT = 4;
55631
+ var DEPTH_OF_LIMIT = 4;
55344
55632
  /**
55345
55633
  * serialize an HTML element by creating a shallow clone of it with text content
55346
55634
  * and return the resulting outerHTML string (without the subtree)
@@ -55351,8 +55639,8 @@ function serializeHTML(node) {
55351
55639
  if (!node || node.nodeType !== node.ELEMENT_NODE) {
55352
55640
  return '';
55353
55641
  }
55354
- const nodeClone = node.cloneNode(false);
55355
- const { textContent } = node;
55642
+ var nodeClone = node.cloneNode(false);
55643
+ var textContent = node.textContent;
55356
55644
  if (textContent) {
55357
55645
  nodeClone.textContent = textContent;
55358
55646
  }
@@ -55366,7 +55654,7 @@ function isObject(obj) {
55366
55654
  return false;
55367
55655
  if (typeof obj !== 'object')
55368
55656
  return false;
55369
- const proto = Object.getPrototypeOf(obj);
55657
+ var proto = Object.getPrototypeOf(obj);
55370
55658
  return proto === Object.prototype || proto === null;
55371
55659
  }
55372
55660
  /**
@@ -55375,11 +55663,11 @@ function isObject(obj) {
55375
55663
  function isObjTooDeep(obj, limit) {
55376
55664
  if (limit === 0)
55377
55665
  return true;
55378
- const keys = Object.keys(obj);
55666
+ var keys = Object.keys(obj);
55379
55667
  if (keys.length === 0)
55380
55668
  return false;
55381
- return keys.some(key => {
55382
- const value = obj[key];
55669
+ return keys.some(function (key) {
55670
+ var value = obj[key];
55383
55671
  return isObject(value) && isObjTooDeep(value, limit - 1);
55384
55672
  });
55385
55673
  }
@@ -55395,7 +55683,7 @@ function shouldIgnore(_obj) {
55395
55683
  return false;
55396
55684
  }
55397
55685
  // out of keys limit
55398
- const keys = Object.keys(_obj);
55686
+ var keys = Object.keys(_obj);
55399
55687
  if (keys.length > NUM_OF_KEYS_LIMIT) {
55400
55688
  return true;
55401
55689
  }
@@ -55427,7 +55715,7 @@ function stringify(arg) {
55427
55715
  return value.toString ? value.toString() : '[object Object]';
55428
55716
  }
55429
55717
  if (value instanceof ArrayBuffer)
55430
- return `ArrayBuffer { byteLength: ${value.byteLength} }`;
55718
+ return "ArrayBuffer { byteLength: ".concat(value.byteLength, " }");
55431
55719
  if (value instanceof Error)
55432
55720
  return value.name + ': ' + value.message;
55433
55721
  if (value instanceof Node) {
@@ -55435,10 +55723,10 @@ function stringify(arg) {
55435
55723
  }
55436
55724
  // Handle events
55437
55725
  if (value instanceof Event) {
55438
- const eventResult = {};
55726
+ var eventResult = {};
55439
55727
  // eslint-disable-next-line guard-for-in
55440
- for (const eventKey in value) {
55441
- const eventValue = value[eventKey];
55728
+ for (var eventKey in value) {
55729
+ var eventValue = value[eventKey];
55442
55730
  eventResult[eventKey] = Array.isArray(eventValue) && eventValue[0] instanceof HTMLElement
55443
55731
  ? serializeHTML(eventValue[0])
55444
55732
  : eventValue;
@@ -55449,30 +55737,31 @@ function stringify(arg) {
55449
55737
  });
55450
55738
  }
55451
55739
 
55452
- class StackFrame {
55453
- constructor(obj) {
55740
+ var StackFrame = /** @class */ (function () {
55741
+ function StackFrame(obj) {
55454
55742
  this.fileName = obj.fileName || '';
55455
55743
  this.functionName = obj.functionName || '';
55456
55744
  this.lineNumber = obj.lineNumber;
55457
55745
  this.columnNumber = obj.columnNumber;
55458
55746
  }
55459
- toString() {
55460
- const { fileName, functionName, lineNumber = '', columnNumber = '' } = this;
55747
+ StackFrame.prototype.toString = function () {
55748
+ var _a = this, fileName = _a.fileName, functionName = _a.functionName, _b = _a.lineNumber, lineNumber = _b === void 0 ? '' : _b, _c = _a.columnNumber, columnNumber = _c === void 0 ? '' : _c;
55461
55749
  return functionName
55462
- ? `${functionName} (${fileName}:${lineNumber}:${columnNumber})`
55463
- : `${fileName}:${lineNumber}:${columnNumber}`;
55464
- }
55465
- }
55466
- const FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
55467
- const CHROME_EDGE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
55468
- const SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/;
55469
- const LOCATION_REGEXP = /(.+?)(?::(\d+))?(?::(\d+))?$/;
55470
- const DEFAULT_NUM_FRAMES_TO_SKIP = 5;
55471
- const ErrorStackParser = {
55750
+ ? "".concat(functionName, " (").concat(fileName, ":").concat(lineNumber, ":").concat(columnNumber, ")")
55751
+ : "".concat(fileName, ":").concat(lineNumber, ":").concat(columnNumber);
55752
+ };
55753
+ return StackFrame;
55754
+ }());
55755
+ var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
55756
+ var CHROME_EDGE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
55757
+ var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/;
55758
+ var LOCATION_REGEXP = /(.+?)(?::(\d+))?(?::(\d+))?$/;
55759
+ var DEFAULT_NUM_FRAMES_TO_SKIP = 5;
55760
+ var ErrorStackParser = {
55472
55761
  /**
55473
55762
  * Given an Error object, extract the most information from it.
55474
55763
  */
55475
- parse(error, maxFramesToSave) {
55764
+ parse: function (error, maxFramesToSave) {
55476
55765
  if (!(error === null || error === void 0 ? void 0 : error.stack))
55477
55766
  return [];
55478
55767
  // Chrome, Edge, Opera ≥15
@@ -55486,24 +55775,25 @@ const ErrorStackParser = {
55486
55775
  return [];
55487
55776
  },
55488
55777
  // Separate line and column numbers from a string of the form: (URI:Line:Column)
55489
- extractLocation(urlLike) {
55778
+ extractLocation: function (urlLike) {
55490
55779
  // Fail-fast but return locations like "(native)"
55491
55780
  if (urlLike.indexOf(':') === -1) {
55492
55781
  return [urlLike];
55493
55782
  }
55494
- const parts = LOCATION_REGEXP.exec(urlLike.replace(/[()]/g, ''));
55783
+ var parts = LOCATION_REGEXP.exec(urlLike.replace(/[()]/g, ''));
55495
55784
  if (!parts)
55496
- throw new Error(`Cannot parse given url: ${urlLike}`);
55785
+ throw new Error("Cannot parse given url: ".concat(urlLike));
55497
55786
  return [parts[1], parts[2] || undefined, parts[3] || undefined];
55498
55787
  },
55499
- parseHelper({ regex, includeMatchedLine }, error, maxFramesToSave, callback) {
55500
- const lines = error.stack.split('\n');
55501
- const frames = [];
55502
- let validFramesFound = 0;
55503
- for (let i = 0; i < lines.length; i++) {
55504
- const line = lines[i];
55505
- const lineMatchesRegex = regex.test(line);
55506
- const shouldSkipLine = (includeMatchedLine && !lineMatchesRegex) || // if line doesn't match regex and we want matched lines, skip it
55788
+ parseHelper: function (_a, error, maxFramesToSave, callback) {
55789
+ var regex = _a.regex, includeMatchedLine = _a.includeMatchedLine;
55790
+ var lines = error.stack.split('\n');
55791
+ var frames = [];
55792
+ var validFramesFound = 0;
55793
+ for (var i = 0; i < lines.length; i++) {
55794
+ var line = lines[i];
55795
+ var lineMatchesRegex = regex.test(line);
55796
+ var shouldSkipLine = (includeMatchedLine && !lineMatchesRegex) || // if line doesn't match regex and we want matched lines, skip it
55507
55797
  (!includeMatchedLine && lineMatchesRegex); // if line does match regex but we don't want matched lines, skip it
55508
55798
  if (shouldSkipLine)
55509
55799
  continue;
@@ -55518,11 +55808,12 @@ const ErrorStackParser = {
55518
55808
  }
55519
55809
  return frames;
55520
55810
  },
55521
- parseChromiumStack(error, maxFramesToSave) {
55522
- return this.parseHelper({ regex: CHROME_EDGE_STACK_REGEXP, includeMatchedLine: true }, error, maxFramesToSave, (line, frames) => {
55523
- let sanitizedLine;
55811
+ parseChromiumStack: function (error, maxFramesToSave) {
55812
+ var _this = this;
55813
+ return this.parseHelper({ regex: CHROME_EDGE_STACK_REGEXP, includeMatchedLine: true }, error, maxFramesToSave, function (line, frames) {
55814
+ var sanitizedLine;
55524
55815
  if (line.indexOf('(eval ') > -1) {
55525
- const processedLine = line
55816
+ var processedLine = line
55526
55817
  .replace(/eval code/g, 'eval')
55527
55818
  .replace(/(\(eval at [^()]*)|(\),.*$)/g, '');
55528
55819
  sanitizedLine = processedLine.replace(/^\s+/, '').replace(/\(eval code/g, '(');
@@ -55532,7 +55823,7 @@ const ErrorStackParser = {
55532
55823
  }
55533
55824
  // capture and preserve the parenthesized location "(/foo/my bar.js:12:87)"
55534
55825
  // in case it has spaces in it, as the string is split on \s+ later on
55535
- let location;
55826
+ var location;
55536
55827
  if (sanitizedLine.indexOf('(') > -1 && sanitizedLine.indexOf('):') > -1) {
55537
55828
  location = sanitizedLine.match(/ (\((.+):(\d+):(\d+)\)$)/);
55538
55829
  }
@@ -55540,22 +55831,23 @@ const ErrorStackParser = {
55540
55831
  sanitizedLine = location
55541
55832
  ? sanitizedLine.replace(location[0], '')
55542
55833
  : sanitizedLine;
55543
- const tokens = sanitizedLine.split(/\s+/).slice(1);
55834
+ var tokens = sanitizedLine.split(/\s+/).slice(1);
55544
55835
  // if a location was matched, pass it to extractLocation() otherwise pop the last token
55545
- const locationParts = this.extractLocation(location ? location[1] : tokens.pop() || '');
55546
- const functionName = tokens.join(' ') || undefined;
55547
- const fileName = (locationParts[0] === 'eval' || locationParts[0] === '<anonymous>') ? undefined : locationParts[0];
55836
+ var locationParts = _this.extractLocation(location ? location[1] : tokens.pop() || '');
55837
+ var functionName = tokens.join(' ') || undefined;
55838
+ var fileName = (locationParts[0] === 'eval' || locationParts[0] === '<anonymous>') ? undefined : locationParts[0];
55548
55839
  frames.push(new StackFrame({
55549
- functionName,
55550
- fileName,
55840
+ functionName: functionName,
55841
+ fileName: fileName,
55551
55842
  lineNumber: locationParts[1],
55552
55843
  columnNumber: locationParts[2]
55553
55844
  }));
55554
55845
  });
55555
55846
  },
55556
- parseFirefoxSafariStack(error, maxFramesToSave) {
55557
- return this.parseHelper({ regex: SAFARI_NATIVE_CODE_REGEXP, includeMatchedLine: false }, error, maxFramesToSave, (line, frames) => {
55558
- let processedLine = line;
55847
+ parseFirefoxSafariStack: function (error, maxFramesToSave) {
55848
+ var _this = this;
55849
+ return this.parseHelper({ regex: SAFARI_NATIVE_CODE_REGEXP, includeMatchedLine: false }, error, maxFramesToSave, function (line, frames) {
55850
+ var processedLine = line;
55559
55851
  // Throw away eval information until we implement stacktrace.js/stackframe#8
55560
55852
  if (processedLine.indexOf(' > eval') > -1) {
55561
55853
  processedLine = processedLine.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ':$1');
@@ -55567,12 +55859,12 @@ const ErrorStackParser = {
55567
55859
  }));
55568
55860
  return;
55569
55861
  }
55570
- const functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
55571
- const matches = processedLine.match(functionNameRegex);
55572
- const functionName = matches && matches[1] ? matches[1] : undefined;
55573
- const locationParts = this.extractLocation(processedLine.replace(functionNameRegex, ''));
55862
+ var functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
55863
+ var matches = processedLine.match(functionNameRegex);
55864
+ var functionName = matches && matches[1] ? matches[1] : undefined;
55865
+ var locationParts = _this.extractLocation(processedLine.replace(functionNameRegex, ''));
55574
55866
  frames.push(new StackFrame({
55575
- functionName,
55867
+ functionName: functionName,
55576
55868
  fileName: locationParts[0],
55577
55869
  lineNumber: locationParts[1],
55578
55870
  columnNumber: locationParts[2]
@@ -56359,7 +56651,7 @@ var ConfigReader = (function () {
56359
56651
  var PENDO_CONFIG_SRC = 'pendoconfig';
56360
56652
  var GLOBAL_SRC = 'global';
56361
56653
  var DEFAULT_SRC = 'default';
56362
- const optionMap = {};
56654
+ var optionMap = {};
56363
56655
  /*
56364
56656
  * Option Schema
56365
56657
  *
@@ -56377,7 +56669,9 @@ var ConfigReader = (function () {
56377
56669
  *
56378
56670
  * key - Actual config property name. Allows for disambiguation for the same property from different sources
56379
56671
  */
56380
- function addOption(name, sources = [PENDO_CONFIG_SRC], defaultValue, anySource, aliases = []) {
56672
+ function addOption(name, sources, defaultValue, anySource, aliases) {
56673
+ if (sources === void 0) { sources = [PENDO_CONFIG_SRC]; }
56674
+ if (aliases === void 0) { aliases = []; }
56381
56675
  if (!name)
56382
56676
  return;
56383
56677
  if (optionMap[name])
@@ -56387,9 +56681,9 @@ var ConfigReader = (function () {
56387
56681
  aliases = [];
56388
56682
  }
56389
56683
  var opt = {
56390
- name,
56391
- aliases,
56392
- defaultValue,
56684
+ name: name,
56685
+ aliases: aliases,
56686
+ defaultValue: defaultValue,
56393
56687
  supportedSources: sources
56394
56688
  };
56395
56689
  if (anySource != null) {
@@ -57191,7 +57485,7 @@ var ConfigReader = (function () {
57191
57485
  addOption('formValidation', [PENDO_CONFIG_SRC], false);
57192
57486
  // Performance Metrics
57193
57487
  addOption('performanceMetricsEnabled', [SNIPPET_SRC, PENDO_CONFIG_SRC], true);
57194
- addOption('performanceMetricsSampleRate', [SNIPPET_SRC, PENDO_CONFIG_SRC], 0);
57488
+ addOption('performanceMetricsSampleRate', [SNIPPET_SRC, PENDO_CONFIG_SRC], 10);
57195
57489
  }
57196
57490
  initializeOptions();
57197
57491
  var sourceGetters = {};
@@ -57200,13 +57494,13 @@ var ConfigReader = (function () {
57200
57494
  };
57201
57495
  sourceGetters[PENDO_CONFIG_SRC] = function () {
57202
57496
  var lookup = getPendoConfig();
57203
- return { lookup, name: PENDO_CONFIG_SRC };
57497
+ return { lookup: lookup, name: PENDO_CONFIG_SRC };
57204
57498
  };
57205
57499
  sourceGetters[GLOBAL_SRC] = function () {
57206
57500
  return { lookup: pendo, name: GLOBAL_SRC };
57207
57501
  };
57208
57502
  function findOption(name) {
57209
- return optionMap[name] || { name };
57503
+ return optionMap[name] || { name: name };
57210
57504
  }
57211
57505
  function getSupportedSources(option) {
57212
57506
  return _.get(option, 'supportedSources', [SNIPPET_SRC, PENDO_CONFIG_SRC, GLOBAL_SRC]);
@@ -57217,12 +57511,12 @@ var ConfigReader = (function () {
57217
57511
  function getValueFromSourceGetter(option, sourceGetter) {
57218
57512
  if (!sourceGetter)
57219
57513
  return;
57220
- const source = sourceGetter();
57221
- let v = _.get(source.lookup, getConfigKey(option));
57514
+ var source = sourceGetter();
57515
+ var v = _.get(source.lookup, getConfigKey(option));
57222
57516
  // need to also check option aliases if the option.name key is not found in the source
57223
57517
  if (!doesExist(v)) {
57224
- const aliasWithValue = _.find(option.aliases || [], function (alias) {
57225
- const val = _.get(source.lookup, alias);
57518
+ var aliasWithValue = _.find(option.aliases || [], function (alias) {
57519
+ var val = _.get(source.lookup, alias);
57226
57520
  if (doesExist(val))
57227
57521
  return val;
57228
57522
  });
@@ -57287,32 +57581,32 @@ var ConfigReader = (function () {
57287
57581
  }
57288
57582
  /* eslint-disable no-console */
57289
57583
  return {
57290
- audit,
57291
- get(optionName, defaultValue) {
57584
+ audit: audit,
57585
+ get: function (optionName, defaultValue) {
57292
57586
  var result = findActive(optionName, defaultValue);
57293
57587
  return result.value;
57294
57588
  },
57295
- getLocalConfig(optionName, defaultValue) {
57589
+ getLocalConfig: function (optionName, defaultValue) {
57296
57590
  if (!arguments.length) {
57297
57591
  return deepCopy(originalOptions);
57298
57592
  }
57299
57593
  return findActive(optionName, defaultValue, [SNIPPET_SRC]).value;
57300
57594
  },
57301
- getHostedConfig(optionName, defaultValue) {
57595
+ getHostedConfig: function (optionName, defaultValue) {
57302
57596
  return findActive(optionName, defaultValue, [PENDO_CONFIG_SRC]).value;
57303
57597
  },
57304
- addOption,
57305
- setLocalConfig(_originalOptions) {
57598
+ addOption: addOption,
57599
+ setLocalConfig: function (_originalOptions) {
57306
57600
  originalOptions = _originalOptions;
57307
57601
  },
57308
- options: () => { return pluck(optionMap, 'name'); },
57602
+ options: function () { return pluck(optionMap, 'name'); },
57309
57603
  sources: {
57310
- SNIPPET_SRC,
57311
- PENDO_CONFIG_SRC,
57312
- GLOBAL_SRC,
57313
- DEFAULT_SRC
57604
+ SNIPPET_SRC: SNIPPET_SRC,
57605
+ PENDO_CONFIG_SRC: PENDO_CONFIG_SRC,
57606
+ GLOBAL_SRC: GLOBAL_SRC,
57607
+ DEFAULT_SRC: DEFAULT_SRC
57314
57608
  },
57315
- validate(console) {
57609
+ validate: function (console) {
57316
57610
  console.groupCollapsed('Validate Config options');
57317
57611
  each(audit(), function (item) {
57318
57612
  console.log(String(item.active));
@@ -57336,11 +57630,11 @@ function flux(moduleDefinition) {
57336
57630
  var actions = {};
57337
57631
  var store = {
57338
57632
  state: {},
57339
- commit,
57340
- dispatch,
57633
+ commit: commit,
57634
+ dispatch: dispatch,
57341
57635
  subscribe: _.partial(subscribe, mutationSubscribers),
57342
57636
  subscribeAction: _.partial(subscribe, actionSubscribers),
57343
- registerModule,
57637
+ registerModule: registerModule,
57344
57638
  getters: {}
57345
57639
  };
57346
57640
  if (moduleDefinition) {
@@ -57356,7 +57650,7 @@ function flux(moduleDefinition) {
57356
57650
  _.each(mutationSubscribers, function (subscriber) {
57357
57651
  subscriber({
57358
57652
  type: mutationPath,
57359
- payload
57653
+ payload: payload
57360
57654
  }, store.state);
57361
57655
  });
57362
57656
  }
@@ -57369,7 +57663,7 @@ function flux(moduleDefinition) {
57369
57663
  _.each(actionSubscribers, function (subscriber) {
57370
57664
  subscriber({
57371
57665
  type: actionPath,
57372
- payload
57666
+ payload: payload
57373
57667
  }, store.state);
57374
57668
  });
57375
57669
  return returnValue;
@@ -57428,8 +57722,8 @@ function flux(moduleDefinition) {
57428
57722
  var context = {
57429
57723
  state: moduleState,
57430
57724
  rootState: store.state,
57431
- commit,
57432
- dispatch,
57725
+ commit: commit,
57726
+ dispatch: dispatch,
57433
57727
  getters: filterGetters(store.getters, path),
57434
57728
  rootGetters: store.getters
57435
57729
  };
@@ -57478,10 +57772,10 @@ store.subscribe(function (mutation, state) {
57478
57772
  // console.log(mutation, JSON.parse(JSON.stringify(state)));
57479
57773
  });
57480
57774
 
57481
- const EXTENSION_INSTALL_TYPE = 'extension';
57482
- const NATIVE_INSTALL_TYPE = 'native';
57775
+ var EXTENSION_INSTALL_TYPE = 'extension';
57776
+ var NATIVE_INSTALL_TYPE = 'native';
57483
57777
  function getInstallType() {
57484
- const installType = ConfigReader.get('installType') || getPendoConfigFromEnclosingScope().installType;
57778
+ var installType = ConfigReader.get('installType') || getPendoConfigFromEnclosingScope().installType;
57485
57779
  return installType || NATIVE_INSTALL_TYPE;
57486
57780
  }
57487
57781
  function isExtensionAgent() {
@@ -57503,12 +57797,12 @@ function isNativeCode(fn) { return /native/.test(fn); }
57503
57797
  // we've added trident to track this actual version of IE so we can
57504
57798
  // attempt to handle these cases too.
57505
57799
  // holds major version number for IE or NaN for real browsers
57506
- const msie = determineMSIE(getUA());
57800
+ var msie = determineMSIE(getUA());
57507
57801
  determineTrident(getUA(), msie);
57508
57802
  function pint(str) { return parseInt(str, 10); }
57509
57803
  function lowercase(string) { return _.isString(string) ? string.toLowerCase() : string; }
57510
57804
  function isMinimumIEVersion(minVersion) {
57511
- const sniffer = this;
57805
+ var sniffer = this;
57512
57806
  if (isNaN(sniffer.msie) || sniffer.msie == null)
57513
57807
  return true;
57514
57808
  return sniffer.msie >= minVersion;
@@ -57519,33 +57813,33 @@ function getUA() {
57519
57813
  // IE 11 changed the format of the UserAgent string.
57520
57814
  // See http://msdn.microsoft.com/en-us/library/ms537503.aspx
57521
57815
  function determineMSIE(userAgent) {
57522
- let version = pint((/msie (\d+)/.exec(lowercase(userAgent)) || [])[1]);
57816
+ var version = pint((/msie (\d+)/.exec(lowercase(userAgent)) || [])[1]);
57523
57817
  if (isNaN(version)) {
57524
57818
  version = pint((/trident\/.*; rv:(\d+)/.exec(lowercase(userAgent)) || [])[1]);
57525
57819
  }
57526
57820
  return version;
57527
57821
  }
57528
57822
  function determineTrident(userAgent, ieVersion) {
57529
- let version = pint((/trident\/(\d+)/.exec(lowercase(userAgent)) || [])[1]);
57823
+ var version = pint((/trident\/(\d+)/.exec(lowercase(userAgent)) || [])[1]);
57530
57824
  if (isNaN(version) && ieVersion == 7) {
57531
57825
  version = 3;
57532
57826
  }
57533
57827
  return version;
57534
57828
  }
57535
- const eventSupport = {};
57536
- const android = pint((/android (\d+)/.exec(lowercase(getUA())) || [])[1]);
57537
- const boxee = /Boxee/i.test(getUA());
57538
- const pdocument = window.document || {};
57539
- const documentMode = pdocument.documentMode;
57540
- let vendorPrefix;
57541
- const vendorRegex = /^(Moz|webkit|O|ms)(?=[A-Z])/;
57542
- const bodyStyle = pdocument.body && pdocument.body.style;
57543
- let transitions = false;
57544
- let animations = false;
57545
- let match;
57829
+ var eventSupport = {};
57830
+ var android = pint((/android (\d+)/.exec(lowercase(getUA())) || [])[1]);
57831
+ var boxee = /Boxee/i.test(getUA());
57832
+ var pdocument = window.document || {};
57833
+ var documentMode = pdocument.documentMode;
57834
+ var vendorPrefix;
57835
+ var vendorRegex = /^(Moz|webkit|O|ms)(?=[A-Z])/;
57836
+ var bodyStyle = pdocument.body && pdocument.body.style;
57837
+ var transitions = false;
57838
+ var animations = false;
57839
+ var match;
57546
57840
  if (bodyStyle) {
57547
57841
  // eslint-disable-next-line guard-for-in
57548
- for (const prop in bodyStyle) {
57842
+ for (var prop in bodyStyle) {
57549
57843
  match = vendorRegex.exec(prop);
57550
57844
  if (match) {
57551
57845
  vendorPrefix = match[0];
@@ -57563,7 +57857,7 @@ if (bodyStyle) {
57563
57857
  animations = _.isString(pdocument.body.style.webkitAnimation);
57564
57858
  }
57565
57859
  }
57566
- const isChromeExtension = window.chrome && window.chrome.runtime && window.chrome.runtime.id;
57860
+ var isChromeExtension = window.chrome && window.chrome.runtime && window.chrome.runtime.id;
57567
57861
  // Android has history.pushState, but it does not update location correctly
57568
57862
  // so let's not use the history API at all.
57569
57863
  // http://code.google.com/p/android/issues/detail?id=17471
@@ -57571,54 +57865,55 @@ const isChromeExtension = window.chrome && window.chrome.runtime && window.chrom
57571
57865
  // older webkit browser (533.9) on Boxee box has exactly the same problem as Android has
57572
57866
  // so let's not use the history API also
57573
57867
  // We are purposefully using `!(android < 4)` to cover the case when `android` is undefined
57574
- const shouldWrapNativeHistory = _.memoize(function shouldWrapNativeHistory() {
57575
- const hasNativeHistory = window.history && window.history.pushState && window.history.replaceState;
57576
- const isHistoryFrozen = window.history && _.isFunction(Object.isFrozen) && Object.isFrozen(window.history);
57577
- const historyDescriptors = window.history && _.isFunction(Object.getOwnPropertyDescriptors) && Object.getOwnPropertyDescriptors(window.history);
57578
- const isHistoryWriteable = historyDescriptors && _.get(historyDescriptors, 'pushState.writable', true) && _.get(historyDescriptors, 'replaceState.writable', true);
57579
- const hasAndroidSupport = !(android < 4);
57868
+ var shouldWrapNativeHistory = _.memoize(function shouldWrapNativeHistory() {
57869
+ var hasNativeHistory = window.history && window.history.pushState && window.history.replaceState;
57870
+ var isHistoryFrozen = window.history && _.isFunction(Object.isFrozen) && Object.isFrozen(window.history);
57871
+ var historyDescriptors = window.history && _.isFunction(Object.getOwnPropertyDescriptors) && Object.getOwnPropertyDescriptors(window.history);
57872
+ var isHistoryWriteable = historyDescriptors && _.get(historyDescriptors, 'pushState.writable', true) && _.get(historyDescriptors, 'replaceState.writable', true);
57873
+ var hasAndroidSupport = !(android < 4);
57580
57874
  return !!(hasNativeHistory && !isHistoryFrozen && isHistoryWriteable && hasAndroidSupport && !boxee && !isExtensionAgent());
57581
57875
  });
57582
57876
  function shouldWrapHashChange() {
57583
- const hasNativeHashChange = 'onhashchange' in window;
57877
+ var hasNativeHashChange = 'onhashchange' in window;
57584
57878
  // IE8 compatible mode lies
57585
- const hasSupportedDocMode = (!documentMode || documentMode > 7);
57879
+ var hasSupportedDocMode = (!documentMode || documentMode > 7);
57586
57880
  return !!(hasNativeHashChange && hasSupportedDocMode && !isExtensionAgent());
57587
57881
  }
57588
57882
  function isMobileUserAgent() {
57589
57883
  return (/Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i).test(getUA());
57590
57884
  }
57591
- function isSafari(userAgent = getUA()) {
57885
+ function isSafari(userAgent) {
57886
+ if (userAgent === void 0) { userAgent = getUA(); }
57592
57887
  return userAgent.indexOf('Safari') >= 0 && !userAgent.indexOf('Chrome') >= 0;
57593
57888
  }
57594
- const sniffer = {
57889
+ var sniffer = {
57595
57890
  supportsHistoryApi: shouldWrapNativeHistory,
57596
57891
  supportsHashChange: shouldWrapHashChange,
57597
- hasEvent(event) {
57892
+ hasEvent: function (event) {
57598
57893
  // IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have
57599
57894
  // it. In particular the event is not fired when backspace or delete key are pressed or
57600
57895
  // when cut operation is performed.
57601
57896
  if (event == 'input' && msie == 9)
57602
57897
  return false;
57603
57898
  if (_.isUndefined(eventSupport[event])) {
57604
- const divElm = pdocument.createElement('div');
57899
+ var divElm = pdocument.createElement('div');
57605
57900
  eventSupport[event] = 'on' + event in divElm;
57606
57901
  }
57607
57902
  return eventSupport[event];
57608
57903
  },
57609
- vendorPrefix,
57610
- transitions,
57611
- animations,
57612
- android,
57613
- msie,
57904
+ vendorPrefix: vendorPrefix,
57905
+ transitions: transitions,
57906
+ animations: animations,
57907
+ android: android,
57908
+ msie: msie,
57614
57909
  msieDocumentMode: documentMode,
57615
57910
  safari: isSafari(),
57616
57911
  sri: ('integrity' in document.createElement('script')),
57617
57912
  addEventListener: _.isFunction(window.addEventListener),
57618
57913
  MutationObserver: isNativeCode(window.MutationObserver),
57619
- isMinimumIEVersion,
57914
+ isMinimumIEVersion: isMinimumIEVersion,
57620
57915
  isMobileUserAgent: _.memoize(isMobileUserAgent),
57621
- isChromeExtension
57916
+ isChromeExtension: isChromeExtension
57622
57917
  };
57623
57918
 
57624
57919
  var encodeURIComponent = _.isFunction(window.encodeURIComponent) ? window.encodeURIComponent : _.identity;
@@ -57908,16 +58203,16 @@ else {
57908
58203
  function get(url, headers) {
57909
58204
  return ajax({
57910
58205
  method: 'GET',
57911
- url,
57912
- headers
58206
+ url: url,
58207
+ headers: headers
57913
58208
  });
57914
58209
  }
57915
58210
  function post(url, data, headers) {
57916
58211
  return ajax({
57917
58212
  method: 'POST',
57918
- url,
57919
- data,
57920
- headers
58213
+ url: url,
58214
+ data: data,
58215
+ headers: headers
57921
58216
  });
57922
58217
  }
57923
58218
  function postJSON(url, data, headers) {
@@ -57972,11 +58267,11 @@ else {
57972
58267
  ].join('');
57973
58268
  }
57974
58269
  return _.extend(ajax, {
57975
- get,
57976
- post,
57977
- postJSON,
57978
- urlFor,
57979
- supported() {
58270
+ get: get,
58271
+ post: post,
58272
+ postJSON: postJSON,
58273
+ urlFor: urlFor,
58274
+ supported: function () {
57980
58275
  return typeof xhrImpl() !== 'undefined';
57981
58276
  }
57982
58277
  });
@@ -58696,18 +58991,20 @@ function NetworkCapture() {
58696
58991
  }
58697
58992
  }
58698
58993
 
58699
- const PREDICT_STEP_REGEX = /\$\$predict\$\$/;
58700
- const DRAG_THRESHOLD = 5;
58701
- const STYLE_ID = 'pendo-predict-plugin-styles';
58702
- const PREDICT_BASE_URL = 'https://predict.pendo.io';
58703
- const GUIDE_BUTTON_IDENTIFIER = 'button:contains("token")';
58704
- const pluginVersion = '1.0.0';
58705
- const $ = (id) => document.getElementById(id);
58706
- const createElement = (tag, attrs = {}, parent = null) => {
58707
- const el = document.createElement(tag);
58708
- const entries = Object.entries(attrs);
58709
- for (let i = 0; i < entries.length; i++) {
58710
- const [key, value] = entries[i];
58994
+ var PREDICT_STEP_REGEX = /\$\$predict\$\$/;
58995
+ var DRAG_THRESHOLD = 5;
58996
+ var STYLE_ID = 'pendo-predict-plugin-styles';
58997
+ var PREDICT_BASE_URL = 'https://predict.pendo.io';
58998
+ var GUIDE_BUTTON_IDENTIFIER = 'button:contains("token")';
58999
+ var pluginVersion = '1.0.1';
59000
+ var $ = function (id) { return document.getElementById(id); };
59001
+ var createElement = function (tag, attrs, parent) {
59002
+ if (attrs === void 0) { attrs = {}; }
59003
+ if (parent === void 0) { parent = null; }
59004
+ var el = document.createElement(tag);
59005
+ var entries = Object.entries(attrs);
59006
+ for (var i = 0; i < entries.length; i++) {
59007
+ var _a = entries[i], key = _a[0], value = _a[1];
58711
59008
  if (key === 'className')
58712
59009
  el.className = value;
58713
59010
  else if (key === 'innerHTML')
@@ -58719,69 +59016,28 @@ const createElement = (tag, attrs = {}, parent = null) => {
58719
59016
  parent.appendChild(el);
58720
59017
  return el;
58721
59018
  };
58722
- const injectStyles = (pendoContainerId, log = () => { }) => {
58723
- const styleId = `${STYLE_ID}-${pendoContainerId}`;
59019
+ var injectStyles = function (pendoContainerId, log) {
59020
+ if (log === void 0) { log = function () { }; }
59021
+ var styleId = "".concat(STYLE_ID, "-").concat(pendoContainerId);
58724
59022
  if ($(styleId)) {
58725
- log(`[predict] style already exists, skipping: ${styleId}`);
59023
+ log("[predict] style already exists, skipping: ".concat(styleId));
58726
59024
  return;
58727
59025
  }
58728
- log(`[predict] injecting styles: ${styleId}`);
59026
+ log("[predict] injecting styles: ".concat(styleId));
58729
59027
  createElement('style', {
58730
59028
  id: styleId,
58731
- textContent: `
58732
- #${pendoContainerId} {
58733
- display: none !important;
58734
- }
58735
- .frame-explanation {
58736
- aspect-ratio: 16/9; overflow: hidden; min-height: 300px;
58737
- width: 100vw; height: 100vh; background: transparent;
58738
- position: fixed; bottom: 0; right: 0; z-index: 999999; border: none;
58739
- visibility: hidden; opacity: 0; pointer-events: none;
58740
- transition: opacity 0.1s ease-out, visibility 0s linear 0.1s;
58741
- display: none;
58742
- }
58743
- .frame-explanation.is-visible {
58744
- visibility: visible; opacity: 1; pointer-events: auto;
58745
- transition: opacity 0.1s ease-out, visibility 0s linear 0s;
58746
- }
58747
- .frame-explanation.is-exists {
58748
- display: block !important;
58749
- }
58750
- .floating-modal-container {
58751
- position: fixed; top: 20px; right: 20px; z-index: 500000;
58752
- visibility: hidden; opacity: 0; pointer-events: none;
58753
- transition: opacity 0.1s ease-out, visibility 0s linear 0.1s;
58754
- border-radius: 8px; box-shadow: 0px 4px 12px 0px rgba(0,0,0,0.15);
58755
- overflow: hidden; width: 384px; height: 176px;
58756
- }
58757
- .floating-modal-container.is-visible {
58758
- visibility: visible; opacity: 1; pointer-events: auto;
58759
- transition: opacity 0.1s ease-out, visibility 0s linear 0s;
58760
- }
58761
- .floating-modal-container.is-dragging { will-change: left, top; }
58762
- .floating-modal-drag-handle {
58763
- position: absolute; left: 50%; transform: translateX(-50%);
58764
- top: 5px; width: calc(100% - 46px); min-width: 166px; height: 17px;
58765
- z-index: 9999; transition: left 0.2s ease, right 0.2s ease;
58766
- display: flex; justify-content: center; align-items: center;
58767
- }
58768
- .floating-modal-drag-handle svg g { fill: #A0A0A0; }
58769
- .floating-modal-drag-handle:hover { cursor: grab; }
58770
- .floating-modal-drag-handle:hover svg g { fill: #1f2937; }
58771
- .floating-modal-drag-handle.is-dragging { cursor: grabbing; }
58772
- .floating-modal-drag-handle.is-collapsed { top: 0px; }
58773
- .frame-floating-modal { width: 100%; height: 100%; background: white; border: none; display: block; }
58774
- `
59029
+ textContent: "\n #".concat(pendoContainerId, " {\n display: none !important;\n }\n .frame-explanation {\n aspect-ratio: 16/9; overflow: hidden; min-height: 300px;\n width: 100vw; height: 100vh; background: transparent;\n position: fixed; bottom: 0; right: 0; z-index: 999999; border: none;\n visibility: hidden; opacity: 0; pointer-events: none;\n transition: opacity 0.1s ease-out, visibility 0s linear 0.1s;\n display: none;\n }\n .frame-explanation.is-visible {\n visibility: visible; opacity: 1; pointer-events: auto;\n transition: opacity 0.1s ease-out, visibility 0s linear 0s;\n }\n .frame-explanation.is-exists {\n display: block !important;\n }\n .floating-modal-container {\n position: fixed; top: 20px; right: 20px; z-index: 500000;\n visibility: hidden; opacity: 0; pointer-events: none;\n transition: opacity 0.1s ease-out, visibility 0s linear 0.1s;\n border-radius: 8px; box-shadow: 0px 4px 12px 0px rgba(0,0,0,0.15);\n overflow: hidden; width: 384px; height: 176px;\n }\n .floating-modal-container.is-visible {\n visibility: visible; opacity: 1; pointer-events: auto;\n transition: opacity 0.1s ease-out, visibility 0s linear 0s;\n }\n .floating-modal-container.is-dragging { will-change: left, top; }\n .floating-modal-drag-handle {\n position: absolute; left: 50%; transform: translateX(-50%);\n top: 5px; width: calc(100% - 46px); min-width: 166px; height: 17px;\n z-index: 9999; transition: left 0.2s ease, right 0.2s ease;\n display: flex; justify-content: center; align-items: center;\n }\n .floating-modal-drag-handle svg g { fill: #A0A0A0; }\n .floating-modal-drag-handle:hover { cursor: grab; }\n .floating-modal-drag-handle:hover svg g { fill: #1f2937; }\n .floating-modal-drag-handle.is-dragging { cursor: grabbing; }\n .floating-modal-drag-handle.is-collapsed { top: 0px; }\n .frame-floating-modal { width: 100%; height: 100%; background: white; border: none; display: block; }\n ")
58775
59030
  }, document.head);
58776
59031
  };
58777
- const getRecordIdFromUrl = (recordRegex, log = () => { }) => {
59032
+ var getRecordIdFromUrl = function (recordRegex, log) {
58778
59033
  var _a;
58779
- const match = window.location.href.match(recordRegex);
58780
- const recordId = (_a = match === null || match === void 0 ? void 0 : match[1]) !== null && _a !== void 0 ? _a : null;
58781
- log(`[predict] recordId found: ${recordId}`);
59034
+ if (log === void 0) { log = function () { }; }
59035
+ var match = window.location.href.match(recordRegex);
59036
+ var recordId = (_a = match === null || match === void 0 ? void 0 : match[1]) !== null && _a !== void 0 ? _a : null;
59037
+ log("[predict] recordId found: ".concat(recordId));
58782
59038
  return recordId;
58783
59039
  };
58784
- const safeStringify = (value, fallback) => {
59040
+ var safeStringify = function (value, fallback) {
58785
59041
  try {
58786
59042
  return JSON.stringify(value);
58787
59043
  }
@@ -58789,21 +59045,22 @@ const safeStringify = (value, fallback) => {
58789
59045
  return fallback !== null && fallback !== void 0 ? fallback : '';
58790
59046
  }
58791
59047
  };
58792
- const safeParse = (value, fallback, log = () => { }) => {
59048
+ var safeParse = function (value, fallback, log) {
59049
+ if (log === void 0) { log = function () { }; }
58793
59050
  try {
58794
59051
  return JSON.parse(value);
58795
59052
  }
58796
59053
  catch (error) {
58797
- log(`[predict] JSON parse error: ${error}`);
59054
+ log("[predict] JSON parse error: ".concat(error));
58798
59055
  return fallback;
58799
59056
  }
58800
59057
  };
58801
- const buildQueryParams = (params) => {
58802
- const urlParams = new URLSearchParams();
58803
- const entries = Object.entries(params);
59058
+ var buildQueryParams = function (params) {
59059
+ var urlParams = new URLSearchParams();
59060
+ var entries = Object.entries(params);
58804
59061
  urlParams.set('pluginVersion', pluginVersion);
58805
- for (let i = 0; i < entries.length; i++) {
58806
- const [key, value] = entries[i];
59062
+ for (var i = 0; i < entries.length; i++) {
59063
+ var _a = entries[i], key = _a[0], value = _a[1];
58807
59064
  if (value != null) {
58808
59065
  urlParams.set(key, typeof value === 'object' ? safeStringify(value) : String(value));
58809
59066
  }
@@ -58811,17 +59068,17 @@ const buildQueryParams = (params) => {
58811
59068
  return urlParams.toString();
58812
59069
  };
58813
59070
  // ----- Drag & Drop -----
58814
- const setupDragAndDrop = (handle, container) => {
58815
- let isDragging = false;
58816
- let hasMoved = false;
58817
- let isCollapsed = false;
58818
- let startX = 0;
58819
- let startY = 0;
58820
- let initialLeft = 0;
58821
- let initialTop = 0;
58822
- let rafId = null;
58823
- const iframe = container.querySelector('iframe');
58824
- const onMouseDown = (e) => {
59071
+ var setupDragAndDrop = function (handle, container) {
59072
+ var isDragging = false;
59073
+ var hasMoved = false;
59074
+ var isCollapsed = false;
59075
+ var startX = 0;
59076
+ var startY = 0;
59077
+ var initialLeft = 0;
59078
+ var initialTop = 0;
59079
+ var rafId = null;
59080
+ var iframe = container.querySelector('iframe');
59081
+ var onMouseDown = function (e) {
58825
59082
  if (e.button !== 0)
58826
59083
  return;
58827
59084
  e.preventDefault();
@@ -58831,35 +59088,35 @@ const setupDragAndDrop = (handle, container) => {
58831
59088
  container.classList.add('is-dragging');
58832
59089
  if (iframe)
58833
59090
  iframe.style.pointerEvents = 'none';
58834
- const rect = container.getBoundingClientRect();
59091
+ var rect = container.getBoundingClientRect();
58835
59092
  initialLeft = rect.left;
58836
59093
  initialTop = rect.top;
58837
- container.style.left = `${initialLeft}px`;
59094
+ container.style.left = "".concat(initialLeft, "px");
58838
59095
  container.style.right = 'auto';
58839
59096
  startX = e.clientX;
58840
59097
  startY = e.clientY;
58841
59098
  document.addEventListener('mousemove', onMouseMove);
58842
59099
  document.addEventListener('mouseup', onMouseUp);
58843
59100
  };
58844
- const onMouseMove = (e) => {
59101
+ var onMouseMove = function (e) {
58845
59102
  if (!isDragging)
58846
59103
  return;
58847
- const deltaX = e.clientX - startX;
58848
- const deltaY = e.clientY - startY;
59104
+ var deltaX = e.clientX - startX;
59105
+ var deltaY = e.clientY - startY;
58849
59106
  if (Math.abs(deltaX) > DRAG_THRESHOLD || Math.abs(deltaY) > DRAG_THRESHOLD) {
58850
59107
  hasMoved = true;
58851
59108
  }
58852
59109
  if (rafId)
58853
59110
  cancelAnimationFrame(rafId);
58854
- rafId = requestAnimationFrame(() => {
58855
- const rect = container.getBoundingClientRect();
58856
- const newLeft = Math.max(0, Math.min(initialLeft + deltaX, window.innerWidth - rect.width));
58857
- const newTop = Math.max(0, Math.min(initialTop + deltaY, window.innerHeight - rect.height));
58858
- container.style.left = `${newLeft}px`;
58859
- container.style.top = `${newTop}px`;
59111
+ rafId = requestAnimationFrame(function () {
59112
+ var rect = container.getBoundingClientRect();
59113
+ var newLeft = Math.max(0, Math.min(initialLeft + deltaX, window.innerWidth - rect.width));
59114
+ var newTop = Math.max(0, Math.min(initialTop + deltaY, window.innerHeight - rect.height));
59115
+ container.style.left = "".concat(newLeft, "px");
59116
+ container.style.top = "".concat(newTop, "px");
58860
59117
  });
58861
59118
  };
58862
- const onMouseUp = (e) => {
59119
+ var onMouseUp = function (e) {
58863
59120
  var _a;
58864
59121
  if (!isDragging)
58865
59122
  return;
@@ -58877,12 +59134,12 @@ const setupDragAndDrop = (handle, container) => {
58877
59134
  (_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage({ type: 'TRIGGER_EXPAND' }, PREDICT_BASE_URL);
58878
59135
  }
58879
59136
  };
58880
- handle.setCollapsedState = (collapsed) => {
59137
+ handle.setCollapsedState = function (collapsed) {
58881
59138
  isCollapsed = collapsed;
58882
59139
  handle.classList.toggle('is-collapsed', collapsed);
58883
59140
  };
58884
59141
  handle.addEventListener('mousedown', onMouseDown);
58885
- handle.cleanup = () => {
59142
+ handle.cleanup = function () {
58886
59143
  handle.removeEventListener('mousedown', onMouseDown);
58887
59144
  document.removeEventListener('mousemove', onMouseMove);
58888
59145
  document.removeEventListener('mouseup', onMouseUp);
@@ -58892,12 +59149,13 @@ const setupDragAndDrop = (handle, container) => {
58892
59149
  return handle;
58893
59150
  };
58894
59151
  // ----- Explanation Iframe Creation -----
58895
- const createExplanationIframe = ({ analysisId, recordId, configuration }) => {
58896
- var _a;
58897
- const frameId = `frameExplanation-${analysisId}`;
58898
- (_a = $(frameId)) === null || _a === void 0 ? void 0 : _a.remove();
58899
- const base = `${PREDICT_BASE_URL}/external/analysis/${analysisId}/prediction/drilldown/${recordId}`;
58900
- const params = buildQueryParams(configuration);
59152
+ var createExplanationIframe = function (_a) {
59153
+ var _b;
59154
+ var analysisId = _a.analysisId, recordId = _a.recordId, configuration = _a.configuration;
59155
+ var frameId = "frameExplanation-".concat(analysisId);
59156
+ (_b = $(frameId)) === null || _b === void 0 ? void 0 : _b.remove();
59157
+ var base = "".concat(PREDICT_BASE_URL, "/external/analysis/").concat(analysisId, "/prediction/drilldown/").concat(recordId);
59158
+ var params = buildQueryParams(configuration);
58901
59159
  createElement('iframe', {
58902
59160
  id: frameId,
58903
59161
  className: 'frame-explanation',
@@ -58905,28 +59163,24 @@ const createExplanationIframe = ({ analysisId, recordId, configuration }) => {
58905
59163
  loading: 'lazy',
58906
59164
  referrerPolicy: 'strict-origin-when-cross-origin',
58907
59165
  allowFullscreen: true,
58908
- src: `${base}?${params}`
59166
+ src: "".concat(base, "?").concat(params)
58909
59167
  }, document.body);
58910
59168
  };
58911
59169
  // ----- Floating Modal Creation -----
58912
- const createFloatingModal = ({ recordId, configuration }) => {
58913
- var _a;
58914
- const flatIds = (_a = configuration.analysisIds) === null || _a === void 0 ? void 0 : _a.flat(Infinity);
58915
- for (let i = 0; i < flatIds.length; i++) {
58916
- createExplanationIframe({ analysisId: flatIds[i], recordId, configuration });
58917
- }
58918
- const container = createElement('div', { id: 'floatingModalContainer', className: 'floating-modal-container' }, document.body);
58919
- const dragHandle = createElement('div', {
59170
+ var createFloatingModal = function (_a) {
59171
+ var _b;
59172
+ var recordId = _a.recordId, configuration = _a.configuration;
59173
+ var flatIds = (_b = configuration.analysisIds) === null || _b === void 0 ? void 0 : _b.flat(Infinity);
59174
+ for (var i = 0; i < flatIds.length; i++) {
59175
+ createExplanationIframe({ analysisId: flatIds[i], recordId: recordId, configuration: configuration });
59176
+ }
59177
+ var container = createElement('div', { id: 'floatingModalContainer', className: 'floating-modal-container' }, document.body);
59178
+ var dragHandle = createElement('div', {
58920
59179
  className: 'floating-modal-drag-handle',
58921
- innerHTML: `<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
58922
- <g fill="#EBEBEB">
58923
- <circle cx="3.33" cy="6" r="1.5"/><circle cx="8" cy="6" r="1.5"/><circle cx="12.67" cy="6" r="1.5"/>
58924
- <circle cx="3.33" cy="10" r="1.5"/><circle cx="8" cy="10" r="1.5"/><circle cx="12.67" cy="10" r="1.5"/>
58925
- </g>
58926
- </svg>`
59180
+ innerHTML: "<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/svg\">\n <g fill=\"#EBEBEB\">\n <circle cx=\"3.33\" cy=\"6\" r=\"1.5\"/><circle cx=\"8\" cy=\"6\" r=\"1.5\"/><circle cx=\"12.67\" cy=\"6\" r=\"1.5\"/>\n <circle cx=\"3.33\" cy=\"10\" r=\"1.5\"/><circle cx=\"8\" cy=\"10\" r=\"1.5\"/><circle cx=\"12.67\" cy=\"10\" r=\"1.5\"/>\n </g>\n </svg>"
58927
59181
  }, container);
58928
- const baseUrl = `${PREDICT_BASE_URL}/external/analysis/prediction/summary/${recordId}`;
58929
- const params = buildQueryParams(configuration);
59182
+ var baseUrl = "".concat(PREDICT_BASE_URL, "/external/analysis/prediction/summary/").concat(recordId);
59183
+ var params = buildQueryParams(configuration);
58930
59184
  createElement('iframe', {
58931
59185
  id: 'frameFloatingModal',
58932
59186
  className: 'frame-floating-modal',
@@ -58934,133 +59188,136 @@ const createFloatingModal = ({ recordId, configuration }) => {
58934
59188
  referrerPolicy: 'strict-origin-when-cross-origin',
58935
59189
  allowFullscreen: true,
58936
59190
  title: 'Floating Modal',
58937
- src: `${baseUrl}?${params}`
59191
+ src: "".concat(baseUrl, "?").concat(params)
58938
59192
  }, container);
58939
59193
  container.dragHandle = setupDragAndDrop(dragHandle, container);
58940
- return () => {
59194
+ return function () {
58941
59195
  var _a, _b;
58942
59196
  (_b = (_a = container.dragHandle) === null || _a === void 0 ? void 0 : _a.cleanup) === null || _b === void 0 ? void 0 : _b.call(_a);
58943
59197
  container.remove();
58944
- for (let i = 0; i < flatIds.length; i++) {
58945
- const frame = $(`frameExplanation-${flatIds[i]}`);
59198
+ for (var i = 0; i < flatIds.length; i++) {
59199
+ var frame = $("frameExplanation-".concat(flatIds[i]));
58946
59200
  if (frame)
58947
59201
  frame.remove();
58948
59202
  }
58949
59203
  };
58950
59204
  };
58951
- const setupMessageListener = ({ token, cleanup, pendo }) => {
58952
- const messageHandler = ({ origin, data }) => {
58953
- var _a;
59205
+ var setupMessageListener = function (_a) {
59206
+ var token = _a.token, forceAccountId = _a.forceAccountId, cleanup = _a.cleanup, pendo = _a.pendo;
59207
+ var messageHandler = function (_a) {
59208
+ var _b;
59209
+ var origin = _a.origin, data = _a.data;
58954
59210
  if (origin !== PREDICT_BASE_URL || !data || typeof data !== 'object')
58955
59211
  return;
58956
- const { type, analysisId, height, width } = data;
58957
- const explanationFrame = $(`frameExplanation-${analysisId}`);
58958
- const floatingModal = $('floatingModalContainer');
58959
- const setFloatingModalSize = () => {
59212
+ var _c = data, type = _c.type, analysisId = _c.analysisId, height = _c.height, width = _c.width;
59213
+ var explanationFrame = $("frameExplanation-".concat(analysisId));
59214
+ var floatingModal = $('floatingModalContainer');
59215
+ var setFloatingModalSize = function () {
58960
59216
  if (floatingModal) {
58961
- floatingModal.style.height = `${height}px`;
58962
- floatingModal.style.width = `${width}px`;
59217
+ floatingModal.style.height = "".concat(height, "px");
59218
+ floatingModal.style.width = "".concat(width, "px");
58963
59219
  }
58964
59220
  };
58965
- const setFloatingModalCollapsedState = (collapsed) => {
59221
+ var setFloatingModalCollapsedState = function (collapsed) {
58966
59222
  var _a, _b;
58967
59223
  if (floatingModal)
58968
59224
  (_b = (_a = floatingModal.dragHandle) === null || _a === void 0 ? void 0 : _a.setCollapsedState) === null || _b === void 0 ? void 0 : _b.call(_a, collapsed);
58969
59225
  };
58970
- const actions = {
58971
- MODAL_INITIALIZED: () => {
59226
+ var actions = {
59227
+ MODAL_INITIALIZED: function () {
58972
59228
  var _a, _b, _c;
58973
- const iframe = $('frameFloatingModal');
59229
+ var iframe = $('frameFloatingModal');
58974
59230
  if (iframe) {
58975
- let idToken = null;
58976
- let extensionAPIKeys = null;
58977
- const retrieveIDPToken = pendo.getConfigValue('retrieveIDPToken');
59231
+ var idToken = null;
59232
+ var extensionAPIKeys = null;
59233
+ var retrieveIDPToken = pendo.getConfigValue('retrieveIDPToken');
58978
59234
  if (pendo._.isFunction(retrieveIDPToken)) {
58979
- const result = retrieveIDPToken();
59235
+ var result = retrieveIDPToken();
58980
59236
  if (result) {
58981
59237
  idToken = result.idToken;
58982
59238
  extensionAPIKeys = result.extensionAPIKeys;
58983
59239
  }
58984
59240
  }
58985
- const visitorId = (_a = pendo === null || pendo === void 0 ? void 0 : pendo.getVisitorId) === null || _a === void 0 ? void 0 : _a.call(pendo);
58986
- const accountId = (_b = pendo === null || pendo === void 0 ? void 0 : pendo.getAccountId) === null || _b === void 0 ? void 0 : _b.call(pendo);
58987
- (_c = iframe.contentWindow) === null || _c === void 0 ? void 0 : _c.postMessage({ type: 'TOKEN_RECEIVED', token, idToken, extensionAPIKeys, visitorId, accountId }, PREDICT_BASE_URL);
59241
+ var visitorId = (_a = pendo === null || pendo === void 0 ? void 0 : pendo.getVisitorId) === null || _a === void 0 ? void 0 : _a.call(pendo);
59242
+ var accountId = forceAccountId !== null && forceAccountId !== void 0 ? forceAccountId : (_b = pendo === null || pendo === void 0 ? void 0 : pendo.getAccountId) === null || _b === void 0 ? void 0 : _b.call(pendo);
59243
+ (_c = iframe.contentWindow) === null || _c === void 0 ? void 0 : _c.postMessage({ type: 'TOKEN_RECEIVED', token: token, idToken: idToken, extensionAPIKeys: extensionAPIKeys, visitorId: visitorId, accountId: accountId }, PREDICT_BASE_URL);
58988
59244
  }
58989
59245
  },
58990
- OPEN_EXPLANATION: () => {
59246
+ OPEN_EXPLANATION: function () {
58991
59247
  var _a;
58992
59248
  explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.add('is-visible');
58993
59249
  (_a = explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(data, PREDICT_BASE_URL);
58994
59250
  },
58995
- CLOSE_EXPLANATION: () => explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.remove('is-visible'),
58996
- AUTH_ERROR_EXPLANATION: () => {
59251
+ CLOSE_EXPLANATION: function () { return explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.remove('is-visible'); },
59252
+ AUTH_ERROR_EXPLANATION: function () {
58997
59253
  explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.remove('is-visible');
58998
- const iframe = $('frameFloatingModal');
59254
+ var iframe = $('frameFloatingModal');
58999
59255
  // eslint-disable-next-line no-self-assign
59000
59256
  if (iframe)
59001
59257
  iframe.src = iframe.src;
59002
59258
  },
59003
- DATA_READY: () => {
59259
+ DATA_READY: function () {
59004
59260
  floatingModal === null || floatingModal === void 0 ? void 0 : floatingModal.classList.add('is-visible');
59005
59261
  setFloatingModalSize();
59006
59262
  // Use analysisIds from the message data if available, otherwise use all IDs
59007
- const idsToShow = data.analysisIds || [];
59008
- for (let i = 0; i < idsToShow.length; i++) {
59009
- const frame = $(`frameExplanation-${idsToShow[i]}`);
59263
+ var idsToShow = data.analysisIds || [];
59264
+ for (var i = 0; i < idsToShow.length; i++) {
59265
+ var frame = $("frameExplanation-".concat(idsToShow[i]));
59010
59266
  if (frame)
59011
59267
  frame.classList.add('is-exists');
59012
59268
  }
59013
59269
  },
59014
- AUTH_ERROR: () => {
59270
+ AUTH_ERROR: function () {
59015
59271
  floatingModal === null || floatingModal === void 0 ? void 0 : floatingModal.classList.add('is-visible');
59016
59272
  setFloatingModalSize();
59017
59273
  },
59018
59274
  CLOSE_FLOATING_MODAL: cleanup,
59019
- EXPAND_FLOATING_MODAL: () => {
59275
+ EXPAND_FLOATING_MODAL: function () {
59020
59276
  setFloatingModalSize();
59021
59277
  setFloatingModalCollapsedState(false);
59022
59278
  },
59023
- COLLAPSE_FLOATING_MODAL: () => {
59279
+ COLLAPSE_FLOATING_MODAL: function () {
59024
59280
  setFloatingModalSize();
59025
59281
  setFloatingModalCollapsedState(true);
59026
59282
  }
59027
59283
  };
59028
59284
  if (type && type in actions) {
59029
- (_a = actions === null || actions === void 0 ? void 0 : actions[type]) === null || _a === void 0 ? void 0 : _a.call(actions);
59285
+ (_b = actions === null || actions === void 0 ? void 0 : actions[type]) === null || _b === void 0 ? void 0 : _b.call(actions);
59030
59286
  }
59031
59287
  };
59032
59288
  window.addEventListener('message', messageHandler);
59033
- return () => window.removeEventListener('message', messageHandler);
59289
+ return function () { return window.removeEventListener('message', messageHandler); };
59034
59290
  };
59035
- const predictGuidesScript = ({ step, pendo, cleanupArray, cleanup, log }) => {
59036
- var _a;
59291
+ var predictGuidesScript = function (_a) {
59292
+ var _b;
59293
+ var step = _a.step, pendo = _a.pendo, cleanupArray = _a.cleanupArray, cleanup = _a.cleanup, log = _a.log;
59037
59294
  log('[predict] initializing');
59038
59295
  // Before anything else, inject styles so that the guide will be hidden
59039
- const pendoContainerId = step === null || step === void 0 ? void 0 : step.containerId;
59296
+ var pendoContainerId = step === null || step === void 0 ? void 0 : step.containerId;
59040
59297
  injectStyles(pendoContainerId, log);
59041
59298
  if (cleanupArray.length > 0) {
59042
59299
  log('[predict] cleanupArray is not empty');
59043
59300
  return;
59044
59301
  }
59045
59302
  // ----- Extract Configuration -----
59046
- const guideButton = (_a = step.guideElement.find(GUIDE_BUTTON_IDENTIFIER)) === null || _a === void 0 ? void 0 : _a[0];
59303
+ var guideButton = (_b = step.guideElement.find(GUIDE_BUTTON_IDENTIFIER)) === null || _b === void 0 ? void 0 : _b[0];
59047
59304
  if (!guideButton) {
59048
59305
  log('[predict] no guide button found, aborting');
59049
59306
  return;
59050
59307
  }
59051
- const _b = safeParse(guideButton.textContent, {}, log), { token } = _b, configuration = __rest(_b, ["token"]);
59308
+ var _c = safeParse(guideButton.textContent, {}, log), token = _c.token, configuration = __rest(_c, ["token"]);
59052
59309
  if (!configuration || !token) {
59053
59310
  log('[predict] no configuration found, aborting');
59054
59311
  return;
59055
59312
  }
59056
- const recordRegex = new RegExp(`/${configuration.recordRegexName}/([a-zA-Z0-9]+)(?:/|$)`);
59057
- const recordId = getRecordIdFromUrl(recordRegex, log);
59313
+ var recordRegex = new RegExp("/".concat(configuration.recordRegexName, "/([a-zA-Z0-9]+)(?:/|$)"));
59314
+ var recordId = getRecordIdFromUrl(recordRegex, log);
59058
59315
  if (!recordId) {
59059
59316
  log('[predict] no recordId found in URL, aborting');
59060
59317
  return;
59061
59318
  }
59062
- cleanupArray.push(setupMessageListener({ token, cleanup, pendo }));
59063
- cleanupArray.push(createFloatingModal({ recordId, configuration }));
59319
+ cleanupArray.push(setupMessageListener({ token: token, forceAccountId: configuration === null || configuration === void 0 ? void 0 : configuration.forceAccountId, cleanup: cleanup, pendo: pendo }));
59320
+ cleanupArray.push(createFloatingModal({ recordId: recordId, configuration: configuration }));
59064
59321
  };
59065
59322
 
59066
59323
  const PredictGuides = () => {