@sendoracloud/sdk-react-native 1.6.0 → 1.6.1
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 +22 -16
- package/dist/index.js +22 -16
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2149,7 +2149,13 @@ var SendoraSDK = class {
|
|
|
2149
2149
|
{ apiUrl: this.config.apiUrl, publicKey: this.config.publicKey, debug: this.debug },
|
|
2150
2150
|
"/api/v1/push/tokens",
|
|
2151
2151
|
{
|
|
2152
|
-
|
|
2152
|
+
// Conditional spread — the backend's registerPushTokenSchema makes
|
|
2153
|
+
// userId `.optional()`, which accepts a missing key but REJECTS
|
|
2154
|
+
// `null` (422 "userId: Expected string, received null"). Anonymous
|
|
2155
|
+
// installs (pre-identify()) carry a null userId, so OMIT the field
|
|
2156
|
+
// rather than send null — anon devices must still be able to
|
|
2157
|
+
// register. Mirrors the same conditional-spread sendEvent() uses.
|
|
2158
|
+
...this.userId ? { userId: this.userId } : {},
|
|
2153
2159
|
anonymousId: this.anonId,
|
|
2154
2160
|
token: reg.token,
|
|
2155
2161
|
platform: reg.platform,
|
|
@@ -2191,7 +2197,7 @@ var SendoraSDK = class {
|
|
|
2191
2197
|
if (clickAction !== void 0) body.clickAction = clickAction;
|
|
2192
2198
|
await post(
|
|
2193
2199
|
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2194
|
-
"/push/track-open",
|
|
2200
|
+
"/api/v1/push/track-open",
|
|
2195
2201
|
body
|
|
2196
2202
|
);
|
|
2197
2203
|
},
|
|
@@ -2210,7 +2216,7 @@ var SendoraSDK = class {
|
|
|
2210
2216
|
if (!self.config) throw new Error("[sendoracloud] init() must complete before push.liveActivities.startToken().");
|
|
2211
2217
|
const res = await post(
|
|
2212
2218
|
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2213
|
-
"/push/live-activities/start-token",
|
|
2219
|
+
"/api/v1/push/live-activities/start-token",
|
|
2214
2220
|
{
|
|
2215
2221
|
pushToken: input.pushToken,
|
|
2216
2222
|
activityType: input.activityType,
|
|
@@ -2244,7 +2250,7 @@ var SendoraSDK = class {
|
|
|
2244
2250
|
if (!self.config) throw new Error("[sendoracloud] init() must complete before push.geofences.list().");
|
|
2245
2251
|
const res = await getJson(
|
|
2246
2252
|
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2247
|
-
"/push/geofences/list-for-device"
|
|
2253
|
+
"/api/v1/push/geofences/list-for-device"
|
|
2248
2254
|
);
|
|
2249
2255
|
if (!res || !res.ok) {
|
|
2250
2256
|
throw new Error(`[sendoracloud] geofences list failed (HTTP ${res?.status ?? "network"}).`);
|
|
@@ -2262,7 +2268,7 @@ var SendoraSDK = class {
|
|
|
2262
2268
|
if (!self.config) throw new Error("[sendoracloud] init() must complete before push.geofences.recordEvent().");
|
|
2263
2269
|
const res = await post(
|
|
2264
2270
|
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2265
|
-
"/push/geofences/event",
|
|
2271
|
+
"/api/v1/push/geofences/event",
|
|
2266
2272
|
{
|
|
2267
2273
|
geofenceId: input.geofenceId,
|
|
2268
2274
|
kind: input.kind,
|
|
@@ -2306,7 +2312,7 @@ var SendoraSDK = class {
|
|
|
2306
2312
|
if (!self.config) throw new Error("[sendoracloud] init() must complete before attribution.reportInstall().");
|
|
2307
2313
|
const res = await post(
|
|
2308
2314
|
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2309
|
-
"/attribution/install",
|
|
2315
|
+
"/api/v1/attribution/install",
|
|
2310
2316
|
input ?? {}
|
|
2311
2317
|
);
|
|
2312
2318
|
if (!res || !res.ok) throw new Error(`[sendoracloud] attribution.reportInstall failed (${res?.status ?? "network"})`);
|
|
@@ -2318,7 +2324,7 @@ var SendoraSDK = class {
|
|
|
2318
2324
|
if (!self.config) throw new Error("[sendoracloud] init() must complete before attribution.checkDeferred().");
|
|
2319
2325
|
const res = await post(
|
|
2320
2326
|
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2321
|
-
"/attribution/deferred",
|
|
2327
|
+
"/api/v1/attribution/deferred",
|
|
2322
2328
|
input ?? {}
|
|
2323
2329
|
);
|
|
2324
2330
|
if (!res || !res.ok) throw new Error(`[sendoracloud] attribution.checkDeferred failed (${res?.status ?? "network"})`);
|
|
@@ -2352,7 +2358,7 @@ var SendoraSDK = class {
|
|
|
2352
2358
|
if (!self.config) throw new Error("[sendoracloud] init() must complete before support.createTicket().");
|
|
2353
2359
|
const res = await post(
|
|
2354
2360
|
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2355
|
-
"/support/tickets",
|
|
2361
|
+
"/api/v1/support/tickets",
|
|
2356
2362
|
input
|
|
2357
2363
|
);
|
|
2358
2364
|
if (!res || !res.ok) throw new Error(`[sendoracloud] support.createTicket failed (${res?.status ?? "network"})`);
|
|
@@ -2364,7 +2370,7 @@ var SendoraSDK = class {
|
|
|
2364
2370
|
if (!self.config) throw new Error("[sendoracloud] init() must complete before support.submitCsat().");
|
|
2365
2371
|
const res = await post(
|
|
2366
2372
|
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2367
|
-
"/support/csat",
|
|
2373
|
+
"/api/v1/support/csat",
|
|
2368
2374
|
input
|
|
2369
2375
|
);
|
|
2370
2376
|
if (!res || !res.ok) throw new Error(`[sendoracloud] support.submitCsat failed (${res?.status ?? "network"})`);
|
|
@@ -2453,7 +2459,7 @@ var SendoraSDK = class {
|
|
|
2453
2459
|
if (!self.config) throw new Error("[sendoracloud] init() must complete before consent.record().");
|
|
2454
2460
|
const res = await post(
|
|
2455
2461
|
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2456
|
-
"/consent/record",
|
|
2462
|
+
"/api/v1/consent/record",
|
|
2457
2463
|
input
|
|
2458
2464
|
);
|
|
2459
2465
|
if (!res || !res.ok) throw new Error(`[sendoracloud] consent.record failed (${res?.status ?? "network"})`);
|
|
@@ -2465,7 +2471,7 @@ var SendoraSDK = class {
|
|
|
2465
2471
|
if (!self.config) throw new Error("[sendoracloud] init() must complete before consent.requestDeletion().");
|
|
2466
2472
|
const res = await post(
|
|
2467
2473
|
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2468
|
-
"/consent/deletion-request",
|
|
2474
|
+
"/api/v1/consent/deletion-request",
|
|
2469
2475
|
input
|
|
2470
2476
|
);
|
|
2471
2477
|
if (!res || !res.ok) throw new Error(`[sendoracloud] consent.requestDeletion failed (${res?.status ?? "network"})`);
|
|
@@ -2516,7 +2522,7 @@ var SendoraSDK = class {
|
|
|
2516
2522
|
if (!self.config) throw new Error("[sendoracloud] init() must complete before surveys.submitResponse().");
|
|
2517
2523
|
const res = await post(
|
|
2518
2524
|
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2519
|
-
"/surveys/responses",
|
|
2525
|
+
"/api/v1/surveys/responses",
|
|
2520
2526
|
{ completed: true, ...input }
|
|
2521
2527
|
);
|
|
2522
2528
|
if (!res || !res.ok) throw new Error(`[sendoracloud] surveys.submitResponse failed (${res?.status ?? "network"})`);
|
|
@@ -2566,7 +2572,7 @@ var SendoraSDK = class {
|
|
|
2566
2572
|
if (!self.config) throw new Error("[sendoracloud] init() must complete before messages.recordImpression().");
|
|
2567
2573
|
const res = await post(
|
|
2568
2574
|
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2569
|
-
"/in-app-messages/impressions",
|
|
2575
|
+
"/api/v1/in-app-messages/impressions",
|
|
2570
2576
|
input
|
|
2571
2577
|
);
|
|
2572
2578
|
if (!res || !res.ok) throw new Error(`[sendoracloud] messages.recordImpression failed (${res?.status ?? "network"})`);
|
|
@@ -2604,7 +2610,7 @@ var SendoraSDK = class {
|
|
|
2604
2610
|
};
|
|
2605
2611
|
const res = await post(
|
|
2606
2612
|
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2607
|
-
"/feature-flags/evaluate",
|
|
2613
|
+
"/api/v1/feature-flags/evaluate",
|
|
2608
2614
|
body
|
|
2609
2615
|
);
|
|
2610
2616
|
if (!res || !res.ok) throw new Error(`[sendoracloud] flags.evaluate failed (${res?.status ?? "network"})`);
|
|
@@ -2621,7 +2627,7 @@ var SendoraSDK = class {
|
|
|
2621
2627
|
};
|
|
2622
2628
|
const res = await post(
|
|
2623
2629
|
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2624
|
-
"/feature-flags/evaluate-all",
|
|
2630
|
+
"/api/v1/feature-flags/evaluate-all",
|
|
2625
2631
|
body
|
|
2626
2632
|
);
|
|
2627
2633
|
if (!res || !res.ok) throw new Error(`[sendoracloud] flags.evaluateAll failed (${res?.status ?? "network"})`);
|
|
@@ -2656,7 +2662,7 @@ var SendoraSDK = class {
|
|
|
2656
2662
|
};
|
|
2657
2663
|
const res = await post(
|
|
2658
2664
|
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2659
|
-
"/chatbot/message",
|
|
2665
|
+
"/api/v1/chatbot/message",
|
|
2660
2666
|
body
|
|
2661
2667
|
);
|
|
2662
2668
|
if (!res || !res.ok) throw new Error(`[sendoracloud] chatbot.sendMessage failed (${res?.status ?? "network"})`);
|
package/dist/index.js
CHANGED
|
@@ -2111,7 +2111,13 @@ var SendoraSDK = class {
|
|
|
2111
2111
|
{ apiUrl: this.config.apiUrl, publicKey: this.config.publicKey, debug: this.debug },
|
|
2112
2112
|
"/api/v1/push/tokens",
|
|
2113
2113
|
{
|
|
2114
|
-
|
|
2114
|
+
// Conditional spread — the backend's registerPushTokenSchema makes
|
|
2115
|
+
// userId `.optional()`, which accepts a missing key but REJECTS
|
|
2116
|
+
// `null` (422 "userId: Expected string, received null"). Anonymous
|
|
2117
|
+
// installs (pre-identify()) carry a null userId, so OMIT the field
|
|
2118
|
+
// rather than send null — anon devices must still be able to
|
|
2119
|
+
// register. Mirrors the same conditional-spread sendEvent() uses.
|
|
2120
|
+
...this.userId ? { userId: this.userId } : {},
|
|
2115
2121
|
anonymousId: this.anonId,
|
|
2116
2122
|
token: reg.token,
|
|
2117
2123
|
platform: reg.platform,
|
|
@@ -2153,7 +2159,7 @@ var SendoraSDK = class {
|
|
|
2153
2159
|
if (clickAction !== void 0) body.clickAction = clickAction;
|
|
2154
2160
|
await post(
|
|
2155
2161
|
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2156
|
-
"/push/track-open",
|
|
2162
|
+
"/api/v1/push/track-open",
|
|
2157
2163
|
body
|
|
2158
2164
|
);
|
|
2159
2165
|
},
|
|
@@ -2172,7 +2178,7 @@ var SendoraSDK = class {
|
|
|
2172
2178
|
if (!self.config) throw new Error("[sendoracloud] init() must complete before push.liveActivities.startToken().");
|
|
2173
2179
|
const res = await post(
|
|
2174
2180
|
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2175
|
-
"/push/live-activities/start-token",
|
|
2181
|
+
"/api/v1/push/live-activities/start-token",
|
|
2176
2182
|
{
|
|
2177
2183
|
pushToken: input.pushToken,
|
|
2178
2184
|
activityType: input.activityType,
|
|
@@ -2206,7 +2212,7 @@ var SendoraSDK = class {
|
|
|
2206
2212
|
if (!self.config) throw new Error("[sendoracloud] init() must complete before push.geofences.list().");
|
|
2207
2213
|
const res = await getJson(
|
|
2208
2214
|
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2209
|
-
"/push/geofences/list-for-device"
|
|
2215
|
+
"/api/v1/push/geofences/list-for-device"
|
|
2210
2216
|
);
|
|
2211
2217
|
if (!res || !res.ok) {
|
|
2212
2218
|
throw new Error(`[sendoracloud] geofences list failed (HTTP ${res?.status ?? "network"}).`);
|
|
@@ -2224,7 +2230,7 @@ var SendoraSDK = class {
|
|
|
2224
2230
|
if (!self.config) throw new Error("[sendoracloud] init() must complete before push.geofences.recordEvent().");
|
|
2225
2231
|
const res = await post(
|
|
2226
2232
|
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2227
|
-
"/push/geofences/event",
|
|
2233
|
+
"/api/v1/push/geofences/event",
|
|
2228
2234
|
{
|
|
2229
2235
|
geofenceId: input.geofenceId,
|
|
2230
2236
|
kind: input.kind,
|
|
@@ -2268,7 +2274,7 @@ var SendoraSDK = class {
|
|
|
2268
2274
|
if (!self.config) throw new Error("[sendoracloud] init() must complete before attribution.reportInstall().");
|
|
2269
2275
|
const res = await post(
|
|
2270
2276
|
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2271
|
-
"/attribution/install",
|
|
2277
|
+
"/api/v1/attribution/install",
|
|
2272
2278
|
input ?? {}
|
|
2273
2279
|
);
|
|
2274
2280
|
if (!res || !res.ok) throw new Error(`[sendoracloud] attribution.reportInstall failed (${res?.status ?? "network"})`);
|
|
@@ -2280,7 +2286,7 @@ var SendoraSDK = class {
|
|
|
2280
2286
|
if (!self.config) throw new Error("[sendoracloud] init() must complete before attribution.checkDeferred().");
|
|
2281
2287
|
const res = await post(
|
|
2282
2288
|
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2283
|
-
"/attribution/deferred",
|
|
2289
|
+
"/api/v1/attribution/deferred",
|
|
2284
2290
|
input ?? {}
|
|
2285
2291
|
);
|
|
2286
2292
|
if (!res || !res.ok) throw new Error(`[sendoracloud] attribution.checkDeferred failed (${res?.status ?? "network"})`);
|
|
@@ -2314,7 +2320,7 @@ var SendoraSDK = class {
|
|
|
2314
2320
|
if (!self.config) throw new Error("[sendoracloud] init() must complete before support.createTicket().");
|
|
2315
2321
|
const res = await post(
|
|
2316
2322
|
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2317
|
-
"/support/tickets",
|
|
2323
|
+
"/api/v1/support/tickets",
|
|
2318
2324
|
input
|
|
2319
2325
|
);
|
|
2320
2326
|
if (!res || !res.ok) throw new Error(`[sendoracloud] support.createTicket failed (${res?.status ?? "network"})`);
|
|
@@ -2326,7 +2332,7 @@ var SendoraSDK = class {
|
|
|
2326
2332
|
if (!self.config) throw new Error("[sendoracloud] init() must complete before support.submitCsat().");
|
|
2327
2333
|
const res = await post(
|
|
2328
2334
|
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2329
|
-
"/support/csat",
|
|
2335
|
+
"/api/v1/support/csat",
|
|
2330
2336
|
input
|
|
2331
2337
|
);
|
|
2332
2338
|
if (!res || !res.ok) throw new Error(`[sendoracloud] support.submitCsat failed (${res?.status ?? "network"})`);
|
|
@@ -2415,7 +2421,7 @@ var SendoraSDK = class {
|
|
|
2415
2421
|
if (!self.config) throw new Error("[sendoracloud] init() must complete before consent.record().");
|
|
2416
2422
|
const res = await post(
|
|
2417
2423
|
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2418
|
-
"/consent/record",
|
|
2424
|
+
"/api/v1/consent/record",
|
|
2419
2425
|
input
|
|
2420
2426
|
);
|
|
2421
2427
|
if (!res || !res.ok) throw new Error(`[sendoracloud] consent.record failed (${res?.status ?? "network"})`);
|
|
@@ -2427,7 +2433,7 @@ var SendoraSDK = class {
|
|
|
2427
2433
|
if (!self.config) throw new Error("[sendoracloud] init() must complete before consent.requestDeletion().");
|
|
2428
2434
|
const res = await post(
|
|
2429
2435
|
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2430
|
-
"/consent/deletion-request",
|
|
2436
|
+
"/api/v1/consent/deletion-request",
|
|
2431
2437
|
input
|
|
2432
2438
|
);
|
|
2433
2439
|
if (!res || !res.ok) throw new Error(`[sendoracloud] consent.requestDeletion failed (${res?.status ?? "network"})`);
|
|
@@ -2478,7 +2484,7 @@ var SendoraSDK = class {
|
|
|
2478
2484
|
if (!self.config) throw new Error("[sendoracloud] init() must complete before surveys.submitResponse().");
|
|
2479
2485
|
const res = await post(
|
|
2480
2486
|
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2481
|
-
"/surveys/responses",
|
|
2487
|
+
"/api/v1/surveys/responses",
|
|
2482
2488
|
{ completed: true, ...input }
|
|
2483
2489
|
);
|
|
2484
2490
|
if (!res || !res.ok) throw new Error(`[sendoracloud] surveys.submitResponse failed (${res?.status ?? "network"})`);
|
|
@@ -2528,7 +2534,7 @@ var SendoraSDK = class {
|
|
|
2528
2534
|
if (!self.config) throw new Error("[sendoracloud] init() must complete before messages.recordImpression().");
|
|
2529
2535
|
const res = await post(
|
|
2530
2536
|
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2531
|
-
"/in-app-messages/impressions",
|
|
2537
|
+
"/api/v1/in-app-messages/impressions",
|
|
2532
2538
|
input
|
|
2533
2539
|
);
|
|
2534
2540
|
if (!res || !res.ok) throw new Error(`[sendoracloud] messages.recordImpression failed (${res?.status ?? "network"})`);
|
|
@@ -2566,7 +2572,7 @@ var SendoraSDK = class {
|
|
|
2566
2572
|
};
|
|
2567
2573
|
const res = await post(
|
|
2568
2574
|
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2569
|
-
"/feature-flags/evaluate",
|
|
2575
|
+
"/api/v1/feature-flags/evaluate",
|
|
2570
2576
|
body
|
|
2571
2577
|
);
|
|
2572
2578
|
if (!res || !res.ok) throw new Error(`[sendoracloud] flags.evaluate failed (${res?.status ?? "network"})`);
|
|
@@ -2583,7 +2589,7 @@ var SendoraSDK = class {
|
|
|
2583
2589
|
};
|
|
2584
2590
|
const res = await post(
|
|
2585
2591
|
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2586
|
-
"/feature-flags/evaluate-all",
|
|
2592
|
+
"/api/v1/feature-flags/evaluate-all",
|
|
2587
2593
|
body
|
|
2588
2594
|
);
|
|
2589
2595
|
if (!res || !res.ok) throw new Error(`[sendoracloud] flags.evaluateAll failed (${res?.status ?? "network"})`);
|
|
@@ -2618,7 +2624,7 @@ var SendoraSDK = class {
|
|
|
2618
2624
|
};
|
|
2619
2625
|
const res = await post(
|
|
2620
2626
|
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2621
|
-
"/chatbot/message",
|
|
2627
|
+
"/api/v1/chatbot/message",
|
|
2622
2628
|
body
|
|
2623
2629
|
);
|
|
2624
2630
|
if (!res || !res.ok) throw new Error(`[sendoracloud] chatbot.sendMessage failed (${res?.status ?? "network"})`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sendoracloud/sdk-react-native",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.1",
|
|
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",
|