@jumio/websdk 0.4.0 → 0.6.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/assets/icons/add.svg +3 -0
- package/assets/icons/bra-id.svg +4 -0
- package/assets/icons/camera-number-placeholder.svg +3 -0
- package/assets/icons/camera-video.svg +4 -0
- package/assets/icons/check.svg +3 -0
- package/assets/icons/chevron-direction-down.svg +3 -0
- package/assets/icons/chevron-direction-left.svg +3 -0
- package/assets/icons/chevron-direction-right.svg +3 -0
- package/assets/icons/close.svg +3 -0
- package/assets/icons/collapse.svg +3 -0
- package/assets/icons/delete.svg +3 -0
- package/assets/icons/device.svg +3 -0
- package/assets/icons/digital-id.svg +4 -0
- package/assets/icons/download.svg +3 -0
- package/assets/icons/exclamation-mark.svg +3 -0
- package/assets/icons/expand.svg +3 -0
- package/assets/icons/external.svg +3 -0
- package/assets/icons/globe.svg +3 -0
- package/assets/icons/help.svg +3 -0
- package/assets/icons/ic-method-camera.svg +4 -0
- package/assets/icons/id-back.svg +3 -0
- package/assets/icons/id-digital.svg +4 -0
- package/assets/icons/id-document.svg +3 -0
- package/assets/icons/id-drivers-license.svg +3 -0
- package/assets/icons/id-front.svg +3 -0
- package/assets/icons/id-passport.svg +9 -0
- package/assets/icons/id-work-visa.svg +4 -0
- package/assets/icons/jumio.svg +4 -0
- package/assets/icons/schedule.svg +3 -0
- package/assets/icons/shield.svg +3 -0
- package/assets/icons/upload-method.svg +3 -0
- package/assets/icons/upload.svg +3 -0
- package/assets/icons/visibility-off.svg +3 -0
- package/assets/icons/visibility.svg +3 -0
- package/assets/ml/assets_da_web_id.tar.gz +0 -0
- package/assets/ml/assets_da_web_liveness.tar.gz +0 -0
- package/assets/ml/dac.wasm +0 -0
- package/assets/ml/dac_simd.wasm +0 -0
- package/assets/style.css +1 -1
- package/index.html +1 -3
- package/index.js +1 -1
- package/index2.d.ts +1053 -130
- package/index2.js +861 -843
- package/js/assets_da_web_id_1_1_6.tar.B0wlC5WP.js +5 -0
- package/js/assets_da_web_liveness_1_1_6.tar.BMW6psZZ.js +5 -0
- package/js/dd/datadogProfiler-P8U8zq4E.js +408 -0
- package/js/dd/datadogRecorder-DZ9J4YQm.js +1218 -0
- package/js/i18n/{ar.DkrHFf0z.js → ar.CJ5f0MbK.js} +11 -3
- package/js/i18n/{az.BSkQXnwx.js → az.DDh3x_FF.js} +11 -3
- package/js/i18n/{bg.x6rcaPaK.js → bg.BUrg34tD.js} +11 -3
- package/js/i18n/{bn.DGFK9qJh.js → bn.C9Cvu33l.js} +11 -3
- package/js/i18n/{ca.mdNlHU-j.js → ca.BN8pRbii.js} +11 -3
- package/js/i18n/{ceb.BhF6mxA1.js → ceb.D1GAcQG1.js} +11 -3
- package/js/i18n/{cs.DCAPAQob.js → cs.DqM7YsXT.js} +11 -3
- package/js/i18n/{da.Bk_Vdzce.js → da.Bb_asJdt.js} +11 -3
- package/js/i18n/{de.Bpox16Tb.js → de.pMzo4HpF.js} +11 -3
- package/js/i18n/{el.DYnJoGSo.js → el.vsvsn980.js} +11 -3
- package/js/i18n/{en.Cdq06XXI.js → en.CpGcRLUP.js} +12 -4
- package/js/i18n/{en_GB.D6Y3GVH3.js → en_GB.CuRoI-ag.js} +12 -4
- package/js/i18n/{es.DfLJlARH.js → es.C45KgGLF.js} +11 -3
- package/js/i18n/{es_MX.DHwOkPFx.js → es_MX.BXsMZlGL.js} +11 -3
- package/js/i18n/{et.tVyYfTGa.js → et.CW7A5O5g.js} +11 -3
- package/js/i18n/{fi.CUb9um3q.js → fi.CkcFeDYr.js} +11 -3
- package/js/i18n/{fil.Bz5mS-t3.js → fil.C44c-WvM.js} +11 -3
- package/js/i18n/{fr.BDS-SRLF.js → fr.DrHWHQSB.js} +11 -3
- package/js/i18n/{fr_CA.BaMhXjza.js → fr_CA.BrRknP4P.js} +11 -3
- package/js/i18n/{ga.Cz17Jrc0.js → ga.CXCo-gow.js} +11 -3
- package/js/i18n/{he.Vk5TYTE0.js → he.w55E5DbW.js} +11 -3
- package/js/i18n/{hi.Bfjbt1hl.js → hi.CFryETDm.js} +11 -3
- package/js/i18n/{hr.CgRnuGgn.js → hr.Bkon4j6k.js} +11 -3
- package/js/i18n/{hu.rj4FulFy.js → hu.DvJpJWLH.js} +11 -3
- package/js/i18n/{hy.rK2i4OKY.js → hy.D4MCccPX.js} +11 -3
- package/js/i18n/{id.1174iI3U.js → id.O49txROs.js} +11 -3
- package/js/i18n/{is.BStEjEbG.js → is.4-D8oYt4.js} +11 -3
- package/js/i18n/{it.ByzrS6GF.js → it.CoOeyRd7.js} +11 -3
- package/js/i18n/{ja.PP3gCv3l.js → ja.C3o8YGyb.js} +11 -3
- package/js/i18n/{jv.CzzgZPMq.js → jv.C5eKltSo.js} +11 -3
- package/js/i18n/{ka_GE.DAYqZQqk.js → ka_GE.B7jUBJSI.js} +11 -3
- package/js/i18n/{kk.8BoMixSA.js → kk.DaYPv7kS.js} +11 -3
- package/js/i18n/{km_KH.l8EDtWHo.js → km_KH.BFWTDYTj.js} +11 -3
- package/js/i18n/{ko.D0qgK5UW.js → ko.CDCmsS7K.js} +11 -3
- package/js/i18n/{lt.Twbcs4Em.js → lt.cWqB7TbU.js} +11 -3
- package/js/i18n/{lv.D7ezMwVc.js → lv.Tr0qUXv8.js} +15 -7
- package/js/i18n/{ms.CJZG8Ll1.js → ms.CwDHHUnC.js} +11 -3
- package/js/i18n/{my.DQjNSwr3.js → my.DgCbecbm.js} +11 -3
- package/js/i18n/{nl.B6sQUXuN.js → nl.rwprkZNn.js} +11 -3
- package/js/i18n/{no.B55mMOOq.js → no.Cq7NZb45.js} +11 -3
- package/js/i18n/{pl.B2put9DP.js → pl.DRHC-qD2.js} +11 -3
- package/js/i18n/{pt.B7PxU_IO.js → pt.pdIrMleR.js} +15 -7
- package/js/i18n/{pt_BR.BKqqa1pH.js → pt_BR.B7E_lBYV.js} +11 -3
- package/js/i18n/{ro.N89dgSUQ.js → ro.TwikY-Eu.js} +11 -3
- package/js/i18n/{ru.1PNbIwxj.js → ru.C57ucjDU.js} +11 -3
- package/js/i18n/{sk.B411Twgh.js → sk.BF80m0zE.js} +11 -3
- package/js/i18n/{sl.BPBaO-Zp.js → sl.DCrKLmRM.js} +11 -3
- package/js/i18n/{sq.Cq5lOBqt.js → sq.BPNNJ-V0.js} +11 -3
- package/js/i18n/{sr_Cyrl.9BeOe20j.js → sr_Cyrl.C2n9ECio.js} +11 -3
- package/js/i18n/{sr_Latn.C2U3IPYN.js → sr_Latn.Css4vgq8.js} +11 -3
- package/js/i18n/{sv.l5wQhwi_.js → sv.DoJqy2ZF.js} +11 -3
- package/js/i18n/{sw.CsifT5Cq.js → sw.C2Vc-khP.js} +11 -3
- package/js/i18n/{th.BP234sbB.js → th.D3IdUlLq.js} +11 -3
- package/js/i18n/{tr.CInDz9Jd.js → tr.BsXleD8A.js} +11 -3
- package/js/i18n/{uk.hNjFGYJm.js → uk.Dt-xSQPx.js} +11 -3
- package/js/i18n/{ur.D60gDBWS.js → ur.dXgVPzpk.js} +11 -3
- package/js/i18n/{uz.Cx7fveDe.js → uz.DoIJtzOq.js} +11 -3
- package/js/i18n/{vi.2DYOwV8T.js → vi.BeiSxuGI.js} +11 -3
- package/js/i18n/{zh_CN.Cj8T_5mA.js → zh_CN.C6x4ojAS.js} +11 -3
- package/js/i18n/{zh_HK.CUqb_GDk.js → zh_HK.BFHGwm_b.js} +11 -3
- package/js/{index.BI4tfquX.js → index.DD1XWd33.js} +28050 -26846
- package/package.json +12 -4
- package/third-party-licenses.txt +45 -25
- package/assets/ml/assets_da_web.tar.gz +0 -0
- package/js/assets_da_web_1_1_6.tar.DJoLQbzK.js +0 -5
- package/js/dd/profiler-BFqIgQQx.js +0 -235
- package/js/dd/startRecording-DtvE5Wi2.js +0 -1494
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
import { j as H, o as re, c as le, a as ce, b as de, g as ue, D as pe, d as fe, e as me, f as R, L as _, R as j, h as ve, i as I, S as V, V as w, k as z, l as _e, m as T, s as Y, n as be, p as F, q as b, r as B, t as x, u as ye, v as Ee, w as C, x as L, y as he, z as Te, A as Ie } from "../index.DD1XWd33.js";
|
|
2
|
+
function ke(s, t, e, n) {
|
|
3
|
+
const l = (d) => {
|
|
4
|
+
t.notify(14, { error: d }), de("Error reported to customer", { "error.message": d.message });
|
|
5
|
+
}, c = le([ce(s, "profile")], l), a = e(n);
|
|
6
|
+
return { async send({ event: d, ...m }) {
|
|
7
|
+
const u = new FormData(), p = H(d);
|
|
8
|
+
if (!p) throw new Error("Failed to serialize event");
|
|
9
|
+
u.append("event", new Blob([p], { type: "application/json" }), "event.json");
|
|
10
|
+
let k = p.length;
|
|
11
|
+
for (const [g, o] of re(m)) {
|
|
12
|
+
const y = H(o);
|
|
13
|
+
if (!y) throw new Error("Failed to serialize attachment");
|
|
14
|
+
const E = await ge(a, y);
|
|
15
|
+
k += E.outputBytesCount, u.append(g, new Blob([E.output]), g);
|
|
16
|
+
}
|
|
17
|
+
c.send({
|
|
18
|
+
data: u,
|
|
19
|
+
bytesCount: k
|
|
20
|
+
});
|
|
21
|
+
} };
|
|
22
|
+
}
|
|
23
|
+
function ge(s, t) {
|
|
24
|
+
return new Promise((e) => {
|
|
25
|
+
s.write(t), s.finish((n) => {
|
|
26
|
+
e(n);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function De() {
|
|
31
|
+
const s = ue();
|
|
32
|
+
return (t) => {
|
|
33
|
+
s.send("profile", t);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function Ae(s, t, e) {
|
|
37
|
+
const n = ke(s, t, e, pe.PROFILING);
|
|
38
|
+
return ({ profile: l, trace: c }) => {
|
|
39
|
+
const a = {
|
|
40
|
+
event: l,
|
|
41
|
+
"wall-time.json": c
|
|
42
|
+
};
|
|
43
|
+
n.send(a);
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const Se = /\/(?![vV]\d{1,2}\/)([^/\d?]*\d+[^/?]*)/g;
|
|
47
|
+
function Oe(s) {
|
|
48
|
+
return s ? s.replace(Se, "/?") : "/";
|
|
49
|
+
}
|
|
50
|
+
const G = (s, t) => s || Oe(t);
|
|
51
|
+
function Ne(s, t, e) {
|
|
52
|
+
const n = fe(t), l = Pe(s, t.applicationId, e), c = Re(n);
|
|
53
|
+
return {
|
|
54
|
+
...l,
|
|
55
|
+
attachments: ["wall-time.json"],
|
|
56
|
+
start: new Date(s.startClocks.timeStamp).toISOString(),
|
|
57
|
+
end: new Date(s.endClocks.timeStamp).toISOString(),
|
|
58
|
+
family: "chrome",
|
|
59
|
+
runtime: "chrome",
|
|
60
|
+
format: "json",
|
|
61
|
+
version: 4,
|
|
62
|
+
tags_profiler: c.join(","),
|
|
63
|
+
_dd: { clock_drift: me() }
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function Pe(s, t, e) {
|
|
67
|
+
const { ids: n, names: l } = we(s.views), c = s.longTasks.map((p) => p.id).filter((p) => p !== void 0), a = s.actions?.map((p) => p.id).filter((p) => p !== void 0) ?? [], { ids: d, labels: m } = Le(s.vitals), u = { application: { id: t } };
|
|
68
|
+
return e && (u.session = { id: e }), n.length && (u.view = {
|
|
69
|
+
id: n,
|
|
70
|
+
name: l
|
|
71
|
+
}), c.length && (u.long_task = { id: c }), a.length && (u.action = {
|
|
72
|
+
id: a,
|
|
73
|
+
label: []
|
|
74
|
+
}), d.length && (u.vital = {
|
|
75
|
+
id: d,
|
|
76
|
+
label: m
|
|
77
|
+
}), u;
|
|
78
|
+
}
|
|
79
|
+
function we(s) {
|
|
80
|
+
const t = {
|
|
81
|
+
ids: [],
|
|
82
|
+
names: []
|
|
83
|
+
};
|
|
84
|
+
for (const e of s)
|
|
85
|
+
t.ids.push(e.viewId), e.viewName && t.names.push(e.viewName);
|
|
86
|
+
return t.names = Array.from(new Set(t.names)), t;
|
|
87
|
+
}
|
|
88
|
+
function Le(s) {
|
|
89
|
+
const t = {
|
|
90
|
+
ids: [],
|
|
91
|
+
labels: []
|
|
92
|
+
};
|
|
93
|
+
if (!s) return t;
|
|
94
|
+
for (const e of s)
|
|
95
|
+
t.ids.push(e.id), t.labels.push(e.label);
|
|
96
|
+
return t.labels = Array.from(new Set(t.labels)), t;
|
|
97
|
+
}
|
|
98
|
+
function Re(s) {
|
|
99
|
+
return s.concat([
|
|
100
|
+
"language:javascript",
|
|
101
|
+
"runtime:chrome",
|
|
102
|
+
"family:chrome",
|
|
103
|
+
"host:browser"
|
|
104
|
+
]);
|
|
105
|
+
}
|
|
106
|
+
const Ve = V;
|
|
107
|
+
function Me(s) {
|
|
108
|
+
const t = R({ expireDelay: Ve });
|
|
109
|
+
return s.subscribe(_.RAW_RUM_EVENT_COLLECTED, ({ rawRumEvent: e, startClocks: n, duration: l }) => {
|
|
110
|
+
e.type === "long_task" && t.add({
|
|
111
|
+
id: e.long_task.id,
|
|
112
|
+
startClocks: n,
|
|
113
|
+
duration: l,
|
|
114
|
+
entryType: e.long_task.entry_type === ve.LONG_TASK ? j.LONG_TASK : j.LONG_ANIMATION_FRAME
|
|
115
|
+
}, n.relative).close(I(n.relative, l));
|
|
116
|
+
}), t;
|
|
117
|
+
}
|
|
118
|
+
const Ue = V;
|
|
119
|
+
function qe(s) {
|
|
120
|
+
const t = R({ expireDelay: Ue });
|
|
121
|
+
return s.subscribe(_.ACTION_STARTED, (e) => {
|
|
122
|
+
t.add({
|
|
123
|
+
id: e.id,
|
|
124
|
+
label: "",
|
|
125
|
+
startClocks: e.startClocks,
|
|
126
|
+
duration: void 0
|
|
127
|
+
}, e.startClocks.relative);
|
|
128
|
+
}), s.subscribe(_.RAW_RUM_EVENT_COLLECTED, ({ rawRumEvent: e, startClocks: n, duration: l }) => {
|
|
129
|
+
if (e.type === "action") {
|
|
130
|
+
const c = t.getEntries(n.relative).find((d) => d.value.id === e.action.id), a = l ?? 0;
|
|
131
|
+
c ? (c.value.duration = a, c.close(I(n.relative, a))) : t.add({
|
|
132
|
+
id: e.action.id,
|
|
133
|
+
label: "",
|
|
134
|
+
startClocks: n,
|
|
135
|
+
duration: l
|
|
136
|
+
}, n.relative).close(I(n.relative, a));
|
|
137
|
+
}
|
|
138
|
+
}), t;
|
|
139
|
+
}
|
|
140
|
+
const He = V;
|
|
141
|
+
function je(s) {
|
|
142
|
+
const t = R({ expireDelay: He });
|
|
143
|
+
return s.subscribe(_.DURATION_VITAL_STARTED, (e) => {
|
|
144
|
+
t.add({
|
|
145
|
+
id: e.id,
|
|
146
|
+
type: w.DURATION,
|
|
147
|
+
startClocks: e.startClocks,
|
|
148
|
+
duration: void 0,
|
|
149
|
+
label: e.name
|
|
150
|
+
}, e.startClocks.relative);
|
|
151
|
+
}), s.subscribe(_.RAW_RUM_EVENT_COLLECTED, ({ rawRumEvent: e, startClocks: n, duration: l }) => {
|
|
152
|
+
if (e.type !== "vital") return;
|
|
153
|
+
if (e.vital.type === w.OPERATION_STEP) {
|
|
154
|
+
if (e.vital.step_type === "start") t.add({
|
|
155
|
+
id: e.vital.id,
|
|
156
|
+
type: e.vital.type,
|
|
157
|
+
operationKey: e.vital.operation_key,
|
|
158
|
+
startClocks: n,
|
|
159
|
+
label: e.vital.name
|
|
160
|
+
}, n.relative);
|
|
161
|
+
else if (e.vital.step_type === "end") {
|
|
162
|
+
const a = t.findAllEntries().find((d) => d.value.type === w.OPERATION_STEP && d.value.label === e.vital.name && d.value.operationKey === e.vital.operation_key);
|
|
163
|
+
if (!a) return;
|
|
164
|
+
a.value.duration = z(a.value.startClocks.relative, n.relative), a.close(n.relative);
|
|
165
|
+
}
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
const c = t.getEntries(n.relative).find((a) => a.value.id === e.vital.id);
|
|
169
|
+
if (c) {
|
|
170
|
+
c.value.duration = l, c.close(I(n.relative, l));
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
t.add({
|
|
174
|
+
id: e.vital.id,
|
|
175
|
+
type: e.vital.type,
|
|
176
|
+
operationKey: e.vital.operation_key,
|
|
177
|
+
startClocks: n,
|
|
178
|
+
duration: l,
|
|
179
|
+
label: e.vital.name
|
|
180
|
+
}, n.relative).close(I(n.relative, l));
|
|
181
|
+
}), t;
|
|
182
|
+
}
|
|
183
|
+
function Fe(s, t) {
|
|
184
|
+
const e = s?.data?.attributes;
|
|
185
|
+
if (!e || typeof e.admitted != "boolean" || typeof e.reason != "string") return t;
|
|
186
|
+
const n = e.reason === "backend_client_not_initialized" ? "backend_unavailable" : e.reason;
|
|
187
|
+
return {
|
|
188
|
+
decision: e.admitted ? "quota_ok" : "quota_ko",
|
|
189
|
+
reason: n
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
function Be(s, t) {
|
|
193
|
+
return be({
|
|
194
|
+
proxy: s.proxy,
|
|
195
|
+
site: s.site,
|
|
196
|
+
path: "/api/v2/profiling/quota",
|
|
197
|
+
parameters: `session_id=${t}`,
|
|
198
|
+
subdomain: "quota"
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
function xe(s, t, e = 5e3) {
|
|
202
|
+
const n = Be(s, t), l = new AbortController();
|
|
203
|
+
let c;
|
|
204
|
+
const a = _e(n, {
|
|
205
|
+
credentials: "omit",
|
|
206
|
+
signal: l.signal,
|
|
207
|
+
headers: new Headers({ "DD-CLIENT-TOKEN": s.clientToken })
|
|
208
|
+
}).then((m) => {
|
|
209
|
+
const u = m.status === 429 ? {
|
|
210
|
+
decision: "quota_ko",
|
|
211
|
+
reason: "quota_exceeded"
|
|
212
|
+
} : {
|
|
213
|
+
decision: "quota_ok",
|
|
214
|
+
reason: "api-error"
|
|
215
|
+
};
|
|
216
|
+
return m.json().then((p) => (T(c), Fe(p, u)), () => (T(c), u));
|
|
217
|
+
}).catch(() => (T(c), {
|
|
218
|
+
decision: "quota_ok",
|
|
219
|
+
reason: "api-error"
|
|
220
|
+
})), d = new Promise((m) => {
|
|
221
|
+
c = Y(() => {
|
|
222
|
+
l.abort(), m({
|
|
223
|
+
decision: "quota_ok",
|
|
224
|
+
reason: "timeout"
|
|
225
|
+
});
|
|
226
|
+
}, e);
|
|
227
|
+
});
|
|
228
|
+
return Promise.race([a, d]);
|
|
229
|
+
}
|
|
230
|
+
const Ce = {
|
|
231
|
+
sampleIntervalMs: 10,
|
|
232
|
+
collectIntervalMs: 6e4,
|
|
233
|
+
minProfileDurationMs: 5e3
|
|
234
|
+
};
|
|
235
|
+
function ze(s, t, e, n, l, c, a = Ce) {
|
|
236
|
+
const d = F() ? b(De)() : b(Ae)(s, t, l);
|
|
237
|
+
let m;
|
|
238
|
+
const u = [], p = b(Me)(t), k = b(qe)(t), g = b(je)(t);
|
|
239
|
+
let o = {
|
|
240
|
+
state: "stopped",
|
|
241
|
+
stateReason: "initializing"
|
|
242
|
+
}, y = 0;
|
|
243
|
+
t.subscribe(_.SESSION_EXPIRED, () => {
|
|
244
|
+
O("session-expired");
|
|
245
|
+
}), t.subscribe(_.SESSION_RENEWED, () => {
|
|
246
|
+
if (o.state === "stopped" && (o.stateReason === "session-expired" || o.stateReason === "quota_ko")) {
|
|
247
|
+
const i = e.findTrackedSession();
|
|
248
|
+
if (!i || !he(i.id, Te(s.sessionSampleRate, s.profilingSampleRate))) return;
|
|
249
|
+
E();
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
function E() {
|
|
253
|
+
if (o.state === "running") return;
|
|
254
|
+
const i = c.findView();
|
|
255
|
+
m = i ? {
|
|
256
|
+
startClocks: i.startClocks,
|
|
257
|
+
viewId: i.id,
|
|
258
|
+
viewName: G(i.name, document.location.pathname)
|
|
259
|
+
} : void 0, u.push(B(window, x.VISIBILITY_CHANGE, Z).stop, B(window, x.BEFORE_UNLOAD, ee).stop), h(), K();
|
|
260
|
+
}
|
|
261
|
+
function K() {
|
|
262
|
+
if (F()) return;
|
|
263
|
+
const i = ++y, r = e.findTrackedSession()?.id;
|
|
264
|
+
r && b(xe)(s, r).then((f) => {
|
|
265
|
+
i === y && (o.state !== "running" && o.state !== "paused" || f.decision === "quota_ko" && O("quota_ko", f.reason));
|
|
266
|
+
}).catch(L);
|
|
267
|
+
}
|
|
268
|
+
function W() {
|
|
269
|
+
O("stopped-by-user");
|
|
270
|
+
}
|
|
271
|
+
function O(i, r) {
|
|
272
|
+
X(i), u.forEach((f) => f()), u.length = 0, n.set({
|
|
273
|
+
status: "stopped",
|
|
274
|
+
error_reason: void 0,
|
|
275
|
+
quota_reason: r
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
function Q(i) {
|
|
279
|
+
if (i.state === "running") return { cleanupTasks: i.cleanupTasks };
|
|
280
|
+
const r = [], f = t.subscribe(_.VIEW_CREATED, (v) => {
|
|
281
|
+
const D = {
|
|
282
|
+
viewId: v.id,
|
|
283
|
+
viewName: G(v.name, document.location.pathname),
|
|
284
|
+
startClocks: v.startClocks
|
|
285
|
+
};
|
|
286
|
+
M(D), m = D;
|
|
287
|
+
});
|
|
288
|
+
return r.push(f.unsubscribe), { cleanupTasks: r };
|
|
289
|
+
}
|
|
290
|
+
function h() {
|
|
291
|
+
const i = ye.Profiler;
|
|
292
|
+
if (!i)
|
|
293
|
+
throw n.set({
|
|
294
|
+
status: "error",
|
|
295
|
+
error_reason: "not-supported-by-browser"
|
|
296
|
+
}), new Error("RUM Profiler is not supported in this browser.");
|
|
297
|
+
o.state === "running" && N(o);
|
|
298
|
+
const { cleanupTasks: r } = Q(o);
|
|
299
|
+
let f;
|
|
300
|
+
try {
|
|
301
|
+
f = new i({
|
|
302
|
+
sampleInterval: a.sampleIntervalMs,
|
|
303
|
+
maxBufferSize: Math.round(a.collectIntervalMs * 1.5 / a.sampleIntervalMs)
|
|
304
|
+
});
|
|
305
|
+
} catch (v) {
|
|
306
|
+
v instanceof Error && v.message.includes("disabled by Document Policy") ? (Ee.warn("[DD_RUM] Profiler startup failed. Ensure your server includes the `Document-Policy: js-profiling` response header when serving HTML pages.", v), n.set({
|
|
307
|
+
status: "error",
|
|
308
|
+
error_reason: "missing-document-policy-header"
|
|
309
|
+
})) : n.set({
|
|
310
|
+
status: "error",
|
|
311
|
+
error_reason: "unexpected-exception"
|
|
312
|
+
});
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
n.set({
|
|
316
|
+
status: "running",
|
|
317
|
+
error_reason: void 0
|
|
318
|
+
}), o = {
|
|
319
|
+
state: "running",
|
|
320
|
+
startClocks: C(),
|
|
321
|
+
profiler: f,
|
|
322
|
+
timeoutId: Y(h, a.collectIntervalMs),
|
|
323
|
+
views: [],
|
|
324
|
+
cleanupTasks: r,
|
|
325
|
+
longTasks: [],
|
|
326
|
+
sessionId: e.findTrackedSession()?.id
|
|
327
|
+
}, M(m), f.addEventListener("samplebufferfull", P);
|
|
328
|
+
}
|
|
329
|
+
function N(i) {
|
|
330
|
+
T(i.timeoutId), i.profiler.removeEventListener("samplebufferfull", P);
|
|
331
|
+
const { startClocks: r, views: f, sessionId: v } = i;
|
|
332
|
+
i.profiler.stop().then((D) => {
|
|
333
|
+
const U = C(), A = z(r.relative, U.relative), q = p.findAll(r.relative, A), ie = k.findAll(r.relative, A), oe = g.findAll(r.relative, A).map((S) => ({
|
|
334
|
+
id: S.id,
|
|
335
|
+
label: S.label,
|
|
336
|
+
startClocks: S.startClocks,
|
|
337
|
+
duration: S.duration
|
|
338
|
+
})), ae = A < a.minProfileDurationMs;
|
|
339
|
+
q.length === 0 && ae || J(Object.assign({}, D, {
|
|
340
|
+
startClocks: r,
|
|
341
|
+
endClocks: U,
|
|
342
|
+
clocksOrigin: Ie(),
|
|
343
|
+
longTasks: q,
|
|
344
|
+
actions: ie,
|
|
345
|
+
vitals: oe,
|
|
346
|
+
views: f,
|
|
347
|
+
sampleInterval: a.sampleIntervalMs
|
|
348
|
+
}), v);
|
|
349
|
+
}).catch(L);
|
|
350
|
+
}
|
|
351
|
+
function X(i) {
|
|
352
|
+
if (o.state !== "running") {
|
|
353
|
+
(o.state === "paused" || o.state === "stopped" && i === "stopped-by-user") && (o = {
|
|
354
|
+
state: "stopped",
|
|
355
|
+
stateReason: i
|
|
356
|
+
});
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
const r = o;
|
|
360
|
+
o = {
|
|
361
|
+
state: "stopped",
|
|
362
|
+
stateReason: i
|
|
363
|
+
}, r.cleanupTasks.forEach((f) => f()), i === "quota_ko" ? (T(r.timeoutId), r.profiler.removeEventListener("samplebufferfull", P), r.profiler.stop().catch(L)) : N(r);
|
|
364
|
+
}
|
|
365
|
+
function $() {
|
|
366
|
+
if (o.state !== "running") return;
|
|
367
|
+
const i = o;
|
|
368
|
+
o = { state: "paused" }, i.cleanupTasks.forEach((r) => r()), N(i);
|
|
369
|
+
}
|
|
370
|
+
function M(i) {
|
|
371
|
+
o.state !== "running" || !i || o.views.push(i);
|
|
372
|
+
}
|
|
373
|
+
function J(i, r) {
|
|
374
|
+
d({
|
|
375
|
+
profile: Ne(i, s, r),
|
|
376
|
+
trace: i
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
function P() {
|
|
380
|
+
h();
|
|
381
|
+
}
|
|
382
|
+
function Z() {
|
|
383
|
+
document.visibilityState === "hidden" && o.state === "running" ? $() : document.visibilityState === "visible" && o.state === "paused" && h();
|
|
384
|
+
}
|
|
385
|
+
function ee() {
|
|
386
|
+
h();
|
|
387
|
+
}
|
|
388
|
+
function te() {
|
|
389
|
+
return o.state === "stopped";
|
|
390
|
+
}
|
|
391
|
+
function se() {
|
|
392
|
+
return o.state === "running";
|
|
393
|
+
}
|
|
394
|
+
function ne() {
|
|
395
|
+
return o.state === "paused";
|
|
396
|
+
}
|
|
397
|
+
return {
|
|
398
|
+
start: E,
|
|
399
|
+
stop: W,
|
|
400
|
+
isStopped: te,
|
|
401
|
+
isRunning: se,
|
|
402
|
+
isPaused: ne
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
export {
|
|
406
|
+
ze as createRumProfiler
|
|
407
|
+
};
|
|
408
|
+
//# sourceMappingURL=datadogProfiler-P8U8zq4E.js.map
|