@picked/client 0.0.1-dev.1773807602703 → 0.0.1-dev.1773878362211
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-GlH9T8_1.js → api-4YC7Dkcf.js} +1 -1
- package/dist/{api-GvmToTw0.cjs → api-dQTozK5u.cjs} +1 -1
- package/dist/cjs/form/index.js +1 -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/server/index.js +1 -1
- package/dist/esm/form/index.js +393 -0
- package/dist/esm/index.js +684 -771
- package/dist/esm/plugins/create-experience/index.js +284 -360
- package/dist/esm/plugins/dynamic-experiences/index.js +78 -145
- package/dist/esm/plugins/experience-browser-storage/index.js +1 -1
- 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/responses-indexeddb/index.js +51 -46
- package/dist/esm/plugins/single-page-app/index.js +24 -24
- package/dist/esm/server/index.js +1 -1
- package/dist/experience-instance-Bd4kkjE6.js +559 -0
- package/dist/experience-instance-UAZPiG2b.cjs +1 -0
- package/dist/{object-JwZ58NOH.js → object-CJssU1Pm.js} +1 -1
- package/dist/object-mwaxtjLG.cjs +1 -0
- package/dist/rules-logic-CZfip-Wl.js +265 -0
- package/dist/rules-logic-Cgia6n5p.cjs +1 -0
- package/dist/storage-58NoTSsc.cjs +1 -0
- package/dist/{storage-Co_LbKr_.js → storage-B2d81EOI.js} +35 -30
- package/dist/types/entities/action/action.d.ts.map +1 -1
- package/dist/types/entities/experience/experience.d.ts +31 -48
- package/dist/types/entities/experience/experience.d.ts.map +1 -1
- package/dist/types/entities/experience-instance/experience-instance.d.ts +2 -2
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/entities/feature/feature.d.ts.map +1 -1
- package/dist/types/entities/field/field.d.ts +12 -17
- package/dist/types/entities/field/field.d.ts.map +1 -1
- package/dist/types/entities/history/history.d.ts.map +1 -1
- package/dist/types/entities/project/project.d.ts.map +1 -1
- package/dist/types/entities/response/response.d.ts +7 -9
- package/dist/types/entities/response/response.d.ts.map +1 -1
- package/dist/types/form/build-responses.d.ts +14 -0
- package/dist/types/form/build-responses.d.ts.map +1 -0
- package/dist/types/form/create-field-evaluator.d.ts +19 -0
- package/dist/types/form/create-field-evaluator.d.ts.map +1 -0
- package/dist/types/form/create-field-validation.d.ts +44 -0
- package/dist/types/form/create-field-validation.d.ts.map +1 -0
- package/dist/types/form/create-form.d.ts +56 -0
- package/dist/types/form/create-form.d.ts.map +1 -0
- package/dist/types/form/create-submit-pipeline.d.ts +58 -0
- package/dist/types/form/create-submit-pipeline.d.ts.map +1 -0
- package/dist/types/form/get-step-fields.d.ts +5 -0
- package/dist/types/form/get-step-fields.d.ts.map +1 -0
- package/dist/types/form/index.d.ts +10 -0
- package/dist/types/form/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/logic-engine.d.ts +2 -8
- package/dist/types/logic-engine.d.ts.map +1 -1
- package/dist/types/picked.d.ts +23 -41
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts +41 -70
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/index.d.ts +1 -1
- package/dist/types/plugins/create-experience/index.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/plugin.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts +5 -20
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/types.d.ts +0 -46
- package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -1
- package/dist/types/plugins/experience-browser-storage/plugin.d.ts +2 -1
- package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/plugins/history-browser-storage/plugin.d.ts +2 -1
- package/dist/types/plugins/history-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/plugins/responses-browser-storage/plugin.d.ts +2 -1
- package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/plugins/responses-indexeddb/plugin.d.ts.map +1 -1
- package/dist/types/plugins/single-page-app/plugin.d.ts +1 -1
- package/dist/types/plugins/single-page-app/plugin.d.ts.map +1 -1
- package/dist/types/utils/dom.d.ts +0 -3
- package/dist/types/utils/dom.d.ts.map +1 -1
- package/dist/types/utils/events.d.ts +2 -2
- package/dist/types/utils/events.d.ts.map +1 -1
- package/dist/types/utils/global-obj.d.ts +0 -1
- package/dist/types/utils/global-obj.d.ts.map +1 -1
- package/dist/types/utils/indexed-db.d.ts +2 -1
- package/dist/types/utils/indexed-db.d.ts.map +1 -1
- package/dist/types/utils/logger.d.ts.map +1 -1
- package/dist/types/utils/node-tree/min-max-steps-to-leaf.d.ts.map +1 -1
- package/dist/types/utils/node-tree/min-max-steps-to-origin.d.ts.map +1 -1
- package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts +3 -3
- package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts.map +1 -1
- package/dist/types/utils/nodes.d.ts +2 -7
- package/dist/types/utils/nodes.d.ts.map +1 -1
- package/dist/types/utils/object.d.ts +0 -8
- package/dist/types/utils/object.d.ts.map +1 -1
- package/dist/types/utils/picked-config.d.ts +1 -1
- package/dist/types/utils/picked-config.d.ts.map +1 -1
- package/dist/types/utils/search-params.d.ts.map +1 -1
- package/dist/types/utils/storage.d.ts.map +1 -1
- package/package.json +27 -3
- package/dist/experience-instance-CxiOyYPf.cjs +0 -1
- package/dist/experience-instance-DCknHRkX.js +0 -804
- package/dist/nodes-DQt4TfuO.js +0 -26
- package/dist/nodes-DsL8kMSX.cjs +0 -1
- package/dist/object-BbFTsGh3.cjs +0 -1
- package/dist/storage-Be5xWNPC.cjs +0 -1
- package/dist/types/entities/condition/condition.d.ts +0 -17
- package/dist/types/entities/condition/condition.d.ts.map +0 -1
- package/dist/types/entities/step/step.d.ts +0 -20
- package/dist/types/entities/step/step.d.ts.map +0 -1
- package/dist/types/utils/key.d.ts +0 -12
- package/dist/types/utils/key.d.ts.map +0 -1
|
@@ -1,204 +1,137 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { c as
|
|
1
|
+
import { a as l } from "../../../api-4YC7Dkcf.js";
|
|
2
|
+
import { c as S } from "../../../api-4YC7Dkcf.js";
|
|
3
3
|
import { l as a } from "../../../logger-C9a75KZn.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
let
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return e >>> 0;
|
|
4
|
+
function d(e) {
|
|
5
|
+
let r = 2166136261;
|
|
6
|
+
for (let n = 0; n < e.length; n++)
|
|
7
|
+
r ^= e.charCodeAt(n), r = Math.imul(r, 16777619);
|
|
8
|
+
return r >>> 0;
|
|
10
9
|
}
|
|
11
|
-
function
|
|
12
|
-
return
|
|
10
|
+
function p(e) {
|
|
11
|
+
return d(e) % 100;
|
|
13
12
|
}
|
|
14
|
-
function
|
|
15
|
-
return
|
|
13
|
+
function g(e, r) {
|
|
14
|
+
return r <= 0 ? !1 : r >= 100 ? !0 : e < r;
|
|
16
15
|
}
|
|
17
|
-
function
|
|
18
|
-
return typeof
|
|
16
|
+
function h(e) {
|
|
17
|
+
return typeof e != "object" || e === null || !("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";
|
|
19
18
|
}
|
|
20
|
-
function
|
|
21
|
-
return typeof
|
|
19
|
+
function f(e) {
|
|
20
|
+
return typeof e != "object" || e === null || !("features" in e) || !Array.isArray(e.features) ? !1 : e.features.every(h);
|
|
22
21
|
}
|
|
23
|
-
function
|
|
24
|
-
|
|
22
|
+
function m(e) {
|
|
23
|
+
const r = e.searchParams["preview-token"];
|
|
24
|
+
if (r && r.length > 0)
|
|
25
|
+
return r[0];
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
-
const
|
|
27
|
+
function w(e) {
|
|
28
|
+
const r = /* @__PURE__ */ new Set(), n = e.searchParams.feature;
|
|
29
|
+
if (!n)
|
|
30
|
+
return r;
|
|
28
31
|
for (const o of n) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const i = o.conditionId ?? o.conditionalId;
|
|
32
|
-
if (!i || t.has(i))
|
|
33
|
-
continue;
|
|
34
|
-
t.add(i);
|
|
35
|
-
const s = e.get(i);
|
|
36
|
-
if (!s) {
|
|
37
|
-
a("warn", `Condition with id '${i}' not found in project conditions`);
|
|
38
|
-
continue;
|
|
39
|
-
}
|
|
40
|
-
r.push({ id: s.id, label: s.name, condition: s.condition });
|
|
32
|
+
const t = o.indexOf(":");
|
|
33
|
+
t > 0 && r.add(o.substring(0, t));
|
|
41
34
|
}
|
|
42
35
|
return r;
|
|
43
36
|
}
|
|
44
|
-
function c(
|
|
45
|
-
|
|
46
|
-
for (const t of e.conditions)
|
|
47
|
-
n.registerCondition(t);
|
|
48
|
-
}
|
|
49
|
-
function b(n, e, t) {
|
|
50
|
-
if (!C(e)) {
|
|
51
|
-
a("warn", `Skipping invalid experience payload: ${JSON.stringify(e)}`);
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
const r = e.componentName ? n.components.listStore.getState().find((o) => o.name === e.componentName)?.component : void 0;
|
|
55
|
-
n.registerExperience({
|
|
56
|
-
id: e.id,
|
|
57
|
-
key: e.key,
|
|
58
|
-
name: e.name,
|
|
59
|
-
targets: e.targets ?? [],
|
|
60
|
-
steps: e.nodes.filter((o) => o.type === "step").map((o) => y(o)),
|
|
61
|
-
nodes: e.nodes,
|
|
62
|
-
edges: e.edges,
|
|
63
|
-
conditions: S(e.nodes, t),
|
|
64
|
-
actions: e.actions,
|
|
65
|
-
condition: e.condition,
|
|
66
|
-
initializeOpen: e.initializeOpen,
|
|
67
|
-
component: r
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
function f(n, e) {
|
|
71
|
-
if (e.fields)
|
|
72
|
-
for (const t of e.fields)
|
|
73
|
-
n.registerField(t);
|
|
74
|
-
}
|
|
75
|
-
function u(n, e) {
|
|
76
|
-
if (e.steps)
|
|
77
|
-
for (const t of e.steps)
|
|
78
|
-
n.registerStep(t);
|
|
79
|
-
}
|
|
80
|
-
function d(n, e) {
|
|
81
|
-
const t = /* @__PURE__ */ new Map();
|
|
82
|
-
if (e.conditions)
|
|
83
|
-
for (const r of e.conditions)
|
|
84
|
-
t.set(r.id, r);
|
|
85
|
-
if (e.experiences)
|
|
86
|
-
for (const r of e.experiences)
|
|
87
|
-
b(n, r, t);
|
|
88
|
-
}
|
|
89
|
-
function k(n) {
|
|
90
|
-
const e = n.searchParams["preview-token"];
|
|
91
|
-
if (e && e.length > 0)
|
|
92
|
-
return e[0];
|
|
93
|
-
}
|
|
94
|
-
function I(n) {
|
|
95
|
-
const e = /* @__PURE__ */ new Set(), t = n.searchParams.feature;
|
|
37
|
+
function c(e, r, n) {
|
|
38
|
+
const o = w(e), t = e.session?.id;
|
|
96
39
|
if (!t)
|
|
97
|
-
return e;
|
|
98
|
-
for (const r of t) {
|
|
99
|
-
const o = r.indexOf(":");
|
|
100
|
-
o > 0 && e.add(r.substring(0, o));
|
|
101
|
-
}
|
|
102
|
-
return e;
|
|
103
|
-
}
|
|
104
|
-
function l(n, e, t) {
|
|
105
|
-
const r = I(n), o = n.session?.id;
|
|
106
|
-
if (!o)
|
|
107
40
|
throw new Error("Session ID is required for feature registration");
|
|
108
|
-
const i =
|
|
109
|
-
for (const s of
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
function
|
|
113
|
-
|
|
114
|
-
key: `v${
|
|
115
|
-
name:
|
|
116
|
-
storage:
|
|
117
|
-
decide: () =>
|
|
41
|
+
const i = p(t);
|
|
42
|
+
for (const s of r.features)
|
|
43
|
+
o.has(s.id) || y(e, s, n, i);
|
|
44
|
+
}
|
|
45
|
+
function y(e, r, n, o) {
|
|
46
|
+
e.registerFeature(r.id, {
|
|
47
|
+
key: `v${r.version}`,
|
|
48
|
+
name: r.name,
|
|
49
|
+
storage: n ? "session" : "local",
|
|
50
|
+
decide: () => r.enabled ? g(o, r.weight) : !1
|
|
118
51
|
});
|
|
119
52
|
}
|
|
120
|
-
function
|
|
121
|
-
let
|
|
53
|
+
function v() {
|
|
54
|
+
let e;
|
|
122
55
|
try {
|
|
123
|
-
|
|
56
|
+
e = __PICKED_PROJECT_CONFIG__;
|
|
124
57
|
} catch {
|
|
125
58
|
return;
|
|
126
59
|
}
|
|
127
|
-
if (
|
|
60
|
+
if (e === void 0)
|
|
128
61
|
return;
|
|
129
|
-
let
|
|
130
|
-
if (typeof
|
|
62
|
+
let r;
|
|
63
|
+
if (typeof e == "string")
|
|
131
64
|
try {
|
|
132
|
-
|
|
65
|
+
r = JSON.parse(e);
|
|
133
66
|
} catch {
|
|
134
67
|
a("warn", "Build-time project config is not valid JSON");
|
|
135
68
|
return;
|
|
136
69
|
}
|
|
137
70
|
else
|
|
138
|
-
|
|
139
|
-
if (
|
|
140
|
-
return
|
|
71
|
+
r = e;
|
|
72
|
+
if (f(r))
|
|
73
|
+
return r;
|
|
141
74
|
a("warn", "Build-time project config has invalid shape, falling back to runtime fetch");
|
|
142
75
|
}
|
|
143
|
-
function
|
|
76
|
+
function j(e) {
|
|
144
77
|
try {
|
|
145
|
-
const
|
|
146
|
-
return
|
|
78
|
+
const r = new URL(e).hostname;
|
|
79
|
+
return r === "localhost" || r === "127.0.0.1" || r === "::1";
|
|
147
80
|
} catch {
|
|
148
81
|
return !1;
|
|
149
82
|
}
|
|
150
83
|
}
|
|
151
|
-
function
|
|
152
|
-
if (typeof
|
|
84
|
+
function b(e) {
|
|
85
|
+
if (typeof e != "object" || e === null || !("cause" in e))
|
|
153
86
|
return !1;
|
|
154
|
-
const { cause:
|
|
155
|
-
return typeof
|
|
87
|
+
const { cause: r } = e;
|
|
88
|
+
return typeof r != "object" || r === null || !("code" in r) ? !1 : r.code === "ECONNREFUSED";
|
|
156
89
|
}
|
|
157
|
-
async function
|
|
158
|
-
const
|
|
159
|
-
let
|
|
90
|
+
async function u(e, r, n) {
|
|
91
|
+
const o = n?.previewToken ? `projects/${r}?preview_token=${encodeURIComponent(n.previewToken)}` : `projects/${r}`;
|
|
92
|
+
let t;
|
|
160
93
|
try {
|
|
161
|
-
|
|
94
|
+
t = await l(e, o, n?.headers);
|
|
162
95
|
} catch (s) {
|
|
163
|
-
return
|
|
96
|
+
return j(e) && b(s) || a("warn", "Failed to fetch project config", s), null;
|
|
164
97
|
}
|
|
165
|
-
if (!
|
|
166
|
-
return a("warn", `Project config request failed with status ${
|
|
98
|
+
if (!t.ok)
|
|
99
|
+
return a("warn", `Project config request failed with status ${t.status.toString()}`), null;
|
|
167
100
|
let i;
|
|
168
101
|
try {
|
|
169
|
-
i = await
|
|
102
|
+
i = await t.json();
|
|
170
103
|
} catch {
|
|
171
104
|
return a("warn", "Failed to parse project config response"), null;
|
|
172
105
|
}
|
|
173
|
-
return
|
|
106
|
+
return f(i) ? i : (a("warn", "Invalid project config response shape"), null);
|
|
174
107
|
}
|
|
175
|
-
function
|
|
108
|
+
function k(e) {
|
|
176
109
|
return {
|
|
177
110
|
name: "dynamic-experiences",
|
|
178
|
-
setup: (
|
|
179
|
-
const
|
|
111
|
+
setup: (r) => {
|
|
112
|
+
const n = e?.apiUrl ?? r.apiUrl;
|
|
180
113
|
return {
|
|
181
114
|
onStart: async () => {
|
|
182
|
-
const
|
|
183
|
-
if (
|
|
184
|
-
const s = await
|
|
185
|
-
s && (
|
|
115
|
+
const o = m(r);
|
|
116
|
+
if (o) {
|
|
117
|
+
const s = await u(n, r.projectId, { previewToken: o });
|
|
118
|
+
s && c(r, s, !0);
|
|
186
119
|
return;
|
|
187
120
|
}
|
|
188
|
-
const
|
|
189
|
-
if (
|
|
190
|
-
|
|
121
|
+
const t = e?.projectConfig ?? v();
|
|
122
|
+
if (t) {
|
|
123
|
+
c(r, t, !1);
|
|
191
124
|
return;
|
|
192
125
|
}
|
|
193
|
-
const i = await
|
|
194
|
-
i && (
|
|
126
|
+
const i = await u(n, r.projectId);
|
|
127
|
+
i && c(r, i, !1);
|
|
195
128
|
}
|
|
196
129
|
};
|
|
197
130
|
}
|
|
198
131
|
};
|
|
199
132
|
}
|
|
200
133
|
export {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
134
|
+
S as createClientHeaders,
|
|
135
|
+
k as dynamicExperiencesPlugin,
|
|
136
|
+
u as fetchProject
|
|
204
137
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createEffect as n, sample as i } from "effector";
|
|
2
|
-
import { c, l as g, s as S } from "../../../storage-
|
|
2
|
+
import { c, l as g, s as S } from "../../../storage-B2d81EOI.js";
|
|
3
3
|
import { l as f } from "../../../logger-C9a75KZn.js";
|
|
4
4
|
const y = ({
|
|
5
5
|
storage: a = "local"
|
|
@@ -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-B2d81EOI.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 i, attach as f, sample as c } from "effector";
|
|
2
|
-
import { c as u, l as g, s as d } from "../../../storage-
|
|
2
|
+
import { c as u, l as g, s as d } from "../../../storage-B2d81EOI.js";
|
|
3
3
|
const p = u("responses", "global"), S = (r, s) => {
|
|
4
4
|
const o = {};
|
|
5
5
|
return Object.entries(r).forEach(([t, n]) => {
|
|
@@ -1,86 +1,91 @@
|
|
|
1
1
|
import { createEffect as u, sample as d } from "effector";
|
|
2
2
|
const x = "picked";
|
|
3
|
-
async function p(
|
|
4
|
-
const { storeName:
|
|
5
|
-
return new Promise((a,
|
|
3
|
+
async function p(s) {
|
|
4
|
+
const { storeName: t, version: c = 1, keyPath: n = "id" } = s;
|
|
5
|
+
return new Promise((a, r) => {
|
|
6
6
|
const e = indexedDB.open(x, c);
|
|
7
7
|
e.onupgradeneeded = () => {
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
}, e.onsuccess = () => a(e.result), e.onerror = () =>
|
|
8
|
+
const o = e.result;
|
|
9
|
+
o.objectStoreNames.contains(t) || o.createObjectStore(t, n ? { keyPath: n } : void 0);
|
|
10
|
+
}, e.onsuccess = () => a(e.result), e.onerror = () => r(new Error(e.error?.message));
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
|
-
async function g(
|
|
13
|
+
async function g(s, t) {
|
|
14
14
|
return new Promise((c, n) => {
|
|
15
|
-
const e =
|
|
15
|
+
const e = s.transaction(t, "readonly").objectStore(t).getAll();
|
|
16
16
|
e.onsuccess = () => c(e.result), e.onerror = () => n(new Error(e.error?.message));
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
async function y(
|
|
19
|
+
async function y(s, t, c) {
|
|
20
20
|
return new Promise((n, a) => {
|
|
21
|
-
const
|
|
22
|
-
|
|
21
|
+
const o = s.transaction(t, "readwrite").objectStore(t).put(c);
|
|
22
|
+
o.onsuccess = () => n(), o.onerror = () => a(new Error(o.error?.message));
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
async function
|
|
25
|
+
async function S(s, t, c) {
|
|
26
26
|
return new Promise((n, a) => {
|
|
27
|
-
const
|
|
28
|
-
|
|
27
|
+
const o = s.transaction(t, "readwrite").objectStore(t).delete(c);
|
|
28
|
+
o.onsuccess = () => n(), o.onerror = () => a(new Error(o.error?.message));
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
-
async function
|
|
31
|
+
async function b(s, t) {
|
|
32
32
|
return new Promise((c, n) => {
|
|
33
|
-
const e =
|
|
33
|
+
const e = s.transaction(t, "readwrite").objectStore(t).clear();
|
|
34
34
|
e.onsuccess = () => c(), e.onerror = () => n(new Error(e.error?.message));
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
const l = "responses",
|
|
37
|
+
const l = "responses", w = { storeName: l, keyPath: "fieldId" }, E = () => ({
|
|
38
38
|
name: "responses-indexdb-plugin",
|
|
39
|
-
setup: (
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
(i, { fieldId:
|
|
39
|
+
setup: (s) => {
|
|
40
|
+
const t = u(async () => {
|
|
41
|
+
const r = await p(w), o = (await g(r, l)).reduce(
|
|
42
|
+
(i, { fieldId: m, value: f }) => (i[m] = f, i),
|
|
43
43
|
{}
|
|
44
44
|
);
|
|
45
|
-
await
|
|
45
|
+
await s.responses.commit(o);
|
|
46
46
|
}), c = u(
|
|
47
|
-
async (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
async (r) => {
|
|
48
|
+
await Promise.allSettled(
|
|
49
|
+
r.map(async (e) => {
|
|
50
|
+
const o = await p(w);
|
|
51
|
+
await y(
|
|
52
|
+
o,
|
|
53
|
+
l,
|
|
54
|
+
e
|
|
55
|
+
);
|
|
56
|
+
})
|
|
57
|
+
);
|
|
55
58
|
}
|
|
56
59
|
), n = u(async () => {
|
|
57
|
-
const
|
|
58
|
-
await
|
|
59
|
-
}), a = u(async (
|
|
60
|
-
const e = await p(
|
|
61
|
-
await
|
|
60
|
+
const r = await p(w);
|
|
61
|
+
await b(r, l);
|
|
62
|
+
}), a = u(async (r) => {
|
|
63
|
+
const e = await p(w);
|
|
64
|
+
await S(e, l, r);
|
|
62
65
|
});
|
|
63
66
|
d({
|
|
64
|
-
source:
|
|
65
|
-
filter: (
|
|
66
|
-
target:
|
|
67
|
+
source: s.eventBus,
|
|
68
|
+
filter: (r) => r.type === "load",
|
|
69
|
+
target: t
|
|
67
70
|
}), d({
|
|
68
|
-
clock:
|
|
69
|
-
source: { responses:
|
|
70
|
-
fn: ({ responses:
|
|
71
|
-
const
|
|
72
|
-
|
|
71
|
+
clock: s.responses.listStore,
|
|
72
|
+
source: { responses: s.responses.listStore, fields: s.fields.listStore },
|
|
73
|
+
fn: ({ responses: r, fields: e }) => {
|
|
74
|
+
const o = new Set(
|
|
75
|
+
e.filter((i) => !i.policies?.doNotStoreValue).map((i) => i.id)
|
|
76
|
+
);
|
|
77
|
+
return r.filter((i) => o.has(i.fieldId));
|
|
73
78
|
},
|
|
74
79
|
target: c
|
|
75
80
|
}), d({
|
|
76
|
-
clock:
|
|
81
|
+
clock: s.responses.clearAll,
|
|
77
82
|
target: n
|
|
78
83
|
}), d({
|
|
79
|
-
clock:
|
|
84
|
+
clock: s.responses.clear,
|
|
80
85
|
target: a
|
|
81
86
|
});
|
|
82
87
|
}
|
|
83
88
|
});
|
|
84
89
|
export {
|
|
85
|
-
|
|
90
|
+
E as responsesIndexedDBPlugin
|
|
86
91
|
};
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { p as
|
|
3
|
-
const
|
|
4
|
-
let
|
|
5
|
-
const
|
|
1
|
+
import { a as c, G as h, f as l } from "../../../supports-8YT4QKI7.js";
|
|
2
|
+
import { p as u } from "../../../object-CJssU1Pm.js";
|
|
3
|
+
const r = h;
|
|
4
|
+
let n;
|
|
5
|
+
const H = (s) => ({
|
|
6
6
|
name: "single-page-app",
|
|
7
|
-
setup: (
|
|
8
|
-
|
|
7
|
+
setup: (e) => {
|
|
8
|
+
c() && m(() => {
|
|
9
9
|
requestAnimationFrame(() => {
|
|
10
|
-
|
|
10
|
+
e.start();
|
|
11
11
|
});
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
|
-
function
|
|
16
|
-
if (
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
}), !
|
|
15
|
+
function m(s) {
|
|
16
|
+
if (r.addEventListener("popstate", () => {
|
|
17
|
+
const t = r.location.href, i = n;
|
|
18
|
+
n = t, i !== t && s();
|
|
19
|
+
}), !l())
|
|
20
20
|
return;
|
|
21
|
-
function
|
|
22
|
-
return function(...
|
|
23
|
-
const
|
|
24
|
-
if (
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
27
|
-
return
|
|
28
|
-
|
|
21
|
+
function e(t) {
|
|
22
|
+
return function(...o) {
|
|
23
|
+
const p = o.length > 2 ? o[2] : void 0;
|
|
24
|
+
if (p) {
|
|
25
|
+
const f = n, a = String(p);
|
|
26
|
+
if (n = a, f === a)
|
|
27
|
+
return t.apply(this, o);
|
|
28
|
+
s();
|
|
29
29
|
}
|
|
30
|
-
return
|
|
30
|
+
return t.apply(this, o);
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
u(r.history, "pushState", e), u(r.history, "replaceState", e);
|
|
34
34
|
}
|
|
35
35
|
export {
|
|
36
|
-
|
|
36
|
+
H as singlePageAppPlugin
|
|
37
37
|
};
|
package/dist/esm/server/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createEvent as i, createStore as C, createEffect as S, sample as n, attach as h } from "effector";
|
|
2
|
-
import {
|
|
2
|
+
import { e as F } from "../../experience-instance-Bd4kkjE6.js";
|
|
3
3
|
function R() {
|
|
4
4
|
let c, p;
|
|
5
5
|
return {
|