@inploi/plugin-chatbot 3.19.0 → 3.20.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.
@@ -5,6 +5,465 @@ var __publicField = (obj, key, value) => {
5
5
  return value;
6
6
  };
7
7
  import { createPlugin } from "@inploi/sdk";
8
+ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
9
+ function getDefaultExportFromCjs(x2) {
10
+ return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
11
+ }
12
+ var isArray$3 = Array.isArray;
13
+ var isArray_1 = isArray$3;
14
+ var freeGlobal$1 = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
15
+ var _freeGlobal = freeGlobal$1;
16
+ var freeGlobal = _freeGlobal;
17
+ var freeSelf = typeof self == "object" && self && self.Object === Object && self;
18
+ var root$3 = freeGlobal || freeSelf || Function("return this")();
19
+ var _root = root$3;
20
+ var root$2 = _root;
21
+ var Symbol$4 = root$2.Symbol;
22
+ var _Symbol = Symbol$4;
23
+ var Symbol$3 = _Symbol;
24
+ var objectProto$4 = Object.prototype;
25
+ var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
26
+ var nativeObjectToString$1 = objectProto$4.toString;
27
+ var symToStringTag$1 = Symbol$3 ? Symbol$3.toStringTag : void 0;
28
+ function getRawTag$1(value) {
29
+ var isOwn = hasOwnProperty$3.call(value, symToStringTag$1), tag = value[symToStringTag$1];
30
+ try {
31
+ value[symToStringTag$1] = void 0;
32
+ var unmasked = true;
33
+ } catch (e2) {
34
+ }
35
+ var result = nativeObjectToString$1.call(value);
36
+ if (unmasked) {
37
+ if (isOwn) {
38
+ value[symToStringTag$1] = tag;
39
+ } else {
40
+ delete value[symToStringTag$1];
41
+ }
42
+ }
43
+ return result;
44
+ }
45
+ var _getRawTag = getRawTag$1;
46
+ var objectProto$3 = Object.prototype;
47
+ var nativeObjectToString = objectProto$3.toString;
48
+ function objectToString$1(value) {
49
+ return nativeObjectToString.call(value);
50
+ }
51
+ var _objectToString = objectToString$1;
52
+ var Symbol$2 = _Symbol, getRawTag = _getRawTag, objectToString = _objectToString;
53
+ var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
54
+ var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
55
+ function baseGetTag$2(value) {
56
+ if (value == null) {
57
+ return value === void 0 ? undefinedTag : nullTag;
58
+ }
59
+ return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
60
+ }
61
+ var _baseGetTag = baseGetTag$2;
62
+ function isObjectLike$1(value) {
63
+ return value != null && typeof value == "object";
64
+ }
65
+ var isObjectLike_1 = isObjectLike$1;
66
+ var baseGetTag$1 = _baseGetTag, isObjectLike = isObjectLike_1;
67
+ var symbolTag = "[object Symbol]";
68
+ function isSymbol$3(value) {
69
+ return typeof value == "symbol" || isObjectLike(value) && baseGetTag$1(value) == symbolTag;
70
+ }
71
+ var isSymbol_1 = isSymbol$3;
72
+ var isArray$2 = isArray_1, isSymbol$2 = isSymbol_1;
73
+ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
74
+ function isKey$1(value, object2) {
75
+ if (isArray$2(value)) {
76
+ return false;
77
+ }
78
+ var type = typeof value;
79
+ if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol$2(value)) {
80
+ return true;
81
+ }
82
+ return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object2 != null && value in Object(object2);
83
+ }
84
+ var _isKey = isKey$1;
85
+ function isObject$3(value) {
86
+ var type = typeof value;
87
+ return value != null && (type == "object" || type == "function");
88
+ }
89
+ var isObject_1 = isObject$3;
90
+ var baseGetTag = _baseGetTag, isObject$2 = isObject_1;
91
+ var asyncTag = "[object AsyncFunction]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
92
+ function isFunction$1(value) {
93
+ if (!isObject$2(value)) {
94
+ return false;
95
+ }
96
+ var tag = baseGetTag(value);
97
+ return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
98
+ }
99
+ var isFunction_1 = isFunction$1;
100
+ var root$1 = _root;
101
+ var coreJsData$1 = root$1["__core-js_shared__"];
102
+ var _coreJsData = coreJsData$1;
103
+ var coreJsData = _coreJsData;
104
+ var maskSrcKey = function() {
105
+ var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
106
+ return uid ? "Symbol(src)_1." + uid : "";
107
+ }();
108
+ function isMasked$1(func) {
109
+ return !!maskSrcKey && maskSrcKey in func;
110
+ }
111
+ var _isMasked = isMasked$1;
112
+ var funcProto$1 = Function.prototype;
113
+ var funcToString$1 = funcProto$1.toString;
114
+ function toSource$1(func) {
115
+ if (func != null) {
116
+ try {
117
+ return funcToString$1.call(func);
118
+ } catch (e2) {
119
+ }
120
+ try {
121
+ return func + "";
122
+ } catch (e2) {
123
+ }
124
+ }
125
+ return "";
126
+ }
127
+ var _toSource = toSource$1;
128
+ var isFunction = isFunction_1, isMasked = _isMasked, isObject$1 = isObject_1, toSource = _toSource;
129
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
130
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
131
+ var funcProto = Function.prototype, objectProto$2 = Object.prototype;
132
+ var funcToString = funcProto.toString;
133
+ var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
134
+ var reIsNative = RegExp(
135
+ "^" + funcToString.call(hasOwnProperty$2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
136
+ );
137
+ function baseIsNative$1(value) {
138
+ if (!isObject$1(value) || isMasked(value)) {
139
+ return false;
140
+ }
141
+ var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
142
+ return pattern.test(toSource(value));
143
+ }
144
+ var _baseIsNative = baseIsNative$1;
145
+ function getValue$1(object2, key) {
146
+ return object2 == null ? void 0 : object2[key];
147
+ }
148
+ var _getValue = getValue$1;
149
+ var baseIsNative = _baseIsNative, getValue = _getValue;
150
+ function getNative$2(object2, key) {
151
+ var value = getValue(object2, key);
152
+ return baseIsNative(value) ? value : void 0;
153
+ }
154
+ var _getNative = getNative$2;
155
+ var getNative$1 = _getNative;
156
+ var nativeCreate$4 = getNative$1(Object, "create");
157
+ var _nativeCreate = nativeCreate$4;
158
+ var nativeCreate$3 = _nativeCreate;
159
+ function hashClear$1() {
160
+ this.__data__ = nativeCreate$3 ? nativeCreate$3(null) : {};
161
+ this.size = 0;
162
+ }
163
+ var _hashClear = hashClear$1;
164
+ function hashDelete$1(key) {
165
+ var result = this.has(key) && delete this.__data__[key];
166
+ this.size -= result ? 1 : 0;
167
+ return result;
168
+ }
169
+ var _hashDelete = hashDelete$1;
170
+ var nativeCreate$2 = _nativeCreate;
171
+ var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
172
+ var objectProto$1 = Object.prototype;
173
+ var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
174
+ function hashGet$1(key) {
175
+ var data = this.__data__;
176
+ if (nativeCreate$2) {
177
+ var result = data[key];
178
+ return result === HASH_UNDEFINED$1 ? void 0 : result;
179
+ }
180
+ return hasOwnProperty$1.call(data, key) ? data[key] : void 0;
181
+ }
182
+ var _hashGet = hashGet$1;
183
+ var nativeCreate$1 = _nativeCreate;
184
+ var objectProto = Object.prototype;
185
+ var hasOwnProperty = objectProto.hasOwnProperty;
186
+ function hashHas$1(key) {
187
+ var data = this.__data__;
188
+ return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty.call(data, key);
189
+ }
190
+ var _hashHas = hashHas$1;
191
+ var nativeCreate = _nativeCreate;
192
+ var HASH_UNDEFINED = "__lodash_hash_undefined__";
193
+ function hashSet$1(key, value) {
194
+ var data = this.__data__;
195
+ this.size += this.has(key) ? 0 : 1;
196
+ data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
197
+ return this;
198
+ }
199
+ var _hashSet = hashSet$1;
200
+ var hashClear = _hashClear, hashDelete = _hashDelete, hashGet = _hashGet, hashHas = _hashHas, hashSet = _hashSet;
201
+ function Hash$1(entries) {
202
+ var index = -1, length = entries == null ? 0 : entries.length;
203
+ this.clear();
204
+ while (++index < length) {
205
+ var entry = entries[index];
206
+ this.set(entry[0], entry[1]);
207
+ }
208
+ }
209
+ Hash$1.prototype.clear = hashClear;
210
+ Hash$1.prototype["delete"] = hashDelete;
211
+ Hash$1.prototype.get = hashGet;
212
+ Hash$1.prototype.has = hashHas;
213
+ Hash$1.prototype.set = hashSet;
214
+ var _Hash = Hash$1;
215
+ function listCacheClear$1() {
216
+ this.__data__ = [];
217
+ this.size = 0;
218
+ }
219
+ var _listCacheClear = listCacheClear$1;
220
+ function eq$1(value, other) {
221
+ return value === other || value !== value && other !== other;
222
+ }
223
+ var eq_1 = eq$1;
224
+ var eq = eq_1;
225
+ function assocIndexOf$4(array2, key) {
226
+ var length = array2.length;
227
+ while (length--) {
228
+ if (eq(array2[length][0], key)) {
229
+ return length;
230
+ }
231
+ }
232
+ return -1;
233
+ }
234
+ var _assocIndexOf = assocIndexOf$4;
235
+ var assocIndexOf$3 = _assocIndexOf;
236
+ var arrayProto = Array.prototype;
237
+ var splice = arrayProto.splice;
238
+ function listCacheDelete$1(key) {
239
+ var data = this.__data__, index = assocIndexOf$3(data, key);
240
+ if (index < 0) {
241
+ return false;
242
+ }
243
+ var lastIndex = data.length - 1;
244
+ if (index == lastIndex) {
245
+ data.pop();
246
+ } else {
247
+ splice.call(data, index, 1);
248
+ }
249
+ --this.size;
250
+ return true;
251
+ }
252
+ var _listCacheDelete = listCacheDelete$1;
253
+ var assocIndexOf$2 = _assocIndexOf;
254
+ function listCacheGet$1(key) {
255
+ var data = this.__data__, index = assocIndexOf$2(data, key);
256
+ return index < 0 ? void 0 : data[index][1];
257
+ }
258
+ var _listCacheGet = listCacheGet$1;
259
+ var assocIndexOf$1 = _assocIndexOf;
260
+ function listCacheHas$1(key) {
261
+ return assocIndexOf$1(this.__data__, key) > -1;
262
+ }
263
+ var _listCacheHas = listCacheHas$1;
264
+ var assocIndexOf = _assocIndexOf;
265
+ function listCacheSet$1(key, value) {
266
+ var data = this.__data__, index = assocIndexOf(data, key);
267
+ if (index < 0) {
268
+ ++this.size;
269
+ data.push([key, value]);
270
+ } else {
271
+ data[index][1] = value;
272
+ }
273
+ return this;
274
+ }
275
+ var _listCacheSet = listCacheSet$1;
276
+ var listCacheClear = _listCacheClear, listCacheDelete = _listCacheDelete, listCacheGet = _listCacheGet, listCacheHas = _listCacheHas, listCacheSet = _listCacheSet;
277
+ function ListCache$1(entries) {
278
+ var index = -1, length = entries == null ? 0 : entries.length;
279
+ this.clear();
280
+ while (++index < length) {
281
+ var entry = entries[index];
282
+ this.set(entry[0], entry[1]);
283
+ }
284
+ }
285
+ ListCache$1.prototype.clear = listCacheClear;
286
+ ListCache$1.prototype["delete"] = listCacheDelete;
287
+ ListCache$1.prototype.get = listCacheGet;
288
+ ListCache$1.prototype.has = listCacheHas;
289
+ ListCache$1.prototype.set = listCacheSet;
290
+ var _ListCache = ListCache$1;
291
+ var getNative = _getNative, root = _root;
292
+ var Map$2 = getNative(root, "Map");
293
+ var _Map = Map$2;
294
+ var Hash = _Hash, ListCache = _ListCache, Map$1 = _Map;
295
+ function mapCacheClear$1() {
296
+ this.size = 0;
297
+ this.__data__ = {
298
+ "hash": new Hash(),
299
+ "map": new (Map$1 || ListCache)(),
300
+ "string": new Hash()
301
+ };
302
+ }
303
+ var _mapCacheClear = mapCacheClear$1;
304
+ function isKeyable$1(value) {
305
+ var type = typeof value;
306
+ return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
307
+ }
308
+ var _isKeyable = isKeyable$1;
309
+ var isKeyable = _isKeyable;
310
+ function getMapData$4(map, key) {
311
+ var data = map.__data__;
312
+ return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
313
+ }
314
+ var _getMapData = getMapData$4;
315
+ var getMapData$3 = _getMapData;
316
+ function mapCacheDelete$1(key) {
317
+ var result = getMapData$3(this, key)["delete"](key);
318
+ this.size -= result ? 1 : 0;
319
+ return result;
320
+ }
321
+ var _mapCacheDelete = mapCacheDelete$1;
322
+ var getMapData$2 = _getMapData;
323
+ function mapCacheGet$1(key) {
324
+ return getMapData$2(this, key).get(key);
325
+ }
326
+ var _mapCacheGet = mapCacheGet$1;
327
+ var getMapData$1 = _getMapData;
328
+ function mapCacheHas$1(key) {
329
+ return getMapData$1(this, key).has(key);
330
+ }
331
+ var _mapCacheHas = mapCacheHas$1;
332
+ var getMapData = _getMapData;
333
+ function mapCacheSet$1(key, value) {
334
+ var data = getMapData(this, key), size = data.size;
335
+ data.set(key, value);
336
+ this.size += data.size == size ? 0 : 1;
337
+ return this;
338
+ }
339
+ var _mapCacheSet = mapCacheSet$1;
340
+ var mapCacheClear = _mapCacheClear, mapCacheDelete = _mapCacheDelete, mapCacheGet = _mapCacheGet, mapCacheHas = _mapCacheHas, mapCacheSet = _mapCacheSet;
341
+ function MapCache$1(entries) {
342
+ var index = -1, length = entries == null ? 0 : entries.length;
343
+ this.clear();
344
+ while (++index < length) {
345
+ var entry = entries[index];
346
+ this.set(entry[0], entry[1]);
347
+ }
348
+ }
349
+ MapCache$1.prototype.clear = mapCacheClear;
350
+ MapCache$1.prototype["delete"] = mapCacheDelete;
351
+ MapCache$1.prototype.get = mapCacheGet;
352
+ MapCache$1.prototype.has = mapCacheHas;
353
+ MapCache$1.prototype.set = mapCacheSet;
354
+ var _MapCache = MapCache$1;
355
+ var MapCache = _MapCache;
356
+ var FUNC_ERROR_TEXT = "Expected a function";
357
+ function memoize$1(func, resolver) {
358
+ if (typeof func != "function" || resolver != null && typeof resolver != "function") {
359
+ throw new TypeError(FUNC_ERROR_TEXT);
360
+ }
361
+ var memoized = function() {
362
+ var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
363
+ if (cache.has(key)) {
364
+ return cache.get(key);
365
+ }
366
+ var result = func.apply(this, args);
367
+ memoized.cache = cache.set(key, result) || cache;
368
+ return result;
369
+ };
370
+ memoized.cache = new (memoize$1.Cache || MapCache)();
371
+ return memoized;
372
+ }
373
+ memoize$1.Cache = MapCache;
374
+ var memoize_1 = memoize$1;
375
+ var memoize = memoize_1;
376
+ var MAX_MEMOIZE_SIZE = 500;
377
+ function memoizeCapped$1(func) {
378
+ var result = memoize(func, function(key) {
379
+ if (cache.size === MAX_MEMOIZE_SIZE) {
380
+ cache.clear();
381
+ }
382
+ return key;
383
+ });
384
+ var cache = result.cache;
385
+ return result;
386
+ }
387
+ var _memoizeCapped = memoizeCapped$1;
388
+ var memoizeCapped = _memoizeCapped;
389
+ var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
390
+ var reEscapeChar = /\\(\\)?/g;
391
+ var stringToPath$1 = memoizeCapped(function(string2) {
392
+ var result = [];
393
+ if (string2.charCodeAt(0) === 46) {
394
+ result.push("");
395
+ }
396
+ string2.replace(rePropName, function(match, number2, quote, subString) {
397
+ result.push(quote ? subString.replace(reEscapeChar, "$1") : number2 || match);
398
+ });
399
+ return result;
400
+ });
401
+ var _stringToPath = stringToPath$1;
402
+ function arrayMap$1(array2, iteratee) {
403
+ var index = -1, length = array2 == null ? 0 : array2.length, result = Array(length);
404
+ while (++index < length) {
405
+ result[index] = iteratee(array2[index], index, array2);
406
+ }
407
+ return result;
408
+ }
409
+ var _arrayMap = arrayMap$1;
410
+ var Symbol$1 = _Symbol, arrayMap = _arrayMap, isArray$1 = isArray_1, isSymbol$1 = isSymbol_1;
411
+ var INFINITY$1 = 1 / 0;
412
+ var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolToString = symbolProto ? symbolProto.toString : void 0;
413
+ function baseToString$1(value) {
414
+ if (typeof value == "string") {
415
+ return value;
416
+ }
417
+ if (isArray$1(value)) {
418
+ return arrayMap(value, baseToString$1) + "";
419
+ }
420
+ if (isSymbol$1(value)) {
421
+ return symbolToString ? symbolToString.call(value) : "";
422
+ }
423
+ var result = value + "";
424
+ return result == "0" && 1 / value == -INFINITY$1 ? "-0" : result;
425
+ }
426
+ var _baseToString = baseToString$1;
427
+ var baseToString = _baseToString;
428
+ function toString$1(value) {
429
+ return value == null ? "" : baseToString(value);
430
+ }
431
+ var toString_1 = toString$1;
432
+ var isArray = isArray_1, isKey = _isKey, stringToPath = _stringToPath, toString = toString_1;
433
+ function castPath$1(value, object2) {
434
+ if (isArray(value)) {
435
+ return value;
436
+ }
437
+ return isKey(value, object2) ? [value] : stringToPath(toString(value));
438
+ }
439
+ var _castPath = castPath$1;
440
+ var isSymbol = isSymbol_1;
441
+ var INFINITY = 1 / 0;
442
+ function toKey$1(value) {
443
+ if (typeof value == "string" || isSymbol(value)) {
444
+ return value;
445
+ }
446
+ var result = value + "";
447
+ return result == "0" && 1 / value == -INFINITY ? "-0" : result;
448
+ }
449
+ var _toKey = toKey$1;
450
+ var castPath = _castPath, toKey = _toKey;
451
+ function baseGet$1(object2, path) {
452
+ path = castPath(path, object2);
453
+ var index = 0, length = path.length;
454
+ while (object2 != null && index < length) {
455
+ object2 = object2[toKey(path[index++])];
456
+ }
457
+ return index && index == length ? object2 : void 0;
458
+ }
459
+ var _baseGet = baseGet$1;
460
+ var baseGet = _baseGet;
461
+ function get(object2, path, defaultValue) {
462
+ var result = object2 == null ? void 0 : baseGet(object2, path);
463
+ return result === void 0 ? defaultValue : result;
464
+ }
465
+ var get_1 = get;
466
+ const get$1 = /* @__PURE__ */ getDefaultExportFromCjs(get_1);
8
467
  var n$1, l$4, u$3, t$3, i$3, o$4, r$4, f$3, e$3, c$3 = {}, s$3 = [], a$3 = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, h$2 = Array.isArray;
9
468
  function v$3(n2, l2) {
10
469
  for (var u2 in l2)
@@ -429,6 +888,9 @@ function getSchemaIssues(info, reason, validation, message, input, issues) {
429
888
  ]
430
889
  };
431
890
  }
