@palbase/web 1.8.0 → 1.9.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/{analytics-facade-DfJ420F5.d.cts → analytics-facade-DFd5LB3_.d.cts} +17 -4
- package/dist/{analytics-facade-CgURkjpP.d.ts → analytics-facade-DsvKx5A5.d.ts} +17 -4
- package/dist/{chunk-AWVNDAMG.js → chunk-I3ZMB7XM.js} +33 -6
- package/dist/chunk-I3ZMB7XM.js.map +1 -0
- package/dist/index.cjs +31 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/internal.cjs +32 -5
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +3 -3
- package/dist/internal.d.ts +3 -3
- package/dist/internal.js +1 -1
- package/dist/next/client.cjs +32 -5
- package/dist/next/client.cjs.map +1 -1
- package/dist/next/client.js +1 -1
- package/dist/next/index.cjs +32 -5
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.d.cts +2 -2
- package/dist/next/index.d.ts +2 -2
- package/dist/next/index.js +1 -1
- package/dist/{pb-C1v9ErPy.d.ts → pb-CDVMy1l1.d.ts} +1 -1
- package/dist/{pb-BwQwp411.d.cts → pb-D_fuhafL.d.cts} +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-AWVNDAMG.js.map +0 -1
package/dist/internal.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { v as PalbeConfig, T as PalbeRuntime } from './analytics-facade-
|
|
2
|
-
export { V as buildRuntime } from './analytics-facade-
|
|
1
|
+
import { v as PalbeConfig, T as PalbeRuntime } from './analytics-facade-DFd5LB3_.cjs';
|
|
2
|
+
export { V as buildRuntime } from './analytics-facade-DFd5LB3_.cjs';
|
|
3
3
|
import { B as BackendError } from './errors-fDoNdTrJ.cjs';
|
|
4
|
-
export { P as PB, c as createBoundClient } from './pb-
|
|
4
|
+
export { P as PB, c as createBoundClient } from './pb-D_fuhafL.cjs';
|
|
5
5
|
import 'livekit-client';
|
|
6
6
|
import './storage-BPaeSG8K.cjs';
|
|
7
7
|
import './pooled-flags-Bwq4usn0.js';
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { v as PalbeConfig, T as PalbeRuntime } from './analytics-facade-
|
|
2
|
-
export { V as buildRuntime } from './analytics-facade-
|
|
1
|
+
import { v as PalbeConfig, T as PalbeRuntime } from './analytics-facade-DsvKx5A5.js';
|
|
2
|
+
export { V as buildRuntime } from './analytics-facade-DsvKx5A5.js';
|
|
3
3
|
import { B as BackendError } from './errors-fDoNdTrJ.js';
|
|
4
|
-
export { P as PB, c as createBoundClient } from './pb-
|
|
4
|
+
export { P as PB, c as createBoundClient } from './pb-CDVMy1l1.js';
|
|
5
5
|
import 'livekit-client';
|
|
6
6
|
import './storage-BPaeSG8K.js';
|
|
7
7
|
import './pooled-flags-Bwq4usn0.js';
|
package/dist/internal.js
CHANGED
package/dist/next/client.cjs
CHANGED
|
@@ -1312,6 +1312,8 @@ var PalbeAuth = class {
|
|
|
1312
1312
|
// suppresses AuthClient's TOKEN_REFRESHED during re-signIn
|
|
1313
1313
|
signedInState = false;
|
|
1314
1314
|
// dedupes AuthClient's repeated SIGNED_OUT events
|
|
1315
|
+
hydratingUser = false;
|
|
1316
|
+
// guards hydrateUser() to a single boot fetch
|
|
1315
1317
|
stateListeners = /* @__PURE__ */ new Set();
|
|
1316
1318
|
eventListeners = /* @__PURE__ */ new Set();
|
|
1317
1319
|
userListeners = /* @__PURE__ */ new Set();
|
|
@@ -1364,13 +1366,37 @@ var PalbeAuth = class {
|
|
|
1364
1366
|
if (changed) for (const cb of this.userListeners) this.safeInvoke(() => cb(user));
|
|
1365
1367
|
return user;
|
|
1366
1368
|
}
|
|
1369
|
+
/**
|
|
1370
|
+
* Restore the user after a session was rehydrated from storage (page reload).
|
|
1371
|
+
* Hydration in buildRuntime restores the TOKENS synchronously, but the access
|
|
1372
|
+
* token JWT does not carry emailVerified/createdAt, so the full AuthUser can't
|
|
1373
|
+
* be reconstructed offline — this fetches GET /auth/user once and announces
|
|
1374
|
+
* `signedIn`, so the app no longer has to `await pb.auth.refreshUser()` itself
|
|
1375
|
+
* on boot. Idempotent (runs once), browser-safe (no-op when not signed in or
|
|
1376
|
+
* a user is already cached), and never throws (a boot-time network failure
|
|
1377
|
+
* must not break app startup — isSignedIn stays true, the app can retry).
|
|
1378
|
+
*/
|
|
1379
|
+
hydrateUser() {
|
|
1380
|
+
if (this.hydratingUser || this.cachedUser || !this.isSignedIn) return;
|
|
1381
|
+
this.hydratingUser = true;
|
|
1382
|
+
void this.refreshUser().then((user) => {
|
|
1383
|
+
if (this.isSignedIn) {
|
|
1384
|
+
this.signedInState = true;
|
|
1385
|
+
this.emitState({ status: "signedIn", user });
|
|
1386
|
+
}
|
|
1387
|
+
}).catch(() => {
|
|
1388
|
+
}).finally(() => {
|
|
1389
|
+
this.hydratingUser = false;
|
|
1390
|
+
});
|
|
1391
|
+
}
|
|
1367
1392
|
// ── listeners ──────────────────────────────────────────
|
|
1368
1393
|
/**
|
|
1369
1394
|
* Subscribe to signed-in/signed-out state. Fires immediately with the
|
|
1370
|
-
* current snapshot (iOS parity).
|
|
1371
|
-
*
|
|
1372
|
-
*
|
|
1373
|
-
*
|
|
1395
|
+
* current snapshot (iOS parity). A restored session (page reload) hydrates
|
|
1396
|
+
* the user asynchronously via `hydrateUser()` (fired once at boot), so the
|
|
1397
|
+
* FIRST snapshot may report signedOut for a tick even when `isSignedIn` is
|
|
1398
|
+
* true; the listener then fires again with `signedIn` once the user lands.
|
|
1399
|
+
* Rely on `isSignedIn` for the session truth if you need it synchronously.
|
|
1374
1400
|
*/
|
|
1375
1401
|
onAuthStateChange(callback) {
|
|
1376
1402
|
this.stateListeners.add(callback);
|
|
@@ -8724,7 +8750,7 @@ function defaultSessionStorage(key) {
|
|
|
8724
8750
|
}
|
|
8725
8751
|
|
|
8726
8752
|
// src/version.ts
|
|
8727
|
-
var VERSION = "1.
|
|
8753
|
+
var VERSION = "1.9.0";
|
|
8728
8754
|
|
|
8729
8755
|
// src/runtime.ts
|
|
8730
8756
|
function buildRuntime(config) {
|
|
@@ -8842,6 +8868,7 @@ function buildRuntime(config) {
|
|
|
8842
8868
|
void rt.perf;
|
|
8843
8869
|
if (typeof document !== "undefined") {
|
|
8844
8870
|
void new PerfConfigClient().fetchConfig(rt, rt.perf);
|
|
8871
|
+
rt.auth.hydrateUser();
|
|
8845
8872
|
}
|
|
8846
8873
|
recordColdStart(rt);
|
|
8847
8874
|
observeWebVitals((item) => rt.perf.record(item));
|