@picked/client 0.0.98-next.1 → 0.0.98-next.2
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-CONFKApU.js → api-C3VRwEmm.js} +1 -1
- package/dist/{api-BgPyneD7.cjs → api-PeY2M79y.cjs} +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/docs/how-to/register-an-action-handler.md +19 -1
- package/dist/docs/how-to/wait-for-an-action-response.md +182 -0
- package/dist/docs/reference/dashboard/actions.mdx +5 -2
- package/dist/docs/reference/delivery-api/workspace-schema.md +3 -0
- package/dist/docs/reference/sdk/actions.md +127 -3
- package/dist/docs/reference/sdk/type-generation.md +8 -0
- package/dist/esm/index.js +514 -328
- package/dist/esm/plugins/dynamic-experiences/index.js +4 -4
- package/dist/esm/server/index.js +3 -3
- package/dist/{experience-instance-DptBuxBJ.js → experience-instance-4KUBH8Gb.js} +278 -220
- package/dist/experience-instance-C9WV52iQ.cjs +1 -0
- package/dist/{plugin-BZg0v-pk.js → plugin-DCUBvwwg.js} +96 -69
- package/dist/plugin-Dbj4RFUo.cjs +1 -0
- package/dist/{preview-unavailable-zegsv152.js → preview-unavailable-CRdiC9KU.js} +1 -1
- package/dist/{preview-unavailable-BC8sZ_nk.cjs → preview-unavailable-ChKFij_K.cjs} +1 -1
- package/dist/{provider-DHsKj_FK.js → provider-B3cWi4ev.js} +1 -1
- package/dist/{provider-reK0A8tr.cjs → provider-DtJJrz-_.cjs} +1 -1
- package/dist/types/entities/action/action.d.ts +94 -23
- package/dist/types/entities/action/action.d.ts.map +1 -1
- package/dist/types/entities/experience-instance/experience-instance.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/rules-logic.d.ts.map +1 -1
- package/dist/types/picked.d.ts +26 -6
- package/dist/types/picked.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.map +1 -1
- package/dist/types/schema-registry.d.ts +10 -0
- package/dist/types/schema-registry.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/experience-instance-CQvQHCNe.cjs +0 -1
- package/dist/plugin-CuYWwfVi.cjs +0 -1
package/dist/esm/index.js
CHANGED
|
@@ -3,17 +3,17 @@ import { n as t, t as n } from "../rules-logic-9hh8y_1b.js";
|
|
|
3
3
|
import { t as r } from "../logger-DMN6TxJJ.js";
|
|
4
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
5
|
import { a as v, i as y, r as ee, s as b, t as x } from "../dom-BqcToNL0.js";
|
|
6
|
-
import { d as S, l as C, n as w, r as
|
|
7
|
-
import { apply as
|
|
8
|
-
import { i as
|
|
9
|
-
import { a as ie, c as ae, l as oe, n as se, o as ce, r as
|
|
10
|
-
import { t as
|
|
11
|
-
import { n as
|
|
12
|
-
import { attach as
|
|
13
|
-
import { createFactory as
|
|
6
|
+
import { d as S, l as C, n as w, r as T, u as E } from "../experience-instance-4KUBH8Gb.js";
|
|
7
|
+
import { apply as D } from "./logic-engine.js";
|
|
8
|
+
import { i as te, n as O, r as ne, t as re } from "../storage-1MW3-_As.js";
|
|
9
|
+
import { a as ie, c as ae, l as oe, n as se, o as ce, r as le, s as ue, t as de } from "../preview-unavailable-CRdiC9KU.js";
|
|
10
|
+
import { t as fe } from "../id-Bo4RBeOs.js";
|
|
11
|
+
import { n as pe, r as me, t as he } from "../inert-script-report-B_bMPRzp.js";
|
|
12
|
+
import { attach as k, clearNode as ge, combine as A, createApi as j, createDomain as M, createEffect as N, createEvent as P, createNode as _e, createStore as F, is as ve, sample as I, withRegion as ye } from "effector";
|
|
13
|
+
import { createFactory as L, invoke as R } from "@withease/factories";
|
|
14
14
|
//#region src/entities/experience/experience.ts
|
|
15
|
-
var
|
|
16
|
-
let i =
|
|
15
|
+
var z = M("experience"), be = L(({ client: e, experience: r }) => {
|
|
16
|
+
let i = z.store(r), a = j(i, { merge(e, t) {
|
|
17
17
|
return {
|
|
18
18
|
...e,
|
|
19
19
|
...t.experience
|
|
@@ -23,15 +23,15 @@ var H = P("experience"), me = B(({ client: e, experience: r }) => {
|
|
|
23
23
|
decisionLogic: e.condition,
|
|
24
24
|
targetSelectors: e.targets,
|
|
25
25
|
initializeOpenLogic: e.initializeOpen
|
|
26
|
-
})), s =
|
|
27
|
-
let r = e.nodes.filter(S).map((e) => t[e.stepId]).filter((e) => e !== void 0), i = e.nodes.filter(
|
|
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(S).map((e) => t[e.stepId]).filter((e) => e !== void 0), i = e.nodes.filter(E).map((e) => n[e.conditionId]).filter((e) => e !== void 0);
|
|
28
28
|
return {
|
|
29
29
|
steps: r,
|
|
30
30
|
nodes: e.nodes,
|
|
31
31
|
edges: e.edges,
|
|
32
32
|
conditions: i
|
|
33
33
|
};
|
|
34
|
-
}), l = i.map((e) => C(e.nodes, e.edges)), u = r.actions ?? [], d, f =
|
|
34
|
+
}), l = i.map((e) => C(e.nodes, e.edges)), u = r.actions ?? [], d, f = k({
|
|
35
35
|
source: o,
|
|
36
36
|
effect: (t, n) => {
|
|
37
37
|
let i = y(t.targetSelectors, r.id);
|
|
@@ -39,18 +39,18 @@ var H = P("experience"), me = B(({ client: e, experience: r }) => {
|
|
|
39
39
|
n ? e.experienceInstances.spawn(d, t, n) : e.experienceInstances.spawn(d, t);
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
}), p =
|
|
42
|
+
}), p = A({
|
|
43
43
|
preconditionPassed: e.preconditionPassedStore,
|
|
44
44
|
isUser: e.session.store.map((e) => e.isUser, { skipVoid: !1 }),
|
|
45
45
|
config: o
|
|
46
|
-
}), m =
|
|
46
|
+
}), m = k({
|
|
47
47
|
source: p,
|
|
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
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
|
-
}), h =
|
|
53
|
+
}), h = N(async () => {
|
|
54
54
|
if (!e.contentLoader) return !0;
|
|
55
55
|
try {
|
|
56
56
|
await e.contentLoader({
|
|
@@ -61,26 +61,26 @@ var H = P("experience"), me = B(({ client: e, experience: r }) => {
|
|
|
61
61
|
`${r.id}`;
|
|
62
62
|
}
|
|
63
63
|
return !0;
|
|
64
|
-
}), g =
|
|
65
|
-
return
|
|
64
|
+
}), g = P(), _ = P(), v = z.createStore(void 0, { skipVoid: !1 }).on(g, (e, t) => t).on(_, (e, t) => t);
|
|
65
|
+
return I({
|
|
66
66
|
clock: g,
|
|
67
67
|
target: m
|
|
68
|
-
}),
|
|
68
|
+
}), I({
|
|
69
69
|
clock: m.doneData,
|
|
70
70
|
source: v,
|
|
71
71
|
filter: (e, t) => t,
|
|
72
72
|
fn: (e) => e,
|
|
73
73
|
target: f
|
|
74
|
-
}),
|
|
74
|
+
}), I({
|
|
75
75
|
clock: m.doneData,
|
|
76
76
|
filter: Boolean,
|
|
77
77
|
target: h
|
|
78
|
-
}),
|
|
78
|
+
}), I({
|
|
79
79
|
clock: _,
|
|
80
80
|
source: v,
|
|
81
81
|
fn: (e) => e,
|
|
82
82
|
target: f
|
|
83
|
-
}),
|
|
83
|
+
}), I({
|
|
84
84
|
clock: _,
|
|
85
85
|
target: h
|
|
86
86
|
}), d = {
|
|
@@ -100,22 +100,22 @@ var H = P("experience"), me = B(({ client: e, experience: r }) => {
|
|
|
100
100
|
prepareExperienceContentFx: h
|
|
101
101
|
}, d;
|
|
102
102
|
});
|
|
103
|
-
function
|
|
104
|
-
return
|
|
103
|
+
function xe(e) {
|
|
104
|
+
return R(be, e);
|
|
105
105
|
}
|
|
106
|
-
var
|
|
107
|
-
let t =
|
|
106
|
+
var Se = L(({ client: e }) => {
|
|
107
|
+
let t = z.store({}), n = j(t, { register(e, t) {
|
|
108
108
|
return {
|
|
109
109
|
...e,
|
|
110
110
|
[t.id]: t
|
|
111
111
|
};
|
|
112
|
-
} }), r =
|
|
113
|
-
n.register(
|
|
112
|
+
} }), r = P(), i = N((t) => {
|
|
113
|
+
n.register(xe({
|
|
114
114
|
client: e,
|
|
115
115
|
experience: t
|
|
116
116
|
}));
|
|
117
117
|
});
|
|
118
|
-
|
|
118
|
+
I({
|
|
119
119
|
clock: r,
|
|
120
120
|
source: t,
|
|
121
121
|
filter: (e, t) => e[t.id] !== void 0,
|
|
@@ -128,7 +128,7 @@ var ge = B(({ client: e }) => {
|
|
|
128
128
|
experience: t,
|
|
129
129
|
strategy: "override"
|
|
130
130
|
});
|
|
131
|
-
}),
|
|
131
|
+
}), I({
|
|
132
132
|
clock: r,
|
|
133
133
|
source: t,
|
|
134
134
|
filter: (e, t) => e[t.id] === void 0,
|
|
@@ -142,7 +142,7 @@ var ge = B(({ client: e }) => {
|
|
|
142
142
|
function s(e) {
|
|
143
143
|
return t.map((t) => Object.values(t).find((t) => t.key === e) ?? t[e], { skipVoid: !1 });
|
|
144
144
|
}
|
|
145
|
-
let c =
|
|
145
|
+
let c = k({
|
|
146
146
|
source: t,
|
|
147
147
|
effect: (e, t) => {
|
|
148
148
|
let n = "key" in t ? Object.values(e).find((e) => e.key === t.key) : e[t.id];
|
|
@@ -160,7 +160,7 @@ var ge = B(({ client: e }) => {
|
|
|
160
160
|
getById: o,
|
|
161
161
|
getByKey: s,
|
|
162
162
|
launch: c,
|
|
163
|
-
open:
|
|
163
|
+
open: k({
|
|
164
164
|
source: {
|
|
165
165
|
experiences: t,
|
|
166
166
|
instances: e.experienceInstances.listStore
|
|
@@ -188,7 +188,7 @@ var ge = B(({ client: e }) => {
|
|
|
188
188
|
}
|
|
189
189
|
}),
|
|
190
190
|
listStore: a,
|
|
191
|
-
initialiseExperiencesFx:
|
|
191
|
+
initialiseExperiencesFx: k({
|
|
192
192
|
source: a,
|
|
193
193
|
effect: (e) => {
|
|
194
194
|
for (let t of e) t.initialiseRequested(void 0);
|
|
@@ -196,48 +196,48 @@ var ge = B(({ client: e }) => {
|
|
|
196
196
|
})
|
|
197
197
|
};
|
|
198
198
|
});
|
|
199
|
-
function
|
|
200
|
-
return
|
|
199
|
+
function Ce(e) {
|
|
200
|
+
return R(Se, e);
|
|
201
201
|
}
|
|
202
|
-
var
|
|
202
|
+
var we = async (e) => {
|
|
203
203
|
await e.experiences.initialiseExperiencesFx();
|
|
204
204
|
};
|
|
205
205
|
//#endregion
|
|
206
206
|
//#region src/entities/plugin/plugin.ts
|
|
207
|
-
function
|
|
208
|
-
return
|
|
207
|
+
function Te(e) {
|
|
208
|
+
return N(async () => {
|
|
209
209
|
await e();
|
|
210
210
|
});
|
|
211
211
|
}
|
|
212
|
-
var
|
|
212
|
+
var Ee = (e, t, n) => {
|
|
213
213
|
let r = t.name, i = t.setup(e), a = n[r] ?? {};
|
|
214
214
|
n[r] = Object.freeze({
|
|
215
215
|
...a,
|
|
216
216
|
...i
|
|
217
217
|
});
|
|
218
|
-
},
|
|
218
|
+
}, De = M("component"), Oe = L(({ client: e, component: t, name: n }) => ({
|
|
219
219
|
name: n,
|
|
220
220
|
component: t,
|
|
221
221
|
frameworkStore: e.frameworks.getByName(t.frameworkName)
|
|
222
222
|
}));
|
|
223
|
-
function
|
|
224
|
-
return
|
|
223
|
+
function ke(e) {
|
|
224
|
+
return R(Oe, e);
|
|
225
225
|
}
|
|
226
|
-
var
|
|
227
|
-
let t =
|
|
226
|
+
var Ae = L(({ client: e }) => {
|
|
227
|
+
let t = De.store({}), n = j(t, { register(e, t) {
|
|
228
228
|
return {
|
|
229
229
|
...e,
|
|
230
230
|
[t.name]: t
|
|
231
231
|
};
|
|
232
|
-
} }), i =
|
|
233
|
-
|
|
232
|
+
} }), i = P();
|
|
233
|
+
I({
|
|
234
234
|
clock: i,
|
|
235
235
|
source: t,
|
|
236
236
|
filter: (e, { name: t }) => e[t] !== void 0,
|
|
237
237
|
fn: (e, { name: t }) => `Component '${t}' already registered. Registering again will override the previous registration.`
|
|
238
|
-
}).watch((e) => /* @__PURE__ */ r("warn", e)),
|
|
238
|
+
}).watch((e) => /* @__PURE__ */ r("warn", e)), I({
|
|
239
239
|
clock: i,
|
|
240
|
-
fn: ({ name: t, component: n }) =>
|
|
240
|
+
fn: ({ name: t, component: n }) => ke({
|
|
241
241
|
client: e,
|
|
242
242
|
name: t,
|
|
243
243
|
component: n
|
|
@@ -254,27 +254,27 @@ var we = B(({ client: e }) => {
|
|
|
254
254
|
listStore: a
|
|
255
255
|
};
|
|
256
256
|
});
|
|
257
|
-
function
|
|
258
|
-
return
|
|
257
|
+
function je(e) {
|
|
258
|
+
return R(Ae, e);
|
|
259
259
|
}
|
|
260
|
-
var
|
|
260
|
+
var Me = (e, t, n) => {
|
|
261
261
|
n.register({
|
|
262
262
|
name: e,
|
|
263
263
|
component: t
|
|
264
264
|
});
|
|
265
|
-
},
|
|
266
|
-
let t =
|
|
265
|
+
}, Ne = M("framework"), Pe = L((e) => {
|
|
266
|
+
let t = Ne.store({}), n = j(t, { register(e, t) {
|
|
267
267
|
return {
|
|
268
268
|
...e,
|
|
269
269
|
[t.name]: t.framework
|
|
270
270
|
};
|
|
271
|
-
} }), i =
|
|
272
|
-
|
|
271
|
+
} }), i = P();
|
|
272
|
+
I({
|
|
273
273
|
clock: i,
|
|
274
274
|
source: t,
|
|
275
275
|
filter: (e, { name: t }) => e[t] !== void 0,
|
|
276
276
|
fn: (e, { name: t }) => `Framework '${t}' already registered. Registering again will override the previous registration.`
|
|
277
|
-
}).watch((e) => /* @__PURE__ */ r("warn", e)),
|
|
277
|
+
}).watch((e) => /* @__PURE__ */ r("warn", e)), I({
|
|
278
278
|
clock: i,
|
|
279
279
|
target: n.register
|
|
280
280
|
});
|
|
@@ -288,44 +288,53 @@ var U = (e, t, n) => {
|
|
|
288
288
|
listStore: a
|
|
289
289
|
};
|
|
290
290
|
});
|
|
291
|
-
function
|
|
292
|
-
return
|
|
291
|
+
function Fe(e) {
|
|
292
|
+
return R(Pe, e);
|
|
293
293
|
}
|
|
294
|
-
var
|
|
294
|
+
var Ie = (e, t) => {
|
|
295
295
|
t.register({
|
|
296
296
|
name: e.name,
|
|
297
297
|
framework: e
|
|
298
298
|
});
|
|
299
|
-
},
|
|
299
|
+
}, Le = L(({ client: e }) => {
|
|
300
300
|
let t = "window" in globalThis, n = {
|
|
301
301
|
location: t ? globalThis.location : void 0,
|
|
302
302
|
document: t ? globalThis.document : void 0,
|
|
303
303
|
sessionStorage: t ? globalThis.sessionStorage : void 0,
|
|
304
304
|
localStorage: t ? globalThis.localStorage : void 0
|
|
305
305
|
};
|
|
306
|
-
return
|
|
306
|
+
return A(e.responses.listStore, e.fields.listStore, (t, r) => Object.freeze({
|
|
307
307
|
client: e,
|
|
308
308
|
responses: t,
|
|
309
309
|
fields: r,
|
|
310
310
|
...n
|
|
311
311
|
}));
|
|
312
312
|
});
|
|
313
|
-
function
|
|
314
|
-
return
|
|
313
|
+
function Re(e) {
|
|
314
|
+
return R(Le, e);
|
|
315
315
|
}
|
|
316
316
|
//#endregion
|
|
317
317
|
//#region src/lifecycle/rules-logic.ts
|
|
318
|
-
function
|
|
318
|
+
function ze(e, t, n) {
|
|
319
319
|
return new Proxy(Object.create(null), { get(r, i) {
|
|
320
320
|
if (typeof i != "string") return;
|
|
321
321
|
let a = e.find((e) => e.key === i);
|
|
322
|
-
if (a !== void 0) return async () => !n.has(i) && await
|
|
322
|
+
if (a !== void 0) return async () => !n.has(i) && await D(a.logic, {
|
|
323
323
|
...t,
|
|
324
|
-
conditions:
|
|
324
|
+
conditions: ze(e, t, new Set(n).add(i))
|
|
325
325
|
}) === !0;
|
|
326
326
|
} });
|
|
327
327
|
}
|
|
328
|
-
|
|
328
|
+
function Be(e, t = [], n = /* @__PURE__ */ new WeakSet()) {
|
|
329
|
+
if (e == null || typeof e == "string" || typeof e == "number" || typeof e == "boolean") return !0;
|
|
330
|
+
if (typeof e != "object" || t.includes(e)) return !1;
|
|
331
|
+
if (n.has(e)) return !0;
|
|
332
|
+
let r = Object.getPrototypeOf(e);
|
|
333
|
+
if (!Array.isArray(e) && r !== Object.prototype && r !== null) return !1;
|
|
334
|
+
let i = [...t, e];
|
|
335
|
+
return Object.values(e).every((e) => Be(e, i, n)) ? (n.add(e), !0) : !1;
|
|
336
|
+
}
|
|
337
|
+
var Ve = L(({ client: e }) => k({
|
|
329
338
|
source: {
|
|
330
339
|
stateSnapshot: e.stateSnapshotStore,
|
|
331
340
|
predicates: e.predicates.listStore,
|
|
@@ -338,10 +347,13 @@ var Me = B(({ client: e }) => j({
|
|
|
338
347
|
let c = t.reduce((t, n) => (t[n.name] = async (...t) => await n.predicate({
|
|
339
348
|
...e,
|
|
340
349
|
args: t
|
|
341
|
-
}), t), {}), l = n.reduce((t, n) => (t[n.key] = async (...t) =>
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
350
|
+
}), t), {}), l = n.reduce((t, n) => (t[n.key] = async (...t) => {
|
|
351
|
+
let r = await n.action({
|
|
352
|
+
...e,
|
|
353
|
+
args: t
|
|
354
|
+
}, null);
|
|
355
|
+
return Be(r) ? r : void 0;
|
|
356
|
+
}, t), {}), u = r.reduce((e, t) => (e[t.id] = async () => {
|
|
345
357
|
let { bucket: e } = await t.getBucket();
|
|
346
358
|
return e;
|
|
347
359
|
}, e), {}), d = {
|
|
@@ -363,129 +375,129 @@ var Me = B(({ client: e }) => j({
|
|
|
363
375
|
...s
|
|
364
376
|
}, f = {
|
|
365
377
|
...d,
|
|
366
|
-
conditions:
|
|
378
|
+
conditions: ze(a, d, /* @__PURE__ */ new Set())
|
|
367
379
|
};
|
|
368
|
-
return await
|
|
380
|
+
return await D(o, f);
|
|
369
381
|
}
|
|
370
382
|
}));
|
|
371
|
-
function
|
|
372
|
-
return
|
|
383
|
+
function He(e) {
|
|
384
|
+
return R(Ve, e);
|
|
373
385
|
}
|
|
374
386
|
//#endregion
|
|
375
387
|
//#region src/lifecycle/lifecycle.ts
|
|
376
|
-
var
|
|
377
|
-
let t =
|
|
388
|
+
var B = M("lifecycle"), Ue = L(({ client: e }) => {
|
|
389
|
+
let t = B.store(!1), r = F(void 0, {
|
|
378
390
|
skipVoid: !1,
|
|
379
|
-
domain:
|
|
380
|
-
}), i =
|
|
391
|
+
domain: B
|
|
392
|
+
}), i = F(void 0, {
|
|
381
393
|
skipVoid: !1,
|
|
382
|
-
domain:
|
|
383
|
-
}), a =
|
|
394
|
+
domain: B
|
|
395
|
+
}), a = B.store("idle"), o = B.store([]), s = F(void 0, {
|
|
384
396
|
skipVoid: !1,
|
|
385
|
-
domain:
|
|
386
|
-
}), l =
|
|
397
|
+
domain: B
|
|
398
|
+
}), l = F(void 0, {
|
|
387
399
|
skipVoid: !1,
|
|
388
|
-
domain:
|
|
389
|
-
}), u =
|
|
400
|
+
domain: B
|
|
401
|
+
}), u = P(), d = P(), f = P(), p = P(), m = P(), h = P();
|
|
390
402
|
o.on(p, (e, t) => [...e, t]), s.on(m, (e, t) => t), l.on(h, (e, t) => t), t.on(d, () => !0);
|
|
391
|
-
let g =
|
|
403
|
+
let g = N(async () => {
|
|
392
404
|
await ee();
|
|
393
|
-
}), _ =
|
|
394
|
-
await
|
|
395
|
-
}), v =
|
|
405
|
+
}), _ = N(async () => {
|
|
406
|
+
await we(e);
|
|
407
|
+
}), v = k({ effect: _ }), y = k({
|
|
396
408
|
source: o,
|
|
397
409
|
effect: async (e) => {
|
|
398
410
|
for (let t of e) await t();
|
|
399
411
|
}
|
|
400
|
-
}), b =
|
|
412
|
+
}), b = k({
|
|
401
413
|
source: s,
|
|
402
414
|
effect: async (t) => t === void 0 ? !0 : typeof t == "boolean" ? t : await n(e, t) === !0
|
|
403
|
-
}), x =
|
|
415
|
+
}), x = k({
|
|
404
416
|
source: l,
|
|
405
417
|
effect: async (t) => t === void 0 ? !0 : typeof t == "boolean" ? t : await n(e, t) === !0
|
|
406
|
-
}), S =
|
|
418
|
+
}), S = I({
|
|
407
419
|
clock: u,
|
|
408
420
|
source: a,
|
|
409
421
|
filter: (e) => e === "idle" && c(),
|
|
410
422
|
fn: () => void 0
|
|
411
423
|
});
|
|
412
|
-
|
|
424
|
+
I({
|
|
413
425
|
clock: S,
|
|
414
426
|
fn: () => "starting",
|
|
415
427
|
target: a
|
|
416
|
-
}), S.watch(e.performance.markBegin), d.watch(e.performance.measure),
|
|
428
|
+
}), S.watch(e.performance.markBegin), d.watch(e.performance.measure), I({
|
|
417
429
|
clock: S,
|
|
418
430
|
target: y
|
|
419
|
-
}),
|
|
431
|
+
}), I({
|
|
420
432
|
clock: S,
|
|
421
433
|
target: g
|
|
422
|
-
}),
|
|
434
|
+
}), I({
|
|
423
435
|
clock: y.done,
|
|
424
436
|
target: b
|
|
425
|
-
}),
|
|
437
|
+
}), I({
|
|
426
438
|
clock: b.doneData,
|
|
427
439
|
target: r
|
|
428
|
-
}),
|
|
440
|
+
}), I({
|
|
429
441
|
clock: x.doneData,
|
|
430
442
|
target: i
|
|
431
|
-
}),
|
|
443
|
+
}), I({
|
|
432
444
|
clock: b.doneData,
|
|
433
445
|
filter: (e) => e,
|
|
434
446
|
target: x
|
|
435
|
-
}),
|
|
447
|
+
}), I({
|
|
436
448
|
clock: x.doneData,
|
|
437
449
|
target: e.session.setIsUser
|
|
438
|
-
}),
|
|
450
|
+
}), I({
|
|
439
451
|
clock: x.doneData,
|
|
440
452
|
fn: (e) => ({
|
|
441
453
|
type: "user_decide",
|
|
442
454
|
value: e
|
|
443
455
|
}),
|
|
444
456
|
target: e.eventBus
|
|
445
|
-
}),
|
|
457
|
+
}), I({
|
|
446
458
|
clock: b.doneData,
|
|
447
459
|
filter: (e) => !e,
|
|
448
460
|
fn: () => void 0,
|
|
449
461
|
target: f
|
|
450
|
-
}),
|
|
462
|
+
}), I({
|
|
451
463
|
clock: x.doneData,
|
|
452
464
|
fn: () => void 0,
|
|
453
465
|
target: f
|
|
454
|
-
}),
|
|
466
|
+
}), I({
|
|
455
467
|
clock: f,
|
|
456
468
|
fn: () => ({ type: "initialize" }),
|
|
457
469
|
target: e.eventBus
|
|
458
470
|
});
|
|
459
|
-
let C =
|
|
460
|
-
|
|
471
|
+
let C = F(!1).on(g.done, () => !0), w = F(!1).on(f, () => !0), T = F(!1).on(v.done, () => !0), E = A(r, i, (e, t) => e === !0 && t === !0);
|
|
472
|
+
I({
|
|
461
473
|
clock: f,
|
|
462
|
-
source:
|
|
474
|
+
source: E,
|
|
463
475
|
filter: (e) => e,
|
|
464
476
|
fn: () => void 0,
|
|
465
477
|
target: _
|
|
466
478
|
});
|
|
467
|
-
let
|
|
468
|
-
|
|
469
|
-
clock:
|
|
479
|
+
let D = A(C, w, E, (e, t, n) => e && t && n);
|
|
480
|
+
I({
|
|
481
|
+
clock: D,
|
|
470
482
|
filter: (e) => e,
|
|
471
483
|
fn: () => void 0,
|
|
472
484
|
target: v
|
|
473
485
|
});
|
|
474
|
-
let
|
|
475
|
-
return
|
|
476
|
-
clock:
|
|
486
|
+
let te = A(C, w, E, T, (e, t, n, r) => e && t && (!n || r));
|
|
487
|
+
return I({
|
|
488
|
+
clock: te,
|
|
477
489
|
filter: (e) => e,
|
|
478
490
|
fn: () => void 0,
|
|
479
491
|
target: d
|
|
480
|
-
}),
|
|
492
|
+
}), I({
|
|
481
493
|
clock: d,
|
|
482
494
|
fn: () => "ready",
|
|
483
495
|
target: a
|
|
484
|
-
}),
|
|
496
|
+
}), I({
|
|
485
497
|
clock: d,
|
|
486
498
|
fn: () => ({ type: "ready" }),
|
|
487
499
|
target: e.eventBus
|
|
488
|
-
}),
|
|
500
|
+
}), I({
|
|
489
501
|
clock: d,
|
|
490
502
|
source: e.session.store,
|
|
491
503
|
fn: ({ id: e, isUser: t, identifiers: n }) => ({
|
|
@@ -495,7 +507,7 @@ var G = P("lifecycle"), Pe = B(({ client: e }) => {
|
|
|
495
507
|
identifiers: n
|
|
496
508
|
}),
|
|
497
509
|
target: e.eventBus
|
|
498
|
-
}),
|
|
510
|
+
}), I({
|
|
499
511
|
clock: [
|
|
500
512
|
y.fail,
|
|
501
513
|
b.fail,
|
|
@@ -517,13 +529,13 @@ var G = P("lifecycle"), Pe = B(({ client: e }) => {
|
|
|
517
529
|
setCondition: h
|
|
518
530
|
};
|
|
519
531
|
});
|
|
520
|
-
function
|
|
521
|
-
return
|
|
532
|
+
function We(e) {
|
|
533
|
+
return R(Ue, e);
|
|
522
534
|
}
|
|
523
535
|
//#endregion
|
|
524
536
|
//#region src/entities/predicate/predicate.ts
|
|
525
|
-
var
|
|
526
|
-
let t =
|
|
537
|
+
var Ge = M("predicate"), Ke = L(({ client: e }) => {
|
|
538
|
+
let t = Ge.store({}), n = j(t, { register(e, t) {
|
|
527
539
|
return {
|
|
528
540
|
...e,
|
|
529
541
|
[t.name]: {
|
|
@@ -531,13 +543,13 @@ var Ie = P("predicate"), Le = B(({ client: e }) => {
|
|
|
531
543
|
predicate: t.predicate
|
|
532
544
|
}
|
|
533
545
|
};
|
|
534
|
-
} }), i =
|
|
535
|
-
|
|
546
|
+
} }), i = P();
|
|
547
|
+
I({
|
|
536
548
|
clock: i,
|
|
537
549
|
source: t,
|
|
538
550
|
filter: (e, { name: t }) => e[t] !== void 0,
|
|
539
551
|
fn: (e, { name: t }) => `Predicate '${t}' already registered. Registering again will override the previous registration.`
|
|
540
|
-
}).watch((e) => /* @__PURE__ */ r("warn", e)),
|
|
552
|
+
}).watch((e) => /* @__PURE__ */ r("warn", e)), I({
|
|
541
553
|
clock: i,
|
|
542
554
|
fn: ({ name: e, predicate: t }) => Object.freeze({
|
|
543
555
|
name: e,
|
|
@@ -550,7 +562,7 @@ var Ie = P("predicate"), Le = B(({ client: e }) => {
|
|
|
550
562
|
return t.map((t) => t[e]?.predicate, { skipVoid: !1 });
|
|
551
563
|
}
|
|
552
564
|
function s(t) {
|
|
553
|
-
let n =
|
|
565
|
+
let n = F(() => void 0, { skipVoid: !1 }), r = k({
|
|
554
566
|
source: {
|
|
555
567
|
predicate: o(t),
|
|
556
568
|
snapshot: e.stateSnapshotStore
|
|
@@ -562,13 +574,13 @@ var Ie = P("predicate"), Le = B(({ client: e }) => {
|
|
|
562
574
|
});
|
|
563
575
|
}
|
|
564
576
|
});
|
|
565
|
-
return
|
|
577
|
+
return I({
|
|
566
578
|
source: {
|
|
567
579
|
responses: e.responses.listStore,
|
|
568
580
|
fields: e.fields.listStore
|
|
569
581
|
},
|
|
570
582
|
target: r
|
|
571
|
-
}),
|
|
583
|
+
}), I({
|
|
572
584
|
clock: r.doneData,
|
|
573
585
|
filter: (e) => e !== void 0,
|
|
574
586
|
target: n
|
|
@@ -581,26 +593,26 @@ var Ie = P("predicate"), Le = B(({ client: e }) => {
|
|
|
581
593
|
getEvokablePredicate: s
|
|
582
594
|
};
|
|
583
595
|
});
|
|
584
|
-
function
|
|
585
|
-
return
|
|
596
|
+
function qe(e) {
|
|
597
|
+
return R(Ke, e);
|
|
586
598
|
}
|
|
587
|
-
var
|
|
599
|
+
var Je = (e, t, n) => {
|
|
588
600
|
n.register({
|
|
589
601
|
name: e,
|
|
590
602
|
predicate: t
|
|
591
603
|
});
|
|
592
|
-
},
|
|
593
|
-
function
|
|
604
|
+
}, V = M("history");
|
|
605
|
+
function H(e, t) {
|
|
594
606
|
return {
|
|
595
|
-
id:
|
|
607
|
+
id: fe(`history-entry-${Date.now()}-${Math.random()}}`),
|
|
596
608
|
node: t,
|
|
597
609
|
at: Date.now(),
|
|
598
610
|
experienceId: e
|
|
599
611
|
};
|
|
600
612
|
}
|
|
601
|
-
var
|
|
602
|
-
let e =
|
|
603
|
-
e.on(t, (e, t) => ({ entries: [...e.entries,
|
|
613
|
+
var Ye = L(() => {
|
|
614
|
+
let e = V.store({ entries: [] }), t = V.event(), n = V.event(), r = V.event(), i = V.event();
|
|
615
|
+
e.on(t, (e, t) => ({ entries: [...e.entries, H(t.experienceId, t.node)] })), e.on(n, (e, t) => ({ entries: [...e.entries.slice(0, -1), H(t.experienceId, t.node)] })), e.on(i, (e, t) => t);
|
|
604
616
|
function a(e, t) {
|
|
605
617
|
let n = {
|
|
606
618
|
lastStepIndex: -1,
|
|
@@ -630,22 +642,22 @@ var Ve = B(() => {
|
|
|
630
642
|
entriesStore: e.map((e) => e.entries)
|
|
631
643
|
};
|
|
632
644
|
});
|
|
633
|
-
function
|
|
634
|
-
return
|
|
645
|
+
function Xe() {
|
|
646
|
+
return R(Ye);
|
|
635
647
|
}
|
|
636
648
|
//#endregion
|
|
637
649
|
//#region src/utils/events.ts
|
|
638
|
-
var
|
|
639
|
-
let t =
|
|
650
|
+
var Ze = 0, Qe = (e) => {
|
|
651
|
+
let t = F([]);
|
|
640
652
|
return t.on(e, (e, t) => [...e, {
|
|
641
|
-
id:
|
|
653
|
+
id: Ze++,
|
|
642
654
|
at: /* @__PURE__ */ new Date(),
|
|
643
655
|
payload: t
|
|
644
656
|
}]), t;
|
|
645
657
|
};
|
|
646
658
|
//#endregion
|
|
647
659
|
//#region src/entities/field/policies.ts
|
|
648
|
-
function
|
|
660
|
+
function U(e) {
|
|
649
661
|
let { doNotTrackValue: t, doNotStoreValue: n } = e ?? {}, r = e?.trackValue ?? t === !1, i = e?.storeValue ?? n === !1;
|
|
650
662
|
return {
|
|
651
663
|
trackValue: r,
|
|
@@ -656,10 +668,10 @@ function Ge(e) {
|
|
|
656
668
|
}
|
|
657
669
|
//#endregion
|
|
658
670
|
//#region src/entities/field/field.ts
|
|
659
|
-
var
|
|
660
|
-
let e =
|
|
671
|
+
var $e = M("field"), et = L(() => {
|
|
672
|
+
let e = $e.store({}), t = j(e, {
|
|
661
673
|
register(e, t) {
|
|
662
|
-
let n = Object.assign({}, t.field, { policies:
|
|
674
|
+
let n = Object.assign({}, t.field, { policies: U(t.field.policies) });
|
|
663
675
|
return {
|
|
664
676
|
...e,
|
|
665
677
|
[n.id]: n
|
|
@@ -671,7 +683,7 @@ var Ke = P("field"), qe = B(() => {
|
|
|
671
683
|
let r = Object.assign({}, n, t.updates);
|
|
672
684
|
return {
|
|
673
685
|
...e,
|
|
674
|
-
[n.id]: Object.assign({}, r, { policies:
|
|
686
|
+
[n.id]: Object.assign({}, r, { policies: U(r.policies) })
|
|
675
687
|
};
|
|
676
688
|
}
|
|
677
689
|
});
|
|
@@ -708,13 +720,13 @@ var Ke = P("field"), qe = B(() => {
|
|
|
708
720
|
getByName: c
|
|
709
721
|
};
|
|
710
722
|
});
|
|
711
|
-
function
|
|
712
|
-
return
|
|
723
|
+
function tt() {
|
|
724
|
+
return R(et);
|
|
713
725
|
}
|
|
714
726
|
//#endregion
|
|
715
727
|
//#region src/entities/step/step.ts
|
|
716
|
-
var
|
|
717
|
-
let e =
|
|
728
|
+
var nt = M("step"), rt = L(() => {
|
|
729
|
+
let e = nt.store({}), t = j(e, { register(e, t) {
|
|
718
730
|
return {
|
|
719
731
|
...e,
|
|
720
732
|
[t.step.id]: t.step
|
|
@@ -738,16 +750,16 @@ var Ye = P("step"), Xe = B(() => {
|
|
|
738
750
|
indexStore: e
|
|
739
751
|
};
|
|
740
752
|
});
|
|
741
|
-
function
|
|
742
|
-
return
|
|
753
|
+
function it() {
|
|
754
|
+
return R(rt);
|
|
743
755
|
}
|
|
744
|
-
function
|
|
756
|
+
function at(e, t) {
|
|
745
757
|
t.register(e);
|
|
746
758
|
}
|
|
747
759
|
//#endregion
|
|
748
760
|
//#region src/entities/content/content.ts
|
|
749
|
-
var
|
|
750
|
-
let e =
|
|
761
|
+
var ot = M("content"), st = L(() => {
|
|
762
|
+
let e = ot.store({}), t = j(e, {
|
|
751
763
|
register(e, t) {
|
|
752
764
|
return {
|
|
753
765
|
...e,
|
|
@@ -788,77 +800,251 @@ var $e = P("content"), et = B(() => {
|
|
|
788
800
|
indexStore: e
|
|
789
801
|
};
|
|
790
802
|
});
|
|
791
|
-
function
|
|
792
|
-
return
|
|
803
|
+
function ct() {
|
|
804
|
+
return R(st);
|
|
793
805
|
}
|
|
794
|
-
function
|
|
806
|
+
function lt(e, t) {
|
|
795
807
|
t.register(e);
|
|
796
808
|
}
|
|
797
809
|
//#endregion
|
|
798
810
|
//#region src/entities/action/action.ts
|
|
799
|
-
var
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
811
|
+
var ut = M("action"), W = {
|
|
812
|
+
status: "idle",
|
|
813
|
+
response: void 0,
|
|
814
|
+
error: void 0
|
|
815
|
+
}, dt = {
|
|
816
|
+
...W,
|
|
817
|
+
status: "running"
|
|
818
|
+
}, G = {};
|
|
819
|
+
function K(e) {
|
|
820
|
+
let t = /* @__PURE__ */ new WeakMap(), n = (e, n) => t.get(n?.experience ?? G)?.get(e);
|
|
821
|
+
return Object.assign((r, i) => {
|
|
822
|
+
let a = n(r, i);
|
|
823
|
+
if (a === void 0) {
|
|
824
|
+
let n = i?.experience ?? G;
|
|
825
|
+
a = e(r, i), t.set(n, (t.get(n) ?? /* @__PURE__ */ new Map()).set(r, a));
|
|
826
|
+
}
|
|
827
|
+
return a;
|
|
828
|
+
}, { find: n });
|
|
829
|
+
}
|
|
830
|
+
function ft(e) {
|
|
831
|
+
return e.status === "succeeded" ? {
|
|
832
|
+
status: "succeeded",
|
|
833
|
+
response: e.response,
|
|
834
|
+
error: void 0
|
|
835
|
+
} : {
|
|
836
|
+
status: "failed",
|
|
837
|
+
response: void 0,
|
|
838
|
+
error: e.error
|
|
839
|
+
};
|
|
840
|
+
}
|
|
841
|
+
var pt = L(({ client: e }) => {
|
|
842
|
+
let t = ut.store({}), n = j(t, {
|
|
843
|
+
register(e, t) {
|
|
844
|
+
return {
|
|
845
|
+
...e,
|
|
846
|
+
[t.key]: {
|
|
847
|
+
key: t.key,
|
|
848
|
+
action: t.action,
|
|
849
|
+
published: t.published === !0
|
|
850
|
+
}
|
|
851
|
+
};
|
|
852
|
+
},
|
|
853
|
+
unregister(e, t) {
|
|
854
|
+
return Object.hasOwn(e, t) ? Object.fromEntries(Object.entries(e).filter(([e]) => e !== t)) : e;
|
|
855
|
+
}
|
|
856
|
+
}), i = P(), a = n.unregister;
|
|
857
|
+
I({
|
|
810
858
|
clock: i,
|
|
811
859
|
source: t,
|
|
812
|
-
filter: (e, { key: t }) =>
|
|
860
|
+
filter: (e, { key: t, published: n }) => {
|
|
861
|
+
let r = e[t];
|
|
862
|
+
return r !== void 0 && !(n && r.published);
|
|
863
|
+
},
|
|
813
864
|
fn: (e, { key: t }) => `Action '${t}' already registered. Registering again will override the previous registration.`
|
|
814
|
-
}).watch((e) => /* @__PURE__ */ r("warn", e)),
|
|
865
|
+
}).watch((e) => /* @__PURE__ */ r("warn", e)), I({
|
|
815
866
|
clock: i,
|
|
816
|
-
fn: ({ key: e, action: t }) => Object.freeze({
|
|
867
|
+
fn: ({ key: e, action: t, published: n }) => Object.freeze({
|
|
817
868
|
key: e,
|
|
818
|
-
action: t
|
|
869
|
+
action: t,
|
|
870
|
+
published: n
|
|
819
871
|
}),
|
|
820
872
|
target: n.register
|
|
821
873
|
});
|
|
822
|
-
let
|
|
823
|
-
function
|
|
874
|
+
let o = t.map((e) => Object.values(e));
|
|
875
|
+
function s(e) {
|
|
824
876
|
return t.map((t) => t[e]?.action, { skipVoid: !1 });
|
|
825
877
|
}
|
|
826
|
-
function
|
|
827
|
-
let
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
878
|
+
function c(n, r, i) {
|
|
879
|
+
let a = r ? { experience: r.experience } : null;
|
|
880
|
+
return (...r) => {
|
|
881
|
+
let o = t.getState()[n]?.action;
|
|
882
|
+
return o?.({
|
|
883
|
+
...i ?? e.stateSnapshotStore.getState(),
|
|
884
|
+
args: r
|
|
885
|
+
}, a);
|
|
886
|
+
};
|
|
887
|
+
}
|
|
888
|
+
let l = /* @__PURE__ */ new WeakMap(), u = [];
|
|
889
|
+
function d(e, t, n) {
|
|
890
|
+
let r = e?.experience ?? G, i = l.get(r) ?? {
|
|
891
|
+
region: !e || u.includes(e.experience) ? _e() : null,
|
|
892
|
+
builders: [],
|
|
893
|
+
unlinkers: []
|
|
894
|
+
};
|
|
895
|
+
l.set(r, i), i.builders.push(t), i.unlinkers.push(n), i.region && ye(i.region, t);
|
|
896
|
+
}
|
|
897
|
+
e.experienceInstances.listStore.watch((e) => {
|
|
898
|
+
for (let t of u) {
|
|
899
|
+
let n = l.get(t);
|
|
900
|
+
if (n?.region && !e.includes(t)) {
|
|
901
|
+
ge(n.region), n.region = null;
|
|
902
|
+
for (let e of n.unlinkers) e();
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
for (let t of e) {
|
|
906
|
+
let e = l.get(t);
|
|
907
|
+
if (e && !e.region) {
|
|
908
|
+
let t = _e();
|
|
909
|
+
e.region = t;
|
|
910
|
+
for (let n of e.builders) ye(t, n);
|
|
837
911
|
}
|
|
912
|
+
}
|
|
913
|
+
u = e;
|
|
914
|
+
});
|
|
915
|
+
let f = K((t, n) => {
|
|
916
|
+
let r = P(), i = F(c(t, n), { skipVoid: !1 }).on(r, (e, t) => t);
|
|
917
|
+
return d(n, () => {
|
|
918
|
+
let i = A(s(t), e.stateSnapshotStore, (e, r) => c(t, n, r));
|
|
919
|
+
I({
|
|
920
|
+
clock: i,
|
|
921
|
+
target: r
|
|
922
|
+
}), r(i.getState());
|
|
923
|
+
}, () => {
|
|
924
|
+
r(c(t, n));
|
|
925
|
+
}), i;
|
|
926
|
+
});
|
|
927
|
+
async function p(n, r = {}) {
|
|
928
|
+
let i = t.getState()[n]?.action;
|
|
929
|
+
if (!i) throw Error(`Action '${n}' is not registered`);
|
|
930
|
+
let a = r.experience ? { experience: r.experience } : null, o = e.stateSnapshotStore.getState(), s = r.args ?? [], c = mt(r.signal, r.timeoutMs);
|
|
931
|
+
return c ? (c.throwIfAborted(), new Promise((e, t) => {
|
|
932
|
+
let n = () => {
|
|
933
|
+
t(c.reason);
|
|
934
|
+
};
|
|
935
|
+
c.addEventListener("abort", n, { once: !0 }), Promise.resolve().then(() => i({
|
|
936
|
+
...o,
|
|
937
|
+
args: s,
|
|
938
|
+
signal: c
|
|
939
|
+
}, a)).then(e, t).finally(() => {
|
|
940
|
+
c.removeEventListener("abort", n);
|
|
941
|
+
});
|
|
942
|
+
})) : i({
|
|
943
|
+
...o,
|
|
944
|
+
args: s
|
|
945
|
+
}, a);
|
|
946
|
+
}
|
|
947
|
+
let m = K((e, t) => {
|
|
948
|
+
let n = P(), r = P(), i = 0, a = async (...a) => {
|
|
949
|
+
i += 1;
|
|
950
|
+
let o = i;
|
|
951
|
+
n();
|
|
952
|
+
let s;
|
|
953
|
+
try {
|
|
954
|
+
s = {
|
|
955
|
+
status: "succeeded",
|
|
956
|
+
response: await p(e, {
|
|
957
|
+
...t,
|
|
958
|
+
args: a
|
|
959
|
+
})
|
|
960
|
+
};
|
|
961
|
+
} catch (e) {
|
|
962
|
+
s = {
|
|
963
|
+
status: "failed",
|
|
964
|
+
error: e
|
|
965
|
+
};
|
|
966
|
+
}
|
|
967
|
+
return o === i && r(s), s;
|
|
968
|
+
}, o = (n) => Object.assign(c(e, t), {
|
|
969
|
+
...n,
|
|
970
|
+
run: a
|
|
838
971
|
});
|
|
839
|
-
return
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
972
|
+
return F(o(W)).on(n, () => o(dt)).on(r, (e, t) => o(ft(t)));
|
|
973
|
+
}), h = K((n, r) => {
|
|
974
|
+
let i = f(n, r), a = F(void 0, { skipVoid: !1 }), o = 0, s = !1, l = !1, u = () => [t.getState()[n]?.action, e.stateSnapshotStore.getState()], d = [], p = N(async (e) => {
|
|
975
|
+
o += 1;
|
|
976
|
+
let t = o;
|
|
977
|
+
if (d = u(), y(n)) return s || (s = !0, `${n}`), {
|
|
978
|
+
evaluation: t,
|
|
979
|
+
value: void 0
|
|
980
|
+
};
|
|
981
|
+
try {
|
|
982
|
+
return {
|
|
983
|
+
evaluation: t,
|
|
984
|
+
value: await e()
|
|
985
|
+
};
|
|
986
|
+
} catch {
|
|
987
|
+
return `${n}`, {
|
|
988
|
+
evaluation: t,
|
|
989
|
+
value: void 0
|
|
990
|
+
};
|
|
991
|
+
}
|
|
992
|
+
});
|
|
993
|
+
I({
|
|
994
|
+
clock: p.doneData,
|
|
995
|
+
filter: ({ evaluation: e }) => e === o,
|
|
996
|
+
fn: ({ value: e }) => e,
|
|
844
997
|
target: a
|
|
845
|
-
}),
|
|
846
|
-
clock:
|
|
847
|
-
filter: (e) => e !==
|
|
848
|
-
target:
|
|
849
|
-
})
|
|
998
|
+
}), I({
|
|
999
|
+
clock: i,
|
|
1000
|
+
filter: () => !l && u().some((e, t) => e !== d[t]),
|
|
1001
|
+
target: p
|
|
1002
|
+
});
|
|
1003
|
+
let m = () => {
|
|
1004
|
+
l || (l = !0, queueMicrotask(() => {
|
|
1005
|
+
l = !1, p(c(n, r));
|
|
1006
|
+
}));
|
|
1007
|
+
};
|
|
1008
|
+
return m(), {
|
|
1009
|
+
result: a,
|
|
1010
|
+
refresh: m,
|
|
1011
|
+
isQueued: () => l
|
|
1012
|
+
};
|
|
1013
|
+
});
|
|
1014
|
+
function g(e, t) {
|
|
1015
|
+
return h(e, t).result;
|
|
1016
|
+
}
|
|
1017
|
+
function _(e, t) {
|
|
1018
|
+
h.find(e, t)?.refresh();
|
|
1019
|
+
}
|
|
1020
|
+
function v(e, t) {
|
|
1021
|
+
return h.find(e, t)?.isQueued() === !0;
|
|
1022
|
+
}
|
|
1023
|
+
function y(e) {
|
|
1024
|
+
return t.getState()[e]?.published === !0;
|
|
850
1025
|
}
|
|
851
1026
|
return {
|
|
852
1027
|
register: i,
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
1028
|
+
unregister: a,
|
|
1029
|
+
getByKey: s,
|
|
1030
|
+
listStore: o,
|
|
1031
|
+
getEvokableAction: f,
|
|
1032
|
+
getActionBinding: m,
|
|
1033
|
+
getActionResult: g,
|
|
1034
|
+
refreshActionResult: _,
|
|
1035
|
+
isActionResultQueued: v,
|
|
1036
|
+
run: p,
|
|
1037
|
+
isPublished: y
|
|
856
1038
|
};
|
|
857
1039
|
});
|
|
858
|
-
function
|
|
859
|
-
|
|
1040
|
+
function mt(e, t) {
|
|
1041
|
+
let n = t === void 0 ? void 0 : AbortSignal.timeout(t);
|
|
1042
|
+
return e && n ? AbortSignal.any([e, n]) : e ?? n;
|
|
1043
|
+
}
|
|
1044
|
+
function ht(e) {
|
|
1045
|
+
return R(pt, e);
|
|
860
1046
|
}
|
|
861
|
-
var
|
|
1047
|
+
var gt = (e, t, n) => {
|
|
862
1048
|
n.register({
|
|
863
1049
|
key: e,
|
|
864
1050
|
action: t
|
|
@@ -877,35 +1063,35 @@ function q(e, t, n, r) {
|
|
|
877
1063
|
function J(e) {
|
|
878
1064
|
return e === null || e === "" || Array.isArray(e) && !e.length;
|
|
879
1065
|
}
|
|
880
|
-
function
|
|
1066
|
+
function _t(e) {
|
|
881
1067
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
|
|
882
1068
|
}
|
|
883
|
-
function
|
|
1069
|
+
function vt(e) {
|
|
884
1070
|
try {
|
|
885
1071
|
return JSON.stringify(e), !0;
|
|
886
1072
|
} catch {
|
|
887
1073
|
return !1;
|
|
888
1074
|
}
|
|
889
1075
|
}
|
|
890
|
-
function
|
|
1076
|
+
function yt(e, t) {
|
|
891
1077
|
return t.find((t) => t.key === e) ?? null;
|
|
892
1078
|
}
|
|
893
|
-
function
|
|
1079
|
+
function bt(e, t) {
|
|
894
1080
|
return e.multiple && (typeof t == "string" || typeof t == "number" || typeof t == "boolean") ? [t] : t;
|
|
895
1081
|
}
|
|
896
|
-
function
|
|
1082
|
+
function xt(e, t) {
|
|
897
1083
|
if (e.type !== "object" || J(t)) return null;
|
|
898
1084
|
if (e.multiple) {
|
|
899
1085
|
if (!Array.isArray(t)) return q(e, t, "This field expects multiple values", "Field expects an array of objects.");
|
|
900
1086
|
for (let n of t) {
|
|
901
1087
|
if (typeof n != "object" || !n) return q(e, t, "This field expects object values", "Field expects an array of objects, but received non-object value.");
|
|
902
|
-
if (!
|
|
1088
|
+
if (!vt(n)) return q(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
|
|
903
1089
|
}
|
|
904
1090
|
return null;
|
|
905
1091
|
}
|
|
906
|
-
return Array.isArray(t) ? q(e, t, "This field expects a single value", "Field expects a single object, not an array.") : typeof t != "object" || !t ? q(e, t, "This field expects an object value", "Field expects an object value.") :
|
|
1092
|
+
return Array.isArray(t) ? q(e, t, "This field expects a single value", "Field expects a single object, not an array.") : typeof t != "object" || !t ? q(e, t, "This field expects an object value", "Field expects an object value.") : vt(t) ? null : q(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
|
|
907
1093
|
}
|
|
908
|
-
function
|
|
1094
|
+
function St(e, t) {
|
|
909
1095
|
if (J(t) || !Array.isArray(e.options) || e.options.length === 0) return null;
|
|
910
1096
|
let n = Array.isArray(t) ? t : [t];
|
|
911
1097
|
if (e.type === "object") {
|
|
@@ -913,9 +1099,9 @@ function ft(e, t) {
|
|
|
913
1099
|
return n.every((e) => r.has(JSON.stringify(e))) ? null : q(e, t, "This field expects a valid option", "Field expects a valid option from the defined choices.");
|
|
914
1100
|
}
|
|
915
1101
|
let r = e.options.map((e) => e.value);
|
|
916
|
-
return n.every((e) => !
|
|
1102
|
+
return n.every((e) => !_t(e) || e === null ? !1 : r.includes(e)) ? null : q(e, t, "This field expects a valid option", `Field expects a valid option. Valid options are: ${r.join(", ")}`);
|
|
917
1103
|
}
|
|
918
|
-
async function
|
|
1104
|
+
async function Ct(t, n, r, i) {
|
|
919
1105
|
if (n.validation && !e(n.validation) && !J(r)) {
|
|
920
1106
|
let e = i ? {
|
|
921
1107
|
$input: r,
|
|
@@ -928,8 +1114,8 @@ async function pt(t, n, r, i) {
|
|
|
928
1114
|
}
|
|
929
1115
|
//#endregion
|
|
930
1116
|
//#region src/entities/response/response.ts
|
|
931
|
-
var
|
|
932
|
-
let t =
|
|
1117
|
+
var wt = M("response"), Tt = L(({ client: e }) => {
|
|
1118
|
+
let t = wt.store({}), r = P(), i = P(), a = j(t, {
|
|
933
1119
|
register(e, t) {
|
|
934
1120
|
return {
|
|
935
1121
|
...e,
|
|
@@ -958,7 +1144,7 @@ var mt = P("response"), ht = B(({ client: e }) => {
|
|
|
958
1144
|
});
|
|
959
1145
|
} else a.registerBatch(e);
|
|
960
1146
|
}
|
|
961
|
-
let s = (t, r) => n(e, t, r), c =
|
|
1147
|
+
let s = (t, r) => n(e, t, r), c = k({
|
|
962
1148
|
source: {
|
|
963
1149
|
allFields: e.fields.listStore,
|
|
964
1150
|
existingResponses: t
|
|
@@ -968,7 +1154,7 @@ var mt = P("response"), ht = B(({ client: e }) => {
|
|
|
968
1154
|
...t,
|
|
969
1155
|
...n
|
|
970
1156
|
}, o = Object.entries(n), c = await Promise.allSettled(o.map(async ([t, n]) => {
|
|
971
|
-
let o =
|
|
1157
|
+
let o = yt(t, e);
|
|
972
1158
|
if (!o) {
|
|
973
1159
|
r.push({
|
|
974
1160
|
fieldKey: t,
|
|
@@ -978,17 +1164,17 @@ var mt = P("response"), ht = B(({ client: e }) => {
|
|
|
978
1164
|
});
|
|
979
1165
|
return;
|
|
980
1166
|
}
|
|
981
|
-
let c =
|
|
1167
|
+
let c = bt(o, n), l = await Ct(s, o, c, a);
|
|
982
1168
|
if (l) {
|
|
983
1169
|
r.push(l);
|
|
984
1170
|
return;
|
|
985
1171
|
}
|
|
986
|
-
let u =
|
|
1172
|
+
let u = xt(o, c);
|
|
987
1173
|
if (u) {
|
|
988
1174
|
r.push(u);
|
|
989
1175
|
return;
|
|
990
1176
|
}
|
|
991
|
-
let d =
|
|
1177
|
+
let d = St(o, c);
|
|
992
1178
|
if (d) {
|
|
993
1179
|
r.push(d);
|
|
994
1180
|
return;
|
|
@@ -1016,7 +1202,7 @@ var mt = P("response"), ht = B(({ client: e }) => {
|
|
|
1016
1202
|
async function l(e) {
|
|
1017
1203
|
return c(e);
|
|
1018
1204
|
}
|
|
1019
|
-
let u =
|
|
1205
|
+
let u = k({
|
|
1020
1206
|
source: t,
|
|
1021
1207
|
effect: async (e, t) => {
|
|
1022
1208
|
let { responsesToCommit: n, validationErrors: r } = await c(t);
|
|
@@ -1031,7 +1217,7 @@ var mt = P("response"), ht = B(({ client: e }) => {
|
|
|
1031
1217
|
value: t
|
|
1032
1218
|
})));
|
|
1033
1219
|
function m(e) {
|
|
1034
|
-
return
|
|
1220
|
+
return A({
|
|
1035
1221
|
f: e,
|
|
1036
1222
|
s: t
|
|
1037
1223
|
}, ({ f: e, s: t }) => {
|
|
@@ -1048,10 +1234,10 @@ var mt = P("response"), ht = B(({ client: e }) => {
|
|
|
1048
1234
|
function _(t) {
|
|
1049
1235
|
return m(e.fields.getByName(t));
|
|
1050
1236
|
}
|
|
1051
|
-
return
|
|
1237
|
+
return I({
|
|
1052
1238
|
clock: r,
|
|
1053
1239
|
target: a.clearAll
|
|
1054
|
-
}),
|
|
1240
|
+
}), I({
|
|
1055
1241
|
clock: i,
|
|
1056
1242
|
target: a.clear
|
|
1057
1243
|
}), {
|
|
@@ -1067,13 +1253,13 @@ var mt = P("response"), ht = B(({ client: e }) => {
|
|
|
1067
1253
|
getByFieldName: _
|
|
1068
1254
|
};
|
|
1069
1255
|
});
|
|
1070
|
-
function
|
|
1071
|
-
return
|
|
1256
|
+
function Et(e) {
|
|
1257
|
+
return R(Tt, e);
|
|
1072
1258
|
}
|
|
1073
1259
|
//#endregion
|
|
1074
1260
|
//#region src/entities/condition/condition.ts
|
|
1075
|
-
var
|
|
1076
|
-
let e =
|
|
1261
|
+
var Dt = M("condition"), Ot = L(() => {
|
|
1262
|
+
let e = Dt.store({}), t = j(e, { register(e, t) {
|
|
1077
1263
|
return {
|
|
1078
1264
|
...e,
|
|
1079
1265
|
[t.condition.id]: t.condition
|
|
@@ -1097,12 +1283,12 @@ var _t = P("condition"), vt = B(() => {
|
|
|
1097
1283
|
indexStore: e
|
|
1098
1284
|
};
|
|
1099
1285
|
});
|
|
1100
|
-
function
|
|
1101
|
-
return
|
|
1286
|
+
function kt() {
|
|
1287
|
+
return R(Ot);
|
|
1102
1288
|
}
|
|
1103
1289
|
//#endregion
|
|
1104
1290
|
//#region src/utils/api-url.ts
|
|
1105
|
-
function
|
|
1291
|
+
function At() {
|
|
1106
1292
|
if (c()) {
|
|
1107
1293
|
let e = [
|
|
1108
1294
|
document.currentScript,
|
|
@@ -1117,25 +1303,25 @@ function bt() {
|
|
|
1117
1303
|
}
|
|
1118
1304
|
//#endregion
|
|
1119
1305
|
//#region src/utils/user-timing.ts
|
|
1120
|
-
var
|
|
1121
|
-
function
|
|
1306
|
+
var jt = "picked:start:begin", Mt = "picked:start";
|
|
1307
|
+
function Nt() {
|
|
1122
1308
|
try {
|
|
1123
1309
|
return s() && !!p.window && "performance" in p;
|
|
1124
1310
|
} catch {
|
|
1125
1311
|
return !1;
|
|
1126
1312
|
}
|
|
1127
1313
|
}
|
|
1128
|
-
function
|
|
1314
|
+
function Pt() {
|
|
1129
1315
|
let e = null, t = null;
|
|
1130
1316
|
return {
|
|
1131
1317
|
markBegin: () => {
|
|
1132
|
-
if (
|
|
1133
|
-
e = performance.mark(
|
|
1318
|
+
if (Nt()) try {
|
|
1319
|
+
e = performance.mark(jt).startTime;
|
|
1134
1320
|
} catch {}
|
|
1135
1321
|
},
|
|
1136
1322
|
measure: () => {
|
|
1137
|
-
if (!(!
|
|
1138
|
-
t = performance.measure(
|
|
1323
|
+
if (!(!Nt() || e === null)) try {
|
|
1324
|
+
t = performance.measure(Mt, { start: e });
|
|
1139
1325
|
} catch {}
|
|
1140
1326
|
},
|
|
1141
1327
|
get startMeasure() {
|
|
@@ -1145,7 +1331,7 @@ function wt() {
|
|
|
1145
1331
|
}
|
|
1146
1332
|
//#endregion
|
|
1147
1333
|
//#region src/utils/client-telemetry.ts
|
|
1148
|
-
function
|
|
1334
|
+
function Ft() {
|
|
1149
1335
|
let e = null;
|
|
1150
1336
|
return {
|
|
1151
1337
|
observeDeliveryAPIRequests: (t) => {
|
|
@@ -1158,13 +1344,13 @@ function Tt() {
|
|
|
1158
1344
|
}
|
|
1159
1345
|
//#endregion
|
|
1160
1346
|
//#region src/entities/session/session.ts
|
|
1161
|
-
var
|
|
1162
|
-
function
|
|
1347
|
+
var Y = re("session", "global");
|
|
1348
|
+
function It() {
|
|
1163
1349
|
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)}`;
|
|
1164
1350
|
}
|
|
1165
|
-
function
|
|
1351
|
+
function Lt() {
|
|
1166
1352
|
if (!h()) return null;
|
|
1167
|
-
let e =
|
|
1353
|
+
let e = O.get(Y);
|
|
1168
1354
|
if (!e.isSet()) return null;
|
|
1169
1355
|
try {
|
|
1170
1356
|
return e.json();
|
|
@@ -1172,10 +1358,10 @@ function Ot() {
|
|
|
1172
1358
|
return null;
|
|
1173
1359
|
}
|
|
1174
1360
|
}
|
|
1175
|
-
var
|
|
1176
|
-
let e =
|
|
1361
|
+
var Rt = L(() => {
|
|
1362
|
+
let e = Lt(), t = { id: e?.id ?? It() };
|
|
1177
1363
|
e?.isUser !== void 0 && (t.isUser = e.isUser), e?.identifiers && Object.keys(e.identifiers).length > 0 && (t.identifiers = e.identifiers);
|
|
1178
|
-
let n =
|
|
1364
|
+
let n = F(t), r = j(n, {
|
|
1179
1365
|
setIsUser: (e, t) => ({
|
|
1180
1366
|
...e,
|
|
1181
1367
|
isUser: t
|
|
@@ -1195,15 +1381,15 @@ var kt = B(() => {
|
|
|
1195
1381
|
let i = { id: e.id };
|
|
1196
1382
|
return e.isUser !== void 0 && (i.isUser = e.isUser), Object.keys(r).length > 0 && (i.identifiers = r), i;
|
|
1197
1383
|
}
|
|
1198
|
-
}), i =
|
|
1384
|
+
}), i = k({
|
|
1199
1385
|
source: n,
|
|
1200
1386
|
effect: (e) => {
|
|
1201
1387
|
if (h()) try {
|
|
1202
|
-
|
|
1388
|
+
O.get(Y).set(e);
|
|
1203
1389
|
} catch {}
|
|
1204
1390
|
}
|
|
1205
1391
|
});
|
|
1206
|
-
return
|
|
1392
|
+
return I({
|
|
1207
1393
|
source: n,
|
|
1208
1394
|
target: i
|
|
1209
1395
|
}), {
|
|
@@ -1213,39 +1399,39 @@ var kt = B(() => {
|
|
|
1213
1399
|
removeIdentifier: r.removeIdentifier
|
|
1214
1400
|
};
|
|
1215
1401
|
});
|
|
1216
|
-
function
|
|
1217
|
-
return
|
|
1402
|
+
function zt() {
|
|
1403
|
+
return R(Rt, void 0);
|
|
1218
1404
|
}
|
|
1219
1405
|
//#endregion
|
|
1220
1406
|
//#region src/utils/picked-config.ts
|
|
1221
|
-
function
|
|
1407
|
+
function Bt() {
|
|
1222
1408
|
if (s()) return globalThis.window.pickedConfig;
|
|
1223
1409
|
}
|
|
1224
|
-
function
|
|
1225
|
-
if (s()) return
|
|
1410
|
+
function Vt() {
|
|
1411
|
+
if (s()) return Bt()?.projectId;
|
|
1226
1412
|
}
|
|
1227
|
-
function
|
|
1413
|
+
function Ht() {
|
|
1228
1414
|
if (!c()) return;
|
|
1229
1415
|
let e = document.getElementById("picked_script") || document.querySelector("script#picked") || document.getElementById("cvly");
|
|
1230
1416
|
if (e) return e.dataset.projectid || e.getAttribute("project-id") || void 0;
|
|
1231
1417
|
}
|
|
1232
|
-
function
|
|
1418
|
+
function Ut(e) {
|
|
1233
1419
|
if (e.projectId) return e.projectId;
|
|
1234
|
-
let t =
|
|
1420
|
+
let t = Vt();
|
|
1235
1421
|
if (t) return t;
|
|
1236
|
-
let n =
|
|
1422
|
+
let n = Ht();
|
|
1237
1423
|
if (n) return n;
|
|
1238
1424
|
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.");
|
|
1239
1425
|
}
|
|
1240
1426
|
//#endregion
|
|
1241
1427
|
//#region src/utils/render-string.ts
|
|
1242
|
-
function
|
|
1428
|
+
function X(e) {
|
|
1243
1429
|
return e == null || e === "" || Number.isNaN(e);
|
|
1244
1430
|
}
|
|
1245
|
-
var
|
|
1246
|
-
default: (e, t) =>
|
|
1247
|
-
append: (e, t) => t && !
|
|
1248
|
-
prepend: (e, t) => t && !
|
|
1431
|
+
var Wt = {
|
|
1432
|
+
default: (e, t) => X(e) ? String(t ?? "") : String(e),
|
|
1433
|
+
append: (e, t) => t && !X(e) ? `${e} ${t}` : e,
|
|
1434
|
+
prepend: (e, t) => t && !X(e) ? `${t} ${e}` : e,
|
|
1249
1435
|
upper: (e) => typeof e == "string" ? e.toUpperCase() : e,
|
|
1250
1436
|
lower: (e) => typeof e == "string" ? e.toLowerCase() : e,
|
|
1251
1437
|
capitalize: (e) => typeof e == "string" ? e.charAt(0).toUpperCase() + e.slice(1) : e,
|
|
@@ -1263,24 +1449,24 @@ var Ft = {
|
|
|
1263
1449
|
return e instanceof Set ? t.format(Array.from(e).map(String)) : e;
|
|
1264
1450
|
}
|
|
1265
1451
|
};
|
|
1266
|
-
function
|
|
1452
|
+
function Gt(e) {
|
|
1267
1453
|
return typeof e == "object" && !!e;
|
|
1268
1454
|
}
|
|
1269
|
-
function
|
|
1455
|
+
function Kt(e, t) {
|
|
1270
1456
|
let n = t;
|
|
1271
|
-
for (let t of e.split(".")) if (
|
|
1457
|
+
for (let t of e.split(".")) if (Gt(n) && t in n) n = n[t];
|
|
1272
1458
|
else return;
|
|
1273
1459
|
return typeof n == "function" ? n() : n;
|
|
1274
1460
|
}
|
|
1275
|
-
function
|
|
1276
|
-
let n = e.split("|").map((e) => e.trim()), r =
|
|
1461
|
+
function qt(e, t) {
|
|
1462
|
+
let n = e.split("|").map((e) => e.trim()), r = Kt(n.shift() ?? "", t);
|
|
1277
1463
|
for (let e of n) {
|
|
1278
|
-
let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o =
|
|
1464
|
+
let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o = Wt[i];
|
|
1279
1465
|
o && (r = o(r, a));
|
|
1280
1466
|
}
|
|
1281
|
-
return
|
|
1467
|
+
return X(r) ? "" : typeof r == "object" ? JSON.stringify(r) : String(r);
|
|
1282
1468
|
}
|
|
1283
|
-
function
|
|
1469
|
+
function Jt(e, t) {
|
|
1284
1470
|
let n = "", r = 0;
|
|
1285
1471
|
for (; r < e.length;) if (e[r] === "{" && e[r + 1] === "{") {
|
|
1286
1472
|
r += 2;
|
|
@@ -1292,13 +1478,13 @@ function zt(e, t) {
|
|
|
1292
1478
|
}
|
|
1293
1479
|
i += e[r++];
|
|
1294
1480
|
}
|
|
1295
|
-
n +=
|
|
1481
|
+
n += qt(i.trim(), t);
|
|
1296
1482
|
} else n += e[r++];
|
|
1297
1483
|
return n;
|
|
1298
1484
|
}
|
|
1299
1485
|
//#endregion
|
|
1300
1486
|
//#region src/picked.ts
|
|
1301
|
-
var
|
|
1487
|
+
var Yt = class {
|
|
1302
1488
|
static logger = r;
|
|
1303
1489
|
options;
|
|
1304
1490
|
dataSource = null;
|
|
@@ -1308,52 +1494,52 @@ var Bt = class {
|
|
|
1308
1494
|
contentLoader;
|
|
1309
1495
|
previewEmbedderOrigins = null;
|
|
1310
1496
|
plugins = {};
|
|
1311
|
-
telemetry =
|
|
1497
|
+
telemetry = Ft();
|
|
1312
1498
|
dataProviders = /* @__PURE__ */ new Map();
|
|
1313
|
-
eventBus =
|
|
1499
|
+
eventBus = P();
|
|
1314
1500
|
events;
|
|
1315
1501
|
projectId;
|
|
1316
1502
|
apiUrl;
|
|
1317
1503
|
dashboardUrl;
|
|
1318
1504
|
documentationSiteUrl;
|
|
1319
|
-
session =
|
|
1320
|
-
performance =
|
|
1505
|
+
session = zt();
|
|
1506
|
+
performance = Pt();
|
|
1321
1507
|
searchParams = ie();
|
|
1322
|
-
history =
|
|
1323
|
-
components =
|
|
1508
|
+
history = Xe();
|
|
1509
|
+
components = je({ client: this });
|
|
1324
1510
|
experienceInstances = w({ client: this });
|
|
1325
|
-
experiences =
|
|
1326
|
-
frameworks =
|
|
1327
|
-
predicates =
|
|
1328
|
-
features =
|
|
1329
|
-
conditions =
|
|
1330
|
-
fields =
|
|
1331
|
-
responses =
|
|
1332
|
-
steps =
|
|
1333
|
-
contents =
|
|
1334
|
-
actions =
|
|
1335
|
-
conditionResults =
|
|
1336
|
-
stateSnapshotStore =
|
|
1337
|
-
evaluateRuleLogicFx =
|
|
1511
|
+
experiences = Ce({ client: this });
|
|
1512
|
+
frameworks = Fe({ client: this });
|
|
1513
|
+
predicates = qe({ client: this });
|
|
1514
|
+
features = ue({ client: this });
|
|
1515
|
+
conditions = kt();
|
|
1516
|
+
fields = tt();
|
|
1517
|
+
responses = Et({ client: this });
|
|
1518
|
+
steps = it();
|
|
1519
|
+
contents = ct();
|
|
1520
|
+
actions = ht({ client: this });
|
|
1521
|
+
conditionResults = T();
|
|
1522
|
+
stateSnapshotStore = Re({ client: this });
|
|
1523
|
+
evaluateRuleLogicFx = He({ client: this });
|
|
1338
1524
|
start;
|
|
1339
1525
|
readyStore;
|
|
1340
1526
|
preconditionPassedStore;
|
|
1341
1527
|
conditionPassedStore;
|
|
1342
1528
|
lifecycleStageStore;
|
|
1343
|
-
lifecycle =
|
|
1344
|
-
renderStringFx =
|
|
1529
|
+
lifecycle = We({ client: this });
|
|
1530
|
+
renderStringFx = k({
|
|
1345
1531
|
source: this.responses.listStore,
|
|
1346
1532
|
effect: (e, { template: t, context: n }) => {
|
|
1347
1533
|
let r = {};
|
|
1348
1534
|
for (let t of e) r[t.fieldKey] = t.value;
|
|
1349
|
-
return
|
|
1535
|
+
return Jt(t, {
|
|
1350
1536
|
...n,
|
|
1351
1537
|
responses: r
|
|
1352
1538
|
});
|
|
1353
1539
|
}
|
|
1354
1540
|
});
|
|
1355
1541
|
constructor(e) {
|
|
1356
|
-
this.events =
|
|
1542
|
+
this.events = Qe(this.eventBus), this.projectId = Ut(e), this.options = Object.freeze(e), this.apiUrl = e.apiUrl || At(), 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({
|
|
1357
1543
|
type: "load",
|
|
1358
1544
|
version: ce()
|
|
1359
1545
|
}), this.maybeStartPreviewChannel();
|
|
@@ -1361,7 +1547,7 @@ var Bt = class {
|
|
|
1361
1547
|
dataProviderFor(e) {
|
|
1362
1548
|
let t = e ?? "", n = this.dataProviders.get(t);
|
|
1363
1549
|
if (n) return n;
|
|
1364
|
-
let r = import("../provider-
|
|
1550
|
+
let r = import("../provider-B3cWi4ev.js").then((t) => t.createPickedDataProvider({
|
|
1365
1551
|
apiUrl: this.apiUrl,
|
|
1366
1552
|
projectId: this.projectId,
|
|
1367
1553
|
getRequestObserver: () => this.telemetry.deliveryAPIRequestObserver,
|
|
@@ -1371,7 +1557,7 @@ var Bt = class {
|
|
|
1371
1557
|
}
|
|
1372
1558
|
async getProjectConfig(e) {
|
|
1373
1559
|
let t = await this.dataProviderFor(e?.previewToken), n = await t.getProjectConfig();
|
|
1374
|
-
if (this.dataSource = t.meta.manifest, n === null && t.meta.previewUnavailable) throw new
|
|
1560
|
+
if (this.dataSource = t.meta.manifest, n === null && t.meta.previewUnavailable) throw new de(this.projectId);
|
|
1375
1561
|
if (n === null) throw Error(`Picked could not resolve the configuration for project "${this.projectId}" from ${this.apiUrl}.`);
|
|
1376
1562
|
return n;
|
|
1377
1563
|
}
|
|
@@ -1379,16 +1565,16 @@ var Bt = class {
|
|
|
1379
1565
|
return (await this.dataProviderFor(t?.previewToken)).getContent(e, t?.signal === void 0 ? void 0 : { signal: t.signal });
|
|
1380
1566
|
}
|
|
1381
1567
|
maybeStartPreviewChannel() {
|
|
1382
|
-
|
|
1568
|
+
le() && import("../preview-channel-CSr96XAo.js").then((e) => e.initPreviewChannel(this)).catch(() => void 0);
|
|
1383
1569
|
}
|
|
1384
1570
|
registerFramework = (e) => {
|
|
1385
|
-
|
|
1571
|
+
Ie(e, this.frameworks);
|
|
1386
1572
|
};
|
|
1387
1573
|
registerComponent = (e, t) => {
|
|
1388
|
-
|
|
1574
|
+
Me(e, t, this.components);
|
|
1389
1575
|
};
|
|
1390
1576
|
registerPlugin = (e) => {
|
|
1391
|
-
|
|
1577
|
+
Ee(this, e, this.plugins);
|
|
1392
1578
|
let t = this.plugins[e.name];
|
|
1393
1579
|
t?.onStart && this.lifecycle.registerPluginStartHook(t.onStart);
|
|
1394
1580
|
};
|
|
@@ -1396,7 +1582,7 @@ var Bt = class {
|
|
|
1396
1582
|
oe(e, t, this.features);
|
|
1397
1583
|
};
|
|
1398
1584
|
registerPredicate = (e, t) => {
|
|
1399
|
-
|
|
1585
|
+
Je(e, t, this.predicates);
|
|
1400
1586
|
};
|
|
1401
1587
|
registerCondition = (e) => {
|
|
1402
1588
|
this.conditions.register(e);
|
|
@@ -1405,19 +1591,19 @@ var Bt = class {
|
|
|
1405
1591
|
this.fields.register(e);
|
|
1406
1592
|
};
|
|
1407
1593
|
registerStep = (e) => {
|
|
1408
|
-
|
|
1594
|
+
at(e, this.steps);
|
|
1409
1595
|
};
|
|
1410
1596
|
registerContent = (e) => {
|
|
1411
|
-
|
|
1597
|
+
lt(e, this.contents);
|
|
1412
1598
|
};
|
|
1413
1599
|
patchContent = (e, t) => {
|
|
1414
1600
|
this.contents.patch(e, t);
|
|
1415
1601
|
};
|
|
1416
1602
|
registerAction = (e, t) => {
|
|
1417
|
-
|
|
1603
|
+
gt(e, t, this.actions);
|
|
1418
1604
|
};
|
|
1419
1605
|
registerExperience = (e) => {
|
|
1420
|
-
e.component &&
|
|
1606
|
+
e.component && Me(`experience:${e.id}`, e.component, this.components), this.experiences.register(e);
|
|
1421
1607
|
};
|
|
1422
1608
|
launchExperienceById = async (e, t) => {
|
|
1423
1609
|
this.experiences.launch({
|
|
@@ -1510,8 +1696,8 @@ var Bt = class {
|
|
|
1510
1696
|
});
|
|
1511
1697
|
}
|
|
1512
1698
|
getPluginConfig = (e) => this.plugins[e] ?? {};
|
|
1513
|
-
},
|
|
1514
|
-
async function
|
|
1699
|
+
}, Xt = "application/picked-javascript", Zt = "application/picked-module", Qt = "data-picked-hydrated";
|
|
1700
|
+
async function $t(e) {
|
|
1515
1701
|
if (!("document" in globalThis)) return;
|
|
1516
1702
|
let t = "application/picked-module", n = "data-picked-hydrated";
|
|
1517
1703
|
function r(e) {
|
|
@@ -1540,23 +1726,23 @@ async function X(e) {
|
|
|
1540
1726
|
a && await a;
|
|
1541
1727
|
}
|
|
1542
1728
|
}
|
|
1543
|
-
function
|
|
1544
|
-
return `<script>(${
|
|
1729
|
+
function en() {
|
|
1730
|
+
return `<script>(${$t.toString()})(document)<\/script>`;
|
|
1545
1731
|
}
|
|
1546
1732
|
//#endregion
|
|
1547
1733
|
//#region src/utils/html-asset-value.ts
|
|
1548
|
-
function
|
|
1734
|
+
function tn(e) {
|
|
1549
1735
|
return typeof e == "object" && !!e && "id" in e && typeof e.id == "string" && "content" in e && (typeof e.content == "string" || e.content === null);
|
|
1550
1736
|
}
|
|
1551
1737
|
//#endregion
|
|
1552
1738
|
//#region src/entities/component/lazyComponent.ts
|
|
1553
|
-
function
|
|
1739
|
+
function nn(e) {
|
|
1554
1740
|
return {
|
|
1555
1741
|
$$type: "lazy-component",
|
|
1556
1742
|
load: e
|
|
1557
1743
|
};
|
|
1558
1744
|
}
|
|
1559
|
-
function
|
|
1745
|
+
function rn(e) {
|
|
1560
1746
|
return typeof e == "object" && !!e && "$$type" in e && e.$$type === "lazy-component";
|
|
1561
1747
|
}
|
|
1562
1748
|
//#endregion
|
|
@@ -1572,10 +1758,10 @@ function $(e) {
|
|
|
1572
1758
|
for (let e of t) Z(e) && n.push(e.contentEntryId);
|
|
1573
1759
|
return n;
|
|
1574
1760
|
}
|
|
1575
|
-
function
|
|
1761
|
+
function an(e, t) {
|
|
1576
1762
|
return t === null ? null : e[t] ?? null;
|
|
1577
1763
|
}
|
|
1578
|
-
function
|
|
1764
|
+
function on(e, t) {
|
|
1579
1765
|
let n = [];
|
|
1580
1766
|
for (let r of t) {
|
|
1581
1767
|
let t = e[r];
|
|
@@ -1583,32 +1769,32 @@ function Yt(e, t) {
|
|
|
1583
1769
|
}
|
|
1584
1770
|
return n;
|
|
1585
1771
|
}
|
|
1586
|
-
function
|
|
1587
|
-
if (
|
|
1772
|
+
function sn(e, t) {
|
|
1773
|
+
if (ve.store(t)) return A(t, e.indexStore, (e, t) => an(t, Q(e)));
|
|
1588
1774
|
let n = Q(t);
|
|
1589
|
-
return e.indexStore.map((e) =>
|
|
1775
|
+
return e.indexStore.map((e) => an(e, n), { skipVoid: !1 });
|
|
1590
1776
|
}
|
|
1591
|
-
function
|
|
1592
|
-
if (
|
|
1777
|
+
function cn(e, t) {
|
|
1778
|
+
if (ve.store(t)) return A(t, e.indexStore, (e, t) => on(t, $(e)));
|
|
1593
1779
|
let n = $(t);
|
|
1594
|
-
return e.indexStore.map((e) =>
|
|
1780
|
+
return e.indexStore.map((e) => on(e, n), { skipVoid: !1 });
|
|
1595
1781
|
}
|
|
1596
1782
|
//#endregion
|
|
1597
1783
|
//#region src/exports.ts
|
|
1598
|
-
var
|
|
1599
|
-
let t = new
|
|
1784
|
+
var ln = (e) => {
|
|
1785
|
+
let t = new Yt(e);
|
|
1600
1786
|
return u(t), t;
|
|
1601
1787
|
};
|
|
1602
1788
|
//#endregion
|
|
1603
1789
|
//#region src/typed-content.ts
|
|
1604
|
-
function
|
|
1790
|
+
function un(e) {
|
|
1605
1791
|
return typeof e.data == "object";
|
|
1606
1792
|
}
|
|
1607
|
-
function
|
|
1608
|
-
return e.map((e) => !e ||
|
|
1793
|
+
function dn(e) {
|
|
1794
|
+
return e.map((e) => !e || !un(e) ? null : e, { skipVoid: !1 });
|
|
1609
1795
|
}
|
|
1610
|
-
function
|
|
1796
|
+
function fn(e, t) {
|
|
1611
1797
|
return e.contentModelKey === t;
|
|
1612
1798
|
}
|
|
1613
1799
|
//#endregion
|
|
1614
|
-
export {
|
|
1800
|
+
export { Qt as PICKED_HYDRATED_ATTR, Zt as PICKED_MODULE_SCRIPT_TYPE, Xt as PICKED_SCRIPT_TYPE, se as PREVIEW_TOKEN_PARAM, Yt as Picked, de as PreviewUnavailableError, en as buildRehydrateBootstrap, ln as createClient, Te as createPluginEffect, re as createStorageKey, sn as deriveReference, cn as deriveReferences, n as evaluateRuleLogic, Bt as getPickedConfig, fn as isContentOfModel, Z as isContentReference, tn as isHtmlAssetValue, g as isInsideIframe, rn as isLazyLoader, v as isPickedRoot, le as isPreviewSession, nn as lazyComponent, O as localStore, he as onInertScriptSubtrees, Q as readReferenceId, $ as readReferenceIds, $t as rehydrateScripts, pe as reportInertScriptSubtrees, me as resetInertScriptReport, ne 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, dn as toTypedContentStore };
|