@picked/client 0.0.71-next.2 → 0.0.71-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/{api-CObostrU.cjs → api-CnjBi6JG.cjs} +1 -1
- package/dist/{api-B0ydpQBE.js → api-vBVGLtvU.js} +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/esm/index.js +291 -252
- package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
- package/dist/esm/server/index.js +1 -1
- package/dist/{plugin-CNna0UjB.cjs → plugin-CSmD1gPl.cjs} +1 -1
- package/dist/{plugin-DUOJpHaq.js → plugin-GOTtoDlC.js} +1 -1
- package/dist/types/entities/feature/feature.d.ts +9 -2
- package/dist/types/entities/feature/feature.d.ts.map +1 -1
- package/dist/types/picked.d.ts +2 -1
- package/dist/types/picked.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -2,17 +2,17 @@ import { t as e } from "../object-BUDGxEqy.js";
|
|
|
2
2
|
import { n as t, t as n } from "../rules-logic-HesIUCu6.js";
|
|
3
3
|
import { t as r } from "../logger-DMN6TxJJ.js";
|
|
4
4
|
import { a as i, c as a, d as o, f as s, i as c, l, m as u, n as d, o as f, r as p, s as m, t as h, u as g } from "../supports-CO9bJGNl.js";
|
|
5
|
-
import { a as _, i as v, r as
|
|
6
|
-
import { l as
|
|
7
|
-
import { i as
|
|
8
|
-
import { n as
|
|
9
|
-
import { t as
|
|
10
|
-
import { n as
|
|
11
|
-
import { attach as
|
|
12
|
-
import { createFactory as
|
|
5
|
+
import { a as _, i as v, r as y, s as b, t as x } from "../dom-BqcToNL0.js";
|
|
6
|
+
import { l as S, n as C, r as w, u as T } from "../experience-instance-DGk11d8a.js";
|
|
7
|
+
import { i as E, n as D, r as O, t as k } from "../storage-1MW3-_As.js";
|
|
8
|
+
import { n as ee, r as te } from "../api-vBVGLtvU.js";
|
|
9
|
+
import { t as ne } from "../id-Bo4RBeOs.js";
|
|
10
|
+
import { n as re, r as ie, t as ae } 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, sample as L } from "effector";
|
|
12
|
+
import { createFactory as R, invoke as z } from "@withease/factories";
|
|
13
13
|
//#region src/entities/experience/experience.ts
|
|
14
|
-
var
|
|
15
|
-
let i =
|
|
14
|
+
var B = N("experience"), oe = R(({ client: e, experience: r }) => {
|
|
15
|
+
let i = B.store(r), a = M(i, { merge(e, t) {
|
|
16
16
|
return {
|
|
17
17
|
...e,
|
|
18
18
|
...t.experience
|
|
@@ -22,34 +22,34 @@ var z = M("experience"), se = L(({ client: e, experience: r }) => {
|
|
|
22
22
|
decisionLogic: e.condition,
|
|
23
23
|
targetSelectors: e.targets,
|
|
24
24
|
initializeOpenLogic: e.initializeOpen
|
|
25
|
-
})), s =
|
|
26
|
-
let r = e.nodes.filter(
|
|
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) => {
|
|
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);
|
|
27
27
|
return {
|
|
28
28
|
steps: r,
|
|
29
29
|
nodes: e.nodes,
|
|
30
30
|
edges: e.edges,
|
|
31
31
|
conditions: i
|
|
32
32
|
};
|
|
33
|
-
}), l = r.actions ?? [], u, d =
|
|
33
|
+
}), l = r.actions ?? [], u, d = A({
|
|
34
34
|
source: o,
|
|
35
35
|
effect: (t, n) => {
|
|
36
36
|
let i = v(t.targetSelectors, r.id);
|
|
37
|
-
i.forEach(({ elements: e }) => e.forEach((e) =>
|
|
37
|
+
i.forEach(({ elements: e }) => e.forEach((e) => b(e, r.id))), x(i, r.id, r.key).forEach((t) => {
|
|
38
38
|
n ? e.experienceInstances.spawn(u, t, n) : e.experienceInstances.spawn(u, t);
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
}), f =
|
|
41
|
+
}), f = j({
|
|
42
42
|
preconditionPassed: e.preconditionPassedStore,
|
|
43
43
|
isUser: e.session.store.map((e) => e.isUser, { skipVoid: !1 }),
|
|
44
44
|
config: o
|
|
45
|
-
}), p =
|
|
45
|
+
}), p = A({
|
|
46
46
|
source: f,
|
|
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 || v(c, r.id).length < 1 ? !1 : s === void 0 || !t(s) || await n(e, s) === !0;
|
|
51
51
|
}
|
|
52
|
-
}), m =
|
|
52
|
+
}), m = P(async () => {
|
|
53
53
|
if (!e.contentLoader) return !0;
|
|
54
54
|
try {
|
|
55
55
|
await e.contentLoader({
|
|
@@ -60,26 +60,26 @@ var z = M("experience"), se = L(({ client: e, experience: r }) => {
|
|
|
60
60
|
`${r.id}`;
|
|
61
61
|
}
|
|
62
62
|
return !0;
|
|
63
|
-
}), h =
|
|
64
|
-
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({
|
|
65
65
|
clock: h,
|
|
66
66
|
target: p
|
|
67
|
-
}),
|
|
67
|
+
}), L({
|
|
68
68
|
clock: p.doneData,
|
|
69
69
|
source: _,
|
|
70
70
|
filter: (e, t) => t,
|
|
71
71
|
fn: (e) => e,
|
|
72
72
|
target: d
|
|
73
|
-
}),
|
|
73
|
+
}), L({
|
|
74
74
|
clock: p.doneData,
|
|
75
75
|
filter: Boolean,
|
|
76
76
|
target: m
|
|
77
|
-
}),
|
|
77
|
+
}), L({
|
|
78
78
|
clock: g,
|
|
79
79
|
source: _,
|
|
80
80
|
fn: (e) => e,
|
|
81
81
|
target: d
|
|
82
|
-
}),
|
|
82
|
+
}), L({
|
|
83
83
|
clock: g,
|
|
84
84
|
target: m
|
|
85
85
|
}), u = {
|
|
@@ -98,22 +98,22 @@ var z = M("experience"), se = L(({ client: e, experience: r }) => {
|
|
|
98
98
|
prepareExperienceContentFx: m
|
|
99
99
|
}, u;
|
|
100
100
|
});
|
|
101
|
-
function
|
|
102
|
-
return
|
|
101
|
+
function se(e) {
|
|
102
|
+
return z(oe, e);
|
|
103
103
|
}
|
|
104
|
-
var
|
|
105
|
-
let t =
|
|
104
|
+
var ce = R(({ client: e }) => {
|
|
105
|
+
let t = B.store({}), n = M(t, { register(e, t) {
|
|
106
106
|
return {
|
|
107
107
|
...e,
|
|
108
108
|
[t.id]: t
|
|
109
109
|
};
|
|
110
|
-
} }), r =
|
|
111
|
-
n.register(
|
|
110
|
+
} }), r = F(), i = P((t) => {
|
|
111
|
+
n.register(se({
|
|
112
112
|
client: e,
|
|
113
113
|
experience: t
|
|
114
114
|
}));
|
|
115
115
|
});
|
|
116
|
-
|
|
116
|
+
L({
|
|
117
117
|
clock: r,
|
|
118
118
|
source: t,
|
|
119
119
|
filter: (e, t) => e[t.id] !== void 0,
|
|
@@ -126,7 +126,7 @@ var le = L(({ client: e }) => {
|
|
|
126
126
|
experience: t,
|
|
127
127
|
strategy: "override"
|
|
128
128
|
});
|
|
129
|
-
}),
|
|
129
|
+
}), L({
|
|
130
130
|
clock: r,
|
|
131
131
|
source: t,
|
|
132
132
|
filter: (e, t) => e[t.id] === void 0,
|
|
@@ -140,7 +140,7 @@ var le = L(({ client: e }) => {
|
|
|
140
140
|
function s(e) {
|
|
141
141
|
return t.map((t) => Object.values(t).find((t) => t.key === e) ?? t[e], { skipVoid: !1 });
|
|
142
142
|
}
|
|
143
|
-
let c =
|
|
143
|
+
let c = A({
|
|
144
144
|
source: t,
|
|
145
145
|
effect: (e, t) => {
|
|
146
146
|
let n = "key" in t ? Object.values(e).find((e) => e.key === t.key) : e[t.id];
|
|
@@ -158,7 +158,7 @@ var le = L(({ client: e }) => {
|
|
|
158
158
|
getById: o,
|
|
159
159
|
getByKey: s,
|
|
160
160
|
launch: c,
|
|
161
|
-
open:
|
|
161
|
+
open: A({
|
|
162
162
|
source: {
|
|
163
163
|
experiences: t,
|
|
164
164
|
instances: e.experienceInstances.listStore
|
|
@@ -186,7 +186,7 @@ var le = L(({ client: e }) => {
|
|
|
186
186
|
}
|
|
187
187
|
}),
|
|
188
188
|
listStore: a,
|
|
189
|
-
initialiseExperiencesFx:
|
|
189
|
+
initialiseExperiencesFx: A({
|
|
190
190
|
source: a,
|
|
191
191
|
effect: (e) => {
|
|
192
192
|
for (let t of e) t.initialiseRequested(void 0);
|
|
@@ -194,20 +194,20 @@ var le = L(({ client: e }) => {
|
|
|
194
194
|
})
|
|
195
195
|
};
|
|
196
196
|
});
|
|
197
|
-
function
|
|
198
|
-
return
|
|
197
|
+
function le(e) {
|
|
198
|
+
return z(ce, e);
|
|
199
199
|
}
|
|
200
|
-
var
|
|
200
|
+
var ue = async (e) => {
|
|
201
201
|
await e.experiences.initialiseExperiencesFx();
|
|
202
202
|
};
|
|
203
203
|
//#endregion
|
|
204
204
|
//#region src/entities/plugin/plugin.ts
|
|
205
|
-
function
|
|
206
|
-
return
|
|
205
|
+
function de(e) {
|
|
206
|
+
return P(async () => {
|
|
207
207
|
await e();
|
|
208
208
|
});
|
|
209
209
|
}
|
|
210
|
-
var
|
|
210
|
+
var fe = (e, t, n) => {
|
|
211
211
|
let r = t.name, i = t.setup(e);
|
|
212
212
|
if (i) {
|
|
213
213
|
let e = n[r] ?? {};
|
|
@@ -216,29 +216,29 @@ var pe = (e, t, n) => {
|
|
|
216
216
|
...i
|
|
217
217
|
});
|
|
218
218
|
}
|
|
219
|
-
},
|
|
219
|
+
}, pe = N("component"), me = R(({ client: e, component: t, name: n }) => ({
|
|
220
220
|
name: n,
|
|
221
221
|
component: t,
|
|
222
222
|
frameworkStore: e.frameworks.getByName(t.frameworkName)
|
|
223
223
|
}));
|
|
224
|
-
function
|
|
225
|
-
return
|
|
224
|
+
function he(e) {
|
|
225
|
+
return z(me, e);
|
|
226
226
|
}
|
|
227
|
-
var
|
|
228
|
-
let t =
|
|
227
|
+
var ge = R(({ client: e }) => {
|
|
228
|
+
let t = pe.store({}), n = M(t, { register(e, t) {
|
|
229
229
|
return {
|
|
230
230
|
...e,
|
|
231
231
|
[t.name]: t
|
|
232
232
|
};
|
|
233
|
-
} }), i =
|
|
234
|
-
|
|
233
|
+
} }), i = F();
|
|
234
|
+
L({
|
|
235
235
|
clock: i,
|
|
236
236
|
source: t,
|
|
237
237
|
filter: (e, { name: t }) => e[t] !== void 0,
|
|
238
238
|
fn: (e, { name: t }) => `Component '${t}' already registered. Registering again will override the previous registration.`
|
|
239
|
-
}).watch((e) => /* @__PURE__ */ r("warn", e)),
|
|
239
|
+
}).watch((e) => /* @__PURE__ */ r("warn", e)), L({
|
|
240
240
|
clock: i,
|
|
241
|
-
fn: ({ name: t, component: n }) =>
|
|
241
|
+
fn: ({ name: t, component: n }) => he({
|
|
242
242
|
client: e,
|
|
243
243
|
name: t,
|
|
244
244
|
component: n
|
|
@@ -255,27 +255,27 @@ var _e = L(({ client: e }) => {
|
|
|
255
255
|
listStore: a
|
|
256
256
|
};
|
|
257
257
|
});
|
|
258
|
-
function
|
|
259
|
-
return
|
|
258
|
+
function _e(e) {
|
|
259
|
+
return z(ge, e);
|
|
260
260
|
}
|
|
261
|
-
var
|
|
261
|
+
var V = (e, t, n) => {
|
|
262
262
|
n.register({
|
|
263
263
|
name: e,
|
|
264
264
|
component: t
|
|
265
265
|
});
|
|
266
|
-
},
|
|
267
|
-
let t =
|
|
266
|
+
}, ve = N("framework"), ye = R((e) => {
|
|
267
|
+
let t = ve.store({}), n = M(t, { register(e, t) {
|
|
268
268
|
return {
|
|
269
269
|
...e,
|
|
270
270
|
[t.name]: t.framework
|
|
271
271
|
};
|
|
272
|
-
} }), i =
|
|
273
|
-
|
|
272
|
+
} }), i = F();
|
|
273
|
+
L({
|
|
274
274
|
clock: i,
|
|
275
275
|
source: t,
|
|
276
276
|
filter: (e, { name: t }) => e[t] !== void 0,
|
|
277
277
|
fn: (e, { name: t }) => `Framework '${t}' already registered. Registering again will override the previous registration.`
|
|
278
|
-
}).watch((e) => /* @__PURE__ */ r("warn", e)),
|
|
278
|
+
}).watch((e) => /* @__PURE__ */ r("warn", e)), L({
|
|
279
279
|
clock: i,
|
|
280
280
|
target: n.register
|
|
281
281
|
});
|
|
@@ -289,50 +289,50 @@ var B = (e, t, n) => {
|
|
|
289
289
|
listStore: a
|
|
290
290
|
};
|
|
291
291
|
});
|
|
292
|
-
function
|
|
293
|
-
return
|
|
292
|
+
function be(e) {
|
|
293
|
+
return z(ye, e);
|
|
294
294
|
}
|
|
295
|
-
var
|
|
295
|
+
var xe = (e, t) => {
|
|
296
296
|
t.register({
|
|
297
297
|
name: e.name,
|
|
298
298
|
framework: e
|
|
299
299
|
});
|
|
300
|
-
},
|
|
300
|
+
}, Se = R(({ client: e }) => {
|
|
301
301
|
let t = "window" in globalThis, n = {
|
|
302
302
|
location: t ? globalThis.location : void 0,
|
|
303
303
|
document: t ? globalThis.document : void 0,
|
|
304
304
|
sessionStorage: t ? globalThis.sessionStorage : void 0,
|
|
305
305
|
localStorage: t ? globalThis.localStorage : void 0
|
|
306
306
|
};
|
|
307
|
-
return
|
|
307
|
+
return j(e.responses.listStore, e.fields.listStore, (t, r) => Object.freeze({
|
|
308
308
|
client: e,
|
|
309
309
|
responses: t,
|
|
310
310
|
fields: r,
|
|
311
311
|
...n
|
|
312
312
|
}));
|
|
313
313
|
});
|
|
314
|
-
function
|
|
315
|
-
return
|
|
314
|
+
function Ce(e) {
|
|
315
|
+
return z(Se, e);
|
|
316
316
|
}
|
|
317
317
|
//#endregion
|
|
318
318
|
//#region src/logic-engine.ts
|
|
319
|
-
function
|
|
319
|
+
function we(e) {
|
|
320
320
|
return typeof e == "number" && !isNaN(e);
|
|
321
321
|
}
|
|
322
|
-
function
|
|
322
|
+
function H(e) {
|
|
323
323
|
return typeof e == "string";
|
|
324
324
|
}
|
|
325
|
-
function
|
|
325
|
+
function U(e) {
|
|
326
326
|
return Array.isArray(e);
|
|
327
327
|
}
|
|
328
|
-
function
|
|
328
|
+
function Te(e) {
|
|
329
329
|
return e instanceof Promise;
|
|
330
330
|
}
|
|
331
331
|
function Ee(e) {
|
|
332
332
|
return typeof e == "object" && !!e && !Array.isArray(e) && Object.keys(e).length === 1;
|
|
333
333
|
}
|
|
334
334
|
function W(e) {
|
|
335
|
-
if (
|
|
335
|
+
if (we(e)) return e;
|
|
336
336
|
let t = parseFloat(`${e}`);
|
|
337
337
|
return isNaN(t) ? 0 : t;
|
|
338
338
|
}
|
|
@@ -362,7 +362,7 @@ var De = {
|
|
|
362
362
|
"!": async (e) => !await q(e),
|
|
363
363
|
"%": (e, t) => W(e) % W(t),
|
|
364
364
|
log: (e) => (console.log(e), e),
|
|
365
|
-
in: (e, t) => t ?
|
|
365
|
+
in: (e, t) => t ? H(t) ? t.indexOf(G(e)) !== -1 : U(t) ? t.includes(e) : !1 : !1,
|
|
366
366
|
cat: (...e) => e.map(G).join(""),
|
|
367
367
|
substr: (e, t, n) => {
|
|
368
368
|
let r = G(e), i = W(t);
|
|
@@ -383,7 +383,7 @@ var De = {
|
|
|
383
383
|
"/": (e, t) => W(e) / W(t),
|
|
384
384
|
min: (...e) => Math.min(...e.map(W)),
|
|
385
385
|
max: (...e) => Math.max(...e.map(W)),
|
|
386
|
-
merge: (...e) => e.reduce((e, t) =>
|
|
386
|
+
merge: (...e) => e.reduce((e, t) => U(t) ? e.concat(t) : e.concat([t]), []),
|
|
387
387
|
var(e, t) {
|
|
388
388
|
let n = arguments.length > 1 ? t : null;
|
|
389
389
|
if (e === "" || e === "." || e == null) return this;
|
|
@@ -401,7 +401,7 @@ var De = {
|
|
|
401
401
|
return a === void 0 ? n : a;
|
|
402
402
|
},
|
|
403
403
|
async missing(...e) {
|
|
404
|
-
let t =
|
|
404
|
+
let t = U(e[0]) ? e[0] : e, n = [];
|
|
405
405
|
for (let e of t) {
|
|
406
406
|
let t = await K({ var: e }, this);
|
|
407
407
|
(t === null || t === "") && n.push(`${e}`);
|
|
@@ -410,23 +410,23 @@ var De = {
|
|
|
410
410
|
},
|
|
411
411
|
async missing_some(e, t) {
|
|
412
412
|
let n = await K({ missing: t }, this);
|
|
413
|
-
if (!
|
|
414
|
-
let r = n.filter(
|
|
415
|
-
return t.filter(
|
|
413
|
+
if (!U(n) || !U(t)) return [];
|
|
414
|
+
let r = n.filter(H);
|
|
415
|
+
return t.filter(H).length - r.length >= W(e) ? [] : r;
|
|
416
416
|
},
|
|
417
417
|
invoke(...e) {
|
|
418
418
|
let [t, ...n] = e;
|
|
419
419
|
return typeof t == "function" ? Reflect.apply(t, null, n) : null;
|
|
420
420
|
},
|
|
421
|
-
startsWith: (e, t) =>
|
|
422
|
-
endsWith: (e, t) =>
|
|
421
|
+
startsWith: (e, t) => H(e) && H(t) && e.startsWith(t),
|
|
422
|
+
endsWith: (e, t) => H(e) && H(t) && e.endsWith(t),
|
|
423
423
|
regexp_matches(e, t) {
|
|
424
424
|
let n = e, r = "";
|
|
425
|
-
if (
|
|
425
|
+
if (U(e)) {
|
|
426
426
|
let [t, i] = e;
|
|
427
427
|
n = t, r = i;
|
|
428
428
|
}
|
|
429
|
-
return !
|
|
429
|
+
return !H(n) || !H(r) ? !1 : new RegExp(n, r).test(G(t));
|
|
430
430
|
},
|
|
431
431
|
throw(e) {
|
|
432
432
|
throw Error(G(e));
|
|
@@ -434,11 +434,11 @@ var De = {
|
|
|
434
434
|
};
|
|
435
435
|
async function K(e, t) {
|
|
436
436
|
if (!e) return e;
|
|
437
|
-
if (
|
|
438
|
-
if (
|
|
437
|
+
if (Te(e)) return K(await e, t);
|
|
438
|
+
if (U(e)) return Promise.all(e.map((e) => K(e, t)));
|
|
439
439
|
if (!Ee(e)) return e;
|
|
440
440
|
let n = Oe(e), r = n ? e[n] ?? [] : [];
|
|
441
|
-
switch (
|
|
441
|
+
switch (U(r) || (r = [r]), n) {
|
|
442
442
|
case "if":
|
|
443
443
|
case "?:":
|
|
444
444
|
for (let e = 0; e < r.length - 1; e += 2) if (await q(await K(r[e], t))) return K(r[e + 1], t);
|
|
@@ -455,18 +455,18 @@ async function K(e, t) {
|
|
|
455
455
|
}
|
|
456
456
|
case "map": {
|
|
457
457
|
let e = await K(r[0], t);
|
|
458
|
-
return
|
|
458
|
+
return U(e) ? await Promise.all(e.map((e) => K(r[1], e))) : [];
|
|
459
459
|
}
|
|
460
460
|
case "filter": {
|
|
461
461
|
let e = await K(r[0], t);
|
|
462
|
-
return
|
|
462
|
+
return U(e) ? (await Promise.all(e.map(async (e) => ({
|
|
463
463
|
item: e,
|
|
464
464
|
shouldInclude: await q(await K(r[1], e))
|
|
465
465
|
})))).filter(({ shouldInclude: e }) => e).map(({ item: e }) => e) : [];
|
|
466
466
|
}
|
|
467
467
|
case "reduce": {
|
|
468
468
|
let e = await K(r[0], t);
|
|
469
|
-
if (!
|
|
469
|
+
if (!U(e)) return r.length > 2 ? await K(r[2], t) : null;
|
|
470
470
|
let n = r[1], i = r.length > 2 ? await K(r[2], t) : null;
|
|
471
471
|
for (let t of e) i = await K(n, {
|
|
472
472
|
current: t,
|
|
@@ -476,19 +476,19 @@ async function K(e, t) {
|
|
|
476
476
|
}
|
|
477
477
|
case "all": {
|
|
478
478
|
let e = await K(r[0], t);
|
|
479
|
-
if (!
|
|
479
|
+
if (!U(e) || e.length === 0) return !1;
|
|
480
480
|
for (let t of e) if (!await q(await K(r[1], t))) return !1;
|
|
481
481
|
return !0;
|
|
482
482
|
}
|
|
483
483
|
case "some": {
|
|
484
484
|
let e = await K(r[0], t);
|
|
485
|
-
if (!
|
|
485
|
+
if (!U(e)) return !1;
|
|
486
486
|
for (let t of e) if (await q(await K(r[1], t))) return !0;
|
|
487
487
|
return !1;
|
|
488
488
|
}
|
|
489
489
|
case "none": {
|
|
490
490
|
let e = await K(r[0], t);
|
|
491
|
-
if (!
|
|
491
|
+
if (!U(e)) return !0;
|
|
492
492
|
for (let t of e) if (await q(await K(r[1], t))) return !1;
|
|
493
493
|
return !0;
|
|
494
494
|
}
|
|
@@ -503,7 +503,7 @@ async function K(e, t) {
|
|
|
503
503
|
return a.apply(t, i);
|
|
504
504
|
}
|
|
505
505
|
async function q(e) {
|
|
506
|
-
return
|
|
506
|
+
return Te(e) ? q(await e) : !(Array.isArray(e) && e.length === 0) && !!e;
|
|
507
507
|
}
|
|
508
508
|
function Oe(e) {
|
|
509
509
|
return Object.keys(e)[0];
|
|
@@ -520,7 +520,7 @@ function ke(e, t, n) {
|
|
|
520
520
|
}) === !0;
|
|
521
521
|
} });
|
|
522
522
|
}
|
|
523
|
-
var Ae =
|
|
523
|
+
var Ae = R(({ client: e }) => A({
|
|
524
524
|
source: {
|
|
525
525
|
stateSnapshot: e.stateSnapshotStore,
|
|
526
526
|
predicates: e.predicates.listStore,
|
|
@@ -564,142 +564,142 @@ var Ae = L(({ client: e }) => k({
|
|
|
564
564
|
}
|
|
565
565
|
}));
|
|
566
566
|
function je(e) {
|
|
567
|
-
return
|
|
567
|
+
return z(Ae, e);
|
|
568
568
|
}
|
|
569
569
|
//#endregion
|
|
570
570
|
//#region src/ping.ts
|
|
571
|
-
var Me = 6e3, Ne =
|
|
571
|
+
var Me = 6e3, Ne = k("last_ping", "global"), Pe = async (e) => {
|
|
572
572
|
try {
|
|
573
|
-
let t = Date.now(), n =
|
|
573
|
+
let t = Date.now(), n = D.get(Ne), r = 0;
|
|
574
574
|
if (n.isSet() && (r = n.json() ?? 0), r && t - r < Me) return !0;
|
|
575
575
|
let i = {
|
|
576
576
|
projectId: e.projectId,
|
|
577
577
|
path: window.location.pathname
|
|
578
578
|
}, a = {}, o = document.getElementById("picked_script")?.dataset.verceltoken;
|
|
579
579
|
o && (a["x-vercel-protection-bypass"] = o);
|
|
580
|
-
let s = (await
|
|
580
|
+
let s = (await ee(e.apiUrl, "ping", i, a)).ok;
|
|
581
581
|
return s && n.set(t), s;
|
|
582
582
|
} catch {
|
|
583
583
|
return !1;
|
|
584
584
|
}
|
|
585
|
-
}, J =
|
|
586
|
-
let t = J.store(!1), r =
|
|
585
|
+
}, J = N("lifecycle"), Fe = R(({ client: e }) => {
|
|
586
|
+
let t = J.store(!1), r = I(void 0, {
|
|
587
587
|
skipVoid: !1,
|
|
588
588
|
domain: J
|
|
589
|
-
}), i =
|
|
589
|
+
}), i = I(void 0, {
|
|
590
590
|
skipVoid: !1,
|
|
591
591
|
domain: J
|
|
592
|
-
}), a = J.store("idle"), o = J.store([]), s =
|
|
592
|
+
}), a = J.store("idle"), o = J.store([]), s = I(void 0, {
|
|
593
593
|
skipVoid: !1,
|
|
594
594
|
domain: J
|
|
595
|
-
}), l =
|
|
595
|
+
}), l = I(void 0, {
|
|
596
596
|
skipVoid: !1,
|
|
597
597
|
domain: J
|
|
598
|
-
}), u =
|
|
598
|
+
}), u = F(), d = F(), f = F(), p = F(), m = F(), h = F();
|
|
599
599
|
o.on(p, (e, t) => [...e, t]), s.on(m, (e, t) => t), l.on(h, (e, t) => t), t.on(d, () => !0);
|
|
600
|
-
let g =
|
|
600
|
+
let g = P(() => {
|
|
601
601
|
Pe(e);
|
|
602
|
-
}), _ =
|
|
603
|
-
await
|
|
604
|
-
}), v =
|
|
605
|
-
await
|
|
606
|
-
}),
|
|
602
|
+
}), _ = P(async () => {
|
|
603
|
+
await y();
|
|
604
|
+
}), v = P(async () => {
|
|
605
|
+
await ue(e);
|
|
606
|
+
}), b = A({ effect: v }), x = A({
|
|
607
607
|
source: o,
|
|
608
608
|
effect: async (e) => {
|
|
609
609
|
for (let t of e) await t();
|
|
610
610
|
}
|
|
611
|
-
}),
|
|
611
|
+
}), S = A({
|
|
612
612
|
source: s,
|
|
613
613
|
effect: async (t) => t === void 0 ? !0 : typeof t == "boolean" ? t : await n(e, t) === !0
|
|
614
|
-
}),
|
|
614
|
+
}), C = A({
|
|
615
615
|
source: l,
|
|
616
616
|
effect: async (t) => t === void 0 ? !0 : typeof t == "boolean" ? t : await n(e, t) === !0
|
|
617
|
-
}),
|
|
617
|
+
}), w = L({
|
|
618
618
|
clock: u,
|
|
619
619
|
source: a,
|
|
620
620
|
filter: (e) => e === "idle" && c(),
|
|
621
621
|
fn: () => void 0
|
|
622
622
|
});
|
|
623
|
-
|
|
624
|
-
clock:
|
|
623
|
+
L({
|
|
624
|
+
clock: w,
|
|
625
625
|
fn: () => "starting",
|
|
626
626
|
target: a
|
|
627
|
-
}),
|
|
628
|
-
clock:
|
|
627
|
+
}), L({
|
|
628
|
+
clock: w,
|
|
629
629
|
target: g
|
|
630
|
-
}),
|
|
631
|
-
clock:
|
|
632
|
-
target: b
|
|
633
|
-
}), I({
|
|
634
|
-
clock: C,
|
|
635
|
-
target: _
|
|
636
|
-
}), I({
|
|
637
|
-
clock: b.done,
|
|
630
|
+
}), L({
|
|
631
|
+
clock: w,
|
|
638
632
|
target: x
|
|
639
|
-
}),
|
|
640
|
-
clock:
|
|
641
|
-
target:
|
|
642
|
-
}),
|
|
633
|
+
}), L({
|
|
634
|
+
clock: w,
|
|
635
|
+
target: _
|
|
636
|
+
}), L({
|
|
637
|
+
clock: x.done,
|
|
638
|
+
target: S
|
|
639
|
+
}), L({
|
|
643
640
|
clock: S.doneData,
|
|
641
|
+
target: r
|
|
642
|
+
}), L({
|
|
643
|
+
clock: C.doneData,
|
|
644
644
|
target: i
|
|
645
|
-
}),
|
|
646
|
-
clock: x.doneData,
|
|
647
|
-
filter: (e) => e,
|
|
648
|
-
target: S
|
|
649
|
-
}), I({
|
|
645
|
+
}), L({
|
|
650
646
|
clock: S.doneData,
|
|
647
|
+
filter: (e) => e,
|
|
648
|
+
target: C
|
|
649
|
+
}), L({
|
|
650
|
+
clock: C.doneData,
|
|
651
651
|
target: e.session.setIsUser
|
|
652
|
-
}),
|
|
653
|
-
clock:
|
|
652
|
+
}), L({
|
|
653
|
+
clock: C.doneData,
|
|
654
654
|
fn: (e) => ({
|
|
655
655
|
type: "user_decide",
|
|
656
656
|
value: e
|
|
657
657
|
}),
|
|
658
658
|
target: e.eventBus
|
|
659
|
-
}),
|
|
660
|
-
clock:
|
|
659
|
+
}), L({
|
|
660
|
+
clock: S.doneData,
|
|
661
661
|
filter: (e) => !e,
|
|
662
662
|
fn: () => void 0,
|
|
663
663
|
target: f
|
|
664
|
-
}),
|
|
665
|
-
clock:
|
|
664
|
+
}), L({
|
|
665
|
+
clock: C.doneData,
|
|
666
666
|
fn: () => void 0,
|
|
667
667
|
target: f
|
|
668
|
-
}),
|
|
668
|
+
}), L({
|
|
669
669
|
clock: f,
|
|
670
670
|
fn: () => ({ type: "initialize" }),
|
|
671
671
|
target: e.eventBus
|
|
672
672
|
});
|
|
673
|
-
let
|
|
674
|
-
|
|
673
|
+
let T = I(!1).on(_.done, () => !0), E = I(!1).on(f, () => !0), D = I(!1).on(b.done, () => !0), O = j(r, i, (e, t) => e === !0 && t === !0);
|
|
674
|
+
L({
|
|
675
675
|
clock: f,
|
|
676
|
-
source:
|
|
676
|
+
source: O,
|
|
677
677
|
filter: (e) => e,
|
|
678
678
|
fn: () => void 0,
|
|
679
679
|
target: v
|
|
680
680
|
});
|
|
681
|
-
let
|
|
682
|
-
|
|
683
|
-
clock:
|
|
681
|
+
let k = j(T, E, O, (e, t, n) => e && t && n);
|
|
682
|
+
L({
|
|
683
|
+
clock: k,
|
|
684
684
|
filter: (e) => e,
|
|
685
685
|
fn: () => void 0,
|
|
686
|
-
target:
|
|
686
|
+
target: b
|
|
687
687
|
});
|
|
688
|
-
let
|
|
689
|
-
return
|
|
690
|
-
clock:
|
|
688
|
+
let ee = j(T, E, O, D, (e, t, n, r) => e && t && (!n || r));
|
|
689
|
+
return L({
|
|
690
|
+
clock: ee,
|
|
691
691
|
filter: (e) => e,
|
|
692
692
|
fn: () => void 0,
|
|
693
693
|
target: d
|
|
694
|
-
}),
|
|
694
|
+
}), L({
|
|
695
695
|
clock: d,
|
|
696
696
|
fn: () => "ready",
|
|
697
697
|
target: a
|
|
698
|
-
}),
|
|
698
|
+
}), L({
|
|
699
699
|
clock: d,
|
|
700
700
|
fn: () => ({ type: "ready" }),
|
|
701
701
|
target: e.eventBus
|
|
702
|
-
}),
|
|
702
|
+
}), L({
|
|
703
703
|
clock: d,
|
|
704
704
|
source: e.session.store,
|
|
705
705
|
fn: ({ id: e, isUser: t, identifiers: n }) => ({
|
|
@@ -709,13 +709,13 @@ var Me = 6e3, Ne = O("last_ping", "global"), Pe = async (e) => {
|
|
|
709
709
|
identifiers: n
|
|
710
710
|
}),
|
|
711
711
|
target: e.eventBus
|
|
712
|
-
}),
|
|
712
|
+
}), L({
|
|
713
713
|
clock: [
|
|
714
|
-
b.fail,
|
|
715
714
|
x.fail,
|
|
716
715
|
S.fail,
|
|
716
|
+
C.fail,
|
|
717
717
|
v.fail,
|
|
718
|
-
|
|
718
|
+
b.fail,
|
|
719
719
|
_.fail
|
|
720
720
|
],
|
|
721
721
|
fn: () => "failed",
|
|
@@ -732,12 +732,12 @@ var Me = 6e3, Ne = O("last_ping", "global"), Pe = async (e) => {
|
|
|
732
732
|
};
|
|
733
733
|
});
|
|
734
734
|
function Ie(e) {
|
|
735
|
-
return
|
|
735
|
+
return z(Fe, e);
|
|
736
736
|
}
|
|
737
737
|
//#endregion
|
|
738
738
|
//#region src/entities/predicate/predicate.ts
|
|
739
|
-
var Le =
|
|
740
|
-
let t = Le.store({}), n =
|
|
739
|
+
var Le = N("predicate"), Re = R(({ client: e }) => {
|
|
740
|
+
let t = Le.store({}), n = M(t, { register(e, t) {
|
|
741
741
|
return {
|
|
742
742
|
...e,
|
|
743
743
|
[t.name]: {
|
|
@@ -745,13 +745,13 @@ var Le = M("predicate"), Re = L(({ client: e }) => {
|
|
|
745
745
|
predicate: t.predicate
|
|
746
746
|
}
|
|
747
747
|
};
|
|
748
|
-
} }), i =
|
|
749
|
-
|
|
748
|
+
} }), i = F();
|
|
749
|
+
L({
|
|
750
750
|
clock: i,
|
|
751
751
|
source: t,
|
|
752
752
|
filter: (e, { name: t }) => e[t] !== void 0,
|
|
753
753
|
fn: (e, { name: t }) => `Predicate '${t}' already registered. Registering again will override the previous registration.`
|
|
754
|
-
}).watch((e) => /* @__PURE__ */ r("warn", e)),
|
|
754
|
+
}).watch((e) => /* @__PURE__ */ r("warn", e)), L({
|
|
755
755
|
clock: i,
|
|
756
756
|
fn: ({ name: e, predicate: t }) => Object.freeze({
|
|
757
757
|
name: e,
|
|
@@ -764,7 +764,7 @@ var Le = M("predicate"), Re = L(({ client: e }) => {
|
|
|
764
764
|
return t.map((t) => t[e]?.predicate, { skipVoid: !1 });
|
|
765
765
|
}
|
|
766
766
|
function s(t) {
|
|
767
|
-
let n =
|
|
767
|
+
let n = I(() => void 0, { skipVoid: !1 }), r = A({
|
|
768
768
|
source: {
|
|
769
769
|
predicate: o(t),
|
|
770
770
|
snapshot: e.stateSnapshotStore
|
|
@@ -776,13 +776,13 @@ var Le = M("predicate"), Re = L(({ client: e }) => {
|
|
|
776
776
|
});
|
|
777
777
|
}
|
|
778
778
|
});
|
|
779
|
-
return
|
|
779
|
+
return L({
|
|
780
780
|
source: {
|
|
781
781
|
responses: e.responses.listStore,
|
|
782
782
|
fields: e.fields.listStore
|
|
783
783
|
},
|
|
784
784
|
target: r
|
|
785
|
-
}),
|
|
785
|
+
}), L({
|
|
786
786
|
clock: r.doneData,
|
|
787
787
|
filter: (e) => e !== void 0,
|
|
788
788
|
target: n
|
|
@@ -796,33 +796,33 @@ var Le = M("predicate"), Re = L(({ client: e }) => {
|
|
|
796
796
|
};
|
|
797
797
|
});
|
|
798
798
|
function ze(e) {
|
|
799
|
-
return
|
|
799
|
+
return z(Re, e);
|
|
800
800
|
}
|
|
801
801
|
var Be = (e, t, n) => {
|
|
802
802
|
n.register({
|
|
803
803
|
name: e,
|
|
804
804
|
predicate: t
|
|
805
805
|
});
|
|
806
|
-
}, Ve =
|
|
806
|
+
}, Ve = N("feature");
|
|
807
807
|
function Y(e) {
|
|
808
808
|
return e?.enabled === !1;
|
|
809
809
|
}
|
|
810
810
|
function He(e) {
|
|
811
811
|
return e === "true" || e !== "false" && e;
|
|
812
812
|
}
|
|
813
|
-
var Ue =
|
|
814
|
-
let t = Ve.store({}), n = Ve.store([]), i =
|
|
813
|
+
var Ue = R(({ client: e }) => {
|
|
814
|
+
let t = Ve.store({}), n = Ve.store([]), i = M(t, { register(e, t) {
|
|
815
815
|
return {
|
|
816
816
|
...e,
|
|
817
817
|
[t.id]: t.feature
|
|
818
818
|
};
|
|
819
|
-
} }), a =
|
|
820
|
-
|
|
819
|
+
} }), a = F();
|
|
820
|
+
L({
|
|
821
821
|
clock: a,
|
|
822
822
|
source: t,
|
|
823
823
|
filter: (e, { id: t }) => e[t] !== void 0,
|
|
824
824
|
fn: (e, { id: t }) => `Feature '${t}' already registered. Registering again will override the previous registration.`
|
|
825
|
-
}).watch((e) => /* @__PURE__ */ r("warn", e)),
|
|
825
|
+
}).watch((e) => /* @__PURE__ */ r("warn", e)), L({
|
|
826
826
|
clock: a,
|
|
827
827
|
fn: ({ id: e, feature: t }) => Object.freeze({
|
|
828
828
|
id: e,
|
|
@@ -836,20 +836,20 @@ var Ue = L(({ client: e }) => {
|
|
|
836
836
|
}),
|
|
837
837
|
target: i.register
|
|
838
838
|
});
|
|
839
|
-
let o =
|
|
839
|
+
let o = P(async ({ id: e, key: t, storage: n = "local", enabled: r }) => {
|
|
840
840
|
if (r === !1) return null;
|
|
841
|
-
let i =
|
|
841
|
+
let i = k(`feature:${e}:${t}`, "global"), a = (n === "session" ? O : D).get(i).text();
|
|
842
842
|
return a ? {
|
|
843
843
|
id: e,
|
|
844
844
|
key: t,
|
|
845
845
|
bucket: He(a),
|
|
846
846
|
storage: n
|
|
847
847
|
} : null;
|
|
848
|
-
}), s =
|
|
848
|
+
}), s = P((e) => {
|
|
849
849
|
if (!e) return null;
|
|
850
|
-
let t =
|
|
851
|
-
(e.storage === "session" ?
|
|
852
|
-
}), c = /* @__PURE__ */ new Map(), l =
|
|
850
|
+
let t = k(`feature:${e.id}:${e.key}`, "global");
|
|
851
|
+
(e.storage === "session" ? O : D).set(t, e.bucket);
|
|
852
|
+
}), c = /* @__PURE__ */ new Map(), l = A({
|
|
853
853
|
source: {
|
|
854
854
|
allFeaturesStore: t,
|
|
855
855
|
resolvedFeaturesStore: n
|
|
@@ -886,7 +886,7 @@ var Ue = L(({ client: e }) => {
|
|
|
886
886
|
};
|
|
887
887
|
}
|
|
888
888
|
});
|
|
889
|
-
|
|
889
|
+
L({
|
|
890
890
|
clock: i.register,
|
|
891
891
|
fn: (e) => {
|
|
892
892
|
let { id: t, feature: n } = e;
|
|
@@ -898,7 +898,7 @@ var Ue = L(({ client: e }) => {
|
|
|
898
898
|
};
|
|
899
899
|
},
|
|
900
900
|
target: o
|
|
901
|
-
}),
|
|
901
|
+
}), L({
|
|
902
902
|
source: t,
|
|
903
903
|
clock: l.doneData,
|
|
904
904
|
filter: (e, t) => !Y(e[t.id]?.feature),
|
|
@@ -913,7 +913,7 @@ var Ue = L(({ client: e }) => {
|
|
|
913
913
|
},
|
|
914
914
|
target: s
|
|
915
915
|
});
|
|
916
|
-
let u =
|
|
916
|
+
let u = j({
|
|
917
917
|
allFeaturesStore: t,
|
|
918
918
|
resolvedFeaturesStore: n
|
|
919
919
|
}).map(({ allFeaturesStore: e, resolvedFeaturesStore: t }) => Object.values(e).map((e) => {
|
|
@@ -939,7 +939,7 @@ var Ue = L(({ client: e }) => {
|
|
|
939
939
|
isResolved: !1
|
|
940
940
|
};
|
|
941
941
|
}));
|
|
942
|
-
|
|
942
|
+
L({
|
|
943
943
|
clock: l.doneData,
|
|
944
944
|
source: {
|
|
945
945
|
resolvedFeatures: n,
|
|
@@ -951,7 +951,7 @@ var Ue = L(({ client: e }) => {
|
|
|
951
951
|
type: "feature_decide",
|
|
952
952
|
feature: e
|
|
953
953
|
}))
|
|
954
|
-
}),
|
|
954
|
+
}), L({
|
|
955
955
|
clock: [o.doneData, l.doneData],
|
|
956
956
|
source: {
|
|
957
957
|
resolvedFeatures: n,
|
|
@@ -963,52 +963,91 @@ var Ue = L(({ client: e }) => {
|
|
|
963
963
|
function d(e) {
|
|
964
964
|
return u.map((t) => t.find((t) => t.id === e));
|
|
965
965
|
}
|
|
966
|
-
|
|
966
|
+
let f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
|
|
967
|
+
function h(e) {
|
|
968
|
+
let t = f.get(e);
|
|
969
|
+
if (t) return t;
|
|
970
|
+
let n = d(e);
|
|
971
|
+
return f.set(e, n), n;
|
|
972
|
+
}
|
|
973
|
+
function g(e) {
|
|
967
974
|
return t.map((t) => t[e], { skipVoid: !1 });
|
|
968
975
|
}
|
|
969
|
-
function
|
|
970
|
-
let t =
|
|
971
|
-
source:
|
|
976
|
+
function _(e) {
|
|
977
|
+
let t = I(async () => void 0, { skipVoid: !1 }), n = h(e), r = A({
|
|
978
|
+
source: n,
|
|
972
979
|
effect: async (e) => {
|
|
973
980
|
if (e) return async () => (await e.getBucket()).bucket;
|
|
974
981
|
}
|
|
975
982
|
});
|
|
976
|
-
return
|
|
977
|
-
|
|
978
|
-
filter: (t) => t.some((t) => t.id === e),
|
|
983
|
+
return L({
|
|
984
|
+
clock: n,
|
|
979
985
|
target: r
|
|
980
|
-
}),
|
|
986
|
+
}), L({
|
|
981
987
|
clock: r.doneData,
|
|
982
988
|
filter: (e) => e !== void 0,
|
|
983
989
|
target: t
|
|
984
990
|
}), r(), t;
|
|
985
991
|
}
|
|
992
|
+
function v(e) {
|
|
993
|
+
let t = p.get(e);
|
|
994
|
+
if (t) return t;
|
|
995
|
+
let n = _(e);
|
|
996
|
+
return p.set(e, n), n;
|
|
997
|
+
}
|
|
998
|
+
function y(e) {
|
|
999
|
+
let t = v(e), n = I(void 0, { skipVoid: !1 }), r = A({
|
|
1000
|
+
source: t,
|
|
1001
|
+
mapParams: (e, t) => t,
|
|
1002
|
+
effect: P(async (e) => await e())
|
|
1003
|
+
});
|
|
1004
|
+
return L({
|
|
1005
|
+
clock: r.doneData,
|
|
1006
|
+
fn: (t) => {
|
|
1007
|
+
if (t !== void 0) return {
|
|
1008
|
+
id: e,
|
|
1009
|
+
bucket: t
|
|
1010
|
+
};
|
|
1011
|
+
},
|
|
1012
|
+
target: n
|
|
1013
|
+
}), L({
|
|
1014
|
+
clock: t,
|
|
1015
|
+
target: r
|
|
1016
|
+
}), r(), n;
|
|
1017
|
+
}
|
|
1018
|
+
function b(e) {
|
|
1019
|
+
let t = m.get(e);
|
|
1020
|
+
if (t) return t;
|
|
1021
|
+
let n = y(e);
|
|
1022
|
+
return m.set(e, n), n;
|
|
1023
|
+
}
|
|
986
1024
|
return {
|
|
987
1025
|
register: a,
|
|
988
|
-
getById:
|
|
989
|
-
getByName:
|
|
1026
|
+
getById: h,
|
|
1027
|
+
getByName: g,
|
|
990
1028
|
listStore: u,
|
|
991
|
-
getEvokableFeature:
|
|
1029
|
+
getEvokableFeature: v,
|
|
1030
|
+
getFeatureResult: b
|
|
992
1031
|
};
|
|
993
1032
|
});
|
|
994
1033
|
function We(e) {
|
|
995
|
-
return
|
|
1034
|
+
return z(Ue, e);
|
|
996
1035
|
}
|
|
997
1036
|
var Ge = (e, t, n) => {
|
|
998
1037
|
n.register({
|
|
999
1038
|
id: e,
|
|
1000
1039
|
feature: t
|
|
1001
1040
|
});
|
|
1002
|
-
}, X =
|
|
1041
|
+
}, X = N("history");
|
|
1003
1042
|
function Ke(e, t) {
|
|
1004
1043
|
return {
|
|
1005
|
-
id:
|
|
1044
|
+
id: ne(`history-entry-${Date.now()}-${Math.random()}}`),
|
|
1006
1045
|
node: t,
|
|
1007
1046
|
at: Date.now(),
|
|
1008
1047
|
experienceId: e
|
|
1009
1048
|
};
|
|
1010
1049
|
}
|
|
1011
|
-
var qe =
|
|
1050
|
+
var qe = R(() => {
|
|
1012
1051
|
let e = X.store({ entries: [] }), t = X.event(), n = X.event(), r = X.event(), i = X.event();
|
|
1013
1052
|
e.on(t, (e, t) => ({ entries: [...e.entries, Ke(t.experienceId, t.node)] })), e.on(n, (e, t) => ({ entries: [...e.entries.slice(0, -1), Ke(t.experienceId, t.node)] })), e.on(i, (e, t) => t);
|
|
1014
1053
|
function a(e, t) {
|
|
@@ -1018,7 +1057,7 @@ var qe = L(() => {
|
|
|
1018
1057
|
};
|
|
1019
1058
|
for (let r = e.length - 1; r >= 0; r--) {
|
|
1020
1059
|
let i = e[r], a = i?.node;
|
|
1021
|
-
if (!(!a || !
|
|
1060
|
+
if (!(!a || !T(a)) && !(t && i.experienceId !== t)) if (n.lastStepIndex === -1) n.lastStepIndex = r;
|
|
1022
1061
|
else {
|
|
1023
1062
|
n.secondLastStepIndex = r;
|
|
1024
1063
|
break;
|
|
@@ -1041,19 +1080,19 @@ var qe = L(() => {
|
|
|
1041
1080
|
};
|
|
1042
1081
|
});
|
|
1043
1082
|
function Je() {
|
|
1044
|
-
return
|
|
1083
|
+
return z(qe);
|
|
1045
1084
|
}
|
|
1046
1085
|
//#endregion
|
|
1047
1086
|
//#region src/utils/events.ts
|
|
1048
1087
|
var Ye = 0, Xe = (e) => {
|
|
1049
|
-
let t =
|
|
1088
|
+
let t = I([]);
|
|
1050
1089
|
return t.on(e, (e, t) => [...e, {
|
|
1051
1090
|
id: Ye++,
|
|
1052
1091
|
at: /* @__PURE__ */ new Date(),
|
|
1053
1092
|
payload: t
|
|
1054
1093
|
}]), t;
|
|
1055
|
-
}, Ze =
|
|
1056
|
-
let e = Ze.store({}), t =
|
|
1094
|
+
}, Ze = N("field"), Qe = R(() => {
|
|
1095
|
+
let e = Ze.store({}), t = M(e, {
|
|
1057
1096
|
register(e, t) {
|
|
1058
1097
|
return {
|
|
1059
1098
|
...e,
|
|
@@ -1102,12 +1141,12 @@ var Ye = 0, Xe = (e) => {
|
|
|
1102
1141
|
};
|
|
1103
1142
|
});
|
|
1104
1143
|
function $e() {
|
|
1105
|
-
return
|
|
1144
|
+
return z(Qe);
|
|
1106
1145
|
}
|
|
1107
1146
|
//#endregion
|
|
1108
1147
|
//#region src/entities/step/step.ts
|
|
1109
|
-
var et =
|
|
1110
|
-
let e = et.store({}), t =
|
|
1148
|
+
var et = N("step"), tt = R(() => {
|
|
1149
|
+
let e = et.store({}), t = M(e, { register(e, t) {
|
|
1111
1150
|
return {
|
|
1112
1151
|
...e,
|
|
1113
1152
|
[t.step.id]: t.step
|
|
@@ -1132,15 +1171,15 @@ var et = M("step"), tt = L(() => {
|
|
|
1132
1171
|
};
|
|
1133
1172
|
});
|
|
1134
1173
|
function nt() {
|
|
1135
|
-
return
|
|
1174
|
+
return z(tt);
|
|
1136
1175
|
}
|
|
1137
1176
|
function rt(e, t) {
|
|
1138
1177
|
t.register(e);
|
|
1139
1178
|
}
|
|
1140
1179
|
//#endregion
|
|
1141
1180
|
//#region src/entities/content/content.ts
|
|
1142
|
-
var it =
|
|
1143
|
-
let e = it.store({}), t =
|
|
1181
|
+
var it = N("content"), at = R(() => {
|
|
1182
|
+
let e = it.store({}), t = M(e, {
|
|
1144
1183
|
register(e, t) {
|
|
1145
1184
|
return {
|
|
1146
1185
|
...e,
|
|
@@ -1182,15 +1221,15 @@ var it = M("content"), at = L(() => {
|
|
|
1182
1221
|
};
|
|
1183
1222
|
});
|
|
1184
1223
|
function ot() {
|
|
1185
|
-
return
|
|
1224
|
+
return z(at);
|
|
1186
1225
|
}
|
|
1187
1226
|
function st(e, t) {
|
|
1188
1227
|
t.register(e);
|
|
1189
1228
|
}
|
|
1190
1229
|
//#endregion
|
|
1191
1230
|
//#region src/entities/action/action.ts
|
|
1192
|
-
var ct =
|
|
1193
|
-
let t = ct.store({}), n =
|
|
1231
|
+
var ct = N("action"), lt = R(({ client: e }) => {
|
|
1232
|
+
let t = ct.store({}), n = M(t, { register(e, t) {
|
|
1194
1233
|
return {
|
|
1195
1234
|
...e,
|
|
1196
1235
|
[t.key]: {
|
|
@@ -1198,13 +1237,13 @@ var ct = M("action"), lt = L(({ client: e }) => {
|
|
|
1198
1237
|
action: t.action
|
|
1199
1238
|
}
|
|
1200
1239
|
};
|
|
1201
|
-
} }), i =
|
|
1202
|
-
|
|
1240
|
+
} }), i = F();
|
|
1241
|
+
L({
|
|
1203
1242
|
clock: i,
|
|
1204
1243
|
source: t,
|
|
1205
1244
|
filter: (e, { key: t }) => e[t] !== void 0,
|
|
1206
1245
|
fn: (e, { key: t }) => `Action '${t}' already registered. Registering again will override the previous registration.`
|
|
1207
|
-
}).watch((e) => /* @__PURE__ */ r("warn", e)),
|
|
1246
|
+
}).watch((e) => /* @__PURE__ */ r("warn", e)), L({
|
|
1208
1247
|
clock: i,
|
|
1209
1248
|
fn: ({ key: e, action: t }) => Object.freeze({
|
|
1210
1249
|
key: e,
|
|
@@ -1217,7 +1256,7 @@ var ct = M("action"), lt = L(({ client: e }) => {
|
|
|
1217
1256
|
return t.map((t) => t[e]?.action, { skipVoid: !1 });
|
|
1218
1257
|
}
|
|
1219
1258
|
function s(t, n) {
|
|
1220
|
-
let r =
|
|
1259
|
+
let r = I(() => void 0, { skipVoid: !1 }), i = n ? { experience: n.experience } : null, a = A({
|
|
1221
1260
|
source: {
|
|
1222
1261
|
action: o(t),
|
|
1223
1262
|
snapshot: e.stateSnapshotStore
|
|
@@ -1229,13 +1268,13 @@ var ct = M("action"), lt = L(({ client: e }) => {
|
|
|
1229
1268
|
}, i);
|
|
1230
1269
|
}
|
|
1231
1270
|
});
|
|
1232
|
-
return
|
|
1271
|
+
return L({
|
|
1233
1272
|
source: {
|
|
1234
1273
|
responses: e.responses.listStore,
|
|
1235
1274
|
fields: e.fields.listStore
|
|
1236
1275
|
},
|
|
1237
1276
|
target: a
|
|
1238
|
-
}),
|
|
1277
|
+
}), L({
|
|
1239
1278
|
clock: a.doneData,
|
|
1240
1279
|
filter: (e) => e !== void 0,
|
|
1241
1280
|
target: r
|
|
@@ -1249,7 +1288,7 @@ var ct = M("action"), lt = L(({ client: e }) => {
|
|
|
1249
1288
|
};
|
|
1250
1289
|
});
|
|
1251
1290
|
function ut(e) {
|
|
1252
|
-
return
|
|
1291
|
+
return z(lt, e);
|
|
1253
1292
|
}
|
|
1254
1293
|
var dt = (e, t, n) => {
|
|
1255
1294
|
n.register({
|
|
@@ -1321,8 +1360,8 @@ async function vt(t, n, r, i) {
|
|
|
1321
1360
|
}
|
|
1322
1361
|
//#endregion
|
|
1323
1362
|
//#region src/entities/response/response.ts
|
|
1324
|
-
var yt =
|
|
1325
|
-
let t = yt.store({}), r =
|
|
1363
|
+
var yt = N("response"), bt = R(({ client: e }) => {
|
|
1364
|
+
let t = yt.store({}), r = F(), i = F(), a = M(t, {
|
|
1326
1365
|
register(e, t) {
|
|
1327
1366
|
return {
|
|
1328
1367
|
...e,
|
|
@@ -1351,7 +1390,7 @@ var yt = M("response"), bt = L(({ client: e }) => {
|
|
|
1351
1390
|
});
|
|
1352
1391
|
} else a.registerBatch(e);
|
|
1353
1392
|
}
|
|
1354
|
-
let s = (t, r) => n(e, t, r), c =
|
|
1393
|
+
let s = (t, r) => n(e, t, r), c = A({
|
|
1355
1394
|
source: {
|
|
1356
1395
|
allFields: e.fields.listStore,
|
|
1357
1396
|
existingResponses: t
|
|
@@ -1409,7 +1448,7 @@ var yt = M("response"), bt = L(({ client: e }) => {
|
|
|
1409
1448
|
async function l(e) {
|
|
1410
1449
|
return c(e);
|
|
1411
1450
|
}
|
|
1412
|
-
let u =
|
|
1451
|
+
let u = A({
|
|
1413
1452
|
source: t,
|
|
1414
1453
|
effect: async (e, t) => {
|
|
1415
1454
|
let { responsesToCommit: n, validationErrors: r } = await c(t);
|
|
@@ -1424,7 +1463,7 @@ var yt = M("response"), bt = L(({ client: e }) => {
|
|
|
1424
1463
|
value: t
|
|
1425
1464
|
})));
|
|
1426
1465
|
function m(e) {
|
|
1427
|
-
return
|
|
1466
|
+
return j({
|
|
1428
1467
|
f: e,
|
|
1429
1468
|
s: t
|
|
1430
1469
|
}, ({ f: e, s: t }) => {
|
|
@@ -1441,10 +1480,10 @@ var yt = M("response"), bt = L(({ client: e }) => {
|
|
|
1441
1480
|
function _(t) {
|
|
1442
1481
|
return m(e.fields.getByName(t));
|
|
1443
1482
|
}
|
|
1444
|
-
return
|
|
1483
|
+
return L({
|
|
1445
1484
|
clock: r,
|
|
1446
1485
|
target: a.clearAll
|
|
1447
|
-
}),
|
|
1486
|
+
}), L({
|
|
1448
1487
|
clock: i,
|
|
1449
1488
|
target: a.clear
|
|
1450
1489
|
}), {
|
|
@@ -1461,12 +1500,12 @@ var yt = M("response"), bt = L(({ client: e }) => {
|
|
|
1461
1500
|
};
|
|
1462
1501
|
});
|
|
1463
1502
|
function xt(e) {
|
|
1464
|
-
return
|
|
1503
|
+
return z(bt, e);
|
|
1465
1504
|
}
|
|
1466
1505
|
//#endregion
|
|
1467
1506
|
//#region src/entities/condition/condition.ts
|
|
1468
|
-
var St =
|
|
1469
|
-
let e = St.store({}), t =
|
|
1507
|
+
var St = N("condition"), Ct = R(() => {
|
|
1508
|
+
let e = St.store({}), t = M(e, { register(e, t) {
|
|
1470
1509
|
return {
|
|
1471
1510
|
...e,
|
|
1472
1511
|
[t.condition.id]: t.condition
|
|
@@ -1491,7 +1530,7 @@ var St = M("condition"), Ct = L(() => {
|
|
|
1491
1530
|
};
|
|
1492
1531
|
});
|
|
1493
1532
|
function wt() {
|
|
1494
|
-
return
|
|
1533
|
+
return z(Ct);
|
|
1495
1534
|
}
|
|
1496
1535
|
//#endregion
|
|
1497
1536
|
//#region src/utils/api-url.ts
|
|
@@ -1518,23 +1557,23 @@ function Et() {
|
|
|
1518
1557
|
let n = r.replace("picked-", "");
|
|
1519
1558
|
t[n] = e.getAll(r);
|
|
1520
1559
|
}
|
|
1521
|
-
let r =
|
|
1522
|
-
if (n.size > 0)
|
|
1560
|
+
let r = k("s");
|
|
1561
|
+
if (n.size > 0) O.set(r, t);
|
|
1523
1562
|
else {
|
|
1524
|
-
let e =
|
|
1563
|
+
let e = O.get(r);
|
|
1525
1564
|
if (e) return e.json() || {};
|
|
1526
1565
|
}
|
|
1527
1566
|
return t;
|
|
1528
1567
|
}
|
|
1529
1568
|
//#endregion
|
|
1530
1569
|
//#region src/entities/session/session.ts
|
|
1531
|
-
var Dt =
|
|
1570
|
+
var Dt = k("session", "global");
|
|
1532
1571
|
function Ot() {
|
|
1533
1572
|
return p() ? 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)}`;
|
|
1534
1573
|
}
|
|
1535
1574
|
function kt() {
|
|
1536
1575
|
if (!m()) return null;
|
|
1537
|
-
let e =
|
|
1576
|
+
let e = D.get(Dt);
|
|
1538
1577
|
if (!e.isSet()) return null;
|
|
1539
1578
|
try {
|
|
1540
1579
|
return e.json();
|
|
@@ -1542,10 +1581,10 @@ function kt() {
|
|
|
1542
1581
|
return null;
|
|
1543
1582
|
}
|
|
1544
1583
|
}
|
|
1545
|
-
var At =
|
|
1584
|
+
var At = R(() => {
|
|
1546
1585
|
let e = kt(), t = { id: e?.id ?? Ot() };
|
|
1547
1586
|
e?.isUser !== void 0 && (t.isUser = e.isUser), e?.identifiers && Object.keys(e.identifiers).length > 0 && (t.identifiers = e.identifiers);
|
|
1548
|
-
let n =
|
|
1587
|
+
let n = I(t), r = M(n, {
|
|
1549
1588
|
setIsUser: (e, t) => ({
|
|
1550
1589
|
...e,
|
|
1551
1590
|
isUser: t
|
|
@@ -1565,15 +1604,15 @@ var At = L(() => {
|
|
|
1565
1604
|
let i = { id: e.id };
|
|
1566
1605
|
return e.isUser !== void 0 && (i.isUser = e.isUser), Object.keys(r).length > 0 && (i.identifiers = r), i;
|
|
1567
1606
|
}
|
|
1568
|
-
}), i =
|
|
1607
|
+
}), i = A({
|
|
1569
1608
|
source: n,
|
|
1570
1609
|
effect: (e) => {
|
|
1571
1610
|
if (m()) try {
|
|
1572
|
-
|
|
1611
|
+
D.get(Dt).set(e);
|
|
1573
1612
|
} catch {}
|
|
1574
1613
|
}
|
|
1575
1614
|
});
|
|
1576
|
-
return
|
|
1615
|
+
return L({
|
|
1577
1616
|
source: n,
|
|
1578
1617
|
target: i
|
|
1579
1618
|
}), {
|
|
@@ -1584,7 +1623,7 @@ var At = L(() => {
|
|
|
1584
1623
|
};
|
|
1585
1624
|
});
|
|
1586
1625
|
function jt() {
|
|
1587
|
-
return
|
|
1626
|
+
return z(At, void 0);
|
|
1588
1627
|
}
|
|
1589
1628
|
//#endregion
|
|
1590
1629
|
//#region src/utils/picked-config.ts
|
|
@@ -1681,7 +1720,7 @@ var Ut = class {
|
|
|
1681
1720
|
contentLoader;
|
|
1682
1721
|
previewEmbedderOrigins = null;
|
|
1683
1722
|
plugins = {};
|
|
1684
|
-
eventBus =
|
|
1723
|
+
eventBus = F();
|
|
1685
1724
|
events;
|
|
1686
1725
|
projectId;
|
|
1687
1726
|
apiUrl;
|
|
@@ -1690,10 +1729,10 @@ var Ut = class {
|
|
|
1690
1729
|
session = jt();
|
|
1691
1730
|
searchParams = Et();
|
|
1692
1731
|
history = Je();
|
|
1693
|
-
components =
|
|
1694
|
-
experienceInstances =
|
|
1695
|
-
experiences =
|
|
1696
|
-
frameworks =
|
|
1732
|
+
components = _e({ client: this });
|
|
1733
|
+
experienceInstances = C({ client: this });
|
|
1734
|
+
experiences = le({ client: this });
|
|
1735
|
+
frameworks = be({ client: this });
|
|
1697
1736
|
predicates = ze({ client: this });
|
|
1698
1737
|
features = We({ client: this });
|
|
1699
1738
|
conditions = wt();
|
|
@@ -1702,8 +1741,8 @@ var Ut = class {
|
|
|
1702
1741
|
steps = nt();
|
|
1703
1742
|
contents = ot();
|
|
1704
1743
|
actions = ut({ client: this });
|
|
1705
|
-
conditionResults =
|
|
1706
|
-
stateSnapshotStore =
|
|
1744
|
+
conditionResults = w();
|
|
1745
|
+
stateSnapshotStore = Ce({ client: this });
|
|
1707
1746
|
evaluateRuleLogicFx = je({ client: this });
|
|
1708
1747
|
start;
|
|
1709
1748
|
readyStore;
|
|
@@ -1711,7 +1750,7 @@ var Ut = class {
|
|
|
1711
1750
|
conditionPassedStore;
|
|
1712
1751
|
lifecycleStageStore;
|
|
1713
1752
|
lifecycle = Ie({ client: this });
|
|
1714
|
-
renderStringFx =
|
|
1753
|
+
renderStringFx = A({
|
|
1715
1754
|
source: this.responses.listStore,
|
|
1716
1755
|
effect: (e, { template: t, context: n }) => {
|
|
1717
1756
|
let r = {};
|
|
@@ -1725,20 +1764,20 @@ var Ut = class {
|
|
|
1725
1764
|
constructor(e) {
|
|
1726
1765
|
this.events = Xe(this.eventBus), this.projectId = Ft(e), this.options = Object.freeze(e), this.apiUrl = e.apiUrl || Tt(), this.dashboardUrl = e.dashboardUrl ?? "https://dashboard.picked.app", this.documentationSiteUrl = e.documentationSiteUrl ?? "https://docs.picked.app", this.start = this.lifecycle.start, this.readyStore = this.lifecycle.readyStore, this.preconditionPassedStore = this.lifecycle.preconditionPassedStore, this.conditionPassedStore = this.lifecycle.conditionPassedStore, this.lifecycleStageStore = this.lifecycle.lifecycleStageStore, this.setupPlugins(), this.setupFeatures(), this.setupPredicates(), this.setupActions(), this.setupComponents(), this.lifecycle.setPrecondition(e.precondition), this.lifecycle.setCondition(e.condition), this.eventBus({
|
|
1727
1766
|
type: "load",
|
|
1728
|
-
version:
|
|
1767
|
+
version: te()
|
|
1729
1768
|
}), this.maybeStartPreviewChannel();
|
|
1730
1769
|
}
|
|
1731
1770
|
maybeStartPreviewChannel() {
|
|
1732
1771
|
Ht() && import("../preview-channel-CSr96XAo.js").then((e) => e.initPreviewChannel(this)).catch(() => void 0);
|
|
1733
1772
|
}
|
|
1734
1773
|
registerFramework = (e) => {
|
|
1735
|
-
|
|
1774
|
+
xe(e, this.frameworks);
|
|
1736
1775
|
};
|
|
1737
1776
|
registerComponent = (e, t) => {
|
|
1738
|
-
|
|
1777
|
+
V(e, t, this.components);
|
|
1739
1778
|
};
|
|
1740
1779
|
registerPlugin = (e) => {
|
|
1741
|
-
|
|
1780
|
+
fe(this, e, this.plugins);
|
|
1742
1781
|
let t = this.plugins[e.name];
|
|
1743
1782
|
t?.onStart && this.lifecycle.registerPluginStartHook(t.onStart);
|
|
1744
1783
|
};
|
|
@@ -1767,7 +1806,7 @@ var Ut = class {
|
|
|
1767
1806
|
dt(e, t, this.actions);
|
|
1768
1807
|
};
|
|
1769
1808
|
registerExperience = (e) => {
|
|
1770
|
-
e.component &&
|
|
1809
|
+
e.component && V(`experience:${e.id}`, e.component, this.components), this.experiences.register(e);
|
|
1771
1810
|
};
|
|
1772
1811
|
launchExperienceById = async (e, t) => {
|
|
1773
1812
|
this.experiences.launch({
|
|
@@ -1905,4 +1944,4 @@ var Qt = (e) => {
|
|
|
1905
1944
|
return u(t), t;
|
|
1906
1945
|
};
|
|
1907
1946
|
//#endregion
|
|
1908
|
-
export { Kt as PICKED_HYDRATED_ATTR, Gt as PICKED_MODULE_SCRIPT_TYPE, Wt as PICKED_SCRIPT_TYPE, Vt as PREVIEW_TOKEN_PARAM, Ut as Picked, Jt as buildRehydrateBootstrap, Qt as createClient,
|
|
1947
|
+
export { Kt as PICKED_HYDRATED_ATTR, Gt as PICKED_MODULE_SCRIPT_TYPE, Wt as PICKED_SCRIPT_TYPE, Vt as PREVIEW_TOKEN_PARAM, Ut as Picked, Jt as buildRehydrateBootstrap, Qt as createClient, de as createPluginEffect, k as createStorageKey, n as evaluateRuleLogic, Mt as getPickedConfig, Yt as isHtmlAssetValue, h as isInsideIframe, Zt as isLazyLoader, _ as isPickedRoot, Ht as isPreviewSession, Xt as lazyComponent, D as localStore, ae as onInertScriptSubtrees, qt as rehydrateScripts, re as reportInertScriptSubtrees, ie as resetInertScriptReport, O as sessionStore, E as subscribe, d as supportsCookies, p as supportsCryptoRandomUUID, c as supportsDocument, i as supportsHistory, f as supportsIntersectionObserver, m as supportsLocalStorage, a as supportsLocation, l as supportsSessionStorage, g as supportsShadowRoot, o as supportsWebComponents, s as supportsWindow };
|