@inploi/plugin-chatbot 3.15.0 → 3.16.1
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-59fab6f6.js} +754 -174
- package/dist/{chatbot-body-daedf7bd.cjs → chatbot-body-9bce9c3f.cjs} +754 -174
- package/dist/chatbot.d.ts +1 -3
- package/dist/chatbot.state.d.ts +127 -0
- package/dist/chatbot.utils.d.ts +10 -7
- package/dist/conditions.d.ts +3 -0
- package/dist/conditions.test.d.ts +1 -0
- package/dist/{index-51b0335a.cjs → index-154bf9a3.cjs} +3 -1
- package/dist/{index-b1d81d1c.js → index-dfe3ef24.js} +26 -24
- package/dist/interpreter.d.ts +8 -7
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +2 -2
- package/package.json +7 -6
|
@@ -1,7 +1,604 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const index = require("./index-
|
|
3
|
+
const index = require("./index-154bf9a3.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 isIfBlockConditionMet = (ifBlock, submissions) => {
|
|
465
|
+
const [firstSegment, ...rest] = ifBlock.data.compareKey.split(".");
|
|
466
|
+
if (!firstSegment)
|
|
467
|
+
return false;
|
|
468
|
+
const answer = submissions == null ? void 0 : submissions[firstSegment];
|
|
469
|
+
if (!answer)
|
|
470
|
+
return false;
|
|
471
|
+
switch (answer.type) {
|
|
472
|
+
case "address": {
|
|
473
|
+
const value = get$2(answer.value, rest.join("."));
|
|
474
|
+
switch (ifBlock.data.compare) {
|
|
475
|
+
case "equals":
|
|
476
|
+
return value === ifBlock.data.compareValue;
|
|
477
|
+
case "contains":
|
|
478
|
+
if (!value)
|
|
479
|
+
return false;
|
|
480
|
+
return value.includes(ifBlock.data.compareValue);
|
|
481
|
+
case "notEquals":
|
|
482
|
+
return value !== ifBlock.data.compareValue;
|
|
483
|
+
case "notContains":
|
|
484
|
+
if (!value)
|
|
485
|
+
return true;
|
|
486
|
+
return !value.includes(ifBlock.data.compareValue);
|
|
487
|
+
}
|
|
488
|
+
break;
|
|
489
|
+
}
|
|
490
|
+
case "integration": {
|
|
491
|
+
if (typeof answer.value !== "object")
|
|
492
|
+
return false;
|
|
493
|
+
if (Array.isArray(answer.value))
|
|
494
|
+
return false;
|
|
495
|
+
const value = get$2(answer.value, rest.join("."));
|
|
496
|
+
const newIfBlock = {
|
|
497
|
+
...ifBlock,
|
|
498
|
+
data: {
|
|
499
|
+
...ifBlock.data,
|
|
500
|
+
compareKey: "_temp"
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
switch (typeof value) {
|
|
504
|
+
case "boolean":
|
|
505
|
+
return isIfBlockConditionMet(newIfBlock, {
|
|
506
|
+
["_temp"]: {
|
|
507
|
+
value,
|
|
508
|
+
type: "boolean"
|
|
509
|
+
}
|
|
510
|
+
});
|
|
511
|
+
case "string":
|
|
512
|
+
return isIfBlockConditionMet(newIfBlock, {
|
|
513
|
+
["_temp"]: {
|
|
514
|
+
value,
|
|
515
|
+
type: "string"
|
|
516
|
+
}
|
|
517
|
+
});
|
|
518
|
+
case "number":
|
|
519
|
+
return isIfBlockConditionMet(newIfBlock, {
|
|
520
|
+
["_temp"]: {
|
|
521
|
+
value,
|
|
522
|
+
type: "number"
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
case "object":
|
|
526
|
+
if (Array.isArray(value) && value.every(index.isString)) {
|
|
527
|
+
return isIfBlockConditionMet(newIfBlock, {
|
|
528
|
+
["_temp"]: {
|
|
529
|
+
value,
|
|
530
|
+
type: "enum"
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
return false;
|
|
535
|
+
}
|
|
536
|
+
break;
|
|
537
|
+
}
|
|
538
|
+
case "boolean": {
|
|
539
|
+
const compareBoolean = ifBlock.data.compareValue === "true";
|
|
540
|
+
switch (ifBlock.data.compare) {
|
|
541
|
+
case "equals":
|
|
542
|
+
return answer.value === compareBoolean;
|
|
543
|
+
case "notEquals":
|
|
544
|
+
return answer.value !== compareBoolean;
|
|
545
|
+
}
|
|
546
|
+
break;
|
|
547
|
+
}
|
|
548
|
+
case "string":
|
|
549
|
+
switch (ifBlock.data.compare) {
|
|
550
|
+
case "equals":
|
|
551
|
+
return answer.value === ifBlock.data.compareValue;
|
|
552
|
+
case "contains":
|
|
553
|
+
if (!answer.value)
|
|
554
|
+
return false;
|
|
555
|
+
return answer.value.includes(ifBlock.data.compareValue);
|
|
556
|
+
case "notEquals":
|
|
557
|
+
return answer.value !== ifBlock.data.compareValue;
|
|
558
|
+
case "notContains":
|
|
559
|
+
if (!answer.value)
|
|
560
|
+
return true;
|
|
561
|
+
return !answer.value.includes(ifBlock.data.compareValue);
|
|
562
|
+
}
|
|
563
|
+
break;
|
|
564
|
+
case "number": {
|
|
565
|
+
try {
|
|
566
|
+
const compareNumber = Number(ifBlock.data.compareValue);
|
|
567
|
+
switch (ifBlock.data.compare) {
|
|
568
|
+
case "equals":
|
|
569
|
+
return answer.value === compareNumber;
|
|
570
|
+
case "notEquals":
|
|
571
|
+
return answer.value !== compareNumber;
|
|
572
|
+
case "greaterThan":
|
|
573
|
+
return answer.value > compareNumber;
|
|
574
|
+
case "greaterThanOrEqualTo":
|
|
575
|
+
return answer.value >= compareNumber;
|
|
576
|
+
case "lessThan":
|
|
577
|
+
return answer.value < compareNumber;
|
|
578
|
+
case "lessThanOrEqualTo":
|
|
579
|
+
return answer.value <= compareNumber;
|
|
580
|
+
}
|
|
581
|
+
} catch {
|
|
582
|
+
console.error(`Failed to parse number in if-block ${ifBlock.id}`, answer.value);
|
|
583
|
+
return false;
|
|
584
|
+
}
|
|
585
|
+
break;
|
|
586
|
+
}
|
|
587
|
+
case "enum":
|
|
588
|
+
switch (ifBlock.data.compare) {
|
|
589
|
+
case "equals":
|
|
590
|
+
return answer.value.length === 1 && answer.value[0] === ifBlock.data.compareValue;
|
|
591
|
+
case "notEquals":
|
|
592
|
+
return answer.value.length === 1 && answer.value[0] !== ifBlock.data.compareValue;
|
|
593
|
+
case "contains":
|
|
594
|
+
return answer.value.includes(ifBlock.data.compareValue);
|
|
595
|
+
case "notContains":
|
|
596
|
+
return !answer.value.includes(ifBlock.data.compareValue);
|
|
597
|
+
}
|
|
598
|
+
break;
|
|
599
|
+
}
|
|
600
|
+
return false;
|
|
601
|
+
};
|
|
5
602
|
const followNodes = ({
|
|
6
603
|
node,
|
|
7
604
|
nodes,
|
|
@@ -74,7 +671,8 @@ const createFlowInterpreter = ({
|
|
|
74
671
|
userInput: async (input) => chatService.input({
|
|
75
672
|
input,
|
|
76
673
|
signal: controller.signal
|
|
77
|
-
})
|
|
674
|
+
}),
|
|
675
|
+
addToSubmissions: chatService.addToSubmissions
|
|
78
676
|
},
|
|
79
677
|
next: (nodeId) => {
|
|
80
678
|
const nextNode = nodeId ? flow.find((node2) => node2.id === nodeId) : fallthroughBranch({
|
|
@@ -224,6 +822,11 @@ async function interpretSubmitNode({
|
|
|
224
822
|
submissions: index.getFlowSubmissionsPayload(submissions || {})
|
|
225
823
|
})
|
|
226
824
|
}).catch((e) => e);
|
|
825
|
+
if (node.data.key)
|
|
826
|
+
chat.addToSubmissions(node.data.key, {
|
|
827
|
+
type: "integration",
|
|
828
|
+
value: response
|
|
829
|
+
});
|
|
227
830
|
await index.N(response).with({
|
|
228
831
|
ats_data: {
|
|
229
832
|
redirect_url: index._.string
|
|
@@ -281,8 +884,7 @@ async function interpretIfBlockNode({
|
|
|
281
884
|
next,
|
|
282
885
|
node
|
|
283
886
|
}) {
|
|
284
|
-
|
|
285
|
-
next(nextId);
|
|
887
|
+
next(isIfBlockConditionMet(node, submissions) ? node.branchId : node.nextId);
|
|
286
888
|
}
|
|
287
889
|
async function interpretTextNode({
|
|
288
890
|
chat,
|
|
@@ -332,7 +934,7 @@ async function interpretQuestionTextNode({
|
|
|
332
934
|
maxChars: node.data.maxChars
|
|
333
935
|
}
|
|
334
936
|
});
|
|
335
|
-
if (reply
|
|
937
|
+
if (reply === null) {
|
|
336
938
|
await chat.sendMessage({
|
|
337
939
|
type: "system",
|
|
338
940
|
variant: "info",
|
|
@@ -367,7 +969,7 @@ async function interpretQuestionNumberNode({
|
|
|
367
969
|
format: "text"
|
|
368
970
|
}
|
|
369
971
|
});
|
|
370
|
-
if (reply
|
|
972
|
+
if (reply === null) {
|
|
371
973
|
await chat.sendMessage({
|
|
372
974
|
type: "system",
|
|
373
975
|
variant: "info",
|
|
@@ -424,7 +1026,7 @@ async function interpretQuestionBooleanNode({
|
|
|
424
1026
|
type: "text",
|
|
425
1027
|
text: interpolateString(node.data.question, submissions)
|
|
426
1028
|
});
|
|
427
|
-
const
|
|
1029
|
+
const reply = await chat.userInput({
|
|
428
1030
|
key: node.data.key,
|
|
429
1031
|
type: "boolean",
|
|
430
1032
|
config: {
|
|
@@ -435,7 +1037,6 @@ async function interpretQuestionBooleanNode({
|
|
|
435
1037
|
}
|
|
436
1038
|
}
|
|
437
1039
|
});
|
|
438
|
-
const reply = input.value;
|
|
439
1040
|
if (reply === null) {
|
|
440
1041
|
await chat.sendMessage({
|
|
441
1042
|
type: "system",
|
|
@@ -446,10 +1047,7 @@ async function interpretQuestionBooleanNode({
|
|
|
446
1047
|
await chat.sendMessage({
|
|
447
1048
|
author: "user",
|
|
448
1049
|
type: "text",
|
|
449
|
-
text:
|
|
450
|
-
true: node.data.trueLabel,
|
|
451
|
-
false: node.data.falseLabel
|
|
452
|
-
}[reply]
|
|
1050
|
+
text: reply.value === true ? node.data.trueLabel : node.data.falseLabel
|
|
453
1051
|
});
|
|
454
1052
|
}
|
|
455
1053
|
next(node.nextId);
|
|
@@ -473,7 +1071,7 @@ async function interpretQuestionAddressNode({
|
|
|
473
1071
|
placeholder: node.data.placeholder
|
|
474
1072
|
}
|
|
475
1073
|
});
|
|
476
|
-
if (response
|
|
1074
|
+
if (response === null) {
|
|
477
1075
|
await chat.sendMessage({
|
|
478
1076
|
type: "system",
|
|
479
1077
|
variant: "info",
|
|
@@ -511,7 +1109,7 @@ async function interpretQuestionFileNode({
|
|
|
511
1109
|
allowMultiple: node.data.multiple === true
|
|
512
1110
|
}
|
|
513
1111
|
});
|
|
514
|
-
if (files
|
|
1112
|
+
if (files === null) {
|
|
515
1113
|
await chat.sendMessage({
|
|
516
1114
|
type: "system",
|
|
517
1115
|
variant: "info",
|
|
@@ -541,91 +1139,51 @@ async function interpretEndFlowNode({
|
|
|
541
1139
|
});
|
|
542
1140
|
end();
|
|
543
1141
|
}
|
|
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
1142
|
const interpolateString = (str, context) => {
|
|
606
1143
|
const regex = /{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g;
|
|
607
|
-
return str.replace(regex, (
|
|
608
|
-
|
|
609
|
-
const submission = context == null ? void 0 : context[
|
|
1144
|
+
return str.replace(regex, (_, key, defaultValue = "") => {
|
|
1145
|
+
const [firstSegment, ...rest] = key.trim().split(".");
|
|
1146
|
+
const submission = context == null ? void 0 : context[firstSegment];
|
|
610
1147
|
if (!submission)
|
|
611
1148
|
return defaultValue;
|
|
612
1149
|
switch (submission.type) {
|
|
613
1150
|
case "boolean":
|
|
614
|
-
return submission.value ===
|
|
1151
|
+
return submission.value === true ? "true" : "false";
|
|
615
1152
|
case "file":
|
|
616
|
-
if (!submission.value)
|
|
617
|
-
return "no files";
|
|
618
1153
|
return submission.value.map((file) => `${file.name} (${index.kbToReadableSize(file.sizeKb)})`).join(", ");
|
|
619
|
-
case "
|
|
1154
|
+
case "enum":
|
|
620
1155
|
return submission.value.join(", ");
|
|
621
|
-
|
|
622
|
-
return submission.value
|
|
1156
|
+
case "address":
|
|
1157
|
+
return Object.values(submission.value).filter((line) => line && line.trim().length > 0).join(", ");
|
|
1158
|
+
case "number":
|
|
1159
|
+
case "string":
|
|
1160
|
+
if (!submission.value)
|
|
1161
|
+
return defaultValue;
|
|
1162
|
+
return submission.value.toString();
|
|
1163
|
+
case "integration": {
|
|
1164
|
+
if (typeof submission.value !== "object")
|
|
1165
|
+
break;
|
|
1166
|
+
if (Array.isArray(submission.value))
|
|
1167
|
+
break;
|
|
1168
|
+
const value = get$2(submission.value, rest.join("."));
|
|
1169
|
+
switch (typeof value) {
|
|
1170
|
+
case "boolean":
|
|
1171
|
+
return value === true ? "true" : "false";
|
|
1172
|
+
case "string":
|
|
1173
|
+
return value;
|
|
1174
|
+
case "number":
|
|
1175
|
+
return value.toString();
|
|
1176
|
+
case "object":
|
|
1177
|
+
if (Array.isArray(value) && value.every(index.isString)) {
|
|
1178
|
+
return value.join(", ");
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
break;
|
|
1182
|
+
}
|
|
623
1183
|
}
|
|
1184
|
+
return defaultValue;
|
|
624
1185
|
});
|
|
625
1186
|
};
|
|
626
|
-
function getDefaultExportFromCjs(x) {
|
|
627
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
628
|
-
}
|
|
629
1187
|
function debounce(func, wait, immediate) {
|
|
630
1188
|
var timeout, args, context, timestamp, result;
|
|
631
1189
|
if (null == wait)
|
|
@@ -884,39 +1442,15 @@ const useChatService = () => {
|
|
|
884
1442
|
}
|
|
885
1443
|
};
|
|
886
1444
|
}, [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 ({
|
|
1445
|
+
const chatService = index.F(() => {
|
|
1446
|
+
const inputFn = ({
|
|
913
1447
|
input,
|
|
914
1448
|
signal: signal2
|
|
915
1449
|
}) => {
|
|
916
1450
|
if (signal2 == null ? void 0 : signal2.aborted)
|
|
917
1451
|
throw new index.AbortedError();
|
|
918
1452
|
index.store.setInput(input);
|
|
919
|
-
return
|
|
1453
|
+
return new Promise((resolve) => {
|
|
920
1454
|
const submitFunction = (submission) => {
|
|
921
1455
|
if (signal2 == null ? void 0 : signal2.aborted)
|
|
922
1456
|
throw new index.AbortedError();
|
|
@@ -928,8 +1462,36 @@ const useChatService = () => {
|
|
|
928
1462
|
};
|
|
929
1463
|
chatStore.onSubmitSuccessFn$.value = submitFunction;
|
|
930
1464
|
});
|
|
931
|
-
}
|
|
932
|
-
|
|
1465
|
+
};
|
|
1466
|
+
return {
|
|
1467
|
+
addToSubmissions: (key, value) => index.store.setSubmission(key, value),
|
|
1468
|
+
send: async ({
|
|
1469
|
+
message,
|
|
1470
|
+
signal: signal2,
|
|
1471
|
+
groupId
|
|
1472
|
+
}) => {
|
|
1473
|
+
await index.N(message).with({
|
|
1474
|
+
author: "bot",
|
|
1475
|
+
type: "text"
|
|
1476
|
+
}, async (message2) => {
|
|
1477
|
+
if (signal2 == null ? void 0 : signal2.aborted)
|
|
1478
|
+
throw new index.AbortedError();
|
|
1479
|
+
chatStore.isBotTyping$.value = true;
|
|
1480
|
+
const typingTime = Math.min(Math.max(20, message2.text.length), 100) * TYPING_SPEED_MS_PER_CHARACTER;
|
|
1481
|
+
await new Promise((resolve) => {
|
|
1482
|
+
return setTimeout(resolve, typingTime, {
|
|
1483
|
+
signal: signal2
|
|
1484
|
+
});
|
|
1485
|
+
});
|
|
1486
|
+
chatStore.isBotTyping$.value = false;
|
|
1487
|
+
}).otherwise(async () => void 0);
|
|
1488
|
+
if (signal2 == null ? void 0 : signal2.aborted)
|
|
1489
|
+
throw new index.AbortedError();
|
|
1490
|
+
index.store.addMessage(message, groupId);
|
|
1491
|
+
},
|
|
1492
|
+
input: inputFn
|
|
1493
|
+
};
|
|
1494
|
+
}, []);
|
|
933
1495
|
return {
|
|
934
1496
|
chatRef,
|
|
935
1497
|
chatService
|
|
@@ -1262,7 +1824,10 @@ const ChatInputAddressDetails = ({
|
|
|
1262
1824
|
onSubmit: (e) => {
|
|
1263
1825
|
const formData = new FormData(e.currentTarget);
|
|
1264
1826
|
const fields = Object.fromEntries(formData.entries());
|
|
1265
|
-
onSubmitSuccess(
|
|
1827
|
+
onSubmitSuccess({
|
|
1828
|
+
type: "address",
|
|
1829
|
+
value: fields
|
|
1830
|
+
});
|
|
1266
1831
|
},
|
|
1267
1832
|
children: [index.o("div", {
|
|
1268
1833
|
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 +1934,10 @@ const ChatInputBoolean = ({
|
|
|
1369
1934
|
throw new Error("invalid form");
|
|
1370
1935
|
});
|
|
1371
1936
|
const answer = index.parse(AnswerSchema, value);
|
|
1372
|
-
onSubmitSuccess(
|
|
1937
|
+
onSubmitSuccess({
|
|
1938
|
+
type: "boolean",
|
|
1939
|
+
value: answer === "true"
|
|
1940
|
+
});
|
|
1373
1941
|
},
|
|
1374
1942
|
children: [index.o("div", {
|
|
1375
1943
|
class: "flex items-center gap-2 p-2.5",
|
|
@@ -1504,7 +2072,7 @@ const ChatInputFile = ({
|
|
|
1504
2072
|
}) => {
|
|
1505
2073
|
var _a;
|
|
1506
2074
|
const submission = (_a = index.store.current$.value.flow) == null ? void 0 : _a.data.submissions[input.key];
|
|
1507
|
-
const [files, setFiles] = index.h(isFileSubmission(submission)
|
|
2075
|
+
const [files, setFiles] = index.h(isFileSubmission(submission) ? submission.value : []);
|
|
1508
2076
|
const [error, setError] = index.h();
|
|
1509
2077
|
const hiddenFileCount = files.length - FILENAMES_TO_SHOW_QTY;
|
|
1510
2078
|
const totalSize = addFileSizesKb(files);
|
|
@@ -1540,7 +2108,10 @@ const ChatInputFile = ({
|
|
|
1540
2108
|
type: "invalid",
|
|
1541
2109
|
message: "Only one file is allowed"
|
|
1542
2110
|
});
|
|
1543
|
-
return onSubmitSuccess(
|
|
2111
|
+
return onSubmitSuccess({
|
|
2112
|
+
type: "file",
|
|
2113
|
+
value: files
|
|
2114
|
+
});
|
|
1544
2115
|
},
|
|
1545
2116
|
children: [index.o("div", {
|
|
1546
2117
|
class: "flex items-center gap-2",
|
|
@@ -1665,14 +2236,14 @@ var isPlainObject = (tempObject) => {
|
|
|
1665
2236
|
var isWeb = typeof window !== "undefined" && typeof window.HTMLElement !== "undefined" && typeof document !== "undefined";
|
|
1666
2237
|
function cloneObject(data) {
|
|
1667
2238
|
let copy;
|
|
1668
|
-
const
|
|
2239
|
+
const isArray2 = Array.isArray(data);
|
|
1669
2240
|
if (data instanceof Date) {
|
|
1670
2241
|
copy = new Date(data);
|
|
1671
2242
|
} else if (data instanceof Set) {
|
|
1672
2243
|
copy = new Set(data);
|
|
1673
|
-
} else if (!(isWeb && (data instanceof Blob || data instanceof FileList)) && (
|
|
1674
|
-
copy =
|
|
1675
|
-
if (!
|
|
2244
|
+
} else if (!(isWeb && (data instanceof Blob || data instanceof FileList)) && (isArray2 || isObject(data))) {
|
|
2245
|
+
copy = isArray2 ? [] : {};
|
|
2246
|
+
if (!isArray2 && !isPlainObject(data)) {
|
|
1676
2247
|
copy = data;
|
|
1677
2248
|
} else {
|
|
1678
2249
|
for (const key in data) {
|
|
@@ -3123,7 +3694,7 @@ const submitIfSingleChecked = (form) => {
|
|
|
3123
3694
|
bubbles: true
|
|
3124
3695
|
}));
|
|
3125
3696
|
};
|
|
3126
|
-
const isMultipleChoiceSubmission = index.isSubmissionOfType("
|
|
3697
|
+
const isMultipleChoiceSubmission = index.isSubmissionOfType("enum");
|
|
3127
3698
|
const getResolver$1 = (config) => {
|
|
3128
3699
|
const length = {
|
|
3129
3700
|
min: config.minSelected ?? 0,
|
|
@@ -3163,7 +3734,10 @@ const ChatInputMultipleChoice = ({
|
|
|
3163
3734
|
},
|
|
3164
3735
|
onSubmit: handleSubmit((submission2) => {
|
|
3165
3736
|
const checked = submission2.checked;
|
|
3166
|
-
onSubmitSuccess(
|
|
3737
|
+
onSubmitSuccess({
|
|
3738
|
+
type: "enum",
|
|
3739
|
+
value: checked
|
|
3740
|
+
});
|
|
3167
3741
|
}),
|
|
3168
3742
|
children: [index.o("div", {
|
|
3169
3743
|
class: "flex items-center gap-1",
|
|
@@ -3205,7 +3779,10 @@ const ChatInputMultipleChoice = ({
|
|
|
3205
3779
|
class: "flex flex-col items-center gap-2",
|
|
3206
3780
|
children: [!isSingleChoice && index.o(SendButton, {}), input.config.minSelected === 0 && index.o(SkipButton, {
|
|
3207
3781
|
type: "button",
|
|
3208
|
-
onClick: () => onSubmitSuccess(
|
|
3782
|
+
onClick: () => onSubmitSuccess({
|
|
3783
|
+
type: "enum",
|
|
3784
|
+
value: []
|
|
3785
|
+
})
|
|
3209
3786
|
})]
|
|
3210
3787
|
})]
|
|
3211
3788
|
}), index.o("div", {
|
|
@@ -3278,7 +3855,7 @@ const inputFormatToProps = {
|
|
|
3278
3855
|
formNoValidate: true
|
|
3279
3856
|
}
|
|
3280
3857
|
};
|
|
3281
|
-
const isTextSubmission = index.isSubmissionOfType("
|
|
3858
|
+
const isTextSubmission = index.isSubmissionOfType("string");
|
|
3282
3859
|
const getResolver = (config) => {
|
|
3283
3860
|
const maxLengthError = `Please enter no more than ${config.maxChars} characters`;
|
|
3284
3861
|
return i(index.object({
|
|
@@ -3322,42 +3899,43 @@ const ChatInputText = ({
|
|
|
3322
3899
|
ref.current.select();
|
|
3323
3900
|
}
|
|
3324
3901
|
}, []);
|
|
3325
|
-
return index.o(
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3902
|
+
return index.o("form", {
|
|
3903
|
+
noValidate: true,
|
|
3904
|
+
class: "flex flex-col gap-1 p-2.5",
|
|
3905
|
+
onSubmit: handleSubmit((submission2) => {
|
|
3906
|
+
onSubmitSuccess({
|
|
3907
|
+
type: "string",
|
|
3908
|
+
value: submission2.text
|
|
3909
|
+
});
|
|
3910
|
+
}),
|
|
3911
|
+
children: [index.o("div", {
|
|
3912
|
+
class: "flex items-center gap-2",
|
|
3332
3913
|
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
|
-
})
|
|
3914
|
+
class: "relative min-w-0 flex-grow",
|
|
3915
|
+
children: [index.o("input", {
|
|
3916
|
+
id: "chat-input",
|
|
3917
|
+
...props,
|
|
3918
|
+
...inputFormatToProps[input.config.format],
|
|
3919
|
+
autocomplete: "off",
|
|
3920
|
+
autoCapitalize: "off",
|
|
3921
|
+
autoCorrect: "off",
|
|
3922
|
+
autoFocus: true,
|
|
3923
|
+
ref: (element) => {
|
|
3924
|
+
if (element) {
|
|
3925
|
+
ref.current = element;
|
|
3926
|
+
}
|
|
3927
|
+
setRef(element);
|
|
3928
|
+
},
|
|
3929
|
+
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",
|
|
3930
|
+
placeholder: input.config.placeholder
|
|
3931
|
+
}), input.config.optional && index.o(SkipButton, {
|
|
3932
|
+
class: "absolute right-0 top-0",
|
|
3933
|
+
onClick: () => onSubmitSuccess(null)
|
|
3934
|
+
})]
|
|
3935
|
+
}), index.o(SendButton, {})]
|
|
3936
|
+
}), index.o(InputError, {
|
|
3937
|
+
error: errors2.text
|
|
3938
|
+
})]
|
|
3361
3939
|
});
|
|
3362
3940
|
};
|
|
3363
3941
|
const ChatInput = () => {
|
|
@@ -3379,10 +3957,6 @@ const ChatInput = () => {
|
|
|
3379
3957
|
wrapper.removeEventListener("transitionend", chatStore.scrollToEnd.smooth);
|
|
3380
3958
|
};
|
|
3381
3959
|
}, []);
|
|
3382
|
-
const handleSubmitSuccess = (type) => (value) => chatStore.onSubmitSuccessFn$.value({
|
|
3383
|
-
type,
|
|
3384
|
-
value
|
|
3385
|
-
});
|
|
3386
3960
|
return index.o("div", {
|
|
3387
3961
|
ref: inputWrapperRef,
|
|
3388
3962
|
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 +3987,50 @@ const ChatInput = () => {
|
|
|
3413
3987
|
type: "text"
|
|
3414
3988
|
}
|
|
3415
3989
|
}, (props) => index.o(ChatInputText, {
|
|
3416
|
-
onSubmitSuccess:
|
|
3990
|
+
onSubmitSuccess: chatStore.onSubmitSuccessFn$.value,
|
|
3417
3991
|
...props
|
|
3418
3992
|
})).with({
|
|
3419
3993
|
input: {
|
|
3420
3994
|
type: "multiple-choice"
|
|
3421
3995
|
}
|
|
3422
3996
|
}, (props) => index.o(ChatInputMultipleChoice, {
|
|
3423
|
-
onSubmitSuccess:
|
|
3997
|
+
onSubmitSuccess: chatStore.onSubmitSuccessFn$.value,
|
|
3424
3998
|
...props
|
|
3425
3999
|
})).with({
|
|
3426
4000
|
input: {
|
|
3427
4001
|
type: "boolean"
|
|
3428
4002
|
}
|
|
3429
4003
|
}, (props) => index.o(ChatInputBoolean, {
|
|
3430
|
-
onSubmitSuccess:
|
|
4004
|
+
onSubmitSuccess: chatStore.onSubmitSuccessFn$.value,
|
|
3431
4005
|
...props
|
|
3432
4006
|
})).with({
|
|
3433
4007
|
input: {
|
|
3434
4008
|
type: "file"
|
|
3435
4009
|
}
|
|
3436
4010
|
}, (props) => index.o(ChatInputFile, {
|
|
3437
|
-
onSubmitSuccess:
|
|
4011
|
+
onSubmitSuccess: chatStore.onSubmitSuccessFn$.value,
|
|
3438
4012
|
...props
|
|
3439
4013
|
})).with({
|
|
3440
4014
|
input: {
|
|
3441
4015
|
type: "submit"
|
|
3442
4016
|
}
|
|
3443
4017
|
}, (props) => index.o(ChatInputSubmit, {
|
|
3444
|
-
onSubmitSuccess:
|
|
4018
|
+
onSubmitSuccess: chatStore.onSubmitSuccessFn$.value,
|
|
3445
4019
|
...props
|
|
3446
4020
|
})).with({
|
|
3447
4021
|
input: {
|
|
3448
4022
|
type: "address"
|
|
3449
4023
|
}
|
|
3450
4024
|
}, (props) => index.o(ChatInputAddress, {
|
|
3451
|
-
onSubmitSuccess:
|
|
4025
|
+
onSubmitSuccess: chatStore.onSubmitSuccessFn$.value,
|
|
3452
4026
|
...props
|
|
3453
|
-
})).
|
|
4027
|
+
})).with({
|
|
4028
|
+
input: {
|
|
4029
|
+
type: "number"
|
|
4030
|
+
}
|
|
4031
|
+
}, () => {
|
|
4032
|
+
throw new Error("Not implemented");
|
|
4033
|
+
}).exhaustive()
|
|
3454
4034
|
})
|
|
3455
4035
|
});
|
|
3456
4036
|
};
|