891
+ function getDefault(schema) {
892
+ return typeof schema.default === "function" ? schema.default() : schema.default;
893
+ }
432
894
  function any(pipe) {
433
895
  return {
434
896
  type: "any",
@@ -500,6 +962,38 @@ function boolean(arg1, arg2) {
500
962
  }
501
963
  };
502
964
  }
965
+ function literal(literal2, message = "Invalid type") {
966
+ return {
967
+ type: "literal",
968
+ async: false,
969
+ literal: literal2,
970
+ message,
971
+ _parse(input, info) {
972
+ if (input !== this.literal) {
973
+ return getSchemaIssues(info, "type", "literal", this.message, input);
974
+ }
975
+ return getOutput(input);
976
+ }
977
+ };
978
+ }
979
+ function nullable(wrapped, default_) {
980
+ return {
981
+ type: "nullable",
982
+ async: false,
983
+ wrapped,
984
+ default: default_,
985
+ _parse(input, info) {
986
+ if (input === null) {
987
+ const override = getDefault(this);
988
+ if (override === void 0) {
989
+ return getOutput(input);
990
+ }
991
+ input = override;
992
+ }
993
+ return this.wrapped._parse(input, info);
994
+ }
995
+ };
996
+ }
503
997
  function number(arg1, arg2) {
504
998
  const [message = "Invalid type", pipe] = getDefaultArgs(arg1, arg2);
505
999
  return {
@@ -601,6 +1095,24 @@ function object(entries, arg2, arg3, arg4) {
601
1095
  }
602
1096
  };
603
1097
  }
