lulichat 1.0.7 → 1.0.15
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 +248 -8
- package/dist/components/Animation.d.ts +15 -0
- package/dist/components/ChatWidget.d.ts +7 -0
- package/dist/components/chatroom/ChatBody.d.ts +3 -0
- package/dist/components/chatroom/ChatFooter.d.ts +3 -0
- package/dist/components/chatroom/ChatHeader.d.ts +3 -0
- package/dist/components/chatroom/ChatInterface.d.ts +2 -0
- package/dist/components/chatroom/ChatRating.d.ts +7 -0
- package/dist/components/chatroom/CompanyQueues.d.ts +13 -0
- package/dist/components/chatroom/Message.d.ts +7 -0
- package/dist/components/chatroom/StartChat.d.ts +17 -0
- package/dist/components/faq/FAQBody.d.ts +3 -0
- package/dist/components/faq/FAQCategories.d.ts +7 -0
- package/dist/components/faq/FAQInterface.d.ts +5 -0
- package/dist/components/faq/FAQList.d.ts +8 -0
- package/dist/components/faq/FAQViewer.d.ts +7 -0
- package/dist/components/history/HistoryInterface.d.ts +5 -0
- package/dist/components/history/Rate.d.ts +3 -0
- package/dist/components/history/TicketList.d.ts +6 -0
- package/dist/components/ui/AutoResizeTextArea.d.ts +10 -0
- package/dist/components/ui/Button.d.ts +8 -0
- package/dist/components/ui/Form.d.ts +33 -0
- package/dist/components/ui/Icons.d.ts +25 -0
- package/dist/components/ui/Input.d.ts +9 -0
- package/dist/components/ui/Tab.d.ts +6 -0
- package/dist/constants.d.ts +33 -0
- package/dist/hooks/useContext.d.ts +14 -0
- package/dist/hooks/useSocket.d.ts +4 -0
- package/dist/hooks/useStore.d.ts +50 -0
- package/dist/index.d.ts +2 -1
- package/dist/lib/embed.d.ts +45 -0
- package/dist/lib/socket.d.ts +18 -0
- package/dist/lulichat-widget-standalone.es.js +12691 -0
- package/dist/lulichat-widget-standalone.umd.js +116 -0
- package/dist/lulichat-widget.es.js +3129 -0
- package/dist/lulichat-widget.umd.js +29 -0
- package/dist/main.d.ts +1 -0
- package/dist/style.css +1 -1
- package/dist/types/index.d.ts +117 -14
- package/dist/utils/api.d.ts +120 -0
- package/dist/utils/index.d.ts +12 -0
- package/dist/utils/renderToHTML.d.ts +1 -0
- package/package.json +40 -21
- package/dist/lulichat-support.es.js +0 -1727
- package/dist/lulichat-support.umd.js +0 -30
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# LuliChat Support Chat
|
|
2
2
|
|
|
3
3
|
Lulichat Support Chat is a React library that provides a chat interface for web applications. It includes a chat icon that opens a contact form for users to submit their contact information, and it establishes a socket connection for real-time chat functionality.
|
|
4
4
|
|
|
@@ -11,7 +11,7 @@ Lulichat Support Chat is a React library that provides a chat interface for web
|
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
|
-
To install the
|
|
14
|
+
To install the LuliChat Support Chat library, run the following command:
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
17
|
npm install lulichat
|
|
@@ -22,14 +22,15 @@ npm install lulichat
|
|
|
22
22
|
To use the Lulichat Support Chat in your application, import the components as follows:
|
|
23
23
|
|
|
24
24
|
```tsx
|
|
25
|
-
import
|
|
25
|
+
import LuliChat from "lulichat";
|
|
26
|
+
import "lulichat/dist/style.css";
|
|
26
27
|
```
|
|
27
28
|
|
|
28
29
|
### Example
|
|
29
30
|
|
|
30
31
|
```tsx
|
|
31
32
|
import React from "react";
|
|
32
|
-
import
|
|
33
|
+
import LuliChat from "lulichat";
|
|
33
34
|
import "lulichat/dist/style.css";
|
|
34
35
|
|
|
35
36
|
const App = () => {
|
|
@@ -52,13 +53,251 @@ const App = () => {
|
|
|
52
53
|
export default App;
|
|
53
54
|
```
|
|
54
55
|
|
|
56
|
+
## Script tag (no React)
|
|
57
|
+
|
|
58
|
+
You have two ways to embed the widget:
|
|
59
|
+
|
|
60
|
+
1. Externalized (smaller) build – you provide React, ReactDOM and socket.io-client (as globals) OR you are on a React page already.
|
|
61
|
+
2. Standalone (larger) build – everything bundled, just one script tag.
|
|
62
|
+
|
|
63
|
+
### 1. Externalized build (recommended if you already use React)
|
|
64
|
+
|
|
65
|
+
Add React, ReactDOM and socket.io-client globals if they are not already present. If you are not using the standalone bundle, also add marked and DOMPurify (or rely on our graceful fallbacks):
|
|
66
|
+
|
|
67
|
+
```html
|
|
68
|
+
<script src="https://unpkg.com/react@18/umd/react.production.min.js"></script>
|
|
69
|
+
<script src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"></script>
|
|
70
|
+
<script src="https://unpkg.com/socket.io-client@4/dist/socket.io.min.js"></script>
|
|
71
|
+
<script src="https://unpkg.com/marked/marked.min.js"></script>
|
|
72
|
+
<script src="https://unpkg.com/dompurify/dist/purify.min.js"></script>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Then include the library UMD bundle. You can pass configuration using `data-*` attributes, or initialize programmatically.
|
|
76
|
+
|
|
77
|
+
```html
|
|
78
|
+
<link rel="stylesheet" href="https://unpkg.com/lulichat/dist/style.css" />
|
|
79
|
+
<script
|
|
80
|
+
src="https://unpkg.com/lulichat/dist/lulichat-support.umd.js"
|
|
81
|
+
data-api-key="YOUR_API_KEY"
|
|
82
|
+
data-company-name="Your Company"
|
|
83
|
+
data-position="bottom-right"
|
|
84
|
+
data-primary-color="#4f46e5"
|
|
85
|
+
defer
|
|
86
|
+
onload="window.LuliChatSupport && window.LuliChatSupport.initFromScript()"
|
|
87
|
+
></script>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Or programmatically:
|
|
91
|
+
|
|
92
|
+
```html
|
|
93
|
+
<script src="https://unpkg.com/lulichat/dist/lulichat-support.umd.js"></script>
|
|
94
|
+
<script>
|
|
95
|
+
window.LuliChatSupport.mount({
|
|
96
|
+
apiKey: "YOUR_API_KEY",
|
|
97
|
+
baseUrl: "https://api.example.com",
|
|
98
|
+
position: "bottom-right",
|
|
99
|
+
primaryColor: "#4f46e5",
|
|
100
|
+
});
|
|
101
|
+
// Later
|
|
102
|
+
// window.LuliChatSupport.unmountAll();
|
|
103
|
+
// or window.LuliChatSupport.unmount(id)
|
|
104
|
+
</script>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Notes:
|
|
108
|
+
|
|
109
|
+
- When using programmatic mount, the stylesheet will be auto‑injected. If your CSS file isn’t next to the script, set a custom URL via `data-style-href` on the script tag.
|
|
110
|
+
- If `marked` or `DOMPurify` are not present, the widget will still render. Markdown will fall back to plain text/HTML passthrough and a console warning is logged. For best security and formatting, include both scripts above or use the standalone bundle.
|
|
111
|
+
|
|
112
|
+
### 2. Standalone build (no other scripts needed)
|
|
113
|
+
|
|
114
|
+
If you prefer a zero‑dependency drop‑in (larger file size), use the standalone bundle produced as `lulichat-support-standalone.umd.js`:
|
|
115
|
+
|
|
116
|
+
```html
|
|
117
|
+
<script
|
|
118
|
+
src="https://unpkg.com/lulichat/dist/lulichat-support-standalone.umd.js"
|
|
119
|
+
data-api-key="YOUR_API_KEY"
|
|
120
|
+
data-company-name="Your Company"
|
|
121
|
+
data-position="bottom-right"
|
|
122
|
+
data-primary-color="#4f46e5"
|
|
123
|
+
defer
|
|
124
|
+
onload="window.LuliChatSupport && window.LuliChatSupport.initFromScript()"
|
|
125
|
+
></script>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
No React/socket.io-client tags required. Choose this for non‑React sites wanting the simplest integration. Trade‑off: bigger download (~300kB UMD vs ~61kB + peer scripts).
|
|
129
|
+
|
|
130
|
+
### Isolated iframe mode (optional)
|
|
131
|
+
|
|
132
|
+
If you want to isolate the widget’s DOM and CSS from your page, you can mount it inside a fixed-position iframe. Enable it from the script tag via `data-isolated="iframe"`:
|
|
133
|
+
|
|
134
|
+
```html
|
|
135
|
+
<script
|
|
136
|
+
src="https://unpkg.com/lulichat/dist/lulichat-support.umd.js"
|
|
137
|
+
data-api-key="YOUR_API_KEY"
|
|
138
|
+
data-isolated="iframe"
|
|
139
|
+
data-iframe-width="360px"
|
|
140
|
+
data-iframe-height="560px"
|
|
141
|
+
defer
|
|
142
|
+
onload="window.LuliChatSupport && window.LuliChatSupport.initFromScript()"
|
|
143
|
+
></script>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Options you can set as `data-*` attributes for iframe mode:
|
|
147
|
+
|
|
148
|
+
- `data-iframe-width` – width of the iframe (e.g. `360px`)
|
|
149
|
+
- `data-iframe-height` – height of the iframe (e.g. `560px`)
|
|
150
|
+
- `data-iframe-auto-resize` – when `true`, the iframe will resize to fit its content height
|
|
151
|
+
- `data-iframe-min-height` / `data-iframe-max-height` – optional min/max height bounds for auto-resize
|
|
152
|
+
|
|
153
|
+
You can also mount the iframe programmatically:
|
|
154
|
+
|
|
155
|
+
```html
|
|
156
|
+
<script>
|
|
157
|
+
const { mountIframe } = window.LuliChatSupport;
|
|
158
|
+
const { id, iframe, unmount } = mountIframe(
|
|
159
|
+
{
|
|
160
|
+
apiKey: "YOUR_API_KEY",
|
|
161
|
+
position: "bottom-right",
|
|
162
|
+
primaryColor: "#4f46e5",
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
width: "360px",
|
|
166
|
+
height: "auto", // optional; if omitted, set autoResize: true to fit content
|
|
167
|
+
autoResize: true,
|
|
168
|
+
minHeight: 300, // optional
|
|
169
|
+
maxHeight: 700, // optional
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
// later: unmount()
|
|
173
|
+
// or: window.LuliChatSupport.unmountIframe(id)
|
|
174
|
+
// or: window.LuliChatSupport.unmountAll()
|
|
175
|
+
// You can also set a custom stylesheet URL inside the iframe via styleHref:
|
|
176
|
+
// mountIframe(config, { styleHref: 'https://cdn.example.com/lulichat.css' })
|
|
177
|
+
}
|
|
178
|
+
</script>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Notes:
|
|
182
|
+
|
|
183
|
+
- Stylesheet injection is automatic for both normal and iframe modes. If your `style.css` is not next to the UMD script, set `data-style-href` on the script or pass `styleHref` to `mountIframe`.
|
|
184
|
+
- In auto-resize mode, the iframe height tracks the content using `ResizeObserver` (with a polling fallback). Min/max heights are respected if provided.
|
|
185
|
+
|
|
186
|
+
### Zero-JS iframe embedding (static frame)
|
|
187
|
+
|
|
188
|
+
If you want to embed the chat without placing any script tags on the parent page (just an `<iframe>`), you can use the provided `frame.html` (or host a copy of it).
|
|
189
|
+
|
|
190
|
+
Example:
|
|
191
|
+
|
|
192
|
+
```html
|
|
193
|
+
<iframe
|
|
194
|
+
src="/path/to/frame.html?apiKey=YOUR_API_KEY&baseUrl=https://api.example.com&position=bottom-right&primaryColor=%234f46e5"
|
|
195
|
+
width="380"
|
|
196
|
+
height="600"
|
|
197
|
+
style="border:0;background:transparent"
|
|
198
|
+
loading="lazy"
|
|
199
|
+
></iframe>
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Supported query parameters (same semantics as data-\*):
|
|
203
|
+
|
|
204
|
+
| Param | Description |
|
|
205
|
+
| ------------------ | ---------------------------------------------------------- | ----------- | --------- | -------- |
|
|
206
|
+
| apiKey | Required API key |
|
|
207
|
+
| baseUrl | API base override |
|
|
208
|
+
| position | bottom-right | bottom-left | top-right | top-left |
|
|
209
|
+
| primaryColor | Hex/CSS color |
|
|
210
|
+
| companyName | Display name |
|
|
211
|
+
| welcomeMessage | Initial auto-response message |
|
|
212
|
+
| requireContactInfo | `true` or `false` |
|
|
213
|
+
| allowAnonymous | `true` or `false` |
|
|
214
|
+
| configUrl | URL returning JSON config to merge (query params override) |
|
|
215
|
+
|
|
216
|
+
Config JSON shape (example returned by `configUrl`):
|
|
217
|
+
|
|
218
|
+
```json
|
|
219
|
+
{
|
|
220
|
+
"apiKey": "YOUR_API_KEY",
|
|
221
|
+
"companyName": "My Company",
|
|
222
|
+
"welcomeMessage": "Hello! How can we help?",
|
|
223
|
+
"primaryColor": "#4f46e5",
|
|
224
|
+
"requireContactInfo": true,
|
|
225
|
+
"allowAnonymous": false
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Precedence: query parameters override fields returned by `configUrl`.
|
|
230
|
+
|
|
231
|
+
To host your own: copy `frame.html` and ensure the path to the standalone bundle script is correct (or swap to externalized bundle + peer scripts). The frame loads, then waits for `window.LuliChatSupport` and mounts internally; styles are auto-injected.
|
|
232
|
+
|
|
233
|
+
## Hosted widget (production)
|
|
234
|
+
|
|
235
|
+
We recommend hosting a small, versioned bundle set under:
|
|
236
|
+
|
|
237
|
+
https://app.lulichat.com/widget/<version>/
|
|
238
|
+
|
|
239
|
+
Each version folder contains:
|
|
240
|
+
|
|
241
|
+
- `lulichat-widget.js` – loader clients include in their pages
|
|
242
|
+
- `lulichat-widget.html` – the frame loaded by the loader
|
|
243
|
+
- `dist/style.css` – stylesheet
|
|
244
|
+
- `lulichat-widget-standalone.umd.js` – the standalone bundle (copied/renamed from the build)
|
|
245
|
+
|
|
246
|
+
There is also a convenience alias:
|
|
247
|
+
|
|
248
|
+
https://app.lulichat.com/widget/latest/
|
|
249
|
+
|
|
250
|
+
Use `latest` if you want automatic upgrades; pin a specific `<version>` for stability.
|
|
251
|
+
|
|
252
|
+
### Client usage (loader)
|
|
253
|
+
|
|
254
|
+
```html
|
|
255
|
+
<script
|
|
256
|
+
src="https://app.lulichat.com/widget/latest/lulichat-widget.js"
|
|
257
|
+
data-api-key="YOUR_API_KEY"
|
|
258
|
+
data-base-url="https://api.lulichat.com"
|
|
259
|
+
data-position="bottom-right"
|
|
260
|
+
data-primary-color="#4f46e5"
|
|
261
|
+
defer
|
|
262
|
+
></script>
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
The loader computes its base URL from its own `src` and injects an iframe pointing to `.../lulichat-widget.html` with your `data-*` passed as query params. It also auto-resizes the iframe based on messages from the frame.
|
|
266
|
+
|
|
267
|
+
#
|
|
268
|
+
|
|
269
|
+
### Passing options via data attributes
|
|
270
|
+
|
|
271
|
+
Supported attributes (all optional except api-key):
|
|
272
|
+
|
|
273
|
+
| Attribute | Purpose |
|
|
274
|
+
| ------------------ | ------------------------------------------------------- |
|
|
275
|
+
| data-api-key | Your public API key for auth/identification |
|
|
276
|
+
| data-company-name | Display name in header |
|
|
277
|
+
| data-position | one of: bottom-right, bottom-left, top-right, top-left |
|
|
278
|
+
| data-primary-color | Hex or CSS color used as primary accent |
|
|
279
|
+
| data-container | CSS selector for a custom mount node (defaults to body) |
|
|
280
|
+
| data-style-href | Optional absolute URL to the CSS file if not colocated |
|
|
281
|
+
|
|
282
|
+
Programmatic mount accepts the same properties plus `baseUrl` and feature flags like `allowAnonymous`.
|
|
283
|
+
|
|
284
|
+
```
|
|
285
|
+
|
|
55
286
|
## API
|
|
56
287
|
|
|
57
|
-
###
|
|
288
|
+
### Global Embed API
|
|
289
|
+
|
|
290
|
+
`window.LuliChatSupport.mount(options)` – mounts the widget, returns an id.
|
|
291
|
+
|
|
292
|
+
`window.LuliChatSupport.unmount(id)` – unmounts a specific instance.
|
|
58
293
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
294
|
+
`window.LuliChatSupport.unmountAll()` – removes all mounted instances.
|
|
295
|
+
|
|
296
|
+
`window.LuliChatSupport.initFromScript()` – reads the current script tag's `data-*` attributes and auto‑mounts.
|
|
297
|
+
|
|
298
|
+
### React Usage
|
|
299
|
+
|
|
300
|
+
Import the default export `LuliChat` for React integration; styling is in `dist/style.css`.
|
|
62
301
|
|
|
63
302
|
## Contributing
|
|
64
303
|
|
|
@@ -67,3 +306,4 @@ Contributions are welcome! Please open an issue or submit a pull request for any
|
|
|
67
306
|
## License
|
|
68
307
|
|
|
69
308
|
This project is licensed under the MIT License. See the LICENSE file for more details.
|
|
309
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Height } from "react-animate-height";
|
|
3
|
+
interface TypewriterProps {
|
|
4
|
+
text: string;
|
|
5
|
+
speed?: number;
|
|
6
|
+
onComplete?: () => void;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function Typewriter(props: TypewriterProps): React.JSX.Element;
|
|
10
|
+
export declare function ThinkingDots(): React.JSX.Element;
|
|
11
|
+
export declare function AnimateHeightCustom(props: React.HTMLProps<HTMLDivElement> & {
|
|
12
|
+
height?: Height;
|
|
13
|
+
end?: VoidFunction;
|
|
14
|
+
}): React.JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TicketTracking } from "@/types";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export type RatingRef = {
|
|
4
|
+
open: (tracking: TicketTracking, callback?: (tracking: TicketTracking) => void) => void;
|
|
5
|
+
};
|
|
6
|
+
declare const ChatRating: React.ForwardRefExoticComponent<React.RefAttributes<RatingRef>>;
|
|
7
|
+
export default ChatRating;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Queue, QueueOption } from "@/types";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export interface Tag extends Queue, QueueOption {
|
|
4
|
+
type: "queue" | "option";
|
|
5
|
+
}
|
|
6
|
+
interface Props {
|
|
7
|
+
message?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface QueueRefObject {
|
|
10
|
+
getTags: () => Tag[];
|
|
11
|
+
}
|
|
12
|
+
declare const CompanyQueues: React.ForwardRefExoticComponent<Props & React.RefAttributes<QueueRefObject>>;
|
|
13
|
+
export default CompanyQueues;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ContactInfo } from "@/types";
|
|
2
|
+
import React from "react";
|
|
3
|
+
interface StartChatProps {
|
|
4
|
+
}
|
|
5
|
+
export interface StartChatRefObject {
|
|
6
|
+
getValues: () => ContactInfo;
|
|
7
|
+
startChat: (payload: Payload) => void;
|
|
8
|
+
}
|
|
9
|
+
export interface Payload {
|
|
10
|
+
message: string;
|
|
11
|
+
files?: FileList | null;
|
|
12
|
+
queueId?: number;
|
|
13
|
+
queueOptionId?: number;
|
|
14
|
+
dataJson?: Record<string, any>;
|
|
15
|
+
}
|
|
16
|
+
export declare const StartChat: React.ForwardRefExoticComponent<StartChatProps & React.RefAttributes<StartChatRefObject>>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { LuliChatAPI } from "@/utils/api";
|
|
3
|
+
declare const FAQCategories: React.MemoExoticComponent<(props: {
|
|
4
|
+
resource: ReturnType<LuliChatAPI["helpCategoriesResource"]>;
|
|
5
|
+
setCategory: (category: string) => void;
|
|
6
|
+
}) => React.JSX.Element>;
|
|
7
|
+
export default FAQCategories;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { LuliChatAPI } from "@/utils/api";
|
|
3
|
+
declare const FAQList: React.MemoExoticComponent<(props: {
|
|
4
|
+
resource: ReturnType<LuliChatAPI["faqResource"]>;
|
|
5
|
+
search: string;
|
|
6
|
+
category: string;
|
|
7
|
+
}) => React.JSX.Element>;
|
|
8
|
+
export default FAQList;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Help } from "@/types";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export interface FAQViewerRefObject {
|
|
4
|
+
view: React.Dispatch<React.SetStateAction<Help | undefined>>;
|
|
5
|
+
}
|
|
6
|
+
declare const FAQViewer: React.ForwardRefExoticComponent<React.RefAttributes<FAQViewerRefObject>>;
|
|
7
|
+
export default FAQViewer;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type Props = {
|
|
3
|
+
value?: string;
|
|
4
|
+
onChange?: (v: string) => void;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
maxHeight?: number;
|
|
8
|
+
} & Omit<React.HTMLProps<HTMLTextAreaElement>, "onChange">;
|
|
9
|
+
export default function AutoResizingTextarea(props: Props): React.JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
variant?: "primary" | "destructive" | "outline" | "secondary" | "ghost" | "link";
|
|
4
|
+
size?: "md" | "sm" | "lg" | "icon";
|
|
5
|
+
shape?: "circle" | "rounded" | "none";
|
|
6
|
+
}
|
|
7
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
8
|
+
export default Button;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface FormProps<T> extends React.FormHTMLAttributes<HTMLFormElement> {
|
|
3
|
+
onValuesChange?: (values: T) => void;
|
|
4
|
+
initialValues?: T;
|
|
5
|
+
onFinish?: (values: T) => void;
|
|
6
|
+
}
|
|
7
|
+
export interface FormRefObject<T> {
|
|
8
|
+
getValues(): T;
|
|
9
|
+
getFieldValue: <K extends keyof T>(fieldName: K) => T[K];
|
|
10
|
+
elementRef: () => HTMLFormElement | null;
|
|
11
|
+
setFieldValue: <K extends keyof T>(fieldName: K, value: T[K]) => void;
|
|
12
|
+
}
|
|
13
|
+
type FormComponent = React.ForwardRefExoticComponent<FormProps<Record<string, any>> & React.RefAttributes<FormRefObject<Record<string, any>>>> & {
|
|
14
|
+
Item: typeof FormItem;
|
|
15
|
+
Label: typeof FormLabel;
|
|
16
|
+
useForm: typeof useForm;
|
|
17
|
+
};
|
|
18
|
+
declare const Form: FormComponent;
|
|
19
|
+
interface FormItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
20
|
+
name?: string;
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
label?: string;
|
|
23
|
+
required?: boolean;
|
|
24
|
+
error?: string;
|
|
25
|
+
}
|
|
26
|
+
declare const FormItem: React.ForwardRefExoticComponent<FormItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
27
|
+
interface FormLabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
|
|
28
|
+
required?: boolean;
|
|
29
|
+
htmlFor?: string;
|
|
30
|
+
}
|
|
31
|
+
declare const FormLabel: React.ForwardRefExoticComponent<FormLabelProps & React.RefAttributes<HTMLLabelElement>>;
|
|
32
|
+
declare const useForm: <T>(initialValues: T) => FormRefObject<T>[];
|
|
33
|
+
export default Form;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SVGProps } from "react";
|
|
3
|
+
export declare function ReplyFill(props: SVGProps<SVGSVGElement>): React.JSX.Element;
|
|
4
|
+
export declare function Star(props: SVGProps<SVGSVGElement>): React.JSX.Element;
|
|
5
|
+
export declare function StarFilled(props: SVGProps<SVGSVGElement>): React.JSX.Element;
|
|
6
|
+
export declare function SystemIcon(props: SVGProps<SVGSVGElement>): React.JSX.Element;
|
|
7
|
+
export declare function MaterialSymbolsHistoryRounded(props: SVGProps<SVGSVGElement>): React.JSX.Element;
|
|
8
|
+
export declare function WpfFaq(props: SVGProps<SVGSVGElement>): React.JSX.Element;
|
|
9
|
+
export declare function MaterialSymbolsChatRounded(props: SVGProps<SVGSVGElement>): React.JSX.Element;
|
|
10
|
+
export declare const ThumbsUp: React.FC<React.SVGProps<any>>;
|
|
11
|
+
export declare const ThumbsDown: React.FC<React.SVGProps<any>>;
|
|
12
|
+
export declare const Search: React.FC<React.SVGProps<any>>;
|
|
13
|
+
export declare const Bot: React.FC<React.SVGProps<any>>;
|
|
14
|
+
export declare const ArrowInOut: React.FC<React.SVGProps<any>>;
|
|
15
|
+
export declare const Uploading: React.FC<React.SVGProps<any>>;
|
|
16
|
+
export declare const DropdownArrow: React.FC<React.SVGProps<any>>;
|
|
17
|
+
export declare const Attachment: React.FC<React.SVGProps<any>>;
|
|
18
|
+
export declare const Close: React.FC<React.SVGProps<any>>;
|
|
19
|
+
export declare const Hello: React.FC<React.SVGProps<any>>;
|
|
20
|
+
export declare const Headphones: React.FC<React.SVGProps<any>>;
|
|
21
|
+
export declare const User: React.FC<React.SVGProps<any>>;
|
|
22
|
+
export declare const Plus: React.FC<React.SVGProps<any>>;
|
|
23
|
+
export declare const Send: React.FC<React.SVGProps<any>>;
|
|
24
|
+
export declare const Loader: React.FC<React.SVGProps<any>>;
|
|
25
|
+
export declare const MessageCircle: React.FC<React.SVGProps<any>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
3
|
+
}
|
|
4
|
+
type InputComponent = React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>> & {
|
|
5
|
+
Password: typeof Password;
|
|
6
|
+
};
|
|
7
|
+
declare const Input: InputComponent;
|
|
8
|
+
declare const Password: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
9
|
+
export default Input;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const Colors: {
|
|
2
|
+
readonly primary: "#0E0E2C";
|
|
3
|
+
readonly secondary: "#755AE2";
|
|
4
|
+
readonly dark: "#0D0D0D";
|
|
5
|
+
readonly mood2: "#131313";
|
|
6
|
+
readonly dark2: "#8770E6";
|
|
7
|
+
readonly light_Dark: "#D3D3F1";
|
|
8
|
+
readonly secondary_dark: "#9278FA";
|
|
9
|
+
readonly helper: "#F5F3FF";
|
|
10
|
+
readonly cod: "#E4E4E4";
|
|
11
|
+
readonly yellow_500: "#BF6700";
|
|
12
|
+
readonly darkgreen: "#099976";
|
|
13
|
+
readonly light_gray: "#F8F9FB";
|
|
14
|
+
readonly orange: "#FF6B00";
|
|
15
|
+
readonly text: "#242424";
|
|
16
|
+
readonly BodyText: "#4A4A68";
|
|
17
|
+
readonly BodyTextAlpha: "#56566A";
|
|
18
|
+
readonly BodyTextLight: "#8C8CA1";
|
|
19
|
+
readonly green: "#12B669";
|
|
20
|
+
readonly blue: "#24214E";
|
|
21
|
+
readonly white: "#fff";
|
|
22
|
+
readonly gray: "#F5F7F9";
|
|
23
|
+
readonly sand: "#818181";
|
|
24
|
+
readonly icon: "#4E4E4E";
|
|
25
|
+
readonly tag: "#F3F4F6";
|
|
26
|
+
readonly outline: "#F1F8FF";
|
|
27
|
+
readonly modal: "#F9FAFB";
|
|
28
|
+
readonly border: "#E9E9E9";
|
|
29
|
+
readonly flat: "#F6F6F6";
|
|
30
|
+
readonly pale: "#EAEDF0;";
|
|
31
|
+
readonly grey: "#F8F8F8";
|
|
32
|
+
};
|
|
33
|
+
export declare const gId = "luli-g-id";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RatingRef } from "@/components/chatroom/ChatRating";
|
|
2
|
+
import { StartChatRefObject } from "@/components/chatroom/StartChat";
|
|
3
|
+
import { FAQViewerRefObject } from "@/components/faq/FAQViewer";
|
|
4
|
+
import { LuliChatAPI } from "@/utils/api";
|
|
5
|
+
import React from "react";
|
|
6
|
+
interface AppContextInterface {
|
|
7
|
+
api: React.RefObject<LuliChatAPI>;
|
|
8
|
+
FAQViewerRef: React.RefObject<FAQViewerRefObject>;
|
|
9
|
+
startChatRef: React.RefObject<StartChatRefObject>;
|
|
10
|
+
ratingRef: React.RefObject<RatingRef>;
|
|
11
|
+
}
|
|
12
|
+
export declare const AppContext: React.Context<AppContextInterface>;
|
|
13
|
+
export declare const useAppContext: () => AppContextInterface;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ChatSocket } from "@/lib/socket";
|
|
2
|
+
import { ChatSession, Company, Contact, Ticket } from "@/types";
|
|
3
|
+
import { ChatMessage } from "@/types/index";
|
|
4
|
+
import { LuliChatConfig } from "@/types";
|
|
5
|
+
import { Tag } from "@/components/chatroom/CompanyQueues";
|
|
6
|
+
type ConnectionStatus = "disconnected" | "connected" | "error";
|
|
7
|
+
type AppStoreState = {
|
|
8
|
+
open: boolean;
|
|
9
|
+
messages: ChatMessage[];
|
|
10
|
+
addMessage: (m: ChatMessage) => void;
|
|
11
|
+
set: (state: AppStoreState | Partial<AppStoreState> | ((state: AppStoreState) => AppStoreState)) => unknown;
|
|
12
|
+
session?: ChatSession;
|
|
13
|
+
company?: Company;
|
|
14
|
+
setMessages: (messages: ChatMessage[]) => void;
|
|
15
|
+
config: LuliChatConfig | null;
|
|
16
|
+
allowAnonymous: boolean;
|
|
17
|
+
tags: Tag[];
|
|
18
|
+
options: Tag[];
|
|
19
|
+
guestId: string;
|
|
20
|
+
contact?: Contact;
|
|
21
|
+
updateSession: (changes: {
|
|
22
|
+
ticket: Ticket;
|
|
23
|
+
contact: Contact;
|
|
24
|
+
token?: string;
|
|
25
|
+
}) => unknown;
|
|
26
|
+
};
|
|
27
|
+
export declare const useAppStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<AppStoreState>, "setState" | "persist"> & {
|
|
28
|
+
setState(partial: AppStoreState | Partial<AppStoreState> | ((state: AppStoreState) => AppStoreState | Partial<AppStoreState>), replace?: false | undefined): unknown;
|
|
29
|
+
setState(state: AppStoreState | ((state: AppStoreState) => AppStoreState), replace: true): unknown;
|
|
30
|
+
persist: {
|
|
31
|
+
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<AppStoreState, AppStoreState, unknown>>) => void;
|
|
32
|
+
clearStorage: () => void;
|
|
33
|
+
rehydrate: () => Promise<void> | void;
|
|
34
|
+
hasHydrated: () => boolean;
|
|
35
|
+
onHydrate: (fn: (state: AppStoreState) => void) => () => void;
|
|
36
|
+
onFinishHydration: (fn: (state: AppStoreState) => void) => () => void;
|
|
37
|
+
getOptions: () => Partial<import("zustand/middleware").PersistOptions<AppStoreState, AppStoreState, unknown>>;
|
|
38
|
+
};
|
|
39
|
+
}>;
|
|
40
|
+
export declare function useAppStoreShallow<T extends (keyof AppStoreState)[]>(fields: [...T]): Pick<AppStoreState, T[number]>;
|
|
41
|
+
type SocketState = {
|
|
42
|
+
socket: ChatSocket | null;
|
|
43
|
+
setSocket: (socket: ChatSocket) => void;
|
|
44
|
+
connected: boolean;
|
|
45
|
+
connectionStatus: ConnectionStatus;
|
|
46
|
+
setStatus: (c: ConnectionStatus) => void;
|
|
47
|
+
};
|
|
48
|
+
export declare const useSocketStore: import("zustand").UseBoundStore<import("zustand").StoreApi<SocketState>>;
|
|
49
|
+
export declare function useSocketStoreShallow<T extends (keyof SocketState)[]>(fields: [...T]): Pick<SocketState, T[number]>;
|
|
50
|
+
export {};
|