@picked/client 0.0.1-dev.1770849584797 → 0.0.1-dev.1771901344537
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/api-CbXfbi_s.js +19 -0
- package/dist/api-DzSCgBQ2.cjs +1 -0
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/plugins/create-experience/index.js +1 -1
- package/dist/cjs/plugins/dynamic-experiences/index.js +1 -0
- package/dist/esm/index.js +450 -477
- package/dist/esm/plugins/create-experience/index.js +295 -298
- package/dist/esm/plugins/dynamic-experiences/index.js +102 -0
- package/dist/types/client.d.ts +10 -0
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/entities/field/field.d.ts +9 -30
- package/dist/types/entities/field/field.d.ts.map +1 -1
- package/dist/types/entities/plugin/plugin.d.ts +4 -1
- package/dist/types/entities/plugin/plugin.d.ts.map +1 -1
- package/dist/types/picked.d.ts +8 -3
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/ping.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts +19 -14
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/plugin.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/hash.d.ts +12 -0
- package/dist/types/plugins/dynamic-experiences/hash.d.ts.map +1 -0
- package/dist/types/plugins/dynamic-experiences/index.d.ts +3 -0
- package/dist/types/plugins/dynamic-experiences/index.d.ts.map +1 -0
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts +23 -0
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -0
- package/dist/types/plugins/dynamic-experiences/types.d.ts +15 -0
- package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -0
- package/dist/types/utils/api.d.ts +3 -0
- package/dist/types/utils/api.d.ts.map +1 -0
- package/dist/types/utils/events.d.ts +10 -4
- package/dist/types/utils/events.d.ts.map +1 -1
- package/dist/types/utils/get-step-fields.d.ts.map +1 -1
- package/package.json +18 -1
package/dist/esm/index.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { createDomain as
|
|
1
|
+
import { createDomain as F, createApi as x, createStore as V, createEffect as $, sample as v, attach as Z, combine as D, createEvent as U } from "effector";
|
|
2
2
|
import { createFactory as w, invoke as b } from "@withease/factories";
|
|
3
|
-
import { g as
|
|
4
|
-
import { f as
|
|
3
|
+
import { g as q, t as ee, c as te, i as re, e as P, a as se, b as ne, d as ie } from "../experience-instance-D0bQ9DzM.js";
|
|
4
|
+
import { f as Rt } from "../experience-instance-D0bQ9DzM.js";
|
|
5
5
|
import { l as k } from "../logger-C9a75KZn.js";
|
|
6
|
-
import { c as A, l as
|
|
7
|
-
import { a as
|
|
6
|
+
import { c as A, l as C, s as M } from "../storage-Co_LbKr_.js";
|
|
7
|
+
import { a as zt } from "../storage-Co_LbKr_.js";
|
|
8
|
+
import { p as oe } from "../api-CbXfbi_s.js";
|
|
8
9
|
import { g as ae } from "../id-BW-g3y32.js";
|
|
9
10
|
import { i as ce } from "../object-JwZ58NOH.js";
|
|
10
|
-
import { s as
|
|
11
|
-
import { e as
|
|
12
|
-
const
|
|
11
|
+
import { s as N, a as T, b as ue, c as de, d as le } from "../supports-8YT4QKI7.js";
|
|
12
|
+
import { e as Mt, f as Ot, g as Dt, h as Ut, i as Vt, j as Nt, k as Tt } from "../supports-8YT4QKI7.js";
|
|
13
|
+
const K = F("experience"), pe = w(
|
|
13
14
|
({ client: t, experience: e }) => {
|
|
14
|
-
const r =
|
|
15
|
-
merge(p,
|
|
15
|
+
const r = K.store(e), s = x(r, {
|
|
16
|
+
merge(p, h) {
|
|
16
17
|
return {
|
|
17
18
|
...p,
|
|
18
|
-
...
|
|
19
|
+
...h.experience
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
22
|
}), i = r.map((p) => ({
|
|
@@ -23,22 +24,22 @@ const W = x("experience"), pe = w(
|
|
|
23
24
|
decisionLogic: p.condition ?? p.decide,
|
|
24
25
|
targetSelectors: p.targets,
|
|
25
26
|
initializeOpenLogic: e.initializeOpen
|
|
26
|
-
})),
|
|
27
|
-
(p) => p.find((
|
|
27
|
+
})), d = t.components.listStore.map(
|
|
28
|
+
(p) => p.find((h) => h.name === `experience:${e.id}`) || p.find((h) => h.name === "experience"),
|
|
28
29
|
{ skipVoid: !1 }
|
|
29
30
|
), o = r.map((p) => ({
|
|
30
31
|
steps: p.steps,
|
|
31
32
|
nodes: p.nodes,
|
|
32
33
|
edges: p.edges,
|
|
33
34
|
conditionals: p.conditionals
|
|
34
|
-
})),
|
|
35
|
+
})), n = r.map((p) => p.fields), l = e.actions ?? [];
|
|
35
36
|
return {
|
|
36
37
|
id: e.id,
|
|
37
38
|
configStore: i,
|
|
38
39
|
treeStore: o,
|
|
39
|
-
fieldsStore:
|
|
40
|
-
componentStore:
|
|
41
|
-
actions:
|
|
40
|
+
fieldsStore: n,
|
|
41
|
+
componentStore: d,
|
|
42
|
+
actions: l,
|
|
42
43
|
merge: s.merge
|
|
43
44
|
};
|
|
44
45
|
}
|
|
@@ -47,61 +48,61 @@ function fe(t) {
|
|
|
47
48
|
return b(pe, t);
|
|
48
49
|
}
|
|
49
50
|
const ge = w(({ client: t }) => {
|
|
50
|
-
const e =
|
|
51
|
-
register(o,
|
|
51
|
+
const e = K.store({}), r = x(e, {
|
|
52
|
+
register(o, n) {
|
|
52
53
|
return {
|
|
53
54
|
...o,
|
|
54
|
-
[
|
|
55
|
+
[n.id]: n
|
|
55
56
|
};
|
|
56
57
|
}
|
|
57
58
|
});
|
|
58
59
|
function s(o) {
|
|
59
|
-
const
|
|
60
|
-
if (
|
|
61
|
-
|
|
60
|
+
const n = e.getState()[o.id];
|
|
61
|
+
if (n) {
|
|
62
|
+
n.merge({ experience: o, strategy: "override" });
|
|
62
63
|
return;
|
|
63
64
|
}
|
|
64
|
-
const
|
|
65
|
-
r.register(
|
|
65
|
+
const l = fe({ client: t, experience: o });
|
|
66
|
+
r.register(l);
|
|
66
67
|
}
|
|
67
68
|
const i = e.map((o) => Object.values(o));
|
|
68
|
-
function
|
|
69
|
-
return e.map((
|
|
69
|
+
function d(o) {
|
|
70
|
+
return e.map((n) => n[o], { skipVoid: !1 });
|
|
70
71
|
}
|
|
71
72
|
return {
|
|
72
73
|
register: s,
|
|
73
|
-
getById:
|
|
74
|
+
getById: d,
|
|
74
75
|
listStore: i
|
|
75
76
|
};
|
|
76
77
|
});
|
|
77
78
|
function me(t) {
|
|
78
79
|
return b(ge, t);
|
|
79
80
|
}
|
|
80
|
-
const
|
|
81
|
+
const he = (t, e) => {
|
|
81
82
|
e.register(t);
|
|
82
|
-
},
|
|
83
|
-
const { targetSelectors: r } = e.configStore.getState(), s =
|
|
83
|
+
}, W = (t, e) => {
|
|
84
|
+
const { targetSelectors: r } = e.configStore.getState(), s = q(r, e.id);
|
|
84
85
|
s.forEach(
|
|
85
|
-
({ elements:
|
|
86
|
-
),
|
|
87
|
-
t.experienceInstances.spawn(e,
|
|
86
|
+
({ elements: d }) => d.forEach((o) => ee(o, e.id))
|
|
87
|
+
), te(s, e.id).forEach((d) => {
|
|
88
|
+
t.experienceInstances.spawn(e, d);
|
|
88
89
|
});
|
|
89
|
-
},
|
|
90
|
+
}, _ = async (t) => {
|
|
90
91
|
await Promise.all(
|
|
91
92
|
t.experiences.listStore.getState().map(async (e) => {
|
|
92
|
-
await
|
|
93
|
+
await ye(t, e) && W(t, e);
|
|
93
94
|
})
|
|
94
95
|
);
|
|
95
|
-
},
|
|
96
|
+
}, ye = async (t, e) => {
|
|
96
97
|
const { decisionLogic: r, targetSelectors: s } = e.configStore.getState();
|
|
97
|
-
return
|
|
98
|
+
return q(s, e.id).length < 1 || s.length === 0 ? !1 : r && re(r) ? await P(t, r) === !0 : !0;
|
|
98
99
|
}, Se = (t, e, r) => {
|
|
99
100
|
const s = e.name, i = e.setup(t);
|
|
100
101
|
if (i) {
|
|
101
|
-
const
|
|
102
|
-
r[s] = Object.freeze({ ...
|
|
102
|
+
const d = r[s] ?? {};
|
|
103
|
+
r[s] = Object.freeze({ ...d, ...i });
|
|
103
104
|
}
|
|
104
|
-
}, ve =
|
|
105
|
+
}, ve = F("component"), ke = w(
|
|
105
106
|
({ client: t, component: e, name: r }) => {
|
|
106
107
|
const s = t.frameworks.getByName(e.frameworkName);
|
|
107
108
|
return {
|
|
@@ -115,59 +116,59 @@ function we(t) {
|
|
|
115
116
|
return b(ke, t);
|
|
116
117
|
}
|
|
117
118
|
const be = w(({ client: t }) => {
|
|
118
|
-
const e = ve.store({}), r =
|
|
119
|
-
register(o,
|
|
119
|
+
const e = ve.store({}), r = x(e, {
|
|
120
|
+
register(o, n) {
|
|
120
121
|
return {
|
|
121
122
|
...o,
|
|
122
|
-
[
|
|
123
|
+
[n.name]: n
|
|
123
124
|
};
|
|
124
125
|
}
|
|
125
126
|
});
|
|
126
|
-
function s(o,
|
|
127
|
+
function s(o, n) {
|
|
127
128
|
e.getState()[o] && k(
|
|
128
129
|
"warn",
|
|
129
130
|
`Component '${o}' already registered. Registering again will override the previous registration.`
|
|
130
131
|
);
|
|
131
|
-
const p = we({ client: t, name: o, component:
|
|
132
|
+
const p = we({ client: t, name: o, component: n });
|
|
132
133
|
r.register(p);
|
|
133
134
|
}
|
|
134
135
|
const i = e.map((o) => Object.values(o));
|
|
135
|
-
function
|
|
136
|
-
return e.map((
|
|
136
|
+
function d(o) {
|
|
137
|
+
return e.map((n) => n[o], { skipVoid: !1 });
|
|
137
138
|
}
|
|
138
139
|
return {
|
|
139
140
|
register: s,
|
|
140
|
-
getByName:
|
|
141
|
+
getByName: d,
|
|
141
142
|
listStore: i
|
|
142
143
|
};
|
|
143
144
|
});
|
|
144
|
-
function
|
|
145
|
+
function Ie(t) {
|
|
145
146
|
return b(be, t);
|
|
146
147
|
}
|
|
147
|
-
const
|
|
148
|
+
const L = (t, e, r) => {
|
|
148
149
|
r.register(t, e);
|
|
149
|
-
},
|
|
150
|
-
const e =
|
|
151
|
-
register(o,
|
|
150
|
+
}, Fe = F("framework"), xe = w(({ client: t }) => {
|
|
151
|
+
const e = Fe.store({}), r = x(e, {
|
|
152
|
+
register(o, n) {
|
|
152
153
|
return {
|
|
153
154
|
...o,
|
|
154
|
-
[
|
|
155
|
+
[n.name]: n.framework
|
|
155
156
|
};
|
|
156
157
|
}
|
|
157
158
|
});
|
|
158
|
-
function s(o,
|
|
159
|
+
function s(o, n) {
|
|
159
160
|
e.getState()[o] && k(
|
|
160
161
|
"warn",
|
|
161
162
|
`Framework '${o}' already registered. Registering again will override the previous registration.`
|
|
162
|
-
), r.register({ name: o, framework:
|
|
163
|
+
), r.register({ name: o, framework: n });
|
|
163
164
|
}
|
|
164
165
|
const i = e.map((o) => Object.values(o));
|
|
165
|
-
function
|
|
166
|
-
return e.map((
|
|
166
|
+
function d(o) {
|
|
167
|
+
return e.map((n) => n[o], { skipVoid: !1 });
|
|
167
168
|
}
|
|
168
169
|
return {
|
|
169
170
|
register: s,
|
|
170
|
-
getByName:
|
|
171
|
+
getByName: d,
|
|
171
172
|
listStore: i
|
|
172
173
|
};
|
|
173
174
|
});
|
|
@@ -176,30 +177,24 @@ function je(t) {
|
|
|
176
177
|
}
|
|
177
178
|
const Ee = (t, e) => {
|
|
178
179
|
e.register(t.name, t);
|
|
179
|
-
}, Pe = 6e3, Ae = A("last_ping", "global"), Be =
|
|
180
|
+
}, Pe = 6e3, Ae = A("last_ping", "global"), Be = async (t) => {
|
|
180
181
|
try {
|
|
181
|
-
const e = Date.now(), r =
|
|
182
|
+
const e = Date.now(), r = C.get(Ae);
|
|
182
183
|
let s = 0;
|
|
183
184
|
if (r.isSet() && (s = r.json() ?? 0), s && e - s < Pe)
|
|
184
185
|
return !0;
|
|
185
|
-
const i =
|
|
186
|
+
const i = {
|
|
186
187
|
projectId: t.projectId,
|
|
187
188
|
path: window.location.pathname
|
|
188
|
-
},
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
p && (
|
|
192
|
-
const S = (await fetch(i, {
|
|
193
|
-
method: "POST",
|
|
194
|
-
headers: a,
|
|
195
|
-
body: o
|
|
196
|
-
})).ok;
|
|
197
|
-
return S && r.set(e), S;
|
|
189
|
+
}, d = {}, n = document.getElementById("picked_script")?.dataset.verceltoken;
|
|
190
|
+
n && (d["x-vercel-protection-bypass"] = n);
|
|
191
|
+
const p = (await oe(t.apiUrl, "ping", i, d)).ok;
|
|
192
|
+
return p && r.set(e), p;
|
|
198
193
|
} catch (e) {
|
|
199
194
|
return k("error", e), !1;
|
|
200
195
|
}
|
|
201
196
|
};
|
|
202
|
-
function
|
|
197
|
+
function Y(t) {
|
|
203
198
|
const e = typeof window < "u", r = {
|
|
204
199
|
client: t,
|
|
205
200
|
responses: t.responses.listStore.getState(),
|
|
@@ -211,147 +206,147 @@ function Q(t) {
|
|
|
211
206
|
};
|
|
212
207
|
return Object.freeze(r);
|
|
213
208
|
}
|
|
214
|
-
const
|
|
215
|
-
const e =
|
|
216
|
-
register(
|
|
209
|
+
const Re = F("predicate"), $e = w(({ client: t }) => {
|
|
210
|
+
const e = Re.store({}), r = x(e, {
|
|
211
|
+
register(n, l) {
|
|
217
212
|
return {
|
|
218
|
-
...
|
|
219
|
-
[
|
|
220
|
-
name:
|
|
221
|
-
predicate:
|
|
213
|
+
...n,
|
|
214
|
+
[l.name]: {
|
|
215
|
+
name: l.name,
|
|
216
|
+
predicate: l.predicate
|
|
222
217
|
}
|
|
223
218
|
};
|
|
224
219
|
}
|
|
225
220
|
});
|
|
226
|
-
function s(
|
|
227
|
-
e.getState()[
|
|
221
|
+
function s(n, l) {
|
|
222
|
+
e.getState()[n] && k(
|
|
228
223
|
"warn",
|
|
229
|
-
`Predicate '${
|
|
230
|
-
), r.register(Object.freeze({ name:
|
|
224
|
+
`Predicate '${n}' already registered. Registering again will override the previous registration.`
|
|
225
|
+
), r.register(Object.freeze({ name: n, predicate: l }));
|
|
231
226
|
}
|
|
232
|
-
const i = e.map((
|
|
233
|
-
function
|
|
234
|
-
return e.map((
|
|
227
|
+
const i = e.map((n) => Object.values(n));
|
|
228
|
+
function d(n) {
|
|
229
|
+
return e.map((l) => l[n]?.predicate, { skipVoid: !1 });
|
|
235
230
|
}
|
|
236
|
-
function o(
|
|
237
|
-
const
|
|
231
|
+
function o(n) {
|
|
232
|
+
const l = V(() => {
|
|
238
233
|
}, {
|
|
239
234
|
skipVoid: !1
|
|
240
235
|
}), p = $(async () => {
|
|
241
|
-
const
|
|
242
|
-
if (!
|
|
236
|
+
const h = d(n).getState();
|
|
237
|
+
if (!h)
|
|
243
238
|
return;
|
|
244
|
-
const
|
|
245
|
-
return (...
|
|
239
|
+
const j = Y(t);
|
|
240
|
+
return (...m) => h({ ...j, args: m });
|
|
246
241
|
});
|
|
247
|
-
return
|
|
242
|
+
return v({
|
|
248
243
|
source: { responses: t.responses.listStore, fields: t.fields.listStore },
|
|
249
244
|
target: p
|
|
250
|
-
}),
|
|
245
|
+
}), v({
|
|
251
246
|
clock: p.doneData,
|
|
252
|
-
filter: (
|
|
253
|
-
target:
|
|
254
|
-
}), p(),
|
|
247
|
+
filter: (h) => h !== void 0,
|
|
248
|
+
target: l
|
|
249
|
+
}), p(), l;
|
|
255
250
|
}
|
|
256
251
|
return {
|
|
257
252
|
register: s,
|
|
258
|
-
getByName:
|
|
253
|
+
getByName: d,
|
|
259
254
|
listStore: i,
|
|
260
255
|
getEvokablePredicate: o
|
|
261
256
|
};
|
|
262
257
|
});
|
|
263
258
|
function ze(t) {
|
|
264
|
-
return b(
|
|
259
|
+
return b($e, t);
|
|
265
260
|
}
|
|
266
261
|
const Ce = (t, e, r) => {
|
|
267
262
|
r.register(t, e);
|
|
268
|
-
},
|
|
269
|
-
const e =
|
|
270
|
-
register(
|
|
263
|
+
}, H = F("feature"), Me = w(({ client: t }) => {
|
|
264
|
+
const e = H.store({}), r = H.store([]), s = x(e, {
|
|
265
|
+
register(a, c) {
|
|
271
266
|
return {
|
|
272
|
-
...
|
|
267
|
+
...a,
|
|
273
268
|
[c.id]: c.feature
|
|
274
269
|
};
|
|
275
270
|
}
|
|
276
271
|
});
|
|
277
|
-
function i(
|
|
278
|
-
e.getState()[
|
|
272
|
+
function i(a, c) {
|
|
273
|
+
e.getState()[a] && k(
|
|
279
274
|
"warn",
|
|
280
|
-
`Feature '${
|
|
275
|
+
`Feature '${a}' already registered. Registering again will override the previous registration.`
|
|
281
276
|
);
|
|
282
277
|
const u = {
|
|
283
|
-
id:
|
|
278
|
+
id: a,
|
|
284
279
|
feature: {
|
|
285
280
|
...c,
|
|
286
|
-
id:
|
|
281
|
+
id: a
|
|
287
282
|
}
|
|
288
283
|
};
|
|
289
284
|
s.register(
|
|
290
285
|
Object.freeze({
|
|
291
|
-
id:
|
|
286
|
+
id: a,
|
|
292
287
|
feature: u
|
|
293
288
|
})
|
|
294
289
|
);
|
|
295
290
|
}
|
|
296
|
-
const
|
|
291
|
+
const d = $(
|
|
297
292
|
async ({
|
|
298
|
-
id:
|
|
293
|
+
id: a,
|
|
299
294
|
key: c,
|
|
300
295
|
storage: f = "local"
|
|
301
296
|
}) => {
|
|
302
|
-
const u = A(`feature:${
|
|
303
|
-
return
|
|
297
|
+
const u = A(`feature:${a}:${c}`, "global"), y = (f === "session" ? M : C).get(u).boolean();
|
|
298
|
+
return y === null ? null : { id: a, key: c, bucket: y, storage: f };
|
|
304
299
|
}
|
|
305
|
-
), o = $((
|
|
306
|
-
if (!
|
|
300
|
+
), o = $((a) => {
|
|
301
|
+
if (!a)
|
|
307
302
|
return null;
|
|
308
|
-
const c = A(`feature:${
|
|
309
|
-
(
|
|
310
|
-
}),
|
|
303
|
+
const c = A(`feature:${a.id}:${a.key}`, "global");
|
|
304
|
+
(a.storage === "session" ? M : C).set(c, a.bucket);
|
|
305
|
+
}), n = /* @__PURE__ */ new Map(), l = Z({
|
|
311
306
|
source: { allFeaturesStore: e, resolvedFeaturesStore: r },
|
|
312
|
-
effect: async ({ allFeaturesStore:
|
|
313
|
-
const
|
|
314
|
-
(R) => R.id === f && R.key ===
|
|
307
|
+
effect: async ({ allFeaturesStore: a, resolvedFeaturesStore: c }, { id: f, decide: u, key: g }) => {
|
|
308
|
+
const y = c.find(
|
|
309
|
+
(R) => R.id === f && R.key === g
|
|
315
310
|
);
|
|
316
|
-
if (
|
|
317
|
-
return
|
|
318
|
-
const
|
|
319
|
-
if (!
|
|
311
|
+
if (y)
|
|
312
|
+
return y;
|
|
313
|
+
const I = a[f];
|
|
314
|
+
if (!I)
|
|
320
315
|
throw new Error(`Feature with id '${f}' not found`);
|
|
321
|
-
const B =
|
|
316
|
+
const B = n.get(`${f}:${g}`);
|
|
322
317
|
if (B !== void 0) {
|
|
323
318
|
const R = await B;
|
|
324
|
-
return { id:
|
|
319
|
+
return { id: I.id, bucket: R, key: g, storage: I.feature.storage };
|
|
325
320
|
}
|
|
326
|
-
const
|
|
327
|
-
|
|
328
|
-
const
|
|
329
|
-
return { id:
|
|
321
|
+
const S = u();
|
|
322
|
+
n.set(`${f}:${g}`, S);
|
|
323
|
+
const X = await S;
|
|
324
|
+
return { id: I.id, bucket: X, key: g, storage: I.feature.storage };
|
|
330
325
|
}
|
|
331
326
|
});
|
|
332
|
-
|
|
327
|
+
v({
|
|
333
328
|
clock: s.register,
|
|
334
|
-
fn: (
|
|
335
|
-
const { id: c, feature: f } =
|
|
329
|
+
fn: (a) => {
|
|
330
|
+
const { id: c, feature: f } = a;
|
|
336
331
|
return { id: c, key: f.feature.key, storage: f.feature.storage };
|
|
337
332
|
},
|
|
338
|
-
target:
|
|
339
|
-
}),
|
|
333
|
+
target: d
|
|
334
|
+
}), v({
|
|
340
335
|
source: e,
|
|
341
|
-
clock:
|
|
342
|
-
fn: (
|
|
343
|
-
const { id: f, bucket: u, storage:
|
|
344
|
-
return
|
|
336
|
+
clock: l.doneData,
|
|
337
|
+
fn: (a, c) => {
|
|
338
|
+
const { id: f, bucket: u, storage: g } = c, y = a[f]?.feature.key;
|
|
339
|
+
return y ? { key: y, id: f, bucket: u, storage: g } : null;
|
|
345
340
|
},
|
|
346
341
|
target: o
|
|
347
342
|
});
|
|
348
|
-
const p =
|
|
343
|
+
const p = D({ allFeaturesStore: e, resolvedFeaturesStore: r }).map(
|
|
349
344
|
({
|
|
350
|
-
allFeaturesStore:
|
|
345
|
+
allFeaturesStore: a,
|
|
351
346
|
resolvedFeaturesStore: c
|
|
352
|
-
}) => Object.values(
|
|
347
|
+
}) => Object.values(a).map((f) => {
|
|
353
348
|
const u = c.find(
|
|
354
|
-
(
|
|
349
|
+
(g) => g.id === f.id && g.key === f.feature.key
|
|
355
350
|
);
|
|
356
351
|
return u ? {
|
|
357
352
|
id: f.id,
|
|
@@ -363,51 +358,51 @@ const Ce = (t, e, r) => {
|
|
|
363
358
|
id: f.id,
|
|
364
359
|
name: f.feature.name,
|
|
365
360
|
key: f.feature.key,
|
|
366
|
-
getBucket: async () => await
|
|
361
|
+
getBucket: async () => await l(f.feature),
|
|
367
362
|
isResolved: !1
|
|
368
363
|
};
|
|
369
364
|
})
|
|
370
365
|
);
|
|
371
|
-
|
|
372
|
-
clock:
|
|
366
|
+
v({
|
|
367
|
+
clock: l.doneData,
|
|
373
368
|
source: { resolvedFeatures: r },
|
|
374
|
-
filter: ({ resolvedFeatures:
|
|
375
|
-
(
|
|
369
|
+
filter: ({ resolvedFeatures: a }, { id: c, key: f }) => !a.some(
|
|
370
|
+
(g) => g.id === c && g.key === f
|
|
376
371
|
),
|
|
377
|
-
fn: (
|
|
378
|
-
target: t.eventBus.prepend((
|
|
372
|
+
fn: (a, c) => c,
|
|
373
|
+
target: t.eventBus.prepend((a) => ({
|
|
379
374
|
type: "feature_decide",
|
|
380
|
-
feature:
|
|
375
|
+
feature: a
|
|
381
376
|
}))
|
|
382
|
-
}),
|
|
383
|
-
clock: [
|
|
377
|
+
}), v({
|
|
378
|
+
clock: [d.doneData, l.doneData],
|
|
384
379
|
source: r,
|
|
385
|
-
fn: (
|
|
380
|
+
fn: (a, c) => !c || a.some(
|
|
386
381
|
(u) => u.id === c.id && u.key === c.key
|
|
387
|
-
) ?
|
|
382
|
+
) ? a : [...a, c],
|
|
388
383
|
target: r
|
|
389
384
|
});
|
|
390
|
-
function
|
|
391
|
-
return p.map((c) => c.find((f) => f.id ===
|
|
385
|
+
function h(a) {
|
|
386
|
+
return p.map((c) => c.find((f) => f.id === a));
|
|
392
387
|
}
|
|
393
|
-
function
|
|
394
|
-
return e.map((c) => c[
|
|
388
|
+
function j(a) {
|
|
389
|
+
return e.map((c) => c[a], { skipVoid: !1 });
|
|
395
390
|
}
|
|
396
|
-
function
|
|
397
|
-
const c =
|
|
391
|
+
function m(a) {
|
|
392
|
+
const c = V(
|
|
398
393
|
async () => {
|
|
399
394
|
},
|
|
400
395
|
{ skipVoid: !1 }
|
|
401
396
|
), f = $(async () => {
|
|
402
|
-
const u =
|
|
397
|
+
const u = h(a).getState();
|
|
403
398
|
if (u)
|
|
404
399
|
return async () => (await u.getBucket()).bucket;
|
|
405
400
|
});
|
|
406
|
-
return
|
|
401
|
+
return v({
|
|
407
402
|
source: r,
|
|
408
|
-
filter: (u) => u.some((
|
|
403
|
+
filter: (u) => u.some((g) => g.id === a),
|
|
409
404
|
target: f
|
|
410
|
-
}),
|
|
405
|
+
}), v({
|
|
411
406
|
clock: f.doneData,
|
|
412
407
|
filter: (u) => u !== void 0,
|
|
413
408
|
target: c
|
|
@@ -415,18 +410,18 @@ const Ce = (t, e, r) => {
|
|
|
415
410
|
}
|
|
416
411
|
return {
|
|
417
412
|
register: i,
|
|
418
|
-
getById:
|
|
419
|
-
getByName:
|
|
413
|
+
getById: h,
|
|
414
|
+
getByName: j,
|
|
420
415
|
listStore: p,
|
|
421
|
-
getEvokableFeature:
|
|
416
|
+
getEvokableFeature: m
|
|
422
417
|
};
|
|
423
418
|
});
|
|
424
|
-
function
|
|
419
|
+
function Oe(t) {
|
|
425
420
|
return b(Me, t);
|
|
426
421
|
}
|
|
427
|
-
const
|
|
422
|
+
const De = (t, e, r) => {
|
|
428
423
|
r.register(t, e);
|
|
429
|
-
},
|
|
424
|
+
}, E = F("history");
|
|
430
425
|
function G(t, e) {
|
|
431
426
|
return {
|
|
432
427
|
// eslint-disable-next-line sonarjs/pseudo-random
|
|
@@ -436,32 +431,32 @@ function G(t, e) {
|
|
|
436
431
|
experienceId: t
|
|
437
432
|
};
|
|
438
433
|
}
|
|
439
|
-
const
|
|
440
|
-
const t =
|
|
441
|
-
t.on(e, (o,
|
|
442
|
-
entries: [...o.entries, G(
|
|
443
|
-
})), t.on(r, (o,
|
|
434
|
+
const Ue = w(() => {
|
|
435
|
+
const t = E.store({ entries: [] }), e = E.event(), r = E.event(), s = E.event(), i = E.event();
|
|
436
|
+
t.on(e, (o, n) => ({
|
|
437
|
+
entries: [...o.entries, G(n.experienceId, n.node)]
|
|
438
|
+
})), t.on(r, (o, n) => ({
|
|
444
439
|
entries: [
|
|
445
440
|
...o.entries.slice(0, -1),
|
|
446
|
-
G(
|
|
441
|
+
G(n.experienceId, n.node)
|
|
447
442
|
]
|
|
448
|
-
})), t.on(i, (o,
|
|
449
|
-
function
|
|
450
|
-
const
|
|
443
|
+
})), t.on(i, (o, n) => n);
|
|
444
|
+
function d(o, n) {
|
|
445
|
+
const l = { lastStepIndex: -1, secondLastStepIndex: -1 };
|
|
451
446
|
for (let p = o.length - 1; p >= 0; p--) {
|
|
452
|
-
const
|
|
453
|
-
if (!(!
|
|
454
|
-
if (
|
|
455
|
-
|
|
447
|
+
const h = o[p], j = h?.node;
|
|
448
|
+
if (!(!j || !se(j)) && !(n && h?.experienceId !== n))
|
|
449
|
+
if (l.lastStepIndex === -1)
|
|
450
|
+
l.lastStepIndex = p;
|
|
456
451
|
else {
|
|
457
|
-
|
|
452
|
+
l.secondLastStepIndex = p;
|
|
458
453
|
break;
|
|
459
454
|
}
|
|
460
455
|
}
|
|
461
|
-
return
|
|
456
|
+
return l;
|
|
462
457
|
}
|
|
463
|
-
return t.on(s, (o,
|
|
464
|
-
const { secondLastStepIndex:
|
|
458
|
+
return t.on(s, (o, n) => {
|
|
459
|
+
const { secondLastStepIndex: l } = d(o.entries, n.experienceId), p = l !== -1 ? o.entries.slice(0, l + 1) : o.entries;
|
|
465
460
|
return {
|
|
466
461
|
...o,
|
|
467
462
|
entries: p
|
|
@@ -474,109 +469,90 @@ const Ne = w(() => {
|
|
|
474
469
|
entriesStore: t.map((o) => o.entries)
|
|
475
470
|
};
|
|
476
471
|
});
|
|
477
|
-
function
|
|
478
|
-
return b(
|
|
472
|
+
function Ve() {
|
|
473
|
+
return b(Ue);
|
|
479
474
|
}
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
475
|
+
let Ne = 0;
|
|
476
|
+
const Te = (t) => {
|
|
477
|
+
const e = V([]);
|
|
478
|
+
return v({
|
|
479
|
+
clock: t,
|
|
480
|
+
source: e,
|
|
481
|
+
fn: (r, s) => [
|
|
482
|
+
...r,
|
|
483
|
+
{
|
|
484
|
+
id: Ne++,
|
|
485
|
+
at: /* @__PURE__ */ new Date(),
|
|
486
|
+
payload: s
|
|
487
|
+
}
|
|
488
|
+
],
|
|
489
|
+
target: e
|
|
490
|
+
}), e;
|
|
491
|
+
}, _e = F("field"), Le = w(() => {
|
|
492
|
+
const t = _e.store({}), e = x(t, {
|
|
493
|
+
register(n, l) {
|
|
483
494
|
return {
|
|
484
|
-
...
|
|
485
|
-
[
|
|
495
|
+
...n,
|
|
496
|
+
[l.field.id]: l.field
|
|
486
497
|
};
|
|
487
498
|
}
|
|
488
499
|
});
|
|
489
|
-
function
|
|
490
|
-
|
|
500
|
+
function r(n) {
|
|
501
|
+
e.register({ field: n });
|
|
491
502
|
}
|
|
492
|
-
function
|
|
493
|
-
const
|
|
494
|
-
if (!
|
|
503
|
+
function s(n, l) {
|
|
504
|
+
const p = d(n).getState();
|
|
505
|
+
if (!p)
|
|
495
506
|
return;
|
|
496
|
-
const
|
|
497
|
-
...
|
|
507
|
+
const h = Object.assign({}, p, {
|
|
508
|
+
...l
|
|
498
509
|
});
|
|
499
|
-
|
|
510
|
+
e.register({ field: { ...h } });
|
|
500
511
|
}
|
|
501
|
-
const
|
|
502
|
-
function
|
|
503
|
-
return
|
|
504
|
-
}
|
|
505
|
-
function a(d) {
|
|
506
|
-
return e.map((n) => Object.values(n).find((c) => c.name === d) || null);
|
|
507
|
-
}
|
|
508
|
-
const g = M.store({}), p = M.effect(
|
|
509
|
-
async (d) => {
|
|
510
|
-
const n = o(d).getState();
|
|
511
|
-
if (!n || n.options == null)
|
|
512
|
-
return { fieldId: d, options: null };
|
|
513
|
-
if (typeof n.options != "function")
|
|
514
|
-
return { fieldId: d, options: n.options };
|
|
515
|
-
if (!t)
|
|
516
|
-
return { fieldId: d, options: null };
|
|
517
|
-
const c = t.responses.listStore.getState(), f = {};
|
|
518
|
-
for (const m of c)
|
|
519
|
-
m.value !== void 0 && (f[m.fieldId] = m.value);
|
|
520
|
-
const u = await Promise.resolve(n.options({ responses: f }));
|
|
521
|
-
return { fieldId: d, options: u };
|
|
522
|
-
}
|
|
523
|
-
);
|
|
524
|
-
g.on(p, (d, n) => ({
|
|
525
|
-
...d,
|
|
526
|
-
[n]: { status: "loading", options: null }
|
|
527
|
-
})), g.on(p.doneData, (d, { fieldId: n, options: c }) => ({
|
|
528
|
-
...d,
|
|
529
|
-
[n]: { status: "resolved", options: c }
|
|
530
|
-
})), g.on(p.fail, (d, { params: n }) => ({
|
|
531
|
-
...d,
|
|
532
|
-
[n]: { status: "error", options: null, error: "Failed to resolve field options" }
|
|
533
|
-
}));
|
|
534
|
-
function y(d) {
|
|
535
|
-
const n = g.getState()[d];
|
|
536
|
-
n && n.status !== "idle" || p(d);
|
|
512
|
+
const i = t.map((n) => Object.values(n));
|
|
513
|
+
function d(n) {
|
|
514
|
+
return t.map((l) => l[n] || null);
|
|
537
515
|
}
|
|
538
|
-
function
|
|
539
|
-
return
|
|
516
|
+
function o(n) {
|
|
517
|
+
return t.map((l) => Object.values(l).find((p) => p.name === n) || null);
|
|
540
518
|
}
|
|
541
519
|
return {
|
|
542
|
-
register:
|
|
543
|
-
update:
|
|
544
|
-
getById:
|
|
545
|
-
listStore:
|
|
546
|
-
getByName:
|
|
547
|
-
resolve: y,
|
|
548
|
-
getByFieldId: S
|
|
520
|
+
register: r,
|
|
521
|
+
update: s,
|
|
522
|
+
getById: d,
|
|
523
|
+
listStore: i,
|
|
524
|
+
getByName: o
|
|
549
525
|
};
|
|
550
526
|
});
|
|
551
|
-
function
|
|
552
|
-
return b(Le
|
|
527
|
+
function He() {
|
|
528
|
+
return b(Le);
|
|
553
529
|
}
|
|
554
|
-
const
|
|
530
|
+
const Ge = (t, e) => {
|
|
555
531
|
e.register(t);
|
|
556
|
-
},
|
|
557
|
-
const t =
|
|
558
|
-
register(o,
|
|
532
|
+
}, Je = F("action"), qe = w(() => {
|
|
533
|
+
const t = Je.store({}), e = x(t, {
|
|
534
|
+
register(o, n) {
|
|
559
535
|
return {
|
|
560
536
|
...o,
|
|
561
|
-
[
|
|
562
|
-
name:
|
|
563
|
-
action:
|
|
537
|
+
[n.name]: {
|
|
538
|
+
name: n.name,
|
|
539
|
+
action: n.action
|
|
564
540
|
}
|
|
565
541
|
};
|
|
566
542
|
}
|
|
567
543
|
});
|
|
568
|
-
function r(o,
|
|
569
|
-
e.register({ name: o, action:
|
|
544
|
+
function r(o, n) {
|
|
545
|
+
e.register({ name: o, action: n });
|
|
570
546
|
}
|
|
571
547
|
const s = t.map((o) => Object.values(o));
|
|
572
548
|
function i(o) {
|
|
573
|
-
return t.map((
|
|
549
|
+
return t.map((n) => n[o], { skipVoid: !1 });
|
|
574
550
|
}
|
|
575
|
-
function
|
|
551
|
+
function d(o) {
|
|
576
552
|
return t.map(
|
|
577
|
-
(
|
|
578
|
-
const
|
|
579
|
-
return
|
|
553
|
+
(n) => {
|
|
554
|
+
const l = n[o];
|
|
555
|
+
return l ? l.action : void 0;
|
|
580
556
|
},
|
|
581
557
|
{ skipVoid: !1 }
|
|
582
558
|
);
|
|
@@ -585,66 +561,66 @@ const Je = (t, e) => {
|
|
|
585
561
|
register: r,
|
|
586
562
|
getByName: i,
|
|
587
563
|
listStore: s,
|
|
588
|
-
getEvokableAction:
|
|
564
|
+
getEvokableAction: d
|
|
589
565
|
};
|
|
590
566
|
});
|
|
591
|
-
function
|
|
592
|
-
return b(
|
|
567
|
+
function Ke() {
|
|
568
|
+
return b(qe);
|
|
593
569
|
}
|
|
594
|
-
const
|
|
570
|
+
const We = (t, e, r) => {
|
|
595
571
|
r.register(t, e);
|
|
596
572
|
};
|
|
597
|
-
function
|
|
573
|
+
function O(t) {
|
|
598
574
|
return typeof t > "u" || t === null || t === "" || Array.isArray(t) && !t.length;
|
|
599
575
|
}
|
|
600
|
-
function
|
|
576
|
+
function Ye(t) {
|
|
601
577
|
return typeof t == "string" || typeof t == "number" || typeof t == "boolean" || t === null;
|
|
602
578
|
}
|
|
603
|
-
function
|
|
579
|
+
function J(t) {
|
|
604
580
|
try {
|
|
605
581
|
return JSON.stringify(t), !0;
|
|
606
582
|
} catch {
|
|
607
583
|
return !1;
|
|
608
584
|
}
|
|
609
585
|
}
|
|
610
|
-
const
|
|
611
|
-
const e =
|
|
612
|
-
register(
|
|
586
|
+
const Qe = F("response"), Xe = w(({ client: t }) => {
|
|
587
|
+
const e = Qe.store({}), r = U(), s = U(), i = x(e, {
|
|
588
|
+
register(m, a) {
|
|
613
589
|
return {
|
|
614
|
-
...
|
|
615
|
-
[
|
|
590
|
+
...m,
|
|
591
|
+
[a.fieldId]: a.response
|
|
616
592
|
};
|
|
617
593
|
},
|
|
618
|
-
registerBatch(
|
|
594
|
+
registerBatch(m, a) {
|
|
619
595
|
return {
|
|
620
|
-
...
|
|
621
|
-
...
|
|
596
|
+
...m,
|
|
597
|
+
...a
|
|
622
598
|
};
|
|
623
599
|
},
|
|
624
|
-
clear(
|
|
625
|
-
const { [
|
|
600
|
+
clear(m, a) {
|
|
601
|
+
const { [a]: c, ...f } = m;
|
|
626
602
|
return f;
|
|
627
603
|
},
|
|
628
604
|
clearAll() {
|
|
629
605
|
return {};
|
|
630
606
|
}
|
|
631
607
|
});
|
|
632
|
-
function
|
|
633
|
-
if (typeof
|
|
634
|
-
if (
|
|
608
|
+
function d(m, a) {
|
|
609
|
+
if (typeof m == "string") {
|
|
610
|
+
if (a === void 0)
|
|
635
611
|
throw new Error("Response is required when registering a single field");
|
|
636
|
-
i.register({ fieldId:
|
|
612
|
+
i.register({ fieldId: m, response: a });
|
|
637
613
|
} else
|
|
638
|
-
i.registerBatch(
|
|
614
|
+
i.registerBatch(m);
|
|
639
615
|
}
|
|
640
|
-
async function o(
|
|
641
|
-
const
|
|
616
|
+
async function o(m) {
|
|
617
|
+
const a = [];
|
|
642
618
|
return await Promise.allSettled(
|
|
643
|
-
Object.entries(
|
|
619
|
+
Object.entries(m).map(async ([c, f]) => {
|
|
644
620
|
let u = f;
|
|
645
|
-
const
|
|
646
|
-
if (!
|
|
647
|
-
|
|
621
|
+
const g = t.fields.getById(c).getState();
|
|
622
|
+
if (!g) {
|
|
623
|
+
a.push({
|
|
648
624
|
fieldId: c,
|
|
649
625
|
userMessage: `Field '${c}' not found`,
|
|
650
626
|
systemMessage: `No field with ID '${c}' exists. Available field IDs are: ${Object.keys(t.fields.listStore.getState()).join(",")}.`,
|
|
@@ -652,21 +628,21 @@ const Ye = x("response"), Qe = w(({ client: t }) => {
|
|
|
652
628
|
});
|
|
653
629
|
return;
|
|
654
630
|
}
|
|
655
|
-
if (
|
|
656
|
-
const
|
|
631
|
+
if (g.multiple && (typeof u == "string" || typeof u == "number" || typeof u == "boolean") && (u = [u]), g.validation && !ce(g.validation) && !O(u)) {
|
|
632
|
+
const y = await P(t, g.validation, {
|
|
657
633
|
$input: u
|
|
658
634
|
});
|
|
659
|
-
if (typeof
|
|
660
|
-
|
|
635
|
+
if (typeof y == "string") {
|
|
636
|
+
a.push({
|
|
661
637
|
fieldId: c,
|
|
662
|
-
userMessage:
|
|
663
|
-
systemMessage: `Field validation resulted in an error: ${
|
|
638
|
+
userMessage: y,
|
|
639
|
+
systemMessage: `Field validation resulted in an error: ${y}.`,
|
|
664
640
|
value: u
|
|
665
641
|
});
|
|
666
642
|
return;
|
|
667
643
|
}
|
|
668
|
-
if (
|
|
669
|
-
|
|
644
|
+
if (y === !1) {
|
|
645
|
+
a.push({
|
|
670
646
|
fieldId: c,
|
|
671
647
|
userMessage: "This field is invalid",
|
|
672
648
|
systemMessage: "Field validation resulted in an unspecified error.",
|
|
@@ -675,8 +651,8 @@ const Ye = x("response"), Qe = w(({ client: t }) => {
|
|
|
675
651
|
return;
|
|
676
652
|
}
|
|
677
653
|
}
|
|
678
|
-
if (
|
|
679
|
-
|
|
654
|
+
if (g.required && O(u)) {
|
|
655
|
+
a.push({
|
|
680
656
|
fieldId: c,
|
|
681
657
|
userMessage: "This field is required",
|
|
682
658
|
systemMessage: "Field is required.",
|
|
@@ -684,8 +660,8 @@ const Ye = x("response"), Qe = w(({ client: t }) => {
|
|
|
684
660
|
});
|
|
685
661
|
return;
|
|
686
662
|
}
|
|
687
|
-
if (!
|
|
688
|
-
|
|
663
|
+
if (!g.multiple && Array.isArray(u) && u.length > 1) {
|
|
664
|
+
a.push({
|
|
689
665
|
fieldId: c,
|
|
690
666
|
userMessage: "This field expects a single response",
|
|
691
667
|
systemMessage: "Field expects a single response.",
|
|
@@ -693,10 +669,10 @@ const Ye = x("response"), Qe = w(({ client: t }) => {
|
|
|
693
669
|
});
|
|
694
670
|
return;
|
|
695
671
|
}
|
|
696
|
-
if (
|
|
697
|
-
if (
|
|
672
|
+
if (g.type === "object" && !O(u))
|
|
673
|
+
if (g.multiple) {
|
|
698
674
|
if (!Array.isArray(u)) {
|
|
699
|
-
|
|
675
|
+
a.push({
|
|
700
676
|
fieldId: c,
|
|
701
677
|
userMessage: "This field expects multiple values",
|
|
702
678
|
systemMessage: "Field expects an array of objects.",
|
|
@@ -704,9 +680,9 @@ const Ye = x("response"), Qe = w(({ client: t }) => {
|
|
|
704
680
|
});
|
|
705
681
|
return;
|
|
706
682
|
}
|
|
707
|
-
for (const
|
|
708
|
-
if (typeof
|
|
709
|
-
|
|
683
|
+
for (const y of u) {
|
|
684
|
+
if (typeof y != "object" || y === null) {
|
|
685
|
+
a.push({
|
|
710
686
|
fieldId: c,
|
|
711
687
|
userMessage: "This field expects object values",
|
|
712
688
|
systemMessage: "Field expects an array of objects, but received non-object value.",
|
|
@@ -714,8 +690,8 @@ const Ye = x("response"), Qe = w(({ client: t }) => {
|
|
|
714
690
|
});
|
|
715
691
|
return;
|
|
716
692
|
}
|
|
717
|
-
if (!
|
|
718
|
-
|
|
693
|
+
if (!J(y)) {
|
|
694
|
+
a.push({
|
|
719
695
|
fieldId: c,
|
|
720
696
|
userMessage: "This field contains non-serializable data",
|
|
721
697
|
systemMessage: "Field value contains non-JSON-serializable data (functions, circular references, etc.).",
|
|
@@ -726,7 +702,7 @@ const Ye = x("response"), Qe = w(({ client: t }) => {
|
|
|
726
702
|
}
|
|
727
703
|
} else {
|
|
728
704
|
if (Array.isArray(u)) {
|
|
729
|
-
|
|
705
|
+
a.push({
|
|
730
706
|
fieldId: c,
|
|
731
707
|
userMessage: "This field expects a single value",
|
|
732
708
|
systemMessage: "Field expects a single object, not an array.",
|
|
@@ -735,7 +711,7 @@ const Ye = x("response"), Qe = w(({ client: t }) => {
|
|
|
735
711
|
return;
|
|
736
712
|
}
|
|
737
713
|
if (typeof u != "object" || u === null) {
|
|
738
|
-
|
|
714
|
+
a.push({
|
|
739
715
|
fieldId: c,
|
|
740
716
|
userMessage: "This field expects an object value",
|
|
741
717
|
systemMessage: "Field expects an object value.",
|
|
@@ -743,8 +719,8 @@ const Ye = x("response"), Qe = w(({ client: t }) => {
|
|
|
743
719
|
});
|
|
744
720
|
return;
|
|
745
721
|
}
|
|
746
|
-
if (!
|
|
747
|
-
|
|
722
|
+
if (!J(u)) {
|
|
723
|
+
a.push({
|
|
748
724
|
fieldId: c,
|
|
749
725
|
userMessage: "This field contains non-serializable data",
|
|
750
726
|
systemMessage: "Field value contains non-JSON-serializable data (functions, circular references, etc.).",
|
|
@@ -753,72 +729,72 @@ const Ye = x("response"), Qe = w(({ client: t }) => {
|
|
|
753
729
|
return;
|
|
754
730
|
}
|
|
755
731
|
}
|
|
756
|
-
if (
|
|
757
|
-
const
|
|
758
|
-
if (
|
|
759
|
-
const
|
|
760
|
-
|
|
732
|
+
if (g.options) {
|
|
733
|
+
const y = Array.isArray(u) ? u : [u];
|
|
734
|
+
if (g.type === "object") {
|
|
735
|
+
const I = g.options.map((S) => JSON.stringify(S.value));
|
|
736
|
+
y.every((S) => I.includes(JSON.stringify(S))) || a.push({
|
|
761
737
|
fieldId: c,
|
|
762
738
|
userMessage: "This field expects a valid option",
|
|
763
739
|
systemMessage: "Field expects a valid option from the defined choices.",
|
|
764
740
|
value: u
|
|
765
741
|
});
|
|
766
742
|
} else {
|
|
767
|
-
const
|
|
768
|
-
|
|
743
|
+
const I = g.options.map((S) => S.value);
|
|
744
|
+
y.every((S) => !Ye(S) || S === null ? !1 : I.includes(S)) || a.push({
|
|
769
745
|
fieldId: c,
|
|
770
746
|
userMessage: "This field expects a valid option",
|
|
771
|
-
systemMessage: `Field expects a valid option. Valid options are: ${
|
|
747
|
+
systemMessage: `Field expects a valid option. Valid options are: ${I.join(", ")}`,
|
|
772
748
|
value: u
|
|
773
749
|
});
|
|
774
750
|
}
|
|
775
751
|
}
|
|
776
752
|
})
|
|
777
|
-
), { responsesToCommit:
|
|
753
|
+
), { responsesToCommit: m, validationErrors: a };
|
|
778
754
|
}
|
|
779
|
-
async function
|
|
780
|
-
const { responsesToCommit:
|
|
781
|
-
return c.length ? { errors: c } : (i.registerBatch(
|
|
755
|
+
async function n(m) {
|
|
756
|
+
const { responsesToCommit: a, validationErrors: c } = await o(m);
|
|
757
|
+
return c.length ? { errors: c } : (i.registerBatch(a), { errors: [] });
|
|
782
758
|
}
|
|
783
|
-
const
|
|
759
|
+
const l = e.map((m) => m), p = e.map((m) => Object.keys(m).map((c) => ({
|
|
784
760
|
fieldId: c,
|
|
785
|
-
value:
|
|
761
|
+
value: m[c]
|
|
786
762
|
})));
|
|
787
|
-
function
|
|
788
|
-
const
|
|
789
|
-
return
|
|
763
|
+
function h(m) {
|
|
764
|
+
const a = t.fields.getById(m), c = e.map((f) => f[m] || null);
|
|
765
|
+
return D({ f: a, r: c }, ({ f, r: u }) => u || (f?.defaultValue ? f.defaultValue : null));
|
|
790
766
|
}
|
|
791
|
-
function
|
|
792
|
-
const
|
|
793
|
-
return
|
|
767
|
+
function j(m) {
|
|
768
|
+
const a = t.fields.getByName(m);
|
|
769
|
+
return D({ f: a, s: e }, ({ f: c, s: f }) => {
|
|
794
770
|
const u = c && f[c.id] || null;
|
|
795
771
|
return u || (c?.defaultValue ? c.defaultValue : null);
|
|
796
772
|
});
|
|
797
773
|
}
|
|
798
|
-
return
|
|
774
|
+
return v({
|
|
799
775
|
clock: r,
|
|
800
776
|
target: i.clearAll
|
|
801
|
-
}),
|
|
777
|
+
}), v({
|
|
802
778
|
clock: s,
|
|
803
779
|
target: i.clear
|
|
804
780
|
}), {
|
|
805
|
-
register:
|
|
781
|
+
register: d,
|
|
806
782
|
clearAll: r,
|
|
807
783
|
clear: s,
|
|
808
|
-
commit:
|
|
784
|
+
commit: n,
|
|
809
785
|
getResponsesToCommit: o,
|
|
810
786
|
listStore: p,
|
|
811
|
-
getAllStore:
|
|
812
|
-
getByFieldId:
|
|
813
|
-
getByFieldName:
|
|
787
|
+
getAllStore: l,
|
|
788
|
+
getByFieldId: h,
|
|
789
|
+
getByFieldName: j
|
|
814
790
|
};
|
|
815
791
|
});
|
|
816
|
-
function
|
|
817
|
-
return b(
|
|
792
|
+
function Ze(t) {
|
|
793
|
+
return b(Xe, t);
|
|
818
794
|
}
|
|
819
|
-
const
|
|
820
|
-
function
|
|
821
|
-
if (
|
|
795
|
+
const et = () => "0.0.1-dev.1771901344537";
|
|
796
|
+
function tt() {
|
|
797
|
+
if (N()) {
|
|
822
798
|
const t = [
|
|
823
799
|
document.currentScript,
|
|
824
800
|
document.getElementById("picked_script"),
|
|
@@ -832,34 +808,34 @@ function et() {
|
|
|
832
808
|
}
|
|
833
809
|
return "https://api.picked.app";
|
|
834
810
|
}
|
|
835
|
-
function
|
|
836
|
-
if (!
|
|
811
|
+
function rt() {
|
|
812
|
+
if (!T())
|
|
837
813
|
return {};
|
|
838
814
|
const t = new URLSearchParams(window.location.search), e = {}, r = /* @__PURE__ */ new Set();
|
|
839
815
|
for (const [i] of t.entries())
|
|
840
816
|
i.startsWith("picked-") && r.add(i);
|
|
841
817
|
for (const i of r) {
|
|
842
|
-
const
|
|
843
|
-
e[
|
|
818
|
+
const d = i.replace("picked-", "");
|
|
819
|
+
e[d] = t.getAll(i);
|
|
844
820
|
}
|
|
845
821
|
const s = A("s");
|
|
846
822
|
if (r.size > 0)
|
|
847
|
-
|
|
823
|
+
M.set(s, e);
|
|
848
824
|
else {
|
|
849
|
-
const i =
|
|
825
|
+
const i = M.get(s);
|
|
850
826
|
if (i)
|
|
851
827
|
return i.json() || {};
|
|
852
828
|
}
|
|
853
829
|
return e;
|
|
854
830
|
}
|
|
855
|
-
function
|
|
831
|
+
function st() {
|
|
856
832
|
if (de())
|
|
857
833
|
return crypto.randomUUID();
|
|
858
834
|
const t = Date.now().toString(36), e = Math.random().toString(36).substring(2, 15), r = Math.random().toString(36).substring(2, 15), s = Math.random().toString(36).substring(2, 15);
|
|
859
835
|
return `${t}-${e}-${r}-${s}`;
|
|
860
836
|
}
|
|
861
|
-
const
|
|
862
|
-
const t =
|
|
837
|
+
const nt = A("session", "global"), it = () => {
|
|
838
|
+
const t = C.get(nt);
|
|
863
839
|
let e;
|
|
864
840
|
t.isSet() && (e = t.json());
|
|
865
841
|
const r = (i) => t.set({
|
|
@@ -867,35 +843,35 @@ const st = A("session", "global"), nt = () => {
|
|
|
867
843
|
isUser: i.isUser,
|
|
868
844
|
identifiers: i.identifiers
|
|
869
845
|
}), s = {
|
|
870
|
-
id: e?.id ??
|
|
846
|
+
id: e?.id ?? st(),
|
|
871
847
|
isUser: e?.isUser ?? void 0,
|
|
872
848
|
identifiers: e?.identifiers ?? void 0,
|
|
873
849
|
setIsUser(i) {
|
|
874
850
|
this.isUser = i, r(this);
|
|
875
851
|
},
|
|
876
|
-
setIdentifier(i,
|
|
877
|
-
this.identifiers = { ...this.identifiers, [i]:
|
|
852
|
+
setIdentifier(i, d) {
|
|
853
|
+
this.identifiers = { ...this.identifiers, [i]: d }, r(this);
|
|
878
854
|
},
|
|
879
855
|
removeIdentifier(i) {
|
|
880
856
|
this.identifiers && (this.identifiers = Object.fromEntries(
|
|
881
|
-
Object.entries(this.identifiers).filter(([
|
|
857
|
+
Object.entries(this.identifiers).filter(([d]) => d !== i)
|
|
882
858
|
), this.identifiers = Object.keys(this.identifiers).length ? this.identifiers : void 0, r(this));
|
|
883
859
|
}
|
|
884
860
|
};
|
|
885
861
|
return r(s), s;
|
|
886
|
-
},
|
|
887
|
-
function
|
|
888
|
-
if (
|
|
862
|
+
}, ot = () => ue() ? it() : null;
|
|
863
|
+
function at() {
|
|
864
|
+
if (T())
|
|
889
865
|
return globalThis.window.pickedConfig;
|
|
890
866
|
}
|
|
891
|
-
function
|
|
892
|
-
if (!
|
|
867
|
+
function ct() {
|
|
868
|
+
if (!T())
|
|
893
869
|
return;
|
|
894
|
-
const t =
|
|
870
|
+
const t = at(), e = t?.organizationId, r = t?.projectId;
|
|
895
871
|
return e && r ? { organizationId: e, projectId: r } : void 0;
|
|
896
872
|
}
|
|
897
|
-
function
|
|
898
|
-
if (!
|
|
873
|
+
function ut() {
|
|
874
|
+
if (!N())
|
|
899
875
|
return;
|
|
900
876
|
const t = document.getElementById("picked_script") || document.querySelector("script#picked") || // legacy support for 'cvly' script tag
|
|
901
877
|
document.getElementById("cvly");
|
|
@@ -904,14 +880,14 @@ function ct() {
|
|
|
904
880
|
const e = t.dataset.organizationid || t.getAttribute("organization-id"), r = t.dataset.projectid || t.getAttribute("project-id");
|
|
905
881
|
return e && r ? { organizationId: e, projectId: r } : void 0;
|
|
906
882
|
}
|
|
907
|
-
function
|
|
883
|
+
function dt(t) {
|
|
908
884
|
const { organizationId: e, projectId: r } = t;
|
|
909
885
|
if (e && r)
|
|
910
886
|
return { organizationId: e, projectId: r };
|
|
911
|
-
const s =
|
|
887
|
+
const s = ct();
|
|
912
888
|
if (s)
|
|
913
889
|
return s;
|
|
914
|
-
const i =
|
|
890
|
+
const i = ut();
|
|
915
891
|
if (i)
|
|
916
892
|
return i;
|
|
917
893
|
throw new Error(
|
|
@@ -921,13 +897,13 @@ function ut(t) {
|
|
|
921
897
|
(3) a <script> tag with id 'picked_script', 'picked', or 'cvly' that includes data-organizationid/data-projectid (or organization-id/project-id) attributes.`
|
|
922
898
|
);
|
|
923
899
|
}
|
|
924
|
-
function
|
|
900
|
+
function z(t) {
|
|
925
901
|
return t == null || t === "" || Number.isNaN(t);
|
|
926
902
|
}
|
|
927
|
-
const
|
|
928
|
-
default: (t, e) =>
|
|
929
|
-
append: (t, e) => e && !
|
|
930
|
-
prepend: (t, e) => e && !
|
|
903
|
+
const lt = {
|
|
904
|
+
default: (t, e) => z(t) ? String(e ?? "") : String(t),
|
|
905
|
+
append: (t, e) => e && !z(t) ? `${t} ${e}` : t,
|
|
906
|
+
prepend: (t, e) => e && !z(t) ? `${e} ${t}` : t,
|
|
931
907
|
upper: (t) => typeof t == "string" ? t.toUpperCase() : t,
|
|
932
908
|
lower: (t) => typeof t == "string" ? t.toLowerCase() : t,
|
|
933
909
|
capitalize: (t) => typeof t == "string" ? t.charAt(0).toUpperCase() + t.slice(1) : t,
|
|
@@ -944,28 +920,28 @@ const dt = {
|
|
|
944
920
|
return t instanceof Set ? e.format(Array.from(t).map(String)) : t;
|
|
945
921
|
}
|
|
946
922
|
};
|
|
947
|
-
function
|
|
923
|
+
function pt(t) {
|
|
948
924
|
return typeof t == "object" && t !== null;
|
|
949
925
|
}
|
|
950
|
-
function
|
|
926
|
+
function ft(t, e) {
|
|
951
927
|
let r = e;
|
|
952
928
|
for (const s of t.split("."))
|
|
953
|
-
if (
|
|
929
|
+
if (pt(r) && s in r)
|
|
954
930
|
r = r[s];
|
|
955
931
|
else
|
|
956
932
|
return;
|
|
957
933
|
return typeof r == "function" ? r() : r;
|
|
958
934
|
}
|
|
959
|
-
function
|
|
960
|
-
const r = t.split("|").map((
|
|
961
|
-
let i =
|
|
962
|
-
for (const
|
|
963
|
-
const [o, ...
|
|
964
|
-
|
|
935
|
+
function gt(t, e) {
|
|
936
|
+
const r = t.split("|").map((d) => d.trim()), s = r.shift() ?? "";
|
|
937
|
+
let i = ft(s, e);
|
|
938
|
+
for (const d of r) {
|
|
939
|
+
const [o, ...n] = d.split(":"), l = o?.trim() ?? "", p = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), h = lt[l];
|
|
940
|
+
h && (i = h(i, p));
|
|
965
941
|
}
|
|
966
|
-
return
|
|
942
|
+
return z(i) ? "" : typeof i == "object" ? JSON.stringify(i) : String(i);
|
|
967
943
|
}
|
|
968
|
-
function
|
|
944
|
+
function mt(t, e) {
|
|
969
945
|
let r = "", s = 0;
|
|
970
946
|
for (; s < t.length; )
|
|
971
947
|
if (t[s] === "{" && t[s + 1] === "{") {
|
|
@@ -978,98 +954,105 @@ function gt(t, e) {
|
|
|
978
954
|
}
|
|
979
955
|
i += t[s++];
|
|
980
956
|
}
|
|
981
|
-
r +=
|
|
957
|
+
r += gt(i.trim(), e);
|
|
982
958
|
} else
|
|
983
959
|
r += t[s++];
|
|
984
960
|
return r;
|
|
985
961
|
}
|
|
986
|
-
class
|
|
962
|
+
class ht {
|
|
987
963
|
static logger = k;
|
|
988
964
|
options;
|
|
989
965
|
isReady = !1;
|
|
990
966
|
project;
|
|
991
967
|
plugins = {};
|
|
992
|
-
|
|
968
|
+
pluginStartHooks = [];
|
|
969
|
+
eventBus = U();
|
|
970
|
+
events;
|
|
993
971
|
organizationId;
|
|
994
972
|
projectId;
|
|
995
973
|
apiUrl;
|
|
974
|
+
dashboardUrl;
|
|
975
|
+
documentationSiteUrl;
|
|
996
976
|
session;
|
|
997
977
|
precondition;
|
|
998
978
|
condition;
|
|
999
|
-
searchParams =
|
|
1000
|
-
history =
|
|
1001
|
-
components =
|
|
1002
|
-
experienceInstances =
|
|
979
|
+
searchParams = rt();
|
|
980
|
+
history = Ve();
|
|
981
|
+
components = Ie({ client: this });
|
|
982
|
+
experienceInstances = ne({ client: this });
|
|
1003
983
|
experiences = me({ client: this });
|
|
1004
984
|
frameworks = je({ client: this });
|
|
1005
985
|
predicates = ze({ client: this });
|
|
1006
|
-
features =
|
|
1007
|
-
responses =
|
|
1008
|
-
fields =
|
|
1009
|
-
actions =
|
|
986
|
+
features = Oe({ client: this });
|
|
987
|
+
responses = Ze({ client: this });
|
|
988
|
+
fields = He();
|
|
989
|
+
actions = Ke();
|
|
1010
990
|
constructor(e) {
|
|
1011
|
-
k("info", "Picked client initializing.");
|
|
1012
|
-
const { organizationId: r, projectId: s } =
|
|
1013
|
-
this.organizationId = r, this.projectId = s, this.options = Object.freeze(e), this.apiUrl = e.apiUrl ||
|
|
991
|
+
k("info", "Picked client initializing."), this.events = Te(this.eventBus);
|
|
992
|
+
const { organizationId: r, projectId: s } = dt(e);
|
|
993
|
+
this.organizationId = r, this.projectId = s, 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.session = ot(), this.setupPlugins(), this.setupFeatures(), this.setupPredicates(), this.setupActions(), this.precondition = e.precondition, this.condition = e.condition, this.eventBus({ type: "load", version: et() }), k("info", "Picked client initialized.");
|
|
1014
994
|
}
|
|
1015
995
|
start = () => {
|
|
1016
|
-
|
|
1017
|
-
if (!
|
|
996
|
+
Be(this), (async () => {
|
|
997
|
+
if (!N())
|
|
1018
998
|
return;
|
|
1019
|
-
|
|
1020
|
-
|
|
999
|
+
await this.runPluginStartHooks();
|
|
1000
|
+
const r = await this.evaluateGate(this.precondition);
|
|
1021
1001
|
let s;
|
|
1022
|
-
r && (
|
|
1002
|
+
r && (s = await this.evaluateGate(this.condition));
|
|
1023
1003
|
const i = r && s === !0;
|
|
1024
1004
|
if (typeof s == "boolean" && this.session) {
|
|
1025
|
-
const
|
|
1026
|
-
this.session.setIsUser(
|
|
1005
|
+
const d = s;
|
|
1006
|
+
this.session.setIsUser(d), this.eventBus({ type: "user_decide", value: d });
|
|
1007
|
+
}
|
|
1008
|
+
if (this.eventBus({ type: "initialize" }), i && _(this), await ie(), i && _(this), this.eventBus({ type: "ready" }), this.isReady = !0, this.session) {
|
|
1009
|
+
const { id: d, isUser: o, identifiers: n } = this.session;
|
|
1010
|
+
this.eventBus({ type: "session", id: d, isUser: o, identifiers: n });
|
|
1027
1011
|
}
|
|
1028
|
-
this.eventBus({ type: "initialize" }), document.body && i && L(this), await oe(), i && L(this), this.eventBus({ type: "ready" }), this.isReady = !0, this.session && this.eventBus({ type: "session", ...this.session });
|
|
1029
1012
|
})();
|
|
1030
1013
|
};
|
|
1031
1014
|
registerFramework = (e) => {
|
|
1032
1015
|
Ee(e, this.frameworks);
|
|
1033
1016
|
};
|
|
1034
1017
|
registerComponent = (e, r) => {
|
|
1035
|
-
|
|
1018
|
+
L(e, r, this.components);
|
|
1036
1019
|
};
|
|
1037
1020
|
registerPlugin = (e) => {
|
|
1038
1021
|
Se(this, e, this.plugins);
|
|
1022
|
+
const r = this.plugins[e.name];
|
|
1023
|
+
r?.onStart && this.pluginStartHooks.push(r.onStart);
|
|
1039
1024
|
};
|
|
1040
1025
|
registerFeature = (e, r) => {
|
|
1041
|
-
|
|
1026
|
+
De(e, r, this.features);
|
|
1042
1027
|
};
|
|
1043
1028
|
registerPredicate = (e, r) => {
|
|
1044
1029
|
Ce(e, r, this.predicates);
|
|
1045
1030
|
};
|
|
1046
1031
|
registerField = (e) => {
|
|
1047
|
-
|
|
1032
|
+
Ge(e, this.fields);
|
|
1048
1033
|
};
|
|
1049
1034
|
registerAction = (e, r) => {
|
|
1050
|
-
|
|
1035
|
+
We(e, r, this.actions);
|
|
1051
1036
|
};
|
|
1052
1037
|
registerExperience = (e) => {
|
|
1053
|
-
e.component &&
|
|
1038
|
+
e.component && L(`experience:${e.id}`, e.component, this.components), he(e, this.experiences);
|
|
1054
1039
|
};
|
|
1055
|
-
getStateSnapshot = () =>
|
|
1040
|
+
getStateSnapshot = () => Y(this);
|
|
1056
1041
|
launchExperienceById = async (e) => {
|
|
1057
1042
|
const r = this.experiences.getById(e).getState();
|
|
1058
1043
|
if (!r) {
|
|
1059
1044
|
k("warn", `Experience with id '${e}' not found.`);
|
|
1060
1045
|
return;
|
|
1061
1046
|
}
|
|
1062
|
-
|
|
1047
|
+
W(this, r);
|
|
1063
1048
|
};
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
// this.project.experiences.forEach((experience) => setupExperience(experience, this.experiences))
|
|
1072
|
-
// }
|
|
1049
|
+
async runPluginStartHooks() {
|
|
1050
|
+
for (const e of this.pluginStartHooks)
|
|
1051
|
+
await e();
|
|
1052
|
+
}
|
|
1053
|
+
async evaluateGate(e) {
|
|
1054
|
+
return e === void 0 ? !0 : typeof e == "boolean" ? e : await P(this, e) === !0;
|
|
1055
|
+
}
|
|
1073
1056
|
setupPlugins() {
|
|
1074
1057
|
this.options.plugins?.forEach((e) => {
|
|
1075
1058
|
if (Array.isArray(e)) {
|
|
@@ -1096,13 +1079,13 @@ class mt {
|
|
|
1096
1079
|
const [s, i] = r.split(":");
|
|
1097
1080
|
if (!s || !i)
|
|
1098
1081
|
return;
|
|
1099
|
-
let
|
|
1100
|
-
|
|
1101
|
-
key: `${
|
|
1082
|
+
let d = i;
|
|
1083
|
+
d === "true" && (d = !0), d === "false" && (d = !1), this.registerFeature(s, {
|
|
1084
|
+
key: `${d}`,
|
|
1102
1085
|
// use the assigned bucket value as the key
|
|
1103
1086
|
name: s,
|
|
1104
1087
|
// eslint-disable-next-line sonarjs/function-return-type
|
|
1105
|
-
decide: () =>
|
|
1088
|
+
decide: () => d,
|
|
1106
1089
|
storage: "session"
|
|
1107
1090
|
});
|
|
1108
1091
|
} catch {
|
|
@@ -1173,67 +1156,57 @@ class mt {
|
|
|
1173
1156
|
* // => "Fruits: apple, banana, and cherry"
|
|
1174
1157
|
*/
|
|
1175
1158
|
renderString = (e, r) => {
|
|
1176
|
-
const s = this.responses.listStore.getState().reduce((i,
|
|
1177
|
-
return
|
|
1159
|
+
const s = this.responses.listStore.getState().reduce((i, d) => (i[d.fieldId] = d.value, i), {});
|
|
1160
|
+
return mt(e, {
|
|
1178
1161
|
...r,
|
|
1179
1162
|
responses: s
|
|
1180
1163
|
});
|
|
1181
1164
|
};
|
|
1182
1165
|
}
|
|
1183
|
-
function
|
|
1184
|
-
return
|
|
1166
|
+
function Q(t) {
|
|
1167
|
+
return t.options?.some((e) => "condition" in e) ?? !1;
|
|
1185
1168
|
}
|
|
1186
1169
|
function yt(t) {
|
|
1187
|
-
return t.some((e) => e.condition ||
|
|
1170
|
+
return t.some((e) => e.condition || Q(e));
|
|
1188
1171
|
}
|
|
1189
|
-
async function
|
|
1190
|
-
return e.length === 0 ? e : (await Promise.all(
|
|
1172
|
+
async function Et(t, e) {
|
|
1173
|
+
return e.length === 0 || !yt(e) ? e : (await Promise.all(
|
|
1191
1174
|
e.map(async (s) => {
|
|
1192
|
-
|
|
1193
|
-
if (s.options && typeof s.options == "function")
|
|
1194
|
-
try {
|
|
1195
|
-
const p = s.options, y = await Promise.resolve(p());
|
|
1196
|
-
i = { ...s, options: y };
|
|
1197
|
-
} catch {
|
|
1198
|
-
i = { ...s, options: null };
|
|
1199
|
-
}
|
|
1200
|
-
if (!yt([i]))
|
|
1201
|
-
return i;
|
|
1202
|
-
if (!(i.condition ? await E(t, i.condition) : !0))
|
|
1175
|
+
if (!(s.condition ? await P(t, s.condition) : !0))
|
|
1203
1176
|
return null;
|
|
1204
|
-
if (!
|
|
1205
|
-
return
|
|
1206
|
-
const
|
|
1207
|
-
|
|
1208
|
-
)).filter((
|
|
1209
|
-
return
|
|
1177
|
+
if (!s.options || !Q(s))
|
|
1178
|
+
return s;
|
|
1179
|
+
const o = (await Promise.all(
|
|
1180
|
+
s.options.map(async (l) => l.condition ? await P(t, l.condition) ? l : null : l)
|
|
1181
|
+
)).filter((l) => l !== null);
|
|
1182
|
+
return o.length === s.options.length ? s : o.length === 0 ? null : { ...s, options: o };
|
|
1210
1183
|
})
|
|
1211
1184
|
)).filter((s) => s !== null);
|
|
1212
1185
|
}
|
|
1213
|
-
const
|
|
1214
|
-
const e = new
|
|
1186
|
+
const Pt = (t) => {
|
|
1187
|
+
const e = new ht(t);
|
|
1215
1188
|
return le(e), e;
|
|
1216
1189
|
};
|
|
1217
1190
|
export {
|
|
1218
|
-
|
|
1219
|
-
|
|
1191
|
+
ht as Picked,
|
|
1192
|
+
Pt as createClient,
|
|
1220
1193
|
A as createStorageKey,
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1194
|
+
P as evaluateRuleLogic,
|
|
1195
|
+
at as getPickedConfig,
|
|
1196
|
+
Et as getStepFields,
|
|
1197
|
+
Rt as isPickedRoot,
|
|
1198
|
+
C as localStore,
|
|
1199
|
+
M as sessionStore,
|
|
1200
|
+
zt as subscribe,
|
|
1201
|
+
Mt as supportsCookies,
|
|
1229
1202
|
de as supportsCryptoRandomUUID,
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1203
|
+
N as supportsDocument,
|
|
1204
|
+
Ot as supportsHistory,
|
|
1205
|
+
Dt as supportsIntersectionObserver,
|
|
1233
1206
|
ue as supportsLocalStorage,
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1207
|
+
Ut as supportsLocation,
|
|
1208
|
+
Vt as supportsSessionStorage,
|
|
1209
|
+
Nt as supportsShadowRoot,
|
|
1210
|
+
Tt as supportsWebComponents,
|
|
1211
|
+
T as supportsWindow
|
|
1239
1212
|
};
|