@zean-chat/react-native 0.1.4 → 0.1.6
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 +1 -1
- package/dist/components/AppMark.d.ts +1 -1
- package/dist/components/ChatHeader.d.ts +2 -2
- package/dist/components/ChatModal.d.ts +3 -2
- package/dist/components/ChatNotice.d.ts +1 -1
- package/dist/components/Composer.d.ts +3 -2
- package/dist/components/EmailForm.d.ts +1 -1
- package/dist/components/ImageViewer.d.ts +5 -2
- package/dist/components/MessageBubble.d.ts +5 -2
- package/dist/components/MessageFiles.d.ts +1 -1
- package/dist/components/MessageList.d.ts +2 -1
- package/dist/components/MessageMeta.d.ts +3 -0
- package/dist/components/PendingPhotos.d.ts +3 -0
- package/dist/components/PoweredBy.d.ts +1 -1
- package/dist/components/Skeleton.d.ts +3 -0
- package/dist/components/TypingBubble.d.ts +1 -1
- package/dist/components/ZeanChat.d.ts +1 -1
- package/dist/hooks/use-keyboard-overlap.d.ts +4 -3
- package/dist/hooks/use-pending-photos.d.ts +5 -4
- package/dist/hooks/use-rise-in.d.ts +8 -0
- package/dist/i18n/en.d.ts +5 -0
- package/dist/i18n/fr.d.ts +5 -0
- package/dist/index.js +1156 -543
- package/dist/interfaces.d.ts +6 -1
- package/dist/models/conversation.utils.d.ts +15 -0
- package/dist/models/sdk.constants.d.ts +20 -1
- package/dist/models/sdk.interface.d.ts +55 -13
- package/dist/models/sdk.utils.d.ts +2 -0
- package/package.json +10 -2
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ import { ZeanChat, useZean } from "@zean-chat/react-native";
|
|
|
21
21
|
const { open, close, toggle, unreadCount, identify, signOut, setAttributes } = useZean();
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
Passing `user` signs the person in; `undefined` signs them out. `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).
|
|
24
|
+
Passing `user` signs the person in; `undefined` signs them out. `locale` (`fr`, `en`) and `colorScheme` (`light`, `dark`) default to the phone's. `maxPhotos` sets the photos per message, 1 to 6; 4 by default. `storage` keeps the newest 100 messages on the phone: the chat shows them at once and downloads only new ones. 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
25
|
|
|
26
26
|
## Why Zean
|
|
27
27
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { AppMarkProps } from '../models/sdk.interface';
|
|
2
|
-
/** The App in the header: its logo, else a chat bubble in its colour. */
|
|
2
|
+
/** The App in the header: its logo in a circle, as the dashboard shows it, else a chat bubble in its colour. */
|
|
3
3
|
export declare function AppMark({ app }: AppMarkProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ChatHeaderProps } from '../models/sdk.interface';
|
|
2
|
-
/** The App's name and whether the team is there,
|
|
3
|
-
export declare function ChatHeader({ app, online,
|
|
2
|
+
/** The App's name and whether the team is there: one short row, so the Conversation keeps the room, even on a small phone. */
|
|
3
|
+
export declare function ChatHeader({ app, online, topInset, onClose }: ChatHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ChatModalProps } from '../models/sdk.interface';
|
|
2
2
|
/**
|
|
3
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
|
|
4
|
+
* screen on Android, closed with back, and on an iPad. It shows once the App and the Conversation are loaded, in the
|
|
5
|
+
* App's colour and the Contact's language.
|
|
5
6
|
*/
|
|
6
|
-
export declare function ChatModal({ chat, colorScheme }: ChatModalProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function ChatModal({ chat, colorScheme, maxPhotos }: ChatModalProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ChatNoticeProps } from '../models/sdk.interface';
|
|
2
|
-
/** A
|
|
2
|
+
/** A card from the chat itself: offline, blocked, unavailable. */
|
|
3
3
|
export declare function ChatNotice({ children }: ChatNoticeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The Contact's message field
|
|
3
|
-
* with the text up to
|
|
2
|
+
* The Contact's message field: a pill with the photo button, when the app installed a picker, and a round send button
|
|
3
|
+
* in the App's colour. 16 point text; the field grows with the text up to five lines. Emoji come from the phone's keyboard.
|
|
4
|
+
* Picked photos show above the field and upload when the message is sent.
|
|
4
5
|
*/
|
|
5
6
|
export declare function Composer(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { EmailFormProps } from '../models/sdk.interface';
|
|
2
|
-
/** Asked
|
|
2
|
+
/** Asked once the Contact has written, until they leave an email: where the team reaches them back. */
|
|
3
3
|
export declare function EmailForm({ onSubmit }: EmailFormProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import type { ImageViewerProps } from '../models/sdk.interface';
|
|
2
|
-
/**
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* A message's images at full size over the chat, swiped from one to the next, pinched to zoom on iOS. The close button,
|
|
4
|
+
* or Android's back, goes back to the chat.
|
|
5
|
+
*/
|
|
6
|
+
export declare function ImageViewer({ gallery, topInset, onClose }: ImageViewerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import type { MessageBubbleProps } from '../models/sdk.interface';
|
|
2
|
-
/**
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* One message: the Contact's on the right in the App's colour, the team's on the left beside the sender's avatar.
|
|
4
|
+
* Messages of a run sit close, with tight corners where they meet; the run's last one carries the time.
|
|
5
|
+
*/
|
|
6
|
+
export declare function MessageBubble({ row, app, onRetry }: MessageBubbleProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { MessageFilesProps } from '../models/sdk.interface';
|
|
2
|
-
/** A message's files: images
|
|
2
|
+
/** A message's files: images that open in the viewer, a bone while each one's link is signed, other files to open. */
|
|
3
3
|
export declare function MessageFiles({ attachments, own, stored }: MessageFilesProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { MessageListProps } from '../models/sdk.interface';
|
|
2
2
|
/**
|
|
3
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.
|
|
4
|
+
* new messages stay in view, and older ones loaded at the top keep the reader's place. Scrolled up, a button goes back
|
|
5
|
+
* to the latest message; the Contact's own message brings them back too.
|
|
5
6
|
*/
|
|
6
7
|
export declare function MessageList({ state }: MessageListProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { MessageMetaProps } from '../models/sdk.interface';
|
|
2
|
+
/** Under the last message of a run: its time, and for the Contact's own how far it went, or why it did not go. */
|
|
3
|
+
export declare function MessageMeta({ row, onRetry }: MessageMetaProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { PendingPhotosProps } from '../models/sdk.interface';
|
|
2
|
+
/** The photos going with the next message, above the field: a spinner while each uploads, red when it did not. */
|
|
3
|
+
export declare function PendingPhotos({ photos, locked, onRemove }: PendingPhotosProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/** The badge the Plan shows, in the product's own colour. */
|
|
1
|
+
/** The badge the Plan shows, in the product's own colour. Opens the public site. */
|
|
2
2
|
export declare function PoweredBy(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { TypingBubbleProps } from '../models/sdk.interface';
|
|
2
|
-
/** Three dots while a Member writes a reply. */
|
|
2
|
+
/** Three dots that bounce in turn while a Member writes a reply. */
|
|
3
3
|
export declare function TypingBubble({ app, sender }: TypingBubbleProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,4 +3,4 @@ import type { ZeanChatProps } from '../interfaces';
|
|
|
3
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
4
|
* `open()` from `useZean()` is called, and shows nothing until then.
|
|
5
5
|
*/
|
|
6
|
-
export declare function ZeanChat({ appKey, storage, user, attributes, locale, colorScheme, backendUrl }: ZeanChatProps): import("react/jsx-runtime").JSX.Element | null;
|
|
6
|
+
export declare function ZeanChat({ appKey, storage, user, attributes, locale, colorScheme, maxPhotos, backendUrl }: ZeanChatProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { ComponentRef, RefObject } from 'react';
|
|
2
2
|
import type { View } from 'react-native';
|
|
3
3
|
/**
|
|
4
|
-
* How much of the chat the keyboard covers: the chat lifts its message field by as much.
|
|
5
|
-
* bottom
|
|
6
|
-
*
|
|
4
|
+
* How much of the chat the keyboard covers: the chat lifts its message field by as much. On iOS the chat reaches the
|
|
5
|
+
* screen's bottom, so it is the screen below the keyboard's top, followed as the keyboard moves, with the keyboard's own
|
|
6
|
+
* timing and curve: on show, on hide, and when it changes height (the emoji keyboard, the suggestions bar). On Android
|
|
7
|
+
* there is no event before the keyboard moves: it is measured once shown, since the window may also shrink above it.
|
|
7
8
|
*/
|
|
8
9
|
export declare function useKeyboardOverlap(ref: RefObject<ComponentRef<typeof View> | null>): number;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import type { ChatAttachment } from '@zean/sdk-core';
|
|
2
2
|
import type { PendingPhoto, PickedPhoto } from '../models/sdk.interface';
|
|
3
|
-
/** Photos picked for the next message:
|
|
3
|
+
/** Photos picked for the next message: shown at once, uploaded only when the message is sent. */
|
|
4
4
|
export declare function usePendingPhotos(): {
|
|
5
5
|
photos: PendingPhoto[];
|
|
6
6
|
problem: string | null;
|
|
7
7
|
/** Photos that still fit in the message. */
|
|
8
8
|
room: number;
|
|
9
|
+
/** Why no more photos fit. */
|
|
10
|
+
tooMany: string;
|
|
9
11
|
add: (picked: ReadonlyArray<PickedPhoto>) => void;
|
|
10
12
|
remove: (id: string) => void;
|
|
11
|
-
|
|
13
|
+
send: () => Promise<Array<ChatAttachment> | null>;
|
|
14
|
+
sending: boolean;
|
|
12
15
|
showProblem: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
13
|
-
uploading: boolean;
|
|
14
|
-
ready: boolean;
|
|
15
16
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Animated } from 'react-native';
|
|
2
|
+
/** The style that fades a new message up into place. Anything already there when the chat opened stays still. */
|
|
3
|
+
export declare function useRiseIn(fresh: boolean): {
|
|
4
|
+
opacity: Animated.Value;
|
|
5
|
+
transform: {
|
|
6
|
+
translateY: Animated.Interpolation<0 | 8>;
|
|
7
|
+
}[];
|
|
8
|
+
};
|
package/dist/i18n/en.d.ts
CHANGED
|
@@ -39,7 +39,12 @@ export declare const en: {
|
|
|
39
39
|
photo_type: string;
|
|
40
40
|
photo_size: string;
|
|
41
41
|
too_many: string;
|
|
42
|
+
too_many_one: string;
|
|
42
43
|
open_image: string;
|
|
43
44
|
close_image: string;
|
|
44
45
|
open_file: string;
|
|
46
|
+
today: string;
|
|
47
|
+
yesterday: string;
|
|
48
|
+
newest: string;
|
|
49
|
+
image_count: string;
|
|
45
50
|
};
|
package/dist/i18n/fr.d.ts
CHANGED
|
@@ -40,7 +40,12 @@ export declare const fr: {
|
|
|
40
40
|
photo_type: string;
|
|
41
41
|
photo_size: string;
|
|
42
42
|
too_many: string;
|
|
43
|
+
too_many_one: string;
|
|
43
44
|
open_image: string;
|
|
44
45
|
close_image: string;
|
|
45
46
|
open_file: string;
|
|
47
|
+
today: string;
|
|
48
|
+
yesterday: string;
|
|
49
|
+
newest: string;
|
|
50
|
+
image_count: string;
|
|
46
51
|
};
|