@picked/client 0.0.78-next.2 → 0.0.78-next.3
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/.tsbuildinfo +1 -1
- package/dist/{api-gGqMLTec.js → api-DxTpQr1S.js} +1 -1
- package/dist/{api-R3q_6NiX.cjs → api-bRP9T5NV.cjs} +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
- package/dist/cjs/plugins/telemetry/index.js +1 -0
- package/dist/cjs/server/index.js +1 -1
- package/dist/emit-D-tLiWL1.cjs +1 -0
- package/dist/emit-Ds2EG7CB.js +14 -0
- package/dist/esm/index.js +270 -229
- package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
- package/dist/esm/plugins/telemetry/index.js +97 -0
- package/dist/esm/server/index.js +1 -1
- package/dist/{plugin-CaJyXwSN.js → plugin-Bx7a4qw2.js} +2 -2
- package/dist/{plugin-D4WVP2aO.cjs → plugin-C24Ybji7.cjs} +1 -1
- package/dist/provider-DH9rfY2L.js +94 -0
- package/dist/provider-OA5InC6Z.cjs +1 -0
- package/dist/types/data-source/api.d.ts.map +1 -1
- package/dist/types/data-source/provider.d.ts +3 -0
- package/dist/types/data-source/provider.d.ts.map +1 -1
- package/dist/types/data-source/request-observer.d.ts +58 -0
- package/dist/types/data-source/request-observer.d.ts.map +1 -0
- package/dist/types/entities/plugin/plugin.d.ts +4 -0
- package/dist/types/entities/plugin/plugin.d.ts.map +1 -1
- package/dist/types/lifecycle/lifecycle.d.ts.map +1 -1
- package/dist/types/picked.d.ts +8 -1
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/telemetry/emit.d.ts +18 -0
- package/dist/types/plugins/telemetry/emit.d.ts.map +1 -0
- package/dist/types/plugins/telemetry/index.d.ts +4 -0
- package/dist/types/plugins/telemetry/index.d.ts.map +1 -0
- package/dist/types/plugins/telemetry/plugin-summary.d.ts +10 -0
- package/dist/types/plugins/telemetry/plugin-summary.d.ts.map +1 -0
- package/dist/types/plugins/telemetry/plugin.d.ts +45 -0
- package/dist/types/plugins/telemetry/plugin.d.ts.map +1 -0
- package/dist/types/utils/client-telemetry.d.ts +25 -0
- package/dist/types/utils/client-telemetry.d.ts.map +1 -0
- package/dist/types/utils/user-timing.d.ts +21 -0
- package/dist/types/utils/user-timing.d.ts.map +1 -0
- package/dist/{version-CaCM83j4.js → version-CWSfnbGk.js} +1 -1
- package/dist/{version-ZVJWOz2D.cjs → version-D9Eq71fx.cjs} +1 -1
- package/package.json +16 -4
- package/dist/provider-C12099cw.cjs +0 -1
- package/dist/provider-D5CCq15k.js +0 -69
package/dist/esm/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { t as e } from "../object-BUDGxEqy.js";
|
|
2
2
|
import { n as t, t as n } from "../rules-logic-HesIUCu6.js";
|
|
3
3
|
import { t as r } from "../logger-DMN6TxJJ.js";
|
|
4
|
-
import { a as i, c as a, d as o, f as s, i as c, l, m as u, n as d, o as f, r as
|
|
5
|
-
import { a as
|
|
6
|
-
import { l as
|
|
7
|
-
import { i as
|
|
8
|
-
import { i as
|
|
9
|
-
import { t as
|
|
10
|
-
import { n as
|
|
11
|
-
import { attach as k, combine as A, createApi as j, createDomain as M, createEffect as N, createEvent as P, createStore as F, is as
|
|
4
|
+
import { a as i, c as a, d as o, f as s, i as c, l, m as u, n as d, o as f, p, r as m, s as h, t as g, u as _ } from "../supports-CO9bJGNl.js";
|
|
5
|
+
import { a as v, i as y, r as ee, s as b, t as x } from "../dom-BqcToNL0.js";
|
|
6
|
+
import { l as S, n as C, r as w, u as T } from "../experience-instance-DGk11d8a.js";
|
|
7
|
+
import { i as te, n as E, r as D, t as O } from "../storage-1MW3-_As.js";
|
|
8
|
+
import { i as ne, n as re, r as ie, t as ae } from "../version-CWSfnbGk.js";
|
|
9
|
+
import { t as oe } from "../id-Bo4RBeOs.js";
|
|
10
|
+
import { n as se, r as ce, t as le } from "../inert-script-report-B_bMPRzp.js";
|
|
11
|
+
import { attach as k, combine as A, createApi as j, createDomain as M, createEffect as N, createEvent as P, createStore as F, is as ue, sample as I } from "effector";
|
|
12
12
|
import { createFactory as L, invoke as R } from "@withease/factories";
|
|
13
|
-
import { sendPing as
|
|
13
|
+
import { sendPing as de } from "@picked/delivery-api-client";
|
|
14
14
|
//#region src/entities/experience/experience.ts
|
|
15
|
-
var z = M("experience"),
|
|
15
|
+
var z = M("experience"), fe = L(({ client: e, experience: r }) => {
|
|
16
16
|
let i = z.store(r), a = j(i, { merge(e, t) {
|
|
17
17
|
return {
|
|
18
18
|
...e,
|
|
@@ -24,7 +24,7 @@ var z = M("experience"), de = L(({ client: e, experience: r }) => {
|
|
|
24
24
|
targetSelectors: e.targets,
|
|
25
25
|
initializeOpenLogic: e.initializeOpen
|
|
26
26
|
})), s = A(i, e.components.listStore, (e, t) => (e.componentName ? t.find((t) => t.name === e.componentName) : void 0) || t.find((t) => t.name === `experience:${e.id}`) || t.find((e) => e.name === "experience"), { skipVoid: !1 }), c = A(i, e.steps.indexStore, e.conditions.indexStore, (e, t, n) => {
|
|
27
|
-
let r = e.nodes.filter(
|
|
27
|
+
let r = e.nodes.filter(T).map((e) => t[e.stepId]).filter((e) => e !== void 0), i = e.nodes.filter(S).map((e) => n[e.conditionId]).filter((e) => e !== void 0);
|
|
28
28
|
return {
|
|
29
29
|
steps: r,
|
|
30
30
|
nodes: e.nodes,
|
|
@@ -34,8 +34,8 @@ var z = M("experience"), de = L(({ client: e, experience: r }) => {
|
|
|
34
34
|
}), l = r.actions ?? [], u, d = k({
|
|
35
35
|
source: o,
|
|
36
36
|
effect: (t, n) => {
|
|
37
|
-
let i =
|
|
38
|
-
i.forEach(({ elements: e }) => e.forEach((e) =>
|
|
37
|
+
let i = y(t.targetSelectors, r.id);
|
|
38
|
+
i.forEach(({ elements: e }) => e.forEach((e) => b(e, r.id))), x(i, r.id, r.key).forEach((t) => {
|
|
39
39
|
n ? e.experienceInstances.spawn(u, t, n) : e.experienceInstances.spawn(u, t);
|
|
40
40
|
});
|
|
41
41
|
}
|
|
@@ -48,7 +48,7 @@ var z = M("experience"), de = L(({ client: e, experience: r }) => {
|
|
|
48
48
|
effect: async ({ preconditionPassed: i, isUser: a, config: o }) => {
|
|
49
49
|
if (!i || !a) return !1;
|
|
50
50
|
let { decisionLogic: s, targetSelectors: c } = o;
|
|
51
|
-
return c.length === 0 ||
|
|
51
|
+
return c.length === 0 || y(c, r.id).length < 1 ? !1 : s === void 0 || !t(s) || await n(e, s) === !0;
|
|
52
52
|
}
|
|
53
53
|
}), m = N(async () => {
|
|
54
54
|
if (!e.contentLoader) return !0;
|
|
@@ -99,17 +99,17 @@ var z = M("experience"), de = L(({ client: e, experience: r }) => {
|
|
|
99
99
|
prepareExperienceContentFx: m
|
|
100
100
|
}, u;
|
|
101
101
|
});
|
|
102
|
-
function
|
|
103
|
-
return R(
|
|
102
|
+
function pe(e) {
|
|
103
|
+
return R(fe, e);
|
|
104
104
|
}
|
|
105
|
-
var
|
|
105
|
+
var me = L(({ client: e }) => {
|
|
106
106
|
let t = z.store({}), n = j(t, { register(e, t) {
|
|
107
107
|
return {
|
|
108
108
|
...e,
|
|
109
109
|
[t.id]: t
|
|
110
110
|
};
|
|
111
111
|
} }), r = P(), i = N((t) => {
|
|
112
|
-
n.register(
|
|
112
|
+
n.register(pe({
|
|
113
113
|
client: e,
|
|
114
114
|
experience: t
|
|
115
115
|
}));
|
|
@@ -195,38 +195,35 @@ var pe = L(({ client: e }) => {
|
|
|
195
195
|
})
|
|
196
196
|
};
|
|
197
197
|
});
|
|
198
|
-
function
|
|
199
|
-
return R(
|
|
198
|
+
function he(e) {
|
|
199
|
+
return R(me, e);
|
|
200
200
|
}
|
|
201
|
-
var
|
|
201
|
+
var ge = async (e) => {
|
|
202
202
|
await e.experiences.initialiseExperiencesFx();
|
|
203
203
|
};
|
|
204
204
|
//#endregion
|
|
205
205
|
//#region src/entities/plugin/plugin.ts
|
|
206
|
-
function
|
|
206
|
+
function _e(e) {
|
|
207
207
|
return N(async () => {
|
|
208
208
|
await e();
|
|
209
209
|
});
|
|
210
210
|
}
|
|
211
|
-
var
|
|
212
|
-
let r = t.name, i = t.setup(e);
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
}, ve = M("component"), ye = L(({ client: e, component: t, name: n }) => ({
|
|
211
|
+
var ve = (e, t, n) => {
|
|
212
|
+
let r = t.name, i = t.setup(e), a = n[r] ?? {};
|
|
213
|
+
n[r] = Object.freeze({
|
|
214
|
+
...a,
|
|
215
|
+
...i
|
|
216
|
+
});
|
|
217
|
+
}, ye = M("component"), be = L(({ client: e, component: t, name: n }) => ({
|
|
221
218
|
name: n,
|
|
222
219
|
component: t,
|
|
223
220
|
frameworkStore: e.frameworks.getByName(t.frameworkName)
|
|
224
221
|
}));
|
|
225
|
-
function
|
|
226
|
-
return R(
|
|
222
|
+
function xe(e) {
|
|
223
|
+
return R(be, e);
|
|
227
224
|
}
|
|
228
|
-
var
|
|
229
|
-
let t =
|
|
225
|
+
var Se = L(({ client: e }) => {
|
|
226
|
+
let t = ye.store({}), n = j(t, { register(e, t) {
|
|
230
227
|
return {
|
|
231
228
|
...e,
|
|
232
229
|
[t.name]: t
|
|
@@ -239,7 +236,7 @@ var xe = L(({ client: e }) => {
|
|
|
239
236
|
fn: (e, { name: t }) => `Component '${t}' already registered. Registering again will override the previous registration.`
|
|
240
237
|
}).watch((e) => /* @__PURE__ */ r("warn", e)), I({
|
|
241
238
|
clock: i,
|
|
242
|
-
fn: ({ name: t, component: n }) =>
|
|
239
|
+
fn: ({ name: t, component: n }) => xe({
|
|
243
240
|
client: e,
|
|
244
241
|
name: t,
|
|
245
242
|
component: n
|
|
@@ -256,16 +253,16 @@ var xe = L(({ client: e }) => {
|
|
|
256
253
|
listStore: a
|
|
257
254
|
};
|
|
258
255
|
});
|
|
259
|
-
function
|
|
260
|
-
return R(
|
|
256
|
+
function Ce(e) {
|
|
257
|
+
return R(Se, e);
|
|
261
258
|
}
|
|
262
|
-
var
|
|
259
|
+
var we = (e, t, n) => {
|
|
263
260
|
n.register({
|
|
264
261
|
name: e,
|
|
265
262
|
component: t
|
|
266
263
|
});
|
|
267
|
-
},
|
|
268
|
-
let t =
|
|
264
|
+
}, Te = M("framework"), Ee = L((e) => {
|
|
265
|
+
let t = Te.store({}), n = j(t, { register(e, t) {
|
|
269
266
|
return {
|
|
270
267
|
...e,
|
|
271
268
|
[t.name]: t.framework
|
|
@@ -290,15 +287,15 @@ var Ce = (e, t, n) => {
|
|
|
290
287
|
listStore: a
|
|
291
288
|
};
|
|
292
289
|
});
|
|
293
|
-
function
|
|
294
|
-
return R(
|
|
290
|
+
function De(e) {
|
|
291
|
+
return R(Ee, e);
|
|
295
292
|
}
|
|
296
|
-
var
|
|
293
|
+
var Oe = (e, t) => {
|
|
297
294
|
t.register({
|
|
298
295
|
name: e.name,
|
|
299
296
|
framework: e
|
|
300
297
|
});
|
|
301
|
-
},
|
|
298
|
+
}, ke = L(({ client: e }) => {
|
|
302
299
|
let t = "window" in globalThis, n = {
|
|
303
300
|
location: t ? globalThis.location : void 0,
|
|
304
301
|
document: t ? globalThis.document : void 0,
|
|
@@ -312,12 +309,12 @@ var De = (e, t) => {
|
|
|
312
309
|
...n
|
|
313
310
|
}));
|
|
314
311
|
});
|
|
315
|
-
function
|
|
316
|
-
return R(
|
|
312
|
+
function Ae(e) {
|
|
313
|
+
return R(ke, e);
|
|
317
314
|
}
|
|
318
315
|
//#endregion
|
|
319
316
|
//#region src/logic-engine.ts
|
|
320
|
-
function
|
|
317
|
+
function je(e) {
|
|
321
318
|
return typeof e == "number" && !isNaN(e);
|
|
322
319
|
}
|
|
323
320
|
function B(e) {
|
|
@@ -326,21 +323,21 @@ function B(e) {
|
|
|
326
323
|
function V(e) {
|
|
327
324
|
return Array.isArray(e);
|
|
328
325
|
}
|
|
329
|
-
function
|
|
326
|
+
function Me(e) {
|
|
330
327
|
return e instanceof Promise;
|
|
331
328
|
}
|
|
332
|
-
function
|
|
329
|
+
function Ne(e) {
|
|
333
330
|
return typeof e == "object" && !!e && !Array.isArray(e) && Object.keys(e).length === 1;
|
|
334
331
|
}
|
|
335
332
|
function H(e) {
|
|
336
|
-
if (
|
|
333
|
+
if (je(e)) return e;
|
|
337
334
|
let t = parseFloat(`${e}`);
|
|
338
335
|
return isNaN(t) ? 0 : t;
|
|
339
336
|
}
|
|
340
337
|
function U(e) {
|
|
341
338
|
return `${e}`;
|
|
342
339
|
}
|
|
343
|
-
var
|
|
340
|
+
var Pe = {
|
|
344
341
|
"==": (e, t) => e == t,
|
|
345
342
|
"===": (e, t) => e === t,
|
|
346
343
|
"!=": (e, t) => e != t,
|
|
@@ -435,10 +432,10 @@ var Ne = {
|
|
|
435
432
|
};
|
|
436
433
|
async function W(e, t) {
|
|
437
434
|
if (!e) return e;
|
|
438
|
-
if (
|
|
435
|
+
if (Me(e)) return W(await e, t);
|
|
439
436
|
if (V(e)) return Promise.all(e.map((e) => W(e, t)));
|
|
440
|
-
if (!
|
|
441
|
-
let n =
|
|
437
|
+
if (!Ne(e)) return e;
|
|
438
|
+
let n = Fe(e), r = n ? e[n] ?? [] : [];
|
|
442
439
|
switch (V(r) || (r = [r]), n) {
|
|
443
440
|
case "if":
|
|
444
441
|
case "?:":
|
|
@@ -496,32 +493,32 @@ async function W(e, t) {
|
|
|
496
493
|
case "catch": try {
|
|
497
494
|
return await W(r[0], t);
|
|
498
495
|
} catch (e) {
|
|
499
|
-
return
|
|
496
|
+
return Ne(e) ? await W(e, t) : r[1] ? await W(r[1], e) : e instanceof Error ? e.message : e;
|
|
500
497
|
}
|
|
501
498
|
}
|
|
502
|
-
let i = await Promise.all(r.map((e) => W(e, t))), a = n ?
|
|
499
|
+
let i = await Promise.all(r.map((e) => W(e, t))), a = n ? Pe[n] : void 0;
|
|
503
500
|
if (!a) throw Error(`Unrecognized operation ${n}`);
|
|
504
501
|
return a.apply(t, i);
|
|
505
502
|
}
|
|
506
503
|
async function G(e) {
|
|
507
|
-
return
|
|
504
|
+
return Me(e) ? G(await e) : !(Array.isArray(e) && e.length === 0) && !!e;
|
|
508
505
|
}
|
|
509
|
-
function
|
|
506
|
+
function Fe(e) {
|
|
510
507
|
return Object.keys(e)[0];
|
|
511
508
|
}
|
|
512
509
|
//#endregion
|
|
513
510
|
//#region src/lifecycle/rules-logic.ts
|
|
514
|
-
function
|
|
511
|
+
function Ie(e, t, n) {
|
|
515
512
|
return new Proxy(Object.create(null), { get(r, i) {
|
|
516
513
|
if (typeof i != "string") return;
|
|
517
514
|
let a = e.find((e) => e.key === i);
|
|
518
515
|
if (a !== void 0) return async () => !n.has(i) && await W(a.logic, {
|
|
519
516
|
...t,
|
|
520
|
-
conditions:
|
|
517
|
+
conditions: Ie(e, t, new Set(n).add(i))
|
|
521
518
|
}) === !0;
|
|
522
519
|
} });
|
|
523
520
|
}
|
|
524
|
-
var
|
|
521
|
+
var Le = L(({ client: e }) => k({
|
|
525
522
|
source: {
|
|
526
523
|
stateSnapshot: e.stateSnapshotStore,
|
|
527
524
|
predicates: e.predicates.listStore,
|
|
@@ -560,22 +557,22 @@ var Ie = L(({ client: e }) => k({
|
|
|
560
557
|
};
|
|
561
558
|
return await W(o, {
|
|
562
559
|
...d,
|
|
563
|
-
conditions:
|
|
560
|
+
conditions: Ie(a, d, /* @__PURE__ */ new Set())
|
|
564
561
|
});
|
|
565
562
|
}
|
|
566
563
|
}));
|
|
567
|
-
function
|
|
568
|
-
return R(
|
|
564
|
+
function Re(e) {
|
|
565
|
+
return R(Le, e);
|
|
569
566
|
}
|
|
570
567
|
//#endregion
|
|
571
568
|
//#region src/ping.ts
|
|
572
|
-
var
|
|
569
|
+
var ze = 6e3, Be = O("last_ping", "global"), Ve = async (e) => {
|
|
573
570
|
try {
|
|
574
|
-
let t = Date.now(), n = E.get(
|
|
575
|
-
if (n.isSet() && (r = n.json() ?? 0), r && t - r <
|
|
571
|
+
let t = Date.now(), n = E.get(Be), r = 0;
|
|
572
|
+
if (n.isSet() && (r = n.json() ?? 0), r && t - r < ze) return !0;
|
|
576
573
|
let i = {}, a = document.getElementById("picked_script")?.dataset.verceltoken;
|
|
577
574
|
a && (i["x-vercel-protection-bypass"] = a);
|
|
578
|
-
let o = await
|
|
575
|
+
let o = await de(e.apiUrl, {
|
|
579
576
|
projectId: e.projectId,
|
|
580
577
|
path: window.location.pathname
|
|
581
578
|
}, { headers: i });
|
|
@@ -583,7 +580,7 @@ var Re = 6e3, ze = O("last_ping", "global"), Be = async (e) => {
|
|
|
583
580
|
} catch {
|
|
584
581
|
return !1;
|
|
585
582
|
}
|
|
586
|
-
}, K = M("lifecycle"),
|
|
583
|
+
}, K = M("lifecycle"), He = L(({ client: e }) => {
|
|
587
584
|
let t = K.store(!1), r = F(void 0, {
|
|
588
585
|
skipVoid: !1,
|
|
589
586
|
domain: K
|
|
@@ -599,11 +596,11 @@ var Re = 6e3, ze = O("last_ping", "global"), Be = async (e) => {
|
|
|
599
596
|
}), u = P(), d = P(), f = P(), p = P(), m = P(), h = P();
|
|
600
597
|
o.on(p, (e, t) => [...e, t]), s.on(m, (e, t) => t), l.on(h, (e, t) => t), t.on(d, () => !0);
|
|
601
598
|
let g = N(() => {
|
|
602
|
-
|
|
599
|
+
Ve(e);
|
|
603
600
|
}), _ = N(async () => {
|
|
604
601
|
await ee();
|
|
605
602
|
}), v = N(async () => {
|
|
606
|
-
await
|
|
603
|
+
await ge(e);
|
|
607
604
|
}), y = k({ effect: v }), b = k({
|
|
608
605
|
source: o,
|
|
609
606
|
effect: async (e) => {
|
|
@@ -625,7 +622,7 @@ var Re = 6e3, ze = O("last_ping", "global"), Be = async (e) => {
|
|
|
625
622
|
clock: C,
|
|
626
623
|
fn: () => "starting",
|
|
627
624
|
target: a
|
|
628
|
-
}), I({
|
|
625
|
+
}), C.watch(e.performance.markBegin), d.watch(e.performance.measure), I({
|
|
629
626
|
clock: C,
|
|
630
627
|
target: g
|
|
631
628
|
}), I({
|
|
@@ -671,24 +668,24 @@ var Re = 6e3, ze = O("last_ping", "global"), Be = async (e) => {
|
|
|
671
668
|
fn: () => ({ type: "initialize" }),
|
|
672
669
|
target: e.eventBus
|
|
673
670
|
});
|
|
674
|
-
let w = F(!1).on(_.done, () => !0), T = F(!1).on(f, () => !0),
|
|
671
|
+
let w = F(!1).on(_.done, () => !0), T = F(!1).on(f, () => !0), te = F(!1).on(y.done, () => !0), E = A(r, i, (e, t) => e === !0 && t === !0);
|
|
675
672
|
I({
|
|
676
673
|
clock: f,
|
|
677
|
-
source:
|
|
674
|
+
source: E,
|
|
678
675
|
filter: (e) => e,
|
|
679
676
|
fn: () => void 0,
|
|
680
677
|
target: v
|
|
681
678
|
});
|
|
682
|
-
let
|
|
679
|
+
let D = A(w, T, E, (e, t, n) => e && t && n);
|
|
683
680
|
I({
|
|
684
|
-
clock:
|
|
681
|
+
clock: D,
|
|
685
682
|
filter: (e) => e,
|
|
686
683
|
fn: () => void 0,
|
|
687
684
|
target: y
|
|
688
685
|
});
|
|
689
|
-
let
|
|
686
|
+
let O = A(w, T, E, te, (e, t, n, r) => e && t && (!n || r));
|
|
690
687
|
return I({
|
|
691
|
-
clock:
|
|
688
|
+
clock: O,
|
|
692
689
|
filter: (e) => e,
|
|
693
690
|
fn: () => void 0,
|
|
694
691
|
target: d
|
|
@@ -732,13 +729,13 @@ var Re = 6e3, ze = O("last_ping", "global"), Be = async (e) => {
|
|
|
732
729
|
setCondition: h
|
|
733
730
|
};
|
|
734
731
|
});
|
|
735
|
-
function
|
|
736
|
-
return R(
|
|
732
|
+
function Ue(e) {
|
|
733
|
+
return R(He, e);
|
|
737
734
|
}
|
|
738
735
|
//#endregion
|
|
739
736
|
//#region src/entities/predicate/predicate.ts
|
|
740
|
-
var
|
|
741
|
-
let t =
|
|
737
|
+
var We = M("predicate"), Ge = L(({ client: e }) => {
|
|
738
|
+
let t = We.store({}), n = j(t, { register(e, t) {
|
|
742
739
|
return {
|
|
743
740
|
...e,
|
|
744
741
|
[t.name]: {
|
|
@@ -796,26 +793,26 @@ var Ue = M("predicate"), We = L(({ client: e }) => {
|
|
|
796
793
|
getEvokablePredicate: s
|
|
797
794
|
};
|
|
798
795
|
});
|
|
799
|
-
function
|
|
800
|
-
return R(
|
|
796
|
+
function Ke(e) {
|
|
797
|
+
return R(Ge, e);
|
|
801
798
|
}
|
|
802
|
-
var
|
|
799
|
+
var qe = (e, t, n) => {
|
|
803
800
|
n.register({
|
|
804
801
|
name: e,
|
|
805
802
|
predicate: t
|
|
806
803
|
});
|
|
807
804
|
}, q = M("history");
|
|
808
|
-
function
|
|
805
|
+
function Je(e, t) {
|
|
809
806
|
return {
|
|
810
|
-
id:
|
|
807
|
+
id: oe(`history-entry-${Date.now()}-${Math.random()}}`),
|
|
811
808
|
node: t,
|
|
812
809
|
at: Date.now(),
|
|
813
810
|
experienceId: e
|
|
814
811
|
};
|
|
815
812
|
}
|
|
816
|
-
var
|
|
813
|
+
var Ye = L(() => {
|
|
817
814
|
let e = q.store({ entries: [] }), t = q.event(), n = q.event(), r = q.event(), i = q.event();
|
|
818
|
-
e.on(t, (e, t) => ({ entries: [...e.entries,
|
|
815
|
+
e.on(t, (e, t) => ({ entries: [...e.entries, Je(t.experienceId, t.node)] })), e.on(n, (e, t) => ({ entries: [...e.entries.slice(0, -1), Je(t.experienceId, t.node)] })), e.on(i, (e, t) => t);
|
|
819
816
|
function a(e, t) {
|
|
820
817
|
let n = {
|
|
821
818
|
lastStepIndex: -1,
|
|
@@ -823,7 +820,7 @@ var Je = L(() => {
|
|
|
823
820
|
};
|
|
824
821
|
for (let r = e.length - 1; r >= 0; r--) {
|
|
825
822
|
let i = e[r], a = i?.node;
|
|
826
|
-
if (!(!a || !
|
|
823
|
+
if (!(!a || !T(a)) && !(t && i.experienceId !== t)) if (n.lastStepIndex === -1) n.lastStepIndex = r;
|
|
827
824
|
else {
|
|
828
825
|
n.secondLastStepIndex = r;
|
|
829
826
|
break;
|
|
@@ -845,22 +842,22 @@ var Je = L(() => {
|
|
|
845
842
|
entriesStore: e.map((e) => e.entries)
|
|
846
843
|
};
|
|
847
844
|
});
|
|
848
|
-
function
|
|
849
|
-
return R(
|
|
845
|
+
function Xe() {
|
|
846
|
+
return R(Ye);
|
|
850
847
|
}
|
|
851
848
|
//#endregion
|
|
852
849
|
//#region src/utils/events.ts
|
|
853
|
-
var
|
|
850
|
+
var Ze = 0, Qe = (e) => {
|
|
854
851
|
let t = F([]);
|
|
855
852
|
return t.on(e, (e, t) => [...e, {
|
|
856
|
-
id:
|
|
853
|
+
id: Ze++,
|
|
857
854
|
at: /* @__PURE__ */ new Date(),
|
|
858
855
|
payload: t
|
|
859
856
|
}]), t;
|
|
860
857
|
};
|
|
861
858
|
//#endregion
|
|
862
859
|
//#region src/entities/field/policies.ts
|
|
863
|
-
function
|
|
860
|
+
function $e(e) {
|
|
864
861
|
let { doNotTrackValue: t, doNotStoreValue: n } = e ?? {}, r = e?.trackValue ?? t === !1, i = e?.storeValue ?? n === !1;
|
|
865
862
|
return {
|
|
866
863
|
trackValue: r,
|
|
@@ -871,10 +868,10 @@ function Qe(e) {
|
|
|
871
868
|
}
|
|
872
869
|
//#endregion
|
|
873
870
|
//#region src/entities/field/field.ts
|
|
874
|
-
var
|
|
875
|
-
let e =
|
|
871
|
+
var et = M("field"), tt = L(() => {
|
|
872
|
+
let e = et.store({}), t = j(e, {
|
|
876
873
|
register(e, t) {
|
|
877
|
-
let n = Object.assign({}, t.field, { policies:
|
|
874
|
+
let n = Object.assign({}, t.field, { policies: $e(t.field.policies) });
|
|
878
875
|
return {
|
|
879
876
|
...e,
|
|
880
877
|
[n.id]: n
|
|
@@ -886,7 +883,7 @@ var $e = M("field"), et = L(() => {
|
|
|
886
883
|
let r = Object.assign({}, n, t.updates);
|
|
887
884
|
return {
|
|
888
885
|
...e,
|
|
889
|
-
[n.id]: Object.assign({}, r, { policies:
|
|
886
|
+
[n.id]: Object.assign({}, r, { policies: $e(r.policies) })
|
|
890
887
|
};
|
|
891
888
|
}
|
|
892
889
|
});
|
|
@@ -923,13 +920,13 @@ var $e = M("field"), et = L(() => {
|
|
|
923
920
|
getByName: c
|
|
924
921
|
};
|
|
925
922
|
});
|
|
926
|
-
function
|
|
927
|
-
return R(
|
|
923
|
+
function nt() {
|
|
924
|
+
return R(tt);
|
|
928
925
|
}
|
|
929
926
|
//#endregion
|
|
930
927
|
//#region src/entities/step/step.ts
|
|
931
|
-
var
|
|
932
|
-
let e =
|
|
928
|
+
var rt = M("step"), it = L(() => {
|
|
929
|
+
let e = rt.store({}), t = j(e, { register(e, t) {
|
|
933
930
|
return {
|
|
934
931
|
...e,
|
|
935
932
|
[t.step.id]: t.step
|
|
@@ -953,16 +950,16 @@ var nt = M("step"), rt = L(() => {
|
|
|
953
950
|
indexStore: e
|
|
954
951
|
};
|
|
955
952
|
});
|
|
956
|
-
function
|
|
957
|
-
return R(
|
|
953
|
+
function at() {
|
|
954
|
+
return R(it);
|
|
958
955
|
}
|
|
959
|
-
function
|
|
956
|
+
function ot(e, t) {
|
|
960
957
|
t.register(e);
|
|
961
958
|
}
|
|
962
959
|
//#endregion
|
|
963
960
|
//#region src/entities/content/content.ts
|
|
964
|
-
var
|
|
965
|
-
let e =
|
|
961
|
+
var st = M("content"), ct = L(() => {
|
|
962
|
+
let e = st.store({}), t = j(e, {
|
|
966
963
|
register(e, t) {
|
|
967
964
|
return {
|
|
968
965
|
...e,
|
|
@@ -1003,16 +1000,16 @@ var ot = M("content"), st = L(() => {
|
|
|
1003
1000
|
indexStore: e
|
|
1004
1001
|
};
|
|
1005
1002
|
});
|
|
1006
|
-
function
|
|
1007
|
-
return R(
|
|
1003
|
+
function lt() {
|
|
1004
|
+
return R(ct);
|
|
1008
1005
|
}
|
|
1009
|
-
function
|
|
1006
|
+
function ut(e, t) {
|
|
1010
1007
|
t.register(e);
|
|
1011
1008
|
}
|
|
1012
1009
|
//#endregion
|
|
1013
1010
|
//#region src/entities/action/action.ts
|
|
1014
|
-
var
|
|
1015
|
-
let t =
|
|
1011
|
+
var dt = M("action"), ft = L(({ client: e }) => {
|
|
1012
|
+
let t = dt.store({}), n = j(t, { register(e, t) {
|
|
1016
1013
|
return {
|
|
1017
1014
|
...e,
|
|
1018
1015
|
[t.key]: {
|
|
@@ -1070,10 +1067,10 @@ var ut = M("action"), dt = L(({ client: e }) => {
|
|
|
1070
1067
|
getEvokableAction: s
|
|
1071
1068
|
};
|
|
1072
1069
|
});
|
|
1073
|
-
function
|
|
1074
|
-
return R(
|
|
1070
|
+
function pt(e) {
|
|
1071
|
+
return R(ft, e);
|
|
1075
1072
|
}
|
|
1076
|
-
var
|
|
1073
|
+
var mt = (e, t, n) => {
|
|
1077
1074
|
n.register({
|
|
1078
1075
|
key: e,
|
|
1079
1076
|
action: t
|
|
@@ -1092,35 +1089,35 @@ function J(e, t, n, r) {
|
|
|
1092
1089
|
function Y(e) {
|
|
1093
1090
|
return e === null || e === "" || Array.isArray(e) && !e.length;
|
|
1094
1091
|
}
|
|
1095
|
-
function
|
|
1092
|
+
function ht(e) {
|
|
1096
1093
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
|
|
1097
1094
|
}
|
|
1098
|
-
function
|
|
1095
|
+
function gt(e) {
|
|
1099
1096
|
try {
|
|
1100
1097
|
return JSON.stringify(e), !0;
|
|
1101
1098
|
} catch {
|
|
1102
1099
|
return !1;
|
|
1103
1100
|
}
|
|
1104
1101
|
}
|
|
1105
|
-
function
|
|
1102
|
+
function _t(e, t) {
|
|
1106
1103
|
return t.find((t) => t.key === e) ?? null;
|
|
1107
1104
|
}
|
|
1108
|
-
function
|
|
1105
|
+
function vt(e, t) {
|
|
1109
1106
|
return e.multiple && (typeof t == "string" || typeof t == "number" || typeof t == "boolean") ? [t] : t;
|
|
1110
1107
|
}
|
|
1111
|
-
function
|
|
1108
|
+
function yt(e, t) {
|
|
1112
1109
|
if (e.type !== "object" || Y(t)) return null;
|
|
1113
1110
|
if (e.multiple) {
|
|
1114
1111
|
if (!Array.isArray(t)) return J(e, t, "This field expects multiple values", "Field expects an array of objects.");
|
|
1115
1112
|
for (let n of t) {
|
|
1116
1113
|
if (typeof n != "object" || !n) return J(e, t, "This field expects object values", "Field expects an array of objects, but received non-object value.");
|
|
1117
|
-
if (!
|
|
1114
|
+
if (!gt(n)) return J(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
|
|
1118
1115
|
}
|
|
1119
1116
|
return null;
|
|
1120
1117
|
}
|
|
1121
|
-
return Array.isArray(t) ? J(e, t, "This field expects a single value", "Field expects a single object, not an array.") : typeof t != "object" || !t ? J(e, t, "This field expects an object value", "Field expects an object value.") :
|
|
1118
|
+
return Array.isArray(t) ? J(e, t, "This field expects a single value", "Field expects a single object, not an array.") : typeof t != "object" || !t ? J(e, t, "This field expects an object value", "Field expects an object value.") : gt(t) ? null : J(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
|
|
1122
1119
|
}
|
|
1123
|
-
function
|
|
1120
|
+
function bt(e, t) {
|
|
1124
1121
|
if (Y(t) || !Array.isArray(e.options) || e.options.length === 0) return null;
|
|
1125
1122
|
let n = Array.isArray(t) ? t : [t];
|
|
1126
1123
|
if (e.type === "object") {
|
|
@@ -1128,9 +1125,9 @@ function yt(e, t) {
|
|
|
1128
1125
|
return n.every((e) => r.has(JSON.stringify(e))) ? null : J(e, t, "This field expects a valid option", "Field expects a valid option from the defined choices.");
|
|
1129
1126
|
}
|
|
1130
1127
|
let r = e.options.map((e) => e.value);
|
|
1131
|
-
return n.every((e) => !
|
|
1128
|
+
return n.every((e) => !ht(e) || e === null ? !1 : r.includes(e)) ? null : J(e, t, "This field expects a valid option", `Field expects a valid option. Valid options are: ${r.join(", ")}`);
|
|
1132
1129
|
}
|
|
1133
|
-
async function
|
|
1130
|
+
async function xt(t, n, r, i) {
|
|
1134
1131
|
if (n.validation && !e(n.validation) && !Y(r)) {
|
|
1135
1132
|
let e = i ? {
|
|
1136
1133
|
$input: r,
|
|
@@ -1143,8 +1140,8 @@ async function bt(t, n, r, i) {
|
|
|
1143
1140
|
}
|
|
1144
1141
|
//#endregion
|
|
1145
1142
|
//#region src/entities/response/response.ts
|
|
1146
|
-
var
|
|
1147
|
-
let t =
|
|
1143
|
+
var St = M("response"), Ct = L(({ client: e }) => {
|
|
1144
|
+
let t = St.store({}), r = P(), i = P(), a = j(t, {
|
|
1148
1145
|
register(e, t) {
|
|
1149
1146
|
return {
|
|
1150
1147
|
...e,
|
|
@@ -1183,7 +1180,7 @@ var xt = M("response"), St = L(({ client: e }) => {
|
|
|
1183
1180
|
...t,
|
|
1184
1181
|
...n
|
|
1185
1182
|
}, o = Object.entries(n), c = await Promise.allSettled(o.map(async ([t, n]) => {
|
|
1186
|
-
let o =
|
|
1183
|
+
let o = _t(t, e);
|
|
1187
1184
|
if (!o) {
|
|
1188
1185
|
r.push({
|
|
1189
1186
|
fieldKey: t,
|
|
@@ -1193,17 +1190,17 @@ var xt = M("response"), St = L(({ client: e }) => {
|
|
|
1193
1190
|
});
|
|
1194
1191
|
return;
|
|
1195
1192
|
}
|
|
1196
|
-
let c =
|
|
1193
|
+
let c = vt(o, n), l = await xt(s, o, c, a);
|
|
1197
1194
|
if (l) {
|
|
1198
1195
|
r.push(l);
|
|
1199
1196
|
return;
|
|
1200
1197
|
}
|
|
1201
|
-
let u =
|
|
1198
|
+
let u = yt(o, c);
|
|
1202
1199
|
if (u) {
|
|
1203
1200
|
r.push(u);
|
|
1204
1201
|
return;
|
|
1205
1202
|
}
|
|
1206
|
-
let d =
|
|
1203
|
+
let d = bt(o, c);
|
|
1207
1204
|
if (d) {
|
|
1208
1205
|
r.push(d);
|
|
1209
1206
|
return;
|
|
@@ -1282,13 +1279,13 @@ var xt = M("response"), St = L(({ client: e }) => {
|
|
|
1282
1279
|
getByFieldName: _
|
|
1283
1280
|
};
|
|
1284
1281
|
});
|
|
1285
|
-
function
|
|
1286
|
-
return R(
|
|
1282
|
+
function wt(e) {
|
|
1283
|
+
return R(Ct, e);
|
|
1287
1284
|
}
|
|
1288
1285
|
//#endregion
|
|
1289
1286
|
//#region src/entities/condition/condition.ts
|
|
1290
|
-
var
|
|
1291
|
-
let e =
|
|
1287
|
+
var Tt = M("condition"), Et = L(() => {
|
|
1288
|
+
let e = Tt.store({}), t = j(e, { register(e, t) {
|
|
1292
1289
|
return {
|
|
1293
1290
|
...e,
|
|
1294
1291
|
[t.condition.id]: t.condition
|
|
@@ -1312,12 +1309,12 @@ var wt = M("condition"), Tt = L(() => {
|
|
|
1312
1309
|
indexStore: e
|
|
1313
1310
|
};
|
|
1314
1311
|
});
|
|
1315
|
-
function
|
|
1316
|
-
return R(
|
|
1312
|
+
function Dt() {
|
|
1313
|
+
return R(Et);
|
|
1317
1314
|
}
|
|
1318
1315
|
//#endregion
|
|
1319
1316
|
//#region src/utils/api-url.ts
|
|
1320
|
-
function
|
|
1317
|
+
function Ot() {
|
|
1321
1318
|
if (c()) {
|
|
1322
1319
|
let e = [
|
|
1323
1320
|
document.currentScript,
|
|
@@ -1332,7 +1329,7 @@ function Dt() {
|
|
|
1332
1329
|
}
|
|
1333
1330
|
//#endregion
|
|
1334
1331
|
//#region src/utils/search-params.ts
|
|
1335
|
-
function
|
|
1332
|
+
function kt() {
|
|
1336
1333
|
if (!s()) return {};
|
|
1337
1334
|
let e = new URLSearchParams(window.location.search), t = {}, n = /* @__PURE__ */ new Set();
|
|
1338
1335
|
for (let [t] of e.entries()) t.startsWith("picked-") && n.add(t);
|
|
@@ -1349,14 +1346,55 @@ function Ot() {
|
|
|
1349
1346
|
return t;
|
|
1350
1347
|
}
|
|
1351
1348
|
//#endregion
|
|
1349
|
+
//#region src/utils/user-timing.ts
|
|
1350
|
+
var At = "picked:start:begin", jt = "picked:start";
|
|
1351
|
+
function Mt() {
|
|
1352
|
+
try {
|
|
1353
|
+
return s() && !!p.window && "performance" in p;
|
|
1354
|
+
} catch {
|
|
1355
|
+
return !1;
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
function Nt() {
|
|
1359
|
+
let e = null, t = null;
|
|
1360
|
+
return {
|
|
1361
|
+
markBegin: () => {
|
|
1362
|
+
if (Mt()) try {
|
|
1363
|
+
e = performance.mark(At).startTime;
|
|
1364
|
+
} catch {}
|
|
1365
|
+
},
|
|
1366
|
+
measure: () => {
|
|
1367
|
+
if (!(!Mt() || e === null)) try {
|
|
1368
|
+
t = performance.measure(jt, { start: e });
|
|
1369
|
+
} catch {}
|
|
1370
|
+
},
|
|
1371
|
+
get startMeasure() {
|
|
1372
|
+
return t;
|
|
1373
|
+
}
|
|
1374
|
+
};
|
|
1375
|
+
}
|
|
1376
|
+
//#endregion
|
|
1377
|
+
//#region src/utils/client-telemetry.ts
|
|
1378
|
+
function Pt() {
|
|
1379
|
+
let e = null;
|
|
1380
|
+
return {
|
|
1381
|
+
observeDeliveryAPIRequests: (t) => {
|
|
1382
|
+
e = t;
|
|
1383
|
+
},
|
|
1384
|
+
get deliveryAPIRequestObserver() {
|
|
1385
|
+
return e;
|
|
1386
|
+
}
|
|
1387
|
+
};
|
|
1388
|
+
}
|
|
1389
|
+
//#endregion
|
|
1352
1390
|
//#region src/entities/session/session.ts
|
|
1353
|
-
var
|
|
1354
|
-
function
|
|
1355
|
-
return
|
|
1391
|
+
var Ft = O("session", "global");
|
|
1392
|
+
function It() {
|
|
1393
|
+
return m() ? crypto.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).substring(2, 15)}-${Math.random().toString(36).substring(2, 15)}-${Math.random().toString(36).substring(2, 15)}`;
|
|
1356
1394
|
}
|
|
1357
|
-
function
|
|
1358
|
-
if (!
|
|
1359
|
-
let e = E.get(
|
|
1395
|
+
function Lt() {
|
|
1396
|
+
if (!h()) return null;
|
|
1397
|
+
let e = E.get(Ft);
|
|
1360
1398
|
if (!e.isSet()) return null;
|
|
1361
1399
|
try {
|
|
1362
1400
|
return e.json();
|
|
@@ -1364,8 +1402,8 @@ function jt() {
|
|
|
1364
1402
|
return null;
|
|
1365
1403
|
}
|
|
1366
1404
|
}
|
|
1367
|
-
var
|
|
1368
|
-
let e =
|
|
1405
|
+
var Rt = L(() => {
|
|
1406
|
+
let e = Lt(), t = { id: e?.id ?? It() };
|
|
1369
1407
|
e?.isUser !== void 0 && (t.isUser = e.isUser), e?.identifiers && Object.keys(e.identifiers).length > 0 && (t.identifiers = e.identifiers);
|
|
1370
1408
|
let n = F(t), r = j(n, {
|
|
1371
1409
|
setIsUser: (e, t) => ({
|
|
@@ -1390,8 +1428,8 @@ var Mt = L(() => {
|
|
|
1390
1428
|
}), i = k({
|
|
1391
1429
|
source: n,
|
|
1392
1430
|
effect: (e) => {
|
|
1393
|
-
if (
|
|
1394
|
-
E.get(
|
|
1431
|
+
if (h()) try {
|
|
1432
|
+
E.get(Ft).set(e);
|
|
1395
1433
|
} catch {}
|
|
1396
1434
|
}
|
|
1397
1435
|
});
|
|
@@ -1405,27 +1443,27 @@ var Mt = L(() => {
|
|
|
1405
1443
|
removeIdentifier: r.removeIdentifier
|
|
1406
1444
|
};
|
|
1407
1445
|
});
|
|
1408
|
-
function
|
|
1409
|
-
return R(
|
|
1446
|
+
function zt() {
|
|
1447
|
+
return R(Rt, void 0);
|
|
1410
1448
|
}
|
|
1411
1449
|
//#endregion
|
|
1412
1450
|
//#region src/utils/picked-config.ts
|
|
1413
|
-
function
|
|
1451
|
+
function Bt() {
|
|
1414
1452
|
if (s()) return globalThis.window.pickedConfig;
|
|
1415
1453
|
}
|
|
1416
|
-
function
|
|
1417
|
-
if (s()) return
|
|
1454
|
+
function Vt() {
|
|
1455
|
+
if (s()) return Bt()?.projectId;
|
|
1418
1456
|
}
|
|
1419
|
-
function
|
|
1457
|
+
function Ht() {
|
|
1420
1458
|
if (!c()) return;
|
|
1421
1459
|
let e = document.getElementById("picked_script") || document.querySelector("script#picked") || document.getElementById("cvly");
|
|
1422
1460
|
if (e) return e.dataset.projectid || e.getAttribute("project-id") || void 0;
|
|
1423
1461
|
}
|
|
1424
|
-
function
|
|
1462
|
+
function Ut(e) {
|
|
1425
1463
|
if (e.projectId) return e.projectId;
|
|
1426
|
-
let t =
|
|
1464
|
+
let t = Vt();
|
|
1427
1465
|
if (t) return t;
|
|
1428
|
-
let n =
|
|
1466
|
+
let n = Ht();
|
|
1429
1467
|
if (n) return n;
|
|
1430
1468
|
throw Error("projectId is required. You can provide it via one of:\n (1) createClient({ projectId }) options;\n (2) window.pickedConfig = { projectId };\n (3) a <script> tag with id 'picked_script', 'picked', or 'cvly' that includes a data-projectid (or project-id) attribute.");
|
|
1431
1469
|
}
|
|
@@ -1434,7 +1472,7 @@ function Lt(e) {
|
|
|
1434
1472
|
function X(e) {
|
|
1435
1473
|
return e == null || e === "" || Number.isNaN(e);
|
|
1436
1474
|
}
|
|
1437
|
-
var
|
|
1475
|
+
var Wt = {
|
|
1438
1476
|
default: (e, t) => X(e) ? String(t ?? "") : String(e),
|
|
1439
1477
|
append: (e, t) => t && !X(e) ? `${e} ${t}` : e,
|
|
1440
1478
|
prepend: (e, t) => t && !X(e) ? `${t} ${e}` : e,
|
|
@@ -1455,24 +1493,24 @@ var Rt = {
|
|
|
1455
1493
|
return e instanceof Set ? t.format(Array.from(e).map(String)) : e;
|
|
1456
1494
|
}
|
|
1457
1495
|
};
|
|
1458
|
-
function
|
|
1496
|
+
function Gt(e) {
|
|
1459
1497
|
return typeof e == "object" && !!e;
|
|
1460
1498
|
}
|
|
1461
|
-
function
|
|
1499
|
+
function Kt(e, t) {
|
|
1462
1500
|
let n = t;
|
|
1463
|
-
for (let t of e.split(".")) if (
|
|
1501
|
+
for (let t of e.split(".")) if (Gt(n) && t in n) n = n[t];
|
|
1464
1502
|
else return;
|
|
1465
1503
|
return typeof n == "function" ? n() : n;
|
|
1466
1504
|
}
|
|
1467
|
-
function
|
|
1468
|
-
let n = e.split("|").map((e) => e.trim()), r =
|
|
1505
|
+
function qt(e, t) {
|
|
1506
|
+
let n = e.split("|").map((e) => e.trim()), r = Kt(n.shift() ?? "", t);
|
|
1469
1507
|
for (let e of n) {
|
|
1470
|
-
let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o =
|
|
1508
|
+
let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o = Wt[i];
|
|
1471
1509
|
o && (r = o(r, a));
|
|
1472
1510
|
}
|
|
1473
1511
|
return X(r) ? "" : typeof r == "object" ? JSON.stringify(r) : String(r);
|
|
1474
1512
|
}
|
|
1475
|
-
function
|
|
1513
|
+
function Jt(e, t) {
|
|
1476
1514
|
let n = "", r = 0;
|
|
1477
1515
|
for (; r < e.length;) if (e[r] === "{" && e[r + 1] === "{") {
|
|
1478
1516
|
r += 2;
|
|
@@ -1484,19 +1522,19 @@ function Ht(e, t) {
|
|
|
1484
1522
|
}
|
|
1485
1523
|
i += e[r++];
|
|
1486
1524
|
}
|
|
1487
|
-
n +=
|
|
1525
|
+
n += qt(i.trim(), t);
|
|
1488
1526
|
} else n += e[r++];
|
|
1489
1527
|
return n;
|
|
1490
1528
|
}
|
|
1491
1529
|
//#endregion
|
|
1492
1530
|
//#region src/utils/preview-session.ts
|
|
1493
|
-
var
|
|
1494
|
-
function
|
|
1495
|
-
return !s() || !
|
|
1531
|
+
var Yt = "preview-token";
|
|
1532
|
+
function Xt() {
|
|
1533
|
+
return !s() || !g() ? !1 : !!kt()[Yt]?.[0];
|
|
1496
1534
|
}
|
|
1497
1535
|
//#endregion
|
|
1498
1536
|
//#region src/picked.ts
|
|
1499
|
-
var
|
|
1537
|
+
var Zt = class {
|
|
1500
1538
|
static logger = r;
|
|
1501
1539
|
options;
|
|
1502
1540
|
dataSource = null;
|
|
@@ -1505,6 +1543,7 @@ var Gt = class {
|
|
|
1505
1543
|
contentLoader;
|
|
1506
1544
|
previewEmbedderOrigins = null;
|
|
1507
1545
|
plugins = {};
|
|
1546
|
+
telemetry = Pt();
|
|
1508
1547
|
dataProviders = /* @__PURE__ */ new Map();
|
|
1509
1548
|
eventBus = P();
|
|
1510
1549
|
events;
|
|
@@ -1512,53 +1551,55 @@ var Gt = class {
|
|
|
1512
1551
|
apiUrl;
|
|
1513
1552
|
dashboardUrl;
|
|
1514
1553
|
documentationSiteUrl;
|
|
1515
|
-
session =
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1554
|
+
session = zt();
|
|
1555
|
+
performance = Nt();
|
|
1556
|
+
searchParams = kt();
|
|
1557
|
+
history = Xe();
|
|
1558
|
+
components = Ce({ client: this });
|
|
1559
|
+
experienceInstances = C({ client: this });
|
|
1560
|
+
experiences = he({ client: this });
|
|
1561
|
+
frameworks = De({ client: this });
|
|
1562
|
+
predicates = Ke({ client: this });
|
|
1563
|
+
features = re({ client: this });
|
|
1564
|
+
conditions = Dt();
|
|
1565
|
+
fields = nt();
|
|
1566
|
+
responses = wt({ client: this });
|
|
1567
|
+
steps = at();
|
|
1568
|
+
contents = lt();
|
|
1569
|
+
actions = pt({ client: this });
|
|
1570
|
+
conditionResults = w();
|
|
1571
|
+
stateSnapshotStore = Ae({ client: this });
|
|
1572
|
+
evaluateRuleLogicFx = Re({ client: this });
|
|
1533
1573
|
start;
|
|
1534
1574
|
readyStore;
|
|
1535
1575
|
preconditionPassedStore;
|
|
1536
1576
|
conditionPassedStore;
|
|
1537
1577
|
lifecycleStageStore;
|
|
1538
|
-
lifecycle =
|
|
1578
|
+
lifecycle = Ue({ client: this });
|
|
1539
1579
|
renderStringFx = k({
|
|
1540
1580
|
source: this.responses.listStore,
|
|
1541
1581
|
effect: (e, { template: t, context: n }) => {
|
|
1542
1582
|
let r = {};
|
|
1543
1583
|
for (let t of e) r[t.fieldKey] = t.value;
|
|
1544
|
-
return
|
|
1584
|
+
return Jt(t, {
|
|
1545
1585
|
...n,
|
|
1546
1586
|
responses: r
|
|
1547
1587
|
});
|
|
1548
1588
|
}
|
|
1549
1589
|
});
|
|
1550
1590
|
constructor(e) {
|
|
1551
|
-
this.events =
|
|
1591
|
+
this.events = Qe(this.eventBus), this.projectId = Ut(e), this.options = Object.freeze(e), this.apiUrl = e.apiUrl || Ot(), this.dashboardUrl = e.dashboardUrl ?? "https://dashboard.picked.app", this.documentationSiteUrl = e.documentationSiteUrl ?? "https://docs.picked.app", this.start = this.lifecycle.start, this.readyStore = this.lifecycle.readyStore, this.preconditionPassedStore = this.lifecycle.preconditionPassedStore, this.conditionPassedStore = this.lifecycle.conditionPassedStore, this.lifecycleStageStore = this.lifecycle.lifecycleStageStore, this.setupPlugins(), this.setupFeatures(), this.setupPredicates(), this.setupActions(), this.setupFields(), this.setupComponents(), this.lifecycle.setPrecondition(e.precondition), this.lifecycle.setCondition(e.condition), this.eventBus({
|
|
1552
1592
|
type: "load",
|
|
1553
|
-
version:
|
|
1593
|
+
version: ae()
|
|
1554
1594
|
}), this.maybeStartPreviewChannel();
|
|
1555
1595
|
}
|
|
1556
1596
|
dataProviderFor(e) {
|
|
1557
1597
|
let t = e ?? "", n = this.dataProviders.get(t);
|
|
1558
1598
|
if (n) return n;
|
|
1559
|
-
let r = import("../provider-
|
|
1599
|
+
let r = import("../provider-DH9rfY2L.js").then((t) => t.createPickedDataProvider({
|
|
1560
1600
|
apiUrl: this.apiUrl,
|
|
1561
1601
|
projectId: this.projectId,
|
|
1602
|
+
getRequestObserver: () => this.telemetry.deliveryAPIRequestObserver,
|
|
1562
1603
|
...e !== void 0 && { previewToken: e }
|
|
1563
1604
|
}));
|
|
1564
1605
|
return this.dataProviders.set(t, r), r;
|
|
@@ -1572,24 +1613,24 @@ var Gt = class {
|
|
|
1572
1613
|
return (await this.dataProviderFor(t?.previewToken)).getContent(e, t?.signal === void 0 ? void 0 : { signal: t.signal });
|
|
1573
1614
|
}
|
|
1574
1615
|
maybeStartPreviewChannel() {
|
|
1575
|
-
|
|
1616
|
+
Xt() && import("../preview-channel-CSr96XAo.js").then((e) => e.initPreviewChannel(this)).catch(() => void 0);
|
|
1576
1617
|
}
|
|
1577
1618
|
registerFramework = (e) => {
|
|
1578
|
-
|
|
1619
|
+
Oe(e, this.frameworks);
|
|
1579
1620
|
};
|
|
1580
1621
|
registerComponent = (e, t) => {
|
|
1581
|
-
|
|
1622
|
+
we(e, t, this.components);
|
|
1582
1623
|
};
|
|
1583
1624
|
registerPlugin = (e) => {
|
|
1584
|
-
|
|
1625
|
+
ve(this, e, this.plugins);
|
|
1585
1626
|
let t = this.plugins[e.name];
|
|
1586
1627
|
t?.onStart && this.lifecycle.registerPluginStartHook(t.onStart);
|
|
1587
1628
|
};
|
|
1588
1629
|
registerFeature = (e, t) => {
|
|
1589
|
-
|
|
1630
|
+
ne(e, t, this.features);
|
|
1590
1631
|
};
|
|
1591
1632
|
registerPredicate = (e, t) => {
|
|
1592
|
-
|
|
1633
|
+
qe(e, t, this.predicates);
|
|
1593
1634
|
};
|
|
1594
1635
|
registerCondition = (e) => {
|
|
1595
1636
|
this.conditions.register(e);
|
|
@@ -1598,19 +1639,19 @@ var Gt = class {
|
|
|
1598
1639
|
this.fields.register(e);
|
|
1599
1640
|
};
|
|
1600
1641
|
registerStep = (e) => {
|
|
1601
|
-
|
|
1642
|
+
ot(e, this.steps);
|
|
1602
1643
|
};
|
|
1603
1644
|
registerContent = (e) => {
|
|
1604
|
-
|
|
1645
|
+
ut(e, this.contents);
|
|
1605
1646
|
};
|
|
1606
1647
|
patchContent = (e, t) => {
|
|
1607
1648
|
this.contents.patch(e, t);
|
|
1608
1649
|
};
|
|
1609
1650
|
registerAction = (e, t) => {
|
|
1610
|
-
|
|
1651
|
+
mt(e, t, this.actions);
|
|
1611
1652
|
};
|
|
1612
1653
|
registerExperience = (e) => {
|
|
1613
|
-
e.component &&
|
|
1654
|
+
e.component && we(`experience:${e.id}`, e.component, this.components), this.experiences.register(e);
|
|
1614
1655
|
};
|
|
1615
1656
|
launchExperienceById = async (e, t) => {
|
|
1616
1657
|
this.experiences.launch({
|
|
@@ -1653,7 +1694,7 @@ var Gt = class {
|
|
|
1653
1694
|
this.registerFeature(e, n);
|
|
1654
1695
|
}), this.searchParams.feature && this.searchParams.feature.forEach((e) => {
|
|
1655
1696
|
try {
|
|
1656
|
-
let t =
|
|
1697
|
+
let t = ie(e);
|
|
1657
1698
|
if (!t) return;
|
|
1658
1699
|
let { id: n, bucket: r } = t;
|
|
1659
1700
|
this.registerFeature(n, {
|
|
@@ -1703,8 +1744,8 @@ var Gt = class {
|
|
|
1703
1744
|
});
|
|
1704
1745
|
}
|
|
1705
1746
|
getPluginConfig = (e) => this.plugins[e] ?? {};
|
|
1706
|
-
},
|
|
1707
|
-
async function
|
|
1747
|
+
}, Qt = "application/picked-javascript", $t = "application/picked-module", en = "data-picked-hydrated";
|
|
1748
|
+
async function tn(e) {
|
|
1708
1749
|
if (!("document" in globalThis)) return;
|
|
1709
1750
|
let t = "application/picked-module", n = "data-picked-hydrated";
|
|
1710
1751
|
function r(e) {
|
|
@@ -1733,23 +1774,23 @@ async function Yt(e) {
|
|
|
1733
1774
|
a && await a;
|
|
1734
1775
|
}
|
|
1735
1776
|
}
|
|
1736
|
-
function
|
|
1737
|
-
return `<script>(${
|
|
1777
|
+
function nn() {
|
|
1778
|
+
return `<script>(${tn.toString()})(document)<\/script>`;
|
|
1738
1779
|
}
|
|
1739
1780
|
//#endregion
|
|
1740
1781
|
//#region src/utils/html-asset-value.ts
|
|
1741
|
-
function
|
|
1782
|
+
function rn(e) {
|
|
1742
1783
|
return typeof e == "object" && !!e && "id" in e && typeof e.id == "string" && "content" in e && (typeof e.content == "string" || e.content === null);
|
|
1743
1784
|
}
|
|
1744
1785
|
//#endregion
|
|
1745
1786
|
//#region src/entities/component/lazyComponent.ts
|
|
1746
|
-
function
|
|
1787
|
+
function an(e) {
|
|
1747
1788
|
return {
|
|
1748
1789
|
$$type: "lazy-component",
|
|
1749
1790
|
load: e
|
|
1750
1791
|
};
|
|
1751
1792
|
}
|
|
1752
|
-
function
|
|
1793
|
+
function on(e) {
|
|
1753
1794
|
return typeof e == "object" && !!e && "$$type" in e && e.$$type === "lazy-component";
|
|
1754
1795
|
}
|
|
1755
1796
|
//#endregion
|
|
@@ -1765,10 +1806,10 @@ function $(e) {
|
|
|
1765
1806
|
for (let e of t) Z(e) && n.push(e.contentEntryId);
|
|
1766
1807
|
return n;
|
|
1767
1808
|
}
|
|
1768
|
-
function
|
|
1809
|
+
function sn(e, t) {
|
|
1769
1810
|
return t === null ? null : e[t] ?? null;
|
|
1770
1811
|
}
|
|
1771
|
-
function
|
|
1812
|
+
function cn(e, t) {
|
|
1772
1813
|
let n = [];
|
|
1773
1814
|
for (let r of t) {
|
|
1774
1815
|
let t = e[r];
|
|
@@ -1776,29 +1817,29 @@ function tn(e, t) {
|
|
|
1776
1817
|
}
|
|
1777
1818
|
return n;
|
|
1778
1819
|
}
|
|
1779
|
-
function
|
|
1780
|
-
if (
|
|
1820
|
+
function ln(e, t) {
|
|
1821
|
+
if (ue.store(t)) return A(t, e.indexStore, (e, t) => sn(t, Q(e)));
|
|
1781
1822
|
let n = Q(t);
|
|
1782
|
-
return e.indexStore.map((e) =>
|
|
1823
|
+
return e.indexStore.map((e) => sn(e, n), { skipVoid: !1 });
|
|
1783
1824
|
}
|
|
1784
|
-
function
|
|
1785
|
-
if (
|
|
1825
|
+
function un(e, t) {
|
|
1826
|
+
if (ue.store(t)) return A(t, e.indexStore, (e, t) => cn(t, $(e)));
|
|
1786
1827
|
let n = $(t);
|
|
1787
|
-
return e.indexStore.map((e) =>
|
|
1828
|
+
return e.indexStore.map((e) => cn(e, n), { skipVoid: !1 });
|
|
1788
1829
|
}
|
|
1789
1830
|
//#endregion
|
|
1790
1831
|
//#region src/exports.ts
|
|
1791
|
-
var
|
|
1792
|
-
let t = new
|
|
1832
|
+
var dn = (e) => {
|
|
1833
|
+
let t = new Zt(e);
|
|
1793
1834
|
return u(t), t;
|
|
1794
1835
|
};
|
|
1795
1836
|
//#endregion
|
|
1796
1837
|
//#region src/typed-content.ts
|
|
1797
|
-
function
|
|
1838
|
+
function fn(e) {
|
|
1798
1839
|
return typeof e.data == "object";
|
|
1799
1840
|
}
|
|
1800
|
-
function
|
|
1801
|
-
return e.map((e) => !e || !
|
|
1841
|
+
function pn(e) {
|
|
1842
|
+
return e.map((e) => !e || !fn(e) ? null : e, { skipVoid: !1 });
|
|
1802
1843
|
}
|
|
1803
1844
|
//#endregion
|
|
1804
|
-
export {
|
|
1845
|
+
export { en as PICKED_HYDRATED_ATTR, $t as PICKED_MODULE_SCRIPT_TYPE, Qt as PICKED_SCRIPT_TYPE, Yt as PREVIEW_TOKEN_PARAM, Zt as Picked, nn as buildRehydrateBootstrap, dn as createClient, _e as createPluginEffect, O as createStorageKey, ln as deriveReference, un as deriveReferences, n as evaluateRuleLogic, Bt as getPickedConfig, Z as isContentReference, rn as isHtmlAssetValue, g as isInsideIframe, on as isLazyLoader, v as isPickedRoot, Xt as isPreviewSession, an as lazyComponent, E as localStore, le as onInertScriptSubtrees, Q as readReferenceId, $ as readReferenceIds, tn as rehydrateScripts, se as reportInertScriptSubtrees, ce as resetInertScriptReport, D as sessionStore, te as subscribe, d as supportsCookies, m as supportsCryptoRandomUUID, c as supportsDocument, i as supportsHistory, f as supportsIntersectionObserver, h as supportsLocalStorage, a as supportsLocation, l as supportsSessionStorage, _ as supportsShadowRoot, o as supportsWebComponents, s as supportsWindow, pn as toTypedContentStore };
|