@zean-chat/react-native 0.1.15 → 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/i18n/en.d.ts +0 -1
- package/dist/i18n/fr.d.ts +0 -1
- package/dist/index.js +262 -67
- package/dist/models/sdk.constants.d.ts +5 -0
- package/dist/models/sdk.interface.d.ts +20 -6
- package/dist/models/sdk.utils.d.ts +7 -2
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ npx expo install @zean-chat/react-native expo-application @react-native-async-st
|
|
|
10
10
|
npm install @zean-chat/react-native react-native-device-info @react-native-async-storage/async-storage react-native-image-picker
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
Already using MMKV or Expo SQLite? Skip AsyncStorage: the chat finds your storage by itself, with no code. Already have a photo picker? Skip it too. The photo picker is optional: without one, the chat has no photo button. `expo-application` (Expo) or `react-native-device-info` (React Native CLI) is required: the chat reads your app's Bundle ID or Package name with it, and stays hidden without it.
|
|
13
|
+
Already using MMKV or Expo SQLite? Skip AsyncStorage: the chat finds your storage by itself, with no code. Already have a photo picker? Skip it too. The photo picker is optional: without one, the chat has no photo button. `expo-application` (Expo) or `react-native-device-info` (React Native CLI) is required: the chat reads your app's Bundle ID or Package name with it, and stays hidden without it. It also gives the app version for Device details, and `react-native-device-info` or `expo-device` the exact model.
|
|
14
14
|
|
|
15
15
|
```tsx
|
|
16
16
|
import { ZeanChat, useZean } from "@zean-chat/react-native";
|
package/dist/i18n/en.d.ts
CHANGED
package/dist/i18n/fr.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -76,6 +76,9 @@ var TEST_DEVICE_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
|
|
|
76
76
|
var QUOTE_HIGHLIGHT_MS = 1600;
|
|
77
77
|
|
|
78
78
|
// ../shared/src/constants/widget.ts
|
|
79
|
+
var APP_PLATFORMS = ["web", "react_native"];
|
|
80
|
+
var DEVICE_TYPES = ["phone", "tablet", "computer"];
|
|
81
|
+
var DEVICE_DETAIL_MAX_LENGTH = 80;
|
|
79
82
|
var EXPO_GO_BUNDLE_ID = "host.exp.exponent";
|
|
80
83
|
var DEFAULT_WIDGET_TEXTS = {
|
|
81
84
|
fr: {
|
|
@@ -144,23 +147,23 @@ function cleanContactUser(value) {
|
|
|
144
147
|
if (typeof id !== "string" || !id.trim() || id.trim().length > CONTACT_ID_MAX_LENGTH) return { user: null, dropped: [] };
|
|
145
148
|
const user = { id: id.trim() };
|
|
146
149
|
const dropped = [];
|
|
147
|
-
const
|
|
150
|
+
const text2 = (key) => {
|
|
148
151
|
const raw = input[key];
|
|
149
152
|
if (raw === void 0 || raw === null) return null;
|
|
150
153
|
const cleaned = typeof raw === "string" ? squashSpaces(raw) : "";
|
|
151
154
|
if (!cleaned) dropped.push(key);
|
|
152
155
|
return cleaned || null;
|
|
153
156
|
};
|
|
154
|
-
const name =
|
|
157
|
+
const name = text2("name");
|
|
155
158
|
if (name !== null && name.length <= CONTACT_NAME_MAX_LENGTH) user.name = name;
|
|
156
159
|
else if (name !== null) dropped.push("name");
|
|
157
|
-
const email =
|
|
160
|
+
const email = text2("email");
|
|
158
161
|
if (email !== null && isEmail(normaliseEmail(email))) user.email = normaliseEmail(email);
|
|
159
162
|
else if (email !== null) dropped.push("email");
|
|
160
|
-
const phone =
|
|
163
|
+
const phone = text2("phone");
|
|
161
164
|
if (phone !== null && phone.length <= CONTACT_PHONE_MAX_LENGTH && PHONE_PATTERN.test(phone)) user.phone = phone;
|
|
162
165
|
else if (phone !== null) dropped.push("phone");
|
|
163
|
-
const language =
|
|
166
|
+
const language = text2("language");
|
|
164
167
|
if (language !== null && LANGUAGE_TAG_PATTERN.test(language)) user.language = languageTag(language);
|
|
165
168
|
else if (language !== null) dropped.push("language");
|
|
166
169
|
return { user, dropped };
|
|
@@ -190,8 +193,8 @@ function isWithinBusinessHours(hours, at) {
|
|
|
190
193
|
const { weekday, minutes } = clockIn(hours.timeZone, at);
|
|
191
194
|
return hours.days.some((day) => day.weekday === weekday && minutesOf(day.opens) <= minutes && minutes < minutesOf(day.closes));
|
|
192
195
|
}
|
|
193
|
-
function pickText(
|
|
194
|
-
return
|
|
196
|
+
function pickText(text2, locale, defaultLocale, fallback) {
|
|
197
|
+
return text2?.[locale]?.trim() || text2?.[defaultLocale]?.trim() || fallback[locale];
|
|
195
198
|
}
|
|
196
199
|
function clockIn(timeZone, at) {
|
|
197
200
|
let parts;
|
|
@@ -227,6 +230,7 @@ var KEPT_MESSAGES = 100;
|
|
|
227
230
|
var KEPT_VERSION = 1;
|
|
228
231
|
var LIVE_AFTER_CLOSE_MS = 2 * 6e4;
|
|
229
232
|
var ADVANCE_AFTER = WIDGET_PAGE_SIZE / 2;
|
|
233
|
+
var QUIET_CALLS = /* @__PURE__ */ new Set(["start", "reportInstall", "setTyping", "setPushToken", "markRead", "signOut"]);
|
|
230
234
|
function emailKey(offer) {
|
|
231
235
|
return `${offer.kind}:${offer.email}`;
|
|
232
236
|
}
|
|
@@ -280,7 +284,7 @@ function createChatStore(backend, options) {
|
|
|
280
284
|
let identifying = null;
|
|
281
285
|
let identified = false;
|
|
282
286
|
let identifiedKnown = false;
|
|
283
|
-
let
|
|
287
|
+
let sessionWatch = null;
|
|
284
288
|
let pushToken2;
|
|
285
289
|
let pushSent = null;
|
|
286
290
|
let destroyed = false;
|
|
@@ -303,8 +307,7 @@ function createChatStore(backend, options) {
|
|
|
303
307
|
const device = () => ({
|
|
304
308
|
locale: state.locale,
|
|
305
309
|
...deviceLanguage ? { language: deviceLanguage } : {},
|
|
306
|
-
|
|
307
|
-
os: options.os,
|
|
310
|
+
...options.deviceDetails ? { details: options.deviceDetails() } : {},
|
|
308
311
|
timeZone
|
|
309
312
|
});
|
|
310
313
|
const deviceWaiters = [];
|
|
@@ -335,14 +338,56 @@ function createChatStore(backend, options) {
|
|
|
335
338
|
stops.push(() => clearInterval(clock));
|
|
336
339
|
})();
|
|
337
340
|
function watchAll() {
|
|
338
|
-
|
|
339
|
-
|
|
341
|
+
watchSession();
|
|
342
|
+
if (!keep || open2) watchLive();
|
|
343
|
+
}
|
|
344
|
+
function sessionLive() {
|
|
345
|
+
return !keep || open2 || session !== null && historyOf(session) !== null;
|
|
346
|
+
}
|
|
347
|
+
function watchSession() {
|
|
348
|
+
sessionWatch?.stop();
|
|
349
|
+
const live = sessionLive();
|
|
350
|
+
let stopped = false;
|
|
351
|
+
let stop = null;
|
|
352
|
+
const entry = {
|
|
353
|
+
live,
|
|
354
|
+
// Once: the Convex client throws on a second unsubscribe.
|
|
355
|
+
stop: () => {
|
|
356
|
+
if (stopped) return;
|
|
357
|
+
stopped = true;
|
|
358
|
+
stop?.();
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
sessionWatch = entry;
|
|
362
|
+
stop = backend.watch(
|
|
363
|
+
"session",
|
|
364
|
+
args(),
|
|
365
|
+
(result) => {
|
|
366
|
+
handleSession(result);
|
|
367
|
+
if (!live && sessionWatch === entry) entry.stop();
|
|
368
|
+
},
|
|
369
|
+
() => {
|
|
340
370
|
failedToLoad = true;
|
|
341
371
|
emit2();
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
if (
|
|
372
|
+
}
|
|
373
|
+
);
|
|
374
|
+
if (stopped) stop();
|
|
345
375
|
}
|
|
376
|
+
function updateSessionLive() {
|
|
377
|
+
if (!sessionWatch || sessionWatch.live === sessionLive()) return;
|
|
378
|
+
if (sessionLive()) watchSession();
|
|
379
|
+
else {
|
|
380
|
+
sessionWatch.stop();
|
|
381
|
+
sessionWatch = { live: false, stop: () => {
|
|
382
|
+
} };
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
function rereadSession() {
|
|
386
|
+
if (sessionWatch && !sessionWatch.live && deviceSecret && !destroyed) watchSession();
|
|
387
|
+
}
|
|
388
|
+
const call = (name, input) => backend.call(name, input).finally(() => {
|
|
389
|
+
if (!QUIET_CALLS.has(name)) rereadSession();
|
|
390
|
+
});
|
|
346
391
|
function watchLive() {
|
|
347
392
|
watchMessages();
|
|
348
393
|
stopTyping?.();
|
|
@@ -392,7 +437,7 @@ function createChatStore(backend, options) {
|
|
|
392
437
|
if (mine !== generation || destroyed || !deviceSecret) return;
|
|
393
438
|
identifiedKnown = state.known;
|
|
394
439
|
try {
|
|
395
|
-
const result = await
|
|
440
|
+
const result = await call("identify", { ...args(), user: person, device: device() });
|
|
396
441
|
if (mine !== generation) return;
|
|
397
442
|
idCode = result.state === "code_available" ? { email: result.email, sent: idCode?.sent ?? false } : null;
|
|
398
443
|
identified = true;
|
|
@@ -420,12 +465,13 @@ function createChatStore(backend, options) {
|
|
|
420
465
|
emit2();
|
|
421
466
|
if ("report" in result && result.report && !reported) {
|
|
422
467
|
reported = true;
|
|
423
|
-
|
|
468
|
+
call("reportInstall", args()).catch(() => {
|
|
424
469
|
});
|
|
425
470
|
}
|
|
426
471
|
startOnce();
|
|
427
472
|
if (state.known && !state.verified && !identifiedKnown && user && !identifying) void sendIdentity();
|
|
428
473
|
if (state.known && Object.keys(heldAttributes).length > 0) void sendAttributes();
|
|
474
|
+
updateSessionLive();
|
|
429
475
|
}
|
|
430
476
|
async function sendAttributes() {
|
|
431
477
|
if (identifying) await identifying;
|
|
@@ -434,7 +480,7 @@ function createChatStore(backend, options) {
|
|
|
434
480
|
heldAttributes = {};
|
|
435
481
|
saveAttributes();
|
|
436
482
|
try {
|
|
437
|
-
await
|
|
483
|
+
await call("setAttributes", { ...args(), attributes: attributes2 });
|
|
438
484
|
return { ok: true };
|
|
439
485
|
} catch (error) {
|
|
440
486
|
if (codeOf(error) === "invalid_attributes")
|
|
@@ -447,7 +493,7 @@ function createChatStore(backend, options) {
|
|
|
447
493
|
if (pushSent?.deviceSecret === deviceSecret && pushSent.token === pushToken2) return;
|
|
448
494
|
const sent = { deviceSecret, token: pushToken2 };
|
|
449
495
|
pushSent = sent;
|
|
450
|
-
|
|
496
|
+
call("setPushToken", { ...args(), token: pushToken2 }).catch((error) => {
|
|
451
497
|
if (pushSent === sent) pushSent = null;
|
|
452
498
|
if (codeOf(error) === "invalid_push_token") console.warn(`${APP_NAME}: the push token was refused: it is too long.`);
|
|
453
499
|
});
|
|
@@ -455,7 +501,7 @@ function createChatStore(backend, options) {
|
|
|
455
501
|
function startOnce() {
|
|
456
502
|
if (started || state.status === "loading" || state.status === "hidden") return;
|
|
457
503
|
started = true;
|
|
458
|
-
if (state.known || devLoad)
|
|
504
|
+
if (state.known || devLoad) call("start", { ...args(), device: device() }).catch(() => {
|
|
459
505
|
});
|
|
460
506
|
for (const entry of outbox) if (entry.error === null) deliver(entry);
|
|
461
507
|
}
|
|
@@ -507,7 +553,7 @@ function createChatStore(backend, options) {
|
|
|
507
553
|
);
|
|
508
554
|
}
|
|
509
555
|
function deliver(entry) {
|
|
510
|
-
|
|
556
|
+
call("send", {
|
|
511
557
|
...args(),
|
|
512
558
|
body: entry.body,
|
|
513
559
|
...entry.attachments ? { attachments: entry.attachments } : {},
|
|
@@ -735,25 +781,25 @@ function createChatStore(backend, options) {
|
|
|
735
781
|
getState: () => state,
|
|
736
782
|
draft: () => draft2 ? { text: draft2.text, files: draft2.files } : null,
|
|
737
783
|
saveDraft(given) {
|
|
738
|
-
const
|
|
784
|
+
const text2 = given.text;
|
|
739
785
|
const files = given.files.map((file) => file.uri && /^https?:/i.test(file.uri) ? { ...file, uri: null } : file);
|
|
740
|
-
if (!
|
|
786
|
+
if (!text2.trim() && files.length === 0) {
|
|
741
787
|
writeDraft(null);
|
|
742
788
|
return;
|
|
743
789
|
}
|
|
744
|
-
if (draft2 && JSON.stringify({ text, files }) === JSON.stringify({ text: draft2.text, files: draft2.files })) return;
|
|
745
|
-
writeDraft({ text, files, history: session ? historyOf(session) : null, updatedAt: Date.now() });
|
|
790
|
+
if (draft2 && JSON.stringify({ text: text2, files }) === JSON.stringify({ text: draft2.text, files: draft2.files })) return;
|
|
791
|
+
writeDraft({ text: text2, files, history: session ? historyOf(session) : null, updatedAt: Date.now() });
|
|
746
792
|
},
|
|
747
793
|
subscribe(listener) {
|
|
748
794
|
listeners2.add(listener);
|
|
749
795
|
return () => listeners2.delete(listener);
|
|
750
796
|
},
|
|
751
797
|
send(body, attachments = []) {
|
|
752
|
-
const
|
|
753
|
-
if (!
|
|
798
|
+
const text2 = body.trim();
|
|
799
|
+
if (!text2 && attachments.length === 0 || !deviceSecret) return;
|
|
754
800
|
const entry = {
|
|
755
801
|
clientId: newClientId(),
|
|
756
|
-
body:
|
|
802
|
+
body: text2,
|
|
757
803
|
...attachments.length > 0 ? { attachments } : {},
|
|
758
804
|
createdAt: Date.now(),
|
|
759
805
|
error: null
|
|
@@ -795,26 +841,27 @@ function createChatStore(backend, options) {
|
|
|
795
841
|
if (open2 === value) return;
|
|
796
842
|
open2 = value;
|
|
797
843
|
if (!keep) return;
|
|
844
|
+
updateSessionLive();
|
|
798
845
|
keepLive();
|
|
799
846
|
if (!value) stopLiveLater();
|
|
800
847
|
else if (!stopMessages && deviceSecret) watchLive();
|
|
801
848
|
},
|
|
802
849
|
markRead() {
|
|
803
850
|
if (state.unread === 0 || !deviceSecret) return;
|
|
804
|
-
|
|
851
|
+
call("markRead", args()).catch(() => {
|
|
805
852
|
});
|
|
806
853
|
},
|
|
807
854
|
typing() {
|
|
808
855
|
const now = Date.now();
|
|
809
856
|
if (state.status !== "ready" || !state.known || now - lastTypingSignal < TYPING_SIGNAL_MS) return;
|
|
810
857
|
lastTypingSignal = now;
|
|
811
|
-
|
|
858
|
+
call("setTyping", args()).catch(() => {
|
|
812
859
|
});
|
|
813
860
|
},
|
|
814
861
|
async setEmail(email) {
|
|
815
862
|
if (!deviceSecret) return { ok: false, code: "not_found" };
|
|
816
863
|
try {
|
|
817
|
-
await
|
|
864
|
+
await call("setEmail", { ...args(), email });
|
|
818
865
|
emailGiven = true;
|
|
819
866
|
emit2();
|
|
820
867
|
return { ok: true };
|
|
@@ -868,10 +915,10 @@ function createChatStore(backend, options) {
|
|
|
868
915
|
if (!deviceSecret || !offer || offer.kind === "id" && !person) return { ok: false, code: "not_found" };
|
|
869
916
|
try {
|
|
870
917
|
if (offer.kind !== "id") {
|
|
871
|
-
await
|
|
918
|
+
await call("requestEmailCode", args());
|
|
872
919
|
emailCodeSent = emailKey(offer);
|
|
873
920
|
} else {
|
|
874
|
-
await
|
|
921
|
+
await call("requestCode", { ...args(), userId: person.id });
|
|
875
922
|
if (idCode && user === person) idCode = { ...idCode, sent: true };
|
|
876
923
|
}
|
|
877
924
|
emit2();
|
|
@@ -886,13 +933,13 @@ function createChatStore(backend, options) {
|
|
|
886
933
|
if (!deviceSecret || !offer || offer.kind === "id" && !person) return { ok: false, code: "not_found" };
|
|
887
934
|
try {
|
|
888
935
|
if (offer.kind !== "id") {
|
|
889
|
-
const result2 = await
|
|
936
|
+
const result2 = await call("confirmEmailCode", { ...args(), code: code2 });
|
|
890
937
|
if (!result2.ok) return result2;
|
|
891
938
|
emailCodeSent = null;
|
|
892
939
|
emit2();
|
|
893
940
|
return { ok: true };
|
|
894
941
|
}
|
|
895
|
-
const result = await
|
|
942
|
+
const result = await call("confirmCode", { ...args(), userId: person.id, code: code2 });
|
|
896
943
|
if (!result.ok) return result;
|
|
897
944
|
idCode = null;
|
|
898
945
|
emit2();
|
|
@@ -908,7 +955,7 @@ function createChatStore(backend, options) {
|
|
|
908
955
|
if (offer.kind === "id") idCodeDismissed = true;
|
|
909
956
|
else {
|
|
910
957
|
emailCodeDismissed = emailKey(offer);
|
|
911
|
-
|
|
958
|
+
call("dismissEmailCode", args()).catch(() => {
|
|
912
959
|
});
|
|
913
960
|
}
|
|
914
961
|
emit2();
|
|
@@ -927,10 +974,10 @@ function createChatStore(backend, options) {
|
|
|
927
974
|
emailGiven = false;
|
|
928
975
|
identifying = null;
|
|
929
976
|
identifiedKnown = false;
|
|
930
|
-
if (deviceSecret)
|
|
977
|
+
if (deviceSecret) call("signOut", args()).catch(() => {
|
|
931
978
|
});
|
|
932
|
-
|
|
933
|
-
|
|
979
|
+
sessionWatch?.stop();
|
|
980
|
+
sessionWatch = null;
|
|
934
981
|
stopLive();
|
|
935
982
|
forgetKept();
|
|
936
983
|
forgetDraft();
|
|
@@ -961,7 +1008,7 @@ function createChatStore(backend, options) {
|
|
|
961
1008
|
await starting;
|
|
962
1009
|
await deviceKnown();
|
|
963
1010
|
if (destroyed || !deviceSecret) return;
|
|
964
|
-
await
|
|
1011
|
+
await call("joinWithPass", { ...args(), pass }).catch(() => {
|
|
965
1012
|
});
|
|
966
1013
|
},
|
|
967
1014
|
destroy() {
|
|
@@ -969,7 +1016,7 @@ function createChatStore(backend, options) {
|
|
|
969
1016
|
for (const resolve of deviceWaiters.splice(0)) resolve();
|
|
970
1017
|
stopMessages?.();
|
|
971
1018
|
stopTyping?.();
|
|
972
|
-
|
|
1019
|
+
sessionWatch?.stop();
|
|
973
1020
|
for (const stop of stops) stop();
|
|
974
1021
|
if (typingTimer) clearTimeout(typingTimer);
|
|
975
1022
|
keepLive();
|
|
@@ -4483,9 +4530,9 @@ var markNames = [
|
|
|
4483
4530
|
"convexFirstMessageReceived"
|
|
4484
4531
|
];
|
|
4485
4532
|
function mark(name, sessionId) {
|
|
4486
|
-
const
|
|
4533
|
+
const detail2 = { sessionId };
|
|
4487
4534
|
if (typeof performance === "undefined" || !performance.mark) return;
|
|
4488
|
-
performance.mark(name, { detail });
|
|
4535
|
+
performance.mark(name, { detail: detail2 });
|
|
4489
4536
|
}
|
|
4490
4537
|
function performanceMarkToJson(mark2) {
|
|
4491
4538
|
let name = mark2.name.slice("convex".length);
|
|
@@ -6496,10 +6543,99 @@ var MAX_ATTACHMENTS = 6;
|
|
|
6496
6543
|
var MAX_IMAGE_SIDE = 1600;
|
|
6497
6544
|
var IMAGE_TYPES = ["image/jpeg", "image/png", "image/webp"];
|
|
6498
6545
|
|
|
6546
|
+
// ../shared/src/utils/devices.ts
|
|
6547
|
+
var BROWSERS = [
|
|
6548
|
+
[/Edg(?:A|iOS)?\/(\d+)/, "Edge"],
|
|
6549
|
+
[/OPR\/(\d+)/, "Opera"],
|
|
6550
|
+
[/SamsungBrowser\/(\d+)/, "Samsung Internet"],
|
|
6551
|
+
[/(?:Firefox|FxiOS)\/(\d+)/, "Firefox"],
|
|
6552
|
+
[/(?:Chrome|CriOS)\/(\d+)/, "Chrome"],
|
|
6553
|
+
[/Version\/(\d+)[^ ]* (?:Mobile\/\S+ )?Safari/, "Safari"]
|
|
6554
|
+
];
|
|
6555
|
+
var ANDROID_BRANDS = [
|
|
6556
|
+
[/^(?:SM-|Galaxy)/i, "Samsung"],
|
|
6557
|
+
[/^Pixel/i, "Google"],
|
|
6558
|
+
[/^(?:Redmi|POCO|Mi |M2\d)/i, "Xiaomi"],
|
|
6559
|
+
[/^moto/i, "Motorola"],
|
|
6560
|
+
[/^(?:ONEPLUS|CPH)/i, "OnePlus"],
|
|
6561
|
+
[/^(?:TECNO)/i, "Tecno"],
|
|
6562
|
+
[/^(?:Infinix)/i, "Infinix"],
|
|
6563
|
+
[/^(?:itel)/i, "itel"],
|
|
6564
|
+
[/^(?:HUAWEI)/i, "Huawei"],
|
|
6565
|
+
[/^Nokia/i, "Nokia"]
|
|
6566
|
+
];
|
|
6567
|
+
var HIDDEN_MODELS = /* @__PURE__ */ new Set(["K", "wv", "Mobile", "Tablet"]);
|
|
6568
|
+
var SCREEN_MAX = 2e4;
|
|
6569
|
+
function detailsFromUserAgent(userAgent, touchPoints = 0) {
|
|
6570
|
+
const browser = browserOf(userAgent);
|
|
6571
|
+
const details = { platform: "web", ...browser ? { browser } : {} };
|
|
6572
|
+
const ios = /(iPhone|iPad|iPod)[^)]*?OS (\d+)[_.](\d+)/.exec(userAgent) ?? /(iPhone|iPad|iPod)/.exec(userAgent);
|
|
6573
|
+
if (ios) {
|
|
6574
|
+
const model = ios[1] === "iPod" ? "iPod touch" : ios[1];
|
|
6575
|
+
const version2 = ios[2] ? ` ${ios[2]}.${ios[3]}` : "";
|
|
6576
|
+
return { ...details, type: ios[1] === "iPad" ? "tablet" : "phone", brand: "Apple", model, os: `iOS${version2}` };
|
|
6577
|
+
}
|
|
6578
|
+
const android = /Android (\d+(?:\.\d+)?)(?:; ([^;)]+?))?(?: Build\/[^;)]*)?[;)]/.exec(userAgent);
|
|
6579
|
+
if (android) {
|
|
6580
|
+
const named = android[2]?.trim();
|
|
6581
|
+
const model = named && !HIDDEN_MODELS.has(named) ? named : void 0;
|
|
6582
|
+
const brand = model && brandOf(model);
|
|
6583
|
+
return {
|
|
6584
|
+
...details,
|
|
6585
|
+
type: /Mobile/.test(userAgent) ? "phone" : "tablet",
|
|
6586
|
+
...brand ? { brand } : {},
|
|
6587
|
+
...model ? { model } : {},
|
|
6588
|
+
os: `Android ${android[1]}`
|
|
6589
|
+
};
|
|
6590
|
+
}
|
|
6591
|
+
if (/Macintosh|Mac OS X/.test(userAgent)) {
|
|
6592
|
+
if (touchPoints > 1) return { ...details, type: "tablet", brand: "Apple", model: "iPad", os: "iOS" };
|
|
6593
|
+
return { ...details, type: "computer", brand: "Apple", model: "Mac", os: "macOS" };
|
|
6594
|
+
}
|
|
6595
|
+
const computer = [
|
|
6596
|
+
[/Windows/, "Windows"],
|
|
6597
|
+
[/CrOS/, "ChromeOS"],
|
|
6598
|
+
[/Linux/, "Linux"]
|
|
6599
|
+
].find(([pattern]) => pattern.test(userAgent));
|
|
6600
|
+
return computer ? { ...details, type: "computer", os: computer[1] } : details;
|
|
6601
|
+
}
|
|
6602
|
+
function uprightScreen(screen, type) {
|
|
6603
|
+
if (!(screen.width > 0 && screen.height > 0)) return void 0;
|
|
6604
|
+
if (type === "computer") return { width: screen.width, height: screen.height };
|
|
6605
|
+
return { width: Math.min(screen.width, screen.height), height: Math.max(screen.width, screen.height) };
|
|
6606
|
+
}
|
|
6607
|
+
function cleanDeviceDetails(details) {
|
|
6608
|
+
const texts = ["brand", "model", "os", "browser", "appVersion", "appBuild"].flatMap((key) => {
|
|
6609
|
+
const value = details[key]?.trim().slice(0, DEVICE_DETAIL_MAX_LENGTH);
|
|
6610
|
+
return value ? [[key, value]] : [];
|
|
6611
|
+
});
|
|
6612
|
+
const width = Math.round(details.screen?.width ?? 0);
|
|
6613
|
+
const height = Math.round(details.screen?.height ?? 0);
|
|
6614
|
+
const screen = width > 0 && height > 0 && width <= SCREEN_MAX && height <= SCREEN_MAX ? { width, height } : null;
|
|
6615
|
+
return {
|
|
6616
|
+
...details.platform && APP_PLATFORMS.includes(details.platform) ? { platform: details.platform } : {},
|
|
6617
|
+
...details.type && DEVICE_TYPES.includes(details.type) ? { type: details.type } : {},
|
|
6618
|
+
...Object.fromEntries(texts),
|
|
6619
|
+
...screen ? { screen } : {}
|
|
6620
|
+
};
|
|
6621
|
+
}
|
|
6622
|
+
function browserOf(userAgent) {
|
|
6623
|
+
for (const [pattern, name] of BROWSERS) {
|
|
6624
|
+
const match = pattern.exec(userAgent);
|
|
6625
|
+
if (match) return `${name} ${match[1]}`;
|
|
6626
|
+
}
|
|
6627
|
+
return void 0;
|
|
6628
|
+
}
|
|
6629
|
+
function brandOf(model) {
|
|
6630
|
+
return ANDROID_BRANDS.find(([pattern]) => pattern.test(model))?.[1];
|
|
6631
|
+
}
|
|
6632
|
+
|
|
6499
6633
|
// src/models/sdk.constants.ts
|
|
6500
6634
|
var OFFLINE_NOTICE_MS = 3e3;
|
|
6501
6635
|
var ANDROID_NAVIGATION_BAR = 48;
|
|
6502
6636
|
var DEFAULT_MAX_PHOTOS = 4;
|
|
6637
|
+
var ANDROID_TABLET_SIDE = 600;
|
|
6638
|
+
var EXPO_DEVICE_TYPES = { 1: "phone", 2: "tablet", 3: "computer" };
|
|
6503
6639
|
var CHAT_STORAGE_ID = "zean-chat";
|
|
6504
6640
|
var LINK_RETRY_MS = 1500;
|
|
6505
6641
|
var LINK_RETRIES = 5;
|
|
@@ -6571,7 +6707,7 @@ function deviceLanguages() {
|
|
|
6571
6707
|
}
|
|
6572
6708
|
function appBundle() {
|
|
6573
6709
|
if (import_react_native.Platform.OS !== "ios" && import_react_native.Platform.OS !== "android") return void 0;
|
|
6574
|
-
const id =
|
|
6710
|
+
const id = text(expoApplication()?.applicationId) ?? text(detail(deviceInfo()?.getBundleId));
|
|
6575
6711
|
return id ? { os: import_react_native.Platform.OS, id } : void 0;
|
|
6576
6712
|
}
|
|
6577
6713
|
function chatStorage(storage) {
|
|
@@ -6638,23 +6774,38 @@ function isKeyValue(value) {
|
|
|
6638
6774
|
const { getItem, setItem } = value;
|
|
6639
6775
|
return typeof getItem === "function" && typeof setItem === "function";
|
|
6640
6776
|
}
|
|
6641
|
-
function
|
|
6777
|
+
function expoApplication() {
|
|
6642
6778
|
try {
|
|
6643
|
-
|
|
6644
|
-
return typeof expo?.applicationId === "string" ? expo.applicationId : null;
|
|
6779
|
+
return require("expo-application");
|
|
6645
6780
|
} catch {
|
|
6646
6781
|
return null;
|
|
6647
6782
|
}
|
|
6648
6783
|
}
|
|
6649
|
-
function
|
|
6784
|
+
function expoDevice() {
|
|
6785
|
+
try {
|
|
6786
|
+
return require("expo-device");
|
|
6787
|
+
} catch {
|
|
6788
|
+
return null;
|
|
6789
|
+
}
|
|
6790
|
+
}
|
|
6791
|
+
function deviceInfo() {
|
|
6650
6792
|
try {
|
|
6651
6793
|
const module2 = require("react-native-device-info");
|
|
6652
|
-
|
|
6653
|
-
return typeof getBundleId === "function" ? getBundleId() : null;
|
|
6794
|
+
return module2 && { ...module2.default, ...module2 };
|
|
6654
6795
|
} catch {
|
|
6655
6796
|
return null;
|
|
6656
6797
|
}
|
|
6657
6798
|
}
|
|
6799
|
+
function detail(read) {
|
|
6800
|
+
try {
|
|
6801
|
+
return read?.();
|
|
6802
|
+
} catch {
|
|
6803
|
+
return void 0;
|
|
6804
|
+
}
|
|
6805
|
+
}
|
|
6806
|
+
function text(value) {
|
|
6807
|
+
return typeof value === "string" && value.trim() !== "" && value !== "unknown" ? value : void 0;
|
|
6808
|
+
}
|
|
6658
6809
|
function isDevBuild() {
|
|
6659
6810
|
return typeof __DEV__ !== "undefined" && __DEV__;
|
|
6660
6811
|
}
|
|
@@ -6676,10 +6827,57 @@ function objectOf(data) {
|
|
|
6676
6827
|
}
|
|
6677
6828
|
return typeof value === "object" && value !== null ? value : null;
|
|
6678
6829
|
}
|
|
6679
|
-
function
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6830
|
+
function deviceDetails() {
|
|
6831
|
+
const screen = import_react_native.Dimensions.get("screen");
|
|
6832
|
+
const system = systemDetails(screen);
|
|
6833
|
+
const installed = import_react_native.Platform.OS === "web" ? {} : installedDetails();
|
|
6834
|
+
const type = installed.type ?? system.type;
|
|
6835
|
+
return cleanDeviceDetails({
|
|
6836
|
+
...system,
|
|
6837
|
+
platform: "react_native",
|
|
6838
|
+
type,
|
|
6839
|
+
brand: installed.brand ?? system.brand,
|
|
6840
|
+
model: installed.model ?? system.model,
|
|
6841
|
+
screen: uprightScreen(screen, type),
|
|
6842
|
+
appVersion: installed.appVersion,
|
|
6843
|
+
appBuild: installed.appBuild
|
|
6844
|
+
});
|
|
6845
|
+
}
|
|
6846
|
+
function systemDetails(screen) {
|
|
6847
|
+
if (import_react_native.Platform.OS === "ios") {
|
|
6848
|
+
const pad = import_react_native.Platform.isPad;
|
|
6849
|
+
return { type: pad ? "tablet" : "phone", brand: "Apple", model: pad ? "iPad" : "iPhone", os: `iOS ${import_react_native.Platform.Version}` };
|
|
6850
|
+
}
|
|
6851
|
+
if (import_react_native.Platform.OS === "android") {
|
|
6852
|
+
const { Release, Brand, Manufacturer, Model } = import_react_native.Platform.constants;
|
|
6853
|
+
const tablet = Math.min(screen.width, screen.height) >= ANDROID_TABLET_SIDE;
|
|
6854
|
+
return { type: tablet ? "tablet" : "phone", brand: brandName(Brand || Manufacturer), model: Model, os: `Android ${Release}` };
|
|
6855
|
+
}
|
|
6856
|
+
if (import_react_native.Platform.OS === "web") {
|
|
6857
|
+
const { userAgent, maxTouchPoints } = globalThis.navigator;
|
|
6858
|
+
return detailsFromUserAgent(userAgent, maxTouchPoints);
|
|
6859
|
+
}
|
|
6860
|
+
return {};
|
|
6861
|
+
}
|
|
6862
|
+
function installedDetails() {
|
|
6863
|
+
const device = expoDevice();
|
|
6864
|
+
const application = expoApplication();
|
|
6865
|
+
const info = deviceInfo();
|
|
6866
|
+
const tablet = detail(info?.isTablet);
|
|
6867
|
+
const infoType = typeof tablet === "boolean" ? tablet ? "tablet" : "phone" : void 0;
|
|
6868
|
+
return {
|
|
6869
|
+
type: EXPO_DEVICE_TYPES[Number(device?.deviceType)] ?? infoType,
|
|
6870
|
+
brand: brandName(text(device?.brand) ?? text(detail(info?.getBrand))),
|
|
6871
|
+
model: text(device?.modelName) ?? text(detail(info?.getModel)),
|
|
6872
|
+
appVersion: text(application?.nativeApplicationVersion) ?? text(detail(info?.getVersion)),
|
|
6873
|
+
appBuild: text(application?.nativeBuildVersion) ?? text(detail(info?.getBuildNumber))
|
|
6874
|
+
};
|
|
6875
|
+
}
|
|
6876
|
+
function brandName(brand) {
|
|
6877
|
+
if (!brand) return void 0;
|
|
6878
|
+
const shouted = brand.length > 3 && brand === brand.toUpperCase();
|
|
6879
|
+
if (brand !== brand.toLowerCase() && !shouted) return brand;
|
|
6880
|
+
return brand.charAt(0).toUpperCase() + brand.slice(1).toLowerCase();
|
|
6683
6881
|
}
|
|
6684
6882
|
function screenInsets() {
|
|
6685
6883
|
if (import_react_native.Platform.OS === "android") {
|
|
@@ -6831,7 +7029,6 @@ function useChatContext() {
|
|
|
6831
7029
|
// src/i18n/en.ts
|
|
6832
7030
|
var en = {
|
|
6833
7031
|
ai: "AI",
|
|
6834
|
-
request_human: "Talk to a Member",
|
|
6835
7032
|
close_chat: "Close chat",
|
|
6836
7033
|
online: "Online",
|
|
6837
7034
|
away: "Away for now",
|
|
@@ -6891,7 +7088,6 @@ var en = {
|
|
|
6891
7088
|
// src/i18n/fr.ts
|
|
6892
7089
|
var fr = {
|
|
6893
7090
|
ai: "IA",
|
|
6894
|
-
request_human: "Parler \xE0 un membre",
|
|
6895
7091
|
close_chat: "Fermer le chat",
|
|
6896
7092
|
online: "En ligne",
|
|
6897
7093
|
away: "Absents pour le moment",
|
|
@@ -7605,11 +7801,11 @@ var styles6 = import_react_native10.StyleSheet.create({
|
|
|
7605
7801
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
7606
7802
|
function Composer() {
|
|
7607
7803
|
const { chat: chat2, t, colors } = useChatContext();
|
|
7608
|
-
const [
|
|
7609
|
-
const typed = (0, import_react8.useRef)(
|
|
7804
|
+
const [text2, setText] = (0, import_react8.useState)(() => chat2.draft()?.text ?? "");
|
|
7805
|
+
const typed = (0, import_react8.useRef)(text2);
|
|
7610
7806
|
const pending = usePendingPhotos();
|
|
7611
7807
|
const picker = photoPicker();
|
|
7612
|
-
const canSend = !pending.sending && (
|
|
7808
|
+
const canSend = !pending.sending && (text2.trim().length > 0 || pending.photos.length > 0);
|
|
7613
7809
|
const draft2 = (0, import_react8.useSyncExternalStore)(subscribeChatView, chatDraft);
|
|
7614
7810
|
const changeText = (value) => {
|
|
7615
7811
|
typed.current = value;
|
|
@@ -7621,8 +7817,8 @@ function Composer() {
|
|
|
7621
7817
|
clearDraft();
|
|
7622
7818
|
}, [draft2]);
|
|
7623
7819
|
(0, import_react8.useEffect)(() => {
|
|
7624
|
-
chat2.saveDraft({ text, files: pending.draftFiles });
|
|
7625
|
-
}, [chat2,
|
|
7820
|
+
chat2.saveDraft({ text: text2, files: pending.draftFiles });
|
|
7821
|
+
}, [chat2, text2, pending.draftFiles]);
|
|
7626
7822
|
const handleSend = async () => {
|
|
7627
7823
|
const attachments = pending.photos.length > 0 ? await pending.send() : [];
|
|
7628
7824
|
if (!attachments) return;
|
|
@@ -7660,7 +7856,7 @@ function Composer() {
|
|
|
7660
7856
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
7661
7857
|
import_react_native11.TextInput,
|
|
7662
7858
|
{
|
|
7663
|
-
value:
|
|
7859
|
+
value: text2,
|
|
7664
7860
|
onChangeText: (value) => {
|
|
7665
7861
|
changeText(value);
|
|
7666
7862
|
chat2.typing();
|
|
@@ -8033,7 +8229,7 @@ function MessageQuote({ quote, app, onQuote }) {
|
|
|
8033
8229
|
const image = quoteImageOf(quote);
|
|
8034
8230
|
const links = useAttachmentLinks(chat2, image ? [image.key] : [], true);
|
|
8035
8231
|
const url = image && links.get(image.key);
|
|
8036
|
-
const
|
|
8232
|
+
const text2 = quoteLineOf(quote, { deleted: t.message_deleted, photo: t.photo });
|
|
8037
8233
|
const { deleted } = quote;
|
|
8038
8234
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
8039
8235
|
import_react_native17.Pressable,
|
|
@@ -8051,7 +8247,7 @@ function MessageQuote({ quote, app, onQuote }) {
|
|
|
8051
8247
|
children: [
|
|
8052
8248
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native17.View, { style: styles11.lines, children: [
|
|
8053
8249
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native17.Text, { style: [styles11.name, { color: colors.primaryText }], numberOfLines: 1, children: quoteAuthorOf(quote, t.you, app.name) }),
|
|
8054
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native17.Text, { style: [styles11.text, { color: colors.muted }, quote.deleted && styles11.deleted], numberOfLines: 1, children:
|
|
8250
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native17.Text, { style: [styles11.text, { color: colors.muted }, quote.deleted && styles11.deleted], numberOfLines: 1, children: text2 })
|
|
8055
8251
|
] }),
|
|
8056
8252
|
image && (url ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native17.Image, { source: { uri: url }, style: [styles11.thumb, { borderColor: colors.border }], accessibilityIgnoresInvertColors: true }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Skeleton, { style: [styles11.thumb, { borderColor: colors.border }] }))
|
|
8057
8253
|
]
|
|
@@ -8189,7 +8385,6 @@ var MessageBubble = (0, import_react13.memo)(function MessageBubble2({ row, app,
|
|
|
8189
8385
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(MessageFiles, { attachments: message.attachments, own: false, stored: true })
|
|
8190
8386
|
] })
|
|
8191
8387
|
] }),
|
|
8192
|
-
message.ai && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native19.Pressable, { accessibilityRole: "button", onPress: () => chat2.send(t.request_human), hitSlop: 8, style: styles13.teamMeta, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native19.Text, { style: [styles13.human, { color: colors.primaryText }], children: t.request_human }) }),
|
|
8193
8388
|
endsRun && !row.welcome && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native19.View, { style: styles13.teamMeta, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(MessageMeta, { row, onRetry: handleRetry }) })
|
|
8194
8389
|
] })
|
|
8195
8390
|
]
|
|
@@ -8218,7 +8413,6 @@ var styles13 = import_react_native19.StyleSheet.create({
|
|
|
8218
8413
|
avatar: { width: AVATAR },
|
|
8219
8414
|
teamColumn: { flexShrink: 1, alignItems: "flex-start", gap: 4 },
|
|
8220
8415
|
teamMeta: { marginLeft: AVATAR + 8 },
|
|
8221
|
-
human: { fontSize: 13, fontWeight: "600", textDecorationLine: "underline", paddingVertical: 8 },
|
|
8222
8416
|
bubble: {
|
|
8223
8417
|
borderRadius: RADII.group,
|
|
8224
8418
|
paddingHorizontal: 14,
|
|
@@ -8559,7 +8753,8 @@ function ZeanChat({
|
|
|
8559
8753
|
// A chosen language goes first: the chat takes the first one it speaks.
|
|
8560
8754
|
languages: locale ? [locale] : deviceLanguages(),
|
|
8561
8755
|
deviceLanguage: deviceLanguages()[0],
|
|
8562
|
-
|
|
8756
|
+
// Read again each time the chat tells the backend about the device.
|
|
8757
|
+
deviceDetails,
|
|
8563
8758
|
// Checked against the App's Bundle ID or Package name: another app with the same key shows no chat.
|
|
8564
8759
|
bundle: appBundle(),
|
|
8565
8760
|
// The Conversation stays on the phone: the next start shows it at once and asks only for newer messages.
|
|
@@ -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. */
|
|
@@ -256,16 +256,30 @@ export interface MMKVModule {
|
|
|
256
256
|
id: string;
|
|
257
257
|
}) => ZeanMMKV;
|
|
258
258
|
}
|
|
259
|
-
/** `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. */
|
|
260
260
|
export interface ExpoApplicationModule {
|
|
261
261
|
applicationId: string | null;
|
|
262
|
+
nativeApplicationVersion: string | null;
|
|
263
|
+
nativeBuildVersion: string | null;
|
|
262
264
|
}
|
|
263
|
-
/** `
|
|
264
|
-
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 {
|
|
265
273
|
getBundleId?: () => string;
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
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;
|
|
269
283
|
}
|
|
270
284
|
export interface ImagePickerModule {
|
|
271
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"
|