@picked/client 0.0.1-dev.1763014928671 → 0.0.1-dev.1763077817547
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/shopify/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/esm/index.js +150 -759
- package/dist/esm/plugins/shopify/index.js +89 -36
- 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-B2l_MG7I.cjs +1 -0
- package/dist/{experience-instance-CKru5var.js → experience-instance-CeuHLrdL.js} +168 -168
- package/dist/{supports-BjhuLJ8z.js → supports-DBMT17KZ.js} +10 -10
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/plugins/shopify/global-obj.d.ts +49 -0
- package/dist/types/plugins/shopify/global-obj.d.ts.map +1 -0
- package/dist/types/plugins/shopify/index.d.ts +4 -0
- package/dist/types/plugins/shopify/index.d.ts.map +1 -1
- package/dist/types/plugins/shopify/picked-config.d.ts +103 -0
- package/dist/types/plugins/shopify/picked-config.d.ts.map +1 -0
- package/dist/types/plugins/shopify/{shopify.d.ts → predicates.d.ts} +20 -6
- package/dist/types/plugins/shopify/predicates.d.ts.map +1 -0
- package/dist/user-session-Bny5aSWK.cjs +1 -0
- package/dist/user-session-sUXlj29_.js +637 -0
- package/package.json +1 -1
- package/dist/experience-instance-CF6m7G83.cjs +0 -1
- package/dist/types/plugins/shopify/shopify.d.ts.map +0 -1
- package/dist/types/plugins/shopify/utils.d.ts +0 -21
- package/dist/types/plugins/shopify/utils.d.ts.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { createDomain as
|
|
2
|
-
import { createFactory as
|
|
3
|
-
import {
|
|
1
|
+
import { createDomain as ht, createEvent as B, combine as C, createApi as ot, createEffect as M, attach as F, split as yt, sample as m } from "effector";
|
|
2
|
+
import { createFactory as it, invoke as st } from "@withease/factories";
|
|
3
|
+
import { h as wt, s as at, a as Nt } from "./supports-DBMT17KZ.js";
|
|
4
4
|
import { l as I } from "./logger-C9a75KZn.js";
|
|
5
|
-
import { i as
|
|
6
|
-
function
|
|
5
|
+
import { i as It } from "./object-JwZ58NOH.js";
|
|
6
|
+
function xt(t) {
|
|
7
7
|
return typeof t == "number" && !isNaN(t);
|
|
8
8
|
}
|
|
9
9
|
function H(t) {
|
|
@@ -12,21 +12,21 @@ function H(t) {
|
|
|
12
12
|
function N(t) {
|
|
13
13
|
return Array.isArray(t);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function ct(t) {
|
|
16
16
|
return t instanceof Promise;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function tt(t) {
|
|
19
19
|
return typeof t == "object" && t !== null && !Array.isArray(t) && Object.keys(t).length === 1;
|
|
20
20
|
}
|
|
21
21
|
function g(t) {
|
|
22
|
-
if (
|
|
22
|
+
if (xt(t)) return t;
|
|
23
23
|
const e = parseFloat(`${t}`);
|
|
24
24
|
return isNaN(e) ? 0 : e;
|
|
25
25
|
}
|
|
26
26
|
function D(t) {
|
|
27
27
|
return `${t}`;
|
|
28
28
|
}
|
|
29
|
-
const
|
|
29
|
+
const Et = {
|
|
30
30
|
// eslint-disable-next-line eqeqeq
|
|
31
31
|
"==": (t, e) => t == e,
|
|
32
32
|
"===": (t, e) => t === e,
|
|
@@ -47,8 +47,8 @@ const kt = {
|
|
|
47
47
|
const a = g(r);
|
|
48
48
|
return n <= s && s <= a;
|
|
49
49
|
},
|
|
50
|
-
"!!": async (t) => await
|
|
51
|
-
"!": async (t) => !await
|
|
50
|
+
"!!": async (t) => await $(t),
|
|
51
|
+
"!": async (t) => !await $(t),
|
|
52
52
|
"%": (t, e) => g(t) % g(e),
|
|
53
53
|
// eslint-disable-next-line sonarjs/function-return-type
|
|
54
54
|
log: (t) => (console.log(t), t),
|
|
@@ -130,31 +130,31 @@ const kt = {
|
|
|
130
130
|
};
|
|
131
131
|
async function p(t, e) {
|
|
132
132
|
if (!t) return t;
|
|
133
|
-
if (
|
|
133
|
+
if (ct(t))
|
|
134
134
|
return p(await t, e);
|
|
135
135
|
if (N(t))
|
|
136
136
|
return Promise.all(t.map((o) => p(o, e)));
|
|
137
|
-
if (!
|
|
138
|
-
const r =
|
|
137
|
+
if (!tt(t)) return t;
|
|
138
|
+
const r = kt(t);
|
|
139
139
|
let n = r ? t[r] ?? [] : [];
|
|
140
140
|
switch (N(n) || (n = [n]), r) {
|
|
141
141
|
case "if":
|
|
142
142
|
case "?:":
|
|
143
143
|
for (let o = 0; o < n.length - 1; o += 2)
|
|
144
|
-
if (await
|
|
144
|
+
if (await $(await p(n[o], e)))
|
|
145
145
|
return p(n[o + 1], e);
|
|
146
146
|
return n.length % 2 === 1 ? p(n[n.length - 1], e) : null;
|
|
147
147
|
case "and": {
|
|
148
148
|
let o = null;
|
|
149
149
|
for (const c of n)
|
|
150
|
-
if (o = await p(c, e), !await
|
|
150
|
+
if (o = await p(c, e), !await $(o))
|
|
151
151
|
return o;
|
|
152
152
|
return o;
|
|
153
153
|
}
|
|
154
154
|
case "or": {
|
|
155
155
|
let o = null;
|
|
156
156
|
for (const c of n)
|
|
157
|
-
if (o = await p(c, e), await
|
|
157
|
+
if (o = await p(c, e), await $(o)) return o;
|
|
158
158
|
return o;
|
|
159
159
|
}
|
|
160
160
|
case "map": {
|
|
@@ -165,7 +165,7 @@ async function p(t, e) {
|
|
|
165
165
|
const o = await p(n[0], e);
|
|
166
166
|
return N(o) ? (await Promise.all(
|
|
167
167
|
o.map(async (d) => {
|
|
168
|
-
const y = await
|
|
168
|
+
const y = await $(await p(n[1], d));
|
|
169
169
|
return { item: d, shouldInclude: y };
|
|
170
170
|
})
|
|
171
171
|
)).filter(({ shouldInclude: d }) => d).map(({ item: d }) => d) : [];
|
|
@@ -184,44 +184,44 @@ async function p(t, e) {
|
|
|
184
184
|
const o = await p(n[0], e);
|
|
185
185
|
if (!N(o) || o.length === 0) return !1;
|
|
186
186
|
for (const c of o)
|
|
187
|
-
if (!await
|
|
187
|
+
if (!await $(await p(n[1], c))) return !1;
|
|
188
188
|
return !0;
|
|
189
189
|
}
|
|
190
190
|
case "some": {
|
|
191
191
|
const o = await p(n[0], e);
|
|
192
192
|
if (!N(o)) return !1;
|
|
193
193
|
for (const c of o)
|
|
194
|
-
if (await
|
|
194
|
+
if (await $(await p(n[1], c))) return !0;
|
|
195
195
|
return !1;
|
|
196
196
|
}
|
|
197
197
|
case "none": {
|
|
198
198
|
const o = await p(n[0], e);
|
|
199
199
|
if (!N(o)) return !0;
|
|
200
200
|
for (const c of o)
|
|
201
|
-
if (await
|
|
201
|
+
if (await $(await p(n[1], c))) return !1;
|
|
202
202
|
return !0;
|
|
203
203
|
}
|
|
204
204
|
case "catch":
|
|
205
205
|
try {
|
|
206
206
|
return await p(n[0], e);
|
|
207
207
|
} catch (o) {
|
|
208
|
-
return
|
|
208
|
+
return tt(o) ? await p(o, e) : n[1] ? await p(n[1], o) : o instanceof Error ? o.message : o;
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
|
-
const s = await Promise.all(n.map((o) => p(o, e))), a = r ?
|
|
211
|
+
const s = await Promise.all(n.map((o) => p(o, e))), a = r ? Et[r] : void 0;
|
|
212
212
|
if (!a) throw new Error(`Unrecognized operation ${r}`);
|
|
213
213
|
return a.apply(e, s);
|
|
214
214
|
}
|
|
215
|
-
async function
|
|
216
|
-
return
|
|
215
|
+
async function $(t) {
|
|
216
|
+
return ct(t) ? $(await t) : !(Array.isArray(t) && t.length === 0) && !!t;
|
|
217
217
|
}
|
|
218
|
-
function
|
|
218
|
+
function kt(t) {
|
|
219
219
|
return Object.keys(t)[0];
|
|
220
220
|
}
|
|
221
|
-
function
|
|
222
|
-
return !
|
|
221
|
+
function At(t) {
|
|
222
|
+
return !It(t);
|
|
223
223
|
}
|
|
224
|
-
async function
|
|
224
|
+
async function et(t, e, r) {
|
|
225
225
|
const n = t.getStateSnapshot(), s = t.predicates.listStore.getState().reduce((c, d) => ({
|
|
226
226
|
...c,
|
|
227
227
|
[d.name]: () => d.predicate(n)
|
|
@@ -250,33 +250,33 @@ async function nt(t, e, r) {
|
|
|
250
250
|
};
|
|
251
251
|
return await p(e, o);
|
|
252
252
|
}
|
|
253
|
-
function
|
|
254
|
-
return !
|
|
253
|
+
function bt(t) {
|
|
254
|
+
return !Nt() || !at() ? [] : Array.from(window.document.querySelectorAll(t)).filter(
|
|
255
255
|
(e) => e instanceof HTMLElement
|
|
256
256
|
);
|
|
257
257
|
}
|
|
258
|
-
function
|
|
259
|
-
if (!
|
|
258
|
+
function vt(t) {
|
|
259
|
+
if (!wt())
|
|
260
260
|
throw new Error("Shadow DOM is not supported in this environment");
|
|
261
261
|
return t.attachShadow({ mode: "closed" });
|
|
262
262
|
}
|
|
263
263
|
function Xt() {
|
|
264
264
|
return new Promise((t, e) => {
|
|
265
|
-
if (!
|
|
265
|
+
if (!at()) {
|
|
266
266
|
e();
|
|
267
267
|
return;
|
|
268
268
|
}
|
|
269
269
|
document.readyState !== "loading" ? t() : document.addEventListener("readystatechange", () => t(), { once: !0 });
|
|
270
270
|
});
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function Bt(t, e) {
|
|
273
273
|
const r = new MutationObserver((n) => {
|
|
274
274
|
document.contains(t) || (r.disconnect(), e());
|
|
275
275
|
});
|
|
276
276
|
r.observe(document.body, { childList: !0, subtree: !0 });
|
|
277
277
|
}
|
|
278
|
-
const
|
|
279
|
-
function
|
|
278
|
+
const K = "picked-root", U = "picked-target", $t = "picked-root";
|
|
279
|
+
function zt(t, e) {
|
|
280
280
|
return [
|
|
281
281
|
...t,
|
|
282
282
|
// Target and replace picked-root web components
|
|
@@ -285,8 +285,8 @@ function Jt(t, e) {
|
|
|
285
285
|
placement: "replace"
|
|
286
286
|
}
|
|
287
287
|
].flatMap((n) => {
|
|
288
|
-
const s =
|
|
289
|
-
(a) => !Ft(a, e) && !
|
|
288
|
+
const s = bt(n.selector).filter(
|
|
289
|
+
(a) => !Ft(a, e) && !Ot(a, e)
|
|
290
290
|
);
|
|
291
291
|
return {
|
|
292
292
|
...n,
|
|
@@ -294,25 +294,25 @@ function Jt(t, e) {
|
|
|
294
294
|
};
|
|
295
295
|
});
|
|
296
296
|
}
|
|
297
|
-
function
|
|
298
|
-
return t.flatMap((r) => r.elements.map((n) =>
|
|
297
|
+
function Jt(t, e) {
|
|
298
|
+
return t.flatMap((r) => r.elements.map((n) => Mt(n, r.placement, e)));
|
|
299
299
|
}
|
|
300
|
-
function
|
|
301
|
-
t.classList.add(
|
|
300
|
+
function Qt(t, e) {
|
|
301
|
+
t.classList.add(U), t.classList.add(`${U}-${e}`);
|
|
302
302
|
}
|
|
303
303
|
function Ft(t, e) {
|
|
304
|
-
return e ? t.classList.contains(`${
|
|
304
|
+
return e ? t.classList.contains(`${U}-${e}`) : t.classList.contains(`${U}`);
|
|
305
305
|
}
|
|
306
|
-
function
|
|
307
|
-
return e ? t.classList.contains(`${
|
|
306
|
+
function Ot(t, e) {
|
|
307
|
+
return e ? t.classList.contains(`${K}-${e}`) : t.classList.contains(K);
|
|
308
308
|
}
|
|
309
|
-
function
|
|
309
|
+
function _t(t) {
|
|
310
310
|
const e = document.createElement("div");
|
|
311
|
-
return e.style.display = "block", e.classList.add(
|
|
311
|
+
return e.style.display = "block", e.classList.add(K), e.classList.add(`${K}-${t}`), e;
|
|
312
312
|
}
|
|
313
|
-
function
|
|
313
|
+
function Mt(t, e, r) {
|
|
314
314
|
let n;
|
|
315
|
-
const s =
|
|
315
|
+
const s = _t(r);
|
|
316
316
|
if (t instanceof Document)
|
|
317
317
|
n = t.body.appendChild(s);
|
|
318
318
|
else {
|
|
@@ -337,25 +337,25 @@ function Tt(t, e, r) {
|
|
|
337
337
|
}
|
|
338
338
|
return n;
|
|
339
339
|
}
|
|
340
|
-
function
|
|
340
|
+
function Tt(t) {
|
|
341
341
|
return t.type === "conditional";
|
|
342
342
|
}
|
|
343
343
|
function j(t) {
|
|
344
344
|
return t.type === "step";
|
|
345
345
|
}
|
|
346
|
-
function
|
|
346
|
+
function Lt(t) {
|
|
347
347
|
return t.type === "experience";
|
|
348
348
|
}
|
|
349
|
-
function
|
|
349
|
+
function nt(t) {
|
|
350
350
|
return t.type === "origin";
|
|
351
351
|
}
|
|
352
|
-
function
|
|
352
|
+
function rt(t) {
|
|
353
353
|
return t.type === "action";
|
|
354
354
|
}
|
|
355
|
-
const
|
|
355
|
+
const ut = (t, e, r, n, s = /* @__PURE__ */ new Set()) => s.has(r.id) ? [] : (s.add(r.id), j(r) && !n ? [r] : e.filter((o) => o.sourceNodeId === r.id).flatMap((o) => {
|
|
356
356
|
const c = t.find((d) => d.id === o.destinationNodeId);
|
|
357
|
-
return c ?
|
|
358
|
-
})),
|
|
357
|
+
return c ? ut(t, e, c, !1, s) : [];
|
|
358
|
+
})), Dt = (t, e, r) => ut(t, e, r, !0, /* @__PURE__ */ new Set()), ft = (t, e, r, n, s = /* @__PURE__ */ new Set()) => {
|
|
359
359
|
if (s.has(r.id)) return [-1, -1];
|
|
360
360
|
s.add(r.id);
|
|
361
361
|
const a = e.filter((d) => d.sourceNodeId === r.id);
|
|
@@ -364,26 +364,26 @@ const ft = (t, e, r, n, s = /* @__PURE__ */ new Set()) => s.has(r.id) ? [] : (s.
|
|
|
364
364
|
for (const d of a) {
|
|
365
365
|
const y = t.find((P) => P.id === d.destinationNodeId);
|
|
366
366
|
if (!y) continue;
|
|
367
|
-
const [k,
|
|
367
|
+
const [k, O] = ft(
|
|
368
368
|
t,
|
|
369
369
|
e,
|
|
370
370
|
y,
|
|
371
371
|
!1,
|
|
372
372
|
new Set(s)
|
|
373
373
|
);
|
|
374
|
-
k !== -1 && (o = Math.min(o, k + 1), c = Math.max(c,
|
|
374
|
+
k !== -1 && (o = Math.min(o, k + 1), c = Math.max(c, O + 1));
|
|
375
375
|
}
|
|
376
376
|
return o === 1 / 0 ? [-1, -1] : [o, c];
|
|
377
|
-
},
|
|
377
|
+
}, Pt = (t, e, r) => ft(t, e, r, !0, /* @__PURE__ */ new Set()), lt = (t, e, r, n = /* @__PURE__ */ new Set()) => {
|
|
378
378
|
if (n.has(r.id)) return [-1, -1];
|
|
379
379
|
if (n.add(r.id), r.type === "origin") return [0, 0];
|
|
380
380
|
const s = e.filter((c) => c.destinationNodeId === r.id);
|
|
381
381
|
if (s.length === 0) return [-1, -1];
|
|
382
382
|
let a = 1 / 0, o = -1 / 0;
|
|
383
383
|
for (const c of s) {
|
|
384
|
-
const d = t.find((
|
|
384
|
+
const d = t.find((O) => O.id === c.sourceNodeId);
|
|
385
385
|
if (!d) continue;
|
|
386
|
-
const [y, k] =
|
|
386
|
+
const [y, k] = lt(
|
|
387
387
|
t,
|
|
388
388
|
e,
|
|
389
389
|
d,
|
|
@@ -392,28 +392,28 @@ const ft = (t, e, r, n, s = /* @__PURE__ */ new Set()) => s.has(r.id) ? [] : (s.
|
|
|
392
392
|
y !== -1 && (a = Math.min(a, y + 1), o = Math.max(o, k + 1));
|
|
393
393
|
}
|
|
394
394
|
return a === 1 / 0 ? [-1, -1] : [a, o];
|
|
395
|
-
},
|
|
395
|
+
}, Rt = (t, e, r) => lt(t, e, r, /* @__PURE__ */ new Set()), dt = (t) => t.find((r) => r.type === "origin") || null, X = (t, e, r) => {
|
|
396
396
|
if (!t)
|
|
397
|
-
return
|
|
397
|
+
return dt(e);
|
|
398
398
|
const n = r.find((a) => a.sourceNodeId === t.id);
|
|
399
399
|
if (!n)
|
|
400
400
|
return null;
|
|
401
401
|
const s = e.find((a) => a.id === n.destinationNodeId);
|
|
402
402
|
return s || null;
|
|
403
403
|
};
|
|
404
|
-
async function
|
|
404
|
+
async function Ct(t, e, r, n) {
|
|
405
405
|
const s = t ? "true" : "false", a = n.find(
|
|
406
406
|
(o) => o.sourceNodeHandle === s && o.sourceNodeId === e
|
|
407
407
|
);
|
|
408
408
|
return r.find((o) => o.id === (a == null ? void 0 : a.destinationNodeId));
|
|
409
409
|
}
|
|
410
|
-
const
|
|
410
|
+
const z = ht("experience-instance"), Ht = it(
|
|
411
411
|
({
|
|
412
412
|
client: t,
|
|
413
413
|
experience: e,
|
|
414
414
|
target: r
|
|
415
415
|
}) => {
|
|
416
|
-
const n = B(), s = B(), a = B(), o = B(), c = B(), d = B(), y = e.componentStore, k =
|
|
416
|
+
const n = B(), s = B(), a = B(), o = B(), c = B(), d = B(), y = e.componentStore, k = z.store("transitioning"), O = t.history.entriesStore.map((i) => i.filter((f) => f.experienceId === e.id)), P = O.map((i) => i.filter((f) => j(f.node))), x = O.map((i) => {
|
|
417
417
|
var f;
|
|
418
418
|
return ((f = i[i.length - 1]) == null ? void 0 : f.node) || null;
|
|
419
419
|
}), u = C(
|
|
@@ -423,53 +423,53 @@ const J = yt("experience-instance"), jt = st(
|
|
|
423
423
|
), S = C(
|
|
424
424
|
e.treeStore,
|
|
425
425
|
x,
|
|
426
|
-
({ nodes: i, edges: f }, l) => l ?
|
|
427
|
-
),
|
|
426
|
+
({ nodes: i, edges: f }, l) => l ? Dt(i, f, l) : []
|
|
427
|
+
), v = C(
|
|
428
428
|
e.treeStore,
|
|
429
429
|
x,
|
|
430
|
-
({ nodes: i, edges: f }, l) => l ?
|
|
431
|
-
),
|
|
430
|
+
({ nodes: i, edges: f }, l) => l ? Rt(i, f, l) : [-1, -1]
|
|
431
|
+
), T = C(
|
|
432
432
|
e.treeStore,
|
|
433
433
|
x,
|
|
434
|
-
({ nodes: i, edges: f }, l) => l ?
|
|
435
|
-
),
|
|
434
|
+
({ nodes: i, edges: f }, l) => l ? Pt(i, f, l) : [-1, -1]
|
|
435
|
+
), A = z.store(!1), _ = ot(A, {
|
|
436
436
|
open: () => !0,
|
|
437
437
|
close: () => !1,
|
|
438
438
|
toggle: (i) => !i,
|
|
439
439
|
set: (i, f) => f
|
|
440
|
-
}),
|
|
440
|
+
}), pt = M(async () => {
|
|
441
441
|
t.history.back({ experienceId: e.id });
|
|
442
|
-
}),
|
|
442
|
+
}), gt = F({
|
|
443
443
|
source: e.treeStore,
|
|
444
444
|
effect: async (i, f) => {
|
|
445
445
|
const l = i.nodes.find((w) => j(w) && w.stepId === f);
|
|
446
446
|
l && t.history.push({ experienceId: e.id, node: l });
|
|
447
447
|
}
|
|
448
|
-
}),
|
|
448
|
+
}), J = F({
|
|
449
449
|
source: x,
|
|
450
450
|
effect: (i) => {
|
|
451
451
|
}
|
|
452
|
-
}),
|
|
452
|
+
}), V = F({
|
|
453
453
|
source: e.treeStore,
|
|
454
|
-
effect: async ({ nodes: i }) =>
|
|
455
|
-
}),
|
|
454
|
+
effect: async ({ nodes: i }) => dt(i)
|
|
455
|
+
}), W = F({
|
|
456
456
|
source: e.treeStore,
|
|
457
457
|
effect: async ({ nodes: i, edges: f }, l) => X(l, i, f)
|
|
458
|
-
}),
|
|
458
|
+
}), q = F({
|
|
459
459
|
source: e.treeStore,
|
|
460
460
|
effect: async ({ nodes: i, edges: f, conditionals: l }, w) => {
|
|
461
461
|
if (!w)
|
|
462
462
|
return;
|
|
463
|
-
const L = l.find((
|
|
463
|
+
const L = l.find((b) => b.id === w.conditionalId);
|
|
464
464
|
if (!L)
|
|
465
465
|
return;
|
|
466
|
-
const E = w.id, h = await
|
|
467
|
-
return
|
|
466
|
+
const E = w.id, h = await et(t, L.condition);
|
|
467
|
+
return Ct(!!h, E, i, f);
|
|
468
468
|
}
|
|
469
|
-
}),
|
|
469
|
+
}), Q = F({
|
|
470
470
|
source: e.treeStore,
|
|
471
471
|
effect: async ({ nodes: i, edges: f }, l) => {
|
|
472
|
-
if (!l || !
|
|
472
|
+
if (!l || !rt(l))
|
|
473
473
|
return;
|
|
474
474
|
const w = l.action;
|
|
475
475
|
if (!w) {
|
|
@@ -494,61 +494,61 @@ const J = yt("experience-instance"), jt = st(
|
|
|
494
494
|
try {
|
|
495
495
|
I("info", `Executing action: ${w}`), await L.action();
|
|
496
496
|
const E = f.find(
|
|
497
|
-
(
|
|
497
|
+
(b) => b.sourceNodeId === l.id && b.sourceNodeHandle === "true"
|
|
498
498
|
);
|
|
499
499
|
if (!E)
|
|
500
500
|
return I("warn", `No 'true' edge found for action node ${l.id}`), null;
|
|
501
|
-
const h = i.find((
|
|
501
|
+
const h = i.find((b) => b.id === E.destinationNodeId);
|
|
502
502
|
return I("info", `Action '${w}' succeeded, moving to node ${h == null ? void 0 : h.id}`), h || null;
|
|
503
503
|
} catch (E) {
|
|
504
504
|
I("warn", `Action '${w}' failed:`, E);
|
|
505
505
|
const h = f.find(
|
|
506
|
-
(
|
|
506
|
+
(G) => G.sourceNodeId === l.id && G.sourceNodeHandle === "false"
|
|
507
507
|
);
|
|
508
508
|
if (!h)
|
|
509
509
|
return I("warn", `No 'false' edge found for action node ${l.id}`), null;
|
|
510
|
-
const
|
|
511
|
-
return I("info", `Action '${w}' failed, moving to node ${
|
|
510
|
+
const b = i.find((G) => G.id === h.destinationNodeId);
|
|
511
|
+
return I("info", `Action '${w}' failed, moving to node ${b == null ? void 0 : b.id}`), b || null;
|
|
512
512
|
}
|
|
513
513
|
}
|
|
514
|
-
}),
|
|
514
|
+
}), mt = M((i) => {
|
|
515
515
|
if (i)
|
|
516
516
|
return t.launchExperienceById(i.experienceId);
|
|
517
|
-
}),
|
|
517
|
+
}), Y = F({
|
|
518
518
|
source: [x, e.treeStore],
|
|
519
519
|
effect: async ([i, { nodes: f, edges: l }]) => X(i, f, l)
|
|
520
|
-
}), R =
|
|
520
|
+
}), R = F({
|
|
521
521
|
source: [x, e.treeStore],
|
|
522
522
|
effect: async ([i, { nodes: f, edges: l }]) => X(i, f, l)
|
|
523
|
-
}),
|
|
523
|
+
}), St = M((i) => {
|
|
524
524
|
t.history.push({ experienceId: e.id, node: i });
|
|
525
|
-
}),
|
|
525
|
+
}), Z = F({
|
|
526
526
|
source: e.configStore,
|
|
527
|
-
effect: async ({ initializeOpenLogic: i }) =>
|
|
527
|
+
effect: async ({ initializeOpenLogic: i }) => At(i) ? !!await et(t, i) : i ?? !1
|
|
528
528
|
});
|
|
529
|
-
return
|
|
529
|
+
return yt({
|
|
530
530
|
source: x,
|
|
531
|
-
match: (i) => i ?
|
|
531
|
+
match: (i) => i ? Tt(i) ? "condition" : j(i) ? "step" : Lt(i) ? "launchExperience" : nt(i) ? "origin" : rt(i) ? "action" : "other" : "none",
|
|
532
532
|
cases: {
|
|
533
|
-
none:
|
|
534
|
-
origin:
|
|
535
|
-
condition:
|
|
536
|
-
step:
|
|
537
|
-
launchExperience:
|
|
538
|
-
action:
|
|
533
|
+
none: V,
|
|
534
|
+
origin: W,
|
|
535
|
+
condition: q,
|
|
536
|
+
step: J,
|
|
537
|
+
launchExperience: mt,
|
|
538
|
+
action: Q,
|
|
539
539
|
__: B()
|
|
540
540
|
}
|
|
541
541
|
}), m({
|
|
542
542
|
clock: [
|
|
543
|
-
z.doneData,
|
|
544
543
|
q.doneData,
|
|
545
544
|
W.doneData,
|
|
545
|
+
V.doneData,
|
|
546
546
|
R.doneData,
|
|
547
|
-
|
|
548
|
-
|
|
547
|
+
Y.doneData,
|
|
548
|
+
Q.doneData
|
|
549
549
|
],
|
|
550
550
|
filter: Boolean,
|
|
551
|
-
target:
|
|
551
|
+
target: St
|
|
552
552
|
}), m({
|
|
553
553
|
clock: s,
|
|
554
554
|
target: R
|
|
@@ -581,18 +581,18 @@ const J = yt("experience-instance"), jt = st(
|
|
|
581
581
|
}))
|
|
582
582
|
}), m({
|
|
583
583
|
clock: a,
|
|
584
|
-
target:
|
|
585
|
-
}), m({ clock: o, target:
|
|
584
|
+
target: pt
|
|
585
|
+
}), m({ clock: o, target: gt }), m({
|
|
586
586
|
source: C([
|
|
587
|
-
z.pending,
|
|
588
587
|
q.pending,
|
|
589
588
|
W.pending,
|
|
589
|
+
V.pending,
|
|
590
590
|
R.pending
|
|
591
591
|
]),
|
|
592
592
|
fn: (i) => i.some(Boolean) ? "transitioning" : "ready",
|
|
593
593
|
target: k
|
|
594
594
|
}), m({
|
|
595
|
-
clock:
|
|
595
|
+
clock: J.doneData,
|
|
596
596
|
source: u,
|
|
597
597
|
filter: Boolean,
|
|
598
598
|
target: t.eventBus.prepend((i) => ({
|
|
@@ -602,29 +602,29 @@ const J = yt("experience-instance"), jt = st(
|
|
|
602
602
|
}))
|
|
603
603
|
}), m({
|
|
604
604
|
clock: d,
|
|
605
|
-
target:
|
|
605
|
+
target: Z
|
|
606
606
|
}), m({
|
|
607
|
-
source:
|
|
608
|
-
fn:
|
|
609
|
-
target:
|
|
607
|
+
source: Z.doneData,
|
|
608
|
+
fn: Boolean,
|
|
609
|
+
target: A
|
|
610
610
|
}), m({
|
|
611
611
|
source: x,
|
|
612
612
|
clock: n,
|
|
613
|
-
filter: (i) => i ?
|
|
614
|
-
target:
|
|
613
|
+
filter: (i) => i ? nt(i) : !0,
|
|
614
|
+
target: Y
|
|
615
615
|
}), m({
|
|
616
|
-
source:
|
|
617
|
-
filter:
|
|
616
|
+
source: A,
|
|
617
|
+
filter: Boolean,
|
|
618
618
|
target: n
|
|
619
619
|
}), m({
|
|
620
|
-
source:
|
|
620
|
+
source: A,
|
|
621
621
|
filter: Boolean,
|
|
622
622
|
target: t.eventBus.prepend(() => ({
|
|
623
623
|
type: "experience_open",
|
|
624
624
|
experience: e
|
|
625
625
|
}))
|
|
626
626
|
}), m({
|
|
627
|
-
source:
|
|
627
|
+
source: A,
|
|
628
628
|
filter: (i) => !i,
|
|
629
629
|
target: t.eventBus.prepend(() => ({
|
|
630
630
|
type: "experience_close",
|
|
@@ -643,18 +643,18 @@ const J = yt("experience-instance"), jt = st(
|
|
|
643
643
|
// state
|
|
644
644
|
stateStore: k,
|
|
645
645
|
// open close
|
|
646
|
-
isOpenStore:
|
|
647
|
-
open:
|
|
648
|
-
close:
|
|
649
|
-
toggleOpen:
|
|
650
|
-
setOpen:
|
|
646
|
+
isOpenStore: A,
|
|
647
|
+
open: _.open,
|
|
648
|
+
close: _.close,
|
|
649
|
+
toggleOpen: _.toggle,
|
|
650
|
+
setOpen: _.set,
|
|
651
651
|
// nodes
|
|
652
652
|
treeStore: e.treeStore,
|
|
653
653
|
currentNodeStore: x,
|
|
654
654
|
currentStepStore: u,
|
|
655
655
|
nextReachableStepNodesStore: S,
|
|
656
|
-
stepsToOriginStore:
|
|
657
|
-
stepsToLeafStore:
|
|
656
|
+
stepsToOriginStore: v,
|
|
657
|
+
stepsToLeafStore: T,
|
|
658
658
|
// history
|
|
659
659
|
goToNextStep: s,
|
|
660
660
|
goToPreviousStep: a,
|
|
@@ -663,69 +663,69 @@ const J = yt("experience-instance"), jt = st(
|
|
|
663
663
|
};
|
|
664
664
|
}
|
|
665
665
|
);
|
|
666
|
-
function
|
|
667
|
-
return
|
|
666
|
+
function jt(t) {
|
|
667
|
+
return st(Ht, t);
|
|
668
668
|
}
|
|
669
|
-
const
|
|
670
|
-
const e =
|
|
669
|
+
const Gt = it(({ client: t }) => {
|
|
670
|
+
const e = z.store({}), r = B(), n = B(), s = B(), a = ot(e, {
|
|
671
671
|
register(u, S) {
|
|
672
|
-
const
|
|
672
|
+
const v = [
|
|
673
673
|
...u[S.experienceId] ?? []
|
|
674
674
|
];
|
|
675
|
-
return
|
|
675
|
+
return v.push(S), {
|
|
676
676
|
...u,
|
|
677
|
-
[S.experienceId]:
|
|
677
|
+
[S.experienceId]: v
|
|
678
678
|
};
|
|
679
679
|
},
|
|
680
680
|
unregister(u, S) {
|
|
681
|
-
var
|
|
682
|
-
const
|
|
683
|
-
(
|
|
681
|
+
var A;
|
|
682
|
+
const v = S.experienceId, T = (A = u[v]) == null ? void 0 : A.filter(
|
|
683
|
+
(_) => _ !== S
|
|
684
684
|
);
|
|
685
685
|
return {
|
|
686
686
|
...u,
|
|
687
|
-
[
|
|
687
|
+
[v]: T ?? []
|
|
688
688
|
};
|
|
689
689
|
}
|
|
690
|
-
}), o =
|
|
691
|
-
({ experience: u, target: S }) =>
|
|
692
|
-
), c =
|
|
690
|
+
}), o = M(
|
|
691
|
+
({ experience: u, target: S }) => jt({ client: t, experience: u, target: S })
|
|
692
|
+
), c = M((u) => {
|
|
693
693
|
a.register(u);
|
|
694
|
-
}), d =
|
|
694
|
+
}), d = M(
|
|
695
695
|
(u) => {
|
|
696
|
-
u.target &&
|
|
696
|
+
u.target && Bt(u.target, () => {
|
|
697
697
|
s(u);
|
|
698
698
|
});
|
|
699
699
|
}
|
|
700
|
-
), y =
|
|
700
|
+
), y = M((u) => {
|
|
701
701
|
a.unregister(u);
|
|
702
|
-
}), k =
|
|
702
|
+
}), k = M((u) => {
|
|
703
703
|
const S = u.componentStore.getState();
|
|
704
704
|
if (!S) {
|
|
705
705
|
I("warn", "No app component registered. Skipping init.");
|
|
706
706
|
return;
|
|
707
707
|
}
|
|
708
|
-
const
|
|
709
|
-
if (!
|
|
708
|
+
const v = S.frameworkStore.getState();
|
|
709
|
+
if (!v) {
|
|
710
710
|
I(
|
|
711
711
|
"error",
|
|
712
712
|
`No framework registered for component '${S.name}'. Skipping rendering.`
|
|
713
713
|
);
|
|
714
714
|
return;
|
|
715
715
|
}
|
|
716
|
-
const
|
|
717
|
-
if (!
|
|
716
|
+
const T = u.target;
|
|
717
|
+
if (!T) {
|
|
718
718
|
I(
|
|
719
719
|
"error",
|
|
720
720
|
`No target element registered for experience '${u.experienceId}'. Skipping rendering.`
|
|
721
721
|
);
|
|
722
722
|
return;
|
|
723
723
|
}
|
|
724
|
-
const
|
|
724
|
+
const A = vt(T);
|
|
725
725
|
try {
|
|
726
|
-
|
|
727
|
-
} catch (
|
|
728
|
-
I("error",
|
|
726
|
+
v.render(A, S.component, t, u);
|
|
727
|
+
} catch (_) {
|
|
728
|
+
I("error", _);
|
|
729
729
|
}
|
|
730
730
|
});
|
|
731
731
|
m({
|
|
@@ -751,7 +751,7 @@ const Kt = st(({ client: t }) => {
|
|
|
751
751
|
clock: n,
|
|
752
752
|
target: k
|
|
753
753
|
});
|
|
754
|
-
function
|
|
754
|
+
function O(u, S) {
|
|
755
755
|
r({ experience: u, target: S });
|
|
756
756
|
}
|
|
757
757
|
const P = e.map((u) => Object.values(u).flat());
|
|
@@ -759,23 +759,23 @@ const Kt = st(({ client: t }) => {
|
|
|
759
759
|
return e.map((S) => S[u] || [], { skipVoid: !1 });
|
|
760
760
|
}
|
|
761
761
|
return {
|
|
762
|
-
spawn:
|
|
762
|
+
spawn: O,
|
|
763
763
|
getByExperienceId: x,
|
|
764
764
|
listStore: P
|
|
765
765
|
};
|
|
766
766
|
});
|
|
767
|
-
function
|
|
768
|
-
return
|
|
767
|
+
function Yt(t) {
|
|
768
|
+
return st(Gt, t);
|
|
769
769
|
}
|
|
770
770
|
export {
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
771
|
+
jt as a,
|
|
772
|
+
Jt as b,
|
|
773
|
+
Yt as c,
|
|
774
774
|
Xt as d,
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
775
|
+
et as e,
|
|
776
|
+
At as f,
|
|
777
|
+
zt as g,
|
|
778
|
+
j as h,
|
|
779
|
+
Ot as i,
|
|
780
|
+
Qt as t
|
|
781
781
|
};
|