@picked/client 0.0.84 → 0.0.85-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/{api-Dauhcq05.cjs → api-C0GTH5AE.cjs} +1 -1
- package/dist/{api-Dpa-71Qe.js → api-CnZly-e2.js} +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/logic-engine.js +1 -0
- package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/docs/how-to/authenticate-the-cli.md +4 -0
- package/dist/docs/how-to/authenticate-with-a-password.md +11 -3
- package/dist/docs/how-to/call-an-external-api-from-a-workflow.md +68 -0
- package/dist/docs/how-to/connect-the-mcp-server.md +8 -0
- package/dist/docs/how-to/set-up-mfa.md +58 -19
- package/dist/docs/reference/dashboard/external-apis.md +65 -0
- package/dist/docs/reference/dashboard/lead-search.md +149 -0
- package/dist/docs/reference/dashboard/workflow-runs.md +79 -0
- package/dist/docs/reference/glossary.md +10 -0
- package/dist/docs/reference/management-api/authentication.md +15 -8
- package/dist/docs/reference/management-api/authorization-and-scopes.md +5 -1
- package/dist/docs/reference/management-api/error-handling.md +2 -3
- package/dist/docs/reference/sdk/analytics-events.md +2 -3
- package/dist/docs/tutorials/first-api-call.md +13 -6
- package/dist/esm/index.js +283 -476
- package/dist/esm/logic-engine.js +208 -0
- package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
- package/dist/esm/server/index.js +2 -2
- package/dist/plugin-BjDkXYhs.cjs +1 -0
- package/dist/{plugin-B8tQck_k.js → plugin-GO5HgKAn.js} +80 -45
- package/dist/{preview-unavailable-CBjPwMqm.cjs → preview-unavailable-Bhv0k6OM.cjs} +1 -1
- package/dist/{preview-unavailable-DrO9PFzS.js → preview-unavailable-R4IEQXV_.js} +1 -1
- package/dist/{provider-DZBClIc7.js → provider-BsUkKYzJ.js} +1 -1
- package/dist/{provider-DFJQEjV6.cjs → provider-UnhXGWr5.cjs} +1 -1
- package/dist/types/logic-engine.d.ts +9 -0
- package/dist/types/logic-engine.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
- package/package.json +18 -7
- package/dist/plugin-BmjrsiJ2.cjs +0 -1
package/dist/esm/index.js
CHANGED
|
@@ -4,15 +4,16 @@ import { t as r } from "../logger-DMN6TxJJ.js";
|
|
|
4
4
|
import { a as i, c as a, d as o, f as s, i as c, l, m as u, n as d, o as f, p, r as m, s as h, t as g, u as _ } from "../supports-CO9bJGNl.js";
|
|
5
5
|
import { a as v, i as y, r as ee, s as b, t as x } from "../dom-BqcToNL0.js";
|
|
6
6
|
import { d as S, l as C, n as w, r as te, u as T } from "../experience-instance-VZQBpVEW.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { t as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
7
|
+
import { apply as E } from "./logic-engine.js";
|
|
8
|
+
import { i as ne, n as D, r as re, t as O } from "../storage-1MW3-_As.js";
|
|
9
|
+
import { a as ie, c as ae, l as oe, n as se, o as ce, r as k, s as le, t as A } from "../preview-unavailable-R4IEQXV_.js";
|
|
10
|
+
import { t as ue } from "../id-Bo4RBeOs.js";
|
|
11
|
+
import { n as de, r as fe, t as pe } from "../inert-script-report-B_bMPRzp.js";
|
|
12
|
+
import { attach as j, combine as M, createApi as N, createDomain as P, createEffect as F, createEvent as I, createStore as L, is as R, sample as z } from "effector";
|
|
13
|
+
import { createFactory as B, invoke as V } from "@withease/factories";
|
|
13
14
|
//#region src/entities/experience/experience.ts
|
|
14
|
-
var
|
|
15
|
-
let i =
|
|
15
|
+
var H = P("experience"), me = B(({ client: e, experience: r }) => {
|
|
16
|
+
let i = H.store(r), a = N(i, { merge(e, t) {
|
|
16
17
|
return {
|
|
17
18
|
...e,
|
|
18
19
|
...t.experience
|
|
@@ -22,7 +23,7 @@ var L = A("experience"), ve = F(({ client: e, experience: r }) => {
|
|
|
22
23
|
decisionLogic: e.condition,
|
|
23
24
|
targetSelectors: e.targets,
|
|
24
25
|
initializeOpenLogic: e.initializeOpen
|
|
25
|
-
})), s =
|
|
26
|
+
})), s = M(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 = M(i, e.steps.indexStore, e.conditions.indexStore, (e, t, n) => {
|
|
26
27
|
let r = e.nodes.filter(S).map((e) => t[e.stepId]).filter((e) => e !== void 0), i = e.nodes.filter(T).map((e) => n[e.conditionId]).filter((e) => e !== void 0);
|
|
27
28
|
return {
|
|
28
29
|
steps: r,
|
|
@@ -30,7 +31,7 @@ var L = A("experience"), ve = F(({ client: e, experience: r }) => {
|
|
|
30
31
|
edges: e.edges,
|
|
31
32
|
conditions: i
|
|
32
33
|
};
|
|
33
|
-
}), l = i.map((e) => C(e.nodes, e.edges)), u = r.actions ?? [], d, f =
|
|
34
|
+
}), l = i.map((e) => C(e.nodes, e.edges)), u = r.actions ?? [], d, f = j({
|
|
34
35
|
source: o,
|
|
35
36
|
effect: (t, n) => {
|
|
36
37
|
let i = y(t.targetSelectors, r.id);
|
|
@@ -38,18 +39,18 @@ var L = A("experience"), ve = F(({ client: e, experience: r }) => {
|
|
|
38
39
|
n ? e.experienceInstances.spawn(d, t, n) : e.experienceInstances.spawn(d, t);
|
|
39
40
|
});
|
|
40
41
|
}
|
|
41
|
-
}), p =
|
|
42
|
+
}), p = M({
|
|
42
43
|
preconditionPassed: e.preconditionPassedStore,
|
|
43
44
|
isUser: e.session.store.map((e) => e.isUser, { skipVoid: !1 }),
|
|
44
45
|
config: o
|
|
45
|
-
}), m =
|
|
46
|
+
}), m = j({
|
|
46
47
|
source: p,
|
|
47
48
|
effect: async ({ preconditionPassed: i, isUser: a, config: o }) => {
|
|
48
49
|
if (!i || !a) return !1;
|
|
49
50
|
let { decisionLogic: s, targetSelectors: c } = o;
|
|
50
51
|
return c.length === 0 || y(c, r.id).length < 1 ? !1 : s === void 0 || !t(s) || await n(e, s) === !0;
|
|
51
52
|
}
|
|
52
|
-
}), h =
|
|
53
|
+
}), h = F(async () => {
|
|
53
54
|
if (!e.contentLoader) return !0;
|
|
54
55
|
try {
|
|
55
56
|
await e.contentLoader({
|
|
@@ -60,26 +61,26 @@ var L = A("experience"), ve = F(({ client: e, experience: r }) => {
|
|
|
60
61
|
`${r.id}`;
|
|
61
62
|
}
|
|
62
63
|
return !0;
|
|
63
|
-
}), g =
|
|
64
|
-
return
|
|
64
|
+
}), g = I(), _ = I(), v = H.createStore(void 0, { skipVoid: !1 }).on(g, (e, t) => t).on(_, (e, t) => t);
|
|
65
|
+
return z({
|
|
65
66
|
clock: g,
|
|
66
67
|
target: m
|
|
67
|
-
}),
|
|
68
|
+
}), z({
|
|
68
69
|
clock: m.doneData,
|
|
69
70
|
source: v,
|
|
70
71
|
filter: (e, t) => t,
|
|
71
72
|
fn: (e) => e,
|
|
72
73
|
target: f
|
|
73
|
-
}),
|
|
74
|
+
}), z({
|
|
74
75
|
clock: m.doneData,
|
|
75
76
|
filter: Boolean,
|
|
76
77
|
target: h
|
|
77
|
-
}),
|
|
78
|
+
}), z({
|
|
78
79
|
clock: _,
|
|
79
80
|
source: v,
|
|
80
81
|
fn: (e) => e,
|
|
81
82
|
target: f
|
|
82
|
-
}),
|
|
83
|
+
}), z({
|
|
83
84
|
clock: _,
|
|
84
85
|
target: h
|
|
85
86
|
}), d = {
|
|
@@ -99,22 +100,22 @@ var L = A("experience"), ve = F(({ client: e, experience: r }) => {
|
|
|
99
100
|
prepareExperienceContentFx: h
|
|
100
101
|
}, d;
|
|
101
102
|
});
|
|
102
|
-
function
|
|
103
|
-
return
|
|
103
|
+
function he(e) {
|
|
104
|
+
return V(me, e);
|
|
104
105
|
}
|
|
105
|
-
var
|
|
106
|
-
let t =
|
|
106
|
+
var ge = B(({ client: e }) => {
|
|
107
|
+
let t = H.store({}), n = N(t, { register(e, t) {
|
|
107
108
|
return {
|
|
108
109
|
...e,
|
|
109
110
|
[t.id]: t
|
|
110
111
|
};
|
|
111
|
-
} }), r =
|
|
112
|
-
n.register(
|
|
112
|
+
} }), r = I(), i = F((t) => {
|
|
113
|
+
n.register(he({
|
|
113
114
|
client: e,
|
|
114
115
|
experience: t
|
|
115
116
|
}));
|
|
116
117
|
});
|
|
117
|
-
|
|
118
|
+
z({
|
|
118
119
|
clock: r,
|
|
119
120
|
source: t,
|
|
120
121
|
filter: (e, t) => e[t.id] !== void 0,
|
|
@@ -127,7 +128,7 @@ var be = F(({ client: e }) => {
|
|
|
127
128
|
experience: t,
|
|
128
129
|
strategy: "override"
|
|
129
130
|
});
|
|
130
|
-
}),
|
|
131
|
+
}), z({
|
|
131
132
|
clock: r,
|
|
132
133
|
source: t,
|
|
133
134
|
filter: (e, t) => e[t.id] === void 0,
|
|
@@ -141,7 +142,7 @@ var be = F(({ client: e }) => {
|
|
|
141
142
|
function s(e) {
|
|
142
143
|
return t.map((t) => Object.values(t).find((t) => t.key === e) ?? t[e], { skipVoid: !1 });
|
|
143
144
|
}
|
|
144
|
-
let c =
|
|
145
|
+
let c = j({
|
|
145
146
|
source: t,
|
|
146
147
|
effect: (e, t) => {
|
|
147
148
|
let n = "key" in t ? Object.values(e).find((e) => e.key === t.key) : e[t.id];
|
|
@@ -159,7 +160,7 @@ var be = F(({ client: e }) => {
|
|
|
159
160
|
getById: o,
|
|
160
161
|
getByKey: s,
|
|
161
162
|
launch: c,
|
|
162
|
-
open:
|
|
163
|
+
open: j({
|
|
163
164
|
source: {
|
|
164
165
|
experiences: t,
|
|
165
166
|
instances: e.experienceInstances.listStore
|
|
@@ -187,7 +188,7 @@ var be = F(({ client: e }) => {
|
|
|
187
188
|
}
|
|
188
189
|
}),
|
|
189
190
|
listStore: a,
|
|
190
|
-
initialiseExperiencesFx:
|
|
191
|
+
initialiseExperiencesFx: j({
|
|
191
192
|
source: a,
|
|
192
193
|
effect: (e) => {
|
|
193
194
|
for (let t of e) t.initialiseRequested(void 0);
|
|
@@ -195,48 +196,48 @@ var be = F(({ client: e }) => {
|
|
|
195
196
|
})
|
|
196
197
|
};
|
|
197
198
|
});
|
|
198
|
-
function
|
|
199
|
-
return
|
|
199
|
+
function _e(e) {
|
|
200
|
+
return V(ge, e);
|
|
200
201
|
}
|
|
201
|
-
var
|
|
202
|
+
var ve = async (e) => {
|
|
202
203
|
await e.experiences.initialiseExperiencesFx();
|
|
203
204
|
};
|
|
204
205
|
//#endregion
|
|
205
206
|
//#region src/entities/plugin/plugin.ts
|
|
206
|
-
function
|
|
207
|
-
return
|
|
207
|
+
function ye(e) {
|
|
208
|
+
return F(async () => {
|
|
208
209
|
await e();
|
|
209
210
|
});
|
|
210
211
|
}
|
|
211
|
-
var
|
|
212
|
+
var be = (e, t, n) => {
|
|
212
213
|
let r = t.name, i = t.setup(e), a = n[r] ?? {};
|
|
213
214
|
n[r] = Object.freeze({
|
|
214
215
|
...a,
|
|
215
216
|
...i
|
|
216
217
|
});
|
|
217
|
-
},
|
|
218
|
+
}, xe = P("component"), Se = B(({ client: e, component: t, name: n }) => ({
|
|
218
219
|
name: n,
|
|
219
220
|
component: t,
|
|
220
221
|
frameworkStore: e.frameworks.getByName(t.frameworkName)
|
|
221
222
|
}));
|
|
222
|
-
function
|
|
223
|
-
return
|
|
223
|
+
function Ce(e) {
|
|
224
|
+
return V(Se, e);
|
|
224
225
|
}
|
|
225
|
-
var
|
|
226
|
-
let t =
|
|
226
|
+
var we = B(({ client: e }) => {
|
|
227
|
+
let t = xe.store({}), n = N(t, { register(e, t) {
|
|
227
228
|
return {
|
|
228
229
|
...e,
|
|
229
230
|
[t.name]: t
|
|
230
231
|
};
|
|
231
|
-
} }), i =
|
|
232
|
-
|
|
232
|
+
} }), i = I();
|
|
233
|
+
z({
|
|
233
234
|
clock: i,
|
|
234
235
|
source: t,
|
|
235
236
|
filter: (e, { name: t }) => e[t] !== void 0,
|
|
236
237
|
fn: (e, { name: t }) => `Component '${t}' already registered. Registering again will override the previous registration.`
|
|
237
|
-
}).watch((e) => /* @__PURE__ */ r("warn", e)),
|
|
238
|
+
}).watch((e) => /* @__PURE__ */ r("warn", e)), z({
|
|
238
239
|
clock: i,
|
|
239
|
-
fn: ({ name: t, component: n }) =>
|
|
240
|
+
fn: ({ name: t, component: n }) => Ce({
|
|
240
241
|
client: e,
|
|
241
242
|
name: t,
|
|
242
243
|
component: n
|
|
@@ -253,27 +254,27 @@ var Oe = F(({ client: e }) => {
|
|
|
253
254
|
listStore: a
|
|
254
255
|
};
|
|
255
256
|
});
|
|
256
|
-
function
|
|
257
|
-
return
|
|
257
|
+
function Te(e) {
|
|
258
|
+
return V(we, e);
|
|
258
259
|
}
|
|
259
|
-
var
|
|
260
|
+
var U = (e, t, n) => {
|
|
260
261
|
n.register({
|
|
261
262
|
name: e,
|
|
262
263
|
component: t
|
|
263
264
|
});
|
|
264
|
-
},
|
|
265
|
-
let t =
|
|
265
|
+
}, Ee = P("framework"), De = B((e) => {
|
|
266
|
+
let t = Ee.store({}), n = N(t, { register(e, t) {
|
|
266
267
|
return {
|
|
267
268
|
...e,
|
|
268
269
|
[t.name]: t.framework
|
|
269
270
|
};
|
|
270
|
-
} }), i =
|
|
271
|
-
|
|
271
|
+
} }), i = I();
|
|
272
|
+
z({
|
|
272
273
|
clock: i,
|
|
273
274
|
source: t,
|
|
274
275
|
filter: (e, { name: t }) => e[t] !== void 0,
|
|
275
276
|
fn: (e, { name: t }) => `Framework '${t}' already registered. Registering again will override the previous registration.`
|
|
276
|
-
}).watch((e) => /* @__PURE__ */ r("warn", e)),
|
|
277
|
+
}).watch((e) => /* @__PURE__ */ r("warn", e)), z({
|
|
277
278
|
clock: i,
|
|
278
279
|
target: n.register
|
|
279
280
|
});
|
|
@@ -287,238 +288,44 @@ var R = (e, t, n) => {
|
|
|
287
288
|
listStore: a
|
|
288
289
|
};
|
|
289
290
|
});
|
|
290
|
-
function
|
|
291
|
-
return
|
|
291
|
+
function Oe(e) {
|
|
292
|
+
return V(De, e);
|
|
292
293
|
}
|
|
293
|
-
var
|
|
294
|
+
var ke = (e, t) => {
|
|
294
295
|
t.register({
|
|
295
296
|
name: e.name,
|
|
296
297
|
framework: e
|
|
297
298
|
});
|
|
298
|
-
},
|
|
299
|
+
}, Ae = B(({ client: e }) => {
|
|
299
300
|
let t = "window" in globalThis, n = {
|
|
300
301
|
location: t ? globalThis.location : void 0,
|
|
301
302
|
document: t ? globalThis.document : void 0,
|
|
302
303
|
sessionStorage: t ? globalThis.sessionStorage : void 0,
|
|
303
304
|
localStorage: t ? globalThis.localStorage : void 0
|
|
304
305
|
};
|
|
305
|
-
return
|
|
306
|
+
return M(e.responses.listStore, e.fields.listStore, (t, r) => Object.freeze({
|
|
306
307
|
client: e,
|
|
307
308
|
responses: t,
|
|
308
309
|
fields: r,
|
|
309
310
|
...n
|
|
310
311
|
}));
|
|
311
312
|
});
|
|
312
|
-
function
|
|
313
|
-
return
|
|
314
|
-
}
|
|
315
|
-
//#endregion
|
|
316
|
-
//#region src/logic-engine.ts
|
|
317
|
-
function Ie(e) {
|
|
318
|
-
return typeof e == "number" && !isNaN(e);
|
|
319
|
-
}
|
|
320
|
-
function z(e) {
|
|
321
|
-
return typeof e == "string";
|
|
322
|
-
}
|
|
323
|
-
function B(e) {
|
|
324
|
-
return Array.isArray(e);
|
|
325
|
-
}
|
|
326
|
-
function Le(e) {
|
|
327
|
-
return e instanceof Promise;
|
|
328
|
-
}
|
|
329
|
-
function Re(e) {
|
|
330
|
-
return typeof e == "object" && !!e && !Array.isArray(e) && Object.keys(e).length === 1;
|
|
331
|
-
}
|
|
332
|
-
function V(e) {
|
|
333
|
-
if (Ie(e)) return e;
|
|
334
|
-
let t = parseFloat(`${e}`);
|
|
335
|
-
return isNaN(t) ? 0 : t;
|
|
336
|
-
}
|
|
337
|
-
function H(e) {
|
|
338
|
-
return `${e}`;
|
|
339
|
-
}
|
|
340
|
-
var ze = {
|
|
341
|
-
"==": (e, t) => e == t,
|
|
342
|
-
"===": (e, t) => e === t,
|
|
343
|
-
"!=": (e, t) => e != t,
|
|
344
|
-
"!==": (e, t) => e !== t,
|
|
345
|
-
">": (e, t) => V(e) > V(t),
|
|
346
|
-
">=": (e, t) => V(e) >= V(t),
|
|
347
|
-
"<": (e, t, n) => {
|
|
348
|
-
let r = V(e), i = V(t);
|
|
349
|
-
if (n === void 0) return r < i;
|
|
350
|
-
let a = V(n);
|
|
351
|
-
return r < i && i < a;
|
|
352
|
-
},
|
|
353
|
-
"<=": (e, t, n) => {
|
|
354
|
-
let r = V(e), i = V(t);
|
|
355
|
-
if (n === void 0) return r <= i;
|
|
356
|
-
let a = V(n);
|
|
357
|
-
return r <= i && i <= a;
|
|
358
|
-
},
|
|
359
|
-
"!!": async (e) => await W(e),
|
|
360
|
-
"!": async (e) => !await W(e),
|
|
361
|
-
"%": (e, t) => V(e) % V(t),
|
|
362
|
-
log: (e) => (console.log(e), e),
|
|
363
|
-
in: (e, t) => t ? z(t) ? t.indexOf(H(e)) !== -1 : B(t) ? t.includes(e) : !1 : !1,
|
|
364
|
-
cat: (...e) => e.map(H).join(""),
|
|
365
|
-
substr: (e, t, n) => {
|
|
366
|
-
let r = H(e), i = V(t);
|
|
367
|
-
if (n === void 0) return r.substr(i);
|
|
368
|
-
let a = V(n);
|
|
369
|
-
if (a < 0) {
|
|
370
|
-
let e = r.substr(i);
|
|
371
|
-
return e.substr(0, e.length + a);
|
|
372
|
-
}
|
|
373
|
-
return r.substr(i, a);
|
|
374
|
-
},
|
|
375
|
-
"+": (...e) => e.reduce((e, t) => V(e) + V(t), 0),
|
|
376
|
-
"*": (...e) => e.reduce((e, t) => V(e) * V(t), 1),
|
|
377
|
-
"-": (e, t) => {
|
|
378
|
-
let n = V(e);
|
|
379
|
-
return t === void 0 ? -n : n - V(t);
|
|
380
|
-
},
|
|
381
|
-
"/": (e, t) => V(e) / V(t),
|
|
382
|
-
min: (...e) => Math.min(...e.map(V)),
|
|
383
|
-
max: (...e) => Math.max(...e.map(V)),
|
|
384
|
-
merge: (...e) => e.reduce((e, t) => B(t) ? e.concat(t) : e.concat([t]), []),
|
|
385
|
-
var(e, t) {
|
|
386
|
-
let n = arguments.length > 1 ? t : null;
|
|
387
|
-
if (e === "" || e === "." || e == null) return this;
|
|
388
|
-
if (typeof e == "number" && Array.isArray(this)) return e >= 0 && e < this.length ? this[e] : n;
|
|
389
|
-
let r = H(e);
|
|
390
|
-
if (r === "" || r === ".") return this;
|
|
391
|
-
let i = r.split("."), a = this;
|
|
392
|
-
for (let e of i) {
|
|
393
|
-
if (a == null) return n;
|
|
394
|
-
if (Array.isArray(a)) {
|
|
395
|
-
let t = parseInt(e, 10);
|
|
396
|
-
a = isNaN(t) ? a[e] : a[t];
|
|
397
|
-
} else a = a[e];
|
|
398
|
-
}
|
|
399
|
-
return a === void 0 ? n : a;
|
|
400
|
-
},
|
|
401
|
-
async missing(...e) {
|
|
402
|
-
let t = B(e[0]) ? e[0] : e, n = [];
|
|
403
|
-
for (let e of t) {
|
|
404
|
-
let t = await U({ var: e }, this);
|
|
405
|
-
(t === null || t === "") && n.push(`${e}`);
|
|
406
|
-
}
|
|
407
|
-
return n;
|
|
408
|
-
},
|
|
409
|
-
async missing_some(e, t) {
|
|
410
|
-
let n = await U({ missing: t }, this);
|
|
411
|
-
if (!B(n) || !B(t)) return [];
|
|
412
|
-
let r = n.filter(z);
|
|
413
|
-
return t.filter(z).length - r.length >= V(e) ? [] : r;
|
|
414
|
-
},
|
|
415
|
-
invoke(...e) {
|
|
416
|
-
let [t, ...n] = e;
|
|
417
|
-
return typeof t == "function" ? Reflect.apply(t, null, n) : null;
|
|
418
|
-
},
|
|
419
|
-
startsWith: (e, t) => z(e) && z(t) && e.startsWith(t),
|
|
420
|
-
endsWith: (e, t) => z(e) && z(t) && e.endsWith(t),
|
|
421
|
-
regexp_matches(e, t) {
|
|
422
|
-
let n = e, r = "";
|
|
423
|
-
if (B(e)) {
|
|
424
|
-
let [t, i] = e;
|
|
425
|
-
n = t, r = i;
|
|
426
|
-
}
|
|
427
|
-
return !z(n) || !z(r) ? !1 : new RegExp(n, r).test(H(t));
|
|
428
|
-
},
|
|
429
|
-
throw(e) {
|
|
430
|
-
throw Error(H(e));
|
|
431
|
-
}
|
|
432
|
-
};
|
|
433
|
-
async function U(e, t) {
|
|
434
|
-
if (!e) return e;
|
|
435
|
-
if (Le(e)) return U(await e, t);
|
|
436
|
-
if (B(e)) return Promise.all(e.map((e) => U(e, t)));
|
|
437
|
-
if (!Re(e)) return e;
|
|
438
|
-
let n = Be(e), r = n ? e[n] ?? [] : [];
|
|
439
|
-
switch (B(r) || (r = [r]), n) {
|
|
440
|
-
case "if":
|
|
441
|
-
case "?:":
|
|
442
|
-
for (let e = 0; e < r.length - 1; e += 2) if (await W(await U(r[e], t))) return U(r[e + 1], t);
|
|
443
|
-
return r.length % 2 == 1 ? U(r[r.length - 1], t) : null;
|
|
444
|
-
case "and": {
|
|
445
|
-
let e = null;
|
|
446
|
-
for (let n of r) if (e = await U(n, t), !await W(e)) return e;
|
|
447
|
-
return e;
|
|
448
|
-
}
|
|
449
|
-
case "or": {
|
|
450
|
-
let e = null;
|
|
451
|
-
for (let n of r) if (e = await U(n, t), await W(e)) return e;
|
|
452
|
-
return e;
|
|
453
|
-
}
|
|
454
|
-
case "map": {
|
|
455
|
-
let e = await U(r[0], t);
|
|
456
|
-
return B(e) ? await Promise.all(e.map((e) => U(r[1], e))) : [];
|
|
457
|
-
}
|
|
458
|
-
case "filter": {
|
|
459
|
-
let e = await U(r[0], t);
|
|
460
|
-
return B(e) ? (await Promise.all(e.map(async (e) => ({
|
|
461
|
-
item: e,
|
|
462
|
-
shouldInclude: await W(await U(r[1], e))
|
|
463
|
-
})))).filter(({ shouldInclude: e }) => e).map(({ item: e }) => e) : [];
|
|
464
|
-
}
|
|
465
|
-
case "reduce": {
|
|
466
|
-
let e = await U(r[0], t);
|
|
467
|
-
if (!B(e)) return r.length > 2 ? await U(r[2], t) : null;
|
|
468
|
-
let n = r[1], i = r.length > 2 ? await U(r[2], t) : null;
|
|
469
|
-
for (let t of e) i = await U(n, {
|
|
470
|
-
current: t,
|
|
471
|
-
accumulator: i
|
|
472
|
-
});
|
|
473
|
-
return i;
|
|
474
|
-
}
|
|
475
|
-
case "all": {
|
|
476
|
-
let e = await U(r[0], t);
|
|
477
|
-
if (!B(e) || e.length === 0) return !1;
|
|
478
|
-
for (let t of e) if (!await W(await U(r[1], t))) return !1;
|
|
479
|
-
return !0;
|
|
480
|
-
}
|
|
481
|
-
case "some": {
|
|
482
|
-
let e = await U(r[0], t);
|
|
483
|
-
if (!B(e)) return !1;
|
|
484
|
-
for (let t of e) if (await W(await U(r[1], t))) return !0;
|
|
485
|
-
return !1;
|
|
486
|
-
}
|
|
487
|
-
case "none": {
|
|
488
|
-
let e = await U(r[0], t);
|
|
489
|
-
if (!B(e)) return !0;
|
|
490
|
-
for (let t of e) if (await W(await U(r[1], t))) return !1;
|
|
491
|
-
return !0;
|
|
492
|
-
}
|
|
493
|
-
case "catch": try {
|
|
494
|
-
return await U(r[0], t);
|
|
495
|
-
} catch (e) {
|
|
496
|
-
return Re(e) ? await U(e, t) : r[1] ? await U(r[1], e) : e instanceof Error ? e.message : e;
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
let i = await Promise.all(r.map((e) => U(e, t))), a = n ? ze[n] : void 0;
|
|
500
|
-
if (!a) throw Error(`Unrecognized operation ${n}`);
|
|
501
|
-
return a.apply(t, i);
|
|
502
|
-
}
|
|
503
|
-
async function W(e) {
|
|
504
|
-
return Le(e) ? W(await e) : !(Array.isArray(e) && e.length === 0) && !!e;
|
|
505
|
-
}
|
|
506
|
-
function Be(e) {
|
|
507
|
-
return Object.keys(e)[0];
|
|
313
|
+
function je(e) {
|
|
314
|
+
return V(Ae, e);
|
|
508
315
|
}
|
|
509
316
|
//#endregion
|
|
510
317
|
//#region src/lifecycle/rules-logic.ts
|
|
511
|
-
function
|
|
318
|
+
function W(e, t, n) {
|
|
512
319
|
return new Proxy(Object.create(null), { get(r, i) {
|
|
513
320
|
if (typeof i != "string") return;
|
|
514
321
|
let a = e.find((e) => e.key === i);
|
|
515
|
-
if (a !== void 0) return async () => !n.has(i) && await
|
|
322
|
+
if (a !== void 0) return async () => !n.has(i) && await E(a.logic, {
|
|
516
323
|
...t,
|
|
517
|
-
conditions:
|
|
324
|
+
conditions: W(e, t, new Set(n).add(i))
|
|
518
325
|
}) === !0;
|
|
519
326
|
} });
|
|
520
327
|
}
|
|
521
|
-
var
|
|
328
|
+
var Me = B(({ client: e }) => j({
|
|
522
329
|
source: {
|
|
523
330
|
stateSnapshot: e.stateSnapshotStore,
|
|
524
331
|
predicates: e.predicates.listStore,
|
|
@@ -554,131 +361,131 @@ var He = F(({ client: e }) => D({
|
|
|
554
361
|
actions: l,
|
|
555
362
|
features: u,
|
|
556
363
|
...s
|
|
557
|
-
}
|
|
558
|
-
return await U(o, {
|
|
364
|
+
}, f = {
|
|
559
365
|
...d,
|
|
560
|
-
conditions:
|
|
561
|
-
}
|
|
366
|
+
conditions: W(a, d, /* @__PURE__ */ new Set())
|
|
367
|
+
};
|
|
368
|
+
return await E(o, f);
|
|
562
369
|
}
|
|
563
370
|
}));
|
|
564
|
-
function
|
|
565
|
-
return
|
|
371
|
+
function Ne(e) {
|
|
372
|
+
return V(Me, e);
|
|
566
373
|
}
|
|
567
374
|
//#endregion
|
|
568
375
|
//#region src/lifecycle/lifecycle.ts
|
|
569
|
-
var G =
|
|
570
|
-
let t = G.store(!1), r =
|
|
376
|
+
var G = P("lifecycle"), Pe = B(({ client: e }) => {
|
|
377
|
+
let t = G.store(!1), r = L(void 0, {
|
|
571
378
|
skipVoid: !1,
|
|
572
379
|
domain: G
|
|
573
|
-
}), i =
|
|
380
|
+
}), i = L(void 0, {
|
|
574
381
|
skipVoid: !1,
|
|
575
382
|
domain: G
|
|
576
|
-
}), a = G.store("idle"), o = G.store([]), s =
|
|
383
|
+
}), a = G.store("idle"), o = G.store([]), s = L(void 0, {
|
|
577
384
|
skipVoid: !1,
|
|
578
385
|
domain: G
|
|
579
|
-
}), l =
|
|
386
|
+
}), l = L(void 0, {
|
|
580
387
|
skipVoid: !1,
|
|
581
388
|
domain: G
|
|
582
|
-
}), u =
|
|
389
|
+
}), u = I(), d = I(), f = I(), p = I(), m = I(), h = I();
|
|
583
390
|
o.on(p, (e, t) => [...e, t]), s.on(m, (e, t) => t), l.on(h, (e, t) => t), t.on(d, () => !0);
|
|
584
|
-
let g =
|
|
391
|
+
let g = F(async () => {
|
|
585
392
|
await ee();
|
|
586
|
-
}), _ =
|
|
587
|
-
await
|
|
588
|
-
}), v =
|
|
393
|
+
}), _ = F(async () => {
|
|
394
|
+
await ve(e);
|
|
395
|
+
}), v = j({ effect: _ }), y = j({
|
|
589
396
|
source: o,
|
|
590
397
|
effect: async (e) => {
|
|
591
398
|
for (let t of e) await t();
|
|
592
399
|
}
|
|
593
|
-
}), b =
|
|
400
|
+
}), b = j({
|
|
594
401
|
source: s,
|
|
595
402
|
effect: async (t) => t === void 0 ? !0 : typeof t == "boolean" ? t : await n(e, t) === !0
|
|
596
|
-
}), x =
|
|
403
|
+
}), x = j({
|
|
597
404
|
source: l,
|
|
598
405
|
effect: async (t) => t === void 0 ? !0 : typeof t == "boolean" ? t : await n(e, t) === !0
|
|
599
|
-
}), S =
|
|
406
|
+
}), S = z({
|
|
600
407
|
clock: u,
|
|
601
408
|
source: a,
|
|
602
409
|
filter: (e) => e === "idle" && c(),
|
|
603
410
|
fn: () => void 0
|
|
604
411
|
});
|
|
605
|
-
|
|
412
|
+
z({
|
|
606
413
|
clock: S,
|
|
607
414
|
fn: () => "starting",
|
|
608
415
|
target: a
|
|
609
|
-
}), S.watch(e.performance.markBegin), d.watch(e.performance.measure),
|
|
416
|
+
}), S.watch(e.performance.markBegin), d.watch(e.performance.measure), z({
|
|
610
417
|
clock: S,
|
|
611
418
|
target: y
|
|
612
|
-
}),
|
|
419
|
+
}), z({
|
|
613
420
|
clock: S,
|
|
614
421
|
target: g
|
|
615
|
-
}),
|
|
422
|
+
}), z({
|
|
616
423
|
clock: y.done,
|
|
617
424
|
target: b
|
|
618
|
-
}),
|
|
425
|
+
}), z({
|
|
619
426
|
clock: b.doneData,
|
|
620
427
|
target: r
|
|
621
|
-
}),
|
|
428
|
+
}), z({
|
|
622
429
|
clock: x.doneData,
|
|
623
430
|
target: i
|
|
624
|
-
}),
|
|
431
|
+
}), z({
|
|
625
432
|
clock: b.doneData,
|
|
626
433
|
filter: (e) => e,
|
|
627
434
|
target: x
|
|
628
|
-
}),
|
|
435
|
+
}), z({
|
|
629
436
|
clock: x.doneData,
|
|
630
437
|
target: e.session.setIsUser
|
|
631
|
-
}),
|
|
438
|
+
}), z({
|
|
632
439
|
clock: x.doneData,
|
|
633
440
|
fn: (e) => ({
|
|
634
441
|
type: "user_decide",
|
|
635
442
|
value: e
|
|
636
443
|
}),
|
|
637
444
|
target: e.eventBus
|
|
638
|
-
}),
|
|
445
|
+
}), z({
|
|
639
446
|
clock: b.doneData,
|
|
640
447
|
filter: (e) => !e,
|
|
641
448
|
fn: () => void 0,
|
|
642
449
|
target: f
|
|
643
|
-
}),
|
|
450
|
+
}), z({
|
|
644
451
|
clock: x.doneData,
|
|
645
452
|
fn: () => void 0,
|
|
646
453
|
target: f
|
|
647
|
-
}),
|
|
454
|
+
}), z({
|
|
648
455
|
clock: f,
|
|
649
456
|
fn: () => ({ type: "initialize" }),
|
|
650
457
|
target: e.eventBus
|
|
651
458
|
});
|
|
652
|
-
let C =
|
|
653
|
-
|
|
459
|
+
let C = L(!1).on(g.done, () => !0), w = L(!1).on(f, () => !0), te = L(!1).on(v.done, () => !0), T = M(r, i, (e, t) => e === !0 && t === !0);
|
|
460
|
+
z({
|
|
654
461
|
clock: f,
|
|
655
462
|
source: T,
|
|
656
463
|
filter: (e) => e,
|
|
657
464
|
fn: () => void 0,
|
|
658
465
|
target: _
|
|
659
466
|
});
|
|
660
|
-
let
|
|
661
|
-
|
|
662
|
-
clock:
|
|
467
|
+
let E = M(C, w, T, (e, t, n) => e && t && n);
|
|
468
|
+
z({
|
|
469
|
+
clock: E,
|
|
663
470
|
filter: (e) => e,
|
|
664
471
|
fn: () => void 0,
|
|
665
472
|
target: v
|
|
666
473
|
});
|
|
667
|
-
let
|
|
668
|
-
return
|
|
669
|
-
clock:
|
|
474
|
+
let ne = M(C, w, T, te, (e, t, n, r) => e && t && (!n || r));
|
|
475
|
+
return z({
|
|
476
|
+
clock: ne,
|
|
670
477
|
filter: (e) => e,
|
|
671
478
|
fn: () => void 0,
|
|
672
479
|
target: d
|
|
673
|
-
}),
|
|
480
|
+
}), z({
|
|
674
481
|
clock: d,
|
|
675
482
|
fn: () => "ready",
|
|
676
483
|
target: a
|
|
677
|
-
}),
|
|
484
|
+
}), z({
|
|
678
485
|
clock: d,
|
|
679
486
|
fn: () => ({ type: "ready" }),
|
|
680
487
|
target: e.eventBus
|
|
681
|
-
}),
|
|
488
|
+
}), z({
|
|
682
489
|
clock: d,
|
|
683
490
|
source: e.session.store,
|
|
684
491
|
fn: ({ id: e, isUser: t, identifiers: n }) => ({
|
|
@@ -688,7 +495,7 @@ var G = A("lifecycle"), We = F(({ client: e }) => {
|
|
|
688
495
|
identifiers: n
|
|
689
496
|
}),
|
|
690
497
|
target: e.eventBus
|
|
691
|
-
}),
|
|
498
|
+
}), z({
|
|
692
499
|
clock: [
|
|
693
500
|
y.fail,
|
|
694
501
|
b.fail,
|
|
@@ -710,13 +517,13 @@ var G = A("lifecycle"), We = F(({ client: e }) => {
|
|
|
710
517
|
setCondition: h
|
|
711
518
|
};
|
|
712
519
|
});
|
|
713
|
-
function
|
|
714
|
-
return
|
|
520
|
+
function Fe(e) {
|
|
521
|
+
return V(Pe, e);
|
|
715
522
|
}
|
|
716
523
|
//#endregion
|
|
717
524
|
//#region src/entities/predicate/predicate.ts
|
|
718
|
-
var
|
|
719
|
-
let t =
|
|
525
|
+
var Ie = P("predicate"), Le = B(({ client: e }) => {
|
|
526
|
+
let t = Ie.store({}), n = N(t, { register(e, t) {
|
|
720
527
|
return {
|
|
721
528
|
...e,
|
|
722
529
|
[t.name]: {
|
|
@@ -724,13 +531,13 @@ var Ke = A("predicate"), qe = F(({ client: e }) => {
|
|
|
724
531
|
predicate: t.predicate
|
|
725
532
|
}
|
|
726
533
|
};
|
|
727
|
-
} }), i =
|
|
728
|
-
|
|
534
|
+
} }), i = I();
|
|
535
|
+
z({
|
|
729
536
|
clock: i,
|
|
730
537
|
source: t,
|
|
731
538
|
filter: (e, { name: t }) => e[t] !== void 0,
|
|
732
539
|
fn: (e, { name: t }) => `Predicate '${t}' already registered. Registering again will override the previous registration.`
|
|
733
|
-
}).watch((e) => /* @__PURE__ */ r("warn", e)),
|
|
540
|
+
}).watch((e) => /* @__PURE__ */ r("warn", e)), z({
|
|
734
541
|
clock: i,
|
|
735
542
|
fn: ({ name: e, predicate: t }) => Object.freeze({
|
|
736
543
|
name: e,
|
|
@@ -743,7 +550,7 @@ var Ke = A("predicate"), qe = F(({ client: e }) => {
|
|
|
743
550
|
return t.map((t) => t[e]?.predicate, { skipVoid: !1 });
|
|
744
551
|
}
|
|
745
552
|
function s(t) {
|
|
746
|
-
let n =
|
|
553
|
+
let n = L(() => void 0, { skipVoid: !1 }), r = j({
|
|
747
554
|
source: {
|
|
748
555
|
predicate: o(t),
|
|
749
556
|
snapshot: e.stateSnapshotStore
|
|
@@ -755,13 +562,13 @@ var Ke = A("predicate"), qe = F(({ client: e }) => {
|
|
|
755
562
|
});
|
|
756
563
|
}
|
|
757
564
|
});
|
|
758
|
-
return
|
|
565
|
+
return z({
|
|
759
566
|
source: {
|
|
760
567
|
responses: e.responses.listStore,
|
|
761
568
|
fields: e.fields.listStore
|
|
762
569
|
},
|
|
763
570
|
target: r
|
|
764
|
-
}),
|
|
571
|
+
}), z({
|
|
765
572
|
clock: r.doneData,
|
|
766
573
|
filter: (e) => e !== void 0,
|
|
767
574
|
target: n
|
|
@@ -774,26 +581,26 @@ var Ke = A("predicate"), qe = F(({ client: e }) => {
|
|
|
774
581
|
getEvokablePredicate: s
|
|
775
582
|
};
|
|
776
583
|
});
|
|
777
|
-
function
|
|
778
|
-
return
|
|
584
|
+
function Re(e) {
|
|
585
|
+
return V(Le, e);
|
|
779
586
|
}
|
|
780
|
-
var
|
|
587
|
+
var ze = (e, t, n) => {
|
|
781
588
|
n.register({
|
|
782
589
|
name: e,
|
|
783
590
|
predicate: t
|
|
784
591
|
});
|
|
785
|
-
}, K =
|
|
786
|
-
function
|
|
592
|
+
}, K = P("history");
|
|
593
|
+
function Be(e, t) {
|
|
787
594
|
return {
|
|
788
|
-
id:
|
|
595
|
+
id: ue(`history-entry-${Date.now()}-${Math.random()}}`),
|
|
789
596
|
node: t,
|
|
790
597
|
at: Date.now(),
|
|
791
598
|
experienceId: e
|
|
792
599
|
};
|
|
793
600
|
}
|
|
794
|
-
var
|
|
601
|
+
var Ve = B(() => {
|
|
795
602
|
let e = K.store({ entries: [] }), t = K.event(), n = K.event(), r = K.event(), i = K.event();
|
|
796
|
-
e.on(t, (e, t) => ({ entries: [...e.entries,
|
|
603
|
+
e.on(t, (e, t) => ({ entries: [...e.entries, Be(t.experienceId, t.node)] })), e.on(n, (e, t) => ({ entries: [...e.entries.slice(0, -1), Be(t.experienceId, t.node)] })), e.on(i, (e, t) => t);
|
|
797
604
|
function a(e, t) {
|
|
798
605
|
let n = {
|
|
799
606
|
lastStepIndex: -1,
|
|
@@ -823,22 +630,22 @@ var Ze = F(() => {
|
|
|
823
630
|
entriesStore: e.map((e) => e.entries)
|
|
824
631
|
};
|
|
825
632
|
});
|
|
826
|
-
function
|
|
827
|
-
return
|
|
633
|
+
function He() {
|
|
634
|
+
return V(Ve);
|
|
828
635
|
}
|
|
829
636
|
//#endregion
|
|
830
637
|
//#region src/utils/events.ts
|
|
831
|
-
var
|
|
832
|
-
let t =
|
|
638
|
+
var Ue = 0, We = (e) => {
|
|
639
|
+
let t = L([]);
|
|
833
640
|
return t.on(e, (e, t) => [...e, {
|
|
834
|
-
id:
|
|
641
|
+
id: Ue++,
|
|
835
642
|
at: /* @__PURE__ */ new Date(),
|
|
836
643
|
payload: t
|
|
837
644
|
}]), t;
|
|
838
645
|
};
|
|
839
646
|
//#endregion
|
|
840
647
|
//#region src/entities/field/policies.ts
|
|
841
|
-
function
|
|
648
|
+
function Ge(e) {
|
|
842
649
|
let { doNotTrackValue: t, doNotStoreValue: n } = e ?? {}, r = e?.trackValue ?? t === !1, i = e?.storeValue ?? n === !1;
|
|
843
650
|
return {
|
|
844
651
|
trackValue: r,
|
|
@@ -849,10 +656,10 @@ function tt(e) {
|
|
|
849
656
|
}
|
|
850
657
|
//#endregion
|
|
851
658
|
//#region src/entities/field/field.ts
|
|
852
|
-
var
|
|
853
|
-
let e =
|
|
659
|
+
var Ke = P("field"), qe = B(() => {
|
|
660
|
+
let e = Ke.store({}), t = N(e, {
|
|
854
661
|
register(e, t) {
|
|
855
|
-
let n = Object.assign({}, t.field, { policies:
|
|
662
|
+
let n = Object.assign({}, t.field, { policies: Ge(t.field.policies) });
|
|
856
663
|
return {
|
|
857
664
|
...e,
|
|
858
665
|
[n.id]: n
|
|
@@ -864,7 +671,7 @@ var nt = A("field"), rt = F(() => {
|
|
|
864
671
|
let r = Object.assign({}, n, t.updates);
|
|
865
672
|
return {
|
|
866
673
|
...e,
|
|
867
|
-
[n.id]: Object.assign({}, r, { policies:
|
|
674
|
+
[n.id]: Object.assign({}, r, { policies: Ge(r.policies) })
|
|
868
675
|
};
|
|
869
676
|
}
|
|
870
677
|
});
|
|
@@ -901,13 +708,13 @@ var nt = A("field"), rt = F(() => {
|
|
|
901
708
|
getByName: c
|
|
902
709
|
};
|
|
903
710
|
});
|
|
904
|
-
function
|
|
905
|
-
return
|
|
711
|
+
function Je() {
|
|
712
|
+
return V(qe);
|
|
906
713
|
}
|
|
907
714
|
//#endregion
|
|
908
715
|
//#region src/entities/step/step.ts
|
|
909
|
-
var
|
|
910
|
-
let e =
|
|
716
|
+
var Ye = P("step"), Xe = B(() => {
|
|
717
|
+
let e = Ye.store({}), t = N(e, { register(e, t) {
|
|
911
718
|
return {
|
|
912
719
|
...e,
|
|
913
720
|
[t.step.id]: t.step
|
|
@@ -931,16 +738,16 @@ var at = A("step"), ot = F(() => {
|
|
|
931
738
|
indexStore: e
|
|
932
739
|
};
|
|
933
740
|
});
|
|
934
|
-
function
|
|
935
|
-
return
|
|
741
|
+
function Ze() {
|
|
742
|
+
return V(Xe);
|
|
936
743
|
}
|
|
937
|
-
function
|
|
744
|
+
function Qe(e, t) {
|
|
938
745
|
t.register(e);
|
|
939
746
|
}
|
|
940
747
|
//#endregion
|
|
941
748
|
//#region src/entities/content/content.ts
|
|
942
|
-
var
|
|
943
|
-
let e =
|
|
749
|
+
var $e = P("content"), et = B(() => {
|
|
750
|
+
let e = $e.store({}), t = N(e, {
|
|
944
751
|
register(e, t) {
|
|
945
752
|
return {
|
|
946
753
|
...e,
|
|
@@ -981,16 +788,16 @@ var lt = A("content"), ut = F(() => {
|
|
|
981
788
|
indexStore: e
|
|
982
789
|
};
|
|
983
790
|
});
|
|
984
|
-
function
|
|
985
|
-
return
|
|
791
|
+
function tt() {
|
|
792
|
+
return V(et);
|
|
986
793
|
}
|
|
987
|
-
function
|
|
794
|
+
function nt(e, t) {
|
|
988
795
|
t.register(e);
|
|
989
796
|
}
|
|
990
797
|
//#endregion
|
|
991
798
|
//#region src/entities/action/action.ts
|
|
992
|
-
var
|
|
993
|
-
let t =
|
|
799
|
+
var rt = P("action"), it = B(({ client: e }) => {
|
|
800
|
+
let t = rt.store({}), n = N(t, { register(e, t) {
|
|
994
801
|
return {
|
|
995
802
|
...e,
|
|
996
803
|
[t.key]: {
|
|
@@ -998,13 +805,13 @@ var pt = A("action"), mt = F(({ client: e }) => {
|
|
|
998
805
|
action: t.action
|
|
999
806
|
}
|
|
1000
807
|
};
|
|
1001
|
-
} }), i =
|
|
1002
|
-
|
|
808
|
+
} }), i = I();
|
|
809
|
+
z({
|
|
1003
810
|
clock: i,
|
|
1004
811
|
source: t,
|
|
1005
812
|
filter: (e, { key: t }) => e[t] !== void 0,
|
|
1006
813
|
fn: (e, { key: t }) => `Action '${t}' already registered. Registering again will override the previous registration.`
|
|
1007
|
-
}).watch((e) => /* @__PURE__ */ r("warn", e)),
|
|
814
|
+
}).watch((e) => /* @__PURE__ */ r("warn", e)), z({
|
|
1008
815
|
clock: i,
|
|
1009
816
|
fn: ({ key: e, action: t }) => Object.freeze({
|
|
1010
817
|
key: e,
|
|
@@ -1017,7 +824,7 @@ var pt = A("action"), mt = F(({ client: e }) => {
|
|
|
1017
824
|
return t.map((t) => t[e]?.action, { skipVoid: !1 });
|
|
1018
825
|
}
|
|
1019
826
|
function s(t, n) {
|
|
1020
|
-
let r =
|
|
827
|
+
let r = L(() => void 0, { skipVoid: !1 }), i = n ? { experience: n.experience } : null, a = j({
|
|
1021
828
|
source: {
|
|
1022
829
|
action: o(t),
|
|
1023
830
|
snapshot: e.stateSnapshotStore
|
|
@@ -1029,13 +836,13 @@ var pt = A("action"), mt = F(({ client: e }) => {
|
|
|
1029
836
|
}, i);
|
|
1030
837
|
}
|
|
1031
838
|
});
|
|
1032
|
-
return
|
|
839
|
+
return z({
|
|
1033
840
|
source: {
|
|
1034
841
|
responses: e.responses.listStore,
|
|
1035
842
|
fields: e.fields.listStore
|
|
1036
843
|
},
|
|
1037
844
|
target: a
|
|
1038
|
-
}),
|
|
845
|
+
}), z({
|
|
1039
846
|
clock: a.doneData,
|
|
1040
847
|
filter: (e) => e !== void 0,
|
|
1041
848
|
target: r
|
|
@@ -1048,10 +855,10 @@ var pt = A("action"), mt = F(({ client: e }) => {
|
|
|
1048
855
|
getEvokableAction: s
|
|
1049
856
|
};
|
|
1050
857
|
});
|
|
1051
|
-
function
|
|
1052
|
-
return
|
|
858
|
+
function at(e) {
|
|
859
|
+
return V(it, e);
|
|
1053
860
|
}
|
|
1054
|
-
var
|
|
861
|
+
var ot = (e, t, n) => {
|
|
1055
862
|
n.register({
|
|
1056
863
|
key: e,
|
|
1057
864
|
action: t
|
|
@@ -1070,35 +877,35 @@ function q(e, t, n, r) {
|
|
|
1070
877
|
function J(e) {
|
|
1071
878
|
return e === null || e === "" || Array.isArray(e) && !e.length;
|
|
1072
879
|
}
|
|
1073
|
-
function
|
|
880
|
+
function st(e) {
|
|
1074
881
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
|
|
1075
882
|
}
|
|
1076
|
-
function
|
|
883
|
+
function ct(e) {
|
|
1077
884
|
try {
|
|
1078
885
|
return JSON.stringify(e), !0;
|
|
1079
886
|
} catch {
|
|
1080
887
|
return !1;
|
|
1081
888
|
}
|
|
1082
889
|
}
|
|
1083
|
-
function
|
|
890
|
+
function lt(e, t) {
|
|
1084
891
|
return t.find((t) => t.key === e) ?? null;
|
|
1085
892
|
}
|
|
1086
|
-
function
|
|
893
|
+
function ut(e, t) {
|
|
1087
894
|
return e.multiple && (typeof t == "string" || typeof t == "number" || typeof t == "boolean") ? [t] : t;
|
|
1088
895
|
}
|
|
1089
|
-
function
|
|
896
|
+
function dt(e, t) {
|
|
1090
897
|
if (e.type !== "object" || J(t)) return null;
|
|
1091
898
|
if (e.multiple) {
|
|
1092
899
|
if (!Array.isArray(t)) return q(e, t, "This field expects multiple values", "Field expects an array of objects.");
|
|
1093
900
|
for (let n of t) {
|
|
1094
901
|
if (typeof n != "object" || !n) return q(e, t, "This field expects object values", "Field expects an array of objects, but received non-object value.");
|
|
1095
|
-
if (!
|
|
902
|
+
if (!ct(n)) return q(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
|
|
1096
903
|
}
|
|
1097
904
|
return null;
|
|
1098
905
|
}
|
|
1099
|
-
return Array.isArray(t) ? q(e, t, "This field expects a single value", "Field expects a single object, not an array.") : typeof t != "object" || !t ? q(e, t, "This field expects an object value", "Field expects an object value.") :
|
|
906
|
+
return Array.isArray(t) ? q(e, t, "This field expects a single value", "Field expects a single object, not an array.") : typeof t != "object" || !t ? q(e, t, "This field expects an object value", "Field expects an object value.") : ct(t) ? null : q(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
|
|
1100
907
|
}
|
|
1101
|
-
function
|
|
908
|
+
function ft(e, t) {
|
|
1102
909
|
if (J(t) || !Array.isArray(e.options) || e.options.length === 0) return null;
|
|
1103
910
|
let n = Array.isArray(t) ? t : [t];
|
|
1104
911
|
if (e.type === "object") {
|
|
@@ -1106,9 +913,9 @@ function St(e, t) {
|
|
|
1106
913
|
return n.every((e) => r.has(JSON.stringify(e))) ? null : q(e, t, "This field expects a valid option", "Field expects a valid option from the defined choices.");
|
|
1107
914
|
}
|
|
1108
915
|
let r = e.options.map((e) => e.value);
|
|
1109
|
-
return n.every((e) => !
|
|
916
|
+
return n.every((e) => !st(e) || e === null ? !1 : r.includes(e)) ? null : q(e, t, "This field expects a valid option", `Field expects a valid option. Valid options are: ${r.join(", ")}`);
|
|
1110
917
|
}
|
|
1111
|
-
async function
|
|
918
|
+
async function pt(t, n, r, i) {
|
|
1112
919
|
if (n.validation && !e(n.validation) && !J(r)) {
|
|
1113
920
|
let e = i ? {
|
|
1114
921
|
$input: r,
|
|
@@ -1121,8 +928,8 @@ async function Ct(t, n, r, i) {
|
|
|
1121
928
|
}
|
|
1122
929
|
//#endregion
|
|
1123
930
|
//#region src/entities/response/response.ts
|
|
1124
|
-
var
|
|
1125
|
-
let t =
|
|
931
|
+
var mt = P("response"), ht = B(({ client: e }) => {
|
|
932
|
+
let t = mt.store({}), r = I(), i = I(), a = N(t, {
|
|
1126
933
|
register(e, t) {
|
|
1127
934
|
return {
|
|
1128
935
|
...e,
|
|
@@ -1151,7 +958,7 @@ var wt = A("response"), Tt = F(({ client: e }) => {
|
|
|
1151
958
|
});
|
|
1152
959
|
} else a.registerBatch(e);
|
|
1153
960
|
}
|
|
1154
|
-
let s = (t, r) => n(e, t, r), c =
|
|
961
|
+
let s = (t, r) => n(e, t, r), c = j({
|
|
1155
962
|
source: {
|
|
1156
963
|
allFields: e.fields.listStore,
|
|
1157
964
|
existingResponses: t
|
|
@@ -1161,7 +968,7 @@ var wt = A("response"), Tt = F(({ client: e }) => {
|
|
|
1161
968
|
...t,
|
|
1162
969
|
...n
|
|
1163
970
|
}, o = Object.entries(n), c = await Promise.allSettled(o.map(async ([t, n]) => {
|
|
1164
|
-
let o =
|
|
971
|
+
let o = lt(t, e);
|
|
1165
972
|
if (!o) {
|
|
1166
973
|
r.push({
|
|
1167
974
|
fieldKey: t,
|
|
@@ -1171,17 +978,17 @@ var wt = A("response"), Tt = F(({ client: e }) => {
|
|
|
1171
978
|
});
|
|
1172
979
|
return;
|
|
1173
980
|
}
|
|
1174
|
-
let c =
|
|
981
|
+
let c = ut(o, n), l = await pt(s, o, c, a);
|
|
1175
982
|
if (l) {
|
|
1176
983
|
r.push(l);
|
|
1177
984
|
return;
|
|
1178
985
|
}
|
|
1179
|
-
let u =
|
|
986
|
+
let u = dt(o, c);
|
|
1180
987
|
if (u) {
|
|
1181
988
|
r.push(u);
|
|
1182
989
|
return;
|
|
1183
990
|
}
|
|
1184
|
-
let d =
|
|
991
|
+
let d = ft(o, c);
|
|
1185
992
|
if (d) {
|
|
1186
993
|
r.push(d);
|
|
1187
994
|
return;
|
|
@@ -1209,7 +1016,7 @@ var wt = A("response"), Tt = F(({ client: e }) => {
|
|
|
1209
1016
|
async function l(e) {
|
|
1210
1017
|
return c(e);
|
|
1211
1018
|
}
|
|
1212
|
-
let u =
|
|
1019
|
+
let u = j({
|
|
1213
1020
|
source: t,
|
|
1214
1021
|
effect: async (e, t) => {
|
|
1215
1022
|
let { responsesToCommit: n, validationErrors: r } = await c(t);
|
|
@@ -1224,7 +1031,7 @@ var wt = A("response"), Tt = F(({ client: e }) => {
|
|
|
1224
1031
|
value: t
|
|
1225
1032
|
})));
|
|
1226
1033
|
function m(e) {
|
|
1227
|
-
return
|
|
1034
|
+
return M({
|
|
1228
1035
|
f: e,
|
|
1229
1036
|
s: t
|
|
1230
1037
|
}, ({ f: e, s: t }) => {
|
|
@@ -1241,10 +1048,10 @@ var wt = A("response"), Tt = F(({ client: e }) => {
|
|
|
1241
1048
|
function _(t) {
|
|
1242
1049
|
return m(e.fields.getByName(t));
|
|
1243
1050
|
}
|
|
1244
|
-
return
|
|
1051
|
+
return z({
|
|
1245
1052
|
clock: r,
|
|
1246
1053
|
target: a.clearAll
|
|
1247
|
-
}),
|
|
1054
|
+
}), z({
|
|
1248
1055
|
clock: i,
|
|
1249
1056
|
target: a.clear
|
|
1250
1057
|
}), {
|
|
@@ -1260,13 +1067,13 @@ var wt = A("response"), Tt = F(({ client: e }) => {
|
|
|
1260
1067
|
getByFieldName: _
|
|
1261
1068
|
};
|
|
1262
1069
|
});
|
|
1263
|
-
function
|
|
1264
|
-
return
|
|
1070
|
+
function gt(e) {
|
|
1071
|
+
return V(ht, e);
|
|
1265
1072
|
}
|
|
1266
1073
|
//#endregion
|
|
1267
1074
|
//#region src/entities/condition/condition.ts
|
|
1268
|
-
var
|
|
1269
|
-
let e =
|
|
1075
|
+
var _t = P("condition"), vt = B(() => {
|
|
1076
|
+
let e = _t.store({}), t = N(e, { register(e, t) {
|
|
1270
1077
|
return {
|
|
1271
1078
|
...e,
|
|
1272
1079
|
[t.condition.id]: t.condition
|
|
@@ -1290,12 +1097,12 @@ var Dt = A("condition"), Ot = F(() => {
|
|
|
1290
1097
|
indexStore: e
|
|
1291
1098
|
};
|
|
1292
1099
|
});
|
|
1293
|
-
function
|
|
1294
|
-
return
|
|
1100
|
+
function yt() {
|
|
1101
|
+
return V(vt);
|
|
1295
1102
|
}
|
|
1296
1103
|
//#endregion
|
|
1297
1104
|
//#region src/utils/api-url.ts
|
|
1298
|
-
function
|
|
1105
|
+
function bt() {
|
|
1299
1106
|
if (c()) {
|
|
1300
1107
|
let e = [
|
|
1301
1108
|
document.currentScript,
|
|
@@ -1310,25 +1117,25 @@ function At() {
|
|
|
1310
1117
|
}
|
|
1311
1118
|
//#endregion
|
|
1312
1119
|
//#region src/utils/user-timing.ts
|
|
1313
|
-
var
|
|
1314
|
-
function
|
|
1120
|
+
var xt = "picked:start:begin", St = "picked:start";
|
|
1121
|
+
function Ct() {
|
|
1315
1122
|
try {
|
|
1316
1123
|
return s() && !!p.window && "performance" in p;
|
|
1317
1124
|
} catch {
|
|
1318
1125
|
return !1;
|
|
1319
1126
|
}
|
|
1320
1127
|
}
|
|
1321
|
-
function
|
|
1128
|
+
function wt() {
|
|
1322
1129
|
let e = null, t = null;
|
|
1323
1130
|
return {
|
|
1324
1131
|
markBegin: () => {
|
|
1325
|
-
if (
|
|
1326
|
-
e = performance.mark(
|
|
1132
|
+
if (Ct()) try {
|
|
1133
|
+
e = performance.mark(xt).startTime;
|
|
1327
1134
|
} catch {}
|
|
1328
1135
|
},
|
|
1329
1136
|
measure: () => {
|
|
1330
|
-
if (!(!
|
|
1331
|
-
t = performance.measure(
|
|
1137
|
+
if (!(!Ct() || e === null)) try {
|
|
1138
|
+
t = performance.measure(St, { start: e });
|
|
1332
1139
|
} catch {}
|
|
1333
1140
|
},
|
|
1334
1141
|
get startMeasure() {
|
|
@@ -1338,7 +1145,7 @@ function Pt() {
|
|
|
1338
1145
|
}
|
|
1339
1146
|
//#endregion
|
|
1340
1147
|
//#region src/utils/client-telemetry.ts
|
|
1341
|
-
function
|
|
1148
|
+
function Tt() {
|
|
1342
1149
|
let e = null;
|
|
1343
1150
|
return {
|
|
1344
1151
|
observeDeliveryAPIRequests: (t) => {
|
|
@@ -1351,13 +1158,13 @@ function Ft() {
|
|
|
1351
1158
|
}
|
|
1352
1159
|
//#endregion
|
|
1353
1160
|
//#region src/entities/session/session.ts
|
|
1354
|
-
var
|
|
1355
|
-
function
|
|
1161
|
+
var Et = O("session", "global");
|
|
1162
|
+
function Dt() {
|
|
1356
1163
|
return m() ? crypto.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).substring(2, 15)}-${Math.random().toString(36).substring(2, 15)}-${Math.random().toString(36).substring(2, 15)}`;
|
|
1357
1164
|
}
|
|
1358
|
-
function
|
|
1165
|
+
function Ot() {
|
|
1359
1166
|
if (!h()) return null;
|
|
1360
|
-
let e =
|
|
1167
|
+
let e = D.get(Et);
|
|
1361
1168
|
if (!e.isSet()) return null;
|
|
1362
1169
|
try {
|
|
1363
1170
|
return e.json();
|
|
@@ -1365,10 +1172,10 @@ function Rt() {
|
|
|
1365
1172
|
return null;
|
|
1366
1173
|
}
|
|
1367
1174
|
}
|
|
1368
|
-
var
|
|
1369
|
-
let e =
|
|
1175
|
+
var kt = B(() => {
|
|
1176
|
+
let e = Ot(), t = { id: e?.id ?? Dt() };
|
|
1370
1177
|
e?.isUser !== void 0 && (t.isUser = e.isUser), e?.identifiers && Object.keys(e.identifiers).length > 0 && (t.identifiers = e.identifiers);
|
|
1371
|
-
let n =
|
|
1178
|
+
let n = L(t), r = N(n, {
|
|
1372
1179
|
setIsUser: (e, t) => ({
|
|
1373
1180
|
...e,
|
|
1374
1181
|
isUser: t
|
|
@@ -1388,15 +1195,15 @@ var zt = F(() => {
|
|
|
1388
1195
|
let i = { id: e.id };
|
|
1389
1196
|
return e.isUser !== void 0 && (i.isUser = e.isUser), Object.keys(r).length > 0 && (i.identifiers = r), i;
|
|
1390
1197
|
}
|
|
1391
|
-
}), i =
|
|
1198
|
+
}), i = j({
|
|
1392
1199
|
source: n,
|
|
1393
1200
|
effect: (e) => {
|
|
1394
1201
|
if (h()) try {
|
|
1395
|
-
|
|
1202
|
+
D.get(Et).set(e);
|
|
1396
1203
|
} catch {}
|
|
1397
1204
|
}
|
|
1398
1205
|
});
|
|
1399
|
-
return
|
|
1206
|
+
return z({
|
|
1400
1207
|
source: n,
|
|
1401
1208
|
target: i
|
|
1402
1209
|
}), {
|
|
@@ -1406,27 +1213,27 @@ var zt = F(() => {
|
|
|
1406
1213
|
removeIdentifier: r.removeIdentifier
|
|
1407
1214
|
};
|
|
1408
1215
|
});
|
|
1409
|
-
function
|
|
1410
|
-
return
|
|
1216
|
+
function At() {
|
|
1217
|
+
return V(kt, void 0);
|
|
1411
1218
|
}
|
|
1412
1219
|
//#endregion
|
|
1413
1220
|
//#region src/utils/picked-config.ts
|
|
1414
|
-
function
|
|
1221
|
+
function jt() {
|
|
1415
1222
|
if (s()) return globalThis.window.pickedConfig;
|
|
1416
1223
|
}
|
|
1417
|
-
function
|
|
1418
|
-
if (s()) return
|
|
1224
|
+
function Mt() {
|
|
1225
|
+
if (s()) return jt()?.projectId;
|
|
1419
1226
|
}
|
|
1420
|
-
function
|
|
1227
|
+
function Nt() {
|
|
1421
1228
|
if (!c()) return;
|
|
1422
1229
|
let e = document.getElementById("picked_script") || document.querySelector("script#picked") || document.getElementById("cvly");
|
|
1423
1230
|
if (e) return e.dataset.projectid || e.getAttribute("project-id") || void 0;
|
|
1424
1231
|
}
|
|
1425
|
-
function
|
|
1232
|
+
function Pt(e) {
|
|
1426
1233
|
if (e.projectId) return e.projectId;
|
|
1427
|
-
let t =
|
|
1234
|
+
let t = Mt();
|
|
1428
1235
|
if (t) return t;
|
|
1429
|
-
let n =
|
|
1236
|
+
let n = Nt();
|
|
1430
1237
|
if (n) return n;
|
|
1431
1238
|
throw Error("projectId is required. You can provide it via one of:\n (1) createClient({ projectId }) options;\n (2) window.pickedConfig = { projectId };\n (3) a <script> tag with id 'picked_script', 'picked', or 'cvly' that includes a data-projectid (or project-id) attribute.");
|
|
1432
1239
|
}
|
|
@@ -1435,7 +1242,7 @@ function Wt(e) {
|
|
|
1435
1242
|
function Y(e) {
|
|
1436
1243
|
return e == null || e === "" || Number.isNaN(e);
|
|
1437
1244
|
}
|
|
1438
|
-
var
|
|
1245
|
+
var Ft = {
|
|
1439
1246
|
default: (e, t) => Y(e) ? String(t ?? "") : String(e),
|
|
1440
1247
|
append: (e, t) => t && !Y(e) ? `${e} ${t}` : e,
|
|
1441
1248
|
prepend: (e, t) => t && !Y(e) ? `${t} ${e}` : e,
|
|
@@ -1456,24 +1263,24 @@ var Gt = {
|
|
|
1456
1263
|
return e instanceof Set ? t.format(Array.from(e).map(String)) : e;
|
|
1457
1264
|
}
|
|
1458
1265
|
};
|
|
1459
|
-
function
|
|
1266
|
+
function It(e) {
|
|
1460
1267
|
return typeof e == "object" && !!e;
|
|
1461
1268
|
}
|
|
1462
|
-
function
|
|
1269
|
+
function Lt(e, t) {
|
|
1463
1270
|
let n = t;
|
|
1464
|
-
for (let t of e.split(".")) if (
|
|
1271
|
+
for (let t of e.split(".")) if (It(n) && t in n) n = n[t];
|
|
1465
1272
|
else return;
|
|
1466
1273
|
return typeof n == "function" ? n() : n;
|
|
1467
1274
|
}
|
|
1468
|
-
function
|
|
1469
|
-
let n = e.split("|").map((e) => e.trim()), r =
|
|
1275
|
+
function Rt(e, t) {
|
|
1276
|
+
let n = e.split("|").map((e) => e.trim()), r = Lt(n.shift() ?? "", t);
|
|
1470
1277
|
for (let e of n) {
|
|
1471
|
-
let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o =
|
|
1278
|
+
let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o = Ft[i];
|
|
1472
1279
|
o && (r = o(r, a));
|
|
1473
1280
|
}
|
|
1474
1281
|
return Y(r) ? "" : typeof r == "object" ? JSON.stringify(r) : String(r);
|
|
1475
1282
|
}
|
|
1476
|
-
function
|
|
1283
|
+
function zt(e, t) {
|
|
1477
1284
|
let n = "", r = 0;
|
|
1478
1285
|
for (; r < e.length;) if (e[r] === "{" && e[r + 1] === "{") {
|
|
1479
1286
|
r += 2;
|
|
@@ -1485,13 +1292,13 @@ function Yt(e, t) {
|
|
|
1485
1292
|
}
|
|
1486
1293
|
i += e[r++];
|
|
1487
1294
|
}
|
|
1488
|
-
n +=
|
|
1295
|
+
n += Rt(i.trim(), t);
|
|
1489
1296
|
} else n += e[r++];
|
|
1490
1297
|
return n;
|
|
1491
1298
|
}
|
|
1492
1299
|
//#endregion
|
|
1493
1300
|
//#region src/picked.ts
|
|
1494
|
-
var
|
|
1301
|
+
var Bt = class {
|
|
1495
1302
|
static logger = r;
|
|
1496
1303
|
options;
|
|
1497
1304
|
dataSource = null;
|
|
@@ -1501,60 +1308,60 @@ var X = class {
|
|
|
1501
1308
|
contentLoader;
|
|
1502
1309
|
previewEmbedderOrigins = null;
|
|
1503
1310
|
plugins = {};
|
|
1504
|
-
telemetry =
|
|
1311
|
+
telemetry = Tt();
|
|
1505
1312
|
dataProviders = /* @__PURE__ */ new Map();
|
|
1506
|
-
eventBus =
|
|
1313
|
+
eventBus = I();
|
|
1507
1314
|
events;
|
|
1508
1315
|
projectId;
|
|
1509
1316
|
apiUrl;
|
|
1510
1317
|
dashboardUrl;
|
|
1511
1318
|
documentationSiteUrl;
|
|
1512
|
-
session =
|
|
1513
|
-
performance =
|
|
1514
|
-
searchParams =
|
|
1515
|
-
history =
|
|
1516
|
-
components =
|
|
1319
|
+
session = At();
|
|
1320
|
+
performance = wt();
|
|
1321
|
+
searchParams = ie();
|
|
1322
|
+
history = He();
|
|
1323
|
+
components = Te({ client: this });
|
|
1517
1324
|
experienceInstances = w({ client: this });
|
|
1518
|
-
experiences =
|
|
1519
|
-
frameworks =
|
|
1520
|
-
predicates =
|
|
1521
|
-
features =
|
|
1522
|
-
conditions =
|
|
1523
|
-
fields =
|
|
1524
|
-
responses =
|
|
1525
|
-
steps =
|
|
1526
|
-
contents =
|
|
1527
|
-
actions =
|
|
1325
|
+
experiences = _e({ client: this });
|
|
1326
|
+
frameworks = Oe({ client: this });
|
|
1327
|
+
predicates = Re({ client: this });
|
|
1328
|
+
features = le({ client: this });
|
|
1329
|
+
conditions = yt();
|
|
1330
|
+
fields = Je();
|
|
1331
|
+
responses = gt({ client: this });
|
|
1332
|
+
steps = Ze();
|
|
1333
|
+
contents = tt();
|
|
1334
|
+
actions = at({ client: this });
|
|
1528
1335
|
conditionResults = te();
|
|
1529
|
-
stateSnapshotStore =
|
|
1530
|
-
evaluateRuleLogicFx =
|
|
1336
|
+
stateSnapshotStore = je({ client: this });
|
|
1337
|
+
evaluateRuleLogicFx = Ne({ client: this });
|
|
1531
1338
|
start;
|
|
1532
1339
|
readyStore;
|
|
1533
1340
|
preconditionPassedStore;
|
|
1534
1341
|
conditionPassedStore;
|
|
1535
1342
|
lifecycleStageStore;
|
|
1536
|
-
lifecycle =
|
|
1537
|
-
renderStringFx =
|
|
1343
|
+
lifecycle = Fe({ client: this });
|
|
1344
|
+
renderStringFx = j({
|
|
1538
1345
|
source: this.responses.listStore,
|
|
1539
1346
|
effect: (e, { template: t, context: n }) => {
|
|
1540
1347
|
let r = {};
|
|
1541
1348
|
for (let t of e) r[t.fieldKey] = t.value;
|
|
1542
|
-
return
|
|
1349
|
+
return zt(t, {
|
|
1543
1350
|
...n,
|
|
1544
1351
|
responses: r
|
|
1545
1352
|
});
|
|
1546
1353
|
}
|
|
1547
1354
|
});
|
|
1548
1355
|
constructor(e) {
|
|
1549
|
-
this.events =
|
|
1356
|
+
this.events = We(this.eventBus), this.projectId = Pt(e), this.options = Object.freeze(e), this.apiUrl = e.apiUrl || bt(), this.dashboardUrl = e.dashboardUrl ?? "https://dashboard.picked.app", this.documentationSiteUrl = e.documentationSiteUrl ?? "https://docs.picked.app", this.start = this.lifecycle.start, this.readyStore = this.lifecycle.readyStore, this.preconditionPassedStore = this.lifecycle.preconditionPassedStore, this.conditionPassedStore = this.lifecycle.conditionPassedStore, this.lifecycleStageStore = this.lifecycle.lifecycleStageStore, this.setupPlugins(), this.setupFeatures(), this.setupPredicates(), this.setupActions(), this.setupFields(), this.setupComponents(), this.lifecycle.setPrecondition(e.precondition), this.lifecycle.setCondition(e.condition), this.eventBus({
|
|
1550
1357
|
type: "load",
|
|
1551
|
-
version:
|
|
1358
|
+
version: ce()
|
|
1552
1359
|
}), this.maybeStartPreviewChannel();
|
|
1553
1360
|
}
|
|
1554
1361
|
dataProviderFor(e) {
|
|
1555
1362
|
let t = e ?? "", n = this.dataProviders.get(t);
|
|
1556
1363
|
if (n) return n;
|
|
1557
|
-
let r = import("../provider-
|
|
1364
|
+
let r = import("../provider-BsUkKYzJ.js").then((t) => t.createPickedDataProvider({
|
|
1558
1365
|
apiUrl: this.apiUrl,
|
|
1559
1366
|
projectId: this.projectId,
|
|
1560
1367
|
getRequestObserver: () => this.telemetry.deliveryAPIRequestObserver,
|
|
@@ -1564,7 +1371,7 @@ var X = class {
|
|
|
1564
1371
|
}
|
|
1565
1372
|
async getProjectConfig(e) {
|
|
1566
1373
|
let t = await this.dataProviderFor(e?.previewToken), n = await t.getProjectConfig();
|
|
1567
|
-
if (this.dataSource = t.meta.manifest, n === null && t.meta.previewUnavailable) throw new
|
|
1374
|
+
if (this.dataSource = t.meta.manifest, n === null && t.meta.previewUnavailable) throw new A(this.projectId);
|
|
1568
1375
|
if (n === null) throw Error(`Picked could not resolve the configuration for project "${this.projectId}" from ${this.apiUrl}.`);
|
|
1569
1376
|
return n;
|
|
1570
1377
|
}
|
|
@@ -1572,24 +1379,24 @@ var X = class {
|
|
|
1572
1379
|
return (await this.dataProviderFor(t?.previewToken)).getContent(e, t?.signal === void 0 ? void 0 : { signal: t.signal });
|
|
1573
1380
|
}
|
|
1574
1381
|
maybeStartPreviewChannel() {
|
|
1575
|
-
|
|
1382
|
+
k() && import("../preview-channel-CSr96XAo.js").then((e) => e.initPreviewChannel(this)).catch(() => void 0);
|
|
1576
1383
|
}
|
|
1577
1384
|
registerFramework = (e) => {
|
|
1578
|
-
|
|
1385
|
+
ke(e, this.frameworks);
|
|
1579
1386
|
};
|
|
1580
1387
|
registerComponent = (e, t) => {
|
|
1581
|
-
|
|
1388
|
+
U(e, t, this.components);
|
|
1582
1389
|
};
|
|
1583
1390
|
registerPlugin = (e) => {
|
|
1584
|
-
|
|
1391
|
+
be(this, e, this.plugins);
|
|
1585
1392
|
let t = this.plugins[e.name];
|
|
1586
1393
|
t?.onStart && this.lifecycle.registerPluginStartHook(t.onStart);
|
|
1587
1394
|
};
|
|
1588
1395
|
registerFeature = (e, t) => {
|
|
1589
|
-
|
|
1396
|
+
oe(e, t, this.features);
|
|
1590
1397
|
};
|
|
1591
1398
|
registerPredicate = (e, t) => {
|
|
1592
|
-
|
|
1399
|
+
ze(e, t, this.predicates);
|
|
1593
1400
|
};
|
|
1594
1401
|
registerCondition = (e) => {
|
|
1595
1402
|
this.conditions.register(e);
|
|
@@ -1598,19 +1405,19 @@ var X = class {
|
|
|
1598
1405
|
this.fields.register(e);
|
|
1599
1406
|
};
|
|
1600
1407
|
registerStep = (e) => {
|
|
1601
|
-
|
|
1408
|
+
Qe(e, this.steps);
|
|
1602
1409
|
};
|
|
1603
1410
|
registerContent = (e) => {
|
|
1604
|
-
|
|
1411
|
+
nt(e, this.contents);
|
|
1605
1412
|
};
|
|
1606
1413
|
patchContent = (e, t) => {
|
|
1607
1414
|
this.contents.patch(e, t);
|
|
1608
1415
|
};
|
|
1609
1416
|
registerAction = (e, t) => {
|
|
1610
|
-
|
|
1417
|
+
ot(e, t, this.actions);
|
|
1611
1418
|
};
|
|
1612
1419
|
registerExperience = (e) => {
|
|
1613
|
-
e.component &&
|
|
1420
|
+
e.component && U(`experience:${e.id}`, e.component, this.components), this.experiences.register(e);
|
|
1614
1421
|
};
|
|
1615
1422
|
launchExperienceById = async (e, t) => {
|
|
1616
1423
|
this.experiences.launch({
|
|
@@ -1653,7 +1460,7 @@ var X = class {
|
|
|
1653
1460
|
this.registerFeature(e, n);
|
|
1654
1461
|
}), this.searchParams.feature && this.searchParams.feature.forEach((e) => {
|
|
1655
1462
|
try {
|
|
1656
|
-
let t =
|
|
1463
|
+
let t = ae(e);
|
|
1657
1464
|
if (!t) return;
|
|
1658
1465
|
let { id: n, bucket: r } = t;
|
|
1659
1466
|
this.registerFeature(n, {
|
|
@@ -1703,8 +1510,8 @@ var X = class {
|
|
|
1703
1510
|
});
|
|
1704
1511
|
}
|
|
1705
1512
|
getPluginConfig = (e) => this.plugins[e] ?? {};
|
|
1706
|
-
},
|
|
1707
|
-
async function
|
|
1513
|
+
}, Vt = "application/picked-javascript", Ht = "application/picked-module", Ut = "data-picked-hydrated";
|
|
1514
|
+
async function X(e) {
|
|
1708
1515
|
if (!("document" in globalThis)) return;
|
|
1709
1516
|
let t = "application/picked-module", n = "data-picked-hydrated";
|
|
1710
1517
|
function r(e) {
|
|
@@ -1733,23 +1540,23 @@ async function $t(e) {
|
|
|
1733
1540
|
a && await a;
|
|
1734
1541
|
}
|
|
1735
1542
|
}
|
|
1736
|
-
function
|
|
1737
|
-
return `<script>(${
|
|
1543
|
+
function Wt() {
|
|
1544
|
+
return `<script>(${X.toString()})(document)<\/script>`;
|
|
1738
1545
|
}
|
|
1739
1546
|
//#endregion
|
|
1740
1547
|
//#region src/utils/html-asset-value.ts
|
|
1741
|
-
function
|
|
1548
|
+
function Gt(e) {
|
|
1742
1549
|
return typeof e == "object" && !!e && "id" in e && typeof e.id == "string" && "content" in e && (typeof e.content == "string" || e.content === null);
|
|
1743
1550
|
}
|
|
1744
1551
|
//#endregion
|
|
1745
1552
|
//#region src/entities/component/lazyComponent.ts
|
|
1746
|
-
function
|
|
1553
|
+
function Kt(e) {
|
|
1747
1554
|
return {
|
|
1748
1555
|
$$type: "lazy-component",
|
|
1749
1556
|
load: e
|
|
1750
1557
|
};
|
|
1751
1558
|
}
|
|
1752
|
-
function
|
|
1559
|
+
function qt(e) {
|
|
1753
1560
|
return typeof e == "object" && !!e && "$$type" in e && e.$$type === "lazy-component";
|
|
1754
1561
|
}
|
|
1755
1562
|
//#endregion
|
|
@@ -1765,10 +1572,10 @@ function $(e) {
|
|
|
1765
1572
|
for (let e of t) Z(e) && n.push(e.contentEntryId);
|
|
1766
1573
|
return n;
|
|
1767
1574
|
}
|
|
1768
|
-
function
|
|
1575
|
+
function Jt(e, t) {
|
|
1769
1576
|
return t === null ? null : e[t] ?? null;
|
|
1770
1577
|
}
|
|
1771
|
-
function
|
|
1578
|
+
function Yt(e, t) {
|
|
1772
1579
|
let n = [];
|
|
1773
1580
|
for (let r of t) {
|
|
1774
1581
|
let t = e[r];
|
|
@@ -1776,32 +1583,32 @@ function on(e, t) {
|
|
|
1776
1583
|
}
|
|
1777
1584
|
return n;
|
|
1778
1585
|
}
|
|
1779
|
-
function
|
|
1780
|
-
if (
|
|
1586
|
+
function Xt(e, t) {
|
|
1587
|
+
if (R.store(t)) return M(t, e.indexStore, (e, t) => Jt(t, Q(e)));
|
|
1781
1588
|
let n = Q(t);
|
|
1782
|
-
return e.indexStore.map((e) =>
|
|
1589
|
+
return e.indexStore.map((e) => Jt(e, n), { skipVoid: !1 });
|
|
1783
1590
|
}
|
|
1784
|
-
function
|
|
1785
|
-
if (
|
|
1591
|
+
function Zt(e, t) {
|
|
1592
|
+
if (R.store(t)) return M(t, e.indexStore, (e, t) => Yt(t, $(e)));
|
|
1786
1593
|
let n = $(t);
|
|
1787
|
-
return e.indexStore.map((e) =>
|
|
1594
|
+
return e.indexStore.map((e) => Yt(e, n), { skipVoid: !1 });
|
|
1788
1595
|
}
|
|
1789
1596
|
//#endregion
|
|
1790
1597
|
//#region src/exports.ts
|
|
1791
|
-
var
|
|
1792
|
-
let t = new
|
|
1598
|
+
var Qt = (e) => {
|
|
1599
|
+
let t = new Bt(e);
|
|
1793
1600
|
return u(t), t;
|
|
1794
1601
|
};
|
|
1795
1602
|
//#endregion
|
|
1796
1603
|
//#region src/typed-content.ts
|
|
1797
|
-
function
|
|
1604
|
+
function $t(e) {
|
|
1798
1605
|
return typeof e.data == "object";
|
|
1799
1606
|
}
|
|
1800
|
-
function
|
|
1801
|
-
return e.map((e) => !e ||
|
|
1607
|
+
function en(e) {
|
|
1608
|
+
return e.map((e) => !e || !$t(e) ? null : e, { skipVoid: !1 });
|
|
1802
1609
|
}
|
|
1803
|
-
function
|
|
1610
|
+
function tn(e, t) {
|
|
1804
1611
|
return e.contentModelKey === t;
|
|
1805
1612
|
}
|
|
1806
1613
|
//#endregion
|
|
1807
|
-
export {
|
|
1614
|
+
export { Ut as PICKED_HYDRATED_ATTR, Ht as PICKED_MODULE_SCRIPT_TYPE, Vt as PICKED_SCRIPT_TYPE, se as PREVIEW_TOKEN_PARAM, Bt as Picked, A as PreviewUnavailableError, Wt as buildRehydrateBootstrap, Qt as createClient, ye as createPluginEffect, O as createStorageKey, Xt as deriveReference, Zt as deriveReferences, n as evaluateRuleLogic, jt as getPickedConfig, tn as isContentOfModel, Z as isContentReference, Gt as isHtmlAssetValue, g as isInsideIframe, qt as isLazyLoader, v as isPickedRoot, k as isPreviewSession, Kt as lazyComponent, D as localStore, pe as onInertScriptSubtrees, Q as readReferenceId, $ as readReferenceIds, X as rehydrateScripts, de as reportInertScriptSubtrees, fe as resetInertScriptReport, re as sessionStore, ne as subscribe, d as supportsCookies, m as supportsCryptoRandomUUID, c as supportsDocument, i as supportsHistory, f as supportsIntersectionObserver, h as supportsLocalStorage, a as supportsLocation, l as supportsSessionStorage, _ as supportsShadowRoot, o as supportsWebComponents, s as supportsWindow, en as toTypedContentStore };
|