@opencx/widget 2.2.0 → 2.3.1
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 +30 -105
- package/dist/basic.cjs +3 -3
- package/dist/basic.cjs.map +1 -1
- package/dist/basic.js +10 -9
- package/dist/basic.js.map +1 -1
- package/dist/core/client/api.d.ts +21 -7
- package/dist/core/client/chat.d.ts +62 -0
- package/dist/core/client/client.d.ts +6 -36
- package/dist/core/client/config.d.ts +35 -0
- package/dist/core/client/contact.d.ts +32 -0
- package/dist/core/client/contact.test.d.ts +1 -0
- package/dist/core/client/index.d.ts +3 -1
- package/dist/core/index.d.ts +6 -1
- package/dist/core/platform/index.d.ts +1 -10
- package/dist/core/types/index.d.ts +24 -2
- package/dist/core/types/pub-sub.d.ts +19 -82
- package/dist/core/types/schemas-v2.d.ts +687 -0
- package/dist/core/utils/create-fetch.d.ts +24 -0
- package/dist/index-CHWVttUy.cjs +18 -0
- package/dist/index-CHWVttUy.cjs.map +1 -0
- package/dist/{index-XkXeMM77.js → index-pl-6K_wU.js} +1178 -1301
- package/dist/index-pl-6K_wU.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +376 -370
- package/dist/index.js.map +1 -1
- package/dist/react-bindings/context/ChatContext.d.ts +130 -0
- package/dist/react-bindings/hooks/useContact.d.ts +9 -0
- package/dist/react-bindings/hooks/usePubsub.d.ts +3 -0
- package/dist/react-bindings/hooks/useSendMessage.d.ts +6 -0
- package/dist/react-bindings/index.d.ts +3 -0
- package/dist/react-web/hooks/use-sound.test.d.ts +1 -0
- package/dist/react-web/hooks/use-sync-state.test.d.ts +1 -0
- package/dist/{react-lib → react-web}/hooks/useAbstractChat.d.ts +42 -45
- package/dist/{react-lib → react-web}/hooks/useAxiosInstance.d.ts +37 -0
- package/dist/{react-lib → react-web}/hooks/useUploadFiles.d.ts +1 -1
- package/dist/{react-lib → react-web}/providers/ChatProvider.d.ts +54 -46
- package/dist/{react-lib → react-web}/types/index.d.ts +1 -0
- package/dist/react.cjs +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +2 -2
- package/dist/react.js.map +1 -1
- package/dist/schemas-BBAV6Sd_.js +122 -0
- package/dist/schemas-BBAV6Sd_.js.map +1 -0
- package/dist/schemas-wky4fpbc.cjs +2 -0
- package/dist/schemas-wky4fpbc.cjs.map +1 -0
- package/dist/src/@components/ChatEvent.component.d.ts +1 -1
- package/dist/src/@components/Fallback.component.d.ts +1 -1
- package/dist/src/@components/Text.component.d.ts +1 -1
- package/dist/src/components/dialog.d.ts +2 -2
- package/dist/src/components/userMessage.d.ts +1 -1
- package/dist/src/designs/basic/index.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist-embed/script.js +106 -106
- package/dist-embed/script.js.map +1 -1
- package/package.json +1 -3
- package/dist/core/managers/chathistory-manager.d.ts +0 -61
- package/dist/core/managers/session-manager.d.ts +0 -35
- package/dist/core/transport/http.transport.d.ts +0 -17
- package/dist/core/transport/transport.d.ts +0 -25
- package/dist/core/types/transport.d.ts +0 -31
- package/dist/history-to-widget-messages-CP0hKjhv.js +0 -195
- package/dist/history-to-widget-messages-CP0hKjhv.js.map +0 -1
- package/dist/history-to-widget-messages-CdbZolRN.cjs +0 -2
- package/dist/history-to-widget-messages-CdbZolRN.cjs.map +0 -1
- package/dist/index-XkXeMM77.js.map +0 -1
- package/dist/index-xb7Pg6AD.cjs +0 -18
- package/dist/index-xb7Pg6AD.cjs.map +0 -1
- package/dist/react-lib/hooks/handle-socket-messages.d.ts +0 -27
- package/dist/react-lib/hooks/socket.d.ts +0 -11
- package/dist/react-lib/hooks/socketState.d.ts +0 -2
- package/dist/react-lib/hooks/useBaseClient.d.ts +0 -2
- package/dist/react-lib/providers/ClientProvider.d.ts +0 -7
- /package/dist/{react-lib/hooks/use-sound.test.d.ts → core/client/chat.test.d.ts} +0 -0
- /package/dist/{react-lib/hooks/use-sync-state.test.d.ts → core/client/config.test.d.ts} +0 -0
- /package/dist/{react-lib → react-web}/Root.d.ts +0 -0
- /package/dist/{react-lib → react-web}/hooks/index.d.ts +0 -0
- /package/dist/{react-lib → react-web}/hooks/use-sound.d.ts +0 -0
- /package/dist/{react-lib → react-web}/hooks/useScrollTo.d.ts +0 -0
- /package/dist/{react-lib → react-web}/hooks/useSyncState.d.ts +0 -0
- /package/dist/{react-lib → react-web}/hooks/useTimeoutState.d.ts +0 -0
- /package/dist/{react-lib → react-web}/hooks/useVote.d.ts +0 -0
- /package/dist/{react-lib → react-web}/hooks/useWidgetContentHeight.d.ts +0 -0
- /package/dist/{react-lib → react-web}/index.d.ts +0 -0
- /package/dist/{react-lib → react-web}/locales/ar.locale.d.ts +0 -0
- /package/dist/{react-lib → react-web}/locales/de.locale.d.ts +0 -0
- /package/dist/{react-lib → react-web}/locales/en.locale.d.ts +0 -0
- /package/dist/{react-lib → react-web}/locales/fr.locale.d.ts +0 -0
- /package/dist/{react-lib → react-web}/locales/helper.d.ts +0 -0
- /package/dist/{react-lib → react-web}/locales/index.d.ts +0 -0
- /package/dist/{react-lib → react-web}/locales/nl.locale.d.ts +0 -0
- /package/dist/{react-lib → react-web}/locales/pt.locale.d.ts +0 -0
- /package/dist/{react-lib → react-web}/providers/ConfigDataProvider.d.ts +0 -0
- /package/dist/{react-lib → react-web}/providers/ContactProvider.d.ts +0 -0
- /package/dist/{react-lib → react-web}/providers/LocalesProvider.d.ts +0 -0
- /package/dist/{react-lib → react-web}/providers/componentRegistry.d.ts +0 -0
- /package/dist/{react-lib → react-web}/providers/use-widget-sfx.d.ts +0 -0
- /package/dist/{react-lib → react-web}/providers/usePreludeData.d.ts +0 -0
- /package/dist/{react-lib → react-web}/types/components.d.ts +0 -0
- /package/dist/{react-lib → react-web}/types/options.d.ts +0 -0
- /package/dist/{react-lib → react-web}/utils/create-safe-context.d.ts +0 -0
- /package/dist/{react-lib → react-web}/utils/debug.d.ts +0 -0
- /package/dist/{react-lib → react-web}/utils/getters.d.ts +0 -0
- /package/dist/{react-lib → react-web}/utils/index.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,105 +1,30 @@
|
|
|
1
|
-
# The one and only chat widget for open
|
|
2
|
-
|
|
3
|
-
## How to Get Started
|
|
4
|
-
|
|
5
|
-
### 1.
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
pnpm add @opencx/widget
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
### 2.
|
|
12
|
-
|
|
13
|
-
```
|
|
14
|
-
import { Widget, WidgetRoot } from "@opencx/widget/basic";
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
### 3.
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
<
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
type WidgetOptions = {
|
|
32
|
-
token: string;
|
|
33
|
-
headers?: Record<string, string>;
|
|
34
|
-
queryParams?: Record<string, string>;
|
|
35
|
-
initialMessages: string;
|
|
36
|
-
apiUrl: string;
|
|
37
|
-
socketUrl: string;
|
|
38
|
-
debug?: boolean;
|
|
39
|
-
language?: LangType;
|
|
40
|
-
user?: {
|
|
41
|
-
name?: string;
|
|
42
|
-
email?: string;
|
|
43
|
-
phone?: string;
|
|
44
|
-
customData?: Record<string, string>;
|
|
45
|
-
avatarUrl?: string;
|
|
46
|
-
};
|
|
47
|
-
bot?: {
|
|
48
|
-
name?: string;
|
|
49
|
-
avatarUrl?: string;
|
|
50
|
-
};
|
|
51
|
-
components?: ComponentType[];
|
|
52
|
-
};
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
also you must import the css file too.
|
|
56
|
-
|
|
57
|
-
```javascript
|
|
58
|
-
import "@opencx/widget/index.css";
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
also the styles are scoped to the widget only so the widget should have a container with `data-chat-widget`
|
|
62
|
-
|
|
63
|
-
```javascript
|
|
64
|
-
import { Widget, WidgetRoot, WidgetPopover } from "@opencx/widget";
|
|
65
|
-
import "@opencx/widget/index.css";
|
|
66
|
-
<div data-chat-widget>
|
|
67
|
-
<WidgetRoot>
|
|
68
|
-
<Widget />
|
|
69
|
-
</WidgetRoot>
|
|
70
|
-
</div>;
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## How about the WidgetPopover ?
|
|
74
|
-
|
|
75
|
-
It's a component that you can use to show the widget in a popover fixed to the bottom left corner
|
|
76
|
-
|
|
77
|
-
```javascript
|
|
78
|
-
<div data-chat-widget>
|
|
79
|
-
<WidgetPopover>
|
|
80
|
-
<Widget />
|
|
81
|
-
</WidgetPopover>
|
|
82
|
-
</div>
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
## How can i Change the colors of the widget ?
|
|
86
|
-
|
|
87
|
-
these are the css variables that you can change to customize the widget
|
|
88
|
-
you may add these variables to the parent container of the widget
|
|
89
|
-
to override the default colors
|
|
90
|
-
|
|
91
|
-
```
|
|
92
|
-
const vars = `
|
|
93
|
-
[--primary:211_65%_59%]
|
|
94
|
-
[--foreground:0_0%_0%]
|
|
95
|
-
[--background:0_0%_100%]
|
|
96
|
-
[--secondary:0_0%_96%]
|
|
97
|
-
[--primary-foreground:217_72%_18%]
|
|
98
|
-
[--accent:0_0_22%]
|
|
99
|
-
`;
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
## I don't want your ui ? can i use my own ?
|
|
103
|
-
|
|
104
|
-
Yes You can, every thing in this lib is exported so u can build your own ui on top of it
|
|
105
|
-
Even the core hook of the widget is exported so you can use it to build your own ui
|
|
1
|
+
# The one and only chat widget for open
|
|
2
|
+
|
|
3
|
+
## How to Get Started
|
|
4
|
+
|
|
5
|
+
### 1. Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @opencx/widget
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### 2. Imports
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { Widget, WidgetRoot } from "@opencx/widget/basic";
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### 3. Usage
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
<WidgetRoot options={options}>
|
|
21
|
+
<Widget />
|
|
22
|
+
</WidgetRoot>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
`WidgetRoot` is just the data layer for the widget. It is required to be present in the parent component of the widget.
|
|
26
|
+
You can Pass [options](./react-lib/types/options.ts) to the `WidgetRoot` component to customize the widget.
|
|
27
|
+
|
|
28
|
+
## I don't want your UI? can I use my own?
|
|
29
|
+
|
|
30
|
+
Yes, everything in this lib is exported so you can build your own UI on top of it. Check out `core` and `react-lib` directories.
|