@sendoracloud/sdk-react-native 0.20.1 → 1.0.1

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
@@ -392,11 +392,16 @@ var Auth = class {
392
392
  */
393
393
  signIn(email, password) {
394
394
  return this.serialize(async () => {
395
+ let prevAnonRefreshToken;
396
+ if (this.user?.isAnonymous) {
397
+ const stashed = this.hooks.storage.get(REFRESH_KEY);
398
+ if (stashed) prevAnonRefreshToken = stashed;
399
+ }
395
400
  if (this.user !== null) await this.wipeLocalIdentity();
396
401
  const res = await post(
397
402
  { apiUrl: this.hooks.apiUrl, publicKey: this.hooks.publicKey, debug: this.hooks.debug },
398
403
  "/api/v1/auth-service/login",
399
- { email, password }
404
+ prevAnonRefreshToken ? { email, password, prevAnonRefreshToken } : { email, password }
400
405
  );
401
406
  if (!res) throw new AuthError("NETWORK_ERROR", "Network request failed");
402
407
  let parsed;
@@ -1644,7 +1649,7 @@ function installAutoTrack(args) {
1644
1649
  }
1645
1650
 
1646
1651
  // src/index.ts
1647
- var SDK_VERSION = "0.16.1";
1652
+ var SDK_VERSION = "1.0.0";
1648
1653
  var DEFAULT_API_URL = "https://api.sendoracloud.com";
1649
1654
  var ANON_KEY = "anon_id";
1650
1655
  var USER_ID_KEY = "user_id";
@@ -1898,7 +1903,6 @@ var SendoraSDK = class {
1898
1903
  { apiUrl: this.config.apiUrl, publicKey: this.config.publicKey, debug: this.debug },
1899
1904
  "/api/v1/push/tokens",
1900
1905
  {
1901
- orgId: this.config.orgId,
1902
1906
  userId: this.userId,
1903
1907
  anonymousId: this.anonId,
1904
1908
  token: reg.token,
@@ -2430,7 +2434,6 @@ var SendoraSDK = class {
2430
2434
  { apiUrl: this.config.apiUrl, publicKey: this.config.publicKey, debug: this.debug },
2431
2435
  "/api/v1/events",
2432
2436
  {
2433
- orgId: this.config.orgId,
2434
2437
  ...this.config.projectId ? { projectId: this.config.projectId } : {},
2435
2438
  module: kind === "identify" ? "profiles" : "analytics",
2436
2439
  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
@@ -349,11 +349,16 @@ var Auth = class {
349
349
  */
350
350
  signIn(email, password) {
351
351
  return this.serialize(async () => {
352
+ let prevAnonRefreshToken;
353
+ if (this.user?.isAnonymous) {
354
+ const stashed = this.hooks.storage.get(REFRESH_KEY);
355
+ if (stashed) prevAnonRefreshToken = stashed;
356
+ }
352
357
  if (this.user !== null) await this.wipeLocalIdentity();
353
358
  const res = await post(
354
359
  { apiUrl: this.hooks.apiUrl, publicKey: this.hooks.publicKey, debug: this.hooks.debug },
355
360
  "/api/v1/auth-service/login",
356
- { email, password }
361
+ prevAnonRefreshToken ? { email, password, prevAnonRefreshToken } : { email, password }
357
362
  );
358
363
  if (!res) throw new AuthError("NETWORK_ERROR", "Network request failed");
359
364
  let parsed;
@@ -1606,7 +1611,7 @@ function installAutoTrack(args) {
1606
1611
  }
1607
1612
 
1608
1613
  // src/index.ts
1609
- var SDK_VERSION = "0.16.1";
1614
+ var SDK_VERSION = "1.0.0";
1610
1615
  var DEFAULT_API_URL = "https://api.sendoracloud.com";
1611
1616
  var ANON_KEY = "anon_id";
1612
1617
  var USER_ID_KEY = "user_id";
@@ -1860,7 +1865,6 @@ var SendoraSDK = class {
1860
1865
  { apiUrl: this.config.apiUrl, publicKey: this.config.publicKey, debug: this.debug },
1861
1866
  "/api/v1/push/tokens",
1862
1867
  {
1863
- orgId: this.config.orgId,
1864
1868
  userId: this.userId,
1865
1869
  anonymousId: this.anonId,
1866
1870
  token: reg.token,
@@ -2392,7 +2396,6 @@ var SendoraSDK = class {
2392
2396
  { apiUrl: this.config.apiUrl, publicKey: this.config.publicKey, debug: this.debug },
2393
2397
  "/api/v1/events",
2394
2398
  {
2395
- orgId: this.config.orgId,
2396
2399
  ...this.config.projectId ? { projectId: this.config.projectId } : {},
2397
2400
  module: kind === "identify" ? "profiles" : "analytics",
2398
2401
  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.1",
3
+ "version": "1.0.1",
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",