@picked/client 0.0.51-next.1 → 0.0.51-next.10
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-CHy9HcU7.cjs +1 -0
- package/dist/{api-Brluf3C1.js → api-mlYS-lDj.js} +1 -1
- package/dist/cjs/form/index.js +1 -1
- 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/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/form/index.js +82 -76
- package/dist/esm/index.js +436 -355
- package/dist/esm/plugins/create-experience/index.js +181 -154
- package/dist/esm/plugins/dynamic-experiences/index.js +52 -30
- package/dist/esm/plugins/responses-browser-storage/index.js +6 -8
- package/dist/esm/plugins/responses-indexeddb/index.js +8 -4
- package/dist/esm/server/index.js +1 -1
- package/dist/experience-instance-DOcd8XI1.cjs +1 -0
- package/dist/{experience-instance-CIbQp9D7.js → experience-instance-NHU1moID.js} +37 -32
- package/dist/{rules-logic-BIkBWZmf.js → rules-logic-CnVktz2l.js} +9 -2
- package/dist/{rules-logic-DDxCiq4P.cjs → rules-logic-nMHNVLn7.cjs} +1 -1
- package/dist/types/client.d.ts +47 -43
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/entities/action/action.d.ts +37 -5
- package/dist/types/entities/action/action.d.ts.map +1 -1
- package/dist/types/entities/condition/condition.d.ts +20 -0
- package/dist/types/entities/condition/condition.d.ts.map +1 -0
- package/dist/types/entities/experience/experience.d.ts +63 -47
- package/dist/types/entities/experience/experience.d.ts.map +1 -1
- package/dist/types/entities/experience-instance/experience-instance.d.ts +22 -2
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/entities/field/field.d.ts +13 -2
- package/dist/types/entities/field/field.d.ts.map +1 -1
- package/dist/types/entities/response/response-validation.d.ts +74 -0
- package/dist/types/entities/response/response-validation.d.ts.map +1 -0
- package/dist/types/entities/response/response.d.ts +24 -20
- package/dist/types/entities/response/response.d.ts.map +1 -1
- package/dist/types/entities/step/step.d.ts +42 -0
- package/dist/types/entities/step/step.d.ts.map +1 -0
- package/dist/types/form/build-responses.d.ts +12 -9
- package/dist/types/form/build-responses.d.ts.map +1 -1
- package/dist/types/form/create-field-evaluator.d.ts +11 -3
- package/dist/types/form/create-field-evaluator.d.ts.map +1 -1
- package/dist/types/form/create-field-validation.d.ts +4 -4
- package/dist/types/form/create-field-validation.d.ts.map +1 -1
- package/dist/types/form/create-form.d.ts +1 -0
- package/dist/types/form/create-form.d.ts.map +1 -1
- package/dist/types/form/create-submit-pipeline.d.ts +19 -7
- package/dist/types/form/create-submit-pipeline.d.ts.map +1 -1
- package/dist/types/form/get-step-fields.d.ts +13 -0
- package/dist/types/form/get-step-fields.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/picked.d.ts +98 -31
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts +31 -11
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/index.d.ts +2 -2
- package/dist/types/plugins/create-experience/index.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/plugin.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts +21 -4
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/types.d.ts +45 -0
- package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -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/utils/events.d.ts +1 -1
- package/dist/types/utils/events.d.ts.map +1 -1
- package/dist/types/utils/node-tree/get-next-node-from-condition.d.ts +13 -0
- package/dist/types/utils/node-tree/get-next-node-from-condition.d.ts.map +1 -1
- package/dist/types/utils/rules-logic.d.ts.map +1 -1
- package/dist/types/utils/state-snaphot.d.ts +11 -1
- package/dist/types/utils/state-snaphot.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/api-A3gUhQJc.cjs +0 -1
- package/dist/experience-instance-Dri5yAp1.cjs +0 -1
|
@@ -12,8 +12,14 @@ var t = {
|
|
|
12
12
|
setup: (n) => {
|
|
13
13
|
e.experiences.forEach((e) => {
|
|
14
14
|
let r = e.serialize(), i = t.deserialize(r);
|
|
15
|
-
i.component = e.component
|
|
15
|
+
i.component = e.component;
|
|
16
|
+
let { steps: a, conditions: o, fields: s, ...c } = i;
|
|
17
|
+
n.registerExperience(c), s.forEach((e) => {
|
|
16
18
|
n.registerField(e);
|
|
19
|
+
}), a.forEach((e) => {
|
|
20
|
+
n.registerStep(e);
|
|
21
|
+
}), o.forEach((e) => {
|
|
22
|
+
n.registerCondition(e);
|
|
17
23
|
});
|
|
18
24
|
});
|
|
19
25
|
}
|
|
@@ -27,7 +33,7 @@ var t = {
|
|
|
27
33
|
let t = s({
|
|
28
34
|
sourceNode: this,
|
|
29
35
|
destinationNode: e.node,
|
|
30
|
-
|
|
36
|
+
sourceHandle: null
|
|
31
37
|
}, r);
|
|
32
38
|
r.edges.push(t);
|
|
33
39
|
},
|
|
@@ -36,7 +42,7 @@ var t = {
|
|
|
36
42
|
let t = s({
|
|
37
43
|
sourceNode: this,
|
|
38
44
|
destinationNode: e.node,
|
|
39
|
-
|
|
45
|
+
sourceHandle: "true"
|
|
40
46
|
}, r);
|
|
41
47
|
r.edges.push(t);
|
|
42
48
|
},
|
|
@@ -45,7 +51,7 @@ var t = {
|
|
|
45
51
|
let t = s({
|
|
46
52
|
sourceNode: this,
|
|
47
53
|
destinationNode: e.node,
|
|
48
|
-
|
|
54
|
+
sourceHandle: "false"
|
|
49
55
|
}, r);
|
|
50
56
|
r.edges.push(t);
|
|
51
57
|
},
|
|
@@ -53,21 +59,28 @@ var t = {
|
|
|
53
59
|
return t.serialize({
|
|
54
60
|
id: this.id,
|
|
55
61
|
type: this.type,
|
|
56
|
-
|
|
62
|
+
actionKey: this.action
|
|
57
63
|
});
|
|
58
64
|
}
|
|
59
|
-
}), i = (t) =>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
65
|
+
}), i = (t) => {
|
|
66
|
+
let n = t.name, r = t.id ?? e("step");
|
|
67
|
+
return {
|
|
68
|
+
id: r,
|
|
69
|
+
name: n,
|
|
70
|
+
key: t.key ?? r,
|
|
71
|
+
label: n,
|
|
72
|
+
fields: t.fields ?? [],
|
|
73
|
+
addField(e) {
|
|
74
|
+
let t = "serialize" in e ? e : l(e);
|
|
75
|
+
return this.fields.includes(t) || this.fields.push(t), t;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}, a = (n, r) => {
|
|
79
|
+
let i = n.name, a = n.id ?? e("step"), s = {
|
|
80
|
+
id: a,
|
|
81
|
+
name: i,
|
|
82
|
+
key: n.key ?? a,
|
|
83
|
+
label: i,
|
|
71
84
|
experience: r,
|
|
72
85
|
fields: n.fields ?? [],
|
|
73
86
|
node: null,
|
|
@@ -89,15 +102,17 @@ var t = {
|
|
|
89
102
|
serialize() {
|
|
90
103
|
return t.serialize({
|
|
91
104
|
id: this.id,
|
|
105
|
+
key: this.key,
|
|
106
|
+
name: this.name,
|
|
92
107
|
label: this.label,
|
|
93
108
|
fieldIds: this.fields.map((e) => e.id)
|
|
94
109
|
});
|
|
95
110
|
}
|
|
96
111
|
};
|
|
97
112
|
return o({
|
|
98
|
-
step:
|
|
113
|
+
step: s,
|
|
99
114
|
type: "step"
|
|
100
|
-
}, r),
|
|
115
|
+
}, r), s;
|
|
101
116
|
}, o = (n, r) => {
|
|
102
117
|
let i = {
|
|
103
118
|
id: e("node"),
|
|
@@ -113,6 +128,7 @@ var t = {
|
|
|
113
128
|
id: this.id,
|
|
114
129
|
type: this.type,
|
|
115
130
|
stepId: this.connectedStep.id,
|
|
131
|
+
name: this.connectedStep.name,
|
|
116
132
|
label: this.connectedStep.label
|
|
117
133
|
});
|
|
118
134
|
}
|
|
@@ -142,7 +158,8 @@ var t = {
|
|
|
142
158
|
return t.serialize({
|
|
143
159
|
id: this.id,
|
|
144
160
|
type: this.type,
|
|
145
|
-
experienceId: this.connectedExperience.id
|
|
161
|
+
experienceId: this.connectedExperience.id,
|
|
162
|
+
experienceKey: this.connectedExperience.key
|
|
146
163
|
});
|
|
147
164
|
}
|
|
148
165
|
} : {
|
|
@@ -158,22 +175,24 @@ var t = {
|
|
|
158
175
|
}, s = (n, r) => ({
|
|
159
176
|
id: e("edge"),
|
|
160
177
|
sourceNode: n.sourceNode,
|
|
161
|
-
|
|
178
|
+
sourceHandle: n.sourceHandle,
|
|
162
179
|
destinationNode: n.destinationNode,
|
|
163
180
|
experience: r,
|
|
164
181
|
serialize() {
|
|
165
182
|
return t.serialize({
|
|
166
183
|
id: this.id,
|
|
167
|
-
|
|
184
|
+
sourceHandle: this.sourceHandle ?? void 0,
|
|
168
185
|
sourceNodeId: this.sourceNode.id,
|
|
169
186
|
destinationNodeId: this.destinationNode.id
|
|
170
187
|
});
|
|
171
188
|
}
|
|
172
189
|
}), c = (n, r) => {
|
|
173
|
-
let i = {
|
|
174
|
-
id:
|
|
190
|
+
let i = e("conditional"), a = n.name ?? n.label ?? i, c = {
|
|
191
|
+
id: i,
|
|
192
|
+
key: n.key ?? i,
|
|
193
|
+
name: a,
|
|
175
194
|
label: n.label,
|
|
176
|
-
|
|
195
|
+
logic: n.condition,
|
|
177
196
|
node: null,
|
|
178
197
|
experience: r,
|
|
179
198
|
addTrue(e) {
|
|
@@ -181,7 +200,7 @@ var t = {
|
|
|
181
200
|
let t = s({
|
|
182
201
|
sourceNode: this.node,
|
|
183
202
|
destinationNode: e.node,
|
|
184
|
-
|
|
203
|
+
sourceHandle: "true"
|
|
185
204
|
}, this.experience);
|
|
186
205
|
this.experience.edges.push(t);
|
|
187
206
|
},
|
|
@@ -190,66 +209,84 @@ var t = {
|
|
|
190
209
|
let t = s({
|
|
191
210
|
sourceNode: this.node,
|
|
192
211
|
destinationNode: e.node,
|
|
193
|
-
|
|
212
|
+
sourceHandle: "false"
|
|
194
213
|
}, this.experience);
|
|
195
214
|
this.experience.edges.push(t);
|
|
196
215
|
},
|
|
197
216
|
serialize() {
|
|
198
217
|
return t.serialize({
|
|
199
218
|
id: this.id,
|
|
200
|
-
|
|
201
|
-
|
|
219
|
+
key: this.key,
|
|
220
|
+
name: this.name,
|
|
221
|
+
logic: this.logic
|
|
202
222
|
});
|
|
203
223
|
}
|
|
204
224
|
};
|
|
205
225
|
return o({
|
|
206
|
-
condition:
|
|
226
|
+
condition: c,
|
|
207
227
|
type: "condition"
|
|
208
|
-
}, r),
|
|
209
|
-
}, l =
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
228
|
+
}, r), c;
|
|
229
|
+
}, l = (n) => {
|
|
230
|
+
let r = n.id ?? e("field");
|
|
231
|
+
return {
|
|
232
|
+
id: r,
|
|
233
|
+
key: n.key ?? r,
|
|
234
|
+
name: n.name,
|
|
235
|
+
type: n.type,
|
|
236
|
+
label: n.label,
|
|
237
|
+
placeholder: n.placeholder,
|
|
238
|
+
description: n.description,
|
|
239
|
+
helpText: n.helpText,
|
|
240
|
+
defaultValue: n.defaultValue ?? null,
|
|
241
|
+
multiple: n.multiple,
|
|
242
|
+
validation: n.validation ?? {},
|
|
243
|
+
condition: n.condition,
|
|
244
|
+
required: n.required,
|
|
245
|
+
options: n.options?.map((t) => ({
|
|
246
|
+
id: "id" in t ? t.id : e("option"),
|
|
247
|
+
...t
|
|
248
|
+
})) ?? null,
|
|
249
|
+
policies: n.policies,
|
|
250
|
+
serialize() {
|
|
251
|
+
let e = {
|
|
252
|
+
id: this.id,
|
|
253
|
+
key: this.key,
|
|
254
|
+
name: this.name,
|
|
255
|
+
label: this.label,
|
|
256
|
+
placeholder: this.placeholder,
|
|
257
|
+
required: this.required,
|
|
258
|
+
description: this.description,
|
|
259
|
+
helpText: this.helpText,
|
|
260
|
+
validation: this.validation,
|
|
261
|
+
condition: this.condition,
|
|
262
|
+
policies: this.policies
|
|
263
|
+
}, 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;
|
|
264
|
+
switch (this.type) {
|
|
265
|
+
case "text":
|
|
266
|
+
if (this.multiple) {
|
|
267
|
+
let n;
|
|
268
|
+
if (Array.isArray(this.defaultValue)) {
|
|
269
|
+
n = [];
|
|
270
|
+
for (let e of this.defaultValue) typeof e == "string" && n.push(e);
|
|
271
|
+
n.length === 0 && (n = void 0);
|
|
272
|
+
}
|
|
273
|
+
return t.serialize({
|
|
274
|
+
...e,
|
|
275
|
+
type: "text",
|
|
276
|
+
multiple: !0,
|
|
277
|
+
defaultValue: n,
|
|
278
|
+
options: this.options ? this.options.map((e) => ({
|
|
279
|
+
id: e.id,
|
|
280
|
+
label: e.label,
|
|
281
|
+
value: `${e.value}`,
|
|
282
|
+
condition: e.condition
|
|
283
|
+
})) : null
|
|
284
|
+
});
|
|
248
285
|
}
|
|
249
286
|
return t.serialize({
|
|
250
287
|
...e,
|
|
251
288
|
type: "text",
|
|
252
|
-
multiple: !
|
|
289
|
+
multiple: !1,
|
|
253
290
|
defaultValue: n,
|
|
254
291
|
options: this.options ? this.options.map((e) => ({
|
|
255
292
|
id: e.id,
|
|
@@ -258,32 +295,32 @@ var t = {
|
|
|
258
295
|
condition: e.condition
|
|
259
296
|
})) : null
|
|
260
297
|
});
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
298
|
+
case "number":
|
|
299
|
+
if (this.multiple) {
|
|
300
|
+
let n;
|
|
301
|
+
if (Array.isArray(this.defaultValue)) {
|
|
302
|
+
n = [];
|
|
303
|
+
for (let e of this.defaultValue) typeof e == "number" && n.push(e);
|
|
304
|
+
n.length === 0 && (n = void 0);
|
|
305
|
+
}
|
|
306
|
+
return t.serialize({
|
|
307
|
+
...e,
|
|
308
|
+
type: "number",
|
|
309
|
+
multiple: !0,
|
|
310
|
+
defaultValue: n,
|
|
311
|
+
options: this.options ? this.options.map((e) => ({
|
|
312
|
+
id: e.id,
|
|
313
|
+
label: e.label,
|
|
314
|
+
value: Number(e.value),
|
|
315
|
+
condition: e.condition
|
|
316
|
+
})) : null
|
|
317
|
+
});
|
|
281
318
|
}
|
|
282
319
|
return t.serialize({
|
|
283
320
|
...e,
|
|
284
321
|
type: "number",
|
|
285
|
-
multiple: !
|
|
286
|
-
defaultValue:
|
|
322
|
+
multiple: !1,
|
|
323
|
+
defaultValue: r,
|
|
287
324
|
options: this.options ? this.options.map((e) => ({
|
|
288
325
|
id: e.id,
|
|
289
326
|
label: e.label,
|
|
@@ -291,32 +328,32 @@ var t = {
|
|
|
291
328
|
condition: e.condition
|
|
292
329
|
})) : null
|
|
293
330
|
});
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
331
|
+
case "boolean":
|
|
332
|
+
if (this.multiple) {
|
|
333
|
+
let n;
|
|
334
|
+
if (Array.isArray(this.defaultValue)) {
|
|
335
|
+
n = [];
|
|
336
|
+
for (let e of this.defaultValue) typeof e == "boolean" && n.push(e);
|
|
337
|
+
n.length === 0 && (n = void 0);
|
|
338
|
+
}
|
|
339
|
+
return t.serialize({
|
|
340
|
+
...e,
|
|
341
|
+
type: "boolean",
|
|
342
|
+
multiple: !0,
|
|
343
|
+
defaultValue: n,
|
|
344
|
+
options: this.options ? this.options.map((e) => ({
|
|
345
|
+
id: e.id,
|
|
346
|
+
label: e.label,
|
|
347
|
+
value: !!e.value,
|
|
348
|
+
condition: e.condition
|
|
349
|
+
})) : null
|
|
350
|
+
});
|
|
314
351
|
}
|
|
315
352
|
return t.serialize({
|
|
316
353
|
...e,
|
|
317
354
|
type: "boolean",
|
|
318
|
-
multiple: !
|
|
319
|
-
defaultValue:
|
|
355
|
+
multiple: !1,
|
|
356
|
+
defaultValue: i,
|
|
320
357
|
options: this.options ? this.options.map((e) => ({
|
|
321
358
|
id: e.id,
|
|
322
359
|
label: e.label,
|
|
@@ -324,49 +361,38 @@ var t = {
|
|
|
324
361
|
condition: e.condition
|
|
325
362
|
})) : null
|
|
326
363
|
});
|
|
327
|
-
|
|
328
|
-
|
|
364
|
+
case "object": return this.multiple ? t.serialize({
|
|
365
|
+
...e,
|
|
366
|
+
type: "object",
|
|
367
|
+
multiple: !0,
|
|
368
|
+
defaultValue: this.defaultValue,
|
|
369
|
+
options: this.options ? this.options.map((e) => ({
|
|
370
|
+
id: e.id,
|
|
371
|
+
label: e.label,
|
|
372
|
+
description: e.description,
|
|
373
|
+
value: e.value,
|
|
374
|
+
condition: e.condition
|
|
375
|
+
})) : null
|
|
376
|
+
}) : t.serialize({
|
|
329
377
|
...e,
|
|
330
|
-
type: "
|
|
378
|
+
type: "object",
|
|
331
379
|
multiple: !1,
|
|
332
|
-
defaultValue:
|
|
380
|
+
defaultValue: this.defaultValue,
|
|
333
381
|
options: this.options ? this.options.map((e) => ({
|
|
334
382
|
id: e.id,
|
|
335
383
|
label: e.label,
|
|
336
|
-
|
|
384
|
+
description: e.description,
|
|
385
|
+
value: e.value,
|
|
337
386
|
condition: e.condition
|
|
338
387
|
})) : null
|
|
339
388
|
});
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
type: "object",
|
|
343
|
-
multiple: !0,
|
|
344
|
-
defaultValue: this.defaultValue,
|
|
345
|
-
options: this.options ? this.options.map((e) => ({
|
|
346
|
-
id: e.id,
|
|
347
|
-
label: e.label,
|
|
348
|
-
description: e.description,
|
|
349
|
-
value: e.value,
|
|
350
|
-
condition: e.condition
|
|
351
|
-
})) : null
|
|
352
|
-
}) : t.serialize({
|
|
353
|
-
...e,
|
|
354
|
-
type: "object",
|
|
355
|
-
multiple: !1,
|
|
356
|
-
defaultValue: this.defaultValue,
|
|
357
|
-
options: this.options ? this.options.map((e) => ({
|
|
358
|
-
id: e.id,
|
|
359
|
-
label: e.label,
|
|
360
|
-
description: e.description,
|
|
361
|
-
value: e.value,
|
|
362
|
-
condition: e.condition
|
|
363
|
-
})) : null
|
|
364
|
-
});
|
|
365
|
-
default: throw Error("Unsupported field type");
|
|
389
|
+
default: throw Error("Unsupported field type");
|
|
390
|
+
}
|
|
366
391
|
}
|
|
367
|
-
}
|
|
368
|
-
}
|
|
392
|
+
};
|
|
393
|
+
}, u = (e) => ({
|
|
369
394
|
id: e.id,
|
|
395
|
+
key: e.key ?? e.id,
|
|
370
396
|
component: e.component,
|
|
371
397
|
name: e.name,
|
|
372
398
|
initializeOpen: e.initializeOpen,
|
|
@@ -386,7 +412,7 @@ var t = {
|
|
|
386
412
|
let e = s({
|
|
387
413
|
sourceNode: n,
|
|
388
414
|
destinationNode: r.node,
|
|
389
|
-
|
|
415
|
+
sourceHandle: null
|
|
390
416
|
}, this);
|
|
391
417
|
this.edges.push(e);
|
|
392
418
|
}
|
|
@@ -402,7 +428,7 @@ var t = {
|
|
|
402
428
|
let e = s({
|
|
403
429
|
sourceNode: n,
|
|
404
430
|
destinationNode: i,
|
|
405
|
-
|
|
431
|
+
sourceHandle: null
|
|
406
432
|
}, this);
|
|
407
433
|
this.edges.push(e);
|
|
408
434
|
}
|
|
@@ -417,7 +443,7 @@ var t = {
|
|
|
417
443
|
let e = s({
|
|
418
444
|
sourceNode: n,
|
|
419
445
|
destinationNode: r.node,
|
|
420
|
-
|
|
446
|
+
sourceHandle: null
|
|
421
447
|
}, this);
|
|
422
448
|
this.edges.push(e);
|
|
423
449
|
}
|
|
@@ -437,19 +463,20 @@ var t = {
|
|
|
437
463
|
let e = s({
|
|
438
464
|
sourceNode: n,
|
|
439
465
|
destinationNode: r,
|
|
440
|
-
|
|
466
|
+
sourceHandle: null
|
|
441
467
|
}, this);
|
|
442
468
|
this.edges.push(e);
|
|
443
469
|
}
|
|
444
470
|
return e;
|
|
445
471
|
},
|
|
446
472
|
addField(e, t) {
|
|
447
|
-
let n = "serialize" in e ? e :
|
|
473
|
+
let n = "serialize" in e ? e : l(e);
|
|
448
474
|
return t && t.fields.push(n), this.fields.includes(n) || this.fields.push(n), n;
|
|
449
475
|
},
|
|
450
476
|
serialize() {
|
|
451
477
|
return t.serialize({
|
|
452
478
|
id: this.id,
|
|
479
|
+
key: this.key,
|
|
453
480
|
component: this.component,
|
|
454
481
|
name: this.name,
|
|
455
482
|
initializeOpen: this.initializeOpen,
|
|
@@ -464,4 +491,4 @@ var t = {
|
|
|
464
491
|
}
|
|
465
492
|
});
|
|
466
493
|
//#endregion
|
|
467
|
-
export { c as createCondition,
|
|
494
|
+
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-mlYS-lDj.js";
|
|
3
3
|
//#region src/plugins/dynamic-experiences/hash.ts
|
|
4
4
|
function n(e) {
|
|
5
5
|
let t = 2166136261;
|
|
@@ -15,16 +15,38 @@ function i(e, t) {
|
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region src/plugins/dynamic-experiences/plugin.ts
|
|
17
17
|
function a(e) {
|
|
18
|
-
return typeof e
|
|
18
|
+
return typeof e == "object" && !!e && "features" in e && Array.isArray(e.features);
|
|
19
19
|
}
|
|
20
|
-
function o(e) {
|
|
21
|
-
|
|
20
|
+
function o(e, t) {
|
|
21
|
+
if (Array.isArray(t.conditions)) for (let n of t.conditions) e.registerCondition(n);
|
|
22
22
|
}
|
|
23
|
-
function s(e) {
|
|
23
|
+
function s(e, t) {
|
|
24
|
+
e.registerExperience({
|
|
25
|
+
id: t.id,
|
|
26
|
+
key: t.key,
|
|
27
|
+
name: t.name,
|
|
28
|
+
targets: t.targets,
|
|
29
|
+
nodes: t.nodes,
|
|
30
|
+
edges: t.edges,
|
|
31
|
+
condition: t.condition,
|
|
32
|
+
initializeOpen: t.initializeOpen,
|
|
33
|
+
componentName: t.componentName
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function c(e, t) {
|
|
37
|
+
if (Array.isArray(t.fields)) for (let n of t.fields) e.registerField(n);
|
|
38
|
+
}
|
|
39
|
+
function l(e, t) {
|
|
40
|
+
if (Array.isArray(t.steps)) for (let n of t.steps) e.registerStep(n);
|
|
41
|
+
}
|
|
42
|
+
function u(e, t) {
|
|
43
|
+
if (Array.isArray(t.experiences)) for (let n of t.experiences) s(e, n);
|
|
44
|
+
}
|
|
45
|
+
function d(e) {
|
|
24
46
|
let t = e.searchParams["preview-token"];
|
|
25
47
|
if (t && t.length > 0) return t[0];
|
|
26
48
|
}
|
|
27
|
-
function
|
|
49
|
+
function f(e) {
|
|
28
50
|
let t = /* @__PURE__ */ new Set(), n = e.searchParams.feature;
|
|
29
51
|
if (!n) return t;
|
|
30
52
|
for (let e of n) {
|
|
@@ -33,13 +55,13 @@ function c(e) {
|
|
|
33
55
|
}
|
|
34
56
|
return t;
|
|
35
57
|
}
|
|
36
|
-
function
|
|
37
|
-
let i =
|
|
58
|
+
function p(e, t, n) {
|
|
59
|
+
let i = f(e), a = e.session?.id;
|
|
38
60
|
if (!a) throw Error("Session ID is required for feature registration");
|
|
39
61
|
let o = r(a);
|
|
40
|
-
for (let r of t.features) i.has(r.id) ||
|
|
62
|
+
for (let r of t.features) i.has(r.id) || m(e, r, n, o);
|
|
41
63
|
}
|
|
42
|
-
function
|
|
64
|
+
function m(e, t, n, r) {
|
|
43
65
|
e.registerFeature(t.id, {
|
|
44
66
|
key: `v${t.version}`,
|
|
45
67
|
name: t.name,
|
|
@@ -47,7 +69,7 @@ function u(e, t, n, r) {
|
|
|
47
69
|
decide: () => t.enabled ? i(r, t.weight) : !1
|
|
48
70
|
});
|
|
49
71
|
}
|
|
50
|
-
function
|
|
72
|
+
function h() {
|
|
51
73
|
let e;
|
|
52
74
|
try {
|
|
53
75
|
e = __PICKED_PROJECT_CONFIG__;
|
|
@@ -62,9 +84,9 @@ function d() {
|
|
|
62
84
|
return;
|
|
63
85
|
}
|
|
64
86
|
else t = e;
|
|
65
|
-
if (
|
|
87
|
+
if (a(t)) return t;
|
|
66
88
|
}
|
|
67
|
-
function
|
|
89
|
+
function g(e) {
|
|
68
90
|
try {
|
|
69
91
|
let t = new URL(e).hostname;
|
|
70
92
|
return t === "localhost" || t === "127.0.0.1" || t === "::1";
|
|
@@ -72,49 +94,49 @@ function f(e) {
|
|
|
72
94
|
return !1;
|
|
73
95
|
}
|
|
74
96
|
}
|
|
75
|
-
function
|
|
97
|
+
function _(e) {
|
|
76
98
|
if (typeof e != "object" || !e || !("cause" in e)) return !1;
|
|
77
99
|
let { cause: t } = e;
|
|
78
100
|
return typeof t != "object" || !t || !("code" in t) ? !1 : t.code === "ECONNREFUSED";
|
|
79
101
|
}
|
|
80
|
-
async function
|
|
81
|
-
let i = r?.previewToken ? `projects/${n}?preview_token=${encodeURIComponent(r.previewToken)}` : `projects/${n}`,
|
|
102
|
+
async function v(e, n, r) {
|
|
103
|
+
let i = r?.previewToken ? `projects/${n}?preview_token=${encodeURIComponent(r.previewToken)}` : `projects/${n}`, o;
|
|
82
104
|
try {
|
|
83
|
-
|
|
105
|
+
o = await t(e, i, r?.headers);
|
|
84
106
|
} catch (t) {
|
|
85
|
-
return
|
|
107
|
+
return g(e) && _(t), null;
|
|
86
108
|
}
|
|
87
|
-
if (!
|
|
109
|
+
if (!o.ok) return `${o.status.toString()}`, null;
|
|
88
110
|
let s;
|
|
89
111
|
try {
|
|
90
|
-
s = await
|
|
112
|
+
s = await o.json();
|
|
91
113
|
} catch {
|
|
92
114
|
return null;
|
|
93
115
|
}
|
|
94
|
-
return
|
|
116
|
+
return a(s) ? s : null;
|
|
95
117
|
}
|
|
96
|
-
function
|
|
118
|
+
function y(e) {
|
|
97
119
|
return {
|
|
98
120
|
name: "dynamic-experiences",
|
|
99
121
|
setup: (t) => {
|
|
100
122
|
let n = e?.apiUrl ?? t.apiUrl;
|
|
101
123
|
return { onStart: async () => {
|
|
102
|
-
let r =
|
|
124
|
+
let r = d(t);
|
|
103
125
|
if (r) {
|
|
104
|
-
let e = await
|
|
105
|
-
e &&
|
|
126
|
+
let e = await v(n, t.projectId, { previewToken: r });
|
|
127
|
+
e && (p(t, e, !0), o(t, e), c(t, e), l(t, e), u(t, e));
|
|
106
128
|
return;
|
|
107
129
|
}
|
|
108
|
-
let i = e?.projectConfig ??
|
|
130
|
+
let i = e?.projectConfig ?? h();
|
|
109
131
|
if (i) {
|
|
110
|
-
|
|
132
|
+
p(t, i, !1), o(t, i), c(t, i), l(t, i), u(t, i);
|
|
111
133
|
return;
|
|
112
134
|
}
|
|
113
|
-
let a = await
|
|
114
|
-
a &&
|
|
135
|
+
let a = await v(n, t.projectId);
|
|
136
|
+
a && (p(t, a, !1), o(t, a), c(t, a), l(t, a), u(t, a));
|
|
115
137
|
} };
|
|
116
138
|
}
|
|
117
139
|
};
|
|
118
140
|
}
|
|
119
141
|
//#endregion
|
|
120
|
-
export { e as createClientHeaders,
|
|
142
|
+
export { e as createClientHeaders, y as dynamicExperiencesPlugin, v as fetchProject };
|