@realtimexsco/live-chat 1.4.15 → 1.4.16

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.mts CHANGED
@@ -560,8 +560,8 @@ interface ChatFeatures {
560
560
  /** Show video call button in header (default: `true`) */
561
561
  showVideoCall?: boolean;
562
562
  /**
563
- * When `true`, hide phone/video buttons in group chats.
564
- * Default: `false` (buttons show in all chats).
563
+ * @deprecated Call permission gates from effective settings now apply the same
564
+ * in DM and group chats. Buttons stay visible; use showPhoneCall/showVideoCall to hide.
565
565
  */
566
566
  hideCallActionsInGroupChats?: boolean;
567
567
  /** Called when user taps voice call */
package/dist/index.d.ts CHANGED
@@ -560,8 +560,8 @@ interface ChatFeatures {
560
560
  /** Show video call button in header (default: `true`) */
561
561
  showVideoCall?: boolean;
562
562
  /**
563
- * When `true`, hide phone/video buttons in group chats.
564
- * Default: `false` (buttons show in all chats).
563
+ * @deprecated Call permission gates from effective settings now apply the same
564
+ * in DM and group chats. Buttons stay visible; use showPhoneCall/showVideoCall to hide.
565
565
  */
566
566
  hideCallActionsInGroupChats?: boolean;
567
567
  /** Called when user taps voice call */
package/dist/index.mjs CHANGED
@@ -6878,8 +6878,21 @@ function AdminPermissionTooltip({
6878
6878
  if (!disabled || !message) {
6879
6879
  return /* @__PURE__ */ jsx(Fragment, { children });
6880
6880
  }
6881
+ const gatedChildren = React3__default.Children.map(children, (child) => {
6882
+ if (!React3__default.isValidElement(child)) return child;
6883
+ return React3__default.cloneElement(child, {
6884
+ className: cn(child.props.className, "pointer-events-none")
6885
+ });
6886
+ });
6881
6887
  return /* @__PURE__ */ jsxs(Tooltip, { children: [
6882
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: cn("inline-flex", className), children }) }),
6888
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
6889
+ "span",
6890
+ {
6891
+ className: cn("inline-flex cursor-not-allowed", className),
6892
+ tabIndex: 0,
6893
+ children: gatedChildren
6894
+ }
6895
+ ) }),
6883
6896
  /* @__PURE__ */ jsx(TooltipContent, { side, className: "max-w-[240px] text-xs", children: message })
6884
6897
  ] });
6885
6898
  }
@@ -7292,9 +7305,34 @@ var PushNotificationToggle = ({
7292
7305
  children
7293
7306
  }) => {
7294
7307
  const push = usePushNotifications();
7295
- const { getPushNotificationGate } = useEffectiveSettingsOptional();
7308
+ const { loading: settingsLoading, getPushNotificationGate } = useEffectiveSettingsOptional();
7296
7309
  const adminGate = getPushNotificationGate();
7297
7310
  const [isToggling, setIsToggling] = useState(false);
7311
+ const isBootstrapping = push.loading || settingsLoading;
7312
+ if (isBootstrapping && !push.supported) {
7313
+ return /* @__PURE__ */ jsxs(
7314
+ "div",
7315
+ {
7316
+ className: cn(
7317
+ "flex items-center justify-between gap-4 rounded-xl border border-(--chat-border) bg-(--chat-surface) px-4 py-3",
7318
+ className
7319
+ ),
7320
+ children: [
7321
+ /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
7322
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-(--chat-text)", children: label }),
7323
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-(--chat-muted)", children: "Loading\u2026" })
7324
+ ] }),
7325
+ /* @__PURE__ */ jsx(
7326
+ Loader2,
7327
+ {
7328
+ className: "size-5 shrink-0 animate-spin text-(--chat-theme)",
7329
+ "aria-label": "Loading push notification settings"
7330
+ }
7331
+ )
7332
+ ]
7333
+ }
7334
+ );
7335
+ }
7298
7336
  if (!push.supported) {
7299
7337
  return null;
7300
7338
  }
