@sendoracloud/sdk-react-native 0.20.0 → 1.0.0

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 CHANGED
@@ -40,6 +40,15 @@ That's it. Since 0.17.0 the SDK bundles `react-native-get-random-values` as a ha
40
40
 
41
41
  > **Upgrading from 0.16.x?** You can delete the `import "react-native-get-random-values";` line from your `index.js` / `index.tsx` entry file — it's now a no-op (the SDK side-effect-loads the polyfill itself). Leaving it in does no harm.
42
42
 
43
+ > **Upgrading from 0.x to 1.0?** Delete the `orgId` (and any legacy `publicKey`) fields from your `SendoraCloud.init({...})` call — the backend now resolves the org from the API key server-side. All public method signatures are unchanged.
44
+ >
45
+ > ```diff
46
+ > await SendoraCloud.init({
47
+ > apiKey: "pk_prod_...",
48
+ > - orgId: "<ORG_ID>",
49
+ > });
50
+ > ```
51
+
43
52
  ### Optional peers (deep links)
44
53
 
45
54
  | Peer | When to install |
@@ -236,7 +245,7 @@ Full reference + edge-case writeup: [/docs/quickstart-react-native#anon-existing
236
245
 
237
246
  ## Stability
238
247
 
239
- This SDK is on the **0.16.x line**. Patch bumps (0.16.x0.16.y) are backwards-compatible; minor bumps may include breaking changes — always read the [CHANGELOG](https://github.com/sendoracloud/sdk-react-native/blob/main/CHANGELOG.md) before upgrading. 1.0 ships once the SDK has soaked 2 consecutive months in production without a schema change.
248
+ This SDK is on the **1.x line**. Patch bumps (1.x.y1.x.z) are backwards-compatible; minor bumps may include opt-in feature additions. Breaking changes only on major bumps — always read the [CHANGELOG](./CHANGELOG.md) before upgrading.
240
249
 
241
250
  ## JWT verification (custom backend)
242
251
 
package/dist/index.cjs CHANGED
@@ -195,6 +195,7 @@ async function request(opts, method, path, body, extraHeaders) {
195
195
  }
196
196
 
197
197
  // src/auth.ts
198
+ var import_react_native = require("react-native");
198
199
  var TOKEN_KEY = "auth_access_token";
199
200
  var TOKEN_EXPIRES_KEY = "auth_access_expires";
200
201
  var REFRESH_KEY = "auth_refresh_token";
@@ -850,8 +851,7 @@ var Auth = class {
850
851
  void tick();
851
852
  }, TICK_MS);
852
853
  try {
853
- const RN = require("react-native");
854
- const subscription = RN.AppState?.addEventListener?.("change", (state) => {
854
+ const subscription = import_react_native.AppState?.addEventListener?.("change", (state) => {
855
855
  if (state === "active") void tick();
856
856
  });
857
857
  if (subscription) {
@@ -1004,7 +1004,7 @@ function decodeJwtPayload(token) {
1004
1004
  }
1005
1005
 
1006
1006
  // src/links.ts
1007
- var import_react_native = require("react-native");
1007
+ var import_react_native2 = require("react-native");
1008
1008
  var LinkError = class extends Error {
1009
1009
  constructor(code, message, statusCode = 0, details) {
1010
1010
  super(message);
@@ -1083,10 +1083,10 @@ function dynRequire(id) {
1083
1083
  }
1084
1084
  function loadRn() {
1085
1085
  return {
1086
- Platform: import_react_native.Platform,
1087
- Dimensions: import_react_native.Dimensions,
1088
- NativeModules: import_react_native.NativeModules,
1089
- Linking: import_react_native.Linking
1086
+ Platform: import_react_native2.Platform,
1087
+ Dimensions: import_react_native2.Dimensions,
1088
+ NativeModules: import_react_native2.NativeModules,
1089
+ Linking: import_react_native2.Linking
1090
1090
  };
1091
1091
  }
1092
1092
  function readTimezone() {
@@ -1568,7 +1568,7 @@ var Links = class {
1568
1568
  };
1569
1569
 
1570
1570
  // src/auto-track.ts
1571
- var import_react_native2 = require("react-native");
1571
+ var import_react_native3 = require("react-native");
1572
1572
  var DEFAULT_IDLE_MS = 30 * 60 * 1e3;
1573
1573
  function resolveFlags(cfg) {
1574
1574
  if (cfg === false) {
@@ -1612,7 +1612,7 @@ function installAutoTrack(args) {
1612
1612
  args.fire("app.opened", { sessionId });
1613
1613
  }
1614
1614
  if (flags.appBackground) {
1615
- const AppState = import_react_native2.AppState;
1615
+ const AppState = import_react_native3.AppState;
1616
1616
  if (AppState && typeof AppState.addEventListener === "function") {
1617
1617
  const handler = (state) => {
1618
1618
  ensureSession(true);
@@ -1644,7 +1644,7 @@ function installAutoTrack(args) {
1644
1644
  }
1645
1645
 
1646
1646
  // src/index.ts
1647
- var SDK_VERSION = "0.16.1";
1647
+ var SDK_VERSION = "1.0.0";
1648
1648
  var DEFAULT_API_URL = "https://api.sendoracloud.com";
1649
1649
  var ANON_KEY = "anon_id";
1650
1650
  var USER_ID_KEY = "user_id";
@@ -1898,7 +1898,6 @@ var SendoraSDK = class {
1898
1898
  { apiUrl: this.config.apiUrl, publicKey: this.config.publicKey, debug: this.debug },
1899
1899
  "/api/v1/push/tokens",
1900
1900
  {
1901
- orgId: this.config.orgId,
1902
1901
  userId: this.userId,
1903
1902
  anonymousId: this.anonId,
1904
1903
  token: reg.token,
@@ -2430,7 +2429,6 @@ var SendoraSDK = class {
2430
2429
  { apiUrl: this.config.apiUrl, publicKey: this.config.publicKey, debug: this.debug },
2431
2430
  "/api/v1/events",
2432
2431
  {
2433
- orgId: this.config.orgId,
2434
2432
  ...this.config.projectId ? { projectId: this.config.projectId } : {},
2435
2433
  module: kind === "identify" ? "profiles" : "analytics",
2436
2434
  eventType: payload.eventType ?? (kind === "identify" ? "identify" : "track"),
package/dist/index.d.cts CHANGED
@@ -608,12 +608,6 @@ interface SendoraConfig {
608
608
  * both are set, `apiKey` wins.
609
609
  */
610
610
  publicKey?: string;
611
- /**
612
- * @deprecated 0.10.0 — backend now derives org from the API key
613
- * row server-side. Kept for test harnesses that need to override
614
- * the bound org explicitly.
615
- */
616
- orgId?: string;
617
611
  /** Backend base URL. Defaults to Sendora's production API. */
618
612
  apiUrl?: string;
619
613
  /** `"prod"` | `"staging"` | `"dev"` routing hint. For API-key auth this
@@ -716,8 +710,7 @@ interface PushTokenReceipt {
716
710
  * import SendoraCloud from "@sendoracloud/sdk-react-native";
717
711
  *
718
712
  * await SendoraCloud.init({
719
- * publicKey: "pk_prod_...",
720
- * orgId: "<ORG_ID>",
713
+ * apiKey: "pk_prod_...",
721
714
  * projectId: "<PROJECT_ID>",
722
715
  * });
723
716
  *
package/dist/index.d.ts CHANGED
@@ -608,12 +608,6 @@ interface SendoraConfig {
608
608
  * both are set, `apiKey` wins.
609
609
  */
610
610
  publicKey?: string;
611
- /**
612
- * @deprecated 0.10.0 — backend now derives org from the API key
613
- * row server-side. Kept for test harnesses that need to override
614
- * the bound org explicitly.
615
- */
616
- orgId?: string;
617
611
  /** Backend base URL. Defaults to Sendora's production API. */
618
612
  apiUrl?: string;
619
613
  /** `"prod"` | `"staging"` | `"dev"` routing hint. For API-key auth this
@@ -716,8 +710,7 @@ interface PushTokenReceipt {
716
710
  * import SendoraCloud from "@sendoracloud/sdk-react-native";
717
711
  *
718
712
  * await SendoraCloud.init({
719
- * publicKey: "pk_prod_...",
720
- * orgId: "<ORG_ID>",
713
+ * apiKey: "pk_prod_...",
721
714
  * projectId: "<PROJECT_ID>",
722
715
  * });
723
716
  *
package/dist/index.js CHANGED
@@ -1,10 +1,3 @@
1
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined") return require.apply(this, arguments);
5
- throw Error('Dynamic require of "' + x + '" is not supported');
6
- });
7
-
8
1
  // src/index.ts
9
2
  import "react-native-get-random-values";
10
3
 
@@ -159,6 +152,7 @@ async function request(opts, method, path, body, extraHeaders) {
159
152
  }
160
153
 
161
154
  // src/auth.ts
155
+ import { AppState as RnAppState } from "react-native";
162
156
  var TOKEN_KEY = "auth_access_token";
163
157
  var TOKEN_EXPIRES_KEY = "auth_access_expires";
164
158
  var REFRESH_KEY = "auth_refresh_token";
@@ -814,8 +808,7 @@ var Auth = class {
814
808
  void tick();
815
809
  }, TICK_MS);
816
810
  try {
817
- const RN = __require("react-native");
818
- const subscription = RN.AppState?.addEventListener?.("change", (state) => {
811
+ const subscription = RnAppState?.addEventListener?.("change", (state) => {
819
812
  if (state === "active") void tick();
820
813
  });
821
814
  if (subscription) {
@@ -1537,7 +1530,7 @@ var Links = class {
1537
1530
  };
1538
1531
 
1539
1532
  // src/auto-track.ts
1540
- import { AppState as RnAppState } from "react-native";
1533
+ import { AppState as RnAppState2 } from "react-native";
1541
1534
  var DEFAULT_IDLE_MS = 30 * 60 * 1e3;
1542
1535
  function resolveFlags(cfg) {
1543
1536
  if (cfg === false) {
@@ -1581,7 +1574,7 @@ function installAutoTrack(args) {
1581
1574
  args.fire("app.opened", { sessionId });
1582
1575
  }
1583
1576
  if (flags.appBackground) {
1584
- const AppState = RnAppState;
1577
+ const AppState = RnAppState2;
1585
1578
  if (AppState && typeof AppState.addEventListener === "function") {
1586
1579
  const handler = (state) => {
1587
1580
  ensureSession(true);
@@ -1613,7 +1606,7 @@ function installAutoTrack(args) {
1613
1606
  }
1614
1607
 
1615
1608
  // src/index.ts
1616
- var SDK_VERSION = "0.16.1";
1609
+ var SDK_VERSION = "1.0.0";
1617
1610
  var DEFAULT_API_URL = "https://api.sendoracloud.com";
1618
1611
  var ANON_KEY = "anon_id";
1619
1612
  var USER_ID_KEY = "user_id";
@@ -1867,7 +1860,6 @@ var SendoraSDK = class {
1867
1860
  { apiUrl: this.config.apiUrl, publicKey: this.config.publicKey, debug: this.debug },
1868
1861
  "/api/v1/push/tokens",
1869
1862
  {
1870
- orgId: this.config.orgId,
1871
1863
  userId: this.userId,
1872
1864
  anonymousId: this.anonId,
1873
1865
  token: reg.token,
@@ -2399,7 +2391,6 @@ var SendoraSDK = class {
2399
2391
  { apiUrl: this.config.apiUrl, publicKey: this.config.publicKey, debug: this.debug },
2400
2392
  "/api/v1/events",
2401
2393
  {
2402
- orgId: this.config.orgId,
2403
2394
  ...this.config.projectId ? { projectId: this.config.projectId } : {},
2404
2395
  module: kind === "identify" ? "profiles" : "analytics",
2405
2396
  eventType: payload.eventType ?? (kind === "identify" ? "identify" : "track"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendoracloud/sdk-react-native",
3
- "version": "0.20.0",
3
+ "version": "1.0.0",
4
4
  "description": "Sendora Cloud React Native + Expo SDK — analytics, identity, push-token registration, auth, deep links (Branch / Firebase Dynamic Links parity). Auth + analytics + deep links work in Expo Go; push token registration requires a Dev Client (EAS Build or `npx expo prebuild`).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",