@brainfish-ai/web-tracker 0.0.7-alpha.5 → 0.0.7-alpha.6
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.cjs.js +7 -7
- package/dist/index.cjs.js.gz +0 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +74 -67
- package/dist/index.js.gz +0 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -33,7 +33,7 @@ const rt = /* @__PURE__ */ Object.create(null);
|
|
|
33
33
|
Object.keys(we).forEach((a) => {
|
|
34
34
|
rt[we[a]] = a;
|
|
35
35
|
});
|
|
36
|
-
const xt = { type: "error", data: "parser error" }, Ba = typeof Blob == "function" || typeof Blob != "undefined" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", qa = typeof ArrayBuffer == "function",
|
|
36
|
+
const xt = { type: "error", data: "parser error" }, Ba = typeof Blob == "function" || typeof Blob != "undefined" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", qa = typeof ArrayBuffer == "function", Ua = (a) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(a) : a && a.buffer instanceof ArrayBuffer, Pt = ({ type: a, data: e }, t, n) => Ba && e instanceof Blob ? t ? n(e) : oa(e, n) : qa && (e instanceof ArrayBuffer || Ua(e)) ? t ? n(e) : oa(new Blob([e]), n) : n(we[a] + (e || "")), oa = (a, e) => {
|
|
37
37
|
const t = new FileReader();
|
|
38
38
|
return t.onload = function() {
|
|
39
39
|
const n = t.result.split(",")[1];
|
|
@@ -66,7 +66,7 @@ const er = typeof ArrayBuffer == "function", Gt = (a, e) => {
|
|
|
66
66
|
function ar() {
|
|
67
67
|
return new TransformStream({ transform(a, e) {
|
|
68
68
|
(function(t, n) {
|
|
69
|
-
Ba && t.data instanceof Blob ? t.data.arrayBuffer().then(sa).then(n) : qa && (t.data instanceof ArrayBuffer ||
|
|
69
|
+
Ba && t.data instanceof Blob ? t.data.arrayBuffer().then(sa).then(n) : qa && (t.data instanceof ArrayBuffer || Ua(t.data)) ? n(sa(t.data)) : Pt(t, !1, (r) => {
|
|
70
70
|
vt || (vt = new TextEncoder()), n(vt.encode(r));
|
|
71
71
|
});
|
|
72
72
|
})(a, (t) => {
|
|
@@ -134,7 +134,7 @@ te.prototype.on = te.prototype.addEventListener = function(a, e) {
|
|
|
134
134
|
return !!this.listeners(a).length;
|
|
135
135
|
};
|
|
136
136
|
const pt = typeof Promise == "function" && typeof Promise.resolve == "function" ? (a) => Promise.resolve().then(a) : (a, e) => e(a, 0), pe = typeof self != "undefined" ? self : typeof window != "undefined" ? window : Function("return this")();
|
|
137
|
-
function
|
|
137
|
+
function Wa(a, ...e) {
|
|
138
138
|
return e.reduce((t, n) => (a.hasOwnProperty(n) && (t[n] = a[n]), t), {});
|
|
139
139
|
}
|
|
140
140
|
const nr = pe.setTimeout, rr = pe.clearTimeout;
|
|
@@ -300,7 +300,7 @@ class ve extends te {
|
|
|
300
300
|
}
|
|
301
301
|
_create() {
|
|
302
302
|
var e;
|
|
303
|
-
const t =
|
|
303
|
+
const t = Wa(this._opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
|
|
304
304
|
t.xdomain = !!this._opts.xd;
|
|
305
305
|
const n = this._xhr = this.createRequest(t);
|
|
306
306
|
try {
|
|
@@ -378,7 +378,7 @@ class dr extends Zt {
|
|
|
378
378
|
return "websocket";
|
|
379
379
|
}
|
|
380
380
|
doOpen() {
|
|
381
|
-
const e = this.uri(), t = this.opts.protocols, n = Ka ? {} :
|
|
381
|
+
const e = this.uri(), t = this.opts.protocols, n = Ka ? {} : Wa(this.opts, "agent", "perMessageDeflate", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "localAddress", "protocolVersion", "origin", "maxPayload", "family", "checkServerIdentity");
|
|
382
382
|
this.opts.extraHeaders && (n.headers = this.opts.extraHeaders);
|
|
383
383
|
try {
|
|
384
384
|
this.ws = this.createSocket(e, t, n);
|
|
@@ -1261,7 +1261,7 @@ class _t extends te {
|
|
|
1261
1261
|
this._reconnecting = !1, this.backoff.reset(), this.emitReserved("reconnect", e);
|
|
1262
1262
|
}
|
|
1263
1263
|
}
|
|
1264
|
-
const
|
|
1264
|
+
const Ue = {};
|
|
1265
1265
|
function st(a, e) {
|
|
1266
1266
|
typeof a == "object" && (e = a, a = void 0);
|
|
1267
1267
|
const t = function(l, c = "", h) {
|
|
@@ -1269,9 +1269,9 @@ function st(a, e) {
|
|
|
1269
1269
|
h = h || typeof location != "undefined" && location, l == null && (l = h.protocol + "//" + h.host), typeof l == "string" && (l.charAt(0) === "/" && (l = l.charAt(1) === "/" ? h.protocol + l : h.host + l), /^(https?|wss?):\/\//.test(l) || (l = h !== void 0 ? h.protocol + "//" + l : "https://" + l), d = Rt(l)), d.port || (/^(http|ws)$/.test(d.protocol) ? d.port = "80" : /^(http|ws)s$/.test(d.protocol) && (d.port = "443")), d.path = d.path || "/";
|
|
1270
1270
|
const u = d.host.indexOf(":") !== -1 ? "[" + d.host + "]" : d.host;
|
|
1271
1271
|
return d.id = d.protocol + "://" + u + ":" + d.port + c, d.href = d.protocol + "://" + u + (h && h.port === d.port ? "" : ":" + d.port), d;
|
|
1272
|
-
}(a, (e = e || {}).path || "/socket.io"), n = t.source, r = t.id, i = t.path, o =
|
|
1272
|
+
}(a, (e = e || {}).path || "/socket.io"), n = t.source, r = t.id, i = t.path, o = Ue[r] && i in Ue[r].nsps;
|
|
1273
1273
|
let s;
|
|
1274
|
-
return e.forceNew || e["force new connection"] || e.multiplex === !1 || o ? s = new _t(n, e) : (
|
|
1274
|
+
return e.forceNew || e["force new connection"] || e.multiplex === !1 || o ? s = new _t(n, e) : (Ue[r] || (Ue[r] = new _t(n, e)), s = Ue[r]), t.query && !e.query && (e.query = t.queryKey), s.socket(t.path, e);
|
|
1275
1275
|
}
|
|
1276
1276
|
Object.assign(st, { Manager: _t, Socket: Ha, io: st, connect: st });
|
|
1277
1277
|
class zr {
|
|
@@ -1402,7 +1402,14 @@ class Er {
|
|
|
1402
1402
|
return O(this, null, function* () {
|
|
1403
1403
|
console.log("----- 1. IDENTIFYING USER -----", e), e.userId && (this.userId = e.userId, console.log("----- 2. FLUSHING QUEUE -----"), this.flush()), console.log("----- 3. LOOKING FOR IFRAME -----");
|
|
1404
1404
|
const t = document.querySelector("#bf-iframe-container .trigger-iframe");
|
|
1405
|
-
if (t
|
|
1405
|
+
if (t) {
|
|
1406
|
+
console.log("----- 4. CHECKING IFRAME STATE -----");
|
|
1407
|
+
const n = () => {
|
|
1408
|
+
t.contentWindow && (console.log("----- 5. POSTING MESSAGE TO IFRAME -----"), t.contentWindow.postMessage({ type: "USER_IDENTIFY", payload: e }, "*"));
|
|
1409
|
+
};
|
|
1410
|
+
t.contentWindow && n(), t.addEventListener("load", n);
|
|
1411
|
+
}
|
|
1412
|
+
if (Object.keys(e).length > 1) return this.send({ type: "user.identify", payload: Me(de({}, e), { properties: de(de({}, this.global), e.properties) }) });
|
|
1406
1413
|
});
|
|
1407
1414
|
}
|
|
1408
1415
|
record(e, t) {
|
|
@@ -1822,7 +1829,7 @@ function qr(a, e) {
|
|
|
1822
1829
|
}
|
|
1823
1830
|
});
|
|
1824
1831
|
}
|
|
1825
|
-
function
|
|
1832
|
+
function Ur(t) {
|
|
1826
1833
|
return O(this, arguments, function* (a, e = {}) {
|
|
1827
1834
|
const { width: n, height: r } = Ja(a, e), i = yield ut(a, e, !0);
|
|
1828
1835
|
return yield qr(i, e), yield tn(i, e), function(o, s) {
|
|
@@ -1837,7 +1844,7 @@ function Wr(t) {
|
|
|
1837
1844
|
}
|
|
1838
1845
|
function Vr(t) {
|
|
1839
1846
|
return O(this, arguments, function* (a, e = {}) {
|
|
1840
|
-
const { width: n, height: r } = Ja(a, e), i = yield
|
|
1847
|
+
const { width: n, height: r } = Ja(a, e), i = yield Ur(a, e), o = yield lt(i), s = document.createElement("canvas"), l = s.getContext("2d"), c = e.pixelRatio || function() {
|
|
1841
1848
|
let u, b;
|
|
1842
1849
|
try {
|
|
1843
1850
|
b = process;
|
|
@@ -1851,7 +1858,7 @@ function Vr(t) {
|
|
|
1851
1858
|
}(s), s.style.width = `${h}`, s.style.height = `${d}`, e.backgroundColor && (l.fillStyle = e.backgroundColor, l.fillRect(0, 0, s.width, s.height)), l.drawImage(o, 0, 0, s.width, s.height), s;
|
|
1852
1859
|
});
|
|
1853
1860
|
}
|
|
1854
|
-
function
|
|
1861
|
+
function Wr(a) {
|
|
1855
1862
|
return O(this, null, function* () {
|
|
1856
1863
|
const e = document.documentElement.scrollHeight, t = document.documentElement.scrollWidth, n = Array.from(document.styleSheets).map((o) => {
|
|
1857
1864
|
try {
|
|
@@ -2032,7 +2039,7 @@ function ct(a, e) {
|
|
|
2032
2039
|
});
|
|
2033
2040
|
}
|
|
2034
2041
|
var ti = /^[^ \t\n\r\u000c]+/, ai = /^[, \t\n\r\u000c]+/;
|
|
2035
|
-
function
|
|
2042
|
+
function We(a, e) {
|
|
2036
2043
|
if (!e || e.trim() === "") return e;
|
|
2037
2044
|
var t = a.createElement("a");
|
|
2038
2045
|
return t.href = e, t.href;
|
|
@@ -2045,7 +2052,7 @@ function Dt() {
|
|
|
2045
2052
|
return a.href = "", a.href;
|
|
2046
2053
|
}
|
|
2047
2054
|
function ln(a, e, t, n) {
|
|
2048
|
-
return t === "src" || t === "href" && n && (e !== "use" || n[0] !== "#") || t === "xlink:href" && n && n[0] !== "#" ?
|
|
2055
|
+
return t === "src" || t === "href" && n && (e !== "use" || n[0] !== "#") || t === "xlink:href" && n && n[0] !== "#" ? We(a, n) : t !== "background" || !n || e !== "table" && e !== "td" && e !== "th" ? t === "srcset" && n ? function(r, i) {
|
|
2049
2056
|
if (i.trim() === "") return i;
|
|
2050
2057
|
var o = 0;
|
|
2051
2058
|
function s(b) {
|
|
@@ -2054,10 +2061,10 @@ function ln(a, e, t, n) {
|
|
|
2054
2061
|
}
|
|
2055
2062
|
for (var l = []; s(ai), !(o >= i.length); ) {
|
|
2056
2063
|
var c = s(ti);
|
|
2057
|
-
if (c.slice(-1) === ",") c =
|
|
2064
|
+
if (c.slice(-1) === ",") c = We(r, c.substring(0, c.length - 1)), l.push(c);
|
|
2058
2065
|
else {
|
|
2059
2066
|
var h = "";
|
|
2060
|
-
c =
|
|
2067
|
+
c = We(r, c);
|
|
2061
2068
|
for (var d = !1; ; ) {
|
|
2062
2069
|
var u = i.charAt(o);
|
|
2063
2070
|
if (u === "") {
|
|
@@ -2077,7 +2084,7 @@ function ln(a, e, t, n) {
|
|
|
2077
2084
|
}
|
|
2078
2085
|
}
|
|
2079
2086
|
return l.join(", ");
|
|
2080
|
-
}(a, n) : t === "style" && n ? ct(n, Dt()) : e === "object" && t === "data" && n ?
|
|
2087
|
+
}(a, n) : t === "style" && n ? ct(n, Dt()) : e === "object" && t === "data" && n ? We(a, n) : n : We(a, n);
|
|
2081
2088
|
}
|
|
2082
2089
|
function mt(a, e, t) {
|
|
2083
2090
|
if (!a) return !1;
|
|
@@ -2118,25 +2125,25 @@ function ri(a, e) {
|
|
|
2118
2125
|
if (ge.test(ze)) return !0;
|
|
2119
2126
|
}
|
|
2120
2127
|
return !!ke && ee.matches(ke);
|
|
2121
|
-
}(g, z, T),
|
|
2128
|
+
}(g, z, T), W = function(ee) {
|
|
2122
2129
|
if (ee instanceof HTMLFormElement) return "form";
|
|
2123
2130
|
var ge = ee.tagName.toLowerCase().trim();
|
|
2124
2131
|
return Qr.test(ge) ? "div" : ge;
|
|
2125
2132
|
}(g), _ = {}, x = g.attributes.length, H = 0; H < x; H++) {
|
|
2126
2133
|
var X = g.attributes[H];
|
|
2127
|
-
_[X.name] = ln(S,
|
|
2134
|
+
_[X.name] = ln(S, W, X.name, X.value);
|
|
2128
2135
|
}
|
|
2129
|
-
if (
|
|
2136
|
+
if (W === "link" && E) {
|
|
2130
2137
|
var J = Array.from(S.styleSheets).find(function(ee) {
|
|
2131
2138
|
return ee.href === g.href;
|
|
2132
2139
|
}), re = null;
|
|
2133
2140
|
J && (re = Ft(J)), re && (delete _.rel, delete _.href, _._cssText = ct(re, J.href));
|
|
2134
2141
|
}
|
|
2135
|
-
if (
|
|
2142
|
+
if (W === "style" && g.sheet && !(g.innerText || g.textContent || "").trim().length && (re = Ft(g.sheet)) && (_._cssText = ct(re, Dt())), W === "input" || W === "textarea" || W === "select") {
|
|
2136
2143
|
var L = g.value, y = g.checked;
|
|
2137
|
-
_.type !== "radio" && _.type !== "checkbox" && _.type !== "submit" && _.type !== "button" && L ? _.value = Qt({ type: _.type, tagName:
|
|
2144
|
+
_.type !== "radio" && _.type !== "checkbox" && _.type !== "submit" && _.type !== "button" && L ? _.value = Qt({ type: _.type, tagName: W, value: L, maskInputOptions: I, maskInputFn: j }) : y && (_.checked = y);
|
|
2138
2145
|
}
|
|
2139
|
-
if (
|
|
2146
|
+
if (W === "option" && (g.selected && !I.select ? _.selected = !0 : delete _.selected), W === "canvas" && F) {
|
|
2140
2147
|
if (g.__context === "2d") (function(ee) {
|
|
2141
2148
|
var ge = ee.getContext("2d");
|
|
2142
2149
|
if (!ge) return !0;
|
|
@@ -2153,7 +2160,7 @@ function ri(a, e) {
|
|
|
2153
2160
|
K.width = g.width, K.height = g.height, Z !== K.toDataURL(G.type, G.quality) && (_.rr_dataURL = Z);
|
|
2154
2161
|
}
|
|
2155
2162
|
}
|
|
2156
|
-
if (
|
|
2163
|
+
if (W === "img" && V) {
|
|
2157
2164
|
Oe || (Oe = S.createElement("canvas"), Ca = Oe.getContext("2d"));
|
|
2158
2165
|
var Q = g, P = Q.crossOrigin;
|
|
2159
2166
|
Q.crossOrigin = "anonymous";
|
|
@@ -2167,11 +2174,11 @@ function ri(a, e) {
|
|
|
2167
2174
|
};
|
|
2168
2175
|
Q.complete && Q.naturalWidth !== 0 ? ye() : Q.onload = ye;
|
|
2169
2176
|
}
|
|
2170
|
-
if (
|
|
2177
|
+
if (W !== "audio" && W !== "video" || (_.rr_mediaState = g.paused ? "paused" : "played", _.rr_mediaCurrentTime = g.currentTime), ce || (g.scrollLeft && (_.rr_scrollLeft = g.scrollLeft), g.scrollTop && (_.rr_scrollTop = g.scrollTop)), q) {
|
|
2171
2178
|
var Ae = g.getBoundingClientRect(), Ne = Ae.width, Je = Ae.height;
|
|
2172
2179
|
_ = { class: _.class, rr_width: "".concat(Ne, "px"), rr_height: "".concat(Je, "px") };
|
|
2173
2180
|
}
|
|
2174
|
-
return
|
|
2181
|
+
return W !== "iframe" || me(_.src) || (g.contentDocument || (_.rr_src = _.src), delete _.src), { type: ie.Element, tagName: W, attributes: _, childNodes: [], isSVG: ni(g) || void 0, needBlock: q, rootId: oe };
|
|
2175
2182
|
}(a, { doc: t, blockClass: r, blockSelector: i, inlineStylesheet: l, maskInputOptions: h, maskInputFn: u, dataURLOptions: f, inlineImages: R, recordCanvas: p, keepIframeSrcFn: m, newlyAddedElement: C, rootId: M });
|
|
2176
2183
|
case a.TEXT_NODE:
|
|
2177
2184
|
return function(g, A) {
|
|
@@ -2211,13 +2218,13 @@ function Be(a, e) {
|
|
|
2211
2218
|
var q = Object.assign(oe, { id: t });
|
|
2212
2219
|
if (r.add(a, q), t === -2) return null;
|
|
2213
2220
|
z && z(a);
|
|
2214
|
-
var
|
|
2221
|
+
var W = !h;
|
|
2215
2222
|
if (q.type === ie.Element) {
|
|
2216
|
-
|
|
2223
|
+
W = W && !q.needBlock, delete q.needBlock;
|
|
2217
2224
|
var _ = a.shadowRoot;
|
|
2218
2225
|
_ && Ye(_) && (q.isShadowHost = !0);
|
|
2219
2226
|
}
|
|
2220
|
-
if ((q.type === ie.Document || q.type === ie.Element) &&
|
|
2227
|
+
if ((q.type === ie.Document || q.type === ie.Element) && W) {
|
|
2221
2228
|
m.headWhitespace && q.type === ie.Element && q.tagName === "head" && (ce = !1);
|
|
2222
2229
|
for (var x = { doc: n, mirror: r, blockClass: i, blockSelector: o, maskTextClass: s, maskTextSelector: l, skipChild: h, inlineStylesheet: u, maskInputOptions: f, maskTextFn: R, maskInputFn: p, slimDOMOptions: m, dataURLOptions: C, inlineImages: g, recordCanvas: S, preserveWhiteSpace: ce, onSerialize: z, onIframeLoad: T, iframeLoadTimeout: w, onStylesheetLoad: I, stylesheetLoadTimeout: k, keepIframeSrcFn: V }, H = 0, X = Array.from(a.childNodes); H < X.length; H++)
|
|
2223
2230
|
(L = Be(X[H], x)) && q.childNodes.push(L);
|
|
@@ -2384,7 +2391,7 @@ class ii {
|
|
|
2384
2391
|
return this.id++;
|
|
2385
2392
|
}
|
|
2386
2393
|
}
|
|
2387
|
-
var
|
|
2394
|
+
var U = ((a) => (a[a.DomContentLoaded = 0] = "DomContentLoaded", a[a.Load = 1] = "Load", a[a.FullSnapshot = 2] = "FullSnapshot", a[a.IncrementalSnapshot = 3] = "IncrementalSnapshot", a[a.Meta = 4] = "Meta", a[a.Custom = 5] = "Custom", a[a.Plugin = 6] = "Plugin", a))(U || {}), B = ((a) => (a[a.Mutation = 0] = "Mutation", a[a.MouseMove = 1] = "MouseMove", a[a.MouseInteraction = 2] = "MouseInteraction", a[a.Scroll = 3] = "Scroll", a[a.ViewportResize = 4] = "ViewportResize", a[a.Input = 5] = "Input", a[a.TouchMove = 6] = "TouchMove", a[a.MediaInteraction = 7] = "MediaInteraction", a[a.StyleSheetRule = 8] = "StyleSheetRule", a[a.CanvasMutation = 9] = "CanvasMutation", a[a.Font = 10] = "Font", a[a.Log = 11] = "Log", a[a.Drag = 12] = "Drag", a[a.StyleDeclaration = 13] = "StyleDeclaration", a[a.Selection = 14] = "Selection", a[a.AdoptedStyleSheet = 15] = "AdoptedStyleSheet", a))(B || {}), Bt = ((a) => (a[a.MouseUp = 0] = "MouseUp", a[a.MouseDown = 1] = "MouseDown", a[a.Click = 2] = "Click", a[a.ContextMenu = 3] = "ContextMenu", a[a.DblClick = 4] = "DblClick", a[a.Focus = 5] = "Focus", a[a.Blur = 6] = "Blur", a[a.TouchStart = 7] = "TouchStart", a[a.TouchMove_Departed = 8] = "TouchMove_Departed", a[a.TouchEnd = 9] = "TouchEnd", a[a.TouchCancel = 10] = "TouchCancel", a))(Bt || {}), De = ((a) => (a[a["2D"] = 0] = "2D", a[a.WebGL = 1] = "WebGL", a[a.WebGL2 = 2] = "WebGL2", a))(De || {});
|
|
2388
2395
|
function Aa(a) {
|
|
2389
2396
|
return "__ln" in a;
|
|
2390
2397
|
}
|
|
@@ -2729,8 +2736,8 @@ function hi(a, e = {}) {
|
|
|
2729
2736
|
let ce = F.value, oe = !1;
|
|
2730
2737
|
ne === "radio" || ne === "checkbox" ? oe = F.checked : (A[F.tagName.toLowerCase()] || A[ne]) && (ce = Qt({ maskInputOptions: A, tagName: F.tagName, type: ne, value: ce, maskInputFn: S })), w(F, Ta({ text: ce, isChecked: oe, userTriggered: me }, T));
|
|
2731
2738
|
const q = F.name;
|
|
2732
|
-
ne === "radio" && q && oe && m.querySelectorAll(`input[type="radio"][name="${q}"]`).forEach((
|
|
2733
|
-
|
|
2739
|
+
ne === "radio" && q && oe && m.querySelectorAll(`input[type="radio"][name="${q}"]`).forEach((W) => {
|
|
2740
|
+
W !== F && w(W, Ta({ text: W.value, isChecked: !oe, userTriggered: !1 }, T));
|
|
2734
2741
|
});
|
|
2735
2742
|
}
|
|
2736
2743
|
function w(V, F) {
|
|
@@ -2916,17 +2923,17 @@ class di {
|
|
|
2916
2923
|
transformCrossOriginEvent(e, t) {
|
|
2917
2924
|
var n;
|
|
2918
2925
|
switch (t.type) {
|
|
2919
|
-
case
|
|
2920
|
-
return this.crossOriginIframeMirror.reset(e), this.crossOriginIframeStyleMirror.reset(e), this.replaceIdOnNode(t.data.node, e), { timestamp: t.timestamp, type:
|
|
2921
|
-
case
|
|
2922
|
-
case
|
|
2923
|
-
case
|
|
2926
|
+
case U.FullSnapshot:
|
|
2927
|
+
return this.crossOriginIframeMirror.reset(e), this.crossOriginIframeStyleMirror.reset(e), this.replaceIdOnNode(t.data.node, e), { timestamp: t.timestamp, type: U.IncrementalSnapshot, data: { source: B.Mutation, adds: [{ parentId: this.mirror.getId(e), nextId: null, node: t.data.node }], removes: [], texts: [], attributes: [], isAttachIframe: !0 } };
|
|
2928
|
+
case U.Meta:
|
|
2929
|
+
case U.Load:
|
|
2930
|
+
case U.DomContentLoaded:
|
|
2924
2931
|
return !1;
|
|
2925
|
-
case
|
|
2932
|
+
case U.Plugin:
|
|
2926
2933
|
return t;
|
|
2927
|
-
case
|
|
2934
|
+
case U.Custom:
|
|
2928
2935
|
return this.replaceIds(t.data.payload, e, ["id", "parentId", "previousId", "nextId"]), t;
|
|
2929
|
-
case
|
|
2936
|
+
case U.IncrementalSnapshot:
|
|
2930
2937
|
switch (t.data.source) {
|
|
2931
2938
|
case B.Mutation:
|
|
2932
2939
|
return t.data.adds.forEach((r) => {
|
|
@@ -3339,13 +3346,13 @@ function Ce(a = {}) {
|
|
|
3339
3346
|
};
|
|
3340
3347
|
$ = (x, H) => {
|
|
3341
3348
|
var X;
|
|
3342
|
-
if (!(!((X = xe[0]) === null || X === void 0) && X.isFrozen()) || x.type ===
|
|
3349
|
+
if (!(!((X = xe[0]) === null || X === void 0) && X.isFrozen()) || x.type === U.FullSnapshot || x.type === U.IncrementalSnapshot && x.data.source === B.Mutation || xe.forEach((J) => J.unfreeze()), I) e == null || e(me(x), H);
|
|
3343
3350
|
else if (j) {
|
|
3344
3351
|
const J = { type: "rrweb", event: me(x), isCheckout: H };
|
|
3345
3352
|
window.parent.postMessage(J, "*");
|
|
3346
3353
|
}
|
|
3347
|
-
if (x.type ===
|
|
3348
|
-
else if (x.type ===
|
|
3354
|
+
if (x.type === U.FullSnapshot) V = x, F = 0;
|
|
3355
|
+
else if (x.type === U.IncrementalSnapshot) {
|
|
3349
3356
|
if (x.data.source === B.Mutation && x.data.isAttachIframe) return;
|
|
3350
3357
|
F++;
|
|
3351
3358
|
const J = n && F >= n, re = t && x.timestamp - V.timestamp > t;
|
|
@@ -3353,48 +3360,48 @@ function Ce(a = {}) {
|
|
|
3353
3360
|
}
|
|
3354
3361
|
};
|
|
3355
3362
|
const ne = (x) => {
|
|
3356
|
-
$(ae({ type:
|
|
3357
|
-
}, ce = (x) => $(ae({ type:
|
|
3358
|
-
for (const x of T || []) x.getMirror && x.getMirror({ nodeMirror: be, crossOriginIframeMirror:
|
|
3363
|
+
$(ae({ type: U.IncrementalSnapshot, data: Object.assign({ source: B.Mutation }, x) }));
|
|
3364
|
+
}, ce = (x) => $(ae({ type: U.IncrementalSnapshot, data: Object.assign({ source: B.Scroll }, x) })), oe = (x) => $(ae({ type: U.IncrementalSnapshot, data: Object.assign({ source: B.CanvasMutation }, x) })), q = new vi({ mutationCb: ne, adoptedStyleSheetCb: (x) => $(ae({ type: U.IncrementalSnapshot, data: Object.assign({ source: B.AdoptedStyleSheet }, x) })) }), W = new di({ mirror: be, mutationCb: ne, stylesheetManager: q, recordCrossOriginIframes: g, wrappedEmit: $ });
|
|
3365
|
+
for (const x of T || []) x.getMirror && x.getMirror({ nodeMirror: be, crossOriginIframeMirror: W.crossOriginIframeMirror, crossOriginIframeStyleMirror: W.crossOriginIframeStyleMirror });
|
|
3359
3366
|
Et = new wi({ recordCanvas: M, mutationCb: oe, win: window, blockClass: r, blockSelector: i, mirror: be, sampling: m.canvas, dataURLOptions: v });
|
|
3360
|
-
const _ = new ui({ mutationCb: ne, scrollCb: ce, bypassOptions: { blockClass: r, blockSelector: i, maskTextClass: s, maskTextSelector: l, inlineStylesheet: c, maskInputOptions: k, dataURLOptions: v, maskTextFn: f, maskInputFn: b, recordCanvas: M, inlineImages: z, sampling: m, slimDOMOptions: G, iframeManager:
|
|
3367
|
+
const _ = new ui({ mutationCb: ne, scrollCb: ce, bypassOptions: { blockClass: r, blockSelector: i, maskTextClass: s, maskTextSelector: l, inlineStylesheet: c, maskInputOptions: k, dataURLOptions: v, maskTextFn: f, maskInputFn: b, recordCanvas: M, inlineImages: z, sampling: m, slimDOMOptions: G, iframeManager: W, stylesheetManager: q, canvasManager: Et, keepIframeSrcFn: E }, mirror: be });
|
|
3361
3368
|
dt = (x = !1) => {
|
|
3362
3369
|
var H, X, J, re, L, y;
|
|
3363
|
-
$(ae({ type:
|
|
3370
|
+
$(ae({ type: U.Meta, data: { href: window.location.href, width: dn(), height: hn() } }), x), q.reset(), xe.forEach((K) => K.lock());
|
|
3364
3371
|
const Z = function(K, Q) {
|
|
3365
|
-
var P = Q || {}, ye = P.mirror, Ae = ye === void 0 ? new on() : ye, Ne = P.blockClass, Je = Ne === void 0 ? "rr-block" : Ne, ee = P.blockSelector, ge = ee === void 0 ? null : ee, ke = P.maskTextClass, Ie = ke === void 0 ? "rr-mask" : ke, ze = P.maskTextSelector, ft = ze === void 0 ? null : ze, Qe = P.inlineStylesheet, On = Qe === void 0 || Qe, Xt = P.inlineImages, _n = Xt !== void 0 && Xt, $t = P.recordCanvas, Ln = $t !== void 0 && $t, ea = P.maskAllInputs, kt = ea !== void 0 && ea, Fn = P.maskTextFn, Dn = P.maskInputFn, ta = P.slimDOM, qe = ta !== void 0 && ta, Bn = P.dataURLOptions, qn = P.preserveWhiteSpace,
|
|
3366
|
-
return Be(K, { doc: K, mirror: Ae, blockClass: Je, blockSelector: ge, maskTextClass: Ie, maskTextSelector: ft, skipChild: !1, inlineStylesheet: On, maskInputOptions: kt === !0 ? { color: !0, date: !0, "datetime-local": !0, email: !0, month: !0, number: !0, range: !0, search: !0, tel: !0, text: !0, time: !0, url: !0, week: !0, textarea: !0, select: !0, password: !0 } : kt === !1 ? { password: !0 } : kt, maskTextFn: Fn, maskInputFn: Dn, slimDOMOptions: qe === !0 || qe === "all" ? { script: !0, comment: !0, headFavicon: !0, headWhitespace: !0, headMetaDescKeywords: qe === "all", headMetaSocial: !0, headMetaRobots: !0, headMetaHttpEquiv: !0, headMetaAuthorship: !0, headMetaVerification: !0 } : qe === !1 ? {} : qe, dataURLOptions: Bn, inlineImages: _n, recordCanvas: Ln, preserveWhiteSpace: qn, onSerialize:
|
|
3372
|
+
var P = Q || {}, ye = P.mirror, Ae = ye === void 0 ? new on() : ye, Ne = P.blockClass, Je = Ne === void 0 ? "rr-block" : Ne, ee = P.blockSelector, ge = ee === void 0 ? null : ee, ke = P.maskTextClass, Ie = ke === void 0 ? "rr-mask" : ke, ze = P.maskTextSelector, ft = ze === void 0 ? null : ze, Qe = P.inlineStylesheet, On = Qe === void 0 || Qe, Xt = P.inlineImages, _n = Xt !== void 0 && Xt, $t = P.recordCanvas, Ln = $t !== void 0 && $t, ea = P.maskAllInputs, kt = ea !== void 0 && ea, Fn = P.maskTextFn, Dn = P.maskInputFn, ta = P.slimDOM, qe = ta !== void 0 && ta, Bn = P.dataURLOptions, qn = P.preserveWhiteSpace, Un = P.onSerialize, Vn = P.onIframeLoad, Wn = P.iframeLoadTimeout, Pn = P.onStylesheetLoad, Gn = P.stylesheetLoadTimeout, aa = P.keepIframeSrcFn;
|
|
3373
|
+
return Be(K, { doc: K, mirror: Ae, blockClass: Je, blockSelector: ge, maskTextClass: Ie, maskTextSelector: ft, skipChild: !1, inlineStylesheet: On, maskInputOptions: kt === !0 ? { color: !0, date: !0, "datetime-local": !0, email: !0, month: !0, number: !0, range: !0, search: !0, tel: !0, text: !0, time: !0, url: !0, week: !0, textarea: !0, select: !0, password: !0 } : kt === !1 ? { password: !0 } : kt, maskTextFn: Fn, maskInputFn: Dn, slimDOMOptions: qe === !0 || qe === "all" ? { script: !0, comment: !0, headFavicon: !0, headWhitespace: !0, headMetaDescKeywords: qe === "all", headMetaSocial: !0, headMetaRobots: !0, headMetaHttpEquiv: !0, headMetaAuthorship: !0, headMetaVerification: !0 } : qe === !1 ? {} : qe, dataURLOptions: Bn, inlineImages: _n, recordCanvas: Ln, preserveWhiteSpace: qn, onSerialize: Un, onIframeLoad: Vn, iframeLoadTimeout: Wn, onStylesheetLoad: Pn, stylesheetLoadTimeout: Gn, keepIframeSrcFn: aa === void 0 ? function() {
|
|
3367
3374
|
return !1;
|
|
3368
3375
|
} : aa, newlyAddedElement: !1 });
|
|
3369
3376
|
}(document, { mirror: be, blockClass: r, blockSelector: i, maskTextClass: s, maskTextSelector: l, inlineStylesheet: c, maskAllInputs: k, maskTextFn: f, slimDOM: G, dataURLOptions: v, recordCanvas: M, inlineImages: z, onSerialize: (K) => {
|
|
3370
|
-
gn(K, be) &&
|
|
3377
|
+
gn(K, be) && W.addIframe(K), pn(K, be) && q.trackLinkElement(K), yn(K) && _.addShadowRoot(K.shadowRoot, document);
|
|
3371
3378
|
}, onIframeLoad: (K, Q) => {
|
|
3372
|
-
|
|
3379
|
+
W.attachIframe(K, Q), _.observeAttachShadow(K);
|
|
3373
3380
|
}, onStylesheetLoad: (K, Q) => {
|
|
3374
3381
|
q.attachLinkElement(K, Q);
|
|
3375
3382
|
}, keepIframeSrcFn: E });
|
|
3376
3383
|
if (!Z) return console.warn("Failed to snapshot the document");
|
|
3377
|
-
$(ae({ type:
|
|
3384
|
+
$(ae({ type: U.FullSnapshot, data: { node: Z, initialOffset: { left: window.pageXOffset !== void 0 ? window.pageXOffset : (document == null ? void 0 : document.documentElement.scrollLeft) || ((X = (H = document == null ? void 0 : document.body) === null || H === void 0 ? void 0 : H.parentElement) === null || X === void 0 ? void 0 : X.scrollLeft) || ((J = document == null ? void 0 : document.body) === null || J === void 0 ? void 0 : J.scrollLeft) || 0, top: window.pageYOffset !== void 0 ? window.pageYOffset : (document == null ? void 0 : document.documentElement.scrollTop) || ((L = (re = document == null ? void 0 : document.body) === null || re === void 0 ? void 0 : re.parentElement) === null || L === void 0 ? void 0 : L.scrollTop) || ((y = document == null ? void 0 : document.body) === null || y === void 0 ? void 0 : y.scrollTop) || 0 } } })), xe.forEach((K) => K.unlock()), document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0 && q.adoptStyleSheets(document.adoptedStyleSheets, be.getId(document));
|
|
3378
3385
|
};
|
|
3379
3386
|
try {
|
|
3380
3387
|
const x = [];
|
|
3381
3388
|
x.push(se("DOMContentLoaded", () => {
|
|
3382
|
-
$(ae({ type:
|
|
3389
|
+
$(ae({ type: U.DomContentLoaded, data: {} }));
|
|
3383
3390
|
}));
|
|
3384
3391
|
const H = (J) => {
|
|
3385
3392
|
var re;
|
|
3386
|
-
return hi({ mutationCb: ne, mousemoveCb: (L, y) => $(ae({ type:
|
|
3387
|
-
$(ae({ type:
|
|
3388
|
-
}, blockClass: r, ignoreClass: o, maskTextClass: s, maskTextSelector: l, maskInputOptions: k, inlineStylesheet: c, sampling: m, recordCanvas: M, inlineImages: z, userTriggeredOnInput: A, collectFonts: S, doc: J, maskInputFn: b, maskTextFn: f, keepIframeSrcFn: E, blockSelector: i, slimDOMOptions: G, dataURLOptions: v, mirror: be, iframeManager:
|
|
3393
|
+
return hi({ mutationCb: ne, mousemoveCb: (L, y) => $(ae({ type: U.IncrementalSnapshot, data: { source: y, positions: L } })), mouseInteractionCb: (L) => $(ae({ type: U.IncrementalSnapshot, data: Object.assign({ source: B.MouseInteraction }, L) })), scrollCb: ce, viewportResizeCb: (L) => $(ae({ type: U.IncrementalSnapshot, data: Object.assign({ source: B.ViewportResize }, L) })), inputCb: (L) => $(ae({ type: U.IncrementalSnapshot, data: Object.assign({ source: B.Input }, L) })), mediaInteractionCb: (L) => $(ae({ type: U.IncrementalSnapshot, data: Object.assign({ source: B.MediaInteraction }, L) })), styleSheetRuleCb: (L) => $(ae({ type: U.IncrementalSnapshot, data: Object.assign({ source: B.StyleSheetRule }, L) })), styleDeclarationCb: (L) => $(ae({ type: U.IncrementalSnapshot, data: Object.assign({ source: B.StyleDeclaration }, L) })), canvasMutationCb: oe, fontCb: (L) => $(ae({ type: U.IncrementalSnapshot, data: Object.assign({ source: B.Font }, L) })), selectionCb: (L) => {
|
|
3394
|
+
$(ae({ type: U.IncrementalSnapshot, data: Object.assign({ source: B.Selection }, L) }));
|
|
3395
|
+
}, blockClass: r, ignoreClass: o, maskTextClass: s, maskTextSelector: l, maskInputOptions: k, inlineStylesheet: c, sampling: m, recordCanvas: M, inlineImages: z, userTriggeredOnInput: A, collectFonts: S, doc: J, maskInputFn: b, maskTextFn: f, keepIframeSrcFn: E, blockSelector: i, slimDOMOptions: G, dataURLOptions: v, mirror: be, iframeManager: W, stylesheetManager: q, shadowDomManager: _, canvasManager: Et, ignoreCSSAttributes: w, plugins: ((re = T == null ? void 0 : T.filter((L) => L.observer)) === null || re === void 0 ? void 0 : re.map((L) => ({ observer: L.observer, options: L.options, callback: (y) => $(ae({ type: U.Plugin, data: { plugin: L.name, payload: y } })) }))) || [] }, R);
|
|
3389
3396
|
};
|
|
3390
|
-
|
|
3397
|
+
W.addLoadListener((J) => {
|
|
3391
3398
|
x.push(H(J.contentDocument));
|
|
3392
3399
|
});
|
|
3393
3400
|
const X = () => {
|
|
3394
3401
|
dt(), x.push(H(document)), gt = !0;
|
|
3395
3402
|
};
|
|
3396
3403
|
return document.readyState === "interactive" || document.readyState === "complete" ? X() : x.push(se("load", () => {
|
|
3397
|
-
$(ae({ type:
|
|
3404
|
+
$(ae({ type: U.Load, data: {} })), X();
|
|
3398
3405
|
}, window)), () => {
|
|
3399
3406
|
x.forEach((J) => J()), gt = !1;
|
|
3400
3407
|
};
|
|
@@ -3404,7 +3411,7 @@ function Ce(a = {}) {
|
|
|
3404
3411
|
}
|
|
3405
3412
|
Ce.addCustomEvent = (a, e) => {
|
|
3406
3413
|
if (!gt) throw new Error("please add custom event after start recording");
|
|
3407
|
-
$(ae({ type:
|
|
3414
|
+
$(ae({ type: U.Custom, data: { tag: a, payload: e } }));
|
|
3408
3415
|
}, Ce.freezePage = () => {
|
|
3409
3416
|
xe.forEach((a) => a.freeze());
|
|
3410
3417
|
}, Ce.takeFullSnapshot = (a) => {
|
|
@@ -3500,13 +3507,13 @@ function Si(a) {
|
|
|
3500
3507
|
}
|
|
3501
3508
|
return e;
|
|
3502
3509
|
}
|
|
3503
|
-
function
|
|
3510
|
+
function Ut(a) {
|
|
3504
3511
|
return Object.prototype.toString.call(a) === "[object Object]";
|
|
3505
3512
|
}
|
|
3506
3513
|
function xn(a, e) {
|
|
3507
3514
|
if (e === 0) return !0;
|
|
3508
3515
|
const t = Object.keys(a);
|
|
3509
|
-
for (const n of t) if (
|
|
3516
|
+
for (const n of t) if (Ut(a[n]) && xn(a[n], e - 1)) return !0;
|
|
3510
3517
|
return !1;
|
|
3511
3518
|
}
|
|
3512
3519
|
function Tt(a, e) {
|
|
@@ -3521,7 +3528,7 @@ function Tt(a, e) {
|
|
|
3521
3528
|
if (o === null) return o;
|
|
3522
3529
|
if (o === void 0) return "undefined";
|
|
3523
3530
|
if (function(s) {
|
|
3524
|
-
return !!(
|
|
3531
|
+
return !!(Ut(s) && Object.keys(s).length > t.numOfKeysLimit || typeof s == "function" || Ut(s) && xn(s, t.depthOfLimit));
|
|
3525
3532
|
}(o)) return function(s) {
|
|
3526
3533
|
let l = s.toString();
|
|
3527
3534
|
return t.stringLengthLimit && l.length > t.stringLengthLimit && (l = `${l.slice(0, t.stringLengthLimit)}...`), l;
|
|
@@ -3773,15 +3780,15 @@ const Te = class Te {
|
|
|
3773
3780
|
}
|
|
3774
3781
|
};
|
|
3775
3782
|
N(Te, "instance");
|
|
3776
|
-
let
|
|
3777
|
-
const Mi = "0.0.7-alpha.
|
|
3783
|
+
let Wt = Te;
|
|
3784
|
+
const Mi = "0.0.7-alpha.6";
|
|
3778
3785
|
class Mn extends Er {
|
|
3779
3786
|
constructor(t) {
|
|
3780
3787
|
super(de({ sdk: "web", sdkVersion: Mi }, t));
|
|
3781
3788
|
N(this, "lastPath", "");
|
|
3782
3789
|
N(this, "debounceTimer", null);
|
|
3783
3790
|
N(this, "agent");
|
|
3784
|
-
N(this, "sessionManager",
|
|
3791
|
+
N(this, "sessionManager", Wt.getInstance());
|
|
3785
3792
|
this.options = t, this.agent = new Ni(), this.isServer() || (this.setGlobalProperties({ __referrer: document.referrer }), this.options.trackOutgoingLinks && this.trackOutgoingLinks(), this.options.trackScreenViews && this.trackScreenViews(), this.options.trackAttributes && this.trackAttributes(), this.options.enableRecording && typeof window != "undefined" && window.location.hostname === "localhost" && this.startRecording());
|
|
3786
3793
|
}
|
|
3787
3794
|
debounce(t, n) {
|
|
@@ -3850,7 +3857,7 @@ class Mn extends Er {
|
|
|
3850
3857
|
document.readyState === "complete" ? c(null) : window.addEventListener("load", c);
|
|
3851
3858
|
});
|
|
3852
3859
|
const l = document.body.cloneNode(!0);
|
|
3853
|
-
return Hr(l), yield
|
|
3860
|
+
return Hr(l), yield Wr(l);
|
|
3854
3861
|
} catch (l) {
|
|
3855
3862
|
console.error("An error occurred:", l);
|
|
3856
3863
|
}
|
package/dist/index.js.gz
CHANGED
|
Binary file
|