@inploi/flows 2.0.0 → 3.0.0
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/chunk-3HF7KDUR.mjs +2 -0
- package/dist/{chunk-VKMPK5WA.mjs.map → chunk-3HF7KDUR.mjs.map} +1 -1
- package/dist/chunk-DKKJHDKM.mjs +2 -0
- package/dist/chunk-DKKJHDKM.mjs.map +1 -0
- package/dist/i18n.d.mts +392 -0
- package/dist/i18n.mjs +2 -0
- package/dist/i18n.mjs.map +1 -0
- package/dist/interpreter.d.mts +3 -113
- package/dist/interpreter.mjs +1 -1
- package/dist/interpreter.mjs.map +1 -1
- package/dist/linked-list.d.mts +6 -6
- package/dist/linked-list.mjs +1 -1
- package/dist/linked-list.mjs.map +1 -1
- package/dist/utils.d.mts +3 -12
- package/dist/utils.mjs +1 -1
- package/package.json +10 -5
- package/dist/chunk-VKMPK5WA.mjs +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var g=Object.create;var f=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var m=(b,a)=>()=>(a||b((a={exports:{}}).exports,a),a.exports);var l=(b,a,c,e)=>{if(a&&typeof a=="object"||typeof a=="function")for(let d of i(a))!k.call(b,d)&&d!==c&&f(b,d,{get:()=>a[d],enumerable:!(e=h(a,d))||e.enumerable});return b};var n=(b,a,c)=>(c=b!=null?g(j(b)):{},l(a||!b||!b.__esModule?f(c,"default",{value:b,enumerable:!0}):c,b));export{m as a,n as b};
|
|
2
|
+
//# sourceMappingURL=chunk-DKKJHDKM.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/i18n.d.mts
ADDED
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
import * as preact from 'preact';
|
|
2
|
+
import * as _inploi_i18n_translation from '@inploi/i18n/translation';
|
|
3
|
+
|
|
4
|
+
declare const TranslationProvider: (props: {
|
|
5
|
+
terms?: Partial<_inploi_i18n_translation.TranslationDict<{
|
|
6
|
+
readonly submission_redirect_message: "Almost there! Please complete your submission here:";
|
|
7
|
+
readonly complete_submission: "Complete submission";
|
|
8
|
+
readonly submission_completed: "Submission completed!";
|
|
9
|
+
readonly submission_failed: "Failed to submit";
|
|
10
|
+
readonly maximize: "Maximise";
|
|
11
|
+
readonly minimize: "Minimise";
|
|
12
|
+
readonly close_application: "Close application";
|
|
13
|
+
/** When an application is at an invalid state, the user will get this error. */
|
|
14
|
+
readonly invalid_state: "Invalid application state";
|
|
15
|
+
readonly redirect_url_error: "Couldn’t get the redirect URL.";
|
|
16
|
+
readonly upload_file: {
|
|
17
|
+
readonly one: "Select file to upload";
|
|
18
|
+
readonly other: "Select files to upload";
|
|
19
|
+
};
|
|
20
|
+
readonly file_max_size: "max {{size}}";
|
|
21
|
+
readonly file_extensions: "Accepted file extensions";
|
|
22
|
+
readonly address_error: "Something went wrong! Plase continue manually";
|
|
23
|
+
readonly address_search: "Type and search for places…";
|
|
24
|
+
readonly address_manual: "Fill in manually";
|
|
25
|
+
readonly back: "Back";
|
|
26
|
+
readonly search: "Search";
|
|
27
|
+
readonly unknown_error: "An error occurred";
|
|
28
|
+
readonly line1: "Line 1";
|
|
29
|
+
readonly line2: "Line 2";
|
|
30
|
+
readonly line3: "Line 3";
|
|
31
|
+
readonly city: "City";
|
|
32
|
+
readonly state: "State";
|
|
33
|
+
readonly postcode: "Postcode";
|
|
34
|
+
readonly country: "Country";
|
|
35
|
+
readonly select_country: "Select a country";
|
|
36
|
+
readonly validation_empty: "Please enter a value";
|
|
37
|
+
readonly validation_email: "That doesn’t look like a valid email address";
|
|
38
|
+
readonly validation_url: "That doesn’t look like a valid URL";
|
|
39
|
+
readonly validation_max_chars: "Please enter no more than {{count}} characters";
|
|
40
|
+
readonly validation_min_chars: "Please enter {{count}} or more characters";
|
|
41
|
+
readonly validation_phone: "Please enter a valid phone number";
|
|
42
|
+
readonly validation_country_code: "Please select a country code";
|
|
43
|
+
readonly validation_number: "Please enter a valid number";
|
|
44
|
+
readonly validation_number_min: "Please enter a number greater than or equal to {{min}}";
|
|
45
|
+
readonly validation_number_max: "Please enter a number less than or equal to {{max}}";
|
|
46
|
+
readonly validation_number_decimal_cases: "Please enter a number with at most {{count}} decimal cases";
|
|
47
|
+
readonly validation_file: "Please select a file";
|
|
48
|
+
readonly validation_file_ext: "Please only upload {{ext}} files";
|
|
49
|
+
readonly validation_file_min: {
|
|
50
|
+
readonly one: "Please upload at least one file";
|
|
51
|
+
readonly other: "Please only upload at least {{count}} files";
|
|
52
|
+
};
|
|
53
|
+
readonly validation_file_max: {
|
|
54
|
+
readonly one: "Please only upload one file";
|
|
55
|
+
readonly other: "Please only upload up to {{count}} files";
|
|
56
|
+
};
|
|
57
|
+
readonly validation_file_size: "Your file is too big. Please upload a file smaller than {{size}}";
|
|
58
|
+
}>> | undefined;
|
|
59
|
+
locale: string | undefined;
|
|
60
|
+
children?: preact.ComponentChildren;
|
|
61
|
+
}) => preact.JSX.Element;
|
|
62
|
+
declare const useTranslation: <T extends {
|
|
63
|
+
readonly submission_redirect_message: "Almost there! Please complete your submission here:";
|
|
64
|
+
readonly complete_submission: "Complete submission";
|
|
65
|
+
readonly submission_completed: "Submission completed!";
|
|
66
|
+
readonly submission_failed: "Failed to submit";
|
|
67
|
+
readonly maximize: "Maximise";
|
|
68
|
+
readonly minimize: "Minimise";
|
|
69
|
+
readonly close_application: "Close application";
|
|
70
|
+
/** When an application is at an invalid state, the user will get this error. */
|
|
71
|
+
readonly invalid_state: "Invalid application state";
|
|
72
|
+
readonly redirect_url_error: "Couldn’t get the redirect URL.";
|
|
73
|
+
readonly upload_file: {
|
|
74
|
+
readonly one: "Select file to upload";
|
|
75
|
+
readonly other: "Select files to upload";
|
|
76
|
+
};
|
|
77
|
+
readonly file_max_size: "max {{size}}";
|
|
78
|
+
readonly file_extensions: "Accepted file extensions";
|
|
79
|
+
readonly address_error: "Something went wrong! Plase continue manually";
|
|
80
|
+
readonly address_search: "Type and search for places…";
|
|
81
|
+
readonly address_manual: "Fill in manually";
|
|
82
|
+
readonly back: "Back";
|
|
83
|
+
readonly search: "Search";
|
|
84
|
+
readonly unknown_error: "An error occurred";
|
|
85
|
+
readonly line1: "Line 1";
|
|
86
|
+
readonly line2: "Line 2";
|
|
87
|
+
readonly line3: "Line 3";
|
|
88
|
+
readonly city: "City";
|
|
89
|
+
readonly state: "State";
|
|
90
|
+
readonly postcode: "Postcode";
|
|
91
|
+
readonly country: "Country";
|
|
92
|
+
readonly select_country: "Select a country";
|
|
93
|
+
readonly validation_empty: "Please enter a value";
|
|
94
|
+
readonly validation_email: "That doesn’t look like a valid email address";
|
|
95
|
+
readonly validation_url: "That doesn’t look like a valid URL";
|
|
96
|
+
readonly validation_max_chars: "Please enter no more than {{count}} characters";
|
|
97
|
+
readonly validation_min_chars: "Please enter {{count}} or more characters";
|
|
98
|
+
readonly validation_phone: "Please enter a valid phone number";
|
|
99
|
+
readonly validation_country_code: "Please select a country code";
|
|
100
|
+
readonly validation_number: "Please enter a valid number";
|
|
101
|
+
readonly validation_number_min: "Please enter a number greater than or equal to {{min}}";
|
|
102
|
+
readonly validation_number_max: "Please enter a number less than or equal to {{max}}";
|
|
103
|
+
readonly validation_number_decimal_cases: "Please enter a number with at most {{count}} decimal cases";
|
|
104
|
+
readonly validation_file: "Please select a file";
|
|
105
|
+
readonly validation_file_ext: "Please only upload {{ext}} files";
|
|
106
|
+
readonly validation_file_min: {
|
|
107
|
+
readonly one: "Please upload at least one file";
|
|
108
|
+
readonly other: "Please only upload at least {{count}} files";
|
|
109
|
+
};
|
|
110
|
+
readonly validation_file_max: {
|
|
111
|
+
readonly one: "Please only upload one file";
|
|
112
|
+
readonly other: "Please only upload up to {{count}} files";
|
|
113
|
+
};
|
|
114
|
+
readonly validation_file_size: "Your file is too big. Please upload a file smaller than {{size}}";
|
|
115
|
+
} = {
|
|
116
|
+
readonly submission_redirect_message: "Almost there! Please complete your submission here:";
|
|
117
|
+
readonly complete_submission: "Complete submission";
|
|
118
|
+
readonly submission_completed: "Submission completed!";
|
|
119
|
+
readonly submission_failed: "Failed to submit";
|
|
120
|
+
readonly maximize: "Maximise";
|
|
121
|
+
readonly minimize: "Minimise";
|
|
122
|
+
readonly close_application: "Close application";
|
|
123
|
+
/** When an application is at an invalid state, the user will get this error. */
|
|
124
|
+
readonly invalid_state: "Invalid application state";
|
|
125
|
+
readonly redirect_url_error: "Couldn’t get the redirect URL.";
|
|
126
|
+
readonly upload_file: {
|
|
127
|
+
readonly one: "Select file to upload";
|
|
128
|
+
readonly other: "Select files to upload";
|
|
129
|
+
};
|
|
130
|
+
readonly file_max_size: "max {{size}}";
|
|
131
|
+
readonly file_extensions: "Accepted file extensions";
|
|
132
|
+
readonly address_error: "Something went wrong! Plase continue manually";
|
|
133
|
+
readonly address_search: "Type and search for places…";
|
|
134
|
+
readonly address_manual: "Fill in manually";
|
|
135
|
+
readonly back: "Back";
|
|
136
|
+
readonly search: "Search";
|
|
137
|
+
readonly unknown_error: "An error occurred";
|
|
138
|
+
readonly line1: "Line 1";
|
|
139
|
+
readonly line2: "Line 2";
|
|
140
|
+
readonly line3: "Line 3";
|
|
141
|
+
readonly city: "City";
|
|
142
|
+
readonly state: "State";
|
|
143
|
+
readonly postcode: "Postcode";
|
|
144
|
+
readonly country: "Country";
|
|
145
|
+
readonly select_country: "Select a country";
|
|
146
|
+
readonly validation_empty: "Please enter a value";
|
|
147
|
+
readonly validation_email: "That doesn’t look like a valid email address";
|
|
148
|
+
readonly validation_url: "That doesn’t look like a valid URL";
|
|
149
|
+
readonly validation_max_chars: "Please enter no more than {{count}} characters";
|
|
150
|
+
readonly validation_min_chars: "Please enter {{count}} or more characters";
|
|
151
|
+
readonly validation_phone: "Please enter a valid phone number";
|
|
152
|
+
readonly validation_country_code: "Please select a country code";
|
|
153
|
+
readonly validation_number: "Please enter a valid number";
|
|
154
|
+
readonly validation_number_min: "Please enter a number greater than or equal to {{min}}";
|
|
155
|
+
readonly validation_number_max: "Please enter a number less than or equal to {{max}}";
|
|
156
|
+
readonly validation_number_decimal_cases: "Please enter a number with at most {{count}} decimal cases";
|
|
157
|
+
readonly validation_file: "Please select a file";
|
|
158
|
+
readonly validation_file_ext: "Please only upload {{ext}} files";
|
|
159
|
+
readonly validation_file_min: {
|
|
160
|
+
readonly one: "Please upload at least one file";
|
|
161
|
+
readonly other: "Please only upload at least {{count}} files";
|
|
162
|
+
};
|
|
163
|
+
readonly validation_file_max: {
|
|
164
|
+
readonly one: "Please only upload one file";
|
|
165
|
+
readonly other: "Please only upload up to {{count}} files";
|
|
166
|
+
};
|
|
167
|
+
readonly validation_file_size: "Your file is too big. Please upload a file smaller than {{size}}";
|
|
168
|
+
}>() => {
|
|
169
|
+
t: _inploi_i18n_translation.TFn<T>;
|
|
170
|
+
locale: string | undefined;
|
|
171
|
+
};
|
|
172
|
+
declare const createTFunction: <T extends {
|
|
173
|
+
readonly submission_redirect_message: "Almost there! Please complete your submission here:";
|
|
174
|
+
readonly complete_submission: "Complete submission";
|
|
175
|
+
readonly submission_completed: "Submission completed!";
|
|
176
|
+
readonly submission_failed: "Failed to submit";
|
|
177
|
+
readonly maximize: "Maximise";
|
|
178
|
+
readonly minimize: "Minimise";
|
|
179
|
+
readonly close_application: "Close application";
|
|
180
|
+
/** When an application is at an invalid state, the user will get this error. */
|
|
181
|
+
readonly invalid_state: "Invalid application state";
|
|
182
|
+
readonly redirect_url_error: "Couldn’t get the redirect URL.";
|
|
183
|
+
readonly upload_file: {
|
|
184
|
+
readonly one: "Select file to upload";
|
|
185
|
+
readonly other: "Select files to upload";
|
|
186
|
+
};
|
|
187
|
+
readonly file_max_size: "max {{size}}";
|
|
188
|
+
readonly file_extensions: "Accepted file extensions";
|
|
189
|
+
readonly address_error: "Something went wrong! Plase continue manually";
|
|
190
|
+
readonly address_search: "Type and search for places…";
|
|
191
|
+
readonly address_manual: "Fill in manually";
|
|
192
|
+
readonly back: "Back";
|
|
193
|
+
readonly search: "Search";
|
|
194
|
+
readonly unknown_error: "An error occurred";
|
|
195
|
+
readonly line1: "Line 1";
|
|
196
|
+
readonly line2: "Line 2";
|
|
197
|
+
readonly line3: "Line 3";
|
|
198
|
+
readonly city: "City";
|
|
199
|
+
readonly state: "State";
|
|
200
|
+
readonly postcode: "Postcode";
|
|
201
|
+
readonly country: "Country";
|
|
202
|
+
readonly select_country: "Select a country";
|
|
203
|
+
readonly validation_empty: "Please enter a value";
|
|
204
|
+
readonly validation_email: "That doesn’t look like a valid email address";
|
|
205
|
+
readonly validation_url: "That doesn’t look like a valid URL";
|
|
206
|
+
readonly validation_max_chars: "Please enter no more than {{count}} characters";
|
|
207
|
+
readonly validation_min_chars: "Please enter {{count}} or more characters";
|
|
208
|
+
readonly validation_phone: "Please enter a valid phone number";
|
|
209
|
+
readonly validation_country_code: "Please select a country code";
|
|
210
|
+
readonly validation_number: "Please enter a valid number";
|
|
211
|
+
readonly validation_number_min: "Please enter a number greater than or equal to {{min}}";
|
|
212
|
+
readonly validation_number_max: "Please enter a number less than or equal to {{max}}";
|
|
213
|
+
readonly validation_number_decimal_cases: "Please enter a number with at most {{count}} decimal cases";
|
|
214
|
+
readonly validation_file: "Please select a file";
|
|
215
|
+
readonly validation_file_ext: "Please only upload {{ext}} files";
|
|
216
|
+
readonly validation_file_min: {
|
|
217
|
+
readonly one: "Please upload at least one file";
|
|
218
|
+
readonly other: "Please only upload at least {{count}} files";
|
|
219
|
+
};
|
|
220
|
+
readonly validation_file_max: {
|
|
221
|
+
readonly one: "Please only upload one file";
|
|
222
|
+
readonly other: "Please only upload up to {{count}} files";
|
|
223
|
+
};
|
|
224
|
+
readonly validation_file_size: "Your file is too big. Please upload a file smaller than {{size}}";
|
|
225
|
+
} = {
|
|
226
|
+
readonly submission_redirect_message: "Almost there! Please complete your submission here:";
|
|
227
|
+
readonly complete_submission: "Complete submission";
|
|
228
|
+
readonly submission_completed: "Submission completed!";
|
|
229
|
+
readonly submission_failed: "Failed to submit";
|
|
230
|
+
readonly maximize: "Maximise";
|
|
231
|
+
readonly minimize: "Minimise";
|
|
232
|
+
readonly close_application: "Close application";
|
|
233
|
+
/** When an application is at an invalid state, the user will get this error. */
|
|
234
|
+
readonly invalid_state: "Invalid application state";
|
|
235
|
+
readonly redirect_url_error: "Couldn’t get the redirect URL.";
|
|
236
|
+
readonly upload_file: {
|
|
237
|
+
readonly one: "Select file to upload";
|
|
238
|
+
readonly other: "Select files to upload";
|
|
239
|
+
};
|
|
240
|
+
readonly file_max_size: "max {{size}}";
|
|
241
|
+
readonly file_extensions: "Accepted file extensions";
|
|
242
|
+
readonly address_error: "Something went wrong! Plase continue manually";
|
|
243
|
+
readonly address_search: "Type and search for places…";
|
|
244
|
+
readonly address_manual: "Fill in manually";
|
|
245
|
+
readonly back: "Back";
|
|
246
|
+
readonly search: "Search";
|
|
247
|
+
readonly unknown_error: "An error occurred";
|
|
248
|
+
readonly line1: "Line 1";
|
|
249
|
+
readonly line2: "Line 2";
|
|
250
|
+
readonly line3: "Line 3";
|
|
251
|
+
readonly city: "City";
|
|
252
|
+
readonly state: "State";
|
|
253
|
+
readonly postcode: "Postcode";
|
|
254
|
+
readonly country: "Country";
|
|
255
|
+
readonly select_country: "Select a country";
|
|
256
|
+
readonly validation_empty: "Please enter a value";
|
|
257
|
+
readonly validation_email: "That doesn’t look like a valid email address";
|
|
258
|
+
readonly validation_url: "That doesn’t look like a valid URL";
|
|
259
|
+
readonly validation_max_chars: "Please enter no more than {{count}} characters";
|
|
260
|
+
readonly validation_min_chars: "Please enter {{count}} or more characters";
|
|
261
|
+
readonly validation_phone: "Please enter a valid phone number";
|
|
262
|
+
readonly validation_country_code: "Please select a country code";
|
|
263
|
+
readonly validation_number: "Please enter a valid number";
|
|
264
|
+
readonly validation_number_min: "Please enter a number greater than or equal to {{min}}";
|
|
265
|
+
readonly validation_number_max: "Please enter a number less than or equal to {{max}}";
|
|
266
|
+
readonly validation_number_decimal_cases: "Please enter a number with at most {{count}} decimal cases";
|
|
267
|
+
readonly validation_file: "Please select a file";
|
|
268
|
+
readonly validation_file_ext: "Please only upload {{ext}} files";
|
|
269
|
+
readonly validation_file_min: {
|
|
270
|
+
readonly one: "Please upload at least one file";
|
|
271
|
+
readonly other: "Please only upload at least {{count}} files";
|
|
272
|
+
};
|
|
273
|
+
readonly validation_file_max: {
|
|
274
|
+
readonly one: "Please only upload one file";
|
|
275
|
+
readonly other: "Please only upload up to {{count}} files";
|
|
276
|
+
};
|
|
277
|
+
readonly validation_file_size: "Your file is too big. Please upload a file smaller than {{size}}";
|
|
278
|
+
}>(options: {
|
|
279
|
+
overrides: Partial<_inploi_i18n_translation.TranslationDict<{
|
|
280
|
+
readonly submission_redirect_message: "Almost there! Please complete your submission here:";
|
|
281
|
+
readonly complete_submission: "Complete submission";
|
|
282
|
+
readonly submission_completed: "Submission completed!";
|
|
283
|
+
readonly submission_failed: "Failed to submit";
|
|
284
|
+
readonly maximize: "Maximise";
|
|
285
|
+
readonly minimize: "Minimise";
|
|
286
|
+
readonly close_application: "Close application";
|
|
287
|
+
/** When an application is at an invalid state, the user will get this error. */
|
|
288
|
+
readonly invalid_state: "Invalid application state";
|
|
289
|
+
readonly redirect_url_error: "Couldn’t get the redirect URL.";
|
|
290
|
+
readonly upload_file: {
|
|
291
|
+
readonly one: "Select file to upload";
|
|
292
|
+
readonly other: "Select files to upload";
|
|
293
|
+
};
|
|
294
|
+
readonly file_max_size: "max {{size}}";
|
|
295
|
+
readonly file_extensions: "Accepted file extensions";
|
|
296
|
+
readonly address_error: "Something went wrong! Plase continue manually";
|
|
297
|
+
readonly address_search: "Type and search for places…";
|
|
298
|
+
readonly address_manual: "Fill in manually";
|
|
299
|
+
readonly back: "Back";
|
|
300
|
+
readonly search: "Search";
|
|
301
|
+
readonly unknown_error: "An error occurred";
|
|
302
|
+
readonly line1: "Line 1";
|
|
303
|
+
readonly line2: "Line 2";
|
|
304
|
+
readonly line3: "Line 3";
|
|
305
|
+
readonly city: "City";
|
|
306
|
+
readonly state: "State";
|
|
307
|
+
readonly postcode: "Postcode";
|
|
308
|
+
readonly country: "Country";
|
|
309
|
+
readonly select_country: "Select a country";
|
|
310
|
+
readonly validation_empty: "Please enter a value";
|
|
311
|
+
readonly validation_email: "That doesn’t look like a valid email address";
|
|
312
|
+
readonly validation_url: "That doesn’t look like a valid URL";
|
|
313
|
+
readonly validation_max_chars: "Please enter no more than {{count}} characters";
|
|
314
|
+
readonly validation_min_chars: "Please enter {{count}} or more characters";
|
|
315
|
+
readonly validation_phone: "Please enter a valid phone number";
|
|
316
|
+
readonly validation_country_code: "Please select a country code";
|
|
317
|
+
readonly validation_number: "Please enter a valid number";
|
|
318
|
+
readonly validation_number_min: "Please enter a number greater than or equal to {{min}}";
|
|
319
|
+
readonly validation_number_max: "Please enter a number less than or equal to {{max}}";
|
|
320
|
+
readonly validation_number_decimal_cases: "Please enter a number with at most {{count}} decimal cases";
|
|
321
|
+
readonly validation_file: "Please select a file";
|
|
322
|
+
readonly validation_file_ext: "Please only upload {{ext}} files";
|
|
323
|
+
readonly validation_file_min: {
|
|
324
|
+
readonly one: "Please upload at least one file";
|
|
325
|
+
readonly other: "Please only upload at least {{count}} files";
|
|
326
|
+
};
|
|
327
|
+
readonly validation_file_max: {
|
|
328
|
+
readonly one: "Please only upload one file";
|
|
329
|
+
readonly other: "Please only upload up to {{count}} files";
|
|
330
|
+
};
|
|
331
|
+
readonly validation_file_size: "Your file is too big. Please upload a file smaller than {{size}}";
|
|
332
|
+
}>>;
|
|
333
|
+
locale: string | undefined;
|
|
334
|
+
}) => _inploi_i18n_translation.TFn<T>;
|
|
335
|
+
declare const defaultTerms: {
|
|
336
|
+
readonly submission_redirect_message: "Almost there! Please complete your submission here:";
|
|
337
|
+
readonly complete_submission: "Complete submission";
|
|
338
|
+
readonly submission_completed: "Submission completed!";
|
|
339
|
+
readonly submission_failed: "Failed to submit";
|
|
340
|
+
readonly maximize: "Maximise";
|
|
341
|
+
readonly minimize: "Minimise";
|
|
342
|
+
readonly close_application: "Close application";
|
|
343
|
+
/** When an application is at an invalid state, the user will get this error. */
|
|
344
|
+
readonly invalid_state: "Invalid application state";
|
|
345
|
+
readonly redirect_url_error: "Couldn’t get the redirect URL.";
|
|
346
|
+
readonly upload_file: {
|
|
347
|
+
readonly one: "Select file to upload";
|
|
348
|
+
readonly other: "Select files to upload";
|
|
349
|
+
};
|
|
350
|
+
readonly file_max_size: "max {{size}}";
|
|
351
|
+
readonly file_extensions: "Accepted file extensions";
|
|
352
|
+
readonly address_error: "Something went wrong! Plase continue manually";
|
|
353
|
+
readonly address_search: "Type and search for places…";
|
|
354
|
+
readonly address_manual: "Fill in manually";
|
|
355
|
+
readonly back: "Back";
|
|
356
|
+
readonly search: "Search";
|
|
357
|
+
readonly unknown_error: "An error occurred";
|
|
358
|
+
readonly line1: "Line 1";
|
|
359
|
+
readonly line2: "Line 2";
|
|
360
|
+
readonly line3: "Line 3";
|
|
361
|
+
readonly city: "City";
|
|
362
|
+
readonly state: "State";
|
|
363
|
+
readonly postcode: "Postcode";
|
|
364
|
+
readonly country: "Country";
|
|
365
|
+
readonly select_country: "Select a country";
|
|
366
|
+
readonly validation_empty: "Please enter a value";
|
|
367
|
+
readonly validation_email: "That doesn’t look like a valid email address";
|
|
368
|
+
readonly validation_url: "That doesn’t look like a valid URL";
|
|
369
|
+
readonly validation_max_chars: "Please enter no more than {{count}} characters";
|
|
370
|
+
readonly validation_min_chars: "Please enter {{count}} or more characters";
|
|
371
|
+
readonly validation_phone: "Please enter a valid phone number";
|
|
372
|
+
readonly validation_country_code: "Please select a country code";
|
|
373
|
+
readonly validation_number: "Please enter a valid number";
|
|
374
|
+
readonly validation_number_min: "Please enter a number greater than or equal to {{min}}";
|
|
375
|
+
readonly validation_number_max: "Please enter a number less than or equal to {{max}}";
|
|
376
|
+
readonly validation_number_decimal_cases: "Please enter a number with at most {{count}} decimal cases";
|
|
377
|
+
readonly validation_file: "Please select a file";
|
|
378
|
+
readonly validation_file_ext: "Please only upload {{ext}} files";
|
|
379
|
+
readonly validation_file_min: {
|
|
380
|
+
readonly one: "Please upload at least one file";
|
|
381
|
+
readonly other: "Please only upload at least {{count}} files";
|
|
382
|
+
};
|
|
383
|
+
readonly validation_file_max: {
|
|
384
|
+
readonly one: "Please only upload one file";
|
|
385
|
+
readonly other: "Please only upload up to {{count}} files";
|
|
386
|
+
};
|
|
387
|
+
readonly validation_file_size: "Your file is too big. Please upload a file smaller than {{size}}";
|
|
388
|
+
};
|
|
389
|
+
type TFunction = ReturnType<typeof useTranslation>['t'];
|
|
390
|
+
type ChatbotTranslationTerms = Parameters<typeof TranslationProvider>[0]['terms'];
|
|
391
|
+
|
|
392
|
+
export { ChatbotTranslationTerms, TFunction, TranslationProvider, createTFunction, defaultTerms, useTranslation };
|
package/dist/i18n.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./chunk-DKKJHDKM.mjs";import{createTranslation as e}from"@inploi/i18n/preact";var{TranslationProvider:i,useTranslation:t,createTFunction:o,defaultTerms:l}=e({submission_redirect_message:"Almost there! Please complete your submission here:",complete_submission:"Complete submission",submission_completed:"Submission completed!",submission_failed:"Failed to submit",maximize:"Maximise",minimize:"Minimise",close_application:"Close application",invalid_state:"Invalid application state",redirect_url_error:"Couldn\u2019t get the redirect URL.",upload_file:{one:"Select file to upload",other:"Select files to upload"},file_max_size:"max {{size}}",file_extensions:"Accepted file extensions",address_error:"Something went wrong! Plase continue manually",address_search:"Type and search for places\u2026",address_manual:"Fill in manually",back:"Back",search:"Search",unknown_error:"An error occurred",line1:"Line 1",line2:"Line 2",line3:"Line 3",city:"City",state:"State",postcode:"Postcode",country:"Country",select_country:"Select a country",validation_empty:"Please enter a value",validation_email:"That doesn\u2019t look like a valid email address",validation_url:"That doesn\u2019t look like a valid URL",validation_max_chars:"Please enter no more than {{count}} characters",validation_min_chars:"Please enter {{count}} or more characters",validation_phone:"Please enter a valid phone number",validation_country_code:"Please select a country code",validation_number:"Please enter a valid number",validation_number_min:"Please enter a number greater than or equal to {{min}}",validation_number_max:"Please enter a number less than or equal to {{max}}",validation_number_decimal_cases:"Please enter a number with at most {{count}} decimal cases",validation_file:"Please select a file",validation_file_ext:"Please only upload {{ext}} files",validation_file_min:{one:"Please upload at least one file",other:"Please only upload at least {{count}} files"},validation_file_max:{one:"Please only upload one file",other:"Please only upload up to {{count}} files"},validation_file_size:"Your file is too big. Please upload a file smaller than {{size}}"});export{i as TranslationProvider,o as createTFunction,l as defaultTerms,t as useTranslation};
|
|
2
|
+
//# sourceMappingURL=i18n.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/i18n.ts"],"sourcesContent":["import { createTranslation } from '@inploi/i18n/preact';\n\nexport const { TranslationProvider, useTranslation, createTFunction, defaultTerms } = createTranslation({\n\tsubmission_redirect_message: 'Almost there! Please complete your submission here:',\n\tcomplete_submission: 'Complete submission',\n\tsubmission_completed: 'Submission completed!',\n\tsubmission_failed: 'Failed to submit',\n\tmaximize: 'Maximise',\n\tminimize: 'Minimise',\n\tclose_application: 'Close application',\n\t/** When an application is at an invalid state, the user will get this error. */\n\tinvalid_state: 'Invalid application state',\n\tredirect_url_error: 'Couldn’t get the redirect URL.',\n\tupload_file: {\n\t\tone: 'Select file to upload',\n\t\tother: 'Select files to upload',\n\t},\n\tfile_max_size: 'max {{size}}',\n\tfile_extensions: 'Accepted file extensions',\n\taddress_error: 'Something went wrong! Plase continue manually',\n\taddress_search: 'Type and search for places…',\n\taddress_manual: 'Fill in manually',\n\tback: 'Back',\n\tsearch: 'Search',\n\tunknown_error: 'An error occurred',\n\n\tline1: 'Line 1',\n\tline2: 'Line 2',\n\tline3: 'Line 3',\n\tcity: 'City',\n\tstate: 'State',\n\tpostcode: 'Postcode',\n\tcountry: 'Country',\n\tselect_country: 'Select a country',\n\n\tvalidation_empty: 'Please enter a value',\n\tvalidation_email: 'That doesn’t look like a valid email address',\n\tvalidation_url: 'That doesn’t look like a valid URL',\n\tvalidation_max_chars: 'Please enter no more than {{count}} characters',\n\tvalidation_min_chars: 'Please enter {{count}} or more characters',\n\tvalidation_phone: 'Please enter a valid phone number',\n\tvalidation_country_code: 'Please select a country code',\n\tvalidation_number: 'Please enter a valid number',\n\tvalidation_number_min: 'Please enter a number greater than or equal to {{min}}',\n\tvalidation_number_max: 'Please enter a number less than or equal to {{max}}',\n\tvalidation_number_decimal_cases: 'Please enter a number with at most {{count}} decimal cases',\n\tvalidation_file: 'Please select a file',\n\tvalidation_file_ext: 'Please only upload {{ext}} files',\n\tvalidation_file_min: { one: 'Please upload at least one file', other: 'Please only upload at least {{count}} files' },\n\tvalidation_file_max: { one: 'Please only upload one file', other: 'Please only upload up to {{count}} files' },\n\tvalidation_file_size: 'Your file is too big. Please upload a file smaller than {{size}}',\n});\n\nexport type TFunction = ReturnType<typeof useTranslation>['t'];\n\nexport type ChatbotTranslationTerms = Parameters<typeof TranslationProvider>[0]['terms'];\n"],"mappings":"6BAAA,OAAS,qBAAAA,MAAyB,sBAE3B,GAAM,CAAE,oBAAAC,EAAqB,eAAAC,EAAgB,gBAAAC,EAAiB,aAAAC,CAAa,EAAIJ,EAAkB,CACvG,4BAA6B,sDAC7B,oBAAqB,sBACrB,qBAAsB,wBACtB,kBAAmB,mBACnB,SAAU,WACV,SAAU,WACV,kBAAmB,oBAEnB,cAAe,4BACf,mBAAoB,sCACpB,YAAa,CACZ,IAAK,wBACL,MAAO,wBACR,EACA,cAAe,eACf,gBAAiB,2BACjB,cAAe,gDACf,eAAgB,mCAChB,eAAgB,mBAChB,KAAM,OACN,OAAQ,SACR,cAAe,oBAEf,MAAO,SACP,MAAO,SACP,MAAO,SACP,KAAM,OACN,MAAO,QACP,SAAU,WACV,QAAS,UACT,eAAgB,mBAEhB,iBAAkB,uBAClB,iBAAkB,oDAClB,eAAgB,0CAChB,qBAAsB,iDACtB,qBAAsB,4CACtB,iBAAkB,oCAClB,wBAAyB,+BACzB,kBAAmB,8BACnB,sBAAuB,yDACvB,sBAAuB,sDACvB,gCAAiC,6DACjC,gBAAiB,uBACjB,oBAAqB,mCACrB,oBAAqB,CAAE,IAAK,kCAAmC,MAAO,6CAA8C,EACpH,oBAAqB,CAAE,IAAK,8BAA+B,MAAO,0CAA2C,EAC7G,qBAAsB,kEACvB,CAAC","names":["createTranslation","TranslationProvider","useTranslation","createTFunction","defaultTerms"]}
|
package/dist/interpreter.d.mts
CHANGED
|
@@ -1,120 +1,10 @@
|
|
|
1
1
|
import { FlowNode } from '@inploi/core/flows';
|
|
2
2
|
import { InploiRpcClient, AnalyticsService, Logger } from '@inploi/sdk';
|
|
3
3
|
import { F as FlowSubmissions, a as FlowInput, R as Result, V as ValiError } from './result-3e1b4efe.js';
|
|
4
|
-
import
|
|
4
|
+
import { TFunction } from './i18n.mjs';
|
|
5
5
|
import { LinkedList } from './linked-list.mjs';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
readonly submission_redirect_message: "Almost there! Please complete your submission here:";
|
|
9
|
-
readonly complete_submission: "Complete submission";
|
|
10
|
-
readonly submission_completed: "Submission completed!";
|
|
11
|
-
readonly submission_failed: "Failed to submit";
|
|
12
|
-
readonly maximize: "Maximise";
|
|
13
|
-
readonly minimize: "Minimise";
|
|
14
|
-
readonly close_application: "Close application";
|
|
15
|
-
/** When an application is at an invalid state, the user will get this error. */
|
|
16
|
-
readonly invalid_state: "Invalid application state";
|
|
17
|
-
readonly redirect_url_error: "Couldn’t get the redirect URL.";
|
|
18
|
-
readonly upload_file: {
|
|
19
|
-
readonly one: "Select file to upload";
|
|
20
|
-
readonly other: "Select files to upload";
|
|
21
|
-
};
|
|
22
|
-
readonly file_max_size: "max {{size}}";
|
|
23
|
-
readonly file_extensions: "Accepted file extensions";
|
|
24
|
-
readonly address_error: "Something went wrong! Plase continue manually";
|
|
25
|
-
readonly address_search: "Type and search for places…";
|
|
26
|
-
readonly address_manual: "Fill in manually";
|
|
27
|
-
readonly back: "Back";
|
|
28
|
-
readonly search: "Search";
|
|
29
|
-
readonly unknown_error: "An error occurred";
|
|
30
|
-
readonly line1: "Line 1";
|
|
31
|
-
readonly line2: "Line 2";
|
|
32
|
-
readonly line3: "Line 3";
|
|
33
|
-
readonly city: "City";
|
|
34
|
-
readonly state: "State";
|
|
35
|
-
readonly postcode: "Postcode";
|
|
36
|
-
readonly country: "Country";
|
|
37
|
-
readonly select_country: "Select a country";
|
|
38
|
-
readonly validation_empty: "Please enter a value";
|
|
39
|
-
readonly validation_email: "That doesn’t look like a valid email address";
|
|
40
|
-
readonly validation_url: "That doesn’t look like a valid URL";
|
|
41
|
-
readonly validation_max_chars: "Please enter no more than {{count}} characters";
|
|
42
|
-
readonly validation_min_chars: "Please enter {{count}} or more characters";
|
|
43
|
-
readonly validation_phone: "Please enter a valid phone number";
|
|
44
|
-
readonly validation_country_code: "Please select a country code";
|
|
45
|
-
readonly validation_number: "Please enter a valid number";
|
|
46
|
-
readonly validation_number_min: "Please enter a number greater than or equal to {{min}}";
|
|
47
|
-
readonly validation_number_max: "Please enter a number less than or equal to {{max}}";
|
|
48
|
-
readonly validation_number_decimal_cases: "Please enter a number with at most {{count}} decimal cases";
|
|
49
|
-
readonly validation_file: "Please select a file";
|
|
50
|
-
readonly validation_file_ext: "Please only upload {{ext}} files";
|
|
51
|
-
readonly validation_file_min: {
|
|
52
|
-
readonly one: "Please upload at least one file";
|
|
53
|
-
readonly other: "Please only upload at least {{count}} files";
|
|
54
|
-
};
|
|
55
|
-
readonly validation_file_max: {
|
|
56
|
-
readonly one: "Please only upload one file";
|
|
57
|
-
readonly other: "Please only upload up to {{count}} files";
|
|
58
|
-
};
|
|
59
|
-
readonly validation_file_size: "Your file is too big. Please upload a file smaller than {{size}}";
|
|
60
|
-
} = {
|
|
61
|
-
readonly submission_redirect_message: "Almost there! Please complete your submission here:";
|
|
62
|
-
readonly complete_submission: "Complete submission";
|
|
63
|
-
readonly submission_completed: "Submission completed!";
|
|
64
|
-
readonly submission_failed: "Failed to submit";
|
|
65
|
-
readonly maximize: "Maximise";
|
|
66
|
-
readonly minimize: "Minimise";
|
|
67
|
-
readonly close_application: "Close application";
|
|
68
|
-
/** When an application is at an invalid state, the user will get this error. */
|
|
69
|
-
readonly invalid_state: "Invalid application state";
|
|
70
|
-
readonly redirect_url_error: "Couldn’t get the redirect URL.";
|
|
71
|
-
readonly upload_file: {
|
|
72
|
-
readonly one: "Select file to upload";
|
|
73
|
-
readonly other: "Select files to upload";
|
|
74
|
-
};
|
|
75
|
-
readonly file_max_size: "max {{size}}";
|
|
76
|
-
readonly file_extensions: "Accepted file extensions";
|
|
77
|
-
readonly address_error: "Something went wrong! Plase continue manually";
|
|
78
|
-
readonly address_search: "Type and search for places…";
|
|
79
|
-
readonly address_manual: "Fill in manually";
|
|
80
|
-
readonly back: "Back";
|
|
81
|
-
readonly search: "Search";
|
|
82
|
-
readonly unknown_error: "An error occurred";
|
|
83
|
-
readonly line1: "Line 1";
|
|
84
|
-
readonly line2: "Line 2";
|
|
85
|
-
readonly line3: "Line 3";
|
|
86
|
-
readonly city: "City";
|
|
87
|
-
readonly state: "State";
|
|
88
|
-
readonly postcode: "Postcode";
|
|
89
|
-
readonly country: "Country";
|
|
90
|
-
readonly select_country: "Select a country";
|
|
91
|
-
readonly validation_empty: "Please enter a value";
|
|
92
|
-
readonly validation_email: "That doesn’t look like a valid email address";
|
|
93
|
-
readonly validation_url: "That doesn’t look like a valid URL";
|
|
94
|
-
readonly validation_max_chars: "Please enter no more than {{count}} characters";
|
|
95
|
-
readonly validation_min_chars: "Please enter {{count}} or more characters";
|
|
96
|
-
readonly validation_phone: "Please enter a valid phone number";
|
|
97
|
-
readonly validation_country_code: "Please select a country code";
|
|
98
|
-
readonly validation_number: "Please enter a valid number";
|
|
99
|
-
readonly validation_number_min: "Please enter a number greater than or equal to {{min}}";
|
|
100
|
-
readonly validation_number_max: "Please enter a number less than or equal to {{max}}";
|
|
101
|
-
readonly validation_number_decimal_cases: "Please enter a number with at most {{count}} decimal cases";
|
|
102
|
-
readonly validation_file: "Please select a file";
|
|
103
|
-
readonly validation_file_ext: "Please only upload {{ext}} files";
|
|
104
|
-
readonly validation_file_min: {
|
|
105
|
-
readonly one: "Please upload at least one file";
|
|
106
|
-
readonly other: "Please only upload at least {{count}} files";
|
|
107
|
-
};
|
|
108
|
-
readonly validation_file_max: {
|
|
109
|
-
readonly one: "Please only upload one file";
|
|
110
|
-
readonly other: "Please only upload up to {{count}} files";
|
|
111
|
-
};
|
|
112
|
-
readonly validation_file_size: "Your file is too big. Please upload a file smaller than {{size}}";
|
|
113
|
-
}>() => {
|
|
114
|
-
t: _inploi_i18n_translation.TFn<T>;
|
|
115
|
-
locale: string | undefined;
|
|
116
|
-
};
|
|
117
|
-
type TFunction = ReturnType<typeof useTranslation>['t'];
|
|
6
|
+
import 'preact';
|
|
7
|
+
import '@inploi/i18n/translation';
|
|
118
8
|
|
|
119
9
|
type MaybePromise<T> = T | Promise<T>;
|
|
120
10
|
type FlowInterpreterYield = {
|
package/dist/interpreter.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{A as v,B as m,C as f,D as Z,F as ee,G as P,H as M,I as te,J as Q,K as re,a as q,b as L,c as B,d as G,e as c,f as I,g as D,h as R,i as U,j as w,k as W,l as x,m as X,n as z,o as T,p as H,q as V,r as J,s as A,t as F,u as k,v as j,w as O,x as g,y as K,z as b}from"./chunk-VKMPK5WA.mjs";var $=B(D());var ne=({condition:n,context:e,submissions:u,ifBlock:s})=>{let[i,...a]=n.compareKey.split(".");if(!i)return!1;let r=M({context:e,key:i,path:a,submissions:u});if(!r)return!1;switch(r.type){case"address":{let t=(0,$.default)(r.value,a.join("."));switch(n.compare){case"equals":return t===n.compareValue;case"contains":return t?t.includes(n.compareValue):!1;case"notEquals":return t!==n.compareValue;case"notContains":return t?!t.includes(n.compareValue):!0}break}case"integration":{if(typeof r.value!="object"||Array.isArray(r.value))return!1;let t=(0,$.default)(r.value,a.join(".")),o=L(q({},s),{data:L(q({},s.data),{compareKey:"_temp"})});switch(typeof t){case"boolean":return C(o,{submissions:{_temp:{value:t,type:"boolean"}},context:e});case"string":return C(o,{submissions:{_temp:{value:t,type:"string"}},context:e});case"number":return C(o,{submissions:{_temp:{value:t,type:"number"}},context:e});case"object":return Array.isArray(t)&&t.every(l=>typeof l=="string")?C(o,{submissions:{_temp:{value:t,type:"enum"}},context:e}):!1}break}case"boolean":{let t=n.compareValue==="true";switch(n.compare){case"equals":return r.value===t;case"notEquals":return r.value!==t}break}case"phone":case"string":{let t=r.type==="phone"?r.value.countryCode+r.value.phoneNumber:r.value;switch(n.compare){case"equals":return t===n.compareValue;case"contains":return t?t.includes(n.compareValue):!1;case"notEquals":return t!==n.compareValue;case"notContains":return t?!t.includes(n.compareValue):!0}break}case"number":{try{let t=Number(n.compareValue);switch(n.compare){case"equals":return r.value===t;case"notEquals":return r.value!==t;case"greaterThan":return r.value>t;case"greaterThanOrEqualTo":return r.value>=t;case"lessThan":return r.value<t;case"lessThanOrEqualTo":return r.value<=t}}catch(t){return console.error(`Failed to parse number in if-block ${s.id}`,r.value),!1}break}case"enum":switch(n.compare){case"equals":return r.value.length===1&&r.value[0]===n.compareValue;case"notEquals":return r.value.length===1&&r.value[0]!==n.compareValue;case"contains":return r.value.includes(n.compareValue);case"notContains":return!r.value.includes(n.compareValue)}break;case"file":break;default:break}},C=(n,{context:e,submissions:u})=>{let s="combinator"in n.data?n.data.conditions:[n.data];if(("combinator"in n.data?n.data.combinator:"and")==="or"){for(let a of s)if(ne({condition:a,context:e,submissions:u,ifBlock:n}))return!0;return!1}else{for(let a of s)if(!ne({condition:a,context:e,submissions:u,ifBlock:n}))return!1;return!0}};var ae=B(D());var ve=/{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g,N=(n,{context:e,submissions:u})=>n.replace(ve,(s,i,a="")=>{let[r,...t]=i.trim().split("."),o=M({key:r,path:t,submissions:u,context:e});if(!o)return a;switch(o.type){case"boolean":return o.value===!0?"true":"false";case"file":return o.value.map(l=>`${l.name} (${Q(l.sizeKb)})`).join(", ");case"enum":return o.value.join(", ");case"address":return Object.values(o.value).filter(l=>l&&l.trim().length>0).join(", ");case"number":case"string":return o.value?o.value.toString():a;case"phone":return re(o.value);case"integration":{if(typeof o.value!="object"||Array.isArray(o.value))break;let l=(0,ae.default)(o.value,t.join("."));switch(typeof l){case"boolean":return l===!0?"true":"false";case"string":return l;case"number":return l.toString();case"object":if(Array.isArray(l)&&l.every(d=>typeof d=="string"))return l.join(", ")}break}default:}return a});function oe(n){return c(this,null,function*(){let{node:e,config:{logger:u,analytics:s,submissions:i,next:a}}=n;return s.service.log({event:"IDENTIFY",properties:{identifier:P({key:e.data.key,submissions:i}).toString(),first_name:e.data.firstName?P({key:e.data.firstName,submissions:i}).toString():void 0,last_name:e.data.lastName?P({key:e.data.lastName,submissions:i}).toString():void 0,email:e.data.email?P({key:e.data.email,submissions:i}).toString():void 0,phone_number:e.data.phoneNumber?P({key:e.data.phoneNumber,submissions:i}).toString():void 0,custom_traits:e.data.customTraits?Object.fromEntries(e.data.customTraits.map(({key:r,value:t})=>{var o;return[r,(o=i[t])==null?void 0:o.value]})):void 0}}).catch(u.error),a(e.nextId)})}import{endpoint as be,typed as he}from"@inploi/sdk";var se=k({success:J(),integration_response:k({service:j(g()),status:F(),data:K(),error:A(k({message:g(),data:K()}))})}),Ie=be({pathname:"/flow/submit",method:"POST",schema:{response:se,body:he()}});function ie(n){return c(this,null,function*(){var l;let{node:e,config:{rpcClient:u,submissions:s,actions:i,next:a,analytics:r,logger:t,context:o}}=n;return e.data.skipConfirmation!==!0&&(yield i.input("submit",{config:{key:(l=e.data.key)!=null?l:"_SUBMIT",label:e.data.submitLabel},validate:()=>G(this,null,function*(){let p=Z(r.service.getSessionInfo)();p.err&&t.error(p.val.originalError);try{let y=yield u.request(Ie,{body:{log_submit:!1,integration_id:e.data.integrationId,anonymous_id:p.ok?p.val.anonymous_id:void 0,session_id:p.ok?p.val.session_id:void 0,job:o.job,submissions:ee(s)}}),h=v(se,y);return h.success===!1?f(h.issues):m(h.output)}catch(y){let h=[{input:y,origin:"value",reason:"unknown",validation:"API error",message:y instanceof Error?y.message:"toString"in y?y.toString():"Unknown error"}];return f(h)}})})),a(e.nextId)})}var S=b(A(j(g())),T(n=>n===null?void 0:n)),ke=({node:n})=>{var u,s,i,a,r,t,o;let e=n.data.keys;return k({[(u=e.line1)!=null?u:"line1"]:S,[(s=e.line2)!=null?s:"line2"]:S,[(i=e.line3)!=null?i:"line3"]:S,[(a=e.city)!=null?a:"city"]:S,[(r=e.country)!=null?r:"country"]:S,[(t=e.postcode)!=null?t:"postcode"]:S,[(o=e.state)!=null?o:"state"]:S})};function ue(n){return c(this,null,function*(){let{node:e,config:{submissions:u,actions:s,next:i}}=n;return yield s.text({author:"bot",message:e.data.question}),yield s.input("address",{config:{key:e.data.key,keys:e.data.keys,placeholder:e.data.placeholder,optional:e.data.optional},validate:a=>{if(e.data.optional&&a===null)return m(a);let r=ke(n),t=v(r,a);return t.success===!1?f(t.issues):(u[e.data.key]={type:"address",value:t.output},m(a))}}),i(e.nextId)})}var xe=["true","false"],Ne=O(xe);function le(n){return c(this,null,function*(){let{node:e,config:{submissions:u,actions:s,next:i}}=n;return yield s.text({author:"bot",message:e.data.question}),yield s.input("boolean",{config:{key:e.data.key,labels:{false:e.data.falseLabel,true:e.data.trueLabel},optional:e.data.optional},validate:a=>{if(e.data.optional&&a===null)return m(a);let r=v(Ne,a);return r.success===!1?f(r.issues):(u[e.data.key]={type:"boolean",value:r.output==="true"},m(a))}}),i(e.nextId)})}function de(n){return c(this,null,function*(){let{node:e,config:{submissions:u,actions:s,next:i}}=n;yield s.text({author:"bot",message:e.data.question});let a=V(O(e.data.options.map(r=>r.value)));return yield s.input("multiple-choice",{config:{key:e.data.key,options:e.data.options,maxSelected:e.data.maxSelected,minSelected:e.data.minSelected},validate:r=>{if(e.data.minSelected===0&&r===null)return m(r);let t=v(a,r);return t.success===!1?f(t.issues):(u[e.data.key]={type:"enum",value:t.output},m(r))}}),i(e.nextId)})}function me(n){return c(this,null,function*(){let{node:e,config:{submissions:u,actions:s,next:i,t:a}}=n;return yield s.text({author:"bot",message:e.data.question}),yield s.input("file",{config:{key:e.data.key,allowMultiple:e.data.multiple===!0,extensions:e.data.extensions,fileSizeLimitKib:e.data.maxSizeKb,optional:e.data.optional},validate:r=>{var h;if(e.data.optional&&r===null)return m(r);let t=e.data.optional?0:1,o=e.data.multiple?Number.POSITIVE_INFINITY:1,l=(h=e.data.maxSizeKb)!=null?h:0,d=e.data.extensions.map(E=>E.toLowerCase()),p=b(V(k({name:b(g(a("validation_empty")),R(E=>{let Y=te(E);return Y.ok===!1?!1:d.includes(Y.val.toLowerCase())},a("validation_file_ext",{ext:d.join(", ")}))),data:g(),sizeKb:F()})),x(t,a("validation_file_min",{count:t})),w(o,a("validation_file_max",{count:o})),R(E=>E.reduce((ye,ge)=>ye+ge.sizeKb,0)<=l,a("validation_file_size",{size:Q(l)}))),y=v(p,r);return y.success===!1?f(y.issues):(u[e.data.key]={type:"file",value:y.output},m(r))}}),i(e.nextId)})}var we=({node:n,config:{t:e}})=>{var a,r,t;let u=(a=n.data.min)!=null?a:Number.MIN_SAFE_INTEGER,s=(r=n.data.max)!=null?r:Number.MAX_SAFE_INTEGER,i=(t=n.data.decimalCases)!=null?t:0;return b(F(e("validation_number")),X(u,e("validation_number_min",{min:u})),W(s,e("validation_number_max",{max:s})),R(o=>o===Number(o.toFixed(i)),e("validation_number_decimal_cases",{count:i})))};function pe(n){return c(this,null,function*(){let{node:e,config:{submissions:u,actions:s,next:i}}=n;yield s.text({author:"bot",message:e.data.question});let a=u[e.data.key];return yield s.input("number",{config:{key:e.data.key,placeholder:e.data.placeholder,optional:e.data.optional,decimalCases:e.data.decimalCases,max:e.data.max,min:e.data.min,defaultValue:(a==null?void 0:a.type)==="number"?a.value.toString():void 0},validate:r=>{if(e.data.optional&&r===null)return m(r);let t=we(n),o=v(t,r);return o.success===!1?f(o.issues):(u[e.data.key]={type:"number",value:o.output},m(r))}}),i(e.nextId)})}var _e=({node:n,config:{t:e}})=>k({countryCode:b(g(e("validation_country_code")),z(/^\+?[0-9 -]+$/,e("validation_country_code"))),phoneNumber:b(g(e("validation_phone")),z(/^\+?[0-9 -]+$/,e("validation_phone")),x(n.data.minChars,e("validation_min_chars",{count:n.data.minChars})),T(u=>u.replace(/[^0-9]/g,"")))});function ce(n){return c(this,null,function*(){let{node:e,config:{actions:u,next:s,submissions:i}}=n;yield u.text({author:"bot",message:e.data.question});let a=i[e.data.key];return yield u.input("phone",{config:{key:e.data.key,minChars:e.data.minChars,defaultValue:(a==null?void 0:a.type)==="phone"?a.value:{countryCode:e.data.defaultCountryCode},placeholder:e.data.placeholder,submissionFormat:"phone",optional:e.data.optional},validate:r=>{if(e.data.optional&&r===null)return m(r);let t=_e(n),o=v(t,r);return o.success===!1?f(o.issues):(i[e.data.key]={type:"address",value:o.output},m(r))}}),s(e.nextId)})}var Se=({node:n,config:{t:e,logger:u}})=>{var i,a,r,t,o,l,d,p,y,h;let s={email:e("validation_email"),url:e("validation_url"),maxLength:e("validation_max_chars",{count:(i=n.data.maxChars)!=null?i:999}),minLength:e("validation_min_chars",{count:(a=n.data.minChars)!=null?a:1})};switch(n.data.format){case"email":return b(g(s.email),U(s.email),x((r=n.data.minChars)!=null?r:1,s.minLength),w((t=n.data.maxChars)!=null?t:1/0,s.maxLength));case"text":return b(g(),x((o=n.data.minChars)!=null?o:1,s.minLength),w((l=n.data.maxChars)!=null?l:1/0,s.maxLength));case"url":return b(g(),H(s.url),x((d=n.data.minChars)!=null?d:1,s.minLength),w((p=n.data.maxChars)!=null?p:1/0,s.maxLength));case"phone":return b(g(),x((y=n.data.minChars)!=null?y:1,s.minLength),w((h=n.data.maxChars)!=null?h:1/0,s.maxLength));default:return n.data.format,u.error(`Unsupported question-text format: ${n.data.format}`),null}};function fe(n){return c(this,null,function*(){let{node:e,config:{submissions:u,actions:s,next:i}}=n;yield s.text({author:"bot",message:e.data.question});let a=u[e.data.key];return yield s.input("text",{config:{key:e.data.key,maxChars:e.data.maxChars,minChars:e.data.minChars,placeholder:e.data.placeholder,format:e.data.format,optional:e.data.optional,defaultValue:(a==null?void 0:a.type)==="string"?a.value:void 0},validate:r=>{if(e.data.optional&&r===null)return m(r);let t=Se(n);if(t===null)return m(r);let o=v(t,r);return o.success===!1?f(o.issues):(u[e.data.key]={type:"string",value:o.output},m(r))}}),i(e.nextId)})}var ht=n=>{let e={};return{interpret:function(a){return c(this,arguments,function*({nodes:s,context:i}){let r={error:({message:d})=>({type:"error",message:N(d,{submissions:e,context:i})}),info:({message:d})=>({type:"info",message:N(d,{submissions:e,context:i})}),success:({message:d})=>({type:"success",message:N(d,{submissions:e,context:i})}),text:({message:d,author:p})=>({type:"text",author:p,message:N(d,{submissions:e,context:i})}),image:({url:d,height:p,width:y})=>({type:"image",url:N(d,{submissions:e,context:i}),height:p,width:y}),state:d=>({type:"state",state:d}),link:({href:d,message:p})=>({type:"link",href:N(d,{submissions:e,context:i}),message:N(p,{submissions:e,context:i})}),submissions:d=>({type:"submissions",submissions:d}),input:(d,p)=>({type:"input",input:{type:d,config:p.config,validate:p.validate}})};if(!s.headId)return{type:"error",message:"No head node found"};let t=s.items[s.headId],o=d=>{if(!d)return t=void 0,{type:"next",nodeId:void 0};let p=s.items[d];if(!p)throw new Error(`Next node with id ${d} not found`);return t=p,{type:"next",nodeId:d}},l=L(q({},n),{context:i,submissions:e,next:o,actions:r});for(;t;){switch(t.type){case"text":yield r.text({author:"bot",message:t.data.text}),o(t.nextId);break;case"image":yield r.image(t.data),o(t.nextId);break;case"link":yield r.link({href:t.data.href,message:t.data.cta}),o(t.nextId);break;case"add-submission":e[t.data.key]={type:"string",value:t.data.value},o(t.nextId);break;case"jump":o(t.data.targetId);break;case"question-text":yield*I(fe({config:l,node:t}));break;case"question-phone":yield*I(ce({config:l,node:t}));break;case"question-boolean":yield*I(le({config:l,node:t}));break;case"question-number":yield*I(pe({config:l,node:t}));break;case"question-address":yield*I(ue({config:l,node:t}));break;case"question-enum":yield*I(de({config:l,node:t}));break;case"question-file":yield*I(me({config:l,node:t}));break;case"identify":{yield*I(oe({config:l,node:t}));break}case"if-block":{let d=C(t,{context:l.context,submissions:e})?t.branchId:t.nextId;o(d);break}case"integration-application-submit":yield*I(ie({config:l,node:t}));break;case"feedback":yield r.error({message:"Not implemented"});break;case"integration-workflow-get":yield r.error({message:"This message should never be reached"});break;case"end-flow":t=void 0;break}yield r.submissions(e)}yield{type:"end"}})}}};export{ht as createFlowInterpreter};
|
|
1
|
+
import{A as S,B as T,C as W,D as V,E as X,a as Y,b as P,c as z,d as k,e as K,f as h,g as $,h as j,i as C,j as B,k as E,l as G,m as q,n as w,o as v,p as L,q as R,r as c,s as O,t as y,u as f,v as d,w as p,x as D,z as U}from"./chunk-3HF7KDUR.mjs";import{b as Q}from"./chunk-DKKJHDKM.mjs";var M=Q(Y());var H=({condition:r,context:e,submissions:l,ifBlock:o})=>{let[u,...a]=r.compareKey.split(".");if(!u)return!1;let t=T({context:e,key:u,path:a,submissions:l});if(!t)return!1;switch(t.type){case"address":{let n=(0,M.default)(t.value,a.join("."));switch(r.compare){case"equals":return n===r.compareValue;case"contains":return n?n.includes(r.compareValue):!1;case"notEquals":return n!==r.compareValue;case"notContains":return n?!n.includes(r.compareValue):!0}break}case"integration":{if(typeof t.value!="object"||Array.isArray(t.value))return!1;let n=(0,M.default)(t.value,a.join(".")),s={...o,data:{...o.data,compareKey:"_temp"}};switch(typeof n){case"boolean":return _(s,{submissions:{_temp:{value:n,type:"boolean"}},context:e});case"string":return _(s,{submissions:{_temp:{value:n,type:"string"}},context:e});case"number":return _(s,{submissions:{_temp:{value:n,type:"number"}},context:e});case"object":return Array.isArray(n)&&n.every(i=>typeof i=="string")?_(s,{submissions:{_temp:{value:n,type:"enum"}},context:e}):!1}break}case"boolean":{let n=r.compareValue==="true";switch(r.compare){case"equals":return t.value===n;case"notEquals":return t.value!==n}break}case"phone":case"string":{let n=t.type==="phone"?t.value.countryCode+t.value.phoneNumber:t.value;switch(r.compare){case"equals":return n===r.compareValue;case"contains":return n?n.includes(r.compareValue):!1;case"notEquals":return n!==r.compareValue;case"notContains":return n?!n.includes(r.compareValue):!0}break}case"number":{try{let n=Number(r.compareValue);switch(r.compare){case"equals":return t.value===n;case"notEquals":return t.value!==n;case"greaterThan":return t.value>n;case"greaterThanOrEqualTo":return t.value>=n;case"lessThan":return t.value<n;case"lessThanOrEqualTo":return t.value<=n}}catch{return console.error(`Failed to parse number in if-block ${o.id}`,t.value),!1}break}case"enum":switch(r.compare){case"equals":return t.value.length===1&&t.value[0]===r.compareValue;case"notEquals":return t.value.length===1&&t.value[0]!==r.compareValue;case"contains":return t.value.includes(r.compareValue);case"notContains":return!t.value.includes(r.compareValue)}break;case"file":break;default:break}},_=(r,{context:e,submissions:l})=>{let o="combinator"in r.data?r.data.conditions:[r.data];if(("combinator"in r.data?r.data.combinator:"and")==="or"){for(let a of o)if(H({condition:a,context:e,submissions:l,ifBlock:r}))return!0;return!1}else{for(let a of o)if(!H({condition:a,context:e,submissions:l,ifBlock:r}))return!1;return!0}};var J=Q(Y());var me=/{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g,I=(r,{context:e,submissions:l})=>r.replace(me,(o,u,a="")=>{let[t,...n]=u.trim().split("."),s=T({key:t,path:n,submissions:l,context:e});if(!s)return a;switch(s.type){case"boolean":return s.value===!0?"true":"false";case"file":return s.value.map(i=>`${i.name} (${V(i.sizeKb)})`).join(", ");case"enum":return s.value.join(", ");case"address":return Object.values(s.value).filter(i=>i&&i.trim().length>0).join(", ");case"number":case"string":return s.value?s.value.toString():a;case"phone":return X(s.value);case"integration":{if(typeof s.value!="object"||Array.isArray(s.value))break;let i=(0,J.default)(s.value,n.join("."));switch(typeof i){case"boolean":return i===!0?"true":"false";case"string":return i;case"number":return i.toString();case"object":if(Array.isArray(i)&&i.every(m=>typeof m=="string"))return i.join(", ")}break}default:}return a});async function*Z(r){let{node:e,config:{logger:l,analytics:o,submissions:u,next:a}}=r;return o.service.log({event:"IDENTIFY",properties:{identifier:S({key:e.data.key,submissions:u}).toString(),first_name:e.data.firstName?S({key:e.data.firstName,submissions:u}).toString():void 0,last_name:e.data.lastName?S({key:e.data.lastName,submissions:u}).toString():void 0,email:e.data.email?S({key:e.data.email,submissions:u}).toString():void 0,phone_number:e.data.phoneNumber?S({key:e.data.phoneNumber,submissions:u}).toString():void 0,custom_traits:e.data.customTraits?Object.fromEntries(e.data.customTraits.map(({key:t,value:n})=>[t,u[n]?.value])):void 0}}).catch(l.error),a(e.nextId)}import{endpoint as pe,typed as ce}from"@inploi/sdk";var ee=v({success:G(),integration_response:v({service:L(c()),status:w(),data:O(),error:q(v({message:c(),data:O()}))})}),fe=pe({pathname:"/flow/submit",method:"POST",schema:{response:ee,body:ce()}});async function*te(r){let{node:e,config:{rpcClient:l,submissions:o,actions:u,next:a,analytics:t,logger:n,context:s}}=r;return e.data.skipConfirmation!==!0&&(yield u.input("submit",{config:{key:e.data.key??"_SUBMIT",label:e.data.submitLabel},validate:async()=>{let m=D(t.service.getSessionInfo)();m.err&&n.error(m.val.originalError);try{let g=await l.request(fe,{body:{log_submit:!1,integration_id:e.data.integrationId,anonymous_id:m.ok?m.val.anonymous_id:void 0,session_id:m.ok?m.val.session_id:void 0,job:s.job,submissions:U(o)}}),b=f(ee,g);return b.success===!1?p(b.issues):d(b.output)}catch(g){let b=[{input:g,origin:"value",reason:"unknown",validation:"API error",message:g instanceof Error?g.message:"toString"in g?g.toString():"Unknown error"}];return p(b)}}})),a(e.nextId)}var N=y(q(L(c())),C(r=>r===null?void 0:r)),ye=({node:r})=>{let e=r.data.keys;return v({[e.line1??"line1"]:N,[e.line2??"line2"]:N,[e.line3??"line3"]:N,[e.city??"city"]:N,[e.country??"country"]:N,[e.postcode??"postcode"]:N,[e.state??"state"]:N})};async function*re(r){let{node:e,config:{submissions:l,actions:o,next:u}}=r;return yield o.text({author:"bot",message:e.data.question}),yield o.input("address",{config:{key:e.data.key,keys:e.data.keys,placeholder:e.data.placeholder,optional:e.data.optional},validate:a=>{if(e.data.optional&&a===null)return d(a);let t=ye(r),n=f(t,a);return n.success===!1?p(n.issues):(l[e.data.key]={type:"address",value:n.output},d(a))}}),u(e.nextId)}var ge=["true","false"],ve=R(ge);async function*ne(r){let{node:e,config:{submissions:l,actions:o,next:u}}=r;return yield o.text({author:"bot",message:e.data.question}),yield o.input("boolean",{config:{key:e.data.key,labels:{false:e.data.falseLabel,true:e.data.trueLabel},optional:e.data.optional},validate:a=>{if(e.data.optional&&a===null)return d(a);let t=f(ve,a);return t.success===!1?p(t.issues):(l[e.data.key]={type:"boolean",value:t.output==="true"},d(a))}}),u(e.nextId)}async function*ae(r){let{node:e,config:{submissions:l,actions:o,next:u}}=r;yield o.text({author:"bot",message:e.data.question});let a=E(R(e.data.options.map(t=>t.value)));return yield o.input("multiple-choice",{config:{key:e.data.key,options:e.data.options,maxSelected:e.data.maxSelected,minSelected:e.data.minSelected},validate:t=>{if(e.data.minSelected===0&&t===null)return d(t);let n=f(a,t);return n.success===!1?p(n.issues):(l[e.data.key]={type:"enum",value:n.output},d(t))}}),u(e.nextId)}async function*oe(r){let{node:e,config:{submissions:l,actions:o,next:u,t:a}}=r;return yield o.text({author:"bot",message:e.data.question}),yield o.input("file",{config:{key:e.data.key,allowMultiple:e.data.multiple===!0,extensions:e.data.extensions,fileSizeLimitKib:e.data.maxSizeKb,optional:e.data.optional},validate:t=>{if(e.data.optional&&t===null)return d(t);let n=e.data.optional?0:1,s=e.data.multiple?Number.POSITIVE_INFINITY:1,i=e.data.maxSizeKb??0,m=e.data.extensions.map(F=>F.toLowerCase()),g=y(E(v({name:y(c(a("validation_empty")),P(F=>{let A=W(F);return A.ok===!1?!1:m.includes(A.val.toLowerCase())},a("validation_file_ext",{ext:m.join(", ")}))),data:c(),sizeKb:w()})),h(n,a("validation_file_min",{count:n})),k(s,a("validation_file_max",{count:s})),P(F=>F.reduce((le,de)=>le+de.sizeKb,0)<=i,a("validation_file_size",{size:V(i)}))),b=f(g,t);return b.success===!1?p(b.issues):(l[e.data.key]={type:"file",value:b.output},d(t))}}),u(e.nextId)}var be=({node:r,config:{t:e}})=>{let l=r.data.min??Number.MIN_SAFE_INTEGER,o=r.data.max??Number.MAX_SAFE_INTEGER,u=r.data.decimalCases??0;return y(w(e("validation_number")),$(l,e("validation_number_min",{min:l})),K(o,e("validation_number_max",{max:o})),P(a=>a===Number(a.toFixed(u)),e("validation_number_decimal_cases",{count:u})))};async function*se(r){let{node:e,config:{submissions:l,actions:o,next:u}}=r;yield o.text({author:"bot",message:e.data.question});let a=l[e.data.key];return yield o.input("number",{config:{key:e.data.key,placeholder:e.data.placeholder,optional:e.data.optional,decimalCases:e.data.decimalCases,max:e.data.max,min:e.data.min,defaultValue:a?.type==="number"?a.value.toString():void 0},validate:t=>{if(e.data.optional&&t===null)return d(t);let n=be(r),s=f(n,t);return s.success===!1?p(s.issues):(l[e.data.key]={type:"number",value:s.output},d(t))}}),u(e.nextId)}var he=({node:r,config:{t:e}})=>v({countryCode:y(c(e("validation_country_code")),j(/^\+?[0-9 -]+$/,e("validation_country_code"))),phoneNumber:y(c(e("validation_phone")),j(/^\+?[0-9 -]+$/,e("validation_phone")),h(r.data.minChars,e("validation_min_chars",{count:r.data.minChars})),C(l=>l.replace(/[^0-9]/g,"")))});async function*ie(r){let{node:e,config:{actions:l,next:o,submissions:u}}=r;yield l.text({author:"bot",message:e.data.question});let a=u[e.data.key];return yield l.input("phone",{config:{key:e.data.key,minChars:e.data.minChars,defaultValue:a?.type==="phone"?a.value:{countryCode:e.data.defaultCountryCode},placeholder:e.data.placeholder,submissionFormat:"phone",optional:e.data.optional},validate:t=>{if(e.data.optional&&t===null)return d(t);let n=he(r),s=f(n,t);return s.success===!1?p(s.issues):(u[e.data.key]={type:"address",value:s.output},d(t))}}),o(e.nextId)}var Ie=({node:r,config:{t:e,logger:l}})=>{let o={email:e("validation_email"),url:e("validation_url"),maxLength:e("validation_max_chars",{count:r.data.maxChars??999}),minLength:e("validation_min_chars",{count:r.data.minChars??1})};switch(r.data.format){case"email":return y(c(o.email),z(o.email),h(r.data.minChars??1,o.minLength),k(r.data.maxChars??1/0,o.maxLength));case"text":return y(c(),h(r.data.minChars??1,o.minLength),k(r.data.maxChars??1/0,o.maxLength));case"url":return y(c(),B(o.url),h(r.data.minChars??1,o.minLength),k(r.data.maxChars??1/0,o.maxLength));case"phone":return y(c(),h(r.data.minChars??1,o.minLength),k(r.data.maxChars??1/0,o.maxLength));default:return r.data.format,l.error(`Unsupported question-text format: ${r.data.format}`),null}};async function*ue(r){let{node:e,config:{submissions:l,actions:o,next:u}}=r;yield o.text({author:"bot",message:e.data.question});let a=l[e.data.key];return yield o.input("text",{config:{key:e.data.key,maxChars:e.data.maxChars,minChars:e.data.minChars,placeholder:e.data.placeholder,format:e.data.format,optional:e.data.optional,defaultValue:a?.type==="string"?a.value:void 0},validate:t=>{if(e.data.optional&&t===null)return d(t);let n=Ie(r);if(n===null)return d(t);let s=f(n,t);return s.success===!1?p(s.issues):(l[e.data.key]={type:"string",value:s.output},d(t))}}),u(e.nextId)}var nt=r=>{let e={};return{interpret:async function*({nodes:o,context:u}){let a={error:({message:i})=>({type:"error",message:I(i,{submissions:e,context:u})}),info:({message:i})=>({type:"info",message:I(i,{submissions:e,context:u})}),success:({message:i})=>({type:"success",message:I(i,{submissions:e,context:u})}),text:({message:i,author:m})=>({type:"text",author:m,message:I(i,{submissions:e,context:u})}),image:({url:i,height:m,width:g})=>({type:"image",url:I(i,{submissions:e,context:u}),height:m,width:g}),state:i=>({type:"state",state:i}),link:({href:i,message:m})=>({type:"link",href:I(i,{submissions:e,context:u}),message:I(m,{submissions:e,context:u})}),submissions:i=>({type:"submissions",submissions:i}),input:(i,m)=>({type:"input",input:{type:i,config:m.config,validate:m.validate}})};if(!o.headId)return{type:"error",message:"No head node found"};let t=o.items[o.headId],n=i=>{if(!i)return t=void 0,{type:"next",nodeId:void 0};let m=o.items[i];if(!m)throw new Error(`Next node with id ${i} not found`);return t=m,{type:"next",nodeId:i}},s={...r,context:u,submissions:e,next:n,actions:a};for(;t;){switch(t.type){case"text":yield a.text({author:"bot",message:t.data.text}),n(t.nextId);break;case"image":yield a.image(t.data),n(t.nextId);break;case"link":yield a.link({href:t.data.href,message:t.data.cta}),n(t.nextId);break;case"add-submission":e[t.data.key]={type:"string",value:t.data.value},n(t.nextId);break;case"jump":n(t.data.targetId);break;case"question-text":yield*ue({config:s,node:t});break;case"question-phone":yield*ie({config:s,node:t});break;case"question-boolean":yield*ne({config:s,node:t});break;case"question-number":yield*se({config:s,node:t});break;case"question-address":yield*re({config:s,node:t});break;case"question-enum":yield*ae({config:s,node:t});break;case"question-file":yield*oe({config:s,node:t});break;case"identify":{yield*Z({config:s,node:t});break}case"if-block":{let i=_(t,{context:s.context,submissions:e})?t.branchId:t.nextId;n(i);break}case"integration-application-submit":yield*te({config:s,node:t});break;case"feedback":yield a.error({message:"Not implemented"});break;case"integration-workflow-get":yield a.error({message:"This message should never be reached"});break;case"end-flow":t=void 0;break}yield a.submissions(e)}yield{type:"end"}}}};export{nt as createFlowInterpreter};
|
|
2
2
|
//# sourceMappingURL=interpreter.mjs.map
|