@opencx/widget 3.0.25 → 3.0.26

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/react.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useUploadFiles-B2xF0gMk.cjs");function a(t,s,u){const{widgetCtx:{api:i}}=e.useWidget();return e._default(async o=>o==="up"?i.vote({action:"upvote",messagePublicId:t,sessionId:s}).then(u):i.vote({action:"downvote",messagePublicId:t,sessionId:s}).then(u),[i,t,s,u])}exports.WidgetProvider=e.WidgetProvider;exports.useConfig=e.useConfig;exports.useContact=e.useContact;exports.useIsAwaitingBotReply=e.useIsAwaitingBotReply;exports.useMessages=e.useMessages;exports.usePreludeData=e.usePreludeData;exports.usePrimitiveState=e.usePrimitiveState;exports.useSessions=e.useSessions;exports.useUploadFiles=e.useUploadFiles;exports.useWidget=e.useWidget;exports.useWidgetRouter=e.useWidgetRouter;exports.useVote=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useUploadFiles-CYk-yx_p.cjs");function a(t,s,u){const{widgetCtx:{api:i}}=e.useWidget();return e._default(async o=>o==="up"?i.vote({action:"upvote",messagePublicId:t,sessionId:s}).then(u):i.vote({action:"downvote",messagePublicId:t,sessionId:s}).then(u),[i,t,s,u])}exports.WidgetProvider=e.WidgetProvider;exports.useConfig=e.useConfig;exports.useContact=e.useContact;exports.useIsAwaitingBotReply=e.useIsAwaitingBotReply;exports.useMessages=e.useMessages;exports.usePreludeData=e.usePreludeData;exports.usePrimitiveState=e.usePrimitiveState;exports.useSessions=e.useSessions;exports.useUploadFiles=e.useUploadFiles;exports.useWidget=e.useWidget;exports.useWidgetRouter=e.useWidgetRouter;exports.useVote=a;
2
2
  //# sourceMappingURL=react.cjs.map
package/dist/react.js CHANGED
@@ -1,5 +1,5 @@
1
- import { u as i, _ as o } from "./useUploadFiles-NW25TYrl.js";
2
- import { W as l, a as p, b as f, c as m, d as v, e as c, f as P, g as W, i as b, h } from "./useUploadFiles-NW25TYrl.js";
1
+ import { u as i, _ as o } from "./useUploadFiles-C0CkXRGg.js";
2
+ import { W as l, a as p, b as f, c as m, d as v, e as c, f as P, g as W, i as b, h } from "./useUploadFiles-C0CkXRGg.js";
3
3
  function n(e, t, s) {
4
4
  const { widgetCtx: { api: a } } = i();
5
5
  return o(
@@ -43,7 +43,7 @@ function nn(e) {
43
43
  return r;
44
44
  }, t.Provider];
45
45
  }
