@picked/client 0.0.39-next.1 → 0.0.39-next.3
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 +2 -2
- package/dist/cjs/plugins/create-experience/index.js +1 -1
- package/dist/cjs/plugins/experience-browser-storage/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/esm/index.js +551 -470
- package/dist/esm/plugins/create-experience/index.js +91 -82
- package/dist/esm/plugins/experience-browser-storage/index.js +12 -13
- package/dist/esm/server/index.js +1 -1
- package/dist/experience-instance-D0bQ9DzM.js +815 -0
- package/dist/experience-instance-D8RtqKEZ.cjs +1 -0
- package/dist/types/entities/experience-instance/experience-instance.d.ts +30 -118
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/entities/field/field.d.ts +31 -55
- package/dist/types/entities/field/field.d.ts.map +1 -1
- package/dist/types/entities/response/response.d.ts +9 -5
- package/dist/types/entities/response/response.d.ts.map +1 -1
- package/dist/types/picked.d.ts +6 -79
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts +28 -5
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/dist/types/utils/events.d.ts +10 -10
- package/dist/types/utils/events.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/experience-instance-CKiUCMCP.js +0 -815
- package/dist/experience-instance-yl7BWjFA.cjs +0 -1
|
@@ -6,42 +6,42 @@ const r = {
|
|
|
6
6
|
deserialize(e) {
|
|
7
7
|
return JSON.parse(e);
|
|
8
8
|
}
|
|
9
|
-
},
|
|
9
|
+
}, x = (e) => ({
|
|
10
10
|
name: "create-experience",
|
|
11
11
|
setup: (o) => {
|
|
12
|
-
e.experiences.forEach((
|
|
13
|
-
const
|
|
14
|
-
d.component =
|
|
12
|
+
e.experiences.forEach((s) => {
|
|
13
|
+
const n = s.serialize(), d = r.deserialize(n);
|
|
14
|
+
d.component = s.component, o.registerExperience(d), d.fields.forEach((N) => {
|
|
15
15
|
o.registerField(N);
|
|
16
16
|
});
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
}),
|
|
19
|
+
}), y = (e, o) => ({
|
|
20
20
|
id: f("node"),
|
|
21
21
|
position: [0, 0],
|
|
22
22
|
experience: o,
|
|
23
23
|
type: "action",
|
|
24
24
|
action: e.action,
|
|
25
|
-
addNext(
|
|
26
|
-
if (!
|
|
25
|
+
addNext(n) {
|
|
26
|
+
if (!n.node) throw new Error("Cannot connect to node");
|
|
27
27
|
const d = h(
|
|
28
|
-
{ sourceNode: this, destinationNode:
|
|
28
|
+
{ sourceNode: this, destinationNode: n.node, sourceNodeHandle: null },
|
|
29
29
|
o
|
|
30
30
|
);
|
|
31
31
|
o.edges.push(d);
|
|
32
32
|
},
|
|
33
|
-
onSuccess(
|
|
34
|
-
if (!
|
|
33
|
+
onSuccess(n) {
|
|
34
|
+
if (!n.node) throw new Error("Cannot connect to node");
|
|
35
35
|
const d = h(
|
|
36
|
-
{ sourceNode: this, destinationNode:
|
|
36
|
+
{ sourceNode: this, destinationNode: n.node, sourceNodeHandle: "true" },
|
|
37
37
|
o
|
|
38
38
|
);
|
|
39
39
|
o.edges.push(d);
|
|
40
40
|
},
|
|
41
|
-
onFail(
|
|
42
|
-
if (!
|
|
41
|
+
onFail(n) {
|
|
42
|
+
if (!n.node) throw new Error("Cannot connect to node");
|
|
43
43
|
const d = h(
|
|
44
|
-
{ sourceNode: this, destinationNode:
|
|
44
|
+
{ sourceNode: this, destinationNode: n.node, sourceNodeHandle: "false" },
|
|
45
45
|
o
|
|
46
46
|
);
|
|
47
47
|
o.edges.push(d);
|
|
@@ -54,51 +54,51 @@ const r = {
|
|
|
54
54
|
position: this.position
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
-
}),
|
|
57
|
+
}), V = (e) => ({
|
|
58
58
|
id: e.id ?? f("step"),
|
|
59
59
|
label: e.label,
|
|
60
60
|
fields: e.fields ?? [],
|
|
61
61
|
addField(o) {
|
|
62
|
-
const
|
|
63
|
-
return this.fields?.includes(
|
|
62
|
+
const s = "serialize" in o ? o : m(o);
|
|
63
|
+
return this.fields?.includes(s) || this.fields?.push(s), s;
|
|
64
64
|
}
|
|
65
|
-
}),
|
|
66
|
-
const
|
|
65
|
+
}), z = (e, o) => {
|
|
66
|
+
const s = {
|
|
67
67
|
id: e.id ?? f("step"),
|
|
68
68
|
label: e.label,
|
|
69
69
|
experience: o,
|
|
70
70
|
fields: e.fields ?? [],
|
|
71
71
|
node: null,
|
|
72
|
-
nextStep(
|
|
73
|
-
return this.experience.addStep(
|
|
72
|
+
nextStep(n) {
|
|
73
|
+
return this.experience.addStep(n, this);
|
|
74
74
|
},
|
|
75
|
-
nextConditional(
|
|
76
|
-
return this.experience.addConditional(
|
|
75
|
+
nextConditional(n) {
|
|
76
|
+
return this.experience.addConditional(n, this);
|
|
77
77
|
},
|
|
78
|
-
addNextExperience(
|
|
79
|
-
return this.experience.addExperience(
|
|
78
|
+
addNextExperience(n) {
|
|
79
|
+
return this.experience.addExperience(n, this);
|
|
80
80
|
},
|
|
81
|
-
addField(
|
|
82
|
-
return this.experience.addField(
|
|
81
|
+
addField(n) {
|
|
82
|
+
return this.experience.addField(n, this);
|
|
83
83
|
},
|
|
84
84
|
serialize() {
|
|
85
85
|
return r.serialize({
|
|
86
86
|
id: this.id,
|
|
87
87
|
label: this.label,
|
|
88
|
-
fieldIds: this.fields.map((
|
|
88
|
+
fieldIds: this.fields.map((n) => n.id)
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
91
|
};
|
|
92
|
-
return p({ step:
|
|
93
|
-
},
|
|
94
|
-
const
|
|
92
|
+
return p({ step: s, type: "step" }, o), s;
|
|
93
|
+
}, g = () => [0, 0], p = (e, o) => {
|
|
94
|
+
const s = {
|
|
95
95
|
id: f("node"),
|
|
96
|
-
position:
|
|
96
|
+
position: g(),
|
|
97
97
|
experience: o
|
|
98
98
|
};
|
|
99
99
|
if (e.type === "step") {
|
|
100
100
|
const d = {
|
|
101
|
-
...
|
|
101
|
+
...s,
|
|
102
102
|
type: "step",
|
|
103
103
|
connectedStep: e.step,
|
|
104
104
|
serialize() {
|
|
@@ -115,7 +115,7 @@ const r = {
|
|
|
115
115
|
}
|
|
116
116
|
if (e.type === "conditional") {
|
|
117
117
|
const d = {
|
|
118
|
-
...
|
|
118
|
+
...s,
|
|
119
119
|
type: "conditional",
|
|
120
120
|
connectedConditional: e.conditional,
|
|
121
121
|
serialize() {
|
|
@@ -130,7 +130,7 @@ const r = {
|
|
|
130
130
|
return d.connectedConditional.node = d, d;
|
|
131
131
|
}
|
|
132
132
|
return e.type === "experience" ? {
|
|
133
|
-
...
|
|
133
|
+
...s,
|
|
134
134
|
type: "experience",
|
|
135
135
|
connectedExperience: e.experience,
|
|
136
136
|
serialize() {
|
|
@@ -142,7 +142,7 @@ const r = {
|
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
144
|
} : {
|
|
145
|
-
...
|
|
145
|
+
...s,
|
|
146
146
|
type: "origin",
|
|
147
147
|
serialize() {
|
|
148
148
|
return r.serialize({
|
|
@@ -167,25 +167,25 @@ const r = {
|
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
169
|
}), b = (e, o) => {
|
|
170
|
-
const
|
|
170
|
+
const s = {
|
|
171
171
|
id: f("conditional"),
|
|
172
172
|
condition: e.condition,
|
|
173
173
|
node: null,
|
|
174
174
|
experience: o,
|
|
175
|
-
addTrue(
|
|
176
|
-
if (!this.node || !
|
|
175
|
+
addTrue(n) {
|
|
176
|
+
if (!this.node || !n.node)
|
|
177
177
|
throw new Error("todo no node");
|
|
178
178
|
const d = h(
|
|
179
|
-
{ sourceNode: this.node, destinationNode:
|
|
179
|
+
{ sourceNode: this.node, destinationNode: n.node, sourceNodeHandle: "true" },
|
|
180
180
|
this.experience
|
|
181
181
|
);
|
|
182
182
|
this.experience.edges.push(d);
|
|
183
183
|
},
|
|
184
|
-
addFalse(
|
|
185
|
-
if (!this.node || !
|
|
184
|
+
addFalse(n) {
|
|
185
|
+
if (!this.node || !n.node)
|
|
186
186
|
throw new Error("todo no node");
|
|
187
187
|
const d = h(
|
|
188
|
-
{ sourceNode: this.node, destinationNode:
|
|
188
|
+
{ sourceNode: this.node, destinationNode: n.node, sourceNodeHandle: "false" },
|
|
189
189
|
this.experience
|
|
190
190
|
);
|
|
191
191
|
this.experience.edges.push(d);
|
|
@@ -197,7 +197,7 @@ const r = {
|
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
199
|
};
|
|
200
|
-
return p({ conditional:
|
|
200
|
+
return p({ conditional: s, type: "conditional" }, o), s;
|
|
201
201
|
}, m = (e) => ({
|
|
202
202
|
id: e.id,
|
|
203
203
|
name: e.name,
|
|
@@ -211,12 +211,13 @@ const r = {
|
|
|
211
211
|
validation: e.validation ?? {},
|
|
212
212
|
condition: e.condition,
|
|
213
213
|
required: e.required,
|
|
214
|
-
options: e.options?.map((
|
|
215
|
-
|
|
214
|
+
options: e.options?.map((s) => ({
|
|
215
|
+
id: "id" in s ? s.id : f("option"),
|
|
216
|
+
...s
|
|
216
217
|
})) ?? null,
|
|
217
218
|
policies: e.policies,
|
|
218
219
|
serialize() {
|
|
219
|
-
const
|
|
220
|
+
const s = {
|
|
220
221
|
id: this.id,
|
|
221
222
|
name: this.name,
|
|
222
223
|
label: this.label,
|
|
@@ -227,7 +228,7 @@ const r = {
|
|
|
227
228
|
validation: this.validation,
|
|
228
229
|
condition: this.condition,
|
|
229
230
|
policies: this.policies
|
|
230
|
-
},
|
|
231
|
+
}, n = typeof this.defaultValue == "string" ? this.defaultValue : void 0, d = typeof this.defaultValue == "number" ? this.defaultValue : void 0, N = typeof this.defaultValue == "boolean" ? this.defaultValue : void 0;
|
|
231
232
|
switch (this.type) {
|
|
232
233
|
case "text":
|
|
233
234
|
if (this.multiple) {
|
|
@@ -239,7 +240,7 @@ const r = {
|
|
|
239
240
|
t.length === 0 && (t = void 0);
|
|
240
241
|
}
|
|
241
242
|
return r.serialize({
|
|
242
|
-
...
|
|
243
|
+
...s,
|
|
243
244
|
type: "text",
|
|
244
245
|
multiple: !0,
|
|
245
246
|
defaultValue: t,
|
|
@@ -252,10 +253,10 @@ const r = {
|
|
|
252
253
|
});
|
|
253
254
|
}
|
|
254
255
|
return r.serialize({
|
|
255
|
-
...
|
|
256
|
+
...s,
|
|
256
257
|
type: "text",
|
|
257
258
|
multiple: !1,
|
|
258
|
-
defaultValue:
|
|
259
|
+
defaultValue: n,
|
|
259
260
|
options: this.options ? this.options.map((t) => ({
|
|
260
261
|
id: t.id,
|
|
261
262
|
label: t.label,
|
|
@@ -273,7 +274,7 @@ const r = {
|
|
|
273
274
|
t.length === 0 && (t = void 0);
|
|
274
275
|
}
|
|
275
276
|
return r.serialize({
|
|
276
|
-
...
|
|
277
|
+
...s,
|
|
277
278
|
type: "number",
|
|
278
279
|
multiple: !0,
|
|
279
280
|
defaultValue: t,
|
|
@@ -286,7 +287,7 @@ const r = {
|
|
|
286
287
|
});
|
|
287
288
|
}
|
|
288
289
|
return r.serialize({
|
|
289
|
-
...
|
|
290
|
+
...s,
|
|
290
291
|
type: "number",
|
|
291
292
|
multiple: !1,
|
|
292
293
|
defaultValue: d,
|
|
@@ -307,7 +308,7 @@ const r = {
|
|
|
307
308
|
t.length === 0 && (t = void 0);
|
|
308
309
|
}
|
|
309
310
|
return r.serialize({
|
|
310
|
-
...
|
|
311
|
+
...s,
|
|
311
312
|
type: "boolean",
|
|
312
313
|
multiple: !0,
|
|
313
314
|
defaultValue: t,
|
|
@@ -320,7 +321,7 @@ const r = {
|
|
|
320
321
|
});
|
|
321
322
|
}
|
|
322
323
|
return r.serialize({
|
|
323
|
-
...
|
|
324
|
+
...s,
|
|
324
325
|
type: "boolean",
|
|
325
326
|
multiple: !1,
|
|
326
327
|
defaultValue: N,
|
|
@@ -331,30 +332,38 @@ const r = {
|
|
|
331
332
|
condition: t.condition
|
|
332
333
|
})) : null
|
|
333
334
|
});
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
335
|
+
case "object":
|
|
336
|
+
return this.multiple ? r.serialize({
|
|
337
|
+
...s,
|
|
338
|
+
type: "object",
|
|
339
|
+
multiple: !0,
|
|
340
|
+
defaultValue: this.defaultValue,
|
|
341
|
+
options: this.options ? this.options.map((t) => ({
|
|
342
|
+
id: t.id,
|
|
343
|
+
label: t.label,
|
|
344
|
+
description: t.description,
|
|
345
|
+
value: t.value,
|
|
346
|
+
condition: t.condition
|
|
347
|
+
})) : null
|
|
348
|
+
}) : r.serialize({
|
|
349
|
+
...s,
|
|
350
|
+
type: "object",
|
|
351
|
+
multiple: !1,
|
|
352
|
+
defaultValue: this.defaultValue,
|
|
353
|
+
options: this.options ? this.options.map((t) => ({
|
|
354
|
+
id: t.id,
|
|
355
|
+
label: t.label,
|
|
356
|
+
description: t.description,
|
|
357
|
+
value: t.value,
|
|
358
|
+
condition: t.condition
|
|
359
|
+
})) : null
|
|
360
|
+
});
|
|
352
361
|
default:
|
|
353
362
|
throw new Error("Unsupported field type");
|
|
354
363
|
}
|
|
355
364
|
}
|
|
356
|
-
}),
|
|
357
|
-
const o = [],
|
|
365
|
+
}), E = (e) => {
|
|
366
|
+
const o = [], s = [], n = [], d = [], N = [], t = e.condition ?? e.decide;
|
|
358
367
|
return {
|
|
359
368
|
id: e.id,
|
|
360
369
|
component: e.component,
|
|
@@ -364,14 +373,14 @@ const r = {
|
|
|
364
373
|
decide: e.decide,
|
|
365
374
|
targets: e.targets,
|
|
366
375
|
steps: o,
|
|
367
|
-
nodes:
|
|
368
|
-
edges:
|
|
376
|
+
nodes: s,
|
|
377
|
+
edges: n,
|
|
369
378
|
fields: N,
|
|
370
379
|
conditionals: d,
|
|
371
380
|
addStep(i, u) {
|
|
372
381
|
let l = u?.node;
|
|
373
382
|
this.nodes.length === 0 && (l = p({ type: "origin" }, this), this.nodes.push(l));
|
|
374
|
-
const a = "serialize" in i ? i :
|
|
383
|
+
const a = "serialize" in i ? i : z(i, this);
|
|
375
384
|
if (l) {
|
|
376
385
|
if (!a.node)
|
|
377
386
|
throw new Error("todo no node");
|
|
@@ -388,7 +397,7 @@ const r = {
|
|
|
388
397
|
addAction(i, u) {
|
|
389
398
|
let l = u?.node;
|
|
390
399
|
this.nodes.length === 0 && (l = p({ type: "origin" }, this), this.nodes.push(l));
|
|
391
|
-
const a = "serialize" in i ? i :
|
|
400
|
+
const a = "serialize" in i ? i : y(i, this);
|
|
392
401
|
if (l) {
|
|
393
402
|
const c = h(
|
|
394
403
|
{ sourceNode: l, destinationNode: a, sourceNodeHandle: null },
|
|
@@ -456,10 +465,10 @@ const r = {
|
|
|
456
465
|
export {
|
|
457
466
|
b as createConditional,
|
|
458
467
|
h as createEdge,
|
|
459
|
-
|
|
460
|
-
|
|
468
|
+
E as createExperience,
|
|
469
|
+
x as createExperiencePlugin,
|
|
461
470
|
m as createField,
|
|
462
471
|
p as createNode,
|
|
463
|
-
|
|
472
|
+
V as createStep,
|
|
464
473
|
r as serialization
|
|
465
474
|
};
|
|
@@ -1,35 +1,34 @@
|
|
|
1
|
-
import { createEffect as
|
|
1
|
+
import { createEffect as n, sample as i } from "effector";
|
|
2
2
|
import { c, l as g, s as S } from "../../../storage-Co_LbKr_.js";
|
|
3
3
|
import { l as f } from "../../../logger-C9a75KZn.js";
|
|
4
4
|
const y = ({
|
|
5
5
|
storage: a = "local"
|
|
6
6
|
} = {}) => ({
|
|
7
7
|
name: "experience-browser-storage-plugin",
|
|
8
|
-
setup: (
|
|
9
|
-
const
|
|
8
|
+
setup: (s) => {
|
|
9
|
+
const r = a === "local" ? g : S, p = n(async (e) => {
|
|
10
10
|
if (!e) {
|
|
11
11
|
f("warn", "No experience instance provided to loadExperienceVisiblityFx.");
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
|
-
const t = c("open-close", "experience", e),
|
|
15
|
-
e.setOpen(
|
|
14
|
+
const t = c("open-close", "experience", e), o = r.get(t).boolean();
|
|
15
|
+
e.setOpen(o ?? e.isOpenStore.getState());
|
|
16
16
|
});
|
|
17
17
|
i({
|
|
18
|
-
source:
|
|
19
|
-
filter: (e) => e.type === "experience_initialize" && "
|
|
20
|
-
|
|
21
|
-
fn: (e) => e.experienceInstance,
|
|
18
|
+
source: s.eventBus,
|
|
19
|
+
filter: (e) => e.type === "experience_initialize" && "experience" in e,
|
|
20
|
+
fn: (e) => e.experience,
|
|
22
21
|
target: p
|
|
23
22
|
});
|
|
24
|
-
const l =
|
|
25
|
-
const t = c("open-close", "experience", e),
|
|
26
|
-
|
|
23
|
+
const l = n(async (e) => {
|
|
24
|
+
const t = c("open-close", "experience", e), o = e.isOpenStore.getState();
|
|
25
|
+
r.set(t, o);
|
|
27
26
|
}), x = (e) => i({
|
|
28
27
|
source: e.isOpenStore,
|
|
29
28
|
fn: () => e,
|
|
30
29
|
target: l
|
|
31
30
|
});
|
|
32
|
-
|
|
31
|
+
s.experienceInstances.listStore.watch((e) => {
|
|
33
32
|
e.forEach((t) => x(t));
|
|
34
33
|
});
|
|
35
34
|
}
|
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-D0bQ9DzM.js";
|
|
3
3
|
function R() {
|
|
4
4
|
let c, p;
|
|
5
5
|
return {
|