lulichat 1.0.16 → 1.0.18
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 +17 -47
- package/dist/lulichat-widget-standalone.es.js +2608 -2644
- package/dist/lulichat-widget-standalone.umd.js +31 -31
- package/dist/lulichat-widget.es.js +818 -854
- package/dist/lulichat-widget.umd.js +6 -6
- package/dist/style.css +1 -1
- package/package.json +2 -3
- package/dist/index.d.ts +0 -131
- package/dist/lulichat-widget.html +0 -153
- package/dist/lulichat-widget.js +0 -131
package/README.md
CHANGED
|
@@ -7,12 +7,15 @@ LuliChat Support Chat is a library that provides a real-time live support chat w
|
|
|
7
7
|
## 1. React Installation & Usage
|
|
8
8
|
|
|
9
9
|
### Installation
|
|
10
|
+
|
|
10
11
|
```bash
|
|
11
12
|
npm install lulichat
|
|
12
13
|
```
|
|
13
14
|
|
|
14
15
|
### Usage
|
|
16
|
+
|
|
15
17
|
Import the component and stylesheet:
|
|
18
|
+
|
|
16
19
|
```tsx
|
|
17
20
|
import React from "react";
|
|
18
21
|
import LuliChat from "lulichat";
|
|
@@ -42,6 +45,7 @@ export default App;
|
|
|
42
45
|
You can load the widget on any website using the unpkg CDN.
|
|
43
46
|
|
|
44
47
|
### Option A: Standalone Bundle (Recommended for non-React websites)
|
|
48
|
+
|
|
45
49
|
This bundle includes React, ReactDOM, Socket.io, marked, and DOMPurify internally, making it a zero-dependency drop-in.
|
|
46
50
|
|
|
47
51
|
```html
|
|
@@ -57,6 +61,7 @@ This bundle includes React, ReactDOM, Socket.io, marked, and DOMPurify internall
|
|
|
57
61
|
```
|
|
58
62
|
|
|
59
63
|
### Option B: Externalized Bundle
|
|
64
|
+
|
|
60
65
|
If your page already loads React, ReactDOM, and socket.io-client, use the smaller externalized bundle:
|
|
61
66
|
|
|
62
67
|
```html
|
|
@@ -72,65 +77,30 @@ If your page already loads React, ReactDOM, and socket.io-client, use the smalle
|
|
|
72
77
|
></script>
|
|
73
78
|
```
|
|
74
79
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
## 3. Iframe Embedding Options
|
|
78
|
-
|
|
79
|
-
### Option A: Isolated Iframe (Script Tag)
|
|
80
|
-
To isolate the chat DOM and CSS from your parent page styles, enable isolated mode using the `data-isolated` attribute:
|
|
81
|
-
|
|
82
|
-
```html
|
|
83
|
-
<script
|
|
84
|
-
src="https://unpkg.com/lulichat/dist/lulichat-widget.umd.js"
|
|
85
|
-
data-api-key="YOUR_API_KEY"
|
|
86
|
-
data-isolated="iframe"
|
|
87
|
-
data-iframe-width="360px"
|
|
88
|
-
data-iframe-height="560px"
|
|
89
|
-
defer
|
|
90
|
-
onload="window.LuliChatSupport && window.LuliChatSupport.initFromScript()"
|
|
91
|
-
></script>
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
### Option B: Zero-JS Iframe Embedding (Static Frame)
|
|
95
|
-
If you want to embed the chat widget strictly via a standard `<iframe>` without any scripts on the parent page, point the frame to the hosted `lulichat-widget.html`:
|
|
96
|
-
|
|
97
|
-
```html
|
|
98
|
-
<iframe
|
|
99
|
-
src="https://unpkg.com/lulichat/dist/lulichat-widget.html?apiKey=YOUR_API_KEY&position=bottom-right&primaryColor=%234f46e5"
|
|
100
|
-
width="380"
|
|
101
|
-
height="600"
|
|
102
|
-
style="border:0;background:transparent"
|
|
103
|
-
loading="lazy"
|
|
104
|
-
></iframe>
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
---
|
|
108
|
-
|
|
109
|
-
## 4. Configuration Options
|
|
80
|
+
## 3. Configuration Options
|
|
110
81
|
|
|
111
82
|
Set these options via React component props, `data-*` script tag attributes, or URL query parameters:
|
|
112
83
|
|
|
113
|
-
| Parameter / Attribute
|
|
114
|
-
|
|
|
115
|
-
| `apiKey` / `data-api-key`
|
|
116
|
-
| `companyName` / `data-company-name`
|
|
117
|
-
| `welcomeMessage` / `data-welcome-message`
|
|
118
|
-
| `primaryColor` / `data-primary-color`
|
|
119
|
-
| `position` / `data-position`
|
|
120
|
-
| `allowAnonymous` / `data-allow-anonymous`
|
|
121
|
-
| `requireContactInfo` / `data-require-contact-info` | Ask for contact info before initiating a session
|
|
122
|
-
| `baseUrl` / `data-base-url`
|
|
84
|
+
| Parameter / Attribute | Description | Default |
|
|
85
|
+
| :------------------------------------------------- | :------------------------------------------------------------------------ | :------------------------- |
|
|
86
|
+
| `apiKey` / `data-api-key` | Your LuliChat public API key (Required) | - |
|
|
87
|
+
| `companyName` / `data-company-name` | Header title of the widget | `LuliChat` |
|
|
88
|
+
| `welcomeMessage` / `data-welcome-message` | Initial greeting message | - |
|
|
89
|
+
| `primaryColor` / `data-primary-color` | Hex theme color code (e.g. `#4f46e5`) | `#4f46e5` |
|
|
90
|
+
| `position` / `data-position` | Widget placement (`bottom-right`, `bottom-left`, `top-right`, `top-left`) | `bottom-right` |
|
|
91
|
+
| `allowAnonymous` / `data-allow-anonymous` | Allow users to chat without entering contact info | `false` |
|
|
92
|
+
| `requireContactInfo` / `data-require-contact-info` | Ask for contact info before initiating a session | `true` |
|
|
93
|
+
| `baseUrl` / `data-base-url` | Base endpoint URL for the chat backend API | `https://api.lulichat.com` |
|
|
123
94
|
|
|
124
95
|
---
|
|
125
96
|
|
|
126
|
-
##
|
|
97
|
+
## 4. JavaScript / Programmatic API
|
|
127
98
|
|
|
128
99
|
When loaded via a script tag, the widget registers a global `window.LuliChatSupport` object:
|
|
129
100
|
|
|
130
101
|
- `window.LuliChatSupport.mount(config, targetSelector?)`: Mounts the widget programmatically.
|
|
131
102
|
- `window.LuliChatSupport.unmount(id)`: Unmounts a specific widget instance by ID.
|
|
132
103
|
- `window.LuliChatSupport.unmountAll()`: Removes all mounted widget instances.
|
|
133
|
-
- `window.LuliChatSupport.mountIframe(config, iframeConfig)`: Programmatically mounts the widget within an isolated iframe.
|
|
134
104
|
- `window.LuliChatSupport.initFromScript()`: Reads properties from the current `<script>` tag and initializes the widget.
|
|
135
105
|
|
|
136
106
|
## License
|