@sendoracloud/sdk-react-native 1.13.0 → 1.14.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
@@ -136,7 +136,84 @@ var Storage = class {
136
136
  }
137
137
  };
138
138
 
139
+ // package.json
140
+ var package_default = {
141
+ name: "@sendoracloud/sdk-react-native",
142
+ version: "1.14.0",
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
+ type: "module",
145
+ main: "./dist/index.cjs",
146
+ module: "./dist/index.js",
147
+ types: "./dist/index.d.ts",
148
+ exports: {
149
+ ".": {
150
+ types: "./dist/index.d.ts",
151
+ import: "./dist/index.js",
152
+ require: "./dist/index.cjs"
153
+ },
154
+ "./contact-widget": {
155
+ types: "./dist/contact-widget.d.ts",
156
+ import: "./dist/contact-widget.js",
157
+ require: "./dist/contact-widget.cjs"
158
+ }
159
+ },
160
+ files: [
161
+ "dist",
162
+ "examples",
163
+ "README.md",
164
+ "LICENSE"
165
+ ],
166
+ keywords: [
167
+ "sendora",
168
+ "react-native",
169
+ "expo",
170
+ "analytics",
171
+ "tracking",
172
+ "customer-engagement"
173
+ ],
174
+ dependencies: {
175
+ "react-native-get-random-values": "^1.11.0"
176
+ },
177
+ peerDependencies: {
178
+ "@react-native-async-storage/async-storage": ">=1.17.0",
179
+ "react-native": ">=0.70.0",
180
+ "react-native-webview": ">=13.0.0"
181
+ },
182
+ peerDependenciesMeta: {
183
+ "@react-native-async-storage/async-storage": {
184
+ optional: false
185
+ },
186
+ "react-native": {
187
+ optional: false
188
+ },
189
+ "react-native-webview": {
190
+ optional: true
191
+ }
192
+ },
193
+ scripts: {
194
+ build: "tsup src/index.ts src/contact-widget.tsx --format esm,cjs --dts --clean --external react --external react-native --external react-native-webview",
195
+ typecheck: "tsc --noEmit"
196
+ },
197
+ devDependencies: {
198
+ "@types/react": "^19.2.16",
199
+ "react-native": "^0.85.3",
200
+ "react-native-webview": "^13.16.1",
201
+ tsup: "^8.0.0",
202
+ typescript: "^5.0.0"
203
+ },
204
+ license: "MIT",
205
+ repository: {
206
+ type: "git",
207
+ url: "https://github.com/sendoracloud/sdk-react-native"
208
+ },
209
+ homepage: "https://sendoracloud.com/sdks"
210
+ };
211
+
212
+ // src/version.ts
213
+ var SDK_VERSION = package_default.version;
214
+
139
215
  // src/http.ts
