@zean-chat/react-native 0.1.7 → 0.1.10
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/dist/components/AppMark.d.ts +1 -1
- package/dist/components/ChatHeader.d.ts +1 -1
- package/dist/components/ChatModal.d.ts +1 -1
- package/dist/components/ChatNotice.d.ts +1 -1
- package/dist/components/ChatScreen.d.ts +1 -1
- package/dist/components/Composer.d.ts +1 -1
- package/dist/components/ContactCodeCard.d.ts +3 -3
- package/dist/components/EmailForm.d.ts +1 -1
- package/dist/components/Icon.d.ts +1 -1
- package/dist/components/ImageViewer.d.ts +1 -1
- package/dist/components/MessageBubble.d.ts +1 -1
- package/dist/components/MessageFiles.d.ts +1 -1
- package/dist/components/MessageList.d.ts +1 -1
- package/dist/components/MessageMeta.d.ts +1 -1
- package/dist/components/PendingPhotos.d.ts +1 -1
- package/dist/components/PoweredBy.d.ts +1 -1
- package/dist/components/Skeleton.d.ts +1 -1
- package/dist/components/TeamAvatar.d.ts +2 -2
- package/dist/components/TypingBubble.d.ts +1 -1
- package/dist/components/ZeanChat.d.ts +1 -1
- package/dist/i18n/en.d.ts +4 -0
- package/dist/i18n/fr.d.ts +4 -0
- package/dist/index.js +100 -25
- package/dist/models/sdk.interface.d.ts +3 -1
- package/package.json +6 -6
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { AppMarkProps } from '../models/sdk.interface';
|
|
2
2
|
/** The App in the header: its logo in a circle, as the dashboard shows it, else a chat bubble in its colour. */
|
|
3
|
-
export declare function AppMark({ app }: AppMarkProps): import("react
|
|
3
|
+
export declare function AppMark({ app }: AppMarkProps): import("react").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ChatHeaderProps } from '../models/sdk.interface';
|
|
2
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
|
|
3
|
+
export declare function ChatHeader({ app, online, topInset, onClose }: ChatHeaderProps): import("react").JSX.Element;
|
|
@@ -4,4 +4,4 @@ import type { ChatModalProps } from '../models/sdk.interface';
|
|
|
4
4
|
* screen on Android, closed with back, and on an iPad. It shows once the App and the Conversation are loaded, in the
|
|
5
5
|
* App's colour and the Contact's language.
|
|
6
6
|
*/
|
|
7
|
-
export declare function ChatModal({ chat, colorScheme, maxPhotos }: ChatModalProps): import("react
|
|
7
|
+
export declare function ChatModal({ chat, colorScheme, maxPhotos }: ChatModalProps): import("react").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ChatNoticeProps } from '../models/sdk.interface';
|
|
2
2
|
/** A card from the chat itself: offline, blocked, unavailable. */
|
|
3
|
-
export declare function ChatNotice({ children }: ChatNoticeProps): import("react
|
|
3
|
+
export declare function ChatNotice({ children }: ChatNoticeProps): import("react").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ChatScreenProps } from '../models/sdk.interface';
|
|
2
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
|
|
3
|
+
export declare function ChatScreen({ state, insets, onClose }: ChatScreenProps): import("react").JSX.Element;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
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
4
|
* Picked photos show above the field and upload when the message is sent.
|
|
5
5
|
*/
|
|
6
|
-
export declare function Composer(): import("react
|
|
6
|
+
export declare function Composer(): import("react").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ContactCodeCardProps } from '../models/sdk.interface';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* A Contact code to the person's email: it joins this device to their Conversation (ADR 0010), or brings in what they
|
|
4
|
+
* wrote before signing in (ADR 0014). The code field takes the code the phone offers from the email.
|
|
5
5
|
*/
|
|
6
|
-
export declare function ContactCodeCard({ code, onDismiss }: ContactCodeCardProps): import("react
|
|
6
|
+
export declare function ContactCodeCard({ code, onDismiss }: ContactCodeCardProps): import("react").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { EmailFormProps } from '../models/sdk.interface';
|
|
2
2
|
/** Asked once the Contact has written, until they leave an email: where the team reaches them back. */
|
|
3
|
-
export declare function EmailForm({ onSubmit }: EmailFormProps): import("react
|
|
3
|
+
export declare function EmailForm({ onSubmit }: EmailFormProps): import("react").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { IconProps } from '../models/sdk.interface';
|
|
2
2
|
/** One of the chat's icons, in a colour. Decorative: the button around it carries the name. */
|
|
3
|
-
export declare function Icon({ name, color, size }: IconProps): import("react
|
|
3
|
+
export declare function Icon({ name, color, size }: IconProps): import("react").JSX.Element;
|
|
@@ -3,4 +3,4 @@ import type { ImageViewerProps } from '../models/sdk.interface';
|
|
|
3
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
4
|
* or Android's back, goes back to the chat.
|
|
5
5
|
*/
|
|
6
|
-
export declare function ImageViewer({ gallery, topInset, onClose }: ImageViewerProps): import("react
|
|
6
|
+
export declare function ImageViewer({ gallery, topInset, onClose }: ImageViewerProps): import("react").JSX.Element;
|
|
@@ -3,4 +3,4 @@ import type { MessageBubbleProps } from '../models/sdk.interface';
|
|
|
3
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
4
|
* Messages of a run sit close, with tight corners where they meet; the run's last one carries the time.
|
|
5
5
|
*/
|
|
6
|
-
export declare function MessageBubble({ row, app, onRetry }: MessageBubbleProps): import("react
|
|
6
|
+
export declare function MessageBubble({ row, app, onRetry }: MessageBubbleProps): import("react").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { MessageFilesProps } from '../models/sdk.interface';
|
|
2
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
|
-
export declare function MessageFiles({ attachments, own, stored }: MessageFilesProps): import("react
|
|
3
|
+
export declare function MessageFiles({ attachments, own, stored }: MessageFilesProps): import("react").JSX.Element | null;
|
|
@@ -4,4 +4,4 @@ import type { MessageListProps } from '../models/sdk.interface';
|
|
|
4
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
5
|
* to the latest message; the Contact's own message brings them back too.
|
|
6
6
|
*/
|
|
7
|
-
export declare function MessageList({ state }: MessageListProps): import("react
|
|
7
|
+
export declare function MessageList({ state }: MessageListProps): import("react").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { MessageMetaProps } from '../models/sdk.interface';
|
|
2
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
|
|
3
|
+
export declare function MessageMeta({ row, onRetry }: MessageMetaProps): import("react").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { PendingPhotosProps } from '../models/sdk.interface';
|
|
2
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
|
|
3
|
+
export declare function PendingPhotos({ photos, locked, onRemove }: PendingPhotosProps): import("react").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** The badge the Plan shows, in the product's own colour. Opens the public site. */
|
|
2
|
-
export declare function PoweredBy(): import("react
|
|
2
|
+
export declare function PoweredBy(): import("react").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { SkeletonProps } from '../models/sdk.interface';
|
|
2
2
|
/** A bone that breathes where something is loading. Its size and shape come from `style`. */
|
|
3
|
-
export declare function Skeleton({ style }: SkeletonProps): import("react
|
|
3
|
+
export declare function Skeleton({ style }: SkeletonProps): import("react").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
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
|
|
2
|
+
/** Beside the team's messages: the Member's photo or initials, else the App's logo or initial; for an AI reply, the sparkles. */
|
|
3
|
+
export declare function TeamAvatar({ app, sender, ai }: TeamAvatarProps): import("react").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { TypingBubbleProps } from '../models/sdk.interface';
|
|
2
2
|
/** Three dots that bounce in turn while a Member writes a reply. */
|
|
3
|
-
export declare function TypingBubble({ app, sender }: TypingBubbleProps): import("react
|
|
3
|
+
export declare function TypingBubble({ app, sender }: TypingBubbleProps): import("react").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, maxPhotos, backendUrl }: ZeanChatProps): import("react
|
|
6
|
+
export declare function ZeanChat({ appKey, storage, user, attributes, locale, colorScheme, maxPhotos, backendUrl }: ZeanChatProps): import("react").JSX.Element | null;
|
package/dist/i18n/en.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export declare const en: {
|
|
2
|
+
ai: string;
|
|
3
|
+
request_human: string;
|
|
2
4
|
close_chat: string;
|
|
3
5
|
online: string;
|
|
4
6
|
away: string;
|
|
@@ -24,6 +26,7 @@ export declare const en: {
|
|
|
24
26
|
email_saved: string;
|
|
25
27
|
error: string;
|
|
26
28
|
code_prompt: string;
|
|
29
|
+
code_prompt_earlier: string;
|
|
27
30
|
code_send: string;
|
|
28
31
|
code_label: string;
|
|
29
32
|
code_submit: string;
|
|
@@ -32,6 +35,7 @@ export declare const en: {
|
|
|
32
35
|
code_expired: string;
|
|
33
36
|
code_rate_limited: string;
|
|
34
37
|
code_dismiss: string;
|
|
38
|
+
code_not_me: string;
|
|
35
39
|
attach: string;
|
|
36
40
|
uploading: string;
|
|
37
41
|
ready: string;
|
package/dist/i18n/fr.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** The chat's words, the same as the web widget's. French is the reference: `en.ts` carries the same keys. */
|
|
2
2
|
export declare const fr: {
|
|
3
|
+
ai: string;
|
|
4
|
+
request_human: string;
|
|
3
5
|
close_chat: string;
|
|
4
6
|
online: string;
|
|
5
7
|
away: string;
|
|
@@ -25,6 +27,7 @@ export declare const fr: {
|
|
|
25
27
|
email_saved: string;
|
|
26
28
|
error: string;
|
|
27
29
|
code_prompt: string;
|
|
30
|
+
code_prompt_earlier: string;
|
|
28
31
|
code_send: string;
|
|
29
32
|
code_label: string;
|
|
30
33
|
code_submit: string;
|
|
@@ -33,6 +36,7 @@ export declare const fr: {
|
|
|
33
36
|
code_expired: string;
|
|
34
37
|
code_rate_limited: string;
|
|
35
38
|
code_dismiss: string;
|
|
39
|
+
code_not_me: string;
|
|
36
40
|
attach: string;
|
|
37
41
|
uploading: string;
|
|
38
42
|
ready: string;
|
package/dist/index.js
CHANGED
|
@@ -208,6 +208,9 @@ var KEPT_MESSAGES = 100;
|
|
|
208
208
|
var KEPT_VERSION = 1;
|
|
209
209
|
var LIVE_AFTER_CLOSE_MS = 2 * 6e4;
|
|
210
210
|
var ADVANCE_AFTER = WIDGET_PAGE_SIZE / 2;
|
|
211
|
+
function emailKey(offer) {
|
|
212
|
+
return `${offer.kind}:${offer.email}`;
|
|
213
|
+
}
|
|
211
214
|
function createChatStore(backend, options) {
|
|
212
215
|
const secretKey = `zean:${options.appKey}:device`;
|
|
213
216
|
const outboxKey = `zean:${options.appKey}:outbox`;
|
|
@@ -241,7 +244,10 @@ function createChatStore(backend, options) {
|
|
|
241
244
|
let started = false;
|
|
242
245
|
let reported = false;
|
|
243
246
|
let user = null;
|
|
244
|
-
let
|
|
247
|
+
let idCode = null;
|
|
248
|
+
let idCodeDismissed = false;
|
|
249
|
+
let emailCodeSent = null;
|
|
250
|
+
let emailCodeDismissed = null;
|
|
245
251
|
let emailGiven = false;
|
|
246
252
|
let wroteHere = false;
|
|
247
253
|
let emailAskWanted = false;
|
|
@@ -260,11 +266,13 @@ function createChatStore(backend, options) {
|
|
|
260
266
|
};
|
|
261
267
|
const args = () => ({ appKey: options.appKey, deviceSecret, host: options.host, bundle: options.bundle });
|
|
262
268
|
const deviceLanguage = options.deviceLanguage ?? options.languages[0];
|
|
269
|
+
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
263
270
|
const device = () => ({
|
|
264
271
|
locale: state.locale,
|
|
265
272
|
...deviceLanguage ? { language: deviceLanguage } : {},
|
|
266
273
|
browser: options.browser,
|
|
267
|
-
os: options.os
|
|
274
|
+
os: options.os,
|
|
275
|
+
timeZone
|
|
268
276
|
});
|
|
269
277
|
const deviceWaiters = [];
|
|
270
278
|
const useSecret = (secret) => {
|
|
@@ -292,7 +300,6 @@ function createChatStore(backend, options) {
|
|
|
292
300
|
stops.push(() => clearInterval(clock));
|
|
293
301
|
})();
|
|
294
302
|
function watchAll() {
|
|
295
|
-
for (const stop of watchers) stop();
|
|
296
303
|
watchers = [
|
|
297
304
|
backend.watch("session", args(), handleSession, () => {
|
|
298
305
|
failedToLoad = true;
|
|
@@ -353,7 +360,7 @@ function createChatStore(backend, options) {
|
|
|
353
360
|
try {
|
|
354
361
|
const result = await backend.call("identify", { ...args(), user: person, device: device() });
|
|
355
362
|
if (mine !== generation) return;
|
|
356
|
-
|
|
363
|
+
idCode = result.state === "code_available" ? { email: result.email, sent: idCode?.sent ?? false } : null;
|
|
357
364
|
identified = true;
|
|
358
365
|
emit2();
|
|
359
366
|
} catch (error) {
|
|
@@ -463,6 +470,8 @@ function createChatStore(backend, options) {
|
|
|
463
470
|
outbox = outbox.filter((other) => other.clientId !== entry.clientId);
|
|
464
471
|
saveOutbox();
|
|
465
472
|
emit2();
|
|
473
|
+
backend.reportCountry({ ...args(), timeZone, language: deviceLanguage }).catch(() => {
|
|
474
|
+
});
|
|
466
475
|
},
|
|
467
476
|
(error) => {
|
|
468
477
|
outbox = outbox.map((other) => other.clientId === entry.clientId ? { ...other, error: codeOf(error) } : other);
|
|
@@ -479,7 +488,7 @@ function createChatStore(backend, options) {
|
|
|
479
488
|
function wantsEmail() {
|
|
480
489
|
const app = session && "app" in session ? session.app : null;
|
|
481
490
|
const contact = session && "contact" in session ? session.contact : null;
|
|
482
|
-
return statusOf() === "ready" && !!contact && contact.email === null && !emailGiven &&
|
|
491
|
+
return statusOf() === "ready" && !!contact && contact.email === null && !emailGiven && app?.askEmail === true;
|
|
483
492
|
}
|
|
484
493
|
function holdEmailAsk() {
|
|
485
494
|
const wanted = wantsEmail();
|
|
@@ -532,10 +541,16 @@ function createChatStore(backend, options) {
|
|
|
532
541
|
askEmail: emailAskWanted && !emailAskTimer,
|
|
533
542
|
emailGiven,
|
|
534
543
|
verified,
|
|
535
|
-
contactCode: verified
|
|
544
|
+
contactCode: codeOffer(verified),
|
|
536
545
|
connected
|
|
537
546
|
};
|
|
538
547
|
}
|
|
548
|
+
function codeOffer(verified) {
|
|
549
|
+
if (idCode && !verified) return idCodeDismissed ? null : { kind: "id", ...idCode };
|
|
550
|
+
const offer = session && "emailCode" in session ? session.emailCode : null;
|
|
551
|
+
if (!offer || emailKey(offer) === emailCodeDismissed) return null;
|
|
552
|
+
return { ...offer, sent: emailKey(offer) === emailCodeSent };
|
|
553
|
+
}
|
|
539
554
|
function checkKept(result) {
|
|
540
555
|
const history = "contact" in result ? result.contact?.historyKey ?? null : null;
|
|
541
556
|
if (history !== keptHistory) {
|
|
@@ -545,7 +560,7 @@ function createChatStore(backend, options) {
|
|
|
545
560
|
if (hidesChat(result)) forgetKept();
|
|
546
561
|
else if (history !== null && !stopMessages && serverMessages().length === 0 && deviceSecret) {
|
|
547
562
|
watchLive();
|
|
548
|
-
|
|
563
|
+
stopLiveLater();
|
|
549
564
|
} else saveKept();
|
|
550
565
|
}
|
|
551
566
|
async function loadKept() {
|
|
@@ -744,7 +759,8 @@ function createChatStore(backend, options) {
|
|
|
744
759
|
}
|
|
745
760
|
if (user?.id !== person.id) {
|
|
746
761
|
generation += 1;
|
|
747
|
-
|
|
762
|
+
idCode = null;
|
|
763
|
+
idCodeDismissed = false;
|
|
748
764
|
emailGiven = false;
|
|
749
765
|
}
|
|
750
766
|
user = person;
|
|
@@ -752,12 +768,17 @@ function createChatStore(backend, options) {
|
|
|
752
768
|
await sendIdentity();
|
|
753
769
|
},
|
|
754
770
|
async requestCode() {
|
|
771
|
+
const offer = state.contactCode;
|
|
755
772
|
const person = user;
|
|
756
|
-
if (!
|
|
773
|
+
if (!deviceSecret || !offer || offer.kind === "id" && !person) return { ok: false, code: "not_found" };
|
|
757
774
|
try {
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
775
|
+
if (offer.kind !== "id") {
|
|
776
|
+
await backend.call("requestEmailCode", args());
|
|
777
|
+
emailCodeSent = emailKey(offer);
|
|
778
|
+
} else {
|
|
779
|
+
await backend.call("requestCode", { ...args(), userId: person.id });
|
|
780
|
+
if (idCode && user === person) idCode = { ...idCode, sent: true };
|
|
781
|
+
}
|
|
761
782
|
emit2();
|
|
762
783
|
return { ok: true };
|
|
763
784
|
} catch (error) {
|
|
@@ -765,12 +786,20 @@ function createChatStore(backend, options) {
|
|
|
765
786
|
}
|
|
766
787
|
},
|
|
767
788
|
async confirmCode(code2) {
|
|
789
|
+
const offer = state.contactCode;
|
|
768
790
|
const person = user;
|
|
769
|
-
if (!
|
|
791
|
+
if (!deviceSecret || !offer || offer.kind === "id" && !person) return { ok: false, code: "not_found" };
|
|
770
792
|
try {
|
|
793
|
+
if (offer.kind !== "id") {
|
|
794
|
+
const result2 = await backend.call("confirmEmailCode", { ...args(), code: code2 });
|
|
795
|
+
if (!result2.ok) return result2;
|
|
796
|
+
emailCodeSent = null;
|
|
797
|
+
emit2();
|
|
798
|
+
return { ok: true };
|
|
799
|
+
}
|
|
771
800
|
const result = await backend.call("confirmCode", { ...args(), userId: person.id, code: code2 });
|
|
772
801
|
if (!result.ok) return result;
|
|
773
|
-
|
|
802
|
+
idCode = null;
|
|
774
803
|
emit2();
|
|
775
804
|
void sendIdentity();
|
|
776
805
|
return { ok: true };
|
|
@@ -778,6 +807,17 @@ function createChatStore(backend, options) {
|
|
|
778
807
|
return { ok: false, code: codeOf(error) };
|
|
779
808
|
}
|
|
780
809
|
},
|
|
810
|
+
dismissCode() {
|
|
811
|
+
const offer = state.contactCode;
|
|
812
|
+
if (!offer) return;
|
|
813
|
+
if (offer.kind === "id") idCodeDismissed = true;
|
|
814
|
+
else {
|
|
815
|
+
emailCodeDismissed = emailKey(offer);
|
|
816
|
+
backend.call("dismissEmailCode", args()).catch(() => {
|
|
817
|
+
});
|
|
818
|
+
}
|
|
819
|
+
emit2();
|
|
820
|
+
},
|
|
781
821
|
async signOut() {
|
|
782
822
|
generation += 1;
|
|
783
823
|
const mine = generation;
|
|
@@ -785,7 +825,10 @@ function createChatStore(backend, options) {
|
|
|
785
825
|
if (mine !== generation) return;
|
|
786
826
|
user = null;
|
|
787
827
|
identified = false;
|
|
788
|
-
|
|
828
|
+
idCode = null;
|
|
829
|
+
idCodeDismissed = false;
|
|
830
|
+
emailCodeSent = null;
|
|
831
|
+
emailCodeDismissed = null;
|
|
789
832
|
emailGiven = false;
|
|
790
833
|
identifying = null;
|
|
791
834
|
identifiedKnown = false;
|
|
@@ -6201,6 +6244,14 @@ function convexBackend(url) {
|
|
|
6201
6244
|
throw withCode(error);
|
|
6202
6245
|
});
|
|
6203
6246
|
},
|
|
6247
|
+
// A WebSocket hides the connection from Convex functions: a plain request to an HTTP action, through Cloudflare.
|
|
6248
|
+
reportCountry: async (report) => {
|
|
6249
|
+
const response = await fetch(`${url.replace(/\/$/, "")}/http/widget/country`, {
|
|
6250
|
+
method: "POST",
|
|
6251
|
+
body: JSON.stringify(report)
|
|
6252
|
+
});
|
|
6253
|
+
if (!response.ok) throw new Error(`Country report failed: ${response.status}`);
|
|
6254
|
+
},
|
|
6204
6255
|
watchConnection: (onChange) => {
|
|
6205
6256
|
onChange(client.connectionState().isWebSocketConnected);
|
|
6206
6257
|
return client.subscribeToConnectionState((state) => onChange(state.isWebSocketConnected));
|
|
@@ -6425,7 +6476,9 @@ var ICONS = {
|
|
|
6425
6476
|
mark: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAEfElEQVR4nOycV6hcRRzGP2MBe4m9YSEaFQuIRkUsIBhbriU2LKigglgeFB81ICgWVIxiQQULiA2NsSchNyHtISGQkJ6HJJBCQnp/CMn38d+Ey+Xu/OecPbt7znB+8GMfZhZ2v3tmzpz/zN5BqAkyCDVB6oAc6oAc6oAc6oAc6oAc6oAcDkHrXEovp0MbnkFPpCc07ATr6YbG6yz6Ox2PAjgI+biePkdvoSehnGyl39A36FrkJGtAF9P36G2oDrvoJ3QU3YaMxAakofgqfZ0ehmqyEPaHXZblTbEBfUWfQvXZSEfQKbFviAnoSfo10kFz05V0SUxnL6DD6QrYXSklNNyuQsSc5K2DHkF64QgtRz6I6egFdAXSRXPqhV4nL6BOLfS6gb77OzGdQqxG2uiOdnqogxfQDKTPfaFGL6A/6XakzYhQoxfQTvoa0ua6UGPsSnoc7ME0VY5GkzVRbD1I43QO0uXsZg2xAW2h19LvkSbHNmvIUlHcQR+DDbWpSItNzRrylFwnwApmN8IqdymwvllD3opiX1RifZw+QS9A9dD00XSIFRFQX4bArqz9noXy8w+9vVlj0QH15yLYQqyHDkM5d1Geh5VkB6TdAfVFZRNN8Dc0XoegHByPwCTdyYD6o90QhXUTLLCh6Dyj6YuhDt0MqD+D6a10ZOP1CLQX1afPQ+DqEa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UgAAAEgAAABICAYAAABV7bNHAAAACXBIWXMAAAsTAAALEwEAmpwYAAABCUlEQVR4nO3ZQQqDMBBG4f8EeqmCFqS9/yHstnRlSYlQimK0monJ+yDgzuE5LkQJAAAAAAAAAAAA+Kgldf64a2tJzXOR9JA0+OOuG8N5mol53IwmKkn91zDjefmnF1vn7/07T+9nje4+MYxVpLk443GzJhVoiBhpKY5ZoGrmFYsZKSSO2SvmXAMGPCpSSJyXn9FUK+kZMOiea34NvOdNiWgjRjpdnJiRThsnRqTTxzkyUjZxjoiUXZw9I2UbZ49I2cf5J1IxcbZEKi7O2k8Dq0+X02zSUNrmbNmk4jbn300qYnO2blJRm7N2k4rcnNBIxFn4XWP5+yhJdUo//AAAAAAAAAAAAKCcvAFtUXbojKVOAwAAAABJRU5ErkJggg=="
|
|
6479
|
+
down: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAACXBIWXMAAAsTAAALEwEAmpwYAAABCUlEQVR4nO3ZQQqDMBBG4f8EeqmCFqS9/yHstnRlSYlQimK0monJ+yDgzuE5LkQJAAAAAAAAAAAA+Kgldf64a2tJzXOR9JA0+OOuG8N5mol53IwmKkn91zDjefmnF1vn7/07T+9nje4+MYxVpLk443GzJhVoiBhpKY5ZoGrmFYsZKSSO2SvmXAMGPCpSSJyXn9FUK+kZMOiea34NvOdNiWgjRjpdnJiRThsnRqTTxzkyUjZxjoiUXZw9I2UbZ49I2cf5J1IxcbZEKi7O2k8Dq0+X02zSUNrmbNmk4jbn300qYnO2blJRm7N2k4rcnNBIxFn4XWP5+yhJdUo//AAAAAAAAAAAAKCcvAFtUXbojKVOAwAAAABJRU5ErkJggg==",
|
|
6480
|
+
/** An AI reply, beside its label and in its avatar. */
|
|
6481
|
+
sparkles: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAEvklEQVR4nO1cPUwUQRT+xCjE6rx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qQ4eHSXuhHOMQi7Z97LHAvBHCG85HHcM7D4MxrLHPdYfhfQGD0ckMWli8fDxneO8hZKgHMEiv9gaR+D1E93TQwAxaBJn5+MrwnkdIUAVgUsEPmaDjuyo4oHiASlbL4STh7znOaB6lXaNnVKBSiyGr5UAYzjE7PWdcqdC+Si2GrJYjcLhJKUwqtK9SiyGr5QgU9S6UkyES/osMKrUYslqOQDEkiX1ayRsW1CaJrYTFk8GuFsOuliOUnm6rBW87w/vDpg+7Wgy7Wo5A8ZsRLsakNqx4RRt2kNViqNRyFISC4i4UJKvFUKnlCAzzjHBtHk4xu1oMlVqOwDAoWaTbaFrFSTncIj2g0A9Xi7HksqjXCDMfRFm4p3ByJjCTE5epYnwHPyzgKQ7TF1gympTW9FN28tMUgQeradrc00Gp4g7uh7BW5lQqTgPBc8RhHwmbswAzHn0ex1fUkWX6Tt7sOv0eUFyQ7SC84xt0QHOVzueM0rXAPecIESLAT/wHr8UbpjadbEsAAAAASUVORK5CYII="
|
|
6429
6482
|
};
|
|
6430
6483
|
|
|
6431
6484
|
// src/models/sdk.utils.ts
|
|
@@ -6598,6 +6651,8 @@ function useChatContext() {
|
|
|
6598
6651
|
|
|
6599
6652
|
// src/i18n/en.ts
|
|
6600
6653
|
var en = {
|
|
6654
|
+
ai: "AI",
|
|
6655
|
+
request_human: "Talk to a Member",
|
|
6601
6656
|
close_chat: "Close chat",
|
|
6602
6657
|
online: "Online",
|
|
6603
6658
|
away: "Away for now",
|
|
@@ -6623,6 +6678,7 @@ var en = {
|
|
|
6623
6678
|
email_saved: "Thanks, we will write to {email}.",
|
|
6624
6679
|
error: "Something went wrong. Try again.",
|
|
6625
6680
|
code_prompt: "Chatted with us on another device? Get a code at {email} to see your conversation here.",
|
|
6681
|
+
code_prompt_earlier: "Wrote to us before signing in? Get a code at {email} to bring that conversation here.",
|
|
6626
6682
|
code_send: "Get the code",
|
|
6627
6683
|
code_label: "Enter the 6-digit code sent to {email}.",
|
|
6628
6684
|
code_submit: "Confirm",
|
|
@@ -6631,6 +6687,7 @@ var en = {
|
|
|
6631
6687
|
code_expired: "This code no longer works. Ask for a new one.",
|
|
6632
6688
|
code_rate_limited: "Too many codes asked for. Try again in an hour.",
|
|
6633
6689
|
code_dismiss: "Not now",
|
|
6690
|
+
code_not_me: "Not me",
|
|
6634
6691
|
attach: "Send a photo",
|
|
6635
6692
|
uploading: "Uploading\u2026",
|
|
6636
6693
|
ready: "Ready",
|
|
@@ -6650,6 +6707,8 @@ var en = {
|
|
|
6650
6707
|
|
|
6651
6708
|
// src/i18n/fr.ts
|
|
6652
6709
|
var fr = {
|
|
6710
|
+
ai: "IA",
|
|
6711
|
+
request_human: "Parler \xE0 un membre",
|
|
6653
6712
|
close_chat: "Fermer le chat",
|
|
6654
6713
|
online: "En ligne",
|
|
6655
6714
|
away: "Absents pour le moment",
|
|
@@ -6675,6 +6734,7 @@ var fr = {
|
|
|
6675
6734
|
email_saved: "Merci, nous vous \xE9crirons \xE0 {email}.",
|
|
6676
6735
|
error: "Une erreur est survenue. R\xE9essayez.",
|
|
6677
6736
|
code_prompt: "D\xE9j\xE0 \xE9chang\xE9 avec nous sur un autre appareil ? Recevez un code \xE0 {email} pour retrouver votre conversation ici.",
|
|
6737
|
+
code_prompt_earlier: "Vous nous avez \xE9crit avant de vous connecter ? Recevez un code \xE0 {email} pour retrouver cette conversation ici.",
|
|
6678
6738
|
code_send: "Recevoir le code",
|
|
6679
6739
|
code_label: "Saisissez le code \xE0 6 chiffres envoy\xE9 \xE0 {email}.",
|
|
6680
6740
|
code_submit: "Valider",
|
|
@@ -6683,6 +6743,7 @@ var fr = {
|
|
|
6683
6743
|
code_expired: "Ce code ne fonctionne plus. Demandez-en un nouveau.",
|
|
6684
6744
|
code_rate_limited: "Trop de codes demand\xE9s. R\xE9essayez dans une heure.",
|
|
6685
6745
|
code_dismiss: "Plus tard",
|
|
6746
|
+
code_not_me: "Ce n\u2019est pas moi",
|
|
6686
6747
|
attach: "Envoyer une photo",
|
|
6687
6748
|
uploading: "Envoi\u2026",
|
|
6688
6749
|
ready: "Pr\xEAt",
|
|
@@ -6947,6 +7008,7 @@ var CODE_LENGTH = 6;
|
|
|
6947
7008
|
var CODE_MAX_AGE_SECONDS = 15 * 60;
|
|
6948
7009
|
var TEST_EMAIL_DOMAIN = "zean-test.local";
|
|
6949
7010
|
var DEV_OPERATOR_EMAIL = `operator@${TEST_EMAIL_DOMAIN}`;
|
|
7011
|
+
var MOBILE_AUTH_CODE_TTL_MS = 2 * 6e4;
|
|
6950
7012
|
|
|
6951
7013
|
// src/components/ContactCodeCard.tsx
|
|
6952
7014
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
@@ -6976,7 +7038,8 @@ function ContactCodeCard({ code: code2, onDismiss }) {
|
|
|
6976
7038
|
setBusy(false);
|
|
6977
7039
|
if (!result.ok) setError(errorOf(result.code));
|
|
6978
7040
|
};
|
|
6979
|
-
const
|
|
7041
|
+
const prompt = code2.kind === "earlier" ? t.code_prompt_earlier : t.code_prompt;
|
|
7042
|
+
const label = format(code2.sent ? t.code_label : prompt, { email: code2.email });
|
|
6980
7043
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react_native9.View, { style: [styles5.card, { backgroundColor: colors.surface }], children: [
|
|
6981
7044
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native9.Text, { style: [styles5.prompt, { color: colors.text }], children: label }),
|
|
6982
7045
|
code2.sent ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react_native9.View, { style: styles5.row, children: [
|
|
@@ -7021,7 +7084,7 @@ function ContactCodeCard({ code: code2, onDismiss }) {
|
|
|
7021
7084
|
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native9.Text, { style: [styles5.buttonText, { color: colors.primaryForeground }], children: t.code_send })
|
|
7022
7085
|
}
|
|
7023
7086
|
),
|
|
7024
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native9.Pressable, { onPress: onDismiss, accessibilityRole: "button", hitSlop: 8, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native9.Text, { style: [styles5.link, { color: colors.muted }], children: t.code_dismiss }) })
|
|
7087
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native9.Pressable, { onPress: onDismiss, accessibilityRole: "button", hitSlop: 8, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native9.Text, { style: [styles5.link, { color: colors.muted }], children: code2.kind === "id" ? t.code_dismiss : t.code_not_me }) })
|
|
7025
7088
|
] }),
|
|
7026
7089
|
error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native9.Text, { accessibilityLiveRegion: "polite", style: [styles5.error, { color: colors.danger }], children: error }),
|
|
7027
7090
|
code2.sent && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native9.Pressable, { onPress: () => void handleSend(), disabled: busy, accessibilityRole: "button", hitSlop: 8, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native9.Text, { style: [styles5.link, { color: colors.primaryText }, busy && styles5.dim], children: t.code_resend }) })
|
|
@@ -7729,8 +7792,19 @@ var styles10 = import_react_native16.StyleSheet.create({
|
|
|
7729
7792
|
// src/components/TeamAvatar.tsx
|
|
7730
7793
|
var import_react_native17 = require("react-native");
|
|
7731
7794
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
7732
|
-
function TeamAvatar({ app, sender }) {
|
|
7795
|
+
function TeamAvatar({ app, sender, ai = false }) {
|
|
7733
7796
|
const { colors } = useChatContext();
|
|
7797
|
+
if (ai) {
|
|
7798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
7799
|
+
import_react_native17.View,
|
|
7800
|
+
{
|
|
7801
|
+
style: [styles11.avatar, { backgroundColor: colors.primaryTint }],
|
|
7802
|
+
accessibilityElementsHidden: true,
|
|
7803
|
+
importantForAccessibility: "no-hide-descendants",
|
|
7804
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon, { name: "sparkles", color: colors.primaryText, size: 14 })
|
|
7805
|
+
}
|
|
7806
|
+
);
|
|
7807
|
+
}
|
|
7734
7808
|
const image = sender ? sender.image : app.logoUrl;
|
|
7735
7809
|
if (image) {
|
|
7736
7810
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native17.Image, { source: { uri: image }, style: [styles11.avatar, { borderColor: colors.border }], accessibilityIgnoresInvertColors: true });
|
|
@@ -7762,7 +7836,7 @@ var styles11 = import_react_native17.StyleSheet.create({
|
|
|
7762
7836
|
// src/components/MessageBubble.tsx
|
|
7763
7837
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
7764
7838
|
function MessageBubble({ row, app, onRetry }) {
|
|
7765
|
-
const { t, locale, colors, openedAt } = useChatContext();
|
|
7839
|
+
const { chat: chat2, t, locale, colors, openedAt } = useChatContext();
|
|
7766
7840
|
const { message, startsRun, endsRun, startsDay } = row;
|
|
7767
7841
|
const own = message.from === "contact";
|
|
7768
7842
|
const rise = useRiseIn(message.createdAt > openedAt && (!own || message.status === "sending"));
|
|
@@ -7785,9 +7859,9 @@ function MessageBubble({ row, app, onRetry }) {
|
|
|
7785
7859
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MessageFiles, { attachments: message.attachments, own: true, stored: message.status === "sent" }),
|
|
7786
7860
|
endsRun && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MessageMeta, { row, onRetry })
|
|
7787
7861
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native18.View, { style: styles12.team, children: [
|
|
7788
|
-
startsRun && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native18.Text, { style: [styles12.name, { color: colors.muted }], numberOfLines: 1, children: message.sender?.name ?? app.name }),
|
|
7862
|
+
(startsRun || message.ai) && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native18.Text, { style: [styles12.name, { color: colors.muted }], numberOfLines: 1, children: message.ai ? t.ai : message.sender?.name ?? app.name }),
|
|
7789
7863
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native18.View, { style: styles12.teamRow, children: [
|
|
7790
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native18.View, { style: styles12.avatar, children: endsRun && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TeamAvatar, { app, sender: message.sender }) }),
|
|
7864
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native18.View, { style: styles12.avatar, children: endsRun && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TeamAvatar, { app, sender: message.sender, ai: message.ai }) }),
|
|
7791
7865
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native18.View, { style: styles12.teamColumn, children: [
|
|
7792
7866
|
message.body !== "" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7793
7867
|
import_react_native18.Text,
|
|
@@ -7804,6 +7878,7 @@ function MessageBubble({ row, app, onRetry }) {
|
|
|
7804
7878
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MessageFiles, { attachments: message.attachments, own: false, stored: true })
|
|
7805
7879
|
] })
|
|
7806
7880
|
] }),
|
|
7881
|
+
message.ai && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native18.Pressable, { accessibilityRole: "button", onPress: () => chat2.send(t.request_human), hitSlop: 8, style: styles12.teamMeta, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native18.Text, { style: [styles12.human, { color: colors.primaryText }], children: t.request_human }) }),
|
|
7807
7882
|
endsRun && !row.welcome && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native18.View, { style: styles12.teamMeta, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MessageMeta, { row, onRetry }) })
|
|
7808
7883
|
] })
|
|
7809
7884
|
] });
|
|
@@ -7830,6 +7905,7 @@ var styles12 = import_react_native18.StyleSheet.create({
|
|
|
7830
7905
|
avatar: { width: AVATAR },
|
|
7831
7906
|
teamColumn: { flexShrink: 1, alignItems: "flex-start", gap: 4 },
|
|
7832
7907
|
teamMeta: { marginLeft: AVATAR + 8 },
|
|
7908
|
+
human: { fontSize: 13, fontWeight: "600", textDecorationLine: "underline", paddingVertical: 8 },
|
|
7833
7909
|
bubble: {
|
|
7834
7910
|
borderRadius: RADII.group,
|
|
7835
7911
|
paddingHorizontal: 14,
|
|
@@ -8032,18 +8108,17 @@ var styles15 = import_react_native21.StyleSheet.create({
|
|
|
8032
8108
|
// src/components/ChatScreen.tsx
|
|
8033
8109
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
8034
8110
|
function ChatScreen({ state, insets, onClose }) {
|
|
8035
|
-
const { t, colors } = useChatContext();
|
|
8111
|
+
const { chat: chat2, t, colors } = useChatContext();
|
|
8036
8112
|
const rootRef = (0, import_react15.useRef)(null);
|
|
8037
8113
|
const keyboard = useKeyboardOverlap(rootRef);
|
|
8038
8114
|
const connectionLost = useConnectionLost(state.connected);
|
|
8039
|
-
const [codeDismissed, setCodeDismissed] = (0, import_react15.useState)(false);
|
|
8040
8115
|
const app = state.app;
|
|
8041
8116
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native22.View, { ref: rootRef, style: [styles16.screen, { backgroundColor: colors.background, paddingBottom: keyboard }], children: [
|
|
8042
8117
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChatHeader, { app, online: state.online, topInset: insets.top, onClose }),
|
|
8043
8118
|
connectionLost && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native22.View, { style: styles16.notice, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChatNotice, { children: t.reconnecting }) }),
|
|
8044
8119
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MessageList, { state }),
|
|
8045
8120
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native22.View, { style: [styles16.footer, { paddingBottom: 8 + (keyboard > 0 ? 0 : insets.bottom) }], children: [
|
|
8046
|
-
state.contactCode &&
|
|
8121
|
+
state.contactCode && state.status === "ready" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ContactCodeCard, { code: state.contactCode, onDismiss: chat2.dismissCode }),
|
|
8047
8122
|
state.status === "blocked" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChatNotice, { children: t.blocked }) : state.status === "unavailable" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChatNotice, { children: t.unavailable }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Composer, {}),
|
|
8048
8123
|
app.showBadge && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PoweredBy, {})
|
|
8049
8124
|
] })
|
|
@@ -138,6 +138,8 @@ export interface TeamAvatarProps {
|
|
|
138
138
|
app: ChatApp;
|
|
139
139
|
/** Null: the App. */
|
|
140
140
|
sender: ChatSender | null;
|
|
141
|
+
/** An AI reply: the sparkles, not the sender's initials. */
|
|
142
|
+
ai?: boolean;
|
|
141
143
|
}
|
|
142
144
|
export interface AppMarkProps {
|
|
143
145
|
app: ChatApp;
|
|
@@ -176,7 +178,7 @@ export interface IconProps {
|
|
|
176
178
|
color: string;
|
|
177
179
|
size: number;
|
|
178
180
|
}
|
|
179
|
-
export type IconName = 'close' | 'send' | 'photo' | 'file' | 'download' | 'remove' | 'mark' | 'check' | 'seen' | 'down';
|
|
181
|
+
export type IconName = 'close' | 'send' | 'photo' | 'file' | 'download' | 'remove' | 'mark' | 'check' | 'seen' | 'down' | 'sparkles';
|
|
180
182
|
export interface ExpoImagePickerAsset {
|
|
181
183
|
uri: string;
|
|
182
184
|
fileName?: string | null;
|
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.10",
|
|
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",
|
|
@@ -91,18 +91,18 @@
|
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
93
|
"@jest/globals": "29.7.0",
|
|
94
|
-
"@react-native/babel-preset": "0.
|
|
95
|
-
"@react-native/jest-preset": "0.
|
|
94
|
+
"@react-native/babel-preset": "0.88.0",
|
|
95
|
+
"@react-native/jest-preset": "0.88.0",
|
|
96
96
|
"@testing-library/react-native": "14.1.0",
|
|
97
|
-
"@types/react": "19.
|
|
97
|
+
"@types/react": "19.3.0",
|
|
98
98
|
"@zean/config": "*",
|
|
99
99
|
"@zean/sdk-core": "*",
|
|
100
100
|
"@zean/shared": "*",
|
|
101
101
|
"babel-jest": "29.7.0",
|
|
102
102
|
"convex": "1.46.0",
|
|
103
103
|
"jest": "29.7.0",
|
|
104
|
-
"react": "19.
|
|
105
|
-
"react-native": "0.
|
|
104
|
+
"react": "19.3.0",
|
|
105
|
+
"react-native": "0.88.0",
|
|
106
106
|
"test-renderer": "1.3.1",
|
|
107
107
|
"typescript": "6.0.3",
|
|
108
108
|
"vitest": "4.1.11"
|