@cleartrip/talos-use-chat-controller 1.18.0-beta-261029-3.0 → 1.18.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/dist/services/index.d.ts +2 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/talos-use-chat-controller.browser.cjs.js +1 -1
- package/dist/talos-use-chat-controller.browser.cjs.js.map +1 -1
- package/dist/talos-use-chat-controller.browser.esm.js +1 -1
- package/dist/talos-use-chat-controller.browser.esm.js.map +1 -1
- package/dist/talos-use-chat-controller.cjs.js +147 -90
- package/dist/talos-use-chat-controller.cjs.js.map +1 -1
- package/dist/talos-use-chat-controller.esm.js +147 -90
- package/dist/talos-use-chat-controller.esm.js.map +1 -1
- package/dist/talos-use-chat-controller.umd.js +156 -518
- package/dist/talos-use-chat-controller.umd.js.map +1 -1
- package/package.json +7 -7
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@cleartrip/talos-general-utils'), require('@cleartrip/talos-rum-logger'), require('@cleartrip/talos-widget-types'), require('@cleartrip/talos-network'), require('@cleartrip/talos-use-chat')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'react', '@cleartrip/talos-general-utils', '@cleartrip/talos-rum-logger', '@cleartrip/talos-widget-types', '@cleartrip/talos-network', '@cleartrip/talos-use-chat'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TalosUseChatController = {}, global.React, global.talosGeneralUtils, global.talosRumLogger, global.talosWidgetTypes, global.talosNetwork, global.talosUseChat));
|
|
5
|
-
})(this, (function (exports, require$$0, talosGeneralUtils, talosRumLogger, talosWidgetTypes, talosNetwork, talosUseChat) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('uuid'), require('@cleartrip/talos-general-utils'), require('@cleartrip/talos-rum-logger'), require('@cleartrip/talos-widget-types'), require('@cleartrip/talos-network'), require('@cleartrip/talos-use-chat')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react', 'uuid', '@cleartrip/talos-general-utils', '@cleartrip/talos-rum-logger', '@cleartrip/talos-widget-types', '@cleartrip/talos-network', '@cleartrip/talos-use-chat'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TalosUseChatController = {}, global.React, global.uuid, global.talosGeneralUtils, global.talosRumLogger, global.talosWidgetTypes, global.talosNetwork, global.talosUseChat));
|
|
5
|
+
})(this, (function (exports, require$$0, uuid, talosGeneralUtils, talosRumLogger, talosWidgetTypes, talosNetwork, talosUseChat) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
8
|
|
|
@@ -167,425 +167,6 @@
|
|
|
167
167
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
168
168
|
};
|
|
169
169
|
|
|
170
|
-
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
171
|
-
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
172
|
-
// generators (like Math.random()).
|
|
173
|
-
let getRandomValues;
|
|
174
|
-
const rnds8 = new Uint8Array(16);
|
|
175
|
-
function rng() {
|
|
176
|
-
// lazy load so that environments that need to polyfill have a chance to do so
|
|
177
|
-
if (!getRandomValues) {
|
|
178
|
-
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
|
|
179
|
-
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
180
|
-
if (!getRandomValues) {
|
|
181
|
-
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
return getRandomValues(rnds8);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
188
|
-
|
|
189
|
-
function validate(uuid) {
|
|
190
|
-
return typeof uuid === 'string' && REGEX.test(uuid);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Convert array of 16 byte values to UUID string format of the form:
|
|
195
|
-
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
196
|
-
*/
|
|
197
|
-
|
|
198
|
-
const byteToHex = [];
|
|
199
|
-
for (let i = 0; i < 256; ++i) {
|
|
200
|
-
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
201
|
-
}
|
|
202
|
-
function unsafeStringify(arr, offset = 0) {
|
|
203
|
-
// Note: Be careful editing this code! It's been tuned for performance
|
|
204
|
-
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
205
|
-
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
function parse(uuid) {
|
|
209
|
-
if (!validate(uuid)) {
|
|
210
|
-
throw TypeError('Invalid UUID');
|
|
211
|
-
}
|
|
212
|
-
let v;
|
|
213
|
-
const arr = new Uint8Array(16); // Parse ########-....-....-....-............
|
|
214
|
-
|
|
215
|
-
arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
|
|
216
|
-
arr[1] = v >>> 16 & 0xff;
|
|
217
|
-
arr[2] = v >>> 8 & 0xff;
|
|
218
|
-
arr[3] = v & 0xff; // Parse ........-####-....-....-............
|
|
219
|
-
|
|
220
|
-
arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
|
|
221
|
-
arr[5] = v & 0xff; // Parse ........-....-####-....-............
|
|
222
|
-
|
|
223
|
-
arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
|
|
224
|
-
arr[7] = v & 0xff; // Parse ........-....-....-####-............
|
|
225
|
-
|
|
226
|
-
arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
|
|
227
|
-
arr[9] = v & 0xff; // Parse ........-....-....-....-############
|
|
228
|
-
// (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes)
|
|
229
|
-
|
|
230
|
-
arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;
|
|
231
|
-
arr[11] = v / 0x100000000 & 0xff;
|
|
232
|
-
arr[12] = v >>> 24 & 0xff;
|
|
233
|
-
arr[13] = v >>> 16 & 0xff;
|
|
234
|
-
arr[14] = v >>> 8 & 0xff;
|
|
235
|
-
arr[15] = v & 0xff;
|
|
236
|
-
return arr;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
function stringToBytes(str) {
|
|
240
|
-
str = unescape(encodeURIComponent(str)); // UTF8 escape
|
|
241
|
-
|
|
242
|
-
const bytes = [];
|
|
243
|
-
for (let i = 0; i < str.length; ++i) {
|
|
244
|
-
bytes.push(str.charCodeAt(i));
|
|
245
|
-
}
|
|
246
|
-
return bytes;
|
|
247
|
-
}
|
|
248
|
-
const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
|
|
249
|
-
const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
|
|
250
|
-
function v35(name, version, hashfunc) {
|
|
251
|
-
function generateUUID(value, namespace, buf, offset) {
|
|
252
|
-
var _namespace;
|
|
253
|
-
if (typeof value === 'string') {
|
|
254
|
-
value = stringToBytes(value);
|
|
255
|
-
}
|
|
256
|
-
if (typeof namespace === 'string') {
|
|
257
|
-
namespace = parse(namespace);
|
|
258
|
-
}
|
|
259
|
-
if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) {
|
|
260
|
-
throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');
|
|
261
|
-
} // Compute hash of namespace and value, Per 4.3
|
|
262
|
-
// Future: Use spread syntax when supported on all platforms, e.g. `bytes =
|
|
263
|
-
// hashfunc([...namespace, ... value])`
|
|
264
|
-
|
|
265
|
-
let bytes = new Uint8Array(16 + value.length);
|
|
266
|
-
bytes.set(namespace);
|
|
267
|
-
bytes.set(value, namespace.length);
|
|
268
|
-
bytes = hashfunc(bytes);
|
|
269
|
-
bytes[6] = bytes[6] & 0x0f | version;
|
|
270
|
-
bytes[8] = bytes[8] & 0x3f | 0x80;
|
|
271
|
-
if (buf) {
|
|
272
|
-
offset = offset || 0;
|
|
273
|
-
for (let i = 0; i < 16; ++i) {
|
|
274
|
-
buf[offset + i] = bytes[i];
|
|
275
|
-
}
|
|
276
|
-
return buf;
|
|
277
|
-
}
|
|
278
|
-
return unsafeStringify(bytes);
|
|
279
|
-
} // Function#name is not settable on some platforms (#270)
|
|
280
|
-
|
|
281
|
-
try {
|
|
282
|
-
generateUUID.name = name; // eslint-disable-next-line no-empty
|
|
283
|
-
} catch (err) {} // For CommonJS default export support
|
|
284
|
-
|
|
285
|
-
generateUUID.DNS = DNS;
|
|
286
|
-
generateUUID.URL = URL;
|
|
287
|
-
return generateUUID;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
/*
|
|
291
|
-
* Browser-compatible JavaScript MD5
|
|
292
|
-
*
|
|
293
|
-
* Modification of JavaScript MD5
|
|
294
|
-
* https://github.com/blueimp/JavaScript-MD5
|
|
295
|
-
*
|
|
296
|
-
* Copyright 2011, Sebastian Tschan
|
|
297
|
-
* https://blueimp.net
|
|
298
|
-
*
|
|
299
|
-
* Licensed under the MIT license:
|
|
300
|
-
* https://opensource.org/licenses/MIT
|
|
301
|
-
*
|
|
302
|
-
* Based on
|
|
303
|
-
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
|
|
304
|
-
* Digest Algorithm, as defined in RFC 1321.
|
|
305
|
-
* Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
|
|
306
|
-
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
|
|
307
|
-
* Distributed under the BSD License
|
|
308
|
-
* See http://pajhome.org.uk/crypt/md5 for more info.
|
|
309
|
-
*/
|
|
310
|
-
function md5(bytes) {
|
|
311
|
-
if (typeof bytes === 'string') {
|
|
312
|
-
const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
|
|
313
|
-
|
|
314
|
-
bytes = new Uint8Array(msg.length);
|
|
315
|
-
for (let i = 0; i < msg.length; ++i) {
|
|
316
|
-
bytes[i] = msg.charCodeAt(i);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8));
|
|
320
|
-
}
|
|
321
|
-
/*
|
|
322
|
-
* Convert an array of little-endian words to an array of bytes
|
|
323
|
-
*/
|
|
324
|
-
|
|
325
|
-
function md5ToHexEncodedArray(input) {
|
|
326
|
-
const output = [];
|
|
327
|
-
const length32 = input.length * 32;
|
|
328
|
-
const hexTab = '0123456789abcdef';
|
|
329
|
-
for (let i = 0; i < length32; i += 8) {
|
|
330
|
-
const x = input[i >> 5] >>> i % 32 & 0xff;
|
|
331
|
-
const hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16);
|
|
332
|
-
output.push(hex);
|
|
333
|
-
}
|
|
334
|
-
return output;
|
|
335
|
-
}
|
|
336
|
-
/**
|
|
337
|
-
* Calculate output length with padding and bit length
|
|
338
|
-
*/
|
|
339
|
-
|
|
340
|
-
function getOutputLength(inputLength8) {
|
|
341
|
-
return (inputLength8 + 64 >>> 9 << 4) + 14 + 1;
|
|
342
|
-
}
|
|
343
|
-
/*
|
|
344
|
-
* Calculate the MD5 of an array of little-endian words, and a bit length.
|
|
345
|
-
*/
|
|
346
|
-
|
|
347
|
-
function wordsToMd5(x, len) {
|
|
348
|
-
/* append padding */
|
|
349
|
-
x[len >> 5] |= 0x80 << len % 32;
|
|
350
|
-
x[getOutputLength(len) - 1] = len;
|
|
351
|
-
let a = 1732584193;
|
|
352
|
-
let b = -271733879;
|
|
353
|
-
let c = -1732584194;
|
|
354
|
-
let d = 271733878;
|
|
355
|
-
for (let i = 0; i < x.length; i += 16) {
|
|
356
|
-
const olda = a;
|
|
357
|
-
const oldb = b;
|
|
358
|
-
const oldc = c;
|
|
359
|
-
const oldd = d;
|
|
360
|
-
a = md5ff(a, b, c, d, x[i], 7, -680876936);
|
|
361
|
-
d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);
|
|
362
|
-
c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);
|
|
363
|
-
b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);
|
|
364
|
-
a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);
|
|
365
|
-
d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);
|
|
366
|
-
c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);
|
|
367
|
-
b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);
|
|
368
|
-
a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);
|
|
369
|
-
d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);
|
|
370
|
-
c = md5ff(c, d, a, b, x[i + 10], 17, -42063);
|
|
371
|
-
b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);
|
|
372
|
-
a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);
|
|
373
|
-
d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);
|
|
374
|
-
c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);
|
|
375
|
-
b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);
|
|
376
|
-
a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);
|
|
377
|
-
d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);
|
|
378
|
-
c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);
|
|
379
|
-
b = md5gg(b, c, d, a, x[i], 20, -373897302);
|
|
380
|
-
a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);
|
|
381
|
-
d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);
|
|
382
|
-
c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);
|
|
383
|
-
b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);
|
|
384
|
-
a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);
|
|
385
|
-
d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);
|
|
386
|
-
c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);
|
|
387
|
-
b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);
|
|
388
|
-
a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);
|
|
389
|
-
d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);
|
|
390
|
-
c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);
|
|
391
|
-
b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);
|
|
392
|
-
a = md5hh(a, b, c, d, x[i + 5], 4, -378558);
|
|
393
|
-
d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);
|
|
394
|
-
c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);
|
|
395
|
-
b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);
|
|
396
|
-
a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);
|
|
397
|
-
d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);
|
|
398
|
-
c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);
|
|
399
|
-
b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);
|
|
400
|
-
a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);
|
|
401
|
-
d = md5hh(d, a, b, c, x[i], 11, -358537222);
|
|
402
|
-
c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);
|
|
403
|
-
b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);
|
|
404
|
-
a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);
|
|
405
|
-
d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);
|
|
406
|
-
c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);
|
|
407
|
-
b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);
|
|
408
|
-
a = md5ii(a, b, c, d, x[i], 6, -198630844);
|
|
409
|
-
d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);
|
|
410
|
-
c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);
|
|
411
|
-
b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);
|
|
412
|
-
a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);
|
|
413
|
-
d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);
|
|
414
|
-
c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);
|
|
415
|
-
b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);
|
|
416
|
-
a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);
|
|
417
|
-
d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);
|
|
418
|
-
c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);
|
|
419
|
-
b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);
|
|
420
|
-
a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);
|
|
421
|
-
d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);
|
|
422
|
-
c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);
|
|
423
|
-
b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);
|
|
424
|
-
a = safeAdd(a, olda);
|
|
425
|
-
b = safeAdd(b, oldb);
|
|
426
|
-
c = safeAdd(c, oldc);
|
|
427
|
-
d = safeAdd(d, oldd);
|
|
428
|
-
}
|
|
429
|
-
return [a, b, c, d];
|
|
430
|
-
}
|
|
431
|
-
/*
|
|
432
|
-
* Convert an array bytes to an array of little-endian words
|
|
433
|
-
* Characters >255 have their high-byte silently ignored.
|
|
434
|
-
*/
|
|
435
|
-
|
|
436
|
-
function bytesToWords(input) {
|
|
437
|
-
if (input.length === 0) {
|
|
438
|
-
return [];
|
|
439
|
-
}
|
|
440
|
-
const length8 = input.length * 8;
|
|
441
|
-
const output = new Uint32Array(getOutputLength(length8));
|
|
442
|
-
for (let i = 0; i < length8; i += 8) {
|
|
443
|
-
output[i >> 5] |= (input[i / 8] & 0xff) << i % 32;
|
|
444
|
-
}
|
|
445
|
-
return output;
|
|
446
|
-
}
|
|
447
|
-
/*
|
|
448
|
-
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
|
|
449
|
-
* to work around bugs in some JS interpreters.
|
|
450
|
-
*/
|
|
451
|
-
|
|
452
|
-
function safeAdd(x, y) {
|
|
453
|
-
const lsw = (x & 0xffff) + (y & 0xffff);
|
|
454
|
-
const msw = (x >> 16) + (y >> 16) + (lsw >> 16);
|
|
455
|
-
return msw << 16 | lsw & 0xffff;
|
|
456
|
-
}
|
|
457
|
-
/*
|
|
458
|
-
* Bitwise rotate a 32-bit number to the left.
|
|
459
|
-
*/
|
|
460
|
-
|
|
461
|
-
function bitRotateLeft(num, cnt) {
|
|
462
|
-
return num << cnt | num >>> 32 - cnt;
|
|
463
|
-
}
|
|
464
|
-
/*
|
|
465
|
-
* These functions implement the four basic operations the algorithm uses.
|
|
466
|
-
*/
|
|
467
|
-
|
|
468
|
-
function md5cmn(q, a, b, x, s, t) {
|
|
469
|
-
return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);
|
|
470
|
-
}
|
|
471
|
-
function md5ff(a, b, c, d, x, s, t) {
|
|
472
|
-
return md5cmn(b & c | ~b & d, a, b, x, s, t);
|
|
473
|
-
}
|
|
474
|
-
function md5gg(a, b, c, d, x, s, t) {
|
|
475
|
-
return md5cmn(b & d | c & ~d, a, b, x, s, t);
|
|
476
|
-
}
|
|
477
|
-
function md5hh(a, b, c, d, x, s, t) {
|
|
478
|
-
return md5cmn(b ^ c ^ d, a, b, x, s, t);
|
|
479
|
-
}
|
|
480
|
-
function md5ii(a, b, c, d, x, s, t) {
|
|
481
|
-
return md5cmn(c ^ (b | ~d), a, b, x, s, t);
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
v35('v3', 0x30, md5);
|
|
485
|
-
|
|
486
|
-
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
487
|
-
var native = {
|
|
488
|
-
randomUUID
|
|
489
|
-
};
|
|
490
|
-
|
|
491
|
-
function v4(options, buf, offset) {
|
|
492
|
-
if (native.randomUUID && !buf && !options) {
|
|
493
|
-
return native.randomUUID();
|
|
494
|
-
}
|
|
495
|
-
options = options || {};
|
|
496
|
-
const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
497
|
-
|
|
498
|
-
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
499
|
-
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
|
500
|
-
|
|
501
|
-
if (buf) {
|
|
502
|
-
offset = offset || 0;
|
|
503
|
-
for (let i = 0; i < 16; ++i) {
|
|
504
|
-
buf[offset + i] = rnds[i];
|
|
505
|
-
}
|
|
506
|
-
return buf;
|
|
507
|
-
}
|
|
508
|
-
return unsafeStringify(rnds);
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
// Adapted from Chris Veness' SHA1 code at
|
|
512
|
-
// http://www.movable-type.co.uk/scripts/sha1.html
|
|
513
|
-
function f(s, x, y, z) {
|
|
514
|
-
switch (s) {
|
|
515
|
-
case 0:
|
|
516
|
-
return x & y ^ ~x & z;
|
|
517
|
-
case 1:
|
|
518
|
-
return x ^ y ^ z;
|
|
519
|
-
case 2:
|
|
520
|
-
return x & y ^ x & z ^ y & z;
|
|
521
|
-
case 3:
|
|
522
|
-
return x ^ y ^ z;
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
function ROTL(x, n) {
|
|
526
|
-
return x << n | x >>> 32 - n;
|
|
527
|
-
}
|
|
528
|
-
function sha1(bytes) {
|
|
529
|
-
const K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];
|
|
530
|
-
const H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];
|
|
531
|
-
if (typeof bytes === 'string') {
|
|
532
|
-
const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
|
|
533
|
-
|
|
534
|
-
bytes = [];
|
|
535
|
-
for (let i = 0; i < msg.length; ++i) {
|
|
536
|
-
bytes.push(msg.charCodeAt(i));
|
|
537
|
-
}
|
|
538
|
-
} else if (!Array.isArray(bytes)) {
|
|
539
|
-
// Convert Array-like to Array
|
|
540
|
-
bytes = Array.prototype.slice.call(bytes);
|
|
541
|
-
}
|
|
542
|
-
bytes.push(0x80);
|
|
543
|
-
const l = bytes.length / 4 + 2;
|
|
544
|
-
const N = Math.ceil(l / 16);
|
|
545
|
-
const M = new Array(N);
|
|
546
|
-
for (let i = 0; i < N; ++i) {
|
|
547
|
-
const arr = new Uint32Array(16);
|
|
548
|
-
for (let j = 0; j < 16; ++j) {
|
|
549
|
-
arr[j] = bytes[i * 64 + j * 4] << 24 | bytes[i * 64 + j * 4 + 1] << 16 | bytes[i * 64 + j * 4 + 2] << 8 | bytes[i * 64 + j * 4 + 3];
|
|
550
|
-
}
|
|
551
|
-
M[i] = arr;
|
|
552
|
-
}
|
|
553
|
-
M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);
|
|
554
|
-
M[N - 1][14] = Math.floor(M[N - 1][14]);
|
|
555
|
-
M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;
|
|
556
|
-
for (let i = 0; i < N; ++i) {
|
|
557
|
-
const W = new Uint32Array(80);
|
|
558
|
-
for (let t = 0; t < 16; ++t) {
|
|
559
|
-
W[t] = M[i][t];
|
|
560
|
-
}
|
|
561
|
-
for (let t = 16; t < 80; ++t) {
|
|
562
|
-
W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);
|
|
563
|
-
}
|
|
564
|
-
let a = H[0];
|
|
565
|
-
let b = H[1];
|
|
566
|
-
let c = H[2];
|
|
567
|
-
let d = H[3];
|
|
568
|
-
let e = H[4];
|
|
569
|
-
for (let t = 0; t < 80; ++t) {
|
|
570
|
-
const s = Math.floor(t / 20);
|
|
571
|
-
const T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0;
|
|
572
|
-
e = d;
|
|
573
|
-
d = c;
|
|
574
|
-
c = ROTL(b, 30) >>> 0;
|
|
575
|
-
b = a;
|
|
576
|
-
a = T;
|
|
577
|
-
}
|
|
578
|
-
H[0] = H[0] + a >>> 0;
|
|
579
|
-
H[1] = H[1] + b >>> 0;
|
|
580
|
-
H[2] = H[2] + c >>> 0;
|
|
581
|
-
H[3] = H[3] + d >>> 0;
|
|
582
|
-
H[4] = H[4] + e >>> 0;
|
|
583
|
-
}
|
|
584
|
-
return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff];
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
v35('v5', 0x50, sha1);
|
|
588
|
-
|
|
589
170
|
var API_ENDPOINTS = {
|
|
590
171
|
GET_CHAT_ID: '/agentrix/api/v1/agent/request',
|
|
591
172
|
GET_CONVERSATION_BY_ID: function (sessionId, referenceId) { return "/agentrix/api/v1/conversations/session?sessionId=".concat(sessionId, "&referenceId=").concat(referenceId); },
|
|
@@ -599,32 +180,57 @@
|
|
|
599
180
|
|
|
600
181
|
var ChatService = (function () {
|
|
601
182
|
function ChatService(network) {
|
|
602
|
-
var _a = network !== null && network !== void 0 ? network : {}, headers = _a.headers, body = _a.body, domain = _a.domain;
|
|
183
|
+
var _a = network !== null && network !== void 0 ? network : {}, headers = _a.headers, getHeaders = _a.getHeaders, body = _a.body, domain = _a.domain;
|
|
603
184
|
this.headers = __assign(__assign({}, headers), talosGeneralUtils.getSessionIdHeader());
|
|
185
|
+
this.getHeaders = getHeaders;
|
|
604
186
|
this.basePayload = body !== null && body !== void 0 ? body : {};
|
|
605
187
|
this.domain = domain || '';
|
|
606
188
|
}
|
|
189
|
+
ChatService.prototype.resolveHeaders = function () {
|
|
190
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
191
|
+
var dynamicHeaders, _a;
|
|
192
|
+
return __generator(this, function (_b) {
|
|
193
|
+
switch (_b.label) {
|
|
194
|
+
case 0:
|
|
195
|
+
if (!this.getHeaders) return [3, 2];
|
|
196
|
+
return [4, Promise.resolve(this.getHeaders())];
|
|
197
|
+
case 1:
|
|
198
|
+
_a = _b.sent();
|
|
199
|
+
return [3, 3];
|
|
200
|
+
case 2:
|
|
201
|
+
_a = {};
|
|
202
|
+
_b.label = 3;
|
|
203
|
+
case 3:
|
|
204
|
+
dynamicHeaders = _a;
|
|
205
|
+
return [2, __assign(__assign({}, this.headers), dynamicHeaders)];
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
};
|
|
607
210
|
ChatService.prototype.fetchChatId = function (forceNewChat) {
|
|
608
211
|
if (forceNewChat === void 0) { forceNewChat = false; }
|
|
609
212
|
return __awaiter(this, void 0, void 0, function () {
|
|
610
|
-
var _a, _b, referenceId, _c, pageId, mergedPayload,
|
|
611
|
-
|
|
612
|
-
|
|
213
|
+
var _a, _b, referenceId, _c, pageId, mergedPayload, response, _d;
|
|
214
|
+
var _e;
|
|
215
|
+
return __generator(this, function (_f) {
|
|
216
|
+
switch (_f.label) {
|
|
613
217
|
case 0:
|
|
614
218
|
_a = this.basePayload, _b = _a.referenceId, referenceId = _b === void 0 ? "" : _b, _c = _a.pageId, pageId = _c === void 0 ? "" : _c;
|
|
615
219
|
mergedPayload = __assign(__assign({ payload: {
|
|
616
220
|
tripId: referenceId,
|
|
617
221
|
} }, (pageId && { pageId: pageId })), { init: forceNewChat });
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
222
|
+
_d = talosNetwork.baseFetch;
|
|
223
|
+
_e = {
|
|
224
|
+
url: API_ENDPOINTS.GET_CHAT_ID,
|
|
225
|
+
method: talosNetwork.REQUEST_METHODS.POST,
|
|
226
|
+
body: JSON.stringify(mergedPayload)
|
|
227
|
+
};
|
|
228
|
+
return [4, this.resolveHeaders()];
|
|
229
|
+
case 1: return [4, _d.apply(void 0, [(_e.headers = _f.sent(),
|
|
230
|
+
_e.domain = this.domain,
|
|
231
|
+
_e)])];
|
|
232
|
+
case 2:
|
|
233
|
+
response = _f.sent();
|
|
628
234
|
return [2, response];
|
|
629
235
|
}
|
|
630
236
|
});
|
|
@@ -633,19 +239,23 @@
|
|
|
633
239
|
ChatService.prototype.fetchConversationById = function (sessionId) {
|
|
634
240
|
var _a;
|
|
635
241
|
return __awaiter(this, void 0, void 0, function () {
|
|
636
|
-
var _b, referenceId, response;
|
|
637
|
-
|
|
638
|
-
|
|
242
|
+
var _b, referenceId, response, _c;
|
|
243
|
+
var _d;
|
|
244
|
+
return __generator(this, function (_e) {
|
|
245
|
+
switch (_e.label) {
|
|
639
246
|
case 0:
|
|
640
247
|
_b = ((_a = this.basePayload) !== null && _a !== void 0 ? _a : {}).referenceId, referenceId = _b === void 0 ? "" : _b;
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
case 1:
|
|
648
|
-
|
|
248
|
+
_c = talosNetwork.baseFetch;
|
|
249
|
+
_d = {
|
|
250
|
+
url: API_ENDPOINTS.GET_CONVERSATION_BY_ID(sessionId, referenceId),
|
|
251
|
+
method: talosNetwork.REQUEST_METHODS.GET
|
|
252
|
+
};
|
|
253
|
+
return [4, this.resolveHeaders()];
|
|
254
|
+
case 1: return [4, _c.apply(void 0, [(_d.headers = _e.sent(),
|
|
255
|
+
_d.domain = this.domain,
|
|
256
|
+
_d)])];
|
|
257
|
+
case 2:
|
|
258
|
+
response = _e.sent();
|
|
649
259
|
return [2, response];
|
|
650
260
|
}
|
|
651
261
|
});
|
|
@@ -653,18 +263,23 @@
|
|
|
653
263
|
};
|
|
654
264
|
ChatService.prototype.getPresignedURL = function (payload) {
|
|
655
265
|
return __awaiter(this, void 0, void 0, function () {
|
|
656
|
-
var response;
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
266
|
+
var response, _a;
|
|
267
|
+
var _b;
|
|
268
|
+
return __generator(this, function (_c) {
|
|
269
|
+
switch (_c.label) {
|
|
270
|
+
case 0:
|
|
271
|
+
_a = talosNetwork.baseFetch;
|
|
272
|
+
_b = {
|
|
660
273
|
url: API_ENDPOINTS.GET_PRESIGNED_URL,
|
|
661
274
|
method: talosNetwork.REQUEST_METHODS.POST,
|
|
662
|
-
body: JSON.stringify(payload)
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
275
|
+
body: JSON.stringify(payload)
|
|
276
|
+
};
|
|
277
|
+
return [4, this.resolveHeaders()];
|
|
278
|
+
case 1: return [4, _a.apply(void 0, [(_b.headers = _c.sent(),
|
|
279
|
+
_b.domain = this.domain,
|
|
280
|
+
_b)])];
|
|
281
|
+
case 2:
|
|
282
|
+
response = _c.sent();
|
|
668
283
|
return [2, response];
|
|
669
284
|
}
|
|
670
285
|
});
|
|
@@ -694,18 +309,23 @@
|
|
|
694
309
|
};
|
|
695
310
|
ChatService.prototype.getPreviousChats = function (payload) {
|
|
696
311
|
return __awaiter(this, void 0, void 0, function () {
|
|
697
|
-
var response;
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
312
|
+
var response, _a;
|
|
313
|
+
var _b;
|
|
314
|
+
return __generator(this, function (_c) {
|
|
315
|
+
switch (_c.label) {
|
|
316
|
+
case 0:
|
|
317
|
+
_a = talosNetwork.baseFetch;
|
|
318
|
+
_b = {
|
|
701
319
|
url: API_ENDPOINTS.GET_PREVIOUS_CHATS,
|
|
702
320
|
method: talosNetwork.REQUEST_METHODS.POST,
|
|
703
|
-
body: JSON.stringify(payload)
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
321
|
+
body: JSON.stringify(payload)
|
|
322
|
+
};
|
|
323
|
+
return [4, this.resolveHeaders()];
|
|
324
|
+
case 1: return [4, _a.apply(void 0, [(_b.headers = _c.sent(),
|
|
325
|
+
_b.domain = this.domain,
|
|
326
|
+
_b)])];
|
|
327
|
+
case 2:
|
|
328
|
+
response = _c.sent();
|
|
709
329
|
return [2, response];
|
|
710
330
|
}
|
|
711
331
|
});
|
|
@@ -714,21 +334,25 @@
|
|
|
714
334
|
ChatService.prototype.getBotResponse = function (payload) {
|
|
715
335
|
var _a;
|
|
716
336
|
return __awaiter(this, void 0, void 0, function () {
|
|
717
|
-
var _b, referenceId, mergedPayload, response;
|
|
718
|
-
|
|
719
|
-
|
|
337
|
+
var _b, referenceId, mergedPayload, response, _c;
|
|
338
|
+
var _d;
|
|
339
|
+
return __generator(this, function (_e) {
|
|
340
|
+
switch (_e.label) {
|
|
720
341
|
case 0:
|
|
721
342
|
_b = ((_a = this.basePayload) !== null && _a !== void 0 ? _a : {}).referenceId, referenceId = _b === void 0 ? "" : _b;
|
|
722
343
|
mergedPayload = __assign(__assign({}, payload), { referenceId: referenceId, payload: __assign(__assign({}, payload.payload), this.basePayload) });
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
case 1:
|
|
731
|
-
|
|
344
|
+
_c = talosNetwork.baseFetch;
|
|
345
|
+
_d = {
|
|
346
|
+
url: API_ENDPOINTS.GET_BOT_RESPONSE,
|
|
347
|
+
method: talosNetwork.REQUEST_METHODS.POST,
|
|
348
|
+
body: JSON.stringify(mergedPayload)
|
|
349
|
+
};
|
|
350
|
+
return [4, this.resolveHeaders()];
|
|
351
|
+
case 1: return [4, _c.apply(void 0, [(_d.headers = _e.sent(),
|
|
352
|
+
_d.domain = this.domain,
|
|
353
|
+
_d)])];
|
|
354
|
+
case 2:
|
|
355
|
+
response = _e.sent();
|
|
732
356
|
return [2, response];
|
|
733
357
|
}
|
|
734
358
|
});
|
|
@@ -736,18 +360,23 @@
|
|
|
736
360
|
};
|
|
737
361
|
ChatService.prototype.postFeedback = function (payload) {
|
|
738
362
|
return __awaiter(this, void 0, void 0, function () {
|
|
739
|
-
var response;
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
363
|
+
var response, _a;
|
|
364
|
+
var _b;
|
|
365
|
+
return __generator(this, function (_c) {
|
|
366
|
+
switch (_c.label) {
|
|
367
|
+
case 0:
|
|
368
|
+
_a = talosNetwork.baseFetch;
|
|
369
|
+
_b = {
|
|
743
370
|
url: API_ENDPOINTS.POST_FEEDBACK,
|
|
744
371
|
method: talosNetwork.REQUEST_METHODS.POST,
|
|
745
|
-
body: JSON.stringify(payload)
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
372
|
+
body: JSON.stringify(payload)
|
|
373
|
+
};
|
|
374
|
+
return [4, this.resolveHeaders()];
|
|
375
|
+
case 1: return [4, _a.apply(void 0, [(_b.headers = _c.sent(),
|
|
376
|
+
_b.domain = this.domain,
|
|
377
|
+
_b)])];
|
|
378
|
+
case 2:
|
|
379
|
+
response = _c.sent();
|
|
751
380
|
return [2, response];
|
|
752
381
|
}
|
|
753
382
|
});
|
|
@@ -756,9 +385,10 @@
|
|
|
756
385
|
ChatService.prototype.getQuickPills = function (pageId, signal) {
|
|
757
386
|
var _a;
|
|
758
387
|
return __awaiter(this, void 0, void 0, function () {
|
|
759
|
-
var _b, basePageId, mergedPayload, response;
|
|
760
|
-
|
|
761
|
-
|
|
388
|
+
var _b, basePageId, mergedPayload, response, _c;
|
|
389
|
+
var _d;
|
|
390
|
+
return __generator(this, function (_e) {
|
|
391
|
+
switch (_e.label) {
|
|
762
392
|
case 0:
|
|
763
393
|
_b = ((_a = this.basePayload) !== null && _a !== void 0 ? _a : {}).pageId, basePageId = _b === void 0 ? "" : _b;
|
|
764
394
|
mergedPayload = {
|
|
@@ -767,16 +397,19 @@
|
|
|
767
397
|
},
|
|
768
398
|
routeKey: 'quick-pills',
|
|
769
399
|
};
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
400
|
+
_c = talosNetwork.baseFetch;
|
|
401
|
+
_d = {
|
|
402
|
+
url: API_ENDPOINTS.GET_QUICK_PILLS,
|
|
403
|
+
method: talosNetwork.REQUEST_METHODS.POST,
|
|
404
|
+
body: JSON.stringify(mergedPayload)
|
|
405
|
+
};
|
|
406
|
+
return [4, this.resolveHeaders()];
|
|
407
|
+
case 1: return [4, _c.apply(void 0, [(_d.headers = _e.sent(),
|
|
408
|
+
_d.domain = this.domain,
|
|
409
|
+
_d.signal = signal,
|
|
410
|
+
_d)])];
|
|
411
|
+
case 2:
|
|
412
|
+
response = _e.sent();
|
|
780
413
|
return [2, response];
|
|
781
414
|
}
|
|
782
415
|
});
|
|
@@ -784,17 +417,22 @@
|
|
|
784
417
|
};
|
|
785
418
|
ChatService.prototype.getFeedbackOptions = function () {
|
|
786
419
|
return __awaiter(this, void 0, void 0, function () {
|
|
787
|
-
var response;
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
420
|
+
var response, _a;
|
|
421
|
+
var _b;
|
|
422
|
+
return __generator(this, function (_c) {
|
|
423
|
+
switch (_c.label) {
|
|
424
|
+
case 0:
|
|
425
|
+
_a = talosNetwork.baseFetch;
|
|
426
|
+
_b = {
|
|
791
427
|
url: API_ENDPOINTS.GET_FEEDBACK_OPTIONS,
|
|
792
|
-
method: talosNetwork.REQUEST_METHODS.GET
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
428
|
+
method: talosNetwork.REQUEST_METHODS.GET
|
|
429
|
+
};
|
|
430
|
+
return [4, this.resolveHeaders()];
|
|
431
|
+
case 1: return [4, _a.apply(void 0, [(_b.headers = _c.sent(),
|
|
432
|
+
_b.domain = this.domain,
|
|
433
|
+
_b)])];
|
|
434
|
+
case 2:
|
|
435
|
+
response = _c.sent();
|
|
798
436
|
return [2, response];
|
|
799
437
|
}
|
|
800
438
|
});
|
|
@@ -1514,7 +1152,7 @@
|
|
|
1514
1152
|
var buildBotPayload = function (variant, sessionId) {
|
|
1515
1153
|
var base = {
|
|
1516
1154
|
sessionId: sessionId,
|
|
1517
|
-
messageId: v4(),
|
|
1155
|
+
messageId: uuid.v4(),
|
|
1518
1156
|
message: "",
|
|
1519
1157
|
payload: { createdAt: Date.now() },
|
|
1520
1158
|
};
|
|
@@ -1719,7 +1357,7 @@
|
|
|
1719
1357
|
var messageList = (_b = (_a = messages[chatId]) === null || _a === void 0 ? void 0 : _a.messages) !== null && _b !== void 0 ? _b : [];
|
|
1720
1358
|
var turnSequence = getTurnSequence(messageList, "BOT_MESSAGE") + 1;
|
|
1721
1359
|
var messageIndex = messageList.length + 1;
|
|
1722
|
-
var messageId = v4();
|
|
1360
|
+
var messageId = uuid.v4();
|
|
1723
1361
|
if (!isInit) {
|
|
1724
1362
|
inFlightReplyRef.current = { chatId: chatId, messageId: messageId };
|
|
1725
1363
|
updateReplyLoading(true);
|
|
@@ -1860,7 +1498,7 @@
|
|
|
1860
1498
|
setIsNewChat(newChat);
|
|
1861
1499
|
summaryEnabledRef.current = summaryEnabled;
|
|
1862
1500
|
if (newChat) {
|
|
1863
|
-
latestSessionId = v4();
|
|
1501
|
+
latestSessionId = uuid.v4();
|
|
1864
1502
|
}
|
|
1865
1503
|
setChatStack([{ type: exports.ChatPageType.CHAT, id: latestSessionId }]);
|
|
1866
1504
|
if (!newChat) return [3, 3];
|
|
@@ -1977,7 +1615,7 @@
|
|
|
1977
1615
|
}, [open, isInitialLoading, currentChatId, fetchContextSummary, resetContextSummary]);
|
|
1978
1616
|
var pushUserMessage = function (message) {
|
|
1979
1617
|
var userMessageWidget = formUserMessageWidget({ message: message });
|
|
1980
|
-
var id = v4();
|
|
1618
|
+
var id = uuid.v4();
|
|
1981
1619
|
var turnSequence = 0;
|
|
1982
1620
|
setMessages(function (prev) {
|
|
1983
1621
|
var _a;
|
|
@@ -2287,7 +1925,7 @@
|
|
|
2287
1925
|
switch (_c.label) {
|
|
2288
1926
|
case 0:
|
|
2289
1927
|
userMessageWidget = formUserMessageWidget({ files: files });
|
|
2290
|
-
messageId = v4();
|
|
1928
|
+
messageId = uuid.v4();
|
|
2291
1929
|
turnSequence = getTurnSequence((_b = (_a = messages[currentChatId]) === null || _a === void 0 ? void 0 : _a.messages) !== null && _b !== void 0 ? _b : [], "USER_MESSAGE") + 1;
|
|
2292
1930
|
setMessages(function (prev) {
|
|
2293
1931
|
var _a;
|