@opencx/widget-react 4.0.35 → 4.0.36

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/index.js CHANGED
@@ -38,12 +38,12 @@ const V = {
38
38
  )) return e;
39
39
  const y = (w) => {
40
40
  var N, S;
41
- const { clientX: k, clientY: I } = w, x = w.currentTarget.getBoundingClientRect(), M = k - (x.left + x.width / 2), O = I - (x.top + x.height / 2), F = Math.max(
41
+ const { clientX: k, clientY: I } = w, x = w.currentTarget.getBoundingClientRect(), M = k - (x.left + x.width / 2), H = I - (x.top + x.height / 2), F = Math.max(
42
42
  -1,
43
43
  Math.min(1, M / (x.width / 2))
44
44
  ), W = Math.max(
45
45
  -1,
46
- Math.min(1, O / (x.height / 2))
46
+ Math.min(1, H / (x.height / 2))
47
47
  ), R = F * V.x, f = W * V.y;
48
48
  d({ x: R, y: f }), (S = (N = e.props).onMouseMove) == null || S.call(N, w);
49
49
  }, v = () => {
@@ -91,15 +91,15 @@ const Er = 10, Rr = (e, o, t) => ({
91
91
  initial: { opacity: 0, y: e, ...o.initial },
92
92
  animate: { opacity: 1, y: 0, ...o.animate, transition: { delay: t } },
93
93
  exit: { opacity: 0, y: -e, ...o.exit }
94
- }), Hr = (e, o, t) => ({
94
+ }), Or = (e, o, t) => ({
95
95
  initial: { opacity: 0, y: -e, ...o.initial },
96
96
  animate: { opacity: 1, y: 0, ...o.animate, transition: { delay: t } },
97
97
  exit: { opacity: 0, y: e, ...o.exit }
98
- }), Or = {
98
+ }), Hr = {
99
99
  right: Rr,
100
100
  left: Pr,
101
101
  up: Ar,
102
- down: Hr
102
+ down: Or
103
103
  }, u = dt(
104
104
  ({
105
105
  fadeIn: e = "down",
@@ -110,7 +110,7 @@ const Er = 10, Rr = (e, o, t) => ({
110
110
  delay: a = 0,
111
111
  ...i
112
112
  }, l) => {
113
- const d = e ? Or[e](o, s, a) : {};
113
+ const d = e ? Hr[e](o, s, a) : {};
114
114
  return n && d.exit && typeof d.exit == "object" && !Array.isArray(d.exit) && (d.exit.transition = { duration: 0 }), /* @__PURE__ */ r(Z.div, { ref: l, ...i, ...d, children: t });
115
115
  }
116
116
  );
@@ -547,7 +547,7 @@ function J({
547
547
  ] });
548
548
  }
549
549
  const st = 450;
550
- function H() {
550
+ function O() {
551
551
  const [e, o] = U.useState(() => (window.top || window).innerWidth < st);
552
552
  return U.useEffect(() => {
553
553
  const t = window.top || window, n = () => {
@@ -563,8 +563,8 @@ const ie = {
563
563
  transitionDuration: "1000ms"
564
564
  };
565
565
  function q() {
566
- var v, m, z, w, k, I, x, M, O, F, W, R, f, N, S, B, se, _e, Ie, Te, Me, De, je, Ee, Re, Pe, Ae, He, Oe, Fe, We, $e, Le, Be, Ye, Ue, qe, Xe, Ve, Ge, Ke, Qe, Ze, Je, et, tt, rt;
567
- const { dir: e } = ve(), { isSmallScreen: o } = H(), { theme: t, inline: n } = b(), s = (Y) => n ? "100%" : Y, a = (Y, he) => o ? `100dv${Y}` : he, i = (Y, he) => s(a(Y, he)), l = {
566
+ var v, m, z, w, k, I, x, M, H, F, W, R, f, N, S, B, se, _e, Ie, Te, Me, De, je, Ee, Re, Pe, Ae, Oe, He, Fe, We, $e, Le, Be, Ye, Ue, qe, Xe, Ve, Ge, Ke, Qe, Ze, Je, et, tt, rt;
567
+ const { dir: e } = ve(), { isSmallScreen: o } = O(), { theme: t, inline: n } = b(), s = (Y) => n ? "100%" : Y, a = (Y, he) => o ? `100dv${Y}` : he, i = (Y, he) => s(a(Y, he)), l = {
568
568
  zIndex: ((v = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : v.zIndex) ?? 1e7,
569
569
  offset: {
570
570
  bottom: ((z = (m = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : m.offset) == null ? void 0 : z.bottom) ?? 20,
@@ -572,7 +572,7 @@ function q() {
572
572
  left: ((x = (I = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : I.offset) == null ? void 0 : x.left) ?? (e === "rtl" ? 20 : "initial")
573
573
  },
574
574
  size: {
575
- button: ((O = (M = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : M.size) == null ? void 0 : O.button) ?? 48,
575
+ button: ((H = (M = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : M.size) == null ? void 0 : H.button) ?? 48,
576
576
  icon: ((W = (F = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : F.size) == null ? void 0 : W.icon) ?? 24
577
577
  }
578
578
  }, d = (() => {
@@ -607,7 +607,7 @@ function q() {
607
607
  )
608
608
  },
609
609
  sessions: {
610
- width: i("w", ((Oe = (He = t == null ? void 0 : t.screens) == null ? void 0 : He.sessions) == null ? void 0 : Oe.width) ?? "450px"),
610
+ width: i("w", ((He = (Oe = t == null ? void 0 : t.screens) == null ? void 0 : Oe.sessions) == null ? void 0 : He.width) ?? "450px"),
611
611
  height: i("h", ((We = (Fe = t == null ? void 0 : t.screens) == null ? void 0 : Fe.sessions) == null ? void 0 : We.height) ?? "600px")
612
612
  },
613
613
  chat: {
@@ -783,7 +783,7 @@ function ze({
783
783
  width: e,
784
784
  height: o
785
785
  }) {
786
- const { isSmallScreen: t } = H(), { setWidth: n, setHeight: s } = Rt();
786
+ const { isSmallScreen: t } = O(), { setWidth: n, setHeight: s } = Rt();
787
787
  re(() => {
788
788
  e && n(e), o && s(o);
789
789
  }, [t, o, e, n, s]);
@@ -915,7 +915,7 @@ function Qr() {
915
915
  function Zr({
916
916
  button: e
917
917
  }) {
918
- const { setIsOpen: o } = K(), { isSmallScreen: t } = H();
918
+ const { setIsOpen: o } = K(), { isSmallScreen: t } = O();
919
919
  return t && e.hideOnSmallScreen || !t && e.hideOnLargeScreen ? null : /* @__PURE__ */ r(
920
920
  C,
921
921
  {
@@ -935,7 +935,7 @@ function ue({
935
935
  }) {
936
936
  const [o, t] = T(!1), {
937
937
  routerState: { screen: n }
938
- } = A(), { isSmallScreen: s } = H(), { theme: a } = q(), { setWidth: i, setHeight: l } = Rt();
938
+ } = A(), { isSmallScreen: s } = O(), { theme: a } = q(), { setWidth: i, setHeight: l } = Rt();
939
939
  if (n !== "chat" && n !== "sessions") return null;
940
940
  const d = (() => {
941
941
  switch (n) {
@@ -981,7 +981,7 @@ function Pt({
981
981
  button: e
982
982
  }) {
983
983
  var k, I;
984
- const { close: o } = pe(), { widgetCtx: t } = j(), { setIsOpen: n } = K(), { resolveSession: s, sessionState: a } = L(), { isSmallScreen: i } = H(), l = !a.session, d = ((k = a.session) == null ? void 0 : k.isOpened) === !1, h = e.onResolved || "stay-in-chat", y = e.behaviorBeforeSessionCreation || "disabled", v = e.behaviorIfSessionIsResolved || "disabled", m = !!(a.isResolvingSession || l && y === "disabled" || d && v === "disabled"), z = async () => {
984
+ const { close: o } = pe(), { widgetCtx: t } = j(), { setIsOpen: n } = K(), { resolveSession: s, sessionState: a } = L(), { isSmallScreen: i } = O(), l = !a.session, d = ((k = a.session) == null ? void 0 : k.isOpened) === !1, h = e.onResolved || "stay-in-chat", y = e.behaviorBeforeSessionCreation || "disabled", v = e.behaviorIfSessionIsResolved || "disabled", m = !!(a.isResolvingSession || l && y === "disabled" || d && v === "disabled"), z = async () => {
985
985
  const { success: x, error: M } = await s();
986
986
  if (o(), !x) return console.error(M);
987
987
  switch (h) {
@@ -1142,13 +1142,13 @@ function At() {
1142
1142
  /* @__PURE__ */ r(Vr, {})
1143
1143
  ] });
1144
1144
  }
1145
- function Ht({ className: e }) {
1145
+ function Ot({ className: e }) {
1146
1146
  return /* @__PURE__ */ r(wr, { className: p("size-4 animate-spin", e) });
1147
1147
  }
1148
1148
  function to() {
1149
1149
  const {
1150
1150
  messagesState: { isInitialFetchLoading: e }
1151
- } = E(), { isSmallScreen: o } = H(), { activeMode: t, Component: n } = mt();
1151
+ } = E(), { isSmallScreen: o } = O(), { activeMode: t, Component: n } = mt();
1152
1152
  return {
1153
1153
  isCanvasOpen: !e && !o && !!t && !!n
1154
1154
  };
@@ -1221,7 +1221,7 @@ const oo = [
1221
1221
  }
1222
1222
  ];
1223
1223
  function no() {
1224
- const { isSmallScreen: e } = H(), {
1224
+ const { isSmallScreen: e } = O(), {
1225
1225
  submitCsat: o,
1226
1226
  isCsatRequested: t,
1227
1227
  isCsatSubmitted: n,
@@ -1434,7 +1434,7 @@ function io({
1434
1434
  }
1435
1435
  function ao() {
1436
1436
  var R;
1437
- const { isSmallScreen: e } = H(), o = de(null), { sendMessage: t } = E(), { sessionState: n } = L(), { t: s } = X(), [a, i] = T(""), {
1437
+ const { isSmallScreen: e } = O(), o = de(null), { sendMessage: t } = E(), { sessionState: n } = L(), { t: s } = X(), [a, i] = T(""), {
1438
1438
  allFiles: l,
1439
1439
  emptyTheFiles: d,
1440
1440
  handleCancelUpload: h,
@@ -1463,7 +1463,7 @@ function ao() {
1463
1463
  }), i(""), d();
1464
1464
  }, {
1465
1465
  getRootProps: M,
1466
- getInputProps: O,
1466
+ getInputProps: H,
1467
1467
  open: F
1468
1468
  } = Dr({
1469
1469
  onDrop: k,
@@ -1493,7 +1493,7 @@ function ao() {
1493
1493
  className: "p-2 relative space-y-1",
1494
1494
  ...M(),
1495
1495
  children: [
1496
- /* @__PURE__ */ r("input", { ...O() }),
1496
+ /* @__PURE__ */ r("input", { ...H() }),
1497
1497
  /* @__PURE__ */ c(
1498
1498
  "div",
1499
1499
  {
@@ -1673,7 +1673,7 @@ function po({
1673
1673
  }
1674
1674
  );
1675
1675
  }
1676
- function Ot({
1676
+ function Ht({
1677
1677
  messages: e,
1678
1678
  className: o,
1679
1679
  containerClassName: t
@@ -1746,7 +1746,7 @@ function le({
1746
1746
  },
1747
1747
  n.id
1748
1748
  )),
1749
- /* @__PURE__ */ r(Ot, { messages: e })
1749
+ /* @__PURE__ */ r(Ht, { messages: e })
1750
1750
  ]
1751
1751
  }
1752
1752
  )
@@ -1838,7 +1838,7 @@ function go({
1838
1838
  },
1839
1839
  o.id
1840
1840
  )),
1841
- /* @__PURE__ */ r(Ot, { messages: e, containerClassName: "ms-auto" })
1841
+ /* @__PURE__ */ r(Ht, { messages: e, containerClassName: "ms-auto" })
1842
1842
  ]
1843
1843
  }
1844
1844
  );
@@ -2036,7 +2036,7 @@ function zo() {
2036
2036
  u,
2037
2037
  {
2038
2038
  className: "flex flex-col items-center justify-center w-full flex-1",
2039
- children: /* @__PURE__ */ r(Ht, {})
2039
+ children: /* @__PURE__ */ r(Ot, {})
2040
2040
  },
2041
2041
  "loading"
2042
2042
  ) : /* @__PURE__ */ c(
@@ -2204,7 +2204,7 @@ function Io() {
2204
2204
  u,
2205
2205
  {
2206
2206
  className: "flex-1 flex items-center justify-center",
2207
- children: /* @__PURE__ */ r(Ht, {})
2207
+ children: /* @__PURE__ */ r(Ot, {})
2208
2208
  },
2209
2209
  "loading"
2210
2210
  ) : /* @__PURE__ */ r(
@@ -2304,7 +2304,7 @@ function To() {
2304
2304
  }
2305
2305
  const ae = G.forwardRef(
2306
2306
  ({ className: e, type: o, ...t }, n) => {
2307
- const { isSmallScreen: s } = H();
2307
+ const { isSmallScreen: s } = O();
2308
2308
  return /* @__PURE__ */ r($, { ref: n, children: /* @__PURE__ */ r(
2309
2309
  "input",
2310
2310
  {
@@ -2350,10 +2350,10 @@ const Do = me.object({
2350
2350
  email: me.string().email()
2351
2351
  });
2352
2352
  function jo() {
2353
- var x, M, O, F, W, R, f, N;
2353
+ var x, M, H, F, W, R, f, N;
2354
2354
  const {
2355
2355
  widgetCtx: { org: e }
2356
- } = j(), { setIsOpen: o } = K(), { createUnverifiedContact: t } = qt(), { isSmallScreen: n } = H(), s = b(), { theme: a } = q(), { t: i } = X(), { observedElementRef: l } = Mo();
2356
+ } = j(), { setIsOpen: o } = K(), { createUnverifiedContact: t } = qt(), { isSmallScreen: n } = O(), s = b(), { theme: a } = q(), { t: i } = X(), { observedElementRef: l } = Mo();
2357
2357
  ze({
2358
2358
  height: void 0,
2359
2359
  width: a.screens.welcome.width
@@ -2409,7 +2409,7 @@ function jo() {
2409
2409
  ),
2410
2410
  children: [
2411
2411
  n && /* @__PURE__ */ r(u, { className: "absolute top-6 end-6", children: /* @__PURE__ */ r(C, { size: "selfless", onClick: () => o(!1), children: /* @__PURE__ */ r(xe, { className: "size-4" }) }) }),
2412
- /* @__PURE__ */ r("div", { className: "flex items-center justify-between w-full mb-2", children: (O = s.assets) != null && O.organizationLogo ? /* @__PURE__ */ r(
2412
+ /* @__PURE__ */ r("div", { className: "flex items-center justify-between w-full mb-2", children: (H = s.assets) != null && H.organizationLogo ? /* @__PURE__ */ r(
2413
2413
  "img",
2414
2414
  {
2415
2415
  src: (F = s.assets) == null ? void 0 : F.organizationLogo,
@@ -2535,7 +2535,7 @@ function Wt() {
2535
2535
  }
2536
2536
  })() }) });
2537
2537
  }
2538
- const Eo = "4.0.35", Ro = `<!DOCTYPE html>
2538
+ const Eo = "4.0.36", Ro = `<!DOCTYPE html>
2539
2539
  <html>
2540
2540
  <head>
2541
2541
  <style>
@@ -2649,6 +2649,8 @@ function Po() {
2649
2649
  },
2650
2650
  side: "top",
2651
2651
  align: "end",
2652
+ "aria-modal": "false",
2653
+ "aria-label": "Support chat",
2652
2654
  sideOffset: e.widgetContentContainer.offset.side,
2653
2655
  alignOffset: e.widgetContentContainer.offset.align,
2654
2656
  avoidCollisions: !1,
@@ -2691,7 +2693,7 @@ function Ao({
2691
2693
  }
2692
2694
  );
2693
2695
  }
2694
- const Ho = `<!DOCTYPE html>
2696
+ const Oo = `<!DOCTYPE html>
2695
2697
  <html>
2696
2698
  <head>
2697
2699
  <style>
@@ -2708,13 +2710,14 @@ html, body {
2708
2710
  <body>
2709
2711
  </body>
2710
2712
  </html>`;
2711
- function Oo() {
2713
+ function Ho() {
2712
2714
  var a, i;
2713
2715
  const { isOpen: e } = K(), { cssOverrides: o, assets: t } = b(), { theme: n, cssVars: s } = q();
2714
2716
  return /* @__PURE__ */ c(
2715
2717
  bt,
2716
2718
  {
2717
- initialContent: Ho,
2719
+ initialContent: Oo,
2720
+ title: "OpenCX Live Chat Trigger",
2718
2721
  style: {
2719
2722
  height: `calc(${n.widgetTrigger.size.button}px + ${V.x * 2}px)`,
2720
2723
  width: `calc(${n.widgetTrigger.size.button}px + ${V.y * 2}px)`,
@@ -2854,7 +2857,7 @@ function Wo() {
2854
2857
  const { isOpen: e, setIsOpen: o } = K();
2855
2858
  return /* @__PURE__ */ c(ce.Root, { open: e, onOpenChange: o, children: [
2856
2859
  /* @__PURE__ */ r(Fo, {}),
2857
- /* @__PURE__ */ r(Oo, {}),
2860
+ /* @__PURE__ */ r(Ho, {}),
2858
2861
  /* @__PURE__ */ r(Po, {})
2859
2862
  ] });
2860
2863
  }