1098
+ function optional(wrapped, default_) {
1099
+ return {
1100
+ type: "optional",
1101
+ async: false,
1102
+ wrapped,
1103
+ default: default_,
1104
+ _parse(input, info) {
1105
+ if (input === void 0) {
1106
+ const override = getDefault(this);
1107
+ if (override === void 0) {
1108
+ return getOutput(input);
1109
+ }
1110
+ input = override;
1111
+ }
1112
+ return this.wrapped._parse(input, info);
1113
+ }
1114
+ };
1115
+ }
604
1116
  function picklist(options, message = "Invalid type") {
605
1117
  return {
606
1118
  type: "picklist",
@@ -721,6 +1233,34 @@ function record(arg1, arg2, arg3, arg4) {
721
1233
  }
722
1234
  };
723
1235
  }
1236
+ function union(options, message = "Invalid type") {
1237
+ return {
1238
+ type: "union",
1239
+ async: false,
1240
+ options,
1241
+ message,
1242
+ _parse(input, info) {
1243
+ let issues;
1244
+ let output;
1245
+ for (const schema of this.options) {
1246
+ const result = schema._parse(input, info);
1247
+ if (result.issues) {
1248
+ if (issues) {
1249
+ for (const issue of result.issues) {
1250
+ issues.push(issue);
1251
+ }
1252
+ } else {
1253
+ issues = result.issues;
1254
+ }
1255
+ } else {
1256
+ output = [result.output];
1257
+ break;
1258
+ }
1259
+ }
1260
+ return output ? getOutput(output[0]) : getSchemaIssues(info, "type", "union", this.message, input, issues);
1261
+ }
1262
+ };
1263
+ }
724
1264
  function parse$1(schema, input, info) {
725
1265
  const result = schema._parse(input, info);
726
1266
  if (result.issues) {
@@ -4758,7 +5298,7 @@ const StatusBar = ({
4758
5298
  })
4759
5299
  });