46
- const rn = "3.0.25", [z, on] = nn();
46
+ const rn = "3.0.26", [z, on] = nn();
47
47
  function tr({
48
48
  options: e,
49
49
  children: t,
@@ -94,9 +94,9 @@ function an() {
94
94
  };
95
95
  }
96
96
  function or() {
97
- var r;
98
- const { sessionState: e } = an(), { messagesState: t } = sn();
99
- return { isAwaitingBotReply: (((r = e.session) == null ? void 0 : r.assignee.kind) === "ai" || e.isCreatingSession) && t.isSendingMessage };
97
+ var s, i;
98
+ const { sessionState: e } = an(), { messagesState: t } = sn(), n = ((s = e.session) == null ? void 0 : s.assignee.kind) === "ai", r = ((i = t.messages.at(-1)) == null ? void 0 : i.type) === "FROM_USER";
99
+ return { isAwaitingBotReply: (n || e.isCreatingSession) && (t.isSendingMessage || r) };
100
100
  }
101
101
  var sr = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
102
102
  function ir(e) {
@@ -253,10 +253,10 @@ const G = () => {
253
253
  }, P = (
254
254
  /*#__NOINLINE__*/
255
255
  G()
256
- ), we = Object, g = (e) => e === P, N = (e) => typeof e == "function", $ = (e, t) => ({
256
+ ), we = Object, g = (e) => e === P, M = (e) => typeof e == "function", $ = (e, t) => ({
257
257
  ...e,
258
258
  ...t
259
- }), dn = (e) => N(e.then), ce = /* @__PURE__ */ new WeakMap();
259
+ }), dn = (e) => M(e.then), ce = /* @__PURE__ */ new WeakMap();
260
260
  let pn = 0;
261
261
  const se = (e) => {
262
262
  const t = typeof e, n = e && e.constructor, r = n == Date;
@@ -326,8 +326,8 @@ const _n = () => Ae, [xe, je] = he && window.addEventListener ? [
326
326
  }, Qe = !k.useId, ie = !he || "Deno" in window, wn = (e) => hn() ? window.requestAnimationFrame(e) : setTimeout(e, 1), be = ie ? st : Yt, Oe = typeof navigator < "u" && navigator.connection, Ze = !ie && Oe && ([
327
327
  "slow-2g",
328
328
  "2g"
329
- ].includes(Oe.effectiveType) || Oe.saveData), Ne = (e) => {
330
- if (N(e))
329
+ ].includes(Oe.effectiveType) || Oe.saveData), Me = (e) => {
330
+ if (M(e))
331
331
  try {
332
332
  e = e();
333
333
  } catch {
@@ -359,7 +359,7 @@ async function ft(...e) {
359
359
  const d = s.rollbackOnError;
360
360
  let h = s.optimisticData;
361
361
  const f = (l) => typeof d == "function" ? d(l) : d !== !1, a = s.throwOnError;
362
- if (N(n)) {
362
+ if (M(n)) {
363
363
  const l = n, c = [], y = t.keys();
364
364
  for (const _ of y)
365
365
  // Skip the special useSWRInfinite and useSWRSubscription keys.
@@ -368,11 +368,11 @@ async function ft(...e) {
368
368
  }
369
369
  return u(n);
370
370
  async function u(l) {
371
- const [c] = Ne(l);
371
+ const [c] = Me(l);
372
372
  if (!c) return;
373
373
  const [y, _] = it(t, c), [T, p, Y, O] = W.get(t), E = () => {
374
374
  const V = T[c];
375
- return (N(s.revalidate) ? s.revalidate(y().data, l) : s.revalidate !== !1) && (delete Y[c], delete O[c], V && V[0]) ? V[0](ct).then(() => y().data) : y().data;
375
+ return (M(s.revalidate) ? s.revalidate(y().data, l) : s.revalidate !== !1) && (delete Y[c], delete O[c], V && V[0]) ? V[0](ct).then(() => y().data) : y().data;
376
376
  };
377
377
  if (e.length < 3)
378
378
  return E();
@@ -383,10 +383,10 @@ async function ft(...e) {
383
383
  0
384
384
  ];
385
385
  const w = !g(h), C = y(), j = C.data, q = C._c, K = g(q) ? j : q;
386
- if (w && (h = N(h) ? h(K, j) : h, _({
386
+ if (w && (h = M(h) ? h(K, j) : h, _({
387
387
  data: h,
388
388
  _c: K
389
- })), N(S))
389
+ })), M(S))
390
390
  try {
391
391
  S = S(K);
392
392
  } catch (V) {
@@ -403,7 +403,7 @@ async function ft(...e) {
403
403
  _c: P
404
404
  }));
405
405
  if (i && !v)
406
- if (N(i)) {
406
+ if (M(i)) {
407
407
  const V = i(S, K);
408
408
  _({
409
409
  data: V,
@@ -509,7 +509,7 @@ const et = (e, t) => {
509
509
  return n;
510
510
  }, xn = rt({}), jn = "$inf$", dt = he && window.__SWR_DEVTOOLS_USE__, Pn = dt ? window.__SWR_DEVTOOLS_USE__ : [], Ln = () => {
511
511
  dt && (window.__SWR_DEVTOOLS_REACT__ = k);
512
- }, In = (e) => N(e[1]) ? [
512
+ }, In = (e) => M(e[1]) ? [
513
513
  e[0],
514
514
  e[1],
515
515
  e[2] || {}
@@ -518,15 +518,15 @@ const et = (e, t) => {
518
518
  null,
519
519
  (e[1] === null ? e[2] : e[1]) || {}
520
520
  ], Vn = () => $(Dn, ot(xn)), Fn = (e) => (t, n, r) => e(t, n && ((...s) => {
521
- const [i] = Ne(t), [, , , d] = W.get(lt);
521
+ const [i] = Me(t), [, , , d] = W.get(lt);
522
522
  if (i.startsWith(jn))
523
523
  return n(...s);
524
524
  const h = d[i];
525
525
  return g(h) ? n(...s) : (delete d[i], h);
526
- }), r), Nn = Pn.concat(Fn), Mn = (e) => function(...n) {
526
+ }), r), Mn = Pn.concat(Fn), Nn = (e) => function(...n) {
527
527
  const r = Vn(), [o, s, i] = In(n), d = An(r, i);
528
528
  let h = e;
529
- const { use: f } = d, a = (f || []).concat(Nn);
529
+ const { use: f } = d, a = (f || []).concat(Mn);
530
530
  for (let u = a.length; u--; )
531
531
  h = a[u](h);
532
532
  return h(o, s || d.fetcher || null, d);
@@ -551,7 +551,7 @@ const tt = k.use || ((e) => {
551
551
  }), Re = {
552
552
  dedupe: !0
553
553
  }, Wn = (e, t, n) => {
554
- const { cache: r, compare: o, suspense: s, fallbackData: i, revalidateOnMount: d, revalidateIfStale: h, refreshInterval: f, refreshWhenHidden: a, refreshWhenOffline: u, keepPreviousData: l } = n, [c, y, _, T] = W.get(r), [p, Y] = Ne(e), O = H(!1), E = H(!1), S = H(p), v = H(t), L = H(n), w = () => L.current, C = () => w().isVisible() && w().isOnline(), [j, q, K, V] = it(r, p), J = H({}).current, qt = g(i) ? n.fallback[p] : i, Ue = (m, b) => {
554
+ const { cache: r, compare: o, suspense: s, fallbackData: i, revalidateOnMount: d, revalidateIfStale: h, refreshInterval: f, refreshWhenHidden: a, refreshWhenOffline: u, keepPreviousData: l } = n, [c, y, _, T] = W.get(r), [p, Y] = Me(e), O = H(!1), E = H(!1), S = H(p), v = H(t), L = H(n), w = () => L.current, C = () => w().isVisible() && w().isOnline(), [j, q, K, V] = it(r, p), J = H({}).current, qt = g(i) ? n.fallback[p] : i, Ue = (m, b) => {
555
555
  for (const A in J) {
556
556
  const R = A;
557
557
  if (R === "data") {
@@ -563,12 +563,12 @@ const tt = k.use || ((e) => {
563
563
  return !0;
564
564
  }, We = Ve(() => {
565
565
  const m = !p || !t ? !1 : g(d) ? w().isPaused() || s ? !1 : g(h) ? !0 : h : d, b = (x) => {
566
- const M = $(x);
567
- return delete M._k, m ? {
566
+ const N = $(x);
567
+ return delete N._k, m ? {
568
568
  isValidating: !0,
569
569
  isLoading: !0,
570
- ...M
571
- } : M;
570
+ ...N
571
+ } : N;
572
572
  }, A = j(), R = V(), F = b(A), ee = A === R ? F : b(R);
573
573
  let D = F;
574
574
  return [
@@ -596,11 +596,11 @@ const tt = k.use || ((e) => {
596
596
  if (!p || !b || E.current || w().isPaused())
597
597
  return !1;
598
598
  let A, R, F = !0;
599
- const ee = m || {}, D = !_[p] || !ee.dedupe, x = () => Qe ? !E.current && p === S.current && O.current : p === S.current, M = {
599
+ const ee = m || {}, D = !_[p] || !ee.dedupe, x = () => Qe ? !E.current && p === S.current && O.current : p === S.current, N = {
600
600
  isValidating: !1,
601
601
  isLoading: !1
602
602
  }, Ke = () => {
603
- q(M);
603
+ q(N);
604
604
  }, ke = () => {
605
605
  const I = _[p];
606
606
  I && I[1] === R && delete _[p];
@@ -616,7 +616,7 @@ const tt = k.use || ((e) => {
616
616
  Pe()
617
617
  ]), [A, R] = _[p], A = await A, D && setTimeout(ke, n.dedupingInterval), !_[p] || _[p][1] !== R)
618
618
  return D && x() && w().onDiscarded(p), !1;
619
- M.error = P;
619
+ N.error = P;
620
620
  const I = y[p];
621
621
  if (!g(I) && // case 1
622
622
  (R <= I[0] || // case 2
@@ -624,11 +624,11 @@ const tt = k.use || ((e) => {
624
624
  I[1] === 0))
625
625
  return Ke(), D && x() && w().onDiscarded(p), !1;
626
626
  const U = j().data;
627
- M.data = o(U, A) ? U : A, D && x() && w().onSuccess(A, p, n);
627
+ N.data = o(U, A) ? U : A, D && x() && w().onSuccess(A, p, n);
628
628
  } catch (I) {
629
629
  ke();
630
630
  const U = w(), { shouldRetryOnError: ye } = U;
631
- U.isPaused() || (M.error = I, D && x() && (U.onError(I, p, U), (ye === !0 || N(ye) && ye(I)) && (!w().revalidateOnFocus || !w().revalidateOnReconnect || C()) && U.onErrorRetry(I, p, U, ($t) => {
631
+ U.isPaused() || (N.error = I, D && x() && (U.onError(I, p, U), (ye === !0 || M(ye) && ye(I)) && (!w().revalidateOnFocus || !w().revalidateOnReconnect || C()) && U.onErrorRetry(I, p, U, ($t) => {
632
632
  const ge = c[p];
633
633
  ge && ge[0] && ge[0](re.ERROR_REVALIDATE_EVENT, $t);
634
634
  }, {
@@ -688,7 +688,7 @@ const tt = k.use || ((e) => {
688
688
  ]), be(() => {
689
689
  let m;
690
690
  function b() {
691
- const R = N(f) ? f(j().data) : f;
691
+ const R = M(f) ? f(j().data) : f;
692
692
  R && m !== -1 && (m = setTimeout(A, R));
693
693
  }
694
694
  function A() {
@@ -732,7 +732,7 @@ const tt = k.use || ((e) => {
732
732
  return J.isLoading = !0, Gt;
733
733
  }
734
734
  };
735
- }, qn = Mn(Wn);
735
+ }, qn = Nn(Wn);
736
736
  function ar() {
737
737
  const { widgetCtx: e } = z();
738
738
  return qn([e.config.token], e.api.widgetPrelude, {
@@ -936,7 +936,7 @@ function pe(e) {
936
936
  };
937
937
  throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
938
938
  }
939
- function Me(e, t) {
939
+ function Ne(e, t) {
940
940
  var n = typeof Symbol == "function" && e[Symbol.iterator];
941
941
  if (!n) return e;
942
942
  var r = n.call(e), o, s = [], i;
@@ -955,7 +955,7 @@ function Me(e, t) {
955
955
  }
956
956
  function Tt() {
957
957
  for (var e = [], t = 0; t < arguments.length; t++)
958
- e = e.concat(Me(arguments[t]));
958
+ e = e.concat(Ne(arguments[t]));
959
959
  return e;
960
960
  }
961
961
  function Ct() {
@@ -1071,11 +1071,11 @@ function Ft(e, t, n, r, o) {
1071
1071
  if (typeof t == "function" ? e !== t || !o : !t.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
1072
1072
  return r === "a" ? o.call(e, n) : o ? o.value = n : t.set(e, n), n;
1073
1073
  }
1074
- function Nt(e, t) {
1074
+ function Mt(e, t) {
1075
1075
  if (t === null || typeof t != "object" && typeof t != "function") throw new TypeError("Cannot use 'in' operator on non-object");
1076
1076
  return typeof e == "function" ? t === e : e.has(t);
1077
1077
  }
1078
- function Mt(e, t, n) {
1078
+ function Nt(e, t, n) {
1079
1079
  if (t != null) {
1080
1080
  if (typeof t != "object" && typeof t != "function") throw new TypeError("Object expected.");
1081
1081
  var r, o;
@@ -1146,7 +1146,7 @@ const Gn = {
1146
1146
  __createBinding: _e,
1147
1147
  __exportStar: Rt,
1148
1148
  __values: pe,
1149
- __read: Me,
1149
+ __read: Ne,
1150
1150
  __spread: Tt,
1151
1151
  __spreadArrays: Ct,
1152
1152
  __spreadArray: Dt,
@@ -1159,13 +1159,13 @@ const Gn = {
1159
1159
  __importDefault: It,
1160
1160
  __classPrivateFieldGet: Vt,
1161
1161
  __classPrivateFieldSet: Ft,
1162
- __classPrivateFieldIn: Nt,
1163
- __addDisposableResource: Mt,
1162
+ __classPrivateFieldIn: Mt,
1163
+ __addDisposableResource: Nt,
1164
1164
  __disposeResources: Ut,
1165
1165
  __rewriteRelativeImportExtension: Wt
1166
1166
  }, $n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1167
1167
  __proto__: null,
1168
- __addDisposableResource: Mt,
1168
+ __addDisposableResource: Nt,
1169
1169
  get __assign() {
1170
1170
  return de;
1171
1171
  },
@@ -1175,7 +1175,7 @@ const Gn = {
1175
1175
  __await: te,
1176
1176
  __awaiter: bt,
1177
1177
  __classPrivateFieldGet: Vt,
1178
- __classPrivateFieldIn: Nt,
1178
+ __classPrivateFieldIn: Mt,
1179
1179
  __classPrivateFieldSet: Ft,
1180
1180
  __createBinding: _e,
1181
1181
  __decorate: yt,
@@ -1190,7 +1190,7 @@ const Gn = {
1190
1190
  __metadata: mt,
1191
1191
  __param: gt,
1192
1192
  __propKey: St,
1193
- __read: Me,
1193
+ __read: Ne,
1194
1194
  __rest: _t,
1195
1195
  __rewriteRelativeImportExtension: Wt,
1196
1196
  __runInitializers: vt,
@@ -1337,4 +1337,4 @@ export {
1337
1337
  Dt as n,
1338
1338
  z as u
1339
1339
  };
1340
- //# sourceMappingURL=useUploadFiles-NW25TYrl.js.map
1340
+ //# sourceMappingURL=useUploadFiles-C0CkXRGg.js.map