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