@picked/client 0.0.7-next.3 → 0.0.7
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 +291 -323
- package/dist/esm/plugins/create-experience/index.js +67 -75
- package/dist/esm/plugins/responses-browser-storage/index.js +15 -16
- package/dist/esm/plugins/responses-indexeddb/index.js +21 -24
- package/dist/esm/server/index.js +1 -1
- package/dist/{experience-instance-C1Ky25uw.js → experience-instance-DYZovD6a.js} +16 -17
- package/dist/{experience-instance-DNI5sbjx.cjs → experience-instance-DwO_yZK0.cjs} +1 -1
- package/dist/types/entities/experience-instance/experience-instance.d.ts +0 -3
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/entities/field/field.d.ts +19 -27
- 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 +0 -8
- package/dist/types/entities/response/response.d.ts.map +1 -1
- package/dist/types/exports.d.ts +0 -2
- package/dist/types/exports.d.ts.map +1 -1
- package/dist/types/picked.d.ts +6 -12
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts +6 -17
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/types/utils/get-step-fields.d.ts +0 -4
- package/dist/types/utils/get-step-fields.d.ts.map +0 -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((l) => {
|
|
13
|
+
const s = l.serialize(), o = r.deserialize(s);
|
|
14
|
+
o.component = l.component, a.registerExperience(o), o.fields.forEach((c) => {
|
|
15
|
+
a.registerField(c);
|
|
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, o;
|
|
25
|
+
const l = "serialize" in a ? a : m(a);
|
|
26
|
+
return (s = this.fields) != null && s.includes(l) || (o = this.fields) == null || o.push(l), l;
|
|
27
27
|
}
|
|
28
28
|
}), y = (e, a) => {
|
|
29
|
-
const
|
|
29
|
+
const l = {
|
|
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 h({ step: l, type: "step" }, a), l;
|
|
56
|
+
}, z = () => [0, 0], h = (e, a) => {
|
|
57
|
+
const l = {
|
|
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 o = {
|
|
64
|
+
...l,
|
|
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 o.connectedStep.node = o, o;
|
|
78
78
|
}
|
|
79
79
|
if (e.type === "conditional") {
|
|
80
|
-
const
|
|
81
|
-
...
|
|
80
|
+
const o = {
|
|
81
|
+
...l,
|
|
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 o.connectedConditional.node = o, o;
|
|
94
94
|
}
|
|
95
95
|
return e.type === "experience" ? {
|
|
96
|
-
...
|
|
96
|
+
...l,
|
|
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
|
+
...l,
|
|
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 l = {
|
|
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 o = 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(o);
|
|
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 o = 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(o);
|
|
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 h({ conditional: l, type: "conditional" }, a), l;
|
|
164
164
|
}, m = (e) => {
|
|
165
|
-
var
|
|
165
|
+
var l;
|
|
166
166
|
return {
|
|
167
167
|
id: e.id,
|
|
168
168
|
name: e.name,
|
|
@@ -171,14 +171,13 @@ 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,
|
|
175
175
|
multiple: e.multiple,
|
|
176
|
-
validation: e.validation
|
|
177
|
-
condition: e.condition,
|
|
176
|
+
validation: e.validation,
|
|
178
177
|
required: e.required,
|
|
179
|
-
options: ((
|
|
178
|
+
options: ((l = e.options) == null ? void 0 : l.map((s) => ({
|
|
180
179
|
...s
|
|
181
|
-
})))
|
|
180
|
+
}))) || null,
|
|
182
181
|
policies: e.policies,
|
|
183
182
|
serialize() {
|
|
184
183
|
const s = {
|
|
@@ -190,18 +189,17 @@ const r = {
|
|
|
190
189
|
description: this.description,
|
|
191
190
|
helpText: this.helpText,
|
|
192
191
|
validation: this.validation,
|
|
193
|
-
condition: this.condition,
|
|
194
192
|
policies: this.policies
|
|
195
|
-
},
|
|
193
|
+
}, o = typeof this.defaultValue == "string" ? this.defaultValue : null, c = typeof this.defaultValue == "number" ? this.defaultValue : null, n = typeof this.defaultValue == "boolean" ? this.defaultValue : null;
|
|
196
194
|
switch (this.type) {
|
|
197
195
|
case "text":
|
|
198
196
|
if (this.multiple) {
|
|
199
|
-
let i;
|
|
197
|
+
let i = null;
|
|
200
198
|
if (Array.isArray(this.defaultValue)) {
|
|
201
199
|
i = [];
|
|
202
200
|
for (const t of this.defaultValue)
|
|
203
201
|
typeof t == "string" && i.push(t);
|
|
204
|
-
i.length === 0 && (i =
|
|
202
|
+
i.length === 0 && (i = null);
|
|
205
203
|
}
|
|
206
204
|
return r.serialize({
|
|
207
205
|
...s,
|
|
@@ -211,8 +209,7 @@ const r = {
|
|
|
211
209
|
options: this.options ? this.options.map((t) => ({
|
|
212
210
|
id: t.id,
|
|
213
211
|
label: t.label,
|
|
214
|
-
value: `${t.value}
|
|
215
|
-
condition: t.condition
|
|
212
|
+
value: `${t.value}`
|
|
216
213
|
})) : null
|
|
217
214
|
});
|
|
218
215
|
}
|
|
@@ -220,22 +217,21 @@ const r = {
|
|
|
220
217
|
...s,
|
|
221
218
|
type: "text",
|
|
222
219
|
multiple: !1,
|
|
223
|
-
defaultValue:
|
|
220
|
+
defaultValue: o,
|
|
224
221
|
options: this.options ? this.options.map((i) => ({
|
|
225
222
|
id: i.id,
|
|
226
223
|
label: i.label,
|
|
227
|
-
value: `${i.value}
|
|
228
|
-
condition: i.condition
|
|
224
|
+
value: `${i.value}`
|
|
229
225
|
})) : null
|
|
230
226
|
});
|
|
231
227
|
case "number":
|
|
232
228
|
if (this.multiple) {
|
|
233
|
-
let i;
|
|
229
|
+
let i = null;
|
|
234
230
|
if (Array.isArray(this.defaultValue)) {
|
|
235
231
|
i = [];
|
|
236
232
|
for (const t of this.defaultValue)
|
|
237
233
|
typeof t == "number" && i.push(t);
|
|
238
|
-
i.length === 0 && (i =
|
|
234
|
+
i.length === 0 && (i = null);
|
|
239
235
|
}
|
|
240
236
|
return r.serialize({
|
|
241
237
|
...s,
|
|
@@ -245,8 +241,7 @@ const r = {
|
|
|
245
241
|
options: this.options ? this.options.map((t) => ({
|
|
246
242
|
id: t.id,
|
|
247
243
|
label: t.label,
|
|
248
|
-
value: Number(t.value)
|
|
249
|
-
condition: t.condition
|
|
244
|
+
value: Number(t.value)
|
|
250
245
|
})) : null
|
|
251
246
|
});
|
|
252
247
|
}
|
|
@@ -254,22 +249,21 @@ const r = {
|
|
|
254
249
|
...s,
|
|
255
250
|
type: "number",
|
|
256
251
|
multiple: !1,
|
|
257
|
-
defaultValue:
|
|
252
|
+
defaultValue: c,
|
|
258
253
|
options: this.options ? this.options.map((i) => ({
|
|
259
254
|
id: i.id,
|
|
260
255
|
label: i.label,
|
|
261
|
-
value: Number(i.value)
|
|
262
|
-
condition: i.condition
|
|
256
|
+
value: Number(i.value)
|
|
263
257
|
})) : null
|
|
264
258
|
});
|
|
265
259
|
case "boolean":
|
|
266
260
|
if (this.multiple) {
|
|
267
|
-
let i;
|
|
261
|
+
let i = null;
|
|
268
262
|
if (Array.isArray(this.defaultValue)) {
|
|
269
263
|
i = [];
|
|
270
264
|
for (const t of this.defaultValue)
|
|
271
265
|
typeof t == "boolean" && i.push(t);
|
|
272
|
-
i.length === 0 && (i =
|
|
266
|
+
i.length === 0 && (i = null);
|
|
273
267
|
}
|
|
274
268
|
return r.serialize({
|
|
275
269
|
...s,
|
|
@@ -279,8 +273,7 @@ const r = {
|
|
|
279
273
|
options: this.options ? this.options.map((t) => ({
|
|
280
274
|
id: t.id,
|
|
281
275
|
label: t.label,
|
|
282
|
-
value: !!t.value
|
|
283
|
-
condition: t.condition
|
|
276
|
+
value: !!t.value
|
|
284
277
|
})) : null
|
|
285
278
|
});
|
|
286
279
|
}
|
|
@@ -292,8 +285,7 @@ const r = {
|
|
|
292
285
|
options: this.options ? this.options.map((i) => ({
|
|
293
286
|
id: i.id,
|
|
294
287
|
label: i.label,
|
|
295
|
-
value: !!i.value
|
|
296
|
-
condition: i.condition
|
|
288
|
+
value: !!i.value
|
|
297
289
|
})) : null
|
|
298
290
|
});
|
|
299
291
|
// todo: support for object type fields
|
|
@@ -319,8 +311,8 @@ const r = {
|
|
|
319
311
|
}
|
|
320
312
|
}
|
|
321
313
|
};
|
|
322
|
-
},
|
|
323
|
-
const a = [],
|
|
314
|
+
}, V = (e) => {
|
|
315
|
+
const a = [], l = [], s = [], o = [], c = [];
|
|
324
316
|
return {
|
|
325
317
|
id: e.id,
|
|
326
318
|
component: e.component,
|
|
@@ -329,52 +321,52 @@ const r = {
|
|
|
329
321
|
decide: e.decide,
|
|
330
322
|
targets: e.targets,
|
|
331
323
|
steps: a,
|
|
332
|
-
nodes:
|
|
324
|
+
nodes: l,
|
|
333
325
|
edges: s,
|
|
334
|
-
fields:
|
|
335
|
-
conditionals:
|
|
326
|
+
fields: c,
|
|
327
|
+
conditionals: o,
|
|
336
328
|
addStep(n, i) {
|
|
337
329
|
let t = i == null ? void 0 : i.node;
|
|
338
|
-
this.nodes.length === 0 && (t =
|
|
339
|
-
const
|
|
330
|
+
this.nodes.length === 0 && (t = h({ type: "origin" }, this), this.nodes.push(t));
|
|
331
|
+
const d = "serialize" in n ? n : y(n, this);
|
|
340
332
|
if (t) {
|
|
341
|
-
if (!
|
|
333
|
+
if (!d.node)
|
|
342
334
|
throw new Error("todo no node");
|
|
343
335
|
const u = p(
|
|
344
|
-
{ sourceNode: t, destinationNode:
|
|
336
|
+
{ sourceNode: t, destinationNode: d.node, sourceNodeHandle: null },
|
|
345
337
|
this
|
|
346
338
|
);
|
|
347
339
|
this.edges.push(u);
|
|
348
340
|
}
|
|
349
|
-
return
|
|
341
|
+
return d.fields.length > 0 && d.fields.forEach((u) => {
|
|
350
342
|
this.fields.includes(u) || this.fields.push(u);
|
|
351
|
-
}), this.steps.includes(
|
|
343
|
+
}), this.steps.includes(d) || (this.steps.push(d), d.node && this.nodes.push(d.node)), d;
|
|
352
344
|
},
|
|
353
345
|
addConditional(n, i) {
|
|
354
346
|
let t = i == null ? void 0 : i.node;
|
|
355
|
-
this.nodes.length === 0 && (t =
|
|
356
|
-
const
|
|
347
|
+
this.nodes.length === 0 && (t = h({ type: "origin" }, this), this.nodes.push(t));
|
|
348
|
+
const d = "serialize" in n ? n : N(n, this);
|
|
357
349
|
if (t) {
|
|
358
|
-
if (!
|
|
350
|
+
if (!d.node)
|
|
359
351
|
throw new Error("todo no node");
|
|
360
352
|
const u = p(
|
|
361
|
-
{ sourceNode: t, destinationNode:
|
|
353
|
+
{ sourceNode: t, destinationNode: d.node, sourceNodeHandle: null },
|
|
362
354
|
this
|
|
363
355
|
);
|
|
364
356
|
this.edges.push(u);
|
|
365
357
|
}
|
|
366
|
-
return this.conditionals.includes(
|
|
358
|
+
return this.conditionals.includes(d) || (this.conditionals.push(d), d.node && this.nodes.push(d.node)), d;
|
|
367
359
|
},
|
|
368
360
|
addExperience(n, i) {
|
|
369
361
|
let t = i == null ? void 0 : i.node;
|
|
370
|
-
this.nodes.length === 0 && (t =
|
|
371
|
-
const
|
|
362
|
+
this.nodes.length === 0 && (t = h({ type: "origin" }, this), this.nodes.push(t));
|
|
363
|
+
const d = h(
|
|
372
364
|
{ type: "experience", experience: n },
|
|
373
365
|
this
|
|
374
366
|
);
|
|
375
|
-
if (this.nodes.push(
|
|
367
|
+
if (this.nodes.push(d), t) {
|
|
376
368
|
const u = p(
|
|
377
|
-
{ sourceNode: t, destinationNode:
|
|
369
|
+
{ sourceNode: t, destinationNode: d, sourceNodeHandle: null },
|
|
378
370
|
this
|
|
379
371
|
);
|
|
380
372
|
this.edges.push(u);
|
|
@@ -407,10 +399,10 @@ const r = {
|
|
|
407
399
|
export {
|
|
408
400
|
N as createConditional,
|
|
409
401
|
p as createEdge,
|
|
410
|
-
|
|
402
|
+
V as createExperience,
|
|
411
403
|
b as createExperiencePlugin,
|
|
412
404
|
m as createField,
|
|
413
|
-
|
|
405
|
+
h as createNode,
|
|
414
406
|
x as createStep,
|
|
415
407
|
r as serialization
|
|
416
408
|
};
|
|
@@ -1,37 +1,36 @@
|
|
|
1
|
-
import { createEffect as
|
|
2
|
-
import { c as
|
|
3
|
-
const a =
|
|
4
|
-
storage:
|
|
1
|
+
import { createEffect as l, sample as p } from "effector";
|
|
2
|
+
import { c as m, l as b, s as d } from "../../../storage-D87xFySf.js";
|
|
3
|
+
const a = m("responses", "global"), j = ({
|
|
4
|
+
storage: i = "local"
|
|
5
5
|
} = {}) => ({
|
|
6
6
|
name: "responses-browser-storage-plugin",
|
|
7
7
|
setup: (e) => {
|
|
8
|
-
const t =
|
|
8
|
+
const t = i === "local" ? b : d, g = l(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
|
+
}), u = l(async (s) => {
|
|
16
16
|
const r = t.get(a).json(), o = {};
|
|
17
|
-
Object.entries(s).forEach(([c,
|
|
18
|
-
var l;
|
|
17
|
+
Object.entries(s).forEach(([c, S]) => {
|
|
19
18
|
const n = e.fields.getById(c).getState();
|
|
20
|
-
!(
|
|
19
|
+
!(n != null && n.policies.doNotStoreValue) && (o[c] = S);
|
|
21
20
|
});
|
|
22
|
-
const
|
|
23
|
-
t.set(a,
|
|
21
|
+
const f = { ...r, ...o };
|
|
22
|
+
t.set(a, f);
|
|
24
23
|
});
|
|
25
|
-
|
|
24
|
+
p({
|
|
26
25
|
source: e.eventBus,
|
|
27
26
|
filter: (s) => s.type === "initialized",
|
|
28
|
-
target:
|
|
29
|
-
}),
|
|
27
|
+
target: g
|
|
28
|
+
}), p({
|
|
30
29
|
source: e.responses.getAllStore,
|
|
31
|
-
target:
|
|
30
|
+
target: u
|
|
32
31
|
});
|
|
33
32
|
}
|
|
34
33
|
});
|
|
35
34
|
export {
|
|
36
|
-
|
|
35
|
+
j as responsesBrowserStoragePlugin
|
|
37
36
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createEffect as
|
|
1
|
+
import { createEffect as u, sample as d } from "effector";
|
|
2
2
|
const x = "picked";
|
|
3
|
-
async function
|
|
3
|
+
async function p(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,51 +49,48 @@ async function S(r, o) {
|
|
|
49
49
|
};
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
const
|
|
52
|
+
const l = "responses", m = { storeName: l, keyPath: "fieldId" }, I = () => ({
|
|
53
53
|
name: "responses-indexdb-plugin",
|
|
54
54
|
setup: (r) => {
|
|
55
|
-
const o =
|
|
56
|
-
const t = await m
|
|
57
|
-
(c, { fieldId:
|
|
55
|
+
const o = u(async () => {
|
|
56
|
+
const t = await p(m), e = (await g(t, l)).reduce(
|
|
57
|
+
(c, { fieldId: w, value: f }) => (c[w] = f, c),
|
|
58
58
|
{}
|
|
59
59
|
);
|
|
60
60
|
await r.responses.commit(e);
|
|
61
|
-
}), a =
|
|
61
|
+
}), a = u(
|
|
62
62
|
async (t) => {
|
|
63
63
|
t.forEach((s) => {
|
|
64
|
-
m
|
|
65
|
-
y(e,
|
|
64
|
+
p(m).then((e) => {
|
|
65
|
+
y(e, l, 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 m
|
|
73
|
-
await S(t,
|
|
74
|
-
}), i =
|
|
75
|
-
const s = await m
|
|
76
|
-
await b(s,
|
|
71
|
+
), n = u(async () => {
|
|
72
|
+
const t = await p(m);
|
|
73
|
+
await S(t, l);
|
|
74
|
+
}), i = u(async (t) => {
|
|
75
|
+
const s = await p(m);
|
|
76
|
+
await b(s, l, t);
|
|
77
77
|
});
|
|
78
|
-
|
|
78
|
+
d({
|
|
79
79
|
source: r.eventBus,
|
|
80
80
|
filter: (t) => t.type === "initialized",
|
|
81
81
|
target: o
|
|
82
|
-
}),
|
|
82
|
+
}), d({
|
|
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
|
-
|
|
88
|
-
return !((l = c.policies) != null && l.doNotStoreValue);
|
|
89
|
-
});
|
|
90
|
-
return t.filter((c) => e.some((l) => l.id === c.fieldId));
|
|
86
|
+
const e = s.filter((c) => !c.policies.doNotStoreValue);
|
|
87
|
+
return t.filter((c) => e.some((w) => w.id === c.fieldId));
|
|
91
88
|
},
|
|
92
89
|
target: a
|
|
93
|
-
}),
|
|
90
|
+
}), d({
|
|
94
91
|
clock: r.responses.clearAll,
|
|
95
92
|
target: n
|
|
96
|
-
}),
|
|
93
|
+
}), d({
|
|
97
94
|
clock: r.responses.clear,
|
|
98
95
|
target: i
|
|
99
96
|
});
|
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-DYZovD6a.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 M(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(M(t)) !== -1 : w(e) ? e.includes(t) : !1 : !1,
|
|
56
|
+
cat: (...t) => t.map(M).join(""),
|
|
57
57
|
/* eslint-disable sonarjs/deprecation */
|
|
58
58
|
substr: (t, e, r) => {
|
|
59
|
-
const n =
|
|
59
|
+
const n = M(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 = M(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(M(e));
|
|
126
126
|
},
|
|
127
127
|
throw(t) {
|
|
128
|
-
throw new Error(
|
|
128
|
+
throw new Error(M(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
|
+
})), Lt = (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
|
+
}, Mt = (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 ? Lt(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 ? Mt(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((L) => $(L) && L.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 }, L) => {
|
|
474
|
+
if (!L)
|
|
475
475
|
return;
|
|
476
|
-
const q = g.find((ut) => ut.id ===
|
|
476
|
+
const q = g.find((ut) => ut.id === L.conditionalId);
|
|
477
477
|
if (!q)
|
|
478
478
|
return;
|
|
479
|
-
const ct =
|
|
479
|
+
const ct = L.id, at = await yt(t, q.condition);
|
|
480
480
|
return Bt(!!at, ct, s, p);
|
|
481
481
|
}
|
|
482
482
|
}), st = v((s) => {
|
|
@@ -573,7 +573,6 @@ 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),
|
|
577
576
|
// config
|
|
578
577
|
experienceId: e.id,
|
|
579
578
|
configStore: e.configStore,
|