@zean-chat/react-native 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +35 -2
- package/dist/components/AppMark.d.ts +3 -0
- package/dist/components/ChatHeader.d.ts +3 -0
- package/dist/components/ChatModal.d.ts +6 -0
- package/dist/components/ChatNotice.d.ts +3 -0
- package/dist/components/ChatScreen.d.ts +3 -0
- package/dist/components/Composer.d.ts +5 -0
- package/dist/components/EmailForm.d.ts +3 -0
- package/dist/components/Icon.d.ts +3 -0
- package/dist/components/ImageViewer.d.ts +3 -0
- package/dist/components/MessageBubble.d.ts +3 -0
- package/dist/components/MessageFiles.d.ts +3 -0
- package/dist/components/MessageList.d.ts +6 -0
- package/dist/components/PoweredBy.d.ts +2 -0
- package/dist/components/TeamAvatar.d.ts +3 -0
- package/dist/components/TypingBubble.d.ts +3 -0
- package/dist/components/ZeanChat.d.ts +6 -0
- package/dist/hooks/use-app-active.d.ts +2 -0
- package/dist/hooks/use-attachment-links.d.ts +6 -0
- package/dist/hooks/use-chat-context.d.ts +4 -0
- package/dist/hooks/use-connection-lost.d.ts +2 -0
- package/dist/hooks/use-keyboard-overlap.d.ts +8 -0
- package/dist/hooks/use-pending-photos.d.ts +15 -0
- package/dist/hooks/use-zean.d.ts +3 -0
- package/dist/i18n/en.d.ts +36 -0
- package/dist/i18n/fr.d.ts +37 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +7264 -0
- package/dist/interfaces.d.ts +44 -0
- package/dist/models/photos.utils.d.ts +7 -0
- package/dist/models/sdk.constants.d.ts +18 -0
- package/dist/models/sdk.interface.d.ts +187 -0
- package/dist/models/sdk.store.d.ts +10 -0
- package/dist/models/sdk.utils.d.ts +24 -0
- package/package.json +81 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Zean
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,36 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @zean-chat/react-native: in-app support chat for React Native and Expo
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Add a free customer support chat inside your iOS and Android app, with [Zean](https://zean.chat/?utm_source=npm&utm_medium=readme&utm_campaign=react-native). Plain React Native: no native module of its own, works in Expo Go. Your App key is in your Zean dashboard.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx expo install @zean-chat/react-native @react-native-async-storage/async-storage expo-image-picker
|
|
7
|
+
# or
|
|
8
|
+
npm install @zean-chat/react-native @react-native-async-storage/async-storage react-native-image-picker
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The photo picker is optional: without one, the chat has no photo button.
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
15
|
+
import { ZeanChat, useZean } from "@zean-chat/react-native";
|
|
16
|
+
|
|
17
|
+
// Once, at the root of the app (beside the navigator, or in app/_layout.tsx with Expo Router).
|
|
18
|
+
<ZeanChat appKey="app_your_app_key" storage={AsyncStorage} getToken={user ? fetchZeanToken : undefined} locale="fr" />;
|
|
19
|
+
|
|
20
|
+
// Anywhere. The chat opens in a modal over the app.
|
|
21
|
+
const { open, close, toggle, unreadCount, identify, signOut, setAttributes } = useZean();
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`locale` (`fr`, `en`) and `colorScheme` (`light`, `dark`) default to the phone's. Full guide: [install the chat in React Native and Expo](https://zean.chat/docs/install-react-native), [React Native reference](https://zean.chat/docs/reference-react-native).
|
|
25
|
+
|
|
26
|
+
## Why Zean
|
|
27
|
+
|
|
28
|
+
- Free plan to start. Paid plans in FCFA, payable by Mobile Money.
|
|
29
|
+
- Shared inbox for your team. Reply from your phone.
|
|
30
|
+
- Verified identity, webhooks, French and English. Fast even on 3G.
|
|
31
|
+
|
|
32
|
+
## Links
|
|
33
|
+
|
|
34
|
+
[Zean live chat](https://zean.chat/?utm_source=npm&utm_medium=readme&utm_campaign=react-native) · [Documentation](https://zean.chat/docs) · [Create a free account](https://zean.chat/sign-in?utm_source=npm&utm_medium=readme&utm_campaign=react-native) · [Zean vs Intercom](https://zean.chat/compare/intercom) · [Zean vs Crisp](https://zean.chat/compare/crisp)
|
|
35
|
+
|
|
36
|
+
Other SDKs: [@zean-chat/js](https://www.npmjs.com/package/@zean-chat/js) · [@zean-chat/react](https://www.npmjs.com/package/@zean-chat/react) · [@zean-chat/vue](https://www.npmjs.com/package/@zean-chat/vue) · [@zean-chat/react-native](https://www.npmjs.com/package/@zean-chat/react-native)
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ChatHeaderProps } from '../models/sdk.interface';
|
|
2
|
+
/** The App's name and whether the team is there, with the header text until the Contact writes. */
|
|
3
|
+
export declare function ChatHeader({ app, online, greeting, topInset, onClose }: ChatHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ChatModalProps } from '../models/sdk.interface';
|
|
2
|
+
/**
|
|
3
|
+
* The chat in React Native's own `Modal`, above any navigator: a sheet on an iPhone, swiped down to close; the whole
|
|
4
|
+
* screen on Android, closed with back, and on an iPad. It shows once the App is known, in its colour and the Contact's language.
|
|
5
|
+
*/
|
|
6
|
+
export declare function ChatModal({ chat, colorScheme }: ChatModalProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ChatScreenProps } from '../models/sdk.interface';
|
|
2
|
+
/** The open chat: the header, the Conversation, and the message field above the keyboard. */
|
|
3
|
+
export declare function ChatScreen({ state, insets, onClose }: ChatScreenProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Contact's message field, with the photo button when the app installed a picker. 16 point text; the field grows
|
|
3
|
+
* with the text up to a few lines. Emoji come from the phone's keyboard.
|
|
4
|
+
*/
|
|
5
|
+
export declare function Composer(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ImageViewerProps } from '../models/sdk.interface';
|
|
2
|
+
/** An image at full size over the chat. A tap anywhere, or Android's back, closes it and keeps the chat open. */
|
|
3
|
+
export declare function ImageViewer({ image, onClose }: ImageViewerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { MessageBubbleProps } from '../models/sdk.interface';
|
|
2
|
+
/** One message: the Contact's on the right in the App's colour, the team's on the left. */
|
|
3
|
+
export declare function MessageBubble({ message, app, showName, status, onRetry }: MessageBubbleProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { MessageFilesProps } from '../models/sdk.interface';
|
|
2
|
+
/** A message's files: images to open full screen, other files to open in the phone's viewer. */
|
|
3
|
+
export declare function MessageFiles({ attachments, own, stored }: MessageFilesProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { MessageListProps } from '../models/sdk.interface';
|
|
2
|
+
/**
|
|
3
|
+
* The App's welcome, the Conversation, and what the team is doing now. The list runs from the bottom, as chats do:
|
|
4
|
+
* new messages stay in view, and older ones loaded at the top keep the reader's place.
|
|
5
|
+
*/
|
|
6
|
+
export declare function MessageList({ state }: MessageListProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { TeamAvatarProps } from '../models/sdk.interface';
|
|
2
|
+
/** Beside the team's messages: the Member's photo or initials, else the App's logo or initial. */
|
|
3
|
+
export declare function TeamAvatar({ app, sender }: TeamAvatarProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ZeanChatProps } from '../interfaces';
|
|
2
|
+
/**
|
|
3
|
+
* The chat. Render it once, near the root of the app, inside or outside any navigator: it opens in its own modal when
|
|
4
|
+
* `open()` from `useZean()` is called, and shows nothing until then.
|
|
5
|
+
*/
|
|
6
|
+
export declare function ZeanChat({ appKey, storage, getToken, attributes, locale, colorScheme, backendUrl }: ZeanChatProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Chat } from '@zean/sdk-core';
|
|
2
|
+
/**
|
|
3
|
+
* The links to show a message's files, signed for the Contact's device. `stored`: false while the Contact's message is on
|
|
4
|
+
* its way, when its files cannot be read yet.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useAttachmentLinks(chat: Chat, keys: ReadonlyArray<string>, stored: boolean): ReadonlyMap<string, string>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ChatContextValue } from '../models/sdk.interface';
|
|
2
|
+
export declare const ChatContext: import("react").Context<ChatContextValue | null>;
|
|
3
|
+
/** The open chat, its words and colours: given by `ChatModal` to everything inside it. */
|
|
4
|
+
export declare function useChatContext(): ChatContextValue;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ComponentRef, RefObject } from 'react';
|
|
2
|
+
import type { View } from 'react-native';
|
|
3
|
+
/**
|
|
4
|
+
* How much of the chat the keyboard covers: the chat lifts its message field by as much. The chat always reaches the
|
|
5
|
+
* bottom of the screen. On iOS that makes it the keyboard's height: inside a sheet, React Native measures from the
|
|
6
|
+
* sheet's top, not the screen's. On Android it is measured, since the window may also shrink above the keyboard.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useKeyboardOverlap(ref: RefObject<ComponentRef<typeof View> | null>): number;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ChatAttachment } from '@zean/sdk-core';
|
|
2
|
+
import type { PendingPhoto, PickedPhoto } from '../models/sdk.interface';
|
|
3
|
+
/** Photos picked for the next message: uploaded at once, sent with the text. */
|
|
4
|
+
export declare function usePendingPhotos(): {
|
|
5
|
+
photos: PendingPhoto[];
|
|
6
|
+
problem: string | null;
|
|
7
|
+
/** Photos that still fit in the message. */
|
|
8
|
+
room: number;
|
|
9
|
+
add: (picked: ReadonlyArray<PickedPhoto>) => void;
|
|
10
|
+
remove: (id: string) => void;
|
|
11
|
+
take: () => Array<ChatAttachment>;
|
|
12
|
+
showProblem: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
13
|
+
uploading: boolean;
|
|
14
|
+
ready: boolean;
|
|
15
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare const en: {
|
|
2
|
+
close_chat: string;
|
|
3
|
+
online: string;
|
|
4
|
+
away: string;
|
|
5
|
+
placeholder: string;
|
|
6
|
+
send: string;
|
|
7
|
+
powered_by: string;
|
|
8
|
+
earlier: string;
|
|
9
|
+
sending: string;
|
|
10
|
+
sent: string;
|
|
11
|
+
seen: string;
|
|
12
|
+
not_sent: string;
|
|
13
|
+
rate_limited: string;
|
|
14
|
+
retry: string;
|
|
15
|
+
team: string;
|
|
16
|
+
typing: string;
|
|
17
|
+
reconnecting: string;
|
|
18
|
+
blocked: string;
|
|
19
|
+
unavailable: string;
|
|
20
|
+
email_prompt: string;
|
|
21
|
+
email_placeholder: string;
|
|
22
|
+
email_submit: string;
|
|
23
|
+
email_invalid: string;
|
|
24
|
+
email_saved: string;
|
|
25
|
+
error: string;
|
|
26
|
+
attach: string;
|
|
27
|
+
uploading: string;
|
|
28
|
+
ready: string;
|
|
29
|
+
remove_photo: string;
|
|
30
|
+
photo_type: string;
|
|
31
|
+
photo_size: string;
|
|
32
|
+
too_many: string;
|
|
33
|
+
open_image: string;
|
|
34
|
+
close_image: string;
|
|
35
|
+
open_file: string;
|
|
36
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** The chat's words, the same as the web widget's. French is the reference: `en.ts` carries the same keys. */
|
|
2
|
+
export declare const fr: {
|
|
3
|
+
close_chat: string;
|
|
4
|
+
online: string;
|
|
5
|
+
away: string;
|
|
6
|
+
placeholder: string;
|
|
7
|
+
send: string;
|
|
8
|
+
powered_by: string;
|
|
9
|
+
earlier: string;
|
|
10
|
+
sending: string;
|
|
11
|
+
sent: string;
|
|
12
|
+
seen: string;
|
|
13
|
+
not_sent: string;
|
|
14
|
+
rate_limited: string;
|
|
15
|
+
retry: string;
|
|
16
|
+
team: string;
|
|
17
|
+
typing: string;
|
|
18
|
+
reconnecting: string;
|
|
19
|
+
blocked: string;
|
|
20
|
+
unavailable: string;
|
|
21
|
+
email_prompt: string;
|
|
22
|
+
email_placeholder: string;
|
|
23
|
+
email_submit: string;
|
|
24
|
+
email_invalid: string;
|
|
25
|
+
email_saved: string;
|
|
26
|
+
error: string;
|
|
27
|
+
attach: string;
|
|
28
|
+
uploading: string;
|
|
29
|
+
ready: string;
|
|
30
|
+
remove_photo: string;
|
|
31
|
+
photo_type: string;
|
|
32
|
+
photo_size: string;
|
|
33
|
+
too_many: string;
|
|
34
|
+
open_image: string;
|
|
35
|
+
close_image: string;
|
|
36
|
+
open_file: string;
|
|
37
|
+
};
|
package/dist/index.d.ts
ADDED