@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,137 +1,120 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
function
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return r >>> 0;
|
|
1
|
+
import "../../../logger-6z_gb4rA.js";
|
|
2
|
+
import { i as e, t } from "../../../api-DWBcrf98.js";
|
|
3
|
+
//#region src/plugins/dynamic-experiences/hash.ts
|
|
4
|
+
function n(e) {
|
|
5
|
+
let t = 2166136261;
|
|
6
|
+
for (let n = 0; n < e.length; n++) t ^= e.charCodeAt(n), t = Math.imul(t, 16777619);
|
|
7
|
+
return t >>> 0;
|
|
9
8
|
}
|
|
10
|
-
function
|
|
11
|
-
|
|
9
|
+
function r(e) {
|
|
10
|
+
return n(e) % 100;
|
|
12
11
|
}
|
|
13
|
-
function
|
|
14
|
-
|
|
12
|
+
function i(e, t) {
|
|
13
|
+
return t <= 0 ? !1 : t >= 100 ? !0 : e < t;
|
|
15
14
|
}
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/plugins/dynamic-experiences/plugin.ts
|
|
17
|
+
function a(e) {
|
|
18
|
+
return typeof e != "object" || !e || !("id" in e && "name" in e && "enabled" in e && "weight" in e && "version" in e) ? !1 : typeof e.id == "string" && typeof e.name == "string" && typeof e.enabled == "boolean" && typeof e.weight == "number" && typeof e.version == "number";
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
-
|
|
20
|
+
function o(e) {
|
|
21
|
+
return typeof e != "object" || !e || !("features" in e) || !Array.isArray(e.features) ? !1 : e.features.every(a);
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return r[0];
|
|
23
|
+
function s(e) {
|
|
24
|
+
let t = e.searchParams["preview-token"];
|
|
25
|
+
if (t && t.length > 0) return t[0];
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return r;
|
|
27
|
+
function c(e) {
|
|
28
|
+
let t = /* @__PURE__ */ new Set(), n = e.searchParams.feature;
|
|
29
|
+
if (!n) return t;
|
|
30
|
+
for (let e of n) {
|
|
31
|
+
let n = e.indexOf(":");
|
|
32
|
+
n > 0 && t.add(e.substring(0, n));
|
|
33
|
+
}
|
|
34
|
+
return t;
|
|
36
35
|
}
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
for (const s of r.features)
|
|
43
|
-
o.has(s.id) || y(e, s, n, i);
|
|
36
|
+
function l(e, t, n) {
|
|
37
|
+
let i = c(e), a = e.session?.id;
|
|
38
|
+
if (!a) throw Error("Session ID is required for feature registration");
|
|
39
|
+
let o = r(a);
|
|
40
|
+
for (let r of t.features) i.has(r.id) || u(e, r, n, o);
|
|
44
41
|
}
|
|
45
|
-
function
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
function u(e, t, n, r) {
|
|
43
|
+
e.registerFeature(t.id, {
|
|
44
|
+
key: `v${t.version}`,
|
|
45
|
+
name: t.name,
|
|
46
|
+
storage: n ? "session" : "local",
|
|
47
|
+
decide: () => t.enabled ? i(r, t.weight) : !1
|
|
48
|
+
});
|
|
52
49
|
}
|
|
53
|
-
function
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
else
|
|
71
|
-
r = e;
|
|
72
|
-
if (f(r))
|
|
73
|
-
return r;
|
|
74
|
-
a("warn", "Build-time project config has invalid shape, falling back to runtime fetch");
|
|
50
|
+
function d() {
|
|
51
|
+
let e;
|
|
52
|
+
try {
|
|
53
|
+
e = __PICKED_PROJECT_CONFIG__;
|
|
54
|
+
} catch {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (e === void 0) return;
|
|
58
|
+
let t;
|
|
59
|
+
if (typeof e == "string") try {
|
|
60
|
+
t = JSON.parse(e);
|
|
61
|
+
} catch {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
else t = e;
|
|
65
|
+
if (o(t)) return t;
|
|
75
66
|
}
|
|
76
|
-
function
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
67
|
+
function f(e) {
|
|
68
|
+
try {
|
|
69
|
+
let t = new URL(e).hostname;
|
|
70
|
+
return t === "localhost" || t === "127.0.0.1" || t === "::1";
|
|
71
|
+
} catch {
|
|
72
|
+
return !1;
|
|
73
|
+
}
|
|
83
74
|
}
|
|
84
|
-
function
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
return typeof r != "object" || r === null || !("code" in r) ? !1 : r.code === "ECONNREFUSED";
|
|
75
|
+
function p(e) {
|
|
76
|
+
if (typeof e != "object" || !e || !("cause" in e)) return !1;
|
|
77
|
+
let { cause: t } = e;
|
|
78
|
+
return typeof t != "object" || !t || !("code" in t) ? !1 : t.code === "ECONNREFUSED";
|
|
89
79
|
}
|
|
90
|
-
async function
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
return f(i) ? i : (a("warn", "Invalid project config response shape"), null);
|
|
80
|
+
async function m(e, n, r) {
|
|
81
|
+
let i = r?.previewToken ? `projects/${n}?preview_token=${encodeURIComponent(r.previewToken)}` : `projects/${n}`, a;
|
|
82
|
+
try {
|
|
83
|
+
a = await t(e, i, r?.headers);
|
|
84
|
+
} catch (t) {
|
|
85
|
+
return f(e) && p(t), null;
|
|
86
|
+
}
|
|
87
|
+
if (!a.ok) return `${a.status.toString()}`, null;
|
|
88
|
+
let s;
|
|
89
|
+
try {
|
|
90
|
+
s = await a.json();
|
|
91
|
+
} catch {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
return o(s) ? s : null;
|
|
107
95
|
}
|
|
108
|
-
function
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
};
|
|
96
|
+
function h(e) {
|
|
97
|
+
return {
|
|
98
|
+
name: "dynamic-experiences",
|
|
99
|
+
setup: (t) => {
|
|
100
|
+
let n = e?.apiUrl ?? t.apiUrl;
|
|
101
|
+
return { onStart: async () => {
|
|
102
|
+
let r = s(t);
|
|
103
|
+
if (r) {
|
|
104
|
+
let e = await m(n, t.projectId, { previewToken: r });
|
|
105
|
+
e && l(t, e, !0);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
let i = e?.projectConfig ?? d();
|
|
109
|
+
if (i) {
|
|
110
|
+
l(t, i, !1);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
let a = await m(n, t.projectId);
|
|
114
|
+
a && l(t, a, !1);
|
|
115
|
+
} };
|
|
116
|
+
}
|
|
117
|
+
};
|
|
132
118
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
k as dynamicExperiencesPlugin,
|
|
136
|
-
u as fetchProject
|
|
137
|
-
};
|
|
119
|
+
//#endregion
|
|
120
|
+
export { e as createClientHeaders, h as dynamicExperiencesPlugin, m as fetchProject };
|
|
@@ -1,38 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
s.experienceInstances.listStore.watch((e) => {
|
|
32
|
-
e.forEach((t) => x(t));
|
|
33
|
-
});
|
|
34
|
-
}
|
|
1
|
+
import "../../../logger-6z_gb4rA.js";
|
|
2
|
+
import { n as e, r as t, t as n } from "../../../storage-DyxpJ0pg.js";
|
|
3
|
+
import { createEffect as r, sample as i } from "effector";
|
|
4
|
+
//#region src/plugins/experience-browser-storage/plugin.ts
|
|
5
|
+
var a = ({ storage: a = "local" } = {}) => ({
|
|
6
|
+
name: "experience-browser-storage-plugin",
|
|
7
|
+
setup: (o) => {
|
|
8
|
+
let s = a === "local" ? e : t, c = r(async (e) => {
|
|
9
|
+
if (!e) return;
|
|
10
|
+
let t = n("open-close", "experience", e), r = s.get(t).boolean();
|
|
11
|
+
e.setOpen(r ?? e.isOpenStore.getState());
|
|
12
|
+
});
|
|
13
|
+
i({
|
|
14
|
+
source: o.eventBus,
|
|
15
|
+
filter: (e) => e.type === "experience_initialize" && "experience" in e,
|
|
16
|
+
fn: (e) => e.experience,
|
|
17
|
+
target: c
|
|
18
|
+
});
|
|
19
|
+
let l = r(async (e) => {
|
|
20
|
+
let t = n("open-close", "experience", e), r = e.isOpenStore.getState();
|
|
21
|
+
s.set(t, r);
|
|
22
|
+
}), u = (e) => i({
|
|
23
|
+
source: e.isOpenStore,
|
|
24
|
+
fn: () => e,
|
|
25
|
+
target: l
|
|
26
|
+
});
|
|
27
|
+
o.experienceInstances.listStore.watch((e) => {
|
|
28
|
+
e.forEach((e) => u(e));
|
|
29
|
+
});
|
|
30
|
+
}
|
|
35
31
|
});
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { a as experienceBrowserStoragePlugin };
|
|
@@ -1,26 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
1
|
+
import { n as e, r as t, t as n } from "../../../storage-DyxpJ0pg.js";
|
|
2
|
+
import { createEffect as r, sample as i } from "effector";
|
|
3
|
+
//#region src/plugins/history-browser-storage/plugin.ts
|
|
4
|
+
var a = n("history", "global"), o = ({ storage: n = "local" } = {}) => ({
|
|
5
|
+
name: "history-browser-storage-plugin",
|
|
6
|
+
setup: (o) => {
|
|
7
|
+
let s = n === "local" ? e : t, c = r(async () => {
|
|
8
|
+
let e = s.get(a).json();
|
|
9
|
+
e && o.history.restore({ entries: e });
|
|
10
|
+
}), l = r(async (e) => {
|
|
11
|
+
s.set(a, e);
|
|
12
|
+
});
|
|
13
|
+
i({
|
|
14
|
+
source: o.eventBus,
|
|
15
|
+
filter: (e) => e.type === "load",
|
|
16
|
+
target: c
|
|
17
|
+
}), i({
|
|
18
|
+
source: o.history.entriesStore,
|
|
19
|
+
target: l
|
|
20
|
+
});
|
|
21
|
+
}
|
|
23
22
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
23
|
+
//#endregion
|
|
24
|
+
export { o as historyBrowserStoragePlugin };
|
|
@@ -1,40 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
},
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
});
|
|
36
|
-
}
|
|
1
|
+
import { n as e, r as t, t as n } from "../../../storage-DyxpJ0pg.js";
|
|
2
|
+
import { attach as r, createEffect as i, sample as a } from "effector";
|
|
3
|
+
//#region src/plugins/responses-browser-storage/plugin.ts
|
|
4
|
+
var o = n("responses", "global"), s = (e, t) => {
|
|
5
|
+
let n = {};
|
|
6
|
+
return Object.entries(e).forEach(([e, r]) => {
|
|
7
|
+
t.find((t) => t.id === e)?.policies?.doNotStoreValue || (n[e] = r);
|
|
8
|
+
}), n;
|
|
9
|
+
}, c = ({ storage: n = "local" } = {}) => ({
|
|
10
|
+
name: "responses-browser-storage-plugin",
|
|
11
|
+
setup: (c) => {
|
|
12
|
+
let l = n === "local" ? e : t, u = i(async () => {
|
|
13
|
+
let e = l.get(o).json();
|
|
14
|
+
if (!e) return null;
|
|
15
|
+
c.responses.register(e);
|
|
16
|
+
}), d = r({
|
|
17
|
+
source: {
|
|
18
|
+
responses: c.responses.getAllStore,
|
|
19
|
+
fields: c.fields.listStore
|
|
20
|
+
},
|
|
21
|
+
effect: ({ responses: e, fields: t }) => {
|
|
22
|
+
let n = s(e, t);
|
|
23
|
+
l.set(o, n);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
a({
|
|
27
|
+
source: c.eventBus,
|
|
28
|
+
filter: (e) => e.type === "load",
|
|
29
|
+
target: u
|
|
30
|
+
}), a({
|
|
31
|
+
source: c.responses.getAllStore,
|
|
32
|
+
target: d
|
|
33
|
+
});
|
|
34
|
+
}
|
|
37
35
|
});
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
};
|
|
36
|
+
//#endregion
|
|
37
|
+
export { c as responsesBrowserStoragePlugin };
|
|
@@ -1,86 +1,87 @@
|
|
|
1
|
-
import { createEffect as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { createEffect as e, sample as t } from "effector";
|
|
2
|
+
//#region src/utils/indexed-db.ts
|
|
3
|
+
var n = "picked";
|
|
4
|
+
async function r(e) {
|
|
5
|
+
let { storeName: t, version: r = 1, keyPath: i = "id" } = e;
|
|
6
|
+
return new Promise((e, a) => {
|
|
7
|
+
let o = indexedDB.open(n, r);
|
|
8
|
+
o.onupgradeneeded = () => {
|
|
9
|
+
let e = o.result;
|
|
10
|
+
e.objectStoreNames.contains(t) || e.createObjectStore(t, i ? { keyPath: i } : void 0);
|
|
11
|
+
}, o.onsuccess = () => e(o.result), o.onerror = () => a(Error(o.error?.message));
|
|
12
|
+
});
|
|
12
13
|
}
|
|
13
|
-
async function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
async function i(e, t) {
|
|
15
|
+
return new Promise((n, r) => {
|
|
16
|
+
let i = e.transaction(t, "readonly").objectStore(t).getAll();
|
|
17
|
+
i.onsuccess = () => n(i.result), i.onerror = () => r(Error(i.error?.message));
|
|
18
|
+
});
|
|
18
19
|
}
|
|
19
|
-
async function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
async function a(e, t, n) {
|
|
21
|
+
return new Promise((r, i) => {
|
|
22
|
+
let a = e.transaction(t, "readwrite").objectStore(t).put(n);
|
|
23
|
+
a.onsuccess = () => r(), a.onerror = () => i(Error(a.error?.message));
|
|
24
|
+
});
|
|
24
25
|
}
|
|
25
|
-
async function
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
async function o(e, t, n) {
|
|
27
|
+
return new Promise((r, i) => {
|
|
28
|
+
let a = e.transaction(t, "readwrite").objectStore(t).delete(n);
|
|
29
|
+
a.onsuccess = () => r(), a.onerror = () => i(Error(a.error?.message));
|
|
30
|
+
});
|
|
30
31
|
}
|
|
31
|
-
async function
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
async function s(e, t) {
|
|
33
|
+
return new Promise((n, r) => {
|
|
34
|
+
let i = e.transaction(t, "readwrite").objectStore(t).clear();
|
|
35
|
+
i.onsuccess = () => n(), i.onerror = () => r(Error(i.error?.message));
|
|
36
|
+
});
|
|
36
37
|
}
|
|
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
|
-
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/plugins/responses-indexeddb/plugin.ts
|
|
40
|
+
var c = "responses", l = {
|
|
41
|
+
storeName: c,
|
|
42
|
+
keyPath: "fieldId"
|
|
43
|
+
}, u = () => ({
|
|
44
|
+
name: "responses-indexdb-plugin",
|
|
45
|
+
setup: (n) => {
|
|
46
|
+
let u = e(async () => {
|
|
47
|
+
let e = (await i(await r(l), c)).reduce((e, { fieldId: t, value: n }) => (e[t] = n, e), {});
|
|
48
|
+
await n.responses.commit(e);
|
|
49
|
+
}), d = e(async (e) => {
|
|
50
|
+
e.forEach((e) => {
|
|
51
|
+
r(l).then((t) => {
|
|
52
|
+
a(t, c, e);
|
|
53
|
+
}).catch((e) => {
|
|
54
|
+
console.error("Failed to store response in IndexedDB:", e);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
}), f = e(async () => {
|
|
58
|
+
await s(await r(l), c);
|
|
59
|
+
}), p = e(async (e) => {
|
|
60
|
+
await o(await r(l), c, e);
|
|
61
|
+
});
|
|
62
|
+
t({
|
|
63
|
+
source: n.eventBus,
|
|
64
|
+
filter: (e) => e.type === "load",
|
|
65
|
+
target: u
|
|
66
|
+
}), t({
|
|
67
|
+
clock: n.responses.listStore,
|
|
68
|
+
source: {
|
|
69
|
+
responses: n.responses.listStore,
|
|
70
|
+
fields: n.fields.listStore
|
|
71
|
+
},
|
|
72
|
+
fn: ({ responses: e, fields: t }) => {
|
|
73
|
+
let n = t.filter((e) => !e.policies?.doNotStoreValue);
|
|
74
|
+
return e.filter((e) => n.some((t) => t.id === e.fieldId));
|
|
75
|
+
},
|
|
76
|
+
target: d
|
|
77
|
+
}), t({
|
|
78
|
+
clock: n.responses.clearAll,
|
|
79
|
+
target: f
|
|
80
|
+
}), t({
|
|
81
|
+
clock: n.responses.clear,
|
|
82
|
+
target: p
|
|
83
|
+
});
|
|
84
|
+
}
|
|
83
85
|
});
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
};
|
|
86
|
+
//#endregion
|
|
87
|
+
export { u as responsesIndexedDBPlugin };
|