@picked/client 0.0.1-dev.1764626732123 → 0.0.1-dev.1764632196476
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/cjs/index.js +1 -1
- package/dist/cjs/plugins/create-experience/index.js +1 -1
- package/dist/cjs/plugins/experience-browser-storage/index.js +1 -1
- package/dist/cjs/plugins/history-browser-storage/index.js +1 -1
- package/dist/cjs/plugins/responses-browser-storage/index.js +1 -1
- package/dist/cjs/plugins/responses-indexeddb/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/esm/index.js +792 -144
- package/dist/esm/plugins/create-experience/index.js +123 -121
- package/dist/esm/plugins/experience-browser-storage/index.js +1 -1
- package/dist/esm/plugins/history-browser-storage/index.js +8 -8
- package/dist/esm/plugins/responses-browser-storage/index.js +23 -24
- package/dist/esm/plugins/responses-indexeddb/index.js +1 -1
- package/dist/esm/plugins/single-page-app/index.js +3 -3
- package/dist/esm/plugins/web-components/index.js +1 -1
- package/dist/esm/plugins/window-object/index.js +1 -1
- package/dist/esm/server/index.js +7 -7
- package/dist/{experience-instance-C2AnM2J_.js → experience-instance-C4INDX6a.js} +8 -8
- package/dist/{experience-instance-BpQMqclI.cjs → experience-instance-DjjpHk0t.cjs} +1 -1
- package/dist/{supports-DBMT17KZ.js → supports-BjhuLJ8z.js} +10 -10
- package/dist/types/client.d.ts +31 -0
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/entities/action/action.d.ts +2 -4
- package/dist/types/entities/action/action.d.ts.map +1 -1
- package/dist/types/entities/experience/experience.d.ts +3 -1
- package/dist/types/entities/experience/experience.d.ts.map +1 -1
- package/dist/types/entities/feature/feature.d.ts +3 -5
- package/dist/types/entities/feature/feature.d.ts.map +1 -1
- package/dist/types/entities/field/field.d.ts +7 -0
- package/dist/types/entities/field/field.d.ts.map +1 -1
- package/dist/types/entities/predicate/predicate.d.ts +5 -4
- package/dist/types/entities/predicate/predicate.d.ts.map +1 -1
- package/dist/types/entities/response/response.d.ts +1 -4
- package/dist/types/entities/response/response.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/picked.d.ts +20 -20
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts +6 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/utils/events.d.ts +13 -7
- package/dist/types/utils/events.d.ts.map +1 -1
- package/dist/types/utils/user-session.d.ts +2 -0
- package/dist/types/utils/user-session.d.ts.map +1 -1
- package/package.json +1 -7
- package/dist/cjs/plugins/shopify/index.js +0 -1
- package/dist/esm/plugins/shopify/index.js +0 -123
- package/dist/types/plugins/shopify/global-obj.d.ts +0 -49
- package/dist/types/plugins/shopify/global-obj.d.ts.map +0 -1
- package/dist/types/plugins/shopify/index.d.ts +0 -6
- package/dist/types/plugins/shopify/index.d.ts.map +0 -1
- package/dist/types/plugins/shopify/picked-config.d.ts +0 -103
- package/dist/types/plugins/shopify/picked-config.d.ts.map +0 -1
- package/dist/types/plugins/shopify/plugin.d.ts +0 -3
- package/dist/types/plugins/shopify/plugin.d.ts.map +0 -1
- package/dist/types/plugins/shopify/predicates.d.ts +0 -42
- package/dist/types/plugins/shopify/predicates.d.ts.map +0 -1
- package/dist/user-session-BTaOgTo_.cjs +0 -1
- package/dist/user-session-YEUZkOjt.js +0 -718
package/dist/esm/index.js
CHANGED
|
@@ -1,120 +1,768 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { c as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
var X = Object.defineProperty;
|
|
2
|
+
var Z = (t, e, s) => e in t ? X(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
|
|
3
|
+
var m = (t, e, s) => Z(t, typeof e != "symbol" ? e + "" : e, s);
|
|
4
|
+
import { createDomain as F, createApi as b, createEffect as U, attach as ee, sample as x, combine as O, createEvent as C } from "effector";
|
|
5
|
+
import { createFactory as k, invoke as w } from "@withease/factories";
|
|
6
|
+
import { g as L, t as te, c as se, i as re, e as E, a as ne, b as ie, d as oe } from "../experience-instance-C4INDX6a.js";
|
|
7
|
+
import { f as kt } from "../experience-instance-C4INDX6a.js";
|
|
8
|
+
import { l as v } from "../logger-C9a75KZn.js";
|
|
9
|
+
import { c as B, s as j, l as D } from "../storage-Cb_71y48.js";
|
|
10
|
+
import { a as It } from "../storage-Cb_71y48.js";
|
|
11
|
+
import { g as ae } from "../id-BW-g3y32.js";
|
|
12
|
+
import { i as ce } from "../object-JwZ58NOH.js";
|
|
13
|
+
import { s as H, a as ue, b as K, c as le, d as de } from "../supports-BjhuLJ8z.js";
|
|
14
|
+
import { h as bt, f as xt, j as Et, e as Pt, g as Rt, i as Bt, k as At } from "../supports-BjhuLJ8z.js";
|
|
15
|
+
const q = F("experience"), pe = k(
|
|
16
|
+
({ client: t, experience: e }) => {
|
|
17
|
+
const s = q.store(e), n = b(s, {
|
|
18
|
+
merge(u, h) {
|
|
19
|
+
return {
|
|
20
|
+
...u,
|
|
21
|
+
...h.experience
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}), a = s.map((u) => ({
|
|
25
|
+
name: u.name,
|
|
26
|
+
decisionLogic: u.condition ?? u.decide,
|
|
27
|
+
targetSelectors: u.targets,
|
|
28
|
+
initializeOpenLogic: e.initializeOpen
|
|
29
|
+
})), l = t.components.listStore.map(
|
|
30
|
+
(u) => u.find((h) => h.name === `experience:${e.id}`) || u.find((h) => h.name === "experience"),
|
|
31
|
+
{ skipVoid: !1 }
|
|
32
|
+
), r = s.map((u) => ({
|
|
33
|
+
steps: u.steps,
|
|
34
|
+
nodes: u.nodes,
|
|
35
|
+
edges: u.edges,
|
|
36
|
+
conditionals: u.conditionals
|
|
37
|
+
})), i = e.actions ?? [];
|
|
38
|
+
return {
|
|
39
|
+
id: e.id,
|
|
40
|
+
configStore: a,
|
|
41
|
+
treeStore: r,
|
|
42
|
+
componentStore: l,
|
|
43
|
+
actions: i,
|
|
44
|
+
merge: n.merge
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
function ge(t) {
|
|
49
|
+
return w(pe, t);
|
|
50
|
+
}
|
|
51
|
+
const fe = k(({ client: t }) => {
|
|
52
|
+
const e = q.store({}), s = b(e, {
|
|
53
|
+
register(r, i) {
|
|
54
|
+
return {
|
|
55
|
+
...r,
|
|
56
|
+
[i.id]: i
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
function n(r) {
|
|
61
|
+
const i = e.getState()[r.id];
|
|
62
|
+
if (i) {
|
|
63
|
+
i.merge({ experience: r, strategy: "override" });
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const u = ge({ client: t, experience: r });
|
|
67
|
+
s.register(u);
|
|
68
|
+
}
|
|
69
|
+
const a = e.map((r) => Object.values(r));
|
|
70
|
+
function l(r) {
|
|
71
|
+
return e.map((i) => i[r], { skipVoid: !1 });
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
register: n,
|
|
75
|
+
getById: l,
|
|
76
|
+
listStore: a
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
function me(t) {
|
|
80
|
+
return w(fe, t);
|
|
81
|
+
}
|
|
82
|
+
const he = (t, e) => {
|
|
83
|
+
e.register(t);
|
|
84
|
+
}, G = (t, e) => {
|
|
85
|
+
const { targetSelectors: s } = e.configStore.getState(), n = L(s, e.id);
|
|
86
|
+
n.forEach(
|
|
87
|
+
({ elements: l }) => l.forEach((r) => te(r, e.id))
|
|
88
|
+
), se(n, e.id).forEach((l) => {
|
|
89
|
+
t.experienceInstances.spawn(e, l);
|
|
90
|
+
});
|
|
91
|
+
}, M = async (t) => {
|
|
92
|
+
await Promise.all(
|
|
93
|
+
t.experiences.listStore.getState().map(async (e) => {
|
|
94
|
+
await ye(t, e) && G(t, e);
|
|
95
|
+
})
|
|
96
|
+
);
|
|
97
|
+
}, ye = async (t, e) => {
|
|
98
|
+
const { decisionLogic: s, targetSelectors: n } = e.configStore.getState();
|
|
99
|
+
return L(n, e.id).length < 1 || n.length === 0 ? !1 : s && re(s) ? await E(t, s) === !0 : !0;
|
|
100
|
+
}, Se = (t, e, s) => {
|
|
101
|
+
const n = e.name, a = e.setup(t);
|
|
102
|
+
if (a) {
|
|
103
|
+
const l = s[n] ?? {};
|
|
104
|
+
s[n] = Object.freeze({ ...l, ...a });
|
|
105
|
+
}
|
|
106
|
+
}, ve = F("component"), ke = k(
|
|
107
|
+
({ client: t, component: e, name: s }) => {
|
|
108
|
+
const n = t.frameworks.getByName(e.frameworkName);
|
|
109
|
+
return {
|
|
110
|
+
name: s,
|
|
111
|
+
component: e,
|
|
112
|
+
frameworkStore: n
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
function we(t) {
|
|
117
|
+
return w(ke, t);
|
|
118
|
+
}
|
|
119
|
+
const Ie = k(({ client: t }) => {
|
|
120
|
+
const e = ve.store({}), s = b(e, {
|
|
121
|
+
register(r, i) {
|
|
122
|
+
return {
|
|
123
|
+
...r,
|
|
124
|
+
[i.name]: i
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
function n(r, i) {
|
|
129
|
+
e.getState()[r] && v(
|
|
130
|
+
"warn",
|
|
131
|
+
`Component '${r}' already registered. Registering again will override the previous registration.`
|
|
132
|
+
);
|
|
133
|
+
const h = we({ client: t, name: r, component: i });
|
|
134
|
+
s.register(h);
|
|
135
|
+
}
|
|
136
|
+
const a = e.map((r) => Object.values(r));
|
|
137
|
+
function l(r) {
|
|
138
|
+
return e.map((i) => i[r], { skipVoid: !1 });
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
register: n,
|
|
142
|
+
getByName: l,
|
|
143
|
+
listStore: a
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
function Fe(t) {
|
|
147
|
+
return w(Ie, t);
|
|
148
|
+
}
|
|
149
|
+
const V = (t, e, s) => {
|
|
150
|
+
s.register(t, e);
|
|
151
|
+
}, be = F("framework"), xe = k(({ client: t }) => {
|
|
152
|
+
const e = be.store({}), s = b(e, {
|
|
153
|
+
register(r, i) {
|
|
154
|
+
return {
|
|
155
|
+
...r,
|
|
156
|
+
[i.name]: i.framework
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
function n(r, i) {
|
|
161
|
+
e.getState()[r] && v(
|
|
162
|
+
"warn",
|
|
163
|
+
`Framework '${r}' already registered. Registering again will override the previous registration.`
|
|
164
|
+
), s.register({ name: r, framework: i });
|
|
165
|
+
}
|
|
166
|
+
const a = e.map((r) => Object.values(r));
|
|
167
|
+
function l(r) {
|
|
168
|
+
return e.map((i) => i[r], { skipVoid: !1 });
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
register: n,
|
|
172
|
+
getByName: l,
|
|
173
|
+
listStore: a
|
|
174
|
+
};
|
|
175
|
+
});
|
|
176
|
+
function Ee(t) {
|
|
177
|
+
return w(xe, t);
|
|
178
|
+
}
|
|
179
|
+
const Pe = (t, e) => {
|
|
180
|
+
e.register(t.name, t);
|
|
181
|
+
}, Re = 6e3, T = B("last_ping", "global"), Be = (t) => `${t}/api/v1/ping`, Ae = async (t) => {
|
|
182
|
+
try {
|
|
183
|
+
const e = Date.now(), s = localStorage.getItem(T);
|
|
184
|
+
if (s && e - parseInt(s) < Re)
|
|
185
|
+
return !0;
|
|
186
|
+
const n = Be(t.apiUrl), a = {
|
|
187
|
+
projectId: t.projectId,
|
|
188
|
+
path: window.location.pathname
|
|
189
|
+
}, l = JSON.stringify(a), r = {
|
|
190
|
+
"Content-Type": "application/json"
|
|
191
|
+
}, i = document.getElementById("picked_script"), u = i == null ? void 0 : i.dataset.verceltoken;
|
|
192
|
+
u && (r["x-vercel-protection-bypass"] = u);
|
|
193
|
+
const S = (await fetch(n, {
|
|
194
|
+
method: "POST",
|
|
195
|
+
headers: r,
|
|
196
|
+
body: l
|
|
197
|
+
})).ok;
|
|
198
|
+
return S && localStorage.setItem(T, e.toString()), S;
|
|
199
|
+
} catch (e) {
|
|
200
|
+
return v("error", e), !1;
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
function $e(t) {
|
|
204
|
+
const e = typeof window < "u", s = {
|
|
205
|
+
client: t,
|
|
206
|
+
responses: t.responses.listStore.getState(),
|
|
207
|
+
fields: t.fields.listStore.getState(),
|
|
208
|
+
location: e ? window.location : void 0,
|
|
209
|
+
document: e ? window.document : void 0,
|
|
210
|
+
sessionStorage: e ? window.sessionStorage : void 0,
|
|
211
|
+
localStorage: e ? window.localStorage : void 0
|
|
212
|
+
};
|
|
213
|
+
return Object.freeze(s);
|
|
214
|
+
}
|
|
215
|
+
const je = F("predicate"), De = k(({ client: t }) => {
|
|
216
|
+
const e = je.store({}), s = b(e, {
|
|
217
|
+
register(r, i) {
|
|
218
|
+
return {
|
|
219
|
+
...r,
|
|
220
|
+
[i.name]: {
|
|
221
|
+
name: i.name,
|
|
222
|
+
predicate: i.predicate
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
function n(r, i) {
|
|
228
|
+
e.getState()[r] && v(
|
|
229
|
+
"warn",
|
|
230
|
+
`Predicate '${r}' already registered. Registering again will override the previous registration.`
|
|
231
|
+
), s.register(Object.freeze({ name: r, predicate: i }));
|
|
232
|
+
}
|
|
233
|
+
const a = e.map((r) => Object.values(r));
|
|
234
|
+
function l(r) {
|
|
235
|
+
return e.map((i) => i[r], { skipVoid: !1 });
|
|
236
|
+
}
|
|
237
|
+
return {
|
|
238
|
+
register: n,
|
|
239
|
+
getByName: l,
|
|
240
|
+
listStore: a
|
|
241
|
+
};
|
|
242
|
+
});
|
|
243
|
+
function Oe(t) {
|
|
244
|
+
return w(De, t);
|
|
245
|
+
}
|
|
246
|
+
const Ce = (t, e, s) => {
|
|
247
|
+
s.register(t, e);
|
|
248
|
+
}, N = F("feature"), Ue = k(({ client: t }) => {
|
|
249
|
+
const e = N.store({}), s = N.store([]), n = b(e, {
|
|
250
|
+
register(d, c) {
|
|
251
|
+
return {
|
|
252
|
+
...d,
|
|
253
|
+
[c.id]: c.feature
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
function a(d, c) {
|
|
258
|
+
e.getState()[d] && v(
|
|
259
|
+
"warn",
|
|
260
|
+
`Feature '${d}' already registered. Registering again will override the previous registration.`
|
|
261
|
+
);
|
|
262
|
+
const p = {
|
|
263
|
+
id: d,
|
|
264
|
+
feature: {
|
|
265
|
+
...c,
|
|
266
|
+
id: d
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
n.register(
|
|
270
|
+
Object.freeze({
|
|
271
|
+
id: d,
|
|
272
|
+
feature: p
|
|
273
|
+
})
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
const l = U(
|
|
277
|
+
async ({
|
|
278
|
+
id: d,
|
|
279
|
+
key: c,
|
|
280
|
+
storage: o = "local"
|
|
281
|
+
}) => {
|
|
282
|
+
const p = B(`feature:${d}:${c}`, "global"), g = (o === "session" ? j : D).get(p).boolean();
|
|
283
|
+
return g === null ? null : { id: d, key: c, bucket: g, storage: o };
|
|
284
|
+
}
|
|
285
|
+
), r = U((d) => {
|
|
286
|
+
if (!d)
|
|
287
|
+
return null;
|
|
288
|
+
const c = B(`feature:${d.id}:${d.key}`, "global");
|
|
289
|
+
(d.storage === "session" ? j : D).set(c, d.bucket);
|
|
290
|
+
}), i = /* @__PURE__ */ new Map(), u = ee({
|
|
291
|
+
source: { allFeaturesStore: e, resolvedFeaturesStore: s },
|
|
292
|
+
effect: async ({ allFeaturesStore: d, resolvedFeaturesStore: c }, { id: o, decide: p, key: f }) => {
|
|
293
|
+
const g = c.find(
|
|
294
|
+
($) => $.id === o && $.key === f
|
|
295
|
+
);
|
|
296
|
+
if (g)
|
|
297
|
+
return g;
|
|
298
|
+
const y = d[o];
|
|
299
|
+
if (!y)
|
|
300
|
+
throw new Error(`Feature with id '${o}' not found`);
|
|
301
|
+
const I = i.get(`${o}:${f}`);
|
|
302
|
+
if (I !== void 0) {
|
|
303
|
+
const $ = await I;
|
|
304
|
+
return { id: y.id, bucket: $, key: f, storage: y.feature.storage };
|
|
305
|
+
}
|
|
306
|
+
const A = p();
|
|
307
|
+
i.set(`${o}:${f}`, A);
|
|
308
|
+
const P = await A;
|
|
309
|
+
return { id: y.id, bucket: P, key: f, storage: y.feature.storage };
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
x({
|
|
313
|
+
clock: n.register,
|
|
314
|
+
fn: (d) => {
|
|
315
|
+
const { id: c, feature: o } = d;
|
|
316
|
+
return { id: c, key: o.feature.key, storage: o.feature.storage };
|
|
317
|
+
},
|
|
318
|
+
target: l
|
|
319
|
+
}), x({
|
|
320
|
+
source: e,
|
|
321
|
+
clock: u.doneData,
|
|
322
|
+
fn: (d, c) => {
|
|
323
|
+
var y;
|
|
324
|
+
const { id: o, bucket: p, storage: f } = c, g = (y = d[o]) == null ? void 0 : y.feature.key;
|
|
325
|
+
return g ? { key: g, id: o, bucket: p, storage: f } : null;
|
|
326
|
+
},
|
|
327
|
+
target: r
|
|
328
|
+
});
|
|
329
|
+
const h = O({ allFeaturesStore: e, resolvedFeaturesStore: s }).map(
|
|
330
|
+
({
|
|
331
|
+
allFeaturesStore: d,
|
|
332
|
+
resolvedFeaturesStore: c
|
|
333
|
+
}) => Object.values(d).map((o) => {
|
|
334
|
+
const p = c.find(
|
|
335
|
+
(f) => f.id === o.id && f.key === o.feature.key
|
|
336
|
+
);
|
|
337
|
+
return p ? {
|
|
338
|
+
id: o.id,
|
|
339
|
+
name: o.feature.name,
|
|
340
|
+
key: o.feature.key,
|
|
341
|
+
getBucket: () => ({ id: o.id, bucket: p.bucket }),
|
|
342
|
+
isResolved: !0
|
|
343
|
+
} : {
|
|
344
|
+
id: o.id,
|
|
345
|
+
name: o.feature.name,
|
|
346
|
+
key: o.feature.key,
|
|
347
|
+
getBucket: async () => await u(o.feature),
|
|
348
|
+
isResolved: !1
|
|
349
|
+
};
|
|
350
|
+
})
|
|
351
|
+
);
|
|
352
|
+
x({
|
|
353
|
+
clock: u.doneData,
|
|
354
|
+
source: { resolvedFeatures: s },
|
|
355
|
+
filter: ({ resolvedFeatures: d }, { id: c, key: o }) => !d.some(
|
|
356
|
+
(f) => f.id === c && f.key === o
|
|
357
|
+
),
|
|
358
|
+
fn: (d, c) => c,
|
|
359
|
+
target: t.eventBus.prepend((d) => ({
|
|
360
|
+
type: "feature_decide",
|
|
361
|
+
feature: d
|
|
362
|
+
}))
|
|
363
|
+
}), x({
|
|
364
|
+
clock: [l.doneData, u.doneData],
|
|
365
|
+
source: s,
|
|
366
|
+
fn: (d, c) => !c || d.some(
|
|
367
|
+
(p) => p.id === c.id && p.key === c.key
|
|
368
|
+
) ? d : [...d, c],
|
|
369
|
+
target: s
|
|
370
|
+
});
|
|
371
|
+
function S(d) {
|
|
372
|
+
return e.map((c) => c[d], { skipVoid: !1 });
|
|
373
|
+
}
|
|
374
|
+
return {
|
|
375
|
+
register: a,
|
|
376
|
+
getByName: S,
|
|
377
|
+
listStore: h
|
|
378
|
+
};
|
|
379
|
+
});
|
|
380
|
+
function Me(t) {
|
|
381
|
+
return w(Ue, t);
|
|
382
|
+
}
|
|
383
|
+
const Ve = (t, e, s) => {
|
|
384
|
+
s.register(t, e);
|
|
385
|
+
}, R = F("history");
|
|
386
|
+
function _(t, e) {
|
|
387
|
+
return {
|
|
388
|
+
// eslint-disable-next-line sonarjs/pseudo-random
|
|
389
|
+
id: ae(`history-entry-${Date.now()}-${Math.random()}}`),
|
|
390
|
+
node: e,
|
|
391
|
+
at: Date.now(),
|
|
392
|
+
experienceId: t
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
const Te = k(() => {
|
|
396
|
+
const t = R.store({ entries: [] }), e = R.event(), s = R.event(), n = R.event(), a = R.event();
|
|
397
|
+
t.on(e, (r, i) => ({
|
|
398
|
+
entries: [...r.entries, _(i.experienceId, i.node)]
|
|
399
|
+
})), t.on(s, (r, i) => ({
|
|
400
|
+
entries: [
|
|
401
|
+
...r.entries.slice(0, -1),
|
|
402
|
+
_(i.experienceId, i.node)
|
|
403
|
+
]
|
|
404
|
+
})), t.on(a, (r, i) => i);
|
|
405
|
+
function l(r, i) {
|
|
406
|
+
const u = { lastStepIndex: -1, secondLastStepIndex: -1 };
|
|
407
|
+
for (let h = r.length - 1; h >= 0; h--) {
|
|
408
|
+
const S = r[h], d = S == null ? void 0 : S.node;
|
|
409
|
+
if (!(!d || !ne(d)) && !(i && (S == null ? void 0 : S.experienceId) !== i))
|
|
410
|
+
if (u.lastStepIndex === -1)
|
|
411
|
+
u.lastStepIndex = h;
|
|
412
|
+
else {
|
|
413
|
+
u.secondLastStepIndex = h;
|
|
414
|
+
break;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
return u;
|
|
418
|
+
}
|
|
419
|
+
return t.on(n, (r, i) => {
|
|
420
|
+
const { secondLastStepIndex: u } = l(r.entries, i.experienceId), h = u !== -1 ? r.entries.slice(0, u + 1) : r.entries;
|
|
421
|
+
return {
|
|
422
|
+
...r,
|
|
423
|
+
entries: h
|
|
424
|
+
};
|
|
425
|
+
}), {
|
|
426
|
+
push: e,
|
|
427
|
+
replace: s,
|
|
428
|
+
back: n,
|
|
429
|
+
restore: a,
|
|
430
|
+
entriesStore: t.map((r) => r.entries)
|
|
431
|
+
};
|
|
432
|
+
});
|
|
433
|
+
function Ne() {
|
|
434
|
+
return w(Te);
|
|
435
|
+
}
|
|
436
|
+
const _e = () => C(), ze = F("field"), Le = k(() => {
|
|
437
|
+
const t = ze.store({}), e = b(t, {
|
|
438
|
+
register(r, i) {
|
|
439
|
+
return {
|
|
440
|
+
...r,
|
|
441
|
+
[i.field.id]: i.field
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
function s(r) {
|
|
446
|
+
e.register({ field: r });
|
|
447
|
+
}
|
|
448
|
+
const n = t.map((r) => Object.values(r));
|
|
449
|
+
function a(r) {
|
|
450
|
+
return t.map((i) => i[r] || null);
|
|
451
|
+
}
|
|
452
|
+
function l(r) {
|
|
453
|
+
return t.map((i) => Object.values(i).find((u) => u.name === r) || null);
|
|
454
|
+
}
|
|
455
|
+
return {
|
|
456
|
+
register: s,
|
|
457
|
+
getById: a,
|
|
458
|
+
listStore: n,
|
|
459
|
+
getByName: l
|
|
460
|
+
};
|
|
461
|
+
});
|
|
462
|
+
function He() {
|
|
463
|
+
return w(Le);
|
|
464
|
+
}
|
|
465
|
+
const Ke = (t, e) => {
|
|
466
|
+
e.register(t);
|
|
467
|
+
}, qe = F("action"), Ge = k(() => {
|
|
468
|
+
const t = qe.store({}), e = b(t, {
|
|
469
|
+
register(l, r) {
|
|
470
|
+
return {
|
|
471
|
+
...l,
|
|
472
|
+
[r.name]: {
|
|
473
|
+
name: r.name,
|
|
474
|
+
action: r.action
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
function s(l, r) {
|
|
480
|
+
e.register({ name: l, action: r });
|
|
481
|
+
}
|
|
482
|
+
const n = t.map((l) => Object.values(l));
|
|
483
|
+
function a(l) {
|
|
484
|
+
return t.map((r) => r[l], { skipVoid: !1 });
|
|
485
|
+
}
|
|
486
|
+
return {
|
|
487
|
+
register: s,
|
|
488
|
+
getByName: a,
|
|
489
|
+
listStore: n
|
|
490
|
+
};
|
|
491
|
+
});
|
|
492
|
+
function We() {
|
|
493
|
+
return w(Ge);
|
|
494
|
+
}
|
|
495
|
+
const Ye = (t, e, s) => {
|
|
496
|
+
s.register(t, e);
|
|
497
|
+
};
|
|
498
|
+
function z(t) {
|
|
499
|
+
return typeof t > "u" || t === null || t === "" || Array.isArray(t) && !t.length;
|
|
500
|
+
}
|
|
501
|
+
const Je = F("response"), Qe = k(({ client: t }) => {
|
|
502
|
+
const e = Je.store({}), s = C(), n = C(), a = b(e, {
|
|
503
|
+
register(c, o) {
|
|
504
|
+
return {
|
|
505
|
+
...c,
|
|
506
|
+
[o.fieldId]: o.response
|
|
507
|
+
};
|
|
508
|
+
},
|
|
509
|
+
registerBatch(c, o) {
|
|
510
|
+
return {
|
|
511
|
+
...c,
|
|
512
|
+
...o
|
|
513
|
+
};
|
|
514
|
+
},
|
|
515
|
+
clear(c, o) {
|
|
516
|
+
const { [o]: p, ...f } = c;
|
|
517
|
+
return f;
|
|
518
|
+
},
|
|
519
|
+
clearAll() {
|
|
520
|
+
return {};
|
|
521
|
+
}
|
|
522
|
+
});
|
|
523
|
+
function l(c, o) {
|
|
524
|
+
a.register({ fieldId: c, response: o });
|
|
525
|
+
}
|
|
526
|
+
async function r(c) {
|
|
527
|
+
const o = [];
|
|
528
|
+
return await Promise.allSettled(
|
|
529
|
+
Object.entries(c).map(async ([p, f]) => {
|
|
530
|
+
let g = f;
|
|
531
|
+
const y = t.fields.getById(p).getState();
|
|
532
|
+
if (!y) {
|
|
533
|
+
o.push({
|
|
534
|
+
fieldId: p,
|
|
535
|
+
userMessage: `Field '${p}' not found`,
|
|
536
|
+
systemMessage: `No field with ID '${p}' exists. Available field IDs are: ${Object.keys(t.fields.listStore.getState()).join(",")}.`,
|
|
537
|
+
value: g
|
|
538
|
+
});
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
if (y.multiple && (typeof g == "string" || typeof g == "number" || typeof g == "boolean") && (g = [g]), y.validation && !ce(y.validation) && !z(g)) {
|
|
542
|
+
const I = await E(t, y.validation, {
|
|
543
|
+
$input: g
|
|
544
|
+
});
|
|
545
|
+
if (typeof I == "string") {
|
|
546
|
+
o.push({
|
|
547
|
+
fieldId: p,
|
|
548
|
+
userMessage: I,
|
|
549
|
+
systemMessage: `Field validation resulted in an error: ${I}.`,
|
|
550
|
+
value: g
|
|
551
|
+
});
|
|
552
|
+
return;
|
|
553
|
+
}
|
|
554
|
+
if (I === !1) {
|
|
555
|
+
o.push({
|
|
556
|
+
fieldId: p,
|
|
557
|
+
userMessage: "This field is invalid",
|
|
558
|
+
systemMessage: "Field validation resulted in an unspecified error.",
|
|
559
|
+
value: g
|
|
560
|
+
});
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
if (y.required && z(g)) {
|
|
565
|
+
o.push({
|
|
566
|
+
fieldId: p,
|
|
567
|
+
userMessage: "This field is required",
|
|
568
|
+
systemMessage: "Field is required.",
|
|
569
|
+
value: g
|
|
570
|
+
});
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
if (!y.multiple && Array.isArray(g) && g.length > 1) {
|
|
574
|
+
o.push({
|
|
575
|
+
fieldId: p,
|
|
576
|
+
userMessage: "This field expects a single response",
|
|
577
|
+
systemMessage: "Field expects a single response.",
|
|
578
|
+
value: g
|
|
579
|
+
});
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
if (y.options) {
|
|
583
|
+
const I = y.options.map((P) => P.value), A = Array.isArray(g) ? g : [g];
|
|
584
|
+
Array.isArray(g) && (A.every((P) => I.includes(P)) || o.push({
|
|
585
|
+
fieldId: p,
|
|
586
|
+
userMessage: "This field expects a valid option",
|
|
587
|
+
systemMessage: `Field expects a valid option. Valid options are: ${I.join(", ")}`,
|
|
588
|
+
value: g
|
|
589
|
+
}));
|
|
590
|
+
}
|
|
591
|
+
})
|
|
592
|
+
), { responsesToCommit: c, validationErrors: o };
|
|
593
|
+
}
|
|
594
|
+
async function i(c) {
|
|
595
|
+
const { responsesToCommit: o, validationErrors: p } = await r(c);
|
|
596
|
+
return p.length ? { errors: p } : (a.registerBatch(o), { errors: [] });
|
|
597
|
+
}
|
|
598
|
+
const u = e.map((c) => c), h = e.map((c) => Object.keys(c).map((p) => ({
|
|
599
|
+
fieldId: p,
|
|
600
|
+
value: c[p]
|
|
601
|
+
})));
|
|
602
|
+
function S(c) {
|
|
603
|
+
const o = t.fields.getById(c), p = e.map((f) => f[c] || null);
|
|
604
|
+
return O({ f: o, r: p }, ({ f, r: g }) => g || (f != null && f.defaultValue ? f.defaultValue : null));
|
|
605
|
+
}
|
|
606
|
+
function d(c) {
|
|
607
|
+
const o = t.fields.getByName(c);
|
|
608
|
+
return O({ f: o, s: e }, ({ f: p, s: f }) => {
|
|
609
|
+
const g = p && f[p.id] || null;
|
|
610
|
+
return g || (p != null && p.defaultValue ? p.defaultValue : null);
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
return x({
|
|
614
|
+
clock: s,
|
|
615
|
+
target: a.clearAll
|
|
616
|
+
}), x({
|
|
617
|
+
clock: n,
|
|
618
|
+
target: a.clear
|
|
619
|
+
}), {
|
|
620
|
+
register: l,
|
|
621
|
+
clearAll: s,
|
|
622
|
+
clear: n,
|
|
623
|
+
commit: i,
|
|
624
|
+
getResponsesToCommit: r,
|
|
625
|
+
listStore: h,
|
|
626
|
+
getAllStore: u,
|
|
627
|
+
getByFieldId: S,
|
|
628
|
+
getByFieldName: d
|
|
629
|
+
};
|
|
630
|
+
});
|
|
631
|
+
function Xe(t) {
|
|
632
|
+
return w(Qe, t);
|
|
633
|
+
}
|
|
634
|
+
const Ze = () => "0.0.1-dev.1764632196476";
|
|
635
|
+
function et() {
|
|
636
|
+
if (H()) {
|
|
637
|
+
const t = [
|
|
23
638
|
document.currentScript,
|
|
24
639
|
document.getElementById("picked_script"),
|
|
25
640
|
document.getElementById("picked"),
|
|
26
641
|
document.getElementById("cvly"),
|
|
27
642
|
document.getElementById("cvly-x")
|
|
28
643
|
];
|
|
29
|
-
for (const e of
|
|
644
|
+
for (const e of t)
|
|
30
645
|
if (e != null && e.dataset.api)
|
|
31
646
|
return e.dataset.api;
|
|
32
647
|
}
|
|
33
648
|
return "https://api.picked.app";
|
|
34
649
|
}
|
|
35
|
-
function
|
|
36
|
-
if (!
|
|
650
|
+
function tt() {
|
|
651
|
+
if (!ue())
|
|
37
652
|
return {};
|
|
38
|
-
const
|
|
39
|
-
for (const [
|
|
40
|
-
|
|
41
|
-
for (const
|
|
42
|
-
const
|
|
43
|
-
e[
|
|
44
|
-
}
|
|
45
|
-
const
|
|
46
|
-
if (
|
|
47
|
-
|
|
653
|
+
const t = new URLSearchParams(window.location.search), e = {}, s = /* @__PURE__ */ new Set();
|
|
654
|
+
for (const [a] of t.entries())
|
|
655
|
+
a.startsWith("picked-") && s.add(a);
|
|
656
|
+
for (const a of s) {
|
|
657
|
+
const l = a.replace("picked-", "");
|
|
658
|
+
e[l] = t.getAll(a);
|
|
659
|
+
}
|
|
660
|
+
const n = B("s");
|
|
661
|
+
if (s.size > 0)
|
|
662
|
+
j.set(n, e);
|
|
48
663
|
else {
|
|
49
|
-
const
|
|
50
|
-
if (
|
|
51
|
-
return
|
|
664
|
+
const a = j.get(n);
|
|
665
|
+
if (a)
|
|
666
|
+
return a.json() || {};
|
|
52
667
|
}
|
|
53
668
|
return e;
|
|
54
669
|
}
|
|
55
|
-
|
|
670
|
+
function st() {
|
|
671
|
+
if (le())
|
|
672
|
+
return crypto.randomUUID();
|
|
673
|
+
const t = Date.now().toString(36), e = Math.random().toString(36).substring(2, 15), s = Math.random().toString(36).substring(2, 15), n = Math.random().toString(36).substring(2, 15);
|
|
674
|
+
return `${t}-${e}-${s}-${n}`;
|
|
675
|
+
}
|
|
676
|
+
const W = B("session", "global"), Y = () => {
|
|
677
|
+
const t = K() ? D.get(W) : null;
|
|
678
|
+
return function(s) {
|
|
679
|
+
this.isUser = s, t && t.set(this);
|
|
680
|
+
};
|
|
681
|
+
}, rt = () => ({
|
|
682
|
+
id: st(),
|
|
683
|
+
isUser: void 0,
|
|
684
|
+
setIsUser: Y()
|
|
685
|
+
}), nt = () => {
|
|
686
|
+
if (!K()) return null;
|
|
687
|
+
const t = D.get(W);
|
|
688
|
+
let e = t.isSet() ? t.json() : null;
|
|
689
|
+
if (!e) {
|
|
690
|
+
const s = rt();
|
|
691
|
+
return t.set(s), s;
|
|
692
|
+
}
|
|
693
|
+
return {
|
|
694
|
+
...e,
|
|
695
|
+
setIsUser: Y()
|
|
696
|
+
};
|
|
697
|
+
}, it = () => nt();
|
|
698
|
+
class J {
|
|
56
699
|
constructor(e) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
700
|
+
m(this, "options");
|
|
701
|
+
m(this, "isReady", !1);
|
|
702
|
+
m(this, "project");
|
|
703
|
+
m(this, "plugins", {});
|
|
704
|
+
m(this, "eventBus", _e());
|
|
705
|
+
m(this, "organizationId");
|
|
706
|
+
m(this, "projectId");
|
|
707
|
+
m(this, "apiUrl");
|
|
708
|
+
m(this, "session");
|
|
709
|
+
m(this, "precondition");
|
|
710
|
+
m(this, "condition");
|
|
711
|
+
m(this, "searchParams", tt());
|
|
712
|
+
m(this, "history", Ne());
|
|
713
|
+
m(this, "components", Fe({ client: this }));
|
|
714
|
+
m(this, "experienceInstances", ie({ client: this }));
|
|
715
|
+
m(this, "experiences", me({ client: this }));
|
|
716
|
+
m(this, "frameworks", Ee({ client: this }));
|
|
717
|
+
m(this, "predicates", Oe({ client: this }));
|
|
718
|
+
m(this, "features", Me({ client: this }));
|
|
719
|
+
m(this, "responses", Xe({ client: this }));
|
|
720
|
+
m(this, "fields", He());
|
|
721
|
+
m(this, "actions", We());
|
|
722
|
+
v("info", "Picked client initializing."), this.organizationId = e.organizationId, this.projectId = e.projectId, this.options = Object.freeze(e), this.apiUrl = e.apiUrl || et(), this.session = it(), this.setupPlugins(), this.setupFeatures(), this.setupPredicates(), this.setupActions(), this.precondition = e.precondition, this.condition = e.condition, this.eventBus({ type: "load", version: Ze() }), v("info", "Picked client initialized.");
|
|
78
723
|
}
|
|
79
724
|
start() {
|
|
80
|
-
|
|
81
|
-
|
|
725
|
+
Ae(this), (async () => {
|
|
726
|
+
if (!H())
|
|
727
|
+
return;
|
|
728
|
+
let s = !0, n;
|
|
729
|
+
this.precondition !== void 0 && await E(this, this.precondition) === !1 && (n = !1, s = !1), this.condition !== void 0 && n !== !1 && await E(this, this.condition) === !1 && (s = !1), this.session && this.session.setIsUser(s), this.eventBus({ type: "initialize", is_user: s }), this.eventBus({ type: "user_decide", value: s }), document.body && s && M(this), await oe(), s && M(this), this.eventBus({ type: "ready" }), this.isReady = !0, this.session && this.eventBus({ type: "session", ...this.session });
|
|
82
730
|
})();
|
|
83
731
|
}
|
|
84
732
|
registerFramework(e) {
|
|
85
|
-
|
|
733
|
+
Pe(e, this.frameworks);
|
|
86
734
|
}
|
|
87
|
-
registerComponent(e,
|
|
88
|
-
|
|
735
|
+
registerComponent(e, s) {
|
|
736
|
+
V(e, s, this.components);
|
|
89
737
|
}
|
|
90
738
|
registerPlugin(e) {
|
|
91
|
-
|
|
739
|
+
Se(this, e, this.plugins);
|
|
92
740
|
}
|
|
93
|
-
registerFeature(e,
|
|
94
|
-
|
|
741
|
+
registerFeature(e, s) {
|
|
742
|
+
Ve(e, s, this.features);
|
|
95
743
|
}
|
|
96
|
-
registerPredicate(e,
|
|
97
|
-
|
|
744
|
+
registerPredicate(e, s) {
|
|
745
|
+
Ce(e, s, this.predicates);
|
|
98
746
|
}
|
|
99
747
|
registerField(e) {
|
|
100
|
-
|
|
748
|
+
Ke(e, this.fields);
|
|
101
749
|
}
|
|
102
|
-
registerAction(e,
|
|
103
|
-
|
|
750
|
+
registerAction(e, s) {
|
|
751
|
+
Ye(e, s, this.actions);
|
|
104
752
|
}
|
|
105
753
|
registerExperience(e) {
|
|
106
|
-
e.component &&
|
|
754
|
+
e.component && V(`experience:${e.id}`, e.component, this.components), he(e, this.experiences);
|
|
107
755
|
}
|
|
108
756
|
getStateSnapshot() {
|
|
109
|
-
return
|
|
757
|
+
return $e(this);
|
|
110
758
|
}
|
|
111
759
|
async launchExperienceById(e) {
|
|
112
|
-
const
|
|
113
|
-
if (!
|
|
114
|
-
|
|
760
|
+
const s = this.experiences.getById(e).getState();
|
|
761
|
+
if (!s) {
|
|
762
|
+
v("warn", `Experience with id '${e}' not found.`);
|
|
115
763
|
return;
|
|
116
764
|
}
|
|
117
|
-
|
|
765
|
+
G(this, s);
|
|
118
766
|
}
|
|
119
767
|
// private async fetchProject() {
|
|
120
768
|
// if (this.project) {
|
|
@@ -127,38 +775,38 @@ class m {
|
|
|
127
775
|
// }
|
|
128
776
|
setupPlugins() {
|
|
129
777
|
var e;
|
|
130
|
-
(e = this.options.plugins) == null || e.forEach((
|
|
131
|
-
if (Array.isArray(
|
|
132
|
-
|
|
133
|
-
this.registerPlugin(
|
|
778
|
+
(e = this.options.plugins) == null || e.forEach((s) => {
|
|
779
|
+
if (Array.isArray(s)) {
|
|
780
|
+
s.forEach((a) => {
|
|
781
|
+
this.registerPlugin(a);
|
|
134
782
|
});
|
|
135
783
|
return;
|
|
136
784
|
}
|
|
137
|
-
const
|
|
138
|
-
if (Array.isArray(
|
|
139
|
-
|
|
785
|
+
const n = typeof s == "function" ? s() : s;
|
|
786
|
+
if (Array.isArray(n)) {
|
|
787
|
+
n.forEach((a) => this.registerPlugin(a));
|
|
140
788
|
return;
|
|
141
789
|
}
|
|
142
|
-
this.registerPlugin(
|
|
790
|
+
this.registerPlugin(n);
|
|
143
791
|
});
|
|
144
792
|
}
|
|
145
793
|
setupFeatures() {
|
|
146
794
|
const e = this.options.features;
|
|
147
|
-
e && (Object.entries(e).forEach(([
|
|
148
|
-
const
|
|
149
|
-
this.registerFeature(
|
|
150
|
-
}), this.searchParams.feature && this.searchParams.feature.forEach((
|
|
795
|
+
e && (Object.entries(e).forEach(([s, n]) => {
|
|
796
|
+
const a = typeof n == "function" ? n() : n;
|
|
797
|
+
this.registerFeature(s, a);
|
|
798
|
+
}), this.searchParams.feature && this.searchParams.feature.forEach((s) => {
|
|
151
799
|
try {
|
|
152
|
-
const [
|
|
153
|
-
if (!
|
|
800
|
+
const [n, a] = s.split(":");
|
|
801
|
+
if (!n || !a)
|
|
154
802
|
return;
|
|
155
|
-
let
|
|
156
|
-
|
|
157
|
-
key: `${
|
|
803
|
+
let l = a;
|
|
804
|
+
l === "true" && (l = !0), l === "false" && (l = !1), this.registerFeature(n, {
|
|
805
|
+
key: `${l}`,
|
|
158
806
|
// use the assigned bucket value as the key
|
|
159
|
-
name:
|
|
807
|
+
name: n,
|
|
160
808
|
// eslint-disable-next-line sonarjs/function-return-type
|
|
161
|
-
decide: () =>
|
|
809
|
+
decide: () => l,
|
|
162
810
|
storage: "session"
|
|
163
811
|
});
|
|
164
812
|
} catch {
|
|
@@ -167,73 +815,73 @@ class m {
|
|
|
167
815
|
}
|
|
168
816
|
setupPredicates() {
|
|
169
817
|
const e = this.options.predicates;
|
|
170
|
-
e && Object.entries(e).forEach(([
|
|
171
|
-
if (typeof
|
|
172
|
-
|
|
818
|
+
e && Object.entries(e).forEach(([s, n]) => {
|
|
819
|
+
if (typeof n != "function") {
|
|
820
|
+
v("warn", `Predicate "${s}" is not a function.`);
|
|
173
821
|
return;
|
|
174
822
|
}
|
|
175
|
-
this.registerPredicate(
|
|
823
|
+
this.registerPredicate(s, n);
|
|
176
824
|
});
|
|
177
825
|
}
|
|
178
826
|
setupActions() {
|
|
179
827
|
const e = this.options.actions;
|
|
180
|
-
e && Object.entries(e).forEach(([
|
|
181
|
-
if (typeof
|
|
182
|
-
|
|
828
|
+
e && Object.entries(e).forEach(([s, n]) => {
|
|
829
|
+
if (typeof n != "function") {
|
|
830
|
+
v("warn", `Action "${s}" is not a function.`);
|
|
183
831
|
return;
|
|
184
832
|
}
|
|
185
|
-
this.registerAction(
|
|
833
|
+
this.registerAction(s, n);
|
|
186
834
|
});
|
|
187
835
|
}
|
|
188
836
|
getPluginConfig(e) {
|
|
189
837
|
return this.plugins[e] ?? {};
|
|
190
838
|
}
|
|
191
839
|
}
|
|
192
|
-
|
|
193
|
-
function
|
|
840
|
+
m(J, "logger", v);
|
|
841
|
+
function Q(t) {
|
|
194
842
|
var e;
|
|
195
|
-
return ((e =
|
|
843
|
+
return ((e = t.options) == null ? void 0 : e.some((s) => "condition" in s)) ?? !1;
|
|
196
844
|
}
|
|
197
|
-
function
|
|
198
|
-
return
|
|
845
|
+
function ot(t) {
|
|
846
|
+
return t.some((e) => e.condition || Q(e));
|
|
199
847
|
}
|
|
200
|
-
async function
|
|
201
|
-
return e.length === 0 || !
|
|
202
|
-
e.map(async (
|
|
203
|
-
if (!(
|
|
848
|
+
async function ht(t, e) {
|
|
849
|
+
return e.length === 0 || !ot(e) ? e : (await Promise.all(
|
|
850
|
+
e.map(async (n) => {
|
|
851
|
+
if (!(n.condition ? await E(t, n.condition) : !0))
|
|
204
852
|
return null;
|
|
205
|
-
if (!
|
|
206
|
-
return
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
)).filter((
|
|
210
|
-
return
|
|
853
|
+
if (!n.options || !Q(n))
|
|
854
|
+
return n;
|
|
855
|
+
const r = (await Promise.all(
|
|
856
|
+
n.options.map(async (u) => u.condition ? await E(t, u.condition) ? u : null : u)
|
|
857
|
+
)).filter((u) => u !== null);
|
|
858
|
+
return r.length === n.options.length ? n : r.length === 0 ? null : { ...n, options: r };
|
|
211
859
|
})
|
|
212
|
-
)).filter((
|
|
860
|
+
)).filter((n) => n !== null);
|
|
213
861
|
}
|
|
214
|
-
const
|
|
215
|
-
const e = new
|
|
216
|
-
return
|
|
862
|
+
const yt = (t) => {
|
|
863
|
+
const e = new J(t);
|
|
864
|
+
return de(e), e;
|
|
217
865
|
};
|
|
218
866
|
export {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
867
|
+
J as Picked,
|
|
868
|
+
yt as createClient,
|
|
869
|
+
B as createStorageKey,
|
|
870
|
+
E as evaluateRuleLogic,
|
|
871
|
+
ht as getStepFields,
|
|
872
|
+
kt as isPickedRoot,
|
|
873
|
+
D as localStore,
|
|
874
|
+
j as sessionStore,
|
|
875
|
+
It as subscribe,
|
|
876
|
+
bt as supportsCookies,
|
|
229
877
|
le as supportsCryptoRandomUUID,
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
878
|
+
H as supportsDocument,
|
|
879
|
+
xt as supportsHistory,
|
|
880
|
+
Et as supportsIntersectionObserver,
|
|
881
|
+
K as supportsLocalStorage,
|
|
882
|
+
Pt as supportsLocation,
|
|
883
|
+
Rt as supportsSessionStorage,
|
|
884
|
+
Bt as supportsShadowRoot,
|
|
885
|
+
At as supportsWebComponents,
|
|
886
|
+
ue as supportsWindow
|
|
239
887
|
};
|