@zean-chat/react-native 0.1.14 → 0.1.16
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/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 -1
- package/dist/i18n/fr.d.ts +4 -1
- package/dist/index.js +758 -309
- package/dist/models/conversation.utils.d.ts +6 -2
- package/dist/models/sdk.constants.d.ts +5 -0
- package/dist/models/sdk.interface.d.ts +38 -8
- package/dist/models/sdk.utils.d.ts +7 -2
- package/package.json +6 -2
|
@@ -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,11 +1,16 @@
|
|
|
1
1
|
import type { IconName, NeutralColors } from './sdk.interface';
|
|
2
2
|
import type { ZeanColorScheme } from '../interfaces';
|
|
3
|
+
import type { DeviceType } from '@zean/shared/constants/widget';
|
|
3
4
|
/** How long the connection is down before the chat says so: a short blip is not worth a notice. */
|
|
4
5
|
export declare const OFFLINE_NOTICE_MS = 3000;
|
|
5
6
|
/** Android's navigation bar with its three buttons, in points: the gesture bar is half as tall. */
|
|
6
7
|
export declare const ANDROID_NAVIGATION_BAR = 48;
|
|
7
8
|
/** Photos a Contact sends in one message, unless `ZeanChat`'s `maxPhotos` says otherwise. */
|
|
8
9
|
export declare const DEFAULT_MAX_PHOTOS = 4;
|
|
10
|
+
/** Android calls a device whose shorter screen side is this many dp or more a tablet. */
|
|
11
|
+
export declare const ANDROID_TABLET_SIDE = 600;
|
|
12
|
+
/** `expo-device`'s `deviceType` numbers: a TV, or one it cannot tell, is left to React Native. */
|
|
13
|
+
export declare const EXPO_DEVICE_TYPES: Partial<Record<number, DeviceType>>;
|
|
9
14
|
/** The chat's own MMKV instance, apart from the app's. */
|
|
10
15
|
export declare const CHAT_STORAGE_ID = "zean-chat";
|
|
11
16
|
/** A photo's link asked for before its message is stored is refused: asked again this often, a few times. */
|
|
@@ -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;
|
|
@@ -240,16 +256,30 @@ export interface MMKVModule {
|
|
|
240
256
|
id: string;
|
|
241
257
|
}) => ZeanMMKV;
|
|
242
258
|
}
|
|
243
|
-
/** `expo-application`: the app's Bundle ID on iOS, its Package name on Android. */
|
|
259
|
+
/** `expo-application`: the app's Bundle ID on iOS, its Package name on Android, its version and its build. */
|
|
244
260
|
export interface ExpoApplicationModule {
|
|
245
261
|
applicationId: string | null;
|
|
262
|
+
nativeApplicationVersion: string | null;
|
|
263
|
+
nativeBuildVersion: string | null;
|
|
246
264
|
}
|
|
247
|
-
/** `
|
|
248
|
-
export interface
|
|
265
|
+
/** `expo-device`: the exact model, as "iPhone 16 Pro", its brand, and its kind as a number. */
|
|
266
|
+
export interface ExpoDeviceModule {
|
|
267
|
+
modelName: string | null;
|
|
268
|
+
brand: string | null;
|
|
269
|
+
deviceType: number | null;
|
|
270
|
+
}
|
|
271
|
+
/** What the chat reads from `react-native-device-info`. */
|
|
272
|
+
export interface DeviceInfoFunctions {
|
|
249
273
|
getBundleId?: () => string;
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
274
|
+
getModel?: () => string;
|
|
275
|
+
getBrand?: () => string;
|
|
276
|
+
isTablet?: () => boolean;
|
|
277
|
+
getVersion?: () => string;
|
|
278
|
+
getBuildNumber?: () => string;
|
|
279
|
+
}
|
|
280
|
+
/** `react-native-device-info`, its named exports or its default one. */
|
|
281
|
+
export interface DeviceInfoModule extends DeviceInfoFunctions {
|
|
282
|
+
default?: DeviceInfoFunctions;
|
|
253
283
|
}
|
|
254
284
|
export interface ImagePickerModule {
|
|
255
285
|
launchImageLibrary: (options: ImagePickerOptions) => Promise<ImagePickerResult>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ChatColors, ScreenInsets } from './sdk.interface';
|
|
2
2
|
import type { AppBundle, ChatStorage } from '@zean/sdk-core';
|
|
3
|
+
import type { DeviceDetails } from '@zean/shared/interfaces/widget';
|
|
3
4
|
import type { ZeanColorScheme, ZeanStorage } from '../interfaces';
|
|
4
5
|
/** `{name}` in a text, filled from `values`. */
|
|
5
6
|
export declare function format(template: string, values: Record<string, string | number>): string;
|
|
@@ -33,8 +34,12 @@ export declare function isDevBuild(): boolean;
|
|
|
33
34
|
* deliver it.
|
|
34
35
|
*/
|
|
35
36
|
export declare function isZeanNotification(data: unknown): boolean;
|
|
36
|
-
/**
|
|
37
|
-
|
|
37
|
+
/**
|
|
38
|
+
* The Contact's Device details, with nothing for the app to install. React Native gives the system, the screen and, on
|
|
39
|
+
* Android, the brand and model. An app that already has `expo-device`, `expo-application` or `react-native-device-info`
|
|
40
|
+
* also gives the exact model and its own version. Unknown details are left out.
|
|
41
|
+
*/
|
|
42
|
+
export declare function deviceDetails(): DeviceDetails;
|
|
38
43
|
/**
|
|
39
44
|
* The room the system takes at the top and the bottom of the chat, without a native module. On Android and on an iPad
|
|
40
45
|
* the chat covers the whole screen, under the status bar and the navigation bar. On an iPhone it is a sheet below the
|
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.16",
|
|
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",
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"@react-native-async-storage/async-storage": "*",
|
|
60
60
|
"expo-application": "*",
|
|
61
|
+
"expo-device": "*",
|
|
61
62
|
"expo-image-picker": "*",
|
|
62
63
|
"expo-sqlite": "*",
|
|
63
64
|
"react": ">=19",
|
|
@@ -70,6 +71,9 @@
|
|
|
70
71
|
"expo-application": {
|
|
71
72
|
"optional": true
|
|
72
73
|
},
|
|
74
|
+
"expo-device": {
|
|
75
|
+
"optional": true
|
|
76
|
+
},
|
|
73
77
|
"react-native-device-info": {
|
|
74
78
|
"optional": true
|
|
75
79
|
},
|
|
@@ -102,7 +106,7 @@
|
|
|
102
106
|
"convex": "1.46.0",
|
|
103
107
|
"jest": "29.7.0",
|
|
104
108
|
"react": "19.3.0",
|
|
105
|
-
"react-native": "0.88.
|
|
109
|
+
"react-native": "0.88.1",
|
|
106
110
|
"test-renderer": "1.3.1",
|
|
107
111
|
"typescript": "6.0.3",
|
|
108
112
|
"vitest": "4.1.11"
|