@picked/client 0.0.1-dev.1770178792114 → 0.0.1-dev.1770256874555
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 +549 -468
- package/dist/esm/plugins/create-experience/index.js +90 -82
- package/dist/esm/plugins/experience-browser-storage/index.js +12 -13
- package/dist/esm/plugins/single-page-app/index.js +1 -1
- package/dist/esm/plugins/web-components/index.js +1 -1
- package/dist/esm/plugins/window-object/index.js +1 -1
- 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/{supports-COb-sl36.js → supports-8YT4QKI7.js} +5 -5
- package/dist/types/entities/experience-instance/experience-instance.d.ts +30 -115
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/entities/field/field.d.ts +33 -2
- package/dist/types/entities/field/field.d.ts.map +1 -1
- package/dist/types/entities/response/response.d.ts.map +1 -1
- package/dist/types/picked.d.ts +2 -76
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/dist/types/utils/events.d.ts +10 -18
- package/dist/types/utils/events.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/experience-instance-DXLWzNXG.cjs +0 -1
- package/dist/experience-instance-eADy3oIy.js +0 -810
|
@@ -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,12 @@ 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
|
+
...s
|
|
216
216
|
})) ?? null,
|
|
217
217
|
policies: e.policies,
|
|
218
218
|
serialize() {
|
|
219
|
-
const
|
|
219
|
+
const s = {
|
|
220
220
|
id: this.id,
|
|
221
221
|
name: this.name,
|
|
222
222
|
label: this.label,
|
|
@@ -227,7 +227,7 @@ const r = {
|
|
|
227
227
|
validation: this.validation,
|
|
228
228
|
condition: this.condition,
|
|
229
229
|
policies: this.policies
|
|
230
|
-
},
|
|
230
|
+
}, 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
231
|
switch (this.type) {
|
|
232
232
|
case "text":
|
|
233
233
|
if (this.multiple) {
|
|
@@ -239,7 +239,7 @@ const r = {
|
|
|
239
239
|
t.length === 0 && (t = void 0);
|
|
240
240
|
}
|
|
241
241
|
return r.serialize({
|
|
242
|
-
...
|
|
242
|
+
...s,
|
|
243
243
|
type: "text",
|
|
244
244
|
multiple: !0,
|
|
245
245
|
defaultValue: t,
|
|
@@ -252,10 +252,10 @@ const r = {
|
|
|
252
252
|
});
|
|
253
253
|
}
|
|
254
254
|
return r.serialize({
|
|
255
|
-
...
|
|
255
|
+
...s,
|
|
256
256
|
type: "text",
|
|
257
257
|
multiple: !1,
|
|
258
|
-
defaultValue:
|
|
258
|
+
defaultValue: n,
|
|
259
259
|
options: this.options ? this.options.map((t) => ({
|
|
260
260
|
id: t.id,
|
|
261
261
|
label: t.label,
|
|
@@ -273,7 +273,7 @@ const r = {
|
|
|
273
273
|
t.length === 0 && (t = void 0);
|
|
274
274
|
}
|
|
275
275
|
return r.serialize({
|
|
276
|
-
...
|
|
276
|
+
...s,
|
|
277
277
|
type: "number",
|
|
278
278
|
multiple: !0,
|
|
279
279
|
defaultValue: t,
|
|
@@ -286,7 +286,7 @@ const r = {
|
|
|
286
286
|
});
|
|
287
287
|
}
|
|
288
288
|
return r.serialize({
|
|
289
|
-
...
|
|
289
|
+
...s,
|
|
290
290
|
type: "number",
|
|
291
291
|
multiple: !1,
|
|
292
292
|
defaultValue: d,
|
|
@@ -307,7 +307,7 @@ const r = {
|
|
|
307
307
|
t.length === 0 && (t = void 0);
|
|
308
308
|
}
|
|
309
309
|
return r.serialize({
|
|
310
|
-
...
|
|
310
|
+
...s,
|
|
311
311
|
type: "boolean",
|
|
312
312
|
multiple: !0,
|
|
313
313
|
defaultValue: t,
|
|
@@ -320,7 +320,7 @@ const r = {
|
|
|
320
320
|
});
|
|
321
321
|
}
|
|
322
322
|
return r.serialize({
|
|
323
|
-
...
|
|
323
|
+
...s,
|
|
324
324
|
type: "boolean",
|
|
325
325
|
multiple: !1,
|
|
326
326
|
defaultValue: N,
|
|
@@ -331,30 +331,38 @@ const r = {
|
|
|
331
331
|
condition: t.condition
|
|
332
332
|
})) : null
|
|
333
333
|
});
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
334
|
+
case "object":
|
|
335
|
+
return this.multiple ? r.serialize({
|
|
336
|
+
...s,
|
|
337
|
+
type: "object",
|
|
338
|
+
multiple: !0,
|
|
339
|
+
defaultValue: this.defaultValue,
|
|
340
|
+
options: this.options ? this.options.map((t) => ({
|
|
341
|
+
id: t.id,
|
|
342
|
+
label: t.label,
|
|
343
|
+
description: t.description,
|
|
344
|
+
value: t.value,
|
|
345
|
+
condition: t.condition
|
|
346
|
+
})) : null
|
|
347
|
+
}) : r.serialize({
|
|
348
|
+
...s,
|
|
349
|
+
type: "object",
|
|
350
|
+
multiple: !1,
|
|
351
|
+
defaultValue: this.defaultValue,
|
|
352
|
+
options: this.options ? this.options.map((t) => ({
|
|
353
|
+
id: t.id,
|
|
354
|
+
label: t.label,
|
|
355
|
+
description: t.description,
|
|
356
|
+
value: t.value,
|
|
357
|
+
condition: t.condition
|
|
358
|
+
})) : null
|
|
359
|
+
});
|
|
352
360
|
default:
|
|
353
361
|
throw new Error("Unsupported field type");
|
|
354
362
|
}
|
|
355
363
|
}
|
|
356
|
-
}),
|
|
357
|
-
const o = [],
|
|
364
|
+
}), E = (e) => {
|
|
365
|
+
const o = [], s = [], n = [], d = [], N = [], t = e.condition ?? e.decide;
|
|
358
366
|
return {
|
|
359
367
|
id: e.id,
|
|
360
368
|
component: e.component,
|
|
@@ -364,14 +372,14 @@ const r = {
|
|
|
364
372
|
decide: e.decide,
|
|
365
373
|
targets: e.targets,
|
|
366
374
|
steps: o,
|
|
367
|
-
nodes:
|
|
368
|
-
edges:
|
|
375
|
+
nodes: s,
|
|
376
|
+
edges: n,
|
|
369
377
|
fields: N,
|
|
370
378
|
conditionals: d,
|
|
371
379
|
addStep(i, u) {
|
|
372
380
|
let l = u?.node;
|
|
373
381
|
this.nodes.length === 0 && (l = p({ type: "origin" }, this), this.nodes.push(l));
|
|
374
|
-
const a = "serialize" in i ? i :
|
|
382
|
+
const a = "serialize" in i ? i : z(i, this);
|
|
375
383
|
if (l) {
|
|
376
384
|
if (!a.node)
|
|
377
385
|
throw new Error("todo no node");
|
|
@@ -388,7 +396,7 @@ const r = {
|
|
|
388
396
|
addAction(i, u) {
|
|
389
397
|
let l = u?.node;
|
|
390
398
|
this.nodes.length === 0 && (l = p({ type: "origin" }, this), this.nodes.push(l));
|
|
391
|
-
const a = "serialize" in i ? i :
|
|
399
|
+
const a = "serialize" in i ? i : y(i, this);
|
|
392
400
|
if (l) {
|
|
393
401
|
const c = h(
|
|
394
402
|
{ sourceNode: l, destinationNode: a, sourceNodeHandle: null },
|
|
@@ -456,10 +464,10 @@ const r = {
|
|
|
456
464
|
export {
|
|
457
465
|
b as createConditional,
|
|
458
466
|
h as createEdge,
|
|
459
|
-
|
|
460
|
-
|
|
467
|
+
E as createExperience,
|
|
468
|
+
x as createExperiencePlugin,
|
|
461
469
|
m as createField,
|
|
462
470
|
p as createNode,
|
|
463
|
-
|
|
471
|
+
V as createStep,
|
|
464
472
|
r as serialization
|
|
465
473
|
};
|
|
@@ -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 {
|