@pendo/agent 2.299.0 → 2.300.1

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.
@@ -3905,8 +3905,8 @@ let SERVER = '';
3905
3905
  let ASSET_HOST = '';
3906
3906
  let ASSET_PATH = '';
3907
3907
  let DESIGNER_SERVER = '';
3908
- let VERSION = '2.299.0_';
3909
- let PACKAGE_VERSION = '2.299.0';
3908
+ let VERSION = '2.300.1_';
3909
+ let PACKAGE_VERSION = '2.300.1';
3910
3910
  let LOADER = 'xhr';
3911
3911
  /* eslint-enable agent-eslint-rules/no-gulp-env-references */
3912
3912
  /**
@@ -11560,7 +11560,7 @@ var loadResource = function (options, callback, sendErrorToCallback = false) {
11560
11560
  script.src = getPolicy(pendo$1).createScriptURL(options.url);
11561
11561
  addIntegrityAttribute(script, options.url);
11562
11562
  document.body.appendChild(script);
11563
- return {};
11563
+ return script;
11564
11564
  }
11565
11565
  else { // Assume JS file.
11566
11566
  script = document.createElement('script');
@@ -11574,7 +11574,7 @@ var loadResource = function (options, callback, sendErrorToCallback = false) {
11574
11574
  if (err) {
11575
11575
  if (sendErrorToCallback)
11576
11576
  originalCallback(err);
11577
- return;
11577
+ return {};
11578
11578
  }
11579
11579
  originalCallback.apply(this, _.toArray(arguments).slice(1));
11580
11580
  });
@@ -11628,7 +11628,7 @@ var loadWatcher = function (target, url, callback) {
11628
11628
  setTimeout$1(function () {
11629
11629
  if (!isLoaded) {
11630
11630
  // Log a warning if we fail to load the resource within 10 seconds
11631
- writeMessage('Failed to load ' + url + ' within 10 seconds');
11631
+ log.critical('Failed to load ' + url + ' within 10 seconds');
11632
11632
  }
11633
11633
  }, 10000);
11634
11634
  }
@@ -12239,8 +12239,14 @@ const BEACON_GIF_FAILURES = {
12239
12239
  poll: 'pendo-poll-gif-failure',
12240
12240
  agentic: 'pendo-agentic-gif-failure'
12241
12241
  };
12242
- const GUIDE_LOOP_TIMER = 'pendo-guide-loop';
12243
- const EVENT_CAPTURED_TIMER = 'pendo-event-captured';
12242
+ const GUIDE_LOOP_TIMER = {
12243
+ name: 'pendo-guide-loop',
12244
+ debuggingOnly: true
12245
+ };
12246
+ const EVENT_CAPTURED_TIMER = {
12247
+ name: 'pendo-event-captured',
12248
+ debuggingOnly: true
12249
+ };
12244
12250
  const INITIALIZE = 'pendo-initialize';
12245
12251
  const TEARDOWN = 'pendo-teardown';
12246
12252
  const METRICS = {};
@@ -12256,12 +12262,8 @@ _.each(BEACON_GIF_FAILURES, (name) => {
12256
12262
  instrument: counter
12257
12263
  };
12258
12264
  });
12259
- METRICS[GUIDE_LOOP_TIMER] = {
12260
- name: GUIDE_LOOP_TIMER
12261
- };
12262
- METRICS[EVENT_CAPTURED_TIMER] = {
12263
- name: EVENT_CAPTURED_TIMER
12264
- };
12265
+ METRICS[GUIDE_LOOP_TIMER.name] = GUIDE_LOOP_TIMER;
12266
+ METRICS[EVENT_CAPTURED_TIMER.name] = EVENT_CAPTURED_TIMER;
12265
12267
  METRICS[INITIALIZE] = {
12266
12268
  name: INITIALIZE
12267
12269
  };
@@ -12269,17 +12271,52 @@ METRICS[TEARDOWN] = {
12269
12271
  name: TEARDOWN
12270
12272
  };
12271
12273
 
12274
+ var debugEnabled = 'debug-enabled';
12275
+ function getDebuggingStorage() {
12276
+ try {
12277
+ const debuggingStorage = agentStorage.read(debugEnabled) || JSON.parse(getCookie(debugEnabled));
12278
+ if (typeof debuggingStorage === 'boolean') { // v1 debugger storage format
12279
+ return { enabled: debuggingStorage };
12280
+ }
12281
+ return debuggingStorage || {};
12282
+ }
12283
+ catch (e) {
12284
+ return {};
12285
+ }
12286
+ }
12287
+ function isDebuggingEnabled(asBoolean = true) {
12288
+ let isEnabled;
12289
+ if (store && store.getters && store.getters['debugger/debuggingEnabled']) {
12290
+ isEnabled = store.getters['debugger/debuggingEnabled']();
12291
+ }
12292
+ else {
12293
+ isEnabled = getDebuggingStorage().enabled === true;
12294
+ }
12295
+ if (asBoolean) {
12296
+ return isEnabled;
12297
+ }
12298
+ else {
12299
+ return isEnabled ? 'Yes' : 'No';
12300
+ }
12301
+ }
12302
+
12272
12303
  const PERFORMANCE_SEND_INTERVAL = 1000 * 60 * 10; // 10 minutes
12273
12304
  class PerformanceMonitor {
12274
12305
  constructor() {
12275
12306
  this._isPerformanceApiAvailable = this._checkPerformanceApi();
12276
12307
  this._measuringPerformance = false;
12308
+ this._debugging = false;
12309
+ this._setDebuggingBound = _.bind(this._setDebugging, this);
12277
12310
  this.marks = new Set();
12278
12311
  this.measures = new Set();
12279
12312
  }
12280
12313
  initialize() {
12314
+ if (!ConfigReader.get('performanceMetricsEnabled'))
12315
+ return _.noop;
12281
12316
  this._measuringPerformance = true;
12282
12317
  this._markPerformance(INITIALIZE);
12318
+ this._setDebugging();
12319
+ Events.debuggerLaunched.on(this._setDebuggingBound);
12283
12320
  this.interval = setInterval(() => {
12284
12321
  this.send();
12285
12322
  }, PERFORMANCE_SEND_INTERVAL);
@@ -12291,13 +12328,19 @@ class PerformanceMonitor {
12291
12328
  this._markPerformance(TEARDOWN);
12292
12329
  this.send();
12293
12330
  this._measuringPerformance = false;
12331
+ this._setDebugging();
12332
+ Events.debuggerLaunched.off(this._setDebuggingBound);
12294
12333
  this._clearMarksAndMeasures();
12295
12334
  clearInterval(this.interval);
12296
12335
  }
12297
- startTimer(name, detail = null) {
12336
+ startTimer({ name, debuggingOnly }, detail = null) {
12337
+ if (debuggingOnly && !this._debugging)
12338
+ return;
12298
12339
  this._markPerformance(`${name}-start`, { detail });
12299
12340
  }
12300
- stopTimer(name, detail = null) {
12341
+ stopTimer({ name, debuggingOnly }, detail = null) {
12342
+ if (debuggingOnly && !this._debugging)
12343
+ return;
12301
12344
  this._markPerformance(`${name}-stop`, { detail });
12302
12345
  this._measurePerformance(name, { detail });
12303
12346
  }
@@ -12306,25 +12349,20 @@ class PerformanceMonitor {
12306
12349
  this._markPerformance(name, { detail });
12307
12350
  }
12308
12351
  send() {
12309
- const metrics = _.reduce(METRICS, (acc, metric) => {
12352
+ const payload = _.reduce(METRICS, (acc, metric) => {
12310
12353
  const { name, type, instrument } = metric;
12311
12354
  if (!instrument)
12312
12355
  return acc;
12313
12356
  const entries = performance.getEntriesByName(name);
12314
12357
  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
- }
12358
+ acc.push({
12359
+ name,
12360
+ type,
12361
+ value,
12362
+ timestamp: Date.now()
12363
+ });
12323
12364
  return acc;
12324
12365
  }, []);
12325
- const payload = _.filter(metrics, (metric) => {
12326
- return metric.value > 0;
12327
- });
12328
12366
  this._clearMarksAndMeasures();
12329
12367
  if (!ConfigReader.get('sendPerformanceMetrics'))
12330
12368
  return;
@@ -12333,8 +12371,7 @@ class PerformanceMonitor {
12333
12371
  }
12334
12372
  }
12335
12373
  _checkPerformanceApi() {
12336
- return ConfigReader.get('performanceMetricsEnabled') &&
12337
- detectNativeBrowserAPI('performance.mark') &&
12374
+ return detectNativeBrowserAPI('performance.mark') &&
12338
12375
  detectNativeBrowserAPI('performance.measure') &&
12339
12376
  detectNativeBrowserAPI('performance.getEntries') &&
12340
12377
  detectNativeBrowserAPI('performance.getEntriesByName') &&
@@ -12344,6 +12381,9 @@ class PerformanceMonitor {
12344
12381
  _shouldMeasurePerformance() {
12345
12382
  return this._isPerformanceApiAvailable && this._measuringPerformance;
12346
12383
  }
12384
+ _setDebugging() {
12385
+ this._debugging = isDebuggingEnabled();
12386
+ }
12347
12387
  _markPerformance(name, metadata) {
12348
12388
  if (!this._shouldMeasurePerformance())
12349
12389
  return;
@@ -12361,13 +12401,15 @@ class PerformanceMonitor {
12361
12401
  }
12362
12402
  }
12363
12403
  _clearMarksAndMeasures() {
12364
- for (const name of this.marks) {
12404
+ // eslint-disable-next-line agent-eslint-rules/no-array-foreach
12405
+ this.marks.forEach(name => {
12365
12406
  performance.clearMarks(name);
12366
- }
12407
+ });
12367
12408
  this.marks.clear();
12368
- for (const name of this.measures) {
12409
+ // eslint-disable-next-line agent-eslint-rules/no-array-foreach
12410
+ this.measures.forEach(name => {
12369
12411
  performance.clearMeasures(name);
12370
- }
12412
+ });
12371
12413
  this.measures.clear();
12372
12414
  }
12373
12415
  }
@@ -20988,22 +21030,13 @@ function continueOrCompleteUpdate() {
20988
21030
  * Otherwise, it is the same as calling startGuides.
20989
21031
  */
