@picked/client 0.0.1-dev.1764626732123 → 0.0.1-dev.1764632196476
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/experience-browser-storage/index.js +1 -1
- package/dist/cjs/plugins/history-browser-storage/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 +792 -144
- package/dist/esm/plugins/create-experience/index.js +123 -121
- package/dist/esm/plugins/experience-browser-storage/index.js +1 -1
- package/dist/esm/plugins/history-browser-storage/index.js +8 -8
- package/dist/esm/plugins/responses-browser-storage/index.js +23 -24
- package/dist/esm/plugins/responses-indexeddb/index.js +1 -1
- package/dist/esm/plugins/single-page-app/index.js +3 -3
- 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 +7 -7
- package/dist/{experience-instance-C2AnM2J_.js → experience-instance-C4INDX6a.js} +8 -8
- package/dist/{experience-instance-BpQMqclI.cjs → experience-instance-DjjpHk0t.cjs} +1 -1
- package/dist/{supports-DBMT17KZ.js → supports-BjhuLJ8z.js} +10 -10
- package/dist/types/client.d.ts +31 -0
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/entities/action/action.d.ts +2 -4
- package/dist/types/entities/action/action.d.ts.map +1 -1
- package/dist/types/entities/experience/experience.d.ts +3 -1
- package/dist/types/entities/experience/experience.d.ts.map +1 -1
- package/dist/types/entities/feature/feature.d.ts +3 -5
- package/dist/types/entities/feature/feature.d.ts.map +1 -1
- package/dist/types/entities/field/field.d.ts +7 -0
- package/dist/types/entities/field/field.d.ts.map +1 -1
- package/dist/types/entities/predicate/predicate.d.ts +5 -4
- package/dist/types/entities/predicate/predicate.d.ts.map +1 -1
- package/dist/types/entities/response/response.d.ts +1 -4
- package/dist/types/entities/response/response.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/picked.d.ts +20 -20
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts +6 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/utils/events.d.ts +13 -7
- package/dist/types/utils/events.d.ts.map +1 -1
- package/dist/types/utils/user-session.d.ts +2 -0
- package/dist/types/utils/user-session.d.ts.map +1 -1
- package/package.json +1 -7
- package/dist/cjs/plugins/shopify/index.js +0 -1
- package/dist/esm/plugins/shopify/index.js +0 -123
- package/dist/types/plugins/shopify/global-obj.d.ts +0 -49
- package/dist/types/plugins/shopify/global-obj.d.ts.map +0 -1
- package/dist/types/plugins/shopify/index.d.ts +0 -6
- package/dist/types/plugins/shopify/index.d.ts.map +0 -1
- package/dist/types/plugins/shopify/picked-config.d.ts +0 -103
- package/dist/types/plugins/shopify/picked-config.d.ts.map +0 -1
- package/dist/types/plugins/shopify/plugin.d.ts +0 -3
- package/dist/types/plugins/shopify/plugin.d.ts.map +0 -1
- package/dist/types/plugins/shopify/predicates.d.ts +0 -42
- package/dist/types/plugins/shopify/predicates.d.ts.map +0 -1
- package/dist/user-session-BTaOgTo_.cjs +0 -1
- package/dist/user-session-YEUZkOjt.js +0 -718
|
@@ -1,73 +1,73 @@
|
|
|
1
1
|
import { g as p } from "../../../id-BW-g3y32.js";
|
|
2
|
-
const
|
|
2
|
+
const r = {
|
|
3
3
|
serialize(i) {
|
|
4
4
|
return JSON.stringify(i);
|
|
5
5
|
},
|
|
6
6
|
deserialize(i) {
|
|
7
7
|
return JSON.parse(i);
|
|
8
8
|
}
|
|
9
|
-
},
|
|
9
|
+
}, v = (i) => ({
|
|
10
10
|
name: "create-experience",
|
|
11
|
-
setup: (
|
|
12
|
-
i.experiences.forEach((
|
|
13
|
-
const s =
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
setup: (o) => {
|
|
12
|
+
i.experiences.forEach((d) => {
|
|
13
|
+
const s = d.serialize(), n = r.deserialize(s);
|
|
14
|
+
n.component = d.component, o.registerExperience(n), n.fields.forEach((f) => {
|
|
15
|
+
o.registerField(f);
|
|
16
16
|
});
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
}),
|
|
19
|
+
}), g = (i, o) => ({
|
|
20
20
|
id: p("node"),
|
|
21
21
|
position: [0, 0],
|
|
22
|
-
experience:
|
|
22
|
+
experience: o,
|
|
23
23
|
type: "action",
|
|
24
24
|
action: i.action,
|
|
25
25
|
addNext(s) {
|
|
26
26
|
if (!s.node) throw new Error("Cannot connect to node");
|
|
27
|
-
const
|
|
27
|
+
const n = c(
|
|
28
28
|
{ sourceNode: this, destinationNode: s.node, sourceNodeHandle: null },
|
|
29
|
-
|
|
29
|
+
o
|
|
30
30
|
);
|
|
31
|
-
|
|
31
|
+
o.edges.push(n);
|
|
32
32
|
},
|
|
33
33
|
onSuccess(s) {
|
|
34
34
|
if (!s.node) throw new Error("Cannot connect to node");
|
|
35
|
-
const
|
|
35
|
+
const n = c(
|
|
36
36
|
{ sourceNode: this, destinationNode: s.node, sourceNodeHandle: "true" },
|
|
37
|
-
|
|
37
|
+
o
|
|
38
38
|
);
|
|
39
|
-
|
|
39
|
+
o.edges.push(n);
|
|
40
40
|
},
|
|
41
41
|
onFail(s) {
|
|
42
42
|
if (!s.node) throw new Error("Cannot connect to node");
|
|
43
|
-
const
|
|
43
|
+
const n = c(
|
|
44
44
|
{ sourceNode: this, destinationNode: s.node, sourceNodeHandle: "false" },
|
|
45
|
-
|
|
45
|
+
o
|
|
46
46
|
);
|
|
47
|
-
|
|
47
|
+
o.edges.push(n);
|
|
48
48
|
},
|
|
49
49
|
serialize() {
|
|
50
|
-
return
|
|
50
|
+
return r.serialize({
|
|
51
51
|
id: this.id,
|
|
52
52
|
type: this.type,
|
|
53
53
|
action: this.action,
|
|
54
54
|
position: this.position
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
-
}),
|
|
57
|
+
}), E = (i) => ({
|
|
58
58
|
id: i.id ?? p("step"),
|
|
59
59
|
label: i.label,
|
|
60
60
|
fields: i.fields ?? [],
|
|
61
|
-
addField(
|
|
62
|
-
var s,
|
|
63
|
-
const
|
|
64
|
-
return (s = this.fields) != null && s.includes(
|
|
61
|
+
addField(o) {
|
|
62
|
+
var s, n;
|
|
63
|
+
const d = "serialize" in o ? o : m(o);
|
|
64
|
+
return (s = this.fields) != null && s.includes(d) || (n = this.fields) == null || n.push(d), d;
|
|
65
65
|
}
|
|
66
|
-
}),
|
|
67
|
-
const
|
|
66
|
+
}), y = (i, o) => {
|
|
67
|
+
const d = {
|
|
68
68
|
id: i.id ?? p("step"),
|
|
69
69
|
label: i.label,
|
|
70
|
-
experience:
|
|
70
|
+
experience: o,
|
|
71
71
|
fields: i.fields ?? [],
|
|
72
72
|
node: null,
|
|
73
73
|
nextStep(s) {
|
|
@@ -83,27 +83,27 @@ const a = {
|
|
|
83
83
|
return this.experience.addField(s, this);
|
|
84
84
|
},
|
|
85
85
|
serialize() {
|
|
86
|
-
return
|
|
86
|
+
return r.serialize({
|
|
87
87
|
id: this.id,
|
|
88
88
|
label: this.label,
|
|
89
89
|
fieldIds: this.fields.map((s) => s.id)
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
|
-
return h({ step:
|
|
94
|
-
},
|
|
95
|
-
const
|
|
93
|
+
return h({ step: d, type: "step" }, o), d;
|
|
94
|
+
}, z = () => [0, 0], h = (i, o) => {
|
|
95
|
+
const d = {
|
|
96
96
|
id: p("node"),
|
|
97
|
-
position:
|
|
98
|
-
experience:
|
|
97
|
+
position: z(),
|
|
98
|
+
experience: o
|
|
99
99
|
};
|
|
100
100
|
if (i.type === "step") {
|
|
101
|
-
const
|
|
102
|
-
...
|
|
101
|
+
const n = {
|
|
102
|
+
...d,
|
|
103
103
|
type: "step",
|
|
104
104
|
connectedStep: i.step,
|
|
105
105
|
serialize() {
|
|
106
|
-
return
|
|
106
|
+
return r.serialize({
|
|
107
107
|
id: this.id,
|
|
108
108
|
type: this.type,
|
|
109
109
|
stepId: this.connectedStep.id,
|
|
@@ -112,15 +112,15 @@ const a = {
|
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
114
|
};
|
|
115
|
-
return
|
|
115
|
+
return n.connectedStep.node = n, n;
|
|
116
116
|
}
|
|
117
117
|
if (i.type === "conditional") {
|
|
118
|
-
const
|
|
119
|
-
...
|
|
118
|
+
const n = {
|
|
119
|
+
...d,
|
|
120
120
|
type: "conditional",
|
|
121
121
|
connectedConditional: i.conditional,
|
|
122
122
|
serialize() {
|
|
123
|
-
return
|
|
123
|
+
return r.serialize({
|
|
124
124
|
id: this.id,
|
|
125
125
|
type: this.type,
|
|
126
126
|
conditionalId: this.connectedConditional.id,
|
|
@@ -128,14 +128,14 @@ const a = {
|
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
};
|
|
131
|
-
return
|
|
131
|
+
return n.connectedConditional.node = n, n;
|
|
132
132
|
}
|
|
133
133
|
return i.type === "experience" ? {
|
|
134
|
-
...
|
|
134
|
+
...d,
|
|
135
135
|
type: "experience",
|
|
136
136
|
connectedExperience: i.experience,
|
|
137
137
|
serialize() {
|
|
138
|
-
return
|
|
138
|
+
return r.serialize({
|
|
139
139
|
id: this.id,
|
|
140
140
|
type: this.type,
|
|
141
141
|
experienceId: this.connectedExperience.id,
|
|
@@ -143,64 +143,64 @@ const a = {
|
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
145
|
} : {
|
|
146
|
-
...
|
|
146
|
+
...d,
|
|
147
147
|
type: "origin",
|
|
148
148
|
serialize() {
|
|
149
|
-
return
|
|
149
|
+
return r.serialize({
|
|
150
150
|
id: this.id,
|
|
151
151
|
type: this.type,
|
|
152
152
|
position: this.position
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
|
-
}, c = (i,
|
|
156
|
+
}, c = (i, o) => ({
|
|
157
157
|
id: p("edge"),
|
|
158
158
|
sourceNode: i.sourceNode,
|
|
159
159
|
sourceNodeHandle: i.sourceNodeHandle,
|
|
160
160
|
destinationNode: i.destinationNode,
|
|
161
|
-
experience:
|
|
161
|
+
experience: o,
|
|
162
162
|
serialize() {
|
|
163
|
-
return
|
|
163
|
+
return r.serialize({
|
|
164
164
|
id: this.id,
|
|
165
165
|
sourceNodeHandle: this.sourceNodeHandle ?? void 0,
|
|
166
166
|
sourceNodeId: this.sourceNode.id,
|
|
167
167
|
destinationNodeId: this.destinationNode.id
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
|
-
}),
|
|
171
|
-
const
|
|
170
|
+
}), b = (i, o) => {
|
|
171
|
+
const d = {
|
|
172
172
|
id: p("conditional"),
|
|
173
173
|
condition: i.condition,
|
|
174
174
|
node: null,
|
|
175
|
-
experience:
|
|
175
|
+
experience: o,
|
|
176
176
|
addTrue(s) {
|
|
177
177
|
if (!this.node || !s.node)
|
|
178
178
|
throw new Error("todo no node");
|
|
179
|
-
const
|
|
179
|
+
const n = c(
|
|
180
180
|
{ sourceNode: this.node, destinationNode: s.node, sourceNodeHandle: "true" },
|
|
181
181
|
this.experience
|
|
182
182
|
);
|
|
183
|
-
this.experience.edges.push(
|
|
183
|
+
this.experience.edges.push(n);
|
|
184
184
|
},
|
|
185
185
|
addFalse(s) {
|
|
186
186
|
if (!this.node || !s.node)
|
|
187
187
|
throw new Error("todo no node");
|
|
188
|
-
const
|
|
188
|
+
const n = c(
|
|
189
189
|
{ sourceNode: this.node, destinationNode: s.node, sourceNodeHandle: "false" },
|
|
190
190
|
this.experience
|
|
191
191
|
);
|
|
192
|
-
this.experience.edges.push(
|
|
192
|
+
this.experience.edges.push(n);
|
|
193
193
|
},
|
|
194
194
|
serialize() {
|
|
195
|
-
return
|
|
195
|
+
return r.serialize({
|
|
196
196
|
id: this.id,
|
|
197
197
|
condition: this.condition
|
|
198
198
|
});
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
return h({ conditional:
|
|
202
|
-
},
|
|
203
|
-
var
|
|
201
|
+
return h({ conditional: d, type: "conditional" }, o), d;
|
|
202
|
+
}, m = (i) => {
|
|
203
|
+
var d;
|
|
204
204
|
return {
|
|
205
205
|
id: i.id,
|
|
206
206
|
name: i.name,
|
|
@@ -214,7 +214,7 @@ const a = {
|
|
|
214
214
|
validation: i.validation ?? {},
|
|
215
215
|
condition: i.condition,
|
|
216
216
|
required: i.required,
|
|
217
|
-
options: ((
|
|
217
|
+
options: ((d = i.options) == null ? void 0 : d.map((s) => ({
|
|
218
218
|
...s
|
|
219
219
|
}))) ?? null,
|
|
220
220
|
policies: i.policies,
|
|
@@ -230,7 +230,7 @@ const a = {
|
|
|
230
230
|
validation: this.validation,
|
|
231
231
|
condition: this.condition,
|
|
232
232
|
policies: this.policies
|
|
233
|
-
},
|
|
233
|
+
}, n = typeof this.defaultValue == "string" ? this.defaultValue : void 0, f = typeof this.defaultValue == "number" ? this.defaultValue : void 0, N = typeof this.defaultValue == "boolean" ? this.defaultValue : void 0;
|
|
234
234
|
switch (this.type) {
|
|
235
235
|
case "text":
|
|
236
236
|
if (this.multiple) {
|
|
@@ -241,7 +241,7 @@ const a = {
|
|
|
241
241
|
typeof t == "string" && e.push(t);
|
|
242
242
|
e.length === 0 && (e = void 0);
|
|
243
243
|
}
|
|
244
|
-
return
|
|
244
|
+
return r.serialize({
|
|
245
245
|
...s,
|
|
246
246
|
type: "text",
|
|
247
247
|
multiple: !0,
|
|
@@ -254,11 +254,11 @@ const a = {
|
|
|
254
254
|
})) : null
|
|
255
255
|
});
|
|
256
256
|
}
|
|
257
|
-
return
|
|
257
|
+
return r.serialize({
|
|
258
258
|
...s,
|
|
259
259
|
type: "text",
|
|
260
260
|
multiple: !1,
|
|
261
|
-
defaultValue:
|
|
261
|
+
defaultValue: n,
|
|
262
262
|
options: this.options ? this.options.map((e) => ({
|
|
263
263
|
id: e.id,
|
|
264
264
|
label: e.label,
|
|
@@ -275,7 +275,7 @@ const a = {
|
|
|
275
275
|
typeof t == "number" && e.push(t);
|
|
276
276
|
e.length === 0 && (e = void 0);
|
|
277
277
|
}
|
|
278
|
-
return
|
|
278
|
+
return r.serialize({
|
|
279
279
|
...s,
|
|
280
280
|
type: "number",
|
|
281
281
|
multiple: !0,
|
|
@@ -288,7 +288,7 @@ const a = {
|
|
|
288
288
|
})) : null
|
|
289
289
|
});
|
|
290
290
|
}
|
|
291
|
-
return
|
|
291
|
+
return r.serialize({
|
|
292
292
|
...s,
|
|
293
293
|
type: "number",
|
|
294
294
|
multiple: !1,
|
|
@@ -309,7 +309,7 @@ const a = {
|
|
|
309
309
|
typeof t == "boolean" && e.push(t);
|
|
310
310
|
e.length === 0 && (e = void 0);
|
|
311
311
|
}
|
|
312
|
-
return
|
|
312
|
+
return r.serialize({
|
|
313
313
|
...s,
|
|
314
314
|
type: "boolean",
|
|
315
315
|
multiple: !0,
|
|
@@ -322,11 +322,11 @@ const a = {
|
|
|
322
322
|
})) : null
|
|
323
323
|
});
|
|
324
324
|
}
|
|
325
|
-
return
|
|
325
|
+
return r.serialize({
|
|
326
326
|
...s,
|
|
327
327
|
type: "boolean",
|
|
328
328
|
multiple: !1,
|
|
329
|
-
defaultValue:
|
|
329
|
+
defaultValue: N,
|
|
330
330
|
options: this.options ? this.options.map((e) => ({
|
|
331
331
|
id: e.id,
|
|
332
332
|
label: e.label,
|
|
@@ -357,111 +357,113 @@ const a = {
|
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
359
|
};
|
|
360
|
-
},
|
|
361
|
-
const
|
|
360
|
+
}, V = (i) => {
|
|
361
|
+
const o = [], d = [], s = [], n = [], f = [], N = i.condition ?? i.decide;
|
|
362
362
|
return {
|
|
363
363
|
id: i.id,
|
|
364
364
|
component: i.component,
|
|
365
365
|
name: i.name,
|
|
366
366
|
initializeOpen: i.initializeOpen,
|
|
367
|
+
condition: N,
|
|
367
368
|
decide: i.decide,
|
|
368
369
|
targets: i.targets,
|
|
369
|
-
steps:
|
|
370
|
-
nodes:
|
|
370
|
+
steps: o,
|
|
371
|
+
nodes: d,
|
|
371
372
|
edges: s,
|
|
372
373
|
fields: f,
|
|
373
|
-
conditionals:
|
|
374
|
-
addStep(
|
|
375
|
-
let
|
|
376
|
-
this.nodes.length === 0 && (
|
|
377
|
-
const
|
|
378
|
-
if (
|
|
379
|
-
if (!
|
|
374
|
+
conditionals: n,
|
|
375
|
+
addStep(e, t) {
|
|
376
|
+
let l = t == null ? void 0 : t.node;
|
|
377
|
+
this.nodes.length === 0 && (l = h({ type: "origin" }, this), this.nodes.push(l));
|
|
378
|
+
const a = "serialize" in e ? e : y(e, this);
|
|
379
|
+
if (l) {
|
|
380
|
+
if (!a.node)
|
|
380
381
|
throw new Error("todo no node");
|
|
381
382
|
const u = c(
|
|
382
|
-
{ sourceNode:
|
|
383
|
+
{ sourceNode: l, destinationNode: a.node, sourceNodeHandle: null },
|
|
383
384
|
this
|
|
384
385
|
);
|
|
385
386
|
this.edges.push(u);
|
|
386
387
|
}
|
|
387
|
-
return
|
|
388
|
+
return a.fields.length > 0 && a.fields.forEach((u) => {
|
|
388
389
|
this.fields.includes(u) || this.fields.push(u);
|
|
389
|
-
}), this.steps.includes(
|
|
390
|
+
}), this.steps.includes(a) || (this.steps.push(a), a.node && this.nodes.push(a.node)), a;
|
|
390
391
|
},
|
|
391
|
-
addAction(
|
|
392
|
-
let
|
|
393
|
-
this.nodes.length === 0 && (
|
|
394
|
-
const
|
|
395
|
-
if (
|
|
392
|
+
addAction(e, t) {
|
|
393
|
+
let l = t == null ? void 0 : t.node;
|
|
394
|
+
this.nodes.length === 0 && (l = h({ type: "origin" }, this), this.nodes.push(l));
|
|
395
|
+
const a = "serialize" in e ? e : g(e, this);
|
|
396
|
+
if (l) {
|
|
396
397
|
const u = c(
|
|
397
|
-
{ sourceNode:
|
|
398
|
+
{ sourceNode: l, destinationNode: a, sourceNodeHandle: null },
|
|
398
399
|
this
|
|
399
400
|
);
|
|
400
401
|
this.edges.push(u);
|
|
401
402
|
}
|
|
402
|
-
return this.nodes.push(
|
|
403
|
+
return this.nodes.push(a), a;
|
|
403
404
|
},
|
|
404
|
-
addConditional(
|
|
405
|
-
let
|
|
406
|
-
this.nodes.length === 0 && (
|
|
407
|
-
const
|
|
408
|
-
if (
|
|
409
|
-
if (!
|
|
405
|
+
addConditional(e, t) {
|
|
406
|
+
let l = t == null ? void 0 : t.node;
|
|
407
|
+
this.nodes.length === 0 && (l = h({ type: "origin" }, this), this.nodes.push(l));
|
|
408
|
+
const a = "serialize" in e ? e : b(e, this);
|
|
409
|
+
if (l) {
|
|
410
|
+
if (!a.node)
|
|
410
411
|
throw new Error("todo no node");
|
|
411
412
|
const u = c(
|
|
412
|
-
{ sourceNode:
|
|
413
|
+
{ sourceNode: l, destinationNode: a.node, sourceNodeHandle: null },
|
|
413
414
|
this
|
|
414
415
|
);
|
|
415
416
|
this.edges.push(u);
|
|
416
417
|
}
|
|
417
|
-
return this.conditionals.includes(
|
|
418
|
+
return this.conditionals.includes(a) || (this.conditionals.push(a), a.node && this.nodes.push(a.node)), a;
|
|
418
419
|
},
|
|
419
|
-
addExperience(
|
|
420
|
-
let
|
|
421
|
-
this.nodes.length === 0 && (
|
|
422
|
-
const
|
|
423
|
-
{ type: "experience", experience:
|
|
420
|
+
addExperience(e, t) {
|
|
421
|
+
let l = t == null ? void 0 : t.node;
|
|
422
|
+
this.nodes.length === 0 && (l = h({ type: "origin" }, this), this.nodes.push(l));
|
|
423
|
+
const a = h(
|
|
424
|
+
{ type: "experience", experience: e },
|
|
424
425
|
this
|
|
425
426
|
);
|
|
426
|
-
if (this.nodes.push(
|
|
427
|
+
if (this.nodes.push(a), l) {
|
|
427
428
|
const u = c(
|
|
428
|
-
{ sourceNode:
|
|
429
|
+
{ sourceNode: l, destinationNode: a, sourceNodeHandle: null },
|
|
429
430
|
this
|
|
430
431
|
);
|
|
431
432
|
this.edges.push(u);
|
|
432
433
|
}
|
|
433
|
-
return
|
|
434
|
+
return e;
|
|
434
435
|
},
|
|
435
|
-
addField(
|
|
436
|
-
const
|
|
437
|
-
return
|
|
436
|
+
addField(e, t) {
|
|
437
|
+
const l = "serialize" in e ? e : m(e);
|
|
438
|
+
return t && t.fields.push(l), this.fields.includes(l) || this.fields.push(l), l;
|
|
438
439
|
},
|
|
439
440
|
serialize() {
|
|
440
|
-
return
|
|
441
|
+
return r.serialize({
|
|
441
442
|
id: this.id,
|
|
442
443
|
component: this.component,
|
|
443
444
|
name: this.name,
|
|
444
445
|
initializeOpen: this.initializeOpen,
|
|
446
|
+
condition: this.condition ?? this.decide,
|
|
445
447
|
decide: this.decide,
|
|
446
448
|
targets: this.targets,
|
|
447
|
-
steps: this.steps.map((
|
|
448
|
-
nodes: this.nodes.map((
|
|
449
|
-
edges: this.edges.map((
|
|
449
|
+
steps: this.steps.map((e) => r.deserialize(e.serialize())),
|
|
450
|
+
nodes: this.nodes.map((e) => r.deserialize(e.serialize())),
|
|
451
|
+
edges: this.edges.map((e) => r.deserialize(e.serialize())),
|
|
450
452
|
conditionals: this.conditionals.map(
|
|
451
|
-
(
|
|
453
|
+
(e) => r.deserialize(e.serialize())
|
|
452
454
|
),
|
|
453
|
-
fields: this.fields.map((
|
|
455
|
+
fields: this.fields.map((e) => r.deserialize(e.serialize()))
|
|
454
456
|
});
|
|
455
457
|
}
|
|
456
458
|
};
|
|
457
459
|
};
|
|
458
460
|
export {
|
|
459
|
-
|
|
461
|
+
b as createConditional,
|
|
460
462
|
c as createEdge,
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
463
|
+
V as createExperience,
|
|
464
|
+
v as createExperiencePlugin,
|
|
465
|
+
m as createField,
|
|
464
466
|
h as createNode,
|
|
465
|
-
|
|
466
|
-
|
|
467
|
+
E as createStep,
|
|
468
|
+
r as serialization
|
|
467
469
|
};
|
|
@@ -16,7 +16,7 @@ const y = ({
|
|
|
16
16
|
});
|
|
17
17
|
i({
|
|
18
18
|
source: n.eventBus,
|
|
19
|
-
filter: (e) => e.type === "
|
|
19
|
+
filter: (e) => e.type === "experience_initialize" && "experienceInstance" in e,
|
|
20
20
|
// @ts-ignore todo
|
|
21
21
|
fn: (e) => e.experienceInstance,
|
|
22
22
|
target: p
|
|
@@ -4,19 +4,19 @@ const a = l("history", "global"), f = ({
|
|
|
4
4
|
storage: i = "local"
|
|
5
5
|
} = {}) => ({
|
|
6
6
|
name: "history-browser-storage-plugin",
|
|
7
|
-
setup: (
|
|
8
|
-
const
|
|
9
|
-
const t =
|
|
10
|
-
t &&
|
|
7
|
+
setup: (o) => {
|
|
8
|
+
const e = i === "local" ? y : g, n = s(async () => {
|
|
9
|
+
const t = e.get(a).json();
|
|
10
|
+
t && o.history.restore({ entries: t });
|
|
11
11
|
}), c = s(async (t) => {
|
|
12
|
-
|
|
12
|
+
e.set(a, t);
|
|
13
13
|
});
|
|
14
14
|
r({
|
|
15
|
-
source:
|
|
16
|
-
filter: (t) => t.type === "
|
|
15
|
+
source: o.eventBus,
|
|
16
|
+
filter: (t) => t.type === "load",
|
|
17
17
|
target: n
|
|
18
18
|
}), r({
|
|
19
|
-
source:
|
|
19
|
+
source: o.history.entriesStore,
|
|
20
20
|
target: c
|
|
21
21
|
});
|
|
22
22
|
}
|
|
@@ -1,42 +1,41 @@
|
|
|
1
|
-
import { createEffect as
|
|
2
|
-
import { c as
|
|
3
|
-
const p =
|
|
4
|
-
|
|
5
|
-
return Object.entries(n).forEach(([t, a]) => {
|
|
6
|
-
var r;
|
|
7
|
-
const s = e.find((i) => i.id === t);
|
|
8
|
-
!((r = s == null ? void 0 : s.policies) != null && r.doNotStoreValue) && (o[t] = a);
|
|
9
|
-
}), o;
|
|
10
|
-
}, h = ({
|
|
11
|
-
storage: n = "local"
|
|
1
|
+
import { createEffect as d, attach as m, sample as l } from "effector";
|
|
2
|
+
import { c as b, l as h, s as E } from "../../../storage-Cb_71y48.js";
|
|
3
|
+
const p = b("responses", "global"), y = ({
|
|
4
|
+
storage: i = "local"
|
|
12
5
|
} = {}) => ({
|
|
13
6
|
name: "responses-browser-storage-plugin",
|
|
14
7
|
setup: (e) => {
|
|
15
|
-
const
|
|
16
|
-
const s =
|
|
8
|
+
const n = i === "local" ? h : E, u = d(async () => {
|
|
9
|
+
const s = n.get(p).json();
|
|
17
10
|
if (!s)
|
|
18
11
|
return null;
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
Object.entries(s).forEach(([r, o]) => {
|
|
13
|
+
e.responses.register(r, o);
|
|
14
|
+
});
|
|
15
|
+
}), f = m({
|
|
21
16
|
source: {
|
|
22
17
|
responses: e.responses.getAllStore,
|
|
23
18
|
fields: e.fields.listStore
|
|
24
19
|
},
|
|
25
|
-
effect: ({ responses: s, fields:
|
|
26
|
-
const
|
|
27
|
-
|
|
20
|
+
effect: ({ responses: s, fields: r }) => {
|
|
21
|
+
const o = {};
|
|
22
|
+
Object.entries(s).forEach(([a, g]) => {
|
|
23
|
+
var c;
|
|
24
|
+
const t = r.find((S) => S.id === a);
|
|
25
|
+
!((c = t == null ? void 0 : t.policies) != null && c.doNotStoreValue) && (o[a] = g);
|
|
26
|
+
}), n.set(p, o);
|
|
28
27
|
}
|
|
29
28
|
});
|
|
30
|
-
|
|
29
|
+
l({
|
|
31
30
|
source: e.eventBus,
|
|
32
|
-
filter: (s) => s.type === "
|
|
33
|
-
target:
|
|
34
|
-
}),
|
|
31
|
+
filter: (s) => s.type === "load",
|
|
32
|
+
target: u
|
|
33
|
+
}), l({
|
|
35
34
|
source: e.responses.getAllStore,
|
|
36
|
-
target:
|
|
35
|
+
target: f
|
|
37
36
|
});
|
|
38
37
|
}
|
|
39
38
|
});
|
|
40
39
|
export {
|
|
41
|
-
|
|
40
|
+
y as responsesBrowserStoragePlugin
|
|
42
41
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as f, G as c,
|
|
1
|
+
import { a as f, G as c, f as m } from "../../../supports-BjhuLJ8z.js";
|
|
2
2
|
import { p as a } from "../../../object-JwZ58NOH.js";
|
|
3
3
|
const o = c;
|
|
4
4
|
let s;
|
|
5
|
-
const
|
|
5
|
+
const d = (r) => ({
|
|
6
6
|
name: "single-page-app",
|
|
7
7
|
setup: (n) => {
|
|
8
8
|
r.instrumentHistory && f() && h(() => {
|
|
@@ -33,5 +33,5 @@ function h(r) {
|
|
|
33
33
|
a(o.history, "pushState", n), a(o.history, "replaceState", n);
|
|
34
34
|
}
|
|
35
35
|
export {
|
|
36
|
-
|
|
36
|
+
d as singlePageAppPlugin
|
|
37
37
|
};
|