@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.cjs CHANGED
@@ -6906,8 +6906,21 @@ function AdminPermissionTooltip({
6906
6906
  if (!disabled || !message) {
6907
6907
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
6908
6908
  }
6909
+ const gatedChildren = React3__namespace.default.Children.map(children, (child) => {
6910
+ if (!React3__namespace.default.isValidElement(child)) return child;
6911
+ return React3__namespace.default.cloneElement(child, {
6912
+ className: cn(child.props.className, "pointer-events-none")
6913
+ });
6914
+ });
6909
6915
  return /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
6910
- /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("inline-flex", className), children }) }),
6916
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
6917
+ "span",
6918
+ {
6919
+ className: cn("inline-flex cursor-not-allowed", className),
6920
+ tabIndex: 0,
6921
+ children: gatedChildren
6922
+ }
6923
+ ) }),
6911
6924
  /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { side, className: "max-w-[240px] text-xs", children: message })
6912
6925
  ] });
6913
6926
  }
@@ -7320,9 +7333,34 @@ var PushNotificationToggle = ({
7320
7333
  children
7321
7334
  }) => {
7322
7335
  const push = usePushNotifications();
7323
- const { getPushNotificationGate } = useEffectiveSettingsOptional();
7336
+ const { loading: settingsLoading, getPushNotificationGate } = useEffectiveSettingsOptional();
7324
7337
  const adminGate = getPushNotificationGate();
7325
7338
  const [isToggling, setIsToggling] = React3.useState(false);
7339
+ const isBootstrapping = push.loading || settingsLoading;
7340
+ if (isBootstrapping && !push.supported) {
7341
+ return /* @__PURE__ */ jsxRuntime.jsxs(
7342
+ "div",
7343
+ {
7344
+ className: cn(
7345
+ "flex items-center justify-between gap-4 rounded-xl border border-(--chat-border) bg-(--chat-surface) px-4 py-3",
7346
+ className
7347
+ ),
7348
+ children: [
7349
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-0.5", children: [
7350
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-(--chat-text)", children: label }),
7351
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-(--chat-muted)", children: "Loading\u2026" })
7352
+ ] }),
7353
+ /* @__PURE__ */ jsxRuntime.jsx(
7354
+ lucideReact.Loader2,
7355
+ {
7356
+ className: "size-5 shrink-0 animate-spin text-(--chat-theme)",
7357
+ "aria-label": "Loading push notification settings"
7358
+ }
7359
+ )
7360
+ ]
7361
+ }
7362
+ );
7363
+ }
7326
7364
  if (!push.supported) {
7327
7365
  return null;
7328
7366
  }
