@inploi/plugin-chatbot 3.14.1 → 3.16.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.
@@ -1,7 +1,605 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-f79d99f5.cjs");
3
+ const index = require("./index-a8a873bc.cjs");
4
4
  require("@inploi/sdk");
5
+ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
6
+ function getDefaultExportFromCjs(x) {
7
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
8
+ }
9
+ var isArray$3 = Array.isArray;
10
+ var isArray_1 = isArray$3;
11
+ var freeGlobal$1 = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
12
+ var _freeGlobal = freeGlobal$1;
13
+ var freeGlobal = _freeGlobal;
14
+ var freeSelf = typeof self == "object" && self && self.Object === Object && self;
15
+ var root$3 = freeGlobal || freeSelf || Function("return this")();
16
+ var _root = root$3;
17
+ var root$2 = _root;
18
+ var Symbol$4 = root$2.Symbol;
19
+ var _Symbol = Symbol$4;
20
+ var Symbol$3 = _Symbol;
21
+ var objectProto$4 = Object.prototype;
22
+ var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
23
+ var nativeObjectToString$1 = objectProto$4.toString;
24
+ var symToStringTag$1 = Symbol$3 ? Symbol$3.toStringTag : void 0;
25
+ function getRawTag$1(value) {
26
+ var isOwn = hasOwnProperty$3.call(value, symToStringTag$1), tag = value[symToStringTag$1];
27
+ try {
28
+ value[symToStringTag$1] = void 0;
29
+ var unmasked = true;
30
+ } catch (e) {
31
+ }
32
+ var result = nativeObjectToString$1.call(value);
33
+ if (unmasked) {
34
+ if (isOwn) {
35
+ value[symToStringTag$1] = tag;
36
+ } else {
37
+ delete value[symToStringTag$1];
38
+ }
39
+ }
40
+ return result;
41
+ }
42
+ var _getRawTag = getRawTag$1;
43
+ var objectProto$3 = Object.prototype;
44
+ var nativeObjectToString = objectProto$3.toString;
45
+ function objectToString$1(value) {
46
+ return nativeObjectToString.call(value);
47
+ }
48
+ var _objectToString = objectToString$1;
49
+ var Symbol$2 = _Symbol, getRawTag = _getRawTag, objectToString = _objectToString;
50
+ var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
51
+ var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
52
+ function baseGetTag$2(value) {
53
+ if (value == null) {
54
+ return value === void 0 ? undefinedTag : nullTag;
55
+ }
56
+ return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
57
+ }
58
+ var _baseGetTag = baseGetTag$2;
59
+ function isObjectLike$1(value) {
60
+ return value != null && typeof value == "object";
61
+ }
62
+ var isObjectLike_1 = isObjectLike$1;
63
+ var baseGetTag$1 = _baseGetTag, isObjectLike = isObjectLike_1;
64
+ var symbolTag = "[object Symbol]";
65
+ function isSymbol$3(value) {
66
+ return typeof value == "symbol" || isObjectLike(value) && baseGetTag$1(value) == symbolTag;
67
+ }
68
+ var isSymbol_1 = isSymbol$3;
69
+ var isArray$2 = isArray_1, isSymbol$2 = isSymbol_1;
70
+ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
71
+ function isKey$2(value, object) {
72
+ if (isArray$2(value)) {
73
+ return false;
74
+ }
75
+ var type = typeof value;
76
+ if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol$2(value)) {
77
+ return true;
78
+ }
79
+ return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
80
+ }
81
+ var _isKey = isKey$2;
82
+ function isObject$3(value) {
83
+ var type = typeof value;
84
+ return value != null && (type == "object" || type == "function");
85
+ }
86
+ var isObject_1 = isObject$3;
87
+ var baseGetTag = _baseGetTag, isObject$2 = isObject_1;
88
+ var asyncTag = "[object AsyncFunction]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
89
+ function isFunction$2(value) {
90
+ if (!isObject$2(value)) {
91
+ return false;
92
+ }
93
+ var tag = baseGetTag(value);
94
+ return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
95
+ }
96
+ var isFunction_1 = isFunction$2;
97
+ var root$1 = _root;
98
+ var coreJsData$1 = root$1["__core-js_shared__"];
99
+ var _coreJsData = coreJsData$1;
100
+ var coreJsData = _coreJsData;
101
+ var maskSrcKey = function() {
102
+ var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
103
+ return uid ? "Symbol(src)_1." + uid : "";
104
+ }();
105
+ function isMasked$1(func) {
106
+ return !!maskSrcKey && maskSrcKey in func;
107
+ }
108
+ var _isMasked = isMasked$1;
109
+ var funcProto$1 = Function.prototype;
110
+ var funcToString$1 = funcProto$1.toString;
111
+ function toSource$1(func) {
112
+ if (func != null) {
113
+ try {
114
+ return funcToString$1.call(func);
115
+ } catch (e) {
116
+ }
117
+ try {
118
+ return func + "";
119
+ } catch (e) {
120
+ }
121
+ }
122
+ return "";
123
+ }
124
+ var _toSource = toSource$1;
125
+ var isFunction$1 = isFunction_1, isMasked = _isMasked, isObject$1 = isObject_1, toSource = _toSource;
126
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
127
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
128
+ var funcProto = Function.prototype, objectProto$2 = Object.prototype;
129
+ var funcToString = funcProto.toString;
130
+ var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
131
+ var reIsNative = RegExp(
132
+ "^" + funcToString.call(hasOwnProperty$2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
133
+ );
134
+ function baseIsNative$1(value) {
135
+ if (!isObject$1(value) || isMasked(value)) {
136
+ return false;
137
+ }
138
+ var pattern = isFunction$1(value) ? reIsNative : reIsHostCtor;
139
+ return pattern.test(toSource(value));
140
+ }
141
+ var _baseIsNative = baseIsNative$1;
142
+ function getValue$1(object, key) {
143
+ return object == null ? void 0 : object[key];
144
+ }
145
+ var _getValue = getValue$1;
146
+ var baseIsNative = _baseIsNative, getValue = _getValue;
147
+ function getNative$2(object, key) {
148
+ var value = getValue(object, key);
149
+ return baseIsNative(value) ? value : void 0;
150
+ }
151
+ var _getNative = getNative$2;
152
+ var getNative$1 = _getNative;
153
+ var nativeCreate$4 = getNative$1(Object, "create");
154
+ var _nativeCreate = nativeCreate$4;
155
+ var nativeCreate$3 = _nativeCreate;
156
+ function hashClear$1() {
157
+ this.__data__ = nativeCreate$3 ? nativeCreate$3(null) : {};
158
+ this.size = 0;
159
+ }
160
+ var _hashClear = hashClear$1;
161
+ function hashDelete$1(key) {
162
+ var result = this.has(key) && delete this.__data__[key];
163
+ this.size -= result ? 1 : 0;
164
+ return result;
165
+ }
166
+ var _hashDelete = hashDelete$1;
167
+ var nativeCreate$2 = _nativeCreate;
168
+ var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
169
+ var objectProto$1 = Object.prototype;
170
+ var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
171
+ function hashGet$1(key) {
172
+ var data = this.__data__;
173
+ if (nativeCreate$2) {
174
+ var result = data[key];
175
+ return result === HASH_UNDEFINED$1 ? void 0 : result;
176
+ }
177
+ return hasOwnProperty$1.call(data, key) ? data[key] : void 0;
178
+ }
179
+ var _hashGet = hashGet$1;
180
+ var nativeCreate$1 = _nativeCreate;
181
+ var objectProto = Object.prototype;
182
+ var hasOwnProperty = objectProto.hasOwnProperty;
183
+ function hashHas$1(key) {
184
+ var data = this.__data__;
185
+ return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty.call(data, key);
186
+ }
187
+ var _hashHas = hashHas$1;
188
+ var nativeCreate = _nativeCreate;
189
+ var HASH_UNDEFINED = "__lodash_hash_undefined__";
190
+ function hashSet$1(key, value) {
191
+ var data = this.__data__;
192
+ this.size += this.has(key) ? 0 : 1;
193
+ data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
194
+ return this;
195
+ }
196
+ var _hashSet = hashSet$1;
197
+ var hashClear = _hashClear, hashDelete = _hashDelete, hashGet = _hashGet, hashHas = _hashHas, hashSet = _hashSet;
198
+ function Hash$1(entries) {
199
+ var index2 = -1, length = entries == null ? 0 : entries.length;
200
+ this.clear();
201
+ while (++index2 < length) {
202
+ var entry = entries[index2];
203
+ this.set(entry[0], entry[1]);
204
+ }
205
+ }
206
+ Hash$1.prototype.clear = hashClear;
207
+ Hash$1.prototype["delete"] = hashDelete;
208
+ Hash$1.prototype.get = hashGet;
209
+ Hash$1.prototype.has = hashHas;
210
+ Hash$1.prototype.set = hashSet;
211
+ var _Hash = Hash$1;
212
+ function listCacheClear$1() {
213
+ this.__data__ = [];
214
+ this.size = 0;
215
+ }
216
+ var _listCacheClear = listCacheClear$1;
217
+ function eq$1(value, other) {
218
+ return value === other || value !== value && other !== other;
219
+ }
220
+ var eq_1 = eq$1;
221
+ var eq = eq_1;
222
+ function assocIndexOf$4(array, key) {
223
+ var length = array.length;
224
+ while (length--) {
225
+ if (eq(array[length][0], key)) {
226
+ return length;
227
+ }
228
+ }
229
+ return -1;
230
+ }
231
+ var _assocIndexOf = assocIndexOf$4;
232
+ var assocIndexOf$3 = _assocIndexOf;
233
+ var arrayProto = Array.prototype;
234
+ var splice = arrayProto.splice;
235
+ function listCacheDelete$1(key) {
236
+ var data = this.__data__, index2 = assocIndexOf$3(data, key);
237
+ if (index2 < 0) {
238
+ return false;
239
+ }
240
+ var lastIndex = data.length - 1;
241
+ if (index2 == lastIndex) {
242
+ data.pop();
243
+ } else {
244
+ splice.call(data, index2, 1);
245
+ }
246
+ --this.size;
247
+ return true;
248
+ }
249
+ var _listCacheDelete = listCacheDelete$1;
250
+ var assocIndexOf$2 = _assocIndexOf;
251
+ function listCacheGet$1(key) {
252
+ var data = this.__data__, index2 = assocIndexOf$2(data, key);
253
+ return index2 < 0 ? void 0 : data[index2][1];
254
+ }
255
+ var _listCacheGet = listCacheGet$1;
256
+ var assocIndexOf$1 = _assocIndexOf;
257
+ function listCacheHas$1(key) {
258
+ return assocIndexOf$1(this.__data__, key) > -1;
259
+ }
260
+ var _listCacheHas = listCacheHas$1;
261
+ var assocIndexOf = _assocIndexOf;
262
+ function listCacheSet$1(key, value) {
263
+ var data = this.__data__, index2 = assocIndexOf(data, key);
264
+ if (index2 < 0) {
265
+ ++this.size;
266
+ data.push([key, value]);
267
+ } else {
268
+ data[index2][1] = value;
269
+ }
270
+ return this;
271
+ }
272
+ var _listCacheSet = listCacheSet$1;
273
+ var listCacheClear = _listCacheClear, listCacheDelete = _listCacheDelete, listCacheGet = _listCacheGet, listCacheHas = _listCacheHas, listCacheSet = _listCacheSet;
274
+ function ListCache$1(entries) {
275
+ var index2 = -1, length = entries == null ? 0 : entries.length;
276
+ this.clear();
277
+ while (++index2 < length) {
278
+ var entry = entries[index2];
279
+ this.set(entry[0], entry[1]);
280
+ }
281
+ }
282
+ ListCache$1.prototype.clear = listCacheClear;
283
+ ListCache$1.prototype["delete"] = listCacheDelete;
284
+ ListCache$1.prototype.get = listCacheGet;
285
+ ListCache$1.prototype.has = listCacheHas;
286
+ ListCache$1.prototype.set = listCacheSet;
287
+ var _ListCache = ListCache$1;
288
+ var getNative = _getNative, root = _root;
289
+ var Map$1 = getNative(root, "Map");
290
+ var _Map = Map$1;
291
+ var Hash = _Hash, ListCache = _ListCache, Map = _Map;
292
+ function mapCacheClear$1() {
293
+ this.size = 0;
294
+ this.__data__ = {
295
+ "hash": new Hash(),
296
+ "map": new (Map || ListCache)(),
297
+ "string": new Hash()
298
+ };
299
+ }
300
+ var _mapCacheClear = mapCacheClear$1;
301
+ function isKeyable$1(value) {
302
+ var type = typeof value;
303
+ return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
304
+ }
305
+ var _isKeyable = isKeyable$1;
306
+ var isKeyable = _isKeyable;
307
+ function getMapData$4(map, key) {
308
+ var data = map.__data__;
309
+ return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
310
+ }
311
+ var _getMapData = getMapData$4;
312
+ var getMapData$3 = _getMapData;
313
+ function mapCacheDelete$1(key) {
314
+ var result = getMapData$3(this, key)["delete"](key);
315
+ this.size -= result ? 1 : 0;
316
+ return result;
317
+ }
318
+ var _mapCacheDelete = mapCacheDelete$1;
319
+ var getMapData$2 = _getMapData;
320
+ function mapCacheGet$1(key) {
321
+ return getMapData$2(this, key).get(key);
322
+ }
323
+ var _mapCacheGet = mapCacheGet$1;
324
+ var getMapData$1 = _getMapData;
325
+ function mapCacheHas$1(key) {
326
+ return getMapData$1(this, key).has(key);
327
+ }
328
+ var _mapCacheHas = mapCacheHas$1;
329
+ var getMapData = _getMapData;
330
+ function mapCacheSet$1(key, value) {
331
+ var data = getMapData(this, key), size = data.size;
332
+ data.set(key, value);
333
+ this.size += data.size == size ? 0 : 1;
334
+ return this;
335
+ }
336
+ var _mapCacheSet = mapCacheSet$1;
337
+ var mapCacheClear = _mapCacheClear, mapCacheDelete = _mapCacheDelete, mapCacheGet = _mapCacheGet, mapCacheHas = _mapCacheHas, mapCacheSet = _mapCacheSet;
338
+ function MapCache$1(entries) {
339
+ var index2 = -1, length = entries == null ? 0 : entries.length;
340
+ this.clear();
341
+ while (++index2 < length) {
342
+ var entry = entries[index2];
343
+ this.set(entry[0], entry[1]);
344
+ }
345
+ }
346
+ MapCache$1.prototype.clear = mapCacheClear;
347
+ MapCache$1.prototype["delete"] = mapCacheDelete;
348
+ MapCache$1.prototype.get = mapCacheGet;
349
+ MapCache$1.prototype.has = mapCacheHas;
350
+ MapCache$1.prototype.set = mapCacheSet;
351
+ var _MapCache = MapCache$1;
352
+ var MapCache = _MapCache;
353
+ var FUNC_ERROR_TEXT = "Expected a function";
354
+ function memoize$1(func, resolver) {
355
+ if (typeof func != "function" || resolver != null && typeof resolver != "function") {
356
+ throw new TypeError(FUNC_ERROR_TEXT);
357
+ }
358
+ var memoized = function() {
359
+ var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
360
+ if (cache.has(key)) {
361
+ return cache.get(key);
362
+ }
363
+ var result = func.apply(this, args);
364
+ memoized.cache = cache.set(key, result) || cache;
365
+ return result;
366
+ };
367
+ memoized.cache = new (memoize$1.Cache || MapCache)();
368
+ return memoized;
369
+ }
370
+ memoize$1.Cache = MapCache;
371
+ var memoize_1 = memoize$1;
372
+ var memoize = memoize_1;
373
+ var MAX_MEMOIZE_SIZE = 500;
374
+ function memoizeCapped$1(func) {
375
+ var result = memoize(func, function(key) {
376
+ if (cache.size === MAX_MEMOIZE_SIZE) {
377
+ cache.clear();
378
+ }
379
+ return key;
380
+ });
381
+ var cache = result.cache;
382
+ return result;
383
+ }
384
+ var _memoizeCapped = memoizeCapped$1;
385
+ var memoizeCapped = _memoizeCapped;
386
+ var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
387
+ var reEscapeChar = /\\(\\)?/g;
388
+ var stringToPath$2 = memoizeCapped(function(string) {
389
+ var result = [];
390
+ if (string.charCodeAt(0) === 46) {
391
+ result.push("");
392
+ }
393
+ string.replace(rePropName, function(match, number, quote, subString) {
394
+ result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
395
+ });
396
+ return result;
397
+ });
398
+ var _stringToPath = stringToPath$2;
399
+ function arrayMap$1(array, iteratee) {
400
+ var index2 = -1, length = array == null ? 0 : array.length, result = Array(length);
401
+ while (++index2 < length) {
402
+ result[index2] = iteratee(array[index2], index2, array);
403
+ }
404
+ return result;
405
+ }
406
+ var _arrayMap = arrayMap$1;
407
+ var Symbol$1 = _Symbol, arrayMap = _arrayMap, isArray$1 = isArray_1, isSymbol$1 = isSymbol_1;
408
+ var INFINITY$1 = 1 / 0;
409
+ var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolToString = symbolProto ? symbolProto.toString : void 0;
410
+ function baseToString$1(value) {
411
+ if (typeof value == "string") {
412
+ return value;
413
+ }
414
+ if (isArray$1(value)) {
415
+ return arrayMap(value, baseToString$1) + "";
416
+ }
417
+ if (isSymbol$1(value)) {
418
+ return symbolToString ? symbolToString.call(value) : "";
419
+ }
420
+ var result = value + "";
421
+ return result == "0" && 1 / value == -INFINITY$1 ? "-0" : result;
422
+ }
423
+ var _baseToString = baseToString$1;
424
+ var baseToString = _baseToString;
425
+ function toString$1(value) {
426
+ return value == null ? "" : baseToString(value);
427
+ }
428
+ var toString_1 = toString$1;
429
+ var isArray = isArray_1, isKey$1 = _isKey, stringToPath$1 = _stringToPath, toString = toString_1;
430
+ function castPath$1(value, object) {
431
+ if (isArray(value)) {
432
+ return value;
433
+ }
434
+ return isKey$1(value, object) ? [value] : stringToPath$1(toString(value));
435
+ }
436
+ var _castPath = castPath$1;
437
+ var isSymbol = isSymbol_1;
438
+ var INFINITY = 1 / 0;
439
+ function toKey$1(value) {
440
+ if (typeof value == "string" || isSymbol(value)) {
441
+ return value;
442
+ }
443
+ var result = value + "";
444
+ return result == "0" && 1 / value == -INFINITY ? "-0" : result;
445
+ }
446
+ var _toKey = toKey$1;
447
+ var castPath = _castPath, toKey = _toKey;
448
+ function baseGet$2(object, path) {
449
+ path = castPath(path, object);
450
+ var index2 = 0, length = path.length;
451
+ while (object != null && index2 < length) {
452
+ object = object[toKey(path[index2++])];
453
+ }
454
+ return index2 && index2 == length ? object : void 0;
455
+ }
456
+ var _baseGet = baseGet$2;
457
+ var baseGet$1 = _baseGet;
458
+ function get$1(object, path, defaultValue) {
459
+ var result = object == null ? void 0 : baseGet$1(object, path);
460
+ return result === void 0 ? defaultValue : result;
461
+ }
462
+ var get_1 = get$1;
463
+ const get$2 = /* @__PURE__ */ getDefaultExportFromCjs(get_1);
464
+ const isString$1 = (value) => typeof value === "string";
465
+ const isIfBlockConditionMet = (ifBlock, submissions) => {
466
+ const [firstSegment, ...rest] = ifBlock.data.compareKey.split(".");
467
+ if (!firstSegment)
468
+ return false;
469
+ const answer = submissions == null ? void 0 : submissions[firstSegment];
470
+ if (!answer)
471
+ return false;
472
+ switch (answer.type) {
473
+ case "address": {
474
+ const value = get$2(answer.value, rest.join("."));
475
+ switch (ifBlock.data.compare) {
476
+ case "equals":
477
+ return value === ifBlock.data.compareValue;
478
+ case "contains":
479
+ if (!value)
480
+ return false;
481
+ return value.includes(ifBlock.data.compareValue);
482
+ case "notEquals":
483
+ return value !== ifBlock.data.compareValue;
484
+ case "notContains":
485
+ if (!value)
486
+ return true;
487
+ return !value.includes(ifBlock.data.compareValue);
488
+ }
489
+ break;
490
+ }
491
+ case "integration": {
492
+ if (typeof answer.value !== "object")
493
+ return false;
494
+ if (Array.isArray(answer.value))
495
+ return false;
496
+ const value = get$2(answer.value, rest.join("."));
497
+ const newIfBlock = {
498
+ ...ifBlock,
499
+ data: {
500
+ ...ifBlock.data,
501
+ compareKey: "_temp"
502
+ }
503
+ };
504
+ switch (typeof value) {
505
+ case "boolean":
506
+ return isIfBlockConditionMet(newIfBlock, {
507
+ ["_temp"]: {
508
+ value,
509
+ type: "boolean"
510
+ }
511
+ });
512
+ case "string":
513
+ return isIfBlockConditionMet(newIfBlock, {
514
+ ["_temp"]: {
515
+ value,
516
+ type: "string"
517
+ }
518
+ });
519
+ case "number":
520
+ return isIfBlockConditionMet(newIfBlock, {
521
+ ["_temp"]: {
522
+ value,
523
+ type: "number"
524
+ }
525
+ });
526
+ case "object":
527
+ if (Array.isArray(value) && value.every(isString$1)) {
528
+ return isIfBlockConditionMet(newIfBlock, {
529
+ ["_temp"]: {
530
+ value,
531
+ type: "enum"
532
+ }
533
+ });
534
+ }
535
+ return false;
536
+ }
537
+ break;
538
+ }
539
+ case "boolean": {
540
+ const compareBoolean = ifBlock.data.compareValue === "true";
541
+ switch (ifBlock.data.compare) {
542
+ case "equals":
543
+ return answer.value === compareBoolean;
544
+ case "notEquals":
545
+ return answer.value !== compareBoolean;
546
+ }
547
+ break;
548
+ }
549
+ case "string":
550
+ switch (ifBlock.data.compare) {
551
+ case "equals":
552
+ return answer.value === ifBlock.data.compareValue;
553
+ case "contains":
554
+ if (!answer.value)
555
+ return false;
556
+ return answer.value.includes(ifBlock.data.compareValue);
557
+ case "notEquals":
558
+ return answer.value !== ifBlock.data.compareValue;
559
+ case "notContains":
560
+ if (!answer.value)
561
+ return true;
562
+ return !answer.value.includes(ifBlock.data.compareValue);
563
+ }
564
+ break;
565
+ case "number": {
566
+ try {
567
+ const compareNumber = Number(ifBlock.data.compareValue);
568
+ switch (ifBlock.data.compare) {
569
+ case "equals":
570
+ return answer.value === compareNumber;
571
+ case "notEquals":
572
+ return answer.value !== compareNumber;
573
+ case "greaterThan":
574
+ return answer.value > compareNumber;
575
+ case "greaterThanOrEqualTo":
576
+ return answer.value >= compareNumber;
577
+ case "lessThan":
578
+ return answer.value < compareNumber;
579
+ case "lessThanOrEqualTo":
580
+ return answer.value <= compareNumber;
581
+ }
582
+ } catch {
583
+ console.error(`Failed to parse number in if-block ${ifBlock.id}`, answer.value);
584
+ return false;
585
+ }
586
+ break;
587
+ }
588
+ case "enum":
589
+ switch (ifBlock.data.compare) {
590
+ case "equals":
591
+ return answer.value.length === 1 && answer.value[0] === ifBlock.data.compareValue;
592
+ case "notEquals":
593
+ return answer.value.length === 1 && answer.value[0] !== ifBlock.data.compareValue;
594
+ case "contains":
595
+ return answer.value.includes(ifBlock.data.compareValue);
596
+ case "notContains":
597
+ return !answer.value.includes(ifBlock.data.compareValue);
598
+ }
599
+ break;
600
+ }
601
+ return false;
602
+ };
5
603
  const followNodes = ({
6
604
  node,
7
605
  nodes,
@@ -74,7 +672,8 @@ const createFlowInterpreter = ({
74
672
  userInput: async (input) => chatService.input({
75
673
  input,
76
674
  signal: controller.signal
77
- })
675
+ }),
676
+ addToSubmissions: chatService.addToSubmissions
78
677
  },
79
678
  next: (nodeId) => {
80
679
  const nextNode = nodeId ? flow.find((node2) => node2.id === nodeId) : fallthroughBranch({
@@ -224,6 +823,11 @@ async function interpretSubmitNode({
224
823
  submissions: index.getFlowSubmissionsPayload(submissions || {})
225
824
  })
226
825
  }).catch((e) => e);
826
+ if (node.data.key)
827
+ chat.addToSubmissions(node.data.key, {
828
+ type: "integration",
829
+ value: response
830
+ });
227
831
  await index.N(response).with({
228
832
  ats_data: {
229
833
  redirect_url: index._.string
@@ -281,8 +885,7 @@ async function interpretIfBlockNode({
281
885
  next,
282
886
  node
283
887
  }) {
284
- const nextId = isIfBlockConditionMet(node, submissions) ? node.branchId : node.nextId;
285
- next(nextId);
888
+ next(isIfBlockConditionMet(node, submissions) ? node.branchId : node.nextId);
286
889
  }
287
890
  async function interpretTextNode({
288
891
  chat,
@@ -332,7 +935,7 @@ async function interpretQuestionTextNode({
332
935
  maxChars: node.data.maxChars
333
936
  }
334
937
  });
335
- if (reply.value === null) {
938
+ if (reply === null) {
336
939
  await chat.sendMessage({
337
940
  type: "system",
338
941
  variant: "info",
@@ -367,7 +970,7 @@ async function interpretQuestionNumberNode({
367
970
  format: "text"
368
971
  }
369
972
  });
370
- if (reply.value === null) {
973
+ if (reply === null) {
371
974
  await chat.sendMessage({
372
975
  type: "system",
373
976
  variant: "info",
@@ -424,7 +1027,7 @@ async function interpretQuestionBooleanNode({
424
1027
  type: "text",
425
1028
  text: interpolateString(node.data.question, submissions)
426
1029
  });
427
- const input = await chat.userInput({
1030
+ const reply = await chat.userInput({
428
1031
  key: node.data.key,
429
1032
  type: "boolean",
430
1033
  config: {
@@ -435,7 +1038,6 @@ async function interpretQuestionBooleanNode({
435
1038
  }
436
1039
  }
437
1040
  });
438
- const reply = input.value;
439
1041
  if (reply === null) {
440
1042
  await chat.sendMessage({
441
1043
  type: "system",
@@ -446,10 +1048,7 @@ async function interpretQuestionBooleanNode({
446
1048
  await chat.sendMessage({
447
1049
  author: "user",
448
1050
  type: "text",
449
- text: {
450
- true: node.data.trueLabel,
451
- false: node.data.falseLabel
452
- }[reply]
1051
+ text: reply.value === true ? node.data.trueLabel : node.data.falseLabel
453
1052
  });
454
1053
  }
455
1054
  next(node.nextId);
@@ -473,7 +1072,7 @@ async function interpretQuestionAddressNode({
473
1072
  placeholder: node.data.placeholder
474
1073
  }
475
1074
  });
476
- if (response.value === null) {
1075
+ if (response === null) {
477
1076
  await chat.sendMessage({
478
1077
  type: "system",
479
1078
  variant: "info",
@@ -511,7 +1110,7 @@ async function interpretQuestionFileNode({
511
1110
  allowMultiple: node.data.multiple === true
512
1111
  }
513
1112
  });
514
- if (files.value === null) {
1113
+ if (files === null) {
515
1114
  await chat.sendMessage({
516
1115
  type: "system",
517
1116
  variant: "info",
@@ -541,83 +1140,34 @@ async function interpretEndFlowNode({
541
1140
  });
542
1141
  end();
543
1142
  }
544
- const possibleContainsValue = index._.union(index._.string, index._.array(index._.string), null);
545
- const isIfBlockConditionMet = (ifBlock, submissions) => {
546
- const answer = submissions == null ? void 0 : submissions[ifBlock.data.compareKey];
547
- if (!answer)
548
- return false;
549
- return index.N({
550
- ...ifBlock.data,
551
- answer
552
- }).with({
553
- compare: "equals"
554
- }, ({
555
- compareValue
556
- }) => {
557
- if (typeof answer.value === "string" || typeof answer.value === "boolean")
558
- return compareValue === answer.value.toString();
559
- return false;
560
- }).with({
561
- compare: "notEquals"
562
- }, ({
563
- compareValue
564
- }) => {
565
- if (typeof answer.value === "string" || typeof answer.value === "boolean")
566
- return compareValue !== answer.value.toString();
567
- return false;
568
- }).with({
569
- compare: "contains",
570
- answer: {
571
- value: possibleContainsValue
572
- }
573
- }, ({
574
- compareValue,
575
- answer: answer2
576
- }) => answer2.value !== null && answer2.value.includes(compareValue)).with({
577
- compare: "notContains",
578
- answer: {
579
- value: possibleContainsValue
580
- }
581
- }, ({
582
- compareValue,
583
- answer: answer2
584
- }) => answer2.value === null || !answer2.value.includes(compareValue)).with({
585
- answer: {
586
- type: "file"
587
- }
588
- }, () => false).with({
589
- answer: {
590
- type: "address",
591
- value: index._.any
592
- }
593
- }, () => {
594
- return false;
595
- }).exhaustive();
596
- };
597
1143
  const interpolateString = (str, context) => {
598
1144
  const regex = /{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g;
599
- return str.replace(regex, (match2, key, defaultValue = "") => {
1145
+ return str.replace(regex, (_, key, defaultValue = "") => {
600
1146
  key = key.trim();
601
1147
  const submission = context == null ? void 0 : context[key];
602
1148
  if (!submission)
603
1149
  return defaultValue;
604
1150
  switch (submission.type) {
605
1151
  case "boolean":
606
- return submission.value === "true" ? "true" : "false";
1152
+ return submission.value === true ? "true" : "false";
607
1153
  case "file":
608
- if (!submission.value)
609
- return "no files";
610
1154
  return submission.value.map((file) => `${file.name} (${index.kbToReadableSize(file.sizeKb)})`).join(", ");
611
- case "multiple-choice":
1155
+ case "enum":
612
1156
  return submission.value.join(", ");
1157
+ case "address":
1158
+ return Object.values(submission.value).filter((line) => line && line.trim().length > 0).join(", ");
1159
+ case "number":
1160
+ case "string":
1161
+ if (!submission.value)
1162
+ return defaultValue;
1163
+ return submission.value.toString();
1164
+ case "integration":
1165
+ return JSON.stringify(submission.value);
613
1166
  default:
614
- return submission.value || defaultValue;
1167
+ return defaultValue;
615
1168
  }
616
1169
  });
617
1170
  };
618
- function getDefaultExportFromCjs(x) {
619
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
620
- }
621
1171
  function debounce(func, wait, immediate) {
622
1172
  var timeout, args, context, timestamp, result;
623
1173
  if (null == wait)
@@ -876,39 +1426,15 @@ const useChatService = () => {
876
1426
  }
877
1427
  };
878
1428
  }, [chatRef]);
879
- const chatService = index.F(() => ({
880
- send: async ({
881
- message,
882
- signal: signal2,
883
- groupId
884
- }) => {
885
- await index.N(message).with({
886
- author: "bot",
887
- type: "text"
888
- }, async (message2) => {
889
- if (signal2 == null ? void 0 : signal2.aborted)
890
- throw new index.AbortedError();
891
- chatStore.isBotTyping$.value = true;
892
- const typingTime = Math.min(Math.max(20, message2.text.length), 100) * TYPING_SPEED_MS_PER_CHARACTER;
893
- await new Promise((resolve) => {
894
- return setTimeout(resolve, typingTime, {
895
- signal: signal2
896
- });
897
- });
898
- chatStore.isBotTyping$.value = false;
899
- }).otherwise(async () => void 0);
900
- if (signal2 == null ? void 0 : signal2.aborted)
901
- throw new index.AbortedError();
902
- index.store.addMessage(message, groupId);
903
- },
904
- input: async ({
1429
+ const chatService = index.F(() => {
1430
+ const inputFn = ({
905
1431
  input,
906
1432
  signal: signal2
907
1433
  }) => {
908
1434
  if (signal2 == null ? void 0 : signal2.aborted)
909
1435
  throw new index.AbortedError();
910
1436
  index.store.setInput(input);
911
- return await new Promise((resolve) => {
1437
+ return new Promise((resolve) => {
912
1438
  const submitFunction = (submission) => {
913
1439
  if (signal2 == null ? void 0 : signal2.aborted)
914
1440
  throw new index.AbortedError();
@@ -920,8 +1446,36 @@ const useChatService = () => {
920
1446
  };
921
1447
  chatStore.onSubmitSuccessFn$.value = submitFunction;
922
1448
  });
923
- }
924
- }), []);
1449
+ };
1450
+ return {
1451
+ addToSubmissions: (key, value) => index.store.setSubmission(key, value),
1452
+ send: async ({
1453
+ message,
1454
+ signal: signal2,
1455
+ groupId
1456
+ }) => {
1457
+ await index.N(message).with({
1458
+ author: "bot",
1459
+ type: "text"
1460
+ }, async (message2) => {
1461
+ if (signal2 == null ? void 0 : signal2.aborted)
1462
+ throw new index.AbortedError();
1463
+ chatStore.isBotTyping$.value = true;
1464
+ const typingTime = Math.min(Math.max(20, message2.text.length), 100) * TYPING_SPEED_MS_PER_CHARACTER;
1465
+ await new Promise((resolve) => {
1466
+ return setTimeout(resolve, typingTime, {
1467
+ signal: signal2
1468
+ });
1469
+ });
1470
+ chatStore.isBotTyping$.value = false;
1471
+ }).otherwise(async () => void 0);
1472
+ if (signal2 == null ? void 0 : signal2.aborted)
1473
+ throw new index.AbortedError();
1474
+ index.store.addMessage(message, groupId);
1475
+ },
1476
+ input: inputFn
1477
+ };
1478
+ }, []);
925
1479
  return {
926
1480
  chatRef,
927
1481
  chatService
@@ -952,6 +1506,7 @@ const SkipButton = ({
952
1506
  })]
953
1507
  }), "Skip"]
954
1508
  });
1509
+ const countryNames = ["Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegovina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "British Virgin Islands", "Brunei", "Bulgaria", "Burkina Faso", "Burundi", "Cabo Verde", "Cambodia", "Cameroon", "Canada", "Caribbean Netherlands", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Cook Islands", "Costa Rica", "Croatia", "Cuba", "Curaçao", "Cyprus", "Czechia", "Côte d'Ivoire", "Democratic Republic of the Congo", "Denmark", "Djibouti", "Dominican Republic", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Eswatini", "Ethiopia", "Falkland Islands (Islas Malvinas)", "Faroe Islands", "Fiji", "Finland", "France", "French Guiana", "French Polynesia", "French Southern and Antarctic Lands", "Gabon", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guernsey", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Heard Island and McDonald Islands", "Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland", "Isle of Man", "Israel", "Italy", "Jamaica", "Japan", "Jersey", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Kosovo", "Kuwait", "Kyrgyzstan", "Laos", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg", "Macao", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Martinique", "Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia", "Moldova", "Monaco", "Mongolia", "Montenegro", "Montserrat", "Morocco", "Mozambique", "Myanmar (Burma)", "Namibia", "Nauru", "Nepal", "Netherlands", "New Caledonia", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Niue", "Norfolk Island", "North Korea", "North Macedonia", "Northern Mariana Islands", "Norway", "Oman", "Pakistan", "Palau", "Palestine", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Pitcairn Islands", "Poland", "Portugal", "Puerto Rico", "Qatar", "Romania", "Russia", "Rwanda", "Réunion", "Saint Barthélemy", "Saint Helena, Ascension and Tristan da Cunha", "Saint Kitts and Nevis", "Saint Lucia", "Saint Martin", "Saint Pierre and Miquelon", "Saint Vincent and the Grenadines", "Samoa", "San Marino", "Saudi Arabia", "Senegal", "Serbia", "Seychelles", "Sierra Leone", "Singapore", "Sint Maarten", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "South Georgia and the South Sandwich Islands", "South Korea", "South Sudan", "Spain", "Sri Lanka", "Sudan", "Suriname", "Svalbard and Jan Mayen", "Sweden", "Switzerland", "Syria", "São Tomé and Príncipe", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "The Bahamas", "The Gambia", "Timor-Leste", "Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkmenistan", "Turks and Caicos Islands", "Tuvalu", "Türkiye", "U.S. Virgin Islands", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States", "United States Minor Outlying Islands", "Uruguay", "Uzbekistan", "Vanuatu", "Vatican City", "Venezuela", "Vietnam", "Wallis and Futuna", "Western Sahara", "Yemen", "Zambia", "Zimbabwe", "Åland Islands"];
955
1510
  const keyToAddressComponents = {
956
1511
  line1: ["street_number", "floor", "room", "premise"],
957
1512
  line2: ["subpremise", "street_address", "route"],
@@ -991,7 +1546,8 @@ const useGooglePlaces = () => {
991
1546
  const {
992
1547
  predictions
993
1548
  } = await autocomplete.getPlacePredictions({
994
- input
1549
+ input,
1550
+ language: "en"
995
1551
  });
996
1552
  return predictions.map((p) => ({
997
1553
  label: p.description,
@@ -1001,7 +1557,8 @@ const useGooglePlaces = () => {
1001
1557
  getPlaceDetails: async (placeId) => {
1002
1558
  const result = await new Promise((resolve, reject) => places.getDetails({
1003
1559
  placeId,
1004
- fields: ["address_components"]
1560
+ fields: ["address_components"],
1561
+ language: "en"
1005
1562
  }, (result2, status) => {
1006
1563
  if (status !== google.maps.places.PlacesServiceStatus["OK"])
1007
1564
  return reject(status);
@@ -1173,7 +1730,7 @@ const ChatInputAddressQuery = ({
1173
1730
  ref,
1174
1731
  name: "address",
1175
1732
  id: "chat-address",
1176
- autocomplete: "on",
1733
+ autocomplete: "address-line1 country-name postal-code",
1177
1734
  autoFocus: true,
1178
1735
  class: "outline-divider ease-expo-out placeholder:text-neutral-10 text-neutral-12 focus-visible:outline-accent-7 caret-accent-9 bg-lowest w-full rounded-full px-3 py-1 text-base outline outline-2 transition-all",
1179
1736
  placeholder: input.config.placeholder || "Search an address",
@@ -1251,7 +1808,10 @@ const ChatInputAddressDetails = ({
1251
1808
  onSubmit: (e) => {
1252
1809
  const formData = new FormData(e.currentTarget);
1253
1810
  const fields = Object.fromEntries(formData.entries());
1254
- onSubmitSuccess(fields);
1811
+ onSubmitSuccess({
1812
+ type: "address",
1813
+ value: fields
1814
+ });
1255
1815
  },
1256
1816
  children: [index.o("div", {
1257
1817
  class: "bg-neutral-3 border-neutral-5 grid items-center gap-1.5 rounded-2xl border pb-2 pl-4 pr-3 pt-3 [grid-template-columns:min-content_1fr]",
@@ -1268,9 +1828,42 @@ const ChatInputAddressDetails = ({
1268
1828
  children: addressKeyToLabel[key]
1269
1829
  }), index.o("div", {
1270
1830
  class: "flex flex-col items-stretch gap-1.5",
1271
- children: [index.o("input", {
1831
+ children: [key === "country" ? index.o("div", {
1832
+ class: "relative",
1833
+ children: [index.o("select", {
1834
+ class: "text-neutral-12 hover:bg-neutral-4 placeholder:text-neutral-8 focus:bg-neutral-5 w-full flex-1 appearance-none rounded-lg border-solid bg-transparent bg-none px-3 py-1.5 text-base transition-colors focus:outline-none",
1835
+ name,
1836
+ id: labelId,
1837
+ defaultValue: addressFields[key],
1838
+ required: true,
1839
+ children: [addressFields.country && !countryNames.includes(addressFields.country) ? index.o("option", {
1840
+ value: addressFields[key],
1841
+ children: addressFields[key]
1842
+ }) : index.o("option", {
1843
+ value: "",
1844
+ children: "Select a country"
1845
+ }), countryNames.map((country) => index.o("option", {
1846
+ value: country,
1847
+ children: country
1848
+ }, country))]
1849
+ }), index.o("svg", {
1850
+ class: "text-neutral-12 absolute bottom-2.5 right-2 flex items-center justify-center",
1851
+ width: "16",
1852
+ height: "16",
1853
+ stroke: "currentColor",
1854
+ "stroke-width": "1.5",
1855
+ "stroke-linecap": "round",
1856
+ "stroke-linejoin": "round",
1857
+ viewBox: "0 0 16 16",
1858
+ fill: "none",
1859
+ xmlns: "http://www.w3.org/2000/svg",
1860
+ children: index.o("path", {
1861
+ d: "M4 6.5L8 10.5L12 6.5"
1862
+ })
1863
+ })]
1864
+ }) : index.o("input", {
1272
1865
  autoFocus: i2 === 0 ? true : void 0,
1273
- class: "text-neutral-12 hover:bg-neutral-4 placeholder:text-neutral-8 focus:bg-neutral-5 flex-1 rounded-lg border-solid bg-transparent px-3 py-1.5 text-base transition-colors focus:outline-none",
1866
+ class: "text-neutral-12 hover:bg-neutral-4 placeholder:text-neutral-8 focus:bg-neutral-5 flex-1 rounded-lg border-solid bg-transparent px-3 py-1.5 text-base transition-colors autofill:shadow-[inset_0_0_0_1000px_hsl(210_16.7%_97.6%)] focus:outline-none",
1274
1867
  name,
1275
1868
  id: labelId,
1276
1869
  defaultValue: addressFields[key],
@@ -1325,7 +1918,10 @@ const ChatInputBoolean = ({
1325
1918
  throw new Error("invalid form");
1326
1919
  });
1327
1920
  const answer = index.parse(AnswerSchema, value);
1328
- onSubmitSuccess(answer);
1921
+ onSubmitSuccess({
1922
+ type: "boolean",
1923
+ value: answer === "true"
1924
+ });
1329
1925
  },
1330
1926
  children: [index.o("div", {
1331
1927
  class: "flex items-center gap-2 p-2.5",
@@ -1460,7 +2056,7 @@ const ChatInputFile = ({
1460
2056
  }) => {
1461
2057
  var _a;
1462
2058
  const submission = (_a = index.store.current$.value.flow) == null ? void 0 : _a.data.submissions[input.key];
1463
- const [files, setFiles] = index.h(isFileSubmission(submission) && submission.value !== null ? submission.value : []);
2059
+ const [files, setFiles] = index.h(isFileSubmission(submission) ? submission.value : []);
1464
2060
  const [error, setError] = index.h();
1465
2061
  const hiddenFileCount = files.length - FILENAMES_TO_SHOW_QTY;
1466
2062
  const totalSize = addFileSizesKb(files);
@@ -1496,7 +2092,10 @@ const ChatInputFile = ({
1496
2092
  type: "invalid",
1497
2093
  message: "Only one file is allowed"
1498
2094
  });
1499
- return onSubmitSuccess(files);
2095
+ return onSubmitSuccess({
2096
+ type: "file",
2097
+ value: files
2098
+ });
1500
2099
  },
1501
2100
  children: [index.o("div", {
1502
2101
  class: "flex items-center gap-2",
@@ -1621,14 +2220,14 @@ var isPlainObject = (tempObject) => {
1621
2220
  var isWeb = typeof window !== "undefined" && typeof window.HTMLElement !== "undefined" && typeof document !== "undefined";
1622
2221
  function cloneObject(data) {
1623
2222
  let copy;
1624
- const isArray = Array.isArray(data);
2223
+ const isArray2 = Array.isArray(data);
1625
2224
  if (data instanceof Date) {
1626
2225
  copy = new Date(data);
1627
2226
  } else if (data instanceof Set) {
1628
2227
  copy = new Set(data);
1629
- } else if (!(isWeb && (data instanceof Blob || data instanceof FileList)) && (isArray || isObject(data))) {
1630
- copy = isArray ? [] : {};
1631
- if (!isArray && !isPlainObject(data)) {
2228
+ } else if (!(isWeb && (data instanceof Blob || data instanceof FileList)) && (isArray2 || isObject(data))) {
2229
+ copy = isArray2 ? [] : {};
2230
+ if (!isArray2 && !isPlainObject(data)) {
1632
2231
  copy = data;
1633
2232
  } else {
1634
2233
  for (const key in data) {
@@ -3079,7 +3678,7 @@ const submitIfSingleChecked = (form) => {
3079
3678
  bubbles: true
3080
3679
  }));
3081
3680
  };
3082
- const isMultipleChoiceSubmission = index.isSubmissionOfType("multiple-choice");
3681
+ const isMultipleChoiceSubmission = index.isSubmissionOfType("enum");
3083
3682
  const getResolver$1 = (config) => {
3084
3683
  const length = {
3085
3684
  min: config.minSelected ?? 0,
@@ -3119,7 +3718,10 @@ const ChatInputMultipleChoice = ({
3119
3718
  },
3120
3719
  onSubmit: handleSubmit((submission2) => {
3121
3720
  const checked = submission2.checked;
3122
- onSubmitSuccess(checked);
3721
+ onSubmitSuccess({
3722
+ type: "enum",
3723
+ value: checked
3724
+ });
3123
3725
  }),
3124
3726
  children: [index.o("div", {
3125
3727
  class: "flex items-center gap-1",
@@ -3161,7 +3763,10 @@ const ChatInputMultipleChoice = ({
3161
3763
  class: "flex flex-col items-center gap-2",
3162
3764
  children: [!isSingleChoice && index.o(SendButton, {}), input.config.minSelected === 0 && index.o(SkipButton, {
3163
3765
  type: "button",
3164
- onClick: () => onSubmitSuccess([])
3766
+ onClick: () => onSubmitSuccess({
3767
+ type: "enum",
3768
+ value: []
3769
+ })
3165
3770
  })]
3166
3771
  })]
3167
3772
  }), index.o("div", {
@@ -3234,7 +3839,7 @@ const inputFormatToProps = {
3234
3839
  formNoValidate: true
3235
3840
  }
3236
3841
  };
3237
- const isTextSubmission = index.isSubmissionOfType("text");
3842
+ const isTextSubmission = index.isSubmissionOfType("string");
3238
3843
  const getResolver = (config) => {
3239
3844
  const maxLengthError = `Please enter no more than ${config.maxChars} characters`;
3240
3845
  return i(index.object({
@@ -3278,42 +3883,43 @@ const ChatInputText = ({
3278
3883
  ref.current.select();
3279
3884
  }
3280
3885
  }, []);
3281
- return index.o(index.k, {
3282
- children: index.o("form", {
3283
- noValidate: true,
3284
- class: "flex flex-col gap-1 p-2.5",
3285
- onSubmit: handleSubmit((submission2) => {
3286
- onSubmitSuccess(submission2.text);
3287
- }),
3886
+ return index.o("form", {
3887
+ noValidate: true,
3888
+ class: "flex flex-col gap-1 p-2.5",
3889
+ onSubmit: handleSubmit((submission2) => {
3890
+ onSubmitSuccess({
3891
+ type: "string",
3892
+ value: submission2.text
3893
+ });
3894
+ }),
3895
+ children: [index.o("div", {
3896
+ class: "flex items-center gap-2",
3288
3897
  children: [index.o("div", {
3289
- class: "flex items-center gap-2",
3290
- children: [index.o("div", {
3291
- class: "relative min-w-0 flex-grow",
3292
- children: [index.o("input", {
3293
- id: "chat-input",
3294
- ...props,
3295
- ...inputFormatToProps[input.config.format],
3296
- autocomplete: "off",
3297
- autoCapitalize: "off",
3298
- autoCorrect: "off",
3299
- autoFocus: true,
3300
- ref: (element) => {
3301
- if (element) {
3302
- ref.current = element;
3303
- }
3304
- setRef(element);
3305
- },
3306
- class: "outline-divider ease-expo-out placeholder:text-neutral-10 text-neutral-12 focus-visible:outline-accent-7 caret-accent-9 bg-lowest w-full rounded-full px-3 py-1 text-base outline outline-2 transition-all",
3307
- placeholder: input.config.placeholder
3308
- }), input.config.optional && index.o(SkipButton, {
3309
- class: "absolute right-0 top-0",
3310
- onClick: () => onSubmitSuccess(null)
3311
- })]
3312
- }), index.o(SendButton, {})]
3313
- }), index.o(InputError, {
3314
- error: errors2.text
3315
- })]
3316
- })
3898
+ class: "relative min-w-0 flex-grow",
3899
+ children: [index.o("input", {
3900
+ id: "chat-input",
3901
+ ...props,
3902
+ ...inputFormatToProps[input.config.format],
3903
+ autocomplete: "off",
3904
+ autoCapitalize: "off",
3905
+ autoCorrect: "off",
3906
+ autoFocus: true,
3907
+ ref: (element) => {
3908
+ if (element) {
3909
+ ref.current = element;
3910
+ }
3911
+ setRef(element);
3912
+ },
3913
+ class: "outline-divider ease-expo-out placeholder:text-neutral-10 text-neutral-12 focus-visible:outline-accent-7 caret-accent-9 bg-lowest w-full rounded-full px-3 py-1 text-base outline outline-2 transition-all",
3914
+ placeholder: input.config.placeholder
3915
+ }), input.config.optional && index.o(SkipButton, {
3916
+ class: "absolute right-0 top-0",
3917
+ onClick: () => onSubmitSuccess(null)
3918
+ })]
3919
+ }), index.o(SendButton, {})]
3920
+ }), index.o(InputError, {
3921
+ error: errors2.text
3922
+ })]
3317
3923
  });
3318
3924
  };
3319
3925
  const ChatInput = () => {
@@ -3335,10 +3941,6 @@ const ChatInput = () => {
3335
3941
  wrapper.removeEventListener("transitionend", chatStore.scrollToEnd.smooth);
3336
3942
  };
3337
3943
  }, []);
3338
- const handleSubmitSuccess = (type) => (value) => chatStore.onSubmitSuccessFn$.value({
3339
- type,
3340
- value
3341
- });
3342
3944
  return index.o("div", {
3343
3945
  ref: inputWrapperRef,
3344
3946
  class: "ease-expo-out absolute bottom-0 w-full overflow-hidden rounded-b-3xl backdrop-blur-xl transition-all duration-700 will-change-[height]",
@@ -3369,44 +3971,50 @@ const ChatInput = () => {
3369
3971
  type: "text"
3370
3972
  }
3371
3973
  }, (props) => index.o(ChatInputText, {
3372
- onSubmitSuccess: handleSubmitSuccess(props.input.type),
3974
+ onSubmitSuccess: chatStore.onSubmitSuccessFn$.value,
3373
3975
  ...props
3374
3976
  })).with({
3375
3977
  input: {
3376
3978
  type: "multiple-choice"
3377
3979
  }
3378
3980
  }, (props) => index.o(ChatInputMultipleChoice, {
3379
- onSubmitSuccess: handleSubmitSuccess(props.input.type),
3981
+ onSubmitSuccess: chatStore.onSubmitSuccessFn$.value,
3380
3982
  ...props
3381
3983
  })).with({
3382
3984
  input: {
3383
3985
  type: "boolean"
3384
3986
  }
3385
3987
  }, (props) => index.o(ChatInputBoolean, {
3386
- onSubmitSuccess: handleSubmitSuccess(props.input.type),
3988
+ onSubmitSuccess: chatStore.onSubmitSuccessFn$.value,
3387
3989
  ...props
3388
3990
  })).with({
3389
3991
  input: {
3390
3992
  type: "file"
3391
3993
  }
3392
3994
  }, (props) => index.o(ChatInputFile, {
3393
- onSubmitSuccess: handleSubmitSuccess(props.input.type),
3995
+ onSubmitSuccess: chatStore.onSubmitSuccessFn$.value,
3394
3996
  ...props
3395
3997
  })).with({
3396
3998
  input: {
3397
3999
  type: "submit"
3398
4000
  }
3399
4001
  }, (props) => index.o(ChatInputSubmit, {
3400
- onSubmitSuccess: handleSubmitSuccess(props.input.type),
4002
+ onSubmitSuccess: chatStore.onSubmitSuccessFn$.value,
3401
4003
  ...props
3402
4004
  })).with({
3403
4005
  input: {
3404
4006
  type: "address"
3405
4007
  }
3406
4008
  }, (props) => index.o(ChatInputAddress, {
3407
- onSubmitSuccess: handleSubmitSuccess(props.input.type),
4009
+ onSubmitSuccess: chatStore.onSubmitSuccessFn$.value,
3408
4010
  ...props
3409
- })).exhaustive()
4011
+ })).with({
4012
+ input: {
4013
+ type: "number"
4014
+ }
4015
+ }, () => {
4016
+ throw new Error("Not implemented");
4017
+ }).exhaustive()
3410
4018
  })
3411
4019
  });
3412
4020
  };