20990
21032
  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
- }
21033
+ setGuidesDelayed(false);
21000
21034
  startGuides();
21001
21035
  };
21002
21036
  var manuallyStopGuides = function () {
21003
21037
  if (!areGuidesDisabled()) {
21004
21038
  setGuidesDelayed(true);
21005
21039
  }
21006
- stopGuides();
21007
21040
  resetPendoUI();
21008
21041
  };
21009
21042
  // a phase that only has one unit of work per update
@@ -21550,35 +21583,6 @@ function Wrappable() {
21550
21583
  return this;
21551
21584
  }
21552
21585
 
21553
- var debugEnabled = 'debug-enabled';
21554
- function getDebuggingStorage() {
21555
- try {
21556
- const debuggingStorage = agentStorage.read(debugEnabled) || JSON.parse(getCookie(debugEnabled));
21557
- if (typeof debuggingStorage === 'boolean') { // v1 debugger storage format
21558
- return { enabled: debuggingStorage };
21559
- }
21560
- return debuggingStorage || {};
21561
- }
21562
- catch (e) {
21563
- return {};
21564
- }
21565
- }
21566
- function isDebuggingEnabled(asBoolean = true) {
21567
- let isEnabled;
21568
- if (store && store.getters && store.getters['debugger/debuggingEnabled']) {
21569
- isEnabled = store.getters['debugger/debuggingEnabled']();
21570
- }
21571
- else {
21572
- isEnabled = getDebuggingStorage().enabled === true;
21573
- }
21574
- if (asBoolean) {
21575
- return isEnabled;
21576
- }
21577
- else {
21578
- return isEnabled ? 'Yes' : 'No';
21579
- }
21580
- }
21581
-
21582
21586
  class GuideTypeIdentifier {
21583
21587
  constructor(identificationFn, typeName) {
21584
21588
  this.type = typeName;
@@ -24268,30 +24272,40 @@ class GuideCache {
24268
24272
  if (this.db)
24269
24273
  return q.resolve(this.db);
24270
24274
  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;
24275
+ try {
24276
+ const request = indexedDB.open(`pendo-${apiKey}`, 1);
24277
+ request.onerror = () => {
24278
+ this.dbError(new Error('open.request.onerror'));
24279
+ deferred.resolve();
24282
24280
  };
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 = () => {
24281
+ request.onsuccess = (event) => {
24282
+ const db = event.target.result;
24289
24283
  this.db = db;
24284
+ db.onclose = () => {
24285
+ this.db = null;
24286
+ };
24290
24287
  deferred.resolve(db);
24291
24288
  };
24292
- };
24289
+ request.onupgradeneeded = (event) => {
24290
+ const db = event.target.result;
24291
+ const objectStore = db.createObjectStore('guides', { keyPath: 'guide.id' });
24292
+ objectStore.transaction.oncomplete = () => {
24293
+ this.db = db;
24294
+ deferred.resolve(db);
24295
+ };
24296
+ };
24297
+ }
24298
+ catch (error) {
24299
+ this.dbError(error);
24300
+ deferred.resolve();
24301
+ }
24293
24302
  return deferred.promise;
24294
24303
  }
24304
+ dbError(error) {
24305
+ log.critical('indexedDB cache error', { error });
24306
+ this.cacheGuidesPersistent = false;
24307
+ this.db = null;
24308
+ }
24295
24309
  load(now = getNow()) {
24296
24310
  if (this.cache)
24297
24311
  return q.resolve(this.cache);
@@ -24299,26 +24313,30 @@ class GuideCache {
24299
24313
  if (!this.db)
24300
24314
  return q.resolve(this.cache);
24301
24315
  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
- });
24316
+ try {
24317
+ const objectStore = this.db.transaction(['guides'], 'readwrite').objectStore('guides');
24318
+ const request = objectStore.getAll();
24319
+ request.onerror = () => {
24320
+ this.dbError(new Error('load.request.onerror'));
24321
+ deferred.resolve(this.cache);
24322
+ };
24323
+ request.onsuccess = (event) => {
24324
+ const cachedGuides = event.target.result;
24325
+ _.each(cachedGuides, (cachedGuide) => {
24326
+ if (cachedGuide.expires > now) {
24327
+ this.cache[cachedGuide.guide.id] = cachedGuide;
24328
+ }
24329
+ else {
24330
+ objectStore.delete(cachedGuide.guide.id);
24331
+ }
24332
+ });
24333
+ deferred.resolve(this.cache);
24334
+ };
24335
+ }
24336
+ catch (error) {
24337
+ this.dbError(error);
24320
24338
  deferred.resolve(this.cache);
24321
- };
24339
+ }
24322
24340
  return deferred.promise;
24323
24341
  }
