@sendoracloud/sdk-react-native 1.14.0 → 1.16.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
@@ -139,7 +139,7 @@ var Storage = class {
139
139
  // package.json
140
140
  var package_default = {
141
141
  name: "@sendoracloud/sdk-react-native",
142
- version: "1.14.0",
142
+ version: "1.16.0",
143
143
  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`).",
144
144
  type: "module",
145
145
  main: "./dist/index.cjs",
@@ -2046,7 +2046,7 @@ function byteLength(s) {
2046
2046
  return s.length * 4;
2047
2047
  }
2048
2048
  }
2049
- function buildDeviceContext(appVersion) {
2049
+ function buildDeviceContext(appVersion, appBuild) {
2050
2050
  try {
2051
2051
  const os = import_react_native4.Platform?.OS;
2052
2052
  if (os !== "ios" && os !== "android") return void 0;
@@ -2056,7 +2056,8 @@ function buildDeviceContext(appVersion) {
2056
2056
  os: os === "ios" ? "iOS" : "Android",
2057
2057
  osVersion: String(import_react_native4.Platform.Version ?? ""),
2058
2058
  model: expoDeviceModel(),
2059
- appVersion: resolveAppVersion(appVersion)
2059
+ appVersion: resolveAppVersion(appVersion),
2060
+ appBuild: resolveAppBuild(appBuild)
2060
2061
  };
2061
2062
  } catch {
2062
2063
  return void 0;
@@ -2069,6 +2070,14 @@ function expoModule(name) {
2069
2070
  if (m && typeof m === "object") return m;
2070
2071
  } catch {
2071
2072
  }
2073
+ try {
2074
+ const g = globalThis;
2075
+ const nm = import_react_native4.NativeModules;
2076
+ const proxy = g?.expo?.modules?.NativeModulesProxy ?? nm?.NativeUnimoduleProxy;
2077
+ const consts = proxy?.modulesConstants?.[name];
2078
+ if (consts && typeof consts === "object") return consts;
2079
+ } catch {
2080
+ }
2072
2081
  try {
2073
2082
  const nm = import_react_native4.NativeModules;
2074
2083
  const m = nm?.[name];
@@ -2077,12 +2086,17 @@ function expoModule(name) {
2077
2086
  }
2078
2087
  return void 0;
2079
2088
  }
2080
- function expoNativeAppVersion() {
2089
+ function expoApplicationVersion() {
2090
+ const a = expoModule("ExpoApplication");
2091
+ const v = a?.nativeApplicationVersion;
2092
+ return typeof v === "string" && v ? v : "";
2093
+ }
2094
+ function expoConstantsVersion() {
2081
2095
  const c = expoModule("ExponentConstants") ?? expoModule("ExpoConstants");
2082
2096
  if (!c) return "";
2083
2097
  if (typeof c.nativeAppVersion === "string" && c.nativeAppVersion) return c.nativeAppVersion;
2084
2098
  try {
2085
- const raw = c.expoConfig ?? c.manifest ?? c.manifest2;
2099
+ const raw = c.manifest ?? c.expoConfig ?? c.manifest2;
2086
2100
  const m = typeof raw === "string" ? JSON.parse(raw) : raw;
2087
2101
  const v = m?.version;
2088
2102
  return typeof v === "string" ? v : "";
@@ -2097,8 +2111,10 @@ function expoDeviceModel() {
2097
2111
  }
2098
2112
  function resolveAppVersion(configAppVersion) {
2099
2113
  if (configAppVersion) return configAppVersion;
2100
- const native = expoNativeAppVersion();
2101
- if (native) return native;
2114
+ const appMod = expoApplicationVersion();
2115
+ if (appMod) return appMod;
2116
+ const constMod = expoConstantsVersion();
2117
+ if (constMod) return constMod;
2102
2118
  try {
2103
2119
  const env = process.env.EXPO_PUBLIC_APP_VERSION;
2104
2120
  if (env) return env;
@@ -2107,6 +2123,18 @@ function resolveAppVersion(configAppVersion) {
2107
2123
  const g = globalThis.__SENDORA_APP_VERSION__;
2108
2124
  return typeof g === "string" ? g : "";
2109
2125
  }
2126
+ function expoApplicationBuild() {
2127
+ const a = expoModule("ExpoApplication");
2128
+ const v = a?.nativeBuildVersion;
2129
+ return typeof v === "string" && v ? v : "";
2130
+ }
2131
+ function resolveAppBuild(configAppBuild) {
2132
+ if (configAppBuild) return configAppBuild;
2133
+ const appMod = expoApplicationBuild();
2134
+ if (appMod) return appMod;
2135
+ const g = globalThis.__SENDORA_APP_BUILD__;
2136
+ return typeof g === "string" ? g : "";
2137
+ }
2110
2138
  var SendoraSDK = class {
2111
2139
  constructor() {
2112
2140
  this.config = null;
@@ -2917,7 +2945,7 @@ var SendoraSDK = class {
2917
2945
  async sendEvent(kind, payload) {
2918
2946
  if (!this.config) return;
2919
2947
  if (!this.consentGranted) return;
2920
- const device = buildDeviceContext(this.config.appVersion);
2948
+ const device = buildDeviceContext(this.config.appVersion, this.config.appBuild);
2921
2949
  await post(
2922
2950
  { apiUrl: this.config.apiUrl, publicKey: this.config.publicKey, debug: this.debug },
2923
2951
  "/api/v1/events",
package/dist/index.d.cts CHANGED
@@ -824,6 +824,12 @@ interface SendoraConfig {
824
824
  * `react-native-device-info`) if you want app-version analytics.
825
825
  */
826
826
  appVersion?: string;
827
+ /**
828
+ * App build number (iOS `CFBundleVersion` / Android `versionCode`). Auto-read
829
+ * from expo-application's `nativeBuildVersion` when present; supply here to
830
+ * override or for non-Expo apps. Shown as "version (build)" on the dashboard.
831
+ */
832
+ appBuild?: string;
827
833
  }
828
834
  type TraitValue = string | number | boolean | null | undefined;
829
835
  interface IdentifyTraits {
package/dist/index.d.ts CHANGED
@@ -824,6 +824,12 @@ interface SendoraConfig {
824
824
  * `react-native-device-info`) if you want app-version analytics.
825
825
  */
826
826
  appVersion?: string;
827
+ /**
828
+ * App build number (iOS `CFBundleVersion` / Android `versionCode`). Auto-read
829
+ * from expo-application's `nativeBuildVersion` when present; supply here to
830
+ * override or for non-Expo apps. Shown as "version (build)" on the dashboard.
831
+ */
832
+ appBuild?: string;
827
833
  }
828
834
  type TraitValue = string | number | boolean | null | undefined;
829
835
  interface IdentifyTraits {
package/dist/index.js CHANGED
@@ -96,7 +96,7 @@ var Storage = class {
96
96
  // package.json
97
97
  var package_default = {
98
98
  name: "@sendoracloud/sdk-react-native",
99
- version: "1.14.0",
99
+ version: "1.16.0",
100
100
  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`).",
101
101
  type: "module",
102
102
  main: "./dist/index.cjs",
@@ -2008,7 +2008,7 @@ function byteLength(s) {
2008
2008
  return s.length * 4;
2009
2009
  }
2010
2010
  }
