@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.cjs CHANGED
@@ -860,6 +860,9 @@ var init_conversation_helpers = __esm({
860
860
  const mergedParticipants = conversation.participants !== void 0 ? mergeConversationParticipants(existing?.participants, conversation.participants) : existing?.participants ?? conversation.participants;
861
861
  const isGroup = isGroupConversation(conversation) || isGroupConversation(existing);
862
862
  const resolvedGroupImage = resolveGroupImage(conversation) || resolveGroupImage(existing);
863
+ const incomingGroupName = typeof conversation.groupName === "string" && conversation.groupName.trim() || typeof conversation.name === "string" && conversation.name.trim() || "";
864
+ const existingGroupName = typeof existing?.groupName === "string" && existing.groupName.trim() || typeof existing?.name === "string" && existing.name.trim() || "";
865
+ const resolvedGroupName = incomingGroupName || existingGroupName || void 0;
863
866
  return {
864
867
  ...existing,
865
868
  ...conversation,
@@ -867,7 +870,10 @@ var init_conversation_helpers = __esm({
867
870
  isGroup,
868
871
  isBlocked: resolvedBlocked,
869
872
  lastMessage: mergeLastMessage(existing?.lastMessage, conversation.lastMessage),
870
- ...isGroup && resolvedGroupImage ? { image: resolvedGroupImage, groupImage: resolvedGroupImage } : {}
873
+ ...isGroup ? {
874
+ ...resolvedGroupName ? { groupName: resolvedGroupName, name: resolvedGroupName } : {},
875
+ ...resolvedGroupImage ? { image: resolvedGroupImage, groupImage: resolvedGroupImage } : {}
876
+ } : {}
871
877
  };
872
878
  };
873
879
  resolveConversationLastMessage = (conversation, messagesByConversation) => {
@@ -2803,8 +2809,7 @@ var init_message_handlers = __esm({
2803
2809
  conversationType: lastDM.conversationType || "individual",
2804
2810
  isGroup: false,
2805
2811
  ...shouldIncludeParticipants ? { participants: participantSeed } : {},
2806
- groupName: lastDM.groupName,
2807
- name: lastDM.groupName,
2812
+ ...lastDM.groupName ? { groupName: lastDM.groupName, name: lastDM.groupName } : {},
2808
2813
  owner: existingConv?.owner ?? lastDM.owner
2809
2814
  },
2810
2815
  {
@@ -3147,8 +3152,10 @@ var init_group_handlers = __esm({
3147
3152
  _id: conversationId,
3148
3153
  conversationType: "group",
3149
3154
  isGroup: true,
3150
- groupName: lastDM.groupName,
3151
- name: lastDM.groupName,
3155
+ ...lastDM.groupName || lastDM.name ? {
3156
+ groupName: lastDM.groupName || lastDM.name,
3157
+ name: lastDM.groupName || lastDM.name
3158
+ } : {},
3152
3159
  participants: buildParticipantsFromMessagePayload(lastDM, loggedUserId)
3153
3160
  },
3154
3161
  {
@@ -3186,8 +3193,10 @@ var init_group_handlers = __esm({
3186
3193
  _id: conversationId,
3187
3194
  conversationType: "group",
3188
3195
  isGroup: true,
3189
- groupName: lastDM.groupName,
3190
- name: lastDM.groupName,
3196
+ ...lastDM.groupName || lastDM.name ? {
3197
+ groupName: lastDM.groupName || lastDM.name,
3198
+ name: lastDM.groupName || lastDM.name
3199
+ } : {},
3191
3200
  participants: buildParticipantsFromMessagePayload(lastDM, loggedUserId)
3192
3201
  },
3193
3202
  {
@@ -8858,7 +8867,7 @@ function MessageAttachmentsCaptionBar({
8858
8867
  onCancelEdit
8859
8868
  }) {
8860
8869
  if (isStandaloneMetaOnly) {
8861
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end pt-0.5", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-0.5", children: [
8870
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end pt-1.5 pb-0.5", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-0.5", children: [
8862
8871
  /* @__PURE__ */ jsxRuntime.jsx(
8863
8872
  MessageCornerBadges,
8864
8873
  {
@@ -10069,6 +10078,8 @@ function FileAttachmentRow({
10069
10078
  }
10070
10079
  window.open(fileUrl, "_blank", "noopener,noreferrer");
10071
10080
  };
10081
+ const onThemeBubble = inBubble && isSender;
10082
+ const onIncomingBubble = inBubble && !isSender;
10072
10083
  return /* @__PURE__ */ jsxRuntime.jsxs(
10073
10084
  "div",
10074
10085
  {
@@ -10076,8 +10087,11 @@ function FileAttachmentRow({
10076
10087
  "group w-full transition-opacity",
10077
10088
  !stacked && "flex min-w-[220px] items-center gap-2",
10078
10089
  stacked && "py-1.5",
10079
- stacked && showDivider && (inBubble && isSender ? "border-t border-white/15" : "border-t border-(--chat-border)/35"),
10080
- !stacked && !inBubble && "rounded-2xl border border-(--chat-border) bg-(--chat-surface) p-2 shadow-sm",
10090
+ stacked && showDivider && (onThemeBubble ? "border-t border-white/15" : "border-t border-(--chat-border)/35"),
10091
+ !stacked && "rounded-xl border p-2.5",
10092
+ !stacked && onThemeBubble && "border-white/20 bg-white/12 text-white shadow-[inset_0_1px_0_rgba(255,255,255,0.08)] backdrop-blur-[2px]",
10093
+ !stacked && onIncomingBubble && "border-(--chat-border)/70 bg-(--chat-elevated) text-(--chat-text) shadow-sm [.dark_&]:bg-(--chat-surface)",
10094
+ !stacked && !inBubble && "border-(--chat-border) bg-(--chat-surface) shadow-sm",
10081
10095
  !fileUrl && "pointer-events-none opacity-60",
10082
10096
  isCaptionActive && "opacity-90"
10083
10097
  ),
@@ -10089,36 +10103,31 @@ function FileAttachmentRow({
10089
10103
  type: "button",
10090
10104
  onClick: handleFileOpen,
10091
10105
  disabled: !fileUrl || selectionMode,
10092
- className: "flex min-w-0 flex-1 items-center gap-2 text-left disabled:cursor-default",
10106
+ className: "flex min-w-0 flex-1 items-center gap-2.5 text-left disabled:cursor-default",
10093
10107
  children: [
10094
10108
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(
10095
- "flex shrink-0 items-center justify-center rounded-lg text-white",
10096
- stacked ? "size-9" : "size-10 rounded-xl shadow-sm",
10109
+ "flex size-10 shrink-0 items-center justify-center rounded-lg text-white shadow-sm",
10097
10110
  getAttachmentIconBoxClass(rawName)
10098
- ), children: getAttachmentIcon(rawName, "file", "text-white", stacked ? 18 : 20) }),
10111
+ ), children: getAttachmentIcon(rawName, "file", "text-white", 18) }),
10099
10112
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
10100
10113
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(
10101
- "block truncate text-xs font-medium leading-tight",
10102
- inBubble && isSender ? "text-white" : "text-(--chat-text)"
10114
+ "block truncate text-[12px] font-semibold leading-tight",
10115
+ onThemeBubble ? "text-white" : "text-(--chat-text)"
10103
10116
  ), children: displayName }),
10104
10117
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(
10105
- "mt-0.5 block truncate text-[10px] leading-tight uppercase",
10106
- inBubble && isSender ? "text-white/60" : "text-(--chat-muted)"
10118
+ "mt-0.5 block truncate text-[10px] font-medium leading-tight uppercase tracking-wide",
10119
+ onThemeBubble ? "text-white/70" : "text-(--chat-muted)"
10107
10120
  ), children: subtitle })
10108
10121
  ] }),
10109
10122
  /* @__PURE__ */ jsxRuntime.jsx(
10110
10123
  "span",
10111
10124
  {
10112
10125
  className: cn(
10113
- "flex shrink-0 items-center justify-center transition-colors",
10114
- stacked ? "size-6 text-(--chat-muted) group-hover:text-(--chat-theme)" : cn(
10115
- "size-7 rounded-lg border",
10116
- 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)"
10117
- ),
10118
- stacked && inBubble && isSender && "text-white/70 group-hover:text-white"
10126
+ "flex size-8 shrink-0 items-center justify-center rounded-full transition-colors",
10127
+ 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)"
10119
10128
  ),
10120
10129
  "aria-hidden": true,
10121
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Eye, { size: stacked ? 13 : 14 })
10130
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Eye, { size: 14 })
10122
10131
  }
10123
10132
  )
10124
10133
  ]
@@ -10129,13 +10138,13 @@ function FileAttachmentRow({
10129
10138
  {
10130
10139
  onClick: onEditCaption,
10131
10140
  label: `${attachmentCaption ? "Edit" : "Add"} caption for ${displayName}`,
10132
- className: inBubble && isSender ? "text-white/60 hover:text-white" : void 0
10141
+ className: onThemeBubble ? "text-white/60 hover:text-white" : void 0
10133
10142
  }
10134
10143
  )
10135
10144
  ] }),
10136
10145
  stacked && attachmentCaption ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: cn(
10137
- "mt-1 whitespace-pre-wrap break-words pl-11 pr-7 text-[11px] leading-snug",
10138
- inBubble && isSender ? "text-white/85" : "text-(--chat-text-secondary)"
10146
+ "mt-1 whitespace-pre-wrap break-words pl-12 pr-8 text-[11px] leading-snug",
10147
+ onThemeBubble ? "text-white/85" : "text-(--chat-text-secondary)"
10139
10148
  ), children: attachmentCaption }) : null
10140
10149
  ]
