@sendoracloud/sdk-react-native 0.10.2 → 0.10.3
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 +13 -3
- package/dist/index.d.cts +18 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.js +13 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -231,9 +231,14 @@ var Auth = class {
|
|
|
231
231
|
this.inflight = Promise.resolve();
|
|
232
232
|
this.refreshInflight = null;
|
|
233
233
|
this.hooks = hooks;
|
|
234
|
+
this.readyPromise = new Promise((res) => {
|
|
235
|
+
this.resolveReady = res;
|
|
236
|
+
});
|
|
234
237
|
}
|
|
235
238
|
/** Re-hydrate session from storage. Called by the parent SDK
|
|
236
|
-
* during init() after Storage.hydrate() has run.
|
|
239
|
+
* during init() after Storage.hydrate() has run. Marks the
|
|
240
|
+
* internal ready promise as resolved so queued auth calls
|
|
241
|
+
* unblock. */
|
|
237
242
|
hydrate() {
|
|
238
243
|
const cachedUser = this.hooks.storage.get(USER_KEY);
|
|
239
244
|
const cachedToken = this.hooks.storage.get(TOKEN_KEY);
|
|
@@ -253,6 +258,7 @@ var Auth = class {
|
|
|
253
258
|
this.hooks.storage.remove(REFRESH_KEY);
|
|
254
259
|
}
|
|
255
260
|
}
|
|
261
|
+
this.resolveReady();
|
|
256
262
|
}
|
|
257
263
|
getCurrentUser() {
|
|
258
264
|
return this.user;
|
|
@@ -705,7 +711,11 @@ var Auth = class {
|
|
|
705
711
|
}
|
|
706
712
|
// --- internals ---
|
|
707
713
|
serialize(op) {
|
|
708
|
-
const
|
|
714
|
+
const guarded = async () => {
|
|
715
|
+
await this.readyPromise;
|
|
716
|
+
return op();
|
|
717
|
+
};
|
|
718
|
+
const next = this.inflight.then(guarded, guarded);
|
|
709
719
|
this.inflight = next.catch(() => void 0);
|
|
710
720
|
return next;
|
|
711
721
|
}
|
|
@@ -790,7 +800,7 @@ function decodeJwtPayload(token) {
|
|
|
790
800
|
}
|
|
791
801
|
|
|
792
802
|
// src/index.ts
|
|
793
|
-
var SDK_VERSION = "0.10.
|
|
803
|
+
var SDK_VERSION = "0.10.3";
|
|
794
804
|
var DEFAULT_API_URL = "https://api.sendoracloud.com";
|
|
795
805
|
var ANON_KEY = "anon_id";
|
|
796
806
|
var USER_ID_KEY = "user_id";
|
package/dist/index.d.cts
CHANGED
|
@@ -106,9 +106,26 @@ declare class Auth {
|
|
|
106
106
|
private accessExpiresAt;
|
|
107
107
|
private inflight;
|
|
108
108
|
private refreshInflight;
|
|
109
|
+
/**
|
|
110
|
+
* Resolves when the parent SDK has finished its async init() —
|
|
111
|
+
* AsyncStorage hydrated + auth.hydrate() restored the cached
|
|
112
|
+
* session. All public auth methods await this internally so a
|
|
113
|
+
* customer who forgets `await sendora.init()` before showing the
|
|
114
|
+
* signup UI doesn't hit the cold-start race where the upgrade
|
|
115
|
+
* path's `storage.get(REFRESH_KEY)` returns null even though a
|
|
116
|
+
* valid anonymous session is sitting on disk.
|
|
117
|
+
*
|
|
118
|
+
* Industry-standard "SDK gates on internal readiness" pattern
|
|
119
|
+
* (Firebase Auth, Auth0, Clerk all do equivalent internal
|
|
120
|
+
* gating).
|
|
121
|
+
*/
|
|
122
|
+
private readyPromise;
|
|
123
|
+
private resolveReady;
|
|
109
124
|
constructor(hooks: AuthHooks);
|
|
110
125
|
/** Re-hydrate session from storage. Called by the parent SDK
|
|
111
|
-
* during init() after Storage.hydrate() has run.
|
|
126
|
+
* during init() after Storage.hydrate() has run. Marks the
|
|
127
|
+
* internal ready promise as resolved so queued auth calls
|
|
128
|
+
* unblock. */
|
|
112
129
|
hydrate(): void;
|
|
113
130
|
getCurrentUser(): AuthUser | null;
|
|
114
131
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -106,9 +106,26 @@ declare class Auth {
|
|
|
106
106
|
private accessExpiresAt;
|
|
107
107
|
private inflight;
|
|
108
108
|
private refreshInflight;
|
|
109
|
+
/**
|
|
110
|
+
* Resolves when the parent SDK has finished its async init() —
|
|
111
|
+
* AsyncStorage hydrated + auth.hydrate() restored the cached
|
|
112
|
+
* session. All public auth methods await this internally so a
|
|
113
|
+
* customer who forgets `await sendora.init()` before showing the
|
|
114
|
+
* signup UI doesn't hit the cold-start race where the upgrade
|
|
115
|
+
* path's `storage.get(REFRESH_KEY)` returns null even though a
|
|
116
|
+
* valid anonymous session is sitting on disk.
|
|
117
|
+
*
|
|
118
|
+
* Industry-standard "SDK gates on internal readiness" pattern
|
|
119
|
+
* (Firebase Auth, Auth0, Clerk all do equivalent internal
|
|
120
|
+
* gating).
|
|
121
|
+
*/
|
|
122
|
+
private readyPromise;
|
|
123
|
+
private resolveReady;
|
|
109
124
|
constructor(hooks: AuthHooks);
|
|
110
125
|
/** Re-hydrate session from storage. Called by the parent SDK
|
|
111
|
-
* during init() after Storage.hydrate() has run.
|
|
126
|
+
* during init() after Storage.hydrate() has run. Marks the
|
|
127
|
+
* internal ready promise as resolved so queued auth calls
|
|
128
|
+
* unblock. */
|
|
112
129
|
hydrate(): void;
|
|
113
130
|
getCurrentUser(): AuthUser | null;
|
|
114
131
|
/**
|
package/dist/index.js
CHANGED
|
@@ -191,9 +191,14 @@ var Auth = class {
|
|
|
191
191
|
this.inflight = Promise.resolve();
|
|
192
192
|
this.refreshInflight = null;
|
|
193
193
|
this.hooks = hooks;
|
|
194
|
+
this.readyPromise = new Promise((res) => {
|
|
195
|
+
this.resolveReady = res;
|
|
196
|
+
});
|
|
194
197
|
}
|
|
195
198
|
/** Re-hydrate session from storage. Called by the parent SDK
|
|
196
|
-
* during init() after Storage.hydrate() has run.
|
|
199
|
+
* during init() after Storage.hydrate() has run. Marks the
|
|
200
|
+
* internal ready promise as resolved so queued auth calls
|
|
201
|
+
* unblock. */
|
|
197
202
|
hydrate() {
|
|
198
203
|
const cachedUser = this.hooks.storage.get(USER_KEY);
|
|
199
204
|
const cachedToken = this.hooks.storage.get(TOKEN_KEY);
|
|
@@ -213,6 +218,7 @@ var Auth = class {
|
|
|
213
218
|
this.hooks.storage.remove(REFRESH_KEY);
|
|
214
219
|
}
|
|
215
220
|
}
|
|
221
|
+
this.resolveReady();
|
|
216
222
|
}
|
|
217
223
|
getCurrentUser() {
|
|
218
224
|
return this.user;
|
|
@@ -665,7 +671,11 @@ var Auth = class {
|
|
|
665
671
|
}
|
|
666
672
|
// --- internals ---
|
|
667
673
|
serialize(op) {
|
|
668
|
-
const
|
|
674
|
+
const guarded = async () => {
|
|
675
|
+
await this.readyPromise;
|
|
676
|
+
return op();
|
|
677
|
+
};
|
|
678
|
+
const next = this.inflight.then(guarded, guarded);
|
|
669
679
|
this.inflight = next.catch(() => void 0);
|
|
670
680
|
return next;
|
|
671
681
|
}
|
|
@@ -750,7 +760,7 @@ function decodeJwtPayload(token) {
|
|
|
750
760
|
}
|
|
751
761
|
|
|
752
762
|
// src/index.ts
|
|
753
|
-
var SDK_VERSION = "0.10.
|
|
763
|
+
var SDK_VERSION = "0.10.3";
|
|
754
764
|
var DEFAULT_API_URL = "https://api.sendoracloud.com";
|
|
755
765
|
var ANON_KEY = "anon_id";
|
|
756
766
|
var USER_ID_KEY = "user_id";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sendoracloud/sdk-react-native",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.3",
|
|
4
4
|
"description": "Sendora Cloud React Native + Expo SDK — analytics, identity, push-token registration, auth. Expo Go compatible, no native modules beyond AsyncStorage.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|