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