@picked/client 0.0.9 → 0.0.10-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/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 +168 -152
- 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 +5 -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
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { createDomain as
|
|
5
|
-
import { createFactory as k, invoke as
|
|
6
|
-
import { g as
|
|
7
|
-
import { f as
|
|
1
|
+
var G = Object.defineProperty;
|
|
2
|
+
var W = (t, e, s) => e in t ? G(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
|
|
3
|
+
var h = (t, e, s) => W(t, typeof e != "symbol" ? e + "" : e, s);
|
|
4
|
+
import { createDomain as x, createApi as I, createEffect as O, attach as Y, sample as P, combine as A, createEvent as C } from "effector";
|
|
5
|
+
import { createFactory as k, invoke as b } from "@withease/factories";
|
|
6
|
+
import { g as U, t as J, 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 gt } 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 mt } 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 St, j as wt, e as vt, g as kt, i as bt, k as xt } from "../supports-BjhuLJ8z.js";
|
|
15
|
+
const _ = x("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
|
|
47
|
+
function ue(t) {
|
|
48
|
+
return b(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
|
|
78
|
+
function de(t) {
|
|
79
|
+
return b(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
|
-
({ elements: l }) => l.forEach((r) =>
|
|
86
|
+
({ elements: l }) => l.forEach((r) => J(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 = x("component"), he = 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
|
|
115
|
+
function ye(t) {
|
|
116
|
+
return b(he, 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,8 +129,8 @@ 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
|
|
133
|
-
s.register(
|
|
132
|
+
const y = ye({ client: t, name: r, component: n });
|
|
133
|
+
s.register(y);
|
|
134
134
|
}
|
|
135
135
|
const i = e.map((r) => Object.values(r));
|
|
136
136
|
function l(r) {
|
|
@@ -142,13 +142,13 @@ const ye = k(({ client: t }) => {
|
|
|
142
142
|
listStore: i
|
|
143
143
|
};
|
|
144
144
|
});
|
|
145
|
-
function
|
|
146
|
-
return
|
|
145
|
+
function we(t) {
|
|
146
|
+
return b(Se, t);
|
|
147
147
|
}
|
|
148
|
-
const
|
|
148
|
+
const T = (t, e, s) => {
|
|
149
149
|
s.register(t, e);
|
|
150
|
-
},
|
|
151
|
-
const e =
|
|
150
|
+
}, ve = x("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
|
|
175
|
+
function be(t) {
|
|
176
|
+
return b(ke, t);
|
|
177
177
|
}
|
|
178
|
-
const
|
|
178
|
+
const xe = (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 = x("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
|
|
242
|
+
function Be(t) {
|
|
243
|
+
return b($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 = x("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" ?
|
|
290
|
-
}), r = /* @__PURE__ */ new Map(), n =
|
|
288
|
+
const f = $(`feature:${c.id}:${c.key}`, "global");
|
|
289
|
+
(c.storage === "session" ? B : D).set(f, c.bucket);
|
|
290
|
+
}), r = /* @__PURE__ */ new Map(), n = Y({
|
|
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({
|
|
@@ -350,21 +350,21 @@ const Be = (t, e, s) => {
|
|
|
350
350
|
};
|
|
351
351
|
})
|
|
352
352
|
);
|
|
353
|
-
function
|
|
353
|
+
function y(c) {
|
|
354
354
|
return t.map((f) => f[c], { skipVoid: !1 });
|
|
355
355
|
}
|
|
356
356
|
return {
|
|
357
357
|
register: o,
|
|
358
|
-
getByName:
|
|
358
|
+
getByName: y,
|
|
359
359
|
listStore: d
|
|
360
360
|
};
|
|
361
361
|
});
|
|
362
|
-
function
|
|
363
|
-
return
|
|
362
|
+
function Ce() {
|
|
363
|
+
return b(Ae);
|
|
364
364
|
}
|
|
365
|
-
const
|
|
365
|
+
const De = (t, e, s) => {
|
|
366
366
|
s.register(t, e);
|
|
367
|
-
}, E =
|
|
367
|
+
}, E = x("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)]
|
|
@@ -386,23 +386,23 @@ const Ce = k(() => {
|
|
|
386
386
|
})), t.on(i, (r, n) => n);
|
|
387
387
|
function l(r, n) {
|
|
388
388
|
const d = { lastStepIndex: -1, secondLastStepIndex: -1 };
|
|
389
|
-
for (let
|
|
390
|
-
const c = r[
|
|
389
|
+
for (let y = r.length - 1; y >= 0; y--) {
|
|
390
|
+
const c = r[y], f = c == null ? void 0 : c.node;
|
|
391
391
|
if (!(!f || !Z(f)) && !(n && (c == null ? void 0 : c.experienceId) !== n))
|
|
392
392
|
if (d.lastStepIndex === -1)
|
|
393
|
-
d.lastStepIndex =
|
|
393
|
+
d.lastStepIndex = y;
|
|
394
394
|
else {
|
|
395
|
-
d.secondLastStepIndex =
|
|
395
|
+
d.secondLastStepIndex = y;
|
|
396
396
|
break;
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
399
|
return d;
|
|
400
400
|
}
|
|
401
401
|
return t.on(o, (r, n) => {
|
|
402
|
-
const { secondLastStepIndex: d } = l(r.entries, n.experienceId),
|
|
402
|
+
const { secondLastStepIndex: d } = l(r.entries, n.experienceId), y = d !== -1 ? r.entries.slice(0, d + 1) : r.entries;
|
|
403
403
|
return {
|
|
404
404
|
...r,
|
|
405
|
-
entries:
|
|
405
|
+
entries: y
|
|
406
406
|
};
|
|
407
407
|
}), {
|
|
408
408
|
push: e,
|
|
@@ -412,11 +412,11 @@ const Ce = k(() => {
|
|
|
412
412
|
entriesStore: t.map((r) => r.entries)
|
|
413
413
|
};
|
|
414
414
|
});
|
|
415
|
-
function
|
|
416
|
-
return
|
|
415
|
+
function Me() {
|
|
416
|
+
return b(Oe);
|
|
417
417
|
}
|
|
418
|
-
const
|
|
419
|
-
const t =
|
|
418
|
+
const Te = () => C(), Ve = x("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
|
|
444
|
+
function Le() {
|
|
445
|
+
return b(Ne);
|
|
446
446
|
}
|
|
447
|
-
const
|
|
447
|
+
const Ue = (t, e) => {
|
|
448
448
|
e.register(t);
|
|
449
|
-
},
|
|
450
|
-
const e =
|
|
449
|
+
}, ze = x("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(", ")}`,
|
|
@@ -543,7 +543,7 @@ const Ne = (t, e) => {
|
|
|
543
543
|
const { responsesToCommit: p, validationErrors: g } = await r(a);
|
|
544
544
|
return g.length ? { errors: g } : (i.registerBatch(p), { errors: [] });
|
|
545
545
|
}
|
|
546
|
-
const d = e.map((a) => a),
|
|
546
|
+
const d = e.map((a) => a), y = e.map((a) => Object.keys(a).map((g) => ({
|
|
547
547
|
fieldId: g,
|
|
548
548
|
value: a[g]
|
|
549
549
|
})));
|
|
@@ -570,18 +570,18 @@ const Ne = (t, e) => {
|
|
|
570
570
|
clear: o,
|
|
571
571
|
commit: n,
|
|
572
572
|
getResponsesToCommit: r,
|
|
573
|
-
listStore:
|
|
573
|
+
listStore: y,
|
|
574
574
|
getAllStore: d,
|
|
575
575
|
getByFieldId: c,
|
|
576
576
|
getByFieldName: f
|
|
577
577
|
};
|
|
578
578
|
});
|
|
579
|
-
function
|
|
580
|
-
return
|
|
579
|
+
function He(t) {
|
|
580
|
+
return b(_e, t);
|
|
581
581
|
}
|
|
582
|
-
const
|
|
583
|
-
function
|
|
584
|
-
if (
|
|
582
|
+
const Ke = () => "0.0.10-next.2";
|
|
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 Ge() {
|
|
599
599
|
if (!ne())
|
|
600
600
|
return {};
|
|
601
601
|
const t = new URLSearchParams(window.location.search), e = {}, s = /* @__PURE__ */ new Set();
|
|
@@ -605,66 +605,81 @@ 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 We() {
|
|
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 Ye = () => ({
|
|
625
|
+
id: We()
|
|
626
|
+
}), Je = $("session", "global"), Qe = () => {
|
|
627
|
+
if (!oe()) return null;
|
|
628
|
+
const t = D.get(Je);
|
|
629
|
+
let e = t.isSet() ? t.json() : null;
|
|
630
|
+
return e || (e = Ye(), t.set(e)), e;
|
|
631
|
+
}, Xe = () => Qe();
|
|
618
632
|
class K {
|
|
619
633
|
constructor(e) {
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
634
|
+
h(this, "options");
|
|
635
|
+
h(this, "isReady", !1);
|
|
636
|
+
h(this, "project");
|
|
637
|
+
h(this, "plugins", {});
|
|
638
|
+
h(this, "eventBus", Te());
|
|
639
|
+
h(this, "organizationId");
|
|
640
|
+
h(this, "projectId");
|
|
641
|
+
h(this, "apiUrl");
|
|
642
|
+
h(this, "session");
|
|
643
|
+
h(this, "searchParams", Ge());
|
|
644
|
+
h(this, "history", Me());
|
|
645
|
+
h(this, "components", we({ client: this }));
|
|
646
|
+
h(this, "experienceInstances", ee({ client: this }));
|
|
647
|
+
h(this, "experiences", de({ client: this }));
|
|
648
|
+
h(this, "frameworks", be({ client: this }));
|
|
649
|
+
h(this, "predicates", Be({ client: this }));
|
|
650
|
+
h(this, "features", Ce());
|
|
651
|
+
h(this, "responses", He({ client: this }));
|
|
652
|
+
h(this, "fields", Le());
|
|
653
|
+
v("info", "Picked client initializing."), this.organizationId = e.organizationId, this.projectId = e.projectId, this.options = Object.freeze(e), this.apiUrl = e.apiUrl || qe(), this.session = Xe(), this.setupPlugins(), this.setupFeatures(), this.setupPredicates(), this.eventBus({ type: "initialized", version: Ke() }), v("info", "Picked client initialized.");
|
|
639
654
|
}
|
|
640
655
|
start() {
|
|
641
|
-
|
|
642
|
-
|
|
656
|
+
Ee(this), (async () => {
|
|
657
|
+
z() && (document.body && M(this), await te(), await M(this), this.eventBus({ type: "ready" }), this.isReady = !0, this.session && this.eventBus({ type: "session", ...this.session }));
|
|
643
658
|
})();
|
|
644
659
|
}
|
|
645
660
|
registerFramework(e) {
|
|
646
|
-
|
|
661
|
+
xe(e, this.frameworks);
|
|
647
662
|
}
|
|
648
663
|
registerComponent(e, s) {
|
|
649
|
-
|
|
664
|
+
T(e, s, this.components);
|
|
650
665
|
}
|
|
651
666
|
registerPlugin(e) {
|
|
652
|
-
|
|
667
|
+
fe(this, e, this.plugins);
|
|
653
668
|
}
|
|
654
669
|
registerFeature(e, s) {
|
|
655
|
-
|
|
670
|
+
De(e, s, this.features);
|
|
656
671
|
}
|
|
657
672
|
registerPredicate(e, s) {
|
|
658
|
-
|
|
673
|
+
je(e, s, this.predicates);
|
|
659
674
|
}
|
|
660
675
|
registerField(e) {
|
|
661
|
-
|
|
676
|
+
Ue(e, this.fields);
|
|
662
677
|
}
|
|
663
678
|
registerExperience(e) {
|
|
664
|
-
e.component &&
|
|
679
|
+
e.component && T(`experience:${e.id}`, e.component, this.components), pe(e, this.experiences);
|
|
665
680
|
}
|
|
666
681
|
getStateSnapshot() {
|
|
667
|
-
return
|
|
682
|
+
return Pe(this);
|
|
668
683
|
}
|
|
669
684
|
async launchExperienceById(e) {
|
|
670
685
|
const s = this.experiences.getById(e).getState();
|
|
@@ -737,16 +752,16 @@ class K {
|
|
|
737
752
|
return this.plugins[e] ?? {};
|
|
738
753
|
}
|
|
739
754
|
}
|
|
740
|
-
|
|
755
|
+
h(K, "logger", v);
|
|
741
756
|
function q(t) {
|
|
742
757
|
var e;
|
|
743
758
|
return ((e = t.options) == null ? void 0 : e.some((s) => "condition" in s)) ?? !1;
|
|
744
759
|
}
|
|
745
|
-
function
|
|
760
|
+
function Ze(t) {
|
|
746
761
|
return t.some((e) => e.condition || q(e));
|
|
747
762
|
}
|
|
748
|
-
async function
|
|
749
|
-
return e.length === 0 || !
|
|
763
|
+
async function ut(t, e) {
|
|
764
|
+
return e.length === 0 || !Ze(e) ? e : (await Promise.all(
|
|
750
765
|
e.map(async (o) => {
|
|
751
766
|
if (!(o.condition ? await R(t, o.condition) : !0))
|
|
752
767
|
return null;
|
|
@@ -759,28 +774,29 @@ async function rt(t, e) {
|
|
|
759
774
|
})
|
|
760
775
|
)).filter((o) => o !== null);
|
|
761
776
|
}
|
|
762
|
-
const
|
|
777
|
+
const lt = (t) => {
|
|
763
778
|
const e = new K(t);
|
|
764
|
-
return
|
|
779
|
+
return ae(e), e;
|
|
765
780
|
};
|
|
766
781
|
export {
|
|
767
782
|
K as Picked,
|
|
768
|
-
|
|
769
|
-
|
|
783
|
+
lt as createClient,
|
|
784
|
+
$ as createStorageKey,
|
|
770
785
|
R as evaluateRuleLogic,
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
786
|
+
ut as getStepFields,
|
|
787
|
+
gt as isPickedRoot,
|
|
788
|
+
D as localStore,
|
|
789
|
+
B as sessionStore,
|
|
790
|
+
mt as subscribe,
|
|
791
|
+
yt as supportsCookies,
|
|
792
|
+
ie as supportsCryptoRandomUUID,
|
|
793
|
+
z as supportsDocument,
|
|
794
|
+
St as supportsHistory,
|
|
795
|
+
wt as supportsIntersectionObserver,
|
|
796
|
+
oe as supportsLocalStorage,
|
|
797
|
+
vt as supportsLocation,
|
|
798
|
+
kt as supportsSessionStorage,
|
|
799
|
+
bt as supportsShadowRoot,
|
|
800
|
+
xt as supportsWebComponents,
|
|
785
801
|
ne as supportsWindow
|
|
786
802
|
};
|
|
@@ -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
|
} = {}) => ({
|