@realtimexsco/live-chat 1.4.9 → 1.4.11
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/firebase-messaging-sw.js +312 -71
- package/dist/index.cjs +1029 -641
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +128 -37
- package/dist/index.d.ts +128 -37
- package/dist/index.mjs +1019 -637
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +11 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -105,6 +105,27 @@ type ChatQueryParamsByApi = Partial<Record<Exclude<ChatApiKey, "all" | "get">, C
|
|
|
105
105
|
/** Match an axios request URL to a named API key (first match wins). */
|
|
106
106
|
declare function resolveChatApiKey(url?: string): Exclude<ChatApiKey, "all" | "get"> | null;
|
|
107
107
|
|
|
108
|
+
type ChatApiVersionKey = "default" | "push";
|
|
109
|
+
interface ChatApiVersionConfig {
|
|
110
|
+
/** Main chat REST API version (usually parsed from `setChatBaseURL`). */
|
|
111
|
+
default?: string;
|
|
112
|
+
/** Push notification API version. Default: `v2`. */
|
|
113
|
+
push?: string;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Strip a trailing `/v1`, `/v2`, … from the configured base URL.
|
|
117
|
+
* `https://realtimex.softwareco.com/api/v1` → `https://realtimex.softwareco.com/api`
|
|
118
|
+
*/
|
|
119
|
+
declare const resolveApiRoot: (baseUrl?: string) => string;
|
|
120
|
+
declare const buildVersionedApiUrl: (path: string, options?: {
|
|
121
|
+
version?: string;
|
|
122
|
+
baseUrl?: string;
|
|
123
|
+
service?: ChatApiVersionKey;
|
|
124
|
+
}) => string;
|
|
125
|
+
declare const setChatApiVersions: (config?: ChatApiVersionConfig | null) => void;
|
|
126
|
+
declare const getChatApiVersions: () => Readonly<Record<ChatApiVersionKey, string>>;
|
|
127
|
+
declare const setChatPushApiVersion: (version: string) => void;
|
|
128
|
+
|
|
108
129
|
declare const setChatClientId: (id: string) => void;
|
|
109
130
|
declare const setChatAccessToken: (token: string) => void;
|
|
110
131
|
declare const setChatBaseURL: (url: string) => void;
|
|
@@ -143,11 +164,52 @@ declare const getChatQueryParamsByApi: () => {
|
|
|
143
164
|
presignedUrls?: Record<string, string> | undefined;
|
|
144
165
|
};
|
|
145
166
|
|
|
167
|
+
interface PushNotificationToggleRenderProps {
|
|
168
|
+
label: string;
|
|
169
|
+
description: string;
|
|
170
|
+
checked: boolean;
|
|
171
|
+
disabled: boolean;
|
|
172
|
+
loading: boolean;
|
|
173
|
+
permissionBlocked: boolean;
|
|
174
|
+
error: string | null;
|
|
175
|
+
onCheckedChange: (checked: boolean) => void;
|
|
176
|
+
}
|
|
177
|
+
interface PushNotificationToggleProps {
|
|
178
|
+
className?: string;
|
|
179
|
+
label?: string;
|
|
180
|
+
description?: string;
|
|
181
|
+
/** Build your own row UI while keeping package push logic. */
|
|
182
|
+
children?: (props: PushNotificationToggleRenderProps) => ReactNode;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Drop-in per-user push notification switch. Renders nothing while push is
|
|
186
|
+
* unsupported by the browser, disabled by the workspace admins, or not yet
|
|
187
|
+
* configured on the backend — users only ever see a switch they can use.
|
|
188
|
+
*
|
|
189
|
+
* On: prompts for browser permission and registers this device.
|
|
190
|
+
* Off: unregisters this device.
|
|
191
|
+
*/
|
|
192
|
+
declare const PushNotificationToggle: ({ className, label, description, children, }: PushNotificationToggleProps) => React.JSX.Element | null;
|
|
193
|
+
|
|
146
194
|
interface ChatForwardItem {
|
|
147
195
|
message: IMessage;
|
|
148
196
|
attachmentId?: string;
|
|
149
197
|
}
|
|
150
198
|
|
|
199
|
+
interface IUser {
|
|
200
|
+
_id: string;
|
|
201
|
+
id?: string;
|
|
202
|
+
name: string;
|
|
203
|
+
email: string;
|
|
204
|
+
role: string;
|
|
205
|
+
isActive: boolean;
|
|
206
|
+
createdAt: Date;
|
|
207
|
+
updatedAt: Date;
|
|
208
|
+
image?: string;
|
|
209
|
+
refreshToken?: string;
|
|
210
|
+
isOnline?: boolean;
|
|
211
|
+
}
|
|
212
|
+
|
|
151
213
|
interface ChatLayoutConfig {
|
|
152
214
|
/** Sidebar with profile + conversation list */
|
|
153
215
|
sidebar?: boolean;
|
|
@@ -167,20 +229,6 @@ interface ChatLayoutConfig {
|
|
|
167
229
|
declare const defaultChatLayoutConfig: Required<ChatLayoutConfig>;
|
|
168
230
|
declare const mergeChatLayoutConfig: (config?: ChatLayoutConfig) => Required<ChatLayoutConfig>;
|
|
169
231
|
|
|
170
|
-
interface IUser {
|
|
171
|
-
_id: string;
|
|
172
|
-
id?: string;
|
|
173
|
-
name: string;
|
|
174
|
-
email: string;
|
|
175
|
-
role: string;
|
|
176
|
-
isActive: boolean;
|
|
177
|
-
createdAt: Date;
|
|
178
|
-
updatedAt: Date;
|
|
179
|
-
image?: string;
|
|
180
|
-
refreshToken?: string;
|
|
181
|
-
isOnline?: boolean;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
232
|
type SocketStatus = "idle" | "connecting" | "connected" | "disconnected" | "error";
|
|
185
233
|
interface AuthState {
|
|
186
234
|
loggedUserDetails: IUser | null;
|
|
@@ -548,6 +596,33 @@ interface LoggedUserDetailsSlotProps {
|
|
|
548
596
|
searchQuery?: string;
|
|
549
597
|
setSearchQuery?: (val: string) => void;
|
|
550
598
|
}
|
|
599
|
+
/** Full settings button + modal (replace for a completely custom account settings UI). */
|
|
600
|
+
interface LoggedUserSettingsDialogSlotProps {
|
|
601
|
+
loggedUserDetails: any;
|
|
602
|
+
open?: boolean;
|
|
603
|
+
onOpenChange?: (open: boolean) => void;
|
|
604
|
+
title?: string;
|
|
605
|
+
showProfile?: boolean;
|
|
606
|
+
showPushToggle?: boolean;
|
|
607
|
+
className?: string;
|
|
608
|
+
}
|
|
609
|
+
/** Settings gear button only — used when customizing the dialog shell. */
|
|
610
|
+
interface LoggedUserSettingsTriggerSlotProps {
|
|
611
|
+
onClick: () => void;
|
|
612
|
+
className?: string;
|
|
613
|
+
tooltip?: string;
|
|
614
|
+
ariaLabel?: string;
|
|
615
|
+
}
|
|
616
|
+
/** Modal body — profile, push toggle, or your own settings rows. */
|
|
617
|
+
interface LoggedUserSettingsContentSlotProps {
|
|
618
|
+
loggedUserDetails: any;
|
|
619
|
+
user: IUser;
|
|
620
|
+
onClose?: () => void;
|
|
621
|
+
title?: string;
|
|
622
|
+
showProfile?: boolean;
|
|
623
|
+
showPushToggle?: boolean;
|
|
624
|
+
className?: string;
|
|
625
|
+
}
|
|
551
626
|
interface ActiveChannelMessagesSlotProps {
|
|
552
627
|
activeChannel: IChannel | null;
|
|
553
628
|
loggedUserId?: string;
|
|
@@ -758,6 +833,12 @@ interface ChatClassNames {
|
|
|
758
833
|
mainPanel?: string;
|
|
759
834
|
sidebar?: string;
|
|
760
835
|
loggedUserDetails?: string;
|
|
836
|
+
loggedUserSettingsTrigger?: string;
|
|
837
|
+
loggedUserSettingsDialog?: string;
|
|
838
|
+
loggedUserSettingsHeader?: string;
|
|
839
|
+
loggedUserSettingsContent?: string;
|
|
840
|
+
loggedUserSettingsAvatar?: string;
|
|
841
|
+
pushNotificationToggle?: string;
|
|
761
842
|
channelList?: string;
|
|
762
843
|
channelListItem?: string;
|
|
763
844
|
channelListItemActive?: string;
|
|
@@ -788,6 +869,10 @@ interface ChatComponents {
|
|
|
788
869
|
/** Case 1: replace the entire chat UI shell */
|
|
789
870
|
ChatLayout?: React__default.ComponentType<ChatLayoutSlotProps>;
|
|
790
871
|
LoggedUserDetails?: React__default.ComponentType<LoggedUserDetailsSlotProps>;
|
|
872
|
+
LoggedUserSettingsDialog?: React__default.ComponentType<LoggedUserSettingsDialogSlotProps>;
|
|
873
|
+
LoggedUserSettingsTrigger?: React__default.ComponentType<LoggedUserSettingsTriggerSlotProps>;
|
|
874
|
+
LoggedUserSettingsContent?: React__default.ComponentType<LoggedUserSettingsContentSlotProps>;
|
|
875
|
+
PushNotificationToggle?: React__default.ComponentType<PushNotificationToggleProps>;
|
|
791
876
|
ChannelList?: React__default.ComponentType<ChannelListSlotProps>;
|
|
792
877
|
ChannelListItem?: React__default.ComponentType<ChannelListItemSlotProps>;
|
|
793
878
|
ChannelHeader?: React__default.ComponentType<ChannelHeaderSlotProps>;
|
|
@@ -875,13 +960,19 @@ interface ChatProps {
|
|
|
875
960
|
queryParamApis?: ChatApiKey[];
|
|
876
961
|
/** Different query params per API key */
|
|
877
962
|
queryParamsByApi?: ChatQueryParamsByApi;
|
|
963
|
+
/**
|
|
964
|
+
* Per-service API versions after `/api`.
|
|
965
|
+
* Example: `{ default: 'v1', push: 'v2' }`.
|
|
966
|
+
* `default` is also parsed from `apiUrl` when it ends with `/v1`, `/v2`, etc.
|
|
967
|
+
*/
|
|
968
|
+
apiVersions?: ChatApiVersionConfig;
|
|
878
969
|
channelsData?: IChannel[];
|
|
879
970
|
messagesData?: Record<string, IMessage[]>;
|
|
880
971
|
onMessageReceived?: (message: any) => void;
|
|
881
972
|
onSocketConnected?: (socketId: string) => void;
|
|
882
973
|
onSocketError?: (error: string) => void;
|
|
883
974
|
}
|
|
884
|
-
declare const Chat: ({ children, onSendMessage, client, theme, uiConfig, themeColor, accessToken, loggedUserDetails, apiUrl, socketUrl, queryParams, queryParamApis, queryParamsByApi, channelsData, messagesData, onMessageReceived, onSocketConnected, onSocketError }: ChatProps) => React__default.JSX.Element;
|
|
975
|
+
declare const Chat: ({ children, onSendMessage, client, theme, uiConfig, themeColor, accessToken, loggedUserDetails, apiUrl, socketUrl, queryParams, queryParamApis, queryParamsByApi, apiVersions, channelsData, messagesData, onMessageReceived, onSocketConnected, onSocketError }: ChatProps) => React__default.JSX.Element;
|
|
885
976
|
|
|
886
977
|
type ChatColorMode = 'light' | 'dark';
|
|
887
978
|
|
|
@@ -966,6 +1057,8 @@ interface ChatMainProps {
|
|
|
966
1057
|
* pinnedMessages, starredMessages, searchMessages, searchMessagesContext
|
|
967
1058
|
*/
|
|
968
1059
|
queryParamsByApi?: ChatQueryParamsByApi;
|
|
1060
|
+
/** Per-service API versions after `/api` — e.g. `{ default: 'v1', push: 'v2' }`. */
|
|
1061
|
+
apiVersions?: ChatApiVersionConfig;
|
|
969
1062
|
themeColor?: string;
|
|
970
1063
|
theme?: string;
|
|
971
1064
|
uiConfig?: UIConfig;
|
|
@@ -997,7 +1090,7 @@ interface ChatMainProps {
|
|
|
997
1090
|
/** Extra classes on the viewport wrapper */
|
|
998
1091
|
viewportClassName?: string;
|
|
999
1092
|
}
|
|
1000
|
-
declare const ChatMain: ({ clientId, loggedUserDetails, accessToken, apiUrl, socketUrl, queryParams, queryParamApis, queryParamsByApi, themeColor, theme, uiConfig, components, classNames, features, layout, colorMode, defaultColorMode, onColorModeChange, showColorModeToggle, locale, timeZone, hour12, defaultLocale, defaultTimeZone, defaultHour12, onDateTimePreferencesChange, showDateTimeSettings, error, info, onErrorDismiss, onInfoDismiss, viewportHeight, viewportClassName, }: ChatMainProps) => React__default.JSX.Element;
|
|
1093
|
+
declare const ChatMain: ({ clientId, loggedUserDetails, accessToken, apiUrl, socketUrl, queryParams, queryParamApis, queryParamsByApi, apiVersions, themeColor, theme, uiConfig, components, classNames, features, layout, colorMode, defaultColorMode, onColorModeChange, showColorModeToggle, locale, timeZone, hour12, defaultLocale, defaultTimeZone, defaultHour12, onDateTimePreferencesChange, showDateTimeSettings, error, info, onErrorDismiss, onInfoDismiss, viewportHeight, viewportClassName, }: ChatMainProps) => React__default.JSX.Element;
|
|
1001
1094
|
|
|
1002
1095
|
declare const useStore: zustand.UseBoundStore<Omit<zustand.StoreApi<AppStoreState>, "setState" | "persist"> & {
|
|
1003
1096
|
setState(partial: AppStoreState | Partial<AppStoreState> | ((state: AppStoreState) => AppStoreState | Partial<AppStoreState>), replace?: false | undefined): unknown;
|
|
@@ -1297,6 +1390,14 @@ interface LoggedUserDetailsProps {
|
|
|
1297
1390
|
}
|
|
1298
1391
|
declare const LoggedUserDetails: ({ loggedUserDetails, onUserSelect, isCreateModalOpen, setIsCreateModalOpen, searchQuery, setSearchQuery, }: LoggedUserDetailsProps) => React.JSX.Element;
|
|
1299
1392
|
|
|
1393
|
+
declare const LoggedUserSettingsDialog: ({ loggedUserDetails, open: controlledOpen, onOpenChange: controlledOnOpenChange, title, showProfile, showPushToggle, className, }: LoggedUserSettingsDialogSlotProps) => React.JSX.Element;
|
|
1394
|
+
|
|
1395
|
+
declare const LoggedUserSettingsTrigger: ({ onClick, className, tooltip, ariaLabel, }: LoggedUserSettingsTriggerSlotProps) => React.JSX.Element;
|
|
1396
|
+
|
|
1397
|
+
declare const LoggedUserSettingsContent: ({ user, title, showProfile, showPushToggle, className, }: LoggedUserSettingsContentSlotProps) => React.JSX.Element;
|
|
1398
|
+
|
|
1399
|
+
declare const buildLoggedUserProfile: (loggedUserDetails: IUser | null | undefined) => IUser;
|
|
1400
|
+
|
|
1300
1401
|
interface ForwardModalProps {
|
|
1301
1402
|
isOpen: boolean;
|
|
1302
1403
|
onClose: () => void;
|
|
@@ -1354,7 +1455,7 @@ declare const useChatController: () => {
|
|
|
1354
1455
|
declare function resolveApiUrl(apiUrl?: string): string;
|
|
1355
1456
|
/**
|
|
1356
1457
|
* Socket.io connects to the host origin with path `/connection`.
|
|
1357
|
-
* Prefer explicit `socketUrl`; otherwise derive from `apiUrl` by stripping `/api/
|
|
1458
|
+
* Prefer explicit `socketUrl`; otherwise derive from `apiUrl` by stripping `/api/vN`.
|
|
1358
1459
|
*/
|
|
1359
1460
|
declare function resolveSocketUrl(socketUrl?: string, apiUrl?: string): string;
|
|
1360
1461
|
|
|
@@ -1536,8 +1637,8 @@ declare function ChatAlertsProvider({ children, value, }: {
|
|
|
1536
1637
|
declare function useChatAlerts(): ChatAlertsContextValue;
|
|
1537
1638
|
|
|
1538
1639
|
declare const buttonVariants: (props?: ({
|
|
1539
|
-
variant?: "
|
|
1540
|
-
size?: "
|
|
1640
|
+
variant?: "default" | "link" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
1641
|
+
size?: "default" | "sm" | "xs" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
1541
1642
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
1542
1643
|
declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
1543
1644
|
asChild?: boolean;
|
|
@@ -1621,21 +1722,6 @@ interface UsePushNotifications extends PushNotificationsState {
|
|
|
1621
1722
|
*/
|
|
1622
1723
|
declare const usePushNotifications: () => UsePushNotifications;
|
|
1623
1724
|
|
|
1624
|
-
interface PushNotificationToggleProps {
|
|
1625
|
-
className?: string;
|
|
1626
|
-
label?: string;
|
|
1627
|
-
description?: string;
|
|
1628
|
-
}
|
|
1629
|
-
/**
|
|
1630
|
-
* Drop-in per-user push notification switch. Renders nothing while push is
|
|
1631
|
-
* unsupported by the browser, disabled by the workspace admins, or not yet
|
|
1632
|
-
* configured on the backend — users only ever see a switch they can use.
|
|
1633
|
-
*
|
|
1634
|
-
* On: prompts for browser permission and registers this device.
|
|
1635
|
-
* Off: unregisters this device.
|
|
1636
|
-
*/
|
|
1637
|
-
declare const PushNotificationToggle: ({ className, label, description, }: PushNotificationToggleProps) => React.JSX.Element | null;
|
|
1638
|
-
|
|
1639
1725
|
interface ForegroundPushPayload {
|
|
1640
1726
|
title?: string;
|
|
1641
1727
|
body?: string;
|
|
@@ -1656,6 +1742,8 @@ declare const OPEN_CONVERSATION_EVENT = "realtimex:open-conversation";
|
|
|
1656
1742
|
declare const NOTIFICATION_CLICK_SW_TYPE = "realtimex:notification-click";
|
|
1657
1743
|
/** Must match the channel name in firebase-messaging-sw.js */
|
|
1658
1744
|
declare const PUSH_BROADCAST_CHANNEL = "realtimex-push";
|
|
1745
|
+
/** Must match the cache name in firebase-messaging-sw.js */
|
|
1746
|
+
declare const PUSH_DATA_CACHE_NAME = "realtimex-push-data-v1";
|
|
1659
1747
|
interface PushOpenRequest {
|
|
1660
1748
|
conversationId: string;
|
|
1661
1749
|
senderId?: string;
|
|
@@ -1678,10 +1766,13 @@ declare const requestOpenConversation: (conversationId: string, meta?: Record<st
|
|
|
1678
1766
|
/** Open immediately when the chat store/controller is already mounted. */
|
|
1679
1767
|
declare const buildChannelFromPushRequest: (request: PushOpenRequest, loggedUserId?: string, allUsers?: any[]) => IChannel;
|
|
1680
1768
|
interface NotificationClickBridgeOptions {
|
|
1681
|
-
/** Host chat route, default `/chat` */
|
|
1769
|
+
/** Host chat route, default `/chat` (no query string — conversation id stays internal). */
|
|
1682
1770
|
chatPath?: string;
|
|
1683
|
-
|
|
1771
|
+
/** Navigate to the chat route when the user is not already on it. */
|
|
1772
|
+
onNavigate?: (conversationId: string, chatPath: string) => void;
|
|
1684
1773
|
}
|
|
1774
|
+
/** Cold-start fallback when the SW opened `/chat` without a URL query param. */
|
|
1775
|
+
declare const consumePendingOpenFromPushCache: () => Promise<PushOpenRequest | null>;
|
|
1685
1776
|
declare const installNotificationClickBridge: (options?: NotificationClickBridgeOptions) => (() => void);
|
|
1686
1777
|
|
|
1687
|
-
export { type ActiveChannelMessagesSlotProps, type AdminsDrawerSlotProps, type AttachmentsDrawerSlotProps, type AvatarSlotProps, CHAT_API_KEYS, CHAT_GET_API_KEYS, Calendar, CalendarDayButton, Channel, type ChannelDetailsDrawerSlotProps, ChannelHeaderView as ChannelHeader, type ChannelHeaderSlotProps, ChannelListView as ChannelList, ChannelListItem, type ChannelListItemSlotProps, type ChannelListSlotProps, type ChannelMessageBoxSlotProps, Chat, type ChatActionModalSlotProps, ChatAlertsProvider, type ChatApiKey, ChatAvatar, type ChatCallContext, type ChatClassNames, type ChatColorMode, type ChatComponents, type ChatCustomizationConfig, ChatCustomizationProvider, ChatDateJumpMenu, type ChatDateTimePreferences, type ChatFeatures, type ChatGetApiKey, ChatLayout, type ChatLayoutConfig, type ChatLayoutSlotProps, ChatLocaleProvider, ChatMain, type ChatPanelAlertsSlotProps, type ChatQueryParams, type ChatQueryParamsByApi, ChatThemeProvider, ChatViewport, type ChatViewportHeight, DefaultChannelListItem, DefaultChatAvatar, DefaultChatLayout, 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, 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, type PendingJump, type PermissionDrawerSlotProps, type PhoneCallButtonSlotProps, type PinnedMessagesDrawerSlotProps, type PushConfig, PushNotificationToggle, type PushNotificationToggleProps, type PushNotificationsState, type PushOpenRequest, type PushPreference, type StarredMessagesDrawerSlotProps, type UIConfig, type UsePushNotifications, type VideoCallButtonSlotProps, apiGetPushConfig, apiGetPushPreference, apiRegisterPushToken, apiRemovePushToken, apiUpdatePushPreference, buildChannelFromPushRequest, capitalizeFirst, clampJumpDate, consumePendingOpenConversation, consumePendingOpenRequest, ChatMain as default, defaultChatClassNames, defaultChatComponents, defaultChatFeatures, defaultChatLayoutConfig, disablePushOnThisDevice, downloadFile, enablePushOnThisDevice, getChatBaseUrl, getChatQueryParamApis, getChatQueryParams, getChatQueryParamsByApi, getChatSocketUrl, getFirstAndLastNameOneCharacter, getResponsiveWidth, getSocketConfig, getStoredPushToken, installNotificationClickBridge, isEmpty, isPushSupported, mergeChatCustomization, mergeChatLayoutConfig, onForegroundPush, packageDefaultComponents, peekPendingOpenConversation, peekPendingOpenRequest, requestOpenConversation, resolveApiUrl, resolveChatApiKey, resolveConversationIdFromPushData, resolveJumpDateBounds, resolveJumpPreset, resolveJumpStep, resolveSocketUrl, setChatAccessToken, setChatBaseURL, setChatClientId, setChatQueryParamApis, setChatQueryParams, setChatQueryParamsByApi, setChatSocketUrl, showNotification, smoothScrollToMessage, socketService, startOfLocalDay, toDateInputValue, uniqueList, useChatAlerts, useChatContext, useChatController, useChatCustomization, useChatCustomizationOptional, useChatFeatures, useChatFeaturesOptional, useChatLocale, useStore as useChatStore, useChatTheme, usePushNotifications };
|
|
1778
|
+
export { type ActiveChannelMessagesSlotProps, type AdminsDrawerSlotProps, type AttachmentsDrawerSlotProps, type AvatarSlotProps, CHAT_API_KEYS, CHAT_GET_API_KEYS, Calendar, CalendarDayButton, 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, type ChatFeatures, type ChatGetApiKey, ChatLayout, type ChatLayoutConfig, type ChatLayoutSlotProps, ChatLocaleProvider, ChatMain, type ChatPanelAlertsSlotProps, type ChatQueryParams, type ChatQueryParamsByApi, ChatThemeProvider, ChatViewport, type ChatViewportHeight, DefaultChannelListItem, DefaultChatAvatar, DefaultChatLayout, 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, 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, useChatAlerts, useChatContext, useChatController, useChatCustomization, useChatCustomizationOptional, useChatFeatures, useChatFeaturesOptional, useChatLocale, useStore as useChatStore, useChatTheme, usePushNotifications };
|
package/dist/index.d.ts
CHANGED
|
@@ -105,6 +105,27 @@ type ChatQueryParamsByApi = Partial<Record<Exclude<ChatApiKey, "all" | "get">, C
|
|
|
105
105
|
/** Match an axios request URL to a named API key (first match wins). */
|
|
106
106
|
declare function resolveChatApiKey(url?: string): Exclude<ChatApiKey, "all" | "get"> | null;
|
|
107
107
|
|
|
108
|
+
type ChatApiVersionKey = "default" | "push";
|
|
109
|
+
interface ChatApiVersionConfig {
|
|
110
|
+
/** Main chat REST API version (usually parsed from `setChatBaseURL`). */
|
|
111
|
+
default?: string;
|
|
112
|
+
/** Push notification API version. Default: `v2`. */
|
|
113
|
+
push?: string;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Strip a trailing `/v1`, `/v2`, … from the configured base URL.
|
|
117
|
+
* `https://realtimex.softwareco.com/api/v1` → `https://realtimex.softwareco.com/api`
|
|
118
|
+
*/
|
|
119
|
+
declare const resolveApiRoot: (baseUrl?: string) => string;
|
|
120
|
+
declare const buildVersionedApiUrl: (path: string, options?: {
|
|
121
|
+
version?: string;
|
|
122
|
+
baseUrl?: string;
|
|
123
|
+
service?: ChatApiVersionKey;
|
|
124
|
+
}) => string;
|
|
125
|
+
declare const setChatApiVersions: (config?: ChatApiVersionConfig | null) => void;
|
|
126
|
+
declare const getChatApiVersions: () => Readonly<Record<ChatApiVersionKey, string>>;
|
|
127
|
+
declare const setChatPushApiVersion: (version: string) => void;
|
|
128
|
+
|
|
108
129
|
declare const setChatClientId: (id: string) => void;
|
|
109
130
|
declare const setChatAccessToken: (token: string) => void;
|
|
110
131
|
declare const setChatBaseURL: (url: string) => void;
|
|
@@ -143,11 +164,52 @@ declare const getChatQueryParamsByApi: () => {
|
|
|
143
164
|
presignedUrls?: Record<string, string> | undefined;
|
|
144
165
|
};
|
|
145
166
|
|
|
167
|
+
interface PushNotificationToggleRenderProps {
|
|
168
|
+
label: string;
|
|
169
|
+
description: string;
|
|
170
|
+
checked: boolean;
|
|
171
|
+
disabled: boolean;
|
|
172
|
+
loading: boolean;
|
|
173
|
+
permissionBlocked: boolean;
|
|
174
|
+
error: string | null;
|
|
175
|
+
onCheckedChange: (checked: boolean) => void;
|
|
176
|
+
}
|
|
177
|
+
interface PushNotificationToggleProps {
|
|
178
|
+
className?: string;
|
|
179
|
+
label?: string;
|
|
180
|
+
description?: string;
|
|
181
|
+
/** Build your own row UI while keeping package push logic. */
|
|
182
|
+
children?: (props: PushNotificationToggleRenderProps) => ReactNode;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Drop-in per-user push notification switch. Renders nothing while push is
|
|
186
|
+
* unsupported by the browser, disabled by the workspace admins, or not yet
|
|
187
|
+
* configured on the backend — users only ever see a switch they can use.
|
|
188
|
+
*
|
|
189
|
+
* On: prompts for browser permission and registers this device.
|
|
190
|
+
* Off: unregisters this device.
|
|
191
|
+
*/
|
|
192
|
+
declare const PushNotificationToggle: ({ className, label, description, children, }: PushNotificationToggleProps) => React.JSX.Element | null;
|
|
193
|
+
|
|
146
194
|
interface ChatForwardItem {
|
|
147
195
|
message: IMessage;
|
|
148
196
|
attachmentId?: string;
|
|
149
197
|
}
|
|
150
198
|
|
|
199
|
+
interface IUser {
|
|
200
|
+
_id: string;
|
|
201
|
+
id?: string;
|
|
202
|
+
name: string;
|
|
203
|
+
email: string;
|
|
204
|
+
role: string;
|
|
205
|
+
isActive: boolean;
|
|
206
|
+
createdAt: Date;
|
|
207
|
+
updatedAt: Date;
|
|
208
|
+
image?: string;
|
|
209
|
+
refreshToken?: string;
|
|
210
|
+
isOnline?: boolean;
|
|
211
|
+
}
|
|
212
|
+
|
|
151
213
|
interface ChatLayoutConfig {
|
|
152
214
|
/** Sidebar with profile + conversation list */
|
|
153
215
|
sidebar?: boolean;
|
|
@@ -167,20 +229,6 @@ interface ChatLayoutConfig {
|
|
|
167
229
|
declare const defaultChatLayoutConfig: Required<ChatLayoutConfig>;
|
|
168
230
|
declare const mergeChatLayoutConfig: (config?: ChatLayoutConfig) => Required<ChatLayoutConfig>;
|
|
169
231
|
|
|
170
|
-
interface IUser {
|
|
171
|
-
_id: string;
|
|
172
|
-
id?: string;
|
|
173
|
-
name: string;
|
|
174
|
-
email: string;
|
|
175
|
-
role: string;
|
|
176
|
-
isActive: boolean;
|
|
177
|
-
createdAt: Date;
|
|
178
|
-
updatedAt: Date;
|
|
179
|
-
image?: string;
|
|
180
|
-
refreshToken?: string;
|
|
181
|
-
isOnline?: boolean;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
232
|
type SocketStatus = "idle" | "connecting" | "connected" | "disconnected" | "error";
|
|
185
233
|
interface AuthState {
|
|
186
234
|
loggedUserDetails: IUser | null;
|
|
@@ -548,6 +596,33 @@ interface LoggedUserDetailsSlotProps {
|
|
|
548
596
|
searchQuery?: string;
|
|
549
597
|
setSearchQuery?: (val: string) => void;
|
|
550
598
|
}
|
|
599
|
+
/** Full settings button + modal (replace for a completely custom account settings UI). */
|
|
600
|
+
interface LoggedUserSettingsDialogSlotProps {
|
|
601
|
+
loggedUserDetails: any;
|
|
602
|
+
open?: boolean;
|
|
603
|
+
onOpenChange?: (open: boolean) => void;
|
|
604
|
+
title?: string;
|
|
605
|
+
showProfile?: boolean;
|
|
606
|
+
showPushToggle?: boolean;
|
|
607
|
+
className?: string;
|
|
608
|
+
}
|
|
609
|
+
/** Settings gear button only — used when customizing the dialog shell. */
|
|
610
|
+
interface LoggedUserSettingsTriggerSlotProps {
|
|
611
|
+
onClick: () => void;
|
|
612
|
+
className?: string;
|
|
613
|
+
tooltip?: string;
|
|
614
|
+
ariaLabel?: string;
|
|
615
|
+
}
|
|
616
|
+
/** Modal body — profile, push toggle, or your own settings rows. */
|
|
617
|
+
interface LoggedUserSettingsContentSlotProps {
|
|
618
|
+
loggedUserDetails: any;
|
|
619
|
+
user: IUser;
|
|
620
|
+
onClose?: () => void;
|
|
621
|
+
title?: string;
|
|
622
|
+
showProfile?: boolean;
|
|
623
|
+
showPushToggle?: boolean;
|
|
624
|
+
className?: string;
|
|
625
|
+
}
|
|
551
626
|
interface ActiveChannelMessagesSlotProps {
|
|
552
627
|
activeChannel: IChannel | null;
|
|
553
628
|
loggedUserId?: string;
|
|
@@ -758,6 +833,12 @@ interface ChatClassNames {
|
|
|
758
833
|
mainPanel?: string;
|
|
759
834
|
sidebar?: string;
|
|
760
835
|
loggedUserDetails?: string;
|
|
836
|
+
loggedUserSettingsTrigger?: string;
|
|
837
|
+
loggedUserSettingsDialog?: string;
|
|
838
|
+
loggedUserSettingsHeader?: string;
|
|
839
|
+
loggedUserSettingsContent?: string;
|
|
840
|
+
loggedUserSettingsAvatar?: string;
|
|
841
|
+
pushNotificationToggle?: string;
|
|
761
842
|
channelList?: string;
|
|
762
843
|
channelListItem?: string;
|
|
763
844
|
channelListItemActive?: string;
|
|
@@ -788,6 +869,10 @@ interface ChatComponents {
|
|
|
788
869
|
/** Case 1: replace the entire chat UI shell */
|
|
789
870
|
ChatLayout?: React__default.ComponentType<ChatLayoutSlotProps>;
|
|
790
871
|
LoggedUserDetails?: React__default.ComponentType<LoggedUserDetailsSlotProps>;
|
|
872
|
+
LoggedUserSettingsDialog?: React__default.ComponentType<LoggedUserSettingsDialogSlotProps>;
|
|
873
|
+
LoggedUserSettingsTrigger?: React__default.ComponentType<LoggedUserSettingsTriggerSlotProps>;
|
|
874
|
+
LoggedUserSettingsContent?: React__default.ComponentType<LoggedUserSettingsContentSlotProps>;
|
|
875
|
+
PushNotificationToggle?: React__default.ComponentType<PushNotificationToggleProps>;
|
|
791
876
|
ChannelList?: React__default.ComponentType<ChannelListSlotProps>;
|
|
792
877
|
ChannelListItem?: React__default.ComponentType<ChannelListItemSlotProps>;
|
|
793
878
|
ChannelHeader?: React__default.ComponentType<ChannelHeaderSlotProps>;
|
|
@@ -875,13 +960,19 @@ interface ChatProps {
|
|
|
875
960
|
queryParamApis?: ChatApiKey[];
|
|
876
961
|
/** Different query params per API key */
|
|
877
962
|
queryParamsByApi?: ChatQueryParamsByApi;
|
|
963
|
+
/**
|
|
964
|
+
* Per-service API versions after `/api`.
|
|
965
|
+
* Example: `{ default: 'v1', push: 'v2' }`.
|
|
966
|
+
* `default` is also parsed from `apiUrl` when it ends with `/v1`, `/v2`, etc.
|
|
967
|
+
*/
|
|
968
|
+
apiVersions?: ChatApiVersionConfig;
|
|
878
969
|
channelsData?: IChannel[];
|
|
879
970
|
messagesData?: Record<string, IMessage[]>;
|
|
880
971
|
onMessageReceived?: (message: any) => void;
|
|
881
972
|
onSocketConnected?: (socketId: string) => void;
|
|
882
973
|
onSocketError?: (error: string) => void;
|
|
883
974
|
}
|
|
884
|
-
declare const Chat: ({ children, onSendMessage, client, theme, uiConfig, themeColor, accessToken, loggedUserDetails, apiUrl, socketUrl, queryParams, queryParamApis, queryParamsByApi, channelsData, messagesData, onMessageReceived, onSocketConnected, onSocketError }: ChatProps) => React__default.JSX.Element;
|
|
975
|
+
declare const Chat: ({ children, onSendMessage, client, theme, uiConfig, themeColor, accessToken, loggedUserDetails, apiUrl, socketUrl, queryParams, queryParamApis, queryParamsByApi, apiVersions, channelsData, messagesData, onMessageReceived, onSocketConnected, onSocketError }: ChatProps) => React__default.JSX.Element;
|
|
885
976
|
|
|
886
977
|
type ChatColorMode = 'light' | 'dark';
|
|
887
978
|
|
|
@@ -966,6 +1057,8 @@ interface ChatMainProps {
|
|
|
966
1057
|
* pinnedMessages, starredMessages, searchMessages, searchMessagesContext
|
|
967
1058
|
*/
|
|
968
1059
|
queryParamsByApi?: ChatQueryParamsByApi;
|
|
1060
|
+
/** Per-service API versions after `/api` — e.g. `{ default: 'v1', push: 'v2' }`. */
|
|
1061
|
+
apiVersions?: ChatApiVersionConfig;
|
|
969
1062
|
themeColor?: string;
|
|
970
1063
|
theme?: string;
|
|
971
1064
|
uiConfig?: UIConfig;
|
|
@@ -997,7 +1090,7 @@ interface ChatMainProps {
|
|
|
997
1090
|
/** Extra classes on the viewport wrapper */
|
|
998
1091
|
viewportClassName?: string;
|
|
999
1092
|
}
|
|
1000
|
-
declare const ChatMain: ({ clientId, loggedUserDetails, accessToken, apiUrl, socketUrl, queryParams, queryParamApis, queryParamsByApi, themeColor, theme, uiConfig, components, classNames, features, layout, colorMode, defaultColorMode, onColorModeChange, showColorModeToggle, locale, timeZone, hour12, defaultLocale, defaultTimeZone, defaultHour12, onDateTimePreferencesChange, showDateTimeSettings, error, info, onErrorDismiss, onInfoDismiss, viewportHeight, viewportClassName, }: ChatMainProps) => React__default.JSX.Element;
|
|
1093
|
+
declare const ChatMain: ({ clientId, loggedUserDetails, accessToken, apiUrl, socketUrl, queryParams, queryParamApis, queryParamsByApi, apiVersions, themeColor, theme, uiConfig, components, classNames, features, layout, colorMode, defaultColorMode, onColorModeChange, showColorModeToggle, locale, timeZone, hour12, defaultLocale, defaultTimeZone, defaultHour12, onDateTimePreferencesChange, showDateTimeSettings, error, info, onErrorDismiss, onInfoDismiss, viewportHeight, viewportClassName, }: ChatMainProps) => React__default.JSX.Element;
|
|
1001
1094
|
|
|
1002
1095
|
declare const useStore: zustand.UseBoundStore<Omit<zustand.StoreApi<AppStoreState>, "setState" | "persist"> & {
|
|
1003
1096
|
setState(partial: AppStoreState | Partial<AppStoreState> | ((state: AppStoreState) => AppStoreState | Partial<AppStoreState>), replace?: false | undefined): unknown;
|
|
@@ -1297,6 +1390,14 @@ interface LoggedUserDetailsProps {
|
|
|
1297
1390
|
}
|
|
1298
1391
|
declare const LoggedUserDetails: ({ loggedUserDetails, onUserSelect, isCreateModalOpen, setIsCreateModalOpen, searchQuery, setSearchQuery, }: LoggedUserDetailsProps) => React.JSX.Element;
|
|
1299
1392
|
|
|
1393
|
+
declare const LoggedUserSettingsDialog: ({ loggedUserDetails, open: controlledOpen, onOpenChange: controlledOnOpenChange, title, showProfile, showPushToggle, className, }: LoggedUserSettingsDialogSlotProps) => React.JSX.Element;
|
|
1394
|
+
|
|
1395
|
+
declare const LoggedUserSettingsTrigger: ({ onClick, className, tooltip, ariaLabel, }: LoggedUserSettingsTriggerSlotProps) => React.JSX.Element;
|
|
1396
|
+
|
|
1397
|
+
declare const LoggedUserSettingsContent: ({ user, title, showProfile, showPushToggle, className, }: LoggedUserSettingsContentSlotProps) => React.JSX.Element;
|
|
1398
|
+
|
|
1399
|
+
declare const buildLoggedUserProfile: (loggedUserDetails: IUser | null | undefined) => IUser;
|
|
1400
|
+
|
|
1300
1401
|
interface ForwardModalProps {
|
|
1301
1402
|
isOpen: boolean;
|
|
1302
1403
|
onClose: () => void;
|
|
@@ -1354,7 +1455,7 @@ declare const useChatController: () => {
|
|
|
1354
1455
|
declare function resolveApiUrl(apiUrl?: string): string;
|
|
1355
1456
|
/**
|
|
1356
1457
|
* Socket.io connects to the host origin with path `/connection`.
|
|
1357
|
-
* Prefer explicit `socketUrl`; otherwise derive from `apiUrl` by stripping `/api/
|
|
1458
|
+
* Prefer explicit `socketUrl`; otherwise derive from `apiUrl` by stripping `/api/vN`.
|
|
1358
1459
|
*/
|
|
1359
1460
|
declare function resolveSocketUrl(socketUrl?: string, apiUrl?: string): string;
|
|
1360
1461
|
|
|
@@ -1536,8 +1637,8 @@ declare function ChatAlertsProvider({ children, value, }: {
|
|
|
1536
1637
|
declare function useChatAlerts(): ChatAlertsContextValue;
|
|
1537
1638
|
|
|
1538
1639
|
declare const buttonVariants: (props?: ({
|
|
1539
|
-
variant?: "
|
|
1540
|
-
size?: "
|
|
1640
|
+
variant?: "default" | "link" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
1641
|
+
size?: "default" | "sm" | "xs" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
1541
1642
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
1542
1643
|
declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
1543
1644
|
asChild?: boolean;
|
|
@@ -1621,21 +1722,6 @@ interface UsePushNotifications extends PushNotificationsState {
|
|
|
1621
1722
|
*/
|
|
1622
1723
|
declare const usePushNotifications: () => UsePushNotifications;
|
|
1623
1724
|
|
|
1624
|
-
interface PushNotificationToggleProps {
|
|
1625
|
-
className?: string;
|
|
1626
|
-
label?: string;
|
|
1627
|
-
description?: string;
|
|
1628
|
-
}
|
|
1629
|
-
/**
|
|
1630
|
-
* Drop-in per-user push notification switch. Renders nothing while push is
|
|
1631
|
-
* unsupported by the browser, disabled by the workspace admins, or not yet
|
|
1632
|
-
* configured on the backend — users only ever see a switch they can use.
|
|
1633
|
-
*
|
|
1634
|
-
* On: prompts for browser permission and registers this device.
|
|
1635
|
-
* Off: unregisters this device.
|
|
1636
|
-
*/
|
|
1637
|
-
declare const PushNotificationToggle: ({ className, label, description, }: PushNotificationToggleProps) => React.JSX.Element | null;
|
|
1638
|
-
|
|
1639
1725
|
interface ForegroundPushPayload {
|
|
1640
1726
|
title?: string;
|
|
1641
1727
|
body?: string;
|
|
@@ -1656,6 +1742,8 @@ declare const OPEN_CONVERSATION_EVENT = "realtimex:open-conversation";
|
|
|
1656
1742
|
declare const NOTIFICATION_CLICK_SW_TYPE = "realtimex:notification-click";
|
|
1657
1743
|
/** Must match the channel name in firebase-messaging-sw.js */
|
|
1658
1744
|
declare const PUSH_BROADCAST_CHANNEL = "realtimex-push";
|
|
1745
|
+
/** Must match the cache name in firebase-messaging-sw.js */
|
|
1746
|
+
declare const PUSH_DATA_CACHE_NAME = "realtimex-push-data-v1";
|
|
1659
1747
|
interface PushOpenRequest {
|
|
1660
1748
|
conversationId: string;
|
|
1661
1749
|
senderId?: string;
|
|
@@ -1678,10 +1766,13 @@ declare const requestOpenConversation: (conversationId: string, meta?: Record<st
|
|
|
1678
1766
|
/** Open immediately when the chat store/controller is already mounted. */
|
|
1679
1767
|
declare const buildChannelFromPushRequest: (request: PushOpenRequest, loggedUserId?: string, allUsers?: any[]) => IChannel;
|
|
1680
1768
|
interface NotificationClickBridgeOptions {
|
|
1681
|
-
/** Host chat route, default `/chat` */
|
|
1769
|
+
/** Host chat route, default `/chat` (no query string — conversation id stays internal). */
|
|
1682
1770
|
chatPath?: string;
|
|
1683
|
-
|
|
1771
|
+
/** Navigate to the chat route when the user is not already on it. */
|
|
1772
|
+
onNavigate?: (conversationId: string, chatPath: string) => void;
|
|
1684
1773
|
}
|
|
1774
|
+
/** Cold-start fallback when the SW opened `/chat` without a URL query param. */
|
|
1775
|
+
declare const consumePendingOpenFromPushCache: () => Promise<PushOpenRequest | null>;
|
|
1685
1776
|
declare const installNotificationClickBridge: (options?: NotificationClickBridgeOptions) => (() => void);
|
|
1686
1777
|
|
|
1687
|
-
export { type ActiveChannelMessagesSlotProps, type AdminsDrawerSlotProps, type AttachmentsDrawerSlotProps, type AvatarSlotProps, CHAT_API_KEYS, CHAT_GET_API_KEYS, Calendar, CalendarDayButton, Channel, type ChannelDetailsDrawerSlotProps, ChannelHeaderView as ChannelHeader, type ChannelHeaderSlotProps, ChannelListView as ChannelList, ChannelListItem, type ChannelListItemSlotProps, type ChannelListSlotProps, type ChannelMessageBoxSlotProps, Chat, type ChatActionModalSlotProps, ChatAlertsProvider, type ChatApiKey, ChatAvatar, type ChatCallContext, type ChatClassNames, type ChatColorMode, type ChatComponents, type ChatCustomizationConfig, ChatCustomizationProvider, ChatDateJumpMenu, type ChatDateTimePreferences, type ChatFeatures, type ChatGetApiKey, ChatLayout, type ChatLayoutConfig, type ChatLayoutSlotProps, ChatLocaleProvider, ChatMain, type ChatPanelAlertsSlotProps, type ChatQueryParams, type ChatQueryParamsByApi, ChatThemeProvider, ChatViewport, type ChatViewportHeight, DefaultChannelListItem, DefaultChatAvatar, DefaultChatLayout, 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, 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, type PendingJump, type PermissionDrawerSlotProps, type PhoneCallButtonSlotProps, type PinnedMessagesDrawerSlotProps, type PushConfig, PushNotificationToggle, type PushNotificationToggleProps, type PushNotificationsState, type PushOpenRequest, type PushPreference, type StarredMessagesDrawerSlotProps, type UIConfig, type UsePushNotifications, type VideoCallButtonSlotProps, apiGetPushConfig, apiGetPushPreference, apiRegisterPushToken, apiRemovePushToken, apiUpdatePushPreference, buildChannelFromPushRequest, capitalizeFirst, clampJumpDate, consumePendingOpenConversation, consumePendingOpenRequest, ChatMain as default, defaultChatClassNames, defaultChatComponents, defaultChatFeatures, defaultChatLayoutConfig, disablePushOnThisDevice, downloadFile, enablePushOnThisDevice, getChatBaseUrl, getChatQueryParamApis, getChatQueryParams, getChatQueryParamsByApi, getChatSocketUrl, getFirstAndLastNameOneCharacter, getResponsiveWidth, getSocketConfig, getStoredPushToken, installNotificationClickBridge, isEmpty, isPushSupported, mergeChatCustomization, mergeChatLayoutConfig, onForegroundPush, packageDefaultComponents, peekPendingOpenConversation, peekPendingOpenRequest, requestOpenConversation, resolveApiUrl, resolveChatApiKey, resolveConversationIdFromPushData, resolveJumpDateBounds, resolveJumpPreset, resolveJumpStep, resolveSocketUrl, setChatAccessToken, setChatBaseURL, setChatClientId, setChatQueryParamApis, setChatQueryParams, setChatQueryParamsByApi, setChatSocketUrl, showNotification, smoothScrollToMessage, socketService, startOfLocalDay, toDateInputValue, uniqueList, useChatAlerts, useChatContext, useChatController, useChatCustomization, useChatCustomizationOptional, useChatFeatures, useChatFeaturesOptional, useChatLocale, useStore as useChatStore, useChatTheme, usePushNotifications };
|
|
1778
|
+
export { type ActiveChannelMessagesSlotProps, type AdminsDrawerSlotProps, type AttachmentsDrawerSlotProps, type AvatarSlotProps, CHAT_API_KEYS, CHAT_GET_API_KEYS, Calendar, CalendarDayButton, 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, type ChatFeatures, type ChatGetApiKey, ChatLayout, type ChatLayoutConfig, type ChatLayoutSlotProps, ChatLocaleProvider, ChatMain, type ChatPanelAlertsSlotProps, type ChatQueryParams, type ChatQueryParamsByApi, ChatThemeProvider, ChatViewport, type ChatViewportHeight, DefaultChannelListItem, DefaultChatAvatar, DefaultChatLayout, 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, 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, useChatAlerts, useChatContext, useChatController, useChatCustomization, useChatCustomizationOptional, useChatFeatures, useChatFeaturesOptional, useChatLocale, useStore as useChatStore, useChatTheme, usePushNotifications };
|