@picked/client 0.0.83 → 0.0.84-next.1
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-C7k-sqTX.js → api-MpZsPlFm.js} +1 -1
- package/dist/api-fdr8U6uj.cjs +1 -0
- 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/reference/tools/mcp.md +32 -31
- package/dist/esm/index.js +376 -398
- package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
- package/dist/esm/server/index.js +39 -35
- package/dist/plugin-CP-W1V0R.cjs +1 -0
- package/dist/{plugin-Ch3nd-iX.js → plugin-CdfjHKod.js} +68 -52
- package/dist/{version-COZoqJaS.js → preview-unavailable-Cs6tiz5X.js} +104 -61
- package/dist/preview-unavailable-p5as3RNK.cjs +1 -0
- package/dist/{provider-URanKqBl.js → provider-DUACzeBR.js} +6 -3
- package/dist/provider-Dk6CixDl.cjs +1 -0
- package/dist/types/data-source/preview-unavailable.d.ts +18 -0
- package/dist/types/data-source/preview-unavailable.d.ts.map +1 -0
- package/dist/types/data-source/provider.d.ts +5 -0
- package/dist/types/data-source/provider.d.ts.map +1 -1
- package/dist/types/exports.d.ts +1 -0
- package/dist/types/exports.d.ts.map +1 -1
- package/dist/types/picked.d.ts +6 -0
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
- package/dist/types/server/serialize.d.ts +1 -0
- package/dist/types/server/serialize.d.ts.map +1 -1
- package/dist/types/utils/search-params.d.ts +20 -0
- package/dist/types/utils/search-params.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/api-CSANsJg3.cjs +0 -1
- package/dist/plugin-ByOn3B0I.cjs +0 -1
- package/dist/provider-CxjhDODz.cjs +0 -1
- package/dist/version-BlPyWs4m.cjs +0 -1
package/dist/esm/index.js
CHANGED
|
@@ -4,15 +4,15 @@ 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
6
|
import { d as S, l as C, n as w, r as te, u as T } from "../experience-instance-BibCf-8y.js";
|
|
7
|
-
import { i as ne, n as E, r as
|
|
8
|
-
import {
|
|
9
|
-
import { t as
|
|
10
|
-
import { n as
|
|
11
|
-
import { attach as
|
|
12
|
-
import { createFactory as
|
|
7
|
+
import { i as ne, n as E, r as re, t as ie } from "../storage-1MW3-_As.js";
|
|
8
|
+
import { a as ae, c as oe, l as se, n as ce, o as le, r as ue, s as de, t as fe } from "../preview-unavailable-Cs6tiz5X.js";
|
|
9
|
+
import { t as pe } from "../id-Bo4RBeOs.js";
|
|
10
|
+
import { n as me, r as he, t as ge } from "../inert-script-report-B_bMPRzp.js";
|
|
11
|
+
import { attach as D, combine as O, createApi as k, createDomain as A, createEffect as j, createEvent as M, createStore as N, is as _e, sample as P } from "effector";
|
|
12
|
+
import { createFactory as F, invoke as I } from "@withease/factories";
|
|
13
13
|
//#region src/entities/experience/experience.ts
|
|
14
|
-
var
|
|
15
|
-
let i =
|
|
14
|
+
var L = A("experience"), ve = F(({ client: e, experience: r }) => {
|
|
15
|
+
let i = L.store(r), a = k(i, { merge(e, t) {
|
|
16
16
|
return {
|
|
17
17
|
...e,
|
|
18
18
|
...t.experience
|
|
@@ -22,7 +22,7 @@ var z = M("experience"), fe = L(({ client: e, experience: r }) => {
|
|
|
22
22
|
decisionLogic: e.condition,
|
|
23
23
|
targetSelectors: e.targets,
|
|
24
24
|
initializeOpenLogic: e.initializeOpen
|
|
25
|
-
})), s =
|
|
25
|
+
})), s = O(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 = O(i, e.steps.indexStore, e.conditions.indexStore, (e, t, n) => {
|
|
26
26
|
let r = e.nodes.filter(S).map((e) => t[e.stepId]).filter((e) => e !== void 0), i = e.nodes.filter(T).map((e) => n[e.conditionId]).filter((e) => e !== void 0);
|
|
27
27
|
return {
|
|
28
28
|
steps: r,
|
|
@@ -30,7 +30,7 @@ var z = M("experience"), fe = L(({ client: e, experience: r }) => {
|
|
|
30
30
|
edges: e.edges,
|
|
31
31
|
conditions: i
|
|
32
32
|
};
|
|
33
|
-
}), l = i.map((e) => C(e.nodes, e.edges)), u = r.actions ?? [], d, f =
|
|
33
|
+
}), l = i.map((e) => C(e.nodes, e.edges)), u = r.actions ?? [], d, f = D({
|
|
34
34
|
source: o,
|
|
35
35
|
effect: (t, n) => {
|
|
36
36
|
let i = y(t.targetSelectors, r.id);
|
|
@@ -38,18 +38,18 @@ var z = M("experience"), fe = L(({ client: e, experience: r }) => {
|
|
|
38
38
|
n ? e.experienceInstances.spawn(d, t, n) : e.experienceInstances.spawn(d, t);
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
}), p =
|
|
41
|
+
}), p = O({
|
|
42
42
|
preconditionPassed: e.preconditionPassedStore,
|
|
43
43
|
isUser: e.session.store.map((e) => e.isUser, { skipVoid: !1 }),
|
|
44
44
|
config: o
|
|
45
|
-
}), m =
|
|
45
|
+
}), m = D({
|
|
46
46
|
source: p,
|
|
47
47
|
effect: async ({ preconditionPassed: i, isUser: a, config: o }) => {
|
|
48
48
|
if (!i || !a) return !1;
|
|
49
49
|
let { decisionLogic: s, targetSelectors: c } = o;
|
|
50
50
|
return c.length === 0 || y(c, r.id).length < 1 ? !1 : s === void 0 || !t(s) || await n(e, s) === !0;
|
|
51
51
|
}
|
|
52
|
-
}), h =
|
|
52
|
+
}), h = j(async () => {
|
|
53
53
|
if (!e.contentLoader) return !0;
|
|
54
54
|
try {
|
|
55
55
|
await e.contentLoader({
|
|
@@ -60,26 +60,26 @@ var z = M("experience"), fe = L(({ client: e, experience: r }) => {
|
|
|
60
60
|
`${r.id}`;
|
|
61
61
|
}
|
|
62
62
|
return !0;
|
|
63
|
-
}), g =
|
|
64
|
-
return
|
|
63
|
+
}), g = M(), _ = M(), v = L.createStore(void 0, { skipVoid: !1 }).on(g, (e, t) => t).on(_, (e, t) => t);
|
|
64
|
+
return P({
|
|
65
65
|
clock: g,
|
|
66
66
|
target: m
|
|
67
|
-
}),
|
|
67
|
+
}), P({
|
|
68
68
|
clock: m.doneData,
|
|
69
69
|
source: v,
|
|
70
70
|
filter: (e, t) => t,
|
|
71
71
|
fn: (e) => e,
|
|
72
72
|
target: f
|
|
73
|
-
}),
|
|
73
|
+
}), P({
|
|
74
74
|
clock: m.doneData,
|
|
75
75
|
filter: Boolean,
|
|
76
76
|
target: h
|
|
77
|
-
}),
|
|
77
|
+
}), P({
|
|
78
78
|
clock: _,
|
|
79
79
|
source: v,
|
|
80
80
|
fn: (e) => e,
|
|
81
81
|
target: f
|
|
82
|
-
}),
|
|
82
|
+
}), P({
|
|
83
83
|
clock: _,
|
|
84
84
|
target: h
|
|
85
85
|
}), d = {
|
|
@@ -99,22 +99,22 @@ var z = M("experience"), fe = L(({ client: e, experience: r }) => {
|
|
|
99
99
|
prepareExperienceContentFx: h
|
|
100
100
|
}, d;
|
|
101
101
|
});
|
|
102
|
-
function
|
|
103
|
-
return
|
|
102
|
+
function ye(e) {
|
|
103
|
+
return I(ve, e);
|
|
104
104
|
}
|
|
105
|
-
var
|
|
106
|
-
let t =
|
|
105
|
+
var be = F(({ client: e }) => {
|
|
106
|
+
let t = L.store({}), n = k(t, { register(e, t) {
|
|
107
107
|
return {
|
|
108
108
|
...e,
|
|
109
109
|
[t.id]: t
|
|
110
110
|
};
|
|
111
|
-
} }), r =
|
|
112
|
-
n.register(
|
|
111
|
+
} }), r = M(), i = j((t) => {
|
|
112
|
+
n.register(ye({
|
|
113
113
|
client: e,
|
|
114
114
|
experience: t
|
|
115
115
|
}));
|
|
116
116
|
});
|
|
117
|
-
|
|
117
|
+
P({
|
|
118
118
|
clock: r,
|
|
119
119
|
source: t,
|
|
120
120
|
filter: (e, t) => e[t.id] !== void 0,
|
|
@@ -127,7 +127,7 @@ var me = L(({ client: e }) => {
|
|
|
127
127
|
experience: t,
|
|
128
128
|
strategy: "override"
|
|
129
129
|
});
|
|
130
|
-
}),
|
|
130
|
+
}), P({
|
|
131
131
|
clock: r,
|
|
132
132
|
source: t,
|
|
133
133
|
filter: (e, t) => e[t.id] === void 0,
|
|
@@ -141,7 +141,7 @@ var me = L(({ client: e }) => {
|
|
|
141
141
|
function s(e) {
|
|
142
142
|
return t.map((t) => Object.values(t).find((t) => t.key === e) ?? t[e], { skipVoid: !1 });
|
|
143
143
|
}
|
|
144
|
-
let c =
|
|
144
|
+
let c = D({
|
|
145
145
|
source: t,
|
|
146
146
|
effect: (e, t) => {
|
|
147
147
|
let n = "key" in t ? Object.values(e).find((e) => e.key === t.key) : e[t.id];
|
|
@@ -159,7 +159,7 @@ var me = L(({ client: e }) => {
|
|
|
159
159
|
getById: o,
|
|
160
160
|
getByKey: s,
|
|
161
161
|
launch: c,
|
|
162
|
-
open:
|
|
162
|
+
open: D({
|
|
163
163
|
source: {
|
|
164
164
|
experiences: t,
|
|
165
165
|
instances: e.experienceInstances.listStore
|
|
@@ -187,7 +187,7 @@ var me = L(({ client: e }) => {
|
|
|
187
187
|
}
|
|
188
188
|
}),
|
|
189
189
|
listStore: a,
|
|
190
|
-
initialiseExperiencesFx:
|
|
190
|
+
initialiseExperiencesFx: D({
|
|
191
191
|
source: a,
|
|
192
192
|
effect: (e) => {
|
|
193
193
|
for (let t of e) t.initialiseRequested(void 0);
|
|
@@ -195,48 +195,48 @@ var me = L(({ client: e }) => {
|
|
|
195
195
|
})
|
|
196
196
|
};
|
|
197
197
|
});
|
|
198
|
-
function
|
|
199
|
-
return
|
|
198
|
+
function xe(e) {
|
|
199
|
+
return I(be, e);
|
|
200
200
|
}
|
|
201
|
-
var
|
|
201
|
+
var Se = async (e) => {
|
|
202
202
|
await e.experiences.initialiseExperiencesFx();
|
|
203
203
|
};
|
|
204
204
|
//#endregion
|
|
205
205
|
//#region src/entities/plugin/plugin.ts
|
|
206
|
-
function
|
|
207
|
-
return
|
|
206
|
+
function Ce(e) {
|
|
207
|
+
return j(async () => {
|
|
208
208
|
await e();
|
|
209
209
|
});
|
|
210
210
|
}
|
|
211
|
-
var
|
|
211
|
+
var we = (e, t, n) => {
|
|
212
212
|
let r = t.name, i = t.setup(e), a = n[r] ?? {};
|
|
213
213
|
n[r] = Object.freeze({
|
|
214
214
|
...a,
|
|
215
215
|
...i
|
|
216
216
|
});
|
|
217
|
-
},
|
|
217
|
+
}, Te = A("component"), Ee = F(({ client: e, component: t, name: n }) => ({
|
|
218
218
|
name: n,
|
|
219
219
|
component: t,
|
|
220
220
|
frameworkStore: e.frameworks.getByName(t.frameworkName)
|
|
221
221
|
}));
|
|
222
|
-
function
|
|
223
|
-
return
|
|
222
|
+
function De(e) {
|
|
223
|
+
return I(Ee, e);
|
|
224
224
|
}
|
|
225
|
-
var
|
|
226
|
-
let t =
|
|
225
|
+
var Oe = F(({ client: e }) => {
|
|
226
|
+
let t = Te.store({}), n = k(t, { register(e, t) {
|
|
227
227
|
return {
|
|
228
228
|
...e,
|
|
229
229
|
[t.name]: t
|
|
230
230
|
};
|
|
231
|
-
} }), i =
|
|
232
|
-
|
|
231
|
+
} }), i = M();
|
|
232
|
+
P({
|
|
233
233
|
clock: i,
|
|
234
234
|
source: t,
|
|
235
235
|
filter: (e, { name: t }) => e[t] !== void 0,
|
|
236
236
|
fn: (e, { name: t }) => `Component '${t}' already registered. Registering again will override the previous registration.`
|
|
237
|
-
}).watch((e) => /* @__PURE__ */ r("warn", e)),
|
|
237
|
+
}).watch((e) => /* @__PURE__ */ r("warn", e)), P({
|
|
238
238
|
clock: i,
|
|
239
|
-
fn: ({ name: t, component: n }) =>
|
|
239
|
+
fn: ({ name: t, component: n }) => De({
|
|
240
240
|
client: e,
|
|
241
241
|
name: t,
|
|
242
242
|
component: n
|
|
@@ -253,27 +253,27 @@ var Se = L(({ client: e }) => {
|
|
|
253
253
|
listStore: a
|
|
254
254
|
};
|
|
255
255
|
});
|
|
256
|
-
function
|
|
257
|
-
return
|
|
256
|
+
function ke(e) {
|
|
257
|
+
return I(Oe, e);
|
|
258
258
|
}
|
|
259
|
-
var
|
|
259
|
+
var R = (e, t, n) => {
|
|
260
260
|
n.register({
|
|
261
261
|
name: e,
|
|
262
262
|
component: t
|
|
263
263
|
});
|
|
264
|
-
},
|
|
265
|
-
let t =
|
|
264
|
+
}, Ae = A("framework"), je = F((e) => {
|
|
265
|
+
let t = Ae.store({}), n = k(t, { register(e, t) {
|
|
266
266
|
return {
|
|
267
267
|
...e,
|
|
268
268
|
[t.name]: t.framework
|
|
269
269
|
};
|
|
270
|
-
} }), i =
|
|
271
|
-
|
|
270
|
+
} }), i = M();
|
|
271
|
+
P({
|
|
272
272
|
clock: i,
|
|
273
273
|
source: t,
|
|
274
274
|
filter: (e, { name: t }) => e[t] !== void 0,
|
|
275
275
|
fn: (e, { name: t }) => `Framework '${t}' already registered. Registering again will override the previous registration.`
|
|
276
|
-
}).watch((e) => /* @__PURE__ */ r("warn", e)),
|
|
276
|
+
}).watch((e) => /* @__PURE__ */ r("warn", e)), P({
|
|
277
277
|
clock: i,
|
|
278
278
|
target: n.register
|
|
279
279
|
});
|
|
@@ -287,106 +287,106 @@ var we = (e, t, n) => {
|
|
|
287
287
|
listStore: a
|
|
288
288
|
};
|
|
289
289
|
});
|
|
290
|
-
function
|
|
291
|
-
return
|
|
290
|
+
function Me(e) {
|
|
291
|
+
return I(je, e);
|
|
292
292
|
}
|
|
293
|
-
var
|
|
293
|
+
var Ne = (e, t) => {
|
|
294
294
|
t.register({
|
|
295
295
|
name: e.name,
|
|
296
296
|
framework: e
|
|
297
297
|
});
|
|
298
|
-
},
|
|
298
|
+
}, Pe = F(({ client: e }) => {
|
|
299
299
|
let t = "window" in globalThis, n = {
|
|
300
300
|
location: t ? globalThis.location : void 0,
|
|
301
301
|
document: t ? globalThis.document : void 0,
|
|
302
302
|
sessionStorage: t ? globalThis.sessionStorage : void 0,
|
|
303
303
|
localStorage: t ? globalThis.localStorage : void 0
|
|
304
304
|
};
|
|
305
|
-
return
|
|
305
|
+
return O(e.responses.listStore, e.fields.listStore, (t, r) => Object.freeze({
|
|
306
306
|
client: e,
|
|
307
307
|
responses: t,
|
|
308
308
|
fields: r,
|
|
309
309
|
...n
|
|
310
310
|
}));
|
|
311
311
|
});
|
|
312
|
-
function
|
|
313
|
-
return
|
|
312
|
+
function Fe(e) {
|
|
313
|
+
return I(Pe, e);
|
|
314
314
|
}
|
|
315
315
|
//#endregion
|
|
316
316
|
//#region src/logic-engine.ts
|
|
317
|
-
function
|
|
317
|
+
function Ie(e) {
|
|
318
318
|
return typeof e == "number" && !isNaN(e);
|
|
319
319
|
}
|
|
320
|
-
function
|
|
320
|
+
function z(e) {
|
|
321
321
|
return typeof e == "string";
|
|
322
322
|
}
|
|
323
|
-
function
|
|
323
|
+
function B(e) {
|
|
324
324
|
return Array.isArray(e);
|
|
325
325
|
}
|
|
326
|
-
function
|
|
326
|
+
function Le(e) {
|
|
327
327
|
return e instanceof Promise;
|
|
328
328
|
}
|
|
329
|
-
function
|
|
329
|
+
function Re(e) {
|
|
330
330
|
return typeof e == "object" && !!e && !Array.isArray(e) && Object.keys(e).length === 1;
|
|
331
331
|
}
|
|
332
|
-
function
|
|
333
|
-
if (
|
|
332
|
+
function V(e) {
|
|
333
|
+
if (Ie(e)) return e;
|
|
334
334
|
let t = parseFloat(`${e}`);
|
|
335
335
|
return isNaN(t) ? 0 : t;
|
|
336
336
|
}
|
|
337
|
-
function
|
|
337
|
+
function H(e) {
|
|
338
338
|
return `${e}`;
|
|
339
339
|
}
|
|
340
|
-
var
|
|
340
|
+
var ze = {
|
|
341
341
|
"==": (e, t) => e == t,
|
|
342
342
|
"===": (e, t) => e === t,
|
|
343
343
|
"!=": (e, t) => e != t,
|
|
344
344
|
"!==": (e, t) => e !== t,
|
|
345
|
-
">": (e, t) =>
|
|
346
|
-
">=": (e, t) =>
|
|
345
|
+
">": (e, t) => V(e) > V(t),
|
|
346
|
+
">=": (e, t) => V(e) >= V(t),
|
|
347
347
|
"<": (e, t, n) => {
|
|
348
|
-
let r =
|
|
348
|
+
let r = V(e), i = V(t);
|
|
349
349
|
if (n === void 0) return r < i;
|
|
350
|
-
let a =
|
|
350
|
+
let a = V(n);
|
|
351
351
|
return r < i && i < a;
|
|
352
352
|
},
|
|
353
353
|
"<=": (e, t, n) => {
|
|
354
|
-
let r =
|
|
354
|
+
let r = V(e), i = V(t);
|
|
355
355
|
if (n === void 0) return r <= i;
|
|
356
|
-
let a =
|
|
356
|
+
let a = V(n);
|
|
357
357
|
return r <= i && i <= a;
|
|
358
358
|
},
|
|
359
|
-
"!!": async (e) => await
|
|
360
|
-
"!": async (e) => !await
|
|
361
|
-
"%": (e, t) =>
|
|
359
|
+
"!!": async (e) => await W(e),
|
|
360
|
+
"!": async (e) => !await W(e),
|
|
361
|
+
"%": (e, t) => V(e) % V(t),
|
|
362
362
|
log: (e) => (console.log(e), e),
|
|
363
|
-
in: (e, t) => t ?
|
|
364
|
-
cat: (...e) => e.map(
|
|
363
|
+
in: (e, t) => t ? z(t) ? t.indexOf(H(e)) !== -1 : B(t) ? t.includes(e) : !1 : !1,
|
|
364
|
+
cat: (...e) => e.map(H).join(""),
|
|
365
365
|
substr: (e, t, n) => {
|
|
366
|
-
let r =
|
|
366
|
+
let r = H(e), i = V(t);
|
|
367
367
|
if (n === void 0) return r.substr(i);
|
|
368
|
-
let a =
|
|
368
|
+
let a = V(n);
|
|
369
369
|
if (a < 0) {
|
|
370
370
|
let e = r.substr(i);
|
|
371
371
|
return e.substr(0, e.length + a);
|
|
372
372
|
}
|
|
373
373
|
return r.substr(i, a);
|
|
374
374
|
},
|
|
375
|
-
"+": (...e) => e.reduce((e, t) =>
|
|
376
|
-
"*": (...e) => e.reduce((e, t) =>
|
|
375
|
+
"+": (...e) => e.reduce((e, t) => V(e) + V(t), 0),
|
|
376
|
+
"*": (...e) => e.reduce((e, t) => V(e) * V(t), 1),
|
|
377
377
|
"-": (e, t) => {
|
|
378
|
-
let n =
|
|
379
|
-
return t === void 0 ? -n : n -
|
|
378
|
+
let n = V(e);
|
|
379
|
+
return t === void 0 ? -n : n - V(t);
|
|
380
380
|
},
|
|
381
|
-
"/": (e, t) =>
|
|
382
|
-
min: (...e) => Math.min(...e.map(
|
|
383
|
-
max: (...e) => Math.max(...e.map(
|
|
384
|
-
merge: (...e) => e.reduce((e, t) =>
|
|
381
|
+
"/": (e, t) => V(e) / V(t),
|
|
382
|
+
min: (...e) => Math.min(...e.map(V)),
|
|
383
|
+
max: (...e) => Math.max(...e.map(V)),
|
|
384
|
+
merge: (...e) => e.reduce((e, t) => B(t) ? e.concat(t) : e.concat([t]), []),
|
|
385
385
|
var(e, t) {
|
|
386
386
|
let n = arguments.length > 1 ? t : null;
|
|
387
387
|
if (e === "" || e === "." || e == null) return this;
|
|
388
388
|
if (typeof e == "number" && Array.isArray(this)) return e >= 0 && e < this.length ? this[e] : n;
|
|
389
|
-
let r =
|
|
389
|
+
let r = H(e);
|
|
390
390
|
if (r === "" || r === ".") return this;
|
|
391
391
|
let i = r.split("."), a = this;
|
|
392
392
|
for (let e of i) {
|
|
@@ -399,126 +399,126 @@ var Pe = {
|
|
|
399
399
|
return a === void 0 ? n : a;
|
|
400
400
|
},
|
|
401
401
|
async missing(...e) {
|
|
402
|
-
let t =
|
|
402
|
+
let t = B(e[0]) ? e[0] : e, n = [];
|
|
403
403
|
for (let e of t) {
|
|
404
|
-
let t = await
|
|
404
|
+
let t = await U({ var: e }, this);
|
|
405
405
|
(t === null || t === "") && n.push(`${e}`);
|
|
406
406
|
}
|
|
407
407
|
return n;
|
|
408
408
|
},
|
|
409
409
|
async missing_some(e, t) {
|
|
410
|
-
let n = await
|
|
411
|
-
if (!
|
|
412
|
-
let r = n.filter(
|
|
413
|
-
return t.filter(
|
|
410
|
+
let n = await U({ missing: t }, this);
|
|
411
|
+
if (!B(n) || !B(t)) return [];
|
|
412
|
+
let r = n.filter(z);
|
|
413
|
+
return t.filter(z).length - r.length >= V(e) ? [] : r;
|
|
414
414
|
},
|
|
415
415
|
invoke(...e) {
|
|
416
416
|
let [t, ...n] = e;
|
|
417
417
|
return typeof t == "function" ? Reflect.apply(t, null, n) : null;
|
|
418
418
|
},
|
|
419
|
-
startsWith: (e, t) =>
|
|
420
|
-
endsWith: (e, t) =>
|
|
419
|
+
startsWith: (e, t) => z(e) && z(t) && e.startsWith(t),
|
|
420
|
+
endsWith: (e, t) => z(e) && z(t) && e.endsWith(t),
|
|
421
421
|
regexp_matches(e, t) {
|
|
422
422
|
let n = e, r = "";
|
|
423
|
-
if (
|
|
423
|
+
if (B(e)) {
|
|
424
424
|
let [t, i] = e;
|
|
425
425
|
n = t, r = i;
|
|
426
426
|
}
|
|
427
|
-
return !
|
|
427
|
+
return !z(n) || !z(r) ? !1 : new RegExp(n, r).test(H(t));
|
|
428
428
|
},
|
|
429
429
|
throw(e) {
|
|
430
|
-
throw Error(
|
|
430
|
+
throw Error(H(e));
|
|
431
431
|
}
|
|
432
432
|
};
|
|
433
|
-
async function
|
|
433
|
+
async function U(e, t) {
|
|
434
434
|
if (!e) return e;
|
|
435
|
-
if (
|
|
436
|
-
if (
|
|
437
|
-
if (!
|
|
438
|
-
let n =
|
|
439
|
-
switch (
|
|
435
|
+
if (Le(e)) return U(await e, t);
|
|
436
|
+
if (B(e)) return Promise.all(e.map((e) => U(e, t)));
|
|
437
|
+
if (!Re(e)) return e;
|
|
438
|
+
let n = Be(e), r = n ? e[n] ?? [] : [];
|
|
439
|
+
switch (B(r) || (r = [r]), n) {
|
|
440
440
|
case "if":
|
|
441
441
|
case "?:":
|
|
442
|
-
for (let e = 0; e < r.length - 1; e += 2) if (await
|
|
443
|
-
return r.length % 2 == 1 ?
|
|
442
|
+
for (let e = 0; e < r.length - 1; e += 2) if (await W(await U(r[e], t))) return U(r[e + 1], t);
|
|
443
|
+
return r.length % 2 == 1 ? U(r[r.length - 1], t) : null;
|
|
444
444
|
case "and": {
|
|
445
445
|
let e = null;
|
|
446
|
-
for (let n of r) if (e = await
|
|
446
|
+
for (let n of r) if (e = await U(n, t), !await W(e)) return e;
|
|
447
447
|
return e;
|
|
448
448
|
}
|
|
449
449
|
case "or": {
|
|
450
450
|
let e = null;
|
|
451
|
-
for (let n of r) if (e = await
|
|
451
|
+
for (let n of r) if (e = await U(n, t), await W(e)) return e;
|
|
452
452
|
return e;
|
|
453
453
|
}
|
|
454
454
|
case "map": {
|
|
455
|
-
let e = await
|
|
456
|
-
return
|
|
455
|
+
let e = await U(r[0], t);
|
|
456
|
+
return B(e) ? await Promise.all(e.map((e) => U(r[1], e))) : [];
|
|
457
457
|
}
|
|
458
458
|
case "filter": {
|
|
459
|
-
let e = await
|
|
460
|
-
return
|
|
459
|
+
let e = await U(r[0], t);
|
|
460
|
+
return B(e) ? (await Promise.all(e.map(async (e) => ({
|
|
461
461
|
item: e,
|
|
462
|
-
shouldInclude: await
|
|
462
|
+
shouldInclude: await W(await U(r[1], e))
|
|
463
463
|
})))).filter(({ shouldInclude: e }) => e).map(({ item: e }) => e) : [];
|
|
464
464
|
}
|
|
465
465
|
case "reduce": {
|
|
466
|
-
let e = await
|
|
467
|
-
if (!
|
|
468
|
-
let n = r[1], i = r.length > 2 ? await
|
|
469
|
-
for (let t of e) i = await
|
|
466
|
+
let e = await U(r[0], t);
|
|
467
|
+
if (!B(e)) return r.length > 2 ? await U(r[2], t) : null;
|
|
468
|
+
let n = r[1], i = r.length > 2 ? await U(r[2], t) : null;
|
|
469
|
+
for (let t of e) i = await U(n, {
|
|
470
470
|
current: t,
|
|
471
471
|
accumulator: i
|
|
472
472
|
});
|
|
473
473
|
return i;
|
|
474
474
|
}
|
|
475
475
|
case "all": {
|
|
476
|
-
let e = await
|
|
477
|
-
if (!
|
|
478
|
-
for (let t of e) if (!await
|
|
476
|
+
let e = await U(r[0], t);
|
|
477
|
+
if (!B(e) || e.length === 0) return !1;
|
|
478
|
+
for (let t of e) if (!await W(await U(r[1], t))) return !1;
|
|
479
479
|
return !0;
|
|
480
480
|
}
|
|
481
481
|
case "some": {
|
|
482
|
-
let e = await
|
|
483
|
-
if (!
|
|
484
|
-
for (let t of e) if (await
|
|
482
|
+
let e = await U(r[0], t);
|
|
483
|
+
if (!B(e)) return !1;
|
|
484
|
+
for (let t of e) if (await W(await U(r[1], t))) return !0;
|
|
485
485
|
return !1;
|
|
486
486
|
}
|
|
487
487
|
case "none": {
|
|
488
|
-
let e = await
|
|
489
|
-
if (!
|
|
490
|
-
for (let t of e) if (await
|
|
488
|
+
let e = await U(r[0], t);
|
|
489
|
+
if (!B(e)) return !0;
|
|
490
|
+
for (let t of e) if (await W(await U(r[1], t))) return !1;
|
|
491
491
|
return !0;
|
|
492
492
|
}
|
|
493
493
|
case "catch": try {
|
|
494
|
-
return await
|
|
494
|
+
return await U(r[0], t);
|
|
495
495
|
} catch (e) {
|
|
496
|
-
return
|
|
496
|
+
return Re(e) ? await U(e, t) : r[1] ? await U(r[1], e) : e instanceof Error ? e.message : e;
|
|
497
497
|
}
|
|
498
498
|
}
|
|
499
|
-
let i = await Promise.all(r.map((e) =>
|
|
499
|
+
let i = await Promise.all(r.map((e) => U(e, t))), a = n ? ze[n] : void 0;
|
|
500
500
|
if (!a) throw Error(`Unrecognized operation ${n}`);
|
|
501
501
|
return a.apply(t, i);
|
|
502
502
|
}
|
|
503
|
-
async function
|
|
504
|
-
return
|
|
503
|
+
async function W(e) {
|
|
504
|
+
return Le(e) ? W(await e) : !(Array.isArray(e) && e.length === 0) && !!e;
|
|
505
505
|
}
|
|
506
|
-
function
|
|
506
|
+
function Be(e) {
|
|
507
507
|
return Object.keys(e)[0];
|
|
508
508
|
}
|
|
509
509
|
//#endregion
|
|
510
510
|
//#region src/lifecycle/rules-logic.ts
|
|
511
|
-
function
|
|
511
|
+
function Ve(e, t, n) {
|
|
512
512
|
return new Proxy(Object.create(null), { get(r, i) {
|
|
513
513
|
if (typeof i != "string") return;
|
|
514
514
|
let a = e.find((e) => e.key === i);
|
|
515
|
-
if (a !== void 0) return async () => !n.has(i) && await
|
|
515
|
+
if (a !== void 0) return async () => !n.has(i) && await U(a.logic, {
|
|
516
516
|
...t,
|
|
517
|
-
conditions:
|
|
517
|
+
conditions: Ve(e, t, new Set(n).add(i))
|
|
518
518
|
}) === !0;
|
|
519
519
|
} });
|
|
520
520
|
}
|
|
521
|
-
var
|
|
521
|
+
var He = F(({ client: e }) => D({
|
|
522
522
|
source: {
|
|
523
523
|
stateSnapshot: e.stateSnapshotStore,
|
|
524
524
|
predicates: e.predicates.listStore,
|
|
@@ -555,130 +555,130 @@ var Le = L(({ client: e }) => k({
|
|
|
555
555
|
features: u,
|
|
556
556
|
...s
|
|
557
557
|
};
|
|
558
|
-
return await
|
|
558
|
+
return await U(o, {
|
|
559
559
|
...d,
|
|
560
|
-
conditions:
|
|
560
|
+
conditions: Ve(a, d, /* @__PURE__ */ new Set())
|
|
561
561
|
});
|
|
562
562
|
}
|
|
563
563
|
}));
|
|
564
|
-
function
|
|
565
|
-
return
|
|
564
|
+
function Ue(e) {
|
|
565
|
+
return I(He, e);
|
|
566
566
|
}
|
|
567
567
|
//#endregion
|
|
568
568
|
//#region src/lifecycle/lifecycle.ts
|
|
569
|
-
var
|
|
570
|
-
let t =
|
|
569
|
+
var G = A("lifecycle"), We = F(({ client: e }) => {
|
|
570
|
+
let t = G.store(!1), r = N(void 0, {
|
|
571
571
|
skipVoid: !1,
|
|
572
|
-
domain:
|
|
573
|
-
}), i =
|
|
572
|
+
domain: G
|
|
573
|
+
}), i = N(void 0, {
|
|
574
574
|
skipVoid: !1,
|
|
575
|
-
domain:
|
|
576
|
-
}), a =
|
|
575
|
+
domain: G
|
|
576
|
+
}), a = G.store("idle"), o = G.store([]), s = N(void 0, {
|
|
577
577
|
skipVoid: !1,
|
|
578
|
-
domain:
|
|
579
|
-
}), l =
|
|
578
|
+
domain: G
|
|
579
|
+
}), l = N(void 0, {
|
|
580
580
|
skipVoid: !1,
|
|
581
|
-
domain:
|
|
582
|
-
}), u =
|
|
581
|
+
domain: G
|
|
582
|
+
}), u = M(), d = M(), f = M(), p = M(), m = M(), h = M();
|
|
583
583
|
o.on(p, (e, t) => [...e, t]), s.on(m, (e, t) => t), l.on(h, (e, t) => t), t.on(d, () => !0);
|
|
584
|
-
let g =
|
|
584
|
+
let g = j(async () => {
|
|
585
585
|
await ee();
|
|
586
|
-
}), _ =
|
|
587
|
-
await
|
|
588
|
-
}), v =
|
|
586
|
+
}), _ = j(async () => {
|
|
587
|
+
await Se(e);
|
|
588
|
+
}), v = D({ effect: _ }), y = D({
|
|
589
589
|
source: o,
|
|
590
590
|
effect: async (e) => {
|
|
591
591
|
for (let t of e) await t();
|
|
592
592
|
}
|
|
593
|
-
}), b =
|
|
593
|
+
}), b = D({
|
|
594
594
|
source: s,
|
|
595
595
|
effect: async (t) => t === void 0 ? !0 : typeof t == "boolean" ? t : await n(e, t) === !0
|
|
596
|
-
}), x =
|
|
596
|
+
}), x = D({
|
|
597
597
|
source: l,
|
|
598
598
|
effect: async (t) => t === void 0 ? !0 : typeof t == "boolean" ? t : await n(e, t) === !0
|
|
599
|
-
}), S =
|
|
599
|
+
}), S = P({
|
|
600
600
|
clock: u,
|
|
601
601
|
source: a,
|
|
602
602
|
filter: (e) => e === "idle" && c(),
|
|
603
603
|
fn: () => void 0
|
|
604
604
|
});
|
|
605
|
-
|
|
605
|
+
P({
|
|
606
606
|
clock: S,
|
|
607
607
|
fn: () => "starting",
|
|
608
608
|
target: a
|
|
609
|
-
}), S.watch(e.performance.markBegin), d.watch(e.performance.measure),
|
|
609
|
+
}), S.watch(e.performance.markBegin), d.watch(e.performance.measure), P({
|
|
610
610
|
clock: S,
|
|
611
611
|
target: y
|
|
612
|
-
}),
|
|
612
|
+
}), P({
|
|
613
613
|
clock: S,
|
|
614
614
|
target: g
|
|
615
|
-
}),
|
|
615
|
+
}), P({
|
|
616
616
|
clock: y.done,
|
|
617
617
|
target: b
|
|
618
|
-
}),
|
|
618
|
+
}), P({
|
|
619
619
|
clock: b.doneData,
|
|
620
620
|
target: r
|
|
621
|
-
}),
|
|
621
|
+
}), P({
|
|
622
622
|
clock: x.doneData,
|
|
623
623
|
target: i
|
|
624
|
-
}),
|
|
624
|
+
}), P({
|
|
625
625
|
clock: b.doneData,
|
|
626
626
|
filter: (e) => e,
|
|
627
627
|
target: x
|
|
628
|
-
}),
|
|
628
|
+
}), P({
|
|
629
629
|
clock: x.doneData,
|
|
630
630
|
target: e.session.setIsUser
|
|
631
|
-
}),
|
|
631
|
+
}), P({
|
|
632
632
|
clock: x.doneData,
|
|
633
633
|
fn: (e) => ({
|
|
634
634
|
type: "user_decide",
|
|
635
635
|
value: e
|
|
636
636
|
}),
|
|
637
637
|
target: e.eventBus
|
|
638
|
-
}),
|
|
638
|
+
}), P({
|
|
639
639
|
clock: b.doneData,
|
|
640
640
|
filter: (e) => !e,
|
|
641
641
|
fn: () => void 0,
|
|
642
642
|
target: f
|
|
643
|
-
}),
|
|
643
|
+
}), P({
|
|
644
644
|
clock: x.doneData,
|
|
645
645
|
fn: () => void 0,
|
|
646
646
|
target: f
|
|
647
|
-
}),
|
|
647
|
+
}), P({
|
|
648
648
|
clock: f,
|
|
649
649
|
fn: () => ({ type: "initialize" }),
|
|
650
650
|
target: e.eventBus
|
|
651
651
|
});
|
|
652
|
-
let C =
|
|
653
|
-
|
|
652
|
+
let C = N(!1).on(g.done, () => !0), w = N(!1).on(f, () => !0), te = N(!1).on(v.done, () => !0), T = O(r, i, (e, t) => e === !0 && t === !0);
|
|
653
|
+
P({
|
|
654
654
|
clock: f,
|
|
655
655
|
source: T,
|
|
656
656
|
filter: (e) => e,
|
|
657
657
|
fn: () => void 0,
|
|
658
658
|
target: _
|
|
659
659
|
});
|
|
660
|
-
let ne =
|
|
661
|
-
|
|
660
|
+
let ne = O(C, w, T, (e, t, n) => e && t && n);
|
|
661
|
+
P({
|
|
662
662
|
clock: ne,
|
|
663
663
|
filter: (e) => e,
|
|
664
664
|
fn: () => void 0,
|
|
665
665
|
target: v
|
|
666
666
|
});
|
|
667
|
-
let E =
|
|
668
|
-
return
|
|
667
|
+
let E = O(C, w, T, te, (e, t, n, r) => e && t && (!n || r));
|
|
668
|
+
return P({
|
|
669
669
|
clock: E,
|
|
670
670
|
filter: (e) => e,
|
|
671
671
|
fn: () => void 0,
|
|
672
672
|
target: d
|
|
673
|
-
}),
|
|
673
|
+
}), P({
|
|
674
674
|
clock: d,
|
|
675
675
|
fn: () => "ready",
|
|
676
676
|
target: a
|
|
677
|
-
}),
|
|
677
|
+
}), P({
|
|
678
678
|
clock: d,
|
|
679
679
|
fn: () => ({ type: "ready" }),
|
|
680
680
|
target: e.eventBus
|
|
681
|
-
}),
|
|
681
|
+
}), P({
|
|
682
682
|
clock: d,
|
|
683
683
|
source: e.session.store,
|
|
684
684
|
fn: ({ id: e, isUser: t, identifiers: n }) => ({
|
|
@@ -688,7 +688,7 @@ var K = M("lifecycle"), ze = L(({ client: e }) => {
|
|
|
688
688
|
identifiers: n
|
|
689
689
|
}),
|
|
690
690
|
target: e.eventBus
|
|
691
|
-
}),
|
|
691
|
+
}), P({
|
|
692
692
|
clock: [
|
|
693
693
|
y.fail,
|
|
694
694
|
b.fail,
|
|
@@ -710,13 +710,13 @@ var K = M("lifecycle"), ze = L(({ client: e }) => {
|
|
|
710
710
|
setCondition: h
|
|
711
711
|
};
|
|
712
712
|
});
|
|
713
|
-
function
|
|
714
|
-
return
|
|
713
|
+
function Ge(e) {
|
|
714
|
+
return I(We, e);
|
|
715
715
|
}
|
|
716
716
|
//#endregion
|
|
717
717
|
//#region src/entities/predicate/predicate.ts
|
|
718
|
-
var
|
|
719
|
-
let t =
|
|
718
|
+
var Ke = A("predicate"), qe = F(({ client: e }) => {
|
|
719
|
+
let t = Ke.store({}), n = k(t, { register(e, t) {
|
|
720
720
|
return {
|
|
721
721
|
...e,
|
|
722
722
|
[t.name]: {
|
|
@@ -724,13 +724,13 @@ var Ve = M("predicate"), He = L(({ client: e }) => {
|
|
|
724
724
|
predicate: t.predicate
|
|
725
725
|
}
|
|
726
726
|
};
|
|
727
|
-
} }), i =
|
|
728
|
-
|
|
727
|
+
} }), i = M();
|
|
728
|
+
P({
|
|
729
729
|
clock: i,
|
|
730
730
|
source: t,
|
|
731
731
|
filter: (e, { name: t }) => e[t] !== void 0,
|
|
732
732
|
fn: (e, { name: t }) => `Predicate '${t}' already registered. Registering again will override the previous registration.`
|
|
733
|
-
}).watch((e) => /* @__PURE__ */ r("warn", e)),
|
|
733
|
+
}).watch((e) => /* @__PURE__ */ r("warn", e)), P({
|
|
734
734
|
clock: i,
|
|
735
735
|
fn: ({ name: e, predicate: t }) => Object.freeze({
|
|
736
736
|
name: e,
|
|
@@ -743,7 +743,7 @@ var Ve = M("predicate"), He = L(({ client: e }) => {
|
|
|
743
743
|
return t.map((t) => t[e]?.predicate, { skipVoid: !1 });
|
|
744
744
|
}
|
|
745
745
|
function s(t) {
|
|
746
|
-
let n =
|
|
746
|
+
let n = N(() => void 0, { skipVoid: !1 }), r = D({
|
|
747
747
|
source: {
|
|
748
748
|
predicate: o(t),
|
|
749
749
|
snapshot: e.stateSnapshotStore
|
|
@@ -755,13 +755,13 @@ var Ve = M("predicate"), He = L(({ client: e }) => {
|
|
|
755
755
|
});
|
|
756
756
|
}
|
|
757
757
|
});
|
|
758
|
-
return
|
|
758
|
+
return P({
|
|
759
759
|
source: {
|
|
760
760
|
responses: e.responses.listStore,
|
|
761
761
|
fields: e.fields.listStore
|
|
762
762
|
},
|
|
763
763
|
target: r
|
|
764
|
-
}),
|
|
764
|
+
}), P({
|
|
765
765
|
clock: r.doneData,
|
|
766
766
|
filter: (e) => e !== void 0,
|
|
767
767
|
target: n
|
|
@@ -774,26 +774,26 @@ var Ve = M("predicate"), He = L(({ client: e }) => {
|
|
|
774
774
|
getEvokablePredicate: s
|
|
775
775
|
};
|
|
776
776
|
});
|
|
777
|
-
function
|
|
778
|
-
return
|
|
777
|
+
function Je(e) {
|
|
778
|
+
return I(qe, e);
|
|
779
779
|
}
|
|
780
|
-
var
|
|
780
|
+
var Ye = (e, t, n) => {
|
|
781
781
|
n.register({
|
|
782
782
|
name: e,
|
|
783
783
|
predicate: t
|
|
784
784
|
});
|
|
785
|
-
},
|
|
786
|
-
function
|
|
785
|
+
}, K = A("history");
|
|
786
|
+
function Xe(e, t) {
|
|
787
787
|
return {
|
|
788
|
-
id:
|
|
788
|
+
id: pe(`history-entry-${Date.now()}-${Math.random()}}`),
|
|
789
789
|
node: t,
|
|
790
790
|
at: Date.now(),
|
|
791
791
|
experienceId: e
|
|
792
792
|
};
|
|
793
793
|
}
|
|
794
|
-
var
|
|
795
|
-
let e =
|
|
796
|
-
e.on(t, (e, t) => ({ entries: [...e.entries,
|
|
794
|
+
var Ze = F(() => {
|
|
795
|
+
let e = K.store({ entries: [] }), t = K.event(), n = K.event(), r = K.event(), i = K.event();
|
|
796
|
+
e.on(t, (e, t) => ({ entries: [...e.entries, Xe(t.experienceId, t.node)] })), e.on(n, (e, t) => ({ entries: [...e.entries.slice(0, -1), Xe(t.experienceId, t.node)] })), e.on(i, (e, t) => t);
|
|
797
797
|
function a(e, t) {
|
|
798
798
|
let n = {
|
|
799
799
|
lastStepIndex: -1,
|
|
@@ -823,22 +823,22 @@ var Ke = L(() => {
|
|
|
823
823
|
entriesStore: e.map((e) => e.entries)
|
|
824
824
|
};
|
|
825
825
|
});
|
|
826
|
-
function
|
|
827
|
-
return
|
|
826
|
+
function Qe() {
|
|
827
|
+
return I(Ze);
|
|
828
828
|
}
|
|
829
829
|
//#endregion
|
|
830
830
|
//#region src/utils/events.ts
|
|
831
|
-
var
|
|
832
|
-
let t =
|
|
831
|
+
var $e = 0, et = (e) => {
|
|
832
|
+
let t = N([]);
|
|
833
833
|
return t.on(e, (e, t) => [...e, {
|
|
834
|
-
id:
|
|
834
|
+
id: $e++,
|
|
835
835
|
at: /* @__PURE__ */ new Date(),
|
|
836
836
|
payload: t
|
|
837
837
|
}]), t;
|
|
838
838
|
};
|
|
839
839
|
//#endregion
|
|
840
840
|
//#region src/entities/field/policies.ts
|
|
841
|
-
function
|
|
841
|
+
function tt(e) {
|
|
842
842
|
let { doNotTrackValue: t, doNotStoreValue: n } = e ?? {}, r = e?.trackValue ?? t === !1, i = e?.storeValue ?? n === !1;
|
|
843
843
|
return {
|
|
844
844
|
trackValue: r,
|
|
@@ -849,10 +849,10 @@ function Xe(e) {
|
|
|
849
849
|
}
|
|
850
850
|
//#endregion
|
|
851
851
|
//#region src/entities/field/field.ts
|
|
852
|
-
var
|
|
853
|
-
let e =
|
|
852
|
+
var nt = A("field"), rt = F(() => {
|
|
853
|
+
let e = nt.store({}), t = k(e, {
|
|
854
854
|
register(e, t) {
|
|
855
|
-
let n = Object.assign({}, t.field, { policies:
|
|
855
|
+
let n = Object.assign({}, t.field, { policies: tt(t.field.policies) });
|
|
856
856
|
return {
|
|
857
857
|
...e,
|
|
858
858
|
[n.id]: n
|
|
@@ -864,7 +864,7 @@ var Ze = M("field"), Qe = L(() => {
|
|
|
864
864
|
let r = Object.assign({}, n, t.updates);
|
|
865
865
|
return {
|
|
866
866
|
...e,
|
|
867
|
-
[n.id]: Object.assign({}, r, { policies:
|
|
867
|
+
[n.id]: Object.assign({}, r, { policies: tt(r.policies) })
|
|
868
868
|
};
|
|
869
869
|
}
|
|
870
870
|
});
|
|
@@ -901,13 +901,13 @@ var Ze = M("field"), Qe = L(() => {
|
|
|
901
901
|
getByName: c
|
|
902
902
|
};
|
|
903
903
|
});
|
|
904
|
-
function
|
|
905
|
-
return
|
|
904
|
+
function it() {
|
|
905
|
+
return I(rt);
|
|
906
906
|
}
|
|
907
907
|
//#endregion
|
|
908
908
|
//#region src/entities/step/step.ts
|
|
909
|
-
var
|
|
910
|
-
let e =
|
|
909
|
+
var at = A("step"), ot = F(() => {
|
|
910
|
+
let e = at.store({}), t = k(e, { register(e, t) {
|
|
911
911
|
return {
|
|
912
912
|
...e,
|
|
913
913
|
[t.step.id]: t.step
|
|
@@ -931,16 +931,16 @@ var et = M("step"), tt = L(() => {
|
|
|
931
931
|
indexStore: e
|
|
932
932
|
};
|
|
933
933
|
});
|
|
934
|
-
function
|
|
935
|
-
return
|
|
934
|
+
function st() {
|
|
935
|
+
return I(ot);
|
|
936
936
|
}
|
|
937
|
-
function
|
|
937
|
+
function ct(e, t) {
|
|
938
938
|
t.register(e);
|
|
939
939
|
}
|
|
940
940
|
//#endregion
|
|
941
941
|
//#region src/entities/content/content.ts
|
|
942
|
-
var
|
|
943
|
-
let e =
|
|
942
|
+
var lt = A("content"), ut = F(() => {
|
|
943
|
+
let e = lt.store({}), t = k(e, {
|
|
944
944
|
register(e, t) {
|
|
945
945
|
return {
|
|
946
946
|
...e,
|
|
@@ -981,16 +981,16 @@ var it = M("content"), at = L(() => {
|
|
|
981
981
|
indexStore: e
|
|
982
982
|
};
|
|
983
983
|
});
|
|
984
|
-
function
|
|
985
|
-
return
|
|
984
|
+
function dt() {
|
|
985
|
+
return I(ut);
|
|
986
986
|
}
|
|
987
|
-
function
|
|
987
|
+
function ft(e, t) {
|
|
988
988
|
t.register(e);
|
|
989
989
|
}
|
|
990
990
|
//#endregion
|
|
991
991
|
//#region src/entities/action/action.ts
|
|
992
|
-
var
|
|
993
|
-
let t =
|
|
992
|
+
var pt = A("action"), mt = F(({ client: e }) => {
|
|
993
|
+
let t = pt.store({}), n = k(t, { register(e, t) {
|
|
994
994
|
return {
|
|
995
995
|
...e,
|
|
996
996
|
[t.key]: {
|
|
@@ -998,13 +998,13 @@ var ct = M("action"), lt = L(({ client: e }) => {
|
|
|
998
998
|
action: t.action
|
|
999
999
|
}
|
|
1000
1000
|
};
|
|
1001
|
-
} }), i =
|
|
1002
|
-
|
|
1001
|
+
} }), i = M();
|
|
1002
|
+
P({
|
|
1003
1003
|
clock: i,
|
|
1004
1004
|
source: t,
|
|
1005
1005
|
filter: (e, { key: t }) => e[t] !== void 0,
|
|
1006
1006
|
fn: (e, { key: t }) => `Action '${t}' already registered. Registering again will override the previous registration.`
|
|
1007
|
-
}).watch((e) => /* @__PURE__ */ r("warn", e)),
|
|
1007
|
+
}).watch((e) => /* @__PURE__ */ r("warn", e)), P({
|
|
1008
1008
|
clock: i,
|
|
1009
1009
|
fn: ({ key: e, action: t }) => Object.freeze({
|
|
1010
1010
|
key: e,
|
|
@@ -1017,7 +1017,7 @@ var ct = M("action"), lt = L(({ client: e }) => {
|
|
|
1017
1017
|
return t.map((t) => t[e]?.action, { skipVoid: !1 });
|
|
1018
1018
|
}
|
|
1019
1019
|
function s(t, n) {
|
|
1020
|
-
let r =
|
|
1020
|
+
let r = N(() => void 0, { skipVoid: !1 }), i = n ? { experience: n.experience } : null, a = D({
|
|
1021
1021
|
source: {
|
|
1022
1022
|
action: o(t),
|
|
1023
1023
|
snapshot: e.stateSnapshotStore
|
|
@@ -1029,13 +1029,13 @@ var ct = M("action"), lt = L(({ client: e }) => {
|
|
|
1029
1029
|
}, i);
|
|
1030
1030
|
}
|
|
1031
1031
|
});
|
|
1032
|
-
return
|
|
1032
|
+
return P({
|
|
1033
1033
|
source: {
|
|
1034
1034
|
responses: e.responses.listStore,
|
|
1035
1035
|
fields: e.fields.listStore
|
|
1036
1036
|
},
|
|
1037
1037
|
target: a
|
|
1038
|
-
}),
|
|
1038
|
+
}), P({
|
|
1039
1039
|
clock: a.doneData,
|
|
1040
1040
|
filter: (e) => e !== void 0,
|
|
1041
1041
|
target: r
|
|
@@ -1048,10 +1048,10 @@ var ct = M("action"), lt = L(({ client: e }) => {
|
|
|
1048
1048
|
getEvokableAction: s
|
|
1049
1049
|
};
|
|
1050
1050
|
});
|
|
1051
|
-
function
|
|
1052
|
-
return
|
|
1051
|
+
function ht(e) {
|
|
1052
|
+
return I(mt, e);
|
|
1053
1053
|
}
|
|
1054
|
-
var
|
|
1054
|
+
var gt = (e, t, n) => {
|
|
1055
1055
|
n.register({
|
|
1056
1056
|
key: e,
|
|
1057
1057
|
action: t
|
|
@@ -1059,7 +1059,7 @@ var dt = (e, t, n) => {
|
|
|
1059
1059
|
};
|
|
1060
1060
|
//#endregion
|
|
1061
1061
|
//#region src/entities/response/response-validation.ts
|
|
1062
|
-
function
|
|
1062
|
+
function q(e, t, n, r) {
|
|
1063
1063
|
return {
|
|
1064
1064
|
fieldKey: e.key,
|
|
1065
1065
|
userMessage: n,
|
|
@@ -1067,62 +1067,62 @@ function J(e, t, n, r) {
|
|
|
1067
1067
|
value: t
|
|
1068
1068
|
};
|
|
1069
1069
|
}
|
|
1070
|
-
function
|
|
1070
|
+
function J(e) {
|
|
1071
1071
|
return e === null || e === "" || Array.isArray(e) && !e.length;
|
|
1072
1072
|
}
|
|
1073
|
-
function
|
|
1073
|
+
function _t(e) {
|
|
1074
1074
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
|
|
1075
1075
|
}
|
|
1076
|
-
function
|
|
1076
|
+
function vt(e) {
|
|
1077
1077
|
try {
|
|
1078
1078
|
return JSON.stringify(e), !0;
|
|
1079
1079
|
} catch {
|
|
1080
1080
|
return !1;
|
|
1081
1081
|
}
|
|
1082
1082
|
}
|
|
1083
|
-
function
|
|
1083
|
+
function yt(e, t) {
|
|
1084
1084
|
return t.find((t) => t.key === e) ?? null;
|
|
1085
1085
|
}
|
|
1086
|
-
function
|
|
1086
|
+
function bt(e, t) {
|
|
1087
1087
|
return e.multiple && (typeof t == "string" || typeof t == "number" || typeof t == "boolean") ? [t] : t;
|
|
1088
1088
|
}
|
|
1089
|
-
function
|
|
1090
|
-
if (e.type !== "object" ||
|
|
1089
|
+
function xt(e, t) {
|
|
1090
|
+
if (e.type !== "object" || J(t)) return null;
|
|
1091
1091
|
if (e.multiple) {
|
|
1092
|
-
if (!Array.isArray(t)) return
|
|
1092
|
+
if (!Array.isArray(t)) return q(e, t, "This field expects multiple values", "Field expects an array of objects.");
|
|
1093
1093
|
for (let n of t) {
|
|
1094
|
-
if (typeof n != "object" || !n) return
|
|
1095
|
-
if (!
|
|
1094
|
+
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.");
|
|
1095
|
+
if (!vt(n)) return q(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
|
|
1096
1096
|
}
|
|
1097
1097
|
return null;
|
|
1098
1098
|
}
|
|
1099
|
-
return Array.isArray(t) ?
|
|
1099
|
+
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.).");
|
|
1100
1100
|
}
|
|
1101
|
-
function
|
|
1102
|
-
if (
|
|
1101
|
+
function St(e, t) {
|
|
1102
|
+
if (J(t) || !Array.isArray(e.options) || e.options.length === 0) return null;
|
|
1103
1103
|
let n = Array.isArray(t) ? t : [t];
|
|
1104
1104
|
if (e.type === "object") {
|
|
1105
1105
|
let r = new Set(e.options.map((e) => JSON.stringify(e.value)));
|
|
1106
|
-
return n.every((e) => r.has(JSON.stringify(e))) ? null :
|
|
1106
|
+
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.");
|
|
1107
1107
|
}
|
|
1108
1108
|
let r = e.options.map((e) => e.value);
|
|
1109
|
-
return n.every((e) => !
|
|
1109
|
+
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(", ")}`);
|
|
1110
1110
|
}
|
|
1111
|
-
async function
|
|
1112
|
-
if (n.validation && !e(n.validation) && !
|
|
1111
|
+
async function Ct(t, n, r, i) {
|
|
1112
|
+
if (n.validation && !e(n.validation) && !J(r)) {
|
|
1113
1113
|
let e = i ? {
|
|
1114
1114
|
$input: r,
|
|
1115
1115
|
responses: i
|
|
1116
1116
|
} : { $input: r }, a = await t(n.validation, e);
|
|
1117
|
-
if (typeof a == "string") return
|
|
1118
|
-
if (a === !1) return
|
|
1117
|
+
if (typeof a == "string") return q(n, r, a, `Field validation resulted in an error: ${a}.`);
|
|
1118
|
+
if (a === !1) return q(n, r, "This field is invalid", "Field validation resulted in an unspecified error.");
|
|
1119
1119
|
}
|
|
1120
|
-
return n.required &&
|
|
1120
|
+
return n.required && J(r) ? q(n, r, "This field is required", "Field is required.") : !n.multiple && Array.isArray(r) && r.length > 1 ? q(n, r, "This field expects a single response", "Field expects a single response.") : null;
|
|
1121
1121
|
}
|
|
1122
1122
|
//#endregion
|
|
1123
1123
|
//#region src/entities/response/response.ts
|
|
1124
|
-
var
|
|
1125
|
-
let t =
|
|
1124
|
+
var wt = A("response"), Tt = F(({ client: e }) => {
|
|
1125
|
+
let t = wt.store({}), r = M(), i = M(), a = k(t, {
|
|
1126
1126
|
register(e, t) {
|
|
1127
1127
|
return {
|
|
1128
1128
|
...e,
|
|
@@ -1151,7 +1151,7 @@ var yt = M("response"), bt = L(({ client: e }) => {
|
|
|
1151
1151
|
});
|
|
1152
1152
|
} else a.registerBatch(e);
|
|
1153
1153
|
}
|
|
1154
|
-
let s = (t, r) => n(e, t, r), c =
|
|
1154
|
+
let s = (t, r) => n(e, t, r), c = D({
|
|
1155
1155
|
source: {
|
|
1156
1156
|
allFields: e.fields.listStore,
|
|
1157
1157
|
existingResponses: t
|
|
@@ -1161,7 +1161,7 @@ var yt = M("response"), bt = L(({ client: e }) => {
|
|
|
1161
1161
|
...t,
|
|
1162
1162
|
...n
|
|
1163
1163
|
}, o = Object.entries(n), c = await Promise.allSettled(o.map(async ([t, n]) => {
|
|
1164
|
-
let o =
|
|
1164
|
+
let o = yt(t, e);
|
|
1165
1165
|
if (!o) {
|
|
1166
1166
|
r.push({
|
|
1167
1167
|
fieldKey: t,
|
|
@@ -1171,17 +1171,17 @@ var yt = M("response"), bt = L(({ client: e }) => {
|
|
|
1171
1171
|
});
|
|
1172
1172
|
return;
|
|
1173
1173
|
}
|
|
1174
|
-
let c =
|
|
1174
|
+
let c = bt(o, n), l = await Ct(s, o, c, a);
|
|
1175
1175
|
if (l) {
|
|
1176
1176
|
r.push(l);
|
|
1177
1177
|
return;
|
|
1178
1178
|
}
|
|
1179
|
-
let u =
|
|
1179
|
+
let u = xt(o, c);
|
|
1180
1180
|
if (u) {
|
|
1181
1181
|
r.push(u);
|
|
1182
1182
|
return;
|
|
1183
1183
|
}
|
|
1184
|
-
let d =
|
|
1184
|
+
let d = St(o, c);
|
|
1185
1185
|
if (d) {
|
|
1186
1186
|
r.push(d);
|
|
1187
1187
|
return;
|
|
@@ -1209,7 +1209,7 @@ var yt = M("response"), bt = L(({ client: e }) => {
|
|
|
1209
1209
|
async function l(e) {
|
|
1210
1210
|
return c(e);
|
|
1211
1211
|
}
|
|
1212
|
-
let u =
|
|
1212
|
+
let u = D({
|
|
1213
1213
|
source: t,
|
|
1214
1214
|
effect: async (e, t) => {
|
|
1215
1215
|
let { responsesToCommit: n, validationErrors: r } = await c(t);
|
|
@@ -1224,7 +1224,7 @@ var yt = M("response"), bt = L(({ client: e }) => {
|
|
|
1224
1224
|
value: t
|
|
1225
1225
|
})));
|
|
1226
1226
|
function m(e) {
|
|
1227
|
-
return
|
|
1227
|
+
return O({
|
|
1228
1228
|
f: e,
|
|
1229
1229
|
s: t
|
|
1230
1230
|
}, ({ f: e, s: t }) => {
|
|
@@ -1241,10 +1241,10 @@ var yt = M("response"), bt = L(({ client: e }) => {
|
|
|
1241
1241
|
function _(t) {
|
|
1242
1242
|
return m(e.fields.getByName(t));
|
|
1243
1243
|
}
|
|
1244
|
-
return
|
|
1244
|
+
return P({
|
|
1245
1245
|
clock: r,
|
|
1246
1246
|
target: a.clearAll
|
|
1247
|
-
}),
|
|
1247
|
+
}), P({
|
|
1248
1248
|
clock: i,
|
|
1249
1249
|
target: a.clear
|
|
1250
1250
|
}), {
|
|
@@ -1260,13 +1260,13 @@ var yt = M("response"), bt = L(({ client: e }) => {
|
|
|
1260
1260
|
getByFieldName: _
|
|
1261
1261
|
};
|
|
1262
1262
|
});
|
|
1263
|
-
function
|
|
1264
|
-
return
|
|
1263
|
+
function Et(e) {
|
|
1264
|
+
return I(Tt, e);
|
|
1265
1265
|
}
|
|
1266
1266
|
//#endregion
|
|
1267
1267
|
//#region src/entities/condition/condition.ts
|
|
1268
|
-
var
|
|
1269
|
-
let e =
|
|
1268
|
+
var Dt = A("condition"), Ot = F(() => {
|
|
1269
|
+
let e = Dt.store({}), t = k(e, { register(e, t) {
|
|
1270
1270
|
return {
|
|
1271
1271
|
...e,
|
|
1272
1272
|
[t.condition.id]: t.condition
|
|
@@ -1290,12 +1290,12 @@ var St = M("condition"), Ct = L(() => {
|
|
|
1290
1290
|
indexStore: e
|
|
1291
1291
|
};
|
|
1292
1292
|
});
|
|
1293
|
-
function
|
|
1294
|
-
return
|
|
1293
|
+
function kt() {
|
|
1294
|
+
return I(Ot);
|
|
1295
1295
|
}
|
|
1296
1296
|
//#endregion
|
|
1297
1297
|
//#region src/utils/api-url.ts
|
|
1298
|
-
function
|
|
1298
|
+
function At() {
|
|
1299
1299
|
if (c()) {
|
|
1300
1300
|
let e = [
|
|
1301
1301
|
document.currentScript,
|
|
@@ -1309,44 +1309,26 @@ function Tt() {
|
|
|
1309
1309
|
return "https://api.picked.app";
|
|
1310
1310
|
}
|
|
1311
1311
|
//#endregion
|
|
1312
|
-
//#region src/utils/search-params.ts
|
|
1313
|
-
function Et() {
|
|
1314
|
-
if (!s()) return {};
|
|
1315
|
-
let e = new URLSearchParams(window.location.search), t = {}, n = /* @__PURE__ */ new Set();
|
|
1316
|
-
for (let [t] of e.entries()) t.startsWith("picked-") && n.add(t);
|
|
1317
|
-
for (let r of n) {
|
|
1318
|
-
let n = r.replace("picked-", "");
|
|
1319
|
-
t[n] = e.getAll(r);
|
|
1320
|
-
}
|
|
1321
|
-
let r = O("s");
|
|
1322
|
-
if (n.size > 0) D.set(r, t);
|
|
1323
|
-
else {
|
|
1324
|
-
let e = D.get(r);
|
|
1325
|
-
if (e) return e.json() || {};
|
|
1326
|
-
}
|
|
1327
|
-
return t;
|
|
1328
|
-
}
|
|
1329
|
-
//#endregion
|
|
1330
1312
|
//#region src/utils/user-timing.ts
|
|
1331
|
-
var
|
|
1332
|
-
function
|
|
1313
|
+
var jt = "picked:start:begin", Mt = "picked:start";
|
|
1314
|
+
function Nt() {
|
|
1333
1315
|
try {
|
|
1334
1316
|
return s() && !!p.window && "performance" in p;
|
|
1335
1317
|
} catch {
|
|
1336
1318
|
return !1;
|
|
1337
1319
|
}
|
|
1338
1320
|
}
|
|
1339
|
-
function
|
|
1321
|
+
function Pt() {
|
|
1340
1322
|
let e = null, t = null;
|
|
1341
1323
|
return {
|
|
1342
1324
|
markBegin: () => {
|
|
1343
|
-
if (
|
|
1344
|
-
e = performance.mark(
|
|
1325
|
+
if (Nt()) try {
|
|
1326
|
+
e = performance.mark(jt).startTime;
|
|
1345
1327
|
} catch {}
|
|
1346
1328
|
},
|
|
1347
1329
|
measure: () => {
|
|
1348
|
-
if (!(!
|
|
1349
|
-
t = performance.measure(
|
|
1330
|
+
if (!(!Nt() || e === null)) try {
|
|
1331
|
+
t = performance.measure(Mt, { start: e });
|
|
1350
1332
|
} catch {}
|
|
1351
1333
|
},
|
|
1352
1334
|
get startMeasure() {
|
|
@@ -1356,7 +1338,7 @@ function At() {
|
|
|
1356
1338
|
}
|
|
1357
1339
|
//#endregion
|
|
1358
1340
|
//#region src/utils/client-telemetry.ts
|
|
1359
|
-
function
|
|
1341
|
+
function Ft() {
|
|
1360
1342
|
let e = null;
|
|
1361
1343
|
return {
|
|
1362
1344
|
observeDeliveryAPIRequests: (t) => {
|
|
@@ -1369,13 +1351,13 @@ function jt() {
|
|
|
1369
1351
|
}
|
|
1370
1352
|
//#endregion
|
|
1371
1353
|
//#region src/entities/session/session.ts
|
|
1372
|
-
var
|
|
1373
|
-
function
|
|
1354
|
+
var It = ie("session", "global");
|
|
1355
|
+
function Lt() {
|
|
1374
1356
|
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)}`;
|
|
1375
1357
|
}
|
|
1376
|
-
function
|
|
1358
|
+
function Rt() {
|
|
1377
1359
|
if (!h()) return null;
|
|
1378
|
-
let e = E.get(
|
|
1360
|
+
let e = E.get(It);
|
|
1379
1361
|
if (!e.isSet()) return null;
|
|
1380
1362
|
try {
|
|
1381
1363
|
return e.json();
|
|
@@ -1383,10 +1365,10 @@ function Pt() {
|
|
|
1383
1365
|
return null;
|
|
1384
1366
|
}
|
|
1385
1367
|
}
|
|
1386
|
-
var
|
|
1387
|
-
let e =
|
|
1368
|
+
var zt = F(() => {
|
|
1369
|
+
let e = Rt(), t = { id: e?.id ?? Lt() };
|
|
1388
1370
|
e?.isUser !== void 0 && (t.isUser = e.isUser), e?.identifiers && Object.keys(e.identifiers).length > 0 && (t.identifiers = e.identifiers);
|
|
1389
|
-
let n =
|
|
1371
|
+
let n = N(t), r = k(n, {
|
|
1390
1372
|
setIsUser: (e, t) => ({
|
|
1391
1373
|
...e,
|
|
1392
1374
|
isUser: t
|
|
@@ -1406,15 +1388,15 @@ var Ft = L(() => {
|
|
|
1406
1388
|
let i = { id: e.id };
|
|
1407
1389
|
return e.isUser !== void 0 && (i.isUser = e.isUser), Object.keys(r).length > 0 && (i.identifiers = r), i;
|
|
1408
1390
|
}
|
|
1409
|
-
}), i =
|
|
1391
|
+
}), i = D({
|
|
1410
1392
|
source: n,
|
|
1411
1393
|
effect: (e) => {
|
|
1412
1394
|
if (h()) try {
|
|
1413
|
-
E.get(
|
|
1395
|
+
E.get(It).set(e);
|
|
1414
1396
|
} catch {}
|
|
1415
1397
|
}
|
|
1416
1398
|
});
|
|
1417
|
-
return
|
|
1399
|
+
return P({
|
|
1418
1400
|
source: n,
|
|
1419
1401
|
target: i
|
|
1420
1402
|
}), {
|
|
@@ -1424,39 +1406,39 @@ var Ft = L(() => {
|
|
|
1424
1406
|
removeIdentifier: r.removeIdentifier
|
|
1425
1407
|
};
|
|
1426
1408
|
});
|
|
1427
|
-
function
|
|
1428
|
-
return
|
|
1409
|
+
function Bt() {
|
|
1410
|
+
return I(zt, void 0);
|
|
1429
1411
|
}
|
|
1430
1412
|
//#endregion
|
|
1431
1413
|
//#region src/utils/picked-config.ts
|
|
1432
|
-
function
|
|
1414
|
+
function Vt() {
|
|
1433
1415
|
if (s()) return globalThis.window.pickedConfig;
|
|
1434
1416
|
}
|
|
1435
|
-
function
|
|
1436
|
-
if (s()) return
|
|
1417
|
+
function Ht() {
|
|
1418
|
+
if (s()) return Vt()?.projectId;
|
|
1437
1419
|
}
|
|
1438
|
-
function
|
|
1420
|
+
function Ut() {
|
|
1439
1421
|
if (!c()) return;
|
|
1440
1422
|
let e = document.getElementById("picked_script") || document.querySelector("script#picked") || document.getElementById("cvly");
|
|
1441
1423
|
if (e) return e.dataset.projectid || e.getAttribute("project-id") || void 0;
|
|
1442
1424
|
}
|
|
1443
|
-
function
|
|
1425
|
+
function Wt(e) {
|
|
1444
1426
|
if (e.projectId) return e.projectId;
|
|
1445
|
-
let t =
|
|
1427
|
+
let t = Ht();
|
|
1446
1428
|
if (t) return t;
|
|
1447
|
-
let n =
|
|
1429
|
+
let n = Ut();
|
|
1448
1430
|
if (n) return n;
|
|
1449
1431
|
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.");
|
|
1450
1432
|
}
|
|
1451
1433
|
//#endregion
|
|
1452
1434
|
//#region src/utils/render-string.ts
|
|
1453
|
-
function
|
|
1435
|
+
function Y(e) {
|
|
1454
1436
|
return e == null || e === "" || Number.isNaN(e);
|
|
1455
1437
|
}
|
|
1456
|
-
var
|
|
1457
|
-
default: (e, t) =>
|
|
1458
|
-
append: (e, t) => t && !
|
|
1459
|
-
prepend: (e, t) => t && !
|
|
1438
|
+
var Gt = {
|
|
1439
|
+
default: (e, t) => Y(e) ? String(t ?? "") : String(e),
|
|
1440
|
+
append: (e, t) => t && !Y(e) ? `${e} ${t}` : e,
|
|
1441
|
+
prepend: (e, t) => t && !Y(e) ? `${t} ${e}` : e,
|
|
1460
1442
|
upper: (e) => typeof e == "string" ? e.toUpperCase() : e,
|
|
1461
1443
|
lower: (e) => typeof e == "string" ? e.toLowerCase() : e,
|
|
1462
1444
|
capitalize: (e) => typeof e == "string" ? e.charAt(0).toUpperCase() + e.slice(1) : e,
|
|
@@ -1474,24 +1456,24 @@ var Vt = {
|
|
|
1474
1456
|
return e instanceof Set ? t.format(Array.from(e).map(String)) : e;
|
|
1475
1457
|
}
|
|
1476
1458
|
};
|
|
1477
|
-
function
|
|
1459
|
+
function Kt(e) {
|
|
1478
1460
|
return typeof e == "object" && !!e;
|
|
1479
1461
|
}
|
|
1480
|
-
function
|
|
1462
|
+
function qt(e, t) {
|
|
1481
1463
|
let n = t;
|
|
1482
|
-
for (let t of e.split(".")) if (
|
|
1464
|
+
for (let t of e.split(".")) if (Kt(n) && t in n) n = n[t];
|
|
1483
1465
|
else return;
|
|
1484
1466
|
return typeof n == "function" ? n() : n;
|
|
1485
1467
|
}
|
|
1486
|
-
function
|
|
1487
|
-
let n = e.split("|").map((e) => e.trim()), r =
|
|
1468
|
+
function Jt(e, t) {
|
|
1469
|
+
let n = e.split("|").map((e) => e.trim()), r = qt(n.shift() ?? "", t);
|
|
1488
1470
|
for (let e of n) {
|
|
1489
|
-
let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o =
|
|
1471
|
+
let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o = Gt[i];
|
|
1490
1472
|
o && (r = o(r, a));
|
|
1491
1473
|
}
|
|
1492
|
-
return
|
|
1474
|
+
return Y(r) ? "" : typeof r == "object" ? JSON.stringify(r) : String(r);
|
|
1493
1475
|
}
|
|
1494
|
-
function
|
|
1476
|
+
function Yt(e, t) {
|
|
1495
1477
|
let n = "", r = 0;
|
|
1496
1478
|
for (; r < e.length;) if (e[r] === "{" && e[r + 1] === "{") {
|
|
1497
1479
|
r += 2;
|
|
@@ -1503,81 +1485,76 @@ function Gt(e, t) {
|
|
|
1503
1485
|
}
|
|
1504
1486
|
i += e[r++];
|
|
1505
1487
|
}
|
|
1506
|
-
n +=
|
|
1488
|
+
n += Jt(i.trim(), t);
|
|
1507
1489
|
} else n += e[r++];
|
|
1508
1490
|
return n;
|
|
1509
1491
|
}
|
|
1510
1492
|
//#endregion
|
|
1511
|
-
//#region src/utils/preview-session.ts
|
|
1512
|
-
var Kt = "preview-token";
|
|
1513
|
-
function qt() {
|
|
1514
|
-
return !s() || !g() ? !1 : !!Et()[Kt]?.[0];
|
|
1515
|
-
}
|
|
1516
|
-
//#endregion
|
|
1517
1493
|
//#region src/picked.ts
|
|
1518
|
-
var
|
|
1494
|
+
var X = class {
|
|
1519
1495
|
static logger = r;
|
|
1520
1496
|
options;
|
|
1521
1497
|
dataSource = null;
|
|
1522
1498
|
seededVersionId = null;
|
|
1523
1499
|
versionSkew = null;
|
|
1500
|
+
previewUnavailable = !1;
|
|
1524
1501
|
contentLoader;
|
|
1525
1502
|
previewEmbedderOrigins = null;
|
|
1526
1503
|
plugins = {};
|
|
1527
|
-
telemetry =
|
|
1504
|
+
telemetry = Ft();
|
|
1528
1505
|
dataProviders = /* @__PURE__ */ new Map();
|
|
1529
|
-
eventBus =
|
|
1506
|
+
eventBus = M();
|
|
1530
1507
|
events;
|
|
1531
1508
|
projectId;
|
|
1532
1509
|
apiUrl;
|
|
1533
1510
|
dashboardUrl;
|
|
1534
1511
|
documentationSiteUrl;
|
|
1535
|
-
session =
|
|
1536
|
-
performance =
|
|
1537
|
-
searchParams =
|
|
1538
|
-
history =
|
|
1539
|
-
components =
|
|
1512
|
+
session = Bt();
|
|
1513
|
+
performance = Pt();
|
|
1514
|
+
searchParams = ae();
|
|
1515
|
+
history = Qe();
|
|
1516
|
+
components = ke({ client: this });
|
|
1540
1517
|
experienceInstances = w({ client: this });
|
|
1541
|
-
experiences =
|
|
1542
|
-
frameworks =
|
|
1543
|
-
predicates =
|
|
1544
|
-
features =
|
|
1545
|
-
conditions =
|
|
1546
|
-
fields =
|
|
1547
|
-
responses =
|
|
1548
|
-
steps =
|
|
1549
|
-
contents =
|
|
1550
|
-
actions =
|
|
1518
|
+
experiences = xe({ client: this });
|
|
1519
|
+
frameworks = Me({ client: this });
|
|
1520
|
+
predicates = Je({ client: this });
|
|
1521
|
+
features = de({ client: this });
|
|
1522
|
+
conditions = kt();
|
|
1523
|
+
fields = it();
|
|
1524
|
+
responses = Et({ client: this });
|
|
1525
|
+
steps = st();
|
|
1526
|
+
contents = dt();
|
|
1527
|
+
actions = ht({ client: this });
|
|
1551
1528
|
conditionResults = te();
|
|
1552
|
-
stateSnapshotStore =
|
|
1553
|
-
evaluateRuleLogicFx =
|
|
1529
|
+
stateSnapshotStore = Fe({ client: this });
|
|
1530
|
+
evaluateRuleLogicFx = Ue({ client: this });
|
|
1554
1531
|
start;
|
|
1555
1532
|
readyStore;
|
|
1556
1533
|
preconditionPassedStore;
|
|
1557
1534
|
conditionPassedStore;
|
|
1558
1535
|
lifecycleStageStore;
|
|
1559
|
-
lifecycle =
|
|
1560
|
-
renderStringFx =
|
|
1536
|
+
lifecycle = Ge({ client: this });
|
|
1537
|
+
renderStringFx = D({
|
|
1561
1538
|
source: this.responses.listStore,
|
|
1562
1539
|
effect: (e, { template: t, context: n }) => {
|
|
1563
1540
|
let r = {};
|
|
1564
1541
|
for (let t of e) r[t.fieldKey] = t.value;
|
|
1565
|
-
return
|
|
1542
|
+
return Yt(t, {
|
|
1566
1543
|
...n,
|
|
1567
1544
|
responses: r
|
|
1568
1545
|
});
|
|
1569
1546
|
}
|
|
1570
1547
|
});
|
|
1571
1548
|
constructor(e) {
|
|
1572
|
-
this.events =
|
|
1549
|
+
this.events = et(this.eventBus), this.projectId = Wt(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({
|
|
1573
1550
|
type: "load",
|
|
1574
|
-
version:
|
|
1551
|
+
version: le()
|
|
1575
1552
|
}), this.maybeStartPreviewChannel();
|
|
1576
1553
|
}
|
|
1577
1554
|
dataProviderFor(e) {
|
|
1578
1555
|
let t = e ?? "", n = this.dataProviders.get(t);
|
|
1579
1556
|
if (n) return n;
|
|
1580
|
-
let r = import("../provider-
|
|
1557
|
+
let r = import("../provider-DUACzeBR.js").then((t) => t.createPickedDataProvider({
|
|
1581
1558
|
apiUrl: this.apiUrl,
|
|
1582
1559
|
projectId: this.projectId,
|
|
1583
1560
|
getRequestObserver: () => this.telemetry.deliveryAPIRequestObserver,
|
|
@@ -1587,31 +1564,32 @@ var Jt = class {
|
|
|
1587
1564
|
}
|
|
1588
1565
|
async getProjectConfig(e) {
|
|
1589
1566
|
let t = await this.dataProviderFor(e?.previewToken), n = await t.getProjectConfig();
|
|
1590
|
-
if (this.dataSource = t.meta.manifest, n === null) throw
|
|
1567
|
+
if (this.dataSource = t.meta.manifest, n === null && t.meta.previewUnavailable) throw new fe(this.projectId);
|
|
1568
|
+
if (n === null) throw Error(`Picked could not resolve the configuration for project "${this.projectId}" from ${this.apiUrl}.`);
|
|
1591
1569
|
return n;
|
|
1592
1570
|
}
|
|
1593
1571
|
async getExperienceContent(e, t) {
|
|
1594
1572
|
return (await this.dataProviderFor(t?.previewToken)).getContent(e, t?.signal === void 0 ? void 0 : { signal: t.signal });
|
|
1595
1573
|
}
|
|
1596
1574
|
maybeStartPreviewChannel() {
|
|
1597
|
-
|
|
1575
|
+
ue() && import("../preview-channel-CSr96XAo.js").then((e) => e.initPreviewChannel(this)).catch(() => void 0);
|
|
1598
1576
|
}
|
|
1599
1577
|
registerFramework = (e) => {
|
|
1600
|
-
|
|
1578
|
+
Ne(e, this.frameworks);
|
|
1601
1579
|
};
|
|
1602
1580
|
registerComponent = (e, t) => {
|
|
1603
|
-
|
|
1581
|
+
R(e, t, this.components);
|
|
1604
1582
|
};
|
|
1605
1583
|
registerPlugin = (e) => {
|
|
1606
|
-
|
|
1584
|
+
we(this, e, this.plugins);
|
|
1607
1585
|
let t = this.plugins[e.name];
|
|
1608
1586
|
t?.onStart && this.lifecycle.registerPluginStartHook(t.onStart);
|
|
1609
1587
|
};
|
|
1610
1588
|
registerFeature = (e, t) => {
|
|
1611
|
-
|
|
1589
|
+
se(e, t, this.features);
|
|
1612
1590
|
};
|
|
1613
1591
|
registerPredicate = (e, t) => {
|
|
1614
|
-
|
|
1592
|
+
Ye(e, t, this.predicates);
|
|
1615
1593
|
};
|
|
1616
1594
|
registerCondition = (e) => {
|
|
1617
1595
|
this.conditions.register(e);
|
|
@@ -1620,19 +1598,19 @@ var Jt = class {
|
|
|
1620
1598
|
this.fields.register(e);
|
|
1621
1599
|
};
|
|
1622
1600
|
registerStep = (e) => {
|
|
1623
|
-
|
|
1601
|
+
ct(e, this.steps);
|
|
1624
1602
|
};
|
|
1625
1603
|
registerContent = (e) => {
|
|
1626
|
-
|
|
1604
|
+
ft(e, this.contents);
|
|
1627
1605
|
};
|
|
1628
1606
|
patchContent = (e, t) => {
|
|
1629
1607
|
this.contents.patch(e, t);
|
|
1630
1608
|
};
|
|
1631
1609
|
registerAction = (e, t) => {
|
|
1632
|
-
|
|
1610
|
+
gt(e, t, this.actions);
|
|
1633
1611
|
};
|
|
1634
1612
|
registerExperience = (e) => {
|
|
1635
|
-
e.component &&
|
|
1613
|
+
e.component && R(`experience:${e.id}`, e.component, this.components), this.experiences.register(e);
|
|
1636
1614
|
};
|
|
1637
1615
|
launchExperienceById = async (e, t) => {
|
|
1638
1616
|
this.experiences.launch({
|
|
@@ -1675,7 +1653,7 @@ var Jt = class {
|
|
|
1675
1653
|
this.registerFeature(e, n);
|
|
1676
1654
|
}), this.searchParams.feature && this.searchParams.feature.forEach((e) => {
|
|
1677
1655
|
try {
|
|
1678
|
-
let t =
|
|
1656
|
+
let t = oe(e);
|
|
1679
1657
|
if (!t) return;
|
|
1680
1658
|
let { id: n, bucket: r } = t;
|
|
1681
1659
|
this.registerFeature(n, {
|
|
@@ -1725,8 +1703,8 @@ var Jt = class {
|
|
|
1725
1703
|
});
|
|
1726
1704
|
}
|
|
1727
1705
|
getPluginConfig = (e) => this.plugins[e] ?? {};
|
|
1728
|
-
},
|
|
1729
|
-
async function
|
|
1706
|
+
}, Xt = "application/picked-javascript", Zt = "application/picked-module", Qt = "data-picked-hydrated";
|
|
1707
|
+
async function $t(e) {
|
|
1730
1708
|
if (!("document" in globalThis)) return;
|
|
1731
1709
|
let t = "application/picked-module", n = "data-picked-hydrated";
|
|
1732
1710
|
function r(e) {
|
|
@@ -1755,23 +1733,23 @@ async function Qt(e) {
|
|
|
1755
1733
|
a && await a;
|
|
1756
1734
|
}
|
|
1757
1735
|
}
|
|
1758
|
-
function
|
|
1759
|
-
return `<script>(${
|
|
1736
|
+
function en() {
|
|
1737
|
+
return `<script>(${$t.toString()})(document)<\/script>`;
|
|
1760
1738
|
}
|
|
1761
1739
|
//#endregion
|
|
1762
1740
|
//#region src/utils/html-asset-value.ts
|
|
1763
|
-
function
|
|
1741
|
+
function tn(e) {
|
|
1764
1742
|
return typeof e == "object" && !!e && "id" in e && typeof e.id == "string" && "content" in e && (typeof e.content == "string" || e.content === null);
|
|
1765
1743
|
}
|
|
1766
1744
|
//#endregion
|
|
1767
1745
|
//#region src/entities/component/lazyComponent.ts
|
|
1768
|
-
function
|
|
1746
|
+
function nn(e) {
|
|
1769
1747
|
return {
|
|
1770
1748
|
$$type: "lazy-component",
|
|
1771
1749
|
load: e
|
|
1772
1750
|
};
|
|
1773
1751
|
}
|
|
1774
|
-
function
|
|
1752
|
+
function rn(e) {
|
|
1775
1753
|
return typeof e == "object" && !!e && "$$type" in e && e.$$type === "lazy-component";
|
|
1776
1754
|
}
|
|
1777
1755
|
//#endregion
|
|
@@ -1787,10 +1765,10 @@ function $(e) {
|
|
|
1787
1765
|
for (let e of t) Z(e) && n.push(e.contentEntryId);
|
|
1788
1766
|
return n;
|
|
1789
1767
|
}
|
|
1790
|
-
function
|
|
1768
|
+
function an(e, t) {
|
|
1791
1769
|
return t === null ? null : e[t] ?? null;
|
|
1792
1770
|
}
|
|
1793
|
-
function
|
|
1771
|
+
function on(e, t) {
|
|
1794
1772
|
let n = [];
|
|
1795
1773
|
for (let r of t) {
|
|
1796
1774
|
let t = e[r];
|
|
@@ -1798,29 +1776,29 @@ function an(e, t) {
|
|
|
1798
1776
|
}
|
|
1799
1777
|
return n;
|
|
1800
1778
|
}
|
|
1801
|
-
function
|
|
1802
|
-
if (
|
|
1779
|
+
function sn(e, t) {
|
|
1780
|
+
if (_e.store(t)) return O(t, e.indexStore, (e, t) => an(t, Q(e)));
|
|
1803
1781
|
let n = Q(t);
|
|
1804
|
-
return e.indexStore.map((e) =>
|
|
1782
|
+
return e.indexStore.map((e) => an(e, n), { skipVoid: !1 });
|
|
1805
1783
|
}
|
|
1806
|
-
function
|
|
1807
|
-
if (
|
|
1784
|
+
function cn(e, t) {
|
|
1785
|
+
if (_e.store(t)) return O(t, e.indexStore, (e, t) => on(t, $(e)));
|
|
1808
1786
|
let n = $(t);
|
|
1809
|
-
return e.indexStore.map((e) =>
|
|
1787
|
+
return e.indexStore.map((e) => on(e, n), { skipVoid: !1 });
|
|
1810
1788
|
}
|
|
1811
1789
|
//#endregion
|
|
1812
1790
|
//#region src/exports.ts
|
|
1813
|
-
var
|
|
1814
|
-
let t = new
|
|
1791
|
+
var ln = (e) => {
|
|
1792
|
+
let t = new X(e);
|
|
1815
1793
|
return u(t), t;
|
|
1816
1794
|
};
|
|
1817
1795
|
//#endregion
|
|
1818
1796
|
//#region src/typed-content.ts
|
|
1819
|
-
function
|
|
1797
|
+
function un(e) {
|
|
1820
1798
|
return typeof e.data == "object";
|
|
1821
1799
|
}
|
|
1822
|
-
function
|
|
1823
|
-
return e.map((e) => !e || !
|
|
1800
|
+
function dn(e) {
|
|
1801
|
+
return e.map((e) => !e || !un(e) ? null : e, { skipVoid: !1 });
|
|
1824
1802
|
}
|
|
1825
1803
|
//#endregion
|
|
1826
|
-
export {
|
|
1804
|
+
export { Qt as PICKED_HYDRATED_ATTR, Zt as PICKED_MODULE_SCRIPT_TYPE, Xt as PICKED_SCRIPT_TYPE, ce as PREVIEW_TOKEN_PARAM, X as Picked, fe as PreviewUnavailableError, en as buildRehydrateBootstrap, ln as createClient, Ce as createPluginEffect, ie as createStorageKey, sn as deriveReference, cn as deriveReferences, n as evaluateRuleLogic, Vt as getPickedConfig, Z as isContentReference, tn as isHtmlAssetValue, g as isInsideIframe, rn as isLazyLoader, v as isPickedRoot, ue as isPreviewSession, nn as lazyComponent, E as localStore, ge as onInertScriptSubtrees, Q as readReferenceId, $ as readReferenceIds, $t as rehydrateScripts, me as reportInertScriptSubtrees, he as resetInertScriptReport, re as sessionStore, ne 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 };
|