2011
- function buildDeviceContext(appVersion) {
2011
+ function buildDeviceContext(appVersion, appBuild) {
2012
2012
  try {
2013
2013
  const os = Platform?.OS;
2014
2014
  if (os !== "ios" && os !== "android") return void 0;
@@ -2018,7 +2018,8 @@ function buildDeviceContext(appVersion) {
2018
2018
  os: os === "ios" ? "iOS" : "Android",
2019
2019
  osVersion: String(Platform.Version ?? ""),
2020
2020
  model: expoDeviceModel(),
2021
- appVersion: resolveAppVersion(appVersion)
2021
+ appVersion: resolveAppVersion(appVersion),
2022
+ appBuild: resolveAppBuild(appBuild)
2022
2023
  };
2023
2024
  } catch {
2024
2025
  return void 0;
@@ -2031,6 +2032,14 @@ function expoModule(name) {
2031
2032
  if (m && typeof m === "object") return m;
2032
2033
  } catch {
2033
2034
  }
2035
+ try {
2036
+ const g = globalThis;
2037
+ const nm = NativeModules;
2038
+ const proxy = g?.expo?.modules?.NativeModulesProxy ?? nm?.NativeUnimoduleProxy;
2039
+ const consts = proxy?.modulesConstants?.[name];
2040
+ if (consts && typeof consts === "object") return consts;
2041
+ } catch {
2042
+ }
2034
2043
  try {
2035
2044
  const nm = NativeModules;
2036
2045
  const m = nm?.[name];
@@ -2039,12 +2048,17 @@ function expoModule(name) {
2039
2048
  }
2040
2049
  return void 0;
2041
2050
  }
2042
- function expoNativeAppVersion() {
2051
+ function expoApplicationVersion() {
2052
+ const a = expoModule("ExpoApplication");
2053
+ const v = a?.nativeApplicationVersion;
2054
+ return typeof v === "string" && v ? v : "";
2055
+ }
2056
+ function expoConstantsVersion() {
2043
2057
  const c = expoModule("ExponentConstants") ?? expoModule("ExpoConstants");
2044
2058
  if (!c) return "";
2045
2059
  if (typeof c.nativeAppVersion === "string" && c.nativeAppVersion) return c.nativeAppVersion;
2046
2060
  try {
2047
- const raw = c.expoConfig ?? c.manifest ?? c.manifest2;
2061
+ const raw = c.manifest ?? c.expoConfig ?? c.manifest2;
2048
2062
  const m = typeof raw === "string" ? JSON.parse(raw) : raw;
2049
2063
  const v = m?.version;
2050
2064
  return typeof v === "string" ? v : "";
@@ -2059,8 +2073,10 @@ function expoDeviceModel() {
2059
2073
  }
2060
2074
  function resolveAppVersion(configAppVersion) {
2061
2075
  if (configAppVersion) return configAppVersion;
2062
- const native = expoNativeAppVersion();
2063
- if (native) return native;
2076
+ const appMod = expoApplicationVersion();
2077
+ if (appMod) return appMod;
2078
+ const constMod = expoConstantsVersion();
2079
+ if (constMod) return constMod;
2064
2080
  try {
2065
2081
  const env = process.env.EXPO_PUBLIC_APP_VERSION;
2066
2082
  if (env) return env;
@@ -2069,6 +2085,18 @@ function resolveAppVersion(configAppVersion) {
2069
2085
  const g = globalThis.__SENDORA_APP_VERSION__;
2070
2086
  return typeof g === "string" ? g : "";
2071
2087
  }
2088
+ function expoApplicationBuild() {
2089
+ const a = expoModule("ExpoApplication");
2090
+ const v = a?.nativeBuildVersion;
2091
+ return typeof v === "string" && v ? v : "";
2092
+ }
2093
+ function resolveAppBuild(configAppBuild) {
2094
+ if (configAppBuild) return configAppBuild;
2095
+ const appMod = expoApplicationBuild();
2096
+ if (appMod) return appMod;
2097
+ const g = globalThis.__SENDORA_APP_BUILD__;
2098
+ return typeof g === "string" ? g : "";
2099
+ }
2072
2100
  var SendoraSDK = class {
2073
2101
  constructor() {
2074
2102
  this.config = null;
@@ -2879,7 +2907,7 @@ var SendoraSDK = class {
2879
2907
  async sendEvent(kind, payload) {
2880
2908
  if (!this.config) return;
2881
2909
  if (!this.consentGranted) return;
2882
- const device = buildDeviceContext(this.config.appVersion);
2910
+ const device = buildDeviceContext(this.config.appVersion, this.config.appBuild);
2883
2911
  await post(
2884
2912
  { apiUrl: this.config.apiUrl, publicKey: this.config.publicKey, debug: this.debug },
2885
2913
  "/api/v1/events",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendoracloud/sdk-react-native",
3
- "version": "1.14.0",
3
+ "version": "1.16.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",