@sendoracloud/sdk-react-native 0.9.0 → 0.10.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/dist/index.cjs CHANGED
@@ -767,7 +767,7 @@ function decodeJwtPayload(token) {
767
767
  }
768
768
 
769
769
  // src/index.ts
770
- var SDK_VERSION = "0.4.0";
770
+ var SDK_VERSION = "0.10.0";
771
771
  var DEFAULT_API_URL = "https://api.sendoracloud.com";
772
772
  var ANON_KEY = "anon_id";
773
773
  var USER_ID_KEY = "user_id";
@@ -816,7 +816,7 @@ var SendoraSDK = class {
816
816
  }
817
817
  /** Initialize the SDK. Must be awaited at app startup before identify/track. */
818
818
  async init(config) {
819
- const rawKey = String(config.publicKey ?? "").trim();
819
+ const rawKey = String(config.apiKey ?? config.publicKey ?? "").trim();
820
820
  if (/^sk_/i.test(rawKey) || /sk_(prod|staging|dev|live|test)_/i.test(rawKey)) {
821
821
  throw new Error(
822
822
  "[sendoracloud] Secret key (sk_*) detected. The client SDK must only receive public keys (pk_*). Secret keys belong on your server."
@@ -861,6 +861,10 @@ var SendoraSDK = class {
861
861
  environment: "prod",
862
862
  consentedByDefault: true,
863
863
  ...config,
864
+ // Store rawKey on BOTH fields so any downstream reader that
865
+ // grabbed the legacy `publicKey` field keeps working, and
866
+ // future code reading `apiKey` does too.
867
+ apiKey: rawKey,
864
868
  publicKey: rawKey
865
869
  };
866
870
  this.auth = new Auth({
package/dist/index.d.cts CHANGED
@@ -241,9 +241,23 @@ declare class Auth {
241
241
  }
242
242
 
243
243
  interface SendoraConfig {
244
- /** Public API key (pk_live_... or pk_test_...). Secret keys are refused. */
245
- publicKey: string;
246
- /** Org UUID defaults to the key's bound org, but can be overridden for test harnesses. */
244
+ /**
245
+ * Public API key (`pk_live_…` or `pk_test_…`). Secret keys are refused.
246
+ * Canonical name as of 0.10.0 pre-0.10.0 callers using `publicKey`
247
+ * still work via the deprecated alias below.
248
+ */
249
+ apiKey?: string;
250
+ /**
251
+ * @deprecated Use `apiKey` instead (0.10.0+ canonical name across
252
+ * sdk-web / sdk-ios / sdk-android). Kept for back-compat — when
253
+ * both are set, `apiKey` wins.
254
+ */
255
+ publicKey?: string;
256
+ /**
257
+ * @deprecated 0.10.0 — backend now derives org from the API key
258
+ * row server-side. Kept for test harnesses that need to override
259
+ * the bound org explicitly.
260
+ */
247
261
  orgId?: string;
248
262
  /** Backend base URL. Defaults to Sendora's production API. */
249
263
  apiUrl?: string;
package/dist/index.d.ts CHANGED
@@ -241,9 +241,23 @@ declare class Auth {
241
241
  }
242
242
 
243
243
  interface SendoraConfig {
244
- /** Public API key (pk_live_... or pk_test_...). Secret keys are refused. */
245
- publicKey: string;
246
- /** Org UUID defaults to the key's bound org, but can be overridden for test harnesses. */
244
+ /**
245
+ * Public API key (`pk_live_…` or `pk_test_…`). Secret keys are refused.
246
+ * Canonical name as of 0.10.0 pre-0.10.0 callers using `publicKey`
247
+ * still work via the deprecated alias below.
248
+ */
249
+ apiKey?: string;
250
+ /**
251
+ * @deprecated Use `apiKey` instead (0.10.0+ canonical name across
252
+ * sdk-web / sdk-ios / sdk-android). Kept for back-compat — when
253
+ * both are set, `apiKey` wins.
254
+ */
255
+ publicKey?: string;
256
+ /**
257
+ * @deprecated 0.10.0 — backend now derives org from the API key
258
+ * row server-side. Kept for test harnesses that need to override
259
+ * the bound org explicitly.
260
+ */
247
261
  orgId?: string;
248
262
  /** Backend base URL. Defaults to Sendora's production API. */
249
263
  apiUrl?: string;
package/dist/index.js CHANGED
@@ -727,7 +727,7 @@ function decodeJwtPayload(token) {
727
727
  }
728
728
 
729
729
  // src/index.ts
730
- var SDK_VERSION = "0.4.0";
730
+ var SDK_VERSION = "0.10.0";
731
731
  var DEFAULT_API_URL = "https://api.sendoracloud.com";
732
732
  var ANON_KEY = "anon_id";
733
733
  var USER_ID_KEY = "user_id";
@@ -776,7 +776,7 @@ var SendoraSDK = class {
776
776
  }
777
777
  /** Initialize the SDK. Must be awaited at app startup before identify/track. */
778
778
  async init(config) {
779
- const rawKey = String(config.publicKey ?? "").trim();
779
+ const rawKey = String(config.apiKey ?? config.publicKey ?? "").trim();
780
780
  if (/^sk_/i.test(rawKey) || /sk_(prod|staging|dev|live|test)_/i.test(rawKey)) {
781
781
  throw new Error(
782
782
  "[sendoracloud] Secret key (sk_*) detected. The client SDK must only receive public keys (pk_*). Secret keys belong on your server."
@@ -821,6 +821,10 @@ var SendoraSDK = class {
821
821
  environment: "prod",
822
822
  consentedByDefault: true,
823
823
  ...config,
824
+ // Store rawKey on BOTH fields so any downstream reader that
825
+ // grabbed the legacy `publicKey` field keeps working, and
826
+ // future code reading `apiKey` does too.
827
+ apiKey: rawKey,
824
828
  publicKey: rawKey
825
829
  };
826
830
  this.auth = new Auth({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendoracloud/sdk-react-native",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "Sendora Cloud React Native + Expo SDK — analytics, identity, push-token registration, auth. Expo Go compatible, no native modules beyond AsyncStorage.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",