@picked/client 0.0.8-next.1 → 0.0.9-next.1
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 +145 -126
- package/dist/esm/plugins/experience-browser-storage/index.js +15 -14
- 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 +32 -33
- 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-C1Ky25uw.js → experience-instance-BEKoIaYp.js} +156 -151
- package/dist/{experience-instance-DNI5sbjx.cjs → experience-instance-D4dHslLZ.cjs} +1 -1
- package/dist/{storage-D87xFySf.js → storage-BxBBl9Bw.js} +39 -31
- package/dist/storage-LI3UdcCr.cjs +1 -0
- package/dist/{supports-yKVnaaMQ.js → supports-BjhuLJ8z.js} +20 -12
- package/dist/supports-YvpQZxbh.cjs +1 -0
- 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 +2 -0
- 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 +23 -24
- package/dist/types/utils/events.d.ts.map +1 -1
- package/dist/types/utils/storage.d.ts +3 -0
- package/dist/types/utils/storage.d.ts.map +1 -1
- package/dist/types/utils/supports.d.ts +1 -0
- package/dist/types/utils/supports.d.ts.map +1 -1
- package/dist/types/utils/user-session.d.ts +6 -0
- package/dist/types/utils/user-session.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/storage-BPJwmlva.cjs +0 -1
- package/dist/supports-B6KShYPU.cjs +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 b, createApi as I, createEffect as O, 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 U, t as Y, c as Q, e as R, i as X, a as Z, b as ee, d as te } from "../experience-instance-BEKoIaYp.js";
|
|
7
|
+
import { f as pt } from "../experience-instance-BEKoIaYp.js";
|
|
8
8
|
import { l as v } from "../logger-C9a75KZn.js";
|
|
9
|
-
import { c as
|
|
10
|
-
import { a as
|
|
9
|
+
import { c as $, s as B, l as D } from "../storage-BxBBl9Bw.js";
|
|
10
|
+
import { a as ft } from "../storage-BxBBl9Bw.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 z, a as ne, b as oe, c as ie, d as ae } from "../supports-BjhuLJ8z.js";
|
|
14
|
+
import { h as yt, f as ht, j as St, e as wt, g as vt, i as kt, k as xt } from "../supports-BjhuLJ8z.js";
|
|
15
|
+
const _ = b("experience"), ce = k(
|
|
16
16
|
({ client: t, experience: e }) => {
|
|
17
|
-
const s =
|
|
17
|
+
const s = _.store(e), o = I(s, {
|
|
18
18
|
merge(n, d) {
|
|
19
19
|
return {
|
|
20
20
|
...n,
|
|
@@ -44,11 +44,11 @@ const U = F("experience"), ie = k(
|
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
);
|
|
47
|
-
function
|
|
48
|
-
return x(
|
|
47
|
+
function ue(t) {
|
|
48
|
+
return x(ce, t);
|
|
49
49
|
}
|
|
50
|
-
const
|
|
51
|
-
const e =
|
|
50
|
+
const le = k(({ client: t }) => {
|
|
51
|
+
const e = _.store({}), s = I(e, {
|
|
52
52
|
register(r, n) {
|
|
53
53
|
return {
|
|
54
54
|
...r,
|
|
@@ -62,7 +62,7 @@ const ce = k(({ client: t }) => {
|
|
|
62
62
|
n.merge({ experience: r, strategy: "override" });
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
|
-
const d =
|
|
65
|
+
const d = ue({ 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 ce = k(({ client: t }) => {
|
|
|
75
75
|
listStore: i
|
|
76
76
|
};
|
|
77
77
|
});
|
|
78
|
-
function
|
|
79
|
-
return x(
|
|
78
|
+
function de(t) {
|
|
79
|
+
return x(le, t);
|
|
80
80
|
}
|
|
81
|
-
const
|
|
81
|
+
const pe = (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 = U(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
|
+
}, M = async (t) => {
|
|
91
91
|
await Promise.all(
|
|
92
92
|
t.experiences.listStore.getState().map(async (e) => {
|
|
93
|
-
await
|
|
93
|
+
await ge(t, e) && H(t, e);
|
|
94
94
|
})
|
|
95
95
|
);
|
|
96
|
-
},
|
|
96
|
+
}, ge = async (t, e) => {
|
|
97
97
|
const { type: s, decisionLogic: o, targetSelectors: i } = e.configStore.getState();
|
|
98
|
-
return
|
|
99
|
-
},
|
|
98
|
+
return U(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
|
+
}, fe = (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
|
+
}, me = b("component"), ye = 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 le = (t, e) => {
|
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
114
|
);
|
|
115
|
-
function
|
|
116
|
-
return x(
|
|
115
|
+
function he(t) {
|
|
116
|
+
return x(ye, t);
|
|
117
117
|
}
|
|
118
|
-
const
|
|
119
|
-
const e =
|
|
118
|
+
const Se = k(({ client: t }) => {
|
|
119
|
+
const e = me.store({}), s = I(e, {
|
|
120
120
|
register(r, n) {
|
|
121
121
|
return {
|
|
122
122
|
...r,
|
|
@@ -129,7 +129,7 @@ const ye = 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 = he({ 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 ye = k(({ client: t }) => {
|
|
|
142
142
|
listStore: i
|
|
143
143
|
};
|
|
144
144
|
});
|
|
145
|
-
function
|
|
146
|
-
return x(
|
|
145
|
+
function we(t) {
|
|
146
|
+
return x(Se, t);
|
|
147
147
|
}
|
|
148
|
-
const
|
|
148
|
+
const T = (t, e, s) => {
|
|
149
149
|
s.register(t, e);
|
|
150
|
-
},
|
|
151
|
-
const e =
|
|
150
|
+
}, ve = b("framework"), ke = k(({ client: t }) => {
|
|
151
|
+
const e = ve.store({}), s = I(e, {
|
|
152
152
|
register(r, n) {
|
|
153
153
|
return {
|
|
154
154
|
...r,
|
|
@@ -172,15 +172,15 @@ const V = (t, e, s) => {
|
|
|
172
172
|
listStore: i
|
|
173
173
|
};
|
|
174
174
|
});
|
|
175
|
-
function
|
|
176
|
-
return x(
|
|
175
|
+
function xe(t) {
|
|
176
|
+
return x(ke, t);
|
|
177
177
|
}
|
|
178
|
-
const
|
|
178
|
+
const be = (t, e) => {
|
|
179
179
|
e.register(t.name, t);
|
|
180
|
-
},
|
|
180
|
+
}, Ie = 6e3, V = $("last_ping", "global"), Fe = (t) => `${t}/api/v1/ping`, Ee = 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(V);
|
|
183
|
+
if (s && e - parseInt(s) < Ie)
|
|
184
184
|
return !0;
|
|
185
185
|
const o = Fe(t.apiUrl), i = {
|
|
186
186
|
projectId: t.projectId,
|
|
@@ -194,12 +194,12 @@ const ke = (t, e) => {
|
|
|
194
194
|
headers: r,
|
|
195
195
|
body: l
|
|
196
196
|
})).ok;
|
|
197
|
-
return c && localStorage.setItem(
|
|
197
|
+
return c && localStorage.setItem(V, e.toString()), c;
|
|
198
198
|
} catch (e) {
|
|
199
199
|
return v("error", e), !1;
|
|
200
200
|
}
|
|
201
201
|
};
|
|
202
|
-
function
|
|
202
|
+
function Pe(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 Ie(t) {
|
|
|
211
211
|
};
|
|
212
212
|
return Object.freeze(s);
|
|
213
213
|
}
|
|
214
|
-
const
|
|
215
|
-
const e =
|
|
214
|
+
const Re = b("predicate"), $e = k(({ client: t }) => {
|
|
215
|
+
const e = Re.store({}), s = I(e, {
|
|
216
216
|
register(r, n) {
|
|
217
217
|
return {
|
|
218
218
|
...r,
|
|
@@ -239,13 +239,13 @@ const Ee = F("predicate"), Pe = k(({ client: t }) => {
|
|
|
239
239
|
listStore: i
|
|
240
240
|
};
|
|
241
241
|
});
|
|
242
|
-
function
|
|
243
|
-
return x(
|
|
242
|
+
function Be(t) {
|
|
243
|
+
return x($e, t);
|
|
244
244
|
}
|
|
245
|
-
const
|
|
245
|
+
const je = (t, e, s) => {
|
|
246
246
|
s.register(t, e);
|
|
247
|
-
}, N =
|
|
248
|
-
const t = N.store({}), e = N.store([]), s =
|
|
247
|
+
}, N = b("feature"), Ae = k(() => {
|
|
248
|
+
const t = N.store({}), e = N.store([]), s = I(t, {
|
|
249
249
|
register(c, f) {
|
|
250
250
|
return {
|
|
251
251
|
...c,
|
|
@@ -272,25 +272,25 @@ const Be = (t, e, s) => {
|
|
|
272
272
|
})
|
|
273
273
|
);
|
|
274
274
|
}
|
|
275
|
-
const i =
|
|
275
|
+
const i = O(
|
|
276
276
|
async ({
|
|
277
277
|
id: c,
|
|
278
278
|
key: f,
|
|
279
279
|
storage: a = "local"
|
|
280
280
|
}) => {
|
|
281
|
-
const p =
|
|
281
|
+
const p = $(`feature:${c}:${f}`, "global"), m = (a === "session" ? B : D).get(p).boolean();
|
|
282
282
|
if (m !== null)
|
|
283
283
|
return { id: c, bucket: m };
|
|
284
284
|
}
|
|
285
|
-
), l =
|
|
285
|
+
), l = O((c) => {
|
|
286
286
|
if (!c)
|
|
287
287
|
return null;
|
|
288
|
-
const f =
|
|
289
|
-
(c.storage === "session" ?
|
|
288
|
+
const f = $(`feature:${c.id}:${c.key}`, "global");
|
|
289
|
+
(c.storage === "session" ? B : D).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((F) => F.id === a);
|
|
294
294
|
if (m)
|
|
295
295
|
return m;
|
|
296
296
|
const u = c[a];
|
|
@@ -298,13 +298,13 @@ const Be = (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 F = await S;
|
|
302
|
+
return { id: u.id, bucket: F, 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 j = await w;
|
|
307
|
+
return { id: u.id, bucket: j, storage: u.feature.storage };
|
|
308
308
|
}
|
|
309
309
|
});
|
|
310
310
|
P({
|
|
@@ -359,12 +359,12 @@ const Be = (t, e, s) => {
|
|
|
359
359
|
listStore: d
|
|
360
360
|
};
|
|
361
361
|
});
|
|
362
|
-
function
|
|
363
|
-
return x(
|
|
362
|
+
function Ce() {
|
|
363
|
+
return x(Ae);
|
|
364
364
|
}
|
|
365
|
-
const
|
|
365
|
+
const De = (t, e, s) => {
|
|
366
366
|
s.register(t, e);
|
|
367
|
-
}, E =
|
|
367
|
+
}, E = b("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 Oe = 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 Ce = k(() => {
|
|
|
412
412
|
entriesStore: t.map((r) => r.entries)
|
|
413
413
|
};
|
|
414
414
|
});
|
|
415
|
-
function
|
|
416
|
-
return x(
|
|
415
|
+
function Me() {
|
|
416
|
+
return x(Oe);
|
|
417
417
|
}
|
|
418
|
-
const
|
|
419
|
-
const t =
|
|
418
|
+
const Te = () => C(), Ve = b("field"), Ne = k(() => {
|
|
419
|
+
const t = Ve.store({}), e = I(t, {
|
|
420
420
|
register(r, n) {
|
|
421
421
|
return {
|
|
422
422
|
...r,
|
|
@@ -441,13 +441,13 @@ const Oe = () => C(), Te = F("field"), Ve = k(() => {
|
|
|
441
441
|
getByName: l
|
|
442
442
|
};
|
|
443
443
|
});
|
|
444
|
-
function
|
|
445
|
-
return x(
|
|
444
|
+
function Le() {
|
|
445
|
+
return x(Ne);
|
|
446
446
|
}
|
|
447
|
-
const
|
|
447
|
+
const Ue = (t, e) => {
|
|
448
448
|
e.register(t);
|
|
449
|
-
},
|
|
450
|
-
const e =
|
|
449
|
+
}, ze = b("response"), _e = k(({ client: t }) => {
|
|
450
|
+
const e = ze.store({}), s = C(), o = C(), i = I(e, {
|
|
451
451
|
register(a, p) {
|
|
452
452
|
return {
|
|
453
453
|
...a,
|
|
@@ -528,8 +528,8 @@ const Ne = (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((F) => F.value), j = Array.isArray(u) ? u : [u];
|
|
532
|
+
Array.isArray(u) && (j.every((F) => w.includes(F)) || 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 Ne = (t, e) => {
|
|
|
576
576
|
getByFieldName: f
|
|
577
577
|
};
|
|
578
578
|
});
|
|
579
|
-
function
|
|
580
|
-
return x(
|
|
579
|
+
function He(t) {
|
|
580
|
+
return x(_e, t);
|
|
581
581
|
}
|
|
582
|
-
const
|
|
583
|
-
function
|
|
584
|
-
if (
|
|
582
|
+
const Ke = () => "0.0.9-next.1";
|
|
583
|
+
function qe() {
|
|
584
|
+
if (z()) {
|
|
585
585
|
const t = [
|
|
586
586
|
document.currentScript,
|
|
587
587
|
document.getElementById("picked_script"),
|
|
@@ -595,7 +595,7 @@ function He() {
|
|
|
595
595
|
}
|
|
596
596
|
return "https://api.picked.app";
|
|
597
597
|
}
|
|
598
|
-
function
|
|
598
|
+
function We() {
|
|
599
599
|
if (!ne())
|
|
600
600
|
return {};
|
|
601
601
|
const t = new URLSearchParams(window.location.search), e = {}, s = /* @__PURE__ */ new Set();
|
|
@@ -605,66 +605,84 @@ function Ke() {
|
|
|
605
605
|
const l = i.replace("picked-", "");
|
|
606
606
|
e[l] = t.getAll(i);
|
|
607
607
|
}
|
|
608
|
-
const o =
|
|
608
|
+
const o = $("s");
|
|
609
609
|
if (s.size > 0)
|
|
610
|
-
|
|
610
|
+
B.set(o, e);
|
|
611
611
|
else {
|
|
612
|
-
const i =
|
|
612
|
+
const i = B.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
|
+
};
|
|
618
635
|
class K {
|
|
619
636
|
constructor(e) {
|
|
620
637
|
y(this, "options");
|
|
621
638
|
y(this, "isReady", !1);
|
|
622
639
|
y(this, "project");
|
|
623
640
|
y(this, "plugins", {});
|
|
624
|
-
y(this, "eventBus",
|
|
641
|
+
y(this, "eventBus", Te());
|
|
625
642
|
y(this, "organizationId");
|
|
626
643
|
y(this, "projectId");
|
|
627
644
|
y(this, "apiUrl");
|
|
628
|
-
y(this, "
|
|
629
|
-
y(this, "
|
|
630
|
-
y(this, "
|
|
645
|
+
y(this, "session");
|
|
646
|
+
y(this, "searchParams", We());
|
|
647
|
+
y(this, "history", Me());
|
|
648
|
+
y(this, "components", we({ client: this }));
|
|
631
649
|
y(this, "experienceInstances", ee({ client: this }));
|
|
632
|
-
y(this, "experiences",
|
|
633
|
-
y(this, "frameworks",
|
|
634
|
-
y(this, "predicates",
|
|
635
|
-
y(this, "features",
|
|
636
|
-
y(this, "responses",
|
|
637
|
-
y(this, "fields",
|
|
638
|
-
v("info", "Picked client initializing."), this.organizationId = e.organizationId, this.projectId = e.projectId, this.options = Object.freeze(e), this.apiUrl = e.apiUrl ||
|
|
650
|
+
y(this, "experiences", de({ client: this }));
|
|
651
|
+
y(this, "frameworks", xe({ client: this }));
|
|
652
|
+
y(this, "predicates", Be({ client: this }));
|
|
653
|
+
y(this, "features", Ce());
|
|
654
|
+
y(this, "responses", He({ client: this }));
|
|
655
|
+
y(this, "fields", Le());
|
|
656
|
+
v("info", "Picked client initializing."), this.organizationId = e.organizationId, this.projectId = e.projectId, this.options = Object.freeze(e), this.apiUrl = e.apiUrl || qe(), this.setupPlugins(), this.setupFeatures(), this.setupPredicates(), this.session = Qe(this), this.eventBus({ type: "initialized", version: Ke() }), v("info", "Picked client initialized.");
|
|
639
657
|
}
|
|
640
658
|
start() {
|
|
641
|
-
|
|
642
|
-
|
|
659
|
+
Ee(this), (async () => {
|
|
660
|
+
z() && (document.body && await M(this), await te(), await M(this), this.eventBus({ type: "ready" }), this.isReady = !0);
|
|
643
661
|
})();
|
|
644
662
|
}
|
|
645
663
|
registerFramework(e) {
|
|
646
|
-
|
|
664
|
+
be(e, this.frameworks);
|
|
647
665
|
}
|
|
648
666
|
registerComponent(e, s) {
|
|
649
|
-
|
|
667
|
+
T(e, s, this.components);
|
|
650
668
|
}
|
|
651
669
|
registerPlugin(e) {
|
|
652
|
-
|
|
670
|
+
fe(this, e, this.plugins);
|
|
653
671
|
}
|
|
654
672
|
registerFeature(e, s) {
|
|
655
|
-
|
|
673
|
+
De(e, s, this.features);
|
|
656
674
|
}
|
|
657
675
|
registerPredicate(e, s) {
|
|
658
|
-
|
|
676
|
+
je(e, s, this.predicates);
|
|
659
677
|
}
|
|
660
678
|
registerField(e) {
|
|
661
|
-
|
|
679
|
+
Ue(e, this.fields);
|
|
662
680
|
}
|
|
663
681
|
registerExperience(e) {
|
|
664
|
-
e.component &&
|
|
682
|
+
e.component && T(`experience:${e.id}`, e.component, this.components), pe(e, this.experiences);
|
|
665
683
|
}
|
|
666
684
|
getStateSnapshot() {
|
|
667
|
-
return
|
|
685
|
+
return Pe(this);
|
|
668
686
|
}
|
|
669
687
|
async launchExperienceById(e) {
|
|
670
688
|
const s = this.experiences.getById(e).getState();
|
|
@@ -742,11 +760,11 @@ function q(t) {
|
|
|
742
760
|
var e;
|
|
743
761
|
return ((e = t.options) == null ? void 0 : e.some((s) => "condition" in s)) ?? !1;
|
|
744
762
|
}
|
|
745
|
-
function
|
|
763
|
+
function Xe(t) {
|
|
746
764
|
return t.some((e) => e.condition || q(e));
|
|
747
765
|
}
|
|
748
|
-
async function
|
|
749
|
-
return e.length === 0 || !
|
|
766
|
+
async function ct(t, e) {
|
|
767
|
+
return e.length === 0 || !Xe(e) ? e : (await Promise.all(
|
|
750
768
|
e.map(async (o) => {
|
|
751
769
|
if (!(o.condition ? await R(t, o.condition) : !0))
|
|
752
770
|
return null;
|
|
@@ -759,28 +777,29 @@ async function rt(t, e) {
|
|
|
759
777
|
})
|
|
760
778
|
)).filter((o) => o !== null);
|
|
761
779
|
}
|
|
762
|
-
const
|
|
780
|
+
const ut = (t) => {
|
|
763
781
|
const e = new K(t);
|
|
764
|
-
return
|
|
782
|
+
return ae(e), e;
|
|
765
783
|
};
|
|
766
784
|
export {
|
|
767
785
|
K as Picked,
|
|
768
|
-
|
|
769
|
-
|
|
786
|
+
ut as createClient,
|
|
787
|
+
$ as createStorageKey,
|
|
770
788
|
R as evaluateRuleLogic,
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
789
|
+
ct as getStepFields,
|
|
790
|
+
pt as isPickedRoot,
|
|
791
|
+
D as localStore,
|
|
792
|
+
B as sessionStore,
|
|
793
|
+
ft as subscribe,
|
|
794
|
+
yt as supportsCookies,
|
|
795
|
+
ie as supportsCryptoRandomUUID,
|
|
796
|
+
z as supportsDocument,
|
|
797
|
+
ht as supportsHistory,
|
|
798
|
+
St as supportsIntersectionObserver,
|
|
799
|
+
oe as supportsLocalStorage,
|
|
800
|
+
wt as supportsLocation,
|
|
801
|
+
vt as supportsSessionStorage,
|
|
802
|
+
kt as supportsShadowRoot,
|
|
803
|
+
xt as supportsWebComponents,
|
|
785
804
|
ne as supportsWindow
|
|
786
805
|
};
|
|
@@ -1,35 +1,36 @@
|
|
|
1
|
-
import { createEffect as
|
|
2
|
-
import { c, l as
|
|
1
|
+
import { createEffect as r, sample as i } from "effector";
|
|
2
|
+
import { c, l as g, s as S } from "../../../storage-BxBBl9Bw.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: (n) => {
|
|
9
|
+
const o = a === "local" ? g : S, p = r(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), s = o.get(t).boolean();
|
|
15
|
+
e.setOpen(s ?? e.isOpenStore.getState());
|
|
16
16
|
});
|
|
17
17
|
i({
|
|
18
|
-
source:
|
|
19
|
-
filter: (e) => e.type === "experience_initialized",
|
|
18
|
+
source: n.eventBus,
|
|
19
|
+
filter: (e) => e.type === "experience_initialized" && "experienceInstance" in e,
|
|
20
|
+
// @ts-ignore todo
|
|
20
21
|
fn: (e) => e.experienceInstance,
|
|
21
22
|
target: p
|
|
22
23
|
});
|
|
23
|
-
const l =
|
|
24
|
-
const t = c("open-close", "experience", e),
|
|
25
|
-
|
|
26
|
-
}),
|
|
24
|
+
const l = r(async (e) => {
|
|
25
|
+
const t = c("open-close", "experience", e), s = e.isOpenStore.getState();
|
|
26
|
+
o.set(t, s);
|
|
27
|
+
}), x = (e) => i({
|
|
27
28
|
source: e.isOpenStore,
|
|
28
29
|
fn: () => e,
|
|
29
30
|
target: l
|
|
30
31
|
});
|
|
31
|
-
|
|
32
|
-
e.forEach((t) =>
|
|
32
|
+
n.experienceInstances.listStore.watch((e) => {
|
|
33
|
+
e.forEach((t) => x(t));
|
|
33
34
|
});
|
|
34
35
|
}
|
|
35
36
|
});
|
|
@@ -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-BxBBl9Bw.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-BxBBl9Bw.js";
|
|
3
3
|
const a = b("responses", "global"), R = ({
|
|
4
4
|
storage: g = "local"
|
|
5
5
|
} = {}) => ({
|