@realtimexsco/live-chat 1.3.2 → 1.3.4

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.mjs CHANGED
@@ -850,6 +850,9 @@ var init_conversation_helpers = __esm({
850
850
  const mergedParticipants = conversation.participants !== void 0 ? mergeConversationParticipants(existing?.participants, conversation.participants) : existing?.participants ?? conversation.participants;
851
851
  const isGroup = isGroupConversation(conversation) || isGroupConversation(existing);
852
852
  const resolvedGroupImage = resolveGroupImage(conversation) || resolveGroupImage(existing);
853
+ const incomingGroupName = typeof conversation.groupName === "string" && conversation.groupName.trim() || typeof conversation.name === "string" && conversation.name.trim() || "";
854
+ const existingGroupName = typeof existing?.groupName === "string" && existing.groupName.trim() || typeof existing?.name === "string" && existing.name.trim() || "";
855
+ const resolvedGroupName = incomingGroupName || existingGroupName || void 0;
853
856
  return {
854
857
  ...existing,
855
858
  ...conversation,
@@ -857,7 +860,10 @@ var init_conversation_helpers = __esm({
857
860
  isGroup,
858
861
  isBlocked: resolvedBlocked,
859
862
  lastMessage: mergeLastMessage(existing?.lastMessage, conversation.lastMessage),
860
- ...isGroup && resolvedGroupImage ? { image: resolvedGroupImage, groupImage: resolvedGroupImage } : {}
863
+ ...isGroup ? {
864
+ ...resolvedGroupName ? { groupName: resolvedGroupName, name: resolvedGroupName } : {},
865
+ ...resolvedGroupImage ? { image: resolvedGroupImage, groupImage: resolvedGroupImage } : {}
866
+ } : {}
861
867
  };
862
868
  };
863
869
  resolveConversationLastMessage = (conversation, messagesByConversation) => {
@@ -2793,8 +2799,7 @@ var init_message_handlers = __esm({
2793
2799
  conversationType: lastDM.conversationType || "individual",
2794
2800
  isGroup: false,
2795
2801
  ...shouldIncludeParticipants ? { participants: participantSeed } : {},
2796
- groupName: lastDM.groupName,
2797
- name: lastDM.groupName,
2802
+ ...lastDM.groupName ? { groupName: lastDM.groupName, name: lastDM.groupName } : {},
2798
2803
  owner: existingConv?.owner ?? lastDM.owner
2799
2804
  },
2800
2805
  {
@@ -3137,8 +3142,10 @@ var init_group_handlers = __esm({
3137
3142
  _id: conversationId,
3138
3143
  conversationType: "group",
3139
3144
  isGroup: true,
3140
- groupName: lastDM.groupName,
3141
- name: lastDM.groupName,
3145
+ ...lastDM.groupName || lastDM.name ? {
3146
+ groupName: lastDM.groupName || lastDM.name,
3147
+ name: lastDM.groupName || lastDM.name
3148
+ } : {},
3142
3149
  participants: buildParticipantsFromMessagePayload(lastDM, loggedUserId)
3143
3150
  },
3144
3151
  {
@@ -3176,8 +3183,10 @@ var init_group_handlers = __esm({
3176
3183
  _id: conversationId,
3177
3184
  conversationType: "group",
3178
3185
  isGroup: true,
3179
- groupName: lastDM.groupName,
3180
- name: lastDM.groupName,
3186
+ ...lastDM.groupName || lastDM.name ? {
3187
+ groupName: lastDM.groupName || lastDM.name,
3188
+ name: lastDM.groupName || lastDM.name
3189
+ } : {},
3181
3190
  participants: buildParticipantsFromMessagePayload(lastDM, loggedUserId)
3182
3191
  },
3183
3192
  {
@@ -8848,7 +8857,7 @@ function MessageAttachmentsCaptionBar({
8848
8857
  onCancelEdit
8849
8858
  }) {
8850
8859
  if (isStandaloneMetaOnly) {
8851
- return /* @__PURE__ */ jsx("div", { className: "flex justify-end pt-0.5", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5", children: [
8860
+ return /* @__PURE__ */ jsx("div", { className: "flex justify-end pt-1.5 pb-0.5", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5", children: [
8852
8861
  /* @__PURE__ */ jsx(
8853
8862
  MessageCornerBadges,
8854
8863
  {
@@ -10059,6 +10068,8 @@ function FileAttachmentRow({
10059
10068
  }
10060
10069
  window.open(fileUrl, "_blank", "noopener,noreferrer");
10061
10070
  };
10071
+ const onThemeBubble = inBubble && isSender;
10072
+ const onIncomingBubble = inBubble && !isSender;
10062
10073
  return /* @__PURE__ */ jsxs(
10063
10074
  "div",
10064
10075
  {
@@ -10066,8 +10077,11 @@ function FileAttachmentRow({
10066
10077
  "group w-full transition-opacity",
10067
10078
  !stacked && "flex min-w-[220px] items-center gap-2",
10068
10079
  stacked && "py-1.5",
10069
- stacked && showDivider && (inBubble && isSender ? "border-t border-white/15" : "border-t border-(--chat-border)/35"),
10070
- !stacked && !inBubble && "rounded-2xl border border-(--chat-border) bg-(--chat-surface) p-2 shadow-sm",
10080
+ stacked && showDivider && (onThemeBubble ? "border-t border-white/15" : "border-t border-(--chat-border)/35"),
10081
+ !stacked && "rounded-xl border p-2.5",
10082
+ !stacked && onThemeBubble && "border-white/20 bg-white/12 text-white shadow-[inset_0_1px_0_rgba(255,255,255,0.08)] backdrop-blur-[2px]",
10083
+ !stacked && onIncomingBubble && "border-(--chat-border)/70 bg-(--chat-elevated) text-(--chat-text) shadow-sm [.dark_&]:bg-(--chat-surface)",
10084
+ !stacked && !inBubble && "border-(--chat-border) bg-(--chat-surface) shadow-sm",
10071
10085
  !fileUrl && "pointer-events-none opacity-60",
10072
10086
  isCaptionActive && "opacity-90"
10073
10087
  ),
@@ -10079,36 +10093,31 @@ function FileAttachmentRow({
10079
10093
  type: "button",
10080
10094
  onClick: handleFileOpen,
10081
10095
  disabled: !fileUrl || selectionMode,
10082
- className: "flex min-w-0 flex-1 items-center gap-2 text-left disabled:cursor-default",
10096
+ className: "flex min-w-0 flex-1 items-center gap-2.5 text-left disabled:cursor-default",
10083
10097
  children: [
10084
10098
  /* @__PURE__ */ jsx("div", { className: cn(
10085
- "flex shrink-0 items-center justify-center rounded-lg text-white",
10086
- stacked ? "size-9" : "size-10 rounded-xl shadow-sm",
10099
+ "flex size-10 shrink-0 items-center justify-center rounded-lg text-white shadow-sm",
10087
10100
  getAttachmentIconBoxClass(rawName)
10088
- ), children: getAttachmentIcon(rawName, "file", "text-white", stacked ? 18 : 20) }),
10101
+ ), children: getAttachmentIcon(rawName, "file", "text-white", 18) }),
10089
10102
  /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
10090
10103
  /* @__PURE__ */ jsx("span", { className: cn(
10091
- "block truncate text-xs font-medium leading-tight",
10092
- inBubble && isSender ? "text-white" : "text-(--chat-text)"
10104
+ "block truncate text-[12px] font-semibold leading-tight",
10105
+ onThemeBubble ? "text-white" : "text-(--chat-text)"
10093
10106
  ), children: displayName }),
10094
10107
  /* @__PURE__ */ jsx("span", { className: cn(
10095
- "mt-0.5 block truncate text-[10px] leading-tight uppercase",
10096
- inBubble && isSender ? "text-white/60" : "text-(--chat-muted)"
10108
+ "mt-0.5 block truncate text-[10px] font-medium leading-tight uppercase tracking-wide",
10109
+ onThemeBubble ? "text-white/70" : "text-(--chat-muted)"
10097
10110
  ), children: subtitle })
10098
10111
  ] }),
10099
10112
  /* @__PURE__ */ jsx(
10100
10113
  "span",
10101
10114
  {
10102
10115
  className: cn(
10103
- "flex shrink-0 items-center justify-center transition-colors",
10104
- stacked ? "size-6 text-(--chat-muted) group-hover:text-(--chat-theme)" : cn(
10105
- "size-7 rounded-lg border",
10106
- inBubble && isSender ? "border-white/15 bg-white/10 text-white/80 group-hover:bg-white/15 group-hover:text-white" : "border-(--chat-border) bg-(--chat-elevated) text-(--chat-muted) group-hover:text-(--chat-theme)"
10107
- ),
10108
- stacked && inBubble && isSender && "text-white/70 group-hover:text-white"
10116
+ "flex size-8 shrink-0 items-center justify-center rounded-full transition-colors",
10117
+ onThemeBubble ? "text-white/80 group-hover:bg-white/10 group-hover:text-white" : "text-(--chat-muted) group-hover:bg-(--chat-hover) group-hover:text-(--chat-theme)"
10109
10118
  ),
10110
10119
  "aria-hidden": true,
10111
- children: /* @__PURE__ */ jsx(Eye, { size: stacked ? 13 : 14 })
10120
+ children: /* @__PURE__ */ jsx(Eye, { size: 14 })
10112
10121
  }
10113
10122
  )
10114
10123
  ]
@@ -10119,13 +10128,13 @@ function FileAttachmentRow({
10119
10128
  {
10120
10129
  onClick: onEditCaption,
10121
10130
  label: `${attachmentCaption ? "Edit" : "Add"} caption for ${displayName}`,
10122
- className: inBubble && isSender ? "text-white/60 hover:text-white" : void 0
10131
+ className: onThemeBubble ? "text-white/60 hover:text-white" : void 0
10123
10132
  }
10124
10133
  )
10125
10134
  ] }),
10126
10135
  stacked && attachmentCaption ? /* @__PURE__ */ jsx("p", { className: cn(
10127
- "mt-1 whitespace-pre-wrap break-words pl-11 pr-7 text-[11px] leading-snug",
10128
- inBubble && isSender ? "text-white/85" : "text-(--chat-text-secondary)"
10136
+ "mt-1 whitespace-pre-wrap break-words pl-12 pr-8 text-[11px] leading-snug",
10137
+ onThemeBubble ? "text-white/85" : "text-(--chat-text-secondary)"
10129
10138
  ), children: attachmentCaption }) : null
10130
10139
  ]
10131
10140
  }
@@ -10244,17 +10253,30 @@ function MessageAttachmentsNonImageSection({
10244
10253
  att.id
10245
10254
  );
10246
10255
  };
10247
- return /* @__PURE__ */ jsx(Fragment, { children: nonImageGroups.map((group) => {
10256
+ return /* @__PURE__ */ jsx("div", { className: "flex w-full flex-col gap-1.5", children: nonImageGroups.map((group) => {
10248
10257
  if (group.kind === "file-run") {
10249
10258
  if (group.items.length === 1) {
10250
10259
  return renderFileAttachmentFrame(group.items[0]);
10251
10260
  }
10252
- return /* @__PURE__ */ jsx("div", { className: "w-full min-w-[220px]", children: group.items.map(
10253
- (att2, index) => renderFileAttachmentFrame(att2, {
10254
- stacked: true,
10255
- showDivider: index > 0
10256
- })
10257
- ) }, `file-run-${group.items.map((item) => item.id).join("-")}`);
10261
+ return /* @__PURE__ */ jsx(
10262
+ "div",
10263
+ {
10264
+ className: cn(
10265
+ "w-full min-w-[220px]",
10266
+ isBubbleLayout && "rounded-xl border p-2",
10267
+ isBubbleLayout && isSender && "border-white/20 bg-white/12 shadow-[inset_0_1px_0_rgba(255,255,255,0.08)] backdrop-blur-[2px]",
10268
+ isBubbleLayout && !isSender && "border-(--chat-border)/70 bg-(--chat-elevated) shadow-sm [.dark_&]:bg-(--chat-surface)",
10269
+ !isBubbleLayout && "rounded-xl border border-(--chat-border) bg-(--chat-surface) p-2 shadow-sm"
10270
+ ),
10271
+ children: group.items.map(
10272
+ (att2, index) => renderFileAttachmentFrame(att2, {
10273
+ stacked: true,
10274
+ showDivider: index > 0
10275
+ })
10276
+ )
10277
+ },
10278
+ `file-run-${group.items.map((item) => item.id).join("-")}`
10279
+ );
10258
10280
  }
10259
10281
  const att = group.item;
10260
10282
  const type = resolveAttachmentType(att);
@@ -10344,11 +10366,12 @@ function MessageAttachmentsView({
10344
10366
  const isImageOnlyBubble = isBubbleLayout && nonImages.length === 0 && images.length > 0;
10345
10367
  const showImageMetaOverlay = isImageOnlyBubble && !hasMessageCaption && !anyImageHasCaption && !attachmentSelectionMode;
10346
10368
  const showCaptionBar = showBottomBar && (!isImageOnlyBubble || hasMessageCaption);
10347
- const bubbleSurface = !isBubbleLayout ? void 0 : isImageOnlyBubble && !hasMessageCaption && !anyImageHasCaption ? "media" : isSender ? "sent" : "received";
10369
+ const canShowSenderName = !!isGroup && !isSender && !!showSenderLabel && !!senderName;
10370
+ const showForwardedInHeader = isBubbleLayout && isForwarded;
10371
+ const bubbleSurface = !isBubbleLayout ? void 0 : isImageOnlyBubble && !hasMessageCaption && !anyImageHasCaption && !isForwarded && !canShowSenderName ? "media" : isSender ? "sent" : "received";
10348
10372
  const metaTimeClass = showImageMetaOverlay ? "text-white/90" : isSender ? "text-white/70" : "text-(--chat-muted)";
10349
10373
  const metaBorderClass = isSender ? "border-white/15" : "border-(--chat-border)/40";
10350
10374
  const metaBadgeVariant = showImageMetaOverlay || isBubbleLayout && isSender ? "on-dark" : "default";
10351
- const isForwardedImageOnly = isBubbleLayout && isForwarded && isImageOnlyBubble;
10352
10375
  return /* @__PURE__ */ jsxs(
10353
10376
  "div",
10354
10377
  {
@@ -10367,29 +10390,39 @@ function MessageAttachmentsView({
10367
10390
  isSender,
10368
10391
  surface: bubbleSurface,
10369
10392
  className: cn(
10370
- isImageOnlyBubble ? "p-0" : isForwarded ? "px-2 py-0.5" : "px-2.5 py-1"
10393
+ isImageOnlyBubble ? "overflow-hidden p-0" : isForwarded || canShowSenderName ? "px-2 py-1" : cn(
10394
+ "px-2.5",
10395
+ nonImages.length > 1 || images.length > 0 && nonImages.length > 0 ? "py-1.5" : "py-1"
10396
+ )
10371
10397
  )
10372
10398
  })
10373
10399
  ),
10374
10400
  children: [
10375
- !isSender && showSenderLabel && senderName && /* @__PURE__ */ jsx("div", { className: "px-0.5 pb-1", children: /* @__PURE__ */ jsx(GroupSenderName, { name: senderName }) }),
10376
- isBubbleLayout && isForwarded && !isForwardedImageOnly && /* @__PURE__ */ jsx(MessageForwardedLabel, { isSender, className: "px-0 pt-0 pb-0" }),
10401
+ (canShowSenderName || showForwardedInHeader) && /* @__PURE__ */ jsxs(
10402
+ "div",
10403
+ {
10404
+ className: cn(
10405
+ "relative z-10 flex min-w-0 flex-col gap-0.5",
10406
+ isImageOnlyBubble ? "px-2.5 pt-1.5 pb-1" : "px-0.5 pb-0.5"
10407
+ ),
10408
+ children: [
10409
+ canShowSenderName ? /* @__PURE__ */ jsx(GroupSenderName, { name: senderName }) : null,
10410
+ showForwardedInHeader ? /* @__PURE__ */ jsx(
10411
+ MessageForwardedLabel,
10412
+ {
10413
+ isSender,
10414
+ className: "px-0 pt-0 pb-0"
10415
+ }
10416
+ ) : null
10417
+ ]
10418
+ }
10419
+ ),
10377
10420
  isBubbleLayout && replySnippet ? /* @__PURE__ */ jsx("div", { className: "px-2 pb-1", children: replySnippet }) : null,
10378
10421
  /* @__PURE__ */ jsxs("div", { className: cn(
10379
10422
  "flex w-full flex-col",
10380
- !isImageOnlyBubble && "gap-0",
10381
- isImageOnlyBubble && "relative overflow-hidden rounded-[inherit]"
10423
+ !isImageOnlyBubble && (images.length > 0 && nonImages.length > 0 ? "gap-1.5" : "gap-0"),
10424
+ isImageOnlyBubble && "relative overflow-hidden"
10382
10425
  ), children: [
10383
- isForwardedImageOnly && /* @__PURE__ */ jsx(
10384
- "div",
10385
- {
10386
- className: cn(
10387
- "pointer-events-none absolute inset-x-0 top-0 z-20 px-2 py-0.5",
10388
- isSender ? "bg-linear-to-b from-(--chat-theme)/95 via-(--chat-theme)/55 to-transparent" : "bg-linear-to-b from-(--chat-incoming-bubble)/95 via-(--chat-incoming-bubble)/55 to-transparent"
10389
- ),
10390
- children: /* @__PURE__ */ jsx(MessageForwardedLabel, { isSender, overlay: true, className: "px-0 pt-0 pb-0" })
10391
- }
10392
- ),
10393
10426
  /* @__PURE__ */ jsx(
10394
10427
  MessageAttachmentsImageSection,
10395
10428
  {
@@ -13827,6 +13860,7 @@ function MessageItemTextBubble({
13827
13860
  isSender,
13828
13861
  className: extra
13829
13862
  });
13863
+ const canShowSenderName = !!isGroup && !isSender && !!showSenderLabel && !!senderName;
13830
13864
  return /* @__PURE__ */ jsxs(
13831
13865
  "div",
13832
13866
  {
@@ -13834,15 +13868,17 @@ function MessageItemTextBubble({
13834
13868
  bubbleClasses(
13835
13869
  cn(
13836
13870
  "flex min-w-[72px] flex-col transition-all duration-200",
13837
- isForwarded ? "gap-0.5 px-2.5 py-1.5 text-[13px]" : "gap-1 px-3.5 py-2.5 text-[14px]"
13871
+ canShowSenderName ? "gap-0.5 px-2.5 py-1.5 text-[14px]" : isForwarded ? "gap-0.5 px-2.5 py-1.5 text-[13px]" : "gap-1 px-3.5 py-2.5 text-[14px]"
13838
13872
  )
13839
13873
  ),
13840
13874
  isPending && "opacity-70",
13841
13875
  isHighlighted && (isSender ? "ring-2 ring-amber-300/60" : "ring-2 ring-amber-200/60")
13842
13876
  ),
13843
13877
  children: [
13844
- isForwarded && /* @__PURE__ */ jsx(MessageForwardedLabel, { isSender, className: "px-0 pt-0 pb-0" }),
13845
- !isSender && showSenderLabel && senderName && /* @__PURE__ */ jsx(GroupSenderName, { name: senderName, className: "mb-0.5" }),
13878
+ (canShowSenderName || isForwarded) && /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-0.5", children: [
13879
+ canShowSenderName ? /* @__PURE__ */ jsx(GroupSenderName, { name: senderName }) : null,
13880
+ isForwarded ? /* @__PURE__ */ jsx(MessageForwardedLabel, { isSender, className: "px-0 pt-0 pb-0" }) : null
13881
+ ] }),
13846
13882
  /* @__PURE__ */ jsx(
13847
13883
  MessageReplySnippet_default,
13848
13884
  {