@realtimexsco/live-chat 1.3.3 → 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);
@@ -10368,7 +10390,10 @@ function MessageAttachmentsView({
10368
10390
  isSender,
10369
10391
  surface: bubbleSurface,
10370
10392
  className: cn(
10371
- isImageOnlyBubble ? "overflow-hidden p-0" : isForwarded || canShowSenderName ? "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
+ )
10372
10397
  )
10373
10398
  })
10374
10399
  ),
@@ -10395,7 +10420,7 @@ function MessageAttachmentsView({
10395
10420
  isBubbleLayout && replySnippet ? /* @__PURE__ */ jsx("div", { className: "px-2 pb-1", children: replySnippet }) : null,
10396
10421
  /* @__PURE__ */ jsxs("div", { className: cn(
10397
10422
  "flex w-full flex-col",
10398
- !isImageOnlyBubble && "gap-0",
10423
+ !isImageOnlyBubble && (images.length > 0 && nonImages.length > 0 ? "gap-1.5" : "gap-0"),
10399
10424
  isImageOnlyBubble && "relative overflow-hidden"
10400
10425
  ), children: [
10401
10426
  /* @__PURE__ */ jsx(