24324
24342
  add(guide, visitorId, now = getNow()) {
@@ -24337,16 +24355,22 @@ class GuideCache {
24337
24355
  save(cachedGuide) {
24338
24356
  if (!this.db)
24339
24357
  return;
24340
- const objectStore = this.db.transaction(['guides'], 'readwrite').objectStore('guides');
24341
24358
  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 = () => {
24359
+ try {
24360
+ const objectStore = this.db.transaction(['guides'], 'readwrite').objectStore('guides');
24361
+ const update = objectStore.put(cachedGuide);
24362
+ update.onerror = () => {
24363
+ this.dbError(new Error('save.request.onerror'));
24364
+ deferred.resolve();
24365
+ };
24366
+ update.onsuccess = () => {
24367
+ deferred.resolve();
24368
+ };
24369
+ }
24370
+ catch (error) {
24371
+ this.dbError(error);
24348
24372
  deferred.resolve();
24349
- };
24373
+ }
24350
24374
  return deferred.promise;
24351
24375
  }
24352
24376
  update(lastGuideStepSeen) {
@@ -25915,13 +25939,12 @@ var loadGuides = function (apiKey, visitorId, page, callback) {
25915
25939
  }
25916
25940
  if (displayableGuides.length) {
25917
25941
  q.all([
25918
- loadGuideCss(),
25919
25942
  globalJsPromise,
25920
25943
  initializeResourceCenter(activeGuides),
25921
25944
  BuildingBlockWatermark.initializeWatermark(activeGuides),
25922
25945
  waitForGlobalCssToLoad(5000)
25923
25946
  ]
25924
- .concat(getRegisteredLoadGuideJobs(activeGuides))).then(function () {
25947
+ .concat(getRegisteredLoadGuideJobs(activeGuides), loadGuideCss())).then(function () {
25925
25948
  if (loadGuides.reqId === reqId) {
25926
25949
  if (store.getters['frames/isLeader']()) {
25927
25950
  restoreGuideShownState(getActiveGuides());
@@ -25935,7 +25958,8 @@ var loadGuides = function (apiKey, visitorId, page, callback) {
25935
25958
  }
25936
25959
  deferred.resolve();
25937
25960
  }, function (err) {
25938
- log.error('Post loadGuide request failed: ', err);
25961
+ log.critical(`Post loadGuide request failed: ${err}`);
25962
+ resetPendoUI();
25939
25963
  Events.guidesFailed.trigger();
25940
25964
  deferred.reject();
25941
25965
  });
@@ -25990,6 +26014,9 @@ function loadExternalCss(id, cssUrl) {
25990
26014
  var style = pendo$1.loadResource(cssUrl, function () {
25991
26015
  deferred.resolve();
25992
26016
  });
26017
+ if (_.isEmpty(style)) {
26018
+ return q.reject(`Failed to load CSS resource: ${cssUrl}. Check that the URL is correct and from an allowed origin.`);
26019
+ }
25993
26020
  style.id = id;
25994
26021
  return deferred.promise;
25995
26022
  }
@@ -26068,7 +26095,7 @@ function loadGuideCss() {
26068
26095
  else {
26069
26096
  dom('#' + CUSTOM_CSS_ID).remove();
26070
26097
  }
26071
- return q.all(promises);
26098
+ return promises;
26072
26099
  }
26073
26100
  var processGuideEventCache = function (options) {
26074
26101
  if (!guideEventQueue)
@@ -26220,14 +26247,6 @@ var initGuides = function (observer) {
26220
26247
  teardownFns.push(attachEventInternal(window, 'securitypolicyviolation', securityPolicyViolationFn));
26221
26248
  teardownFns.push(createVideoFullScreenListeners());
26222
26249
  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
26250
  store.commit('guideUpdate/setObserver', observer);
26232
26251
  store.commit('guideUpdate/setUseObserver');
26233
26252
  teardownFns.push(() => store.dispatch('guideUpdate/stopObserver'));
@@ -26318,6 +26337,10 @@ var setGuidesDisabled = function (areDisabled) {
26318
26337
  };
26319
26338
  var setGuidesDelayed = function (areDelayed) {
26320
26339
  var originalOptions = ConfigReader.getLocalConfig();
26340
+ delete originalOptions.delayGuides;
26341
+ if (originalOptions.guides) {
26342
+ delete originalOptions.guides.delay;
26343
+ }
26321
26344
  originalOptions.delayGuides = areDelayed;
26322
26345
  ConfigReader.setLocalConfig(originalOptions);
26323
26346
  };
@@ -33471,6 +33494,7 @@ var GuideUpdateModule = (function () {
33471
33494
  function observerCallback() {
33472
33495
  store.dispatch('guideUpdate/documentChanged');
33473
33496
  }
33497
+ const debouncedCallback = _.debounce(observerCallback, 50);
33474
33498
  function handleScheduledUpdate() {
33475
33499
  store.dispatch('guideUpdate/handleScheduledUpdate');
33476
33500
  }
@@ -33511,6 +33535,9 @@ var GuideUpdateModule = (function () {
33511
33535
  if (!context.state.observing) {
33512
33536
  const observer = context.getters.observer();
33513
33537
  observer.addEventListener('mutation', observerCallback);
33538
+ attachEvent(window, 'animationend', debouncedCallback);
33539
+ attachEvent(window, 'transitionend', debouncedCallback);
33540
+ attachEvent(window, 'mouseover', debouncedCallback);
33514
33541
  context.commit('setObserving', true);
33515
33542
  }
33516
33543
  }
@@ -33519,6 +33546,10 @@ var GuideUpdateModule = (function () {
33519
33546
  const observer = context.getters.observer();
33520
33547
  if (observer) {
33521
33548
  observer.removeEventListener('mutation', observerCallback);
33549
+ debouncedCallback.cancel();
33550
+ detachEvent(window, 'animationend', debouncedCallback);
33551
+ detachEvent(window, 'transitionend', debouncedCallback);
33552
+ detachEvent(window, 'mouseover', debouncedCallback);
33522
33553
  }
33523
33554
  context.commit('setObserving', false);
33524
33555
  context.dispatch('stopScheduledUpdate');
@@ -39811,7 +39842,7 @@ class PromptPlugin {
39811
39842
  promptType: method,
39812
39843
  url,
39813
39844
  privacyFilterApplied: filteredPrompt !== originalBody
39814
- });
39845
+ }, undefined, 'agentic');
39815
39846
  });
39816
39847
  }
39817
39848
  handleError({ error, context }) {
@@ -39853,7 +39884,7 @@ class PromptPlugin {
39853
39884
  promptType: 'request',
39854
39885
  agentType: 'prompt'
39855
39886
  }, promptEvent);
39856
- this.api.analytics.collectEvent('prompt', event);
39887
+ this.api.analytics.collectEvent('prompt', event, undefined, 'agentic');
39857
39888
  }
39858
39889
  teardown() {
39859
39890
  this._.each(this.prompts, (prompt) => prompt.teardown());
@@ -45064,6 +45095,9 @@ class MutationBuffer {
45064
45095
  this.movedMap = {};
45065
45096
  this.mutationCb(payload);
45066
45097
  });
45098
+ __publicField(this, "bufferBelongsToIframe", (iframeEl) => {
45099
+ return this.doc === iframeEl.contentDocument;
45100
+ });
45067
45101
  __publicField(this, "genTextAreaValueMutation", (textarea) => {
45068
45102
  let item = this.attributeMap.get(textarea);
45069
45103
  if (!item) {
@@ -45631,6 +45665,15 @@ function initViewportResizeObserver({ viewportResizeCb }, { win }) {
45631
45665
  );
45632
45666
  return on("resize", updateDimension, win);
45633
45667
  }
45668
+ function findAndRemoveIframeBuffer(iframeEl) {
45669
+ for (let i2 = mutationBuffers.length - 1; i2 >= 0; i2--) {
45670
+ const buf = mutationBuffers[i2];
45671
+ if (buf.bufferBelongsToIframe(iframeEl)) {
45672
+ buf.reset();
45673
+ mutationBuffers.splice(i2, 1);
45674
+ }
45675
+ }
45676
+ }
45634
45677
  const INPUT_TAGS = ["INPUT", "TEXTAREA", "SELECT"];
45635
45678
  const lastInputValueMap = /* @__PURE__ */ new WeakMap();
45636
45679
  function initInputObserver({
@@ -46477,6 +46520,7 @@ class IframeManager {
46477
46520
  __publicField(this, "wrappedEmit");
46478
46521
  __publicField(this, "takeFullSnapshot");
46479
46522
  __publicField(this, "loadListener");
46523
+ __publicField(this, "pageHideListener");
46480
46524
  __publicField(this, "stylesheetManager");
46481
46525
  __publicField(this, "recordCrossOriginIframes");
46482
46526
  this.mutationCb = options.mutationCb;
@@ -46514,6 +46558,9 @@ class IframeManager {
46514
46558
  addLoadListener(cb) {
46515
46559
  this.loadListener = cb;
46516
46560
  }
46561
+ addPageHideListener(cb) {
46562
+ this.pageHideListener = cb;
46563
+ }
46517
46564
  attachIframe(iframeEl, childSn) {
46518
46565
  var _a2, _b, _c;
46519
46566
  this.mutationCb({
@@ -46535,6 +46582,9 @@ class IframeManager {
46535
46582
  this.handleMessage.bind(this)
46536
46583
  );
46537
46584
  (_b = iframeEl.contentWindow) == null ? void 0 : _b.addEventListener("pagehide", () => {
46585
+ var _a3;
46586
+ (_a3 = this.pageHideListener) == null ? void 0 : _a3.call(this, iframeEl);
46587
+ this.mirror.removeNodeFromMap(iframeEl.contentDocument);
46538
46588
  this.crossOriginIframeMap.delete(iframeEl.contentWindow);
46539
46589
  });
46540
46590
  }
@@ -47748,6 +47798,7 @@ function record(options = {}) {
47748
47798
  iframeManager.setTakeFullSnapshot(takeFullSnapshot$1);
47749
47799
  try {
47750
47800
  const handlers = [];
47801
+ const iframeHandlersMap = /* @__PURE__ */ new Map();
47751
47802
  const observe = (doc) => {
47752
47803
  var _a2;
47753
47804
  return callbackWrapper(initObservers)(
@@ -47873,11 +47924,19 @@ function record(options = {}) {
47873
47924
  };
47874
47925
  iframeManager.addLoadListener((iframeEl) => {
47875
47926
  try {
47876
- handlers.push(observe(iframeEl.contentDocument));
47927
+ iframeHandlersMap.set(iframeEl, observe(iframeEl.contentDocument));
47877
47928
  } catch (error) {
47878
47929
  console.warn(error);
47879
47930
  }
47880
47931
  });
47932
+ iframeManager.addPageHideListener((iframeEl) => {
47933
+ const iframeHandler = iframeHandlersMap.get(iframeEl);
47934
+ if (iframeHandler) {
47935
+ iframeHandler();
47936
+ iframeHandlersMap.delete(iframeEl);
47937
+ }
47938
+ findAndRemoveIframeBuffer(iframeEl);
47939
+ });
47881
47940
  const init = () => {
47882
47941
  takeFullSnapshot$1();
47883
47942
  handlers.push(observe(document));
@@ -47911,6 +47970,7 @@ function record(options = {}) {
47911
47970
  }
47912
47971
  return () => {
47913
47972
  handlers.forEach((h) => h());
47973
+ iframeHandlersMap.forEach((h) => h());
47914
47974
  processedNodeManager.destroy();
47915
47975
  recording = false;
47916
47976
  unregisterErrorHandler();