@zean-chat/react-native 0.1.12 → 0.1.13

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.
Files changed (3) hide show
  1. package/README.md +13 -1
  2. package/dist/index.js +10 -5
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Add a free customer support chat inside your iOS and Android app, with [Zean](https://zean.chat/?utm_source=npm&utm_medium=readme&utm_campaign=react-native). Plain React Native: no native module of its own, works in Expo Go. Your App key is in your Zean dashboard.
4
4
 
5
- First, in App settings, set your app's Bundle ID (iOS) and Package name (Android): the chat shows only in that app, and always in Expo Go.
5
+ Before release, in App settings, set your app's Production Bundle ID (iOS) and Production Package name (Android): a release build shows the chat only with those, or with the optional Development ones (a test build such as `com.acme.app.dev`). A development build (`__DEV__`, 0.1.13 or later) and Expo Go always show it.
6
6
 
7
7
  ```bash
8
8
  npx expo install @zean-chat/react-native expo-application @react-native-async-storage/async-storage expo-image-picker
@@ -45,6 +45,18 @@ Notifications.setBadgeCountAsync(unreadCount);
45
45
 
46
46
  `isZeanNotification(data)` tells a Zean push from your own. Full guide: [push notifications](https://zean.chat/docs/push-notifications).
47
47
 
48
+ Your server already sends pushes? Ignore `push.tokens` and skip `setPushToken`. On `message.member`, find the person by `data.contact.externalId` and send `push.title` and `push.body` with your own tokens. Attach `push.data` so `openFromNotification` opens the chat on tap, or call `useZean().open()` in your own tap handler.
49
+
50
+ ## Test devices
51
+
52
+ A development build with 0.1.11 or later, or any build of your Development app, that opened the chat in the last 24 hours is a Test device. Its events never go to the webhook address, only to the Zean CLI. Write a message from it, then:
53
+
54
+ ```bash
55
+ npx zean-cli trigger message.member
56
+ ```
57
+
58
+ It writes a real test reply in its Conversation, so the push is real. See the [Zean CLI](https://zean.chat/docs/cli).
59
+
48
60
  ## Why Zean
49
61
 
50
62
  - Free plan to start. Paid plans in FCFA, payable by Mobile Money.
package/dist/index.js CHANGED
@@ -279,7 +279,13 @@ function createChatStore(backend, options) {
279
279
  state = derive();
280
280
  for (const listener of listeners2) listener();
281
281
  };
282
- const args = () => ({ appKey: options.appKey, deviceSecret, host: options.host, bundle: options.bundle });
282
+ const args = () => ({
283
+ appKey: options.appKey,
284
+ deviceSecret,
285
+ host: options.host,
286
+ bundle: options.bundle,
287
+ ...options.dev ? { dev: true } : {}
288
+ });
283
289
  const deviceLanguage = options.deviceLanguage ?? options.languages[0];
284
290
  const devLoad = options.dev === true || options.host !== void 0 && isLocalHost(options.host) || options.bundle !== void 0 && isExpoGo(options.bundle);
285
291
  const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
@@ -402,7 +408,7 @@ function createChatStore(backend, options) {
402
408
  emit2();
403
409
  if ("report" in result && result.report && !reported) {
404
410
  reported = true;
405
- backend.call("reportInstall", { ...args(), ...options.dev ? { dev: true } : {} }).catch(() => {
411
+ backend.call("reportInstall", args()).catch(() => {
406
412
  });
407
413
  }
408
414
  startOnce();
@@ -437,9 +443,8 @@ function createChatStore(backend, options) {
437
443
  function startOnce() {
438
444
  if (started || state.status === "loading" || state.status === "hidden") return;
439
445
  started = true;
440
- if (state.known || devLoad)
441
- backend.call("start", { ...args(), device: device(), ...options.dev ? { dev: true } : {} }).catch(() => {
442
- });
446
+ if (state.known || devLoad) backend.call("start", { ...args(), device: device() }).catch(() => {
447
+ });
443
448
  for (const entry of outbox) if (entry.error === null) deliver(entry);
444
449
  }
445
450
  function handleTyping(result) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zean-chat/react-native",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
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",