@picked/client 0.0.78-next.1 → 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-Dn3wRYEQ.js → api-DxTpQr1S.js} +1 -1
- package/dist/{api-By8zcDyl.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/responses-browser-storage/index.js +1 -1
- package/dist/cjs/plugins/responses-indexeddb/index.js +1 -1
- package/dist/cjs/plugins/telemetry/index.js +1 -0
- package/dist/cjs/server/index.js +1 -1
- package/dist/docs/reference/dashboard/fields.mdx +17 -11
- package/dist/docs/reference/sdk/fields.md +6 -6
- package/dist/emit-D-tLiWL1.cjs +1 -0
- package/dist/emit-Ds2EG7CB.js +14 -0
- package/dist/esm/index.js +288 -230
- package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
- package/dist/esm/plugins/responses-browser-storage/index.js +1 -1
- package/dist/esm/plugins/responses-indexeddb/index.js +1 -1
- package/dist/esm/plugins/telemetry/index.js +97 -0
- package/dist/esm/server/index.js +1 -1
- package/dist/{plugin-D-3AO0cS.js → plugin-Bx7a4qw2.js} +2 -2
- package/dist/{plugin-CjybJRgo.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/field/field.d.ts +6 -7
- package/dist/types/entities/field/field.d.ts.map +1 -1
- package/dist/types/entities/field/policies.d.ts +35 -0
- package/dist/types/entities/field/policies.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/index.d.ts +1 -0
- package/dist/types/index.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/create-experience/create-experience.d.ts +3 -8
- package/dist/types/plugins/create-experience/create-experience.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-US7ZKOT_.js → version-CWSfnbGk.js} +1 -1
- package/dist/{version-C5wBj-TI.cjs → version-D9Eq71fx.cjs} +1 -1
- package/package.json +16 -4
- package/dist/provider-C4jR07Qd.cjs +0 -1
- package/dist/provider-Dx-9dqeo.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,32 +842,49 @@ 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
|
-
}
|
|
861
|
-
|
|
857
|
+
};
|
|
858
|
+
//#endregion
|
|
859
|
+
//#region src/entities/field/policies.ts
|
|
860
|
+
function $e(e) {
|
|
861
|
+
let { doNotTrackValue: t, doNotStoreValue: n } = e ?? {}, r = e?.trackValue ?? t === !1, i = e?.storeValue ?? n === !1;
|
|
862
|
+
return {
|
|
863
|
+
trackValue: r,
|
|
864
|
+
storeValue: i,
|
|
865
|
+
doNotTrackValue: !r,
|
|
866
|
+
doNotStoreValue: !i
|
|
867
|
+
};
|
|
868
|
+
}
|
|
869
|
+
//#endregion
|
|
870
|
+
//#region src/entities/field/field.ts
|
|
871
|
+
var et = M("field"), tt = L(() => {
|
|
872
|
+
let e = et.store({}), t = j(e, {
|
|
862
873
|
register(e, t) {
|
|
874
|
+
let n = Object.assign({}, t.field, { policies: $e(t.field.policies) });
|
|
863
875
|
return {
|
|
864
876
|
...e,
|
|
865
|
-
[
|
|
877
|
+
[n.id]: n
|
|
866
878
|
};
|
|
867
879
|
},
|
|
868
880
|
updateByKey(e, t) {
|
|
869
881
|
let n = Object.values(e).find((e) => e.key === t.fieldKey);
|
|
870
|
-
|
|
882
|
+
if (!n) return e;
|
|
883
|
+
let r = Object.assign({}, n, t.updates);
|
|
884
|
+
return {
|
|
871
885
|
...e,
|
|
872
|
-
[n.id]: Object.assign({},
|
|
873
|
-
}
|
|
886
|
+
[n.id]: Object.assign({}, r, { policies: $e(r.policies) })
|
|
887
|
+
};
|
|
874
888
|
}
|
|
875
889
|
});
|
|
876
890
|
function n(e) {
|
|
@@ -906,13 +920,13 @@ var Xe = 0, Ze = (e) => {
|
|
|
906
920
|
getByName: c
|
|
907
921
|
};
|
|
908
922
|
});
|
|
909
|
-
function
|
|
910
|
-
return R(
|
|
923
|
+
function nt() {
|
|
924
|
+
return R(tt);
|
|
911
925
|
}
|
|
912
926
|
//#endregion
|
|
913
927
|
//#region src/entities/step/step.ts
|
|
914
|
-
var
|
|
915
|
-
let e =
|
|
928
|
+
var rt = M("step"), it = L(() => {
|
|
929
|
+
let e = rt.store({}), t = j(e, { register(e, t) {
|
|
916
930
|
return {
|
|
917
931
|
...e,
|
|
918
932
|
[t.step.id]: t.step
|
|
@@ -936,16 +950,16 @@ var tt = M("step"), nt = L(() => {
|
|
|
936
950
|
indexStore: e
|
|
937
951
|
};
|
|
938
952
|
});
|
|
939
|
-
function
|
|
940
|
-
return R(
|
|
953
|
+
function at() {
|
|
954
|
+
return R(it);
|
|
941
955
|
}
|
|
942
|
-
function
|
|
956
|
+
function ot(e, t) {
|
|
943
957
|
t.register(e);
|
|
944
958
|
}
|
|
945
959
|
//#endregion
|
|
946
960
|
//#region src/entities/content/content.ts
|
|
947
|
-
var
|
|
948
|
-
let e =
|
|
961
|
+
var st = M("content"), ct = L(() => {
|
|
962
|
+
let e = st.store({}), t = j(e, {
|
|
949
963
|
register(e, t) {
|
|
950
964
|
return {
|
|
951
965
|
...e,
|
|
@@ -986,16 +1000,16 @@ var at = M("content"), ot = L(() => {
|
|
|
986
1000
|
indexStore: e
|
|
987
1001
|
};
|
|
988
1002
|
});
|
|
989
|
-
function
|
|
990
|
-
return R(
|
|
1003
|
+
function lt() {
|
|
1004
|
+
return R(ct);
|
|
991
1005
|
}
|
|
992
|
-
function
|
|
1006
|
+
function ut(e, t) {
|
|
993
1007
|
t.register(e);
|
|
994
1008
|
}
|
|
995
1009
|
//#endregion
|
|
996
1010
|
//#region src/entities/action/action.ts
|
|
997
|
-
var
|
|
998
|
-
let t =
|
|
1011
|
+
var dt = M("action"), ft = L(({ client: e }) => {
|
|
1012
|
+
let t = dt.store({}), n = j(t, { register(e, t) {
|
|
999
1013
|
return {
|
|
1000
1014
|
...e,
|
|
1001
1015
|
[t.key]: {
|
|
@@ -1053,10 +1067,10 @@ var lt = M("action"), ut = L(({ client: e }) => {
|
|
|
1053
1067
|
getEvokableAction: s
|
|
1054
1068
|
};
|
|
1055
1069
|
});
|
|
1056
|
-
function
|
|
1057
|
-
return R(
|
|
1070
|
+
function pt(e) {
|
|
1071
|
+
return R(ft, e);
|
|
1058
1072
|
}
|
|
1059
|
-
var
|
|
1073
|
+
var mt = (e, t, n) => {
|
|
1060
1074
|
n.register({
|
|
1061
1075
|
key: e,
|
|
1062
1076
|
action: t
|
|
@@ -1075,35 +1089,35 @@ function J(e, t, n, r) {
|
|
|
1075
1089
|
function Y(e) {
|
|
1076
1090
|
return e === null || e === "" || Array.isArray(e) && !e.length;
|
|
1077
1091
|
}
|
|
1078
|
-
function
|
|
1092
|
+
function ht(e) {
|
|
1079
1093
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
|
|
1080
1094
|
}
|
|
1081
|
-
function
|
|
1095
|
+
function gt(e) {
|
|
1082
1096
|
try {
|
|
1083
1097
|
return JSON.stringify(e), !0;
|
|
1084
1098
|
} catch {
|
|
1085
1099
|
return !1;
|
|
1086
1100
|
}
|
|
1087
1101
|
}
|
|
1088
|
-
function
|
|
1102
|
+
function _t(e, t) {
|
|
1089
1103
|
return t.find((t) => t.key === e) ?? null;
|
|
1090
1104
|
}
|
|
1091
|
-
function
|
|
1105
|
+
function vt(e, t) {
|
|
1092
1106
|
return e.multiple && (typeof t == "string" || typeof t == "number" || typeof t == "boolean") ? [t] : t;
|
|
1093
1107
|
}
|
|
1094
|
-
function
|
|
1108
|
+
function yt(e, t) {
|
|
1095
1109
|
if (e.type !== "object" || Y(t)) return null;
|
|
1096
1110
|
if (e.multiple) {
|
|
1097
1111
|
if (!Array.isArray(t)) return J(e, t, "This field expects multiple values", "Field expects an array of objects.");
|
|
1098
1112
|
for (let n of t) {
|
|
1099
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.");
|
|
1100
|
-
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.).");
|
|
1101
1115
|
}
|
|
1102
1116
|
return null;
|
|
1103
1117
|
}
|
|
1104
|
-
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.).");
|
|
1105
1119
|
}
|
|
1106
|
-
function
|
|
1120
|
+
function bt(e, t) {
|
|
1107
1121
|
if (Y(t) || !Array.isArray(e.options) || e.options.length === 0) return null;
|
|
1108
1122
|
let n = Array.isArray(t) ? t : [t];
|
|
1109
1123
|
if (e.type === "object") {
|
|
@@ -1111,9 +1125,9 @@ function vt(e, t) {
|
|
|
1111
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.");
|
|
1112
1126
|
}
|
|
1113
1127
|
let r = e.options.map((e) => e.value);
|
|
1114
|
-
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(", ")}`);
|
|
1115
1129
|
}
|
|
1116
|
-
async function
|
|
1130
|
+
async function xt(t, n, r, i) {
|
|
1117
1131
|
if (n.validation && !e(n.validation) && !Y(r)) {
|
|
1118
1132
|
let e = i ? {
|
|
1119
1133
|
$input: r,
|
|
@@ -1126,8 +1140,8 @@ async function yt(t, n, r, i) {
|
|
|
1126
1140
|
}
|
|
1127
1141
|
//#endregion
|
|
1128
1142
|
//#region src/entities/response/response.ts
|
|
1129
|
-
var
|
|
1130
|
-
let t =
|
|
1143
|
+
var St = M("response"), Ct = L(({ client: e }) => {
|
|
1144
|
+
let t = St.store({}), r = P(), i = P(), a = j(t, {
|
|
1131
1145
|
register(e, t) {
|
|
1132
1146
|
return {
|
|
1133
1147
|
...e,
|
|
@@ -1166,7 +1180,7 @@ var bt = M("response"), xt = L(({ client: e }) => {
|
|
|
1166
1180
|
...t,
|
|
1167
1181
|
...n
|
|
1168
1182
|
}, o = Object.entries(n), c = await Promise.allSettled(o.map(async ([t, n]) => {
|
|
1169
|
-
let o =
|
|
1183
|
+
let o = _t(t, e);
|
|
1170
1184
|
if (!o) {
|
|
1171
1185
|
r.push({
|
|
1172
1186
|
fieldKey: t,
|
|
@@ -1176,17 +1190,17 @@ var bt = M("response"), xt = L(({ client: e }) => {
|
|
|
1176
1190
|
});
|
|
1177
1191
|
return;
|
|
1178
1192
|
}
|
|
1179
|
-
let c =
|
|
1193
|
+
let c = vt(o, n), l = await xt(s, o, c, a);
|
|
1180
1194
|
if (l) {
|
|
1181
1195
|
r.push(l);
|
|
1182
1196
|
return;
|
|
1183
1197
|
}
|
|
1184
|
-
let u =
|
|
1198
|
+
let u = yt(o, c);
|
|
1185
1199
|
if (u) {
|
|
1186
1200
|
r.push(u);
|
|
1187
1201
|
return;
|
|
1188
1202
|
}
|
|
1189
|
-
let d =
|
|
1203
|
+
let d = bt(o, c);
|
|
1190
1204
|
if (d) {
|
|
1191
1205
|
r.push(d);
|
|
1192
1206
|
return;
|
|
@@ -1265,13 +1279,13 @@ var bt = M("response"), xt = L(({ client: e }) => {
|
|
|
1265
1279
|
getByFieldName: _
|
|
1266
1280
|
};
|
|
1267
1281
|
});
|
|
1268
|
-
function
|
|
1269
|
-
return R(
|
|
1282
|
+
function wt(e) {
|
|
1283
|
+
return R(Ct, e);
|
|
1270
1284
|
}
|
|
1271
1285
|
//#endregion
|
|
1272
1286
|
//#region src/entities/condition/condition.ts
|
|
1273
|
-
var
|
|
1274
|
-
let e =
|
|
1287
|
+
var Tt = M("condition"), Et = L(() => {
|
|
1288
|
+
let e = Tt.store({}), t = j(e, { register(e, t) {
|
|
1275
1289
|
return {
|
|
1276
1290
|
...e,
|
|
1277
1291
|
[t.condition.id]: t.condition
|
|
@@ -1295,12 +1309,12 @@ var Ct = M("condition"), wt = L(() => {
|
|
|
1295
1309
|
indexStore: e
|
|
1296
1310
|
};
|
|
1297
1311
|
});
|
|
1298
|
-
function
|
|
1299
|
-
return R(
|
|
1312
|
+
function Dt() {
|
|
1313
|
+
return R(Et);
|
|
1300
1314
|
}
|
|
1301
1315
|
//#endregion
|
|
1302
1316
|
//#region src/utils/api-url.ts
|
|
1303
|
-
function
|
|
1317
|
+
function Ot() {
|
|
1304
1318
|
if (c()) {
|
|
1305
1319
|
let e = [
|
|
1306
1320
|
document.currentScript,
|
|
@@ -1315,7 +1329,7 @@ function Et() {
|
|
|
1315
1329
|
}
|
|
1316
1330
|
//#endregion
|
|
1317
1331
|
//#region src/utils/search-params.ts
|
|
1318
|
-
function
|
|
1332
|
+
function kt() {
|
|
1319
1333
|
if (!s()) return {};
|
|
1320
1334
|
let e = new URLSearchParams(window.location.search), t = {}, n = /* @__PURE__ */ new Set();
|
|
1321
1335
|
for (let [t] of e.entries()) t.startsWith("picked-") && n.add(t);
|
|
@@ -1332,14 +1346,55 @@ function Dt() {
|
|
|
1332
1346
|
return t;
|
|
1333
1347
|
}
|
|
1334
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
|
|
1335
1390
|
//#region src/entities/session/session.ts
|
|
1336
|
-
var
|
|
1337
|
-
function
|
|
1338
|
-
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)}`;
|
|
1339
1394
|
}
|
|
1340
|
-
function
|
|
1341
|
-
if (!
|
|
1342
|
-
let e = E.get(
|
|
1395
|
+
function Lt() {
|
|
1396
|
+
if (!h()) return null;
|
|
1397
|
+
let e = E.get(Ft);
|
|
1343
1398
|
if (!e.isSet()) return null;
|
|
1344
1399
|
try {
|
|
1345
1400
|
return e.json();
|
|
@@ -1347,8 +1402,8 @@ function At() {
|
|
|
1347
1402
|
return null;
|
|
1348
1403
|
}
|
|
1349
1404
|
}
|
|
1350
|
-
var
|
|
1351
|
-
let e =
|
|
1405
|
+
var Rt = L(() => {
|
|
1406
|
+
let e = Lt(), t = { id: e?.id ?? It() };
|
|
1352
1407
|
e?.isUser !== void 0 && (t.isUser = e.isUser), e?.identifiers && Object.keys(e.identifiers).length > 0 && (t.identifiers = e.identifiers);
|
|
1353
1408
|
let n = F(t), r = j(n, {
|
|
1354
1409
|
setIsUser: (e, t) => ({
|
|
@@ -1373,8 +1428,8 @@ var jt = L(() => {
|
|
|
1373
1428
|
}), i = k({
|
|
1374
1429
|
source: n,
|
|
1375
1430
|
effect: (e) => {
|
|
1376
|
-
if (
|
|
1377
|
-
E.get(
|
|
1431
|
+
if (h()) try {
|
|
1432
|
+
E.get(Ft).set(e);
|
|
1378
1433
|
} catch {}
|
|
1379
1434
|
}
|
|
1380
1435
|
});
|
|
@@ -1388,27 +1443,27 @@ var jt = L(() => {
|
|
|
1388
1443
|
removeIdentifier: r.removeIdentifier
|
|
1389
1444
|
};
|
|
1390
1445
|
});
|
|
1391
|
-
function
|
|
1392
|
-
return R(
|
|
1446
|
+
function zt() {
|
|
1447
|
+
return R(Rt, void 0);
|
|
1393
1448
|
}
|
|
1394
1449
|
//#endregion
|
|
1395
1450
|
//#region src/utils/picked-config.ts
|
|
1396
|
-
function
|
|
1451
|
+
function Bt() {
|
|
1397
1452
|
if (s()) return globalThis.window.pickedConfig;
|
|
1398
1453
|
}
|
|
1399
|
-
function
|
|
1400
|
-
if (s()) return
|
|
1454
|
+
function Vt() {
|
|
1455
|
+
if (s()) return Bt()?.projectId;
|
|
1401
1456
|
}
|
|
1402
|
-
function
|
|
1457
|
+
function Ht() {
|
|
1403
1458
|
if (!c()) return;
|
|
1404
1459
|
let e = document.getElementById("picked_script") || document.querySelector("script#picked") || document.getElementById("cvly");
|
|
1405
1460
|
if (e) return e.dataset.projectid || e.getAttribute("project-id") || void 0;
|
|
1406
1461
|
}
|
|
1407
|
-
function
|
|
1462
|
+
function Ut(e) {
|
|
1408
1463
|
if (e.projectId) return e.projectId;
|
|
1409
|
-
let t =
|
|
1464
|
+
let t = Vt();
|
|
1410
1465
|
if (t) return t;
|
|
1411
|
-
let n =
|
|
1466
|
+
let n = Ht();
|
|
1412
1467
|
if (n) return n;
|
|
1413
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.");
|
|
1414
1469
|
}
|
|
@@ -1417,7 +1472,7 @@ function It(e) {
|
|
|
1417
1472
|
function X(e) {
|
|
1418
1473
|
return e == null || e === "" || Number.isNaN(e);
|
|
1419
1474
|
}
|
|
1420
|
-
var
|
|
1475
|
+
var Wt = {
|
|
1421
1476
|
default: (e, t) => X(e) ? String(t ?? "") : String(e),
|
|
1422
1477
|
append: (e, t) => t && !X(e) ? `${e} ${t}` : e,
|
|
1423
1478
|
prepend: (e, t) => t && !X(e) ? `${t} ${e}` : e,
|
|
@@ -1438,24 +1493,24 @@ var Lt = {
|
|
|
1438
1493
|
return e instanceof Set ? t.format(Array.from(e).map(String)) : e;
|
|
1439
1494
|
}
|
|
1440
1495
|
};
|
|
1441
|
-
function
|
|
1496
|
+
function Gt(e) {
|
|
1442
1497
|
return typeof e == "object" && !!e;
|
|
1443
1498
|
}
|
|
1444
|
-
function
|
|
1499
|
+
function Kt(e, t) {
|
|
1445
1500
|
let n = t;
|
|
1446
|
-
for (let t of e.split(".")) if (
|
|
1501
|
+
for (let t of e.split(".")) if (Gt(n) && t in n) n = n[t];
|
|
1447
1502
|
else return;
|
|
1448
1503
|
return typeof n == "function" ? n() : n;
|
|
1449
1504
|
}
|
|
1450
|
-
function
|
|
1451
|
-
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);
|
|
1452
1507
|
for (let e of n) {
|
|
1453
|
-
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];
|
|
1454
1509
|
o && (r = o(r, a));
|
|
1455
1510
|
}
|
|
1456
1511
|
return X(r) ? "" : typeof r == "object" ? JSON.stringify(r) : String(r);
|
|
1457
1512
|
}
|
|
1458
|
-
function
|
|
1513
|
+
function Jt(e, t) {
|
|
1459
1514
|
let n = "", r = 0;
|
|
1460
1515
|
for (; r < e.length;) if (e[r] === "{" && e[r + 1] === "{") {
|
|
1461
1516
|
r += 2;
|
|
@@ -1467,19 +1522,19 @@ function Vt(e, t) {
|
|
|
1467
1522
|
}
|
|
1468
1523
|
i += e[r++];
|
|
1469
1524
|
}
|
|
1470
|
-
n +=
|
|
1525
|
+
n += qt(i.trim(), t);
|
|
1471
1526
|
} else n += e[r++];
|
|
1472
1527
|
return n;
|
|
1473
1528
|
}
|
|
1474
1529
|
//#endregion
|
|
1475
1530
|
//#region src/utils/preview-session.ts
|
|
1476
|
-
var
|
|
1477
|
-
function
|
|
1478
|
-
return !s() || !
|
|
1531
|
+
var Yt = "preview-token";
|
|
1532
|
+
function Xt() {
|
|
1533
|
+
return !s() || !g() ? !1 : !!kt()[Yt]?.[0];
|
|
1479
1534
|
}
|
|
1480
1535
|
//#endregion
|
|
1481
1536
|
//#region src/picked.ts
|
|
1482
|
-
var
|
|
1537
|
+
var Zt = class {
|
|
1483
1538
|
static logger = r;
|
|
1484
1539
|
options;
|
|
1485
1540
|
dataSource = null;
|
|
@@ -1488,6 +1543,7 @@ var Wt = class {
|
|
|
1488
1543
|
contentLoader;
|
|
1489
1544
|
previewEmbedderOrigins = null;
|
|
1490
1545
|
plugins = {};
|
|
1546
|
+
telemetry = Pt();
|
|
1491
1547
|
dataProviders = /* @__PURE__ */ new Map();
|
|
1492
1548
|
eventBus = P();
|
|
1493
1549
|
events;
|
|
@@ -1495,53 +1551,55 @@ var Wt = class {
|
|
|
1495
1551
|
apiUrl;
|
|
1496
1552
|
dashboardUrl;
|
|
1497
1553
|
documentationSiteUrl;
|
|
1498
|
-
session =
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
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 });
|
|
1516
1573
|
start;
|
|
1517
1574
|
readyStore;
|
|
1518
1575
|
preconditionPassedStore;
|
|
1519
1576
|
conditionPassedStore;
|
|
1520
1577
|
lifecycleStageStore;
|
|
1521
|
-
lifecycle =
|
|
1578
|
+
lifecycle = Ue({ client: this });
|
|
1522
1579
|
renderStringFx = k({
|
|
1523
1580
|
source: this.responses.listStore,
|
|
1524
1581
|
effect: (e, { template: t, context: n }) => {
|
|
1525
1582
|
let r = {};
|
|
1526
1583
|
for (let t of e) r[t.fieldKey] = t.value;
|
|
1527
|
-
return
|
|
1584
|
+
return Jt(t, {
|
|
1528
1585
|
...n,
|
|
1529
1586
|
responses: r
|
|
1530
1587
|
});
|
|
1531
1588
|
}
|
|
1532
1589
|
});
|
|
1533
1590
|
constructor(e) {
|
|
1534
|
-
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({
|
|
1535
1592
|
type: "load",
|
|
1536
|
-
version:
|
|
1593
|
+
version: ae()
|
|
1537
1594
|
}), this.maybeStartPreviewChannel();
|
|
1538
1595
|
}
|
|
1539
1596
|
dataProviderFor(e) {
|
|
1540
1597
|
let t = e ?? "", n = this.dataProviders.get(t);
|
|
1541
1598
|
if (n) return n;
|
|
1542
|
-
let r = import("../provider-
|
|
1599
|
+
let r = import("../provider-DH9rfY2L.js").then((t) => t.createPickedDataProvider({
|
|
1543
1600
|
apiUrl: this.apiUrl,
|
|
1544
1601
|
projectId: this.projectId,
|
|
1602
|
+
getRequestObserver: () => this.telemetry.deliveryAPIRequestObserver,
|
|
1545
1603
|
...e !== void 0 && { previewToken: e }
|
|
1546
1604
|
}));
|
|
1547
1605
|
return this.dataProviders.set(t, r), r;
|
|
@@ -1555,24 +1613,24 @@ var Wt = class {
|
|
|
1555
1613
|
return (await this.dataProviderFor(t?.previewToken)).getContent(e, t?.signal === void 0 ? void 0 : { signal: t.signal });
|
|
1556
1614
|
}
|
|
1557
1615
|
maybeStartPreviewChannel() {
|
|
1558
|
-
|
|
1616
|
+
Xt() && import("../preview-channel-CSr96XAo.js").then((e) => e.initPreviewChannel(this)).catch(() => void 0);
|
|
1559
1617
|
}
|
|
1560
1618
|
registerFramework = (e) => {
|
|
1561
|
-
|
|
1619
|
+
Oe(e, this.frameworks);
|
|
1562
1620
|
};
|
|
1563
1621
|
registerComponent = (e, t) => {
|
|
1564
|
-
|
|
1622
|
+
we(e, t, this.components);
|
|
1565
1623
|
};
|
|
1566
1624
|
registerPlugin = (e) => {
|
|
1567
|
-
|
|
1625
|
+
ve(this, e, this.plugins);
|
|
1568
1626
|
let t = this.plugins[e.name];
|
|
1569
1627
|
t?.onStart && this.lifecycle.registerPluginStartHook(t.onStart);
|
|
1570
1628
|
};
|
|
1571
1629
|
registerFeature = (e, t) => {
|
|
1572
|
-
|
|
1630
|
+
ne(e, t, this.features);
|
|
1573
1631
|
};
|
|
1574
1632
|
registerPredicate = (e, t) => {
|
|
1575
|
-
|
|
1633
|
+
qe(e, t, this.predicates);
|
|
1576
1634
|
};
|
|
1577
1635
|
registerCondition = (e) => {
|
|
1578
1636
|
this.conditions.register(e);
|
|
@@ -1581,19 +1639,19 @@ var Wt = class {
|
|
|
1581
1639
|
this.fields.register(e);
|
|
1582
1640
|
};
|
|
1583
1641
|
registerStep = (e) => {
|
|
1584
|
-
|
|
1642
|
+
ot(e, this.steps);
|
|
1585
1643
|
};
|
|
1586
1644
|
registerContent = (e) => {
|
|
1587
|
-
|
|
1645
|
+
ut(e, this.contents);
|
|
1588
1646
|
};
|
|
1589
1647
|
patchContent = (e, t) => {
|
|
1590
1648
|
this.contents.patch(e, t);
|
|
1591
1649
|
};
|
|
1592
1650
|
registerAction = (e, t) => {
|
|
1593
|
-
|
|
1651
|
+
mt(e, t, this.actions);
|
|
1594
1652
|
};
|
|
1595
1653
|
registerExperience = (e) => {
|
|
1596
|
-
e.component &&
|
|
1654
|
+
e.component && we(`experience:${e.id}`, e.component, this.components), this.experiences.register(e);
|
|
1597
1655
|
};
|
|
1598
1656
|
launchExperienceById = async (e, t) => {
|
|
1599
1657
|
this.experiences.launch({
|
|
@@ -1636,7 +1694,7 @@ var Wt = class {
|
|
|
1636
1694
|
this.registerFeature(e, n);
|
|
1637
1695
|
}), this.searchParams.feature && this.searchParams.feature.forEach((e) => {
|
|
1638
1696
|
try {
|
|
1639
|
-
let t =
|
|
1697
|
+
let t = ie(e);
|
|
1640
1698
|
if (!t) return;
|
|
1641
1699
|
let { id: n, bucket: r } = t;
|
|
1642
1700
|
this.registerFeature(n, {
|
|
@@ -1686,8 +1744,8 @@ var Wt = class {
|
|
|
1686
1744
|
});
|
|
1687
1745
|
}
|
|
1688
1746
|
getPluginConfig = (e) => this.plugins[e] ?? {};
|
|
1689
|
-
},
|
|
1690
|
-
async function
|
|
1747
|
+
}, Qt = "application/picked-javascript", $t = "application/picked-module", en = "data-picked-hydrated";
|
|
1748
|
+
async function tn(e) {
|
|
1691
1749
|
if (!("document" in globalThis)) return;
|
|
1692
1750
|
let t = "application/picked-module", n = "data-picked-hydrated";
|
|
1693
1751
|
function r(e) {
|
|
@@ -1716,23 +1774,23 @@ async function Jt(e) {
|
|
|
1716
1774
|
a && await a;
|
|
1717
1775
|
}
|
|
1718
1776
|
}
|
|
1719
|
-
function
|
|
1720
|
-
return `<script>(${
|
|
1777
|
+
function nn() {
|
|
1778
|
+
return `<script>(${tn.toString()})(document)<\/script>`;
|
|
1721
1779
|
}
|
|
1722
1780
|
//#endregion
|
|
1723
1781
|
//#region src/utils/html-asset-value.ts
|
|
1724
|
-
function
|
|
1782
|
+
function rn(e) {
|
|
1725
1783
|
return typeof e == "object" && !!e && "id" in e && typeof e.id == "string" && "content" in e && (typeof e.content == "string" || e.content === null);
|
|
1726
1784
|
}
|
|
1727
1785
|
//#endregion
|
|
1728
1786
|
//#region src/entities/component/lazyComponent.ts
|
|
1729
|
-
function
|
|
1787
|
+
function an(e) {
|
|
1730
1788
|
return {
|
|
1731
1789
|
$$type: "lazy-component",
|
|
1732
1790
|
load: e
|
|
1733
1791
|
};
|
|
1734
1792
|
}
|
|
1735
|
-
function
|
|
1793
|
+
function on(e) {
|
|
1736
1794
|
return typeof e == "object" && !!e && "$$type" in e && e.$$type === "lazy-component";
|
|
1737
1795
|
}
|
|
1738
1796
|
//#endregion
|
|
@@ -1748,10 +1806,10 @@ function $(e) {
|
|
|
1748
1806
|
for (let e of t) Z(e) && n.push(e.contentEntryId);
|
|
1749
1807
|
return n;
|
|
1750
1808
|
}
|
|
1751
|
-
function
|
|
1809
|
+
function sn(e, t) {
|
|
1752
1810
|
return t === null ? null : e[t] ?? null;
|
|
1753
1811
|
}
|
|
1754
|
-
function
|
|
1812
|
+
function cn(e, t) {
|
|
1755
1813
|
let n = [];
|
|
1756
1814
|
for (let r of t) {
|
|
1757
1815
|
let t = e[r];
|
|
@@ -1759,29 +1817,29 @@ function en(e, t) {
|
|
|
1759
1817
|
}
|
|
1760
1818
|
return n;
|
|
1761
1819
|
}
|
|
1762
|
-
function
|
|
1763
|
-
if (
|
|
1820
|
+
function ln(e, t) {
|
|
1821
|
+
if (ue.store(t)) return A(t, e.indexStore, (e, t) => sn(t, Q(e)));
|
|
1764
1822
|
let n = Q(t);
|
|
1765
|
-
return e.indexStore.map((e) =>
|
|
1823
|
+
return e.indexStore.map((e) => sn(e, n), { skipVoid: !1 });
|
|
1766
1824
|
}
|
|
1767
|
-
function
|
|
1768
|
-
if (
|
|
1825
|
+
function un(e, t) {
|
|
1826
|
+
if (ue.store(t)) return A(t, e.indexStore, (e, t) => cn(t, $(e)));
|
|
1769
1827
|
let n = $(t);
|
|
1770
|
-
return e.indexStore.map((e) =>
|
|
1828
|
+
return e.indexStore.map((e) => cn(e, n), { skipVoid: !1 });
|
|
1771
1829
|
}
|
|
1772
1830
|
//#endregion
|
|
1773
1831
|
//#region src/exports.ts
|
|
1774
|
-
var
|
|
1775
|
-
let t = new
|
|
1832
|
+
var dn = (e) => {
|
|
1833
|
+
let t = new Zt(e);
|
|
1776
1834
|
return u(t), t;
|
|
1777
1835
|
};
|
|
1778
1836
|
//#endregion
|
|
1779
1837
|
//#region src/typed-content.ts
|
|
1780
|
-
function
|
|
1838
|
+
function fn(e) {
|
|
1781
1839
|
return typeof e.data == "object";
|
|
1782
1840
|
}
|
|
1783
|
-
function
|
|
1784
|
-
return e.map((e) => !e || !
|
|
1841
|
+
function pn(e) {
|
|
1842
|
+
return e.map((e) => !e || !fn(e) ? null : e, { skipVoid: !1 });
|
|
1785
1843
|
}
|
|
1786
1844
|
//#endregion
|
|
1787
|
-
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 };
|