@pendo/agent 2.299.0 → 2.301.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.
@@ -3540,7 +3540,6 @@ var ConfigReader = (function () {
3540
3540
  addOption('formValidation', [PENDO_CONFIG_SRC], false);
3541
3541
  // Performance Metrics
3542
3542
  addOption('performanceMetricsEnabled', [SNIPPET_SRC, PENDO_CONFIG_SRC], true);
3543
- addOption('sendPerformanceMetrics', [SNIPPET_SRC, PENDO_CONFIG_SRC], false);
3544
3543
  }
3545
3544
  initializeOptions();
3546
3545
  var sourceGetters = {};
@@ -3905,8 +3904,8 @@ let SERVER = '';
3905
3904
  let ASSET_HOST = '';
3906
3905
  let ASSET_PATH = '';
3907
3906
  let DESIGNER_SERVER = '';
3908
- let VERSION = '2.299.0_';
3909
- let PACKAGE_VERSION = '2.299.0';
3907
+ let VERSION = '2.301.0_';
3908
+ let PACKAGE_VERSION = '2.301.0';
3910
3909
  let LOADER = 'xhr';
3911
3910
  /* eslint-enable agent-eslint-rules/no-gulp-env-references */
3912
3911
  /**
@@ -5559,6 +5558,8 @@ var Events = (function () {
5559
5558
  new EventType('sessionChanged', [LIFECYCLE]),
5560
5559
  new EventType('ptm:unpaused', [LIFECYCLE]),
5561
5560
  new EventType('ptm:paused', [LIFECYCLE]),
5561
+ new EventType('recording:unpaused', [LIFECYCLE]),
5562
+ new EventType('recording:paused', [LIFECYCLE]),
5562
5563
  new EventType('childFrameJoined', [FRAMES]),
5563
5564
  new EventType('tabIdChanged:self', [DEBUG, LIFECYCLE])
5564
5565
  ];
@@ -6110,7 +6111,7 @@ var URL = (function(global, factory) {
6110
6111
  })(window, URLPolyfillFactory);
6111
6112
 
6112
6113
  function hasComposedPath(evt) {
6113
- return evt && _.isFunction(evt.composedPath);
6114
+ return evt && typeof evt.composedPath === 'function';
6114
6115
  }
6115
6116
  function getComposedPath(evt) {
6116
6117
  if (hasComposedPath(evt)) {
@@ -6262,6 +6263,7 @@ var sizzle = {exports: {}};
6262
6263
  tokenCache = createCache(),
6263
6264
  compilerCache = createCache(),
6264
6265
  nonnativeSelectorCache = createCache(),
6266
+ nativeishSelectorCache = createCache(),
6265
6267
  sortOrder = function( a, b ) {
6266
6268
  if ( a === b ) {
6267
6269
  hasDuplicate = true;
@@ -6455,6 +6457,46 @@ var sizzle = {exports: {}};
6455
6457
  };
6456
6458
  }
6457
6459
 
6460
+ function isContains(token) {
6461
+ return token.type === 'PSEUDO' && token.matches.length && token.matches[0].replace(rtrim, "$1").toLowerCase() === 'contains';
6462
+ }
6463
+
6464
+ function filterTokens(tokens, predicate) {
6465
+ if (tokens[0].length) {
6466
+ return tokens.map(function(innerTokens) {
6467
+ return filterTokens(innerTokens, predicate);
6468
+ });
6469
+ } else {
6470
+ return tokens.filter(predicate);
6471
+ }
6472
+ }
6473
+
6474
+ function tokensToSelector(tokens) {
6475
+ if (tokens[0].length) {
6476
+ return tokens.map(tokensToSelector).join(',');
6477
+ } else {
6478
+ return toSelector(tokens);
6479
+ }
6480
+ }
6481
+
6482
+ function findSeedForNonNativeSelector(selector, context, selectorCache) {
6483
+ var hopefullyNativeSelector = selectorCache[ selector + " " ];
6484
+ if (!hopefullyNativeSelector) {
6485
+ var nonnativeTokens = tokenize(selector);
6486
+ var hopefullyNativeTokens = filterTokens(nonnativeTokens, function(token) {
6487
+ return !isContains(token);
6488
+ });
6489
+ hopefullyNativeSelector = tokensToSelector(hopefullyNativeTokens);
6490
+ }
6491
+ try {
6492
+ var seed = [];
6493
+ push.apply(seed, context.querySelectorAll(hopefullyNativeSelector));
6494
+ selectorCache(selector, hopefullyNativeSelector);
6495
+ return seed;
6496
+ } catch (e) {
6497
+ }
6498
+ }
6499
+
6458
6500
  function Sizzle( selector, context, results, seed ) {
6459
6501
  var m, i, elem, nid, match, groups, newSelector,
6460
6502
  newContext = context && context.ownerDocument,
@@ -6531,7 +6573,7 @@ var sizzle = {exports: {}};
6531
6573
 
6532
6574
  // Take advantage of querySelectorAll
6533
6575
  if ( support.qsa &&
6534
- !nonnativeSelectorCache[ selector + " " ] &&
6576
+ (!nonnativeSelectorCache[ selector + " " ] || nativeishSelectorCache[ selector + " " ]) &&
6535
6577
  ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) &&
6536
6578
 
6537
6579
  // Support: IE 8 only
@@ -6589,6 +6631,10 @@ var sizzle = {exports: {}};
6589
6631
  context.removeAttribute( "id" );
6590
6632
  }
6591
6633
  }
6634
+
6635
+ if (!seed && nonnativeSelectorCache[ selector + " " ]) {
6636
+ seed = findSeedForNonNativeSelector(selector, newContext, nativeishSelectorCache);
6637
+ }
6592
6638
  }
6593
6639
  }
6594
6640
  }
@@ -11560,7 +11606,7 @@ var loadResource = function (options, callback, sendErrorToCallback = false) {
11560
11606
  script.src = getPolicy(pendo$1).createScriptURL(options.url);
11561
11607
  addIntegrityAttribute(script, options.url);
11562
11608
  document.body.appendChild(script);
11563
- return {};
11609
+ return script;
11564
11610
  }
11565
11611
  else { // Assume JS file.
11566
11612
  script = document.createElement('script');
@@ -11574,7 +11620,7 @@ var loadResource = function (options, callback, sendErrorToCallback = false) {
11574
11620
  if (err) {
11575
11621
  if (sendErrorToCallback)
11576
11622
  originalCallback(err);
11577
- return;
11623
+ return {};
11578
11624
  }
11579
11625
  originalCallback.apply(this, _.toArray(arguments).slice(1));
11580
11626
  });
@@ -11628,7 +11674,7 @@ var loadWatcher = function (target, url, callback) {
11628
11674
  setTimeout$1(function () {
11629
11675
  if (!isLoaded) {
11630
11676
  // Log a warning if we fail to load the resource within 10 seconds
11631
- writeMessage('Failed to load ' + url + ' within 10 seconds');
11677
+ log.critical('Failed to load ' + url + ' within 10 seconds');
11632
11678
  }
11633
11679
  }, 10000);
11634
11680
  }
@@ -12278,6 +12324,8 @@ class PerformanceMonitor {
12278
12324
  this.measures = new Set();
12279
12325
  }
12280
12326
  initialize() {
12327
+ if (!ConfigReader.get('performanceMetricsEnabled'))
12328
+ return _.noop;
12281
12329
  this._measuringPerformance = true;
12282
12330
  this._markPerformance(INITIALIZE);
12283
12331
  this.interval = setInterval(() => {
@@ -12306,35 +12354,27 @@ class PerformanceMonitor {
12306
12354
  this._markPerformance(name, { detail });
12307
12355
  }
12308
12356
  send() {
12309
- const metrics = _.reduce(METRICS, (acc, metric) => {
12357
+ const payload = _.reduce(METRICS, (acc, metric) => {
12310
12358
  const { name, type, instrument } = metric;
12311
12359
  if (!instrument)
12312
12360
  return acc;
12313
12361
  const entries = performance.getEntriesByName(name);
12314
12362
  const value = instrument(entries);
12315
- if (type === 'counter' && value > 0) {
12316
- acc.push({
12317
- name,
12318
- type,
12319
- value,
12320
- timestamp: Date.now()
12321
- });
12322
- }
12363
+ acc.push({
12364
+ name,
12365
+ type,
12366
+ value,
12367
+ timestamp: Date.now()
12368
+ });
12323
12369
  return acc;
12324
12370
  }, []);
12325
- const payload = _.filter(metrics, (metric) => {
12326
- return metric.value > 0;
12327
- });
12328
12371
  this._clearMarksAndMeasures();
12329
- if (!ConfigReader.get('sendPerformanceMetrics'))
12330
- return;
12331
12372
  if (_.size(payload)) {
12332
12373
  writeMetricsPOST(payload);
12333
12374
  }
12334
12375
  }
12335
12376
  _checkPerformanceApi() {
12336
- return ConfigReader.get('performanceMetricsEnabled') &&
12337
- detectNativeBrowserAPI('performance.mark') &&
12377
+ return detectNativeBrowserAPI('performance.mark') &&
12338
12378
  detectNativeBrowserAPI('performance.measure') &&
12339
12379
  detectNativeBrowserAPI('performance.getEntries') &&
12340
12380
  detectNativeBrowserAPI('performance.getEntriesByName') &&
@@ -20988,22 +21028,13 @@ function continueOrCompleteUpdate() {
20988
21028
  * Otherwise, it is the same as calling startGuides.
20989
21029
  */
20990
21030
  var manuallyStartGuides = function () {
20991
- var originalOptions = ConfigReader.getLocalConfig();
20992
- if (ConfigReader.get('delayGuides')) {
20993
- delete originalOptions.delayGuides;
20994
- ConfigReader.setLocalConfig(originalOptions);
20995
- }
20996
- if (ConfigReader.get('guides.delay')) {
20997
- delete originalOptions.guides.delay;
20998
- ConfigReader.setLocalConfig(originalOptions);
20999
- }
21031
+ setGuidesDelayed(false);
21000
21032
  startGuides();
21001
21033
  };
21002
21034
  var manuallyStopGuides = function () {
21003
21035
  if (!areGuidesDisabled()) {
21004
21036
  setGuidesDelayed(true);
21005
21037
  }
21006
- stopGuides();
21007
21038
  resetPendoUI();
21008
21039
  };
21009
21040
  // a phase that only has one unit of work per update
@@ -24268,30 +24299,40 @@ class GuideCache {
24268
24299
  if (this.db)
24269
24300
  return q.resolve(this.db);
24270
24301
  const deferred = q.defer();
24271
- const request = indexedDB.open(`pendo-${apiKey}`, 1);
24272
- request.onerror = () => {
24273
- log.warn('Error opening guide database');
24274
- this.cacheGuidesPersistent = false;
24275
- deferred.resolve();
24276
- };
24277
- request.onsuccess = (event) => {
24278
- const db = event.target.result;
24279
- this.db = db;
24280
- db.onclose = () => {
24281
- this.db = null;
24302
+ try {
24303
+ const request = indexedDB.open(`pendo-${apiKey}`, 1);
24304
+ request.onerror = () => {
24305
+ this.dbError(new Error('open.request.onerror'));
24306
+ deferred.resolve();
24282
24307
  };
24283
- deferred.resolve(db);
24284
- };
24285
- request.onupgradeneeded = (event) => {
24286
- const db = event.target.result;
24287
- const objectStore = db.createObjectStore('guides', { keyPath: 'guide.id' });
24288
- objectStore.transaction.oncomplete = () => {
24308
+ request.onsuccess = (event) => {
24309
+ const db = event.target.result;
24289
24310
  this.db = db;
24311
+ db.onclose = () => {
24312
+ this.db = null;
24313
+ };
24290
24314
  deferred.resolve(db);
24291
24315
  };
24292
- };
24316
+ request.onupgradeneeded = (event) => {
24317
+ const db = event.target.result;
24318
+ const objectStore = db.createObjectStore('guides', { keyPath: 'guide.id' });
24319
+ objectStore.transaction.oncomplete = () => {
24320
+ this.db = db;
24321
+ deferred.resolve(db);
24322
+ };
24323
+ };
24324
+ }
24325
+ catch (error) {
24326
+ this.dbError(error);
24327
+ deferred.resolve();
24328
+ }
24293
24329
  return deferred.promise;
24294
24330
  }
24331
+ dbError(error) {
24332
+ log.critical('indexedDB cache error', { error });
24333
+ this.cacheGuidesPersistent = false;
24334
+ this.db = null;
24335
+ }
24295
24336
  load(now = getNow()) {
24296
24337
  if (this.cache)
24297
24338
  return q.resolve(this.cache);
@@ -24299,26 +24340,30 @@ class GuideCache {
24299
24340
  if (!this.db)
24300
24341
  return q.resolve(this.cache);
24301
24342
  const deferred = q.defer();
24302
- const objectStore = this.db.transaction(['guides'], 'readwrite').objectStore('guides');
24303
- const request = objectStore.getAll();
24304
- request.onerror = () => {
24305
- log.warn('Error loading guide cache');
24306
- this.cacheGuidesPersistent = false;
24307
- this.db = null;
24308
- deferred.resolve(this.cache);
24309
- };
24310
- request.onsuccess = (event) => {
24311
- const cachedGuides = event.target.result;
24312
- _.each(cachedGuides, (cachedGuide) => {
24313
- if (cachedGuide.expires > now) {
24314
- this.cache[cachedGuide.guide.id] = cachedGuide;
24315
- }
24316
- else {
24317
- objectStore.delete(cachedGuide.guide.id);
24318
- }
24319
- });
24343
+ try {
24344
+ const objectStore = this.db.transaction(['guides'], 'readwrite').objectStore('guides');
24345
+ const request = objectStore.getAll();
24346
+ request.onerror = () => {
24347
+ this.dbError(new Error('load.request.onerror'));
24348
+ deferred.resolve(this.cache);
24349
+ };
24350
+ request.onsuccess = (event) => {
24351
+ const cachedGuides = event.target.result;
24352
+ _.each(cachedGuides, (cachedGuide) => {
24353
+ if (cachedGuide.expires > now) {
24354
+ this.cache[cachedGuide.guide.id] = cachedGuide;
24355
+ }
24356
+ else {
24357
+ objectStore.delete(cachedGuide.guide.id);
24358
+ }
24359
+ });
24360
+ deferred.resolve(this.cache);
24361
+ };
24362
+ }
24363
+ catch (error) {
24364
+ this.dbError(error);
24320
24365
  deferred.resolve(this.cache);
24321
- };
24366
+ }
24322
24367
  return deferred.promise;
24323
24368
  }
24324
24369
  add(guide, visitorId, now = getNow()) {
@@ -24337,16 +24382,22 @@ class GuideCache {
24337
24382
  save(cachedGuide) {
24338
24383
  if (!this.db)
24339
24384
  return;
24340
- const objectStore = this.db.transaction(['guides'], 'readwrite').objectStore('guides');
24341
24385
  const deferred = q.defer();
24342
- const update = objectStore.put(cachedGuide);
24343
- update.onerror = () => {
24344
- log.warn(`Error saving guide to cache ${cachedGuide.guide.id}`);
24345
- deferred.resolve();
24346
- };
24347
- update.onsuccess = () => {
24386
+ try {
24387
+ const objectStore = this.db.transaction(['guides'], 'readwrite').objectStore('guides');
24388
+ const update = objectStore.put(cachedGuide);
24389
+ update.onerror = () => {
24390
+ this.dbError(new Error('save.request.onerror'));
24391
+ deferred.resolve();
24392
+ };
24393
+ update.onsuccess = () => {
24394
+ deferred.resolve();
24395
+ };
24396
+ }
24397
+ catch (error) {
24398
+ this.dbError(error);
24348
24399
  deferred.resolve();
24349
- };
24400
+ }
24350
24401
  return deferred.promise;
24351
24402
  }
24352
24403
  update(lastGuideStepSeen) {
@@ -25915,13 +25966,12 @@ var loadGuides = function (apiKey, visitorId, page, callback) {
25915
25966
  }
25916
25967
  if (displayableGuides.length) {
25917
25968
  q.all([
25918
- loadGuideCss(),
25919
25969
  globalJsPromise,
25920
25970
  initializeResourceCenter(activeGuides),
25921
25971
  BuildingBlockWatermark.initializeWatermark(activeGuides),
25922
25972
  waitForGlobalCssToLoad(5000)
25923
25973
  ]
25924
- .concat(getRegisteredLoadGuideJobs(activeGuides))).then(function () {
25974
+ .concat(getRegisteredLoadGuideJobs(activeGuides), loadGuideCss())).then(function () {
25925
25975
  if (loadGuides.reqId === reqId) {
25926
25976
  if (store.getters['frames/isLeader']()) {
25927
25977
  restoreGuideShownState(getActiveGuides());
@@ -25935,7 +25985,8 @@ var loadGuides = function (apiKey, visitorId, page, callback) {
25935
25985
  }
25936
25986
  deferred.resolve();
25937
25987
  }, function (err) {
25938
- log.error('Post loadGuide request failed: ', err);
25988
+ log.critical(`Post loadGuide request failed: ${err}`);
25989
+ resetPendoUI();
25939
25990
  Events.guidesFailed.trigger();
25940
25991
  deferred.reject();
25941
25992
  });
@@ -25990,6 +26041,9 @@ function loadExternalCss(id, cssUrl) {
25990
26041
  var style = pendo$1.loadResource(cssUrl, function () {
25991
26042
  deferred.resolve();
25992
26043
  });
26044
+ if (_.isEmpty(style)) {
26045
+ return q.reject(`Failed to load CSS resource: ${cssUrl}. Check that the URL is correct and from an allowed origin.`);
26046
+ }
25993
26047
  style.id = id;
25994
26048
  return deferred.promise;
25995
26049
  }
@@ -26068,7 +26122,7 @@ function loadGuideCss() {
26068
26122
  else {
26069
26123
  dom('#' + CUSTOM_CSS_ID).remove();
26070
26124
  }
26071
- return q.all(promises);
26125
+ return promises;
26072
26126
  }
26073
26127
  var processGuideEventCache = function (options) {
26074
26128
  if (!guideEventQueue)
@@ -26220,14 +26274,6 @@ var initGuides = function (observer) {
26220
26274
  teardownFns.push(attachEventInternal(window, 'securitypolicyviolation', securityPolicyViolationFn));
26221
26275
  teardownFns.push(createVideoFullScreenListeners());
26222
26276
  if (observer.observing) {
26223
- var updateGuide = function () {
26224
- store.dispatch('guideUpdate/documentChanged');
26225
- };
26226
- const debouncedUpdate = _.debounce(updateGuide, 50);
26227
- teardownFns.push(() => { debouncedUpdate.cancel(); });
26228
- teardownFns.push(attachEvent(window, 'animationend', debouncedUpdate));
26229
- teardownFns.push(attachEvent(window, 'transitionend', debouncedUpdate));
26230
- teardownFns.push(attachEvent(window, 'mouseover', debouncedUpdate));
26231
26277
  store.commit('guideUpdate/setObserver', observer);
26232
26278
  store.commit('guideUpdate/setUseObserver');
26233
26279
  teardownFns.push(() => store.dispatch('guideUpdate/stopObserver'));
@@ -26318,6 +26364,10 @@ var setGuidesDisabled = function (areDisabled) {
26318
26364
  };
26319
26365
  var setGuidesDelayed = function (areDelayed) {
26320
26366
  var originalOptions = ConfigReader.getLocalConfig();
26367
+ delete originalOptions.delayGuides;
26368
+ if (originalOptions.guides) {
26369
+ delete originalOptions.guides.delay;
26370
+ }
26321
26371
  originalOptions.delayGuides = areDelayed;
26322
26372
  ConfigReader.setLocalConfig(originalOptions);
26323
26373
  };
@@ -33471,6 +33521,7 @@ var GuideUpdateModule = (function () {
33471
33521
  function observerCallback() {
33472
33522
  store.dispatch('guideUpdate/documentChanged');
33473
33523
  }
33524
+ const debouncedCallback = _.debounce(observerCallback, 50);
33474
33525
  function handleScheduledUpdate() {
33475
33526
  store.dispatch('guideUpdate/handleScheduledUpdate');
33476
33527
  }
@@ -33511,6 +33562,9 @@ var GuideUpdateModule = (function () {
33511
33562
  if (!context.state.observing) {
33512
33563
  const observer = context.getters.observer();
33513
33564
  observer.addEventListener('mutation', observerCallback);
33565
+ attachEvent(window, 'animationend', debouncedCallback);
33566
+ attachEvent(window, 'transitionend', debouncedCallback);
33567
+ attachEvent(window, 'mouseover', debouncedCallback);
33514
33568
  context.commit('setObserving', true);
33515
33569
  }
33516
33570
  }
@@ -33519,6 +33573,10 @@ var GuideUpdateModule = (function () {
33519
33573
  const observer = context.getters.observer();
33520
33574
  if (observer) {
33521
33575
  observer.removeEventListener('mutation', observerCallback);
33576
+ debouncedCallback.cancel();
33577
+ detachEvent(window, 'animationend', debouncedCallback);
33578
+ detachEvent(window, 'transitionend', debouncedCallback);
33579
+ detachEvent(window, 'mouseover', debouncedCallback);
33522
33580
  }
33523
33581
  context.commit('setObserving', false);
33524
33582
  context.dispatch('stopScheduledUpdate');
@@ -34228,11 +34286,11 @@ const NetworkUrlModule = (function (global) {
34228
34286
  const getters = {
34229
34287
  getTransformedUrl(state) {
34230
34288
  return function (url) {
34231
- if (_.size(state.transforms) < 1) {
34232
- return url;
34233
- }
34234
34289
  try {
34235
34290
  let urlObj = url instanceof URL ? url : new URL(url, window.location.origin);
34291
+ if (_.size(state.transforms) < 1) {
34292
+ return urlObj.href;
34293
+ }
34236
34294
  urlObj = applyTransforms(state.transforms, urlObj);
34237
34295
  return urlObj.href;
34238
34296
  }
@@ -39811,7 +39869,7 @@ class PromptPlugin {
39811
39869
  promptType: method,
39812
39870
  url,
39813
39871
  privacyFilterApplied: filteredPrompt !== originalBody
39814
- });
39872
+ }, undefined, 'agentic');
39815
39873
  });
39816
39874
  }
39817
39875
  handleError({ error, context }) {
@@ -39853,7 +39911,7 @@ class PromptPlugin {
39853
39911
  promptType: 'request',
39854
39912
  agentType: 'prompt'
39855
39913
  }, promptEvent);
39856
- this.api.analytics.collectEvent('prompt', event);
39914
+ this.api.analytics.collectEvent('prompt', event, undefined, 'agentic');
39857
39915
  }
39858
39916
  teardown() {
39859
39917
  this._.each(this.prompts, (prompt) => prompt.teardown());
@@ -45064,6 +45122,9 @@ class MutationBuffer {
45064
45122
  this.movedMap = {};
45065
45123
  this.mutationCb(payload);
45066
45124
  });
45125
+ __publicField(this, "bufferBelongsToIframe", (iframeEl) => {
45126
+ return this.doc === iframeEl.contentDocument;
45127
+ });
45067
45128
  __publicField(this, "genTextAreaValueMutation", (textarea) => {
45068
45129
  let item = this.attributeMap.get(textarea);
45069
45130
  if (!item) {
@@ -45631,6 +45692,15 @@ function initViewportResizeObserver({ viewportResizeCb }, { win }) {
45631
45692
  );
45632
45693
  return on("resize", updateDimension, win);
45633
45694
  }
45695
+ function findAndRemoveIframeBuffer(iframeEl) {
45696
+ for (let i2 = mutationBuffers.length - 1; i2 >= 0; i2--) {
45697
+ const buf = mutationBuffers[i2];
45698
+ if (buf.bufferBelongsToIframe(iframeEl)) {
45699
+ buf.reset();
45700
+ mutationBuffers.splice(i2, 1);
45701
+ }
45702
+ }
45703
+ }
45634
45704
  const INPUT_TAGS = ["INPUT", "TEXTAREA", "SELECT"];
45635
45705
  const lastInputValueMap = /* @__PURE__ */ new WeakMap();
45636
45706
  function initInputObserver({
@@ -46477,6 +46547,7 @@ class IframeManager {
46477
46547
  __publicField(this, "wrappedEmit");
46478
46548
  __publicField(this, "takeFullSnapshot");
46479
46549
  __publicField(this, "loadListener");
46550
+ __publicField(this, "pageHideListener");
46480
46551
  __publicField(this, "stylesheetManager");
46481
46552
  __publicField(this, "recordCrossOriginIframes");
46482
46553
  this.mutationCb = options.mutationCb;
@@ -46514,6 +46585,9 @@ class IframeManager {
46514
46585
  addLoadListener(cb) {
46515
46586
  this.loadListener = cb;
46516
46587
  }
46588
+ addPageHideListener(cb) {
46589
+ this.pageHideListener = cb;
46590
+ }
46517
46591
  attachIframe(iframeEl, childSn) {
46518
46592
  var _a2, _b, _c;
46519
46593
  this.mutationCb({
@@ -46535,6 +46609,9 @@ class IframeManager {
46535
46609
  this.handleMessage.bind(this)
46536
46610
  );
46537
46611
  (_b = iframeEl.contentWindow) == null ? void 0 : _b.addEventListener("pagehide", () => {
46612
+ var _a3;
46613
+ (_a3 = this.pageHideListener) == null ? void 0 : _a3.call(this, iframeEl);
46614
+ this.mirror.removeNodeFromMap(iframeEl.contentDocument);
46538
46615
  this.crossOriginIframeMap.delete(iframeEl.contentWindow);
46539
46616
  });
46540
46617
  }
@@ -47748,6 +47825,7 @@ function record(options = {}) {
47748
47825
  iframeManager.setTakeFullSnapshot(takeFullSnapshot$1);
47749
47826
  try {
47750
47827
  const handlers = [];
47828
+ const iframeHandlersMap = /* @__PURE__ */ new Map();
47751
47829
  const observe = (doc) => {
47752
47830
  var _a2;
47753
47831
  return callbackWrapper(initObservers)(
@@ -47873,11 +47951,19 @@ function record(options = {}) {
47873
47951
  };
47874
47952
  iframeManager.addLoadListener((iframeEl) => {
47875
47953
  try {
47876
- handlers.push(observe(iframeEl.contentDocument));
47954
+ iframeHandlersMap.set(iframeEl, observe(iframeEl.contentDocument));
47877
47955
  } catch (error) {
47878
47956
  console.warn(error);
47879
47957
  }
47880
47958
  });
47959
+ iframeManager.addPageHideListener((iframeEl) => {
47960
+ const iframeHandler = iframeHandlersMap.get(iframeEl);
47961
+ if (iframeHandler) {
47962
+ iframeHandler();
47963
+ iframeHandlersMap.delete(iframeEl);
47964
+ }
47965
+ findAndRemoveIframeBuffer(iframeEl);
47966
+ });
47881
47967
  const init = () => {
47882
47968
  takeFullSnapshot$1();
47883
47969
  handlers.push(observe(document));
@@ -47911,6 +47997,7 @@ function record(options = {}) {
47911
47997
  }
47912
47998
  return () => {
47913
47999
  handlers.forEach((h) => h());
48000
+ iframeHandlersMap.forEach((h) => h());
47914
48001
  processedNodeManager.destroy();
47915
48002
  recording = false;
47916
48003
  unregisterErrorHandler();
@@ -48244,6 +48331,16 @@ class Transport {
48244
48331
  }
48245
48332
  }
48246
48333
 
48334
+ function isElementShadowRoot(elem, _win) {
48335
+ if (!_win) {
48336
+ _win = window;
48337
+ }
48338
+ return typeof _win.ShadowRoot !== 'undefined' && elem instanceof _win.ShadowRoot && elem.host;
48339
+ }
48340
+ function getParent(elem, _win) {
48341
+ return isElementShadowRoot(elem, _win) ? elem.host : elem.parentNode;
48342
+ }
48343
+
48247
48344
  const ELEMENT_NODE = 1;
48248
48345
  const INPUT_MASK = '*'.repeat(10);
48249
48346
  function isElementNode(node) {
@@ -48254,13 +48351,17 @@ function isElementNode(node) {
48254
48351
  return true;
48255
48352
  }
48256
48353
  function distanceToMatch(node, selector, limit = Infinity, distance = 0) {
48257
- if (!isElementNode(node))
48258
- return -1;
48259
48354
  if (distance > limit)
48260
48355
  return -1;
48261
- if (node.matches(selector))
48262
- return distance;
48263
- return distanceToMatch(node.parentNode, selector, limit, distance + 1);
48356
+ if (!node)
48357
+ return -1;
48358
+ if (isElementNode(node)) {
48359
+ if (node.matches(selector))
48360
+ return distance;
48361
+ if (node.parentNode)
48362
+ return distanceToMatch(node.parentNode, selector, limit, distance + 1);
48363
+ }
48364
+ return distanceToMatch(getParent(node), selector, limit, distance + 1);
48264
48365
  }
48265
48366
  function shouldMask(node, options) {
48266
48367
  const { maskAllText, maskTextSelector, unmaskTextSelector } = options;
@@ -50532,6 +50633,7 @@ var sizzle = {exports: {}};
50532
50633
  tokenCache = createCache(),
50533
50634
  compilerCache = createCache(),
50534
50635
  nonnativeSelectorCache = createCache(),
50636
+ nativeishSelectorCache = createCache(),
50535
50637
  sortOrder = function( a, b ) {
50536
50638
  if ( a === b ) {
50537
50639
  hasDuplicate = true;
@@ -50725,6 +50827,46 @@ var sizzle = {exports: {}};
50725
50827
  };
50726
50828
  }
50727
50829
 
50830
+ function isContains(token) {
50831
+ return token.type === 'PSEUDO' && token.matches.length && token.matches[0].replace(rtrim, "$1").toLowerCase() === 'contains';
50832
+ }
50833
+
50834
+ function filterTokens(tokens, predicate) {
50835
+ if (tokens[0].length) {
50836
+ return tokens.map(function(innerTokens) {
50837
+ return filterTokens(innerTokens, predicate);
50838
+ });
50839
+ } else {
50840
+ return tokens.filter(predicate);
50841
+ }
50842
+ }
50843
+
50844
+ function tokensToSelector(tokens) {
50845
+ if (tokens[0].length) {
50846
+ return tokens.map(tokensToSelector).join(',');
50847
+ } else {
50848
+ return toSelector(tokens);
50849
+ }
50850
+ }
50851
+
50852
+ function findSeedForNonNativeSelector(selector, context, selectorCache) {
50853
+ var hopefullyNativeSelector = selectorCache[ selector + " " ];
50854
+ if (!hopefullyNativeSelector) {
50855
+ var nonnativeTokens = tokenize(selector);
50856
+ var hopefullyNativeTokens = filterTokens(nonnativeTokens, function(token) {
50857
+ return !isContains(token);
50858
+ });
50859
+ hopefullyNativeSelector = tokensToSelector(hopefullyNativeTokens);
50860
+ }
50861
+ try {
50862
+ var seed = [];
50863
+ push.apply(seed, context.querySelectorAll(hopefullyNativeSelector));
50864
+ selectorCache(selector, hopefullyNativeSelector);
50865
+ return seed;
50866
+ } catch (e) {
50867
+ }
50868
+ }
50869
+
50728
50870
  function Sizzle( selector, context, results, seed ) {
50729
50871
  var m, i, elem, nid, match, groups, newSelector,
50730
50872
  newContext = context && context.ownerDocument,
@@ -50801,7 +50943,7 @@ var sizzle = {exports: {}};
50801
50943
 
50802
50944
  // Take advantage of querySelectorAll
50803
50945
  if ( support.qsa &&
50804
- !nonnativeSelectorCache[ selector + " " ] &&
50946
+ (!nonnativeSelectorCache[ selector + " " ] || nativeishSelectorCache[ selector + " " ]) &&
50805
50947
  ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) &&
50806
50948
 
50807
50949
  // Support: IE 8 only
@@ -50859,6 +51001,10 @@ var sizzle = {exports: {}};
50859
51001
  context.removeAttribute( "id" );
50860
51002
  }
50861
51003
  }
51004
+
51005
+ if (!seed && nonnativeSelectorCache[ selector + " " ]) {
51006
+ seed = findSeedForNonNativeSelector(selector, newContext, nativeishSelectorCache);
51007
+ }
50862
51008
  }
50863
51009
  }
50864
51010
  }
@@ -53333,6 +53479,7 @@ class SessionRecorder {
53333
53479
  if (continuationCallback) {
53334
53480
  continuationCallback.call(this);
53335
53481
  }
53482
+ this.api.Events.trigger('recording:unpaused');
53336
53483
  }
53337
53484
  if (visitorConfig && visitorConfig.enable && !this.isRecording()) {
53338
53485
  this._startRecordingForVisitor(visitorConfig);
@@ -53441,6 +53588,7 @@ class SessionRecorder {
53441
53588
  });
53442
53589
  }
53443
53590
  _startRecordingForVisitor(visitorConfig) {
53591
+ this.api.Events.trigger('recording:unpaused');
53444
53592
  this.transport.start(this.config);
53445
53593
  const disableFallback = this.pendo._.get(this.config, 'disableFallback', true);
53446
53594
  if (disableFallback && !this.transport.worker) {
@@ -53759,6 +53907,7 @@ class SessionRecorder {
53759
53907
  this.interval = null;
53760
53908
  this._stop = null;
53761
53909
  this.visitorConfig = null;
53910
+ this.api.Events.trigger('recording:paused');
53762
53911
  this.visitorId = null;
53763
53912
  this.accountId = null;
53764
53913
  this.clearSessionInfo();
@@ -55140,21 +55289,35 @@ function createCspViolationMessage(blockedURI, directive, isReportOnly, original
55140
55289
  }
55141
55290
  }
55142
55291
 
55292
+ const DEV_LOG_TYPE = 'devlog';
55293
+ function createDevLogEnvelope(pluginAPI, globalPendo) {
55294
+ return {
55295
+ browser_time: pluginAPI.util.getNow(),
55296
+ url: globalPendo.url.get(),
55297
+ visitorId: globalPendo.get_visitor_id(),
55298
+ accountId: globalPendo.get_account_id(),
55299
+ type: DEV_LOG_TYPE
55300
+ };
55301
+ }
55302
+
55143
55303
  const TOKEN_MAX_SIZE = 100;
55144
55304
  const TOKEN_REFILL_RATE = 10;
55145
55305
  const TOKEN_REFRESH_INTERVAL = 1000;
55306
+ const MAX_UNCOMPRESSED_SIZE = 125000; // 125KB
55146
55307
  class DevlogBuffer {
55147
55308
  constructor(pendo, pluginAPI) {
55148
55309
  this.pendo = pendo;
55149
55310
  this.pluginAPI = pluginAPI;
55150
55311
  this.events = [];
55151
55312
  this.lastEvent = null;
55313
+ this.uncompressedSize = 0;
55314
+ this.payloads = [];
55152
55315
  this.tokens = TOKEN_MAX_SIZE;
55153
55316
  this.lastRefillTime = this.pluginAPI.util.getNow();
55154
55317
  this.nextRefillTime = this.lastRefillTime + TOKEN_REFRESH_INTERVAL;
55155
55318
  }
55156
55319
  isEmpty() {
55157
- return this.events.length === 0;
55320
+ return this.events.length === 0 && this.payloads.length === 0;
55158
55321
  }
55159
55322
  refillTokens() {
55160
55323
  const now = this.pluginAPI.util.getNow();
@@ -55170,22 +55333,53 @@ class DevlogBuffer {
55170
55333
  clear() {
55171
55334
  this.events = [];
55172
55335
  this.lastEvent = null;
55336
+ this.uncompressedSize = 0;
55173
55337
  }
55174
- push(event) {
55338
+ hasTokenAvailable() {
55175
55339
  this.refillTokens();
55176
- if (this.tokens === 0)
55340
+ return this.tokens > 0;
55341
+ }
55342
+ estimateEventSize(event) {
55343
+ return JSON.stringify(event).length;
55344
+ }
55345
+ push(event) {
55346
+ if (!this.hasTokenAvailable())
55177
55347
  return false;
55348
+ const eventSize = this.estimateEventSize(event);
55349
+ if (this.uncompressedSize + eventSize > MAX_UNCOMPRESSED_SIZE) {
55350
+ this.compressCurrentChunk();
55351
+ }
55352
+ this.uncompressedSize += eventSize;
55178
55353
  this.lastEvent = event;
55179
55354
  this.events.push(event);
55180
55355
  this.tokens = Math.max(this.tokens - 1, 0);
55181
55356
  return true;
55182
55357
  }
55183
- pack() {
55184
- if (this.isEmpty())
55358
+ compressCurrentChunk() {
55359
+ if (this.events.length === 0)
55185
55360
  return;
55186
55361
  const jzb = this.pendo.compress(this.events);
55362
+ this.payloads.push(jzb);
55187
55363
  this.clear();
55188
- return jzb;
55364
+ }
55365
+ generateUrl() {
55366
+ const queryParams = {
55367
+ v: this.pendo.VERSION,
55368
+ ct: this.pluginAPI.util.getNow()
55369
+ };
55370
+ return this.pluginAPI.transmit.buildBaseDataUrl(DEV_LOG_TYPE, this.pendo.apiKey, queryParams);
55371
+ }
55372
+ pack() {
55373
+ if (this.isEmpty())
55374
+ return;
55375
+ const url = this.generateUrl();
55376
+ this.compressCurrentChunk();
55377
+ const payloads = this.pendo._.map(this.payloads, (jzb) => ({
55378
+ jzb,
55379
+ url
55380
+ }));
55381
+ this.payloads = [];
55382
+ return payloads;
55189
55383
  }
55190
55384
  }
55191
55385
 
@@ -56377,7 +56571,6 @@ var ConfigReader = (function () {
56377
56571
  addOption('formValidation', [PENDO_CONFIG_SRC], false);
56378
56572
  // Performance Metrics
56379
56573
  addOption('performanceMetricsEnabled', [SNIPPET_SRC, PENDO_CONFIG_SRC], true);
56380
- addOption('sendPerformanceMetrics', [SNIPPET_SRC, PENDO_CONFIG_SRC], false);
56381
56574
  }
56382
56575
  initializeOptions();
56383
56576
  var sourceGetters = {};
@@ -57245,17 +57438,6 @@ class DevlogTransport {
57245
57438
  }
57246
57439
  }
57247
57440
 
57248
- const DEV_LOG_TYPE = 'devlog';
57249
- function createDevLogEnvelope(pluginAPI, globalPendo) {
57250
- return {
57251
- browser_time: pluginAPI.util.getNow(),
57252
- url: globalPendo.url.get(),
57253
- visitorId: globalPendo.get_visitor_id(),
57254
- accountId: globalPendo.get_account_id(),
57255
- type: DEV_LOG_TYPE
57256
- };
57257
- }
57258
-
57259
57441
  function ConsoleCapture() {
57260
57442
  let pluginAPI;
57261
57443
  let _;
@@ -57265,6 +57447,7 @@ function ConsoleCapture() {
57265
57447
  let sendInterval;
57266
57448
  let transport;
57267
57449
  let isPtmPaused;
57450
+ let isCapturingConsoleLogs = false;
57268
57451
  const CAPTURE_CONSOLE_CONFIG = 'captureConsoleLogs';
57269
57452
  const CONSOLE_METHODS = ['log', 'warn', 'error', 'info'];
57270
57453
  const DEV_LOG_SUB_TYPE = 'console';
@@ -57278,11 +57461,17 @@ function ConsoleCapture() {
57278
57461
  createConsoleEvent,
57279
57462
  captureStackTrace,
57280
57463
  send,
57464
+ setCaptureState,
57465
+ recordingStarted,
57466
+ recordingStopped,
57281
57467
  onAppHidden,
57282
57468
  onAppUnloaded,
57283
57469
  onPtmPaused,
57284
57470
  onPtmUnpaused,
57285
57471
  securityPolicyViolationFn,
57472
+ get isCapturingConsoleLogs() {
57473
+ return isCapturingConsoleLogs;
57474
+ },
57286
57475
  get buffer() {
57287
57476
  return buffer;
57288
57477
  },
@@ -57312,11 +57501,12 @@ function ConsoleCapture() {
57312
57501
  }, SEND_INTERVAL);
57313
57502
  sendQueue.start();
57314
57503
  pluginAPI.Events.ready.on(readyHandler);
57504
+ pluginAPI.Events['recording:unpaused'].on(recordingStarted);
57505
+ pluginAPI.Events['recording:paused'].on(recordingStopped);
57315
57506
  pluginAPI.Events.appUnloaded.on(onAppUnloaded);
57316
57507
  pluginAPI.Events.appHidden.on(onAppHidden);
57317
57508
  pluginAPI.Events['ptm:paused'].on(onPtmPaused);
57318
57509
  pluginAPI.Events['ptm:unpaused'].on(onPtmUnpaused);
57319
- pluginAPI.log.info('Console logs are being captured');
57320
57510
  }
57321
57511
  function onAppHidden() {
57322
57512
  send({ hidden: true });
@@ -57336,6 +57526,18 @@ function ConsoleCapture() {
57336
57526
  send();
57337
57527
  }
57338
57528
  }
57529
+ function setCaptureState({ shouldCapture = false, reason = '' } = {}) {
57530
+ if (shouldCapture === isCapturingConsoleLogs)
57531
+ return;
57532
+ isCapturingConsoleLogs = shouldCapture;
57533
+ pluginAPI.log.info(`[ConsoleCapture] Console log capture ${shouldCapture ? 'started' : 'stopped'}${reason ? `: ${reason}` : ''}`);
57534
+ }
57535
+ function recordingStarted() {
57536
+ setCaptureState({ shouldCapture: true, reason: 'recording started' });
57537
+ }
57538
+ function recordingStopped() {
57539
+ setCaptureState({ shouldCapture: false, reason: 'recording stopped' });
57540
+ }
57339
57541
  function readyHandler() {
57340
57542
  addIntercepts();
57341
57543
  pluginAPI.attachEventInternal(window, 'securitypolicyviolation', securityPolicyViolationFn);
@@ -57371,7 +57573,7 @@ function ConsoleCapture() {
57371
57573
  }
57372
57574
  }
57373
57575
  function createConsoleEvent(args, methodName, { skipStackTrace = false, skipScrubPII = false } = {}) {
57374
- if (!args || args.length === 0 || !_.contains(CONSOLE_METHODS, methodName))
57576
+ if (!isCapturingConsoleLogs || !args || args.length === 0 || !_.contains(CONSOLE_METHODS, methodName))
57375
57577
  return;
57376
57578
  // stringify args
57377
57579
  let message = _.compact(_.map(args, arg => {
@@ -57403,13 +57605,13 @@ function ConsoleCapture() {
57403
57605
  }
57404
57606
  const devLogEnvelope = createDevLogEnvelope(pluginAPI, globalPendo);
57405
57607
  const consoleEvent = Object.assign(Object.assign({}, devLogEnvelope), { subType: DEV_LOG_SUB_TYPE, devLogLevel: methodName === 'log' ? 'info' : methodName, devLogMessage: skipScrubPII ? message : scrubPII({ string: message, _ }), devLogTrace: stackTrace, devLogCount: 1 });
57406
- const wasAccepted = buffer.push(consoleEvent);
57407
- if (wasAccepted) {
57408
- if (!isPtmPaused) {
57409
- pluginAPI.Events.eventCaptured.trigger(consoleEvent);
57410
- }
57411
- updateLastLog(logKey);
57608
+ if (!buffer.hasTokenAvailable())
57609
+ return consoleEvent;
57610
+ if (!isPtmPaused) {
57611
+ pluginAPI.Events.eventCaptured.trigger(consoleEvent);
57412
57612
  }
57613
+ buffer.push(consoleEvent);
57614
+ updateLastLog(logKey);
57413
57615
  return consoleEvent;
57414
57616
  }
57415
57617
  function captureStackTrace(maxStackFrames) {
@@ -57434,19 +57636,14 @@ function ConsoleCapture() {
57434
57636
  buffer.clear();
57435
57637
  return;
57436
57638
  }
57437
- const queryParams = {
57438
- v: globalPendo.VERSION,
57439
- ct: pluginAPI.util.getNow()
57440
- };
57441
- const url = pluginAPI.transmit.buildBaseDataUrl(DEV_LOG_TYPE, globalPendo.apiKey, queryParams);
57442
- const jzb = buffer.pack();
57443
- if (!jzb)
57639
+ const payloads = buffer.pack();
57640
+ if (!payloads || payloads.length === 0)
57444
57641
  return;
57445
57642
  if (unload || hidden) {
57446
- sendQueue.drain([{ url, jzb }], unload);
57643
+ sendQueue.drain(payloads, unload);
57447
57644
  }
57448
57645
  else {
57449
- sendQueue.push({ url, jzb });
57646
+ sendQueue.push(...payloads);
57450
57647
  }
57451
57648
  }
57452
57649
  function teardown() {
@@ -57464,6 +57661,8 @@ function ConsoleCapture() {
57464
57661
  pluginAPI.Events.appUnloaded.off(onAppUnloaded);
57465
57662
  pluginAPI.Events['ptm:paused'].off(onPtmPaused);
57466
57663
  pluginAPI.Events['ptm:unpaused'].off(onPtmUnpaused);
57664
+ pluginAPI.Events['recording:unpaused'].off(recordingStarted);
57665
+ pluginAPI.Events['recording:paused'].off(recordingStopped);
57467
57666
  pluginAPI.detachEventInternal(window, 'securitypolicyviolation', securityPolicyViolationFn);
57468
57667
  _.each(CONSOLE_METHODS, function (methodName) {
57469
57668
  if (!console[methodName])
@@ -57488,6 +57687,7 @@ function NetworkCapture() {
57488
57687
  let requestBodyCb;
57489
57688
  let responseBodyCb;
57490
57689
  let pendoDevlogBaseUrl;
57690
+ let isCapturingNetworkLogs = false;
57491
57691
  const CAPTURE_NETWORK_CONFIG = 'captureNetworkRequests';
57492
57692
  const NETWORK_SUB_TYPE = 'network';
57493
57693
  const NETWORK_LOGS_CONFIG = 'networkLogs';
@@ -57515,6 +57715,9 @@ function NetworkCapture() {
57515
57715
  onPtmUnpaused,
57516
57716
  onAppHidden,
57517
57717
  onAppUnloaded,
57718
+ setCaptureState,
57719
+ recordingStarted,
57720
+ recordingStopped,
57518
57721
  addConfigOptions,
57519
57722
  processHeaderConfig,
57520
57723
  extractHeaders,
@@ -57522,6 +57725,9 @@ function NetworkCapture() {
57522
57725
  processBody,
57523
57726
  processRequestBody,
57524
57727
  processResponseBody,
57728
+ get isCapturingNetworkLogs() {
57729
+ return isCapturingNetworkLogs;
57730
+ },
57525
57731
  get requestMap() {
57526
57732
  return requestMap;
57527
57733
  },
@@ -57569,6 +57775,8 @@ function NetworkCapture() {
57569
57775
  }, SEND_INTERVAL);
57570
57776
  sendQueue.start();
57571
57777
  pluginAPI.Events.ready.on(startCapture);
57778
+ pluginAPI.Events['recording:unpaused'].on(recordingStarted);
57779
+ pluginAPI.Events['recording:paused'].on(recordingStopped);
57572
57780
  pluginAPI.Events['ptm:paused'].on(onPtmPaused);
57573
57781
  pluginAPI.Events['ptm:unpaused'].on(onPtmUnpaused);
57574
57782
  pluginAPI.Events.appHidden.on(onAppHidden);
@@ -57660,6 +57868,18 @@ function NetworkCapture() {
57660
57868
  function onAppUnloaded() {
57661
57869
  send({ unload: true });
57662
57870
  }
57871
+ function setCaptureState({ shouldCapture = false, reason = '' } = {}) {
57872
+ if (shouldCapture === isCapturingNetworkLogs)
57873
+ return;
57874
+ isCapturingNetworkLogs = shouldCapture;
57875
+ pluginAPI.log.info(`[NetworkCapture] Network request capture ${shouldCapture ? 'started' : 'stopped'}${reason ? `: ${reason}` : ''}`);
57876
+ }
57877
+ function recordingStarted() {
57878
+ return setCaptureState({ shouldCapture: true, reason: 'recording started' });
57879
+ }
57880
+ function recordingStopped() {
57881
+ return setCaptureState({ shouldCapture: false, reason: 'recording stopped' });
57882
+ }
57663
57883
  function startCapture() {
57664
57884
  pluginAPI.NetworkRequest.on({ request: handleRequest, response: handleResponse, error: handleError });
57665
57885
  }
@@ -57679,11 +57899,17 @@ function NetworkCapture() {
57679
57899
  pluginAPI.Events['ptm:unpaused'].off(onPtmUnpaused);
57680
57900
  pluginAPI.Events.appHidden.off(onAppHidden);
57681
57901
  pluginAPI.Events.appUnloaded.off(onAppUnloaded);
57902
+ pluginAPI.Events['recording:unpaused'].off(recordingStarted);
57903
+ pluginAPI.Events['recording:paused'].off(recordingStopped);
57682
57904
  }
57683
57905
  function handleRequest(request) {
57906
+ if (!isCapturingNetworkLogs)
57907
+ return;
57684
57908
  requestMap[request.requestId] = request;
57685
57909
  }
57686
57910
  function handleResponse(response) {
57911
+ if (!isCapturingNetworkLogs)
57912
+ return;
57687
57913
  if (!response)
57688
57914
  return;
57689
57915
  const request = requestMap[response.requestId];
@@ -57694,24 +57920,23 @@ function NetworkCapture() {
57694
57920
  delete requestMap[response.requestId];
57695
57921
  return;
57696
57922
  }
57697
- // push an empty network event to the buffer to ensure that we have a token available
57698
- const networkEvent = {};
57699
- const wasAccepted = buffer.push(networkEvent);
57700
- if (!wasAccepted) {
57701
- // Token limit reached, remove request from request map
57923
+ if (!buffer.hasTokenAvailable()) {
57702
57924
  delete requestMap[response.requestId];
57703
57925
  return;
57704
57926
  }
57705
- globalPendo._.extend(networkEvent, createNetworkEvent({
57927
+ const networkEvent = createNetworkEvent({
57706
57928
  request,
57707
57929
  response
57708
- }));
57930
+ });
57709
57931
  if (!isPtmPaused) {
57710
57932
  pluginAPI.Events.eventCaptured.trigger(networkEvent);
57711
57933
  }
57934
+ buffer.push(networkEvent);
57712
57935
  delete requestMap[response.requestId];
57713
57936
  }
57714
57937
  function handleError({ error, context }) {
57938
+ if (!isCapturingNetworkLogs)
57939
+ return;
57715
57940
  if (error.requestId && requestMap[error.requestId]) {
57716
57941
  delete requestMap[error.requestId];
57717
57942
  }
@@ -57786,17 +58011,12 @@ function NetworkCapture() {
57786
58011
  buffer.clear();
57787
58012
  return;
57788
58013
  }
57789
- const jzb = buffer.pack();
57790
- const queryParams = {
57791
- v: globalPendo.VERSION,
57792
- ct: pluginAPI.util.getNow()
57793
- };
57794
- const url = pluginAPI.transmit.buildBaseDataUrl(DEV_LOG_TYPE, globalPendo.apiKey, queryParams);
58014
+ const payloads = buffer.pack();
57795
58015
  if (unload || hidden) {
57796
- sendQueue.drain([{ url, jzb }], unload);
58016
+ sendQueue.drain(payloads, unload);
57797
58017
  }
57798
58018
  else {
57799
- sendQueue.push({ url, jzb });
58019
+ sendQueue.push(...payloads);
57800
58020
  }
57801
58021
  }
57802
58022
  }