@diffsome/react 1.2.4 → 1.2.6
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/chat.css +2 -0
- package/dist/index.d.mts +23 -46
- package/dist/index.d.ts +23 -46
- package/dist/index.js +7 -7
- package/dist/index.mjs +7 -7
- package/package.json +1 -1
package/dist/chat.css
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -837,54 +837,9 @@ interface RichContentProps {
|
|
|
837
837
|
*/
|
|
838
838
|
declare function RichContent({ html, className, prose, proseVariant, proseSize, maxWidth, }: RichContentProps): react_jsx_runtime.JSX.Element;
|
|
839
839
|
|
|
840
|
-
interface Message {
|
|
841
|
-
id: number;
|
|
842
|
-
content: string;
|
|
843
|
-
senderType: 'visitor' | 'agent' | 'system';
|
|
844
|
-
senderName?: string;
|
|
845
|
-
timestamp?: string;
|
|
846
|
-
isRead?: boolean;
|
|
847
|
-
}
|
|
848
|
-
interface ChatWidgetProps {
|
|
849
|
-
messages: Message[];
|
|
850
|
-
onSend: (message: string) => void;
|
|
851
|
-
onTyping?: () => void;
|
|
852
|
-
onClose?: () => void;
|
|
853
|
-
title?: string;
|
|
854
|
-
subtitle?: string;
|
|
855
|
-
placeholder?: string;
|
|
856
|
-
loading?: boolean;
|
|
857
|
-
typing?: boolean;
|
|
858
|
-
className?: string;
|
|
859
|
-
}
|
|
860
|
-
declare const ChatWidget: React__default.FC<ChatWidgetProps>;
|
|
861
|
-
|
|
862
840
|
interface ChatBubbleProps {
|
|
863
841
|
/** Diffsome SDK client instance */
|
|
864
|
-
client:
|
|
865
|
-
chat: {
|
|
866
|
-
start: (data?: {
|
|
867
|
-
visitor_name?: string;
|
|
868
|
-
visitor_email?: string;
|
|
869
|
-
initial_message?: string;
|
|
870
|
-
}) => Promise<{
|
|
871
|
-
conversation_id: number;
|
|
872
|
-
visitor_id: string;
|
|
873
|
-
}>;
|
|
874
|
-
connect: (conversationId: number) => {
|
|
875
|
-
send: (content: string) => Promise<unknown>;
|
|
876
|
-
getMessages: () => Promise<Message[]>;
|
|
877
|
-
onMessage: (callback: (msg: Message) => void) => () => void;
|
|
878
|
-
onTyping: (callback: (senderType: string) => void) => () => void;
|
|
879
|
-
sendTyping: () => void;
|
|
880
|
-
disconnect: () => void;
|
|
881
|
-
};
|
|
882
|
-
checkAvailability: () => Promise<{
|
|
883
|
-
available: boolean;
|
|
884
|
-
agents_online: number;
|
|
885
|
-
}>;
|
|
886
|
-
};
|
|
887
|
-
};
|
|
842
|
+
client: Diffsome;
|
|
888
843
|
/** Chat widget title */
|
|
889
844
|
title?: string;
|
|
890
845
|
/** Chat widget subtitle */
|
|
@@ -914,6 +869,28 @@ interface ChatBubbleProps {
|
|
|
914
869
|
}
|
|
915
870
|
declare const ChatBubble: React__default.FC<ChatBubbleProps>;
|
|
916
871
|
|
|
872
|
+
interface Message {
|
|
873
|
+
id: number;
|
|
874
|
+
content: string;
|
|
875
|
+
sender_type: 'visitor' | 'agent' | 'system';
|
|
876
|
+
sender_name?: string;
|
|
877
|
+
created_at?: string;
|
|
878
|
+
is_read?: boolean;
|
|
879
|
+
}
|
|
880
|
+
interface ChatWidgetProps {
|
|
881
|
+
messages: Message[];
|
|
882
|
+
onSend: (message: string) => void;
|
|
883
|
+
onTyping?: () => void;
|
|
884
|
+
onClose?: () => void;
|
|
885
|
+
title?: string;
|
|
886
|
+
subtitle?: string;
|
|
887
|
+
placeholder?: string;
|
|
888
|
+
loading?: boolean;
|
|
889
|
+
typing?: boolean;
|
|
890
|
+
className?: string;
|
|
891
|
+
}
|
|
892
|
+
declare const ChatWidget: React__default.FC<ChatWidgetProps>;
|
|
893
|
+
|
|
917
894
|
interface ChatMessageProps {
|
|
918
895
|
content: string;
|
|
919
896
|
senderType: 'visitor' | 'agent' | 'system';
|
package/dist/index.d.ts
CHANGED
|
@@ -837,54 +837,9 @@ interface RichContentProps {
|
|
|
837
837
|
*/
|
|
838
838
|
declare function RichContent({ html, className, prose, proseVariant, proseSize, maxWidth, }: RichContentProps): react_jsx_runtime.JSX.Element;
|
|
839
839
|
|
|
840
|
-
interface Message {
|
|
841
|
-
id: number;
|
|
842
|
-
content: string;
|
|
843
|
-
senderType: 'visitor' | 'agent' | 'system';
|
|
844
|
-
senderName?: string;
|
|
845
|
-
timestamp?: string;
|
|
846
|
-
isRead?: boolean;
|
|
847
|
-
}
|
|
848
|
-
interface ChatWidgetProps {
|
|
849
|
-
messages: Message[];
|
|
850
|
-
onSend: (message: string) => void;
|
|
851
|
-
onTyping?: () => void;
|
|
852
|
-
onClose?: () => void;
|
|
853
|
-
title?: string;
|
|
854
|
-
subtitle?: string;
|
|
855
|
-
placeholder?: string;
|
|
856
|
-
loading?: boolean;
|
|
857
|
-
typing?: boolean;
|
|
858
|
-
className?: string;
|
|
859
|
-
}
|
|
860
|
-
declare const ChatWidget: React__default.FC<ChatWidgetProps>;
|
|
861
|
-
|
|
862
840
|
interface ChatBubbleProps {
|
|
863
841
|
/** Diffsome SDK client instance */
|
|
864
|
-
client:
|
|
865
|
-
chat: {
|
|
866
|
-
start: (data?: {
|
|
867
|
-
visitor_name?: string;
|
|
868
|
-
visitor_email?: string;
|
|
869
|
-
initial_message?: string;
|
|
870
|
-
}) => Promise<{
|
|
871
|
-
conversation_id: number;
|
|
872
|
-
visitor_id: string;
|
|
873
|
-
}>;
|
|
874
|
-
connect: (conversationId: number) => {
|
|
875
|
-
send: (content: string) => Promise<unknown>;
|
|
876
|
-
getMessages: () => Promise<Message[]>;
|
|
877
|
-
onMessage: (callback: (msg: Message) => void) => () => void;
|
|
878
|
-
onTyping: (callback: (senderType: string) => void) => () => void;
|
|
879
|
-
sendTyping: () => void;
|
|
880
|
-
disconnect: () => void;
|
|
881
|
-
};
|
|
882
|
-
checkAvailability: () => Promise<{
|
|
883
|
-
available: boolean;
|
|
884
|
-
agents_online: number;
|
|
885
|
-
}>;
|
|
886
|
-
};
|
|
887
|
-
};
|
|
842
|
+
client: Diffsome;
|
|
888
843
|
/** Chat widget title */
|
|
889
844
|
title?: string;
|
|
890
845
|
/** Chat widget subtitle */
|
|
@@ -914,6 +869,28 @@ interface ChatBubbleProps {
|
|
|
914
869
|
}
|
|
915
870
|
declare const ChatBubble: React__default.FC<ChatBubbleProps>;
|
|
916
871
|
|
|
872
|
+
interface Message {
|
|
873
|
+
id: number;
|
|
874
|
+
content: string;
|
|
875
|
+
sender_type: 'visitor' | 'agent' | 'system';
|
|
876
|
+
sender_name?: string;
|
|
877
|
+
created_at?: string;
|
|
878
|
+
is_read?: boolean;
|
|
879
|
+
}
|
|
880
|
+
interface ChatWidgetProps {
|
|
881
|
+
messages: Message[];
|
|
882
|
+
onSend: (message: string) => void;
|
|
883
|
+
onTyping?: () => void;
|
|
884
|
+
onClose?: () => void;
|
|
885
|
+
title?: string;
|
|
886
|
+
subtitle?: string;
|
|
887
|
+
placeholder?: string;
|
|
888
|
+
loading?: boolean;
|
|
889
|
+
typing?: boolean;
|
|
890
|
+
className?: string;
|
|
891
|
+
}
|
|
892
|
+
declare const ChatWidget: React__default.FC<ChatWidgetProps>;
|
|
893
|
+
|
|
917
894
|
interface ChatMessageProps {
|
|
918
895
|
content: string;
|
|
919
896
|
senderType: 'visitor' | 'agent' | 'system';
|
package/dist/index.js
CHANGED
|
@@ -2770,10 +2770,10 @@ var ChatWidget = ({
|
|
|
2770
2770
|
ChatMessage,
|
|
2771
2771
|
{
|
|
2772
2772
|
content: msg.content,
|
|
2773
|
-
senderType: msg.
|
|
2774
|
-
senderName: msg.
|
|
2775
|
-
timestamp: formatTime(msg.
|
|
2776
|
-
isRead: msg.
|
|
2773
|
+
senderType: msg.sender_type,
|
|
2774
|
+
senderName: msg.sender_name,
|
|
2775
|
+
timestamp: formatTime(msg.created_at),
|
|
2776
|
+
isRead: msg.is_read
|
|
2777
2777
|
},
|
|
2778
2778
|
msg.id
|
|
2779
2779
|
)),
|
|
@@ -2840,7 +2840,7 @@ var ChatBubble = ({
|
|
|
2840
2840
|
setMessages(existingMessages);
|
|
2841
2841
|
conn.onMessage((msg) => {
|
|
2842
2842
|
setMessages((prev) => [...prev, msg]);
|
|
2843
|
-
if (!isOpen && msg.
|
|
2843
|
+
if (!isOpen && msg.sender_type !== "visitor") {
|
|
2844
2844
|
setUnreadCount((c) => c + 1);
|
|
2845
2845
|
}
|
|
2846
2846
|
});
|
|
@@ -2873,8 +2873,8 @@ var ChatBubble = ({
|
|
|
2873
2873
|
const tempMessage = {
|
|
2874
2874
|
id: Date.now(),
|
|
2875
2875
|
content,
|
|
2876
|
-
|
|
2877
|
-
|
|
2876
|
+
sender_type: "visitor",
|
|
2877
|
+
created_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
2878
2878
|
};
|
|
2879
2879
|
setMessages((prev) => [...prev, tempMessage]);
|
|
2880
2880
|
try {
|
package/dist/index.mjs
CHANGED
|
@@ -2678,10 +2678,10 @@ var ChatWidget = ({
|
|
|
2678
2678
|
ChatMessage,
|
|
2679
2679
|
{
|
|
2680
2680
|
content: msg.content,
|
|
2681
|
-
senderType: msg.
|
|
2682
|
-
senderName: msg.
|
|
2683
|
-
timestamp: formatTime(msg.
|
|
2684
|
-
isRead: msg.
|
|
2681
|
+
senderType: msg.sender_type,
|
|
2682
|
+
senderName: msg.sender_name,
|
|
2683
|
+
timestamp: formatTime(msg.created_at),
|
|
2684
|
+
isRead: msg.is_read
|
|
2685
2685
|
},
|
|
2686
2686
|
msg.id
|
|
2687
2687
|
)),
|
|
@@ -2748,7 +2748,7 @@ var ChatBubble = ({
|
|
|
2748
2748
|
setMessages(existingMessages);
|
|
2749
2749
|
conn.onMessage((msg) => {
|
|
2750
2750
|
setMessages((prev) => [...prev, msg]);
|
|
2751
|
-
if (!isOpen && msg.
|
|
2751
|
+
if (!isOpen && msg.sender_type !== "visitor") {
|
|
2752
2752
|
setUnreadCount((c) => c + 1);
|
|
2753
2753
|
}
|
|
2754
2754
|
});
|
|
@@ -2781,8 +2781,8 @@ var ChatBubble = ({
|
|
|
2781
2781
|
const tempMessage = {
|
|
2782
2782
|
id: Date.now(),
|
|
2783
2783
|
content,
|
|
2784
|
-
|
|
2785
|
-
|
|
2784
|
+
sender_type: "visitor",
|
|
2785
|
+
created_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
2786
2786
|
};
|
|
2787
2787
|
setMessages((prev) => [...prev, tempMessage]);
|
|
2788
2788
|
try {
|