@picked/client 0.0.1-dev.1774244905386 → 0.0.1-dev.1774912386475
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/{api-dkMxUUe0.cjs → api-B-wGEgt8.cjs} +1 -1
- package/dist/{api-ENA5t36y.js → api-DwERBrAZ.js} +1 -1
- package/dist/cjs/form/index.js +1 -0
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/plugins/create-experience/index.js +1 -1
- package/dist/cjs/plugins/dynamic-experiences/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/plugins/single-page-app/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/esm/form/index.js +472 -0
- package/dist/esm/index.js +351 -369
- package/dist/esm/plugins/create-experience/index.js +218 -221
- package/dist/esm/plugins/dynamic-experiences/index.js +6 -7
- package/dist/esm/plugins/experience-browser-storage/index.js +1 -1
- package/dist/esm/plugins/history-browser-storage/index.js +1 -1
- package/dist/esm/plugins/responses-browser-storage/index.js +48 -21
- package/dist/esm/plugins/responses-indexeddb/index.js +5 -9
- package/dist/esm/plugins/single-page-app/index.js +4 -4
- package/dist/esm/server/index.js +1 -1
- package/dist/experience-instance-CwwrKUI8.js +485 -0
- package/dist/experience-instance-DdFUcVRd.cjs +1 -0
- package/dist/{object-Clj5zVr1.js → object-C82v79xc.js} +2 -1
- package/dist/object-CUJOjanb.cjs +1 -0
- package/dist/rules-logic-BIkBWZmf.js +233 -0
- package/dist/rules-logic-DDxCiq4P.cjs +1 -0
- package/dist/{storage-DyxpJ0pg.js → storage-6Xk0uAxB.js} +3 -1
- package/dist/storage-B6lQtc4-.cjs +1 -0
- package/dist/types/entities/action/action.d.ts.map +1 -1
- package/dist/types/entities/experience/experience.d.ts +33 -5
- package/dist/types/entities/experience/experience.d.ts.map +1 -1
- package/dist/types/entities/experience-instance/experience-instance.d.ts +19 -0
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/entities/feature/feature.d.ts.map +1 -1
- package/dist/types/entities/field/field.d.ts +19 -13
- 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/response/response-validation.d.ts +76 -0
- package/dist/types/entities/response/response-validation.d.ts.map +1 -0
- package/dist/types/entities/response/response.d.ts +17 -13
- package/dist/types/entities/response/response.d.ts.map +1 -1
- package/dist/types/entities/step/step.d.ts +1 -3
- package/dist/types/entities/step/step.d.ts.map +1 -1
- package/dist/types/form/build-responses.d.ts +17 -0
- package/dist/types/form/build-responses.d.ts.map +1 -0
- package/dist/types/form/create-field-evaluator.d.ts +27 -0
- package/dist/types/form/create-field-evaluator.d.ts.map +1 -0
- package/dist/types/form/create-field-validation.d.ts +59 -0
- package/dist/types/form/create-field-validation.d.ts.map +1 -0
- package/dist/types/form/create-form.d.ts +97 -0
- package/dist/types/form/create-form.d.ts.map +1 -0
- package/dist/types/form/create-submit-pipeline.d.ts +70 -0
- package/dist/types/form/create-submit-pipeline.d.ts.map +1 -0
- package/dist/types/form/get-step-fields.d.ts +18 -0
- package/dist/types/form/get-step-fields.d.ts.map +1 -0
- package/dist/types/form/index.d.ts +10 -0
- package/dist/types/form/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/logic-engine.d.ts +12 -10
- package/dist/types/logic-engine.d.ts.map +1 -1
- package/dist/types/picked.d.ts +38 -11
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts +22 -32
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/plugin.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/serialization.d.ts +7 -0
- package/dist/types/plugins/create-experience/serialization.d.ts.map +1 -0
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/types.d.ts +11 -17
- package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -1
- package/dist/types/plugins/experience-browser-storage/plugin.d.ts +2 -1
- package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/plugins/history-browser-storage/plugin.d.ts +1 -0
- package/dist/types/plugins/history-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/plugins/responses-browser-storage/plugin.d.ts +2 -1
- package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/plugins/responses-indexeddb/plugin.d.ts.map +1 -1
- package/dist/types/plugins/single-page-app/plugin.d.ts +1 -1
- package/dist/types/plugins/single-page-app/plugin.d.ts.map +1 -1
- package/dist/types/utils/dom.d.ts +0 -3
- package/dist/types/utils/dom.d.ts.map +1 -1
- package/dist/types/utils/events.d.ts +1 -1
- package/dist/types/utils/events.d.ts.map +1 -1
- package/dist/types/utils/global-obj.d.ts +0 -1
- package/dist/types/utils/global-obj.d.ts.map +1 -1
- package/dist/types/utils/indexed-db.d.ts +2 -1
- package/dist/types/utils/indexed-db.d.ts.map +1 -1
- package/dist/types/utils/logger.d.ts.map +1 -1
- package/dist/types/utils/node-tree/get-next-node-from-condition.d.ts +3 -0
- package/dist/types/utils/node-tree/get-next-node-from-condition.d.ts.map +1 -0
- package/dist/types/utils/node-tree/min-max-steps-to-leaf.d.ts.map +1 -1
- package/dist/types/utils/node-tree/min-max-steps-to-origin.d.ts.map +1 -1
- package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts +8 -4
- package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts.map +1 -1
- package/dist/types/utils/nodes.d.ts +58 -9
- package/dist/types/utils/nodes.d.ts.map +1 -1
- package/dist/types/utils/object.d.ts +0 -8
- package/dist/types/utils/object.d.ts.map +1 -1
- package/dist/types/utils/picked-config.d.ts +1 -1
- package/dist/types/utils/picked-config.d.ts.map +1 -1
- package/dist/types/utils/rules-logic.d.ts +31 -0
- package/dist/types/utils/rules-logic.d.ts.map +1 -1
- package/dist/types/utils/search-params.d.ts.map +1 -1
- package/dist/types/utils/storage.d.ts.map +1 -1
- package/package.json +42 -6
- package/dist/experience-instance-BODAwa-_.js +0 -713
- package/dist/experience-instance-DImQh64e.cjs +0 -1
- package/dist/object-BReQiaSS.cjs +0 -1
- package/dist/storage-BFjb8azI.cjs +0 -1
- package/dist/types/entities/project/project.d.ts +0 -9
- package/dist/types/entities/project/project.d.ts.map +0 -1
- package/dist/types/utils/key.d.ts +0 -12
- package/dist/types/utils/key.d.ts.map +0 -1
- package/dist/types/utils/node-tree/get-next-node-from-conditional.d.ts +0 -3
- package/dist/types/utils/node-tree/get-next-node-from-conditional.d.ts.map +0 -1
- /package/dist/{id-CIbS4P60.cjs → id-Bv44ilEo.cjs} +0 -0
- /package/dist/{id-BniPxOdF.js → id-CRqy981z.js} +0 -0
|
@@ -1,42 +1,41 @@
|
|
|
1
|
-
import "../../../
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { t as e } from "../../../id-CRqy981z.js";
|
|
2
|
+
//#region src/plugins/create-experience/serialization.ts
|
|
3
|
+
var t = {
|
|
4
|
+
serialize(e) {
|
|
5
|
+
return JSON.stringify(e);
|
|
6
|
+
},
|
|
7
|
+
deserialize(e) {
|
|
8
|
+
return JSON.parse(e);
|
|
9
|
+
}
|
|
10
|
+
}, n = (e) => ({
|
|
5
11
|
name: "create-experience",
|
|
6
|
-
setup: (
|
|
12
|
+
setup: (n) => {
|
|
7
13
|
e.experiences.forEach((e) => {
|
|
8
|
-
e.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
let r = e.serialize(), i = t.deserialize(r);
|
|
15
|
+
i.component = e.component;
|
|
16
|
+
let { steps: a, conditions: o, fields: s, ...c } = i;
|
|
17
|
+
n.registerExperience(c), s.forEach((e) => {
|
|
18
|
+
n.registerField(e);
|
|
19
|
+
}), a.forEach((e) => {
|
|
20
|
+
n.registerStep(e);
|
|
21
|
+
}), o.forEach((e) => {
|
|
22
|
+
n.registerCondition(e);
|
|
14
23
|
});
|
|
15
|
-
let n = JSON.parse(e.serialize());
|
|
16
|
-
n.component = e.component, t.registerExperience(n);
|
|
17
24
|
});
|
|
18
25
|
}
|
|
19
|
-
})
|
|
20
|
-
//#endregion
|
|
21
|
-
//#region src/utils/key.ts
|
|
22
|
-
function n(e) {
|
|
23
|
-
return e.toLowerCase().replaceAll(/[^a-z0-9\s-]/g, "").trim().replaceAll(/\s+/g, "-");
|
|
24
|
-
}
|
|
25
|
-
//#endregion
|
|
26
|
-
//#region src/plugins/create-experience/create-experience.ts
|
|
27
|
-
var r = (t, n) => ({
|
|
26
|
+
}), r = (n, r) => ({
|
|
28
27
|
id: e("node"),
|
|
29
|
-
experience:
|
|
28
|
+
experience: r,
|
|
30
29
|
type: "action",
|
|
31
|
-
action:
|
|
30
|
+
action: n.action,
|
|
32
31
|
addNext(e) {
|
|
33
32
|
if (!e.node) throw Error("Cannot connect to node");
|
|
34
33
|
let t = s({
|
|
35
34
|
sourceNode: this,
|
|
36
35
|
destinationNode: e.node,
|
|
37
36
|
sourceNodeHandle: null
|
|
38
|
-
},
|
|
39
|
-
|
|
37
|
+
}, r);
|
|
38
|
+
r.edges.push(t);
|
|
40
39
|
},
|
|
41
40
|
onSuccess(e) {
|
|
42
41
|
if (!e.node) throw Error("Cannot connect to node");
|
|
@@ -44,8 +43,8 @@ var r = (t, n) => ({
|
|
|
44
43
|
sourceNode: this,
|
|
45
44
|
destinationNode: e.node,
|
|
46
45
|
sourceNodeHandle: "true"
|
|
47
|
-
},
|
|
48
|
-
|
|
46
|
+
}, r);
|
|
47
|
+
r.edges.push(t);
|
|
49
48
|
},
|
|
50
49
|
onFail(e) {
|
|
51
50
|
if (!e.node) throw Error("Cannot connect to node");
|
|
@@ -53,37 +52,37 @@ var r = (t, n) => ({
|
|
|
53
52
|
sourceNode: this,
|
|
54
53
|
destinationNode: e.node,
|
|
55
54
|
sourceNodeHandle: "false"
|
|
56
|
-
},
|
|
57
|
-
|
|
55
|
+
}, r);
|
|
56
|
+
r.edges.push(t);
|
|
58
57
|
},
|
|
59
58
|
serialize() {
|
|
60
|
-
return
|
|
59
|
+
return t.serialize({
|
|
61
60
|
id: this.id,
|
|
62
61
|
type: this.type,
|
|
63
62
|
action: this.action
|
|
64
63
|
});
|
|
65
64
|
}
|
|
66
65
|
}), i = (t) => {
|
|
67
|
-
let
|
|
66
|
+
let n = t.name, r = t.id ?? e("step");
|
|
68
67
|
return {
|
|
69
|
-
id:
|
|
70
|
-
name:
|
|
71
|
-
key:
|
|
72
|
-
label:
|
|
68
|
+
id: r,
|
|
69
|
+
name: n,
|
|
70
|
+
key: t.key ?? r,
|
|
71
|
+
label: n,
|
|
73
72
|
fields: t.fields ?? [],
|
|
74
73
|
addField(e) {
|
|
75
74
|
let t = "serialize" in e ? e : l(e);
|
|
76
75
|
return this.fields.includes(t) || this.fields.push(t), t;
|
|
77
76
|
}
|
|
78
77
|
};
|
|
79
|
-
}, a = (
|
|
80
|
-
let i =
|
|
81
|
-
id:
|
|
78
|
+
}, a = (n, r) => {
|
|
79
|
+
let i = n.name, a = n.id ?? e("step"), s = {
|
|
80
|
+
id: a,
|
|
82
81
|
name: i,
|
|
83
|
-
key: a,
|
|
82
|
+
key: n.key ?? a,
|
|
84
83
|
label: i,
|
|
85
84
|
experience: r,
|
|
86
|
-
fields:
|
|
85
|
+
fields: n.fields ?? [],
|
|
87
86
|
node: null,
|
|
88
87
|
nextStep(e) {
|
|
89
88
|
return this.experience.addStep(e, this);
|
|
@@ -101,12 +100,11 @@ var r = (t, n) => ({
|
|
|
101
100
|
return this.experience.addField(e, this);
|
|
102
101
|
},
|
|
103
102
|
serialize() {
|
|
104
|
-
return
|
|
103
|
+
return t.serialize({
|
|
105
104
|
id: this.id,
|
|
106
|
-
name: this.name,
|
|
107
105
|
key: this.key,
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
name: this.name,
|
|
107
|
+
label: this.label,
|
|
110
108
|
fieldIds: this.fields.map((e) => e.id)
|
|
111
109
|
});
|
|
112
110
|
}
|
|
@@ -115,36 +113,35 @@ var r = (t, n) => ({
|
|
|
115
113
|
step: s,
|
|
116
114
|
type: "step"
|
|
117
115
|
}, r), s;
|
|
118
|
-
}, o = (
|
|
119
|
-
let
|
|
116
|
+
}, o = (n, r) => {
|
|
117
|
+
let i = {
|
|
120
118
|
id: e("node"),
|
|
121
|
-
experience:
|
|
119
|
+
experience: r
|
|
122
120
|
};
|
|
123
|
-
if (
|
|
121
|
+
if (n.type === "step") {
|
|
124
122
|
let e = {
|
|
125
|
-
...
|
|
123
|
+
...i,
|
|
126
124
|
type: "step",
|
|
127
|
-
connectedStep:
|
|
125
|
+
connectedStep: n.step,
|
|
128
126
|
serialize() {
|
|
129
|
-
return
|
|
127
|
+
return t.serialize({
|
|
130
128
|
id: this.id,
|
|
131
129
|
type: this.type,
|
|
132
|
-
|
|
133
|
-
stepId: this.connectedStep.key,
|
|
130
|
+
stepId: this.connectedStep.id,
|
|
134
131
|
name: this.connectedStep.name,
|
|
135
|
-
label: this.connectedStep.
|
|
132
|
+
label: this.connectedStep.label
|
|
136
133
|
});
|
|
137
134
|
}
|
|
138
135
|
};
|
|
139
136
|
return e.connectedStep.node = e, e;
|
|
140
137
|
}
|
|
141
|
-
if (
|
|
138
|
+
if (n.type === "condition") {
|
|
142
139
|
let e = {
|
|
143
|
-
...
|
|
140
|
+
...i,
|
|
144
141
|
type: "condition",
|
|
145
|
-
connectedCondition:
|
|
142
|
+
connectedCondition: n.condition,
|
|
146
143
|
serialize() {
|
|
147
|
-
return
|
|
144
|
+
return t.serialize({
|
|
148
145
|
id: this.id,
|
|
149
146
|
type: this.type,
|
|
150
147
|
conditionId: this.connectedCondition.id
|
|
@@ -153,48 +150,48 @@ var r = (t, n) => ({
|
|
|
153
150
|
};
|
|
154
151
|
return e.connectedCondition.node = e, e;
|
|
155
152
|
}
|
|
156
|
-
return
|
|
157
|
-
...
|
|
153
|
+
return n.type === "experience" ? {
|
|
154
|
+
...i,
|
|
158
155
|
type: "experience",
|
|
159
|
-
connectedExperience:
|
|
156
|
+
connectedExperience: n.experience,
|
|
160
157
|
serialize() {
|
|
161
|
-
return
|
|
158
|
+
return t.serialize({
|
|
162
159
|
id: this.id,
|
|
163
160
|
type: this.type,
|
|
164
161
|
experienceId: this.connectedExperience.id
|
|
165
162
|
});
|
|
166
163
|
}
|
|
167
164
|
} : {
|
|
168
|
-
...
|
|
165
|
+
...i,
|
|
169
166
|
type: "origin",
|
|
170
167
|
serialize() {
|
|
171
|
-
return
|
|
168
|
+
return t.serialize({
|
|
172
169
|
id: this.id,
|
|
173
170
|
type: this.type
|
|
174
171
|
});
|
|
175
172
|
}
|
|
176
173
|
};
|
|
177
|
-
}, s = (
|
|
174
|
+
}, s = (n, r) => ({
|
|
178
175
|
id: e("edge"),
|
|
179
|
-
sourceNode:
|
|
180
|
-
sourceNodeHandle:
|
|
181
|
-
destinationNode:
|
|
182
|
-
experience:
|
|
176
|
+
sourceNode: n.sourceNode,
|
|
177
|
+
sourceNodeHandle: n.sourceNodeHandle,
|
|
178
|
+
destinationNode: n.destinationNode,
|
|
179
|
+
experience: r,
|
|
183
180
|
serialize() {
|
|
184
|
-
return
|
|
181
|
+
return t.serialize({
|
|
185
182
|
id: this.id,
|
|
186
183
|
sourceNodeHandle: this.sourceNodeHandle ?? void 0,
|
|
187
184
|
sourceNodeId: this.sourceNode.id,
|
|
188
185
|
destinationNodeId: this.destinationNode.id
|
|
189
186
|
});
|
|
190
187
|
}
|
|
191
|
-
}), c = (
|
|
192
|
-
let i = e("conditional"), a =
|
|
188
|
+
}), c = (n, r) => {
|
|
189
|
+
let i = e("conditional"), a = n.name ?? n.label ?? i, c = {
|
|
193
190
|
id: i,
|
|
194
|
-
key:
|
|
191
|
+
key: n.key ?? i,
|
|
195
192
|
name: a,
|
|
196
|
-
label:
|
|
197
|
-
logic:
|
|
193
|
+
label: n.label,
|
|
194
|
+
logic: n.condition,
|
|
198
195
|
node: null,
|
|
199
196
|
experience: r,
|
|
200
197
|
addTrue(e) {
|
|
@@ -216,7 +213,7 @@ var r = (t, n) => ({
|
|
|
216
213
|
this.experience.edges.push(t);
|
|
217
214
|
},
|
|
218
215
|
serialize() {
|
|
219
|
-
return
|
|
216
|
+
return t.serialize({
|
|
220
217
|
id: this.id,
|
|
221
218
|
key: this.key,
|
|
222
219
|
name: this.name,
|
|
@@ -228,27 +225,27 @@ var r = (t, n) => ({
|
|
|
228
225
|
condition: c,
|
|
229
226
|
type: "condition"
|
|
230
227
|
}, r), c;
|
|
231
|
-
}, l = (
|
|
232
|
-
let r =
|
|
233
|
-
return
|
|
234
|
-
id:
|
|
235
|
-
key: r,
|
|
236
|
-
name:
|
|
237
|
-
type:
|
|
238
|
-
label:
|
|
239
|
-
placeholder:
|
|
240
|
-
description:
|
|
241
|
-
helpText:
|
|
242
|
-
defaultValue:
|
|
243
|
-
multiple:
|
|
244
|
-
validation:
|
|
245
|
-
condition:
|
|
246
|
-
required:
|
|
247
|
-
options:
|
|
228
|
+
}, l = (n) => {
|
|
229
|
+
let r = n.id ?? e("field");
|
|
230
|
+
return {
|
|
231
|
+
id: r,
|
|
232
|
+
key: n.key ?? r,
|
|
233
|
+
name: n.name,
|
|
234
|
+
type: n.type,
|
|
235
|
+
label: n.label,
|
|
236
|
+
placeholder: n.placeholder,
|
|
237
|
+
description: n.description,
|
|
238
|
+
helpText: n.helpText,
|
|
239
|
+
defaultValue: n.defaultValue ?? null,
|
|
240
|
+
multiple: n.multiple,
|
|
241
|
+
validation: n.validation ?? {},
|
|
242
|
+
condition: n.condition,
|
|
243
|
+
required: n.required,
|
|
244
|
+
options: n.options?.map((t) => ({
|
|
248
245
|
id: "id" in t ? t.id : e("option"),
|
|
249
246
|
...t
|
|
250
247
|
})) ?? null,
|
|
251
|
-
policies:
|
|
248
|
+
policies: n.policies,
|
|
252
249
|
serialize() {
|
|
253
250
|
let e = {
|
|
254
251
|
id: this.id,
|
|
@@ -262,21 +259,21 @@ var r = (t, n) => ({
|
|
|
262
259
|
validation: this.validation,
|
|
263
260
|
condition: this.condition,
|
|
264
261
|
policies: this.policies
|
|
265
|
-
},
|
|
262
|
+
}, n = typeof this.defaultValue == "string" ? this.defaultValue : void 0, r = typeof this.defaultValue == "number" ? this.defaultValue : void 0, i = typeof this.defaultValue == "boolean" ? this.defaultValue : void 0;
|
|
266
263
|
switch (this.type) {
|
|
267
264
|
case "text":
|
|
268
265
|
if (this.multiple) {
|
|
269
|
-
let
|
|
266
|
+
let n;
|
|
270
267
|
if (Array.isArray(this.defaultValue)) {
|
|
271
|
-
|
|
272
|
-
for (let e of this.defaultValue) typeof e == "string" &&
|
|
273
|
-
|
|
268
|
+
n = [];
|
|
269
|
+
for (let e of this.defaultValue) typeof e == "string" && n.push(e);
|
|
270
|
+
n.length === 0 && (n = void 0);
|
|
274
271
|
}
|
|
275
|
-
return
|
|
272
|
+
return t.serialize({
|
|
276
273
|
...e,
|
|
277
274
|
type: "text",
|
|
278
275
|
multiple: !0,
|
|
279
|
-
defaultValue:
|
|
276
|
+
defaultValue: n,
|
|
280
277
|
options: this.options ? this.options.map((e) => ({
|
|
281
278
|
id: e.id,
|
|
282
279
|
label: e.label,
|
|
@@ -285,11 +282,11 @@ var r = (t, n) => ({
|
|
|
285
282
|
})) : null
|
|
286
283
|
});
|
|
287
284
|
}
|
|
288
|
-
return
|
|
285
|
+
return t.serialize({
|
|
289
286
|
...e,
|
|
290
287
|
type: "text",
|
|
291
288
|
multiple: !1,
|
|
292
|
-
defaultValue:
|
|
289
|
+
defaultValue: n,
|
|
293
290
|
options: this.options ? this.options.map((e) => ({
|
|
294
291
|
id: e.id,
|
|
295
292
|
label: e.label,
|
|
@@ -299,17 +296,17 @@ var r = (t, n) => ({
|
|
|
299
296
|
});
|
|
300
297
|
case "number":
|
|
301
298
|
if (this.multiple) {
|
|
302
|
-
let
|
|
299
|
+
let n;
|
|
303
300
|
if (Array.isArray(this.defaultValue)) {
|
|
304
|
-
|
|
305
|
-
for (let e of this.defaultValue) typeof e == "number" &&
|
|
306
|
-
|
|
301
|
+
n = [];
|
|
302
|
+
for (let e of this.defaultValue) typeof e == "number" && n.push(e);
|
|
303
|
+
n.length === 0 && (n = void 0);
|
|
307
304
|
}
|
|
308
|
-
return
|
|
305
|
+
return t.serialize({
|
|
309
306
|
...e,
|
|
310
307
|
type: "number",
|
|
311
308
|
multiple: !0,
|
|
312
|
-
defaultValue:
|
|
309
|
+
defaultValue: n,
|
|
313
310
|
options: this.options ? this.options.map((e) => ({
|
|
314
311
|
id: e.id,
|
|
315
312
|
label: e.label,
|
|
@@ -318,11 +315,11 @@ var r = (t, n) => ({
|
|
|
318
315
|
})) : null
|
|
319
316
|
});
|
|
320
317
|
}
|
|
321
|
-
return
|
|
318
|
+
return t.serialize({
|
|
322
319
|
...e,
|
|
323
320
|
type: "number",
|
|
324
321
|
multiple: !1,
|
|
325
|
-
defaultValue:
|
|
322
|
+
defaultValue: r,
|
|
326
323
|
options: this.options ? this.options.map((e) => ({
|
|
327
324
|
id: e.id,
|
|
328
325
|
label: e.label,
|
|
@@ -332,17 +329,17 @@ var r = (t, n) => ({
|
|
|
332
329
|
});
|
|
333
330
|
case "boolean":
|
|
334
331
|
if (this.multiple) {
|
|
335
|
-
let
|
|
332
|
+
let n;
|
|
336
333
|
if (Array.isArray(this.defaultValue)) {
|
|
337
|
-
|
|
338
|
-
for (let e of this.defaultValue) typeof e == "boolean" &&
|
|
339
|
-
|
|
334
|
+
n = [];
|
|
335
|
+
for (let e of this.defaultValue) typeof e == "boolean" && n.push(e);
|
|
336
|
+
n.length === 0 && (n = void 0);
|
|
340
337
|
}
|
|
341
|
-
return
|
|
338
|
+
return t.serialize({
|
|
342
339
|
...e,
|
|
343
340
|
type: "boolean",
|
|
344
341
|
multiple: !0,
|
|
345
|
-
defaultValue:
|
|
342
|
+
defaultValue: n,
|
|
346
343
|
options: this.options ? this.options.map((e) => ({
|
|
347
344
|
id: e.id,
|
|
348
345
|
label: e.label,
|
|
@@ -351,11 +348,11 @@ var r = (t, n) => ({
|
|
|
351
348
|
})) : null
|
|
352
349
|
});
|
|
353
350
|
}
|
|
354
|
-
return
|
|
351
|
+
return t.serialize({
|
|
355
352
|
...e,
|
|
356
353
|
type: "boolean",
|
|
357
354
|
multiple: !1,
|
|
358
|
-
defaultValue:
|
|
355
|
+
defaultValue: i,
|
|
359
356
|
options: this.options ? this.options.map((e) => ({
|
|
360
357
|
id: e.id,
|
|
361
358
|
label: e.label,
|
|
@@ -363,7 +360,7 @@ var r = (t, n) => ({
|
|
|
363
360
|
condition: e.condition
|
|
364
361
|
})) : null
|
|
365
362
|
});
|
|
366
|
-
case "object": return this.multiple ?
|
|
363
|
+
case "object": return this.multiple ? t.serialize({
|
|
367
364
|
...e,
|
|
368
365
|
type: "object",
|
|
369
366
|
multiple: !0,
|
|
@@ -375,7 +372,7 @@ var r = (t, n) => ({
|
|
|
375
372
|
value: e.value,
|
|
376
373
|
condition: e.condition
|
|
377
374
|
})) : null
|
|
378
|
-
}) :
|
|
375
|
+
}) : t.serialize({
|
|
379
376
|
...e,
|
|
380
377
|
type: "object",
|
|
381
378
|
multiple: !1,
|
|
@@ -392,105 +389,105 @@ var r = (t, n) => ({
|
|
|
392
389
|
}
|
|
393
390
|
}
|
|
394
391
|
};
|
|
395
|
-
}, u = (e) => {
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
destinationNode: r.node,
|
|
419
|
-
sourceNodeHandle: null
|
|
420
|
-
}, this);
|
|
421
|
-
this.edges.push(e);
|
|
422
|
-
}
|
|
423
|
-
return r.fields.length > 0 && r.fields.forEach((e) => {
|
|
424
|
-
this.fields.includes(e) || this.fields.push(e);
|
|
425
|
-
}), this.steps.includes(r) || (this.steps.push(r), r.node && this.nodes.push(r.node)), r;
|
|
426
|
-
},
|
|
427
|
-
addAction(e, t) {
|
|
428
|
-
let n = t?.node;
|
|
429
|
-
this.nodes.length === 0 && (n = o({ type: "origin" }, this), this.nodes.push(n));
|
|
430
|
-
let i = "serialize" in e ? e : r(e, this);
|
|
431
|
-
if (n) {
|
|
432
|
-
let e = s({
|
|
433
|
-
sourceNode: n,
|
|
434
|
-
destinationNode: i,
|
|
435
|
-
sourceNodeHandle: null
|
|
436
|
-
}, this);
|
|
437
|
-
this.edges.push(e);
|
|
438
|
-
}
|
|
439
|
-
return this.nodes.push(i), i;
|
|
440
|
-
},
|
|
441
|
-
addCondition(e, t) {
|
|
442
|
-
let n = t?.node;
|
|
443
|
-
this.nodes.length === 0 && (n = o({ type: "origin" }, this), this.nodes.push(n));
|
|
444
|
-
let r = "serialize" in e ? e : c(e, this);
|
|
445
|
-
if (n) {
|
|
446
|
-
if (!r.node) throw Error("todo no node");
|
|
447
|
-
let e = s({
|
|
448
|
-
sourceNode: n,
|
|
449
|
-
destinationNode: r.node,
|
|
450
|
-
sourceNodeHandle: null
|
|
451
|
-
}, this);
|
|
452
|
-
this.edges.push(e);
|
|
453
|
-
}
|
|
454
|
-
return this.conditions.includes(r) || (this.conditions.push(r), r.node && this.nodes.push(r.node)), r;
|
|
455
|
-
},
|
|
456
|
-
addConditional(e, t) {
|
|
457
|
-
return this.addCondition(e, t);
|
|
458
|
-
},
|
|
459
|
-
addExperience(e, t) {
|
|
460
|
-
let n = t?.node;
|
|
461
|
-
this.nodes.length === 0 && (n = o({ type: "origin" }, this), this.nodes.push(n));
|
|
462
|
-
let r = o({
|
|
463
|
-
type: "experience",
|
|
464
|
-
experience: e
|
|
392
|
+
}, u = (e) => ({
|
|
393
|
+
id: e.id,
|
|
394
|
+
key: e.key,
|
|
395
|
+
component: e.component,
|
|
396
|
+
name: e.name,
|
|
397
|
+
initializeOpen: e.initializeOpen,
|
|
398
|
+
condition: e.condition,
|
|
399
|
+
targets: e.targets,
|
|
400
|
+
steps: [],
|
|
401
|
+
nodes: [],
|
|
402
|
+
edges: [],
|
|
403
|
+
fields: [],
|
|
404
|
+
conditions: [],
|
|
405
|
+
addStep(e, t) {
|
|
406
|
+
let n = t?.node;
|
|
407
|
+
this.nodes.length === 0 && (n = o({ type: "origin" }, this), this.nodes.push(n));
|
|
408
|
+
let r = "serialize" in e ? e : a(e, this);
|
|
409
|
+
if (n) {
|
|
410
|
+
if (!r.node) throw Error("todo no node");
|
|
411
|
+
let e = s({
|
|
412
|
+
sourceNode: n,
|
|
413
|
+
destinationNode: r.node,
|
|
414
|
+
sourceNodeHandle: null
|
|
465
415
|
}, this);
|
|
466
|
-
|
|
467
|
-
let e = s({
|
|
468
|
-
sourceNode: n,
|
|
469
|
-
destinationNode: r,
|
|
470
|
-
sourceNodeHandle: null
|
|
471
|
-
}, this);
|
|
472
|
-
this.edges.push(e);
|
|
473
|
-
}
|
|
474
|
-
return e;
|
|
475
|
-
},
|
|
476
|
-
addField(e, t) {
|
|
477
|
-
let n = "serialize" in e ? e : l(e);
|
|
478
|
-
return t && t.fields.push(n), this.fields.includes(n) || this.fields.push(n), n;
|
|
479
|
-
},
|
|
480
|
-
serialize() {
|
|
481
|
-
return JSON.stringify({
|
|
482
|
-
id: this.id,
|
|
483
|
-
key: this.key,
|
|
484
|
-
component: this.component,
|
|
485
|
-
name: this.name,
|
|
486
|
-
initializeOpen: this.initializeOpen,
|
|
487
|
-
condition: this.condition,
|
|
488
|
-
targets: this.targets,
|
|
489
|
-
nodes: this.nodes.map((e) => JSON.parse(e.serialize())),
|
|
490
|
-
edges: this.edges.map((e) => JSON.parse(e.serialize()))
|
|
491
|
-
});
|
|
416
|
+
this.edges.push(e);
|
|
492
417
|
}
|
|
493
|
-
|
|
494
|
-
|
|
418
|
+
return r.fields.length > 0 && r.fields.forEach((e) => {
|
|
419
|
+
this.fields.includes(e) || this.fields.push(e);
|
|
420
|
+
}), this.steps.includes(r) || (this.steps.push(r), r.node && this.nodes.push(r.node)), r;
|
|
421
|
+
},
|
|
422
|
+
addAction(e, t) {
|
|
423
|
+
let n = t?.node;
|
|
424
|
+
this.nodes.length === 0 && (n = o({ type: "origin" }, this), this.nodes.push(n));
|
|
425
|
+
let i = "serialize" in e ? e : r(e, this);
|
|
426
|
+
if (n) {
|
|
427
|
+
let e = s({
|
|
428
|
+
sourceNode: n,
|
|
429
|
+
destinationNode: i,
|
|
430
|
+
sourceNodeHandle: null
|
|
431
|
+
}, this);
|
|
432
|
+
this.edges.push(e);
|
|
433
|
+
}
|
|
434
|
+
return this.nodes.push(i), i;
|
|
435
|
+
},
|
|
436
|
+
addCondition(e, t) {
|
|
437
|
+
let n = t?.node;
|
|
438
|
+
this.nodes.length === 0 && (n = o({ type: "origin" }, this), this.nodes.push(n));
|
|
439
|
+
let r = "serialize" in e ? e : c(e, this);
|
|
440
|
+
if (n) {
|
|
441
|
+
if (!r.node) throw Error("todo no node");
|
|
442
|
+
let e = s({
|
|
443
|
+
sourceNode: n,
|
|
444
|
+
destinationNode: r.node,
|
|
445
|
+
sourceNodeHandle: null
|
|
446
|
+
}, this);
|
|
447
|
+
this.edges.push(e);
|
|
448
|
+
}
|
|
449
|
+
return this.conditions.includes(r) || (this.conditions.push(r), r.node && this.nodes.push(r.node)), r;
|
|
450
|
+
},
|
|
451
|
+
addConditional(e, t) {
|
|
452
|
+
return this.addCondition(e, t);
|
|
453
|
+
},
|
|
454
|
+
addExperience(e, t) {
|
|
455
|
+
let n = t?.node;
|
|
456
|
+
this.nodes.length === 0 && (n = o({ type: "origin" }, this), this.nodes.push(n));
|
|
457
|
+
let r = o({
|
|
458
|
+
type: "experience",
|
|
459
|
+
experience: e
|
|
460
|
+
}, this);
|
|
461
|
+
if (this.nodes.push(r), n) {
|
|
462
|
+
let e = s({
|
|
463
|
+
sourceNode: n,
|
|
464
|
+
destinationNode: r,
|
|
465
|
+
sourceNodeHandle: null
|
|
466
|
+
}, this);
|
|
467
|
+
this.edges.push(e);
|
|
468
|
+
}
|
|
469
|
+
return e;
|
|
470
|
+
},
|
|
471
|
+
addField(e, t) {
|
|
472
|
+
let n = "serialize" in e ? e : l(e);
|
|
473
|
+
return t && t.fields.push(n), this.fields.includes(n) || this.fields.push(n), n;
|
|
474
|
+
},
|
|
475
|
+
serialize() {
|
|
476
|
+
return t.serialize({
|
|
477
|
+
id: this.id,
|
|
478
|
+
key: this.key,
|
|
479
|
+
component: this.component,
|
|
480
|
+
name: this.name,
|
|
481
|
+
initializeOpen: this.initializeOpen,
|
|
482
|
+
condition: this.condition,
|
|
483
|
+
targets: this.targets,
|
|
484
|
+
steps: this.steps.map((e) => t.deserialize(e.serialize())),
|
|
485
|
+
nodes: this.nodes.map((e) => t.deserialize(e.serialize())),
|
|
486
|
+
edges: this.edges.map((e) => t.deserialize(e.serialize())),
|
|
487
|
+
conditions: this.conditions.map((e) => t.deserialize(e.serialize())),
|
|
488
|
+
fields: this.fields.map((e) => t.deserialize(e.serialize()))
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
});
|
|
495
492
|
//#endregion
|
|
496
|
-
export { c as createCondition, s as createEdge, u as createExperience,
|
|
493
|
+
export { c as createCondition, s as createEdge, u as createExperience, n as createExperiencePlugin, l as createField, o as createNode, i as createStep };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../../../logger-6z_gb4rA.js";
|
|
2
|
-
import { i as e, t } from "../../../api-
|
|
2
|
+
import { i as e, t } from "../../../api-DwERBrAZ.js";
|
|
3
3
|
//#region src/plugins/dynamic-experiences/hash.ts
|
|
4
4
|
function n(e) {
|
|
5
5
|
let t = 2166136261;
|
|
@@ -18,30 +18,29 @@ function a(e) {
|
|
|
18
18
|
return typeof e == "object" && !!e && "features" in e && Array.isArray(e.features);
|
|
19
19
|
}
|
|
20
20
|
function o(e, t) {
|
|
21
|
-
|
|
21
|
+
for (let n of t.conditions) e.registerCondition(n);
|
|
22
22
|
}
|
|
23
23
|
function s(e, t) {
|
|
24
24
|
e.registerExperience({
|
|
25
25
|
id: t.id,
|
|
26
26
|
key: t.key,
|
|
27
27
|
name: t.name,
|
|
28
|
-
targets: t.targets
|
|
28
|
+
targets: t.targets,
|
|
29
29
|
nodes: t.nodes,
|
|
30
30
|
edges: t.edges,
|
|
31
|
-
actions: t.actions,
|
|
32
31
|
condition: t.condition,
|
|
33
32
|
initializeOpen: t.initializeOpen,
|
|
34
33
|
componentName: t.componentName
|
|
35
34
|
});
|
|
36
35
|
}
|
|
37
36
|
function c(e, t) {
|
|
38
|
-
|
|
37
|
+
for (let n of t.fields) e.registerField(n);
|
|
39
38
|
}
|
|
40
39
|
function l(e, t) {
|
|
41
|
-
|
|
40
|
+
for (let n of t.steps) e.registerStep(n);
|
|
42
41
|
}
|
|
43
42
|
function u(e, t) {
|
|
44
|
-
|
|
43
|
+
for (let n of t.experiences) s(e, n);
|
|
45
44
|
}
|
|
46
45
|
function d(e) {
|
|
47
46
|
let t = e.searchParams["preview-token"];
|