@picked/client 0.0.1-dev.1786675074931 → 0.0.1-dev.1787537193674
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-4YpcWP-x.js +33 -0
- package/dist/api-DRTduQVm.cjs +1 -0
- 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/docs/_root.css +101 -0
- package/dist/docs/explanation/feature-flag-allocation.md +43 -1
- package/dist/docs/how-to/analytics/index.md +2 -0
- package/dist/docs/how-to/authenticate-the-cli.md +15 -13
- package/dist/docs/how-to/create-and-revoke-an-api-key.md +7 -2
- package/dist/docs/how-to/debug-with-the-chrome-extension.md +1 -1
- package/dist/docs/how-to/install-the-sdk.md +30 -12
- package/dist/docs/how-to/install-the-vite-plugin.md +22 -9
- package/dist/docs/how-to/read-a-feature-flag.md +23 -11
- package/dist/docs/how-to/read-a-referenced-entry.md +4 -6
- package/dist/docs/how-to/register-a-component.md +2 -2
- package/dist/docs/how-to/register-an-action-handler.md +1 -1
- package/dist/docs/how-to/render-a-step-form.md +3 -4
- package/dist/docs/how-to/server-render-a-page.md +1 -1
- package/dist/docs/how-to/switch-workspaces.md +1 -2
- package/dist/docs/how-to/write-a-predicate.md +1 -1
- package/dist/docs/reference/dashboard/api-keys.mdx +5 -4
- package/dist/docs/reference/dashboard/features.mdx +45 -5
- package/dist/docs/reference/delivery-api/workspace-schema.md +12 -1
- package/dist/docs/reference/pickedql/dimensions.md +16 -0
- package/dist/docs/reference/pickedql/virtual-functions.md +16 -5
- package/dist/docs/reference/sdk/analytics-events.md +445 -0
- package/dist/docs/reference/sdk/content.md +7 -10
- package/dist/docs/reference/sdk/features.md +18 -7
- package/dist/docs/reference/sdk/plugins/dynamic-experiences.md +1 -1
- package/dist/docs/reference/sdk/plugins/window-object.md +1 -1
- package/dist/docs/reference/sdk/ssr/serialize.md +1 -1
- package/dist/docs/reference/sdk/steps.md +3 -4
- package/dist/docs/reference/sdk/type-generation.md +65 -26
- package/dist/docs/reference/tools/cli.md +19 -14
- package/dist/docs/reference/tools/vite-plugin.md +28 -6
- package/dist/docs/tutorials/first-experience.mdx +6 -7
- package/dist/docs/tutorials/first-server-rendered-page.mdx +3 -3
- package/dist/emit-D-tLiWL1.cjs +1 -0
- package/dist/emit-Ds2EG7CB.js +14 -0
- package/dist/esm/index.js +255 -232
- package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
- package/dist/esm/plugins/telemetry/index.js +94 -0
- package/dist/esm/server/index.js +1 -1
- package/dist/plugin-BPZV7SJg.cjs +1 -0
- package/dist/{plugin-ClKkYGTd.js → plugin-DTN7fsyp.js} +44 -29
- package/dist/{provider-D7msjLQ1.cjs → provider-BxhVIcsp.cjs} +1 -1
- package/dist/{provider-BEpf8z6A.js → provider-DLebj-AW.js} +1 -1
- package/dist/request-observer-BXDfOU0V.cjs +1 -0
- package/dist/request-observer-DtG0cRfz.js +19 -0
- package/dist/types/data-source/api.d.ts.map +1 -1
- package/dist/types/data-source/provider.d.ts +11 -1
- package/dist/types/data-source/provider.d.ts.map +1 -1
- package/dist/types/data-source/request-observer.d.ts +46 -0
- package/dist/types/data-source/request-observer.d.ts.map +1 -0
- package/dist/types/entities/feature/feature.d.ts +10 -3
- package/dist/types/entities/feature/feature.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- 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 +12 -2
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/hash.d.ts +53 -1
- package/dist/types/plugins/dynamic-experiences/hash.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/index.d.ts +1 -0
- package/dist/types/plugins/dynamic-experiences/index.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts +1 -1
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/types.d.ts +3 -4
- package/dist/types/plugins/dynamic-experiences/types.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 +29 -0
- package/dist/types/plugins/telemetry/plugin.d.ts.map +1 -0
- package/dist/types/schema-registry.d.ts +16 -0
- package/dist/types/schema-registry.d.ts.map +1 -1
- package/dist/types/utils/user-timing.d.ts +18 -0
- package/dist/types/utils/user-timing.d.ts.map +1 -0
- package/dist/version-BlahSDlG.cjs +1 -0
- package/dist/{version-CTwGfdI4.js → version-BmBn0dXR.js} +1 -1
- package/package.json +16 -4
- package/dist/api-CSNjsqCv.js +0 -22
- package/dist/api-yuvsQhNy.cjs +0 -1
- package/dist/plugin-D4-caxZN.cjs +0 -1
- package/dist/version-CRxCADU7.cjs +0 -1
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 { t 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 { t as ne } from "../id-Bo4RBeOs.js";
|
|
9
|
+
import { t as re } from "../version-BmBn0dXR.js";
|
|
10
|
+
import { n as ie, r as ae, t as oe } 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 se, 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 ce } from "@picked/delivery-api-client";
|
|
14
14
|
//#region src/entities/experience/experience.ts
|
|
15
|
-
var z = M("experience"),
|
|
15
|
+
var z = M("experience"), le = 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"), ce = 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"), ce = 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"), ce = 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"), ce = L(({ client: e, experience: r }) => {
|
|
|
99
99
|
prepareExperienceContentFx: m
|
|
100
100
|
}, u;
|
|
101
101
|
});
|
|
102
|
-
function
|
|
103
|
-
return R(
|
|
102
|
+
function ue(e) {
|
|
103
|
+
return R(le, e);
|
|
104
104
|
}
|
|
105
|
-
var
|
|
105
|
+
var de = 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(ue({
|
|
113
113
|
client: e,
|
|
114
114
|
experience: t
|
|
115
115
|
}));
|
|
@@ -195,20 +195,20 @@ var ue = L(({ client: e }) => {
|
|
|
195
195
|
})
|
|
196
196
|
};
|
|
197
197
|
});
|
|
198
|
-
function
|
|
199
|
-
return R(
|
|
198
|
+
function fe(e) {
|
|
199
|
+
return R(de, e);
|
|
200
200
|
}
|
|
201
|
-
var
|
|
201
|
+
var pe = 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 me(e) {
|
|
207
207
|
return N(async () => {
|
|
208
208
|
await e();
|
|
209
209
|
});
|
|
210
210
|
}
|
|
211
|
-
var
|
|
211
|
+
var he = (e, t, n) => {
|
|
212
212
|
let r = t.name, i = t.setup(e);
|
|
213
213
|
if (i) {
|
|
214
214
|
let e = n[r] ?? {};
|
|
@@ -217,16 +217,16 @@ var me = (e, t, n) => {
|
|
|
217
217
|
...i
|
|
218
218
|
});
|
|
219
219
|
}
|
|
220
|
-
},
|
|
220
|
+
}, ge = M("component"), _e = L(({ client: e, component: t, name: n }) => ({
|
|
221
221
|
name: n,
|
|
222
222
|
component: t,
|
|
223
223
|
frameworkStore: e.frameworks.getByName(t.frameworkName)
|
|
224
224
|
}));
|
|
225
|
-
function
|
|
226
|
-
return R(
|
|
225
|
+
function ve(e) {
|
|
226
|
+
return R(_e, e);
|
|
227
227
|
}
|
|
228
|
-
var
|
|
229
|
-
let t =
|
|
228
|
+
var ye = L(({ client: e }) => {
|
|
229
|
+
let t = ge.store({}), n = j(t, { register(e, t) {
|
|
230
230
|
return {
|
|
231
231
|
...e,
|
|
232
232
|
[t.name]: t
|
|
@@ -239,7 +239,7 @@ var ve = L(({ client: e }) => {
|
|
|
239
239
|
fn: (e, { name: t }) => `Component '${t}' already registered. Registering again will override the previous registration.`
|
|
240
240
|
}).watch((e) => /* @__PURE__ */ r("warn", e)), I({
|
|
241
241
|
clock: i,
|
|
242
|
-
fn: ({ name: t, component: n }) =>
|
|
242
|
+
fn: ({ name: t, component: n }) => ve({
|
|
243
243
|
client: e,
|
|
244
244
|
name: t,
|
|
245
245
|
component: n
|
|
@@ -256,16 +256,16 @@ var ve = L(({ client: e }) => {
|
|
|
256
256
|
listStore: a
|
|
257
257
|
};
|
|
258
258
|
});
|
|
259
|
-
function
|
|
260
|
-
return R(
|
|
259
|
+
function be(e) {
|
|
260
|
+
return R(ye, e);
|
|
261
261
|
}
|
|
262
|
-
var
|
|
262
|
+
var xe = (e, t, n) => {
|
|
263
263
|
n.register({
|
|
264
264
|
name: e,
|
|
265
265
|
component: t
|
|
266
266
|
});
|
|
267
|
-
},
|
|
268
|
-
let t =
|
|
267
|
+
}, Se = M("framework"), Ce = L((e) => {
|
|
268
|
+
let t = Se.store({}), n = j(t, { register(e, t) {
|
|
269
269
|
return {
|
|
270
270
|
...e,
|
|
271
271
|
[t.name]: t.framework
|
|
@@ -290,15 +290,15 @@ var be = (e, t, n) => {
|
|
|
290
290
|
listStore: a
|
|
291
291
|
};
|
|
292
292
|
});
|
|
293
|
-
function
|
|
294
|
-
return R(
|
|
293
|
+
function we(e) {
|
|
294
|
+
return R(Ce, e);
|
|
295
295
|
}
|
|
296
|
-
var
|
|
296
|
+
var Te = (e, t) => {
|
|
297
297
|
t.register({
|
|
298
298
|
name: e.name,
|
|
299
299
|
framework: e
|
|
300
300
|
});
|
|
301
|
-
},
|
|
301
|
+
}, Ee = L(({ client: e }) => {
|
|
302
302
|
let t = "window" in globalThis, n = {
|
|
303
303
|
location: t ? globalThis.location : void 0,
|
|
304
304
|
document: t ? globalThis.document : void 0,
|
|
@@ -312,12 +312,12 @@ var we = (e, t) => {
|
|
|
312
312
|
...n
|
|
313
313
|
}));
|
|
314
314
|
});
|
|
315
|
-
function
|
|
316
|
-
return R(
|
|
315
|
+
function De(e) {
|
|
316
|
+
return R(Ee, e);
|
|
317
317
|
}
|
|
318
318
|
//#endregion
|
|
319
319
|
//#region src/logic-engine.ts
|
|
320
|
-
function
|
|
320
|
+
function Oe(e) {
|
|
321
321
|
return typeof e == "number" && !isNaN(e);
|
|
322
322
|
}
|
|
323
323
|
function B(e) {
|
|
@@ -326,21 +326,21 @@ function B(e) {
|
|
|
326
326
|
function V(e) {
|
|
327
327
|
return Array.isArray(e);
|
|
328
328
|
}
|
|
329
|
-
function
|
|
329
|
+
function ke(e) {
|
|
330
330
|
return e instanceof Promise;
|
|
331
331
|
}
|
|
332
|
-
function
|
|
332
|
+
function Ae(e) {
|
|
333
333
|
return typeof e == "object" && !!e && !Array.isArray(e) && Object.keys(e).length === 1;
|
|
334
334
|
}
|
|
335
335
|
function H(e) {
|
|
336
|
-
if (
|
|
336
|
+
if (Oe(e)) return e;
|
|
337
337
|
let t = parseFloat(`${e}`);
|
|
338
338
|
return isNaN(t) ? 0 : t;
|
|
339
339
|
}
|
|
340
340
|
function U(e) {
|
|
341
341
|
return `${e}`;
|
|
342
342
|
}
|
|
343
|
-
var
|
|
343
|
+
var je = {
|
|
344
344
|
"==": (e, t) => e == t,
|
|
345
345
|
"===": (e, t) => e === t,
|
|
346
346
|
"!=": (e, t) => e != t,
|
|
@@ -435,10 +435,10 @@ var Ae = {
|
|
|
435
435
|
};
|
|
436
436
|
async function W(e, t) {
|
|
437
437
|
if (!e) return e;
|
|
438
|
-
if (
|
|
438
|
+
if (ke(e)) return W(await e, t);
|
|
439
439
|
if (V(e)) return Promise.all(e.map((e) => W(e, t)));
|
|
440
|
-
if (!
|
|
441
|
-
let n =
|
|
440
|
+
if (!Ae(e)) return e;
|
|
441
|
+
let n = Me(e), r = n ? e[n] ?? [] : [];
|
|
442
442
|
switch (V(r) || (r = [r]), n) {
|
|
443
443
|
case "if":
|
|
444
444
|
case "?:":
|
|
@@ -496,32 +496,32 @@ async function W(e, t) {
|
|
|
496
496
|
case "catch": try {
|
|
497
497
|
return await W(r[0], t);
|
|
498
498
|
} catch (e) {
|
|
499
|
-
return
|
|
499
|
+
return Ae(e) ? await W(e, t) : r[1] ? await W(r[1], e) : e instanceof Error ? e.message : e;
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
|
-
let i = await Promise.all(r.map((e) => W(e, t))), a = n ?
|
|
502
|
+
let i = await Promise.all(r.map((e) => W(e, t))), a = n ? je[n] : void 0;
|
|
503
503
|
if (!a) throw Error(`Unrecognized operation ${n}`);
|
|
504
504
|
return a.apply(t, i);
|
|
505
505
|
}
|
|
506
506
|
async function G(e) {
|
|
507
|
-
return
|
|
507
|
+
return ke(e) ? G(await e) : !(Array.isArray(e) && e.length === 0) && !!e;
|
|
508
508
|
}
|
|
509
|
-
function
|
|
509
|
+
function Me(e) {
|
|
510
510
|
return Object.keys(e)[0];
|
|
511
511
|
}
|
|
512
512
|
//#endregion
|
|
513
513
|
//#region src/lifecycle/rules-logic.ts
|
|
514
|
-
function
|
|
514
|
+
function Ne(e, t, n) {
|
|
515
515
|
return new Proxy(Object.create(null), { get(r, i) {
|
|
516
516
|
if (typeof i != "string") return;
|
|
517
517
|
let a = e.find((e) => e.key === i);
|
|
518
518
|
if (a !== void 0) return async () => !n.has(i) && await W(a.logic, {
|
|
519
519
|
...t,
|
|
520
|
-
conditions:
|
|
520
|
+
conditions: Ne(e, t, new Set(n).add(i))
|
|
521
521
|
}) === !0;
|
|
522
522
|
} });
|
|
523
523
|
}
|
|
524
|
-
var
|
|
524
|
+
var Pe = L(({ client: e }) => k({
|
|
525
525
|
source: {
|
|
526
526
|
stateSnapshot: e.stateSnapshotStore,
|
|
527
527
|
predicates: e.predicates.listStore,
|
|
@@ -560,22 +560,22 @@ var Ne = L(({ client: e }) => k({
|
|
|
560
560
|
};
|
|
561
561
|
return await W(o, {
|
|
562
562
|
...d,
|
|
563
|
-
conditions:
|
|
563
|
+
conditions: Ne(a, d, /* @__PURE__ */ new Set())
|
|
564
564
|
});
|
|
565
565
|
}
|
|
566
566
|
}));
|
|
567
|
-
function
|
|
568
|
-
return R(
|
|
567
|
+
function Fe(e) {
|
|
568
|
+
return R(Pe, e);
|
|
569
569
|
}
|
|
570
570
|
//#endregion
|
|
571
571
|
//#region src/ping.ts
|
|
572
|
-
var
|
|
572
|
+
var Ie = 6e3, Le = O("last_ping", "global"), Re = async (e) => {
|
|
573
573
|
try {
|
|
574
|
-
let t = Date.now(), n = E.get(
|
|
575
|
-
if (n.isSet() && (r = n.json() ?? 0), r && t - r <
|
|
574
|
+
let t = Date.now(), n = E.get(Le), r = 0;
|
|
575
|
+
if (n.isSet() && (r = n.json() ?? 0), r && t - r < Ie) return !0;
|
|
576
576
|
let i = {}, a = document.getElementById("picked_script")?.dataset.verceltoken;
|
|
577
577
|
a && (i["x-vercel-protection-bypass"] = a);
|
|
578
|
-
let o = await
|
|
578
|
+
let o = await ce(e.apiUrl, {
|
|
579
579
|
projectId: e.projectId,
|
|
580
580
|
path: window.location.pathname
|
|
581
581
|
}, { headers: i });
|
|
@@ -583,7 +583,27 @@ var Fe = 6e3, Ie = O("last_ping", "global"), Le = async (e) => {
|
|
|
583
583
|
} catch {
|
|
584
584
|
return !1;
|
|
585
585
|
}
|
|
586
|
-
},
|
|
586
|
+
}, ze = "picked:start:begin", Be = "picked:start";
|
|
587
|
+
function Ve() {
|
|
588
|
+
try {
|
|
589
|
+
return s() && !!p.window && "performance" in p;
|
|
590
|
+
} catch {
|
|
591
|
+
return !1;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
function He() {
|
|
595
|
+
if (Ve()) try {
|
|
596
|
+
performance.mark(ze);
|
|
597
|
+
} catch {}
|
|
598
|
+
}
|
|
599
|
+
function Ue() {
|
|
600
|
+
if (Ve()) try {
|
|
601
|
+
performance.measure(Be, ze);
|
|
602
|
+
} catch {}
|
|
603
|
+
}
|
|
604
|
+
//#endregion
|
|
605
|
+
//#region src/lifecycle/lifecycle.ts
|
|
606
|
+
var K = M("lifecycle"), We = L(({ client: e }) => {
|
|
587
607
|
let t = K.store(!1), r = F(void 0, {
|
|
588
608
|
skipVoid: !1,
|
|
589
609
|
domain: K
|
|
@@ -599,11 +619,11 @@ var Fe = 6e3, Ie = O("last_ping", "global"), Le = async (e) => {
|
|
|
599
619
|
}), u = P(), d = P(), f = P(), p = P(), m = P(), h = P();
|
|
600
620
|
o.on(p, (e, t) => [...e, t]), s.on(m, (e, t) => t), l.on(h, (e, t) => t), t.on(d, () => !0);
|
|
601
621
|
let g = N(() => {
|
|
602
|
-
|
|
622
|
+
Re(e);
|
|
603
623
|
}), _ = N(async () => {
|
|
604
624
|
await ee();
|
|
605
625
|
}), v = N(async () => {
|
|
606
|
-
await
|
|
626
|
+
await pe(e);
|
|
607
627
|
}), y = k({ effect: v }), b = k({
|
|
608
628
|
source: o,
|
|
609
629
|
effect: async (e) => {
|
|
@@ -625,7 +645,7 @@ var Fe = 6e3, Ie = O("last_ping", "global"), Le = async (e) => {
|
|
|
625
645
|
clock: C,
|
|
626
646
|
fn: () => "starting",
|
|
627
647
|
target: a
|
|
628
|
-
}), I({
|
|
648
|
+
}), C.watch(He), d.watch(Ue), I({
|
|
629
649
|
clock: C,
|
|
630
650
|
target: g
|
|
631
651
|
}), I({
|
|
@@ -671,24 +691,24 @@ var Fe = 6e3, Ie = O("last_ping", "global"), Le = async (e) => {
|
|
|
671
691
|
fn: () => ({ type: "initialize" }),
|
|
672
692
|
target: e.eventBus
|
|
673
693
|
});
|
|
674
|
-
let w = F(!1).on(_.done, () => !0), T = F(!1).on(f, () => !0),
|
|
694
|
+
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
695
|
I({
|
|
676
696
|
clock: f,
|
|
677
|
-
source:
|
|
697
|
+
source: E,
|
|
678
698
|
filter: (e) => e,
|
|
679
699
|
fn: () => void 0,
|
|
680
700
|
target: v
|
|
681
701
|
});
|
|
682
|
-
let
|
|
702
|
+
let D = A(w, T, E, (e, t, n) => e && t && n);
|
|
683
703
|
I({
|
|
684
|
-
clock:
|
|
704
|
+
clock: D,
|
|
685
705
|
filter: (e) => e,
|
|
686
706
|
fn: () => void 0,
|
|
687
707
|
target: y
|
|
688
708
|
});
|
|
689
|
-
let
|
|
709
|
+
let O = A(w, T, E, te, (e, t, n, r) => e && t && (!n || r));
|
|
690
710
|
return I({
|
|
691
|
-
clock:
|
|
711
|
+
clock: O,
|
|
692
712
|
filter: (e) => e,
|
|
693
713
|
fn: () => void 0,
|
|
694
714
|
target: d
|
|
@@ -732,13 +752,13 @@ var Fe = 6e3, Ie = O("last_ping", "global"), Le = async (e) => {
|
|
|
732
752
|
setCondition: h
|
|
733
753
|
};
|
|
734
754
|
});
|
|
735
|
-
function
|
|
736
|
-
return R(
|
|
755
|
+
function Ge(e) {
|
|
756
|
+
return R(We, e);
|
|
737
757
|
}
|
|
738
758
|
//#endregion
|
|
739
759
|
//#region src/entities/predicate/predicate.ts
|
|
740
|
-
var
|
|
741
|
-
let t =
|
|
760
|
+
var Ke = M("predicate"), qe = L(({ client: e }) => {
|
|
761
|
+
let t = Ke.store({}), n = j(t, { register(e, t) {
|
|
742
762
|
return {
|
|
743
763
|
...e,
|
|
744
764
|
[t.name]: {
|
|
@@ -796,23 +816,23 @@ var Be = M("predicate"), Ve = L(({ client: e }) => {
|
|
|
796
816
|
getEvokablePredicate: s
|
|
797
817
|
};
|
|
798
818
|
});
|
|
799
|
-
function
|
|
800
|
-
return R(
|
|
819
|
+
function Je(e) {
|
|
820
|
+
return R(qe, e);
|
|
801
821
|
}
|
|
802
|
-
var
|
|
822
|
+
var Ye = (e, t, n) => {
|
|
803
823
|
n.register({
|
|
804
824
|
name: e,
|
|
805
825
|
predicate: t
|
|
806
826
|
});
|
|
807
|
-
},
|
|
827
|
+
}, Xe = M("feature");
|
|
808
828
|
function q(e) {
|
|
809
829
|
return e?.enabled === !1;
|
|
810
830
|
}
|
|
811
|
-
function
|
|
831
|
+
function Ze(e) {
|
|
812
832
|
return e === "true" || e !== "false" && e;
|
|
813
833
|
}
|
|
814
|
-
var
|
|
815
|
-
let t =
|
|
834
|
+
var Qe = L(({ client: e }) => {
|
|
835
|
+
let t = Xe.store({}), n = Xe.store([]), i = j(t, { register(e, t) {
|
|
816
836
|
return {
|
|
817
837
|
...e,
|
|
818
838
|
[t.id]: t.feature
|
|
@@ -843,7 +863,7 @@ var Ke = L(({ client: e }) => {
|
|
|
843
863
|
return a ? {
|
|
844
864
|
id: e,
|
|
845
865
|
key: t,
|
|
846
|
-
bucket:
|
|
866
|
+
bucket: Ze(a),
|
|
847
867
|
storage: n
|
|
848
868
|
} : null;
|
|
849
869
|
}), s = N((e) => {
|
|
@@ -996,7 +1016,7 @@ var Ke = L(({ client: e }) => {
|
|
|
996
1016
|
let n = _(e);
|
|
997
1017
|
return p.set(e, n), n;
|
|
998
1018
|
}
|
|
999
|
-
function
|
|
1019
|
+
function y(e) {
|
|
1000
1020
|
let t = v(e), n = F(void 0, { skipVoid: !1 }), r = k({
|
|
1001
1021
|
source: t,
|
|
1002
1022
|
mapParams: (e, t) => t,
|
|
@@ -1016,10 +1036,10 @@ var Ke = L(({ client: e }) => {
|
|
|
1016
1036
|
target: r
|
|
1017
1037
|
}), r(), n;
|
|
1018
1038
|
}
|
|
1019
|
-
function
|
|
1039
|
+
function ee(e) {
|
|
1020
1040
|
let t = m.get(e);
|
|
1021
1041
|
if (t) return t;
|
|
1022
|
-
let n =
|
|
1042
|
+
let n = y(e);
|
|
1023
1043
|
return m.set(e, n), n;
|
|
1024
1044
|
}
|
|
1025
1045
|
return {
|
|
@@ -1028,29 +1048,29 @@ var Ke = L(({ client: e }) => {
|
|
|
1028
1048
|
getByName: g,
|
|
1029
1049
|
listStore: u,
|
|
1030
1050
|
getEvokableFeature: v,
|
|
1031
|
-
getFeatureResult:
|
|
1051
|
+
getFeatureResult: ee
|
|
1032
1052
|
};
|
|
1033
1053
|
});
|
|
1034
|
-
function
|
|
1035
|
-
return R(
|
|
1054
|
+
function $e(e) {
|
|
1055
|
+
return R(Qe, e);
|
|
1036
1056
|
}
|
|
1037
|
-
var
|
|
1057
|
+
var et = (e, t, n) => {
|
|
1038
1058
|
n.register({
|
|
1039
1059
|
id: e,
|
|
1040
1060
|
feature: t
|
|
1041
1061
|
});
|
|
1042
1062
|
}, J = M("history");
|
|
1043
|
-
function
|
|
1063
|
+
function tt(e, t) {
|
|
1044
1064
|
return {
|
|
1045
|
-
id:
|
|
1065
|
+
id: ne(`history-entry-${Date.now()}-${Math.random()}}`),
|
|
1046
1066
|
node: t,
|
|
1047
1067
|
at: Date.now(),
|
|
1048
1068
|
experienceId: e
|
|
1049
1069
|
};
|
|
1050
1070
|
}
|
|
1051
|
-
var
|
|
1071
|
+
var nt = L(() => {
|
|
1052
1072
|
let e = J.store({ entries: [] }), t = J.event(), n = J.event(), r = J.event(), i = J.event();
|
|
1053
|
-
e.on(t, (e, t) => ({ entries: [...e.entries,
|
|
1073
|
+
e.on(t, (e, t) => ({ entries: [...e.entries, tt(t.experienceId, t.node)] })), e.on(n, (e, t) => ({ entries: [...e.entries.slice(0, -1), tt(t.experienceId, t.node)] })), e.on(i, (e, t) => t);
|
|
1054
1074
|
function a(e, t) {
|
|
1055
1075
|
let n = {
|
|
1056
1076
|
lastStepIndex: -1,
|
|
@@ -1058,7 +1078,7 @@ var Xe = L(() => {
|
|
|
1058
1078
|
};
|
|
1059
1079
|
for (let r = e.length - 1; r >= 0; r--) {
|
|
1060
1080
|
let i = e[r], a = i?.node;
|
|
1061
|
-
if (!(!a || !
|
|
1081
|
+
if (!(!a || !T(a)) && !(t && i.experienceId !== t)) if (n.lastStepIndex === -1) n.lastStepIndex = r;
|
|
1062
1082
|
else {
|
|
1063
1083
|
n.secondLastStepIndex = r;
|
|
1064
1084
|
break;
|
|
@@ -1080,20 +1100,20 @@ var Xe = L(() => {
|
|
|
1080
1100
|
entriesStore: e.map((e) => e.entries)
|
|
1081
1101
|
};
|
|
1082
1102
|
});
|
|
1083
|
-
function
|
|
1084
|
-
return R(
|
|
1103
|
+
function rt() {
|
|
1104
|
+
return R(nt);
|
|
1085
1105
|
}
|
|
1086
1106
|
//#endregion
|
|
1087
1107
|
//#region src/utils/events.ts
|
|
1088
|
-
var
|
|
1108
|
+
var it = 0, at = (e) => {
|
|
1089
1109
|
let t = F([]);
|
|
1090
1110
|
return t.on(e, (e, t) => [...e, {
|
|
1091
|
-
id:
|
|
1111
|
+
id: it++,
|
|
1092
1112
|
at: /* @__PURE__ */ new Date(),
|
|
1093
1113
|
payload: t
|
|
1094
1114
|
}]), t;
|
|
1095
|
-
},
|
|
1096
|
-
let e =
|
|
1115
|
+
}, ot = M("field"), st = L(() => {
|
|
1116
|
+
let e = ot.store({}), t = j(e, {
|
|
1097
1117
|
register(e, t) {
|
|
1098
1118
|
return {
|
|
1099
1119
|
...e,
|
|
@@ -1141,13 +1161,13 @@ var Qe = 0, $e = (e) => {
|
|
|
1141
1161
|
getByName: c
|
|
1142
1162
|
};
|
|
1143
1163
|
});
|
|
1144
|
-
function
|
|
1145
|
-
return R(
|
|
1164
|
+
function ct() {
|
|
1165
|
+
return R(st);
|
|
1146
1166
|
}
|
|
1147
1167
|
//#endregion
|
|
1148
1168
|
//#region src/entities/step/step.ts
|
|
1149
|
-
var
|
|
1150
|
-
let e =
|
|
1169
|
+
var lt = M("step"), ut = L(() => {
|
|
1170
|
+
let e = lt.store({}), t = j(e, { register(e, t) {
|
|
1151
1171
|
return {
|
|
1152
1172
|
...e,
|
|
1153
1173
|
[t.step.id]: t.step
|
|
@@ -1171,16 +1191,16 @@ var rt = M("step"), it = L(() => {
|
|
|
1171
1191
|
indexStore: e
|
|
1172
1192
|
};
|
|
1173
1193
|
});
|
|
1174
|
-
function
|
|
1175
|
-
return R(
|
|
1194
|
+
function dt() {
|
|
1195
|
+
return R(ut);
|
|
1176
1196
|
}
|
|
1177
|
-
function
|
|
1197
|
+
function ft(e, t) {
|
|
1178
1198
|
t.register(e);
|
|
1179
1199
|
}
|
|
1180
1200
|
//#endregion
|
|
1181
1201
|
//#region src/entities/content/content.ts
|
|
1182
|
-
var
|
|
1183
|
-
let e =
|
|
1202
|
+
var pt = M("content"), mt = L(() => {
|
|
1203
|
+
let e = pt.store({}), t = j(e, {
|
|
1184
1204
|
register(e, t) {
|
|
1185
1205
|
return {
|
|
1186
1206
|
...e,
|
|
@@ -1221,16 +1241,16 @@ var st = M("content"), ct = L(() => {
|
|
|
1221
1241
|
indexStore: e
|
|
1222
1242
|
};
|
|
1223
1243
|
});
|
|
1224
|
-
function
|
|
1225
|
-
return R(
|
|
1244
|
+
function ht() {
|
|
1245
|
+
return R(mt);
|
|
1226
1246
|
}
|
|
1227
|
-
function
|
|
1247
|
+
function gt(e, t) {
|
|
1228
1248
|
t.register(e);
|
|
1229
1249
|
}
|
|
1230
1250
|
//#endregion
|
|
1231
1251
|
//#region src/entities/action/action.ts
|
|
1232
|
-
var
|
|
1233
|
-
let t =
|
|
1252
|
+
var _t = M("action"), vt = L(({ client: e }) => {
|
|
1253
|
+
let t = _t.store({}), n = j(t, { register(e, t) {
|
|
1234
1254
|
return {
|
|
1235
1255
|
...e,
|
|
1236
1256
|
[t.key]: {
|
|
@@ -1288,10 +1308,10 @@ var dt = M("action"), ft = L(({ client: e }) => {
|
|
|
1288
1308
|
getEvokableAction: s
|
|
1289
1309
|
};
|
|
1290
1310
|
});
|
|
1291
|
-
function
|
|
1292
|
-
return R(
|
|
1311
|
+
function yt(e) {
|
|
1312
|
+
return R(vt, e);
|
|
1293
1313
|
}
|
|
1294
|
-
var
|
|
1314
|
+
var bt = (e, t, n) => {
|
|
1295
1315
|
n.register({
|
|
1296
1316
|
key: e,
|
|
1297
1317
|
action: t
|
|
@@ -1310,35 +1330,35 @@ function Y(e, t, n, r) {
|
|
|
1310
1330
|
function X(e) {
|
|
1311
1331
|
return e === null || e === "" || Array.isArray(e) && !e.length;
|
|
1312
1332
|
}
|
|
1313
|
-
function
|
|
1333
|
+
function xt(e) {
|
|
1314
1334
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
|
|
1315
1335
|
}
|
|
1316
|
-
function
|
|
1336
|
+
function St(e) {
|
|
1317
1337
|
try {
|
|
1318
1338
|
return JSON.stringify(e), !0;
|
|
1319
1339
|
} catch {
|
|
1320
1340
|
return !1;
|
|
1321
1341
|
}
|
|
1322
1342
|
}
|
|
1323
|
-
function
|
|
1343
|
+
function Ct(e, t) {
|
|
1324
1344
|
return t.find((t) => t.key === e) ?? null;
|
|
1325
1345
|
}
|
|
1326
|
-
function
|
|
1346
|
+
function wt(e, t) {
|
|
1327
1347
|
return e.multiple && (typeof t == "string" || typeof t == "number" || typeof t == "boolean") ? [t] : t;
|
|
1328
1348
|
}
|
|
1329
|
-
function
|
|
1349
|
+
function Tt(e, t) {
|
|
1330
1350
|
if (e.type !== "object" || X(t)) return null;
|
|
1331
1351
|
if (e.multiple) {
|
|
1332
1352
|
if (!Array.isArray(t)) return Y(e, t, "This field expects multiple values", "Field expects an array of objects.");
|
|
1333
1353
|
for (let n of t) {
|
|
1334
1354
|
if (typeof n != "object" || !n) return Y(e, t, "This field expects object values", "Field expects an array of objects, but received non-object value.");
|
|
1335
|
-
if (!
|
|
1355
|
+
if (!St(n)) return Y(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
|
|
1336
1356
|
}
|
|
1337
1357
|
return null;
|
|
1338
1358
|
}
|
|
1339
|
-
return Array.isArray(t) ? Y(e, t, "This field expects a single value", "Field expects a single object, not an array.") : typeof t != "object" || !t ? Y(e, t, "This field expects an object value", "Field expects an object value.") :
|
|
1359
|
+
return Array.isArray(t) ? Y(e, t, "This field expects a single value", "Field expects a single object, not an array.") : typeof t != "object" || !t ? Y(e, t, "This field expects an object value", "Field expects an object value.") : St(t) ? null : Y(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
|
|
1340
1360
|
}
|
|
1341
|
-
function
|
|
1361
|
+
function Et(e, t) {
|
|
1342
1362
|
if (X(t) || !Array.isArray(e.options) || e.options.length === 0) return null;
|
|
1343
1363
|
let n = Array.isArray(t) ? t : [t];
|
|
1344
1364
|
if (e.type === "object") {
|
|
@@ -1346,9 +1366,9 @@ function bt(e, t) {
|
|
|
1346
1366
|
return n.every((e) => r.has(JSON.stringify(e))) ? null : Y(e, t, "This field expects a valid option", "Field expects a valid option from the defined choices.");
|
|
1347
1367
|
}
|
|
1348
1368
|
let r = e.options.map((e) => e.value);
|
|
1349
|
-
return n.every((e) => !
|
|
1369
|
+
return n.every((e) => !xt(e) || e === null ? !1 : r.includes(e)) ? null : Y(e, t, "This field expects a valid option", `Field expects a valid option. Valid options are: ${r.join(", ")}`);
|
|
1350
1370
|
}
|
|
1351
|
-
async function
|
|
1371
|
+
async function Dt(t, n, r, i) {
|
|
1352
1372
|
if (n.validation && !e(n.validation) && !X(r)) {
|
|
1353
1373
|
let e = i ? {
|
|
1354
1374
|
$input: r,
|
|
@@ -1361,8 +1381,8 @@ async function xt(t, n, r, i) {
|
|
|
1361
1381
|
}
|
|
1362
1382
|
//#endregion
|
|
1363
1383
|
//#region src/entities/response/response.ts
|
|
1364
|
-
var
|
|
1365
|
-
let t =
|
|
1384
|
+
var Ot = M("response"), kt = L(({ client: e }) => {
|
|
1385
|
+
let t = Ot.store({}), r = P(), i = P(), a = j(t, {
|
|
1366
1386
|
register(e, t) {
|
|
1367
1387
|
return {
|
|
1368
1388
|
...e,
|
|
@@ -1401,7 +1421,7 @@ var St = M("response"), Ct = L(({ client: e }) => {
|
|
|
1401
1421
|
...t,
|
|
1402
1422
|
...n
|
|
1403
1423
|
}, o = Object.entries(n), c = await Promise.allSettled(o.map(async ([t, n]) => {
|
|
1404
|
-
let o =
|
|
1424
|
+
let o = Ct(t, e);
|
|
1405
1425
|
if (!o) {
|
|
1406
1426
|
r.push({
|
|
1407
1427
|
fieldKey: t,
|
|
@@ -1411,17 +1431,17 @@ var St = M("response"), Ct = L(({ client: e }) => {
|
|
|
1411
1431
|
});
|
|
1412
1432
|
return;
|
|
1413
1433
|
}
|
|
1414
|
-
let c =
|
|
1434
|
+
let c = wt(o, n), l = await Dt(s, o, c, a);
|
|
1415
1435
|
if (l) {
|
|
1416
1436
|
r.push(l);
|
|
1417
1437
|
return;
|
|
1418
1438
|
}
|
|
1419
|
-
let u =
|
|
1439
|
+
let u = Tt(o, c);
|
|
1420
1440
|
if (u) {
|
|
1421
1441
|
r.push(u);
|
|
1422
1442
|
return;
|
|
1423
1443
|
}
|
|
1424
|
-
let d =
|
|
1444
|
+
let d = Et(o, c);
|
|
1425
1445
|
if (d) {
|
|
1426
1446
|
r.push(d);
|
|
1427
1447
|
return;
|
|
@@ -1500,13 +1520,13 @@ var St = M("response"), Ct = L(({ client: e }) => {
|
|
|
1500
1520
|
getByFieldName: _
|
|
1501
1521
|
};
|
|
1502
1522
|
});
|
|
1503
|
-
function
|
|
1504
|
-
return R(
|
|
1523
|
+
function At(e) {
|
|
1524
|
+
return R(kt, e);
|
|
1505
1525
|
}
|
|
1506
1526
|
//#endregion
|
|
1507
1527
|
//#region src/entities/condition/condition.ts
|
|
1508
|
-
var
|
|
1509
|
-
let e =
|
|
1528
|
+
var jt = M("condition"), Mt = L(() => {
|
|
1529
|
+
let e = jt.store({}), t = j(e, { register(e, t) {
|
|
1510
1530
|
return {
|
|
1511
1531
|
...e,
|
|
1512
1532
|
[t.condition.id]: t.condition
|
|
@@ -1530,12 +1550,12 @@ var Tt = M("condition"), Et = L(() => {
|
|
|
1530
1550
|
indexStore: e
|
|
1531
1551
|
};
|
|
1532
1552
|
});
|
|
1533
|
-
function
|
|
1534
|
-
return R(
|
|
1553
|
+
function Nt() {
|
|
1554
|
+
return R(Mt);
|
|
1535
1555
|
}
|
|
1536
1556
|
//#endregion
|
|
1537
1557
|
//#region src/utils/api-url.ts
|
|
1538
|
-
function
|
|
1558
|
+
function Pt() {
|
|
1539
1559
|
if (c()) {
|
|
1540
1560
|
let e = [
|
|
1541
1561
|
document.currentScript,
|
|
@@ -1550,7 +1570,7 @@ function Ot() {
|
|
|
1550
1570
|
}
|
|
1551
1571
|
//#endregion
|
|
1552
1572
|
//#region src/utils/search-params.ts
|
|
1553
|
-
function
|
|
1573
|
+
function Ft() {
|
|
1554
1574
|
if (!s()) return {};
|
|
1555
1575
|
let e = new URLSearchParams(window.location.search), t = {}, n = /* @__PURE__ */ new Set();
|
|
1556
1576
|
for (let [t] of e.entries()) t.startsWith("picked-") && n.add(t);
|
|
@@ -1568,13 +1588,13 @@ function kt() {
|
|
|
1568
1588
|
}
|
|
1569
1589
|
//#endregion
|
|
1570
1590
|
//#region src/entities/session/session.ts
|
|
1571
|
-
var
|
|
1572
|
-
function
|
|
1573
|
-
return
|
|
1591
|
+
var It = O("session", "global");
|
|
1592
|
+
function Lt() {
|
|
1593
|
+
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)}`;
|
|
1574
1594
|
}
|
|
1575
|
-
function
|
|
1576
|
-
if (!
|
|
1577
|
-
let e = E.get(
|
|
1595
|
+
function Rt() {
|
|
1596
|
+
if (!h()) return null;
|
|
1597
|
+
let e = E.get(It);
|
|
1578
1598
|
if (!e.isSet()) return null;
|
|
1579
1599
|
try {
|
|
1580
1600
|
return e.json();
|
|
@@ -1582,8 +1602,8 @@ function Mt() {
|
|
|
1582
1602
|
return null;
|
|
1583
1603
|
}
|
|
1584
1604
|
}
|
|
1585
|
-
var
|
|
1586
|
-
let e =
|
|
1605
|
+
var zt = L(() => {
|
|
1606
|
+
let e = Rt(), t = { id: e?.id ?? Lt() };
|
|
1587
1607
|
e?.isUser !== void 0 && (t.isUser = e.isUser), e?.identifiers && Object.keys(e.identifiers).length > 0 && (t.identifiers = e.identifiers);
|
|
1588
1608
|
let n = F(t), r = j(n, {
|
|
1589
1609
|
setIsUser: (e, t) => ({
|
|
@@ -1608,8 +1628,8 @@ var Nt = L(() => {
|
|
|
1608
1628
|
}), i = k({
|
|
1609
1629
|
source: n,
|
|
1610
1630
|
effect: (e) => {
|
|
1611
|
-
if (
|
|
1612
|
-
E.get(
|
|
1631
|
+
if (h()) try {
|
|
1632
|
+
E.get(It).set(e);
|
|
1613
1633
|
} catch {}
|
|
1614
1634
|
}
|
|
1615
1635
|
});
|
|
@@ -1623,27 +1643,27 @@ var Nt = L(() => {
|
|
|
1623
1643
|
removeIdentifier: r.removeIdentifier
|
|
1624
1644
|
};
|
|
1625
1645
|
});
|
|
1626
|
-
function
|
|
1627
|
-
return R(
|
|
1646
|
+
function Bt() {
|
|
1647
|
+
return R(zt, void 0);
|
|
1628
1648
|
}
|
|
1629
1649
|
//#endregion
|
|
1630
1650
|
//#region src/utils/picked-config.ts
|
|
1631
|
-
function
|
|
1651
|
+
function Vt() {
|
|
1632
1652
|
if (s()) return globalThis.window.pickedConfig;
|
|
1633
1653
|
}
|
|
1634
|
-
function
|
|
1635
|
-
if (s()) return
|
|
1654
|
+
function Ht() {
|
|
1655
|
+
if (s()) return Vt()?.projectId;
|
|
1636
1656
|
}
|
|
1637
|
-
function
|
|
1657
|
+
function Ut() {
|
|
1638
1658
|
if (!c()) return;
|
|
1639
1659
|
let e = document.getElementById("picked_script") || document.querySelector("script#picked") || document.getElementById("cvly");
|
|
1640
1660
|
if (e) return e.dataset.projectid || e.getAttribute("project-id") || void 0;
|
|
1641
1661
|
}
|
|
1642
|
-
function
|
|
1662
|
+
function Wt(e) {
|
|
1643
1663
|
if (e.projectId) return e.projectId;
|
|
1644
|
-
let t =
|
|
1664
|
+
let t = Ht();
|
|
1645
1665
|
if (t) return t;
|
|
1646
|
-
let n =
|
|
1666
|
+
let n = Ut();
|
|
1647
1667
|
if (n) return n;
|
|
1648
1668
|
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.");
|
|
1649
1669
|
}
|
|
@@ -1652,7 +1672,7 @@ function Rt(e) {
|
|
|
1652
1672
|
function Z(e) {
|
|
1653
1673
|
return e == null || e === "" || Number.isNaN(e);
|
|
1654
1674
|
}
|
|
1655
|
-
var
|
|
1675
|
+
var Gt = {
|
|
1656
1676
|
default: (e, t) => Z(e) ? String(t ?? "") : String(e),
|
|
1657
1677
|
append: (e, t) => t && !Z(e) ? `${e} ${t}` : e,
|
|
1658
1678
|
prepend: (e, t) => t && !Z(e) ? `${t} ${e}` : e,
|
|
@@ -1673,24 +1693,24 @@ var zt = {
|
|
|
1673
1693
|
return e instanceof Set ? t.format(Array.from(e).map(String)) : e;
|
|
1674
1694
|
}
|
|
1675
1695
|
};
|
|
1676
|
-
function
|
|
1696
|
+
function Kt(e) {
|
|
1677
1697
|
return typeof e == "object" && !!e;
|
|
1678
1698
|
}
|
|
1679
|
-
function
|
|
1699
|
+
function qt(e, t) {
|
|
1680
1700
|
let n = t;
|
|
1681
|
-
for (let t of e.split(".")) if (
|
|
1701
|
+
for (let t of e.split(".")) if (Kt(n) && t in n) n = n[t];
|
|
1682
1702
|
else return;
|
|
1683
1703
|
return typeof n == "function" ? n() : n;
|
|
1684
1704
|
}
|
|
1685
|
-
function
|
|
1686
|
-
let n = e.split("|").map((e) => e.trim()), r =
|
|
1705
|
+
function Jt(e, t) {
|
|
1706
|
+
let n = e.split("|").map((e) => e.trim()), r = qt(n.shift() ?? "", t);
|
|
1687
1707
|
for (let e of n) {
|
|
1688
|
-
let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o =
|
|
1708
|
+
let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o = Gt[i];
|
|
1689
1709
|
o && (r = o(r, a));
|
|
1690
1710
|
}
|
|
1691
1711
|
return Z(r) ? "" : typeof r == "object" ? JSON.stringify(r) : String(r);
|
|
1692
1712
|
}
|
|
1693
|
-
function
|
|
1713
|
+
function Yt(e, t) {
|
|
1694
1714
|
let n = "", r = 0;
|
|
1695
1715
|
for (; r < e.length;) if (e[r] === "{" && e[r + 1] === "{") {
|
|
1696
1716
|
r += 2;
|
|
@@ -1702,19 +1722,19 @@ function Ut(e, t) {
|
|
|
1702
1722
|
}
|
|
1703
1723
|
i += e[r++];
|
|
1704
1724
|
}
|
|
1705
|
-
n +=
|
|
1725
|
+
n += Jt(i.trim(), t);
|
|
1706
1726
|
} else n += e[r++];
|
|
1707
1727
|
return n;
|
|
1708
1728
|
}
|
|
1709
1729
|
//#endregion
|
|
1710
1730
|
//#region src/utils/preview-session.ts
|
|
1711
|
-
var
|
|
1712
|
-
function
|
|
1713
|
-
return !s() || !
|
|
1731
|
+
var Xt = "preview-token";
|
|
1732
|
+
function Zt() {
|
|
1733
|
+
return !s() || !g() ? !1 : !!Ft()[Xt]?.[0];
|
|
1714
1734
|
}
|
|
1715
1735
|
//#endregion
|
|
1716
1736
|
//#region src/picked.ts
|
|
1717
|
-
var
|
|
1737
|
+
var Qt = class {
|
|
1718
1738
|
static logger = r;
|
|
1719
1739
|
options;
|
|
1720
1740
|
dataSource = null;
|
|
@@ -1723,6 +1743,9 @@ var Kt = class {
|
|
|
1723
1743
|
contentLoader;
|
|
1724
1744
|
previewEmbedderOrigins = null;
|
|
1725
1745
|
plugins = {};
|
|
1746
|
+
get pluginNames() {
|
|
1747
|
+
return Object.keys(this.plugins);
|
|
1748
|
+
}
|
|
1726
1749
|
dataProviders = /* @__PURE__ */ new Map();
|
|
1727
1750
|
eventBus = P();
|
|
1728
1751
|
events;
|
|
@@ -1730,51 +1753,51 @@ var Kt = class {
|
|
|
1730
1753
|
apiUrl;
|
|
1731
1754
|
dashboardUrl;
|
|
1732
1755
|
documentationSiteUrl;
|
|
1733
|
-
session =
|
|
1734
|
-
searchParams =
|
|
1735
|
-
history =
|
|
1736
|
-
components =
|
|
1737
|
-
experienceInstances =
|
|
1738
|
-
experiences =
|
|
1739
|
-
frameworks =
|
|
1740
|
-
predicates =
|
|
1741
|
-
features =
|
|
1742
|
-
conditions =
|
|
1743
|
-
fields =
|
|
1744
|
-
responses =
|
|
1745
|
-
steps =
|
|
1746
|
-
contents =
|
|
1747
|
-
actions =
|
|
1748
|
-
conditionResults =
|
|
1749
|
-
stateSnapshotStore =
|
|
1750
|
-
evaluateRuleLogicFx =
|
|
1756
|
+
session = Bt();
|
|
1757
|
+
searchParams = Ft();
|
|
1758
|
+
history = rt();
|
|
1759
|
+
components = be({ client: this });
|
|
1760
|
+
experienceInstances = C({ client: this });
|
|
1761
|
+
experiences = fe({ client: this });
|
|
1762
|
+
frameworks = we({ client: this });
|
|
1763
|
+
predicates = Je({ client: this });
|
|
1764
|
+
features = $e({ client: this });
|
|
1765
|
+
conditions = Nt();
|
|
1766
|
+
fields = ct();
|
|
1767
|
+
responses = At({ client: this });
|
|
1768
|
+
steps = dt();
|
|
1769
|
+
contents = ht();
|
|
1770
|
+
actions = yt({ client: this });
|
|
1771
|
+
conditionResults = w();
|
|
1772
|
+
stateSnapshotStore = De({ client: this });
|
|
1773
|
+
evaluateRuleLogicFx = Fe({ client: this });
|
|
1751
1774
|
start;
|
|
1752
1775
|
readyStore;
|
|
1753
1776
|
preconditionPassedStore;
|
|
1754
1777
|
conditionPassedStore;
|
|
1755
1778
|
lifecycleStageStore;
|
|
1756
|
-
lifecycle =
|
|
1779
|
+
lifecycle = Ge({ client: this });
|
|
1757
1780
|
renderStringFx = k({
|
|
1758
1781
|
source: this.responses.listStore,
|
|
1759
1782
|
effect: (e, { template: t, context: n }) => {
|
|
1760
1783
|
let r = {};
|
|
1761
1784
|
for (let t of e) r[t.fieldKey] = t.value;
|
|
1762
|
-
return
|
|
1785
|
+
return Yt(t, {
|
|
1763
1786
|
...n,
|
|
1764
1787
|
responses: r
|
|
1765
1788
|
});
|
|
1766
1789
|
}
|
|
1767
1790
|
});
|
|
1768
1791
|
constructor(e) {
|
|
1769
|
-
this.events =
|
|
1792
|
+
this.events = at(this.eventBus), this.projectId = Wt(e), this.options = Object.freeze(e), this.apiUrl = e.apiUrl || Pt(), 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.setupComponents(), this.lifecycle.setPrecondition(e.precondition), this.lifecycle.setCondition(e.condition), this.eventBus({
|
|
1770
1793
|
type: "load",
|
|
1771
|
-
version:
|
|
1794
|
+
version: re()
|
|
1772
1795
|
}), this.maybeStartPreviewChannel();
|
|
1773
1796
|
}
|
|
1774
1797
|
dataProviderFor(e) {
|
|
1775
1798
|
let t = e ?? "", n = this.dataProviders.get(t);
|
|
1776
1799
|
if (n) return n;
|
|
1777
|
-
let r = import("../provider-
|
|
1800
|
+
let r = import("../provider-DLebj-AW.js").then((t) => t.createPickedDataProvider({
|
|
1778
1801
|
apiUrl: this.apiUrl,
|
|
1779
1802
|
projectId: this.projectId,
|
|
1780
1803
|
...e !== void 0 && { previewToken: e }
|
|
@@ -1790,24 +1813,24 @@ var Kt = class {
|
|
|
1790
1813
|
return (await this.dataProviderFor(t?.previewToken)).getContent(e, t?.signal === void 0 ? void 0 : { signal: t.signal });
|
|
1791
1814
|
}
|
|
1792
1815
|
maybeStartPreviewChannel() {
|
|
1793
|
-
|
|
1816
|
+
Zt() && import("../preview-channel-CSr96XAo.js").then((e) => e.initPreviewChannel(this)).catch(() => void 0);
|
|
1794
1817
|
}
|
|
1795
1818
|
registerFramework = (e) => {
|
|
1796
|
-
|
|
1819
|
+
Te(e, this.frameworks);
|
|
1797
1820
|
};
|
|
1798
1821
|
registerComponent = (e, t) => {
|
|
1799
|
-
|
|
1822
|
+
xe(e, t, this.components);
|
|
1800
1823
|
};
|
|
1801
1824
|
registerPlugin = (e) => {
|
|
1802
|
-
|
|
1825
|
+
he(this, e, this.plugins);
|
|
1803
1826
|
let t = this.plugins[e.name];
|
|
1804
1827
|
t?.onStart && this.lifecycle.registerPluginStartHook(t.onStart);
|
|
1805
1828
|
};
|
|
1806
1829
|
registerFeature = (e, t) => {
|
|
1807
|
-
|
|
1830
|
+
et(e, t, this.features);
|
|
1808
1831
|
};
|
|
1809
1832
|
registerPredicate = (e, t) => {
|
|
1810
|
-
|
|
1833
|
+
Ye(e, t, this.predicates);
|
|
1811
1834
|
};
|
|
1812
1835
|
registerCondition = (e) => {
|
|
1813
1836
|
this.conditions.register(e);
|
|
@@ -1816,19 +1839,19 @@ var Kt = class {
|
|
|
1816
1839
|
this.fields.register(e);
|
|
1817
1840
|
};
|
|
1818
1841
|
registerStep = (e) => {
|
|
1819
|
-
|
|
1842
|
+
ft(e, this.steps);
|
|
1820
1843
|
};
|
|
1821
1844
|
registerContent = (e) => {
|
|
1822
|
-
|
|
1845
|
+
gt(e, this.contents);
|
|
1823
1846
|
};
|
|
1824
1847
|
patchContent = (e, t) => {
|
|
1825
1848
|
this.contents.patch(e, t);
|
|
1826
1849
|
};
|
|
1827
1850
|
registerAction = (e, t) => {
|
|
1828
|
-
|
|
1851
|
+
bt(e, t, this.actions);
|
|
1829
1852
|
};
|
|
1830
1853
|
registerExperience = (e) => {
|
|
1831
|
-
e.component &&
|
|
1854
|
+
e.component && xe(`experience:${e.id}`, e.component, this.components), this.experiences.register(e);
|
|
1832
1855
|
};
|
|
1833
1856
|
launchExperienceById = async (e, t) => {
|
|
1834
1857
|
this.experiences.launch({
|
|
@@ -1873,7 +1896,7 @@ var Kt = class {
|
|
|
1873
1896
|
try {
|
|
1874
1897
|
let [t, n] = e.split(":");
|
|
1875
1898
|
if (!t || !n) return;
|
|
1876
|
-
let r =
|
|
1899
|
+
let r = Ze(n);
|
|
1877
1900
|
this.registerFeature(t, {
|
|
1878
1901
|
key: `${r}`,
|
|
1879
1902
|
name: t,
|
|
@@ -1910,8 +1933,8 @@ var Kt = class {
|
|
|
1910
1933
|
});
|
|
1911
1934
|
}
|
|
1912
1935
|
getPluginConfig = (e) => this.plugins[e] ?? {};
|
|
1913
|
-
},
|
|
1914
|
-
async function
|
|
1936
|
+
}, $t = "application/picked-javascript", en = "application/picked-module", tn = "data-picked-hydrated";
|
|
1937
|
+
async function nn(e) {
|
|
1915
1938
|
if (!("document" in globalThis)) return;
|
|
1916
1939
|
let t = "application/picked-module", n = "data-picked-hydrated";
|
|
1917
1940
|
function r(e) {
|
|
@@ -1940,23 +1963,23 @@ async function Xt(e) {
|
|
|
1940
1963
|
a && await a;
|
|
1941
1964
|
}
|
|
1942
1965
|
}
|
|
1943
|
-
function
|
|
1944
|
-
return `<script>(${
|
|
1966
|
+
function rn() {
|
|
1967
|
+
return `<script>(${nn.toString()})(document)<\/script>`;
|
|
1945
1968
|
}
|
|
1946
1969
|
//#endregion
|
|
1947
1970
|
//#region src/utils/html-asset-value.ts
|
|
1948
|
-
function
|
|
1971
|
+
function an(e) {
|
|
1949
1972
|
return typeof e == "object" && !!e && "id" in e && typeof e.id == "string" && "content" in e && (typeof e.content == "string" || e.content === null);
|
|
1950
1973
|
}
|
|
1951
1974
|
//#endregion
|
|
1952
1975
|
//#region src/entities/component/lazyComponent.ts
|
|
1953
|
-
function
|
|
1976
|
+
function on(e) {
|
|
1954
1977
|
return {
|
|
1955
1978
|
$$type: "lazy-component",
|
|
1956
1979
|
load: e
|
|
1957
1980
|
};
|
|
1958
1981
|
}
|
|
1959
|
-
function
|
|
1982
|
+
function sn(e) {
|
|
1960
1983
|
return typeof e == "object" && !!e && "$$type" in e && e.$$type === "lazy-component";
|
|
1961
1984
|
}
|
|
1962
1985
|
//#endregion
|
|
@@ -1967,15 +1990,15 @@ function Q(e) {
|
|
|
1967
1990
|
function $(e) {
|
|
1968
1991
|
return Q(e) ? e.contentEntryId : null;
|
|
1969
1992
|
}
|
|
1970
|
-
function
|
|
1993
|
+
function cn(e) {
|
|
1971
1994
|
let t = Array.isArray(e) ? e : [e], n = [];
|
|
1972
1995
|
for (let e of t) Q(e) && n.push(e.contentEntryId);
|
|
1973
1996
|
return n;
|
|
1974
1997
|
}
|
|
1975
|
-
function
|
|
1998
|
+
function ln(e, t) {
|
|
1976
1999
|
return t === null ? null : e[t] ?? null;
|
|
1977
2000
|
}
|
|
1978
|
-
function
|
|
2001
|
+
function un(e, t) {
|
|
1979
2002
|
let n = [];
|
|
1980
2003
|
for (let r of t) {
|
|
1981
2004
|
let t = e[r];
|
|
@@ -1983,29 +2006,29 @@ function rn(e, t) {
|
|
|
1983
2006
|
}
|
|
1984
2007
|
return n;
|
|
1985
2008
|
}
|
|
1986
|
-
function
|
|
1987
|
-
if (
|
|
2009
|
+
function dn(e, t) {
|
|
2010
|
+
if (se.store(t)) return A(t, e.indexStore, (e, t) => ln(t, $(e)));
|
|
1988
2011
|
let n = $(t);
|
|
1989
|
-
return e.indexStore.map((e) =>
|
|
2012
|
+
return e.indexStore.map((e) => ln(e, n), { skipVoid: !1 });
|
|
1990
2013
|
}
|
|
1991
|
-
function
|
|
1992
|
-
if (
|
|
1993
|
-
let n =
|
|
1994
|
-
return e.indexStore.map((e) =>
|
|
2014
|
+
function fn(e, t) {
|
|
2015
|
+
if (se.store(t)) return A(t, e.indexStore, (e, t) => un(t, cn(e)));
|
|
2016
|
+
let n = cn(t);
|
|
2017
|
+
return e.indexStore.map((e) => un(e, n), { skipVoid: !1 });
|
|
1995
2018
|
}
|
|
1996
2019
|
//#endregion
|
|
1997
2020
|
//#region src/exports.ts
|
|
1998
|
-
var
|
|
1999
|
-
let t = new
|
|
2021
|
+
var pn = (e) => {
|
|
2022
|
+
let t = new Qt(e);
|
|
2000
2023
|
return u(t), t;
|
|
2001
2024
|
};
|
|
2002
2025
|
//#endregion
|
|
2003
2026
|
//#region src/typed-content.ts
|
|
2004
|
-
function
|
|
2027
|
+
function mn(e) {
|
|
2005
2028
|
return typeof e.data == "object";
|
|
2006
2029
|
}
|
|
2007
|
-
function
|
|
2008
|
-
return e.map((e) => !e || !
|
|
2030
|
+
function hn(e) {
|
|
2031
|
+
return e.map((e) => !e || !mn(e) ? null : e, { skipVoid: !1 });
|
|
2009
2032
|
}
|
|
2010
2033
|
//#endregion
|
|
2011
|
-
export {
|
|
2034
|
+
export { tn as PICKED_HYDRATED_ATTR, en as PICKED_MODULE_SCRIPT_TYPE, $t as PICKED_SCRIPT_TYPE, Xt as PREVIEW_TOKEN_PARAM, Qt as Picked, rn as buildRehydrateBootstrap, pn as createClient, me as createPluginEffect, O as createStorageKey, dn as deriveReference, fn as deriveReferences, n as evaluateRuleLogic, Vt as getPickedConfig, Q as isContentReference, an as isHtmlAssetValue, g as isInsideIframe, sn as isLazyLoader, v as isPickedRoot, Zt as isPreviewSession, on as lazyComponent, E as localStore, oe as onInertScriptSubtrees, $ as readReferenceId, cn as readReferenceIds, nn as rehydrateScripts, ie as reportInertScriptSubtrees, ae 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, hn as toTypedContentStore };
|