@sendoracloud/sdk-react-native 1.0.0 → 1.0.2

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
@@ -392,11 +392,16 @@ var Auth = class {
392
392
  */
393
393
  signIn(email, password) {
394
394
  return this.serialize(async () => {
395
+ let prevAnonRefreshToken;
396
+ if (this.user?.isAnonymous) {
397
+ const stashed = this.hooks.storage.get(REFRESH_KEY);
398
+ if (stashed) prevAnonRefreshToken = stashed;
399
+ }
395
400
  if (this.user !== null) await this.wipeLocalIdentity();
396
401
  const res = await post(
397
402
  { apiUrl: this.hooks.apiUrl, publicKey: this.hooks.publicKey, debug: this.hooks.debug },
398
403
  "/api/v1/auth-service/login",
399
- { email, password }
404
+ prevAnonRefreshToken ? { email, password, prevAnonRefreshToken } : { email, password }
400
405
  );
401
406
  if (!res) throw new AuthError("NETWORK_ERROR", "Network request failed");
402
407
  let parsed;
@@ -429,11 +434,18 @@ var Auth = class {
429
434
  */
430
435
  loginSocial(input) {
431
436
  return this.serialize(async () => {
437
+ let prevAnonRefreshToken;
438
+ if (this.user?.isAnonymous) {
439
+ const stashed = this.hooks.storage.get(REFRESH_KEY);
440
+ if (stashed) prevAnonRefreshToken = stashed;
441
+ }
432
442
  if (this.user !== null) await this.wipeLocalIdentity();
443
+ const payload = { ...input };
444
+ if (prevAnonRefreshToken) payload.prevAnonRefreshToken = prevAnonRefreshToken;
433
445
  const res = await post(
434
446
  { apiUrl: this.hooks.apiUrl, publicKey: this.hooks.publicKey, debug: this.hooks.debug },
435
447
  "/api/v1/auth-service/login/social",
436
- input
448
+ payload
437
449
  );
438
450
  if (!res) throw new AuthError("NETWORK_ERROR", "Network request failed");
439
451
  let parsed;
package/dist/index.js CHANGED
@@ -349,11 +349,16 @@ var Auth = class {
349
349
  */
350
350
  signIn(email, password) {
351
351
  return this.serialize(async () => {
352
+ let prevAnonRefreshToken;
353
+ if (this.user?.isAnonymous) {
354
+ const stashed = this.hooks.storage.get(REFRESH_KEY);
355
+ if (stashed) prevAnonRefreshToken = stashed;
356
+ }
352
357
  if (this.user !== null) await this.wipeLocalIdentity();
353
358
  const res = await post(
354
359
  { apiUrl: this.hooks.apiUrl, publicKey: this.hooks.publicKey, debug: this.hooks.debug },
355
360
  "/api/v1/auth-service/login",
356
- { email, password }
361
+ prevAnonRefreshToken ? { email, password, prevAnonRefreshToken } : { email, password }
357
362
  );
358
363
  if (!res) throw new AuthError("NETWORK_ERROR", "Network request failed");
359
364
  let parsed;
@@ -386,11 +391,18 @@ var Auth = class {
386
391
  */
387
392
  loginSocial(input) {
388
393
  return this.serialize(async () => {
394
+ let prevAnonRefreshToken;
395
+ if (this.user?.isAnonymous) {
396
+ const stashed = this.hooks.storage.get(REFRESH_KEY);
397
+ if (stashed) prevAnonRefreshToken = stashed;
398
+ }
389
399
  if (this.user !== null) await this.wipeLocalIdentity();
400
+ const payload = { ...input };
401
+ if (prevAnonRefreshToken) payload.prevAnonRefreshToken = prevAnonRefreshToken;
390
402
  const res = await post(
391
403
  { apiUrl: this.hooks.apiUrl, publicKey: this.hooks.publicKey, debug: this.hooks.debug },
392
404
  "/api/v1/auth-service/login/social",
393
- input
405
+ payload
394
406
  );
395
407
  if (!res) throw new AuthError("NETWORK_ERROR", "Network request failed");
396
408
  let parsed;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendoracloud/sdk-react-native",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
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",