@tarxemo/customer_support 1.0.10 → 1.0.11
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/components/ChatWindow.d.ts.map +1 -1
- package/dist/customer_support.css +1 -1
- package/dist/index.es.js +118 -118
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +5 -5
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var St = Object.defineProperty;
|
|
2
2
|
var Rt = (e, t, n) => t in e ? St(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var Pe = (e, t, n) => Rt(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
-
import
|
|
5
|
-
import { ExternalLink as
|
|
4
|
+
import y, { useState as J, useRef as Xe, useEffect as Ge, useCallback as ee } from "react";
|
|
5
|
+
import { ExternalLink as _t, Send as Ot, X as Tt, Loader2 as At, MessageCircle as Ct } from "lucide-react";
|
|
6
6
|
function Qe(e, t) {
|
|
7
7
|
return function() {
|
|
8
8
|
return e.apply(t, arguments);
|
|
@@ -25,7 +25,7 @@ const Pt = ce("string"), C = ce("function"), et = ce("number"), K = (e) => e !==
|
|
|
25
25
|
return !1;
|
|
26
26
|
const t = ge(e);
|
|
27
27
|
return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(Ye in e) && !(ie in e);
|
|
28
|
-
},
|
|
28
|
+
}, Ut = (e) => {
|
|
29
29
|
if (!K(e) || V(e))
|
|
30
30
|
return !1;
|
|
31
31
|
try {
|
|
@@ -33,7 +33,7 @@ const Pt = ce("string"), C = ce("function"), et = ce("number"), K = (e) => e !==
|
|
|
33
33
|
} catch {
|
|
34
34
|
return !1;
|
|
35
35
|
}
|
|
36
|
-
},
|
|
36
|
+
}, Ft = P("Date"), Lt = P("File"), kt = P("Blob"), Bt = P("FileList"), It = (e) => K(e) && C(e.pipe), jt = (e) => {
|
|
37
37
|
let t;
|
|
38
38
|
return e && (typeof FormData == "function" && e instanceof FormData || C(e.append) && ((t = ae(e)) === "formdata" || // detect form-data instance
|
|
39
39
|
t === "object" && C(e.toString) && e.toString() === "[object FormData]"));
|
|
@@ -207,13 +207,13 @@ const ln = (e) => {
|
|
|
207
207
|
isBoolean: Dt,
|
|
208
208
|
isObject: K,
|
|
209
209
|
isPlainObject: ne,
|
|
210
|
-
isEmptyObject:
|
|
210
|
+
isEmptyObject: Ut,
|
|
211
211
|
isReadableStream: Mt,
|
|
212
212
|
isRequest: Ht,
|
|
213
213
|
isResponse: qt,
|
|
214
214
|
isHeaders: zt,
|
|
215
215
|
isUndefined: H,
|
|
216
|
-
isDate:
|
|
216
|
+
isDate: Ft,
|
|
217
217
|
isFile: Lt,
|
|
218
218
|
isBlob: kt,
|
|
219
219
|
isRegExp: nn,
|
|
@@ -314,7 +314,7 @@ function ye(e) {
|
|
|
314
314
|
function it(e) {
|
|
315
315
|
return c.endsWith(e, "[]") ? e.slice(0, -2) : e;
|
|
316
316
|
}
|
|
317
|
-
function
|
|
317
|
+
function Ue(e, t, n) {
|
|
318
318
|
return e ? e.concat(t).map(function(s, o) {
|
|
319
319
|
return s = it(s), !n && o ? "[" + s + "]" : s;
|
|
320
320
|
}).join(n ? "." : "") : t;
|
|
@@ -354,22 +354,22 @@ function le(e, t, n) {
|
|
|
354
354
|
if (c.endsWith(h, "{}"))
|
|
355
355
|
h = r ? h : h.slice(0, -2), f = JSON.stringify(f);
|
|
356
356
|
else if (c.isArray(f) && hn(f) || (c.isFileList(f) || c.endsWith(h, "[]")) && (S = c.toArray(f)))
|
|
357
|
-
return h = it(h), S.forEach(function(g,
|
|
357
|
+
return h = it(h), S.forEach(function(g, E) {
|
|
358
358
|
!(c.isUndefined(g) || g === null) && t.append(
|
|
359
359
|
// eslint-disable-next-line no-nested-ternary
|
|
360
|
-
i === !0 ?
|
|
360
|
+
i === !0 ? Ue([h], E, o) : i === null ? h : h + "[]",
|
|
361
361
|
u(g)
|
|
362
362
|
);
|
|
363
363
|
}), !1;
|
|
364
364
|
}
|
|
365
|
-
return ye(f) ? !0 : (t.append(
|
|
365
|
+
return ye(f) ? !0 : (t.append(Ue(m, h, o), u(f)), !1);
|
|
366
366
|
}
|
|
367
367
|
const p = [], b = Object.assign(wn, {
|
|
368
368
|
defaultVisitor: l,
|
|
369
369
|
convertValue: u,
|
|
370
370
|
isVisitable: ye
|
|
371
371
|
});
|
|
372
|
-
function
|
|
372
|
+
function O(f, h) {
|
|
373
373
|
if (!c.isUndefined(f)) {
|
|
374
374
|
if (p.indexOf(f) !== -1)
|
|
375
375
|
throw Error("Circular reference detected in " + h.join("."));
|
|
@@ -380,15 +380,15 @@ function le(e, t, n) {
|
|
|
380
380
|
c.isString(R) ? R.trim() : R,
|
|
381
381
|
h,
|
|
382
382
|
b
|
|
383
|
-
)) === !0 &&
|
|
383
|
+
)) === !0 && O(S, h ? h.concat(R) : [R]);
|
|
384
384
|
}), p.pop();
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
387
|
if (!c.isObject(e))
|
|
388
388
|
throw new TypeError("data must be an object");
|
|
389
|
-
return
|
|
389
|
+
return O(e), t;
|
|
390
390
|
}
|
|
391
|
-
function
|
|
391
|
+
function Fe(e) {
|
|
392
392
|
const t = {
|
|
393
393
|
"!": "%21",
|
|
394
394
|
"'": "%27",
|
|
@@ -411,8 +411,8 @@ at.append = function(t, n) {
|
|
|
411
411
|
};
|
|
412
412
|
at.toString = function(t) {
|
|
413
413
|
const n = t ? function(r) {
|
|
414
|
-
return t.call(this, r,
|
|
415
|
-
} :
|
|
414
|
+
return t.call(this, r, Fe);
|
|
415
|
+
} : Fe;
|
|
416
416
|
return this._pairs.map(function(s) {
|
|
417
417
|
return n(s[0]) + "=" + n(s[1]);
|
|
418
418
|
}, "").join("&");
|
|
@@ -500,14 +500,14 @@ const lt = {
|
|
|
500
500
|
Blob: gn
|
|
501
501
|
},
|
|
502
502
|
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
503
|
-
}, Re = typeof window < "u" && typeof document < "u", Ee = typeof navigator == "object" && navigator || void 0, Rn = Re && (!Ee || ["ReactNative", "NativeScript", "NS"].indexOf(Ee.product) < 0),
|
|
504
|
-
self instanceof WorkerGlobalScope && typeof self.importScripts == "function",
|
|
503
|
+
}, Re = typeof window < "u" && typeof document < "u", Ee = typeof navigator == "object" && navigator || void 0, Rn = Re && (!Ee || ["ReactNative", "NativeScript", "NS"].indexOf(Ee.product) < 0), _n = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
|
|
504
|
+
self instanceof WorkerGlobalScope && typeof self.importScripts == "function", On = Re && window.location.href || "http://localhost", Tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
505
505
|
__proto__: null,
|
|
506
506
|
hasBrowserEnv: Re,
|
|
507
507
|
hasStandardBrowserEnv: Rn,
|
|
508
|
-
hasStandardBrowserWebWorkerEnv:
|
|
508
|
+
hasStandardBrowserWebWorkerEnv: _n,
|
|
509
509
|
navigator: Ee,
|
|
510
|
-
origin:
|
|
510
|
+
origin: On
|
|
511
511
|
}, Symbol.toStringTag, { value: "Module" })), A = {
|
|
512
512
|
...Tn,
|
|
513
513
|
...Sn
|
|
@@ -658,14 +658,14 @@ function v(e) {
|
|
|
658
658
|
function re(e) {
|
|
659
659
|
return e === !1 || e == null ? e : c.isArray(e) ? e.map(re) : String(e);
|
|
660
660
|
}
|
|
661
|
-
function
|
|
661
|
+
function Un(e) {
|
|
662
662
|
const t = /* @__PURE__ */ Object.create(null), n = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
663
663
|
let r;
|
|
664
664
|
for (; r = n.exec(e); )
|
|
665
665
|
t[r[1]] = r[2];
|
|
666
666
|
return t;
|
|
667
667
|
}
|
|
668
|
-
const
|
|
668
|
+
const Fn = (e) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());
|
|
669
669
|
function pe(e, t, n, r, s) {
|
|
670
670
|
if (c.isFunction(r))
|
|
671
671
|
return r.call(this, t, n);
|
|
@@ -706,7 +706,7 @@ let N = class {
|
|
|
706
706
|
const i = (a, d) => c.forEach(a, (u, l) => o(u, l, d));
|
|
707
707
|
if (c.isPlainObject(t) || t instanceof this.constructor)
|
|
708
708
|
i(t, n);
|
|
709
|
-
else if (c.isString(t) && (t = t.trim()) && !
|
|
709
|
+
else if (c.isString(t) && (t = t.trim()) && !Fn(t))
|
|
710
710
|
i(Dn(t), n);
|
|
711
711
|
else if (c.isObject(t) && c.isIterable(t)) {
|
|
712
712
|
let a = {}, d, u;
|
|
@@ -728,7 +728,7 @@ let N = class {
|
|
|
728
728
|
if (!n)
|
|
729
729
|
return s;
|
|
730
730
|
if (n === !0)
|
|
731
|
-
return
|
|
731
|
+
return Un(s);
|
|
732
732
|
if (c.isFunction(n))
|
|
733
733
|
return n.call(this, s, r);
|
|
734
734
|
if (c.isRegExp(n))
|
|
@@ -877,8 +877,8 @@ function In(e, t) {
|
|
|
877
877
|
b += n[p++], p = p % e;
|
|
878
878
|
if (s = (s + 1) % e, s === o && (o = (o + 1) % e), u - i < t)
|
|
879
879
|
return;
|
|
880
|
-
const
|
|
881
|
-
return
|
|
880
|
+
const O = l && u - l;
|
|
881
|
+
return O ? Math.round(b * 1e3 / O) : void 0;
|
|
882
882
|
};
|
|
883
883
|
}
|
|
884
884
|
function jn(e, t) {
|
|
@@ -1052,9 +1052,9 @@ const mt = (e) => {
|
|
|
1052
1052
|
const s = mt(e);
|
|
1053
1053
|
let o = s.data;
|
|
1054
1054
|
const i = N.from(s.headers).normalize();
|
|
1055
|
-
let { responseType: a, onUploadProgress: d, onDownloadProgress: u } = s, l, p, b,
|
|
1055
|
+
let { responseType: a, onUploadProgress: d, onDownloadProgress: u } = s, l, p, b, O, f;
|
|
1056
1056
|
function h() {
|
|
1057
|
-
|
|
1057
|
+
O && O(), f && f(), s.cancelToken && s.cancelToken.unsubscribe(l), s.signal && s.signal.removeEventListener("abort", l);
|
|
1058
1058
|
}
|
|
1059
1059
|
let m = new XMLHttpRequest();
|
|
1060
1060
|
m.open(s.method.toUpperCase(), s.url, !0), m.timeout = s.timeout;
|
|
@@ -1081,21 +1081,21 @@ const mt = (e) => {
|
|
|
1081
1081
|
!m || m.readyState !== 4 || m.status === 0 && !(m.responseURL && m.responseURL.indexOf("file:") === 0) || setTimeout(S);
|
|
1082
1082
|
}, m.onabort = function() {
|
|
1083
1083
|
m && (r(new w("Request aborted", w.ECONNABORTED, e, m)), m = null);
|
|
1084
|
-
}, m.onerror = function(
|
|
1085
|
-
const T =
|
|
1086
|
-
|
|
1084
|
+
}, m.onerror = function(E) {
|
|
1085
|
+
const T = E && E.message ? E.message : "Network Error", F = new w(T, w.ERR_NETWORK, e, m);
|
|
1086
|
+
F.event = E || null, r(F), m = null;
|
|
1087
1087
|
}, m.ontimeout = function() {
|
|
1088
|
-
let
|
|
1088
|
+
let E = s.timeout ? "timeout of " + s.timeout + "ms exceeded" : "timeout exceeded";
|
|
1089
1089
|
const T = s.transitional || lt;
|
|
1090
|
-
s.timeoutErrorMessage && (
|
|
1091
|
-
|
|
1090
|
+
s.timeoutErrorMessage && (E = s.timeoutErrorMessage), r(new w(
|
|
1091
|
+
E,
|
|
1092
1092
|
T.clarifyTimeoutError ? w.ETIMEDOUT : w.ECONNABORTED,
|
|
1093
1093
|
e,
|
|
1094
1094
|
m
|
|
1095
1095
|
)), m = null;
|
|
1096
|
-
}, o === void 0 && i.setContentType(null), "setRequestHeader" in m && c.forEach(i.toJSON(), function(
|
|
1097
|
-
m.setRequestHeader(T,
|
|
1098
|
-
}), c.isUndefined(s.withCredentials) || (m.withCredentials = !!s.withCredentials), a && a !== "json" && (m.responseType = s.responseType), u && ([b, f] = oe(u, !0), m.addEventListener("progress", b)), d && m.upload && ([p,
|
|
1096
|
+
}, o === void 0 && i.setContentType(null), "setRequestHeader" in m && c.forEach(i.toJSON(), function(E, T) {
|
|
1097
|
+
m.setRequestHeader(T, E);
|
|
1098
|
+
}), c.isUndefined(s.withCredentials) || (m.withCredentials = !!s.withCredentials), a && a !== "json" && (m.responseType = s.responseType), u && ([b, f] = oe(u, !0), m.addEventListener("progress", b)), d && m.upload && ([p, O] = oe(d), m.upload.addEventListener("progress", p), m.upload.addEventListener("loadend", O)), (s.cancelToken || s.signal) && (l = (g) => {
|
|
1099
1099
|
m && (r(!g || g.type ? new G(null, e, m) : g), m.abort(), m = null);
|
|
1100
1100
|
}, s.cancelToken && s.cancelToken.subscribe(l), s.signal && (s.signal.aborted ? l() : s.signal.addEventListener("abort", l)));
|
|
1101
1101
|
const R = Bn(s.url);
|
|
@@ -1239,7 +1239,7 @@ const mt = (e) => {
|
|
|
1239
1239
|
return f.byteLength;
|
|
1240
1240
|
if (c.isURLSearchParams(f) && (f = f + ""), c.isString(f))
|
|
1241
1241
|
return (await d(f)).byteLength;
|
|
1242
|
-
},
|
|
1242
|
+
}, O = async (f, h) => {
|
|
1243
1243
|
const m = c.toFiniteNumber(f.getContentLength());
|
|
1244
1244
|
return m ?? b(h);
|
|
1245
1245
|
};
|
|
@@ -1250,22 +1250,22 @@ const mt = (e) => {
|
|
|
1250
1250
|
data: S,
|
|
1251
1251
|
signal: R,
|
|
1252
1252
|
cancelToken: g,
|
|
1253
|
-
timeout:
|
|
1253
|
+
timeout: E,
|
|
1254
1254
|
onDownloadProgress: T,
|
|
1255
|
-
onUploadProgress:
|
|
1255
|
+
onUploadProgress: F,
|
|
1256
1256
|
responseType: x,
|
|
1257
1257
|
headers: fe,
|
|
1258
1258
|
withCredentials: Q = "same-origin",
|
|
1259
|
-
fetchOptions:
|
|
1259
|
+
fetchOptions: Oe
|
|
1260
1260
|
} = mt(f), Te = t || fetch;
|
|
1261
1261
|
x = x ? (x + "").toLowerCase() : "text";
|
|
1262
|
-
let Y = Jn([R, g && g.toAbortSignal()],
|
|
1262
|
+
let Y = Jn([R, g && g.toAbortSignal()], E), z = null;
|
|
1263
1263
|
const B = Y && Y.unsubscribe && (() => {
|
|
1264
1264
|
Y.unsubscribe();
|
|
1265
1265
|
});
|
|
1266
1266
|
let Ae;
|
|
1267
1267
|
try {
|
|
1268
|
-
if (
|
|
1268
|
+
if (F && u && m !== "get" && m !== "head" && (Ae = await O(fe, S)) !== 0) {
|
|
1269
1269
|
let k = new n(h, {
|
|
1270
1270
|
method: "POST",
|
|
1271
1271
|
body: S,
|
|
@@ -1274,14 +1274,14 @@ const mt = (e) => {
|
|
|
1274
1274
|
if (c.isFormData(S) && (M = k.headers.get("content-type")) && fe.setContentType(M), k.body) {
|
|
1275
1275
|
const [de, Z] = Be(
|
|
1276
1276
|
Ae,
|
|
1277
|
-
oe(Ie(
|
|
1277
|
+
oe(Ie(F))
|
|
1278
1278
|
);
|
|
1279
1279
|
S = $e(k.body, Me, de, Z);
|
|
1280
1280
|
}
|
|
1281
1281
|
}
|
|
1282
1282
|
c.isString(Q) || (Q = Q ? "include" : "omit");
|
|
1283
1283
|
const D = o && "credentials" in n.prototype, Ce = {
|
|
1284
|
-
...
|
|
1284
|
+
...Oe,
|
|
1285
1285
|
signal: Y,
|
|
1286
1286
|
method: m.toUpperCase(),
|
|
1287
1287
|
headers: fe.normalize().toJSON(),
|
|
@@ -1290,7 +1290,7 @@ const mt = (e) => {
|
|
|
1290
1290
|
credentials: D ? Q : void 0
|
|
1291
1291
|
};
|
|
1292
1292
|
z = o && new n(h, Ce);
|
|
1293
|
-
let L = await (o ? Te(z,
|
|
1293
|
+
let L = await (o ? Te(z, Oe) : Te(h, Ce));
|
|
1294
1294
|
const Ne = l && (x === "stream" || x === "response");
|
|
1295
1295
|
if (l && (T || Ne && B)) {
|
|
1296
1296
|
const k = {};
|
|
@@ -1342,14 +1342,14 @@ const mt = (e) => {
|
|
|
1342
1342
|
return u;
|
|
1343
1343
|
};
|
|
1344
1344
|
ht();
|
|
1345
|
-
const
|
|
1345
|
+
const _e = {
|
|
1346
1346
|
http: mn,
|
|
1347
1347
|
xhr: vn,
|
|
1348
1348
|
fetch: {
|
|
1349
1349
|
get: ht
|
|
1350
1350
|
}
|
|
1351
1351
|
};
|
|
1352
|
-
c.forEach(
|
|
1352
|
+
c.forEach(_e, (e, t) => {
|
|
1353
1353
|
if (e) {
|
|
1354
1354
|
try {
|
|
1355
1355
|
Object.defineProperty(e, "name", { value: t });
|
|
@@ -1367,7 +1367,7 @@ function Zn(e, t) {
|
|
|
1367
1367
|
for (let i = 0; i < n; i++) {
|
|
1368
1368
|
r = e[i];
|
|
1369
1369
|
let a;
|
|
1370
|
-
if (s = r, !Yn(r) && (s =
|
|
1370
|
+
if (s = r, !Yn(r) && (s = _e[(a = String(r)).toLowerCase()], s === void 0))
|
|
1371
1371
|
throw new w(`Unknown adapter '${a}'`);
|
|
1372
1372
|
if (s && (c.isFunction(s) || (s = s.get(t))))
|
|
1373
1373
|
break;
|
|
@@ -1397,7 +1397,7 @@ const wt = {
|
|
|
1397
1397
|
* Exposes all known adapters
|
|
1398
1398
|
* @type {Object<string, Function|Object>}
|
|
1399
1399
|
*/
|
|
1400
|
-
adapters:
|
|
1400
|
+
adapters: _e
|
|
1401
1401
|
};
|
|
1402
1402
|
function he(e) {
|
|
1403
1403
|
if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted)
|
|
@@ -1469,7 +1469,7 @@ function er(e, t, n) {
|
|
|
1469
1469
|
const se = {
|
|
1470
1470
|
assertOptions: er,
|
|
1471
1471
|
validators: ue
|
|
1472
|
-
},
|
|
1472
|
+
}, U = se.validators;
|
|
1473
1473
|
let j = class {
|
|
1474
1474
|
constructor(t) {
|
|
1475
1475
|
this.defaults = t || {}, this.interceptors = {
|
|
@@ -1506,17 +1506,17 @@ let j = class {
|
|
|
1506
1506
|
typeof t == "string" ? (n = n || {}, n.url = t) : n = t || {}, n = $(this.defaults, n);
|
|
1507
1507
|
const { transitional: r, paramsSerializer: s, headers: o } = n;
|
|
1508
1508
|
r !== void 0 && se.assertOptions(r, {
|
|
1509
|
-
silentJSONParsing:
|
|
1510
|
-
forcedJSONParsing:
|
|
1511
|
-
clarifyTimeoutError:
|
|
1509
|
+
silentJSONParsing: U.transitional(U.boolean),
|
|
1510
|
+
forcedJSONParsing: U.transitional(U.boolean),
|
|
1511
|
+
clarifyTimeoutError: U.transitional(U.boolean)
|
|
1512
1512
|
}, !1), s != null && (c.isFunction(s) ? n.paramsSerializer = {
|
|
1513
1513
|
serialize: s
|
|
1514
1514
|
} : se.assertOptions(s, {
|
|
1515
|
-
encode:
|
|
1516
|
-
serialize:
|
|
1515
|
+
encode: U.function,
|
|
1516
|
+
serialize: U.function
|
|
1517
1517
|
}, !0)), n.allowAbsoluteUrls !== void 0 || (this.defaults.allowAbsoluteUrls !== void 0 ? n.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls : n.allowAbsoluteUrls = !0), se.assertOptions(n, {
|
|
1518
|
-
baseUrl:
|
|
1519
|
-
withXsrfToken:
|
|
1518
|
+
baseUrl: U.spelling("baseURL"),
|
|
1519
|
+
withXsrfToken: U.spelling("withXSRFToken")
|
|
1520
1520
|
}, !0), n.method = (n.method || this.defaults.method || "get").toLowerCase();
|
|
1521
1521
|
let i = o && c.merge(
|
|
1522
1522
|
o.common,
|
|
@@ -1545,18 +1545,18 @@ let j = class {
|
|
|
1545
1545
|
return l;
|
|
1546
1546
|
}
|
|
1547
1547
|
b = a.length;
|
|
1548
|
-
let
|
|
1548
|
+
let O = n;
|
|
1549
1549
|
for (; p < b; ) {
|
|
1550
1550
|
const f = a[p++], h = a[p++];
|
|
1551
1551
|
try {
|
|
1552
|
-
|
|
1552
|
+
O = f(O);
|
|
1553
1553
|
} catch (m) {
|
|
1554
1554
|
h.call(this, m);
|
|
1555
1555
|
break;
|
|
1556
1556
|
}
|
|
1557
1557
|
}
|
|
1558
1558
|
try {
|
|
1559
|
-
l = Je.call(this,
|
|
1559
|
+
l = Je.call(this, O);
|
|
1560
1560
|
} catch (f) {
|
|
1561
1561
|
return Promise.reject(f);
|
|
1562
1562
|
}
|
|
@@ -1755,34 +1755,34 @@ function bt(e) {
|
|
|
1755
1755
|
return bt($(e, s));
|
|
1756
1756
|
}, n;
|
|
1757
1757
|
}
|
|
1758
|
-
const
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1758
|
+
const _ = bt(X);
|
|
1759
|
+
_.Axios = j;
|
|
1760
|
+
_.CanceledError = G;
|
|
1761
|
+
_.CancelToken = tr;
|
|
1762
|
+
_.isCancel = ft;
|
|
1763
|
+
_.VERSION = yt;
|
|
1764
|
+
_.toFormData = le;
|
|
1765
|
+
_.AxiosError = w;
|
|
1766
|
+
_.Cancel = _.CanceledError;
|
|
1767
|
+
_.all = function(t) {
|
|
1768
1768
|
return Promise.all(t);
|
|
1769
1769
|
};
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1770
|
+
_.spread = nr;
|
|
1771
|
+
_.isAxiosError = rr;
|
|
1772
|
+
_.mergeConfig = $;
|
|
1773
|
+
_.AxiosHeaders = N;
|
|
1774
|
+
_.formToJSON = (e) => ut(c.isHTMLForm(e) ? new FormData(e) : e);
|
|
1775
|
+
_.getAdapter = wt.getAdapter;
|
|
1776
|
+
_.HttpStatusCode = be;
|
|
1777
|
+
_.default = _;
|
|
1778
1778
|
const {
|
|
1779
1779
|
Axios: Er,
|
|
1780
1780
|
AxiosError: br,
|
|
1781
1781
|
CanceledError: gr,
|
|
1782
1782
|
isCancel: Sr,
|
|
1783
1783
|
CancelToken: Rr,
|
|
1784
|
-
VERSION:
|
|
1785
|
-
all:
|
|
1784
|
+
VERSION: _r,
|
|
1785
|
+
all: Or,
|
|
1786
1786
|
Cancel: Tr,
|
|
1787
1787
|
isAxiosError: Ar,
|
|
1788
1788
|
spread: Cr,
|
|
@@ -1790,13 +1790,13 @@ const {
|
|
|
1790
1790
|
AxiosHeaders: xr,
|
|
1791
1791
|
HttpStatusCode: Pr,
|
|
1792
1792
|
formToJSON: Dr,
|
|
1793
|
-
getAdapter:
|
|
1794
|
-
mergeConfig:
|
|
1795
|
-
} =
|
|
1793
|
+
getAdapter: Ur,
|
|
1794
|
+
mergeConfig: Fr
|
|
1795
|
+
} = _, sr = "https://customers-services.tarxemo.com/api";
|
|
1796
1796
|
class or {
|
|
1797
1797
|
constructor(t, n = sr) {
|
|
1798
1798
|
Pe(this, "client");
|
|
1799
|
-
this.client =
|
|
1799
|
+
this.client = _.create({
|
|
1800
1800
|
baseURL: n,
|
|
1801
1801
|
headers: {
|
|
1802
1802
|
"Content-Type": "application/json",
|
|
@@ -1889,7 +1889,7 @@ function cr(e) {
|
|
|
1889
1889
|
Ge(() => {
|
|
1890
1890
|
b.current = new or(t, n);
|
|
1891
1891
|
}, [t, n]);
|
|
1892
|
-
const
|
|
1892
|
+
const O = ee(() => {
|
|
1893
1893
|
p(null);
|
|
1894
1894
|
}, []), f = ee(
|
|
1895
1895
|
async (S) => {
|
|
@@ -1908,24 +1908,24 @@ function cr(e) {
|
|
|
1908
1908
|
};
|
|
1909
1909
|
o((g) => [...g, R]), u(!0), p(null);
|
|
1910
1910
|
try {
|
|
1911
|
-
const g = await b.current.sendMessage(S, i),
|
|
1911
|
+
const g = await b.current.sendMessage(S, i), E = {
|
|
1912
1912
|
id: `assistant_${Date.now()}`,
|
|
1913
1913
|
role: "ASSISTANT",
|
|
1914
1914
|
content: g.answer,
|
|
1915
1915
|
timestamp: /* @__PURE__ */ new Date(),
|
|
1916
1916
|
sources: g.sources
|
|
1917
1917
|
};
|
|
1918
|
-
o((T) => [...T,
|
|
1918
|
+
o((T) => [...T, E]), g.session_id !== i && a(g.session_id);
|
|
1919
1919
|
} catch (g) {
|
|
1920
|
-
const
|
|
1921
|
-
p(
|
|
1920
|
+
const E = g instanceof Error ? g : new Error("Failed to send message");
|
|
1921
|
+
p(E), r == null || r(E);
|
|
1922
1922
|
const T = {
|
|
1923
1923
|
id: `error_${Date.now()}`,
|
|
1924
1924
|
role: "ASSISTANT",
|
|
1925
|
-
content: `Sorry, I encountered an error: ${
|
|
1925
|
+
content: `Sorry, I encountered an error: ${E.message}`,
|
|
1926
1926
|
timestamp: /* @__PURE__ */ new Date()
|
|
1927
1927
|
};
|
|
1928
|
-
o((
|
|
1928
|
+
o((F) => [...F, T]);
|
|
1929
1929
|
} finally {
|
|
1930
1930
|
u(!1);
|
|
1931
1931
|
}
|
|
@@ -1935,9 +1935,9 @@ function cr(e) {
|
|
|
1935
1935
|
if (!(!b.current || !i)) {
|
|
1936
1936
|
u(!0), p(null);
|
|
1937
1937
|
try {
|
|
1938
|
-
const R = (await b.current.getConversationHistory(i)).messages.map((g,
|
|
1939
|
-
id: `${g.role.toLowerCase()}_${
|
|
1940
|
-
role: g.role,
|
|
1938
|
+
const R = (await b.current.getConversationHistory(i)).messages.map((g, E) => ({
|
|
1939
|
+
id: `${g.role.toLowerCase()}_${E}_${Date.now()}`,
|
|
1940
|
+
role: g.role.toUpperCase(),
|
|
1941
1941
|
content: g.content,
|
|
1942
1942
|
timestamp: new Date(g.created_at)
|
|
1943
1943
|
}));
|
|
@@ -1957,15 +1957,15 @@ function cr(e) {
|
|
|
1957
1957
|
sendMessage: f,
|
|
1958
1958
|
isLoading: d,
|
|
1959
1959
|
error: l,
|
|
1960
|
-
clearError:
|
|
1960
|
+
clearError: O,
|
|
1961
1961
|
sessionId: i,
|
|
1962
1962
|
loadHistory: h,
|
|
1963
1963
|
clearHistory: m
|
|
1964
1964
|
};
|
|
1965
1965
|
}
|
|
1966
1966
|
const lr = ({ message: e }) => {
|
|
1967
|
-
const t = e.role === "USER", n = e.timestamp instanceof Date ? e.timestamp : new Date(e.timestamp);
|
|
1968
|
-
return /* @__PURE__ */
|
|
1967
|
+
const t = e.role.toUpperCase() === "USER", n = e.timestamp instanceof Date ? e.timestamp : new Date(e.timestamp);
|
|
1968
|
+
return /* @__PURE__ */ y.createElement("div", { className: `cs-message ${t ? "cs-message--user" : "cs-message--assistant"}` }, /* @__PURE__ */ y.createElement("div", { className: "cs-message__content" }, /* @__PURE__ */ y.createElement("p", { className: "cs-message__text" }, e.content), e.sources && e.sources.length > 0 && /* @__PURE__ */ y.createElement("div", { className: "cs-message__sources" }, /* @__PURE__ */ y.createElement("p", { className: "cs-message__sources-title" }, "Sources:"), /* @__PURE__ */ y.createElement("ul", { className: "cs-message__sources-list" }, e.sources.map((r, s) => /* @__PURE__ */ y.createElement("li", { key: s, className: "cs-message__source-item" }, /* @__PURE__ */ y.createElement(
|
|
1969
1969
|
"a",
|
|
1970
1970
|
{
|
|
1971
1971
|
href: r.url,
|
|
@@ -1973,9 +1973,9 @@ const lr = ({ message: e }) => {
|
|
|
1973
1973
|
rel: "noopener noreferrer",
|
|
1974
1974
|
className: "cs-message__source-link"
|
|
1975
1975
|
},
|
|
1976
|
-
/* @__PURE__ */
|
|
1977
|
-
/* @__PURE__ */
|
|
1978
|
-
), /* @__PURE__ */
|
|
1976
|
+
/* @__PURE__ */ y.createElement(_t, { size: 12 }),
|
|
1977
|
+
/* @__PURE__ */ y.createElement("span", null, r.title)
|
|
1978
|
+
), /* @__PURE__ */ y.createElement("span", { className: "cs-message__source-similarity" }, Math.round(r.similarity * 100), "% match")))))), /* @__PURE__ */ y.createElement("time", { className: "cs-message__time", dateTime: n.toISOString() }, n.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })));
|
|
1979
1979
|
}, ur = ({
|
|
1980
1980
|
onSendMessage: e,
|
|
1981
1981
|
isLoading: t,
|
|
@@ -1986,7 +1986,7 @@ const lr = ({ message: e }) => {
|
|
|
1986
1986
|
}, i = (a) => {
|
|
1987
1987
|
a.key === "Enter" && !a.shiftKey && (a.preventDefault(), o(a));
|
|
1988
1988
|
};
|
|
1989
|
-
return /* @__PURE__ */
|
|
1989
|
+
return /* @__PURE__ */ y.createElement("form", { className: "cs-input", onSubmit: o }, /* @__PURE__ */ y.createElement(
|
|
1990
1990
|
"textarea",
|
|
1991
1991
|
{
|
|
1992
1992
|
className: "cs-input__textarea",
|
|
@@ -1998,7 +1998,7 @@ const lr = ({ message: e }) => {
|
|
|
1998
1998
|
rows: 1,
|
|
1999
1999
|
"aria-label": "Message input"
|
|
2000
2000
|
}
|
|
2001
|
-
), /* @__PURE__ */
|
|
2001
|
+
), /* @__PURE__ */ y.createElement(
|
|
2002
2002
|
"button",
|
|
2003
2003
|
{
|
|
2004
2004
|
type: "submit",
|
|
@@ -2006,7 +2006,7 @@ const lr = ({ message: e }) => {
|
|
|
2006
2006
|
disabled: !r.trim() || t,
|
|
2007
2007
|
"aria-label": "Send message"
|
|
2008
2008
|
},
|
|
2009
|
-
/* @__PURE__ */
|
|
2009
|
+
/* @__PURE__ */ y.createElement(Ot, { size: 20 })
|
|
2010
2010
|
));
|
|
2011
2011
|
}, fr = ({
|
|
2012
2012
|
messages: e,
|
|
@@ -2021,15 +2021,15 @@ const lr = ({ message: e }) => {
|
|
|
2021
2021
|
return Ge(() => {
|
|
2022
2022
|
var d;
|
|
2023
2023
|
(d = a.current) == null || d.scrollIntoView({ behavior: "smooth" });
|
|
2024
|
-
}, [e]), /* @__PURE__ */
|
|
2024
|
+
}, [e]), /* @__PURE__ */ y.createElement("div", { className: "cs-window" }, /* @__PURE__ */ y.createElement("div", { className: "cs-window__header" }, /* @__PURE__ */ y.createElement("div", { className: "cs-window__header-info" }, /* @__PURE__ */ y.createElement("h3", { className: "cs-window__title" }, "Customer Support"), /* @__PURE__ */ y.createElement("div", { className: "cs-window__status" }, /* @__PURE__ */ y.createElement("span", { className: "cs-window__status-dot" }), /* @__PURE__ */ y.createElement("span", null, "Online"))), /* @__PURE__ */ y.createElement(
|
|
2025
2025
|
"button",
|
|
2026
2026
|
{
|
|
2027
2027
|
className: "cs-window__close",
|
|
2028
2028
|
onClick: n,
|
|
2029
2029
|
"aria-label": "Close chat"
|
|
2030
2030
|
},
|
|
2031
|
-
/* @__PURE__ */
|
|
2032
|
-
)), /* @__PURE__ */
|
|
2031
|
+
/* @__PURE__ */ y.createElement(Tt, { size: 20 })
|
|
2032
|
+
)), /* @__PURE__ */ y.createElement("div", { className: "cs-window__messages" }, e.length === 0 && !r && /* @__PURE__ */ y.createElement("div", { className: "cs-window__welcome" }, /* @__PURE__ */ y.createElement("p", null, i)), e.map((d) => /* @__PURE__ */ y.createElement(lr, { key: d.id, message: d })), r && /* @__PURE__ */ y.createElement("div", { className: "cs-window__typing" }, /* @__PURE__ */ y.createElement(At, { size: 20, className: "cs-window__typing-icon" }), /* @__PURE__ */ y.createElement("span", null, "Thinking...")), s && /* @__PURE__ */ y.createElement("div", { className: "cs-window__error" }, /* @__PURE__ */ y.createElement("p", null, s.message)), /* @__PURE__ */ y.createElement("div", { ref: a })), /* @__PURE__ */ y.createElement("div", { className: "cs-window__input-wrapper" }, /* @__PURE__ */ y.createElement(
|
|
2033
2033
|
ur,
|
|
2034
2034
|
{
|
|
2035
2035
|
onSendMessage: t,
|
|
@@ -2051,7 +2051,7 @@ const lr = ({ message: e }) => {
|
|
|
2051
2051
|
}) => {
|
|
2052
2052
|
const [l, p] = J(!1), {
|
|
2053
2053
|
messages: b,
|
|
2054
|
-
sendMessage:
|
|
2054
|
+
sendMessage: O,
|
|
2055
2055
|
isLoading: f,
|
|
2056
2056
|
error: h,
|
|
2057
2057
|
clearError: m
|
|
@@ -2059,24 +2059,24 @@ const lr = ({ message: e }) => {
|
|
|
2059
2059
|
apiKey: e,
|
|
2060
2060
|
baseUrl: t,
|
|
2061
2061
|
onError: a
|
|
2062
|
-
}), S =
|
|
2063
|
-
const
|
|
2064
|
-
return
|
|
2065
|
-
}, [n]), R = async (
|
|
2066
|
-
if (d == null || d(
|
|
2062
|
+
}), S = y.useMemo(() => {
|
|
2063
|
+
const E = {};
|
|
2064
|
+
return E["--cs-primary-color"] = (n == null ? void 0 : n.primaryColor) || "#6366f1", E["--cs-secondary-color"] = (n == null ? void 0 : n.secondaryColor) || (n == null ? void 0 : n.primaryColor) || "#8b5cf6", E["--cs-bg-color"] = (n == null ? void 0 : n.backgroundColor) || "#ffffff", E["--cs-text-color"] = (n == null ? void 0 : n.textColor) || "#1f2937", E["--cs-font-family"] = (n == null ? void 0 : n.fontFamily) || "inherit", E["--cs-border-radius"] = (n == null ? void 0 : n.borderRadius) || "12px", E["--cs-button-color"] = (n == null ? void 0 : n.buttonColor) || (n == null ? void 0 : n.primaryColor) || "#6366f1", E["--cs-user-message-color"] = (n == null ? void 0 : n.userMessageColor) || (n == null ? void 0 : n.primaryColor) || "#6366f1", E["--cs-assistant-message-color"] = (n == null ? void 0 : n.assistantMessageColor) || "#f3f4f6", n != null && n.primaryColor && (E["--cs-focus-ring"] = `${n.primaryColor}33`), E;
|
|
2065
|
+
}, [n]), R = async (E) => {
|
|
2066
|
+
if (d == null || d(E), await O(E), !h) {
|
|
2067
2067
|
const T = b[b.length - 1];
|
|
2068
2068
|
(T == null ? void 0 : T.role) === "ASSISTANT" && (u == null || u(T.content));
|
|
2069
2069
|
}
|
|
2070
2070
|
}, g = () => {
|
|
2071
2071
|
p(!l), h && m();
|
|
2072
2072
|
};
|
|
2073
|
-
return /* @__PURE__ */
|
|
2073
|
+
return /* @__PURE__ */ y.createElement(
|
|
2074
2074
|
"div",
|
|
2075
2075
|
{
|
|
2076
2076
|
className: `cs-widget cs-widget--${r} ${l ? "cs-widget--open" : ""} ${i}`,
|
|
2077
2077
|
style: S
|
|
2078
2078
|
},
|
|
2079
|
-
l && /* @__PURE__ */
|
|
2079
|
+
l && /* @__PURE__ */ y.createElement(
|
|
2080
2080
|
fr,
|
|
2081
2081
|
{
|
|
2082
2082
|
messages: b,
|
|
@@ -2088,7 +2088,7 @@ const lr = ({ message: e }) => {
|
|
|
2088
2088
|
welcomeMessage: s
|
|
2089
2089
|
}
|
|
2090
2090
|
),
|
|
2091
|
-
/* @__PURE__ */
|
|
2091
|
+
/* @__PURE__ */ y.createElement(
|
|
2092
2092
|
"button",
|
|
2093
2093
|
{
|
|
2094
2094
|
className: `cs-widget__toggle ${l ? "cs-widget__toggle--open" : ""}`,
|
|
@@ -2096,8 +2096,8 @@ const lr = ({ message: e }) => {
|
|
|
2096
2096
|
"aria-label": l ? "Close chat" : "Open chat",
|
|
2097
2097
|
"aria-expanded": l
|
|
2098
2098
|
},
|
|
2099
|
-
/* @__PURE__ */
|
|
2100
|
-
!l && b.length > 0 && /* @__PURE__ */
|
|
2099
|
+
/* @__PURE__ */ y.createElement(Ct, { size: 24 }),
|
|
2100
|
+
!l && b.length > 0 && /* @__PURE__ */ y.createElement("span", { className: "cs-widget__badge" }, b.filter((E) => E.role === "ASSISTANT").length)
|
|
2101
2101
|
)
|
|
2102
2102
|
);
|
|
2103
2103
|
};
|