@sendoracloud/sdk-react-native 1.8.2 → 1.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 +30 -1
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +30 -1
- package/package.json +1 -1
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.
|
|
226
|
+
version: "1.10.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,32 @@ 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: resolveAppVersion(appVersion)
|
|
2050
|
+
};
|
|
2051
|
+
} catch {
|
|
2052
|
+
return void 0;
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
function resolveAppVersion(configAppVersion) {
|
|
2056
|
+
if (configAppVersion) return configAppVersion;
|
|
2057
|
+
try {
|
|
2058
|
+
const env = process.env.EXPO_PUBLIC_APP_VERSION;
|
|
2059
|
+
if (env) return env;
|
|
2060
|
+
} catch {
|
|
2061
|
+
}
|
|
2062
|
+
const g = globalThis.__SENDORA_APP_VERSION__;
|
|
2063
|
+
return typeof g === "string" ? g : "";
|
|
2064
|
+
}
|
|
2038
2065
|
var SendoraSDK = class {
|
|
2039
2066
|
constructor() {
|
|
2040
2067
|
this.config = null;
|
|
@@ -2837,6 +2864,7 @@ var SendoraSDK = class {
|
|
|
2837
2864
|
async sendEvent(kind, payload) {
|
|
2838
2865
|
if (!this.config) return;
|
|
2839
2866
|
if (!this.consentGranted) return;
|
|
2867
|
+
const device = buildDeviceContext(this.config.appVersion);
|
|
2840
2868
|
await post(
|
|
2841
2869
|
{ apiUrl: this.config.apiUrl, publicKey: this.config.publicKey, debug: this.debug },
|
|
2842
2870
|
"/api/v1/events",
|
|
@@ -2851,6 +2879,7 @@ var SendoraSDK = class {
|
|
|
2851
2879
|
context: {
|
|
2852
2880
|
platform: "react-native",
|
|
2853
2881
|
sdk: { name: "@sendoracloud/sdk-react-native", version: SDK_VERSION },
|
|
2882
|
+
...device ? { device } : {},
|
|
2854
2883
|
...this.config.environment ? { environment: this.config.environment } : {},
|
|
2855
2884
|
...kind === "identify" ? { traits: payload.traits } : {}
|
|
2856
2885
|
}
|
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.
|
|
183
|
+
version: "1.10.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,32 @@ 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: resolveAppVersion(appVersion)
|
|
2012
|
+
};
|
|
2013
|
+
} catch {
|
|
2014
|
+
return void 0;
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
2017
|
+
function resolveAppVersion(configAppVersion) {
|
|
2018
|
+
if (configAppVersion) return configAppVersion;
|
|
2019
|
+
try {
|
|
2020
|
+
const env = process.env.EXPO_PUBLIC_APP_VERSION;
|
|
2021
|
+
if (env) return env;
|
|
2022
|
+
} catch {
|
|
2023
|
+
}
|
|
2024
|
+
const g = globalThis.__SENDORA_APP_VERSION__;
|
|
2025
|
+
return typeof g === "string" ? g : "";
|
|
2026
|
+
}
|
|
2000
2027
|
var SendoraSDK = class {
|
|
2001
2028
|
constructor() {
|
|
2002
2029
|
this.config = null;
|
|
@@ -2799,6 +2826,7 @@ var SendoraSDK = class {
|
|
|
2799
2826
|
async sendEvent(kind, payload) {
|
|
2800
2827
|
if (!this.config) return;
|
|
2801
2828
|
if (!this.consentGranted) return;
|
|
2829
|
+
const device = buildDeviceContext(this.config.appVersion);
|
|
2802
2830
|
await post(
|
|
2803
2831
|
{ apiUrl: this.config.apiUrl, publicKey: this.config.publicKey, debug: this.debug },
|
|
2804
2832
|
"/api/v1/events",
|
|
@@ -2813,6 +2841,7 @@ var SendoraSDK = class {
|
|
|
2813
2841
|
context: {
|
|
2814
2842
|
platform: "react-native",
|
|
2815
2843
|
sdk: { name: "@sendoracloud/sdk-react-native", version: SDK_VERSION },
|
|
2844
|
+
...device ? { device } : {},
|
|
2816
2845
|
...this.config.environment ? { environment: this.config.environment } : {},
|
|
2817
2846
|
...kind === "identify" ? { traits: payload.traits } : {}
|
|
2818
2847
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sendoracloud/sdk-react-native",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.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",
|