10141
10150
  }
@@ -10254,17 +10263,30 @@ function MessageAttachmentsNonImageSection({
10254
10263
  att.id
10255
10264
  );
10256
10265
  };
10257
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: nonImageGroups.map((group) => {
10266
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full flex-col gap-1.5", children: nonImageGroups.map((group) => {
10258
10267
  if (group.kind === "file-run") {
10259
10268
  if (group.items.length === 1) {
10260
10269
  return renderFileAttachmentFrame(group.items[0]);
10261
10270
  }
10262
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full min-w-[220px]", children: group.items.map(
10263
- (att2, index) => renderFileAttachmentFrame(att2, {
10264
- stacked: true,
10265
- showDivider: index > 0
10266
- })
10267
- ) }, `file-run-${group.items.map((item) => item.id).join("-")}`);
10271
+ return /* @__PURE__ */ jsxRuntime.jsx(
10272
+ "div",
10273
+ {
10274
+ className: cn(
10275
+ "w-full min-w-[220px]",
10276
+ isBubbleLayout && "rounded-xl border p-2",
10277
+ isBubbleLayout && isSender && "border-white/20 bg-white/12 shadow-[inset_0_1px_0_rgba(255,255,255,0.08)] backdrop-blur-[2px]",
10278
+ isBubbleLayout && !isSender && "border-(--chat-border)/70 bg-(--chat-elevated) shadow-sm [.dark_&]:bg-(--chat-surface)",
10279
+ !isBubbleLayout && "rounded-xl border border-(--chat-border) bg-(--chat-surface) p-2 shadow-sm"
10280
+ ),
10281
+ children: group.items.map(
10282
+ (att2, index) => renderFileAttachmentFrame(att2, {
10283
+ stacked: true,
10284
+ showDivider: index > 0
10285
+ })
10286
+ )
10287
+ },
10288
+ `file-run-${group.items.map((item) => item.id).join("-")}`
10289
+ );
10268
10290
  }
