@zean-chat/react-native 0.1.2 → 0.1.4

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/index.js CHANGED
@@ -31,6 +31,8 @@ var import_react14 = require("react");
31
31
  // ../shared/src/constants/app.ts
32
32
  var APP_NAME = "Zean";
33
33
  var PRODUCTION_BACKEND_URL = "https://api.zean.chat";
34
+ var STAGING_APP_KEY_PREFIX = "app_stg_";
35
+ var STAGING_BACKEND_URL = "https://api-stg.zean.chat";
34
36
  var SUPPORTED_LOCALES = ["fr", "en"];
35
37
  var DEFAULT_LOCALE = "fr";
36
38
 
@@ -6010,6 +6012,12 @@ function createChat(options) {
6010
6012
  return createChatStore(convexBackend(options.backendUrl), options);
6011
6013
  }
6012
6014
 
6015
+ // ../shared/src/utils/app-keys.ts
6016
+ var isStagingKey = (appKey) => appKey.startsWith(STAGING_APP_KEY_PREFIX);
6017
+ function backendUrlFor(appKey) {
6018
+ return isStagingKey(appKey) ? STAGING_BACKEND_URL : PRODUCTION_BACKEND_URL;
6019
+ }
6020
+
6013
6021
  // src/models/sdk.store.ts
6014
6022
  var chat = null;
6015
6023
  var open = false;
@@ -7406,7 +7414,7 @@ function ZeanChat({
7406
7414
  attributes: attributes2,
7407
7415
  locale,
7408
7416
  colorScheme,
7409
- backendUrl = PRODUCTION_BACKEND_URL
7417
+ backendUrl = backendUrlFor(appKey)
7410
7418
  }) {
7411
7419
  const [chat2, setChat] = (0, import_react14.useState)(null);
7412
7420
  const storageRef = (0, import_react14.useRef)(storage);
@@ -31,7 +31,11 @@ export interface ZeanChatProps {
31
31
  locale?: ZeanLocale;
32
32
  /** Leave it out: the phone's. */
33
33
  colorScheme?: ZeanColorScheme;
34
- /** Where the chat's backend is. Leave it out: the default is Zean's own. */
34
+ /**
35
+ * Where the chat's backend is. Leave it out: the App key says which of Zean's own. For local development only, so
36
+ * left out of the documentation.
37
+ * @internal
38
+ */
35
39
  backendUrl?: string;
36
40
  }
37
41
  /** The chat's methods, and the count of replies the Contact has not seen. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zean-chat/react-native",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
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",