@tarxemo/customer_support 1.0.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/LICENSE +21 -0
- package/README.md +313 -0
- package/dist/api/client.d.ts +22 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/components/ChatInput.d.ts +9 -0
- package/dist/components/ChatInput.d.ts.map +1 -0
- package/dist/components/ChatMessage.d.ts +8 -0
- package/dist/components/ChatMessage.d.ts.map +1 -0
- package/dist/components/ChatWindow.d.ts +14 -0
- package/dist/components/ChatWindow.d.ts.map +1 -0
- package/dist/components/CustomerSupportWidget.d.ts +4 -0
- package/dist/components/CustomerSupportWidget.d.ts.map +1 -0
- package/dist/customer_support.css +1 -0
- package/dist/hooks/useCustomerSupport.d.ts +7 -0
- package/dist/hooks/useCustomerSupport.d.ts.map +1 -0
- package/dist/hooks/useLocalStorage.d.ts +10 -0
- package/dist/hooks/useLocalStorage.d.ts.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.es.js +2557 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.umd.js +73 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/types/index.d.ts +92 -0
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +76 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core types for the customer support library
|
|
3
|
+
*/
|
|
4
|
+
export interface Message {
|
|
5
|
+
id: string;
|
|
6
|
+
role: 'USER' | 'ASSISTANT';
|
|
7
|
+
content: string;
|
|
8
|
+
timestamp: Date;
|
|
9
|
+
sources?: Source[];
|
|
10
|
+
}
|
|
11
|
+
export interface Source {
|
|
12
|
+
url: string;
|
|
13
|
+
title: string;
|
|
14
|
+
similarity: number;
|
|
15
|
+
excerpt: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ChatResponse {
|
|
18
|
+
response: {
|
|
19
|
+
status: string;
|
|
20
|
+
message: string;
|
|
21
|
+
code: number;
|
|
22
|
+
};
|
|
23
|
+
data: {
|
|
24
|
+
answer: string;
|
|
25
|
+
sources: Source[];
|
|
26
|
+
session_id: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export interface ConversationHistoryResponse {
|
|
30
|
+
response: {
|
|
31
|
+
status: string;
|
|
32
|
+
message: string;
|
|
33
|
+
code: number;
|
|
34
|
+
};
|
|
35
|
+
data: {
|
|
36
|
+
session_id: string;
|
|
37
|
+
messages: {
|
|
38
|
+
role: 'USER' | 'ASSISTANT';
|
|
39
|
+
content: string;
|
|
40
|
+
created_at: string;
|
|
41
|
+
}[];
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export interface ErrorResponse {
|
|
45
|
+
response: {
|
|
46
|
+
status: 'error';
|
|
47
|
+
message: string;
|
|
48
|
+
code: number;
|
|
49
|
+
};
|
|
50
|
+
data: null;
|
|
51
|
+
errors?: Record<string, string[]>;
|
|
52
|
+
}
|
|
53
|
+
export interface ThemeConfig {
|
|
54
|
+
primaryColor?: string;
|
|
55
|
+
secondaryColor?: string;
|
|
56
|
+
backgroundColor?: string;
|
|
57
|
+
textColor?: string;
|
|
58
|
+
fontFamily?: string;
|
|
59
|
+
borderRadius?: string;
|
|
60
|
+
buttonColor?: string;
|
|
61
|
+
userMessageColor?: string;
|
|
62
|
+
assistantMessageColor?: string;
|
|
63
|
+
}
|
|
64
|
+
export type Position = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
65
|
+
export interface CustomerSupportConfig {
|
|
66
|
+
apiKey: string;
|
|
67
|
+
baseUrl?: string;
|
|
68
|
+
theme?: ThemeConfig;
|
|
69
|
+
position?: Position;
|
|
70
|
+
welcomeMessage?: string;
|
|
71
|
+
placeholder?: string;
|
|
72
|
+
className?: string;
|
|
73
|
+
onError?: (error: Error) => void;
|
|
74
|
+
onMessageSent?: (message: string) => void;
|
|
75
|
+
onMessageReceived?: (response: string) => void;
|
|
76
|
+
}
|
|
77
|
+
export interface UseCustomerSupportOptions {
|
|
78
|
+
apiKey: string;
|
|
79
|
+
baseUrl?: string;
|
|
80
|
+
onError?: (error: Error) => void;
|
|
81
|
+
}
|
|
82
|
+
export interface UseCustomerSupportReturn {
|
|
83
|
+
messages: Message[];
|
|
84
|
+
sendMessage: (question: string) => Promise<void>;
|
|
85
|
+
isLoading: boolean;
|
|
86
|
+
error: Error | null;
|
|
87
|
+
clearError: () => void;
|
|
88
|
+
sessionId: string;
|
|
89
|
+
loadHistory: () => Promise<void>;
|
|
90
|
+
clearHistory: () => void;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,OAAO;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,MAAM;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IACzB,QAAQ,EAAE;QACN,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,IAAI,EAAE;QACF,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;KACtB,CAAC;CACL;AAED,MAAM,WAAW,2BAA2B;IACxC,QAAQ,EAAE;QACN,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,M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AC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CAClD;AAED,MAAM,WAAW,yBAAyB;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CACpC;AAED,MAAM,WAAW,wBAAwB;IACrC,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,YAAY,EAAE,MAAM,IAAI,CAAC;CAC5B"}
|
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tarxemo/customer_support",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A professional React component library for AI-powered customer support integration",
|
|
5
|
+
"main": "./dist/index.umd.js",
|
|
6
|
+
"module": "./dist/index.es.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.es.js",
|
|
11
|
+
"require": "./dist/index.umd.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./styles": "./dist/style.css"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md",
|
|
19
|
+
"LICENSE"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"dev": "vite",
|
|
23
|
+
"build": "tsc && vite build",
|
|
24
|
+
"preview": "vite preview",
|
|
25
|
+
"test": "vitest",
|
|
26
|
+
"test:ui": "vitest --ui",
|
|
27
|
+
"type-check": "tsc --noEmit",
|
|
28
|
+
"lint": "eslint src --ext ts,tsx",
|
|
29
|
+
"format": "prettier --write \"src/**/*.{ts,tsx,css}\"",
|
|
30
|
+
"prepublishOnly": "npm run build"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"react",
|
|
34
|
+
"customer-support",
|
|
35
|
+
"chat",
|
|
36
|
+
"ai",
|
|
37
|
+
"widget",
|
|
38
|
+
"chatbot",
|
|
39
|
+
"support-widget",
|
|
40
|
+
"rag",
|
|
41
|
+
"sitewise"
|
|
42
|
+
],
|
|
43
|
+
"author": "Tarxemo",
|
|
44
|
+
"license": "MIT",
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "https://github.com/tarxemo/customer_support.git"
|
|
48
|
+
},
|
|
49
|
+
"bugs": {
|
|
50
|
+
"url": "https://github.com/tarxemo/customer_support/issues"
|
|
51
|
+
},
|
|
52
|
+
"homepage": "https://github.com/tarxemo/customer_support#readme",
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
55
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"axios": "^1.7.9",
|
|
59
|
+
"lucide-react": "^0.469.0"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@types/node": "^22.10.5",
|
|
63
|
+
"@types/react": "^18.3.18",
|
|
64
|
+
"@types/react-dom": "^18.3.5",
|
|
65
|
+
"@typescript-eslint/eslint-plugin": "^8.36.0",
|
|
66
|
+
"@typescript-eslint/parser": "^8.36.0",
|
|
67
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
68
|
+
"eslint": "^9.18.0",
|
|
69
|
+
"eslint-plugin-react-hooks": "^5.1.0",
|
|
70
|
+
"prettier": "^3.4.2",
|
|
71
|
+
"typescript": "^5.7.3",
|
|
72
|
+
"vite": "^6.0.11",
|
|
73
|
+
"vite-plugin-dts": "^4.4.0",
|
|
74
|
+
"vitest": "^2.1.8"
|
|
75
|
+
}
|
|
76
|
+
}
|