@realtimexsco/live-chat 1.4.15 → 1.4.17
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/PERMISSIONS.md +236 -0
- package/README.md +26 -18
- package/dist/index.cjs +118 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +44 -3
- package/dist/index.d.ts +44 -3
- package/dist/index.mjs +117 -37
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +9 -1
- package/package.json +15 -10
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
|
-
*
|
|
564
|
-
*
|
|
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 */
|
|
@@ -743,18 +743,27 @@ interface HeaderCallActionsSlotProps {
|
|
|
743
743
|
showVideoCall?: boolean;
|
|
744
744
|
onPhoneCall?: () => void;
|
|
745
745
|
onVideoCall?: () => void;
|
|
746
|
+
/** From effective settings — custom slots should disable + show tooltip when true. */
|
|
747
|
+
phoneCallDisabled?: boolean;
|
|
748
|
+
videoCallDisabled?: boolean;
|
|
749
|
+
phoneCallDisabledReason?: string | null;
|
|
750
|
+
videoCallDisabledReason?: string | null;
|
|
746
751
|
className?: string;
|
|
747
752
|
}
|
|
748
753
|
interface PhoneCallButtonSlotProps {
|
|
749
754
|
activeChannel: IChannel;
|
|
750
755
|
conversationId: string | null;
|
|
751
756
|
onPhoneCall?: () => void;
|
|
757
|
+
disabled?: boolean;
|
|
758
|
+
disabledReason?: string | null;
|
|
752
759
|
className?: string;
|
|
753
760
|
}
|
|
754
761
|
interface VideoCallButtonSlotProps {
|
|
755
762
|
activeChannel: IChannel;
|
|
756
763
|
conversationId: string | null;
|
|
757
764
|
onVideoCall?: () => void;
|
|
765
|
+
disabled?: boolean;
|
|
766
|
+
disabledReason?: string | null;
|
|
758
767
|
className?: string;
|
|
759
768
|
}
|
|
760
769
|
interface HeaderSearchOverlaySlotProps {
|
|
@@ -1851,4 +1860,36 @@ declare function ChatEffectiveSettingsProvider({ children, enabled, }: {
|
|
|
1851
1860
|
declare function useEffectiveSettings(): ChatEffectiveSettingsContextValue;
|
|
1852
1861
|
declare function useEffectiveSettingsOptional(): ChatEffectiveSettingsContextValue;
|
|
1853
1862
|
|
|
1854
|
-
|
|
1863
|
+
interface AdminPermissionTooltipProps {
|
|
1864
|
+
disabled: boolean;
|
|
1865
|
+
message?: string | null;
|
|
1866
|
+
side?: "top" | "bottom" | "left" | "right";
|
|
1867
|
+
className?: string;
|
|
1868
|
+
children: React__default.ReactNode;
|
|
1869
|
+
}
|
|
1870
|
+
/**
|
|
1871
|
+
* Wraps a control that may be disabled by admin effective-settings.
|
|
1872
|
+
* Tooltip only appears when `disabled` and a message is provided.
|
|
1873
|
+
* Child controls get pointer-events-none so hover hits this wrapper
|
|
1874
|
+
* (native disabled buttons otherwise swallow hover).
|
|
1875
|
+
*/
|
|
1876
|
+
declare function AdminPermissionTooltip({ disabled, message, side, className, children, }: AdminPermissionTooltipProps): React__default.JSX.Element;
|
|
1877
|
+
|
|
1878
|
+
type AdminFeatureKey = "audioCall" | "videoCall" | "pushNotification" | "blockUsers" | "attachments" | "groupCreation";
|
|
1879
|
+
/**
|
|
1880
|
+
* Resolve an admin effective-settings gate for a feature.
|
|
1881
|
+
* Use inside custom slot components so disabled UI + tooltip match package defaults.
|
|
1882
|
+
*
|
|
1883
|
+
* @example
|
|
1884
|
+
* const gate = useAdminFeatureGate("videoCall");
|
|
1885
|
+
* return (
|
|
1886
|
+
* <AdminPermissionTooltip disabled={!gate.enabled} message={gate.disabledReason}>
|
|
1887
|
+
* <button disabled={!gate.enabled} onClick={gate.enabled ? onVideoCall : undefined}>
|
|
1888
|
+
* Video
|
|
1889
|
+
* </button>
|
|
1890
|
+
* </AdminPermissionTooltip>
|
|
1891
|
+
* );
|
|
1892
|
+
*/
|
|
1893
|
+
declare function useAdminFeatureGate(feature: AdminFeatureKey): CallFeatureGate;
|
|
1894
|
+
|
|
1895
|
+
export { ADMIN_PERMISSION_DENIED_MESSAGE, type ActiveChannelMessagesSlotProps, type AdminFeatureKey, AdminPermissionTooltip, type AdminsDrawerSlotProps, type AttachmentsDrawerSlotProps, type AvatarSlotProps, CALLS_NOT_ALLOWED_BY_PLATFORM_MESSAGE, CALLS_NOT_CONFIGURED_MESSAGE, CHAT_API_KEYS, CHAT_GET_API_KEYS, Calendar, CalendarDayButton, type CallFeatureGate, Channel, type ChannelDetailsDrawerSlotProps, ChannelHeaderView as ChannelHeader, type ChannelHeaderSlotProps, ChannelListView as ChannelList, ChannelListItem, type ChannelListItemSlotProps, type ChannelListSlotProps, type ChannelMessageBoxSlotProps, Chat, type ChatActionModalSlotProps, ChatAlertsProvider, type ChatApiKey, type ChatApiVersionConfig, type ChatApiVersionKey, ChatAvatar, type ChatCallContext, type ChatClassNames, type ChatColorMode, type ChatComponents, type ChatCustomizationConfig, ChatCustomizationProvider, ChatDateJumpMenu, type ChatDateTimePreferences, ChatEffectiveSettingsProvider, type ChatFeatures, type ChatGetApiKey, ChatLayout, type ChatLayoutConfig, type ChatLayoutSlotProps, ChatLocaleProvider, ChatMain, type ChatPanelAlertsSlotProps, type ChatQueryParams, type ChatQueryParamsByApi, ChatThemeProvider, ChatViewport, type ChatViewportHeight, DEFAULT_EFFECTIVE_SETTINGS, DefaultChannelListItem, DefaultChatAvatar, DefaultChatLayout, type EffectiveAttachmentsSettings, type EffectiveCallsSettings, type EffectiveGroupPolicy, type EffectiveMessageTimers, type EffectiveSettings, ForegroundPushBridge, type ForegroundPushBridgeProps, type ForegroundPushPayload, ForwardModalView as ForwardModal, type ForwardModalSlotProps, HeaderCallActions, type HeaderCallActionsSlotProps, type HeaderLeftSideSlotProps, type HeaderRightSideSlotProps, type HeaderSearchOverlaySlotProps, type IAttachment, type IChannel, type IDMDelete, type IDMEditMessage, type IDMForward, type IDMMessage, type IDMPin, type IDMReaction, type IDMRead, type IDMStar, type IDMTyping, type IDMUnstar, type IMessage, type ISocketConfig, type JumpToPreset, LoggedUserDetails, type LoggedUserDetailsSlotProps, LoggedUserSettingsContent, type LoggedUserSettingsContentSlotProps, LoggedUserSettingsDialog, type LoggedUserSettingsDialogSlotProps, LoggedUserSettingsTrigger, type LoggedUserSettingsTriggerSlotProps, type MembersDrawerSlotProps, type MessageAttachmentsSlotProps, ChannelMessageBoxView as MessageInput, MessageItemView as MessageItem, type MessageItemSlotProps, ActiveChannelMessagesView as MessageList, type MessageReactionsSlotProps, type MessageReplySnippetSlotProps, type MessageStatusSlotProps, type MessageToolbarSlotProps, NOTIFICATION_CLICK_SW_TYPE, type NotificationClickBridgeOptions, OPEN_CONVERSATION_EVENT, PUSH_BROADCAST_CHANNEL, PUSH_CHANGED_EVENT, PUSH_DATA_CACHE_NAME, type PendingJump, type PermissionDrawerSlotProps, type PhoneCallButtonSlotProps, type PinnedMessagesDrawerSlotProps, type PushConfig, PushNotificationToggle, type PushNotificationToggleProps, type PushNotificationToggleRenderProps, type PushNotificationsState, type PushOpenRequest, type PushPreference, type StarredMessagesDrawerSlotProps, type UIConfig, type UsePushNotifications, type VideoCallButtonSlotProps, apiGetPushConfig, apiGetPushPreference, apiRegisterPushToken, apiRemovePushToken, apiUpdatePushPreference, buildChannelFromPushRequest, buildLoggedUserProfile, buildVersionedApiUrl, capitalizeFirst, clampJumpDate, consumePendingOpenConversation, consumePendingOpenFromPushCache, consumePendingOpenRequest, ChatMain as default, defaultChatClassNames, defaultChatComponents, defaultChatFeatures, defaultChatLayoutConfig, disablePushOnThisDevice, downloadFile, enablePushOnThisDevice, fetchEffectiveSettings, getChatApiVersions, getChatBaseUrl, getChatQueryParamApis, getChatQueryParams, getChatQueryParamsByApi, getChatSocketUrl, getFirstAndLastNameOneCharacter, getResponsiveWidth, getSocketConfig, getStoredPushToken, installNotificationClickBridge, isEmpty, isPushSupported, mergeChatCustomization, mergeChatLayoutConfig, onForegroundPush, packageDefaultComponents, peekPendingOpenConversation, peekPendingOpenRequest, requestOpenConversation, resolveApiRoot, resolveApiUrl, resolveChatApiKey, resolveConversationIdFromPushData, resolveJumpDateBounds, resolveJumpPreset, resolveJumpStep, resolveSocketUrl, setChatAccessToken, setChatApiVersions, setChatBaseURL, setChatClientId, setChatPushApiVersion, setChatQueryParamApis, setChatQueryParams, setChatQueryParamsByApi, setChatSocketUrl, showNotification, smoothScrollToMessage, socketService, startOfLocalDay, toDateInputValue, uniqueList, useAdminFeatureGate, useChatAlerts, useChatContext, useChatController, useChatCustomization, useChatCustomizationOptional, useChatFeatures, useChatFeaturesOptional, useChatLocale, useStore as useChatStore, useChatTheme, useEffectiveSettings, useEffectiveSettingsOptional, usePushNotifications };
|
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
|
-
*
|
|
564
|
-
*
|
|
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 */
|
|
@@ -743,18 +743,27 @@ interface HeaderCallActionsSlotProps {
|
|
|
743
743
|
showVideoCall?: boolean;
|
|
744
744
|
onPhoneCall?: () => void;
|
|
745
745
|
onVideoCall?: () => void;
|
|
746
|
+
/** From effective settings — custom slots should disable + show tooltip when true. */
|
|
747
|
+
phoneCallDisabled?: boolean;
|
|
748
|
+
videoCallDisabled?: boolean;
|
|
749
|
+
phoneCallDisabledReason?: string | null;
|
|
750
|
+
videoCallDisabledReason?: string | null;
|
|
746
751
|
className?: string;
|
|
747
752
|
}
|
|
748
753
|
interface PhoneCallButtonSlotProps {
|
|
749
754
|
activeChannel: IChannel;
|
|
750
755
|
conversationId: string | null;
|
|
751
756
|
onPhoneCall?: () => void;
|
|
757
|
+
disabled?: boolean;
|
|
758
|
+
disabledReason?: string | null;
|
|
752
759
|
className?: string;
|
|
753
760
|
}
|
|
754
761
|
interface VideoCallButtonSlotProps {
|
|
755
762
|
activeChannel: IChannel;
|
|
756
763
|
conversationId: string | null;
|
|
757
764
|
onVideoCall?: () => void;
|
|
765
|
+
disabled?: boolean;
|
|
766
|
+
disabledReason?: string | null;
|
|
758
767
|
className?: string;
|
|
759
768
|
}
|
|
760
769
|
interface HeaderSearchOverlaySlotProps {
|
|
@@ -1851,4 +1860,36 @@ declare function ChatEffectiveSettingsProvider({ children, enabled, }: {
|
|
|
1851
1860
|
declare function useEffectiveSettings(): ChatEffectiveSettingsContextValue;
|
|
1852
1861
|
declare function useEffectiveSettingsOptional(): ChatEffectiveSettingsContextValue;
|
|
1853
1862
|
|
|
1854
|
-
|
|
1863
|
+
interface AdminPermissionTooltipProps {
|
|
1864
|
+
disabled: boolean;
|
|
1865
|
+
message?: string | null;
|
|
1866
|
+
side?: "top" | "bottom" | "left" | "right";
|
|
1867
|
+
className?: string;
|
|
1868
|
+
children: React__default.ReactNode;
|
|
1869
|
+
}
|
|
1870
|
+
/**
|
|
1871
|
+
* Wraps a control that may be disabled by admin effective-settings.
|
|
1872
|
+
* Tooltip only appears when `disabled` and a message is provided.
|
|
1873
|
+
* Child controls get pointer-events-none so hover hits this wrapper
|
|
1874
|
+
* (native disabled buttons otherwise swallow hover).
|
|
1875
|
+
*/
|
|
1876
|
+
declare function AdminPermissionTooltip({ disabled, message, side, className, children, }: AdminPermissionTooltipProps): React__default.JSX.Element;
|
|
1877
|
+
|
|
1878
|
+
type AdminFeatureKey = "audioCall" | "videoCall" | "pushNotification" | "blockUsers" | "attachments" | "groupCreation";
|
|
1879
|
+
/**
|
|
1880
|
+
* Resolve an admin effective-settings gate for a feature.
|
|
1881
|
+
* Use inside custom slot components so disabled UI + tooltip match package defaults.
|
|
1882
|
+
*
|
|
1883
|
+
* @example
|
|
1884
|
+
* const gate = useAdminFeatureGate("videoCall");
|
|
1885
|
+
* return (
|
|
1886
|
+
* <AdminPermissionTooltip disabled={!gate.enabled} message={gate.disabledReason}>
|
|
1887
|
+
* <button disabled={!gate.enabled} onClick={gate.enabled ? onVideoCall : undefined}>
|
|
1888
|
+
* Video
|
|
1889
|
+
* </button>
|
|
1890
|
+
* </AdminPermissionTooltip>
|
|
1891
|
+
* );
|
|
1892
|
+
*/
|
|
1893
|
+
declare function useAdminFeatureGate(feature: AdminFeatureKey): CallFeatureGate;
|
|
1894
|
+
|
|
1895
|
+
export { ADMIN_PERMISSION_DENIED_MESSAGE, type ActiveChannelMessagesSlotProps, type AdminFeatureKey, AdminPermissionTooltip, type AdminsDrawerSlotProps, type AttachmentsDrawerSlotProps, type AvatarSlotProps, CALLS_NOT_ALLOWED_BY_PLATFORM_MESSAGE, CALLS_NOT_CONFIGURED_MESSAGE, CHAT_API_KEYS, CHAT_GET_API_KEYS, Calendar, CalendarDayButton, type CallFeatureGate, Channel, type ChannelDetailsDrawerSlotProps, ChannelHeaderView as ChannelHeader, type ChannelHeaderSlotProps, ChannelListView as ChannelList, ChannelListItem, type ChannelListItemSlotProps, type ChannelListSlotProps, type ChannelMessageBoxSlotProps, Chat, type ChatActionModalSlotProps, ChatAlertsProvider, type ChatApiKey, type ChatApiVersionConfig, type ChatApiVersionKey, ChatAvatar, type ChatCallContext, type ChatClassNames, type ChatColorMode, type ChatComponents, type ChatCustomizationConfig, ChatCustomizationProvider, ChatDateJumpMenu, type ChatDateTimePreferences, ChatEffectiveSettingsProvider, type ChatFeatures, type ChatGetApiKey, ChatLayout, type ChatLayoutConfig, type ChatLayoutSlotProps, ChatLocaleProvider, ChatMain, type ChatPanelAlertsSlotProps, type ChatQueryParams, type ChatQueryParamsByApi, ChatThemeProvider, ChatViewport, type ChatViewportHeight, DEFAULT_EFFECTIVE_SETTINGS, DefaultChannelListItem, DefaultChatAvatar, DefaultChatLayout, type EffectiveAttachmentsSettings, type EffectiveCallsSettings, type EffectiveGroupPolicy, type EffectiveMessageTimers, type EffectiveSettings, ForegroundPushBridge, type ForegroundPushBridgeProps, type ForegroundPushPayload, ForwardModalView as ForwardModal, type ForwardModalSlotProps, HeaderCallActions, type HeaderCallActionsSlotProps, type HeaderLeftSideSlotProps, type HeaderRightSideSlotProps, type HeaderSearchOverlaySlotProps, type IAttachment, type IChannel, type IDMDelete, type IDMEditMessage, type IDMForward, type IDMMessage, type IDMPin, type IDMReaction, type IDMRead, type IDMStar, type IDMTyping, type IDMUnstar, type IMessage, type ISocketConfig, type JumpToPreset, LoggedUserDetails, type LoggedUserDetailsSlotProps, LoggedUserSettingsContent, type LoggedUserSettingsContentSlotProps, LoggedUserSettingsDialog, type LoggedUserSettingsDialogSlotProps, LoggedUserSettingsTrigger, type LoggedUserSettingsTriggerSlotProps, type MembersDrawerSlotProps, type MessageAttachmentsSlotProps, ChannelMessageBoxView as MessageInput, MessageItemView as MessageItem, type MessageItemSlotProps, ActiveChannelMessagesView as MessageList, type MessageReactionsSlotProps, type MessageReplySnippetSlotProps, type MessageStatusSlotProps, type MessageToolbarSlotProps, NOTIFICATION_CLICK_SW_TYPE, type NotificationClickBridgeOptions, OPEN_CONVERSATION_EVENT, PUSH_BROADCAST_CHANNEL, PUSH_CHANGED_EVENT, PUSH_DATA_CACHE_NAME, type PendingJump, type PermissionDrawerSlotProps, type PhoneCallButtonSlotProps, type PinnedMessagesDrawerSlotProps, type PushConfig, PushNotificationToggle, type PushNotificationToggleProps, type PushNotificationToggleRenderProps, type PushNotificationsState, type PushOpenRequest, type PushPreference, type StarredMessagesDrawerSlotProps, type UIConfig, type UsePushNotifications, type VideoCallButtonSlotProps, apiGetPushConfig, apiGetPushPreference, apiRegisterPushToken, apiRemovePushToken, apiUpdatePushPreference, buildChannelFromPushRequest, buildLoggedUserProfile, buildVersionedApiUrl, capitalizeFirst, clampJumpDate, consumePendingOpenConversation, consumePendingOpenFromPushCache, consumePendingOpenRequest, ChatMain as default, defaultChatClassNames, defaultChatComponents, defaultChatFeatures, defaultChatLayoutConfig, disablePushOnThisDevice, downloadFile, enablePushOnThisDevice, fetchEffectiveSettings, getChatApiVersions, getChatBaseUrl, getChatQueryParamApis, getChatQueryParams, getChatQueryParamsByApi, getChatSocketUrl, getFirstAndLastNameOneCharacter, getResponsiveWidth, getSocketConfig, getStoredPushToken, installNotificationClickBridge, isEmpty, isPushSupported, mergeChatCustomization, mergeChatLayoutConfig, onForegroundPush, packageDefaultComponents, peekPendingOpenConversation, peekPendingOpenRequest, requestOpenConversation, resolveApiRoot, resolveApiUrl, resolveChatApiKey, resolveConversationIdFromPushData, resolveJumpDateBounds, resolveJumpPreset, resolveJumpStep, resolveSocketUrl, setChatAccessToken, setChatApiVersions, setChatBaseURL, setChatClientId, setChatPushApiVersion, setChatQueryParamApis, setChatQueryParams, setChatQueryParamsByApi, setChatSocketUrl, showNotification, smoothScrollToMessage, socketService, startOfLocalDay, toDateInputValue, uniqueList, useAdminFeatureGate, useChatAlerts, useChatContext, useChatController, useChatCustomization, useChatCustomizationOptional, useChatFeatures, useChatFeaturesOptional, useChatLocale, useStore as useChatStore, useChatTheme, useEffectiveSettings, useEffectiveSettingsOptional, usePushNotifications };
|
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(
|
|
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);
|
|
@@ -8973,35 +9011,37 @@ var DefaultHeaderCallActions = ({
|
|
|
8973
9011
|
showVideoCall = true,
|
|
8974
9012
|
onPhoneCall,
|
|
8975
9013
|
onVideoCall,
|
|
9014
|
+
phoneCallDisabled = false,
|
|
9015
|
+
videoCallDisabled = false,
|
|
9016
|
+
phoneCallDisabledReason = null,
|
|
9017
|
+
videoCallDisabledReason = null,
|
|
8976
9018
|
className
|
|
8977
9019
|
}) => {
|
|
8978
|
-
const { components, slotClassName
|
|
8979
|
-
const { getAudioCallGate, getVideoCallGate } = useEffectiveSettingsOptional();
|
|
9020
|
+
const { components, slotClassName } = useChatCustomizationOptional();
|
|
8980
9021
|
const PhoneSlot = components.PhoneCallButton;
|
|
8981
9022
|
const VideoSlot = components.VideoCallButton;
|
|
8982
|
-
const hideInGroups = features.hideCallActionsInGroupChats ?? false;
|
|
8983
|
-
const audioGate = getAudioCallGate();
|
|
8984
|
-
const videoGate = getVideoCallGate();
|
|
8985
|
-
if (hideInGroups && activeChannel.isGroup) return null;
|
|
8986
9023
|
if (!showPhoneCall && !showVideoCall) return null;
|
|
8987
|
-
const phoneEnabled = showPhoneCall &&
|
|
8988
|
-
const videoEnabled = showVideoCall &&
|
|
9024
|
+
const phoneEnabled = showPhoneCall && !phoneCallDisabled;
|
|
9025
|
+
const videoEnabled = showVideoCall && !videoCallDisabled;
|
|
8989
9026
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8990
9027
|
showPhoneCall && (PhoneSlot ? /* @__PURE__ */ jsx(
|
|
8991
9028
|
AdminPermissionTooltip,
|
|
8992
9029
|
{
|
|
8993
|
-
disabled:
|
|
8994
|
-
message:
|
|
9030
|
+
disabled: phoneCallDisabled,
|
|
9031
|
+
message: phoneCallDisabledReason,
|
|
9032
|
+
side: "bottom",
|
|
8995
9033
|
children: /* @__PURE__ */ jsx("span", { className: "inline-flex", children: /* @__PURE__ */ jsx(
|
|
8996
9034
|
PhoneSlot,
|
|
8997
9035
|
{
|
|
8998
9036
|
activeChannel,
|
|
8999
9037
|
conversationId,
|
|
9000
9038
|
onPhoneCall: phoneEnabled ? onPhoneCall : void 0,
|
|
9039
|
+
disabled: phoneCallDisabled,
|
|
9040
|
+
disabledReason: phoneCallDisabledReason,
|
|
9001
9041
|
className: cn(
|
|
9002
9042
|
className,
|
|
9003
9043
|
slotClassName("phoneCallButton"),
|
|
9004
|
-
|
|
9044
|
+
phoneCallDisabled && "opacity-40"
|
|
9005
9045
|
)
|
|
9006
9046
|
}
|
|
9007
9047
|
) })
|
|
@@ -9009,8 +9049,9 @@ var DefaultHeaderCallActions = ({
|
|
|
9009
9049
|
) : /* @__PURE__ */ jsx(
|
|
9010
9050
|
AdminPermissionTooltip,
|
|
9011
9051
|
{
|
|
9012
|
-
disabled:
|
|
9013
|
-
message:
|
|
9052
|
+
disabled: phoneCallDisabled,
|
|
9053
|
+
message: phoneCallDisabledReason,
|
|
9054
|
+
side: "bottom",
|
|
9014
9055
|
children: /* @__PURE__ */ jsx(
|
|
9015
9056
|
Button,
|
|
9016
9057
|
{
|
|
@@ -9018,7 +9059,7 @@ var DefaultHeaderCallActions = ({
|
|
|
9018
9059
|
size: "icon",
|
|
9019
9060
|
className: cn(actionBtnClass, className, slotClassName("phoneCallButton")),
|
|
9020
9061
|
"aria-label": "Voice call",
|
|
9021
|
-
disabled:
|
|
9062
|
+
disabled: phoneCallDisabled,
|
|
9022
9063
|
onClick: phoneEnabled ? onPhoneCall : void 0,
|
|
9023
9064
|
children: /* @__PURE__ */ jsx(Phone, { size: 15 })
|
|
9024
9065
|
}
|
|
@@ -9028,18 +9069,21 @@ var DefaultHeaderCallActions = ({
|
|
|
9028
9069
|
showVideoCall && (VideoSlot ? /* @__PURE__ */ jsx(
|
|
9029
9070
|
AdminPermissionTooltip,
|
|
9030
9071
|
{
|
|
9031
|
-
disabled:
|
|
9032
|
-
message:
|
|
9072
|
+
disabled: videoCallDisabled,
|
|
9073
|
+
message: videoCallDisabledReason,
|
|
9074
|
+
side: "bottom",
|
|
9033
9075
|
children: /* @__PURE__ */ jsx("span", { className: "inline-flex", children: /* @__PURE__ */ jsx(
|
|
9034
9076
|
VideoSlot,
|
|
9035
9077
|
{
|
|
9036
9078
|
activeChannel,
|
|
9037
9079
|
conversationId,
|
|
9038
9080
|
onVideoCall: videoEnabled ? onVideoCall : void 0,
|
|
9081
|
+
disabled: videoCallDisabled,
|
|
9082
|
+
disabledReason: videoCallDisabledReason,
|
|
9039
9083
|
className: cn(
|
|
9040
9084
|
className,
|
|
9041
9085
|
slotClassName("videoCallButton"),
|
|
9042
|
-
|
|
9086
|
+
videoCallDisabled && "opacity-40"
|
|
9043
9087
|
)
|
|
9044
9088
|
}
|
|
9045
9089
|
) })
|
|
@@ -9047,8 +9091,9 @@ var DefaultHeaderCallActions = ({
|
|
|
9047
9091
|
) : /* @__PURE__ */ jsx(
|
|
9048
9092
|
AdminPermissionTooltip,
|
|
9049
9093
|
{
|
|
9050
|
-
disabled:
|
|
9051
|
-
message:
|
|
9094
|
+
disabled: videoCallDisabled,
|
|
9095
|
+
message: videoCallDisabledReason,
|
|
9096
|
+
side: "bottom",
|
|
9052
9097
|
children: /* @__PURE__ */ jsx(
|
|
9053
9098
|
Button,
|
|
9054
9099
|
{
|
|
@@ -9056,7 +9101,7 @@ var DefaultHeaderCallActions = ({
|
|
|
9056
9101
|
size: "icon",
|
|
9057
9102
|
className: cn(actionBtnClass, className, slotClassName("videoCallButton")),
|
|
9058
9103
|
"aria-label": "Video call",
|
|
9059
|
-
disabled:
|
|
9104
|
+
disabled: videoCallDisabled,
|
|
9060
9105
|
onClick: videoEnabled ? onVideoCall : void 0,
|
|
9061
9106
|
children: /* @__PURE__ */ jsx(Video, { size: 15 })
|
|
9062
9107
|
}
|
|
@@ -9066,16 +9111,28 @@ var DefaultHeaderCallActions = ({
|
|
|
9066
9111
|
] });
|
|
9067
9112
|
};
|
|
9068
9113
|
var HeaderCallActions = (props) => {
|
|
9069
|
-
const { components, slotClassName
|
|
9114
|
+
const { components, slotClassName } = useChatCustomizationOptional();
|
|
9115
|
+
const { getAudioCallGate, getVideoCallGate } = useEffectiveSettingsOptional();
|
|
9070
9116
|
const Custom = components.HeaderCallActions;
|
|
9071
|
-
|
|
9072
|
-
|
|
9073
|
-
|
|
9074
|
-
|
|
9075
|
-
|
|
9076
|
-
|
|
9077
|
-
|
|
9078
|
-
|
|
9117
|
+
const showPhoneCall = props.showPhoneCall ?? true;
|
|
9118
|
+
const showVideoCall = props.showVideoCall ?? true;
|
|
9119
|
+
const audioGate = getAudioCallGate();
|
|
9120
|
+
const videoGate = getVideoCallGate();
|
|
9121
|
+
if (!showPhoneCall && !showVideoCall) return null;
|
|
9122
|
+
const gatedProps = {
|
|
9123
|
+
...props,
|
|
9124
|
+
showPhoneCall,
|
|
9125
|
+
showVideoCall,
|
|
9126
|
+
onPhoneCall: audioGate.enabled ? props.onPhoneCall : void 0,
|
|
9127
|
+
onVideoCall: videoGate.enabled ? props.onVideoCall : void 0,
|
|
9128
|
+
phoneCallDisabled: !audioGate.enabled,
|
|
9129
|
+
videoCallDisabled: !videoGate.enabled,
|
|
9130
|
+
phoneCallDisabledReason: audioGate.disabledReason,
|
|
9131
|
+
videoCallDisabledReason: videoGate.disabledReason
|
|
9132
|
+
};
|
|
9133
|
+
const hasButtonSlots = components.PhoneCallButton != null || components.VideoCallButton != null;
|
|
9134
|
+
const useCustom = Custom != null && Custom !== HeaderCallActions && !hasButtonSlots;
|
|
9135
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex items-center gap-0.5", slotClassName("headerCallActions")), children: useCustom ? /* @__PURE__ */ jsx(Custom, { ...gatedProps }) : /* @__PURE__ */ jsx(DefaultHeaderCallActions, { ...gatedProps }) });
|
|
9079
9136
|
};
|
|
9080
9137
|
var HeaderCallActions_default = HeaderCallActions;
|
|
9081
9138
|
function OptionsMenuItem({
|
|
@@ -13473,8 +13530,8 @@ var PermissionDrawer = ({ isOpen, onOpenChange, conversationId, conversationInfo
|
|
|
13473
13530
|
{ key: "onlyAdminCanSendMessage", label: "Only Admin Can Send Message", desc: "Restricts message sending to group administrators only." },
|
|
13474
13531
|
{ key: "onlyAdminCanEditInfo", label: "Only Admin Can Edit Info", desc: "Only admins can change group name, description, and avatar." },
|
|
13475
13532
|
{ key: "senderCanEditMessage", label: "Sender Can Edit Message", desc: "Allows users to edit their own sent messages." },
|
|
13476
|
-
{ key: "allowMemberAdd", label: "
|
|
13477
|
-
{ key: "allowMemberRemove", label: "
|
|
13533
|
+
{ key: "allowMemberAdd", label: "Allow Members to Add", desc: "Allows group members to add new participants." },
|
|
13534
|
+
{ key: "allowMemberRemove", label: "Allow Members to Remove", desc: "Allows group members to remove other participants." },
|
|
13478
13535
|
{ key: "moderationEnabled", label: "Moderation Enabled", desc: "Enables advanced message moderation features." }
|
|
13479
13536
|
];
|
|
13480
13537
|
return /* @__PURE__ */ jsx(Sheet, { open: isOpen, onOpenChange, children: /* @__PURE__ */ jsxs(ChatSheetContent, { showCloseButton: true, className: "sm:max-w-[380px]", children: [
|
|
@@ -13490,7 +13547,7 @@ var PermissionDrawer = ({ isOpen, onOpenChange, conversationId, conversationInfo
|
|
|
13490
13547
|
/* @__PURE__ */ jsx("h3", { className: "mb-1 px-0.5 text-[10px] font-semibold uppercase tracking-wide text-(--chat-muted)", children: "Permissions" }),
|
|
13491
13548
|
/* @__PURE__ */ jsx("div", { className: "rounded-lg border border-(--chat-border) px-3", children: permissionItems.map((item, index) => {
|
|
13492
13549
|
const locked = isGroupPermissionLocked(item.key);
|
|
13493
|
-
const checked =
|
|
13550
|
+
const checked = permissions[item.key];
|
|
13494
13551
|
return /* @__PURE__ */ jsxs(
|
|
13495
13552
|
"div",
|
|
13496
13553
|
{
|
|
@@ -19671,11 +19728,34 @@ var packageDefaultComponents = {
|
|
|
19671
19728
|
ChatSocketStatus: ChatSocketStatus_default
|
|
19672
19729
|
};
|
|
19673
19730
|
|
|
19731
|
+
// src/hooks/useAdminFeatureGate.ts
|
|
19732
|
+
function useAdminFeatureGate(feature) {
|
|
19733
|
+
const ctx = useEffectiveSettingsOptional();
|
|
19734
|
+
switch (feature) {
|
|
19735
|
+
case "audioCall":
|
|
19736
|
+
return ctx.getAudioCallGate();
|
|
19737
|
+
case "videoCall":
|
|
19738
|
+
return ctx.getVideoCallGate();
|
|
19739
|
+
case "pushNotification":
|
|
19740
|
+
return ctx.getPushNotificationGate();
|
|
19741
|
+
case "blockUsers":
|
|
19742
|
+
return ctx.getBlockUsersGate();
|
|
19743
|
+
case "attachments":
|
|
19744
|
+
return ctx.getAttachmentsGate();
|
|
19745
|
+
case "groupCreation":
|
|
19746
|
+
return ctx.getGroupCreationGate();
|
|
19747
|
+
default: {
|
|
19748
|
+
const _exhaustive = feature;
|
|
19749
|
+
return _exhaustive;
|
|
19750
|
+
}
|
|
19751
|
+
}
|
|
19752
|
+
}
|
|
19753
|
+
|
|
19674
19754
|
// src/index.ts
|
|
19675
19755
|
init_settings_types();
|
|
19676
19756
|
init_api_service();
|
|
19677
19757
|
var index_default = ChatMain_default;
|
|
19678
19758
|
|
|
19679
|
-
export { ADMIN_PERMISSION_DENIED_MESSAGE, CALLS_NOT_ALLOWED_BY_PLATFORM_MESSAGE, CALLS_NOT_CONFIGURED_MESSAGE, CHAT_API_KEYS, CHAT_GET_API_KEYS, Calendar, CalendarDayButton, Channel, ChannelHeaderView_default as ChannelHeader, ChannelListView_default as ChannelList, ChannelListItem_default as ChannelListItem, Chat, ChatAlertsProvider, ChatAvatar_default as ChatAvatar, ChatCustomizationProvider, ChatDateJumpMenu, ChatEffectiveSettingsProvider, ChatLayout_default as ChatLayout, ChatLocaleProvider, ChatMain_default as ChatMain, ChatThemeProvider, ChatViewport, DEFAULT_EFFECTIVE_SETTINGS, DefaultChannelListItem, DefaultChatAvatar, DefaultChatLayout_default as DefaultChatLayout, ForegroundPushBridge, ForwardModalView as ForwardModal, HeaderCallActions_default as HeaderCallActions, LoggedUserDetails_default as LoggedUserDetails, LoggedUserSettingsContent_default as LoggedUserSettingsContent, LoggedUserSettingsDialog_default as LoggedUserSettingsDialog, LoggedUserSettingsTrigger_default as LoggedUserSettingsTrigger, ChannelMessageBoxView_default as MessageInput, MessageItemView as MessageItem, ActiveChannelMessagesView_default as MessageList, NOTIFICATION_CLICK_SW_TYPE, OPEN_CONVERSATION_EVENT, PUSH_BROADCAST_CHANNEL, PUSH_CHANGED_EVENT, PUSH_DATA_CACHE_NAME, PushNotificationToggle, apiGetPushConfig, apiGetPushPreference, apiRegisterPushToken, apiRemovePushToken, apiUpdatePushPreference, buildChannelFromPushRequest, buildLoggedUserProfile, buildVersionedApiUrl, capitalizeFirst, clampJumpDate, consumePendingOpenConversation, consumePendingOpenFromPushCache, consumePendingOpenRequest, index_default as default, defaultChatClassNames, defaultChatComponents, defaultChatFeatures, defaultChatLayoutConfig, disablePushOnThisDevice, downloadFile, enablePushOnThisDevice, fetchEffectiveSettings, getChatApiVersions, getChatBaseUrl, getChatQueryParamApis, getChatQueryParams, getChatQueryParamsByApi, getChatSocketUrl, getFirstAndLastNameOneCharacter, getResponsiveWidth, getSocketConfig, getStoredPushToken, installNotificationClickBridge, isEmpty, isPushSupported, mergeChatCustomization, mergeChatLayoutConfig, onForegroundPush, packageDefaultComponents, peekPendingOpenConversation, peekPendingOpenRequest, requestOpenConversation, resolveApiRoot, resolveApiUrl, resolveChatApiKey, resolveConversationIdFromPushData, resolveJumpDateBounds, resolveJumpPreset, resolveJumpStep, resolveSocketUrl, setChatAccessToken, setChatApiVersions, setChatBaseURL, setChatClientId, setChatPushApiVersion, setChatQueryParamApis, setChatQueryParams, setChatQueryParamsByApi, setChatSocketUrl, showNotification, smoothScrollToMessage, socket_service_default as socketService, startOfLocalDay, toDateInputValue, uniqueList, useChatAlerts, useChatContext, useChatController, useChatCustomization, useChatCustomizationOptional, useChatFeatures, useChatFeaturesOptional, useChatLocale, useStore as useChatStore, useChatTheme, useEffectiveSettings, useEffectiveSettingsOptional, usePushNotifications };
|
|
19759
|
+
export { ADMIN_PERMISSION_DENIED_MESSAGE, AdminPermissionTooltip, CALLS_NOT_ALLOWED_BY_PLATFORM_MESSAGE, CALLS_NOT_CONFIGURED_MESSAGE, CHAT_API_KEYS, CHAT_GET_API_KEYS, Calendar, CalendarDayButton, Channel, ChannelHeaderView_default as ChannelHeader, ChannelListView_default as ChannelList, ChannelListItem_default as ChannelListItem, Chat, ChatAlertsProvider, ChatAvatar_default as ChatAvatar, ChatCustomizationProvider, ChatDateJumpMenu, ChatEffectiveSettingsProvider, ChatLayout_default as ChatLayout, ChatLocaleProvider, ChatMain_default as ChatMain, ChatThemeProvider, ChatViewport, DEFAULT_EFFECTIVE_SETTINGS, DefaultChannelListItem, DefaultChatAvatar, DefaultChatLayout_default as DefaultChatLayout, ForegroundPushBridge, ForwardModalView as ForwardModal, HeaderCallActions_default as HeaderCallActions, LoggedUserDetails_default as LoggedUserDetails, LoggedUserSettingsContent_default as LoggedUserSettingsContent, LoggedUserSettingsDialog_default as LoggedUserSettingsDialog, LoggedUserSettingsTrigger_default as LoggedUserSettingsTrigger, ChannelMessageBoxView_default as MessageInput, MessageItemView as MessageItem, ActiveChannelMessagesView_default as MessageList, NOTIFICATION_CLICK_SW_TYPE, OPEN_CONVERSATION_EVENT, PUSH_BROADCAST_CHANNEL, PUSH_CHANGED_EVENT, PUSH_DATA_CACHE_NAME, PushNotificationToggle, apiGetPushConfig, apiGetPushPreference, apiRegisterPushToken, apiRemovePushToken, apiUpdatePushPreference, buildChannelFromPushRequest, buildLoggedUserProfile, buildVersionedApiUrl, capitalizeFirst, clampJumpDate, consumePendingOpenConversation, consumePendingOpenFromPushCache, consumePendingOpenRequest, index_default as default, defaultChatClassNames, defaultChatComponents, defaultChatFeatures, defaultChatLayoutConfig, disablePushOnThisDevice, downloadFile, enablePushOnThisDevice, fetchEffectiveSettings, getChatApiVersions, getChatBaseUrl, getChatQueryParamApis, getChatQueryParams, getChatQueryParamsByApi, getChatSocketUrl, getFirstAndLastNameOneCharacter, getResponsiveWidth, getSocketConfig, getStoredPushToken, installNotificationClickBridge, isEmpty, isPushSupported, mergeChatCustomization, mergeChatLayoutConfig, onForegroundPush, packageDefaultComponents, peekPendingOpenConversation, peekPendingOpenRequest, requestOpenConversation, resolveApiRoot, resolveApiUrl, resolveChatApiKey, resolveConversationIdFromPushData, resolveJumpDateBounds, resolveJumpPreset, resolveJumpStep, resolveSocketUrl, setChatAccessToken, setChatApiVersions, setChatBaseURL, setChatClientId, setChatPushApiVersion, setChatQueryParamApis, setChatQueryParams, setChatQueryParamsByApi, setChatSocketUrl, showNotification, smoothScrollToMessage, socket_service_default as socketService, startOfLocalDay, toDateInputValue, uniqueList, useAdminFeatureGate, useChatAlerts, useChatContext, useChatController, useChatCustomization, useChatCustomizationOptional, useChatFeatures, useChatFeaturesOptional, useChatLocale, useStore as useChatStore, useChatTheme, useEffectiveSettings, useEffectiveSettingsOptional, usePushNotifications };
|
|
19680
19760
|
//# sourceMappingURL=index.mjs.map
|
|
19681
19761
|
//# sourceMappingURL=index.mjs.map
|