@picked/client 0.0.1-dev.1756875690387 → 0.0.1-dev.1762908210565
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 -0
- package/dist/cjs/plugins/history-browser-storage/index.js +1 -0
- package/dist/cjs/plugins/responses-browser-storage/index.js +1 -0
- package/dist/cjs/plugins/{responses-indexeddb-plugin → responses-indexeddb}/index.js +1 -1
- package/dist/cjs/plugins/shopify/index.js +1 -1
- package/dist/cjs/plugins/single-page-app/index.js +1 -1
- package/dist/cjs/plugins/web-components/index.js +1 -0
- package/dist/cjs/plugins/window-object/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/esm/index.js +555 -443
- package/dist/esm/plugins/create-experience/index.js +172 -103
- package/dist/esm/plugins/experience-browser-storage/index.js +39 -0
- package/dist/esm/plugins/{history-browserstorage-plugin → history-browser-storage}/index.js +2 -2
- package/dist/esm/plugins/responses-browser-storage/index.js +41 -0
- package/dist/esm/plugins/{responses-indexeddb-plugin → responses-indexeddb}/index.js +24 -21
- package/dist/esm/plugins/shopify/index.js +38 -28
- package/dist/esm/plugins/single-page-app/index.js +3 -3
- package/dist/esm/plugins/web-components/index.js +21 -0
- package/dist/esm/plugins/window-object/index.js +1 -1
- package/dist/esm/server/index.js +1 -1
- package/dist/experience-instance-CF6m7G83.cjs +1 -0
- package/dist/experience-instance-CKru5var.js +781 -0
- package/dist/storage-Cb_71y48.js +94 -0
- package/dist/storage-DuRlyFaY.cjs +1 -0
- package/dist/{supports-BvrzQAVk.js → supports-BjhuLJ8z.js} +27 -11
- package/dist/supports-YvpQZxbh.cjs +1 -0
- package/dist/types/client.d.ts +26 -0
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/entities/action/action.d.ts +15 -0
- package/dist/types/entities/action/action.d.ts.map +1 -0
- package/dist/types/entities/experience/experience.d.ts +19 -6
- package/dist/types/entities/experience/experience.d.ts.map +1 -1
- package/dist/types/entities/experience-instance/experience-instance.d.ts +13 -10
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/entities/feature/feature.d.ts +5 -2
- package/dist/types/entities/feature/feature.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/history/history.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 +28 -10
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts +48 -13
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/dist/types/plugins/experience-browser-storage/index.d.ts.map +1 -0
- package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +1 -0
- package/dist/types/plugins/history-browser-storage/index.d.ts.map +1 -0
- package/dist/types/plugins/history-browser-storage/plugin.d.ts.map +1 -0
- package/dist/types/plugins/responses-browser-storage/index.d.ts.map +1 -0
- package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +1 -0
- package/dist/types/plugins/responses-indexeddb/index.d.ts.map +1 -0
- package/dist/types/plugins/responses-indexeddb/plugin.d.ts.map +1 -0
- package/dist/types/plugins/shopify/plugin.d.ts.map +1 -1
- package/dist/types/plugins/shopify/utils.d.ts +21 -0
- package/dist/types/plugins/shopify/utils.d.ts.map +1 -0
- package/dist/types/plugins/web-components/index.d.ts +2 -0
- package/dist/types/plugins/web-components/index.d.ts.map +1 -0
- package/dist/types/plugins/web-components/plugin.d.ts +3 -0
- package/dist/types/plugins/web-components/plugin.d.ts.map +1 -0
- package/dist/types/utils/dom.d.ts +5 -5
- package/dist/types/utils/dom.d.ts.map +1 -1
- package/dist/types/utils/events.d.ts +29 -24
- package/dist/types/utils/events.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/dist/types/utils/nodes.d.ts +2 -1
- package/dist/types/utils/nodes.d.ts.map +1 -1
- package/dist/types/utils/storage.d.ts +3 -0
- package/dist/types/utils/storage.d.ts.map +1 -1
- package/dist/types/utils/supports.d.ts +2 -0
- package/dist/types/utils/supports.d.ts.map +1 -1
- package/dist/types/utils/user-session.d.ts +5 -0
- package/dist/types/utils/user-session.d.ts.map +1 -0
- package/package.json +32 -26
- package/dist/cjs/plugins/experience-browserstorage-plugin/index.js +0 -1
- package/dist/cjs/plugins/history-browserstorage-plugin/index.js +0 -1
- package/dist/cjs/plugins/responses-browserstorage-plugin/index.js +0 -1
- package/dist/esm/plugins/experience-browserstorage-plugin/index.js +0 -38
- package/dist/esm/plugins/responses-browserstorage-plugin/index.js +0 -36
- package/dist/experience-instance-6ZKZS7dF.cjs +0 -1
- package/dist/experience-instance-BA0EXYg5.js +0 -712
- package/dist/storage-BPJwmlva.cjs +0 -1
- package/dist/storage-D87xFySf.js +0 -85
- package/dist/supports-C0y3-V5V.cjs +0 -1
- package/dist/types/plugins/experience-browserstorage-plugin/index.d.ts.map +0 -1
- package/dist/types/plugins/experience-browserstorage-plugin/plugin.d.ts.map +0 -1
- package/dist/types/plugins/history-browserstorage-plugin/index.d.ts.map +0 -1
- package/dist/types/plugins/history-browserstorage-plugin/plugin.d.ts.map +0 -1
- package/dist/types/plugins/responses-browserstorage-plugin/index.d.ts.map +0 -1
- package/dist/types/plugins/responses-browserstorage-plugin/plugin.d.ts.map +0 -1
- package/dist/types/plugins/responses-indexeddb-plugin/index.d.ts.map +0 -1
- package/dist/types/plugins/responses-indexeddb-plugin/plugin.d.ts.map +0 -1
- /package/dist/types/plugins/{experience-browserstorage-plugin → experience-browser-storage}/index.d.ts +0 -0
- /package/dist/types/plugins/{experience-browserstorage-plugin → experience-browser-storage}/plugin.d.ts +0 -0
- /package/dist/types/plugins/{history-browserstorage-plugin → history-browser-storage}/index.d.ts +0 -0
- /package/dist/types/plugins/{history-browserstorage-plugin → history-browser-storage}/plugin.d.ts +0 -0
- /package/dist/types/plugins/{responses-browserstorage-plugin → responses-browser-storage}/index.d.ts +0 -0
- /package/dist/types/plugins/{responses-browserstorage-plugin → responses-browser-storage}/plugin.d.ts +0 -0
- /package/dist/types/plugins/{responses-indexeddb-plugin → responses-indexeddb}/index.d.ts +0 -0
- /package/dist/types/plugins/{responses-indexeddb-plugin → responses-indexeddb}/plugin.d.ts +0 -0
|
@@ -1,27 +1,74 @@
|
|
|
1
|
-
import { g as
|
|
2
|
-
const
|
|
1
|
+
import { g as p } from "../../../id-BW-g3y32.js";
|
|
2
|
+
const a = {
|
|
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
|
+
}, x = (i) => ({
|
|
10
10
|
name: "create-experience",
|
|
11
|
-
setup: (
|
|
12
|
-
i.experiences.forEach((
|
|
13
|
-
const s =
|
|
14
|
-
o.component =
|
|
15
|
-
|
|
11
|
+
setup: (d) => {
|
|
12
|
+
i.experiences.forEach((l) => {
|
|
13
|
+
const s = l.serialize(), o = a.deserialize(s);
|
|
14
|
+
o.component = l.component, d.registerExperience(o), o.fields.forEach((f) => {
|
|
15
|
+
d.registerField(f);
|
|
16
16
|
});
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
}), m = (i,
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
}), m = (i, d) => ({
|
|
20
|
+
id: p("node"),
|
|
21
|
+
position: [0, 0],
|
|
22
|
+
experience: d,
|
|
23
|
+
type: "action",
|
|
24
|
+
action: i.action,
|
|
25
|
+
addNext(s) {
|
|
26
|
+
if (!s.node) throw new Error("Cannot connect to node");
|
|
27
|
+
const o = c(
|
|
28
|
+
{ sourceNode: this, destinationNode: s.node, sourceNodeHandle: null },
|
|
29
|
+
d
|
|
30
|
+
);
|
|
31
|
+
d.edges.push(o);
|
|
32
|
+
},
|
|
33
|
+
onSuccess(s) {
|
|
34
|
+
if (!s.node) throw new Error("Cannot connect to node");
|
|
35
|
+
const o = c(
|
|
36
|
+
{ sourceNode: this, destinationNode: s.node, sourceNodeHandle: "true" },
|
|
37
|
+
d
|
|
38
|
+
);
|
|
39
|
+
d.edges.push(o);
|
|
40
|
+
},
|
|
41
|
+
onFail(s) {
|
|
42
|
+
if (!s.node) throw new Error("Cannot connect to node");
|
|
43
|
+
const o = c(
|
|
44
|
+
{ sourceNode: this, destinationNode: s.node, sourceNodeHandle: "false" },
|
|
45
|
+
d
|
|
46
|
+
);
|
|
47
|
+
d.edges.push(o);
|
|
48
|
+
},
|
|
49
|
+
serialize() {
|
|
50
|
+
return a.serialize({
|
|
51
|
+
id: this.id,
|
|
52
|
+
type: this.type,
|
|
53
|
+
action: this.action,
|
|
54
|
+
position: this.position
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}), v = (i) => ({
|
|
58
|
+
id: i.id ?? p("step"),
|
|
59
|
+
label: i.label,
|
|
60
|
+
fields: i.fields ?? [],
|
|
61
|
+
addField(d) {
|
|
62
|
+
var s, o;
|
|
63
|
+
const l = "serialize" in d ? d : N(d);
|
|
64
|
+
return (s = this.fields) != null && s.includes(l) || (o = this.fields) == null || o.push(l), l;
|
|
65
|
+
}
|
|
66
|
+
}), g = (i, d) => {
|
|
67
|
+
const l = {
|
|
68
|
+
id: i.id ?? p("step"),
|
|
22
69
|
label: i.label,
|
|
23
|
-
experience:
|
|
24
|
-
fields: [],
|
|
70
|
+
experience: d,
|
|
71
|
+
fields: i.fields ?? [],
|
|
25
72
|
node: null,
|
|
26
73
|
nextStep(s) {
|
|
27
74
|
return this.experience.addStep(s, this);
|
|
@@ -36,27 +83,27 @@ const l = {
|
|
|
36
83
|
return this.experience.addField(s, this);
|
|
37
84
|
},
|
|
38
85
|
serialize() {
|
|
39
|
-
return
|
|
86
|
+
return a.serialize({
|
|
40
87
|
id: this.id,
|
|
41
88
|
label: this.label,
|
|
42
89
|
fieldIds: this.fields.map((s) => s.id)
|
|
43
90
|
});
|
|
44
91
|
}
|
|
45
92
|
};
|
|
46
|
-
return
|
|
47
|
-
}, y = () => [0, 0],
|
|
48
|
-
const
|
|
49
|
-
id:
|
|
93
|
+
return h({ step: l, type: "step" }, d), l;
|
|
94
|
+
}, y = () => [0, 0], h = (i, d) => {
|
|
95
|
+
const l = {
|
|
96
|
+
id: p("node"),
|
|
50
97
|
position: y(),
|
|
51
|
-
experience:
|
|
98
|
+
experience: d
|
|
52
99
|
};
|
|
53
100
|
if (i.type === "step") {
|
|
54
101
|
const o = {
|
|
55
|
-
...
|
|
102
|
+
...l,
|
|
56
103
|
type: "step",
|
|
57
104
|
connectedStep: i.step,
|
|
58
105
|
serialize() {
|
|
59
|
-
return
|
|
106
|
+
return a.serialize({
|
|
60
107
|
id: this.id,
|
|
61
108
|
type: this.type,
|
|
62
109
|
stepId: this.connectedStep.id,
|
|
@@ -69,11 +116,11 @@ const l = {
|
|
|
69
116
|
}
|
|
70
117
|
if (i.type === "conditional") {
|
|
71
118
|
const o = {
|
|
72
|
-
...
|
|
119
|
+
...l,
|
|
73
120
|
type: "conditional",
|
|
74
121
|
connectedConditional: i.conditional,
|
|
75
122
|
serialize() {
|
|
76
|
-
return
|
|
123
|
+
return a.serialize({
|
|
77
124
|
id: this.id,
|
|
78
125
|
type: this.type,
|
|
79
126
|
conditionalId: this.connectedConditional.id,
|
|
@@ -84,11 +131,11 @@ const l = {
|
|
|
84
131
|
return o.connectedConditional.node = o, o;
|
|
85
132
|
}
|
|
86
133
|
return i.type === "experience" ? {
|
|
87
|
-
...
|
|
134
|
+
...l,
|
|
88
135
|
type: "experience",
|
|
89
136
|
connectedExperience: i.experience,
|
|
90
137
|
serialize() {
|
|
91
|
-
return
|
|
138
|
+
return a.serialize({
|
|
92
139
|
id: this.id,
|
|
93
140
|
type: this.type,
|
|
94
141
|
experienceId: this.connectedExperience.id,
|
|
@@ -96,40 +143,40 @@ const l = {
|
|
|
96
143
|
});
|
|
97
144
|
}
|
|
98
145
|
} : {
|
|
99
|
-
...
|
|
146
|
+
...l,
|
|
100
147
|
type: "origin",
|
|
101
148
|
serialize() {
|
|
102
|
-
return
|
|
149
|
+
return a.serialize({
|
|
103
150
|
id: this.id,
|
|
104
151
|
type: this.type,
|
|
105
152
|
position: this.position
|
|
106
153
|
});
|
|
107
154
|
}
|
|
108
155
|
};
|
|
109
|
-
},
|
|
110
|
-
id:
|
|
156
|
+
}, c = (i, d) => ({
|
|
157
|
+
id: p("edge"),
|
|
111
158
|
sourceNode: i.sourceNode,
|
|
112
159
|
sourceNodeHandle: i.sourceNodeHandle,
|
|
113
160
|
destinationNode: i.destinationNode,
|
|
114
|
-
experience:
|
|
161
|
+
experience: d,
|
|
115
162
|
serialize() {
|
|
116
|
-
return
|
|
163
|
+
return a.serialize({
|
|
117
164
|
id: this.id,
|
|
118
165
|
sourceNodeHandle: this.sourceNodeHandle ?? void 0,
|
|
119
166
|
sourceNodeId: this.sourceNode.id,
|
|
120
167
|
destinationNodeId: this.destinationNode.id
|
|
121
168
|
});
|
|
122
169
|
}
|
|
123
|
-
}),
|
|
124
|
-
const
|
|
125
|
-
id:
|
|
170
|
+
}), z = (i, d) => {
|
|
171
|
+
const l = {
|
|
172
|
+
id: p("conditional"),
|
|
126
173
|
condition: i.condition,
|
|
127
174
|
node: null,
|
|
128
|
-
experience:
|
|
175
|
+
experience: d,
|
|
129
176
|
addTrue(s) {
|
|
130
177
|
if (!this.node || !s.node)
|
|
131
178
|
throw new Error("todo no node");
|
|
132
|
-
const o =
|
|
179
|
+
const o = c(
|
|
133
180
|
{ sourceNode: this.node, destinationNode: s.node, sourceNodeHandle: "true" },
|
|
134
181
|
this.experience
|
|
135
182
|
);
|
|
@@ -138,38 +185,38 @@ const l = {
|
|
|
138
185
|
addFalse(s) {
|
|
139
186
|
if (!this.node || !s.node)
|
|
140
187
|
throw new Error("todo no node");
|
|
141
|
-
const o =
|
|
188
|
+
const o = c(
|
|
142
189
|
{ sourceNode: this.node, destinationNode: s.node, sourceNodeHandle: "false" },
|
|
143
190
|
this.experience
|
|
144
191
|
);
|
|
145
192
|
this.experience.edges.push(o);
|
|
146
193
|
},
|
|
147
194
|
serialize() {
|
|
148
|
-
return
|
|
195
|
+
return a.serialize({
|
|
149
196
|
id: this.id,
|
|
150
197
|
condition: this.condition
|
|
151
198
|
});
|
|
152
199
|
}
|
|
153
200
|
};
|
|
154
|
-
return
|
|
155
|
-
},
|
|
156
|
-
var
|
|
201
|
+
return h({ conditional: l, type: "conditional" }, d), l;
|
|
202
|
+
}, N = (i) => {
|
|
203
|
+
var l;
|
|
157
204
|
return {
|
|
158
|
-
id:
|
|
205
|
+
id: i.id,
|
|
159
206
|
name: i.name,
|
|
160
207
|
type: i.type,
|
|
161
208
|
label: i.label,
|
|
162
209
|
placeholder: i.placeholder,
|
|
163
210
|
description: i.description,
|
|
164
211
|
helpText: i.helpText,
|
|
165
|
-
defaultValue: i.defaultValue,
|
|
212
|
+
defaultValue: i.defaultValue ?? null,
|
|
166
213
|
multiple: i.multiple,
|
|
167
|
-
validation: i.validation,
|
|
214
|
+
validation: i.validation ?? {},
|
|
215
|
+
condition: i.condition,
|
|
168
216
|
required: i.required,
|
|
169
|
-
options: ((
|
|
170
|
-
...s
|
|
171
|
-
|
|
172
|
-
}))) || null,
|
|
217
|
+
options: ((l = i.options) == null ? void 0 : l.map((s) => ({
|
|
218
|
+
...s
|
|
219
|
+
}))) ?? null,
|
|
173
220
|
policies: i.policies,
|
|
174
221
|
serialize() {
|
|
175
222
|
const s = {
|
|
@@ -181,19 +228,20 @@ const l = {
|
|
|
181
228
|
description: this.description,
|
|
182
229
|
helpText: this.helpText,
|
|
183
230
|
validation: this.validation,
|
|
231
|
+
condition: this.condition,
|
|
184
232
|
policies: this.policies
|
|
185
|
-
}, o = typeof this.defaultValue == "string" ? this.defaultValue :
|
|
233
|
+
}, o = 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;
|
|
186
234
|
switch (this.type) {
|
|
187
235
|
case "text":
|
|
188
236
|
if (this.multiple) {
|
|
189
|
-
let e
|
|
237
|
+
let e;
|
|
190
238
|
if (Array.isArray(this.defaultValue)) {
|
|
191
239
|
e = [];
|
|
192
240
|
for (const t of this.defaultValue)
|
|
193
241
|
typeof t == "string" && e.push(t);
|
|
194
|
-
e.length === 0 && (e =
|
|
242
|
+
e.length === 0 && (e = void 0);
|
|
195
243
|
}
|
|
196
|
-
return
|
|
244
|
+
return a.serialize({
|
|
197
245
|
...s,
|
|
198
246
|
type: "text",
|
|
199
247
|
multiple: !0,
|
|
@@ -201,11 +249,12 @@ const l = {
|
|
|
201
249
|
options: this.options ? this.options.map((t) => ({
|
|
202
250
|
id: t.id,
|
|
203
251
|
label: t.label,
|
|
204
|
-
value: `${t.value}
|
|
252
|
+
value: `${t.value}`,
|
|
253
|
+
condition: t.condition
|
|
205
254
|
})) : null
|
|
206
255
|
});
|
|
207
256
|
}
|
|
208
|
-
return
|
|
257
|
+
return a.serialize({
|
|
209
258
|
...s,
|
|
210
259
|
type: "text",
|
|
211
260
|
multiple: !1,
|
|
@@ -213,19 +262,20 @@ const l = {
|
|
|
213
262
|
options: this.options ? this.options.map((e) => ({
|
|
214
263
|
id: e.id,
|
|
215
264
|
label: e.label,
|
|
216
|
-
value: `${e.value}
|
|
265
|
+
value: `${e.value}`,
|
|
266
|
+
condition: e.condition
|
|
217
267
|
})) : null
|
|
218
268
|
});
|
|
219
269
|
case "number":
|
|
220
270
|
if (this.multiple) {
|
|
221
|
-
let e
|
|
271
|
+
let e;
|
|
222
272
|
if (Array.isArray(this.defaultValue)) {
|
|
223
273
|
e = [];
|
|
224
274
|
for (const t of this.defaultValue)
|
|
225
275
|
typeof t == "number" && e.push(t);
|
|
226
|
-
e.length === 0 && (e =
|
|
276
|
+
e.length === 0 && (e = void 0);
|
|
227
277
|
}
|
|
228
|
-
return
|
|
278
|
+
return a.serialize({
|
|
229
279
|
...s,
|
|
230
280
|
type: "number",
|
|
231
281
|
multiple: !0,
|
|
@@ -233,31 +283,33 @@ const l = {
|
|
|
233
283
|
options: this.options ? this.options.map((t) => ({
|
|
234
284
|
id: t.id,
|
|
235
285
|
label: t.label,
|
|
236
|
-
value: Number(t.value)
|
|
286
|
+
value: Number(t.value),
|
|
287
|
+
condition: t.condition
|
|
237
288
|
})) : null
|
|
238
289
|
});
|
|
239
290
|
}
|
|
240
|
-
return
|
|
291
|
+
return a.serialize({
|
|
241
292
|
...s,
|
|
242
293
|
type: "number",
|
|
243
294
|
multiple: !1,
|
|
244
|
-
defaultValue:
|
|
295
|
+
defaultValue: f,
|
|
245
296
|
options: this.options ? this.options.map((e) => ({
|
|
246
297
|
id: e.id,
|
|
247
298
|
label: e.label,
|
|
248
|
-
value: Number(e.value)
|
|
299
|
+
value: Number(e.value),
|
|
300
|
+
condition: e.condition
|
|
249
301
|
})) : null
|
|
250
302
|
});
|
|
251
303
|
case "boolean":
|
|
252
304
|
if (this.multiple) {
|
|
253
|
-
let e
|
|
305
|
+
let e;
|
|
254
306
|
if (Array.isArray(this.defaultValue)) {
|
|
255
307
|
e = [];
|
|
256
308
|
for (const t of this.defaultValue)
|
|
257
309
|
typeof t == "boolean" && e.push(t);
|
|
258
|
-
e.length === 0 && (e =
|
|
310
|
+
e.length === 0 && (e = void 0);
|
|
259
311
|
}
|
|
260
|
-
return
|
|
312
|
+
return a.serialize({
|
|
261
313
|
...s,
|
|
262
314
|
type: "boolean",
|
|
263
315
|
multiple: !0,
|
|
@@ -265,11 +317,12 @@ const l = {
|
|
|
265
317
|
options: this.options ? this.options.map((t) => ({
|
|
266
318
|
id: t.id,
|
|
267
319
|
label: t.label,
|
|
268
|
-
value: !!t.value
|
|
320
|
+
value: !!t.value,
|
|
321
|
+
condition: t.condition
|
|
269
322
|
})) : null
|
|
270
323
|
});
|
|
271
324
|
}
|
|
272
|
-
return
|
|
325
|
+
return a.serialize({
|
|
273
326
|
...s,
|
|
274
327
|
type: "boolean",
|
|
275
328
|
multiple: !1,
|
|
@@ -277,7 +330,8 @@ const l = {
|
|
|
277
330
|
options: this.options ? this.options.map((e) => ({
|
|
278
331
|
id: e.id,
|
|
279
332
|
label: e.label,
|
|
280
|
-
value: !!e.value
|
|
333
|
+
value: !!e.value,
|
|
334
|
+
condition: e.condition
|
|
281
335
|
})) : null
|
|
282
336
|
});
|
|
283
337
|
// todo: support for object type fields
|
|
@@ -303,96 +357,111 @@ const l = {
|
|
|
303
357
|
}
|
|
304
358
|
}
|
|
305
359
|
};
|
|
306
|
-
},
|
|
307
|
-
const
|
|
360
|
+
}, E = (i) => {
|
|
361
|
+
const d = [], l = [], s = [], o = [], f = [];
|
|
308
362
|
return {
|
|
309
363
|
id: i.id,
|
|
310
364
|
component: i.component,
|
|
311
|
-
type: i.type,
|
|
312
365
|
name: i.name,
|
|
366
|
+
initializeOpen: i.initializeOpen,
|
|
313
367
|
decide: i.decide,
|
|
314
368
|
targets: i.targets,
|
|
315
|
-
steps:
|
|
316
|
-
nodes:
|
|
369
|
+
steps: d,
|
|
370
|
+
nodes: l,
|
|
317
371
|
edges: s,
|
|
318
|
-
fields:
|
|
372
|
+
fields: f,
|
|
319
373
|
conditionals: o,
|
|
320
374
|
addStep(n, e) {
|
|
321
375
|
let t = e == null ? void 0 : e.node;
|
|
322
|
-
this.nodes.length === 0 && (t =
|
|
323
|
-
const r = "serialize" in n ? n :
|
|
376
|
+
this.nodes.length === 0 && (t = h({ type: "origin" }, this), this.nodes.push(t));
|
|
377
|
+
const r = "serialize" in n ? n : g(n, this);
|
|
324
378
|
if (t) {
|
|
325
379
|
if (!r.node)
|
|
326
380
|
throw new Error("todo no node");
|
|
327
|
-
const
|
|
381
|
+
const u = c(
|
|
328
382
|
{ sourceNode: t, destinationNode: r.node, sourceNodeHandle: null },
|
|
329
383
|
this
|
|
330
384
|
);
|
|
331
|
-
this.edges.push(
|
|
385
|
+
this.edges.push(u);
|
|
386
|
+
}
|
|
387
|
+
return r.fields.length > 0 && r.fields.forEach((u) => {
|
|
388
|
+
this.fields.includes(u) || this.fields.push(u);
|
|
389
|
+
}), this.steps.includes(r) || (this.steps.push(r), r.node && this.nodes.push(r.node)), r;
|
|
390
|
+
},
|
|
391
|
+
addAction(n, e) {
|
|
392
|
+
let t = e == null ? void 0 : e.node;
|
|
393
|
+
this.nodes.length === 0 && (t = h({ type: "origin" }, this), this.nodes.push(t));
|
|
394
|
+
const r = "serialize" in n ? n : m(n, this);
|
|
395
|
+
if (t) {
|
|
396
|
+
const u = c(
|
|
397
|
+
{ sourceNode: t, destinationNode: r, sourceNodeHandle: null },
|
|
398
|
+
this
|
|
399
|
+
);
|
|
400
|
+
this.edges.push(u);
|
|
332
401
|
}
|
|
333
|
-
return this.
|
|
402
|
+
return this.nodes.push(r), r;
|
|
334
403
|
},
|
|
335
404
|
addConditional(n, e) {
|
|
336
405
|
let t = e == null ? void 0 : e.node;
|
|
337
|
-
this.nodes.length === 0 && (t =
|
|
338
|
-
const r = "serialize" in n ? n :
|
|
406
|
+
this.nodes.length === 0 && (t = h({ type: "origin" }, this), this.nodes.push(t));
|
|
407
|
+
const r = "serialize" in n ? n : z(n, this);
|
|
339
408
|
if (t) {
|
|
340
409
|
if (!r.node)
|
|
341
410
|
throw new Error("todo no node");
|
|
342
|
-
const
|
|
411
|
+
const u = c(
|
|
343
412
|
{ sourceNode: t, destinationNode: r.node, sourceNodeHandle: null },
|
|
344
413
|
this
|
|
345
414
|
);
|
|
346
|
-
this.edges.push(
|
|
415
|
+
this.edges.push(u);
|
|
347
416
|
}
|
|
348
417
|
return this.conditionals.includes(r) || (this.conditionals.push(r), r.node && this.nodes.push(r.node)), r;
|
|
349
418
|
},
|
|
350
419
|
addExperience(n, e) {
|
|
351
420
|
let t = e == null ? void 0 : e.node;
|
|
352
|
-
this.nodes.length === 0 && (t =
|
|
353
|
-
const r =
|
|
421
|
+
this.nodes.length === 0 && (t = h({ type: "origin" }, this), this.nodes.push(t));
|
|
422
|
+
const r = h(
|
|
354
423
|
{ type: "experience", experience: n },
|
|
355
424
|
this
|
|
356
425
|
);
|
|
357
426
|
if (this.nodes.push(r), t) {
|
|
358
|
-
const
|
|
427
|
+
const u = c(
|
|
359
428
|
{ sourceNode: t, destinationNode: r, sourceNodeHandle: null },
|
|
360
429
|
this
|
|
361
430
|
);
|
|
362
|
-
this.edges.push(
|
|
431
|
+
this.edges.push(u);
|
|
363
432
|
}
|
|
364
433
|
return n;
|
|
365
434
|
},
|
|
366
435
|
addField(n, e) {
|
|
367
|
-
const t = "serialize" in n ? n :
|
|
436
|
+
const t = "serialize" in n ? n : N(n);
|
|
368
437
|
return e && e.fields.push(t), this.fields.includes(t) || this.fields.push(t), t;
|
|
369
438
|
},
|
|
370
439
|
serialize() {
|
|
371
|
-
return
|
|
440
|
+
return a.serialize({
|
|
372
441
|
id: this.id,
|
|
373
|
-
type: this.type,
|
|
374
442
|
component: this.component,
|
|
375
443
|
name: this.name,
|
|
444
|
+
initializeOpen: this.initializeOpen,
|
|
376
445
|
decide: this.decide,
|
|
377
446
|
targets: this.targets,
|
|
378
|
-
steps: this.steps.map((n) =>
|
|
379
|
-
nodes: this.nodes.map((n) =>
|
|
380
|
-
edges: this.edges.map((n) =>
|
|
447
|
+
steps: this.steps.map((n) => a.deserialize(n.serialize())),
|
|
448
|
+
nodes: this.nodes.map((n) => a.deserialize(n.serialize())),
|
|
449
|
+
edges: this.edges.map((n) => a.deserialize(n.serialize())),
|
|
381
450
|
conditionals: this.conditionals.map(
|
|
382
|
-
(n) =>
|
|
451
|
+
(n) => a.deserialize(n.serialize())
|
|
383
452
|
),
|
|
384
|
-
fields: this.fields.map((n) =>
|
|
453
|
+
fields: this.fields.map((n) => a.deserialize(n.serialize()))
|
|
385
454
|
});
|
|
386
455
|
}
|
|
387
456
|
};
|
|
388
457
|
};
|
|
389
458
|
export {
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
459
|
+
z as createConditional,
|
|
460
|
+
c as createEdge,
|
|
461
|
+
E as createExperience,
|
|
462
|
+
x as createExperiencePlugin,
|
|
463
|
+
N as createField,
|
|
464
|
+
h as createNode,
|
|
465
|
+
v as createStep,
|
|
466
|
+
a as serialization
|
|
398
467
|
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { createEffect as r, sample as i } from "effector";
|
|
2
|
+
import { c, l as g, s as S } from "../../../storage-Cb_71y48.js";
|
|
3
|
+
import { l as f } from "../../../logger-C9a75KZn.js";
|
|
4
|
+
const y = ({
|
|
5
|
+
storage: a = "local"
|
|
6
|
+
} = {}) => ({
|
|
7
|
+
name: "experience-browser-storage-plugin",
|
|
8
|
+
setup: (n) => {
|
|
9
|
+
const o = a === "local" ? g : S, p = r(async (e) => {
|
|
10
|
+
if (!e) {
|
|
11
|
+
f("warn", "No experience instance provided to loadExperienceVisiblityFx.");
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const t = c("open-close", "experience", e), s = o.get(t).boolean();
|
|
15
|
+
e.setOpen(s ?? e.isOpenStore.getState());
|
|
16
|
+
});
|
|
17
|
+
i({
|
|
18
|
+
source: n.eventBus,
|
|
19
|
+
filter: (e) => e.type === "experience_initialized" && "experienceInstance" in e,
|
|
20
|
+
// @ts-ignore todo
|
|
21
|
+
fn: (e) => e.experienceInstance,
|
|
22
|
+
target: p
|
|
23
|
+
});
|
|
24
|
+
const l = r(async (e) => {
|
|
25
|
+
const t = c("open-close", "experience", e), s = e.isOpenStore.getState();
|
|
26
|
+
o.set(t, s);
|
|
27
|
+
}), x = (e) => i({
|
|
28
|
+
source: e.isOpenStore,
|
|
29
|
+
fn: () => e,
|
|
30
|
+
target: l
|
|
31
|
+
});
|
|
32
|
+
n.experienceInstances.listStore.watch((e) => {
|
|
33
|
+
e.forEach((t) => x(t));
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
export {
|
|
38
|
+
y as experienceBrowserStoragePlugin
|
|
39
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createEffect as s, sample as r } from "effector";
|
|
2
|
-
import { c as l, l as y, s as g } from "../../../storage-
|
|
2
|
+
import { c as l, l as y, s as g } from "../../../storage-Cb_71y48.js";
|
|
3
3
|
const a = l("history", "global"), f = ({
|
|
4
4
|
storage: i = "local"
|
|
5
5
|
} = {}) => ({
|
|
6
|
-
name: "history-
|
|
6
|
+
name: "history-browser-storage-plugin",
|
|
7
7
|
setup: (e) => {
|
|
8
8
|
const o = i === "local" ? y : g, n = s(async () => {
|
|
9
9
|
const t = o.get(a).json();
|
|
@@ -0,0 +1,41 @@
|
|
|
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"
|
|
5
|
+
} = {}) => ({
|
|
6
|
+
name: "responses-browser-storage-plugin",
|
|
7
|
+
setup: (e) => {
|
|
8
|
+
const n = i === "local" ? h : E, u = d(async () => {
|
|
9
|
+
const s = n.get(p).json();
|
|
10
|
+
if (!s)
|
|
11
|
+
return null;
|
|
12
|
+
Object.entries(s).forEach(([t, o]) => {
|
|
13
|
+
e.responses.register(t, o);
|
|
14
|
+
});
|
|
15
|
+
}), f = m({
|
|
16
|
+
source: {
|
|
17
|
+
responses: e.responses.getAllStore,
|
|
18
|
+
fields: e.fields.listStore
|
|
19
|
+
},
|
|
20
|
+
effect: ({ responses: s, fields: t }) => {
|
|
21
|
+
const o = {};
|
|
22
|
+
Object.entries(s).forEach(([a, g]) => {
|
|
23
|
+
var c;
|
|
24
|
+
const r = t.find((S) => S.id === a);
|
|
25
|
+
!((c = r == null ? void 0 : r.policies) != null && c.doNotStoreValue) && (o[a] = g);
|
|
26
|
+
}), n.set(p, o);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
l({
|
|
30
|
+
source: e.eventBus,
|
|
31
|
+
filter: (s) => s.type === "initialized",
|
|
32
|
+
target: u
|
|
33
|
+
}), l({
|
|
34
|
+
source: e.responses.getAllStore,
|
|
35
|
+
target: f
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
export {
|
|
40
|
+
y as responsesBrowserStoragePlugin
|
|
41
|
+
};
|