@sprig-technologies/sprig-browser 2.36.0 → 2.37.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.
- package/dist/{core-B-mNVA8c.cjs → core-BRS09IB6.cjs} +2 -2
- package/dist/{core-PNM_2mYx.js → core-Bm1eJsD-.js} +3 -3
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +8 -0
- package/dist/core.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.js +2 -2
- package/dist/{metricsReporter-B_p_qsZJ.js → metricsReporter-C-byY7_U.js} +1 -1
- package/dist/{metricsReporter-CWGtDAqh.cjs → metricsReporter-Hw5GZJnq.cjs} +1 -1
- package/dist/replay.cjs +1 -1
- package/dist/replay.js +14 -12
- package/dist/view-C0FQQs2x.cjs +669 -0
- package/dist/{view-C3-nqngP.js → view-dfp5ccm1.js} +1344 -1293
- package/package.json +1 -1
- package/dist/view-Cji0PL_w.cjs +0 -669
package/dist/replay.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var it = Object.defineProperty;
|
|
2
2
|
var dt = (e, t, n) => t in e ? it(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var F = (e, t, n) => dt(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
-
import { b as d, s as Q, a as m, v as X, c as ct, g as ut, P as ke, r as Ue, d as lt, e as V, S as Z, f as pt } from "./metricsReporter-
|
|
4
|
+
import { b as d, s as Q, a as m, v as X, c as ct, g as ut, P as ke, r as Ue, d as lt, e as V, S as Z, f as pt } from "./metricsReporter-C-byY7_U.js";
|
|
5
5
|
var B = ((e) => (e[e.DomContentLoaded = 0] = "DomContentLoaded", e[e.Load = 1] = "Load", e[e.FullSnapshot = 2] = "FullSnapshot", e[e.IncrementalSnapshot = 3] = "IncrementalSnapshot", e[e.Meta = 4] = "Meta", e[e.Custom = 5] = "Custom", e[e.Plugin = 6] = "Plugin", e))(B || {}), k = ((e) => (e[e.Mutation = 0] = "Mutation", e[e.MouseMove = 1] = "MouseMove", e[e.MouseInteraction = 2] = "MouseInteraction", e[e.Scroll = 3] = "Scroll", e[e.ViewportResize = 4] = "ViewportResize", e[e.Input = 5] = "Input", e[e.TouchMove = 6] = "TouchMove", e[e.MediaInteraction = 7] = "MediaInteraction", e[e.StyleSheetRule = 8] = "StyleSheetRule", e[e.CanvasMutation = 9] = "CanvasMutation", e[e.Font = 10] = "Font", e[e.Log = 11] = "Log", e[e.Drag = 12] = "Drag", e[e.StyleDeclaration = 13] = "StyleDeclaration", e[e.Selection = 14] = "Selection", e[e.AdoptedStyleSheet = 15] = "AdoptedStyleSheet", e[e.CustomElement = 16] = "CustomElement", e))(k || {});
|
|
6
6
|
const re = (e, t) => t.some((n) => e instanceof n);
|
|
7
7
|
let Se, De;
|
|
@@ -175,7 +175,7 @@ const Ce = (e) => {
|
|
|
175
175
|
var r, o;
|
|
176
176
|
let n = t.target;
|
|
177
177
|
var a;
|
|
178
|
-
t.target === ((r = window.document) == null ? void 0 : r.body) && window.Sprig.pointerDownTarget && (n = window.Sprig.pointerDownTarget), a = { x: t.x, y: t.y, type: e, elementAttributes: Tt(n), windowHeight: window.innerHeight, windowWidth: window.innerWidth, ...n instanceof HTMLElement ? { rect: n == null ? void 0 : n.getBoundingClientRect(), xPath: Ae(n) } : {} }, (o = a == null ? void 0 : a.elementAttributes) != null && o.text && (a.elementAttributes.text = he(a.elementAttributes.text)), b == null || b("Sprig_Click", a);
|
|
178
|
+
t.target === ((r = window.document) == null ? void 0 : r.body) && window.Sprig.pointerDownTarget && (n = window.Sprig.pointerDownTarget), a = { x: t.x, y: t.y, type: e, elementAttributes: Tt(n), windowHeight: window.innerHeight, windowWidth: window.innerWidth, ...n instanceof HTMLElement || n instanceof SVGElement || n instanceof MathMLElement ? { rect: n == null ? void 0 : n.getBoundingClientRect(), xPath: Ae(n) } : {} }, (o = a == null ? void 0 : a.elementAttributes) != null && o.text && (a.elementAttributes.text = he(a.elementAttributes.text)), b == null || b("Sprig_Click", a);
|
|
179
179
|
}, Le = (e) => {
|
|
180
180
|
var t;
|
|
181
181
|
Ct.includes(e.key) && (t = { key: e.key }, b == null || b("Sprig_Keystroke", t));
|
|
@@ -379,14 +379,16 @@ const l = new class {
|
|
|
379
379
|
await n.done;
|
|
380
380
|
}
|
|
381
381
|
}(), x = [];
|
|
382
|
-
let j, We,
|
|
383
|
-
const
|
|
384
|
-
|
|
382
|
+
let j, We, A = [], L = !1, N = 0, W = !1, $e = !1;
|
|
383
|
+
const Ie = [];
|
|
384
|
+
let q, Ke, $, Je, ne = !1;
|
|
385
|
+
const O = () => W && !L && Date.now() <= q, Mt = ({ apiUrl: e, config: t, triggerSnapshot: n, forceInit: a = !1 }) => {
|
|
386
|
+
W && !a || (m.isStorageAvailable ? (A = [], Ie.splice(0), x.splice(0), N = 0, $ = n, We = e, j = { responseGroupUuid: t.responseGroupUuid, surveyId: t.surveyId, userAgent: t.userAgent, sdkVersion: t.sdkVersion }, Ke = t.maxDurationSeconds, Lt(), W || (Je = window.setInterval(Nt, 500)), W = !0) : L = !0);
|
|
385
387
|
}, _t = [k.Drag, k.Input, k.MediaInteraction, k.MouseInteraction, k.MouseMove, k.Scroll, k.Selection, k.TouchMove], At = (e) => e.type === B.Custom || e.type === B.IncrementalSnapshot && _t.includes(e.data.source), ve = (e) => e.some(At), Nt = async () => {
|
|
386
|
-
if (!O()) return void window.clearInterval(
|
|
388
|
+
if (!O()) return void window.clearInterval(Je);
|
|
387
389
|
if (ze(), !ve(x)) return;
|
|
388
390
|
const e = x[0].timestamp;
|
|
389
|
-
Date.now() - e > 35e3 && (
|
|
391
|
+
Date.now() - e > 35e3 && ($ == null || $());
|
|
390
392
|
}, ze = async () => {
|
|
391
393
|
if (A.length || ne) return;
|
|
392
394
|
ne = !0;
|
|
@@ -399,7 +401,7 @@ const O = () => $ && !L && Date.now() <= q, Mt = ({ apiUrl: e, config: t, trigge
|
|
|
399
401
|
d.info("Read stored session state", e);
|
|
400
402
|
const t = JSON.parse(e);
|
|
401
403
|
L = t.disabled, j = t.metadata, A = t.uploadUrls, N = t.currentIndex, q = t.expirationTimestamp, t.pendingEventTimestamp && (d.info(`Uploading with pending timestamp: ${t.pendingEventTimestamp}`), Ot(t.pendingEventTimestamp));
|
|
402
|
-
} else q = 1e3 *
|
|
404
|
+
} else q = 1e3 * Ke + Date.now();
|
|
403
405
|
}, Ot = async (e) => {
|
|
404
406
|
const t = Date.now(), n = (await l.getEventsBetween(e, t)).map((r) => JSON.parse(r.event));
|
|
405
407
|
if (!ve(n)) return;
|
|
@@ -440,7 +442,7 @@ const O = () => $ && !L && Date.now() <= q, Mt = ({ apiUrl: e, config: t, trigge
|
|
|
440
442
|
const t = e.length ? e[e.length - 1].timestamp : Date.now(), n = N, a = ((o = (r = window.UserLeap) == null ? void 0 : r.config) == null ? void 0 : o.customMetadata) ?? ((s = window.__cfg) == null ? void 0 : s.customMetadata);
|
|
441
443
|
N++, e.push({ timestamp: t, type: B.Custom, data: { tag: "Sprig_Meta", payload: { ...j, index: n, visitorId: window.UserLeap.visitorId ?? "", timestamp: t, customMetadata: a } } });
|
|
442
444
|
}, Ht = (e, t) => {
|
|
443
|
-
O() &&
|
|
445
|
+
O() && !$e && (e || x.length) && (e && x.length && (async () => {
|
|
444
446
|
const n = x.splice(0);
|
|
445
447
|
if (!ve(n)) return;
|
|
446
448
|
d.info("Capturing always-on event array to upload"), Ze(n);
|
|
@@ -449,7 +451,7 @@ const O = () => $ && !L && Date.now() <= q, Mt = ({ apiUrl: e, config: t, trigge
|
|
|
449
451
|
})(), x.push(t));
|
|
450
452
|
};
|
|
451
453
|
window.addEventListener("beforeunload", async () => {
|
|
452
|
-
|
|
454
|
+
$e = !0, O() && (d.info("Always On handle page unload"), (() => {
|
|
453
455
|
let e;
|
|
454
456
|
x.length && (e = x[0].timestamp);
|
|
455
457
|
const t = { disabled: L, metadata: j, uploadUrls: A, currentIndex: N, pendingEventTimestamp: e, expirationTimestamp: q };
|
|
@@ -676,7 +678,7 @@ const ye = async (e = !1) => {
|
|
|
676
678
|
d.debug("ReplayInit"), await D(async () => {
|
|
677
679
|
var i;
|
|
678
680
|
n != null && n.minDuration && (tt = n.minDuration), n != null && n.batchDuration && (pe = n.batchDuration), i = t, Me.setLimit(i), Kt(), Gt(c + 35, 1800, c + 35), Wt();
|
|
679
|
-
const u = window.UserLeap.replayLibraryURL ?? "https://cdn.sprig.com/dependencies/record
|
|
681
|
+
const u = window.UserLeap.replayLibraryURL ?? "https://cdn.sprig.com/dependencies/record.min.js";
|
|
680
682
|
if (!window.rrwebRecord) {
|
|
681
683
|
const { record: f } = await import(
|
|
682
684
|
/* webpackIgnore: true */
|
|
@@ -688,7 +690,7 @@ const ye = async (e = !1) => {
|
|
|
688
690
|
const y = window.rrwebRecord;
|
|
689
691
|
if (!y) return d.error("RecordScriptFailed");
|
|
690
692
|
let p = !0, h = 0;
|
|
691
|
-
const w = { checkoutEveryNms: 3e4, sampling: { input: "last", scroll: 250, media: 800 }, ...n };
|
|
693
|
+
const w = { checkoutEveryNms: 3e4, sampling: { input: "last", scroll: 250, media: 800 }, ...n, mutationQueueEnabled: n == null ? void 0 : n.enableMutationQueue };
|
|
692
694
|
var E, P;
|
|
693
695
|
g.stopRecording = y({ emit: (f, v) => {
|
|
694
696
|
if (f.type === B.Custom && (ge = Date.now()), T() || z()) return;
|