@pendo/agent 2.275.1 → 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.1_';
3895
- var PACKAGE_VERSION = '2.275.1';
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);
@@ -37538,6 +37679,168 @@ var FormValidation = (function () {
37538
37679
  }
37539
37680
  })();
37540
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
+
37541
37844
  function registerBuiltInPlugins() {
37542
37845
  registerPlugin(IFrameMonitor);
37543
37846
  registerPlugin(DOMActivation);
@@ -37555,6 +37858,7 @@ function registerBuiltInPlugins() {
37555
37858
  registerPlugin(SegmentFlags$1);
37556
37859
  registerPlugin(WebAnalytics$1);
37557
37860
  registerPlugin(FormValidation);
37861
+ registerPlugin(PromptAnalytics);
37558
37862
  }
37559
37863
 
37560
37864
  /*
@@ -37712,8 +38016,6 @@ function getDefaultExportFromCjs (x) {
37712
38016
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
37713
38017
  }
37714
38018
 
37715
- /* eslint-disable agent-eslint-rules/no-window-pendo */
37716
-
37717
38019
  var substitutionRegex = '\\{(?:\\s?)([^.\\s]?visitor|account|parentAccount)\\.([^|\\s/]*)(?:\\s?\\|\\s?([^}]+|[\\/s]+))?(?:\\s?\\/\\s?){1}\\}';
37718
38020
  var skipStepString = '{skipStep:* *(auto|\\d+)\\/}';
37719
38021
  var goToMiddleString = '(?!0)(\\d+)';
@@ -37730,9 +38032,9 @@ function lookupGuideButtons(domJson, buttons) {
37730
38032
  }
37731
38033
  return buttons;
37732
38034
  }
