@sendoracloud/sdk-react-native 1.8.2 → 1.9.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
@@ -43,6 +43,7 @@ __export(index_exports, {
43
43
  });
44
44
  module.exports = __toCommonJS(index_exports);
45
45
  var import_react_native_get_random_values = require("react-native-get-random-values");
46
+ var import_react_native4 = require("react-native");
46
47
 
47
48
  // src/storage.ts
48
49
  var PREFIX = "sendora_";
@@ -222,7 +223,7 @@ async function request(opts, method, path, body, extraHeaders, reqOpts) {
222
223
  // package.json
223
224
  var package_default = {
224
225
  name: "@sendoracloud/sdk-react-native",
225
- version: "1.8.2",
226
+ version: "1.9.0",
226
227
  description: "Sendora Cloud React Native + Expo SDK \u2014 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`).",
227
228
  type: "module",
228
229
  main: "./dist/index.cjs",
@@ -2035,6 +2036,22 @@ function byteLength(s) {
2035
2036
  return s.length * 4;
2036
2037
  }
2037
2038
  }
2039
+ function buildDeviceContext(appVersion) {
2040
+ try {
2041
+ const os = import_react_native4.Platform?.OS;
2042
+ if (os !== "ios" && os !== "android") return void 0;
2043
+ const isPad = os === "ios" && import_react_native4.Platform.isPad === true;
2044
+ return {
2045
+ type: isPad ? "tablet" : "mobile",
2046
+ os: os === "ios" ? "iOS" : "Android",
2047
+ osVersion: String(import_react_native4.Platform.Version ?? ""),
2048
+ model: "",
2049
+ appVersion: appVersion ?? ""
2050
+ };
2051
+ } catch {
2052
+ return void 0;
2053
+ }
2054
+ }
2038
2055
  var SendoraSDK = class {
2039
2056
  constructor() {
2040
2057
  this.config = null;
@@ -2837,6 +2854,7 @@ var SendoraSDK = class {
2837
2854
  async sendEvent(kind, payload) {
2838
2855
  if (!this.config) return;
2839
2856
  if (!this.consentGranted) return;
2857
+ const device = buildDeviceContext(this.config.appVersion);
2840
2858
  await post(
2841
2859
  { apiUrl: this.config.apiUrl, publicKey: this.config.publicKey, debug: this.debug },
2842
2860
  "/api/v1/events",
@@ -2851,6 +2869,7 @@ var SendoraSDK = class {
2851
2869
  context: {
2852
2870
  platform: "react-native",
2853
2871
  sdk: { name: "@sendoracloud/sdk-react-native", version: SDK_VERSION },
2872
+ ...device ? { device } : {},
2854
2873
  ...this.config.environment ? { environment: this.config.environment } : {},
2855
2874
  ...kind === "identify" ? { traits: payload.traits } : {}
2856
2875
  }
package/dist/index.d.cts CHANGED
@@ -816,6 +816,14 @@ interface SendoraConfig {
816
816
  * Added 0.16.0.
817
817
  */
818
818
  linkDomain?: string;
819
+ /**
820
+ * Your app's version (e.g. "2.4.0"). Attached to every event's
821
+ * `context.device.appVersion` so the dashboard can break analytics down by
822
+ * release (ADR-022). Optional — RN has no zero-dep way to auto-read the
823
+ * host app version, so supply it (e.g. from `expo-constants` /
824
+ * `react-native-device-info`) if you want app-version analytics.
825
+ */
826
+ appVersion?: string;
819
827
  }
820
828
  type TraitValue = string | number | boolean | null | undefined;
821
829
  interface IdentifyTraits {
package/dist/index.d.ts CHANGED
@@ -816,6 +816,14 @@ interface SendoraConfig {
816
816
  * Added 0.16.0.
817
817
  */
818
818
  linkDomain?: string;
819
+ /**
820
+ * Your app's version (e.g. "2.4.0"). Attached to every event's
821
+ * `context.device.appVersion` so the dashboard can break analytics down by
822
+ * release (ADR-022). Optional — RN has no zero-dep way to auto-read the
823
+ * host app version, so supply it (e.g. from `expo-constants` /
824
+ * `react-native-device-info`) if you want app-version analytics.
825
+ */
826
+ appVersion?: string;
819
827
  }
820
828
  type TraitValue = string | number | boolean | null | undefined;
821
829
  interface IdentifyTraits {
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  // src/index.ts
2
2
  import "react-native-get-random-values";
3
+ import { Platform } from "react-native";
3
4
 
4
5
  // src/storage.ts
5
6
  var PREFIX = "sendora_";
@@ -179,7 +180,7 @@ async function request(opts, method, path, body, extraHeaders, reqOpts) {
179
180
  // package.json
180
181
  var package_default = {
181
182
  name: "@sendoracloud/sdk-react-native",
182
- version: "1.8.2",
183
+ version: "1.9.0",
183
184
  description: "Sendora Cloud React Native + Expo SDK \u2014 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`).",
184
185
  type: "module",
185
186
  main: "./dist/index.cjs",
@@ -1997,6 +1998,22 @@ function byteLength(s) {
1997
1998
  return s.length * 4;
1998
1999
  }
1999
2000
  }
2001
+ function buildDeviceContext(appVersion) {
2002
+ try {
2003
+ const os = Platform?.OS;
2004
+ if (os !== "ios" && os !== "android") return void 0;
2005
+ const isPad = os === "ios" && Platform.isPad === true;
2006
+ return {
2007
+ type: isPad ? "tablet" : "mobile",
2008
+ os: os === "ios" ? "iOS" : "Android",
2009
+ osVersion: String(Platform.Version ?? ""),
2010
+ model: "",
2011
+ appVersion: appVersion ?? ""
2012
+ };
2013
+ } catch {
2014
+ return void 0;
2015
+ }
2016
+ }
2000
2017
  var SendoraSDK = class {
2001
2018
  constructor() {
2002
2019
  this.config = null;
@@ -2799,6 +2816,7 @@ var SendoraSDK = class {
2799
2816
  async sendEvent(kind, payload) {
2800
2817
  if (!this.config) return;
2801
2818
  if (!this.consentGranted) return;
2819
+ const device = buildDeviceContext(this.config.appVersion);
2802
2820
  await post(
2803
2821
  { apiUrl: this.config.apiUrl, publicKey: this.config.publicKey, debug: this.debug },
2804
2822
  "/api/v1/events",
@@ -2813,6 +2831,7 @@ var SendoraSDK = class {
2813
2831
  context: {
2814
2832
  platform: "react-native",
2815
2833
  sdk: { name: "@sendoracloud/sdk-react-native", version: SDK_VERSION },
2834
+ ...device ? { device } : {},
2816
2835
  ...this.config.environment ? { environment: this.config.environment } : {},
2817
2836
  ...kind === "identify" ? { traits: payload.traits } : {}
2818
2837
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendoracloud/sdk-react-native",
3
- "version": "1.8.2",
3
+ "version": "1.9.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",