@@ -7302,8 +7340,8 @@ var PushNotificationToggle = ({
7302
7340
  const permissionBlocked = push.permission === "denied";
7303
7341
  const adminBlocked = !adminGate.enabled;
7304
7342
  const notConfigured = !push.configured;
7305
- const showLoader = isToggling;
7306
- const isDisabled = showLoader || permissionBlocked || push.loading || adminBlocked || notConfigured;
7343
+ const showLoader = isToggling || isBootstrapping;
7344
+ const isDisabled = showLoader || permissionBlocked || push.loading || settingsLoading || adminBlocked || notConfigured;
7307
7345
  const handleChange = async (checked) => {
7308
7346
  if (adminBlocked || notConfigured) return;
7309
7347
  setIsToggling(true);
@@ -8975,14 +9013,12 @@ var DefaultHeaderCallActions = ({
8975
9013
  onVideoCall,
8976
9014
  className
8977
9015
  }) => {
8978
- const { components, slotClassName, features } = useChatCustomizationOptional();
9016
+ const { components, slotClassName } = useChatCustomizationOptional();
8979
9017
  const { getAudioCallGate, getVideoCallGate } = useEffectiveSettingsOptional();
8980
9018
  const PhoneSlot = components.PhoneCallButton;
8981
9019
  const VideoSlot = components.VideoCallButton;
8982
- const hideInGroups = features.hideCallActionsInGroupChats ?? false;
8983
9020
  const audioGate = getAudioCallGate();
8984
9021
  const videoGate = getVideoCallGate();
8985
- if (hideInGroups && activeChannel.isGroup) return null;
8986
9022
  if (!showPhoneCall && !showVideoCall) return null;
8987
9023
  const phoneEnabled = showPhoneCall && audioGate.enabled;
8988
9024
  const videoEnabled = showVideoCall && videoGate.enabled;
@@ -8992,6 +9028,7 @@ var DefaultHeaderCallActions = ({
8992
9028
  {
8993
9029
  disabled: !audioGate.enabled,
8994
9030
  message: audioGate.disabledReason,
9031
+ side: "bottom",
8995
9032
  children: /* @__PURE__ */ jsx("span", { className: "inline-flex", children: /* @__PURE__ */ jsx(
8996
9033
  PhoneSlot,
8997
9034
  {
@@ -9001,7 +9038,7 @@ var DefaultHeaderCallActions = ({
9001
9038
  className: cn(
9002
9039
  className,
9003
9040
  slotClassName("phoneCallButton"),
9004
- !audioGate.enabled && "pointer-events-none opacity-40"
9041
+ !audioGate.enabled && "opacity-40"
9005
9042
  )
9006
9043
  }
9007
9044
  ) })
@@ -9011,6 +9048,7 @@ var DefaultHeaderCallActions = ({
9011
9048
  {
9012
9049
  disabled: !audioGate.enabled,
9013
9050
  message: audioGate.disabledReason,
9051
+ side: "bottom",
9014
9052
  children: /* @__PURE__ */ jsx(
9015
9053
  Button,
9016
9054
  {
@@ -9030,6 +9068,7 @@ var DefaultHeaderCallActions = ({
9030
9068
  {
9031
9069
  disabled: !videoGate.enabled,
9032
9070
  message: videoGate.disabledReason,
9071
+ side: "bottom",
9033
9072
  children: /* @__PURE__ */ jsx("span", { className: "inline-flex", children: /* @__PURE__ */ jsx(
9034
9073
  VideoSlot,
9035
9074
  {
@@ -9039,7 +9078,7 @@ var DefaultHeaderCallActions = ({
9039
9078
  className: cn(
9040
9079
  className,
9041
9080
  slotClassName("videoCallButton"),
9042
- !videoGate.enabled && "pointer-events-none opacity-40"
9081
+ !videoGate.enabled && "opacity-40"
9043
9082
  )
9044
9083
  }
9045
9084
  ) })
@@ -9049,6 +9088,7 @@ var DefaultHeaderCallActions = ({
9049
9088
  {
9050
9089
  disabled: !videoGate.enabled,
9051
9090
  message: videoGate.disabledReason,
9091
+ side: "bottom",
9052
9092
  children: /* @__PURE__ */ jsx(
9053
9093
  Button,
9054
9094
  {
@@ -9066,16 +9106,13 @@ var DefaultHeaderCallActions = ({
9066
9106
  ] });
9067
9107
  };
9068
9108
  var HeaderCallActions = (props) => {
9069
- const { components, slotClassName, features } = useChatCustomizationOptional();
9109
+ const { components, slotClassName } = useChatCustomizationOptional();
9070
9110
  const Custom = components.HeaderCallActions;
9071
- if (!Custom) {
9072
- const hideInGroups = features.hideCallActionsInGroupChats ?? false;
9073
- const showPhoneCall = props.showPhoneCall ?? true;
9074
- const showVideoCall = props.showVideoCall ?? true;
9075
- if (hideInGroups && props.activeChannel.isGroup) return null;
9076
- if (!showPhoneCall && !showVideoCall) return null;
9077
- }
9078
- return /* @__PURE__ */ jsx("div", { className: cn("flex items-center gap-0.5", slotClassName("headerCallActions")), children: Custom ? /* @__PURE__ */ jsx(Custom, { ...props }) : /* @__PURE__ */ jsx(DefaultHeaderCallActions, { ...props }) });
9111
+ const showPhoneCall = props.showPhoneCall ?? true;
9112
+ const showVideoCall = props.showVideoCall ?? true;
9113
+ if (!showPhoneCall && !showVideoCall) return null;
9114
+ const useCustom = Custom != null && Custom !== HeaderCallActions;
9115
+ return /* @__PURE__ */ jsx("div", { className: cn("flex items-center gap-0.5", slotClassName("headerCallActions")), children: useCustom ? /* @__PURE__ */ jsx(Custom, { ...props }) : /* @__PURE__ */ jsx(DefaultHeaderCallActions, { ...props }) });
9079
9116
  };
9080
9117
  var HeaderCallActions_default = HeaderCallActions;
9081
9118
  function OptionsMenuItem({
@@ -13473,8 +13510,8 @@ var PermissionDrawer = ({ isOpen, onOpenChange, conversationId, conversationInfo
13473
13510
  { key: "onlyAdminCanSendMessage", label: "Only Admin Can Send Message", desc: "Restricts message sending to group administrators only." },
13474
13511
  { key: "onlyAdminCanEditInfo", label: "Only Admin Can Edit Info", desc: "Only admins can change group name, description, and avatar." },
13475
13512
  { key: "senderCanEditMessage", label: "Sender Can Edit Message", desc: "Allows users to edit their own sent messages." },
13476
- { key: "allowMemberAdd", label: "Only Admin Can Add Members", desc: "Only administrators can add new participants to the group.", inverted: true },
13477
- { key: "allowMemberRemove", label: "Only Admin Can Remove Members", desc: "Only administrators can remove other participants.", inverted: true },
13513
+ { key: "allowMemberAdd", label: "Allow Members to Add", desc: "Allows group members to add new participants." },
13514
+ { key: "allowMemberRemove", label: "Allow Members to Remove", desc: "Allows group members to remove other participants." },
13478
13515
  { key: "moderationEnabled", label: "Moderation Enabled", desc: "Enables advanced message moderation features." }
13479
13516
  ];
13480
13517
  return /* @__PURE__ */ jsx(Sheet, { open: isOpen, onOpenChange, children: /* @__PURE__ */ jsxs(ChatSheetContent, { showCloseButton: true, className: "sm:max-w-[380px]", children: [
@@ -13490,7 +13527,7 @@ var PermissionDrawer = ({ isOpen, onOpenChange, conversationId, conversationInfo
13490
13527
  /* @__PURE__ */ jsx("h3", { className: "mb-1 px-0.5 text-[10px] font-semibold uppercase tracking-wide text-(--chat-muted)", children: "Permissions" }),
13491
13528
  /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-(--chat-border) px-3", children: permissionItems.map((item, index) => {
13492
13529
  const locked = isGroupPermissionLocked(item.key);
13493
- const checked = item.inverted ? !permissions[item.key] : permissions[item.key];
13530
+ const checked = permissions[item.key];
13494
13531
  return /* @__PURE__ */ jsxs(
13495
13532
  "div",
13496
13533
  {