@pendo/agent 2.275.0 → 2.276.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.
@@ -3891,8 +3891,8 @@ var SERVER = '';
3891
3891
  var ASSET_HOST = '';
3892
3892
  var ASSET_PATH = '';
3893
3893
  var DESIGNER_ENV = '';
3894
- var VERSION = '2.275.0_';
3895
- var PACKAGE_VERSION = '2.275.0';
3894
+ var VERSION = '2.276.0_';
3895
+ var PACKAGE_VERSION = '2.276.0';
3896
3896
  var LOADER = 'xhr';
3897
3897
  /* eslint-enable agent-eslint-rules/no-gulp-env-references */
3898
3898
  /**
@@ -11185,6 +11185,221 @@ DomQuery.$ = {
11185
11185
  }
11186
11186
  };
11187
11187
 
11188
+ /**
11189
+ * Abstraction on top of Mutation Observer that has a naive polyfill to use setTimeout and look
11190
+ * every half second for changes.
11191
+ *
11192
+ * This observer only attempts to verify changes to `isInDocument` status for all "observed" elements.
11193
+ * The side effect of changing status is left to the element and any code owning said element to handle.
11194
+ */
11195
+ var DomObserver = /** @class */ (function () {
11196
+ function DomObserver(container, config) {
11197
+ if (container === void 0) { container = getBody(); }
11198
+ if (config === void 0) { config = { 'attributes': true, 'childList': true, 'subtree': true }; }
11199
+ var _this = this;
11200
+ this.listeners = [];
11201
+ this._teardown = function () { };
11202
+ if (sniffer.MutationObserver) {
11203
+ var MutationObserver_1 = getZoneSafeMethod('MutationObserver');
11204
+ var observer_1 = new MutationObserver_1(function (mutationList, observer) {
11205
+ _this.signal();
11206
+ });
11207
+ observer_1.observe(container, config);
11208
+ this._teardown = function () { return observer_1.disconnect; };
11209
+ }
11210
+ else {
11211
+ var handle_1 = setTimeout$1(function () {
11212
+ _this.signal();
11213
+ }, 500);
11214
+ this._teardown = function () {
11215
+ clearTimeout(handle_1);
11216
+ };
11217
+ }
11218
+ }
11219
+ DomObserver.prototype.signal = function () {
11220
+ _.each(this.listeners, function (el) {
11221
+ el.get();
11222
+ });
11223
+ };
11224
+ DomObserver.prototype.addObservers = function () {
11225
+ var elements = [];
11226
+ for (var _i = 0; _i < arguments.length; _i++) {
11227
+ elements[_i] = arguments[_i];
11228
+ }
11229
+ this.listeners = [].concat(this.listeners, elements);
11230
+ };
11231
+ DomObserver.prototype.teardown = function () {
11232
+ this._teardown();
11233
+ };
11234
+ return DomObserver;
11235
+ }());
11236
+
11237
+ function WeakRefFactory() {
11238
+ function WeakRef(obj) {
11239
+ this._object = obj;
11240
+ }
11241
+
11242
+ WeakRef.prototype.deref = function() {
11243
+ return this._object;
11244
+ };
11245
+
11246
+ return WeakRef;
11247
+ }
11248
+
11249
+ var WeakRef = (function(global, factory) {
11250
+ var nativeWeakRef = global.WeakRef;
11251
+ if (typeof nativeWeakRef !== 'function' || !/native/.test(nativeWeakRef)) {
11252
+ return factory();
11253
+ }
11254
+
11255
+ return nativeWeakRef;
11256
+ })(window, WeakRefFactory);
11257
+
11258
+ function getText(elem, limit) {
11259
+ var ret = '';
11260
+ var nodeType = elem.nodeType;
11261
+ var sub;
11262
+ limit = limit || 128;
11263
+ if (nodeType === TEXT || nodeType === CDATA_SECTION) {
11264
+ return elem.nodeValue;
11265
+ }
11266
+ else if (!isElemBlacklisted(elem) &&
11267
+ (nodeType === ELEMENT ||
11268
+ nodeType === DOCUMENT ||
11269
+ nodeType === DOCUMENT_FRAGMENT)) {
11270
+ // Traverse its children
11271
+ if (!elem.childNodes)
11272
+ return ret;
11273
+ for (var i = 0; i < elem.childNodes.length; ++i) {
11274
+ var child = elem.childNodes[i];
11275
+ sub = getText(child, limit - ret.length);
11276
+ if ((ret + sub).length >= limit) {
11277
+ return ret + trimSurrogate(sub.substring(0, limit - ret.length));
11278
+ }
11279
+ ret += sub;
11280
+ }
11281
+ }
11282
+ return ret;
11283
+ }
11284
+ function isElemBlacklisted(elem) {
11285
+ return !elem.tagName || elem.tagName.toLowerCase() == 'textarea';
11286
+ }
11287
+ /**
11288
+ * Determine if the supplied {codepoint} falls within the "high surrogate" range
11289
+ * of unicode characters.
11290
+ *
11291
+ * @access private
11292
+ * @param {number} codepoint
11293
+ * @returns {boolean}
11294
+ * @see https://en.wikipedia.org/wiki/UTF-16#U.2BD800_to_U.2BDFFF
11295
+ */
11296
+ function isHighSurrogate(codepoint) {
11297
+ return (0xD800 <= codepoint && codepoint <= 0xDBFF);
11298
+ }
11299
+ /**
11300
+ * Determine if the supplied {codepoint} falls within the "low surrogate" range
11301
+ * of unicode characters.
11302
+ *
11303
+ * @access private
11304
+ * @param {number} codepoint
11305
+ * @returns {boolean}
11306
+ * @see https://en.wikipedia.org/wiki/UTF-16#U.2BD800_to_U.2BDFFF
11307
+ */
11308
+ function isLowSurrogate(codepoint) {
11309
+ return (0xDC00 <= codepoint && codepoint <= 0xDFFF);
11310
+ }
11311
+ /**
11312
+ * Remove "high surrogate" or unmatched "low surrogate" characters from the end
11313
+ * of {s}, indicating a broken unicode glyph. This happens when we truncate the
11314
+ * text of a node in {getText} that ends with a double-byte-encoded unicode glyph
11315
+ * such as emoji.
11316
+ *
11317
+ * @access private
11318
+ * @see https://github.com/pendo-io/pendo-client/pull/12
11319
+ * @param {string} s
11320
+ * @returns {string} s if no trailing surrogates, s-1 otherwise
11321
+ */
11322
+ function trimSurrogate(s) {
11323
+ // If the string is empty, it's definitely _not_ a "lonely surrogate"...
11324
+ if (s.length < 1)
11325
+ return s;
11326
+ var last = s.slice(-1).charCodeAt(0);
11327
+ // We're only interested in the `last` character...
11328
+ if (!isHighSurrogate(last) && !isLowSurrogate(last))
11329
+ return s;
11330
+ // If the string is only 1 character, that surrogate is definitely "lonely"...
11331
+ if (s.length === 1)
11332
+ return s.slice(0, -1);
11333
+ // All "lonely high surrogates" shall be eradicated...
11334
+ if (isHighSurrogate(last))
11335
+ return s.slice(0, -1);
11336
+ // Not sure how "lonely low surrogate" could happen, but let's check!
11337
+ if (isLowSurrogate(last)) {
11338
+ // Per above, the `last` character isn't the _only_ character...
11339
+ var prev = s.slice(-2).charCodeAt(0);
11340
+ // And if the `prev` character isn't a "high surrogate", that "low surrogate" is lonely.
11341
+ if (!isHighSurrogate(prev))
11342
+ return s.slice(0, -1);
11343
+ }
11344
+ return s; // otherwise leave it alone
11345
+ }
11346
+
11347
+ var ElementGetter = /** @class */ (function () {
11348
+ function ElementGetter(cssSelector) {
11349
+ this.listeners = {}; // callbacks to be called when an event of type occurs
11350
+ this.events = []; // event types this element listens for
11351
+ this.cssSelector = cssSelector;
11352
+ }
11353
+ ElementGetter.prototype.get = function () {
11354
+ var _this = this;
11355
+ var el = this.elRef && this.elRef.deref();
11356
+ var isInDoc = isInDocument(el); // is this safe to call if el is null?
11357
+ if (el && isInDoc)
11358
+ return el;
11359
+ if (el && !isInDoc) {
11360
+ return undefined;
11361
+ }
11362
+ el = dom(this.cssSelector)[0];
11363
+ if (!el) {
11364
+ return undefined;
11365
+ }
11366
+ _.each(this.events, function (evtType) {
11367
+ el.addEventListener(evtType, function (e) { return _this.onEvent(e); });
11368
+ });
11369
+ this.elRef = new WeakRef(el);
11370
+ return el;
11371
+ };
11372
+ ElementGetter.prototype.getText = function (limit) {
11373
+ if (limit === void 0) { limit = 1024; }
11374
+ // XXX not sure about size limit
11375
+ return getText(this.get(), limit);
11376
+ };
11377
+ ElementGetter.prototype.addEventListener = function (event, callback) {
11378
+ var _this = this;
11379
+ var el = this.get();
11380
+ if (this.events.indexOf(event) < 0) {
11381
+ this.events.push(event);
11382
+ if (el) {
11383
+ el.addEventListener(event, function (e) { return _this.onEvent(e); });
11384
+ }
11385
+ }
11386
+ this.listeners[event] = this.listeners[event]
11387
+ ? this.listeners[event].push(callback) : [].concat(callback);
11388
+ };
11389
+ ElementGetter.prototype.onEvent = function (evt) {
11390
+ var type = evt.type;
11391
+ _.each(this.listeners[type], function (cb) { return cb(evt); });
11392
+ };
11393
+ ElementGetter.prototype.teardown = function () {
11394
+ var _this = this;
11395
+ var el = this.get();
11396
+ if (el) {
11397
+ _.each(this.events, function (evtType) { return el.removeEventListener(evtType, _this.onEvent); });
11398
+ }
11399
+ };
11400
+ return ElementGetter;
11401
+ }());
11402
+
11188
11403
  _.extend(dom, {
11189
11404
  'data': DomData$1,
11190
11405
  'event': DomEvent,
@@ -11199,6 +11414,8 @@ _.extend(dom, {
11199
11414
  'intersectRect': intersectRect,
11200
11415
  'getScrollParent': getScrollParent,
11201
11416
  'isElementVisible': isElementVisible,
11417
+ 'Observer': DomObserver,
11418
+ 'Element': ElementGetter,
11202
11419
  'scrollIntoView': scrollIntoView,
11203
11420
  'getRootNode': getRootNode
11204
11421
  });
@@ -11217,17 +11434,17 @@ function isTrustedOrigin(host) {
11217
11434
  return true;
11218
11435
  // Domains that Pendo owns
11219
11436
  var patterns = [
11220
- /^https:\/\/(app|via|adopt)(\.eu|\.us|\.jpn|\.hsbc|\.au)?\.pendo\.io$/,
11437
+ /^https:\/\/(app|via|adopt)(\.eu|\.us|\.gov|\.jpn|\.hsbc|\.au)?\.pendo\.io$/,
11221
11438
  /^https:\/\/((adopt\.)?us1\.)?(app|via|adopt)\.pendo\.io$/,
11222
- /^https:\/\/([0-9]{8}t[0-9]{4}-dot-)pendo-(io|eu|us1|jp-prod|hsbc|au)\.appspot\.com$/,
11223
- /^https:\/\/hotfix-(ops|app)-([0-9]+-dot-)pendo-(io|eu|us1|jp-prod|hsbc|au)\.appspot\.com$/,
11224
- /^https:\/\/pendo-(io|eu|us1|jp-prod|hsbc|au)-static\.storage\.googleapis\.com$/,
11225
- /^https:\/\/(us1\.)?cdn(\.eu|\.jpn|\.hsbc|\.au)?\.pendo\.io$/
11439
+ /^https:\/\/([0-9]{8}t[0-9]{4}-dot-)pendo-(io|eu|us1|govramp|jp-prod|hsbc|au)\.appspot\.com$/,
11440
+ /^https:\/\/hotfix-(ops|app)-([0-9]+-dot-)pendo-(io|eu|us1|govramp|jp-prod|hsbc|au)\.appspot\.com$/,
11441
+ /^https:\/\/pendo-(io|eu|us1|govramp|jp-prod|hsbc|au)-static\.storage\.googleapis\.com$/,
11442
+ /^https:\/\/(us1\.)?cdn(\.eu|\.jpn|\.gov|\.hsbc|\.au)?\.pendo\.io$/
11226
11443
  ];
11227
11444
  if (!isProdAgent()) {
11228
11445
  patterns = patterns.concat([
11229
11446
  /^https:\/\/([a-zA-Z0-9-]+\.)*pendo-dev\.com$/,
11230
- /^https:\/\/([a-zA-Z0-9-]+-dot-)?pendo-(dev|test|io|us1|jp-prod|hsbc|au|batman|magic|atlas|wildlings|ionchef|mobile-guides|mobile-hummus|mobile-fbi|mobile-plat|eu|eu-dev|apollo|security|perfserf|freeze|armada|voc|mcfly|calypso|dap|scrum-ops|ml|helix|uat)\.appspot\.com$/,
11447
+ /^https:\/\/([a-zA-Z0-9-]+-dot-)?pendo-(dev|test|io|us1|govramp|jp-prod|hsbc|au|batman|magic|atlas|wildlings|ionchef|mobile-guides|mobile-hummus|mobile-fbi|mobile-plat|eu|eu-dev|apollo|security|perfserf|freeze|armada|voc|mcfly|calypso|dap|scrum-ops|ml|helix|uat)\.appspot\.com$/,
11231
11448
  /^https:\/\/via\.pendo\.local:\d{4}$/,
11232
11449
  /^https:\/\/adopt\.pendo\.local:\d{4}$/,
11233
11450
  /^https:\/\/local\.pendo\.io:\d{4}$/,
@@ -11524,16 +11741,16 @@ function validateModuleURL(moduleURL) {
11524
11741
  allowedPaths['/modules/pendo.designer/plugins/' + file] = 1;
11525
11742
  allowedPaths['/engage-app-ui/assets/classic-designer/plugins/' + file] = 1;
11526
11743
  });
11527
- moduleURL = moduleURL.replace(/^https:\/\//, '');
11528
- var origin = moduleURL.substring(0, moduleURL.indexOf('/'));
11529
- var path = moduleURL.substring(moduleURL.indexOf('/'));
11530
- return isTrustedOrigin('https://' + origin) && !!allowedPaths[path];
11531
- }
11532
- function ensureHttps(moduleURL) {
11533
- return moduleURL.replace(/^[a-zA-Z-:]*\/\//, 'https://');
11744
+ try {
11745
+ var fileUrl = new URL(moduleURL);
11746
+ return isTrustedOrigin(fileUrl.origin) && !!allowedPaths[fileUrl.pathname];
11747
+ }
11748
+ catch (e) {
11749
+ log.debug('Invalid module URL: ' + moduleURL);
11750
+ return false;
11751
+ }
11534
11752
  }
11535
11753
  var moduleLoader = function (moduleURL) {
11536
- moduleURL = ensureHttps(moduleURL);
11537
11754
  if (!validateModuleURL(moduleURL))
11538
11755
  return;
11539
11756
  modulesWaiting.push(moduleURL);
@@ -14561,7 +14778,7 @@ var GuideRuntime = (function (agentEvents) {
14561
14778
  if (_.isFunction(globalScript[scriptProp])) {
14562
14779
  if (_.isFunction(globalScript.test)) {
14563
14780
  try {
14564
- return globalScript.test(step, guide);
14781
+ return globalScript.test(step, guide, pendo$1);
14565
14782
  }
14566
14783
  catch (e) {
14567
14784
  log.critical('Error in global script test code block', { 'error': e });
@@ -14613,7 +14830,7 @@ var GuideRuntime = (function (agentEvents) {
14613
14830
  _.each(getCustomScripts(step, guide), function (script) {
14614
14831
  try {
14615
14832
  var context_1 = GuideRuntime.getContext(step);
14616
- script.call(context_1, step, guide);
14833
+ script.call(context_1, step, guide, pendo$1);
14617
14834
  }
14618
14835
  catch (err) {
14619
14836
  log.critical('Exception thrown running code block for: ' + JSON.stringify({
@@ -23299,7 +23516,7 @@ function createCrossFrameChannel(store) {
23299
23516
  return createTopFrameRelay(store, window, SingletonMessageHandler);
23300
23517
  }
23301
23518
 
23302
- function onTurbolinksPageLoad(document, onPageLoad) {
23519
+ function onTurbolinksPageLoad(document, onPageLoad, beforeTurboCache) {
23303
23520
  var Turbolinks = window.Turbolinks, Turbo = window.Turbo;
23304
23521
  var turboLinksPageLoad;
23305
23522
  // Special case guide reloading for troublesome Rails component:
@@ -23312,7 +23529,14 @@ function onTurbolinksPageLoad(document, onPageLoad) {
23312
23529
  if (Turbo && Turbo.visit) {
23313
23530
  turboLinksPageLoad = 'turbo:load';
23314
23531
  }
23315
- return turboLinksPageLoad ? attachEventInternal(document, turboLinksPageLoad, onPageLoad) : function () { };
23532
+ if (!turboLinksPageLoad)
23533
+ return function () { };
23534
+ var detachOnPageLoad = attachEventInternal(document, turboLinksPageLoad, onPageLoad);
23535
+ var detachBeforeTurboCache = attachEventInternal(document, 'turbo:before-cache', beforeTurboCache);
23536
+ return function () {
23537
+ detachOnPageLoad();
23538
+ detachBeforeTurboCache();
23539
+ };
23316
23540
  }
23317
23541
 
23318
23542
  var EMPTY_ARRAY_JZB = 'eJwFwIEIAAAAwDDQd3-N1QABFQC5';
@@ -25172,11 +25396,14 @@ var initGuides = function () {
25172
25396
  var guideIds = event.data[0].guideIds;
25173
25397
  pruneBadges(guideIds);
25174
25398
  });
25175
- teardownFns.push(onTurbolinksPageLoad(document, function () {
25399
+ teardownFns.push(onTurbolinksPageLoad(document, function onPageLoad() {
25176
25400
  if (pendoDotUrl.get() === reloadGuides.lastUrl) {
25177
25401
  // Force a reload if Turbolinks replaces the document body without changing the url
25178
25402
  forceGuideReload();
25179
25403
  }
25404
+ }, function beforeTurboCache() {
25405
+ // Prevent Turbo from caching and re-rendering displayed guides
25406
+ resetPendoUI();
25180
25407
  }));
25181
25408
  // Override tooltip size from options hash
25182
25409
  var arrowSize = ConfigReader.get('guides.tooltip.arrowSize');
@@ -26209,7 +26436,8 @@ var PluginAPI = {
26209
26436
  },
26210
26437
  'agentStorage': agentStorage,
26211
26438
  'analytics': {
26212
- 'ptm': function () { return eventQueue; }
26439
+ 'ptm': function () { return eventQueue; },
26440
+ 'collectEvent': collectEvent
26213
26441
  },
26214
26442
  'attachEvent': attachEvent,
26215
26443
  'ConfigReader': ConfigReader,
@@ -27499,95 +27727,6 @@ var BuildingBlockGuides = (function () {
27499
27727
  }
27500
27728
  })();
27501
27729
 
27502
- function getText(elem, limit) {
27503
- var ret = '';
27504
- var nodeType = elem.nodeType;
27505
- var sub;
27506
- limit = limit || 128;
27507
- if (nodeType === TEXT || nodeType === CDATA_SECTION) {
27508
- return elem.nodeValue;
27509
- }
27510
- else if (!isElemBlacklisted(elem) &&
27511
- (nodeType === ELEMENT ||
27512
- nodeType === DOCUMENT ||
27513
- nodeType === DOCUMENT_FRAGMENT)) {
27514
- // Traverse its children
27515
- if (!elem.childNodes)
27516
- return ret;
27517
- for (var i = 0; i < elem.childNodes.length; ++i) {
27518
- var child = elem.childNodes[i];
27519
- sub = getText(child, limit - ret.length);
27520
- if ((ret + sub).length >= limit) {
27521
- return ret + trimSurrogate(sub.substring(0, limit - ret.length));
27522
- }
27523
- ret += sub;
27524
- }
27525
- }
27526
- return ret;
27527
- }
27528
- function isElemBlacklisted(elem) {
27529
- return !elem.tagName || elem.tagName.toLowerCase() == 'textarea';
27530
- }
27531
- /**
27532
- * Determine if the supplied {codepoint} falls within the "high surrogate" range
27533
- * of unicode characters.
27534
- *
27535
- * @access private
27536
- * @param {number} codepoint
27537
- * @returns {boolean}
27538
- * @see https://en.wikipedia.org/wiki/UTF-16#U.2BD800_to_U.2BDFFF
27539
- */
27540
- function isHighSurrogate(codepoint) {
27541
- return (0xD800 <= codepoint && codepoint <= 0xDBFF);
27542
- }
27543
- /**
27544
- * Determine if the supplied {codepoint} falls within the "low surrogate" range
27545
- * of unicode characters.
27546
- *
27547
- * @access private
27548
- * @param {number} codepoint
27549
- * @returns {boolean}
27550
- * @see https://en.wikipedia.org/wiki/UTF-16#U.2BD800_to_U.2BDFFF
27551
- */
27552
- function isLowSurrogate(codepoint) {
27553
- return (0xDC00 <= codepoint && codepoint <= 0xDFFF);
27554
- }
27555
- /**
27556
- * Remove "high surrogate" or unmatched "low surrogate" characters from the end
27557
- * of {s}, indicating a broken unicode glyph. This happens when we truncate the
27558
- * text of a node in {getText} that ends with a double-byte-encoded unicode glyph
27559
- * such as emoji.
27560
- *
27561
- * @access private
27562
- * @see https://github.com/pendo-io/pendo-client/pull/12
27563
- * @param {string} s
27564
- * @returns {string} s if no trailing surrogates, s-1 otherwise
27565
- */
27566
- function trimSurrogate(s) {
27567
- // If the string is empty, it's definitely _not_ a "lonely surrogate"...
27568
- if (s.length < 1)
27569
- return s;
27570
- var last = s.slice(-1).charCodeAt(0);
27571
- // We're only interested in the `last` character...
27572
- if (!isHighSurrogate(last) && !isLowSurrogate(last))
27573
- return s;
27574
- // If the string is only 1 character, that surrogate is definitely "lonely"...
27575
- if (s.length === 1)
27576
- return s.slice(0, -1);
27577
- // All "lonely high surrogates" shall be eradicated...
27578
- if (isHighSurrogate(last))
27579
- return s.slice(0, -1);
27580
- // Not sure how "lonely low surrogate" could happen, but let's check!
27581
- if (isLowSurrogate(last)) {
27582
- // Per above, the `last` character isn't the _only_ character...
27583
- var prev = s.slice(-2).charCodeAt(0);
27584
- // And if the `prev` character isn't a "high surrogate", that "low surrogate" is lonely.
27585
- if (!isHighSurrogate(prev))
27586
- return s.slice(0, -1);
27587
- }
27588
- return s; // otherwise leave it alone
27589
- }
27590
-
27591
27730
  var activeContexts;
27592
27731
  var logOverride;
27593
27732
  var MAX_HISTORY = 100;
@@ -27601,7 +27740,7 @@ var getDefaultLogOverride = function (env) {
27601
27740
  return isEnabledCookie == 'true';
27602
27741
  }
27603
27742
  // add welcome message and list logging status + contexts
27604
- return !_.contains(['prod', 'prod-eu', 'prod-us1', 'prod-jp', 'prod-hsbc', 'prod-au', 'rc'], env);
27743
+ return !_.contains(['prod', 'prod-eu', 'prod-us1', 'prod-jp', 'prod-hsbc', 'prod-au', 'prod-gov', 'rc'], env);
27605
27744
  };
27606
27745
  var getDefaultActiveContexts = function () {
27607
27746
  var ac = agentStorage.read(ACTIVE_CONTEXTS, true);
@@ -35237,7 +35376,9 @@ var ActionAutomation = (function () {
35237
35376
  if (valueDescriptor && typeof valueDescriptor.set === 'function') {
35238
35377
  valueDescriptor.set.call(element, value); // ensures React ≥ 15.6.1 updates value in state
35239
35378
  }
35240
- element.value = value;
35379
+ else {
35380
+ element.value = value;
35381
+ }
35241
35382
  var inputEvent = new InputEvent('input', { 'bubbles': true, 'data': value[value.length - 1] });
35242
35383
  inputEvent.simulated = true; // for React ≤ 15.6.0
35243
35384
  element.dispatchEvent(inputEvent);
@@ -37274,6 +37415,9 @@ var FormValidation = (function () {
37274
37415
  pendo.attachEvent(document, 'input', debouncedValidate);
37275
37416
  }
37276
37417
  function teardown() {
37418
+ if (!pluginApi) {
37419
+ return;
37420
+ }
37277
37421
  if (designerModeCheckInterval) {
37278
37422
  clearInterval(designerModeCheckInterval);
37279
37423
  designerModeCheckInterval = null;
@@ -37535,6 +37679,168 @@ var FormValidation = (function () {
37535
37679
  }
37536
37680
  })();
37537
37681
 
37682
+ var DOMPrompt = /** @class */ (function () {
37683
+ function DOMPrompt(pendo, PluginAPI, inputCssSelector, submitCssSelector, config) {
37684
+ var _this = this;
37685
+ this.listeners = [];
37686
+ this.latestPromptValue = '';
37687
+ this.dom = pendo.dom;
37688
+ this._ = pendo._;
37689
+ this.q = PluginAPI.q;
37690
+ this.inputEl = new this.dom.Element(inputCssSelector);
37691
+ this.submitEl = new this.dom.Element(submitCssSelector);
37692
+ this.inputEl.addEventListener('keyup', function (evt) {
37693
+ _this.latestPromptValue = _this.getPromptValue();
37694
+ if (evt.code === 'Enter') {
37695
+ _this.waitThenCheckForSubmit().then(function (wasSubmitted) {
37696
+ if (wasSubmitted) {
37697
+ _this.submit(_this.latestPromptValue);
37698
+ }
37699
+ });
37700
+ }
37701
+ });
37702
+ this.submitEl.addEventListener('click', function () {
37703
+ _this.waitThenCheckForSubmit().then(function (wasSubmitted) {
37704
+ if (wasSubmitted) {
37705
+ _this.submit(_this.latestPromptValue);
37706
+ }
37707
+ });
37708
+ });
37709
+ this.promptContainer = new this.dom.Observer();
37710
+ this.promptContainer.addObservers(this.inputEl, this.submitEl);
37711
+ }
37712
+ /*
37713
+ * This is my attempt to create a generic way to handle the lack of a reliable `submit` event to listen
37714
+ * for to know when the user is done with their prompt. This waits 1/10th of a second, yielding
37715
+ * the thread such that in theory the input will get cleared as part of the submit process.
37716
+ */
37717
+ DOMPrompt.prototype.waitThenCheckForSubmit = function () {
37718
+ var _this = this;
37719
+ var deferred = this.q.defer();
37720
+ setTimeout$1(function () {
37721
+ deferred.resolve(_this.getPromptValue() === '');
37722
+ }, 100);
37723
+ return deferred.promise;
37724
+ };
37725
+ DOMPrompt.prototype.submit = function (val) {
37726
+ if (!val)
37727
+ return;
37728
+ this._.each(this.listeners, function (cb) { return cb(val); });
37729
+ this.latestPromptValue = '';
37730
+ };
37731
+ DOMPrompt.prototype.getPromptValue = function () {
37732
+ return this.inputEl.getText();
37733
+ };
37734
+ DOMPrompt.prototype.onSubmit = function (callback) {
37735
+ this.listeners.push(callback);
37736
+ };
37737
+ DOMPrompt.prototype.teardown = function () {
37738
+ this.promptContainer.teardown();
37739
+ this.inputEl.teardown();
37740
+ this.submitEl.teardown();
37741
+ };
37742
+ return DOMPrompt;
37743
+ }());
37744
+
37745
+ /*
37746
+ * Prompt Analytics Plugin
37747
+ *
37748
+ * Built-in Plugin adding optional support for monitoring a Prompt like a search box or chat text box.
37749
+ */
37750
+ // XXX Consider making an InputElement and SubmitElement type containing a dom.Element
37751
+ // that would each own their respective scenarios for event listeners.
37752
+ // XXX DOMPrompt would then accept the Input and Submit elements and simply provide
37753
+ // them each a callback for what to do when a `submit` occurs.
37754
+ // This would eventually allow a DOMPrompt to support an array of Input / Submit elements
37755
+ // more cleanly without hairy management code. This is not a likely scenario, so not worrying
37756
+ // about it yet, but calling this out as how it can be supported if needed.
37757
+ var PromptPlugin = /** @class */ (function () {
37758
+ function PromptPlugin() {
37759
+ this.name = 'PromptAnalytics';
37760
+ this.configName = 'aiAgents';
37761
+ this.prompts = [];
37762
+ }
37763
+ PromptPlugin.prototype.initialize = function (pendo, PluginAPI) {
37764
+ var _this = this;
37765
+ this.pendo = pendo;
37766
+ this.api = PluginAPI;
37767
+ this._ = this.pendo._;
37768
+ // register config schema
37769
+ this.api.ConfigReader.addOption(this.configName, ['pendoconfig', 'snippet']);
37770
+ this.loadConfig(this.configName)
37771
+ .then(function (config) { return _this.onConfigLoaded(config); })['catch'](function () { });
37772
+ };
37773
+ // a-fake-sync method - puts the api expectation of a promise in place now
37774
+ // making it easier in the future if the config looking becomes a network call
37775
+ PromptPlugin.prototype.loadConfig = function (configName) {
37776
+ var _a = this.api, q = _a.q, ConfigReader = _a.ConfigReader;
37777
+ var deferred = q.defer();
37778
+ var configObj = ConfigReader.get(configName);
37779
+ deferred.resolve(configObj);
37780
+ return deferred.promise;
37781
+ };
37782
+ PromptPlugin.prototype.onConfigLoaded = function (aiAgents) {
37783
+ var _this = this;
37784
+ if (aiAgents === void 0) { aiAgents = []; }
37785
+ if (!aiAgents || !this._.isArray(aiAgents) || aiAgents.length === 0) {
37786
+ return;
37787
+ }
37788
+ this._.each(aiAgents, function (aiAgent) {
37789
+ _this.observePrompt(aiAgent);
37790
+ });
37791
+ };
37792
+ PromptPlugin.prototype.observePrompt = function (config) {
37793
+ var _this = this;
37794
+ var id = config.id; config.containerCssSelector; var cssSelectors = config.cssSelectors, privacyFilters = config.privacyFilters;
37795
+ this.setFilters(privacyFilters);
37796
+ this.agentId = id;
37797
+ var inputCssSelector, submitCssSelector;
37798
+ inputCssSelector = this.parseCssSelector('input', cssSelectors);
37799
+ submitCssSelector = this.parseCssSelector('submit', cssSelectors);
37800
+ var prompt = new DOMPrompt(this.pendo, this.api, inputCssSelector, submitCssSelector);
37801
+ prompt.onSubmit(function (value) {
37802
+ _this.sendEvent(value);
37803
+ });
37804
+ this.prompts.push(prompt);
37805
+ };
37806
+ PromptPlugin.prototype.parseCssSelector = function (type, configs) {
37807
+ return this._.find(configs, function (target) { return target.type === type; }).cssSelector;
37808
+ };
37809
+ PromptPlugin.prototype.setFilters = function (candidateFilter) {
37810
+ if (!candidateFilter) {
37811
+ this.privacyFilters = null;
37812
+ return null;
37813
+ }
37814
+ try {
37815
+ this.privacyFilters = new RegExp(candidateFilter, 'gmi');
37816
+ }
37817
+ catch (e) {
37818
+ this.privacyFilters = null;
37819
+ this.api.log.error(e);
37820
+ }
37821
+ return this.privacyFilters;
37822
+ };
37823
+ PromptPlugin.prototype.sendEvent = function (promptValue) {
37824
+ var prompt = this.applyPrivacyFilter(promptValue);
37825
+ this.api.analytics.collectEvent('prompt', {
37826
+ 'prompt': prompt,
37827
+ 'agentId': this.agentId,
37828
+ 'promptType': 'request',
37829
+ 'privacyFilterApplied': promptValue !== prompt
37830
+ });
37831
+ };
37832
+ PromptPlugin.prototype.applyPrivacyFilter = function (candidateValue) {
37833
+ if (!this.privacyFilters || !this._.isRegExp(this.privacyFilters))
37834
+ return candidateValue;
37835
+ return candidateValue.replace(this.privacyFilters, 'redacted');
37836
+ };
37837
+ PromptPlugin.prototype.teardown = function () {
37838
+ this._.each(this.prompts, function (prompt) { return prompt.teardown(); });
37839
+ };
37840
+ return PromptPlugin;
37841
+ }());
37842
+ var PromptAnalytics = new PromptPlugin();
37843
+
37538
37844
  function registerBuiltInPlugins() {
37539
37845
  registerPlugin(IFrameMonitor);
37540
37846
  registerPlugin(DOMActivation);
@@ -37552,6 +37858,7 @@ function registerBuiltInPlugins() {
37552
37858
  registerPlugin(SegmentFlags$1);
37553
37859
  registerPlugin(WebAnalytics$1);
37554
37860
  registerPlugin(FormValidation);
37861
+ registerPlugin(PromptAnalytics);
37555
37862
  }
37556
37863
 
37557
37864
  /*
@@ -37709,8 +38016,6 @@ function getDefaultExportFromCjs (x) {
37709
38016
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
37710
38017
  }
37711
38018
 
37712
- /* eslint-disable agent-eslint-rules/no-window-pendo */
37713
-
37714
38019
  var substitutionRegex = '\\{(?:\\s?)([^.\\s]?visitor|account|parentAccount)\\.([^|\\s/]*)(?:\\s?\\|\\s?([^}]+|[\\/s]+))?(?:\\s?\\/\\s?){1}\\}';
37715
38020
  var skipStepString = '{skipStep:* *(auto|\\d+)\\/}';
37716
38021
  var goToMiddleString = '(?!0)(\\d+)';
@@ -37727,9 +38032,9 @@ function lookupGuideButtons(domJson, buttons) {
37727
38032
  }
37728
38033
  return buttons;
37729
38034
  }
37730
- function removeMarkdownSyntax(element, textToReplace, replacementText) {
38035
+ function removeMarkdownSyntax(element, textToReplace, replacementText, pendo) {
37731
38036
  var _a;
37732
- if (window.pendo.dom(element).hasClass('_pendo-nps-open-text-poll-question')) {
38037
+ if (pendo.dom(element).hasClass('_pendo-nps-open-text-poll-question')) {
37733
38038
  // This prevents us from removing the message for the conditionally rendered elements
37734
38039
  element.innerHTML = (_a = element.innerHTML) === null || _a === void 0 ? void 0 : _a.replace(textToReplace, replacementText);
37735
38040
  }
@@ -37742,10 +38047,10 @@ function removeMarkdownSyntax(element, textToReplace, replacementText) {
37742
38047
  }
37743
38048
  if (element.children.length > 0)
37744
38049
  return;
37745
- if (window.pendo.dom(element).hasClass('_pendo-simple-text') ||
37746
- window.pendo.dom(element).hasClass('_pendo-text-plain') ||
37747
- window.pendo.dom(element).hasClass('_pendo-text-list-item') ||
37748
- window.pendo.dom(element).hasClass('_pendo-text-link')) {
38050
+ if (pendo.dom(element).hasClass('_pendo-simple-text') ||
38051
+ pendo.dom(element).hasClass('_pendo-text-plain') ||
38052
+ pendo.dom(element).hasClass('_pendo-text-list-item') ||
38053
+ pendo.dom(element).hasClass('_pendo-text-link')) {
37749
38054
  element.textContent = element.textContent.replace(textToReplace, replacementText);
37750
38055
  }
37751
38056
  }
@@ -37758,38 +38063,37 @@ var guideMarkdownUtil = {
37758
38063
  };
37759
38064
 
37760
38065
  // Does not support submit and go to
37761
- /* eslint-disable agent-eslint-rules/no-window-pendo */
37762
38066
  var goToRegex = new RegExp(guideMarkdownUtil.goToString);
37763
38067
  var PollBranching = {
37764
38068
  'name': 'PollBranching',
37765
- 'script': function (step, guide) {
38069
+ 'script': function (step, guide, pendo) {
37766
38070
  var isAdvanceIntercepted = false;
37767
- var branchingQuestions = initialBranchingSetup(step);
38071
+ var branchingQuestions = initialBranchingSetup(step, pendo);
37768
38072
  if (branchingQuestions) {
37769
38073
  // If there are too many branching questions saved, exit and run the guide normally.
37770
- if (window.pendo._.size(branchingQuestions) > 1)
38074
+ if (pendo._.size(branchingQuestions) > 1)
37771
38075
  return;
37772
38076
  this.on('beforeAdvance', function (evt) {
37773
38077
  var noResponseSelected = step.guideElement.find('[branching] .pendo-radio:checked').length === 0;
37774
38078
  var responseLabel = step.guideElement.find('[branching] .pendo-radio:checked + label')[0];
37775
38079
  var noGotoLabel;
37776
38080
  if (responseLabel) {
37777
- noGotoLabel = window.pendo._.isNull(responseLabel.getAttribute('goToStep'));
38081
+ noGotoLabel = pendo._.isNull(responseLabel.getAttribute('goToStep'));
37778
38082
  }
37779
38083
  if (isAdvanceIntercepted || noResponseSelected || noGotoLabel)
37780
38084
  return;
37781
38085
  isAdvanceIntercepted = true;
37782
- branchingGoToStep(evt, step, guide);
38086
+ branchingGoToStep(evt, step, guide, pendo);
37783
38087
  });
37784
38088
  }
37785
38089
  },
37786
- 'test': function (step) {
38090
+ 'test': function (step, guide, pendo) {
37787
38091
  var _a;
37788
38092
  var branchingQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
37789
- return !window.pendo._.isUndefined(branchingQuestions) && window.pendo._.size(branchingQuestions);
38093
+ return !pendo._.isUndefined(branchingQuestions) && pendo._.size(branchingQuestions);
37790
38094
  },
37791
- 'designerListener': function () {
37792
- var target = window.pendo.dom.getBody();
38095
+ 'designerListener': function (pendo) {
38096
+ var target = pendo.dom.getBody();
37793
38097
  var config = {
37794
38098
  'attributeFilter': ['data-layout'],
37795
38099
  'attributes': true,
@@ -37802,34 +38106,34 @@ var PollBranching = {
37802
38106
  function applyBranchingIndicators(mutations) {
37803
38107
  mutations.forEach(function (mutation) {
37804
38108
  var _a;
37805
- var nodeHasQuerySelector = window.pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelector);
38109
+ var nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelector);
37806
38110
  if (mutation.addedNodes.length && nodeHasQuerySelector) {
37807
38111
  if (mutation.addedNodes[0].querySelector('._pendo-multi-choice-poll-select-border')) {
37808
- if (window.pendo._.size(window.pendo.dom('._pendo-multi-choice-poll-question:contains("{branching/}")'))) {
37809
- window.pendo
38112
+ if (pendo._.size(pendo.dom('._pendo-multi-choice-poll-question:contains("{branching/}")'))) {
38113
+ pendo
37810
38114
  .dom('._pendo-multi-choice-poll-question:contains("{branching/}")')
37811
38115
  .each(function (question, index) {
37812
- window.pendo._.each(window.pendo.dom("#".concat(question.id, " *")), function (element) {
37813
- guideMarkdownUtil.removeMarkdownSyntax(element, '{branching/}', '');
38116
+ pendo._.each(pendo.dom("#".concat(question.id, " *")), function (element) {
38117
+ guideMarkdownUtil.removeMarkdownSyntax(element, '{branching/}', '', pendo);
37814
38118
  });
37815
- window.pendo
38119
+ pendo
37816
38120
  .dom("#".concat(question.id, " p"))
37817
38121
  .css({ 'display': 'inline-block !important' })
37818
38122
  .append(branchingIcon('#999', '20px'))
37819
38123
  .attr({ 'title': 'Custom Branching Added' });
37820
38124
  var dataPendoPollId = question.getAttribute('data-pendo-poll-id');
37821
- if (window.pendo.dom("._pendo-multi-choice-poll-question[data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0]) {
37822
- window.pendo
38125
+ if (pendo.dom("._pendo-multi-choice-poll-question[data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0]) {
38126
+ pendo
37823
38127
  .dom("._pendo-multi-choice-poll-question[data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0]
37824
38128
  .textContent.trim();
37825
38129
  }
37826
- var pollLabels = window.pendo.dom("label[for*=".concat(dataPendoPollId, "]"));
37827
- if (window.pendo._.size(pollLabels)) {
37828
- window.pendo._.forEach(pollLabels, function (label) {
38130
+ var pollLabels = pendo.dom("label[for*=".concat(dataPendoPollId, "]"));
38131
+ if (pendo._.size(pollLabels)) {
38132
+ pendo._.forEach(pollLabels, function (label) {
37829
38133
  if (goToRegex.test(label.textContent)) {
37830
38134
  var labelTitle = goToRegex.exec(label.textContent)[2];
37831
- guideMarkdownUtil.removeMarkdownSyntax(label, goToRegex, '');
37832
- window.pendo
38135
+ guideMarkdownUtil.removeMarkdownSyntax(label, goToRegex, '', pendo);
38136
+ pendo
37833
38137
  .dom(label)
37834
38138
  .append(branchingIcon('#999', '14px'))
37835
38139
  .attr({ 'title': "Branching to step ".concat(labelTitle) });
@@ -37837,11 +38141,11 @@ var PollBranching = {
37837
38141
  });
37838
38142
  }
37839
38143
  if (index > 0) {
37840
- window.pendo
38144
+ pendo
37841
38145
  .dom(question)
37842
38146
  .append(branchingErrorHTML(question.dataset.pendoPollId));
37843
- window.pendo.dom("#".concat(question.id, " #pendo-ps-branching-svg")).remove();
37844
- window.pendo
38147
+ pendo.dom("#".concat(question.id, " #pendo-ps-branching-svg")).remove();
38148
+ pendo
37845
38149
  .dom("#".concat(question.id, " p"))
37846
38150
  .css({ 'display': 'inline-block !important' })
37847
38151
  .append(branchingIcon('red', '20px'))
@@ -37861,31 +38165,31 @@ var PollBranching = {
37861
38165
  }
37862
38166
  }
37863
38167
  };
37864
- function initialBranchingSetup(step) {
38168
+ function initialBranchingSetup(step, pendo) {
37865
38169
  var questions = step.guideElement.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
37866
- window.pendo._.forEach(questions, function (question) {
38170
+ pendo._.forEach(questions, function (question) {
37867
38171
  var dataPendoPollId = question.getAttribute('data-pendo-poll-id');
37868
- window.pendo._.each(step.guideElement.find("#".concat(question.id, " *")), function (element) {
37869
- guideMarkdownUtil.removeMarkdownSyntax(element, '{branching/}', '');
38172
+ pendo._.each(step.guideElement.find("#".concat(question.id, " *")), function (element) {
38173
+ guideMarkdownUtil.removeMarkdownSyntax(element, '{branching/}', '', pendo);
37870
38174
  });
37871
38175
  var pollLabels = step.guideElement.find("label[for*=".concat(dataPendoPollId, "]"));
37872
- window.pendo._.forEach(pollLabels, function (label) {
37873
- if (window.pendo._.isNull(goToRegex.exec(label.textContent))) {
38176
+ pendo._.forEach(pollLabels, function (label) {
38177
+ if (pendo._.isNull(goToRegex.exec(label.textContent))) {
37874
38178
  return;
37875
38179
  }
37876
38180
  var gotoSubstring = goToRegex.exec(label.textContent)[1];
37877
38181
  var gotoIndex = goToRegex.exec(label.textContent)[2];
37878
38182
  label.setAttribute('goToStep', gotoIndex);
37879
- guideMarkdownUtil.removeMarkdownSyntax(label, gotoSubstring, '');
38183
+ guideMarkdownUtil.removeMarkdownSyntax(label, gotoSubstring, '', pendo);
37880
38184
  });
37881
38185
  var pollChoiceContainer = step.guideElement.find("[data-pendo-poll-id=".concat(dataPendoPollId, "]._pendo-multi-choice-poll-select-border"));
37882
- if (pollChoiceContainer) {
38186
+ if (pollChoiceContainer && pollChoiceContainer.length) {
37883
38187
  pollChoiceContainer[0].setAttribute('branching', '');
37884
38188
  }
37885
38189
  });
37886
38190
  return questions;
37887
38191
  }
37888
- function branchingGoToStep(event, step, guide) {
38192
+ function branchingGoToStep(event, step, guide, pendo) {
37889
38193
  var _a;
37890
38194
  var checkedPollInputId = (_a = step.guideElement.find('[branching] input.pendo-radio[data-pendo-poll-id]:checked')[0]) === null || _a === void 0 ? void 0 : _a.id;
37891
38195
  var checkedPollLabel = step.guideElement.find("label[for=\"".concat(checkedPollInputId, "\"]"))[0];
@@ -37896,30 +38200,29 @@ function branchingGoToStep(event, step, guide) {
37896
38200
  var destinationObject = {
37897
38201
  'destinationStepId': guide.steps[pollStepIndex].id
37898
38202
  };
37899
- window.pendo.goToStep(destinationObject);
38203
+ pendo.goToStep(destinationObject);
37900
38204
  event.cancel = true;
37901
38205
  }
37902
38206
 
37903
- /* eslint-disable agent-eslint-rules/no-window-pendo */
37904
38207
  var containerSelector = '[id^="pendo-guide-container"]';
37905
38208
  var MetadataSubstitution = {
37906
38209
  'name': 'MetadataSubstitution',
37907
- 'script': function (step, guide) {
37908
- var placeholderData = findSubstitutableElements();
38210
+ 'script': function (step, guide, pendo) {
38211
+ var placeholderData = findSubstitutableElements(pendo);
37909
38212
  if (step.domJson) {
37910
- findSubstitutableUrlsInJson(step.domJson, placeholderData);
38213
+ findSubstitutableUrlsInJson(step.domJson, placeholderData, pendo);
37911
38214
  }
37912
- if (window.pendo._.size(placeholderData)) {
37913
- window.pendo._.each(placeholderData, function (placeholder) {
37914
- processPlaceholder(placeholder);
38215
+ if (pendo._.size(placeholderData)) {
38216
+ pendo._.each(placeholderData, function (placeholder) {
38217
+ processPlaceholder(placeholder, pendo);
37915
38218
  });
37916
38219
  var containerId = "pendo-g-".concat(step.id);
37917
38220
  var context_1 = step.guideElement;
37918
- updateGuideContainer(containerId, context_1);
38221
+ updateGuideContainer(containerId, context_1, pendo);
37919
38222
  }
37920
38223
  },
37921
- 'designerListener': function () {
37922
- var target = window.pendo.dom.getBody();
38224
+ 'designerListener': function (pendo) {
38225
+ var target = pendo.dom.getBody();
37923
38226
  var config = {
37924
38227
  'attributeFilter': ['data-layout'],
37925
38228
  'attributes': true,
@@ -37934,23 +38237,23 @@ var MetadataSubstitution = {
37934
38237
  var _a;
37935
38238
  if (mutation.addedNodes.length) {
37936
38239
  if (document.querySelector(containerSelector)) {
37937
- var placeholderData = findSubstitutableElements();
37938
- var step = (_a = window.pendo.designerv2.currentlyPreviewedGuide) === null || _a === void 0 ? void 0 : _a.steps[0];
38240
+ var placeholderData = findSubstitutableElements(pendo);
38241
+ var step = (_a = pendo.designerv2.currentlyPreviewedGuide) === null || _a === void 0 ? void 0 : _a.steps[0];
37939
38242
  if (!step)
37940
38243
  return;
37941
38244
  var pendoBlocks = step.buildingBlocks;
37942
- if (!window.pendo._.isUndefined(pendoBlocks)) {
37943
- findSubstitutableUrlsInJson(pendoBlocks, placeholderData);
38245
+ if (!pendo._.isUndefined(pendoBlocks)) {
38246
+ findSubstitutableUrlsInJson(pendoBlocks, placeholderData, pendo);
37944
38247
  }
37945
- if (window.pendo._.size(placeholderData)) {
37946
- window.pendo._.each(placeholderData, function (placeholder) {
37947
- if (window.pendo._.isUndefined(placeholder))
38248
+ if (pendo._.size(placeholderData)) {
38249
+ pendo._.each(placeholderData, function (placeholder) {
38250
+ if (pendo._.isUndefined(placeholder))
37948
38251
  return;
37949
- processPlaceholder(placeholder);
38252
+ processPlaceholder(placeholder, pendo);
37950
38253
  });
37951
38254
  var containerId = "pendo-g-".concat(step.id);
37952
38255
  var context_2 = step.guideElement;
37953
- updateGuideContainer(containerId, context_2);
38256
+ updateGuideContainer(containerId, context_2, pendo);
37954
38257
  }
37955
38258
  }
37956
38259
  }
@@ -37958,13 +38261,13 @@ var MetadataSubstitution = {
37958
38261
  }
37959
38262
  }
37960
38263
  };
37961
- function processPlaceholder(placeholder) {
38264
+ function processPlaceholder(placeholder, pendo) {
37962
38265
  var match;
37963
38266
  var data = placeholder.data, target = placeholder.target;
37964
38267
  var subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
37965
38268
  while ((match = matchPlaceholder(placeholder, subRegex))) {
37966
38269
  var matched = subRegex.exec(match);
37967
- var mdValue = getSubstitueValue(matched);
38270
+ var mdValue = getSubstituteValue(matched, pendo);
37968
38271
  substituteMetadataByTarget(data, target, mdValue, matched);
37969
38272
  }
37970
38273
  }
@@ -37976,16 +38279,16 @@ function matchPlaceholder(placeholder, regex) {
37976
38279
  return decodeURI(placeholder.data[placeholder.target]).match(regex);
37977
38280
  }
37978
38281
  }
37979
- function getSubstitueValue(match) {
37980
- if (window.pendo._.isUndefined(match[1]) || window.pendo._.isUndefined(match[2]))
38282
+ function getSubstituteValue(match, pendo) {
38283
+ if (pendo._.isUndefined(match[1]) || pendo._.isUndefined(match[2]))
37981
38284
  return;
37982
38285
  var type = match[1];
37983
38286
  var property = match[2];
37984
38287
  var defaultValue = match[3];
37985
- if (window.pendo._.isUndefined(type) || window.pendo._.isUndefined(property)) {
38288
+ if (pendo._.isUndefined(type) || pendo._.isUndefined(property)) {
37986
38289
  return;
37987
38290
  }
37988
- var mdValue = window.pendo._.get(window.pendo.getSerializedMetadata(), "".concat(type, ".").concat(property)) || defaultValue || '';
38291
+ var mdValue = pendo._.get(pendo.getSerializedMetadata(), "".concat(type, ".").concat(property)) || defaultValue || '';
37989
38292
  return mdValue;
37990
38293
  }
37991
38294
  function substituteMetadataByTarget(data, target, mdValue, matched) {
@@ -37998,14 +38301,14 @@ function substituteMetadataByTarget(data, target, mdValue, matched) {
37998
38301
  .replace(matched[0], mdValue);
37999
38302
  }
38000
38303
  }
38001
- function updateGuideContainer(containerId, context) {
38002
- if (window.pendo.designer && !window.pendo._.size(window.pendo.dom('#pendo-ps-substitution-icon'))) {
38003
- window.pendo.dom(containerSelector).append(substitutionIcon('#999', '30px'));
38304
+ function updateGuideContainer(containerId, context, pendo) {
38305
+ if (pendo.designer && !pendo._.size(pendo.dom('#pendo-ps-substitution-icon'))) {
38306
+ pendo.dom(containerSelector).append(substitutionIcon('#999', '30px'));
38004
38307
  }
38005
- window.pendo.flexElement(window.pendo.dom(containerSelector));
38006
- window.pendo.BuildingBlocks.BuildingBlockGuides.recalculateGuideHeight(containerId, context);
38308
+ pendo.flexElement(pendo.dom(containerSelector));
38309
+ pendo.BuildingBlocks.BuildingBlockGuides.recalculateGuideHeight(containerId, context);
38007
38310
  }
38008
- function findSubstitutableUrlsInJson(originalData, placeholderData) {
38311
+ function findSubstitutableUrlsInJson(originalData, placeholderData, pendo) {
38009
38312
  if (placeholderData === void 0) { placeholderData = []; }
38010
38313
  var subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
38011
38314
  if ((originalData.name === 'url' || originalData.name === 'href') && originalData.value) {
@@ -38017,35 +38320,35 @@ function findSubstitutableUrlsInJson(originalData, placeholderData) {
38017
38320
  }
38018
38321
  }
38019
38322
  if (originalData.properties && originalData.id === 'href_link_block') {
38020
- window.pendo._.each(originalData.properties, function (prop) {
38021
- findSubstitutableUrlsInJson(prop, placeholderData);
38323
+ pendo._.each(originalData.properties, function (prop) {
38324
+ findSubstitutableUrlsInJson(prop, placeholderData, pendo);
38022
38325
  });
38023
38326
  }
38024
38327
  if (originalData.views) {
38025
- window.pendo._.each(originalData.views, function (view) {
38026
- findSubstitutableUrlsInJson(view, placeholderData);
38328
+ pendo._.each(originalData.views, function (view) {
38329
+ findSubstitutableUrlsInJson(view, placeholderData, pendo);
38027
38330
  });
38028
38331
  }
38029
38332
  if (originalData.parameters) {
38030
- window.pendo._.each(originalData.parameters, function (param) {
38031
- findSubstitutableUrlsInJson(param, placeholderData);
38333
+ pendo._.each(originalData.parameters, function (param) {
38334
+ findSubstitutableUrlsInJson(param, placeholderData, pendo);
38032
38335
  });
38033
38336
  }
38034
38337
  if (originalData.actions) {
38035
- window.pendo._.each(originalData.actions, function (action) {
38036
- findSubstitutableUrlsInJson(action, placeholderData);
38338
+ pendo._.each(originalData.actions, function (action) {
38339
+ findSubstitutableUrlsInJson(action, placeholderData, pendo);
38037
38340
  });
38038
38341
  }
38039
38342
  if (originalData.children) {
38040
- window.pendo._.each(originalData.children, function (child) {
38041
- findSubstitutableUrlsInJson(child, placeholderData);
38343
+ pendo._.each(originalData.children, function (child) {
38344
+ findSubstitutableUrlsInJson(child, placeholderData, pendo);
38042
38345
  });
38043
38346
  }
38044
38347
  return placeholderData;
38045
38348
  }
38046
- function findSubstitutableElements() {
38047
- var elements = window.pendo.dom("".concat(containerSelector, " *:not(.pendo-inline-ui)"));
38048
- return window.pendo._.chain(elements)
38349
+ function findSubstitutableElements(pendo) {
38350
+ var elements = pendo.dom("".concat(containerSelector, " *:not(.pendo-inline-ui)"));
38351
+ return pendo._.chain(elements)
38049
38352
  .filter(function (placeholder) {
38050
38353
  var subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
38051
38354
  if (placeholder.localName === 'a') {
@@ -38059,16 +38362,16 @@ function findSubstitutableElements() {
38059
38362
  }
38060
38363
  if (placeholder.children.length > 0)
38061
38364
  return;
38062
- if (window.pendo.dom(placeholder).hasClass('_pendo-simple-text') ||
38063
- window.pendo.dom(placeholder).hasClass('_pendo-text-plain') ||
38064
- window.pendo.dom(placeholder).hasClass('_pendo-text-list-item') ||
38065
- window.pendo.dom(placeholder).hasClass('_pendo-text-link')) {
38365
+ if (pendo.dom(placeholder).hasClass('_pendo-simple-text') ||
38366
+ pendo.dom(placeholder).hasClass('_pendo-text-plain') ||
38367
+ pendo.dom(placeholder).hasClass('_pendo-text-list-item') ||
38368
+ pendo.dom(placeholder).hasClass('_pendo-text-link')) {
38066
38369
  return subRegex.test(placeholder.textContent);
38067
38370
  }
38068
38371
  return subRegex.test(placeholder.textContent) || subRegex.test(decodeURI(placeholder.href));
38069
38372
  })
38070
38373
  .map(function (placeholder) {
38071
- if (placeholder.localName === 'a' && window.pendo.dom(placeholder).hasClass('_pendo-text-link')) {
38374
+ if (placeholder.localName === 'a' && pendo.dom(placeholder).hasClass('_pendo-text-link')) {
38072
38375
  return [{
38073
38376
  'data': placeholder,
38074
38377
  'target': 'href'
@@ -38089,10 +38392,10 @@ function findSubstitutableElements() {
38089
38392
  'target': 'textContent'
38090
38393
  };
38091
38394
  }
38092
- if (window.pendo.dom(placeholder).hasClass('_pendo-simple-text') ||
38093
- window.pendo.dom(placeholder).hasClass('_pendo-text-plain') ||
38094
- window.pendo.dom(placeholder).hasClass('_pendo-text-list-item') ||
38095
- window.pendo.dom(placeholder).hasClass('_pendo-text-link')) {
38395
+ if (pendo.dom(placeholder).hasClass('_pendo-simple-text') ||
38396
+ pendo.dom(placeholder).hasClass('_pendo-text-plain') ||
38397
+ pendo.dom(placeholder).hasClass('_pendo-text-list-item') ||
38398
+ pendo.dom(placeholder).hasClass('_pendo-text-link')) {
38096
38399
  return {
38097
38400
  'data': placeholder,
38098
38401
  'target': 'textContent'
@@ -38106,11 +38409,10 @@ function substitutionIcon(color, size) {
38106
38409
  return ("<div title=\"Metadata Substitution added\">\n <svg id=\"pendo-ps-substitution-icon\" viewBox=\"0 0 24 24\"\n preserveAspectRatio=\"xMidYMid meet\"\n height=".concat(size, " width=").concat(size, " title=\"Metadata Substitution\"\n style=\"bottom:5px; right:10px; position: absolute;\"\n fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" stroke=\"").concat(color, "\"\n transform=\"matrix(1, 0, 0, 1, 0, 0)rotate(0)\">\n <g stroke-width=\"0\"></g>\n <g stroke-linecap=\"round\" stroke-linejoin=\"round\"\n stroke=\"").concat(color, "\" stroke-width=\"0.528\"></g>\n <g><path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n d=\"M5 5.5C4.17157 5.5 3.5 6.17157 3.5 7V10C3.5 10.8284\n 4.17157 11.5 5 11.5H8C8.82843 11.5 9.5 10.8284 9.5\n 10V9H17V11C17 11.2761 17.2239 11.5 17.5 11.5C17.7761\n 11.5 18 11.2761 18 11V8.5C18 8.22386 17.7761 8 17.5\n 8H9.5V7C9.5 6.17157 8.82843 5.5 8 5.5H5ZM8.5 7C8.5\n 6.72386 8.27614 6.5 8 6.5H5C4.72386 6.5 4.5 6.72386\n 4.5 7V10C4.5 10.2761 4.72386 10.5 5 10.5H8C8.27614\n 10.5 8.5 10.2761 8.5 10V7Z\" fill=\"").concat(color, "\"></path>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n d=\"M7 13C7 12.7239 6.77614 12.5 6.5 12.5C6.22386 12.5\n 6 12.7239 6 13V15.5C6 15.7761 6.22386 16 6.5\n 16H14.5V17C14.5 17.8284 15.1716 18.5 16 18.5H19C19.8284\n 18.5 20.5 17.8284 20.5 17V14C20.5 13.1716 19.8284 12.5\n 19 12.5H16C15.1716 12.5 14.5 13.1716 14.5\n 14V15H7V13ZM15.5 17C15.5 17.2761 15.7239 17.5 16\n 17.5H19C19.2761 17.5 19.5 17.2761 19.5 17V14C19.5\n 13.7239 19.2761 13.5 19 13.5H16C15.7239 13.5 15.5\n 13.7239 15.5 14V17Z\" fill=\"").concat(color, "\"></path> </g></svg></div>"));
38107
38410
  }
38108
38411
 
38109
- /* eslint-disable agent-eslint-rules/no-window-pendo */
38110
38412
  var requiredElement = '<span class="_pendo-required-indicator" style="color:red; font-style:italic;" title="Question is required"> *</span>';
38111
38413
  var RequiredQuestions = {
38112
38414
  'name': 'RequiredQuestions',
38113
- 'script': function (step, guide) {
38415
+ 'script': function (step, guide, pendo) {
38114
38416
  var _a;
38115
38417
  var requiredPollIds = [];
38116
38418
  var submitButtons = (_a = guideMarkdownUtil.lookupGuideButtons(step.domJson)) === null || _a === void 0 ? void 0 : _a.filter(function (button) {
@@ -38118,7 +38420,7 @@ var RequiredQuestions = {
38118
38420
  });
38119
38421
  var requiredQuestions = processRequiredQuestions();
38120
38422
  if (requiredQuestions) {
38121
- window.pendo._.forEach(requiredQuestions, function (question) {
38423
+ pendo._.forEach(requiredQuestions, function (question) {
38122
38424
  if (question.classList.contains('_pendo-open-text-poll-question')) {
38123
38425
  var pollId = question.dataset.pendoPollId;
38124
38426
  step.attachEvent(step.guideElement.find("[data-pendo-poll-id=".concat(pollId, "]._pendo-open-text-poll-input"))[0], 'input', function () {
@@ -38135,19 +38437,19 @@ var RequiredQuestions = {
38135
38437
  function processRequiredQuestions() {
38136
38438
  var questions = step.guideElement.find('[class*=-poll-question]:contains({required/})');
38137
38439
  if (questions) {
38138
- window.pendo._.forEach(questions, function (question) {
38440
+ pendo._.forEach(questions, function (question) {
38139
38441
  var dataPendoPollId = question.getAttribute('data-pendo-poll-id');
38140
38442
  requiredPollIds.push(dataPendoPollId);
38141
- window.pendo._.each(step.guideElement.find("#".concat(question.id, " *, #").concat(question.id)), function (element) {
38142
- guideMarkdownUtil.removeMarkdownSyntax(element, '{required/}', '');
38443
+ pendo._.each(step.guideElement.find("#".concat(question.id, " *, #").concat(question.id)), function (element) {
38444
+ guideMarkdownUtil.removeMarkdownSyntax(element, '{required/}', '', pendo);
38143
38445
  });
38144
38446
  step.guideElement.find("#".concat(question.id, " p")).append(requiredElement);
38145
38447
  });
38146
38448
  }
38147
- if (window.pendo._.size(requiredPollIds)) {
38449
+ if (pendo._.size(requiredPollIds)) {
38148
38450
  var disabledButtonStyles = "<style type=text/css\n id=_pendo-guide-required-disabled>\n ._pendo-button:disabled, ._pendo-buttons[disabled] {\n border: 1px solid #999999 !important;\n background-color: #cccccc !important;\n color: #666666 !important;\n pointer-events: none !important;\n }\n </style>";
38149
- if (window.pendo.dom('#_pendo-guide-required-disabled').length === 0) {
38150
- window.pendo.dom('head').append(disabledButtonStyles);
38451
+ if (pendo.dom('#_pendo-guide-required-disabled').length === 0) {
38452
+ pendo.dom('head').append(disabledButtonStyles);
38151
38453
  }
38152
38454
  disableEligibleButtons(submitButtons);
38153
38455
  }
@@ -38158,14 +38460,14 @@ var RequiredQuestions = {
38158
38460
  return;
38159
38461
  var allRequiredComplete = true;
38160
38462
  var responses = [];
38161
- responses = responses.concat(window.pendo._.map(questions, function (question) {
38463
+ responses = responses.concat(pendo._.map(questions, function (question) {
38162
38464
  var pollId = question.getAttribute('data-pendo-poll-id');
38163
38465
  var input = step.guideElement.find("\n [data-pendo-poll-id=".concat(pollId, "] textarea,\n [data-pendo-poll-id=").concat(pollId, "] input:text,\n [data-pendo-poll-id=").concat(pollId, "] select,\n [data-pendo-poll-id=").concat(pollId, "] input:radio:checked"));
38164
38466
  if (input && input.length && input[0].value) {
38165
38467
  return input[0].value;
38166
38468
  }
38167
38469
  }));
38168
- if (responses.includes(undefined) || window.pendo._.isEmpty(responses)) {
38470
+ if (responses.includes(undefined) || pendo._.isEmpty(responses)) {
38169
38471
  allRequiredComplete = false;
38170
38472
  }
38171
38473
  if (allRequiredComplete) {
@@ -38192,13 +38494,13 @@ var RequiredQuestions = {
38192
38494
  });
38193
38495
  }
38194
38496
  },
38195
- 'test': function (step) {
38497
+ 'test': function (step, guide, pendo) {
38196
38498
  var _a;
38197
38499
  var requiredQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find('[class*=-poll-question]:contains({required/})');
38198
- return !window.pendo._.isUndefined(requiredQuestions) && window.pendo._.size(requiredQuestions);
38500
+ return !pendo._.isUndefined(requiredQuestions) && pendo._.size(requiredQuestions);
38199
38501
  },
38200
- 'designerListener': function () {
38201
- var target = window.pendo.dom.getBody();
38502
+ 'designerListener': function (pendo) {
38503
+ var target = pendo.dom.getBody();
38202
38504
  var config = {
38203
38505
  'attributeFilter': ['data-layout'],
38204
38506
  'attributes': true,
@@ -38211,7 +38513,7 @@ var RequiredQuestions = {
38211
38513
  function applyRequiredIndicators(mutations) {
38212
38514
  mutations.forEach(function (mutation) {
38213
38515
  var _a;
38214
- var nodeHasQuerySelector = window.pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
38516
+ var nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
38215
38517
  if (mutation.addedNodes.length && nodeHasQuerySelector) {
38216
38518
  var eligiblePolls = mutation.addedNodes[0].querySelectorAll('[class*=-poll-wrapper], [class*=-poll-select-border]');
38217
38519
  if (eligiblePolls) {
@@ -38225,21 +38527,21 @@ var RequiredQuestions = {
38225
38527
  dataPendoPollId = poll.getAttribute('data-pendo-poll-id');
38226
38528
  }
38227
38529
  var questionText;
38228
- if (window.pendo.dom("[class*=\"-poll-question\"][data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0]) {
38229
- questionText = window.pendo.dom("[class*=\"-poll-question\"][data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0].textContent;
38530
+ if (pendo.dom("[class*=\"-poll-question\"][data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0]) {
38531
+ questionText = pendo.dom("[class*=\"-poll-question\"][data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0].textContent;
38230
38532
  }
38231
38533
  if (questionText.includes('{required/}')) {
38232
- window.pendo._.each(window.pendo.dom("[data-pendo-poll-id=".concat(dataPendoPollId, "]:not(.pendo-radio)")), function (element) {
38233
- window.pendo._.each(window.pendo.dom("#".concat(element.id, " *:not(\".pendo-radio\"), #").concat(element.id, ":not(\".pendo-radio\")")), function (item) {
38234
- guideMarkdownUtil.removeMarkdownSyntax(item, '{required/}', '');
38534
+ pendo._.each(pendo.dom("[data-pendo-poll-id=".concat(dataPendoPollId, "]:not(.pendo-radio)")), function (element) {
38535
+ pendo._.each(pendo.dom("#".concat(element.id, " *:not(\".pendo-radio\"), #").concat(element.id, ":not(\".pendo-radio\")")), function (item) {
38536
+ guideMarkdownUtil.removeMarkdownSyntax(item, '{required/}', '', pendo);
38235
38537
  });
38236
38538
  });
38237
- if (window.pendo.dom(".bb-text[data-pendo-poll-id=".concat(dataPendoPollId, "] p")).length !== 0 || window.pendo.dom(".bb-text[data-pendo-poll-id=".concat(dataPendoPollId, "] li")).length !== 0) {
38238
- window.pendo.dom(".bb-text[data-pendo-poll-id=".concat(dataPendoPollId, "] p")).append(requiredElement);
38239
- window.pendo.dom(".bb-text[data-pendo-poll-id=".concat(dataPendoPollId, "] li")).append(requiredElement);
38539
+ if (pendo.dom(".bb-text[data-pendo-poll-id=".concat(dataPendoPollId, "] p")).length !== 0 || pendo.dom(".bb-text[data-pendo-poll-id=".concat(dataPendoPollId, "] li")).length !== 0) {
38540
+ pendo.dom(".bb-text[data-pendo-poll-id=".concat(dataPendoPollId, "] p")).append(requiredElement);
38541
+ pendo.dom(".bb-text[data-pendo-poll-id=".concat(dataPendoPollId, "] li")).append(requiredElement);
38240
38542
  }
38241
38543
  else {
38242
- window.pendo.dom(".bb-text[data-pendo-poll-id=".concat(dataPendoPollId, "]")).append(requiredElement);
38544
+ pendo.dom(".bb-text[data-pendo-poll-id=".concat(dataPendoPollId, "]")).append(requiredElement);
38243
38545
  }
38244
38546
  }
38245
38547
  });
@@ -38250,10 +38552,9 @@ var RequiredQuestions = {
38250
38552
  }
38251
38553
  };
38252
38554
 
38253
- /* eslint-disable agent-eslint-rules/no-window-pendo */
38254
38555
  var skipStepRegex = new RegExp(guideMarkdownUtil.skipStepString);
38255
38556
  var SkipToEligibleStep = {
38256
- 'script': function (step, guide) {
38557
+ 'script': function (step, guide, pendo) {
38257
38558
  var isAdvanceIntercepted = false;
38258
38559
  var isPreviousIntercepted = false;
38259
38560
  var guideContainer = step.guideElement.find('#pendo-guide-container');
@@ -38263,22 +38564,22 @@ var SkipToEligibleStep = {
38263
38564
  guideContainer.attr({ 'aria-label': guideContainer.attr('aria-label').replace(skipStepRegex, '') });
38264
38565
  }
38265
38566
  this.on('beforeAdvance', function (evt) {
38266
- if (guide.getPositionOfStep(step) === guide.steps.length || window.pendo._.isUndefined(stepNumberOrAuto))
38567
+ if (guide.getPositionOfStep(step) === guide.steps.length || pendo._.isUndefined(stepNumberOrAuto))
38267
38568
  return; // exit on the last step of a guide or when we don't have an argument
38268
38569
  var eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'next');
38269
38570
  if (!isAdvanceIntercepted && stepNumberOrAuto) {
38270
38571
  isAdvanceIntercepted = true;
38271
- window.pendo.goToStep({ 'destinationStepId': eligibleStep.id });
38572
+ pendo.goToStep({ 'destinationStepId': eligibleStep.id });
38272
38573
  evt.cancel = true;
38273
38574
  }
38274
38575
  });
38275
38576
  this.on('beforePrevious', function (evt) {
38276
- if (window.pendo._.isUndefined(stepNumberOrAuto))
38577
+ if (pendo._.isUndefined(stepNumberOrAuto))
38277
38578
  return;
38278
38579
  var eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'previous');
38279
38580
  if (!isPreviousIntercepted && stepNumberOrAuto) {
38280
38581
  isPreviousIntercepted = true;
38281
- window.pendo.goToStep({ 'destinationStepId': eligibleStep.id });
38582
+ pendo.goToStep({ 'destinationStepId': eligibleStep.id });
38282
38583
  evt.cancel = true;
38283
38584
  }
38284
38585
  });
@@ -38288,15 +38589,15 @@ var SkipToEligibleStep = {
38288
38589
  var skipForwardStep = findStepOnPage(guide.getPositionOfStep(step), 'next', stepNumber);
38289
38590
  var skipPreviousStep = findStepOnPage(guide.getPositionOfStep(step) - 2, 'previous', stepNumber);
38290
38591
  if (skipForwardStep && direction == 'next') {
38291
- window.pendo.goToStep({ 'destinationStepId': skipForwardStep });
38592
+ pendo.goToStep({ 'destinationStepId': skipForwardStep });
38292
38593
  }
38293
38594
  if (skipPreviousStep && direction == 'previous') {
38294
- window.pendo.goToStep({ 'destinationStepId': skipPreviousStep });
38595
+ pendo.goToStep({ 'destinationStepId': skipPreviousStep });
38295
38596
  }
38296
38597
  return direction === 'next' ? skipForwardStep : skipPreviousStep;
38297
38598
  }
38298
38599
  function findStepOnPage(stepIndex, direction, stepNumber) {
38299
- if (window.pendo._.isNaN(stepIndex))
38600
+ if (pendo._.isNaN(stepIndex))
38300
38601
  return;
38301
38602
  var $step = guide.steps[stepIndex];
38302
38603
  if ($step && !$step.canShow()) {
@@ -38315,13 +38616,13 @@ var SkipToEligibleStep = {
38315
38616
  }
38316
38617
  }
38317
38618
  },
38318
- 'test': function (step) {
38619
+ 'test': function (step, guide, pendo) {
38319
38620
  var _a;
38320
38621
  var guideContainerAriaLabel = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find('#pendo-guide-container').attr('aria-label');
38321
- return !window.pendo._.isUndefined(guideContainerAriaLabel) && (guideContainerAriaLabel === null || guideContainerAriaLabel === void 0 ? void 0 : guideContainerAriaLabel.includes('{skipStep'));
38622
+ return !pendo._.isUndefined(guideContainerAriaLabel) && (guideContainerAriaLabel === null || guideContainerAriaLabel === void 0 ? void 0 : guideContainerAriaLabel.includes('{skipStep'));
38322
38623
  },
38323
- 'designerListener': function () {
38324
- var target = window.pendo.dom.getBody();
38624
+ 'designerListener': function (pendo) {
38625
+ var target = pendo.dom.getBody();
38325
38626
  var config = {
38326
38627
  'attributeFilter': ['data-layout'],
38327
38628
  'attributes': true,
@@ -38335,7 +38636,7 @@ var SkipToEligibleStep = {
38335
38636
  function applySkipStepIndicator(mutations) {
38336
38637
  mutations.forEach(function (mutation) {
38337
38638
  var _a, _b;
38338
- var nodeHasQuerySelector = window.pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
38639
+ var nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
38339
38640
  if (mutation.addedNodes.length && nodeHasQuerySelector) {
38340
38641
  var guideContainer = mutation.addedNodes[0].querySelectorAll('#pendo-guide-container');
38341
38642
  var guideContainerAriaLabel = (_b = guideContainer[0]) === null || _b === void 0 ? void 0 : _b.getAttribute('aria-label');
@@ -38343,8 +38644,8 @@ var SkipToEligibleStep = {
38343
38644
  if (guideContainerAriaLabel.match(skipStepRegex)) {
38344
38645
  var fullSkipStepString = guideContainerAriaLabel.match(skipStepRegex)[0];
38345
38646
  guideContainerAriaLabel.replace(fullSkipStepString, '');
38346
- if (!window.pendo.dom('#_pendoSkipIcon').length) {
38347
- window.pendo.dom('#pendo-guide-container').append(skipIcon('#999', '30px').trim());
38647
+ if (!pendo.dom('#_pendoSkipIcon').length) {
38648
+ pendo.dom('#pendo-guide-container').append(skipIcon('#999', '30px').trim());
38348
38649
  }
38349
38650
  }
38350
38651
  }
@@ -38360,12 +38661,14 @@ var SkipToEligibleStep = {
38360
38661
  var GuideMarkdown = (function () {
38361
38662
  var guideMarkdown;
38362
38663
  var pluginApi;
38664
+ var globalPendo;
38363
38665
  return {
38364
38666
  'name': 'GuideMarkdown',
38365
38667
  'initialize': init,
38366
38668
  teardown: teardown
38367
38669
  };
38368
38670
  function init(pendo, PluginAPI) {
38671
+ globalPendo = pendo;
38369
38672
  pluginApi = PluginAPI;
38370
38673
  var configReader = PluginAPI.ConfigReader;
38371
38674
  var GUIDEMARKDOWN_CONFIG = 'guideMarkdown';
@@ -38396,7 +38699,7 @@ var GuideMarkdown = (function () {
38396
38699
  function addDesignerListeners(scripts) {
38397
38700
  scripts.forEach(function (script) {
38398
38701
  if (script.designerListener) {
38399
- script.designerListener();
38702
+ script.designerListener(globalPendo, pluginApi);
38400
38703
  }
38401
38704
  });
38402
38705
  }