diff --git a/packages/react-use-zendesk/CHANGELOG.md b/packages/react-use-zendesk/CHANGELOG.md index 1bce3e6..8b9a625 100644 --- a/packages/react-use-zendesk/CHANGELOG.md +++ b/packages/react-use-zendesk/CHANGELOG.md @@ -1,5 +1,11 @@ # react-use-zendesk +## 1.0.1 + +### Patch Changes + +- update readme in library package + ## 1.0.0 ### Major Changes diff --git a/packages/react-use-zendesk/README.md b/packages/react-use-zendesk/README.md index 8eb5204..bb817c8 100644 --- a/packages/react-use-zendesk/README.md +++ b/packages/react-use-zendesk/README.md @@ -1,2 +1,144 @@ +
React Zendesk Web Widget integration written in typescript.
-## Please read [Readme](https://github.com/multivoltage/react-use-zendesk/blob/main/README.md) \ No newline at end of file +## Features +* Web Widget api available. Please see [Zendesk docs](https://developer.zendesk.com/api-reference/widget-messaging/web/core/) +* TypeScript support +* Only 25kb +* Working on NextJS/Gatsby + + +## ⚠️ Web widget vs Web Widget (classic) ⚠️ + + +This library offers API only for the new version called Web widget. +For more information please read [the comparison](https://support.zendesk.com/hc/en-us/articles/4429429087002-Comparing-the-Zendesk-Web-Widgets) + +## Installation + +```sh +npm i react-use-zendesk +``` + +## Usage +```ts + + +import { ZendeskProvider, useZendesk } from 'react-use-zendesk'; + +const App = () => ( +fake child example
+show
to display the widget unless you use hide.
+| hide | () => void | Hides all parts of the widget from the page. You can invoke it before or after page load.
+| open | () => void | Opens the messaging Web Widget. Chat become visible
+| close | () => void | Closes the messaging Web Widget
+| setLocale | (newLocale: string) => void | Sets the locale of the messaging Web Widget.
+| setZIndex | (newZIndex: number) => void | Sets the CSS property z-index on all the iframes for the messaging WebWidget.
+| setCookies | (isEnabled: boolean) => void | The messaging Web Widget uses a mixture of cookies as well as local and session storage in order to function.
+| setConversationFields | (conversationFields: ZendeskConversationField[]) => void | Allows values for conversation fields to be set in the client to add contextual data about the conversation.
+| setConversationTags | (conversationTags: string[]) => void | Allows custom conversation tags to be set in the client to add contextual data about the conversation
+| loginUser | (jwtToken: string) => void | If your application has a login flow, or if a user needs to access the same conversation from multiple devices
+| logoutUser | () => void | Your app may have a logout function that brings users back to a login screen. In this case, revert the messaging Web Widget to a pre-login state
+| isOpen | boolean | this flag indicates if chat is visible or hidden. Derivated from from `onOpen` and `onCLose`
+| unreadMessages | number / undefined | this flag indicates number of unread messages . Derivated from from `onUnreadMessages`. Before internal callback this flag is `undefined` |
+
+
+#### Example
+```ts
+import { ZendeskProvider, useZendesk } from 'react-use-zendesk';
+
+const App = () => (
+ you have {unreadMessages} unread messages
+your chat is ${isOpen ? "visible" : "hidden"}
+ + > + ); +}; +``` + +## Examples +Go to [examples](https://github.com/multivoltage/react-use-zendesk/tree/main/apps/docs) to check out some integrations ( NextJS...). diff --git a/packages/react-use-zendesk/package.json b/packages/react-use-zendesk/package.json index 3353a19..c10bdfc 100644 --- a/packages/react-use-zendesk/package.json +++ b/packages/react-use-zendesk/package.json @@ -6,7 +6,7 @@ }, "description": "React Zendesk Web Widget integration written in typescript", "license": "MIT", - "version": "1.0.0", + "version": "1.0.1", "repository": { "type": "git", "url": "https://github.com/multivoltage/react-use-zendesk"