@appsurify-testmap/rrweb-playwright-plugin 3.2.0-alpha.1 → 3.3.0-alpha.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.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var O=Object.create;var f=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var L=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var U=(t,e)=>{for(var n in e)f(t,n,{get:e[n],enumerable:!0})},k=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of D(e))!F.call(t,r)&&r!==n&&f(t,r,{get:()=>e[r],enumerable:!(s=P(e,r))||s.enumerable});return t};var b=(t,e,n)=>(n=t!=null?O(L(t)):{},k(e||!t||!t.__esModule?f(n,"default",{value:t,enumerable:!0}):n,t)),z=t=>k(f({},"__esModule",{value:!0}),t);var Y={};U(Y,{expect:()=>y.expect,test:()=>$});module.exports=z(Y);var y=require("@playwright/test");var w=b(require("os")),p=b(require("path")),d=b(require("fs")),B="test-results/playwright/ui";function j(t,e){let n=p.default.dirname(t),s=p.default.join(n,`.${p.default.basename(t)}.tmp-${process.pid}-${Date.now()}`);d.default.mkdirSync(n,{recursive:!0}),d.default.writeFileSync(s,e,"utf-8"),d.default.renameSync(s,t)}function W(t){try{if(!d.default.existsSync(t))return[];let e=d.default.readFileSync(t,"utf-8").trim();if(!e)return[];let n=JSON.parse(e);return Array.isArray(n)?n:[]}catch{return[]}}function C(t,e){let n=e!==void 0?e:B,s=v(t.spec.name),r=v(t.test.suite?.title),i=v(t.test.title),o=t.browser.name,c=`${r?r+"-":""}${i}.json`,u=p.default.join(n,s,o,c),h={events:t.recorderEvents,metadata:{runner:t.runner,spec:t.spec,suite:t.test.suite,test:t.test,browser:t.browser}};d.default.mkdirSync(n,{recursive:!0}),d.default.mkdirSync(p.default.dirname(u),{recursive:!0}),d.default.writeFileSync(u,JSON.stringify(h,null,2),"utf-8"),console.log(`[ui-coverage] Saved report to ${u}`);try{let a=p.default.join(n,"ui-coverage-aggregated.json"),l=W(a);l.push(h),j(a,JSON.stringify(l,null,2)),console.log(`[ui-coverage] Updated aggregate: ${a}`)}catch(a){console.warn("[ui-coverage] Failed to update aggregate report:",a)}}function v(t){return(t??"").trim().replace(/[\s:/\\<>|"'?*]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function _(t,e){let n=t.browserType(),s=t.version(),r=n.name(),i=e.file,o=i.replace(process.cwd(),"").replace(/^[/\\]/,""),c=o.split(/[\\/]/).pop()??"",[u,h]=c.split(/\.(?=[^\\.]+$)/),a=e.titlePath.slice(1,-1),l=a.join(" > ")||"Root Suite";return{runner:{source:"playwright",type:"unknown",version:e.config.version,platform:w.default.platform(),arch:w.default.arch(),recorder:{scriptVersion:"unknown",libVersion:"unknown"}},spec:{name:c,relative:o,absolute:i,baseName:c,fileName:u,fileExtension:h,id:o},test:{suite:{id:a.join("::")||"root",invocationDetails:{absoluteFile:i,column:e.column??0,line:e.line??0,fileUrl:void 0,function:void 0,originalFile:void 0,relativeFile:o},pending:!1,root:a.length===0,title:l,type:"unknown"},id:e.testId,title:e.title,titlePath:e.titlePath.slice(1),fullTitle:e.titlePath.slice(1).join(" "),file:e.file,invocationDetails:{absoluteFile:i,column:e.column,line:e.line,fileUrl:"",relativeFile:o},state:e.status,duration:e.duration,pending:!1,sync:!1,timedOut:void 0,type:""},browser:{name:r,family:r,version:s,majorVersion:parseInt(s.split(".")[0],10),displayName:e.project.use?.channel?.toUpperCase?.()??r.charAt(0).toUpperCase()+r.slice(1),channel:e.project.use?.channel??"",path:n.executablePath()},recorderEvents:[]}}function S(t,e){let n={...t};for(let s in e){let r=e[s],i=t[s];r&&typeof r=="object"&&!Array.isArray(r)&&i&&typeof i=="object"&&!Array.isArray(i)?n[s]=S(i,r):r!==void 0&&(n[s]=r)}return n}async function E(t,e=500){let n=Date.now(),s=t.getEvents().length;return new Promise(r=>{let i=setInterval(()=>{let o=t.getEvents().length;(o===s||Date.now()-n>e)&&(clearInterval(i),r()),s=o},50)})}async function I(t){await t.evaluate(()=>new Promise(e=>requestAnimationFrame(()=>e())))}var H={i8:Int8Array,ui8:Uint8Array,ui8c:Uint8ClampedArray,i16:Int16Array,ui16:Uint16Array,i32:Int32Array,ui32:Uint32Array,f32:Float32Array,f64:Float64Array,bi64:BigInt64Array,bui64:BigUint64Array},Z=new Map(Object.entries(H).map(([t,e])=>[e,t]));var R=`(function (g, f) {if ("object" == typeof exports && "object" == typeof module) {module.exports = f();} else if ("function" == typeof define && define.amd) {define("rrweb", [], f);} else if ("object" == typeof exports) {exports["rrweb"] = f();} else {g["rrweb"] = f();}}(typeof self !== 'undefined' ? self : typeof globalThis !== 'undefined' ? globalThis : this, () => {var exports = {};var module = { exports };
1
+ "use strict";var O=Object.create;var f=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var L=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var U=(t,e)=>{for(var n in e)f(t,n,{get:e[n],enumerable:!0})},$=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of D(e))!F.call(t,s)&&s!==n&&f(t,s,{get:()=>e[s],enumerable:!(r=P(e,s))||r.enumerable});return t};var b=(t,e,n)=>(n=t!=null?O(L(t)):{},$(e||!t||!t.__esModule?f(n,"default",{value:t,enumerable:!0}):n,t)),z=t=>$(f({},"__esModule",{value:!0}),t);var Y={};U(Y,{expect:()=>y.expect,test:()=>k});module.exports=z(Y);var y=require("@playwright/test");var w=b(require("os")),p=b(require("path")),d=b(require("fs")),B="test-results/playwright/ui";function W(t,e){let n=p.default.dirname(t),r=p.default.join(n,`.${p.default.basename(t)}.tmp-${process.pid}-${Date.now()}`);d.default.mkdirSync(n,{recursive:!0}),d.default.writeFileSync(r,e,"utf-8"),d.default.renameSync(r,t)}function j(t){try{if(!d.default.existsSync(t))return[];let e=d.default.readFileSync(t,"utf-8").trim();if(!e)return[];let n=JSON.parse(e);return Array.isArray(n)?n:[]}catch{return[]}}function C(t,e){let n=e!==void 0?e:B,r=v(t.spec.name),s=v(t.test.suite?.title),o=v(t.test.title),i=t.browser.name,c=`${s?s+"-":""}${o}.json`,u=p.default.join(n,r,i,c),h={events:t.recorderEvents,metadata:{runner:t.runner,spec:t.spec,suite:t.test.suite,test:t.test,browser:t.browser}};d.default.mkdirSync(n,{recursive:!0}),d.default.mkdirSync(p.default.dirname(u),{recursive:!0}),d.default.writeFileSync(u,JSON.stringify(h,null,2),"utf-8"),console.log(`[ui-coverage] Saved report to ${u}`);try{let a=p.default.join(n,"ui-coverage-aggregated.json"),l=j(a);l.push(h),W(a,JSON.stringify(l,null,2)),console.log(`[ui-coverage] Updated aggregate: ${a}`)}catch(a){console.warn("[ui-coverage] Failed to update aggregate report:",a)}}function v(t){return(t??"").trim().replace(/[\s:/\\<>|"'?*]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function _(t,e){let n=t.browserType(),r=t.version(),s=n.name(),o=e.file,i=o.replace(process.cwd(),"").replace(/^[/\\]/,""),c=i.split(/[\\/]/).pop()??"",[u,h]=c.split(/\.(?=[^\\.]+$)/),a=e.titlePath.slice(1,-1),l=a.join(" > ")||"Root Suite";return{runner:{source:"playwright",type:"unknown",version:e.config.version,platform:w.default.platform(),arch:w.default.arch(),recorder:{scriptVersion:"unknown",libVersion:"unknown"}},spec:{name:c,relative:i,absolute:o,baseName:c,fileName:u,fileExtension:h,id:i},test:{suite:{id:a.join("::")||"root",invocationDetails:{absoluteFile:o,column:e.column??0,line:e.line??0,fileUrl:void 0,function:void 0,originalFile:void 0,relativeFile:i},pending:!1,root:a.length===0,title:l,type:"unknown"},id:e.testId,title:e.title,titlePath:e.titlePath.slice(1),fullTitle:e.titlePath.slice(1).join(" "),file:e.file,invocationDetails:{absoluteFile:o,column:e.column,line:e.line,fileUrl:"",relativeFile:i},state:e.status,duration:e.duration,pending:!1,sync:!1,timedOut:void 0,type:""},browser:{name:s,family:s,version:r,majorVersion:parseInt(r.split(".")[0],10),displayName:e.project.use?.channel?.toUpperCase?.()??s.charAt(0).toUpperCase()+s.slice(1),channel:e.project.use?.channel??"",path:n.executablePath()},recorderEvents:[]}}function S(t,e){let n={...t};for(let r in e){let s=e[r],o=t[r];s&&typeof s=="object"&&!Array.isArray(s)&&o&&typeof o=="object"&&!Array.isArray(o)?n[r]=S(o,s):s!==void 0&&(n[r]=s)}return n}async function E(t,e=500){let n=Date.now(),r=t.getEvents().length;return new Promise(s=>{let o=setInterval(()=>{let i=t.getEvents().length;(i===r||Date.now()-n>e)&&(clearInterval(o),s()),r=i},50)})}async function I(t){await t.evaluate(()=>new Promise(e=>requestAnimationFrame(()=>e())))}var H={i8:Int8Array,ui8:Uint8Array,ui8c:Uint8ClampedArray,i16:Int16Array,ui16:Uint16Array,i32:Int32Array,ui32:Uint32Array,f32:Float32Array,f64:Float64Array,bi64:BigInt64Array,bui64:BigUint64Array},Z=new Map(Object.entries(H).map(([t,e])=>[e,t]));var R=`(function (g, f) {if ("object" == typeof exports && "object" == typeof module) {module.exports = f();} else if ("function" == typeof define && define.amd) {define("rrweb", [], f);} else if ("object" == typeof exports) {exports["rrweb"] = f();} else {g["rrweb"] = f();}}(typeof self !== 'undefined' ? self : typeof globalThis !== 'undefined' ? globalThis : this, () => {var exports = {};var module = { exports };
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __defProps = Object.defineProperties;
@@ -14273,6 +14273,7 @@ function initNavigationObserver({
14273
14273
  doc,
14274
14274
  sampling
14275
14275
  }) {
14276
+ var _a2;
14276
14277
  if (sampling.navigation === false) {
14277
14278
  return () => {
14278
14279
  };
@@ -14323,6 +14324,30 @@ function initNavigationObserver({
14323
14324
  handlers.push(restoreReplaceState);
14324
14325
  handlers.push(on("popstate", () => emitNavigation("popstate"), win));
14325
14326
  handlers.push(on("hashchange", () => emitNavigation("hashchange"), win));
14327
+ const useNavigationAPI = typeof sampling.navigation === "object" ? (_a2 = sampling.navigation.useNavigationAPI) != null ? _a2 : true : true;
14328
+ if (useNavigationAPI && "navigation" in win) {
14329
+ try {
14330
+ const nav = win.navigation;
14331
+ const handler = (event) => {
14332
+ var _a22;
14333
+ const navEvent = event;
14334
+ if (navEvent.navigationType === "push" || navEvent.navigationType === "replace") {
14335
+ const destUrl = (_a22 = navEvent.destination) == null ? void 0 : _a22.url;
14336
+ if (destUrl && destUrl !== lastHref) {
14337
+ navigationCb({
14338
+ href: destUrl,
14339
+ oldHref: lastHref,
14340
+ navigationType: "navigate"
14341
+ });
14342
+ lastHref = destUrl;
14343
+ }
14344
+ }
14345
+ };
14346
+ nav.addEventListener("navigate", handler);
14347
+ handlers.push(() => nav.removeEventListener("navigate", handler));
14348
+ } catch (e) {
14349
+ }
14350
+ }
14326
14351
  return callbackWrapper(() => {
14327
14352
  handlers.forEach((h) => h());
14328
14353
  });
@@ -16451,6 +16476,170 @@ class VisibilityManager {
16451
16476
  }
16452
16477
  }
16453
16478
  }
16479
+ const DEFAULT_SETTLE_TIMEOUT = 150;
16480
+ const DEFAULT_MAX_WAIT = 5e3;
16481
+ const DEFAULT_DEBOUNCE = 100;
16482
+ class NavigationManager {
16483
+ constructor(options) {
16484
+ var _a2, _b, _c;
16485
+ __publicField(this, "frozen", false);
16486
+ __publicField(this, "locked", false);
16487
+ __publicField(this, "disabled", false);
16488
+ __publicField(this, "settleTimeout");
16489
+ __publicField(this, "maxWait");
16490
+ __publicField(this, "debounceMs");
16491
+ __publicField(this, "settlingObserver", null);
16492
+ __publicField(this, "debounceTimer", null);
16493
+ __publicField(this, "settleCheckTimer", null);
16494
+ __publicField(this, "maxWaitTimer", null);
16495
+ __publicField(this, "lastMutationTime", 0);
16496
+ __publicField(this, "pendingNavigation", null);
16497
+ __publicField(this, "doc");
16498
+ __publicField(this, "onSnapshot");
16499
+ const { doc, config, onSnapshot } = options;
16500
+ this.doc = doc;
16501
+ this.onSnapshot = callbackWrapper(onSnapshot);
16502
+ this.settleTimeout = (_a2 = config.settleTimeout) != null ? _a2 : DEFAULT_SETTLE_TIMEOUT;
16503
+ this.maxWait = (_b = config.maxWait) != null ? _b : DEFAULT_MAX_WAIT;
16504
+ this.debounceMs = (_c = config.debounce) != null ? _c : DEFAULT_DEBOUNCE;
16505
+ }
16506
+ handleNavigation(data) {
16507
+ if (this.disabled)
16508
+ return;
16509
+ if (this.locked)
16510
+ return;
16511
+ this.cancelTimers();
16512
+ this.disconnectSettlingObserver();
16513
+ this.pendingNavigation = data;
16514
+ if (this.frozen) {
16515
+ return;
16516
+ }
16517
+ this.startDebounce();
16518
+ }
16519
+ cancelPending() {
16520
+ this.cancelTimers();
16521
+ this.disconnectSettlingObserver();
16522
+ this.pendingNavigation = null;
16523
+ }
16524
+ freeze() {
16525
+ this.frozen = true;
16526
+ this.cancelTimers();
16527
+ this.disconnectSettlingObserver();
16528
+ }
16529
+ unfreeze() {
16530
+ this.frozen = false;
16531
+ if (this.pendingNavigation && !this.locked && !this.disabled) {
16532
+ this.startDebounce();
16533
+ }
16534
+ }
16535
+ lock() {
16536
+ this.locked = true;
16537
+ this.cancelTimers();
16538
+ this.disconnectSettlingObserver();
16539
+ }
16540
+ unlock() {
16541
+ this.locked = false;
16542
+ this.pendingNavigation = null;
16543
+ }
16544
+ unsetFrozen() {
16545
+ this.frozen = false;
16546
+ }
16547
+ reset() {
16548
+ this.cancelTimers();
16549
+ this.disconnectSettlingObserver();
16550
+ this.pendingNavigation = null;
16551
+ this.frozen = false;
16552
+ this.locked = false;
16553
+ }
16554
+ destroy() {
16555
+ this.reset();
16556
+ this.disabled = true;
16557
+ }
16558
+ startDebounce() {
16559
+ this.debounceTimer = setTimeout(() => {
16560
+ this.debounceTimer = null;
16561
+ this.startDOMSettling();
16562
+ }, this.debounceMs);
16563
+ }
16564
+ startDOMSettling() {
16565
+ if (this.frozen || this.locked || this.disabled)
16566
+ return;
16567
+ this.lastMutationTime = performance.now();
16568
+ const ObserverCtor = mutationObserverCtor();
16569
+ this.settlingObserver = new ObserverCtor(() => {
16570
+ this.lastMutationTime = performance.now();
16571
+ if (this.settleCheckTimer !== null) {
16572
+ clearTimeout(this.settleCheckTimer);
16573
+ }
16574
+ this.settleCheckTimer = setTimeout(
16575
+ () => this.checkSettled(),
16576
+ this.settleTimeout
16577
+ );
16578
+ });
16579
+ this.settlingObserver.observe(this.doc, {
16580
+ childList: true,
16581
+ subtree: true,
16582
+ attributes: true,
16583
+ characterData: true
16584
+ });
16585
+ this.settleCheckTimer = setTimeout(
16586
+ () => this.checkSettled(),
16587
+ this.settleTimeout
16588
+ );
16589
+ this.maxWaitTimer = setTimeout(() => {
16590
+ this.maxWaitTimer = null;
16591
+ this.completeSettling();
16592
+ }, this.maxWait);
16593
+ }
16594
+ checkSettled() {
16595
+ this.settleCheckTimer = null;
16596
+ const elapsed = performance.now() - this.lastMutationTime;
16597
+ if (elapsed >= this.settleTimeout) {
16598
+ this.completeSettling();
16599
+ } else {
16600
+ this.settleCheckTimer = setTimeout(
16601
+ () => this.checkSettled(),
16602
+ this.settleTimeout - elapsed
16603
+ );
16604
+ }
16605
+ }
16606
+ completeSettling() {
16607
+ if (this.frozen || this.locked || this.disabled)
16608
+ return;
16609
+ if (!this.pendingNavigation)
16610
+ return;
16611
+ this.cancelTimers();
16612
+ this.disconnectSettlingObserver();
16613
+ this.pendingNavigation = null;
16614
+ requestAnimationFrame(() => {
16615
+ requestAnimationFrame(() => {
16616
+ if (!this.frozen && !this.locked && !this.disabled) {
16617
+ this.onSnapshot(true);
16618
+ }
16619
+ });
16620
+ });
16621
+ }
16622
+ cancelTimers() {
16623
+ if (this.debounceTimer !== null) {
16624
+ clearTimeout(this.debounceTimer);
16625
+ this.debounceTimer = null;
16626
+ }
16627
+ if (this.settleCheckTimer !== null) {
16628
+ clearTimeout(this.settleCheckTimer);
16629
+ this.settleCheckTimer = null;
16630
+ }
16631
+ if (this.maxWaitTimer !== null) {
16632
+ clearTimeout(this.maxWaitTimer);
16633
+ this.maxWaitTimer = null;
16634
+ }
16635
+ }
16636
+ disconnectSettlingObserver() {
16637
+ if (this.settlingObserver) {
16638
+ this.settlingObserver.disconnect();
16639
+ this.settlingObserver = null;
16640
+ }
16641
+ }
16642
+ }
16454
16643
  class StylesheetManager {
16455
16644
  constructor(options) {
16456
16645
  __publicField(this, "trackedLinkElements", /* @__PURE__ */ new WeakSet());
@@ -16538,43 +16727,13 @@ class ProcessedNodeManager {
16538
16727
  destroy() {
16539
16728
  }
16540
16729
  }
16541
- const version$1 = "3.1.1-alpha.3";
16730
+ const version$1 = "3.3.0-alpha.1";
16542
16731
  let wrappedEmit;
16543
16732
  let takeFullSnapshot$1;
16544
16733
  let canvasManager;
16545
16734
  let recording = false;
16546
16735
  const customEventQueue = [];
16547
16736
  let flushCustomEventQueue$1;
16548
- function waitForDOMStabilization(win) {
16549
- const maxWaitMs = 5e3;
16550
- return new Promise((resolve2) => {
16551
- const captureAfterPaint = () => {
16552
- requestAnimationFrame(() => {
16553
- requestAnimationFrame(() => {
16554
- resolve2();
16555
- });
16556
- });
16557
- };
16558
- const safeResolve = /* @__PURE__ */ (() => {
16559
- let called = false;
16560
- return () => {
16561
- if (!called) {
16562
- called = true;
16563
- captureAfterPaint();
16564
- }
16565
- };
16566
- })();
16567
- if (["interactive", "complete"].includes(win.document.readyState)) {
16568
- safeResolve();
16569
- } else {
16570
- win.addEventListener("DOMContentLoaded", safeResolve, { once: true });
16571
- win.addEventListener("load", safeResolve, { once: true });
16572
- setTimeout(() => {
16573
- safeResolve();
16574
- }, maxWaitMs);
16575
- }
16576
- });
16577
- }
16578
16737
  try {
16579
16738
  if (Array.from([1], (x2) => x2 * 2)[0] !== 2) {
16580
16739
  const cleanFrame = document.createElement("iframe");
@@ -16707,6 +16866,7 @@ function record(options = {}) {
16707
16866
  checkoutDebounceTimer = null;
16708
16867
  checkoutPending = false;
16709
16868
  checkoutFreezeTimestamp = null;
16869
+ navigationManager == null ? void 0 : navigationManager.cancelPending();
16710
16870
  takeFullSnapshot$1(true);
16711
16871
  mutationBuffers.forEach((buf) => {
16712
16872
  buf.resetBuffers();
@@ -16715,6 +16875,9 @@ function record(options = {}) {
16715
16875
  if (visibilityManager) {
16716
16876
  visibilityManager.unsetFrozen();
16717
16877
  }
16878
+ if (navigationManager) {
16879
+ navigationManager.unsetFrozen();
16880
+ }
16718
16881
  };
16719
16882
  wrappedEmit = (r2, isCheckout) => {
16720
16883
  var _a2;
@@ -16724,6 +16887,7 @@ function record(options = {}) {
16724
16887
  if (((_a2 = mutationBuffers[0]) == null ? void 0 : _a2.isFrozen()) && !checkoutPending && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
16725
16888
  mutationBuffers.forEach((buf) => buf.unfreeze());
16726
16889
  visibilityManager == null ? void 0 : visibilityManager.unfreeze();
16890
+ navigationManager == null ? void 0 : navigationManager.unfreeze();
16727
16891
  }
16728
16892
  if (inEmittingFrame) {
16729
16893
  emit == null ? void 0 : emit(eventProcessor(e2), isCheckout);
@@ -16928,6 +17092,7 @@ function record(options = {}) {
16928
17092
  shadowDomManager.init();
16929
17093
  mutationBuffers.forEach((buf) => buf.lock());
16930
17094
  visibilityManager == null ? void 0 : visibilityManager.lock();
17095
+ navigationManager == null ? void 0 : navigationManager.lock();
16931
17096
  const node2 = snapshot(document, {
16932
17097
  mirror,
16933
17098
  blockClass,
@@ -16979,6 +17144,7 @@ function record(options = {}) {
16979
17144
  );
16980
17145
  mutationBuffers.forEach((buf) => buf.unlock());
16981
17146
  visibilityManager == null ? void 0 : visibilityManager.unlock();
17147
+ navigationManager == null ? void 0 : navigationManager.unlock();
16982
17148
  if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)
16983
17149
  stylesheetManager.adoptStyleSheets(
16984
17150
  document.adoptedStyleSheets,
@@ -16991,6 +17157,31 @@ function record(options = {}) {
16991
17157
  }
16992
17158
  customEventQueue.length = 0;
16993
17159
  };
17160
+ let navigationManager;
17161
+ const navigationSampling = sampling.navigation;
17162
+ if (navigationSampling !== false) {
17163
+ const navConfig = typeof navigationSampling === "object" ? navigationSampling : {};
17164
+ navigationManager = new NavigationManager({
17165
+ doc: document,
17166
+ config: navConfig,
17167
+ onSnapshot: (isCheckout) => {
17168
+ if (checkoutPending) {
17169
+ if (checkoutDebounceTimer) {
17170
+ clearTimeout(checkoutDebounceTimer);
17171
+ checkoutDebounceTimer = null;
17172
+ }
17173
+ checkoutPending = false;
17174
+ checkoutFreezeTimestamp = null;
17175
+ mutationBuffers.forEach((buf) => {
17176
+ buf.resetBuffers();
17177
+ buf.unsetFrozen();
17178
+ });
17179
+ visibilityManager == null ? void 0 : visibilityManager.unsetFrozen();
17180
+ }
17181
+ takeFullSnapshot$1(isCheckout);
17182
+ }
17183
+ });
17184
+ }
16994
17185
  try {
16995
17186
  const handlers = [];
16996
17187
  const observe = (doc) => {
@@ -17019,14 +17210,11 @@ function record(options = {}) {
17019
17210
  }, d)
17020
17211
  }),
17021
17212
  navigationCb: (navData) => {
17022
- console.debug(
17023
- \`[\${nowTimestamp()}] [rrweb:record/navigation] \\u{1F9ED} Navigation detected:\`,
17024
- navData.navigationType,
17025
- navData.oldHref,
17026
- "\\u2192",
17027
- navData.href
17028
- );
17029
- takeFullSnapshot$1(true);
17213
+ if (navigationManager) {
17214
+ navigationManager.handleNavigation(navData);
17215
+ } else {
17216
+ takeFullSnapshot$1(true);
17217
+ }
17030
17218
  },
17031
17219
  inputCb: (v2) => wrappedEmit({
17032
17220
  type: EventType.IncrementalSnapshot,
@@ -17138,23 +17326,6 @@ function record(options = {}) {
17138
17326
  flushCustomEventQueue$1();
17139
17327
  }
17140
17328
  };
17141
- const runInit = async () => {
17142
- if (flushCustomEvent === "before") {
17143
- flushCustomEventQueue$1();
17144
- }
17145
- if (recordAfter === "DOMContentStabilized") {
17146
- console.debug(\`[\${nowTimestamp()}] [rrweb:record] \\u{1F7E2} Waiting for DOM stabilization...\`);
17147
- await waitForDOMStabilization(window);
17148
- console.debug(\`[\${nowTimestamp()}] [rrweb:record] \\u2705 DOM stabilized, starting recording\`);
17149
- }
17150
- console.debug(\`[\${nowTimestamp()}] [rrweb:record] \\u2705 Init dom and takeFullSnapshot \`);
17151
- takeFullSnapshot$1();
17152
- handlers.push(observe(document));
17153
- recording = true;
17154
- if (flushCustomEvent === "after") {
17155
- flushCustomEventQueue$1();
17156
- }
17157
- };
17158
17329
  if (document.readyState === "interactive" || document.readyState === "complete") {
17159
17330
  init();
17160
17331
  } else {
@@ -17190,6 +17361,7 @@ function record(options = {}) {
17190
17361
  }
17191
17362
  flushCustomEventQueue$1();
17192
17363
  handlers.forEach((h) => h());
17364
+ navigationManager == null ? void 0 : navigationManager.destroy();
17193
17365
  processedNodeManager.destroy();
17194
17366
  recording = false;
17195
17367
  unregisterErrorHandler();
@@ -17258,7 +17430,7 @@ exports.record = record;
17258
17430
  return module.exports;
17259
17431
  }))
17260
17432
  //# sourceMappingURL=rrweb-record.umd.cjs.map
17261
- `;var A=`(function (g, f) {if ("object" == typeof exports && "object" == typeof module) {module.exports = f();} else if ("function" == typeof define && define.amd) {define("rrwebPluginSequentialIdRecord", [], f);} else if ("object" == typeof exports) {exports["rrwebPluginSequentialIdRecord"] = f();} else {g["rrwebPluginSequentialIdRecord"] = f();}}(typeof self !== 'undefined' ? self : typeof globalThis !== 'undefined' ? globalThis : this, () => {var exports = {};var module = { exports };
17433
+ `;var T=`(function (g, f) {if ("object" == typeof exports && "object" == typeof module) {module.exports = f();} else if ("function" == typeof define && define.amd) {define("rrwebPluginSequentialIdRecord", [], f);} else if ("object" == typeof exports) {exports["rrwebPluginSequentialIdRecord"] = f();} else {g["rrwebPluginSequentialIdRecord"] = f();}}(typeof self !== 'undefined' ? self : typeof globalThis !== 'undefined' ? globalThis : this, () => {var exports = {};var module = { exports };
17262
17434
  "use strict";
17263
17435
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
17264
17436
  const defaultOptions = {
@@ -17302,5 +17474,5 @@ exports.globalSequentialId = globalSequentialId;
17302
17474
  return module.exports;
17303
17475
  }))
17304
17476
  //# sourceMappingURL=rrweb-plugin-sequential-id-record.umd.cjs.map
17305
- `;var K={slimDOMOptions:"all",inlineStylesheet:!0,recordDOM:!0,recordCanvas:!0,collectFonts:!0,inlineImages:!0,maskInputOptions:{password:!0},sampling:{mousemove:!1,mouseInteraction:{MouseUp:!1,MouseDown:!1,Click:!0,ContextMenu:!0,DblClick:!0,Focus:!0,Blur:!0,TouchStart:!1,TouchEnd:!1},scroll:100,media:100,input:"last",canvas:"all",visibility:{mode:"none",debounce:0,threshold:.5,sensitivity:.05,rafThrottle:10}},flushCustomEvent:"after",recordAfter:"DOMContentLoaded",userTriggeredOnInput:!0},m=class{recordFn=null;page=null;context;eventCounter=0;events=[];recordOptions;pendingEvents=[];recorderScriptVersion="unknown";recorderLibVersion="unknown";isRecording=!1;constructor(e){this.recordOptions=S(K,e??{}),this.context={pushEvent:n=>this.events.push(n)}}handleEmit(e){if(e.type===0||e.type===1)return;let n={...e};this.context.pushEvent(n)}async inject(e){this.page=e,await this.page?.addInitScript({content:R}),await this.page?.addInitScript({content:A}),await this.page?.exposeFunction("handleEmit",n=>{this.handleEmit(n)})}async start(){this.recordFn=await this.page?.evaluateHandle(()=>window.rrweb?.record),await this.recordFn?.evaluate((e,n)=>{let s=JSON.parse(n),r=[];window.rrwebPluginSequentialIdRecord&&r.push(window.rrwebPluginSequentialIdRecord.getRecordSequentialIdPlugin({key:"id"})),window.stopFn=e({emit:i=>{window.handleEmit?.(i)},plugins:r,...s})},JSON.stringify(this.recordOptions)),this.isRecording=await this.recordFn?.evaluate(e=>e.isRecording()),this.recorderScriptVersion=await this.recordFn?.evaluate(e=>e.getVersion()),await this.flush()}async stop(){this.isRecording=!1,this.recordFn&&this.page&&!this.page.isClosed()&&(await this.flush(),await this.page.evaluate(()=>{window.stopFn=null}))}async reset(){this.eventCounter=0,this.events=[],await this.stop(),this.context={pushEvent:e=>this.events.push(e)}}async flush(){if(!this.recordFn)return;let e=[];for(let n of this.pendingEvents)try{await this.recordFn.evaluate((s,r)=>{s.addCustomEvent(r.tag,r.payload)},n)}catch{console.debug(`[${Date.now()}] [recorder] flush failed for custom event: ${n.tag}`),e.push(n)}this.pendingEvents=e}async addCustomEvent(e,n){let s={tag:e,payload:n};if(!this.recordFn||!this.isRecording){console.debug(`[${Date.now()}] [recorder] queued custom event (recorder not ready): ${e}`),this.pendingEvents.push(s);return}try{await this.recordFn.evaluate((r,i)=>{r.addCustomEvent(i.tag,i.payload)},s)}catch{this.pendingEvents.push(s)}}isRecordingReady(){return!!this.recordFn&&this.isRecording}getScriptVersion(){return`@appsurify-testmap/rrweb-record:${this.recorderScriptVersion}`}getLibVersion(){return`@appsurify-testmap/rrweb:${this.recorderLibVersion!=="unknown"?this.recorderLibVersion:this.recorderScriptVersion}`}getEvents(){return this.events}getMirror(){return this.recordFn?.mirror}bind(e){this.context=e}setEventCounter(e){this.eventCounter=e}};var g=m;var T=new Map;function M(t,e){T.set(t,e)}function x(t){return T.get(t)}var $=y.test.extend({browser:async({browser:t},e)=>{await e(t)},context:async({browser:t},e,n)=>{let s=await t.newContext(),r=_(t,n);M(n.testId,r),await e(s),await s.close()},page:async({page:t},e,n)=>{let r=n.project.use.testmap??{},i=typeof r=="object"&&"recordingOpts"in r?r.recordingOpts:g,o=new g(i),c=x(n.testId);c&&(c.recorderInstance=o),o.bind({pushEvent:async a=>{c?.recorderEvents.push(a),await Promise.resolve()}}),await o.inject(t),t.on("console",async a=>{a.type()!=="debug"&&console.debug(`[${Date.now()}] [page] console`,a.text())}),t.on("load",async()=>{}),t.on("domcontentloaded",async()=>{await o.start(),c?.runner&&(c.runner.recorder={scriptVersion:o.getScriptVersion(),libVersion:o.getLibVersion()})}),t.on("framenavigated",async()=>{}),t.on("close",async()=>{await o.flush()});let u=n._onStepEnd.bind(void 0);n._onStepEnd=async a=>{let l=n._stepMap.get(a.stepId);if(l.apiName&&l?.location.file===n.file&&await o.addCustomEvent(l.apiName,{stepId:l.stepId,category:l.category,location:l.location,title:l.title,apiName:l.apiName,endWallTime:l.endWallTime}),!t.isClosed())try{await I(t)}catch{}await u(a)};let h=n._onDidFinishTestFunction.bind(void 0);n._onDidFinishTestFunction=async()=>{o&&o.isRecordingReady()&&(await E(o,500),await o.stop()),await h()},await e(t)}});$.beforeEach(async({},t)=>{console.log(`[${Date.now()}] [\u{1F7E2} TEST START] ${t.title}`)});$.afterEach(async({},t)=>{console.log(`[${Date.now()}] [\u{1F534} TEST END] ${t.title}`);let e=x(t.testId);if(!e)return;e.test.duration=t.duration;let n={runner:e?.runner,spec:e?.spec,browser:e?.browser,test:e?.test,suite:e?.test.suite,recorderEvents:Array.isArray(e?.recorderEvents)?e?.recorderEvents:[]},r=t.project.use.testmap??{};C(n,r.outputReportDir)});0&&(module.exports={expect,test});
17477
+ `;var K={slimDOMOptions:"all",inlineStylesheet:!0,recordDOM:!0,recordCanvas:!0,collectFonts:!0,inlineImages:!0,maskInputOptions:{password:!0},sampling:{mousemove:!1,mouseInteraction:{MouseUp:!1,MouseDown:!1,Click:!0,ContextMenu:!0,DblClick:!0,Focus:!0,Blur:!0,TouchStart:!1,TouchEnd:!1},scroll:100,media:100,input:"last",canvas:"all",visibility:{mode:"none",debounce:0,threshold:.5,sensitivity:.05,rafThrottle:10}},flushCustomEvent:"after",recordAfter:"DOMContentLoaded",userTriggeredOnInput:!0},m=class{recordFn=null;page=null;context;eventCounter=0;events=[];recordOptions;pendingEvents=[];recorderScriptVersion="unknown";recorderLibVersion="unknown";isRecording=!1;constructor(e){this.recordOptions=S(K,e??{}),this.context={pushEvent:n=>this.events.push(n)}}handleEmit(e){if(e.type===0||e.type===1)return;let n={...e};this.context.pushEvent(n)}async inject(e){this.page=e,await this.page?.addInitScript({content:R}),await this.page?.addInitScript({content:T}),await this.page?.exposeFunction("handleEmit",n=>{this.handleEmit(n)})}async start(){this.recordFn=await this.page?.evaluateHandle(()=>window.rrweb?.record),await this.recordFn?.evaluate((e,n)=>{let r=JSON.parse(n),s=[];window.rrwebPluginSequentialIdRecord&&s.push(window.rrwebPluginSequentialIdRecord.getRecordSequentialIdPlugin({key:"id"})),window.stopFn=e({emit:o=>{window.handleEmit?.(o)},plugins:s,...r})},JSON.stringify(this.recordOptions)),this.isRecording=await this.recordFn?.evaluate(e=>e.isRecording()),this.recorderScriptVersion=await this.recordFn?.evaluate(e=>e.getVersion()),await this.flush()}async stop(){this.isRecording=!1,this.recordFn&&this.page&&!this.page.isClosed()&&(await this.flush(),await this.page.evaluate(()=>{window.stopFn=null}))}async reset(){this.eventCounter=0,this.events=[],await this.stop(),this.context={pushEvent:e=>this.events.push(e)}}async flush(){if(!this.recordFn)return;let e=[];for(let n of this.pendingEvents)try{await this.recordFn.evaluate((r,s)=>{r.addCustomEvent(s.tag,s.payload)},n)}catch{console.debug(`[${Date.now()}] [recorder] flush failed for custom event: ${n.tag}`),e.push(n)}this.pendingEvents=e}async addCustomEvent(e,n){let r={tag:e,payload:n};if(!this.recordFn||!this.isRecording){console.debug(`[${Date.now()}] [recorder] queued custom event (recorder not ready): ${e}`),this.pendingEvents.push(r);return}try{await this.recordFn.evaluate((s,o)=>{s.addCustomEvent(o.tag,o.payload)},r)}catch{this.pendingEvents.push(r)}}isRecordingReady(){return!!this.recordFn&&this.isRecording}getScriptVersion(){return`@appsurify-testmap/rrweb-record:${this.recorderScriptVersion}`}getLibVersion(){return`@appsurify-testmap/rrweb:${this.recorderLibVersion!=="unknown"?this.recorderLibVersion:this.recorderScriptVersion}`}getEvents(){return this.events}getMirror(){return this.recordFn?.mirror}bind(e){this.context=e}setEventCounter(e){this.eventCounter=e}};var g=m;var A=new Map;function M(t,e){A.set(t,e)}function x(t){return A.get(t)}var k=y.test.extend({browser:async({browser:t},e)=>{await e(t)},context:async({browser:t},e,n)=>{let r=await t.newContext(),s=_(t,n);M(n.testId,s),await e(r),await r.close()},page:async({page:t},e,n)=>{let s=n.project.use.testmap??{},o=typeof s=="object"&&"recordingOpts"in s?s.recordingOpts:g,i=new g(o),c=x(n.testId);c&&(c.recorderInstance=i),i.bind({pushEvent:async a=>{c?.recorderEvents.push(a),await Promise.resolve()}}),await i.inject(t),t.on("console",async a=>{a.type()!=="debug"&&console.debug(`[${Date.now()}] [page] console`,a.text())}),t.on("load",async()=>{}),t.on("domcontentloaded",async()=>{await i.start(),c?.runner&&(c.runner.recorder={scriptVersion:i.getScriptVersion(),libVersion:i.getLibVersion()})}),t.on("framenavigated",async()=>{}),t.on("close",async()=>{await i.flush()});let u=n._onStepEnd.bind(void 0);n._onStepEnd=async a=>{let l=n._stepMap.get(a.stepId);if(l.apiName&&l?.location.file===n.file&&await i.addCustomEvent(l.apiName,{stepId:l.stepId,category:l.category,location:l.location,title:l.title,apiName:l.apiName,endWallTime:l.endWallTime}),!t.isClosed())try{await I(t)}catch{}await u(a)};let h=n._onDidFinishTestFunction.bind(void 0);n._onDidFinishTestFunction=async()=>{i&&i.isRecordingReady()&&(await E(i,500),await i.stop()),await h()},await e(t)}});k.beforeEach(async({},t)=>{console.log(`[${Date.now()}] [\u{1F7E2} TEST START] ${t.title}`)});k.afterEach(async({},t)=>{console.log(`[${Date.now()}] [\u{1F534} TEST END] ${t.title}`);let e=x(t.testId);if(!e)return;e.test.duration=t.duration;let n={runner:e?.runner,spec:e?.spec,browser:e?.browser,test:e?.test,suite:e?.test.suite,recorderEvents:Array.isArray(e?.recorderEvents)?e?.recorderEvents:[]},s=t.project.use.testmap??{};C(n,s.outputReportDir)});0&&(module.exports={expect,test});
17306
17478
  //# sourceMappingURL=index.js.map