4760
5300
  };
4761
- const ChatbotBody = M(() => import("./chatbot-body-67894fdd.js").then((module) => module.ChatbotBody));
5301
+ const ChatbotBody = M(() => import("./chatbot-body-e6cc92c4.js").then((module) => module.ChatbotBody));
4762
5302
  const chatbotContentClass = cva("selection:bg-accent-4 selection:text-accent-12 fixed bottom-2 left-2 right-2 isolate mx-auto max-h-full max-w-[450px] focus:outline-none", {
4763
5303
  variants: {
4764
5304
  view: {
@@ -4835,7 +5375,11 @@ const FlowSchema = object({
4835
5375
  id: coerce(string(), String),
4836
5376
  version: number(),
4837
5377
  build: number(),
4838
- nodes: array(any())
5378
+ nodes: array(any()),
5379
+ context_schema: optional(nullable(record(string(), object({
5380
+ required: boolean(),
5381
+ type: union([literal("string"), literal("number")])
5382
+ }))))
4839
5383
  });
4840
5384
  const FlowByIdPayloadSchema = object({
4841
5385
  flow: FlowSchema
@@ -5106,6 +5650,34 @@ const generateColorThemeCss = (theme) => {
5106
5650
  ${tokenCss.concat(tokenCss).join("\n")}
5107
5651
  }`;
5108
5652
  };
5653
+ const validateContext = ({
5654
+ context,
5655
+ schema
5656
+ }) => {
5657
+ if (!schema)
5658
+ return;
5659
+ for (const key in schema) {
5660
+ const config = schema[key];
5661
+ if (!config)
5662
+ continue;
5663
+ const value = get$1(context, key, null);
5664
+ if (config.required && value === null) {
5665
+ throw new Error(`Configuration error in context: ${key} is required`);
5666
+ }
5667
+ switch (config.type) {
5668
+ case "number":
5669
+ if (typeof value !== "number")
5670
+ throw new Error(`Configuration error in context: ${key} is not a number`);
5671
+ break;
5672
+ case "string":
5673
+ if (typeof value !== "string")
5674
+ throw new Error(`Configuration error in context: ${key} is not a string`);
5675
+ break;
5676
+ default:
5677
+ config.type;
5678
+ }
5679
+ }
5680
+ };
5109
5681
  const chatbotPlugin = ({
5110
5682
  _internal_domManager: dom = createChatbotDomManager(),
5111
5683
  theme
@@ -5187,6 +5759,10 @@ const chatbotPlugin = ({
5187
5759
  };
5188
5760
  params.then(async (params2) => {
5189
5761
  const parsedParams = parse$1(StartFlowSchema, params2);
5762
+ validateContext({
5763
+ context: parsedParams.context,
5764
+ schema: parsedParams.flow.context_schema
5765
+ });
5190
5766
  store.startFlow(parsedParams);
5191
5767
  }).catch((error) => {
5192
5768
  const message = error instanceof Error ? error.message : "An error occurred";
@@ -5196,6 +5772,10 @@ const chatbotPlugin = ({
5196
5772
  };
5197
5773
  });
5198
5774
  } else {
5775
+ validateContext({
5776
+ context: params.context,
5777
+ schema: params.flow.context_schema
5778
+ });
5199
5779
  store.startFlow(params);
5200
5780
  }
5201
5781
  } catch (error) {
@@ -5216,45 +5796,47 @@ const chatbotPlugin = ({
5216
5796
  });
5217
5797
  export {
5218
5798
  AbortedError as A,
5219
- minValue as B,
5799
+ boolean as B,
5220
5800
  Cn as C,
5221
- maxValue as D,
5222
- custom as E,
5801
+ number as D,
5802
+ minValue as E,
5223
5803
  F$1 as F,
5224
- string as G,
5225
- email as H,
5226
- url as I,
5227
- regex as J,
5228
- cva as K,
5229
- ERROR_MESSAGES as L,
5230
- chatbotPlugin as M,
5804
+ maxValue as G,
5805
+ custom as H,
5806
+ string as I,
5807
+ email as J,
5808
+ url as K,
5809
+ regex as L,
5810
+ cva as M,
5231
5811
  N,
5812
+ ERROR_MESSAGES as O,
5813
+ chatbotPlugin as P,
5232
5814
  ValiError as V,
5233
5815
  _$3 as _,
5234
- invariant as a,
5235
- getFlowSubmissionsPayload as b,
5236
- _$4 as c,
5237
- clsx as d,
5238
- a as e,
5239
- debounce as f,
5240
- getHeadOrThrow as g,
5816
+ getHeadOrThrow as a,
5817
+ invariant as b,
5818
+ getFlowSubmissionsPayload as c,
5819
+ getDefaultExportFromCjs as d,
5820
+ _$4 as e,
5821
+ clsx as f,
5822
+ get$1 as g,
5241
5823
  h$1 as h,
5242
5824
  isString as i,
5243
- k$3 as j,
5825
+ a as j,
5244
5826
  kbToReadableSize as k,
5245
- parse$1 as l,
5246
- picklist as m,
5247
- isSubmissionOfType as n,
5827
+ debounce as l,
5828
+ k$3 as m,
5829
+ parse$1 as n,
5248
5830
  o,
5249
5831
  p$3 as p,
5250
- parseAsync as q,
5251
- object as r,
5832
+ picklist as q,
5833
+ isSubmissionOfType as r,
5252
5834
  store as s,
5253
- transform as t,
5254
- maxLength as u,
5255
- minLength as v,
5256
- record as w,
5257
- boolean as x,
5835
+ parseAsync as t,
5836
+ object as u,
5837
+ transform as v,
5838
+ maxLength as w,
5839
+ minLength as x,
5258
5840
  y$2 as y,
5259
- number as z
5841
+ record as z
5260
5842
  };