@inploi/plugin-chatbot 3.15.0 → 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.
- package/cdn/index.js +11 -11
- package/dist/{chatbot-body-0131fc86.js → chatbot-body-1f7580cd.js} +735 -171
- package/dist/{chatbot-body-daedf7bd.cjs → chatbot-body-5774cb2a.cjs} +735 -171
- package/dist/chatbot.d.ts +1 -3
- package/dist/chatbot.state.d.ts +127 -0
- package/dist/chatbot.utils.d.ts +9 -7
- package/dist/conditions.d.ts +3 -0
- package/dist/conditions.test.d.ts +1 -0
- package/dist/{index-b1d81d1c.js → index-063bd7e8.js} +1 -1
- package/dist/{index-51b0335a.cjs → index-a8a873bc.cjs} +1 -1
- package/dist/interpreter.d.ts +8 -7
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +1 -1
- package/package.json +7 -6
|
@@ -1,7 +1,605 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const index = require("./index-
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
1113
|
+
if (files === null) {
|
|
515
1114
|
await chat.sendMessage({
|
|
516
1115
|
type: "system",
|
|
517
1116
|
variant: "info",
|
|
@@ -541,91 +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
|
-
}).with({
|
|
596
|
-
compare: "greaterThan"
|
|
597
|
-
}, () => false).with({
|
|
598
|
-
compare: "lessThan"
|
|
599
|
-
}, () => false).with({
|
|
600
|
-
compare: "greaterThanOrEqualTo"
|
|
601
|
-
}, () => false).with({
|
|
602
|
-
compare: "lessThanOrEqualTo"
|
|
603
|
-
}, () => false).exhaustive();
|
|
604
|
-
};
|
|
605
1143
|
const interpolateString = (str, context) => {
|
|
606
1144
|
const regex = /{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g;
|
|
607
|
-
return str.replace(regex, (
|
|
1145
|
+
return str.replace(regex, (_, key, defaultValue = "") => {
|
|
608
1146
|
key = key.trim();
|
|
609
1147
|
const submission = context == null ? void 0 : context[key];
|
|
610
1148
|
if (!submission)
|
|
611
1149
|
return defaultValue;
|
|
612
1150
|
switch (submission.type) {
|
|
613
1151
|
case "boolean":
|
|
614
|
-
return submission.value ===
|
|
1152
|
+
return submission.value === true ? "true" : "false";
|
|
615
1153
|
case "file":
|
|
616
|
-
if (!submission.value)
|
|
617
|
-
return "no files";
|
|
618
1154
|
return submission.value.map((file) => `${file.name} (${index.kbToReadableSize(file.sizeKb)})`).join(", ");
|
|
619
|
-
case "
|
|
1155
|
+
case "enum":
|
|
620
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);
|
|
621
1166
|
default:
|
|
622
|
-
return
|
|
1167
|
+
return defaultValue;
|
|
623
1168
|
}
|
|
624
1169
|
});
|
|
625
1170
|
};
|
|
626
|
-
function getDefaultExportFromCjs(x) {
|
|
627
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
628
|
-
}
|
|
629
1171
|
function debounce(func, wait, immediate) {
|
|
630
1172
|
var timeout, args, context, timestamp, result;
|
|
631
1173
|
if (null == wait)
|
|
@@ -884,39 +1426,15 @@ const useChatService = () => {
|
|
|
884
1426
|
}
|
|
885
1427
|
};
|
|
886
1428
|
}, [chatRef]);
|
|
887
|
-
const chatService = index.F(() =>
|
|
888
|
-
|
|
889
|
-
message,
|
|
890
|
-
signal: signal2,
|
|
891
|
-
groupId
|
|
892
|
-
}) => {
|
|
893
|
-
await index.N(message).with({
|
|
894
|
-
author: "bot",
|
|
895
|
-
type: "text"
|
|
896
|
-
}, async (message2) => {
|
|
897
|
-
if (signal2 == null ? void 0 : signal2.aborted)
|
|
898
|
-
throw new index.AbortedError();
|
|
899
|
-
chatStore.isBotTyping$.value = true;
|
|
900
|
-
const typingTime = Math.min(Math.max(20, message2.text.length), 100) * TYPING_SPEED_MS_PER_CHARACTER;
|
|
901
|
-
await new Promise((resolve) => {
|
|
902
|
-
return setTimeout(resolve, typingTime, {
|
|
903
|
-
signal: signal2
|
|
904
|
-
});
|
|
905
|
-
});
|
|
906
|
-
chatStore.isBotTyping$.value = false;
|
|
907
|
-
}).otherwise(async () => void 0);
|
|
908
|
-
if (signal2 == null ? void 0 : signal2.aborted)
|
|
909
|
-
throw new index.AbortedError();
|
|
910
|
-
index.store.addMessage(message, groupId);
|
|
911
|
-
},
|
|
912
|
-
input: async ({
|
|
1429
|
+
const chatService = index.F(() => {
|
|
1430
|
+
const inputFn = ({
|
|
913
1431
|
input,
|
|
914
1432
|
signal: signal2
|
|
915
1433
|
}) => {
|
|
916
1434
|
if (signal2 == null ? void 0 : signal2.aborted)
|
|
917
1435
|
throw new index.AbortedError();
|
|
918
1436
|
index.store.setInput(input);
|
|
919
|
-
return
|
|
1437
|
+
return new Promise((resolve) => {
|
|
920
1438
|
const submitFunction = (submission) => {
|
|
921
1439
|
if (signal2 == null ? void 0 : signal2.aborted)
|
|
922
1440
|
throw new index.AbortedError();
|
|
@@ -928,8 +1446,36 @@ const useChatService = () => {
|
|
|
928
1446
|
};
|
|
929
1447
|
chatStore.onSubmitSuccessFn$.value = submitFunction;
|
|
930
1448
|
});
|
|
931
|
-
}
|
|
932
|
-
|
|
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
|
+
}, []);
|
|
933
1479
|
return {
|
|
934
1480
|
chatRef,
|
|
935
1481
|
chatService
|
|
@@ -1262,7 +1808,10 @@ const ChatInputAddressDetails = ({
|
|
|
1262
1808
|
onSubmit: (e) => {
|
|
1263
1809
|
const formData = new FormData(e.currentTarget);
|
|
1264
1810
|
const fields = Object.fromEntries(formData.entries());
|
|
1265
|
-
onSubmitSuccess(
|
|
1811
|
+
onSubmitSuccess({
|
|
1812
|
+
type: "address",
|
|
1813
|
+
value: fields
|
|
1814
|
+
});
|
|
1266
1815
|
},
|
|
1267
1816
|
children: [index.o("div", {
|
|
1268
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]",
|
|
@@ -1369,7 +1918,10 @@ const ChatInputBoolean = ({
|
|
|
1369
1918
|
throw new Error("invalid form");
|
|
1370
1919
|
});
|
|
1371
1920
|
const answer = index.parse(AnswerSchema, value);
|
|
1372
|
-
onSubmitSuccess(
|
|
1921
|
+
onSubmitSuccess({
|
|
1922
|
+
type: "boolean",
|
|
1923
|
+
value: answer === "true"
|
|
1924
|
+
});
|
|
1373
1925
|
},
|
|
1374
1926
|
children: [index.o("div", {
|
|
1375
1927
|
class: "flex items-center gap-2 p-2.5",
|
|
@@ -1504,7 +2056,7 @@ const ChatInputFile = ({
|
|
|
1504
2056
|
}) => {
|
|
1505
2057
|
var _a;
|
|
1506
2058
|
const submission = (_a = index.store.current$.value.flow) == null ? void 0 : _a.data.submissions[input.key];
|
|
1507
|
-
const [files, setFiles] = index.h(isFileSubmission(submission)
|
|
2059
|
+
const [files, setFiles] = index.h(isFileSubmission(submission) ? submission.value : []);
|
|
1508
2060
|
const [error, setError] = index.h();
|
|
1509
2061
|
const hiddenFileCount = files.length - FILENAMES_TO_SHOW_QTY;
|
|
1510
2062
|
const totalSize = addFileSizesKb(files);
|
|
@@ -1540,7 +2092,10 @@ const ChatInputFile = ({
|
|
|
1540
2092
|
type: "invalid",
|
|
1541
2093
|
message: "Only one file is allowed"
|
|
1542
2094
|
});
|
|
1543
|
-
return onSubmitSuccess(
|
|
2095
|
+
return onSubmitSuccess({
|
|
2096
|
+
type: "file",
|
|
2097
|
+
value: files
|
|
2098
|
+
});
|
|
1544
2099
|
},
|
|
1545
2100
|
children: [index.o("div", {
|
|
1546
2101
|
class: "flex items-center gap-2",
|
|
@@ -1665,14 +2220,14 @@ var isPlainObject = (tempObject) => {
|
|
|
1665
2220
|
var isWeb = typeof window !== "undefined" && typeof window.HTMLElement !== "undefined" && typeof document !== "undefined";
|
|
1666
2221
|
function cloneObject(data) {
|
|
1667
2222
|
let copy;
|
|
1668
|
-
const
|
|
2223
|
+
const isArray2 = Array.isArray(data);
|
|
1669
2224
|
if (data instanceof Date) {
|
|
1670
2225
|
copy = new Date(data);
|
|
1671
2226
|
} else if (data instanceof Set) {
|
|
1672
2227
|
copy = new Set(data);
|
|
1673
|
-
} else if (!(isWeb && (data instanceof Blob || data instanceof FileList)) && (
|
|
1674
|
-
copy =
|
|
1675
|
-
if (!
|
|
2228
|
+
} else if (!(isWeb && (data instanceof Blob || data instanceof FileList)) && (isArray2 || isObject(data))) {
|
|
2229
|
+
copy = isArray2 ? [] : {};
|
|
2230
|
+
if (!isArray2 && !isPlainObject(data)) {
|
|
1676
2231
|
copy = data;
|
|
1677
2232
|
} else {
|
|
1678
2233
|
for (const key in data) {
|
|
@@ -3123,7 +3678,7 @@ const submitIfSingleChecked = (form) => {
|
|
|
3123
3678
|
bubbles: true
|
|
3124
3679
|
}));
|
|
3125
3680
|
};
|
|
3126
|
-
const isMultipleChoiceSubmission = index.isSubmissionOfType("
|
|
3681
|
+
const isMultipleChoiceSubmission = index.isSubmissionOfType("enum");
|
|
3127
3682
|
const getResolver$1 = (config) => {
|
|
3128
3683
|
const length = {
|
|
3129
3684
|
min: config.minSelected ?? 0,
|
|
@@ -3163,7 +3718,10 @@ const ChatInputMultipleChoice = ({
|
|
|
3163
3718
|
},
|
|
3164
3719
|
onSubmit: handleSubmit((submission2) => {
|
|
3165
3720
|
const checked = submission2.checked;
|
|
3166
|
-
onSubmitSuccess(
|
|
3721
|
+
onSubmitSuccess({
|
|
3722
|
+
type: "enum",
|
|
3723
|
+
value: checked
|
|
3724
|
+
});
|
|
3167
3725
|
}),
|
|
3168
3726
|
children: [index.o("div", {
|
|
3169
3727
|
class: "flex items-center gap-1",
|
|
@@ -3205,7 +3763,10 @@ const ChatInputMultipleChoice = ({
|
|
|
3205
3763
|
class: "flex flex-col items-center gap-2",
|
|
3206
3764
|
children: [!isSingleChoice && index.o(SendButton, {}), input.config.minSelected === 0 && index.o(SkipButton, {
|
|
3207
3765
|
type: "button",
|
|
3208
|
-
onClick: () => onSubmitSuccess(
|
|
3766
|
+
onClick: () => onSubmitSuccess({
|
|
3767
|
+
type: "enum",
|
|
3768
|
+
value: []
|
|
3769
|
+
})
|
|
3209
3770
|
})]
|
|
3210
3771
|
})]
|
|
3211
3772
|
}), index.o("div", {
|
|
@@ -3278,7 +3839,7 @@ const inputFormatToProps = {
|
|
|
3278
3839
|
formNoValidate: true
|
|
3279
3840
|
}
|
|
3280
3841
|
};
|
|
3281
|
-
const isTextSubmission = index.isSubmissionOfType("
|
|
3842
|
+
const isTextSubmission = index.isSubmissionOfType("string");
|
|
3282
3843
|
const getResolver = (config) => {
|
|
3283
3844
|
const maxLengthError = `Please enter no more than ${config.maxChars} characters`;
|
|
3284
3845
|
return i(index.object({
|
|
@@ -3322,42 +3883,43 @@ const ChatInputText = ({
|
|
|
3322
3883
|
ref.current.select();
|
|
3323
3884
|
}
|
|
3324
3885
|
}, []);
|
|
3325
|
-
return index.o(
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
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",
|
|
3332
3897
|
children: [index.o("div", {
|
|
3333
|
-
class: "
|
|
3334
|
-
children: [index.o("
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
error: errors2.text
|
|
3359
|
-
})]
|
|
3360
|
-
})
|
|
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
|
+
})]
|
|
3361
3923
|
});
|
|
3362
3924
|
};
|
|
3363
3925
|
const ChatInput = () => {
|
|
@@ -3379,10 +3941,6 @@ const ChatInput = () => {
|
|
|
3379
3941
|
wrapper.removeEventListener("transitionend", chatStore.scrollToEnd.smooth);
|
|
3380
3942
|
};
|
|
3381
3943
|
}, []);
|
|
3382
|
-
const handleSubmitSuccess = (type) => (value) => chatStore.onSubmitSuccessFn$.value({
|
|
3383
|
-
type,
|
|
3384
|
-
value
|
|
3385
|
-
});
|
|
3386
3944
|
return index.o("div", {
|
|
3387
3945
|
ref: inputWrapperRef,
|
|
3388
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]",
|
|
@@ -3413,44 +3971,50 @@ const ChatInput = () => {
|
|
|
3413
3971
|
type: "text"
|
|
3414
3972
|
}
|
|
3415
3973
|
}, (props) => index.o(ChatInputText, {
|
|
3416
|
-
onSubmitSuccess:
|
|
3974
|
+
onSubmitSuccess: chatStore.onSubmitSuccessFn$.value,
|
|
3417
3975
|
...props
|
|
3418
3976
|
})).with({
|
|
3419
3977
|
input: {
|
|
3420
3978
|
type: "multiple-choice"
|
|
3421
3979
|
}
|
|
3422
3980
|
}, (props) => index.o(ChatInputMultipleChoice, {
|
|
3423
|
-
onSubmitSuccess:
|
|
3981
|
+
onSubmitSuccess: chatStore.onSubmitSuccessFn$.value,
|
|
3424
3982
|
...props
|
|
3425
3983
|
})).with({
|
|
3426
3984
|
input: {
|
|
3427
3985
|
type: "boolean"
|
|
3428
3986
|
}
|
|
3429
3987
|
}, (props) => index.o(ChatInputBoolean, {
|
|
3430
|
-
onSubmitSuccess:
|
|
3988
|
+
onSubmitSuccess: chatStore.onSubmitSuccessFn$.value,
|
|
3431
3989
|
...props
|
|
3432
3990
|
})).with({
|
|
3433
3991
|
input: {
|
|
3434
3992
|
type: "file"
|
|
3435
3993
|
}
|
|
3436
3994
|
}, (props) => index.o(ChatInputFile, {
|
|
3437
|
-
onSubmitSuccess:
|
|
3995
|
+
onSubmitSuccess: chatStore.onSubmitSuccessFn$.value,
|
|
3438
3996
|
...props
|
|
3439
3997
|
})).with({
|
|
3440
3998
|
input: {
|
|
3441
3999
|
type: "submit"
|
|
3442
4000
|
}
|
|
3443
4001
|
}, (props) => index.o(ChatInputSubmit, {
|
|
3444
|
-
onSubmitSuccess:
|
|
4002
|
+
onSubmitSuccess: chatStore.onSubmitSuccessFn$.value,
|
|
3445
4003
|
...props
|
|
3446
4004
|
})).with({
|
|
3447
4005
|
input: {
|
|
3448
4006
|
type: "address"
|
|
3449
4007
|
}
|
|
3450
4008
|
}, (props) => index.o(ChatInputAddress, {
|
|
3451
|
-
onSubmitSuccess:
|
|
4009
|
+
onSubmitSuccess: chatStore.onSubmitSuccessFn$.value,
|
|
3452
4010
|
...props
|
|
3453
|
-
})).
|
|
4011
|
+
})).with({
|
|
4012
|
+
input: {
|
|
4013
|
+
type: "number"
|
|
4014
|
+
}
|
|
4015
|
+
}, () => {
|
|
4016
|
+
throw new Error("Not implemented");
|
|
4017
|
+
}).exhaustive()
|
|
3454
4018
|
})
|
|
3455
4019
|
});
|
|
3456
4020
|
};
|