@banbox/chat 1.0.13 → 1.0.14

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
@@ -4080,6 +4080,34 @@ function toRef(m) {
4080
4080
  audio: m.audio
4081
4081
  };
4082
4082
  }
4083
+ var avatarBgByInitial2 = {
4084
+ a: "#FFE4E4",
4085
+ b: "#E4F0FF",
4086
+ c: "#E4FFE9",
4087
+ d: "#FFF4E4",
4088
+ e: "#F4E4FF",
4089
+ f: "#FFE4F4",
4090
+ g: "#E4FFFF",
4091
+ h: "#FFFFE4",
4092
+ i: "#E4E4FF",
4093
+ j: "#FFE9E4",
4094
+ k: "#E4FFE4",
4095
+ l: "#FFE4EA",
4096
+ m: "#E8E4FF",
4097
+ n: "#E4F8FF",
4098
+ o: "#FFF0E4",
4099
+ p: "#F0FFE4",
4100
+ q: "#FFE4F8",
4101
+ r: "#E4FFEC",
4102
+ s: "#FFEEE4",
4103
+ t: "#E4EAFF",
4104
+ u: "#F8FFE4",
4105
+ v: "#FFE4EE",
4106
+ w: "#E4FFFA",
4107
+ x: "#FFF8E4",
4108
+ y: "#EAE4FF",
4109
+ z: "#E4FFF0"
4110
+ };
4083
4111
  var SinglePopup = ({ adapter, uiCallbacks, theme, footerActions }) => {
4084
4112
  const { close, reference } = useChatUI();
4085
4113
  const { isOpen: isGalleryOpen, closeGallery } = useGallery();
@@ -4100,10 +4128,12 @@ var SinglePopup = ({ adapter, uiCallbacks, theme, footerActions }) => {
4100
4128
  const activeThread = threads.find((t) => t.id === activeId);
4101
4129
  const isVerified = activeThread?.badge === true;
4102
4130
  const meta = reference?.meta ?? {};
4103
- const initialSrc = activeThread?.avatarSrc ?? "/shop/ban-box.png";
4131
+ const avatarSrc = meta.avatarSrc ?? activeThread?.avatarSrc;
4132
+ const initial = meta.initial ?? activeThread?.avatarText ?? (activeThread?.title ?? meta.title ?? "?").charAt(0).toUpperCase();
4133
+ const avatarBg = avatarBgByInitial2[initial.toLowerCase()] ?? "#E4F0FF";
4104
4134
  const title = meta.title ?? activeThread?.title ?? "Unknown";
4105
- const online = meta.online ?? activeThread?.online ?? true;
4106
- const subtitle = meta.subtitle ?? "Customer";
4135
+ const online = meta.online ?? activeThread?.online ?? false;
4136
+ const subtitle = meta.subtitle ?? activeThread?.subTitle ?? "Customer";
4107
4137
  const [messages, setMessages] = React16.useState(
4108
4138
  () => activeId ? adapter.messages.list(activeId) : []
4109
4139
  );
@@ -4176,11 +4206,23 @@ var SinglePopup = ({ adapter, uiCallbacks, theme, footerActions }) => {
4176
4206
  /* @__PURE__ */ jsx("div", { className: "h-[64px] shrink-0", children: /* @__PURE__ */ jsx(
4177
4207
  ChatHeader,
4178
4208
  {
4179
- left: /* @__PURE__ */ jsx(
4209
+ left: avatarSrc ? /* @__PURE__ */ jsx(
4180
4210
  ChatIdentity_default,
4181
4211
  {
4182
4212
  variant: "avatar",
4183
- src: initialSrc,
4213
+ src: avatarSrc,
4214
+ online,
4215
+ title,
4216
+ subtitle,
4217
+ verified: isVerified,
4218
+ subtitleVariant: "muted"
4219
+ }
4220
+ ) : /* @__PURE__ */ jsx(
4221
+ ChatIdentity_default,
4222
+ {
4223
+ variant: "initial",
4224
+ initial,
4225
+ bg: avatarBg,
4184
4226
  online,
4185
4227
  title,
4186
4228
  subtitle,