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