@opencx/widget 3.0.64 → 3.0.65
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 +12 -12
- package/dist/designs.cjs +18 -18
- package/dist/designs.cjs.map +1 -1
- package/dist/designs.js +590 -585
- package/dist/designs.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +2 -2
- package/dist/react.js.map +1 -1
- package/dist/src/designs/react/components/PoweredByOpen.d.ts +1 -1
- package/dist/src/designs/react/components/lib/MotionDiv.d.ts +1 -1
- package/dist/src/designs/react/components/lib/avatar.d.ts +2 -2
- package/dist/src/designs/react/components/lib/button.d.ts +1 -1
- package/dist/src/designs/react/components/lib/dialog.d.ts +2 -2
- package/dist/src/designs/react/components/lib/dropdown-menu.d.ts +2 -2
- package/dist/src/designs/react/components/lib/input.d.ts +2 -3
- package/dist/src/designs/react/components/lib/popover.d.ts +2 -2
- package/dist/src/designs/react/components/lib/switch.d.ts +2 -2
- package/dist/src/designs/react/components/lib/tooltip.d.ts +4 -4
- package/dist/src/designs/react/components/lib/wobble.d.ts +4 -4
- package/dist/src/designs/react/constants.d.ts +10 -4
- package/dist/src/designs/react/hooks/useWidgetContentHeight.d.ts +2 -2
- package/dist/src/designs/translation/translation.types.d.ts +1 -1
- package/dist/src/headless/core/__tests__/test-utils.d.ts +3 -3
- package/dist/src/headless/core/api/api-caller.d.ts +4 -4
- package/dist/src/headless/core/api/client.d.ts +4 -4
- package/dist/src/headless/core/api/schema.d.ts +60 -60
- package/dist/src/headless/core/context/router.ctx.d.ts +4 -4
- package/dist/src/headless/core/index.d.ts +1 -1
- package/dist/src/headless/core/types/messages.d.ts +8 -8
- package/dist/src/headless/core/types/schemas.d.ts +9 -9
- package/dist/src/headless/core/types/widget-config.d.ts +1 -6
- package/dist/src/headless/react/hooks/usePreludeData.d.ts +1 -1
- package/dist/src/headless/react/hooks/useUploadFiles.d.ts +1 -1
- package/dist/{useUploadFiles-C-_5Cqif.js → useUploadFiles-BLNdq94V.js} +3 -3
- package/dist/useUploadFiles-BLNdq94V.js.map +1 -0
- package/dist/{useUploadFiles-D0XBYDzl.cjs → useUploadFiles-Dl3_5Flm.cjs} +2 -2
- package/dist/useUploadFiles-Dl3_5Flm.cjs.map +1 -0
- package/dist/{widget.ctx-_0XFPUpq.js → widget.ctx-COUAUyWX.js} +2 -4
- package/dist/widget.ctx-COUAUyWX.js.map +1 -0
- package/dist/widget.ctx-DUaeXkNb.cjs.map +1 -1
- package/dist-embed/script.js +45 -45
- package/dist-embed/script.js.map +1 -1
- package/package.json +18 -10
- package/dist/useUploadFiles-C-_5Cqif.js.map +0 -1
- package/dist/useUploadFiles-D0XBYDzl.cjs.map +0 -1
- package/dist/widget.ctx-_0XFPUpq.js.map +0 -1
package/README.md
CHANGED
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
<script src="https://unpkg.com/@opencx/widget@latest/dist-embed/script.js"></script>
|
|
10
10
|
<script>
|
|
11
11
|
const options = {
|
|
12
|
-
token:
|
|
12
|
+
token: 'your-token-here',
|
|
13
13
|
};
|
|
14
|
-
window.addEventListener(
|
|
14
|
+
window.addEventListener('DOMContentLoaded', () => {
|
|
15
15
|
initOpenScript(options);
|
|
16
16
|
});
|
|
17
17
|
</script>
|
|
@@ -29,18 +29,18 @@ pnpm add @opencx/widget
|
|
|
29
29
|
Render the widget:
|
|
30
30
|
|
|
31
31
|
```tsx
|
|
32
|
-
import { Widget } from
|
|
32
|
+
import { Widget } from '@opencx/widget/designs';
|
|
33
33
|
|
|
34
34
|
function YourComponent() {
|
|
35
35
|
return (
|
|
36
36
|
<div data-opencx-widget>
|
|
37
37
|
<Widget
|
|
38
38
|
options={{
|
|
39
|
-
token:
|
|
39
|
+
token: 'your-token-here',
|
|
40
40
|
}}
|
|
41
41
|
/>
|
|
42
42
|
</div>
|
|
43
|
-
)
|
|
43
|
+
);
|
|
44
44
|
}
|
|
45
45
|
```
|
|
46
46
|
|
|
@@ -62,15 +62,15 @@ The widget supports a variety of ways to authenticate, or not, your users:
|
|
|
62
62
|
|
|
63
63
|
1. **Completely anonymous**: Leave `WidgetConfig.collectUserData` and `WidgetConfig.user` empty or explicitly `undefined`
|
|
64
64
|
2. **Manually collect user data**: Pass `WidgetConfig.collectUserData` as `true`
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
- Users will have to input a `name` and an `email` to enter the chat.
|
|
66
|
+
- A contact will be created with the inputted email. But the session will be considered `unverified`, since the user can input any `email`.
|
|
67
|
+
- The user will be saved in `localStorage` and they won't have to input a `name` and `email` on future visits.
|
|
68
68
|
3. **Programmatically pass user data**: Populate `WidgetConfig.user.data` with a `name` and `email`
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
- The session will still be considered `unverified`, because malicious users can still intercept outgoing browser requests and tamper with the user data
|
|
70
|
+
- If `WidgetConfig.collectUserData` is `true` and `WidgetConfig.user.data.email` was also passed, the `email` will take precedence and `collectUserData` will be ignored.
|
|
71
71
|
4. **Secure authentication**: Get a `token` for your user by letting your backend hit a request to `api.open.cx/widget/authenticate-user` ([API reference](https://docs.open.cx/api-reference/widget/authenticate-contact)) and pass the token in `WidgetConfig.user.token`
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
- The session will be `verified`, so your human agents can share private data with the user (in case the session was handed-over to humans)
|
|
73
|
+
- `customData` in the authentication request will be saved, since contacts have no way to tamper with them
|
|
74
74
|
|
|
75
75
|
## Workspace Management
|
|
76
76
|
|