@blumessage/react-chat 1.0.0 → 1.0.3
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 +231 -124
- package/dist/BlumessageChat.js +624 -0
- package/dist/index.js +1 -2291
- package/dist/types/BlumessageChat.d.ts +48 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +53 -40
- package/dist/components/ChatComponent.d.ts +0 -61
- package/dist/components/ChatComponent.d.ts.map +0 -1
- package/dist/index.esm.js +0 -2289
- package/dist/index.esm.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/index.d.ts +0 -2
- package/dist/lib/index.d.ts.map +0 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface Message {
|
|
3
|
+
id: string;
|
|
4
|
+
role: 'user' | 'assistant';
|
|
5
|
+
content: string;
|
|
6
|
+
timestamp: number;
|
|
7
|
+
}
|
|
8
|
+
export interface BlumessageApiResponse {
|
|
9
|
+
conversationId: string;
|
|
10
|
+
messages: Message[];
|
|
11
|
+
created_at: number;
|
|
12
|
+
updated_at: number;
|
|
13
|
+
}
|
|
14
|
+
export interface ConversationSessionResponse {
|
|
15
|
+
id: string;
|
|
16
|
+
messages: Message[];
|
|
17
|
+
created_at: number;
|
|
18
|
+
updated_at: number;
|
|
19
|
+
}
|
|
20
|
+
export interface BlumessageChatProps {
|
|
21
|
+
apiKey: string;
|
|
22
|
+
placeholder?: string;
|
|
23
|
+
theme?: 'light' | 'dark';
|
|
24
|
+
width?: string;
|
|
25
|
+
height?: string;
|
|
26
|
+
size?: 'small' | 'medium' | 'large';
|
|
27
|
+
name?: string;
|
|
28
|
+
subtitle?: string;
|
|
29
|
+
initialMessages?: Message[];
|
|
30
|
+
onUserMessage?: (message: Message) => void;
|
|
31
|
+
onAssistantMessage?: (message: Message) => void;
|
|
32
|
+
conversationId?: string;
|
|
33
|
+
onConversationIdChange?: (conversationId: string | null) => void;
|
|
34
|
+
onChatWidgetOpen?: () => void;
|
|
35
|
+
onChatWidgetClosed?: () => void;
|
|
36
|
+
onError?: (error: string, context?: string) => void;
|
|
37
|
+
persistent?: boolean;
|
|
38
|
+
floating?: boolean;
|
|
39
|
+
buttonText?: string;
|
|
40
|
+
buttonPosition?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
41
|
+
buttonStyle?: React.CSSProperties;
|
|
42
|
+
defaultOpen?: boolean;
|
|
43
|
+
maximizeToggleButton?: boolean;
|
|
44
|
+
fullScreen?: boolean;
|
|
45
|
+
icon?: string;
|
|
46
|
+
primaryColor?: string;
|
|
47
|
+
}
|
|
48
|
+
export declare const BlumessageChat: React.FC<BlumessageChatProps>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BlumessageChat, type BlumessageChatProps, type Message, type BlumessageApiResponse, type ConversationSessionResponse } from './BlumessageChat';
|
package/package.json
CHANGED
|
@@ -1,58 +1,71 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blumessage/react-chat",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "A
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"module": "dist/index.esm.js",
|
|
8
|
-
"types": "dist/index.d.ts",
|
|
9
|
-
"files": [
|
|
10
|
-
"dist",
|
|
11
|
-
"README.md"
|
|
12
|
-
],
|
|
13
|
-
"scripts": {
|
|
14
|
-
"build": "rollup -c",
|
|
15
|
-
"dev": "rollup -c -w",
|
|
16
|
-
"prepare": "npm run build"
|
|
17
|
-
},
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "A React TypeScript chat widget component with floating button, theming, and Blumessage API integration",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Blumessage <contact@blumessage.com>",
|
|
18
7
|
"keywords": [
|
|
19
8
|
"react",
|
|
20
9
|
"chat",
|
|
21
10
|
"component",
|
|
22
|
-
"ui",
|
|
23
|
-
"messaging",
|
|
24
|
-
"ai",
|
|
25
11
|
"blumessage",
|
|
26
12
|
"typescript",
|
|
27
|
-
"
|
|
13
|
+
"widget",
|
|
14
|
+
"floating",
|
|
15
|
+
"tailwind"
|
|
28
16
|
],
|
|
29
|
-
"author": "BlueMessage",
|
|
30
|
-
"license": "MIT",
|
|
31
|
-
"homepage": "https://github.com/blumessage/react-chat",
|
|
32
17
|
"repository": {
|
|
33
18
|
"type": "git",
|
|
34
|
-
"url": "https://github.com/blumessage
|
|
19
|
+
"url": "git+https://github.com/MihaiZhaoDev/blumessage-react-chat-component.git"
|
|
35
20
|
},
|
|
36
21
|
"bugs": {
|
|
37
|
-
"url": "https://github.com/blumessage
|
|
22
|
+
"url": "https://github.com/MihaiZhaoDev/blumessage-react-chat-component/issues"
|
|
38
23
|
},
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
"
|
|
24
|
+
"homepage": "https://github.com/MihaiZhaoDev/blumessage-react-chat-component#readme",
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"README.md",
|
|
28
|
+
"package.json"
|
|
29
|
+
],
|
|
30
|
+
"type": "commonjs",
|
|
31
|
+
"main": "dist/index.js",
|
|
32
|
+
"types": "dist/types/src/index.d.ts",
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./dist/types/src/index.d.ts",
|
|
36
|
+
"import": "./dist/index.js",
|
|
37
|
+
"require": "./dist/index.js"
|
|
38
|
+
}
|
|
42
39
|
},
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"typescript": "^5.0.0"
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "tsc",
|
|
42
|
+
"dev": "webpack serve --config webpack.config.js",
|
|
43
|
+
"test:build": "webpack --config webpack.config.js",
|
|
44
|
+
"prepublishOnly": "npm run build"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"react": ">=18.0.0",
|
|
48
|
+
"react-dom": ">=18.0.0"
|
|
53
49
|
},
|
|
54
50
|
"dependencies": {
|
|
55
|
-
"
|
|
56
|
-
|
|
51
|
+
"lucide-react": "^0.469.0"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@types/react": "^19.1.8",
|
|
55
|
+
"@types/react-dom": "^19.1.6",
|
|
56
|
+
"autoprefixer": "^10.4.21",
|
|
57
|
+
"css-loader": "^7.1.2",
|
|
58
|
+
"html-webpack-plugin": "^5.6.3",
|
|
59
|
+
"postcss": "^8.5.6",
|
|
60
|
+
"postcss-loader": "^8.1.1",
|
|
61
|
+
"react": "^19.1.0",
|
|
62
|
+
"react-dom": "^19.1.0",
|
|
63
|
+
"style-loader": "^4.0.0",
|
|
64
|
+
"tailwindcss": "^4.1.11",
|
|
65
|
+
"ts-loader": "^9.5.2",
|
|
66
|
+
"typescript": "^5.8.3",
|
|
67
|
+
"webpack": "^5.99.9",
|
|
68
|
+
"webpack-cli": "^6.0.1",
|
|
69
|
+
"webpack-dev-server": "^5.2.2"
|
|
57
70
|
}
|
|
58
|
-
}
|
|
71
|
+
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface Message {
|
|
3
|
-
id: string;
|
|
4
|
-
text: string;
|
|
5
|
-
sender: {
|
|
6
|
-
id: string;
|
|
7
|
-
name: string;
|
|
8
|
-
avatar?: string;
|
|
9
|
-
};
|
|
10
|
-
timestamp: Date;
|
|
11
|
-
isOwn: boolean;
|
|
12
|
-
}
|
|
13
|
-
type ChatSize = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
|
|
14
|
-
type FloatingButtonPosition = 'top-right' | 'top-left' | 'bottom-left' | 'bottom-right';
|
|
15
|
-
interface ChatComponentProps {
|
|
16
|
-
messages?: Message[];
|
|
17
|
-
onSendMessage?: (message: string) => void;
|
|
18
|
-
currentUser?: {
|
|
19
|
-
id: string;
|
|
20
|
-
name: string;
|
|
21
|
-
avatar?: string;
|
|
22
|
-
};
|
|
23
|
-
inputPlaceholder?: string;
|
|
24
|
-
className?: string;
|
|
25
|
-
headerTitle?: string;
|
|
26
|
-
headerDescription?: string;
|
|
27
|
-
headerColor?: string;
|
|
28
|
-
headerIcon?: string;
|
|
29
|
-
headerIconColor?: string;
|
|
30
|
-
headerIconHide?: boolean;
|
|
31
|
-
headerAvatarColor?: string;
|
|
32
|
-
primaryColor?: string;
|
|
33
|
-
secondaryColor?: string;
|
|
34
|
-
messageUserColor?: string;
|
|
35
|
-
messageAssistantColor?: string;
|
|
36
|
-
messageTimestamps?: boolean;
|
|
37
|
-
messageUserAvatarVisibility?: boolean;
|
|
38
|
-
messageUserAvatarIcon?: string;
|
|
39
|
-
messageUserAvatarColor?: string;
|
|
40
|
-
messageAssistantAvatarVisibility?: boolean;
|
|
41
|
-
messageAssistantAvatarIcon?: string;
|
|
42
|
-
messageAssistantAvatarColor?: string;
|
|
43
|
-
messageUserName?: string | null;
|
|
44
|
-
messageAssistantName?: string | null;
|
|
45
|
-
sendButtonIcon?: string;
|
|
46
|
-
sendButtonColor?: string;
|
|
47
|
-
inputOutlineColor?: string;
|
|
48
|
-
floatingButtonPosition?: FloatingButtonPosition;
|
|
49
|
-
floatingButtonIcon?: string;
|
|
50
|
-
floatingButtonIconColor?: string;
|
|
51
|
-
floatingButtonBackgroundColor?: string;
|
|
52
|
-
size?: ChatSize;
|
|
53
|
-
maximizeToggle?: boolean;
|
|
54
|
-
maximize?: boolean;
|
|
55
|
-
autoOpen?: boolean;
|
|
56
|
-
forceOpen?: boolean;
|
|
57
|
-
apiKey?: string;
|
|
58
|
-
}
|
|
59
|
-
declare const ChatComponent: React.FC<ChatComponentProps>;
|
|
60
|
-
export default ChatComponent;
|
|
61
|
-
//# sourceMappingURL=ChatComponent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChatComponent.d.ts","sour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