@realtimexsco/live-chat 1.0.0 → 1.2.0
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/README.md +935 -148
- package/dist/index.cjs +493 -220
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +72 -3
- package/dist/index.d.ts +72 -3
- package/dist/index.mjs +487 -222
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -5
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import * as zustand_middleware from 'zustand/middleware';
|
|
3
3
|
import * as zustand from 'zustand';
|
|
4
|
-
import { Socket } from 'socket.io-client';
|
|
4
|
+
import { ManagerOptions, SocketOptions, Socket } from 'socket.io-client';
|
|
5
|
+
import { Renderable } from 'react-hot-toast';
|
|
5
6
|
|
|
6
7
|
interface IChannel {
|
|
7
8
|
id: string;
|
|
@@ -440,8 +441,10 @@ declare const useStore: zustand.UseBoundStore<Omit<zustand.StoreApi<AppStoreStat
|
|
|
440
441
|
|
|
441
442
|
interface ISocketConfig {
|
|
442
443
|
url: string;
|
|
443
|
-
options:
|
|
444
|
+
options: Partial<ManagerOptions & SocketOptions>;
|
|
444
445
|
}
|
|
446
|
+
declare const getSocketConfig: (accessToken: string, tenantId: string, apiBaseUrl?: string) => ISocketConfig;
|
|
447
|
+
|
|
445
448
|
declare class SocketService {
|
|
446
449
|
private socket;
|
|
447
450
|
private currentConfig;
|
|
@@ -698,4 +701,70 @@ declare const setChatClientId: (id: string) => void;
|
|
|
698
701
|
declare const setChatAccessToken: (token: string) => void;
|
|
699
702
|
declare const setChatBaseURL: (url: string) => void;
|
|
700
703
|
|
|
701
|
-
|
|
704
|
+
type IDMMessage = {
|
|
705
|
+
sender: string;
|
|
706
|
+
receiver: string;
|
|
707
|
+
content: string;
|
|
708
|
+
type: string;
|
|
709
|
+
replyTo?: string;
|
|
710
|
+
attachmentUrl?: string;
|
|
711
|
+
conversationId?: string;
|
|
712
|
+
};
|
|
713
|
+
type IDMTyping = {
|
|
714
|
+
sender: string;
|
|
715
|
+
receiver: string;
|
|
716
|
+
conversationId: string;
|
|
717
|
+
};
|
|
718
|
+
type IDMEditMessage = {
|
|
719
|
+
messageId: string;
|
|
720
|
+
sender: string;
|
|
721
|
+
receiver: string;
|
|
722
|
+
content: string;
|
|
723
|
+
};
|
|
724
|
+
type IDMReaction = {
|
|
725
|
+
messageId: string;
|
|
726
|
+
sender: string;
|
|
727
|
+
receiver: string;
|
|
728
|
+
reaction?: string;
|
|
729
|
+
};
|
|
730
|
+
type IDMDelete = {
|
|
731
|
+
messageId: string;
|
|
732
|
+
sender: string;
|
|
733
|
+
receiver: string;
|
|
734
|
+
deleteType: "me" | "everyone";
|
|
735
|
+
};
|
|
736
|
+
type IDMRead = {
|
|
737
|
+
conversationId: string;
|
|
738
|
+
sender: string;
|
|
739
|
+
receiver: string;
|
|
740
|
+
};
|
|
741
|
+
type IDMPin = {
|
|
742
|
+
conversationId: string;
|
|
743
|
+
sender: string;
|
|
744
|
+
receiver: string;
|
|
745
|
+
messageId: string;
|
|
746
|
+
};
|
|
747
|
+
type IDMStar = {
|
|
748
|
+
messageId: string;
|
|
749
|
+
sender: string;
|
|
750
|
+
};
|
|
751
|
+
type IDMUnstar = {
|
|
752
|
+
messageId: string;
|
|
753
|
+
sender: string;
|
|
754
|
+
};
|
|
755
|
+
type IDMForward = {
|
|
756
|
+
messageId: string;
|
|
757
|
+
sender: string;
|
|
758
|
+
targetConversationIds: string[];
|
|
759
|
+
};
|
|
760
|
+
|
|
761
|
+
type NotificationType = "success" | "error" | "info" | "warning";
|
|
762
|
+
declare const showNotification: (message: string, type?: NotificationType, icon?: Renderable, duration?: number) => void;
|
|
763
|
+
declare const downloadFile: (src: string, name: string) => Promise<void>;
|
|
764
|
+
declare const getResponsiveWidth: (width?: number) => number;
|
|
765
|
+
declare const isEmpty: (value: any) => boolean;
|
|
766
|
+
declare function uniqueList<T extends Record<string, any>>(list: T[], key: keyof T): T[];
|
|
767
|
+
declare const capitalizeFirst: (str: string) => string;
|
|
768
|
+
declare const getFirstAndLastNameOneCharacter: (name: string) => string;
|
|
769
|
+
|
|
770
|
+
export { Channel, ChannelHeader, ChannelList, Chat, ChatLayout, type ChatLayoutConfig, ChatMain, ForwardModal, 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, LoggedUserDetails, ChannelMessageBox as MessageInput, ActiveChannelMessages as MessageList, type UIConfig, capitalizeFirst, ChatMain as default, defaultChatLayoutConfig, downloadFile, getFirstAndLastNameOneCharacter, getResponsiveWidth, getSocketConfig, isEmpty, mergeChatLayoutConfig, setChatAccessToken, setChatBaseURL, setChatClientId, showNotification, socketService, uniqueList, useChatContext, useChatController, useStore as useChatStore };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import * as zustand_middleware from 'zustand/middleware';
|
|
3
3
|
import * as zustand from 'zustand';
|
|
4
|
-
import { Socket } from 'socket.io-client';
|
|
4
|
+
import { ManagerOptions, SocketOptions, Socket } from 'socket.io-client';
|
|
5
|
+
import { Renderable } from 'react-hot-toast';
|
|
5
6
|
|
|
6
7
|
interface IChannel {
|
|
7
8
|
id: string;
|
|
@@ -440,8 +441,10 @@ declare const useStore: zustand.UseBoundStore<Omit<zustand.StoreApi<AppStoreStat
|
|
|
440
441
|
|
|
441
442
|
interface ISocketConfig {
|
|
442
443
|
url: string;
|
|
443
|
-
options:
|
|
444
|
+
options: Partial<ManagerOptions & SocketOptions>;
|
|
444
445
|
}
|
|
446
|
+
declare const getSocketConfig: (accessToken: string, tenantId: string, apiBaseUrl?: string) => ISocketConfig;
|
|
447
|
+
|
|
445
448
|
declare class SocketService {
|
|
446
449
|
private socket;
|
|
447
450
|
private currentConfig;
|
|
@@ -698,4 +701,70 @@ declare const setChatClientId: (id: string) => void;
|
|
|
698
701
|
declare const setChatAccessToken: (token: string) => void;
|
|
699
702
|
declare const setChatBaseURL: (url: string) => void;
|
|
700
703
|
|
|
701
|
-
|
|
704
|
+
type IDMMessage = {
|
|
705
|
+
sender: string;
|
|
706
|
+
receiver: string;
|
|
707
|
+
content: string;
|
|
708
|
+
type: string;
|
|
709
|
+
replyTo?: string;
|
|
710
|
+
attachmentUrl?: string;
|
|
711
|
+
conversationId?: string;
|
|
712
|
+
};
|
|
713
|
+
type IDMTyping = {
|
|
714
|
+
sender: string;
|
|
715
|
+
receiver: string;
|
|
716
|
+
conversationId: string;
|
|
717
|
+
};
|
|
718
|
+
type IDMEditMessage = {
|
|
719
|
+
messageId: string;
|
|
720
|
+
sender: string;
|
|
721
|
+
receiver: string;
|
|
722
|
+
content: string;
|
|
723
|
+
};
|
|
724
|
+
type IDMReaction = {
|
|
725
|
+
messageId: string;
|
|
726
|
+
sender: string;
|
|
727
|
+
receiver: string;
|
|
728
|
+
reaction?: string;
|
|
729
|
+
};
|
|
730
|
+
type IDMDelete = {
|
|
731
|
+
messageId: string;
|
|
732
|
+
sender: string;
|
|
733
|
+
receiver: string;
|
|
734
|
+
deleteType: "me" | "everyone";
|
|
735
|
+
};
|
|
736
|
+
type IDMRead = {
|
|
737
|
+
conversationId: string;
|
|
738
|
+
sender: string;
|
|
739
|
+
receiver: string;
|
|
740
|
+
};
|
|
741
|
+
type IDMPin = {
|
|
742
|
+
conversationId: string;
|
|
743
|
+
sender: string;
|
|
744
|
+
receiver: string;
|
|
745
|
+
messageId: string;
|
|
746
|
+
};
|
|
747
|
+
type IDMStar = {
|
|
748
|
+
messageId: string;
|
|
749
|
+
sender: string;
|
|
750
|
+
};
|
|
751
|
+
type IDMUnstar = {
|
|
752
|
+
messageId: string;
|
|
753
|
+
sender: string;
|
|
754
|
+
};
|
|
755
|
+
type IDMForward = {
|
|
756
|
+
messageId: string;
|
|
757
|
+
sender: string;
|
|
758
|
+
targetConversationIds: string[];
|
|
759
|
+
};
|
|
760
|
+
|
|
761
|
+
type NotificationType = "success" | "error" | "info" | "warning";
|
|
762
|
+
declare const showNotification: (message: string, type?: NotificationType, icon?: Renderable, duration?: number) => void;
|
|
763
|
+
declare const downloadFile: (src: string, name: string) => Promise<void>;
|
|
764
|
+
declare const getResponsiveWidth: (width?: number) => number;
|
|
765
|
+
declare const isEmpty: (value: any) => boolean;
|
|
766
|
+
declare function uniqueList<T extends Record<string, any>>(list: T[], key: keyof T): T[];
|
|
767
|
+
declare const capitalizeFirst: (str: string) => string;
|
|
768
|
+
declare const getFirstAndLastNameOneCharacter: (name: string) => string;
|
|
769
|
+
|
|
770
|
+
export { Channel, ChannelHeader, ChannelList, Chat, ChatLayout, type ChatLayoutConfig, ChatMain, ForwardModal, 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, LoggedUserDetails, ChannelMessageBox as MessageInput, ActiveChannelMessages as MessageList, type UIConfig, capitalizeFirst, ChatMain as default, defaultChatLayoutConfig, downloadFile, getFirstAndLastNameOneCharacter, getResponsiveWidth, getSocketConfig, isEmpty, mergeChatLayoutConfig, setChatAccessToken, setChatBaseURL, setChatClientId, showNotification, socketService, uniqueList, useChatContext, useChatController, useStore as useChatStore };
|