@zean-chat/react-native 0.1.13 → 0.1.15
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 +2 -0
- package/dist/components/Composer.d.ts +1 -1
- package/dist/components/MessageBubble.d.ts +3 -2
- package/dist/components/MessageQuote.d.ts +3 -0
- package/dist/hooks/use-pending-photos.d.ts +5 -1
- package/dist/i18n/en.d.ts +4 -0
- package/dist/i18n/fr.d.ts +4 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +537 -256
- package/dist/interfaces.d.ts +10 -1
- package/dist/models/conversation.utils.d.ts +6 -2
- package/dist/models/sdk.interface.d.ts +18 -2
- package/dist/models/sdk.store.d.ts +4 -0
- package/package.json +1 -1
package/dist/interfaces.d.ts
CHANGED
|
@@ -50,9 +50,18 @@ export interface ZeanChatProps {
|
|
|
50
50
|
*/
|
|
51
51
|
backendUrl?: string;
|
|
52
52
|
}
|
|
53
|
+
/** How `open()` opens the chat. */
|
|
54
|
+
export interface ZeanOpenOptions {
|
|
55
|
+
/**
|
|
56
|
+
* Text put in the message field, in place of what it held: the person reads it, edits it and sends it. Nothing is
|
|
57
|
+
* sent until they do. Cut at 5,000 characters.
|
|
58
|
+
*/
|
|
59
|
+
message?: string;
|
|
60
|
+
}
|
|
53
61
|
/** The chat's methods, and the count of replies the Contact has not seen. */
|
|
54
62
|
export interface ZeanControls {
|
|
55
|
-
|
|
63
|
+
/** Opens the chat; with `message`, that text waits in the message field. */
|
|
64
|
+
open: (options?: ZeanOpenOptions) => void;
|
|
56
65
|
close: () => void;
|
|
57
66
|
toggle: () => void;
|
|
58
67
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ChatMessage } from '@zean/sdk-core';
|
|
1
|
+
import type { ChatDraftFile, ChatMessage } from '@zean/sdk-core';
|
|
2
2
|
import type { Locale } from '@zean/shared/constants/app';
|
|
3
|
-
import type { ConversationRow } from './sdk.interface';
|
|
3
|
+
import type { ConversationRow, PendingPhoto } from './sdk.interface';
|
|
4
4
|
import type { fr } from '../i18n/fr';
|
|
5
5
|
/**
|
|
6
6
|
* The Conversation, oldest first, with what each message's neighbours decide about it: where runs by one sender start
|
|
@@ -13,3 +13,7 @@ export declare function conversationRows(messages: ReadonlyArray<ChatMessage>, s
|
|
|
13
13
|
export declare function messageTime(timestamp: number, locale: Locale): string;
|
|
14
14
|
/** The day above its messages: today, yesterday, the weekday within the week, then the date, with its year if not this one. */
|
|
15
15
|
export declare function dayLabel(timestamp: number, now: number, locale: Locale, t: Pick<typeof fr, 'today' | 'yesterday'>): string;
|
|
16
|
+
/** The Draft's photos back in the composer, from their file on the phone: uploaded ones ready, the others to upload. */
|
|
17
|
+
export declare function pendingPhotosOfDraft(files: ReadonlyArray<ChatDraftFile>, newId: () => string): Array<PendingPhoto>;
|
|
18
|
+
/** What the Draft keeps of the photos: each one's own file, and its upload once done. */
|
|
19
|
+
export declare function draftFilesOf(photos: ReadonlyArray<PendingPhoto>): Array<ChatDraftFile>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Chat, ChatApp, ChatAttachment, ChatMessage, ChatResult, ChatSender, ChatState } from '@zean/sdk-core';
|
|
1
|
+
import type { Chat, ChatApp, ChatAttachment, ChatMessage, ChatQuote, ChatResult, ChatSender, ChatState } from '@zean/sdk-core';
|
|
2
2
|
import type { Locale } from '@zean/shared/constants/app';
|
|
3
3
|
import type { AccentColors } from '@zean/shared/interfaces/widget';
|
|
4
4
|
import type { ReactNode } from 'react';
|
|
@@ -121,7 +121,23 @@ export interface MessageListProps {
|
|
|
121
121
|
export interface MessageBubbleProps {
|
|
122
122
|
row: ConversationRow;
|
|
123
123
|
app: ChatApp;
|
|
124
|
-
|
|
124
|
+
/** Sends the message again, by its id. */
|
|
125
|
+
onRetry: (messageId: string) => void;
|
|
126
|
+
/** Goes to the message this reply quotes, by the reply's id: older messages are read first when needed. */
|
|
127
|
+
onQuote: (replyId: string) => void;
|
|
128
|
+
/** Just gone to from a quote: flashed for a moment. */
|
|
129
|
+
highlighted: boolean;
|
|
130
|
+
}
|
|
131
|
+
export interface MessageQuoteProps {
|
|
132
|
+
quote: ChatQuote;
|
|
133
|
+
app: ChatApp;
|
|
134
|
+
/** Goes to the quoted message: pressable unless it was deleted. */
|
|
135
|
+
onQuote: () => void;
|
|
136
|
+
}
|
|
137
|
+
/** What a FlatList says when the row it was asked to go to is not laid out yet. */
|
|
138
|
+
export interface ScrollToIndexFailure {
|
|
139
|
+
index: number;
|
|
140
|
+
averageItemLength: number;
|
|
125
141
|
}
|
|
126
142
|
export interface MessageMetaProps {
|
|
127
143
|
row: ConversationRow;
|
|
@@ -12,4 +12,8 @@ export declare function openFromNotification(data: unknown): boolean;
|
|
|
12
12
|
export declare function attachChat(next: Chat): () => void;
|
|
13
13
|
/** Whether the chat is open and how many replies wait: the same object until one changes. */
|
|
14
14
|
export declare function chatView(): ChatView;
|
|
15
|
+
/** The text waiting for the message field, or null. */
|
|
16
|
+
export declare function chatDraft(): string | null;
|
|
17
|
+
/** The message field took the draft. */
|
|
18
|
+
export declare function clearDraft(): void;
|
|
15
19
|
export declare function subscribeChatView(listener: () => void): () => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zean-chat/react-native",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"description": "In-app support chat for React Native and Expo, iOS and Android. Pure JS, no native module. A free Intercom, Crisp and Zendesk mobile SDK alternative.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|