@picked/client 0.0.9-next.1 → 0.0.9
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/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/shopify/index.js +1 -1
- package/dist/cjs/plugins/single-page-app/index.js +1 -1
- package/dist/cjs/plugins/web-components/index.js +1 -1
- package/dist/cjs/plugins/window-object/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/esm/index.js +126 -145
- package/dist/esm/plugins/experience-browser-storage/index.js +14 -15
- package/dist/esm/plugins/history-browser-storage/index.js +1 -1
- package/dist/esm/plugins/responses-browser-storage/index.js +1 -1
- package/dist/esm/plugins/shopify/index.js +33 -32
- 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 +1 -1
- package/dist/{experience-instance-BEKoIaYp.js → experience-instance-C1Ky25uw.js} +151 -156
- package/dist/{experience-instance-D4dHslLZ.cjs → experience-instance-DNI5sbjx.cjs} +1 -1
- package/dist/storage-BPJwmlva.cjs +1 -0
- package/dist/{storage-BxBBl9Bw.js → storage-D87xFySf.js} +31 -39
- package/dist/supports-B6KShYPU.cjs +1 -0
- package/dist/{supports-BjhuLJ8z.js → supports-yKVnaaMQ.js} +12 -20
- package/dist/types/entities/experience-instance/experience-instance.d.ts +7 -7
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/picked.d.ts +0 -2
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/plugins/shopify/plugin.d.ts.map +1 -1
- package/dist/types/utils/events.d.ts +24 -23
- package/dist/types/utils/events.d.ts.map +1 -1
- package/dist/types/utils/storage.d.ts +0 -3
- package/dist/types/utils/storage.d.ts.map +1 -1
- package/dist/types/utils/supports.d.ts +0 -1
- package/dist/types/utils/supports.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/storage-LI3UdcCr.cjs +0 -1
- package/dist/supports-YvpQZxbh.cjs +0 -1
- package/dist/types/utils/user-session.d.ts +0 -6
- package/dist/types/utils/user-session.d.ts.map +0 -1
package/dist/esm/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
var W = Object.defineProperty;
|
|
2
2
|
var G = (t, e, s) => e in t ? W(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
|
|
3
3
|
var y = (t, e, s) => G(t, typeof e != "symbol" ? e + "" : e, s);
|
|
4
|
-
import { createDomain as
|
|
4
|
+
import { createDomain as F, createApi as b, createEffect as D, attach as J, sample as P, combine as A, createEvent as C } from "effector";
|
|
5
5
|
import { createFactory as k, invoke as x } from "@withease/factories";
|
|
6
|
-
import { g as
|
|
7
|
-
import { f as
|
|
6
|
+
import { g as z, t as Y, c as Q, e as R, i as X, a as Z, b as ee, d as te } from "../experience-instance-C1Ky25uw.js";
|
|
7
|
+
import { f as it } from "../experience-instance-C1Ky25uw.js";
|
|
8
8
|
import { l as v } from "../logger-C9a75KZn.js";
|
|
9
|
-
import { c as
|
|
10
|
-
import { a as
|
|
9
|
+
import { c as B, s as j, l as O } from "../storage-D87xFySf.js";
|
|
10
|
+
import { a as ct } from "../storage-D87xFySf.js";
|
|
11
11
|
import { g as re } from "../id-BW-g3y32.js";
|
|
12
12
|
import { i as se } from "../object-JwZ58NOH.js";
|
|
13
|
-
import { s as
|
|
14
|
-
import {
|
|
15
|
-
const
|
|
13
|
+
import { s as _, a as ne, b as oe } from "../supports-yKVnaaMQ.js";
|
|
14
|
+
import { g as lt, d as dt, i as pt, e as gt, c as ft, f as mt, h as yt, j as ht } from "../supports-yKVnaaMQ.js";
|
|
15
|
+
const U = F("experience"), ie = k(
|
|
16
16
|
({ client: t, experience: e }) => {
|
|
17
|
-
const s =
|
|
17
|
+
const s = U.store(e), o = b(s, {
|
|
18
18
|
merge(n, d) {
|
|
19
19
|
return {
|
|
20
20
|
...n,
|
|
@@ -44,11 +44,11 @@ const _ = b("experience"), ce = k(
|
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
);
|
|
47
|
-
function
|
|
48
|
-
return x(
|
|
47
|
+
function ae(t) {
|
|
48
|
+
return x(ie, t);
|
|
49
49
|
}
|
|
50
|
-
const
|
|
51
|
-
const e =
|
|
50
|
+
const ce = k(({ client: t }) => {
|
|
51
|
+
const e = U.store({}), s = b(e, {
|
|
52
52
|
register(r, n) {
|
|
53
53
|
return {
|
|
54
54
|
...r,
|
|
@@ -62,7 +62,7 @@ const le = k(({ client: t }) => {
|
|
|
62
62
|
n.merge({ experience: r, strategy: "override" });
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
|
-
const d =
|
|
65
|
+
const d = ae({ client: t, experience: r });
|
|
66
66
|
s.register(d);
|
|
67
67
|
}
|
|
68
68
|
const i = e.map((r) => Object.values(r));
|
|
@@ -75,34 +75,34 @@ const le = k(({ client: t }) => {
|
|
|
75
75
|
listStore: i
|
|
76
76
|
};
|
|
77
77
|
});
|
|
78
|
-
function
|
|
79
|
-
return x(
|
|
78
|
+
function ue(t) {
|
|
79
|
+
return x(ce, t);
|
|
80
80
|
}
|
|
81
|
-
const
|
|
81
|
+
const le = (t, e) => {
|
|
82
82
|
e.register(t);
|
|
83
83
|
}, H = (t, e) => {
|
|
84
|
-
const { targetSelectors: s } = e.configStore.getState(), o =
|
|
84
|
+
const { targetSelectors: s } = e.configStore.getState(), o = z(s, e.id);
|
|
85
85
|
o.forEach(
|
|
86
86
|
({ elements: l }) => l.forEach((r) => Y(r, e.id))
|
|
87
87
|
), Q(o, e.id).forEach((l) => {
|
|
88
88
|
t.experienceInstances.spawn(e, l);
|
|
89
89
|
});
|
|
90
|
-
},
|
|
90
|
+
}, T = async (t) => {
|
|
91
91
|
await Promise.all(
|
|
92
92
|
t.experiences.listStore.getState().map(async (e) => {
|
|
93
|
-
await
|
|
93
|
+
await de(t, e) && H(t, e);
|
|
94
94
|
})
|
|
95
95
|
);
|
|
96
|
-
},
|
|
96
|
+
}, de = async (t, e) => {
|
|
97
97
|
const { type: s, decisionLogic: o, targetSelectors: i } = e.configStore.getState();
|
|
98
|
-
return
|
|
99
|
-
},
|
|
98
|
+
return z(i, e.id).length < 1 ? !1 : s === "funnel" ? o ? await R(t, o) === !0 : !1 : i.length === 0 ? !1 : X(o) ? await R(t, o) === !0 : !0;
|
|
99
|
+
}, pe = (t, e, s) => {
|
|
100
100
|
const o = e.name, i = e.setup(t);
|
|
101
101
|
if (i) {
|
|
102
102
|
const l = s[o] ?? {};
|
|
103
103
|
s[o] = Object.freeze({ ...l, ...i });
|
|
104
104
|
}
|
|
105
|
-
},
|
|
105
|
+
}, ge = F("component"), fe = k(
|
|
106
106
|
({ client: t, component: e, name: s }) => {
|
|
107
107
|
const o = t.frameworks.getByName(e.frameworkName);
|
|
108
108
|
return {
|
|
@@ -112,11 +112,11 @@ const pe = (t, e) => {
|
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
114
|
);
|
|
115
|
-
function
|
|
116
|
-
return x(
|
|
115
|
+
function me(t) {
|
|
116
|
+
return x(fe, t);
|
|
117
117
|
}
|
|
118
|
-
const
|
|
119
|
-
const e =
|
|
118
|
+
const ye = k(({ client: t }) => {
|
|
119
|
+
const e = ge.store({}), s = b(e, {
|
|
120
120
|
register(r, n) {
|
|
121
121
|
return {
|
|
122
122
|
...r,
|
|
@@ -129,7 +129,7 @@ const Se = k(({ client: t }) => {
|
|
|
129
129
|
"warn",
|
|
130
130
|
`Component '${r}' already registered. Registering again will override the previous registration.`
|
|
131
131
|
);
|
|
132
|
-
const h =
|
|
132
|
+
const h = me({ client: t, name: r, component: n });
|
|
133
133
|
s.register(h);
|
|
134
134
|
}
|
|
135
135
|
const i = e.map((r) => Object.values(r));
|
|
@@ -142,13 +142,13 @@ const Se = k(({ client: t }) => {
|
|
|
142
142
|
listStore: i
|
|
143
143
|
};
|
|
144
144
|
});
|
|
145
|
-
function
|
|
146
|
-
return x(
|
|
145
|
+
function he(t) {
|
|
146
|
+
return x(ye, t);
|
|
147
147
|
}
|
|
148
|
-
const
|
|
148
|
+
const V = (t, e, s) => {
|
|
149
149
|
s.register(t, e);
|
|
150
|
-
},
|
|
151
|
-
const e =
|
|
150
|
+
}, Se = F("framework"), we = k(({ client: t }) => {
|
|
151
|
+
const e = Se.store({}), s = b(e, {
|
|
152
152
|
register(r, n) {
|
|
153
153
|
return {
|
|
154
154
|
...r,
|
|
@@ -172,15 +172,15 @@ const T = (t, e, s) => {
|
|
|
172
172
|
listStore: i
|
|
173
173
|
};
|
|
174
174
|
});
|
|
175
|
-
function
|
|
176
|
-
return x(
|
|
175
|
+
function ve(t) {
|
|
176
|
+
return x(we, t);
|
|
177
177
|
}
|
|
178
|
-
const
|
|
178
|
+
const ke = (t, e) => {
|
|
179
179
|
e.register(t.name, t);
|
|
180
|
-
},
|
|
180
|
+
}, xe = 6e3, M = B("last_ping", "global"), Fe = (t) => `${t}/api/v1/ping`, be = async (t) => {
|
|
181
181
|
try {
|
|
182
|
-
const e = Date.now(), s = localStorage.getItem(
|
|
183
|
-
if (s && e - parseInt(s) <
|
|
182
|
+
const e = Date.now(), s = localStorage.getItem(M);
|
|
183
|
+
if (s && e - parseInt(s) < xe)
|
|
184
184
|
return !0;
|
|
185
185
|
const o = Fe(t.apiUrl), i = {
|
|
186
186
|
projectId: t.projectId,
|
|
@@ -194,12 +194,12 @@ const be = (t, e) => {
|
|
|
194
194
|
headers: r,
|
|
195
195
|
body: l
|
|
196
196
|
})).ok;
|
|
197
|
-
return c && localStorage.setItem(
|
|
197
|
+
return c && localStorage.setItem(M, e.toString()), c;
|
|
198
198
|
} catch (e) {
|
|
199
199
|
return v("error", e), !1;
|
|
200
200
|
}
|
|
201
201
|
};
|
|
202
|
-
function
|
|
202
|
+
function Ie(t) {
|
|
203
203
|
const e = typeof window < "u", s = {
|
|
204
204
|
client: t,
|
|
205
205
|
responses: t.responses.listStore.getState(),
|
|
@@ -211,8 +211,8 @@ function Pe(t) {
|
|
|
211
211
|
};
|
|
212
212
|
return Object.freeze(s);
|
|
213
213
|
}
|
|
214
|
-
const
|
|
215
|
-
const e =
|
|
214
|
+
const Ee = F("predicate"), Pe = k(({ client: t }) => {
|
|
215
|
+
const e = Ee.store({}), s = b(e, {
|
|
216
216
|
register(r, n) {
|
|
217
217
|
return {
|
|
218
218
|
...r,
|
|
@@ -239,13 +239,13 @@ const Re = b("predicate"), $e = k(({ client: t }) => {
|
|
|
239
239
|
listStore: i
|
|
240
240
|
};
|
|
241
241
|
});
|
|
242
|
-
function
|
|
243
|
-
return x(
|
|
242
|
+
function Re(t) {
|
|
243
|
+
return x(Pe, t);
|
|
244
244
|
}
|
|
245
|
-
const
|
|
245
|
+
const Be = (t, e, s) => {
|
|
246
246
|
s.register(t, e);
|
|
247
|
-
}, N =
|
|
248
|
-
const t = N.store({}), e = N.store([]), s =
|
|
247
|
+
}, N = F("feature"), je = k(() => {
|
|
248
|
+
const t = N.store({}), e = N.store([]), s = b(t, {
|
|
249
249
|
register(c, f) {
|
|
250
250
|
return {
|
|
251
251
|
...c,
|
|
@@ -272,25 +272,25 @@ const je = (t, e, s) => {
|
|
|
272
272
|
})
|
|
273
273
|
);
|
|
274
274
|
}
|
|
275
|
-
const i =
|
|
275
|
+
const i = D(
|
|
276
276
|
async ({
|
|
277
277
|
id: c,
|
|
278
278
|
key: f,
|
|
279
279
|
storage: a = "local"
|
|
280
280
|
}) => {
|
|
281
|
-
const p =
|
|
281
|
+
const p = B(`feature:${c}:${f}`, "global"), m = (a === "session" ? j : O).get(p).boolean();
|
|
282
282
|
if (m !== null)
|
|
283
283
|
return { id: c, bucket: m };
|
|
284
284
|
}
|
|
285
|
-
), l =
|
|
285
|
+
), l = D((c) => {
|
|
286
286
|
if (!c)
|
|
287
287
|
return null;
|
|
288
|
-
const f =
|
|
289
|
-
(c.storage === "session" ?
|
|
288
|
+
const f = B(`feature:${c.id}:${c.key}`, "global");
|
|
289
|
+
(c.storage === "session" ? j : O).set(f, c.bucket);
|
|
290
290
|
}), r = /* @__PURE__ */ new Map(), n = J({
|
|
291
291
|
source: { allFeaturesStore: t, resolvedFeaturesStore: e },
|
|
292
292
|
effect: async ({ allFeaturesStore: c, resolvedFeaturesStore: f }, { id: a, decide: p, key: g }) => {
|
|
293
|
-
const m = f.find((
|
|
293
|
+
const m = f.find((I) => I.id === a);
|
|
294
294
|
if (m)
|
|
295
295
|
return m;
|
|
296
296
|
const u = c[a];
|
|
@@ -298,13 +298,13 @@ const je = (t, e, s) => {
|
|
|
298
298
|
throw new Error(`Feature with id '${a}' not found`);
|
|
299
299
|
const S = r.get(`${a}:${g}`);
|
|
300
300
|
if (S) {
|
|
301
|
-
const
|
|
302
|
-
return { id: u.id, bucket:
|
|
301
|
+
const I = await S;
|
|
302
|
+
return { id: u.id, bucket: I, storage: u.feature.storage };
|
|
303
303
|
}
|
|
304
304
|
const w = p();
|
|
305
305
|
r.set(`${a}:${g}`, w);
|
|
306
|
-
const
|
|
307
|
-
return { id: u.id, bucket:
|
|
306
|
+
const $ = await w;
|
|
307
|
+
return { id: u.id, bucket: $, storage: u.feature.storage };
|
|
308
308
|
}
|
|
309
309
|
});
|
|
310
310
|
P({
|
|
@@ -359,12 +359,12 @@ const je = (t, e, s) => {
|
|
|
359
359
|
listStore: d
|
|
360
360
|
};
|
|
361
361
|
});
|
|
362
|
-
function
|
|
363
|
-
return x(
|
|
362
|
+
function $e() {
|
|
363
|
+
return x(je);
|
|
364
364
|
}
|
|
365
|
-
const
|
|
365
|
+
const Ae = (t, e, s) => {
|
|
366
366
|
s.register(t, e);
|
|
367
|
-
}, E =
|
|
367
|
+
}, E = F("history");
|
|
368
368
|
function L(t, e) {
|
|
369
369
|
return {
|
|
370
370
|
// eslint-disable-next-line sonarjs/pseudo-random
|
|
@@ -374,7 +374,7 @@ function L(t, e) {
|
|
|
374
374
|
experienceId: t
|
|
375
375
|
};
|
|
376
376
|
}
|
|
377
|
-
const
|
|
377
|
+
const Ce = k(() => {
|
|
378
378
|
const t = E.store({ entries: [] }), e = E.event(), s = E.event(), o = E.event(), i = E.event();
|
|
379
379
|
t.on(e, (r, n) => ({
|
|
380
380
|
entries: [...r.entries, L(n.experienceId, n.node)]
|
|
@@ -412,11 +412,11 @@ const Oe = k(() => {
|
|
|
412
412
|
entriesStore: t.map((r) => r.entries)
|
|
413
413
|
};
|
|
414
414
|
});
|
|
415
|
-
function
|
|
416
|
-
return x(
|
|
415
|
+
function De() {
|
|
416
|
+
return x(Ce);
|
|
417
417
|
}
|
|
418
|
-
const
|
|
419
|
-
const t =
|
|
418
|
+
const Oe = () => C(), Te = F("field"), Ve = k(() => {
|
|
419
|
+
const t = Te.store({}), e = b(t, {
|
|
420
420
|
register(r, n) {
|
|
421
421
|
return {
|
|
422
422
|
...r,
|
|
@@ -441,13 +441,13 @@ const Te = () => C(), Ve = b("field"), Ne = k(() => {
|
|
|
441
441
|
getByName: l
|
|
442
442
|
};
|
|
443
443
|
});
|
|
444
|
-
function
|
|
445
|
-
return x(
|
|
444
|
+
function Me() {
|
|
445
|
+
return x(Ve);
|
|
446
446
|
}
|
|
447
|
-
const
|
|
447
|
+
const Ne = (t, e) => {
|
|
448
448
|
e.register(t);
|
|
449
|
-
},
|
|
450
|
-
const e =
|
|
449
|
+
}, Le = F("response"), ze = k(({ client: t }) => {
|
|
450
|
+
const e = Le.store({}), s = C(), o = C(), i = b(e, {
|
|
451
451
|
register(a, p) {
|
|
452
452
|
return {
|
|
453
453
|
...a,
|
|
@@ -528,8 +528,8 @@ const Ue = (t, e) => {
|
|
|
528
528
|
return;
|
|
529
529
|
}
|
|
530
530
|
if (S.options) {
|
|
531
|
-
const w = S.options.map((
|
|
532
|
-
Array.isArray(u) && (
|
|
531
|
+
const w = S.options.map((I) => I.value), $ = Array.isArray(u) ? u : [u];
|
|
532
|
+
Array.isArray(u) && ($.every((I) => w.includes(I)) || p.push({
|
|
533
533
|
fieldId: g,
|
|
534
534
|
userMessage: "This field expects a valid option",
|
|
535
535
|
systemMessage: `Field expects a valid option. Valid options are: ${w.join(", ")}`,
|
|
@@ -576,12 +576,12 @@ const Ue = (t, e) => {
|
|
|
576
576
|
getByFieldName: f
|
|
577
577
|
};
|
|
578
578
|
});
|
|
579
|
-
function
|
|
580
|
-
return x(
|
|
579
|
+
function _e(t) {
|
|
580
|
+
return x(ze, t);
|
|
581
581
|
}
|
|
582
|
-
const
|
|
583
|
-
function
|
|
584
|
-
if (
|
|
582
|
+
const Ue = () => "0.0.9";
|
|
583
|
+
function He() {
|
|
584
|
+
if (_()) {
|
|
585
585
|
const t = [
|
|
586
586
|
document.currentScript,
|
|
587
587
|
document.getElementById("picked_script"),
|
|
@@ -595,7 +595,7 @@ function qe() {
|
|
|
595
595
|
}
|
|
596
596
|
return "https://api.picked.app";
|
|
597
597
|
}
|
|
598
|
-
function
|
|
598
|
+
function Ke() {
|
|
599
599
|
if (!ne())
|
|
600
600
|
return {};
|
|
601
601
|
const t = new URLSearchParams(window.location.search), e = {}, s = /* @__PURE__ */ new Set();
|
|
@@ -605,84 +605,66 @@ function We() {
|
|
|
605
605
|
const l = i.replace("picked-", "");
|
|
606
606
|
e[l] = t.getAll(i);
|
|
607
607
|
}
|
|
608
|
-
const o =
|
|
608
|
+
const o = B("s");
|
|
609
609
|
if (s.size > 0)
|
|
610
|
-
|
|
610
|
+
j.set(o, e);
|
|
611
611
|
else {
|
|
612
|
-
const i =
|
|
612
|
+
const i = j.get(o);
|
|
613
613
|
if (i)
|
|
614
614
|
return i.json() || {};
|
|
615
615
|
}
|
|
616
616
|
return e;
|
|
617
617
|
}
|
|
618
|
-
function Ge() {
|
|
619
|
-
if (ie())
|
|
620
|
-
return crypto.randomUUID();
|
|
621
|
-
const t = Date.now().toString(36), e = Math.random().toString(36).substring(2, 15), s = Math.random().toString(36).substring(2, 15), o = Math.random().toString(36).substring(2, 15);
|
|
622
|
-
return `${t}-${e}-${s}-${o}`;
|
|
623
|
-
}
|
|
624
|
-
const Je = () => ({
|
|
625
|
-
id: Ge()
|
|
626
|
-
}), Ye = () => {
|
|
627
|
-
if (!oe()) return null;
|
|
628
|
-
const t = D.get("session");
|
|
629
|
-
let e = t.isSet() ? t.json() : null;
|
|
630
|
-
return e || (e = Je(), t.set(e)), e;
|
|
631
|
-
}, Qe = (t) => {
|
|
632
|
-
const e = Ye();
|
|
633
|
-
return e && t.eventBus({ type: "session", ...e }), e;
|
|
634
|
-
};
|
|
635
618
|
class K {
|
|
636
619
|
constructor(e) {
|
|
637
620
|
y(this, "options");
|
|
638
621
|
y(this, "isReady", !1);
|
|
639
622
|
y(this, "project");
|
|
640
623
|
y(this, "plugins", {});
|
|
641
|
-
y(this, "eventBus",
|
|
624
|
+
y(this, "eventBus", Oe());
|
|
642
625
|
y(this, "organizationId");
|
|
643
626
|
y(this, "projectId");
|
|
644
627
|
y(this, "apiUrl");
|
|
645
|
-
y(this, "
|
|
646
|
-
y(this, "
|
|
647
|
-
y(this, "
|
|
648
|
-
y(this, "components", we({ client: this }));
|
|
628
|
+
y(this, "searchParams", Ke());
|
|
629
|
+
y(this, "history", De());
|
|
630
|
+
y(this, "components", he({ client: this }));
|
|
649
631
|
y(this, "experienceInstances", ee({ client: this }));
|
|
650
|
-
y(this, "experiences",
|
|
651
|
-
y(this, "frameworks",
|
|
652
|
-
y(this, "predicates",
|
|
653
|
-
y(this, "features",
|
|
654
|
-
y(this, "responses",
|
|
655
|
-
y(this, "fields",
|
|
656
|
-
v("info", "Picked client initializing."), this.organizationId = e.organizationId, this.projectId = e.projectId, this.options = Object.freeze(e), this.apiUrl = e.apiUrl ||
|
|
632
|
+
y(this, "experiences", ue({ client: this }));
|
|
633
|
+
y(this, "frameworks", ve({ client: this }));
|
|
634
|
+
y(this, "predicates", Re({ client: this }));
|
|
635
|
+
y(this, "features", $e());
|
|
636
|
+
y(this, "responses", _e({ client: this }));
|
|
637
|
+
y(this, "fields", Me());
|
|
638
|
+
v("info", "Picked client initializing."), this.organizationId = e.organizationId, this.projectId = e.projectId, this.options = Object.freeze(e), this.apiUrl = e.apiUrl || He(), this.setupPlugins(), this.setupFeatures(), this.setupPredicates(), this.eventBus({ type: "initialized", version: Ue() }), v("info", "Picked client initialized.");
|
|
657
639
|
}
|
|
658
640
|
start() {
|
|
659
|
-
|
|
660
|
-
|
|
641
|
+
be(this), (async () => {
|
|
642
|
+
_() && (document.body && await T(this), await te(), await T(this), this.eventBus({ type: "ready" }), this.isReady = !0);
|
|
661
643
|
})();
|
|
662
644
|
}
|
|
663
645
|
registerFramework(e) {
|
|
664
|
-
|
|
646
|
+
ke(e, this.frameworks);
|
|
665
647
|
}
|
|
666
648
|
registerComponent(e, s) {
|
|
667
|
-
|
|
649
|
+
V(e, s, this.components);
|
|
668
650
|
}
|
|
669
651
|
registerPlugin(e) {
|
|
670
|
-
|
|
652
|
+
pe(this, e, this.plugins);
|
|
671
653
|
}
|
|
672
654
|
registerFeature(e, s) {
|
|
673
|
-
|
|
655
|
+
Ae(e, s, this.features);
|
|
674
656
|
}
|
|
675
657
|
registerPredicate(e, s) {
|
|
676
|
-
|
|
658
|
+
Be(e, s, this.predicates);
|
|
677
659
|
}
|
|
678
660
|
registerField(e) {
|
|
679
|
-
|
|
661
|
+
Ne(e, this.fields);
|
|
680
662
|
}
|
|
681
663
|
registerExperience(e) {
|
|
682
|
-
e.component &&
|
|
664
|
+
e.component && V(`experience:${e.id}`, e.component, this.components), le(e, this.experiences);
|
|
683
665
|
}
|
|
684
666
|
getStateSnapshot() {
|
|
685
|
-
return
|
|
667
|
+
return Ie(this);
|
|
686
668
|
}
|
|
687
669
|
async launchExperienceById(e) {
|
|
688
670
|
const s = this.experiences.getById(e).getState();
|
|
@@ -760,11 +742,11 @@ function q(t) {
|
|
|
760
742
|
var e;
|
|
761
743
|
return ((e = t.options) == null ? void 0 : e.some((s) => "condition" in s)) ?? !1;
|
|
762
744
|
}
|
|
763
|
-
function
|
|
745
|
+
function qe(t) {
|
|
764
746
|
return t.some((e) => e.condition || q(e));
|
|
765
747
|
}
|
|
766
|
-
async function
|
|
767
|
-
return e.length === 0 || !
|
|
748
|
+
async function rt(t, e) {
|
|
749
|
+
return e.length === 0 || !qe(e) ? e : (await Promise.all(
|
|
768
750
|
e.map(async (o) => {
|
|
769
751
|
if (!(o.condition ? await R(t, o.condition) : !0))
|
|
770
752
|
return null;
|
|
@@ -777,29 +759,28 @@ async function ct(t, e) {
|
|
|
777
759
|
})
|
|
778
760
|
)).filter((o) => o !== null);
|
|
779
761
|
}
|
|
780
|
-
const
|
|
762
|
+
const st = (t) => {
|
|
781
763
|
const e = new K(t);
|
|
782
|
-
return
|
|
764
|
+
return oe(e), e;
|
|
783
765
|
};
|
|
784
766
|
export {
|
|
785
767
|
K as Picked,
|
|
786
|
-
|
|
787
|
-
|
|
768
|
+
st as createClient,
|
|
769
|
+
B as createStorageKey,
|
|
788
770
|
R as evaluateRuleLogic,
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
xt as supportsWebComponents,
|
|
771
|
+
rt as getStepFields,
|
|
772
|
+
it as isPickedRoot,
|
|
773
|
+
O as localStore,
|
|
774
|
+
j as sessionStore,
|
|
775
|
+
ct as subscribe,
|
|
776
|
+
lt as supportsCookies,
|
|
777
|
+
_ as supportsDocument,
|
|
778
|
+
dt as supportsHistory,
|
|
779
|
+
pt as supportsIntersectionObserver,
|
|
780
|
+
gt as supportsLocalStorage,
|
|
781
|
+
ft as supportsLocation,
|
|
782
|
+
mt as supportsSessionStorage,
|
|
783
|
+
yt as supportsShadowRoot,
|
|
784
|
+
ht as supportsWebComponents,
|
|
804
785
|
ne as supportsWindow
|
|
805
786
|
};
|
|
@@ -1,36 +1,35 @@
|
|
|
1
|
-
import { createEffect as
|
|
2
|
-
import { c, l as
|
|
1
|
+
import { createEffect as n, sample as i } from "effector";
|
|
2
|
+
import { c, l as x, s as S } from "../../../storage-D87xFySf.js";
|
|
3
3
|
import { l as f } from "../../../logger-C9a75KZn.js";
|
|
4
4
|
const y = ({
|
|
5
5
|
storage: a = "local"
|
|
6
6
|
} = {}) => ({
|
|
7
7
|
name: "experience-browser-storage-plugin",
|
|
8
|
-
setup: (
|
|
9
|
-
const
|
|
8
|
+
setup: (s) => {
|
|
9
|
+
const r = a === "local" ? x : S, p = n(async (e) => {
|
|
10
10
|
if (!e) {
|
|
11
11
|
f("warn", "No experience instance provided to loadExperienceVisiblityFx.");
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
|
-
const t = c("open-close", "experience", e),
|
|
15
|
-
e.setOpen(
|
|
14
|
+
const t = c("open-close", "experience", e), o = r.get(t).boolean();
|
|
15
|
+
e.setOpen(o ?? e.isOpenStore.getState());
|
|
16
16
|
});
|
|
17
17
|
i({
|
|
18
|
-
source:
|
|
19
|
-
filter: (e) => e.type === "experience_initialized"
|
|
20
|
-
// @ts-ignore todo
|
|
18
|
+
source: s.eventBus,
|
|
19
|
+
filter: (e) => e.type === "experience_initialized",
|
|
21
20
|
fn: (e) => e.experienceInstance,
|
|
22
21
|
target: p
|
|
23
22
|
});
|
|
24
|
-
const l =
|
|
25
|
-
const t = c("open-close", "experience", e),
|
|
26
|
-
|
|
27
|
-
}),
|
|
23
|
+
const l = n(async (e) => {
|
|
24
|
+
const t = c("open-close", "experience", e), o = e.isOpenStore.getState();
|
|
25
|
+
r.set(t, o);
|
|
26
|
+
}), g = (e) => i({
|
|
28
27
|
source: e.isOpenStore,
|
|
29
28
|
fn: () => e,
|
|
30
29
|
target: l
|
|
31
30
|
});
|
|
32
|
-
|
|
33
|
-
e.forEach((t) =>
|
|
31
|
+
s.experienceInstances.listStore.watch((e) => {
|
|
32
|
+
e.forEach((t) => g(t));
|
|
34
33
|
});
|
|
35
34
|
}
|
|
36
35
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createEffect as s, sample as r } from "effector";
|
|
2
|
-
import { c as l, l as y, s as g } from "../../../storage-
|
|
2
|
+
import { c as l, l as y, s as g } from "../../../storage-D87xFySf.js";
|
|
3
3
|
const a = l("history", "global"), f = ({
|
|
4
4
|
storage: i = "local"
|
|
5
5
|
} = {}) => ({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createEffect as p, sample as i } from "effector";
|
|
2
|
-
import { c as b, l as d, s as y } from "../../../storage-
|
|
2
|
+
import { c as b, l as d, s as y } from "../../../storage-D87xFySf.js";
|
|
3
3
|
const a = b("responses", "global"), R = ({
|
|
4
4
|
storage: g = "local"
|
|
5
5
|
} = {}) => ({
|