10269
10291
  const att = group.item;
10270
10292
  const type = resolveAttachmentType(att);
@@ -10378,7 +10400,10 @@ function MessageAttachmentsView({
10378
10400
  isSender,
10379
10401
  surface: bubbleSurface,
10380
10402
  className: cn(
10381
- isImageOnlyBubble ? "overflow-hidden p-0" : isForwarded || canShowSenderName ? "px-2 py-0.5" : "px-2.5 py-1"
10403
+ isImageOnlyBubble ? "overflow-hidden p-0" : isForwarded || canShowSenderName ? "px-2 py-1" : cn(
10404
+ "px-2.5",
10405
+ nonImages.length > 1 || images.length > 0 && nonImages.length > 0 ? "py-1.5" : "py-1"
10406
+ )
10382
10407
  )
10383
10408
  })
10384
10409
  ),
@@ -10405,7 +10430,7 @@ function MessageAttachmentsView({
10405
10430
  isBubbleLayout && replySnippet ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2 pb-1", children: replySnippet }) : null,
10406
10431
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(
10407
10432
  "flex w-full flex-col",
10408
- !isImageOnlyBubble && "gap-0",
10433
+ !isImageOnlyBubble && (images.length > 0 && nonImages.length > 0 ? "gap-1.5" : "gap-0"),
10409
10434
  isImageOnlyBubble && "relative overflow-hidden"
10410
10435
  ), children: [
10411
10436
  /* @__PURE__ */ jsxRuntime.jsx(