216
+ var SDK_NAME = "@sendoracloud/sdk-react-native";
140
217
  var NetworkTimeoutError = class extends Error {
141
218
  constructor(method, path, timeoutMs) {
142
219
  super(`Request timed out: ${method} ${path} (${timeoutMs}ms)`);
@@ -179,6 +256,13 @@ async function request(opts, method, path, body, extraHeaders, reqOpts) {
179
256
  // silently 401'd. Do not change this header without updating
180
257
  // apps/backend/src/middleware/auth.ts in lockstep.
181
258
  "x-api-key": opts.publicKey,
259
+ // ADR-023: identify the SDK + version on every request so the
260
+ // backend can attribute traffic + drive version-adoption /
261
+ // compatibility telemetry. Additive — the server ignores these
262
+ // today. Placed before extraHeaders so a caller could override
263
+ // if ever needed (none do).
264
+ "X-Sendora-SDK-Name": SDK_NAME,
265
+ "X-Sendora-SDK-Version": SDK_VERSION,
182
266
  ...extraHeaders ?? {}
183
267
  },
184
268
  body: body !== void 0 ? JSON.stringify(body) : void 0,
@@ -220,82 +304,6 @@ async function request(opts, method, path, body, extraHeaders, reqOpts) {
220
304
  return res;
221
305
  }
222
306
 
223
- // package.json
224
- var package_default = {
225
- name: "@sendoracloud/sdk-react-native",
226
- version: "1.13.0",
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`).",
228
- type: "module",
229
- main: "./dist/index.cjs",
230
- module: "./dist/index.js",
231
- types: "./dist/index.d.ts",
232
- exports: {
233
- ".": {
234
- types: "./dist/index.d.ts",
235
- import: "./dist/index.js",
236
- require: "./dist/index.cjs"
237
- },
238
- "./contact-widget": {
239
- types: "./dist/contact-widget.d.ts",
240
- import: "./dist/contact-widget.js",
241
- require: "./dist/contact-widget.cjs"
242
- }
243
- },
244
- files: [
245
- "dist",
246
- "examples",
247
- "README.md",
248
- "LICENSE"
249
- ],
250
- keywords: [
251
- "sendora",
252
- "react-native",
253
- "expo",
254
- "analytics",
255
- "tracking",
256
- "customer-engagement"
257
- ],
258
- dependencies: {
259
- "react-native-get-random-values": "^1.11.0"
260
- },
261
- peerDependencies: {
262
- "@react-native-async-storage/async-storage": ">=1.17.0",
263
- "react-native": ">=0.70.0",
264
- "react-native-webview": ">=13.0.0"
265
- },
266
- peerDependenciesMeta: {
267
- "@react-native-async-storage/async-storage": {
268
- optional: false
269
- },
270
- "react-native": {
271
- optional: false
272
- },
273
- "react-native-webview": {
274
- optional: true
275
- }
276
- },
277
- scripts: {
278
- build: "tsup src/index.ts src/contact-widget.tsx --format esm,cjs --dts --clean --external react --external react-native --external react-native-webview",
279
- typecheck: "tsc --noEmit"
280
- },
281
- devDependencies: {
282
- "@types/react": "^19.2.16",
283
- "react-native": "^0.85.3",
284
- "react-native-webview": "^13.16.1",
285
- tsup: "^8.0.0",
286
- typescript: "^5.0.0"
287
- },
288
- license: "MIT",
289
- repository: {
290
- type: "git",
291
- url: "https://github.com/sendoracloud/sdk-react-native"
292
- },
293
- homepage: "https://sendoracloud.com/sdks"
294
- };
295
-
296
- // src/version.ts
297
- var SDK_VERSION = package_default.version;
298
-
299
307
  // src/auth.ts
300
308
  var import_react_native = require("react-native");
301
309
  var TOKEN_KEY = "auth_access_token";
@@ -1983,6 +1991,8 @@ function installAutoTrack(args) {
1983
1991
  var DEFAULT_API_URL = "https://api.sendoracloud.com";
1984
1992
  var ANON_KEY = "anon_id";
1985
1993
  var USER_ID_KEY = "user_id";
1994
+ var SCHEMA_VERSION_KEY = "schema_version";
1995
+ var SCHEMA_VERSION = "1";
1986
1996
  var AUTH_HYDRATE_KEYS = [
1987
1997
  "auth_access_token",
1988
1998
  "auth_access_expires",
@@ -2155,7 +2165,15 @@ var SendoraSDK = class {
2155
2165
  `[sendoracloud] apiUrl override active: ${apiUrl} \u2014 confirm this is intentional. Tokens + events will be sent here.`
2156
2166
  );
2157
2167
  }
2158
- await this.storage.hydrate([ANON_KEY, USER_ID_KEY, ...AUTH_HYDRATE_KEYS]);
2168
+ await this.storage.hydrate([
2169
+ ANON_KEY,
2170
+ USER_ID_KEY,
2171
+ SCHEMA_VERSION_KEY,
2172
+ ...AUTH_HYDRATE_KEYS
2173
+ ]);
2174
+ if (!this.storage.get(SCHEMA_VERSION_KEY)) {
2175
+ this.storage.set(SCHEMA_VERSION_KEY, SCHEMA_VERSION);
2176
+ }
2159
2177
  let anon = this.storage.get(ANON_KEY);
2160
2178
  if (!anon) {
2161
2179
  anon = uuid();
package/dist/index.js CHANGED
@@ -93,7 +93,84 @@ var Storage = class {
93
93
  }
94
94
  };
95
95
 
96
+ // package.json
97
+ var package_default = {
98
+ name: "@sendoracloud/sdk-react-native",
99
+ version: "1.14.0",
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
+ type: "module",
102
+ main: "./dist/index.cjs",
103
+ module: "./dist/index.js",
104
+ types: "./dist/index.d.ts",
105
+ exports: {
106
+ ".": {
107
+ types: "./dist/index.d.ts",
108
+ import: "./dist/index.js",
109
+ require: "./dist/index.cjs"
110
+ },
111
+ "./contact-widget": {
112
+ types: "./dist/contact-widget.d.ts",
113
+ import: "./dist/contact-widget.js",
114
+ require: "./dist/contact-widget.cjs"
115
+ }
116
+ },
117
+ files: [
118
+ "dist",
119
+ "examples",
120
+ "README.md",
121
+ "LICENSE"
122
+ ],
123
+ keywords: [
124
+ "sendora",
125
+ "react-native",
126
+ "expo",
127
+ "analytics",
128
+ "tracking",
129
+ "customer-engagement"
130
+ ],
131
+ dependencies: {
132
+ "react-native-get-random-values": "^1.11.0"
133
+ },
134
+ peerDependencies: {
135
+ "@react-native-async-storage/async-storage": ">=1.17.0",
136
+ "react-native": ">=0.70.0",
137
+ "react-native-webview": ">=13.0.0"
138
+ },
139
+ peerDependenciesMeta: {
140
+ "@react-native-async-storage/async-storage": {
141
+ optional: false
142
+ },
143
+ "react-native": {
144
+ optional: false
145
+ },
146
+ "react-native-webview": {
147
+ optional: true
148
+ }
149
+ },
150
+ scripts: {
151
+ build: "tsup src/index.ts src/contact-widget.tsx --format esm,cjs --dts --clean --external react --external react-native --external react-native-webview",
152
+ typecheck: "tsc --noEmit"
153
+ },
154
+ devDependencies: {
155
+ "@types/react": "^19.2.16",
156
+ "react-native": "^0.85.3",
157
+ "react-native-webview": "^13.16.1",
158
+ tsup: "^8.0.0",
159
+ typescript: "^5.0.0"
160
+ },
161
+ license: "MIT",
162
+ repository: {
163
+ type: "git",
164
+ url: "https://github.com/sendoracloud/sdk-react-native"
165
+ },
166
+ homepage: "https://sendoracloud.com/sdks"
167
+ };
168
+
169
+ // src/version.ts
170
+ var SDK_VERSION = package_default.version;
171
+
96
172
  // src/http.ts
173
+ var SDK_NAME = "@sendoracloud/sdk-react-native";
97
174
  var NetworkTimeoutError = class extends Error {
98
175
  constructor(method, path, timeoutMs) {
99
176
  super(`Request timed out: ${method} ${path} (${timeoutMs}ms)`);
@@ -136,6 +213,13 @@ async function request(opts, method, path, body, extraHeaders, reqOpts) {
136
213
  // silently 401'd. Do not change this header without updating
137
214
  // apps/backend/src/middleware/auth.ts in lockstep.
138
215
  "x-api-key": opts.publicKey,
216
+ // ADR-023: identify the SDK + version on every request so the
217
+ // backend can attribute traffic + drive version-adoption /
218
+ // compatibility telemetry. Additive — the server ignores these
219
+ // today. Placed before extraHeaders so a caller could override
220
+ // if ever needed (none do).
221
+ "X-Sendora-SDK-Name": SDK_NAME,
222
+ "X-Sendora-SDK-Version": SDK_VERSION,
139
223
  ...extraHeaders ?? {}
140
224
  },
141
225
  body: body !== void 0 ? JSON.stringify(body) : void 0,
@@ -177,82 +261,6 @@ async function request(opts, method, path, body, extraHeaders, reqOpts) {
177
261
  return res;
178
262
  }
179
263
 
180
- // package.json
181
- var package_default = {
182
- name: "@sendoracloud/sdk-react-native",
183
- version: "1.13.0",
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`).",
185
- type: "module",
186
- main: "./dist/index.cjs",
187
- module: "./dist/index.js",
188
- types: "./dist/index.d.ts",
189
- exports: {
190
- ".": {
191
- types: "./dist/index.d.ts",
192
- import: "./dist/index.js",
193
- require: "./dist/index.cjs"
194
- },
195
- "./contact-widget": {
196
- types: "./dist/contact-widget.d.ts",
197
- import: "./dist/contact-widget.js",
198
- require: "./dist/contact-widget.cjs"
199
- }
200
- },
201
- files: [
202
- "dist",
203
- "examples",
204
- "README.md",
205
- "LICENSE"
206
- ],
207
- keywords: [
208
- "sendora",
209
- "react-native",
210
- "expo",
211
- "analytics",
212
- "tracking",
213
- "customer-engagement"
214
- ],
215
- dependencies: {
216
- "react-native-get-random-values": "^1.11.0"
217
- },
218
- peerDependencies: {
219
- "@react-native-async-storage/async-storage": ">=1.17.0",
220
- "react-native": ">=0.70.0",
221
- "react-native-webview": ">=13.0.0"
222
- },
223
- peerDependenciesMeta: {
224
- "@react-native-async-storage/async-storage": {
225
- optional: false
226
- },
227
- "react-native": {
228
- optional: false
229
- },
230
- "react-native-webview": {
231
- optional: true
232
- }
233
- },
234
- scripts: {
235
- build: "tsup src/index.ts src/contact-widget.tsx --format esm,cjs --dts --clean --external react --external react-native --external react-native-webview",
236
- typecheck: "tsc --noEmit"
237
- },
238
- devDependencies: {
239
- "@types/react": "^19.2.16",
240
- "react-native": "^0.85.3",
241
- "react-native-webview": "^13.16.1",
242
- tsup: "^8.0.0",
243
- typescript: "^5.0.0"
244
- },
245
- license: "MIT",
246
- repository: {
247
- type: "git",
248
- url: "https://github.com/sendoracloud/sdk-react-native"
249
- },
250
- homepage: "https://sendoracloud.com/sdks"
251
- };
252
-
253
- // src/version.ts
254
- var SDK_VERSION = package_default.version;
255
-
256
264
  // src/auth.ts
257
265
  import { AppState as RnAppState } from "react-native";
258
266
  var TOKEN_KEY = "auth_access_token";
@@ -1945,6 +1953,8 @@ function installAutoTrack(args) {
1945
1953
  var DEFAULT_API_URL = "https://api.sendoracloud.com";
1946
1954
  var ANON_KEY = "anon_id";
1947
1955
  var USER_ID_KEY = "user_id";
1956
+ var SCHEMA_VERSION_KEY = "schema_version";
1957
+ var SCHEMA_VERSION = "1";
1948
1958
  var AUTH_HYDRATE_KEYS = [
1949
1959
  "auth_access_token",
1950
1960
  "auth_access_expires",
@@ -2117,7 +2127,15 @@ var SendoraSDK = class {
2117
2127
  `[sendoracloud] apiUrl override active: ${apiUrl} \u2014 confirm this is intentional. Tokens + events will be sent here.`
2118
2128
  );
2119
2129
  }
2120
- await this.storage.hydrate([ANON_KEY, USER_ID_KEY, ...AUTH_HYDRATE_KEYS]);
2130
+ await this.storage.hydrate([
2131
+ ANON_KEY,
2132
+ USER_ID_KEY,
2133
+ SCHEMA_VERSION_KEY,
2134
+ ...AUTH_HYDRATE_KEYS
2135
+ ]);
2136
+ if (!this.storage.get(SCHEMA_VERSION_KEY)) {
2137
+ this.storage.set(SCHEMA_VERSION_KEY, SCHEMA_VERSION);
2138
+ }
2121
2139
  let anon = this.storage.get(ANON_KEY);
2122
2140
  if (!anon) {
2123
2141
  anon = uuid();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendoracloud/sdk-react-native",
3
- "version": "1.13.0",
3
+ "version": "1.14.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",