@sendoracloud/sdk-react-native 1.25.0 → 1.26.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
@@ -202,7 +202,7 @@ var Storage = class {
202
202
  // package.json
203
203
  var package_default = {
204
204
  name: "@sendoracloud/sdk-react-native",
205
- version: "1.25.0",
205
+ version: "1.26.0",
206
206
  description: "Sendora Cloud React Native + Expo SDK \u2014 analytics, identity, push-token registration, auth (incl. Game Center / Play Games), deep links (Branch / Firebase Dynamic Links parity). Auth + analytics + deep links work in Expo Go; push-token registration and the no-arg Game Center / Play Games sign-in require a Dev Client (EAS Build or `npx expo prebuild`).",
207
207
  type: "module",
208
208
  main: "./dist/index.cjs",
@@ -510,6 +510,8 @@ var Auth = class {
510
510
  this.refreshFailureCount = 0;
511
511
  this.refreshCooldownUntil = 0;
512
512
  this.takeoverListeners = /* @__PURE__ */ new Set();
513
+ this.deletionCancelledListeners = /* @__PURE__ */ new Set();
514
+ this.lastDeletionCancelled = null;
513
515
  this.lastTakeover = null;
514
516
  /**
515
517
  * Anon refresh token captured at `signIn()` time, stashed keyed to the
@@ -622,6 +624,36 @@ var Auth = class {
622
624
  }
623
625
  }
624
626
  }
627
+ /**
628
+ * Subscribe to deletion-cancelled events (s58.269): fires when a sign-in
629
+ * cancelled a pending self-service account deletion within its grace window
630
+ * (the account is restored, same user_id). Use it to show "your account
631
+ * deletion was cancelled" + reconcile local state. Fires from signIn /
632
+ * loginSocial / signInWithGameCenter / signInWithPlayGames. Returns an
633
+ * unsubscribe function; listener errors are swallowed (best-effort).
634
+ */
635
+ onDeletionCancelled(listener) {
636
+ this.deletionCancelledListeners.add(listener);
637
+ return () => {
638
+ this.deletionCancelledListeners.delete(listener);
639
+ };
640
+ }
641
+ /** The most recent deletion-cancelled event this session, or null. Cleared on signOut. */
642
+ getLastDeletionCancelled() {
643
+ return this.lastDeletionCancelled;
644
+ }
645
+ /** Internal — fan out deletion-cancelled to subscribers + cache the latest. */
646
+ fireDeletionCancelled(userId) {
647
+ const evt = { userId, at: /* @__PURE__ */ new Date() };
648
+ this.lastDeletionCancelled = evt;
649
+ for (const fn of this.deletionCancelledListeners) {
650
+ try {
651
+ fn(evt);
652
+ } catch (err) {
653
+ if (this.hooks.debug) console.warn("[sendoracloud] onDeletionCancelled listener threw", err);
654
+ }
655
+ }
656
+ }
625
657
  /**
626
658
  * Returns a VALID (non-expired) access token, or null.
627
659
  *
@@ -1599,12 +1631,16 @@ var Auth = class {
1599
1631
  if (data.retiredAnonUserId) {
1600
1632
  this.fireDeviceTakeover(data.retiredAnonUserId, data.user.id);
1601
1633
  }
1634
+ if (data.reactivatedFromDeletion) {
1635
+ this.fireDeletionCancelled(data.user.id);
1636
+ }
1602
1637
  }
1603
1638
  async wipeLocalIdentity() {
1604
1639
  this.user = null;
1605
1640
  this.accessToken = null;
1606
1641
  this.accessExpiresAt = 0;
1607
1642
  this.lastTakeover = null;
1643
+ this.lastDeletionCancelled = null;
1608
1644
  this.pendingAnonTakeover = null;
1609
1645
  this.hooks.storage.remove(USER_KEY);
1610
1646
  this.hooks.storage.remove(TOKEN_KEY);
package/dist/index.d.cts CHANGED
@@ -344,6 +344,17 @@ interface DeviceTakeoverEvent {
344
344
  /** Local clock at the time the SDK observed the event. */
345
345
  at: Date;
346
346
  }
347
+ /**
348
+ * Detail handed to `onDeletionCancelled` subscribers (s58.269). Fires once
349
+ * per sign-in that cancelled a pending self-service deletion within grace —
350
+ * the account is restored with the SAME user_id.
351
+ */
352
+ interface DeletionCancelledEvent {
353
+ /** The restored user_id (unchanged — this is a status flip, not a remap). */
354
+ userId: string;
355
+ /** Local clock at the time the SDK observed the event. */
356
+ at: Date;
357
+ }
347
358
  declare class Auth {
348
359
  private hooks;
349
360
  private user;
@@ -365,6 +376,8 @@ declare class Auth {
365
376
  private refreshFailureCount;
366
377
  private refreshCooldownUntil;
367
378
  private takeoverListeners;
379
+ private deletionCancelledListeners;
380
+ private lastDeletionCancelled;
368
381
  private lastTakeover;
369
382
  /**
370
383
  * Anon refresh token captured at `signIn()` time, stashed keyed to the
@@ -434,6 +447,19 @@ declare class Auth {
434
447
  getLastDeviceTakeover(): DeviceTakeoverEvent | null;
435
448
  /** Internal — fan out to subscribers + cache the latest. */
436
449
  private fireDeviceTakeover;
450
+ /**
451
+ * Subscribe to deletion-cancelled events (s58.269): fires when a sign-in
452
+ * cancelled a pending self-service account deletion within its grace window
453
+ * (the account is restored, same user_id). Use it to show "your account
454
+ * deletion was cancelled" + reconcile local state. Fires from signIn /
455
+ * loginSocial / signInWithGameCenter / signInWithPlayGames. Returns an
456
+ * unsubscribe function; listener errors are swallowed (best-effort).
457
+ */
458
+ onDeletionCancelled(listener: (evt: DeletionCancelledEvent) => void): () => void;
459
+ /** The most recent deletion-cancelled event this session, or null. Cleared on signOut. */
460
+ getLastDeletionCancelled(): DeletionCancelledEvent | null;
461
+ /** Internal — fan out deletion-cancelled to subscribers + cache the latest. */
462
+ private fireDeletionCancelled;
437
463
  /**
438
464
  * Returns a VALID (non-expired) access token, or null.
439
465
  *
package/dist/index.d.ts CHANGED
@@ -344,6 +344,17 @@ interface DeviceTakeoverEvent {
344
344
  /** Local clock at the time the SDK observed the event. */
345
345
  at: Date;
346
346
  }
347
+ /**
348
+ * Detail handed to `onDeletionCancelled` subscribers (s58.269). Fires once
349
+ * per sign-in that cancelled a pending self-service deletion within grace —
350
+ * the account is restored with the SAME user_id.
351
+ */
352
+ interface DeletionCancelledEvent {
353
+ /** The restored user_id (unchanged — this is a status flip, not a remap). */
354
+ userId: string;
355
+ /** Local clock at the time the SDK observed the event. */
356
+ at: Date;
357
+ }
347
358
  declare class Auth {
348
359
  private hooks;
349
360
  private user;
@@ -365,6 +376,8 @@ declare class Auth {
365
376
  private refreshFailureCount;
366
377
  private refreshCooldownUntil;
367
378
  private takeoverListeners;
379
+ private deletionCancelledListeners;
380
+ private lastDeletionCancelled;
368
381
  private lastTakeover;
369
382
  /**
370
383
  * Anon refresh token captured at `signIn()` time, stashed keyed to the
@@ -434,6 +447,19 @@ declare class Auth {
434
447
  getLastDeviceTakeover(): DeviceTakeoverEvent | null;
435
448
  /** Internal — fan out to subscribers + cache the latest. */
436
449
  private fireDeviceTakeover;
450
+ /**
451
+ * Subscribe to deletion-cancelled events (s58.269): fires when a sign-in
452
+ * cancelled a pending self-service account deletion within its grace window
453
+ * (the account is restored, same user_id). Use it to show "your account
454
+ * deletion was cancelled" + reconcile local state. Fires from signIn /
455
+ * loginSocial / signInWithGameCenter / signInWithPlayGames. Returns an
456
+ * unsubscribe function; listener errors are swallowed (best-effort).
457
+ */
458
+ onDeletionCancelled(listener: (evt: DeletionCancelledEvent) => void): () => void;
459
+ /** The most recent deletion-cancelled event this session, or null. Cleared on signOut. */
460
+ getLastDeletionCancelled(): DeletionCancelledEvent | null;
461
+ /** Internal — fan out deletion-cancelled to subscribers + cache the latest. */
462
+ private fireDeletionCancelled;
437
463
  /**
438
464
  * Returns a VALID (non-expired) access token, or null.
439
465
  *
package/dist/index.js CHANGED
@@ -157,7 +157,7 @@ var Storage = class {
157
157
  // package.json
158
158
  var package_default = {
159
159
  name: "@sendoracloud/sdk-react-native",
160
- version: "1.25.0",
160
+ version: "1.26.0",
161
161
  description: "Sendora Cloud React Native + Expo SDK \u2014 analytics, identity, push-token registration, auth (incl. Game Center / Play Games), deep links (Branch / Firebase Dynamic Links parity). Auth + analytics + deep links work in Expo Go; push-token registration and the no-arg Game Center / Play Games sign-in require a Dev Client (EAS Build or `npx expo prebuild`).",
162
162
  type: "module",
163
163
  main: "./dist/index.cjs",
@@ -465,6 +465,8 @@ var Auth = class {
465
465
  this.refreshFailureCount = 0;
466
466
  this.refreshCooldownUntil = 0;
467
467
  this.takeoverListeners = /* @__PURE__ */ new Set();
468
+ this.deletionCancelledListeners = /* @__PURE__ */ new Set();
469
+ this.lastDeletionCancelled = null;
468
470
  this.lastTakeover = null;
469
471
  /**
470
472
  * Anon refresh token captured at `signIn()` time, stashed keyed to the
@@ -577,6 +579,36 @@ var Auth = class {
577
579
  }
578
580
  }
579
581
  }
582
+ /**
583
+ * Subscribe to deletion-cancelled events (s58.269): fires when a sign-in
584
+ * cancelled a pending self-service account deletion within its grace window
585
+ * (the account is restored, same user_id). Use it to show "your account
586
+ * deletion was cancelled" + reconcile local state. Fires from signIn /
587
+ * loginSocial / signInWithGameCenter / signInWithPlayGames. Returns an
588
+ * unsubscribe function; listener errors are swallowed (best-effort).
589
+ */
590
+ onDeletionCancelled(listener) {
591
+ this.deletionCancelledListeners.add(listener);
592
+ return () => {
593
+ this.deletionCancelledListeners.delete(listener);
594
+ };
595
+ }
596
+ /** The most recent deletion-cancelled event this session, or null. Cleared on signOut. */
597
+ getLastDeletionCancelled() {
598
+ return this.lastDeletionCancelled;
599
+ }
600
+ /** Internal — fan out deletion-cancelled to subscribers + cache the latest. */
601
+ fireDeletionCancelled(userId) {
602
+ const evt = { userId, at: /* @__PURE__ */ new Date() };
603
+ this.lastDeletionCancelled = evt;
604
+ for (const fn of this.deletionCancelledListeners) {
605
+ try {
606
+ fn(evt);
607
+ } catch (err) {
608
+ if (this.hooks.debug) console.warn("[sendoracloud] onDeletionCancelled listener threw", err);
609
+ }
610
+ }
611
+ }
580
612
  /**
581
613
  * Returns a VALID (non-expired) access token, or null.
582
614
  *
@@ -1554,12 +1586,16 @@ var Auth = class {
1554
1586
  if (data.retiredAnonUserId) {
1555
1587
  this.fireDeviceTakeover(data.retiredAnonUserId, data.user.id);
1556
1588
  }
1589
+ if (data.reactivatedFromDeletion) {
1590
+ this.fireDeletionCancelled(data.user.id);
1591
+ }
1557
1592
  }
1558
1593
  async wipeLocalIdentity() {
1559
1594
  this.user = null;
1560
1595
  this.accessToken = null;
1561
1596
  this.accessExpiresAt = 0;
1562
1597
  this.lastTakeover = null;
1598
+ this.lastDeletionCancelled = null;
1563
1599
  this.pendingAnonTakeover = null;
1564
1600
  this.hooks.storage.remove(USER_KEY);
1565
1601
  this.hooks.storage.remove(TOKEN_KEY);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendoracloud/sdk-react-native",
3
- "version": "1.25.0",
3
+ "version": "1.26.0",
4
4
  "description": "Sendora Cloud React Native + Expo SDK — analytics, identity, push-token registration, auth (incl. Game Center / Play Games), deep links (Branch / Firebase Dynamic Links parity). Auth + analytics + deep links work in Expo Go; push-token registration and the no-arg Game Center / Play Games sign-in require a Dev Client (EAS Build or `npx expo prebuild`).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",