@picked/client 0.0.50-next.3 → 0.0.50
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/api-BwTaomem.cjs +1 -0
- package/dist/api-DWBcrf98.js +37 -0
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/plugins/create-experience/index.js +1 -1
- package/dist/cjs/plugins/dynamic-experiences/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/responses-indexeddb/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 +1126 -1220
- package/dist/esm/plugins/create-experience/index.js +461 -468
- package/dist/esm/plugins/dynamic-experiences/index.js +106 -123
- package/dist/esm/plugins/experience-browser-storage/index.js +32 -37
- package/dist/esm/plugins/history-browser-storage/index.js +23 -25
- package/dist/esm/plugins/responses-browser-storage/index.js +36 -39
- package/dist/esm/plugins/responses-indexeddb/index.js +81 -80
- package/dist/esm/plugins/single-page-app/index.js +31 -35
- package/dist/esm/plugins/web-components/index.js +18 -20
- package/dist/esm/plugins/window-object/index.js +9 -9
- package/dist/esm/server/index.js +95 -89
- package/dist/experience-instance-BRpI9I4s.js +710 -0
- package/dist/experience-instance-BUTnwbSJ.cjs +1 -0
- package/dist/id-BniPxOdF.js +4 -0
- package/dist/id-CIbS4P60.cjs +1 -0
- package/dist/logger-6z_gb4rA.js +4 -0
- package/dist/logger-fbvQC40v.cjs +1 -0
- package/dist/object-BReQiaSS.cjs +1 -0
- package/dist/object-Clj5zVr1.js +24 -0
- package/dist/storage-BFjb8azI.cjs +1 -0
- package/dist/storage-DyxpJ0pg.js +101 -0
- package/dist/supports-0XIfd4-R.js +85 -0
- package/dist/supports-Dsjg-82e.cjs +1 -0
- package/package.json +5 -5
- package/dist/api-4mY9vhi4.cjs +0 -1
- package/dist/api-D1FqIUly.js +0 -32
- package/dist/experience-instance-BsXG5XJ4.cjs +0 -1
- package/dist/experience-instance-fvSEb72i.js +0 -819
- package/dist/id-BKIWbSTy.cjs +0 -1
- package/dist/id-BW-g3y32.js +0 -6
- package/dist/logger-BsmHUUw1.cjs +0 -1
- package/dist/logger-C9a75KZn.js +0 -5
- package/dist/object-BbFTsGh3.cjs +0 -1
- package/dist/object-JwZ58NOH.js +0 -28
- package/dist/storage-Be5xWNPC.cjs +0 -1
- package/dist/storage-Co_LbKr_.js +0 -239
- package/dist/supports-8YT4QKI7.js +0 -95
- package/dist/supports-YvpQZxbh.cjs +0 -1
|
@@ -1,37 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
1
|
+
import { n as e } from "../../../object-Clj5zVr1.js";
|
|
2
|
+
import { d as t, f as n, i as r } from "../../../supports-0XIfd4-R.js";
|
|
3
|
+
//#region src/plugins/single-page-app/plugin.ts
|
|
4
|
+
var i = n, a, o = (e) => ({
|
|
5
|
+
name: "single-page-app",
|
|
6
|
+
setup: (n) => {
|
|
7
|
+
e.instrumentHistory && t() && s(() => {
|
|
8
|
+
requestAnimationFrame(() => {
|
|
9
|
+
n.start();
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
}
|
|
14
13
|
});
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
a(o.history, "pushState", n), a(o.history, "replaceState", n);
|
|
14
|
+
function s(t) {
|
|
15
|
+
if (i.addEventListener("popstate", () => {
|
|
16
|
+
let e = i.location.href, n = a;
|
|
17
|
+
a = e, n !== e && t();
|
|
18
|
+
}), !r()) return;
|
|
19
|
+
function n(e) {
|
|
20
|
+
return function(...n) {
|
|
21
|
+
let r = n.length > 2 ? n[2] : void 0;
|
|
22
|
+
if (r) {
|
|
23
|
+
let i = a, o = String(r);
|
|
24
|
+
if (a = o, i === o) return e.apply(this, n);
|
|
25
|
+
t();
|
|
26
|
+
}
|
|
27
|
+
return e.apply(this, n);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
e(i.history, "pushState", n), e(i.history, "replaceState", n);
|
|
34
31
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { o as singlePageAppPlugin };
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
1
|
+
import { d as e, u as t } from "../../../supports-0XIfd4-R.js";
|
|
2
|
+
//#region src/plugins/web-components/plugin.ts
|
|
3
|
+
var n = () => ({
|
|
4
|
+
name: "web-components",
|
|
5
|
+
setup: (n) => {
|
|
6
|
+
if (!e() || !t()) return;
|
|
7
|
+
let r = "picked-root";
|
|
8
|
+
if (window.customElements.get(r)) return;
|
|
9
|
+
class i extends HTMLElement {
|
|
10
|
+
connectedCallback() {
|
|
11
|
+
let e = this.getAttribute("experience-id");
|
|
12
|
+
n.isReady && e && n.experiences.launch({ id: e });
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
window.customElements.define(r, i);
|
|
16
|
+
}
|
|
18
17
|
});
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { n as webComponentsPlugin };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { d as e } from "../../../supports-0XIfd4-R.js";
|
|
2
|
+
//#region src/plugins/window-object/plugin.ts
|
|
3
|
+
var t = () => ({
|
|
4
|
+
name: "window",
|
|
5
|
+
setup: (t) => {
|
|
6
|
+
e() && (window.Picked = t);
|
|
7
|
+
}
|
|
7
8
|
});
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { t as windowObjectPlugin };
|
package/dist/esm/server/index.js
CHANGED
|
@@ -1,91 +1,97 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { t as e } from "../../experience-instance-BRpI9I4s.js";
|
|
2
|
+
import { attach as t, createEffect as n, createEvent as r, createStore as i, sample as a } from "effector";
|
|
3
|
+
//#region src/server/index.ts
|
|
4
|
+
function o() {
|
|
5
|
+
let e, t;
|
|
6
|
+
return {
|
|
7
|
+
promise: new Promise((n, r) => {
|
|
8
|
+
e = n, t = r;
|
|
9
|
+
}),
|
|
10
|
+
resolve: (t) => e(t),
|
|
11
|
+
reject: (e) => t(e)
|
|
12
|
+
};
|
|
12
13
|
}
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
14
|
+
function s(s, c) {
|
|
15
|
+
let { promise: l, resolve: u } = o(), d = r(), f = r(), p = r(), m = r(), h = r(), g = s.experiences.listStore.map((t) => t.map((t) => e({
|
|
16
|
+
client: s,
|
|
17
|
+
experience: t
|
|
18
|
+
}))), _ = i({
|
|
19
|
+
currentExperienceIndex: 0,
|
|
20
|
+
renderedExperiences: [],
|
|
21
|
+
isComplete: !1
|
|
22
|
+
}), v = n(async ({ experience: e, availableRenderers: t, startRendererIndex: n = 0 }) => {
|
|
23
|
+
if (!e) return null;
|
|
24
|
+
for (let r = n; r < t.length; r++) {
|
|
25
|
+
let n = t[r], i = e.componentStore.getState();
|
|
26
|
+
if (i && n?.isValidComponent(i.component)) return {
|
|
27
|
+
rendered: await n.render(i.component, s, e),
|
|
28
|
+
rendererIndex: r
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
});
|
|
33
|
+
return _.on(p, (e, t) => ({
|
|
34
|
+
...e,
|
|
35
|
+
renderedExperiences: [...e.renderedExperiences, t],
|
|
36
|
+
currentExperienceIndex: e.currentExperienceIndex + 1
|
|
37
|
+
})).on(h, (e) => ({
|
|
38
|
+
...e,
|
|
39
|
+
currentExperienceIndex: e.currentExperienceIndex + 1
|
|
40
|
+
})).on(m, (e) => ({
|
|
41
|
+
...e,
|
|
42
|
+
isComplete: !0
|
|
43
|
+
})).reset(d), a({
|
|
44
|
+
clock: d,
|
|
45
|
+
target: f
|
|
46
|
+
}), a({
|
|
47
|
+
clock: f,
|
|
48
|
+
source: {
|
|
49
|
+
experiences: g,
|
|
50
|
+
state: _
|
|
51
|
+
},
|
|
52
|
+
filter: ({ experiences: e, state: t }) => t.currentExperienceIndex < e.length && !t.isComplete,
|
|
53
|
+
fn: ({ experiences: e, state: t }) => ({
|
|
54
|
+
experience: e[t.currentExperienceIndex],
|
|
55
|
+
availableRenderers: c,
|
|
56
|
+
startRendererIndex: 0
|
|
57
|
+
}),
|
|
58
|
+
target: v
|
|
59
|
+
}), a({
|
|
60
|
+
clock: v.doneData,
|
|
61
|
+
filter: (e) => e !== null,
|
|
62
|
+
fn: (e) => e.rendered.body,
|
|
63
|
+
target: p
|
|
64
|
+
}), a({
|
|
65
|
+
clock: p,
|
|
66
|
+
target: f
|
|
67
|
+
}), a({
|
|
68
|
+
clock: v.doneData,
|
|
69
|
+
filter: (e) => e === null,
|
|
70
|
+
target: h
|
|
71
|
+
}), a({
|
|
72
|
+
clock: h,
|
|
73
|
+
target: f
|
|
74
|
+
}), a({
|
|
75
|
+
clock: [
|
|
76
|
+
f,
|
|
77
|
+
h,
|
|
78
|
+
p
|
|
79
|
+
],
|
|
80
|
+
source: {
|
|
81
|
+
experiences: g,
|
|
82
|
+
state: _
|
|
83
|
+
},
|
|
84
|
+
filter: ({ experiences: e, state: t }) => t.currentExperienceIndex >= e.length,
|
|
85
|
+
target: m
|
|
86
|
+
}), a({
|
|
87
|
+
clock: m,
|
|
88
|
+
target: t({
|
|
89
|
+
source: _,
|
|
90
|
+
effect: (e) => {
|
|
91
|
+
e.isComplete && u(e.renderedExperiences);
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
}), d(), l;
|
|
88
95
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
};
|
|
96
|
+
//#endregion
|
|
97
|
+
export { s as render };
|