@@ -7330,8 +7368,8 @@ var PushNotificationToggle = ({
7330
7368
  const permissionBlocked = push.permission === "denied";
7331
7369
  const adminBlocked = !adminGate.enabled;
7332
7370
  const notConfigured = !push.configured;
7333
- const showLoader = isToggling;
7334
- const isDisabled = showLoader || permissionBlocked || push.loading || adminBlocked || notConfigured;
7371
+ const showLoader = isToggling || isBootstrapping;
7372
+ const isDisabled = showLoader || permissionBlocked || push.loading || settingsLoading || adminBlocked || notConfigured;
7335
7373
  const handleChange = async (checked) => {
7336
7374
  if (adminBlocked || notConfigured) return;
7337
7375
  setIsToggling(true);
@@ -9003,14 +9041,12 @@ var DefaultHeaderCallActions = ({
9003
9041
  onVideoCall,
9004
9042
  className
9005
9043
  }) => {
9006
- const { components, slotClassName, features } = useChatCustomizationOptional();
9044
+ const { components, slotClassName } = useChatCustomizationOptional();
9007
9045
  const { getAudioCallGate, getVideoCallGate } = useEffectiveSettingsOptional();
9008
9046
  const PhoneSlot = components.PhoneCallButton;
9009
9047
  const VideoSlot = components.VideoCallButton;
9010
- const hideInGroups = features.hideCallActionsInGroupChats ?? false;
9011
9048
  const audioGate = getAudioCallGate();
9012
9049
  const videoGate = getVideoCallGate();
9013
- if (hideInGroups && activeChannel.isGroup) return null;
9014
9050
  if (!showPhoneCall && !showVideoCall) return null;
9015
9051
  const phoneEnabled = showPhoneCall && audioGate.enabled;
9016
9052
  const videoEnabled = showVideoCall && videoGate.enabled;
@@ -9020,6 +9056,7 @@ var DefaultHeaderCallActions = ({
9020
9056
  {
9021
9057
  disabled: !audioGate.enabled,
9022
9058
  message: audioGate.disabledReason,
9059
+ side: "bottom",
9023
9060
  children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-flex", children: /* @__PURE__ */ jsxRuntime.jsx(
9024
9061
  PhoneSlot,
9025
9062
  {
@@ -9029,7 +9066,7 @@ var DefaultHeaderCallActions = ({
9029
9066
  className: cn(
9030
9067
  className,
9031
9068
  slotClassName("phoneCallButton"),
9032
- !audioGate.enabled && "pointer-events-none opacity-40"
9069
+ !audioGate.enabled && "opacity-40"
9033
9070
  )
9034
9071
  }
9035
9072
  ) })
@@ -9039,6 +9076,7 @@ var DefaultHeaderCallActions = ({
9039
9076
  {
9040
9077
  disabled: !audioGate.enabled,
9041
9078
  message: audioGate.disabledReason,
9079
+ side: "bottom",
9042
9080
  children: /* @__PURE__ */ jsxRuntime.jsx(
9043
9081
  Button,
9044
9082
  {
@@ -9058,6 +9096,7 @@ var DefaultHeaderCallActions = ({
9058
9096
  {
9059
9097
  disabled: !videoGate.enabled,
9060
9098
  message: videoGate.disabledReason,
9099
+ side: "bottom",
9061
9100
  children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-flex", children: /* @__PURE__ */ jsxRuntime.jsx(
9062
9101
  VideoSlot,
9063
9102
  {
@@ -9067,7 +9106,7 @@ var DefaultHeaderCallActions = ({
9067
9106
  className: cn(
9068
9107
  className,
9069
9108
  slotClassName("videoCallButton"),
9070
- !videoGate.enabled && "pointer-events-none opacity-40"
9109
+ !videoGate.enabled && "opacity-40"
9071
9110
  )
9072
9111
  }
9073
9112
  ) })
@@ -9077,6 +9116,7 @@ var DefaultHeaderCallActions = ({
9077
9116
  {
9078
9117
  disabled: !videoGate.enabled,
9079
9118
  message: videoGate.disabledReason,
9119
+ side: "bottom",
9080
9120
  children: /* @__PURE__ */ jsxRuntime.jsx(
9081
9121
  Button,
9082
9122
  {
@@ -9094,16 +9134,13 @@ var DefaultHeaderCallActions = ({
9094
9134
  ] });
9095
9135
  };
9096
9136
  var HeaderCallActions = (props) => {
9097
- const { components, slotClassName, features } = useChatCustomizationOptional();
9137
+ const { components, slotClassName } = useChatCustomizationOptional();
9098
9138
  const Custom = components.HeaderCallActions;
9099
- if (!Custom) {
9100
- const hideInGroups = features.hideCallActionsInGroupChats ?? false;
9101
- const showPhoneCall = props.showPhoneCall ?? true;
9102
- const showVideoCall = props.showVideoCall ?? true;
9103
- if (hideInGroups && props.activeChannel.isGroup) return null;
9104
- if (!showPhoneCall && !showVideoCall) return null;
9105
- }
9106
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex items-center gap-0.5", slotClassName("headerCallActions")), children: Custom ? /* @__PURE__ */ jsxRuntime.jsx(Custom, { ...props }) : /* @__PURE__ */ jsxRuntime.jsx(DefaultHeaderCallActions, { ...props }) });
9139
+ const showPhoneCall = props.showPhoneCall ?? true;
9140
+ const showVideoCall = props.showVideoCall ?? true;
9141
+ if (!showPhoneCall && !showVideoCall) return null;
9142
+ const useCustom = Custom != null && Custom !== HeaderCallActions;
9143
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex items-center gap-0.5", slotClassName("headerCallActions")), children: useCustom ? /* @__PURE__ */ jsxRuntime.jsx(Custom, { ...props }) : /* @__PURE__ */ jsxRuntime.jsx(DefaultHeaderCallActions, { ...props }) });
9107
9144
  };
9108
9145
  var HeaderCallActions_default = HeaderCallActions;
9109
9146
  function OptionsMenuItem({
@@ -13501,8 +13538,8 @@ var PermissionDrawer = ({ isOpen, onOpenChange, conversationId, conversationInfo
13501
13538
  { key: "onlyAdminCanSendMessage", label: "Only Admin Can Send Message", desc: "Restricts message sending to group administrators only." },
13502
13539
  { key: "onlyAdminCanEditInfo", label: "Only Admin Can Edit Info", desc: "Only admins can change group name, description, and avatar." },
13503
13540
  { key: "senderCanEditMessage", label: "Sender Can Edit Message", desc: "Allows users to edit their own sent messages." },
13504
- { key: "allowMemberAdd", label: "Only Admin Can Add Members", desc: "Only administrators can add new participants to the group.", inverted: true },
13505
- { key: "allowMemberRemove", label: "Only Admin Can Remove Members", desc: "Only administrators can remove other participants.", inverted: true },
13541
+ { key: "allowMemberAdd", label: "Allow Members to Add", desc: "Allows group members to add new participants." },
13542
+ { key: "allowMemberRemove", label: "Allow Members to Remove", desc: "Allows group members to remove other participants." },
13506
13543
  { key: "moderationEnabled", label: "Moderation Enabled", desc: "Enables advanced message moderation features." }
13507
13544
  ];
13508
13545
  return /* @__PURE__ */ jsxRuntime.jsx(Sheet, { open: isOpen, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(ChatSheetContent, { showCloseButton: true, className: "sm:max-w-[380px]", children: [
@@ -13518,7 +13555,7 @@ var PermissionDrawer = ({ isOpen, onOpenChange, conversationId, conversationInfo
13518
13555
  /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "mb-1 px-0.5 text-[10px] font-semibold uppercase tracking-wide text-(--chat-muted)", children: "Permissions" }),
13519
13556
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border border-(--chat-border) px-3", children: permissionItems.map((item, index) => {
13520
13557
  const locked = isGroupPermissionLocked(item.key);
13521
- const checked = item.inverted ? !permissions[item.key] : permissions[item.key];
13558
+ const checked = permissions[item.key];
13522
13559
  return /* @__PURE__ */ jsxRuntime.jsxs(
13523
13560
  "div",
13524
13561
  {