@picked/client 0.0.7 → 0.0.8-next.1
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/create-experience/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/server/index.js +1 -1
- package/dist/esm/index.js +323 -291
- package/dist/esm/plugins/create-experience/index.js +75 -67
- package/dist/esm/plugins/responses-browser-storage/index.js +16 -15
- package/dist/esm/plugins/responses-indexeddb/index.js +24 -21
- package/dist/esm/server/index.js +1 -1
- package/dist/{experience-instance-DYZovD6a.js → experience-instance-C1Ky25uw.js} +17 -16
- package/dist/{experience-instance-DwO_yZK0.cjs → experience-instance-DNI5sbjx.cjs} +1 -1
- package/dist/types/entities/experience-instance/experience-instance.d.ts +3 -0
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/entities/field/field.d.ts +27 -19
- package/dist/types/entities/field/field.d.ts.map +1 -1
- package/dist/types/entities/predicate/predicate.d.ts +1 -1
- package/dist/types/entities/predicate/predicate.d.ts.map +1 -1
- package/dist/types/entities/response/response.d.ts +8 -0
- package/dist/types/entities/response/response.d.ts.map +1 -1
- package/dist/types/exports.d.ts +2 -0
- package/dist/types/exports.d.ts.map +1 -1
- package/dist/types/picked.d.ts +12 -6
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts +17 -6
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/dist/types/utils/get-step-fields.d.ts +4 -0
- package/dist/types/utils/get-step-fields.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -9,10 +9,10 @@ const r = {
|
|
|
9
9
|
}, b = (e) => ({
|
|
10
10
|
name: "create-experience",
|
|
11
11
|
setup: (a) => {
|
|
12
|
-
e.experiences.forEach((
|
|
13
|
-
const s =
|
|
14
|
-
|
|
15
|
-
a.registerField(
|
|
12
|
+
e.experiences.forEach((o) => {
|
|
13
|
+
const s = o.serialize(), d = r.deserialize(s);
|
|
14
|
+
d.component = o.component, a.registerExperience(d), d.fields.forEach((h) => {
|
|
15
|
+
a.registerField(h);
|
|
16
16
|
});
|
|
17
17
|
});
|
|
18
18
|
}
|
|
@@ -21,12 +21,12 @@ const r = {
|
|
|
21
21
|
label: e.label,
|
|
22
22
|
fields: e.fields ?? [],
|
|
23
23
|
addField(a) {
|
|
24
|
-
var s,
|
|
25
|
-
const
|
|
26
|
-
return (s = this.fields) != null && s.includes(
|
|
24
|
+
var s, d;
|
|
25
|
+
const o = "serialize" in a ? a : m(a);
|
|
26
|
+
return (s = this.fields) != null && s.includes(o) || (d = this.fields) == null || d.push(o), o;
|
|
27
27
|
}
|
|
28
28
|
}), y = (e, a) => {
|
|
29
|
-
const
|
|
29
|
+
const o = {
|
|
30
30
|
id: e.id ?? f("step"),
|
|
31
31
|
label: e.label,
|
|
32
32
|
experience: a,
|
|
@@ -52,16 +52,16 @@ const r = {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
|
-
return
|
|
56
|
-
}, z = () => [0, 0],
|
|
57
|
-
const
|
|
55
|
+
return c({ step: o, type: "step" }, a), o;
|
|
56
|
+
}, z = () => [0, 0], c = (e, a) => {
|
|
57
|
+
const o = {
|
|
58
58
|
id: f("node"),
|
|
59
59
|
position: z(),
|
|
60
60
|
experience: a
|
|
61
61
|
};
|
|
62
62
|
if (e.type === "step") {
|
|
63
|
-
const
|
|
64
|
-
...
|
|
63
|
+
const d = {
|
|
64
|
+
...o,
|
|
65
65
|
type: "step",
|
|
66
66
|
connectedStep: e.step,
|
|
67
67
|
serialize() {
|
|
@@ -74,11 +74,11 @@ const r = {
|
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
|
-
return
|
|
77
|
+
return d.connectedStep.node = d, d;
|
|
78
78
|
}
|
|
79
79
|
if (e.type === "conditional") {
|
|
80
|
-
const
|
|
81
|
-
...
|
|
80
|
+
const d = {
|
|
81
|
+
...o,
|
|
82
82
|
type: "conditional",
|
|
83
83
|
connectedConditional: e.conditional,
|
|
84
84
|
serialize() {
|
|
@@ -90,10 +90,10 @@ const r = {
|
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
|
-
return
|
|
93
|
+
return d.connectedConditional.node = d, d;
|
|
94
94
|
}
|
|
95
95
|
return e.type === "experience" ? {
|
|
96
|
-
...
|
|
96
|
+
...o,
|
|
97
97
|
type: "experience",
|
|
98
98
|
connectedExperience: e.experience,
|
|
99
99
|
serialize() {
|
|
@@ -105,7 +105,7 @@ const r = {
|
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
} : {
|
|
108
|
-
...
|
|
108
|
+
...o,
|
|
109
109
|
type: "origin",
|
|
110
110
|
serialize() {
|
|
111
111
|
return r.serialize({
|
|
@@ -130,7 +130,7 @@ const r = {
|
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
132
|
}), N = (e, a) => {
|
|
133
|
-
const
|
|
133
|
+
const o = {
|
|
134
134
|
id: f("conditional"),
|
|
135
135
|
condition: e.condition,
|
|
136
136
|
node: null,
|
|
@@ -138,20 +138,20 @@ const r = {
|
|
|
138
138
|
addTrue(s) {
|
|
139
139
|
if (!this.node || !s.node)
|
|
140
140
|
throw new Error("todo no node");
|
|
141
|
-
const
|
|
141
|
+
const d = p(
|
|
142
142
|
{ sourceNode: this.node, destinationNode: s.node, sourceNodeHandle: "true" },
|
|
143
143
|
this.experience
|
|
144
144
|
);
|
|
145
|
-
this.experience.edges.push(
|
|
145
|
+
this.experience.edges.push(d);
|
|
146
146
|
},
|
|
147
147
|
addFalse(s) {
|
|
148
148
|
if (!this.node || !s.node)
|
|
149
149
|
throw new Error("todo no node");
|
|
150
|
-
const
|
|
150
|
+
const d = p(
|
|
151
151
|
{ sourceNode: this.node, destinationNode: s.node, sourceNodeHandle: "false" },
|
|
152
152
|
this.experience
|
|
153
153
|
);
|
|
154
|
-
this.experience.edges.push(
|
|
154
|
+
this.experience.edges.push(d);
|
|
155
155
|
},
|
|
156
156
|
serialize() {
|
|
157
157
|
return r.serialize({
|
|
@@ -160,9 +160,9 @@ const r = {
|
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
162
|
};
|
|
163
|
-
return
|
|
163
|
+
return c({ conditional: o, type: "conditional" }, a), o;
|
|
164
164
|
}, m = (e) => {
|
|
165
|
-
var
|
|
165
|
+
var o;
|
|
166
166
|
return {
|
|
167
167
|
id: e.id,
|
|
168
168
|
name: e.name,
|
|
@@ -171,13 +171,14 @@ const r = {
|
|
|
171
171
|
placeholder: e.placeholder,
|
|
172
172
|
description: e.description,
|
|
173
173
|
helpText: e.helpText,
|
|
174
|
-
defaultValue: e.defaultValue,
|
|
174
|
+
defaultValue: e.defaultValue ?? null,
|
|
175
175
|
multiple: e.multiple,
|
|
176
|
-
validation: e.validation,
|
|
176
|
+
validation: e.validation ?? {},
|
|
177
|
+
condition: e.condition,
|
|
177
178
|
required: e.required,
|
|
178
|
-
options: ((
|
|
179
|
+
options: ((o = e.options) == null ? void 0 : o.map((s) => ({
|
|
179
180
|
...s
|
|
180
|
-
})))
|
|
181
|
+
}))) ?? null,
|
|
181
182
|
policies: e.policies,
|
|
182
183
|
serialize() {
|
|
183
184
|
const s = {
|
|
@@ -189,17 +190,18 @@ const r = {
|
|
|
189
190
|
description: this.description,
|
|
190
191
|
helpText: this.helpText,
|
|
191
192
|
validation: this.validation,
|
|
193
|
+
condition: this.condition,
|
|
192
194
|
policies: this.policies
|
|
193
|
-
},
|
|
195
|
+
}, d = typeof this.defaultValue == "string" ? this.defaultValue : void 0, h = typeof this.defaultValue == "number" ? this.defaultValue : void 0, n = typeof this.defaultValue == "boolean" ? this.defaultValue : void 0;
|
|
194
196
|
switch (this.type) {
|
|
195
197
|
case "text":
|
|
196
198
|
if (this.multiple) {
|
|
197
|
-
let i
|
|
199
|
+
let i;
|
|
198
200
|
if (Array.isArray(this.defaultValue)) {
|
|
199
201
|
i = [];
|
|
200
202
|
for (const t of this.defaultValue)
|
|
201
203
|
typeof t == "string" && i.push(t);
|
|
202
|
-
i.length === 0 && (i =
|
|
204
|
+
i.length === 0 && (i = void 0);
|
|
203
205
|
}
|
|
204
206
|
return r.serialize({
|
|
205
207
|
...s,
|
|
@@ -209,7 +211,8 @@ const r = {
|
|
|
209
211
|
options: this.options ? this.options.map((t) => ({
|
|
210
212
|
id: t.id,
|
|
211
213
|
label: t.label,
|
|
212
|
-
value: `${t.value}
|
|
214
|
+
value: `${t.value}`,
|
|
215
|
+
condition: t.condition
|
|
213
216
|
})) : null
|
|
214
217
|
});
|
|
215
218
|
}
|
|
@@ -217,21 +220,22 @@ const r = {
|
|
|
217
220
|
...s,
|
|
218
221
|
type: "text",
|
|
219
222
|
multiple: !1,
|
|
220
|
-
defaultValue:
|
|
223
|
+
defaultValue: d,
|
|
221
224
|
options: this.options ? this.options.map((i) => ({
|
|
222
225
|
id: i.id,
|
|
223
226
|
label: i.label,
|
|
224
|
-
value: `${i.value}
|
|
227
|
+
value: `${i.value}`,
|
|
228
|
+
condition: i.condition
|
|
225
229
|
})) : null
|
|
226
230
|
});
|
|
227
231
|
case "number":
|
|
228
232
|
if (this.multiple) {
|
|
229
|
-
let i
|
|
233
|
+
let i;
|
|
230
234
|
if (Array.isArray(this.defaultValue)) {
|
|
231
235
|
i = [];
|
|
232
236
|
for (const t of this.defaultValue)
|
|
233
237
|
typeof t == "number" && i.push(t);
|
|
234
|
-
i.length === 0 && (i =
|
|
238
|
+
i.length === 0 && (i = void 0);
|
|
235
239
|
}
|
|
236
240
|
return r.serialize({
|
|
237
241
|
...s,
|
|
@@ -241,7 +245,8 @@ const r = {
|
|
|
241
245
|
options: this.options ? this.options.map((t) => ({
|
|
242
246
|
id: t.id,
|
|
243
247
|
label: t.label,
|
|
244
|
-
value: Number(t.value)
|
|
248
|
+
value: Number(t.value),
|
|
249
|
+
condition: t.condition
|
|
245
250
|
})) : null
|
|
246
251
|
});
|
|
247
252
|
}
|
|
@@ -249,21 +254,22 @@ const r = {
|
|
|
249
254
|
...s,
|
|
250
255
|
type: "number",
|
|
251
256
|
multiple: !1,
|
|
252
|
-
defaultValue:
|
|
257
|
+
defaultValue: h,
|
|
253
258
|
options: this.options ? this.options.map((i) => ({
|
|
254
259
|
id: i.id,
|
|
255
260
|
label: i.label,
|
|
256
|
-
value: Number(i.value)
|
|
261
|
+
value: Number(i.value),
|
|
262
|
+
condition: i.condition
|
|
257
263
|
})) : null
|
|
258
264
|
});
|
|
259
265
|
case "boolean":
|
|
260
266
|
if (this.multiple) {
|
|
261
|
-
let i
|
|
267
|
+
let i;
|
|
262
268
|
if (Array.isArray(this.defaultValue)) {
|
|
263
269
|
i = [];
|
|
264
270
|
for (const t of this.defaultValue)
|
|
265
271
|
typeof t == "boolean" && i.push(t);
|
|
266
|
-
i.length === 0 && (i =
|
|
272
|
+
i.length === 0 && (i = void 0);
|
|
267
273
|
}
|
|
268
274
|
return r.serialize({
|
|
269
275
|
...s,
|
|
@@ -273,7 +279,8 @@ const r = {
|
|
|
273
279
|
options: this.options ? this.options.map((t) => ({
|
|
274
280
|
id: t.id,
|
|
275
281
|
label: t.label,
|
|
276
|
-
value: !!t.value
|
|
282
|
+
value: !!t.value,
|
|
283
|
+
condition: t.condition
|
|
277
284
|
})) : null
|
|
278
285
|
});
|
|
279
286
|
}
|
|
@@ -285,7 +292,8 @@ const r = {
|
|
|
285
292
|
options: this.options ? this.options.map((i) => ({
|
|
286
293
|
id: i.id,
|
|
287
294
|
label: i.label,
|
|
288
|
-
value: !!i.value
|
|
295
|
+
value: !!i.value,
|
|
296
|
+
condition: i.condition
|
|
289
297
|
})) : null
|
|
290
298
|
});
|
|
291
299
|
// todo: support for object type fields
|
|
@@ -311,8 +319,8 @@ const r = {
|
|
|
311
319
|
}
|
|
312
320
|
}
|
|
313
321
|
};
|
|
314
|
-
},
|
|
315
|
-
const a = [],
|
|
322
|
+
}, v = (e) => {
|
|
323
|
+
const a = [], o = [], s = [], d = [], h = [];
|
|
316
324
|
return {
|
|
317
325
|
id: e.id,
|
|
318
326
|
component: e.component,
|
|
@@ -321,52 +329,52 @@ const r = {
|
|
|
321
329
|
decide: e.decide,
|
|
322
330
|
targets: e.targets,
|
|
323
331
|
steps: a,
|
|
324
|
-
nodes:
|
|
332
|
+
nodes: o,
|
|
325
333
|
edges: s,
|
|
326
|
-
fields:
|
|
327
|
-
conditionals:
|
|
334
|
+
fields: h,
|
|
335
|
+
conditionals: d,
|
|
328
336
|
addStep(n, i) {
|
|
329
337
|
let t = i == null ? void 0 : i.node;
|
|
330
|
-
this.nodes.length === 0 && (t =
|
|
331
|
-
const
|
|
338
|
+
this.nodes.length === 0 && (t = c({ type: "origin" }, this), this.nodes.push(t));
|
|
339
|
+
const l = "serialize" in n ? n : y(n, this);
|
|
332
340
|
if (t) {
|
|
333
|
-
if (!
|
|
341
|
+
if (!l.node)
|
|
334
342
|
throw new Error("todo no node");
|
|
335
343
|
const u = p(
|
|
336
|
-
{ sourceNode: t, destinationNode:
|
|
344
|
+
{ sourceNode: t, destinationNode: l.node, sourceNodeHandle: null },
|
|
337
345
|
this
|
|
338
346
|
);
|
|
339
347
|
this.edges.push(u);
|
|
340
348
|
}
|
|
341
|
-
return
|
|
349
|
+
return l.fields.length > 0 && l.fields.forEach((u) => {
|
|
342
350
|
this.fields.includes(u) || this.fields.push(u);
|
|
343
|
-
}), this.steps.includes(
|
|
351
|
+
}), this.steps.includes(l) || (this.steps.push(l), l.node && this.nodes.push(l.node)), l;
|
|
344
352
|
},
|
|
345
353
|
addConditional(n, i) {
|
|
346
354
|
let t = i == null ? void 0 : i.node;
|
|
347
|
-
this.nodes.length === 0 && (t =
|
|
348
|
-
const
|
|
355
|
+
this.nodes.length === 0 && (t = c({ type: "origin" }, this), this.nodes.push(t));
|
|
356
|
+
const l = "serialize" in n ? n : N(n, this);
|
|
349
357
|
if (t) {
|
|
350
|
-
if (!
|
|
358
|
+
if (!l.node)
|
|
351
359
|
throw new Error("todo no node");
|
|
352
360
|
const u = p(
|
|
353
|
-
{ sourceNode: t, destinationNode:
|
|
361
|
+
{ sourceNode: t, destinationNode: l.node, sourceNodeHandle: null },
|
|
354
362
|
this
|
|
355
363
|
);
|
|
356
364
|
this.edges.push(u);
|
|
357
365
|
}
|
|
358
|
-
return this.conditionals.includes(
|
|
366
|
+
return this.conditionals.includes(l) || (this.conditionals.push(l), l.node && this.nodes.push(l.node)), l;
|
|
359
367
|
},
|
|
360
368
|
addExperience(n, i) {
|
|
361
369
|
let t = i == null ? void 0 : i.node;
|
|
362
|
-
this.nodes.length === 0 && (t =
|
|
363
|
-
const
|
|
370
|
+
this.nodes.length === 0 && (t = c({ type: "origin" }, this), this.nodes.push(t));
|
|
371
|
+
const l = c(
|
|
364
372
|
{ type: "experience", experience: n },
|
|
365
373
|
this
|
|
366
374
|
);
|
|
367
|
-
if (this.nodes.push(
|
|
375
|
+
if (this.nodes.push(l), t) {
|
|
368
376
|
const u = p(
|
|
369
|
-
{ sourceNode: t, destinationNode:
|
|
377
|
+
{ sourceNode: t, destinationNode: l, sourceNodeHandle: null },
|
|
370
378
|
this
|
|
371
379
|
);
|
|
372
380
|
this.edges.push(u);
|
|
@@ -399,10 +407,10 @@ const r = {
|
|
|
399
407
|
export {
|
|
400
408
|
N as createConditional,
|
|
401
409
|
p as createEdge,
|
|
402
|
-
|
|
410
|
+
v as createExperience,
|
|
403
411
|
b as createExperiencePlugin,
|
|
404
412
|
m as createField,
|
|
405
|
-
|
|
413
|
+
c as createNode,
|
|
406
414
|
x as createStep,
|
|
407
415
|
r as serialization
|
|
408
416
|
};
|
|
@@ -1,36 +1,37 @@
|
|
|
1
|
-
import { createEffect as
|
|
2
|
-
import { c as
|
|
3
|
-
const a =
|
|
4
|
-
storage:
|
|
1
|
+
import { createEffect as p, sample as i } from "effector";
|
|
2
|
+
import { c as b, l as d, s as y } from "../../../storage-D87xFySf.js";
|
|
3
|
+
const a = b("responses", "global"), R = ({
|
|
4
|
+
storage: g = "local"
|
|
5
5
|
} = {}) => ({
|
|
6
6
|
name: "responses-browser-storage-plugin",
|
|
7
7
|
setup: (e) => {
|
|
8
|
-
const t =
|
|
8
|
+
const t = g === "local" ? d : y, u = p(async () => {
|
|
9
9
|
const s = t.get(a).json();
|
|
10
10
|
if (!s)
|
|
11
11
|
return null;
|
|
12
12
|
Object.entries(s).forEach(([r, o]) => {
|
|
13
13
|
e.responses.register(r, o);
|
|
14
14
|
});
|
|
15
|
-
}),
|
|
15
|
+
}), f = p(async (s) => {
|
|
16
16
|
const r = t.get(a).json(), o = {};
|
|
17
|
-
Object.entries(s).forEach(([c,
|
|
17
|
+
Object.entries(s).forEach(([c, m]) => {
|
|
18
|
+
var l;
|
|
18
19
|
const n = e.fields.getById(c).getState();
|
|
19
|
-
!(n
|
|
20
|
+
!((l = n == null ? void 0 : n.policies) != null && l.doNotStoreValue) && (o[c] = m);
|
|
20
21
|
});
|
|
21
|
-
const
|
|
22
|
-
t.set(a,
|
|
22
|
+
const S = { ...r, ...o };
|
|
23
|
+
t.set(a, S);
|
|
23
24
|
});
|
|
24
|
-
|
|
25
|
+
i({
|
|
25
26
|
source: e.eventBus,
|
|
26
27
|
filter: (s) => s.type === "initialized",
|
|
27
|
-
target: g
|
|
28
|
-
}), p({
|
|
29
|
-
source: e.responses.getAllStore,
|
|
30
28
|
target: u
|
|
29
|
+
}), i({
|
|
30
|
+
source: e.responses.getAllStore,
|
|
31
|
+
target: f
|
|
31
32
|
});
|
|
32
33
|
}
|
|
33
34
|
});
|
|
34
35
|
export {
|
|
35
|
-
|
|
36
|
+
R as responsesBrowserStoragePlugin
|
|
36
37
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createEffect as
|
|
1
|
+
import { createEffect as d, sample as p } from "effector";
|
|
2
2
|
const x = "picked";
|
|
3
|
-
async function
|
|
3
|
+
async function m(r) {
|
|
4
4
|
const { storeName: o, version: a = 1, keyPath: n = "id" } = r;
|
|
5
5
|
return new Promise((i, t) => {
|
|
6
6
|
const s = indexedDB.open(x, a);
|
|
@@ -49,48 +49,51 @@ async function S(r, o) {
|
|
|
49
49
|
};
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
const
|
|
52
|
+
const u = "responses", w = { storeName: u, keyPath: "fieldId" }, I = () => ({
|
|
53
53
|
name: "responses-indexdb-plugin",
|
|
54
54
|
setup: (r) => {
|
|
55
|
-
const o =
|
|
56
|
-
const t = await
|
|
57
|
-
(c, { fieldId:
|
|
55
|
+
const o = d(async () => {
|
|
56
|
+
const t = await m(w), e = (await g(t, u)).reduce(
|
|
57
|
+
(c, { fieldId: l, value: f }) => (c[l] = f, c),
|
|
58
58
|
{}
|
|
59
59
|
);
|
|
60
60
|
await r.responses.commit(e);
|
|
61
|
-
}), a =
|
|
61
|
+
}), a = d(
|
|
62
62
|
async (t) => {
|
|
63
63
|
t.forEach((s) => {
|
|
64
|
-
|
|
65
|
-
y(e,
|
|
64
|
+
m(w).then((e) => {
|
|
65
|
+
y(e, u, s);
|
|
66
66
|
}).catch((e) => {
|
|
67
67
|
console.error("Failed to store response in IndexedDB:", e);
|
|
68
68
|
});
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
|
-
), n =
|
|
72
|
-
const t = await
|
|
73
|
-
await S(t,
|
|
74
|
-
}), i =
|
|
75
|
-
const s = await
|
|
76
|
-
await b(s,
|
|
71
|
+
), n = d(async () => {
|
|
72
|
+
const t = await m(w);
|
|
73
|
+
await S(t, u);
|
|
74
|
+
}), i = d(async (t) => {
|
|
75
|
+
const s = await m(w);
|
|
76
|
+
await b(s, u, t);
|
|
77
77
|
});
|
|
78
|
-
|
|
78
|
+
p({
|
|
79
79
|
source: r.eventBus,
|
|
80
80
|
filter: (t) => t.type === "initialized",
|
|
81
81
|
target: o
|
|
82
|
-
}),
|
|
82
|
+
}), p({
|
|
83
83
|
clock: r.responses.listStore,
|
|
84
84
|
source: { responses: r.responses.listStore, fields: r.fields.listStore },
|
|
85
85
|
fn: ({ responses: t, fields: s }) => {
|
|
86
|
-
const e = s.filter((c) =>
|
|
87
|
-
|
|
86
|
+
const e = s.filter((c) => {
|
|
87
|
+
var l;
|
|
88
|
+
return !((l = c.policies) != null && l.doNotStoreValue);
|
|
89
|
+
});
|
|
90
|
+
return t.filter((c) => e.some((l) => l.id === c.fieldId));
|
|
88
91
|
},
|
|
89
92
|
target: a
|
|
90
|
-
}),
|
|
93
|
+
}), p({
|
|
91
94
|
clock: r.responses.clearAll,
|
|
92
95
|
target: n
|
|
93
|
-
}),
|
|
96
|
+
}), p({
|
|
94
97
|
clock: r.responses.clear,
|
|
95
98
|
target: i
|
|
96
99
|
});
|
package/dist/esm/server/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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-
|
|
2
|
+
import { h as F } from "../../experience-instance-C1Ky25uw.js";
|
|
3
3
|
function R() {
|
|
4
4
|
let c, p;
|
|
5
5
|
return {
|
|
@@ -23,7 +23,7 @@ function d(t) {
|
|
|
23
23
|
const e = parseFloat(`${t}`);
|
|
24
24
|
return isNaN(e) ? 0 : e;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function L(t) {
|
|
27
27
|
return `${t}`;
|
|
28
28
|
}
|
|
29
29
|
const ht = {
|
|
@@ -52,11 +52,11 @@ const ht = {
|
|
|
52
52
|
"%": (t, e) => d(t) % d(e),
|
|
53
53
|
// eslint-disable-next-line sonarjs/function-return-type
|
|
54
54
|
log: (t) => (console.log(t), t),
|
|
55
|
-
in: (t, e) => e ? O(e) ? e.indexOf(
|
|
56
|
-
cat: (...t) => t.map(
|
|
55
|
+
in: (t, e) => e ? O(e) ? e.indexOf(L(t)) !== -1 : w(e) ? e.includes(t) : !1 : !1,
|
|
56
|
+
cat: (...t) => t.map(L).join(""),
|
|
57
57
|
/* eslint-disable sonarjs/deprecation */
|
|
58
58
|
substr: (t, e, r) => {
|
|
59
|
-
const n =
|
|
59
|
+
const n = L(t), i = d(e);
|
|
60
60
|
if (r === void 0) return n.substr(i);
|
|
61
61
|
const c = d(r);
|
|
62
62
|
if (c < 0) {
|
|
@@ -82,7 +82,7 @@ const ht = {
|
|
|
82
82
|
return this;
|
|
83
83
|
if (typeof t == "number" && Array.isArray(this))
|
|
84
84
|
return t >= 0 && t < this.length ? this[t] : r;
|
|
85
|
-
const n =
|
|
85
|
+
const n = L(t);
|
|
86
86
|
if (n === "" || n === ".")
|
|
87
87
|
return this;
|
|
88
88
|
const i = n.split(".");
|
|
@@ -122,10 +122,10 @@ const ht = {
|
|
|
122
122
|
const [c, o] = t;
|
|
123
123
|
r = c, n = o;
|
|
124
124
|
}
|
|
125
|
-
return !O(r) || !O(n) ? !1 : new RegExp(r, n).test(
|
|
125
|
+
return !O(r) || !O(n) ? !1 : new RegExp(r, n).test(L(e));
|
|
126
126
|
},
|
|
127
127
|
throw(t) {
|
|
128
|
-
throw new Error(
|
|
128
|
+
throw new Error(L(t));
|
|
129
129
|
}
|
|
130
130
|
};
|
|
131
131
|
async function l(t, e) {
|
|
@@ -352,7 +352,7 @@ function X(t) {
|
|
|
352
352
|
const et = (t, e, r, n, i = /* @__PURE__ */ new Set()) => i.has(r.id) ? [] : (i.add(r.id), $(r) && !n ? [r] : e.filter((o) => o.sourceNodeId === r.id).flatMap((o) => {
|
|
353
353
|
const a = t.find((u) => u.id === o.destinationNodeId);
|
|
354
354
|
return a ? et(t, e, a, !1, i) : [];
|
|
355
|
-
})),
|
|
355
|
+
})), Mt = (t, e, r) => et(t, e, r, !0, /* @__PURE__ */ new Set()), nt = (t, e, r, n, i = /* @__PURE__ */ new Set()) => {
|
|
356
356
|
if (i.has(r.id)) return [-1, -1];
|
|
357
357
|
i.add(r.id);
|
|
358
358
|
const c = e.filter((u) => u.sourceNodeId === r.id);
|
|
@@ -371,7 +371,7 @@ const et = (t, e, r, n, i = /* @__PURE__ */ new Set()) => i.has(r.id) ? [] : (i.
|
|
|
371
371
|
E !== -1 && (o = Math.min(o, E + 1), a = Math.max(a, y + 1));
|
|
372
372
|
}
|
|
373
373
|
return o === 1 / 0 ? [-1, -1] : [o, a];
|
|
374
|
-
},
|
|
374
|
+
}, Lt = (t, e, r) => nt(t, e, r, !0, /* @__PURE__ */ new Set()), rt = (t, e, r, n = /* @__PURE__ */ new Set()) => {
|
|
375
375
|
if (n.has(r.id)) return [-1, -1];
|
|
376
376
|
if (n.add(r.id), r.type === "origin") return [0, 0];
|
|
377
377
|
const i = e.filter((a) => a.destinationNodeId === r.id);
|
|
@@ -420,7 +420,7 @@ const U = ft("experience-instance"), Ft = Q(
|
|
|
420
420
|
), C = F(
|
|
421
421
|
e.treeStore,
|
|
422
422
|
y,
|
|
423
|
-
({ nodes: s, edges: p }, g) => g ?
|
|
423
|
+
({ nodes: s, edges: p }, g) => g ? Mt(s, p, g) : []
|
|
424
424
|
), f = F(
|
|
425
425
|
e.treeStore,
|
|
426
426
|
y,
|
|
@@ -428,7 +428,7 @@ const U = ft("experience-instance"), Ft = Q(
|
|
|
428
428
|
), m = F(
|
|
429
429
|
e.treeStore,
|
|
430
430
|
y,
|
|
431
|
-
({ nodes: s, edges: p }, g) => g ?
|
|
431
|
+
({ nodes: s, edges: p }, g) => g ? Lt(s, p, g) : [-1, -1]
|
|
432
432
|
), x = U.store(!0), N = J(x, {
|
|
433
433
|
open: () => !0,
|
|
434
434
|
close: () => !1,
|
|
@@ -455,7 +455,7 @@ const U = ft("experience-instance"), Ft = Q(
|
|
|
455
455
|
}), T = _({
|
|
456
456
|
source: e.treeStore,
|
|
457
457
|
effect: async (s, p) => {
|
|
458
|
-
const g = s.nodes.find((
|
|
458
|
+
const g = s.nodes.find((M) => $(M) && M.stepId === p);
|
|
459
459
|
g && t.history.push({ experienceId: e.id, node: g });
|
|
460
460
|
}
|
|
461
461
|
}), V = _({
|
|
@@ -470,13 +470,13 @@ const U = ft("experience-instance"), Ft = Q(
|
|
|
470
470
|
effect: async ({ nodes: s, edges: p }, g) => K(g, s, p)
|
|
471
471
|
}), G = _({
|
|
472
472
|
source: e.treeStore,
|
|
473
|
-
effect: async ({ nodes: s, edges: p, conditionals: g },
|
|
474
|
-
if (!
|
|
473
|
+
effect: async ({ nodes: s, edges: p, conditionals: g }, M) => {
|
|
474
|
+
if (!M)
|
|
475
475
|
return;
|
|
476
|
-
const q = g.find((ut) => ut.id ===
|
|
476
|
+
const q = g.find((ut) => ut.id === M.conditionalId);
|
|
477
477
|
if (!q)
|
|
478
478
|
return;
|
|
479
|
-
const ct =
|
|
479
|
+
const ct = M.id, at = await yt(t, q.condition);
|
|
480
480
|
return Bt(!!at, ct, s, p);
|
|
481
481
|
}
|
|
482
482
|
}), st = v((s) => {
|
|
@@ -573,6 +573,7 @@ const U = ft("experience-instance"), Ft = Q(
|
|
|
573
573
|
filter: (s) => s ? X(s) : !0,
|
|
574
574
|
target: W
|
|
575
575
|
}), n(), {
|
|
576
|
+
id: Math.random().toString(36).substring(7),
|
|
576
577
|
// config
|
|
577
578
|
experienceId: e.id,
|
|
578
579
|
configStore: e.configStore,
|