@sendbird/ai-agent-messenger-react-native 1.3.0 → 1.3.2

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.d.ts CHANGED
@@ -895,7 +895,7 @@ declare type CSATSubmitParams = {
895
895
  resolutionScore?: number;
896
896
  };
897
897
 
898
- declare interface CustomMessageTemplateData {
898
+ export declare interface CustomMessageTemplateData {
899
899
  id: string;
900
900
  response: {
901
901
  status: number;
@@ -929,7 +929,7 @@ declare type ExpoImagePickerModule = typeof ExpoImagePicker;
929
929
  /**
930
930
  * For better understanding: https://sendbird.atlassian.net/wiki/spaces/AA/pages/3075014695/Extended+Message+Payload+Spec
931
931
  */
932
- declare interface ExtendedMessagePayload {
932
+ export declare interface ExtendedMessagePayload {
933
933
  is_thinking: boolean;
934
934
  cta_button: {
935
935
  label: string;
@@ -967,6 +967,7 @@ declare interface ExtendedMessagePayload {
967
967
  question: string;
968
968
  scores: number[]; // One or more CSAT scores that trigger this follow-up question.
969
969
  required?: boolean;
970
+ always_visible?: boolean; // Can only be enabled in Dashboard when there is exactly 1 follow-up item and scores are set to [1,2,3,4,5].
970
971
  }
971
972
  | {
972
973
  response_type: 'single_choice';
@@ -974,6 +975,7 @@ declare interface ExtendedMessagePayload {
974
975
  scores: number[]; // One or more CSAT scores that trigger this follow-up question.
975
976
  options: string[]; // Up to 5 predefined answer choices
976
977
  required?: boolean;
978
+ always_visible?: boolean; // Can only be enabled in Dashboard when there is exactly 1 follow-up item and scores are set to [1,2,3,4,5].
977
979
  }
978
980
  >;
979
981
  };
package/dist/index.js CHANGED
@@ -2,8 +2,8 @@ var wr = Object.defineProperty;
2
2
  var xr = (e, t, n) => t in e ? wr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var U = (e, t, n) => xr(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import * as s from "react";
5
- import { createContext as Gt, useContext as Ne, useLayoutEffect as Ce, useState as S, useEffect as M, useRef as F, useCallback as w, useMemo as K, forwardRef as st, useImperativeHandle as Ir, useId as qt, useReducer as Tr, memo as Ue, isValidElement as kr, Fragment as Mr, Children as Lr } from "react";
6
- import { StyleSheet as J, View as we, Animated as R, Image as We, Modal as Pr, I18nManager as Fe, Text as xt, TouchableOpacity as Dr, Pressable as jt, PanResponder as Rr, Easing as pe, FlatList as Or, Linking as ye, useWindowDimensions as Br, ScrollView as Un, KeyboardAvoidingView as Wn, TextInput as Yt, Platform as re, Alert as ke, Keyboard as ot, BackHandler as Nr } from "react-native";
5
+ import { createContext as Gt, useContext as Ne, useLayoutEffect as Ee, useState as S, useEffect as M, useRef as F, useCallback as w, useMemo as K, forwardRef as st, useImperativeHandle as Ir, useId as qt, useReducer as Tr, memo as Ue, isValidElement as kr, Fragment as Mr, Children as Lr } from "react";
6
+ import { StyleSheet as J, View as we, Animated as R, Image as We, Modal as Pr, I18nManager as Fe, Text as xt, TouchableOpacity as Dr, Pressable as jt, PanResponder as Rr, Easing as pe, FlatList as Or, Linking as ye, useWindowDimensions as Br, ScrollView as Un, KeyboardAvoidingView as Wn, TextInput as Yt, Platform as re, Alert as Te, Keyboard as ot, BackHandler as Nr } from "react-native";
7
7
  import { useSafeAreaInsets as at, SafeAreaProvider as Hr, SafeAreaInsetsContext as Vn } from "react-native-safe-area-context";
8
8
  import zr, { SendbirdChatOptions as Fr, SendbirdProduct as $r, DeviceOsPlatform as He, SendbirdPlatform as Gn, SessionHandler as Ur, ConnectionHandler as it, SendbirdError as Wr, LogLevel as Vr } from "@sendbird/chat";
9
9
  import { ConversationStatus as ee, AIAgentModule as Gr, AIAgentMessageFeedbackRating as bn } from "@sendbird/chat/aiAgent";
@@ -55,7 +55,7 @@ function ue(e) {
55
55
  }
56
56
  function r({ template: a, children: i }) {
57
57
  const { updateTemplate: l } = Ne(t);
58
- return Ce(() => {
58
+ return Ee(() => {
59
59
  a && l(a);
60
60
  }, [a]), /* @__PURE__ */ s.createElement(s.Fragment, null, i);
61
61
  }
@@ -67,7 +67,7 @@ function ue(e) {
67
67
  component: l
68
68
  }) {
69
69
  const { updateComponent: c } = Ne(t);
70
- return Ce(() => {
70
+ return Ee(() => {
71
71
  l && c(a, l);
72
72
  }, [l]), null;
73
73
  };
@@ -85,7 +85,7 @@ const xe = (e) => {
85
85
  var t, n;
86
86
  return !!(e != null && e.isAIAgent && ((t = e == null ? void 0 : e.conversation) == null ? void 0 : t.status) === ee.OPEN || e != null && e.isDesk && ((n = e == null ? void 0 : e.helpdeskInfo) == null ? void 0 : n.ticketStatus) === "open");
87
87
  };
88
- function Le(e) {
88
+ function Me(e) {
89
89
  var n, r, o;
90
90
  return typeof (((n = e == null ? void 0 : e.conversation) == null ? void 0 : n.handedOverAt) ?? ((o = (r = e == null ? void 0 : e.conversation) == null ? void 0 : r.handoff) == null ? void 0 : o.timestamp)) == "number";
91
91
  }
@@ -139,7 +139,8 @@ function Eo(e, t) {
139
139
  {
140
140
  response_type: "free_text",
141
141
  scores: [1, 2, 3, 4, 5],
142
- question: t.followUp.question
142
+ question: t.followUp.question,
143
+ always_visible: !1
143
144
  }
144
145
  ],
145
146
  csat_submit_label: t.submit_label,
@@ -155,7 +156,7 @@ function Co(e, t, n) {
155
156
  const r = /* @__PURE__ */ new Date(), o = new Date(((i = e.lastMessage) == null ? void 0 : i.createdAt) || e.createdAt), a = jr(r, o);
156
157
  return a < 1 ? n.justNow : a < 60 ? n.minutesAgo(a) : Yr(o) ? n.hoursAgo(Kr(r, o)) : t(o, n.dateShortFormat);
157
158
  }
158
- const Te = "sb-agent", Kn = "KEY_IMG_ASPECT_RATIO", Xn = "*/*", k = {
159
+ const Ie = "sb-agent", Kn = "KEY_IMG_ASPECT_RATIO", Xn = "*/*", k = {
159
160
  BODY_MAX_WIDTH: 244,
160
161
  AVATAR_SIZE: 26,
161
162
  BODY_TIME_GAP: 4,
@@ -271,7 +272,7 @@ const Sn = (e) => {
271
272
  var t;
272
273
  return !!((t = e.extendedMessagePayload) != null && t.feedback);
273
274
  }
274
- }, ut = `@${Te}`, An = ({ appId: e, aiAgentId: t, storage: n }) => {
275
+ }, ut = `@${Ie}`, An = ({ appId: e, aiAgentId: t, storage: n }) => {
275
276
  const r = {
276
277
  templateBase: `${ut}-template`,
277
278
  template: (o) => `${r.templateBase}/templates/${o}`,
@@ -372,19 +373,19 @@ class Qn {
372
373
  this.level = t;
373
374
  }
374
375
  verbose(...t) {
375
- this.level <= 0 && console.log(`[${Te}/verbose]`, ...t);
376
+ this.level <= 0 && console.log(`[${Ie}/verbose]`, ...t);
376
377
  }
377
378
  debug(...t) {
378
- this.level <= 1 && console.log(`[${Te}/debug]`, ...t);
379
+ this.level <= 1 && console.log(`[${Ie}/debug]`, ...t);
379
380
  }
380
381
  info(...t) {
381
- this.level <= 2 && console.log(`[${Te}/info]`, ...t);
382
+ this.level <= 2 && console.log(`[${Ie}/info]`, ...t);
382
383
  }
383
384
  warn(...t) {
384
- this.level <= 3 && console.warn(`[${Te}/warn]`, ...t);
385
+ this.level <= 3 && console.warn(`[${Ie}/warn]`, ...t);
385
386
  }
386
387
  error(...t) {
387
- this.level <= 4 && console.error(`[${Te}/error]`, ...t);
388
+ this.level <= 4 && console.error(`[${Ie}/error]`, ...t);
388
389
  }
389
390
  }
390
391
  function wn(e, t, n, r) {
@@ -407,7 +408,7 @@ function Bo(e) {
407
408
  };
408
409
  typeof e.groupChannel != "object" && t("GroupChannelModule"), typeof e.aiAgent != "object" && t("AIAgentModule");
409
410
  }
410
- const ve = {
411
+ const be = {
411
412
  conversation: {
412
413
  isTalkToAgentViewEnabled: !0,
413
414
  scrollMode: "auto",
@@ -432,33 +433,33 @@ const ve = {
432
433
  }, No = (e) => {
433
434
  var t, n, r, o, a, i, l, c, u, m, g, d, p, _;
434
435
  return e ? {
435
- ...ve,
436
+ ...be,
436
437
  ...e,
437
438
  conversation: {
438
- ...ve.conversation,
439
+ ...be.conversation,
439
440
  ...e == null ? void 0 : e.conversation,
440
441
  header: {
441
- ...(t = ve.conversation) == null ? void 0 : t.header,
442
+ ...(t = be.conversation) == null ? void 0 : t.header,
442
443
  ...(n = e == null ? void 0 : e.conversation) == null ? void 0 : n.header
443
444
  },
444
445
  input: {
445
- ...(r = ve.conversation) == null ? void 0 : r.input,
446
+ ...(r = be.conversation) == null ? void 0 : r.input,
446
447
  ...(o = e == null ? void 0 : e.conversation) == null ? void 0 : o.input,
447
448
  camera: {
448
- ...(i = (a = ve.conversation) == null ? void 0 : a.input) == null ? void 0 : i.camera,
449
+ ...(i = (a = be.conversation) == null ? void 0 : a.input) == null ? void 0 : i.camera,
449
450
  ...(c = (l = e == null ? void 0 : e.conversation) == null ? void 0 : l.input) == null ? void 0 : c.camera
450
451
  },
451
452
  gallery: {
452
- ...(m = (u = ve.conversation) == null ? void 0 : u.input) == null ? void 0 : m.gallery,
453
+ ...(m = (u = be.conversation) == null ? void 0 : u.input) == null ? void 0 : m.gallery,
453
454
  ...(d = (g = e == null ? void 0 : e.conversation) == null ? void 0 : g.input) == null ? void 0 : d.gallery
454
455
  }
455
456
  },
456
457
  fileViewer: {
457
- ...(p = ve.conversation) == null ? void 0 : p.fileViewer,
458
+ ...(p = be.conversation) == null ? void 0 : p.fileViewer,
458
459
  ...(_ = e == null ? void 0 : e.conversation) == null ? void 0 : _.fileViewer
459
460
  }
460
461
  }
461
- } : ve;
462
+ } : be;
462
463
  }, {
463
464
  Provider: Ho,
464
465
  useContext: Z
@@ -505,7 +506,7 @@ function zo({
505
506
  };
506
507
  });
507
508
  }, [e, t, d, p, u, n]), M(() => () => {
508
- h.chatSDK.disconnectWebSocket();
509
+ h.chatSDK.connectionState === "OPEN" && h.chatSDK.disconnectWebSocket();
509
510
  }, [h.chatSDK]), Bo(h.chatSDK), /* @__PURE__ */ s.createElement(
510
511
  Ho,
511
512
  {
@@ -842,7 +843,7 @@ const Tn = 25 * 1024 * 1024, ts = {
842
843
  });
843
844
  }, []), r = w(
844
845
  (o) => {
845
- const { channel: a, uploadSizeLimit: i = Tn } = o, l = (u = !0) => a != null && a.isAIAgent ? u ? Le(a) : !1 : !0, c = (u) => {
846
+ const { channel: a, uploadSizeLimit: i = Tn } = o, l = (u = !0) => a != null && a.isAIAgent ? u ? Me(a) : !1 : !0, c = (u) => {
846
847
  if (l())
847
848
  return e.defaultUploadSizeLimit ?? i;
848
849
  const m = e.defaultUploadSizeLimit ?? i, g = e.uploadSizeLimitPerType.get(u) ?? m;
@@ -859,7 +860,7 @@ const Tn = 25 * 1024 * 1024, ts = {
859
860
  case "always":
860
861
  return !0;
861
862
  case "handed_off_only":
862
- return Le(a);
863
+ return Me(a);
863
864
  default:
864
865
  return !0;
865
866
  }
@@ -1259,7 +1260,7 @@ const us = (e) => JSON.parse(e), ds = () => {
1259
1260
  aiAgentUserId: (r == null ? void 0 : r.userId) ?? "",
1260
1261
  isStreamAnimating: n
1261
1262
  }), l = Es({
1262
- shouldApply: !!(e != null && e.isAIAgent) && !Le(e),
1263
+ shouldApply: !!(e != null && e.isAIAgent) && !Me(e),
1263
1264
  isDisabledWhileAIResponding: i,
1264
1265
  lastMessage: Cn(t, [tt.PENDING, tt.SUCCEEDED]),
1265
1266
  currentUserId: (o == null ? void 0 : o.userId) ?? ""
@@ -1867,7 +1868,7 @@ const Rs = "remove_powered_by", Zt = (e, t) => {
1867
1868
  return { fallbackIcon: a, url: e == null ? void 0 : e.coverUrl, title: (e == null ? void 0 : e.name) ?? "" };
1868
1869
  }
1869
1870
  };
1870
- return e.isAIAgent ? Le(e) ? o.human("agent") : o.ai("delight") : e.isDesk ? o.human("agent") : o.channel("user");
1871
+ return e.isAIAgent ? Me(e) ? o.human("agent") : o.ai("delight") : e.isDesk ? o.human("agent") : o.channel("user");
1871
1872
  }, Pt = (e) => Tr((t, n) => ({ ...t, ...n }), e);
1872
1873
  var fe = /* @__PURE__ */ ((e) => (e.AI_AGENT_CSAT_5 = "AI_AGENT_CSAT_5", e.AI_AGENT_CSAT_5_WITH_CRE = "AI_AGENT_CSAT_5_WITH_CRE", e.HELPDESK_CSAT_5 = "HELPDESK_CSAT_5", e))(fe || {});
1873
1874
  const Os = /* @__PURE__ */ new Set(["free_text", "single_choice"]), Bs = ({ csatPayload: e, type: t, initialCsat: n, initialCsatReason: r, initialIsResolved: o }) => {
@@ -1877,13 +1878,9 @@ const Os = /* @__PURE__ */ new Set(["free_text", "single_choice"]), Bs = ({ csat
1877
1878
  csatReason: r,
1878
1879
  isResolved: o
1879
1880
  }), [l, c] = Pt({ followUpItem: !1 }), u = K(() => {
1880
- var v;
1881
- const p = a.csat;
1882
- if (typeof p != "number") return;
1883
- const _ = (v = e.follow_up) == null ? void 0 : v.find(
1884
- (h) => h.scores.includes(p)
1885
- );
1886
- if (Os.has(_ == null ? void 0 : _.response_type)) return _;
1881
+ var h;
1882
+ const p = a.csat, _ = typeof p == "number", v = (h = e.follow_up) == null ? void 0 : h.find((y) => _ ? y.scores.includes(p) : y.always_visible ?? !1);
1883
+ if (Os.has(v == null ? void 0 : v.response_type)) return v;
1887
1884
  }, [a.csat, e.follow_up]), m = (() => {
1888
1885
  var p;
1889
1886
  if (typeof n == "number")
@@ -1929,9 +1926,9 @@ const Os = /* @__PURE__ */ new Set(["free_text", "single_choice"]), Bs = ({ csat
1929
1926
  textLength: t.length,
1930
1927
  enabled: n
1931
1928
  }).current, p = n, _ = i < t.length, v = d.initialEnabled && (p || _);
1932
- return Ce(() => {
1929
+ return Ee(() => {
1933
1930
  m.onStart = r, m.onProgress = o, m.onComplete = a, d.textLength = t.length, d.enabled = n;
1934
- }), Ce(() => {
1931
+ }), Ee(() => {
1935
1932
  var h;
1936
1933
  d.initialEnabled && (g.startCalled || (g.startCalled = !0, (h = m.onStart) == null || h.call(m)), l((y) => t.length < y ? t.length : y));
1937
1934
  }, [t]), M(() => {
@@ -3246,7 +3243,7 @@ const D = {
3246
3243
  top: "paddingTop",
3247
3244
  bottom: "paddingBottom"
3248
3245
  }
3249
- }, De = (e, t = Fe.isRTL ? "rtl" : "ltr") => {
3246
+ }, Pe = (e, t = Fe.isRTL ? "rtl" : "ltr") => {
3250
3247
  const n = at();
3251
3248
  return e.reduce(
3252
3249
  (r, o) => {
@@ -3437,7 +3434,7 @@ const Ya = ({
3437
3434
  const o = ur.use(), { themedColor: a } = V();
3438
3435
  return /* @__PURE__ */ s.createElement(O, { onPress: r, style: o.actionItem, activeOpacity: 0.75 }, e && /* @__PURE__ */ s.createElement(B, { type: e, size: 24, color: a.primary }), /* @__PURE__ */ s.createElement(T, { variant: "body3", color: n ? a.error : a.textHighEmphasis, numberOfLines: 1 }, t));
3439
3436
  }, Ka = ({ onClose: e, children: t }) => {
3440
- const n = ur.use(), { translateY: r, panHandlers: o, wrapWithAnimation: a } = cr(), i = De(["left", "right"]);
3437
+ const n = ur.use(), { translateY: r, panHandlers: o, wrapWithAnimation: a } = cr(), i = Pe(["left", "right"]);
3441
3438
  return /* @__PURE__ */ s.createElement(O, { onPress: a(e), style: n.overlay }, /* @__PURE__ */ s.createElement(f.Animated, { style: [n.container, i, { transform: [{ translateY: r }] }], ...o }, t));
3442
3439
  }, nn = ue({
3443
3440
  template: Ka,
@@ -3578,7 +3575,7 @@ const ur = D.create(({ theme: e, edgeInsets: t }) => ({
3578
3575
  NoChannels: oi,
3579
3576
  NoMessages: si
3580
3577
  }
3581
- }), Me = (e) => {
3578
+ }), ke = (e) => {
3582
3579
  const { Template: t } = on.useContext();
3583
3580
  return /* @__PURE__ */ s.createElement(t, { ...e });
3584
3581
  }, ii = ({ style: e, onPress: t }) => {
@@ -3671,13 +3668,13 @@ const ur = D.create(({ theme: e, edgeInsets: t }) => ({
3671
3668
  type: Kt(e.name, e.type),
3672
3669
  onPress: n ? () => n == null ? void 0 : n(e) : void 0
3673
3670
  }
3674
- ), t), Pe = ({ style: e, ...t }) => /* @__PURE__ */ s.createElement(We, { style: [e, t], ...t }), mi = ({
3671
+ ), t), Le = ({ style: e, ...t }) => /* @__PURE__ */ s.createElement(We, { style: [e, t], ...t }), mi = ({
3675
3672
  file: e,
3676
3673
  onClickMedia: t = ({ url: r }) => ye.openURL(r),
3677
3674
  children: n
3678
3675
  }) => {
3679
3676
  const r = gi.use();
3680
- return /* @__PURE__ */ s.createElement(f, { gap: k.GAP_GROUPED }, /* @__PURE__ */ s.createElement(O, { style: r.mediaContainer, onPress: () => t == null ? void 0 : t(e) }, /* @__PURE__ */ s.createElement(Pe, { source: { uri: e.url }, style: r.media, resizeMode: "cover" })), n);
3677
+ return /* @__PURE__ */ s.createElement(f, { gap: k.GAP_GROUPED }, /* @__PURE__ */ s.createElement(O, { style: r.mediaContainer, onPress: () => t == null ? void 0 : t(e) }, /* @__PURE__ */ s.createElement(Le, { source: { uri: e.url }, style: r.media, resizeMode: "cover" })), n);
3681
3678
  }, gi = D.create(({ select: e, theme: t }) => ({
3682
3679
  mediaContainer: {
3683
3680
  width: k.BODY_MAX_WIDTH,
@@ -3740,7 +3737,7 @@ const ur = D.create(({ theme: e, edgeInsets: t }) => ({
3740
3737
  }
3741
3738
  }), hr = Ue(({ src: e, onPress: t }) => {
3742
3739
  const [n, r] = S("1/1"), [o, a] = S(!1), i = hi.use();
3743
- return Ce(() => {
3740
+ return Ee(() => {
3744
3741
  e && ar(e).then(({ width: l, height: c }) => r(`${l}/${c}`));
3745
3742
  }, [e]), /* @__PURE__ */ s.createElement(jt, { style: { marginTop: 8 }, onPress: t }, /* @__PURE__ */ s.createElement(f, { style: [i.container, { aspectRatio: n }] }, o ? /* @__PURE__ */ s.createElement(B, { size: 28, type: "thumbnail-none", color: (l) => l.textHighEmphasisInverse }) : /* @__PURE__ */ s.createElement(We, { source: { uri: e }, style: J.absoluteFillObject, onError: () => a(!0) })));
3746
3743
  }), hi = D.create(({ themedColor: e }) => ({
@@ -4582,7 +4579,7 @@ const Ui = ({
4582
4579
  return () => r(e);
4583
4580
  })();
4584
4581
  return /* @__PURE__ */ s.createElement(f, { flexDirection: "column", alignItems: "flex-end", gap: k.GAP_GROUPED }, /* @__PURE__ */ s.createElement(O, { onPress: g, style: [a.imageContainer, { aspectRatio: i }], activeOpacity: 0.75 }, !u && /* @__PURE__ */ s.createElement(f, { alignItems: "center", justifyContent: "center" }, /* @__PURE__ */ s.createElement(_r, { size: 26 }, /* @__PURE__ */ s.createElement(B, { type: "spinner", color: (d) => d.textLowEmphasis, size: 26 }))), /* @__PURE__ */ s.createElement(
4585
- Pe,
4582
+ Le,
4586
4583
  {
4587
4584
  source: { uri: c },
4588
4585
  style: [a.image, { opacity: u ? 1 : 0 }],
@@ -4919,7 +4916,7 @@ const Ui = ({
4919
4916
  }) => {
4920
4917
  const [o, a] = S(!1), i = br.use();
4921
4918
  return o ? /* @__PURE__ */ s.createElement(al, { value: e, selected: r, label: n }) : /* @__PURE__ */ s.createElement(
4922
- Pe,
4919
+ Le,
4923
4920
  {
4924
4921
  source: { uri: t },
4925
4922
  style: i.emojiImage(r),
@@ -5007,28 +5004,30 @@ const Ui = ({
5007
5004
  }, ml = (e) => {
5008
5005
  if (e.messageType !== "admin.csat")
5009
5006
  throw new Error("Invalid message type");
5010
- const { extendedMessagePayload: t, onSubmitCSAT: n } = e, { csat: r, csatReason: o, csatExpireAt: a, isResolvedWhenDeterminedByUser: i } = e, [, l] = S(0), c = ul(t == null ? void 0 : t.csat), u = gl.use();
5007
+ const { extendedMessagePayload: t, onSubmitCSAT: n } = e, { csat: r, csatReason: o, csatExpireAt: a, isResolvedWhenDeterminedByUser: i } = e, [, l] = S(0), c = ul(t == null ? void 0 : t.csat), u = F(!1), m = gl.use();
5011
5008
  if (!c || !c.visibility || !fe[c.type]) return null;
5012
- const m = c.type === fe.AI_AGENT_CSAT_5 || c.type === fe.AI_AGENT_CSAT_5_WITH_CRE || c.type === fe.HELPDESK_CSAT_5 ? At : () => null;
5013
- return /* @__PURE__ */ s.createElement(f, { style: u.container }, !r && vn(a) ? /* @__PURE__ */ s.createElement(dl, null) : /* @__PURE__ */ s.createElement(
5014
- m,
5009
+ const g = c.type === fe.AI_AGENT_CSAT_5 || c.type === fe.AI_AGENT_CSAT_5_WITH_CRE || c.type === fe.HELPDESK_CSAT_5 ? At : () => null;
5010
+ return /* @__PURE__ */ s.createElement(f, { style: m.container }, !r && vn(a) ? /* @__PURE__ */ s.createElement(dl, null) : /* @__PURE__ */ s.createElement(
5011
+ g,
5015
5012
  {
5016
5013
  csatPayload: c,
5017
5014
  type: c.type,
5018
5015
  initialCsat: r,
5019
5016
  initialCsatReason: o,
5020
5017
  initialIsResolved: i,
5021
- renderSubmitButton: ({ state: g, params: d, validateParams: p }) => /* @__PURE__ */ s.createElement(
5018
+ renderSubmitButton: ({ state: d, params: p, validateParams: _ }) => /* @__PURE__ */ s.createElement(
5022
5019
  O,
5023
5020
  {
5024
5021
  activeOpacity: 0.75,
5025
- disabled: g === "submitted",
5022
+ disabled: d === "submitted",
5026
5023
  onPress: async () => {
5027
- !vn(a) && p() ? await n(d) : l((_) => _ + 1);
5024
+ u.current || (!vn(a) && _() ? (u.current = !0, await n(p).finally(() => {
5025
+ u.current = !1;
5026
+ })) : l((v) => v + 1));
5028
5027
  },
5029
- style: u.submitButton(g)
5028
+ style: m.submitButton(d)
5030
5029
  },
5031
- /* @__PURE__ */ s.createElement(T, { variant: "button", style: u.submitButtonText(g) }, g === "submitted" ? c.csat_submitted_label : c.csat_submit_label)
5030
+ /* @__PURE__ */ s.createElement(T, { variant: "button", style: m.submitButtonText(d) }, d === "submitted" ? c.csat_submitted_label : c.csat_submit_label)
5032
5031
  )
5033
5032
  }
5034
5033
  ));
@@ -5114,7 +5113,7 @@ const Ui = ({
5114
5113
  channelSource: p,
5115
5114
  scrollSource: _,
5116
5115
  state: { input: v, streamAnimation: h }
5117
- } = me(), y = bl(), E = Cl.use(), b = De(["left", "right"]), { state: C, props: I } = _;
5116
+ } = me(), y = bl(), E = Cl.use(), b = Pe(["left", "right"]), { state: C, props: I } = _;
5118
5117
  M(() => {
5119
5118
  C.isAwayFromBottom || d.resetNewMessages();
5120
5119
  }, [C.isAwayFromBottom]);
@@ -5161,31 +5160,31 @@ const Ui = ({
5161
5160
  ...x,
5162
5161
  messageType: "admin.csat",
5163
5162
  isResolvedWhenDeterminedByUser: yo(x),
5164
- onSubmitCSAT: async ({ csat: be, ...Ie }) => {
5165
- var Ee;
5166
- be && await ((Ee = p.channel) == null ? void 0 : Ee.submitCSAT({ csat: be, ...Ie }));
5163
+ onSubmitCSAT: async (ve) => {
5164
+ var Ce;
5165
+ await ((Ce = p.channel) == null ? void 0 : Ce.submitCSAT(ve));
5167
5166
  }
5168
5167
  }
5169
5168
  ) : null : /* @__PURE__ */ s.createElement(r, { ...qe, messageType: "admin" });
5170
5169
  if (je.isOutgoing(A, (m == null ? void 0 : m.userId) ?? "")) {
5171
- const be = {
5170
+ const ve = {
5172
5171
  ...qe,
5173
5172
  sender: N(A),
5174
5173
  sendingStatus: A.sendingStatus,
5175
5174
  onClickFailedMessage: H(A)
5176
5175
  };
5177
5176
  if (A.isUserMessage())
5178
- return /* @__PURE__ */ s.createElement(n, { ...be, messageType: "user" });
5177
+ return /* @__PURE__ */ s.createElement(n, { ...ve, messageType: "user" });
5179
5178
  if (A.isFileMessage()) {
5180
- const [Ie, Ee] = ((fn = A.metaArrays.find((Y) => Y.key === Kn)) == null ? void 0 : fn.value) ?? [];
5179
+ const [Ce, Re] = ((fn = A.metaArrays.find((Y) => Y.key === Kn)) == null ? void 0 : fn.value) ?? [];
5181
5180
  return /* @__PURE__ */ s.createElement(
5182
5181
  n,
5183
5182
  {
5184
- ...be,
5183
+ ...ve,
5185
5184
  messageType: "file",
5186
5185
  file: A,
5187
5186
  metadata: {
5188
- aspectRatio: Ie && Ee ? `${Ie}/${Ee}` : "1/1",
5187
+ aspectRatio: Ce && Re ? `${Ce}/${Re}` : "1/1",
5189
5188
  localFile: (_n = A.messageParams) == null ? void 0 : _n.file
5190
5189
  }
5191
5190
  }
@@ -5193,13 +5192,13 @@ const Ui = ({
5193
5192
  }
5194
5193
  }
5195
5194
  if (je.isIncoming(A, (m == null ? void 0 : m.userId) ?? "")) {
5196
- const be = A.sender.userId === (u == null ? void 0 : u.userId), Ie = G === 0, Ee = {
5195
+ const ve = A.sender.userId === (u == null ? void 0 : u.userId), Ce = G === 0, Re = {
5197
5196
  ...qe,
5198
- sender: N(A, be),
5199
- suggestedRepliesVisible: Ie,
5200
- isBotMessage: be,
5197
+ sender: N(A, ve),
5198
+ suggestedRepliesVisible: Ce,
5199
+ isBotMessage: ve,
5201
5200
  isStreaming: nt.isStreaming(A),
5202
- isHandedOff: Le(p.channel),
5201
+ isHandedOff: Me(p.channel),
5203
5202
  isConversationClosed: xe(p.channel),
5204
5203
  isFeedbackEnabled: u == null ? void 0 : u.isUserFeedbackEnabled,
5205
5204
  isFeedbackCommentEnabled: u == null ? void 0 : u.isUserFeedbackCommentOptionEnabled,
@@ -5250,9 +5249,9 @@ const Ui = ({
5250
5249
  }
5251
5250
  };
5252
5251
  if (A.isUserMessage())
5253
- return /* @__PURE__ */ s.createElement(t, { ...Ee, messageType: "user" });
5252
+ return /* @__PURE__ */ s.createElement(t, { ...Re, messageType: "user" });
5254
5253
  if (A.isFileMessage())
5255
- return /* @__PURE__ */ s.createElement(t, { ...Ee, messageType: "file", file: A });
5254
+ return /* @__PURE__ */ s.createElement(t, { ...Re, messageType: "file", file: A });
5256
5255
  }
5257
5256
  return null;
5258
5257
  })(), z = El(A, ie) && /* @__PURE__ */ s.createElement(Xa, { date: A.createdAt, style: E.dateSeparator });
@@ -5288,10 +5287,10 @@ const Ui = ({
5288
5287
  renderItem: L,
5289
5288
  loading: !d.initialized,
5290
5289
  error: !!(g || p.error),
5291
- LoadingComponent: /* @__PURE__ */ s.createElement(Me, { type: "loading" }),
5292
- EmptyComponent: /* @__PURE__ */ s.createElement(Me, { type: "noMessages", label: a.common.placeholder_no_messages }),
5290
+ LoadingComponent: /* @__PURE__ */ s.createElement(ke, { type: "loading" }),
5291
+ EmptyComponent: /* @__PURE__ */ s.createElement(ke, { type: "noMessages", label: a.common.placeholder_no_messages }),
5293
5292
  ErrorComponent: /* @__PURE__ */ s.createElement(
5294
- Me,
5293
+ ke,
5295
5294
  {
5296
5295
  type: "error",
5297
5296
  label: (g == null ? void 0 : g.message) ?? ((ae = p.error) == null ? void 0 : ae.message),
@@ -5555,7 +5554,7 @@ const Bl = ({ onPressAddAttachment: e, disabled: t }) => /* @__PURE__ */ s.creat
5555
5554
  }
5556
5555
  }), Hl = ({ name: e, type: t, url: n, onRemove: r }) => {
5557
5556
  const o = zl.use();
5558
- return /* @__PURE__ */ s.createElement(f, { style: o.wrapper }, wo(t) ? /* @__PURE__ */ s.createElement(Pe, { source: { uri: n }, style: o.image, resizeMode: "cover" }) : /* @__PURE__ */ s.createElement(sn, { name: e, type: Kt(e, t) }), r && /* @__PURE__ */ s.createElement(O, { onPress: r, style: o.removeButton }, /* @__PURE__ */ s.createElement(B, { type: "remove", size: 20, color: o.removeIcon.tintColor })));
5557
+ return /* @__PURE__ */ s.createElement(f, { style: o.wrapper }, wo(t) ? /* @__PURE__ */ s.createElement(Le, { source: { uri: n }, style: o.image, resizeMode: "cover" }) : /* @__PURE__ */ s.createElement(sn, { name: e, type: Kt(e, t) }), r && /* @__PURE__ */ s.createElement(O, { onPress: r, style: o.removeButton }, /* @__PURE__ */ s.createElement(B, { type: "remove", size: 20, color: o.removeIcon.tintColor })));
5559
5558
  }, Je = 7, zl = D.create(({ themedColor: e }) => ({
5560
5559
  wrapper: {
5561
5560
  marginTop: Je,
@@ -5663,16 +5662,16 @@ const Wl = ({ onPressSend: e }) => /* @__PURE__ */ s.createElement(O, { style: V
5663
5662
  }), m = (h, y) => {
5664
5663
  const E = y.filter((x) => u.isSupportedMimeType(x.type));
5665
5664
  if (E.length === 0 && y.length > 0)
5666
- return ke.alert("", t.conversation.file_upload_not_supported_file), h;
5665
+ return Te.alert("", t.conversation.file_upload_not_supported_file), h;
5667
5666
  const b = (x) => {
5668
5667
  const N = u.getUploadSizeLimit(x.type);
5669
5668
  return x.size && x.size > N;
5670
5669
  }, C = E.find((x) => b(x));
5671
5670
  if (C) {
5672
5671
  const x = u.getUploadSizeLimitInMB(C.type);
5673
- return ke.alert("", t.conversation.file_upload_notification_size_limit(x)), h;
5672
+ return Te.alert("", t.conversation.file_upload_notification_size_limit(x)), h;
5674
5673
  }
5675
- return h.length + E.length > u.maxAttachmentCount ? (ke.alert("", t.conversation.file_upload_notification_count_limit(u.maxAttachmentCount)), h) : [...h, ...E];
5674
+ return h.length + E.length > u.maxAttachmentCount ? (Te.alert("", t.conversation.file_upload_notification_count_limit(u.maxAttachmentCount)), h) : [...h, ...E];
5676
5675
  }, g = (h) => {
5677
5676
  c((y) => m(y, h));
5678
5677
  }, d = (h) => {
@@ -5716,7 +5715,7 @@ const Wl = ({ onPressSend: e }) => /* @__PURE__ */ s.createElement(O, { style: V
5716
5715
  maxAttachmentCount: u.maxAttachmentCount
5717
5716
  };
5718
5717
  }, Yl = () => {
5719
- const { config: e } = Z(), t = Dl(), { strings: n } = W(), { messageSource: r } = me(), { openModal: o } = Qt(), a = De(["left", "right", "bottom"]), i = Kl.use(), {
5718
+ const { config: e } = Z(), t = Dl(), { strings: n } = W(), { messageSource: r } = me(), { openModal: o } = Qt(), a = Pe(["left", "right", "bottom"]), i = Kl.use(), {
5720
5719
  maxAttachmentCount: l,
5721
5720
  sendButtonVisible: c,
5722
5721
  addAttachmentButtonVisible: u,
@@ -5737,7 +5736,7 @@ const Wl = ({ onPressSend: e }) => /* @__PURE__ */ s.createElement(O, { style: V
5737
5736
  label: n.conversation.attachment_camera,
5738
5737
  onPress: async () => {
5739
5738
  if (!d())
5740
- return ke.alert("", n.conversation.file_upload_no_supported_files), b(null);
5739
+ return Te.alert("", n.conversation.file_upload_no_supported_files), b(null);
5741
5740
  const te = await t.captureCamera();
5742
5741
  b(te);
5743
5742
  }
@@ -5749,7 +5748,7 @@ const Wl = ({ onPressSend: e }) => /* @__PURE__ */ s.createElement(O, { style: V
5749
5748
  label: n.conversation.attachment_photo,
5750
5749
  onPress: async () => {
5751
5750
  if (!d())
5752
- return ke.alert("", n.conversation.file_upload_no_supported_files), b(null);
5751
+ return Te.alert("", n.conversation.file_upload_no_supported_files), b(null);
5753
5752
  const te = await t.selectFromGallery({
5754
5753
  selectionLimit: l - _.files.length
5755
5754
  });
@@ -5763,7 +5762,7 @@ const Wl = ({ onPressSend: e }) => /* @__PURE__ */ s.createElement(O, { style: V
5763
5762
  label: n.conversation.attachment_document,
5764
5763
  onPress: async () => {
5765
5764
  if (!p())
5766
- return ke.alert("", n.conversation.file_upload_no_supported_files), b(null);
5765
+ return Te.alert("", n.conversation.file_upload_no_supported_files), b(null);
5767
5766
  const te = await t.selectFile({
5768
5767
  selectionLimit: l - _.files.length,
5769
5768
  mimeTypes: g
@@ -5813,7 +5812,7 @@ const Wl = ({ onPressSend: e }) => /* @__PURE__ */ s.createElement(O, { style: V
5813
5812
  backgroundColor: e.colors.base.background
5814
5813
  })
5815
5814
  })), Er = ({ start: e, title: t, titleAlign: n = "start", end: r }) => {
5816
- const o = De(["left", "right", "top"]), [a, i] = S(0), [l, c] = S(0), u = (d) => {
5815
+ const o = Pe(["left", "right", "top"]), [a, i] = S(0), [l, c] = S(0), u = (d) => {
5817
5816
  i(d.nativeEvent.layout.width);
5818
5817
  }, m = (d) => {
5819
5818
  c(d.nativeEvent.layout.width);
@@ -5871,7 +5870,7 @@ const Wl = ({ onPressSend: e }) => /* @__PURE__ */ s.createElement(O, { style: V
5871
5870
  }, Jl = () => {
5872
5871
  const { themedColor: e } = V(), {
5873
5872
  channelSource: { channel: t }
5874
- } = me(), n = Zt("handoff-button", t), r = !Yn(t) || Le(t);
5873
+ } = me(), n = Zt("handoff-button", t), r = !Yn(t) || Me(t);
5875
5874
  return n ? /* @__PURE__ */ s.createElement(
5876
5875
  O,
5877
5876
  {
@@ -5923,7 +5922,7 @@ const Wl = ({ onPressSend: e }) => /* @__PURE__ */ s.createElement(O, { style: V
5923
5922
  } = me(), { userSession: t, aiAgentInfo: n } = oe(), { config: r } = Z(), o = sr({ channel: e, userSession: t, aiAgentInfo: n }), a = (l = (i = r == null ? void 0 : r.conversation) == null ? void 0 : i.header) == null ? void 0 : l.avatarEnabled;
5924
5923
  return /* @__PURE__ */ s.createElement(f, { gap: 6, flexDirection: "row", alignItems: "center", maxWidth: "100%" }, a && /* @__PURE__ */ s.createElement(vr, { channel: e, size: 34 }), /* @__PURE__ */ s.createElement(f, { flexShrink: 1 }, /* @__PURE__ */ s.createElement(T, { numberOfLines: 1, variant: "h1" }, o.title)));
5925
5924
  }, tc = (e) => {
5926
- const { components: t } = Re.useContext();
5925
+ const { components: t } = De.useContext();
5927
5926
  return /* @__PURE__ */ s.createElement(
5928
5927
  Er,
5929
5928
  {
@@ -5934,15 +5933,15 @@ const Wl = ({ onPressSend: e }) => /* @__PURE__ */ s.createElement(O, { style: V
5934
5933
  }
5935
5934
  );
5936
5935
  }, nc = () => {
5937
- const { components: e } = Re.useContext();
5936
+ const { components: e } = De.useContext();
5938
5937
  return /* @__PURE__ */ s.createElement(e.MenuButton, null);
5939
5938
  }, rc = () => {
5940
- const { components: e } = Re.useContext();
5939
+ const { components: e } = De.useContext();
5941
5940
  return /* @__PURE__ */ s.createElement(e.Title, null);
5942
5941
  }, oc = () => {
5943
- const { components: e } = Re.useContext();
5942
+ const { components: e } = De.useContext();
5944
5943
  return /* @__PURE__ */ s.createElement(f, { flexDirection: "row", alignItems: "center", gap: 10 }, /* @__PURE__ */ s.createElement(e.HandoffButton, null), /* @__PURE__ */ s.createElement(e.CloseButton, null));
5945
- }, Re = ue({
5944
+ }, De = ue({
5946
5945
  template: tc,
5947
5946
  components: {
5948
5947
  StartArea: nc,
@@ -5954,7 +5953,7 @@ const Wl = ({ onPressSend: e }) => /* @__PURE__ */ s.createElement(O, { style: V
5954
5953
  CloseButton: Zl
5955
5954
  }
5956
5955
  }), sc = () => {
5957
- const { Template: e } = Re.useContext();
5956
+ const { Template: e } = De.useContext();
5958
5957
  return /* @__PURE__ */ s.createElement(e, { titleAlign: "start" });
5959
5958
  }, ac = (e) => {
5960
5959
  const { components: t } = dn.useContext();
@@ -6034,7 +6033,7 @@ const Wl = ({ onPressSend: e }) => /* @__PURE__ */ s.createElement(O, { style: V
6034
6033
  }
6035
6034
  })), gc = () => {
6036
6035
  var l;
6037
- const { Template: e } = dc.useContext(), { strings: t } = W(), { connectionError: n } = oe(), { listSource: r, onNavigateToConversation: o } = mn(), a = De(["left", "right"]), i = hc.use();
6036
+ const { Template: e } = dc.useContext(), { strings: t } = W(), { connectionError: n } = oe(), { listSource: r, onNavigateToConversation: o } = mn(), a = Pe(["left", "right"]), i = hc.use();
6038
6037
  return /* @__PURE__ */ s.createElement(
6039
6038
  mr,
6040
6039
  {
@@ -6055,9 +6054,9 @@ const Wl = ({ onPressSend: e }) => /* @__PURE__ */ s.createElement(O, { style: V
6055
6054
  ),
6056
6055
  loading: !r.initialized,
6057
6056
  error: !!(n || r.error),
6058
- LoadingComponent: /* @__PURE__ */ s.createElement(Me, { type: "loading" }),
6059
- EmptyComponent: /* @__PURE__ */ s.createElement(Me, { type: "noChannels", label: t.common.placeholder_no_conversations }),
6060
- ErrorComponent: /* @__PURE__ */ s.createElement(Me, { type: "error", label: (n == null ? void 0 : n.message) ?? ((l = r.error) == null ? void 0 : l.message) })
6057
+ LoadingComponent: /* @__PURE__ */ s.createElement(ke, { type: "loading" }),
6058
+ EmptyComponent: /* @__PURE__ */ s.createElement(ke, { type: "noChannels", label: t.common.placeholder_no_conversations }),
6059
+ ErrorComponent: /* @__PURE__ */ s.createElement(ke, { type: "error", label: (n == null ? void 0 : n.message) ?? ((l = r.error) == null ? void 0 : l.message) })
6061
6060
  }
6062
6061
  );
6063
6062
  }, hc = D.create(({ theme: e }) => ({
@@ -6069,7 +6068,7 @@ const Wl = ({ onPressSend: e }) => /* @__PURE__ */ s.createElement(O, { style: V
6069
6068
  backgroundColor: e.colors.base.background
6070
6069
  }
6071
6070
  })), pc = () => {
6072
- const { strings: e } = W(), { language: t, countryCode: n, context: r } = Z(), { aiAgentInfo: o, refreshActiveChannel: a, createConversation: i, setActiveChannel: l, sdkUser: c } = oe(), { onNavigateToConversation: u } = mn(), m = De(["left", "right", "bottom"]), g = fc.use();
6071
+ const { strings: e } = W(), { language: t, countryCode: n, context: r } = Z(), { aiAgentInfo: o, refreshActiveChannel: a, createConversation: i, setActiveChannel: l, sdkUser: c } = oe(), { onNavigateToConversation: u } = mn(), m = Pe(["left", "right", "bottom"]), g = fc.use();
6073
6072
  return /* @__PURE__ */ s.createElement(
6074
6073
  O,
6075
6074
  {
@@ -6157,7 +6156,7 @@ const Wl = ({ onPressSend: e }) => /* @__PURE__ */ s.createElement(O, { style: V
6157
6156
  }), xc = ({ children: e, ...t }) => {
6158
6157
  const { Template: n } = gn.useContext();
6159
6158
  return /* @__PURE__ */ s.createElement(cc, { ...t }, /* @__PURE__ */ s.createElement(n, null), e);
6160
- }, Ic = "1.3.0", Tc = Ic, Bu = st(
6159
+ }, Ic = "1.3.2", Tc = Ic, Bu = st(
6161
6160
  function({
6162
6161
  logLevel: t = Vr.WARN,
6163
6162
  language: n = ct,
@@ -6196,7 +6195,7 @@ const Wl = ({ onPressSend: e }) => /* @__PURE__ */ s.createElement(O, { style: V
6196
6195
  }
6197
6196
  ), kc = _o(
6198
6197
  dn,
6199
- Re,
6198
+ De,
6200
6199
  gn,
6201
6200
  Ge,
6202
6201
  on,
@@ -6283,7 +6282,7 @@ const Wl = ({ onPressSend: e }) => /* @__PURE__ */ s.createElement(O, { style: V
6283
6282
  isDefaultIcon: t,
6284
6283
  size: n,
6285
6284
  fillColor: r
6286
- }) => e ? t ? /* @__PURE__ */ s.createElement(Pe, { source: { uri: e }, width: n, height: n, tintColor: r, resizeMode: "contain" }) : /* @__PURE__ */ s.createElement(Pe, { source: { uri: e }, width: n, height: n, resizeMode: "cover" }) : /* @__PURE__ */ s.createElement(B, { type: "delight", size: n, color: r }), Nc = ({ size: e, fillColor: t }) => /* @__PURE__ */ s.createElement(B, { type: "chevron-down", size: e, color: t }), Hc = D.create(() => ({
6285
+ }) => e ? t ? /* @__PURE__ */ s.createElement(Le, { source: { uri: e }, width: n, height: n, tintColor: r, resizeMode: "contain" }) : /* @__PURE__ */ s.createElement(Le, { source: { uri: e }, width: n, height: n, resizeMode: "cover" }) : /* @__PURE__ */ s.createElement(B, { type: "delight", size: n, color: r }), Nc = ({ size: e, fillColor: t }) => /* @__PURE__ */ s.createElement(B, { type: "chevron-down", size: e, color: t }), Hc = D.create(() => ({
6287
6286
  container: (e) => ({
6288
6287
  position: "relative",
6289
6288
  width: e.size,
@@ -6655,7 +6654,7 @@ const {
6655
6654
  }, su = (e) => {
6656
6655
  var a, i, l, c;
6657
6656
  const { setPosition: t, setMargin: n, setLauncherSize: r, setSpacing: o } = hn();
6658
- return Ce(() => {
6657
+ return Ee(() => {
6659
6658
  e.position && t(e.position), e.margin && n(e.margin), e.launcherSize !== void 0 && r(e.launcherSize), e.spacing !== void 0 && o(e.spacing);
6660
6659
  }, [
6661
6660
  e.position,
@@ -6668,10 +6667,10 @@ const {
6668
6667
  ]), null;
6669
6668
  }, au = ({ children: e }) => {
6670
6669
  const { setConversationChildren: t } = pn();
6671
- return Ce(() => (t(e), () => t(null)), [e]), null;
6670
+ return Ee(() => (t(e), () => t(null)), [e]), null;
6672
6671
  }, iu = ({ children: e }) => {
6673
6672
  const { setConversationListChildren: t } = pn();
6674
- return Ce(() => (t(e), () => t(null)), [e]), null;
6673
+ return Ee(() => (t(e), () => t(null)), [e]), null;
6675
6674
  }, lu = ({
6676
6675
  entryPoint: e = "Conversation",
6677
6676
  edgeToEdgeEnabled: t = !0,
@@ -6720,7 +6719,7 @@ export {
6720
6719
  ic as Conversation,
6721
6720
  Ru as ConversationContext,
6722
6721
  aa as ConversationContextProvider,
6723
- Re as ConversationHeaderLayout,
6722
+ De as ConversationHeaderLayout,
6724
6723
  dn as ConversationLayout,
6725
6724
  xc as ConversationList,
6726
6725
  Ou as ConversationListContext,