@extn/segi-js 0.2.2 → 0.2.4

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.
@@ -367,7 +367,7 @@ async function activateReplay(args) {
367
367
  setTimeout(onIdle, 5e3);
368
368
  }
369
369
  };
370
- void Promise.resolve().then(() => _interopRequireWildcard(require("../rrweb-CS5CEEFJ.js"))).then(
370
+ void Promise.resolve().then(() => _interopRequireWildcard(require("../rrweb-5RF4GJUU.js"))).then(
371
371
  ({ startRrweb }) => new Promise((resolve) => {
372
372
  scheduleRrwebStart(() => {
373
373
  startRrweb({
@@ -367,7 +367,7 @@ async function activateReplay(args) {
367
367
  setTimeout(onIdle, 5e3);
368
368
  }
369
369
  };
370
- void import("../rrweb-2AZRG7VC.mjs").then(
370
+ void import("../rrweb-7F2GWQCE.mjs").then(
371
371
  ({ startRrweb }) => new Promise((resolve) => {
372
372
  scheduleRrwebStart(() => {
373
373
  startRrweb({
@@ -17,7 +17,7 @@ async function startRrweb(args) {
17
17
  let rrweb;
18
18
  try {
19
19
  rrweb = await Promise.resolve().then(() => _interopRequireWildcard(require("rrweb")));
20
- } catch (e) {
20
+ } catch (e2) {
21
21
  return null;
22
22
  }
23
23
  const maskClass = _nullishCoalesce(_optionalChain([args, 'access', _ => _.options, 'access', _2 => _2.mask, 'optionalAccess', _3 => _3.class]), () => ( "segi-mask"));
@@ -48,13 +48,35 @@ async function startRrweb(args) {
48
48
  }, IDLE_CHECK_MS);
49
49
  function startRecorder() {
50
50
  if (stopFn) return;
51
+ let emitCount = 0;
52
+ const log = (...args2) => {
53
+ if (typeof console !== "undefined") {
54
+ console.log("[segi.replay]", ...args2);
55
+ }
56
+ };
57
+ log("startRecorder() called, rrweb keys:", Object.keys(rrweb).slice(0, 12));
51
58
  const stop = rrweb.record({
52
59
  emit(event) {
60
+ emitCount++;
61
+ const e = event;
62
+ if (emitCount <= 10) {
63
+ log(
64
+ `emit #${emitCount}`,
65
+ "type:",
66
+ e.type,
67
+ "source:",
68
+ _optionalChain([e, 'access', _7 => _7.data, 'optionalAccess', _8 => _8.source]),
69
+ "paused:",
70
+ paused,
71
+ "stopped:",
72
+ stopped
73
+ );
74
+ }
53
75
  if (paused || stopped) return;
54
76
  buffer.push(event);
55
77
  try {
56
78
  bufferBytes += JSON.stringify(event).length;
57
- } catch (e2) {
79
+ } catch (e3) {
58
80
  }
59
81
  if (bufferBytes >= FLUSH_BYTES) flush();
60
82
  },
@@ -69,19 +91,46 @@ async function startRrweb(args) {
69
91
  maskTextClass: maskClass,
70
92
  recordCanvas: false,
71
93
  collectFonts: false,
72
- checkoutEveryNms: CHECKOUT_EVERY_MS,
73
- // Explicit (rather than relying on default) so we don't regress
74
- // when the rrweb default changes between alpha builds. Inlines
75
- // <link rel="stylesheet"> CSS at snapshot time — playback in the
76
- // admin iframe doesn't have access to the customer's origin to
77
- // fetch them otherwise.
78
- inlineStylesheet: true
94
+ checkoutEveryNms: CHECKOUT_EVERY_MS
95
+ // inlineStylesheet intentionally NOT set explicitly; in
96
+ // 2.0.0-alpha.20 the default is `true` but setting it explicitly
97
+ // appears to defer the initial FullSnapshot until all stylesheet
98
+ // fetches complete (or fail). Leaving the default makes rrweb
99
+ // emit the FullSnapshot immediately and inline async-best-effort.
79
100
  });
80
101
  stopFn = typeof stop === "function" ? stop : null;
102
+ log(
103
+ "record() returned, stopFn:",
104
+ typeof stop,
105
+ "rrweb.record.takeFullSnapshot:",
106
+ typeof rrweb.record.takeFullSnapshot,
107
+ "rrweb.takeFullSnapshot:",
108
+ typeof rrweb.takeFullSnapshot
109
+ );
110
+ const forceSnapshot = (label) => {
111
+ if (stopped || paused) return;
112
+ try {
113
+ const rrwebMod = rrweb;
114
+ if (typeof rrwebMod.record.takeFullSnapshot === "function") {
115
+ log(`forceSnapshot[${label}] via record.takeFullSnapshot`);
116
+ rrwebMod.record.takeFullSnapshot(true);
117
+ } else if (typeof rrwebMod.takeFullSnapshot === "function") {
118
+ log(`forceSnapshot[${label}] via top-level takeFullSnapshot`);
119
+ rrwebMod.takeFullSnapshot(true);
120
+ } else {
121
+ log(`forceSnapshot[${label}] no takeFullSnapshot found`);
122
+ }
123
+ } catch (err) {
124
+ log(`forceSnapshot[${label}] threw:`, err);
125
+ }
126
+ };
127
+ setTimeout(() => forceSnapshot("100ms"), 100);
128
+ setTimeout(() => forceSnapshot("500ms"), 500);
129
+ setTimeout(() => forceSnapshot("2000ms"), 2e3);
81
130
  }
82
131
  function stopRrwebOnly() {
83
132
  try {
84
- _optionalChain([stopFn, 'optionalCall', _7 => _7()]);
133
+ _optionalChain([stopFn, 'optionalCall', _9 => _9()]);
85
134
  } finally {
86
135
  stopFn = null;
87
136
  }
@@ -94,7 +143,7 @@ async function startRrweb(args) {
94
143
  bufferBytes = 0;
95
144
  try {
96
145
  args.sendChunk(chunk, useBeacon);
97
- } catch (e3) {
146
+ } catch (e4) {
98
147
  }
99
148
  }
100
149
  function onActivity() {
@@ -143,8 +192,8 @@ async function startRrweb(args) {
143
192
  if (stopped || paused) return;
144
193
  try {
145
194
  const rec = rrweb.record;
146
- _optionalChain([rec, 'access', _8 => _8.takeFullSnapshot, 'optionalCall', _9 => _9()]);
147
- } catch (e4) {
195
+ _optionalChain([rec, 'access', _10 => _10.takeFullSnapshot, 'optionalCall', _11 => _11()]);
196
+ } catch (e5) {
148
197
  }
149
198
  }
150
199
  };
@@ -48,8 +48,30 @@ async function startRrweb(args) {
48
48
  }, IDLE_CHECK_MS);
49
49
  function startRecorder() {
50
50
  if (stopFn) return;
51
+ let emitCount = 0;
52
+ const log = (...args2) => {
53
+ if (typeof console !== "undefined") {
54
+ console.log("[segi.replay]", ...args2);
55
+ }
56
+ };
57
+ log("startRecorder() called, rrweb keys:", Object.keys(rrweb).slice(0, 12));
51
58
  const stop = rrweb.record({
52
59
  emit(event) {
60
+ emitCount++;
61
+ const e = event;
62
+ if (emitCount <= 10) {
63
+ log(
64
+ `emit #${emitCount}`,
65
+ "type:",
66
+ e.type,
67
+ "source:",
68
+ e.data?.source,
69
+ "paused:",
70
+ paused,
71
+ "stopped:",
72
+ stopped
73
+ );
74
+ }
53
75
  if (paused || stopped) return;
54
76
  buffer.push(event);
55
77
  try {
@@ -69,15 +91,42 @@ async function startRrweb(args) {
69
91
  maskTextClass: maskClass,
70
92
  recordCanvas: false,
71
93
  collectFonts: false,
72
- checkoutEveryNms: CHECKOUT_EVERY_MS,
73
- // Explicit (rather than relying on default) so we don't regress
74
- // when the rrweb default changes between alpha builds. Inlines
75
- // <link rel="stylesheet"> CSS at snapshot time — playback in the
76
- // admin iframe doesn't have access to the customer's origin to
77
- // fetch them otherwise.
78
- inlineStylesheet: true
94
+ checkoutEveryNms: CHECKOUT_EVERY_MS
95
+ // inlineStylesheet intentionally NOT set explicitly; in
96
+ // 2.0.0-alpha.20 the default is `true` but setting it explicitly
97
+ // appears to defer the initial FullSnapshot until all stylesheet
98
+ // fetches complete (or fail). Leaving the default makes rrweb
99
+ // emit the FullSnapshot immediately and inline async-best-effort.
79
100
  });
80
101
  stopFn = typeof stop === "function" ? stop : null;
102
+ log(
103
+ "record() returned, stopFn:",
104
+ typeof stop,
105
+ "rrweb.record.takeFullSnapshot:",
106
+ typeof rrweb.record.takeFullSnapshot,
107
+ "rrweb.takeFullSnapshot:",
108
+ typeof rrweb.takeFullSnapshot
109
+ );
110
+ const forceSnapshot = (label) => {
111
+ if (stopped || paused) return;
112
+ try {
113
+ const rrwebMod = rrweb;
114
+ if (typeof rrwebMod.record.takeFullSnapshot === "function") {
115
+ log(`forceSnapshot[${label}] via record.takeFullSnapshot`);
116
+ rrwebMod.record.takeFullSnapshot(true);
117
+ } else if (typeof rrwebMod.takeFullSnapshot === "function") {
118
+ log(`forceSnapshot[${label}] via top-level takeFullSnapshot`);
119
+ rrwebMod.takeFullSnapshot(true);
120
+ } else {
121
+ log(`forceSnapshot[${label}] no takeFullSnapshot found`);
122
+ }
123
+ } catch (err) {
124
+ log(`forceSnapshot[${label}] threw:`, err);
125
+ }
126
+ };
127
+ setTimeout(() => forceSnapshot("100ms"), 100);
128
+ setTimeout(() => forceSnapshot("500ms"), 500);
129
+ setTimeout(() => forceSnapshot("2000ms"), 2e3);
81
130
  }
82
131
  function stopRrwebOnly() {
83
132
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@extn/segi-js",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Browser JavaScript SDK for the segi error monitoring service",
5
5
  "license": "UNLICENSED",
6
6
  "main": "./dist/index.js",
@@ -28,7 +28,7 @@
28
28
  "access": "public"
29
29
  },
30
30
  "dependencies": {
31
- "rrweb": "2.0.0-alpha.4",
31
+ "rrweb": "2.0.0-alpha.20",
32
32
  "@extn/segi-shared": "0.2.0"
33
33
  },
34
34
  "devDependencies": {