37733
- function removeMarkdownSyntax(element, textToReplace, replacementText) {
38035
+ function removeMarkdownSyntax(element, textToReplace, replacementText, pendo) {
37734
38036
  var _a;
37735
- if (window.pendo.dom(element).hasClass('_pendo-nps-open-text-poll-question')) {
38037
+ if (pendo.dom(element).hasClass('_pendo-nps-open-text-poll-question')) {
37736
38038
  // This prevents us from removing the message for the conditionally rendered elements
37737
38039
  element.innerHTML = (_a = element.innerHTML) === null || _a === void 0 ? void 0 : _a.replace(textToReplace, replacementText);
37738
38040
  }
@@ -37745,10 +38047,10 @@ function removeMarkdownSyntax(element, textToReplace, replacementText) {
37745
38047
  }
37746
38048
  if (element.children.length > 0)
37747
38049
  return;
37748
- if (window.pendo.dom(element).hasClass('_pendo-simple-text') ||
37749
- window.pendo.dom(element).hasClass('_pendo-text-plain') ||
37750
- window.pendo.dom(element).hasClass('_pendo-text-list-item') ||
37751
- 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')) {
37752
38054
  element.textContent = element.textContent.replace(textToReplace, replacementText);
37753
38055
  }
37754
38056
  }
@@ -37761,38 +38063,37 @@ var guideMarkdownUtil = {
37761
38063
  };
37762
38064
 
37763
38065
  // Does not support submit and go to
37764
- /* eslint-disable agent-eslint-rules/no-window-pendo */
37765
38066
  var goToRegex = new RegExp(guideMarkdownUtil.goToString);
37766
38067
  var PollBranching = {
37767
38068
  'name': 'PollBranching',
37768
- 'script': function (step, guide) {
38069
+ 'script': function (step, guide, pendo) {
37769
38070
  var isAdvanceIntercepted = false;
37770
- var branchingQuestions = initialBranchingSetup(step);
38071
+ var branchingQuestions = initialBranchingSetup(step, pendo);
37771
38072
  if (branchingQuestions) {
37772
38073
  // If there are too many branching questions saved, exit and run the guide normally.
37773
- if (window.pendo._.size(branchingQuestions) > 1)
38074
+ if (pendo._.size(branchingQuestions) > 1)
37774
38075
  return;
37775
38076
  this.on('beforeAdvance', function (evt) {
37776
38077
  var noResponseSelected = step.guideElement.find('[branching] .pendo-radio:checked').length === 0;
37777
38078
  var responseLabel = step.guideElement.find('[branching] .pendo-radio:checked + label')[0];
37778
38079
  var noGotoLabel;
37779
38080
  if (responseLabel) {
37780
- noGotoLabel = window.pendo._.isNull(responseLabel.getAttribute('goToStep'));
38081
+ noGotoLabel = pendo._.isNull(responseLabel.getAttribute('goToStep'));
37781
38082
  }
37782
38083
  if (isAdvanceIntercepted || noResponseSelected || noGotoLabel)
37783
38084
  return;
37784
38085
  isAdvanceIntercepted = true;
37785
- branchingGoToStep(evt, step, guide);
38086
+ branchingGoToStep(evt, step, guide, pendo);
37786
38087
  });
37787
38088
  }
37788
38089
  },
37789
- 'test': function (step) {
38090
+ 'test': function (step, guide, pendo) {
37790
38091
  var _a;
37791
38092
  var branchingQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
37792
- return !window.pendo._.isUndefined(branchingQuestions) && window.pendo._.size(branchingQuestions);
38093
+ return !pendo._.isUndefined(branchingQuestions) && pendo._.size(branchingQuestions);
37793
38094
  },
37794
- 'designerListener': function () {
37795
- var target = window.pendo.dom.getBody();
38095
+ 'designerListener': function (pendo) {
38096
+ var target = pendo.dom.getBody();
37796
38097
  var config = {
37797
38098
  'attributeFilter': ['data-layout'],
37798
38099
  'attributes': true,
@@ -37805,34 +38106,34 @@ var PollBranching = {
37805
38106
  function applyBranchingIndicators(mutations) {
37806
38107
  mutations.forEach(function (mutation) {
37807
38108
  var _a;
37808
- 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);
37809
38110
  if (mutation.addedNodes.length && nodeHasQuerySelector) {
37810
38111
  if (mutation.addedNodes[0].querySelector('._pendo-multi-choice-poll-select-border')) {
37811
- if (window.pendo._.size(window.pendo.dom('._pendo-multi-choice-poll-question:contains("{branching/}")'))) {
37812
- window.pendo
38112
+ if (pendo._.size(pendo.dom('._pendo-multi-choice-poll-question:contains("{branching/}")'))) {
38113
+ pendo
37813
38114
  .dom('._pendo-multi-choice-poll-question:contains("{branching/}")')
37814
38115
  .each(function (question, index) {
37815
- window.pendo._.each(window.pendo.dom("#".concat(question.id, " *")), function (element) {
37816
- guideMarkdownUtil.removeMarkdownSyntax(element, '{branching/}', '');
38116
+ pendo._.each(pendo.dom("#".concat(question.id, " *")), function (element) {
38117
+ guideMarkdownUtil.removeMarkdownSyntax(element, '{branching/}', '', pendo);
37817
38118
  });
37818
- window.pendo
38119
+ pendo
37819
38120
  .dom("#".concat(question.id, " p"))
37820
38121
  .css({ 'display': 'inline-block !important' })
37821
38122
  .append(branchingIcon('#999', '20px'))
37822
38123
  .attr({ 'title': 'Custom Branching Added' });
37823
38124
  var dataPendoPollId = question.getAttribute('data-pendo-poll-id');
37824
- if (window.pendo.dom("._pendo-multi-choice-poll-question[data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0]) {
37825
- window.pendo
38125
+ if (pendo.dom("._pendo-multi-choice-poll-question[data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0]) {
38126
+ pendo
37826
38127
  .dom("._pendo-multi-choice-poll-question[data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0]
37827
38128
  .textContent.trim();
37828
38129
  }
37829
- var pollLabels = window.pendo.dom("label[for*=".concat(dataPendoPollId, "]"));
37830
- if (window.pendo._.size(pollLabels)) {
37831
- 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) {
37832
38133
  if (goToRegex.test(label.textContent)) {
37833
38134
  var labelTitle = goToRegex.exec(label.textContent)[2];
37834
- guideMarkdownUtil.removeMarkdownSyntax(label, goToRegex, '');
37835
- window.pendo
38135
+ guideMarkdownUtil.removeMarkdownSyntax(label, goToRegex, '', pendo);
38136
+ pendo
37836
38137
  .dom(label)
37837
38138
  .append(branchingIcon('#999', '14px'))
37838
38139
  .attr({ 'title': "Branching to step ".concat(labelTitle) });
@@ -37840,11 +38141,11 @@ var PollBranching = {
37840
38141
  });
37841
38142
  }
37842
38143
  if (index > 0) {
37843
- window.pendo
38144
+ pendo
37844
38145
  .dom(question)
37845
38146
  .append(branchingErrorHTML(question.dataset.pendoPollId));
37846
- window.pendo.dom("#".concat(question.id, " #pendo-ps-branching-svg")).remove();
37847
- window.pendo
38147
+ pendo.dom("#".concat(question.id, " #pendo-ps-branching-svg")).remove();
38148
+ pendo
37848
38149
  .dom("#".concat(question.id, " p"))
37849
38150
  .css({ 'display': 'inline-block !important' })
37850
38151
  .append(branchingIcon('red', '20px'))
@@ -37864,31 +38165,31 @@ var PollBranching = {
37864
38165
  }
37865
38166
  }
37866
38167
  };
37867
- function initialBranchingSetup(step) {
38168
+ function initialBranchingSetup(step, pendo) {
37868
38169
  var questions = step.guideElement.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
37869
- window.pendo._.forEach(questions, function (question) {
38170
+ pendo._.forEach(questions, function (question) {
37870
38171
  var dataPendoPollId = question.getAttribute('data-pendo-poll-id');
37871
- window.pendo._.each(step.guideElement.find("#".concat(question.id, " *")), function (element) {
37872
- guideMarkdownUtil.removeMarkdownSyntax(element, '{branching/}', '');
38172
+ pendo._.each(step.guideElement.find("#".concat(question.id, " *")), function (element) {
38173
+ guideMarkdownUtil.removeMarkdownSyntax(element, '{branching/}', '', pendo);
37873
38174
  });
37874
38175
  var pollLabels = step.guideElement.find("label[for*=".concat(dataPendoPollId, "]"));
37875
- window.pendo._.forEach(pollLabels, function (label) {
37876
- if (window.pendo._.isNull(goToRegex.exec(label.textContent))) {
38176
+ pendo._.forEach(pollLabels, function (label) {
38177
+ if (pendo._.isNull(goToRegex.exec(label.textContent))) {
37877
38178
  return;
37878
38179
  }
37879
38180
  var gotoSubstring = goToRegex.exec(label.textContent)[1];
37880
38181
  var gotoIndex = goToRegex.exec(label.textContent)[2];
37881
38182
  label.setAttribute('goToStep', gotoIndex);
37882
- guideMarkdownUtil.removeMarkdownSyntax(label, gotoSubstring, '');
38183
+ guideMarkdownUtil.removeMarkdownSyntax(label, gotoSubstring, '', pendo);
37883
38184
  });
37884
38185
  var pollChoiceContainer = step.guideElement.find("[data-pendo-poll-id=".concat(dataPendoPollId, "]._pendo-multi-choice-poll-select-border"));
37885
- if (pollChoiceContainer) {
38186
+ if (pollChoiceContainer && pollChoiceContainer.length) {
37886
38187
  pollChoiceContainer[0].setAttribute('branching', '');
37887
38188
  }
37888
38189
  });
37889
38190
  return questions;
37890
38191
  }
37891
- function branchingGoToStep(event, step, guide) {
38192
+ function branchingGoToStep(event, step, guide, pendo) {
37892
38193
  var _a;
37893
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;
37894
38195
  var checkedPollLabel = step.guideElement.find("label[for=\"".concat(checkedPollInputId, "\"]"))[0];
@@ -37899,30 +38200,29 @@ function branchingGoToStep(event, step, guide) {
37899
38200
  var destinationObject = {
37900
38201
  'destinationStepId': guide.steps[pollStepIndex].id
37901
38202
  };
37902
- window.pendo.goToStep(destinationObject);
38203
+ pendo.goToStep(destinationObject);
37903
38204
  event.cancel = true;
37904
38205
  }
37905
38206
 
37906
- /* eslint-disable agent-eslint-rules/no-window-pendo */
37907
38207
  var containerSelector = '[id^="pendo-guide-container"]';
37908
38208
  var MetadataSubstitution = {
37909
38209
  'name': 'MetadataSubstitution',
37910
- 'script': function (step, guide) {
37911
- var placeholderData = findSubstitutableElements();
38210
+ 'script': function (step, guide, pendo) {
38211
+ var placeholderData = findSubstitutableElements(pendo);
37912
38212
  if (step.domJson) {
37913
- findSubstitutableUrlsInJson(step.domJson, placeholderData);
38213
+ findSubstitutableUrlsInJson(step.domJson, placeholderData, pendo);
37914
38214
  }
37915
- if (window.pendo._.size(placeholderData)) {
37916
- window.pendo._.each(placeholderData, function (placeholder) {
37917
- processPlaceholder(placeholder);
38215
+ if (pendo._.size(placeholderData)) {
38216
+ pendo._.each(placeholderData, function (placeholder) {
38217
+ processPlaceholder(placeholder, pendo);
37918
38218
  });
37919
38219
  var containerId = "pendo-g-".concat(step.id);
37920
38220
  var context_1 = step.guideElement;
37921
- updateGuideContainer(containerId, context_1);
38221
+ updateGuideContainer(containerId, context_1, pendo);
37922
38222
  }
37923
38223
  },
37924
- 'designerListener': function () {
37925
- var target = window.pendo.dom.getBody();
38224
+ 'designerListener': function (pendo) {
38225
+ var target = pendo.dom.getBody();
37926
38226
  var config = {
37927
38227
  'attributeFilter': ['data-layout'],
37928
38228
  'attributes': true,
@@ -37937,23 +38237,23 @@ var MetadataSubstitution = {
37937
38237
  var _a;
37938
38238
  if (mutation.addedNodes.length) {
37939
38239
  if (document.querySelector(containerSelector)) {
37940
- var placeholderData = findSubstitutableElements();
37941
- 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];
37942
38242
  if (!step)
37943
38243
  return;
37944
38244
  var pendoBlocks = step.buildingBlocks;
37945
- if (!window.pendo._.isUndefined(pendoBlocks)) {
37946
- findSubstitutableUrlsInJson(pendoBlocks, placeholderData);
38245
+ if (!pendo._.isUndefined(pendoBlocks)) {
38246
+ findSubstitutableUrlsInJson(pendoBlocks, placeholderData, pendo);
37947
38247
  }
37948
- if (window.pendo._.size(placeholderData)) {
37949
- window.pendo._.each(placeholderData, function (placeholder) {
37950
- if (window.pendo._.isUndefined(placeholder))
38248
+ if (pendo._.size(placeholderData)) {
38249
+ pendo._.each(placeholderData, function (placeholder) {
38250
+ if (pendo._.isUndefined(placeholder))
37951
38251
  return;
37952
- processPlaceholder(placeholder);
38252
+ processPlaceholder(placeholder, pendo);
37953
38253
  });
37954
38254
  var containerId = "pendo-g-".concat(step.id);
37955
38255
  var context_2 = step.guideElement;
37956
- updateGuideContainer(containerId, context_2);
38256
+ updateGuideContainer(containerId, context_2, pendo);
37957
38257
  }
37958
38258
  }
37959
38259
  }
@@ -37961,13 +38261,13 @@ var MetadataSubstitution = {
37961
38261
  }
37962
38262
  }
37963
38263
  };
37964
- function processPlaceholder(placeholder) {
38264
+ function processPlaceholder(placeholder, pendo) {
37965
38265
  var match;
37966
38266
  var data = placeholder.data, target = placeholder.target;
37967
38267
  var subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
37968
38268
  while ((match = matchPlaceholder(placeholder, subRegex))) {
37969
38269
  var matched = subRegex.exec(match);
37970
- var mdValue = getSubstitueValue(matched);
38270
+ var mdValue = getSubstituteValue(matched, pendo);
37971
38271
  substituteMetadataByTarget(data, target, mdValue, matched);
37972
38272
  }
37973
38273
  }
@@ -37979,16 +38279,16 @@ function matchPlaceholder(placeholder, regex) {
37979
38279
  return decodeURI(placeholder.data[placeholder.target]).match(regex);
37980
38280
  }
37981
38281
  }
37982
- function getSubstitueValue(match) {
37983
- 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]))
37984
38284
  return;
37985
38285
  var type = match[1];
37986
38286
  var property = match[2];
37987
38287
  var defaultValue = match[3];
37988
- if (window.pendo._.isUndefined(type) || window.pendo._.isUndefined(property)) {
38288
+ if (pendo._.isUndefined(type) || pendo._.isUndefined(property)) {
37989
38289
  return;
37990
38290
  }
37991
- 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 || '';
37992
38292
  return mdValue;
37993
38293
  }
37994
38294
  function substituteMetadataByTarget(data, target, mdValue, matched) {
@@ -38001,14 +38301,14 @@ function substituteMetadataByTarget(data, target, mdValue, matched) {
38001
38301
  .replace(matched[0], mdValue);
38002
38302
  }
38003
38303
  }
38004
- function updateGuideContainer(containerId, context) {
38005
- if (window.pendo.designer && !window.pendo._.size(window.pendo.dom('#pendo-ps-substitution-icon'))) {
38006
- 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'));
38007
38307
  }
38008
- window.pendo.flexElement(window.pendo.dom(containerSelector));
38009
- window.pendo.BuildingBlocks.BuildingBlockGuides.recalculateGuideHeight(containerId, context);
38308
+ pendo.flexElement(pendo.dom(containerSelector));
38309
+ pendo.BuildingBlocks.BuildingBlockGuides.recalculateGuideHeight(containerId, context);
38010
38310
  }
38011
- function findSubstitutableUrlsInJson(originalData, placeholderData) {
38311
+ function findSubstitutableUrlsInJson(originalData, placeholderData, pendo) {
38012
38312
  if (placeholderData === void 0) { placeholderData = []; }
38013
38313
  var subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
38014
38314
  if ((originalData.name === 'url' || originalData.name === 'href') && originalData.value) {
@@ -38020,35 +38320,35 @@ function findSubstitutableUrlsInJson(originalData, placeholderData) {
38020
38320
  }
38021
38321
  }
38022
38322
  if (originalData.properties && originalData.id === 'href_link_block') {
38023
- window.pendo._.each(originalData.properties, function (prop) {
38024
- findSubstitutableUrlsInJson(prop, placeholderData);
38323
+ pendo._.each(originalData.properties, function (prop) {
38324
+ findSubstitutableUrlsInJson(prop, placeholderData, pendo);
38025
38325
  });
38026
38326
  }
38027
38327
  if (originalData.views) {
38028
- window.pendo._.each(originalData.views, function (view) {
38029
- findSubstitutableUrlsInJson(view, placeholderData);
38328
+ pendo._.each(originalData.views, function (view) {
38329
+ findSubstitutableUrlsInJson(view, placeholderData, pendo);
38030
38330
  });
38031
38331
  }
38032
38332
  if (originalData.parameters) {
38033
- window.pendo._.each(originalData.parameters, function (param) {
38034
- findSubstitutableUrlsInJson(param, placeholderData);
38333
+ pendo._.each(originalData.parameters, function (param) {
38334
+ findSubstitutableUrlsInJson(param, placeholderData, pendo);
38035
38335
  });
38036
38336
  }
38037
38337
  if (originalData.actions) {
38038
- window.pendo._.each(originalData.actions, function (action) {
38039
- findSubstitutableUrlsInJson(action, placeholderData);
38338
+ pendo._.each(originalData.actions, function (action) {
38339
+ findSubstitutableUrlsInJson(action, placeholderData, pendo);
38040
38340
  });
38041
38341
  }
38042
38342
  if (originalData.children) {
38043
- window.pendo._.each(originalData.children, function (child) {
38044
- findSubstitutableUrlsInJson(child, placeholderData);
38343
+ pendo._.each(originalData.children, function (child) {
38344
+ findSubstitutableUrlsInJson(child, placeholderData, pendo);
38045
38345
  });
38046
38346
  }
38047
38347
  return placeholderData;
38048
38348
  }
38049
- function findSubstitutableElements() {
38050
- var elements = window.pendo.dom("".concat(containerSelector, " *:not(.pendo-inline-ui)"));
38051
- 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)
38052
38352
  .filter(function (placeholder) {
38053
38353
  var subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
38054
38354
  if (placeholder.localName === 'a') {
@@ -38062,16 +38362,16 @@ function findSubstitutableElements() {
38062
38362
  }
38063
38363
  if (placeholder.children.length > 0)
38064
38364
  return;
38065
- if (window.pendo.dom(placeholder).hasClass('_pendo-simple-text') ||
38066
- window.pendo.dom(placeholder).hasClass('_pendo-text-plain') ||
38067
- window.pendo.dom(placeholder).hasClass('_pendo-text-list-item') ||
38068
- 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')) {
38069
38369
  return subRegex.test(placeholder.textContent);
38070
38370
  }
38071
38371
  return subRegex.test(placeholder.textContent) || subRegex.test(decodeURI(placeholder.href));
38072
38372
  })
38073
38373
  .map(function (placeholder) {
38074
- if (placeholder.localName === 'a' && window.pendo.dom(placeholder).hasClass('_pendo-text-link')) {
38374
+ if (placeholder.localName === 'a' && pendo.dom(placeholder).hasClass('_pendo-text-link')) {
38075
38375
  return [{
38076
38376
  'data': placeholder,
38077
38377
  'target': 'href'
@@ -38092,10 +38392,10 @@ function findSubstitutableElements() {
38092
38392
  'target': 'textContent'
38093
38393
  };
38094
38394
  }
38095
- if (window.pendo.dom(placeholder).hasClass('_pendo-simple-text') ||
38096
- window.pendo.dom(placeholder).hasClass('_pendo-text-plain') ||
38097
- window.pendo.dom(placeholder).hasClass('_pendo-text-list-item') ||
38098
- 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')) {
38099
38399
  return {
38100
38400
  'data': placeholder,
38101
38401
  'target': 'textContent'
@@ -38109,11 +38409,10 @@ function substitutionIcon(color, size) {
38109
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>"));
38110
38410
  }
38111
38411
 
38112
- /* eslint-disable agent-eslint-rules/no-window-pendo */
38113
38412
  var requiredElement = '<span class="_pendo-required-indicator" style="color:red; font-style:italic;" title="Question is required"> *</span>';
38114
38413
  var RequiredQuestions = {
38115
38414
  'name': 'RequiredQuestions',
38116
- 'script': function (step, guide) {
38415
+ 'script': function (step, guide, pendo) {
38117
38416
  var _a;
38118
38417
  var requiredPollIds = [];
38119
38418
  var submitButtons = (_a = guideMarkdownUtil.lookupGuideButtons(step.domJson)) === null || _a === void 0 ? void 0 : _a.filter(function (button) {
@@ -38121,7 +38420,7 @@ var RequiredQuestions = {
38121
38420
  });
38122
38421
  var requiredQuestions = processRequiredQuestions();
38123
38422
  if (requiredQuestions) {
38124
- window.pendo._.forEach(requiredQuestions, function (question) {
38423
+ pendo._.forEach(requiredQuestions, function (question) {
38125
38424
  if (question.classList.contains('_pendo-open-text-poll-question')) {
38126
38425
  var pollId = question.dataset.pendoPollId;
38127
38426
  step.attachEvent(step.guideElement.find("[data-pendo-poll-id=".concat(pollId, "]._pendo-open-text-poll-input"))[0], 'input', function () {
@@ -38138,19 +38437,19 @@ var RequiredQuestions = {
38138
38437
  function processRequiredQuestions() {
38139
38438
  var questions = step.guideElement.find('[class*=-poll-question]:contains({required/})');
38140
38439
  if (questions) {
38141
- window.pendo._.forEach(questions, function (question) {
38440
+ pendo._.forEach(questions, function (question) {
38142
38441
  var dataPendoPollId = question.getAttribute('data-pendo-poll-id');
38143
38442
  requiredPollIds.push(dataPendoPollId);
38144
- window.pendo._.each(step.guideElement.find("#".concat(question.id, " *, #").concat(question.id)), function (element) {
38145
- guideMarkdownUtil.removeMarkdownSyntax(element, '{required/}', '');
38443
+ pendo._.each(step.guideElement.find("#".concat(question.id, " *, #").concat(question.id)), function (element) {
38444
+ guideMarkdownUtil.removeMarkdownSyntax(element, '{required/}', '', pendo);
38146
38445
  });
38147
38446
  step.guideElement.find("#".concat(question.id, " p")).append(requiredElement);
38148
38447
  });
38149
38448
  }
38150
- if (window.pendo._.size(requiredPollIds)) {
38449
+ if (pendo._.size(requiredPollIds)) {
38151
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>";
38152
- if (window.pendo.dom('#_pendo-guide-required-disabled').length === 0) {
38153
- window.pendo.dom('head').append(disabledButtonStyles);
38451
+ if (pendo.dom('#_pendo-guide-required-disabled').length === 0) {
38452
+ pendo.dom('head').append(disabledButtonStyles);
38154
38453
  }
38155
38454
  disableEligibleButtons(submitButtons);
38156
38455
  }
@@ -38161,14 +38460,14 @@ var RequiredQuestions = {
38161
38460
  return;
38162
38461
  var allRequiredComplete = true;
38163
38462
  var responses = [];
38164
- responses = responses.concat(window.pendo._.map(questions, function (question) {
38463
+ responses = responses.concat(pendo._.map(questions, function (question) {
38165
38464
  var pollId = question.getAttribute('data-pendo-poll-id');
38166
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"));
38167
38466
  if (input && input.length && input[0].value) {
38168
38467
  return input[0].value;
38169
38468
  }
38170
38469
  }));
38171
- if (responses.includes(undefined) || window.pendo._.isEmpty(responses)) {
38470
+ if (responses.includes(undefined) || pendo._.isEmpty(responses)) {
38172
38471
  allRequiredComplete = false;
38173
38472
  }
38174
38473
  if (allRequiredComplete) {
@@ -38195,13 +38494,13 @@ var RequiredQuestions = {
38195
38494
  });
38196
38495
  }
38197
38496
  },
38198
- 'test': function (step) {
38497
+ 'test': function (step, guide, pendo) {
38199
38498
  var _a;
38200
38499
  var requiredQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find('[class*=-poll-question]:contains({required/})');
38201
- return !window.pendo._.isUndefined(requiredQuestions) && window.pendo._.size(requiredQuestions);
38500
+ return !pendo._.isUndefined(requiredQuestions) && pendo._.size(requiredQuestions);
38202
38501
  },
38203
- 'designerListener': function () {
38204
- var target = window.pendo.dom.getBody();
38502
+ 'designerListener': function (pendo) {
38503
+ var target = pendo.dom.getBody();
38205
38504
  var config = {
38206
38505
  'attributeFilter': ['data-layout'],
38207
38506
  'attributes': true,
@@ -38214,7 +38513,7 @@ var RequiredQuestions = {
38214
38513
  function applyRequiredIndicators(mutations) {
38215
38514
  mutations.forEach(function (mutation) {
38216
38515
  var _a;
38217
- 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);
38218
38517
  if (mutation.addedNodes.length && nodeHasQuerySelector) {
38219
38518
  var eligiblePolls = mutation.addedNodes[0].querySelectorAll('[class*=-poll-wrapper], [class*=-poll-select-border]');
38220
38519
  if (eligiblePolls) {
@@ -38228,21 +38527,21 @@ var RequiredQuestions = {
38228
38527
  dataPendoPollId = poll.getAttribute('data-pendo-poll-id');
38229
38528
  }
38230
38529
  var questionText;
38231
- if (window.pendo.dom("[class*=\"-poll-question\"][data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0]) {
38232
- 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;
38233
38532
  }
38234
38533
  if (questionText.includes('{required/}')) {
38235
- window.pendo._.each(window.pendo.dom("[data-pendo-poll-id=".concat(dataPendoPollId, "]:not(.pendo-radio)")), function (element) {
38236
- window.pendo._.each(window.pendo.dom("#".concat(element.id, " *:not(\".pendo-radio\"), #").concat(element.id, ":not(\".pendo-radio\")")), function (item) {
38237
- 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);
38238
38537
  });
38239
38538
  });
38240
- 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) {
38241
- window.pendo.dom(".bb-text[data-pendo-poll-id=".concat(dataPendoPollId, "] p")).append(requiredElement);
38242
- 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);
38243
38542
  }
38244
38543
  else {
38245
- 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);
38246
38545
  }
38247
38546
  }
38248
38547
  });
@@ -38253,10 +38552,9 @@ var RequiredQuestions = {
38253
38552
  }
38254
38553
  };
38255
38554
 
38256
- /* eslint-disable agent-eslint-rules/no-window-pendo */
38257
38555
  var skipStepRegex = new RegExp(guideMarkdownUtil.skipStepString);
38258
38556
  var SkipToEligibleStep = {
38259
- 'script': function (step, guide) {
38557
+ 'script': function (step, guide, pendo) {
38260
38558
  var isAdvanceIntercepted = false;
38261
38559
  var isPreviousIntercepted = false;
38262
38560
  var guideContainer = step.guideElement.find('#pendo-guide-container');
@@ -38266,22 +38564,22 @@ var SkipToEligibleStep = {
38266
38564
  guideContainer.attr({ 'aria-label': guideContainer.attr('aria-label').replace(skipStepRegex, '') });
38267
38565
  }
38268
38566
  this.on('beforeAdvance', function (evt) {
38269
- if (guide.getPositionOfStep(step) === guide.steps.length || window.pendo._.isUndefined(stepNumberOrAuto))
38567
+ if (guide.getPositionOfStep(step) === guide.steps.length || pendo._.isUndefined(stepNumberOrAuto))
38270
38568
  return; // exit on the last step of a guide or when we don't have an argument
38271
38569
  var eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'next');
38272
38570
  if (!isAdvanceIntercepted && stepNumberOrAuto) {
38273
38571
  isAdvanceIntercepted = true;
38274
- window.pendo.goToStep({ 'destinationStepId': eligibleStep.id });
38572
+ pendo.goToStep({ 'destinationStepId': eligibleStep.id });
38275
38573
  evt.cancel = true;
38276
38574
  }
38277
38575
  });
38278
38576
  this.on('beforePrevious', function (evt) {
38279
- if (window.pendo._.isUndefined(stepNumberOrAuto))
38577
+ if (pendo._.isUndefined(stepNumberOrAuto))
38280
38578
  return;
38281
38579
  var eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'previous');
38282
38580
  if (!isPreviousIntercepted && stepNumberOrAuto) {
38283
38581
  isPreviousIntercepted = true;
38284
- window.pendo.goToStep({ 'destinationStepId': eligibleStep.id });
38582
+ pendo.goToStep({ 'destinationStepId': eligibleStep.id });
38285
38583
  evt.cancel = true;
38286
38584
  }
38287
38585
  });
@@ -38291,15 +38589,15 @@ var SkipToEligibleStep = {
38291
38589
  var skipForwardStep = findStepOnPage(guide.getPositionOfStep(step), 'next', stepNumber);
38292
38590
  var skipPreviousStep = findStepOnPage(guide.getPositionOfStep(step) - 2, 'previous', stepNumber);
38293
38591
  if (skipForwardStep && direction == 'next') {
38294
- window.pendo.goToStep({ 'destinationStepId': skipForwardStep });
38592
+ pendo.goToStep({ 'destinationStepId': skipForwardStep });
38295
38593
  }
38296
38594
  if (skipPreviousStep && direction == 'previous') {
38297
- window.pendo.goToStep({ 'destinationStepId': skipPreviousStep });
38595
+ pendo.goToStep({ 'destinationStepId': skipPreviousStep });
38298
38596
  }
38299
38597
  return direction === 'next' ? skipForwardStep : skipPreviousStep;
38300
38598
  }
38301
38599
  function findStepOnPage(stepIndex, direction, stepNumber) {
38302
- if (window.pendo._.isNaN(stepIndex))
38600
+ if (pendo._.isNaN(stepIndex))
38303
38601
  return;
38304
38602
  var $step = guide.steps[stepIndex];
38305
38603
  if ($step && !$step.canShow()) {
@@ -38318,13 +38616,13 @@ var SkipToEligibleStep = {
38318
38616
  }
38319
38617
  }
38320
38618
  },
38321
- 'test': function (step) {
38619
+ 'test': function (step, guide, pendo) {
38322
38620
  var _a;
38323
38621
  var guideContainerAriaLabel = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find('#pendo-guide-container').attr('aria-label');
38324
- 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'));
38325
38623
  },
38326
- 'designerListener': function () {
38327
- var target = window.pendo.dom.getBody();
38624
+ 'designerListener': function (pendo) {
38625
+ var target = pendo.dom.getBody();
38328
38626
  var config = {
38329
38627
  'attributeFilter': ['data-layout'],
38330
38628
  'attributes': true,
@@ -38338,7 +38636,7 @@ var SkipToEligibleStep = {
38338
38636
  function applySkipStepIndicator(mutations) {
38339
38637
  mutations.forEach(function (mutation) {
38340
38638
  var _a, _b;
38341
- 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);
38342
38640
  if (mutation.addedNodes.length && nodeHasQuerySelector) {
38343
38641
  var guideContainer = mutation.addedNodes[0].querySelectorAll('#pendo-guide-container');
38344
38642
  var guideContainerAriaLabel = (_b = guideContainer[0]) === null || _b === void 0 ? void 0 : _b.getAttribute('aria-label');
@@ -38346,8 +38644,8 @@ var SkipToEligibleStep = {
38346
38644
  if (guideContainerAriaLabel.match(skipStepRegex)) {
38347
38645
  var fullSkipStepString = guideContainerAriaLabel.match(skipStepRegex)[0];
38348
38646
  guideContainerAriaLabel.replace(fullSkipStepString, '');
38349
- if (!window.pendo.dom('#_pendoSkipIcon').length) {
38350
- 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());
38351
38649
  }
38352
38650
  }
38353
38651
  }
@@ -38363,12 +38661,14 @@ var SkipToEligibleStep = {
38363
38661
  var GuideMarkdown = (function () {
38364
38662
  var guideMarkdown;
38365
38663
  var pluginApi;
38664
+ var globalPendo;
38366
38665
  return {
38367
38666
  'name': 'GuideMarkdown',
38368
38667
  'initialize': init,
38369
38668
  teardown: teardown
38370
38669
  };
38371
38670
  function init(pendo, PluginAPI) {
38671
+ globalPendo = pendo;
38372
38672
  pluginApi = PluginAPI;
38373
38673
  var configReader = PluginAPI.ConfigReader;
38374
38674
  var GUIDEMARKDOWN_CONFIG = 'guideMarkdown';
@@ -38399,7 +38699,7 @@ var GuideMarkdown = (function () {
38399
38699
  function addDesignerListeners(scripts) {
38400
38700
  scripts.forEach(function (script) {
38401
38701
  if (script.designerListener) {
38402
- script.designerListener();
38702
+ script.designerListener(globalPendo, pluginApi);
38403
38703
  }
38404
38704
  });
38405
38705
  }