@realtimexsco/live-chat 1.4.16 → 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 +64 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +42 -1
- package/dist/index.d.ts +42 -1
- package/dist/index.mjs +63 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -10
package/dist/index.d.mts
CHANGED
|
@@ -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
|
@@ -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
|
@@ -9011,23 +9011,24 @@ var DefaultHeaderCallActions = ({
|
|
|
9011
9011
|
showVideoCall = true,
|
|
9012
9012
|
onPhoneCall,
|
|
9013
9013
|
onVideoCall,
|
|
9014
|
+
phoneCallDisabled = false,
|
|
9015
|
+
videoCallDisabled = false,
|
|
9016
|
+
phoneCallDisabledReason = null,
|
|
9017
|
+
videoCallDisabledReason = null,
|
|
9014
9018
|
className
|
|
9015
9019
|
}) => {
|
|
9016
9020
|
const { components, slotClassName } = useChatCustomizationOptional();
|
|
9017
|
-
const { getAudioCallGate, getVideoCallGate } = useEffectiveSettingsOptional();
|
|
9018
9021
|
const PhoneSlot = components.PhoneCallButton;
|
|
9019
9022
|
const VideoSlot = components.VideoCallButton;
|
|
9020
|
-
const audioGate = getAudioCallGate();
|
|
9021
|
-
const videoGate = getVideoCallGate();
|
|
9022
9023
|
if (!showPhoneCall && !showVideoCall) return null;
|
|
9023
|
-
const phoneEnabled = showPhoneCall &&
|
|
9024
|
-
const videoEnabled = showVideoCall &&
|
|
9024
|
+
const phoneEnabled = showPhoneCall && !phoneCallDisabled;
|
|
9025
|
+
const videoEnabled = showVideoCall && !videoCallDisabled;
|
|
9025
9026
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9026
9027
|
showPhoneCall && (PhoneSlot ? /* @__PURE__ */ jsx(
|
|
9027
9028
|
AdminPermissionTooltip,
|
|
9028
9029
|
{
|
|
9029
|
-
disabled:
|
|
9030
|
-
message:
|
|
9030
|
+
disabled: phoneCallDisabled,
|
|
9031
|
+
message: phoneCallDisabledReason,
|
|
9031
9032
|
side: "bottom",
|
|
9032
9033
|
children: /* @__PURE__ */ jsx("span", { className: "inline-flex", children: /* @__PURE__ */ jsx(
|
|
9033
9034
|
PhoneSlot,
|
|
@@ -9035,10 +9036,12 @@ var DefaultHeaderCallActions = ({
|
|
|
9035
9036
|
activeChannel,
|
|
9036
9037
|
conversationId,
|
|
9037
9038
|
onPhoneCall: phoneEnabled ? onPhoneCall : void 0,
|
|
9039
|
+
disabled: phoneCallDisabled,
|
|
9040
|
+
disabledReason: phoneCallDisabledReason,
|
|
9038
9041
|
className: cn(
|
|
9039
9042
|
className,
|
|
9040
9043
|
slotClassName("phoneCallButton"),
|
|
9041
|
-
|
|
9044
|
+
phoneCallDisabled && "opacity-40"
|
|
9042
9045
|
)
|
|
9043
9046
|
}
|
|
9044
9047
|
) })
|
|
@@ -9046,8 +9049,8 @@ var DefaultHeaderCallActions = ({
|
|
|
9046
9049
|
) : /* @__PURE__ */ jsx(
|
|
9047
9050
|
AdminPermissionTooltip,
|
|
9048
9051
|
{
|
|
9049
|
-
disabled:
|
|
9050
|
-
message:
|
|
9052
|
+
disabled: phoneCallDisabled,
|
|
9053
|
+
message: phoneCallDisabledReason,
|
|
9051
9054
|
side: "bottom",
|
|
9052
9055
|
children: /* @__PURE__ */ jsx(
|
|
9053
9056
|
Button,
|
|
@@ -9056,7 +9059,7 @@ var DefaultHeaderCallActions = ({
|
|
|
9056
9059
|
size: "icon",
|
|
9057
9060
|
className: cn(actionBtnClass, className, slotClassName("phoneCallButton")),
|
|
9058
9061
|
"aria-label": "Voice call",
|
|
9059
|
-
disabled:
|
|
9062
|
+
disabled: phoneCallDisabled,
|
|
9060
9063
|
onClick: phoneEnabled ? onPhoneCall : void 0,
|
|
9061
9064
|
children: /* @__PURE__ */ jsx(Phone, { size: 15 })
|
|
9062
9065
|
}
|
|
@@ -9066,8 +9069,8 @@ var DefaultHeaderCallActions = ({
|
|
|
9066
9069
|
showVideoCall && (VideoSlot ? /* @__PURE__ */ jsx(
|
|
9067
9070
|
AdminPermissionTooltip,
|
|
9068
9071
|
{
|
|
9069
|
-
disabled:
|
|
9070
|
-
message:
|
|
9072
|
+
disabled: videoCallDisabled,
|
|
9073
|
+
message: videoCallDisabledReason,
|
|
9071
9074
|
side: "bottom",
|
|
9072
9075
|
children: /* @__PURE__ */ jsx("span", { className: "inline-flex", children: /* @__PURE__ */ jsx(
|
|
9073
9076
|
VideoSlot,
|
|
@@ -9075,10 +9078,12 @@ var DefaultHeaderCallActions = ({
|
|
|
9075
9078
|
activeChannel,
|
|
9076
9079
|
conversationId,
|
|
9077
9080
|
onVideoCall: videoEnabled ? onVideoCall : void 0,
|
|
9081
|
+
disabled: videoCallDisabled,
|
|
9082
|
+
disabledReason: videoCallDisabledReason,
|
|
9078
9083
|
className: cn(
|
|
9079
9084
|
className,
|
|
9080
9085
|
slotClassName("videoCallButton"),
|
|
9081
|
-
|
|
9086
|
+
videoCallDisabled && "opacity-40"
|
|
9082
9087
|
)
|
|
9083
9088
|
}
|
|
9084
9089
|
) })
|
|
@@ -9086,8 +9091,8 @@ var DefaultHeaderCallActions = ({
|
|
|
9086
9091
|
) : /* @__PURE__ */ jsx(
|
|
9087
9092
|
AdminPermissionTooltip,
|
|
9088
9093
|
{
|
|
9089
|
-
disabled:
|
|
9090
|
-
message:
|
|
9094
|
+
disabled: videoCallDisabled,
|
|
9095
|
+
message: videoCallDisabledReason,
|
|
9091
9096
|
side: "bottom",
|
|
9092
9097
|
children: /* @__PURE__ */ jsx(
|
|
9093
9098
|
Button,
|
|
@@ -9096,7 +9101,7 @@ var DefaultHeaderCallActions = ({
|
|
|
9096
9101
|
size: "icon",
|
|
9097
9102
|
className: cn(actionBtnClass, className, slotClassName("videoCallButton")),
|
|
9098
9103
|
"aria-label": "Video call",
|
|
9099
|
-
disabled:
|
|
9104
|
+
disabled: videoCallDisabled,
|
|
9100
9105
|
onClick: videoEnabled ? onVideoCall : void 0,
|
|
9101
9106
|
children: /* @__PURE__ */ jsx(Video, { size: 15 })
|
|
9102
9107
|
}
|
|
@@ -9107,12 +9112,27 @@ var DefaultHeaderCallActions = ({
|
|
|
9107
9112
|
};
|
|
9108
9113
|
var HeaderCallActions = (props) => {
|
|
9109
9114
|
const { components, slotClassName } = useChatCustomizationOptional();
|
|
9115
|
+
const { getAudioCallGate, getVideoCallGate } = useEffectiveSettingsOptional();
|
|
9110
9116
|
const Custom = components.HeaderCallActions;
|
|
9111
9117
|
const showPhoneCall = props.showPhoneCall ?? true;
|
|
9112
9118
|
const showVideoCall = props.showVideoCall ?? true;
|
|
9119
|
+
const audioGate = getAudioCallGate();
|
|
9120
|
+
const videoGate = getVideoCallGate();
|
|
9113
9121
|
if (!showPhoneCall && !showVideoCall) return null;
|
|
9114
|
-
const
|
|
9115
|
-
|
|
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 }) });
|
|
9116
9136
|
};
|
|
9117
9137
|
var HeaderCallActions_default = HeaderCallActions;
|
|
9118
9138
|
function OptionsMenuItem({
|
|
@@ -19708,11 +19728,34 @@ var packageDefaultComponents = {
|
|
|
19708
19728
|
ChatSocketStatus: ChatSocketStatus_default
|
|
19709
19729
|
};
|
|
19710
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
|
+
|
|
19711
19754
|
// src/index.ts
|
|
19712
19755
|
init_settings_types();
|
|
19713
19756
|
init_api_service();
|
|
19714
19757
|
var index_default = ChatMain_default;
|
|
19715
19758
|
|
|
19716
|
-
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 };
|
|
19717
19760
|
//# sourceMappingURL=index.mjs.map
|
|
19718
19761
|
//# sourceMappingURL=index.mjs.map
|