@palbase/web 1.8.0 → 1.10.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-B7vujhPJ.d.cts} +18 -5
- package/dist/{analytics-facade-CgURkjpP.d.ts → analytics-facade-CHh5EGC2.d.ts} +18 -5
- package/dist/{chunk-AWVNDAMG.js → chunk-4ZJHHXD3.js} +36 -11
- package/dist/chunk-4ZJHHXD3.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/gen/cli.cjs +1220 -0
- package/dist/gen/cli.cjs.map +1 -0
- package/dist/gen/cli.d.cts +1 -0
- package/dist/gen/cli.d.ts +1 -0
- package/dist/gen/cli.js +1198 -0
- package/dist/gen/cli.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 +2 -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 +2 -1
- package/dist/next/client.cjs +32 -5
- package/dist/next/client.cjs.map +1 -1
- package/dist/next/client.js +2 -1
- package/dist/next/client.js.map +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 +2 -1
- package/dist/next/index.js.map +1 -1
- package/dist/{pb-BwQwp411.d.cts → pb-6965XULp.d.cts} +1 -1
- package/dist/{pb-C1v9ErPy.d.ts → pb-ChNq987M.d.ts} +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 +2 -1
- package/dist/react/index.js.map +1 -1
- package/package.json +6 -2
- package/dist/chunk-AWVNDAMG.js.map +0 -1
|
@@ -1771,6 +1771,7 @@ declare class PalbeAuth {
|
|
|
1771
1771
|
private signingOut;
|
|
1772
1772
|
private signingIn;
|
|
1773
1773
|
private signedInState;
|
|
1774
|
+
private hydratingUser;
|
|
1774
1775
|
private readonly stateListeners;
|
|
1775
1776
|
private readonly eventListeners;
|
|
1776
1777
|
private readonly userListeners;
|
|
@@ -1788,12 +1789,24 @@ declare class PalbeAuth {
|
|
|
1788
1789
|
signOut(): Promise<void>;
|
|
1789
1790
|
getUser(): Promise<AuthUser>;
|
|
1790
1791
|
refreshUser(): Promise<AuthUser>;
|
|
1792
|
+
/**
|
|
1793
|
+
* Restore the user after a session was rehydrated from storage (page reload).
|
|
1794
|
+
* Hydration in buildRuntime restores the TOKENS synchronously, but the access
|
|
1795
|
+
* token JWT does not carry emailVerified/createdAt, so the full AuthUser can't
|
|
1796
|
+
* be reconstructed offline — this fetches GET /auth/user once and announces
|
|
1797
|
+
* `signedIn`, so the app no longer has to `await pb.auth.refreshUser()` itself
|
|
1798
|
+
* on boot. Idempotent (runs once), browser-safe (no-op when not signed in or
|
|
1799
|
+
* a user is already cached), and never throws (a boot-time network failure
|
|
1800
|
+
* must not break app startup — isSignedIn stays true, the app can retry).
|
|
1801
|
+
*/
|
|
1802
|
+
hydrateUser(): void;
|
|
1791
1803
|
/**
|
|
1792
1804
|
* Subscribe to signed-in/signed-out state. Fires immediately with the
|
|
1793
|
-
* current snapshot (iOS parity).
|
|
1794
|
-
*
|
|
1795
|
-
*
|
|
1796
|
-
*
|
|
1805
|
+
* current snapshot (iOS parity). A restored session (page reload) hydrates
|
|
1806
|
+
* the user asynchronously via `hydrateUser()` (fired once at boot), so the
|
|
1807
|
+
* FIRST snapshot may report signedOut for a tick even when `isSignedIn` is
|
|
1808
|
+
* true; the listener then fires again with `signedIn` once the user lands.
|
|
1809
|
+
* Rely on `isSignedIn` for the session truth if you need it synchronously.
|
|
1797
1810
|
*/
|
|
1798
1811
|
onAuthStateChange(callback: (state: AuthState) => void): Unsubscribe;
|
|
1799
1812
|
onAuthEvent(callback: (event: AuthChangeEvent) => void): Unsubscribe;
|
|
@@ -1965,4 +1978,4 @@ declare class PalbeAnalytics {
|
|
|
1965
1978
|
private post;
|
|
1966
1979
|
}
|
|
1967
1980
|
|
|
1968
|
-
export { type
|
|
1981
|
+
export { type AuthUser as A, PalbeMessaging as B, Chat as C, type PalbeOAuthConfig as D, PalbeRealtime as E, type FlagsView as F, type PresenceState as G, RealtimeChannel as H, type RealtimeHandler as I, type RealtimeStatus as J, type RealtimeStatusSnapshot as K, type RealtimeSubscription as L, type MagicLinkResult as M, type NotifyScope as N, type OAuthExchangeResult as O, type PalbeConfig as P, type ResolvedMention as Q, type RealtimeConnectionState as R, type ResolvedReply as S, type SentReceipt as T, type UnreadView as U, type Unsubscribe as V, PalbePerf as W, type RealtimePayload as a, type ChatMember as b, type ChatMessage as c, type PalbeRuntime as d, buildRuntime as e, type AnalyticsProperties as f, type AuthChangeEvent as g, type AuthState as h, type AuthSuccess as i, Call as j, type CallChangeCallback as k, type CallParticipant as l, type CallState as m, type ChatBackend as n, type ChatDraft as o, type ChatKind as p, type ChatMessageKind as q, type ChatRole as r, type ChatState as s, type CommsPrefs as t, type MentionRange as u, type MessageDirection as v, PalbeAnalytics as w, PalbeAuth as x, PalbeCalls as y, PalbeFlags as z };
|
|
@@ -1771,6 +1771,7 @@ declare class PalbeAuth {
|
|
|
1771
1771
|
private signingOut;
|
|
1772
1772
|
private signingIn;
|
|
1773
1773
|
private signedInState;
|
|
1774
|
+
private hydratingUser;
|
|
1774
1775
|
private readonly stateListeners;
|
|
1775
1776
|
private readonly eventListeners;
|
|
1776
1777
|
private readonly userListeners;
|
|
@@ -1788,12 +1789,24 @@ declare class PalbeAuth {
|
|
|
1788
1789
|
signOut(): Promise<void>;
|
|
1789
1790
|
getUser(): Promise<AuthUser>;
|
|
1790
1791
|
refreshUser(): Promise<AuthUser>;
|
|
1792
|
+
/**
|
|
1793
|
+
* Restore the user after a session was rehydrated from storage (page reload).
|
|
1794
|
+
* Hydration in buildRuntime restores the TOKENS synchronously, but the access
|
|
1795
|
+
* token JWT does not carry emailVerified/createdAt, so the full AuthUser can't
|
|
1796
|
+
* be reconstructed offline — this fetches GET /auth/user once and announces
|
|
1797
|
+
* `signedIn`, so the app no longer has to `await pb.auth.refreshUser()` itself
|
|
1798
|
+
* on boot. Idempotent (runs once), browser-safe (no-op when not signed in or
|
|
1799
|
+
* a user is already cached), and never throws (a boot-time network failure
|
|
1800
|
+
* must not break app startup — isSignedIn stays true, the app can retry).
|
|
1801
|
+
*/
|
|
1802
|
+
hydrateUser(): void;
|
|
1791
1803
|
/**
|
|
1792
1804
|
* Subscribe to signed-in/signed-out state. Fires immediately with the
|
|
1793
|
-
* current snapshot (iOS parity).
|
|
1794
|
-
*
|
|
1795
|
-
*
|
|
1796
|
-
*
|
|
1805
|
+
* current snapshot (iOS parity). A restored session (page reload) hydrates
|
|
1806
|
+
* the user asynchronously via `hydrateUser()` (fired once at boot), so the
|
|
1807
|
+
* FIRST snapshot may report signedOut for a tick even when `isSignedIn` is
|
|
1808
|
+
* true; the listener then fires again with `signedIn` once the user lands.
|
|
1809
|
+
* Rely on `isSignedIn` for the session truth if you need it synchronously.
|
|
1797
1810
|
*/
|
|
1798
1811
|
onAuthStateChange(callback: (state: AuthState) => void): Unsubscribe;
|
|
1799
1812
|
onAuthEvent(callback: (event: AuthChangeEvent) => void): Unsubscribe;
|
|
@@ -1965,4 +1978,4 @@ declare class PalbeAnalytics {
|
|
|
1965
1978
|
private post;
|
|
1966
1979
|
}
|
|
1967
1980
|
|
|
1968
|
-
export { type
|
|
1981
|
+
export { type AuthUser as A, PalbeMessaging as B, Chat as C, type PalbeOAuthConfig as D, PalbeRealtime as E, type FlagsView as F, type PresenceState as G, RealtimeChannel as H, type RealtimeHandler as I, type RealtimeStatus as J, type RealtimeStatusSnapshot as K, type RealtimeSubscription as L, type MagicLinkResult as M, type NotifyScope as N, type OAuthExchangeResult as O, type PalbeConfig as P, type ResolvedMention as Q, type RealtimeConnectionState as R, type ResolvedReply as S, type SentReceipt as T, type UnreadView as U, type Unsubscribe as V, PalbePerf as W, type RealtimePayload as a, type ChatMember as b, type ChatMessage as c, type PalbeRuntime as d, buildRuntime as e, type AnalyticsProperties as f, type AuthChangeEvent as g, type AuthState as h, type AuthSuccess as i, Call as j, type CallChangeCallback as k, type CallParticipant as l, type CallState as m, type ChatBackend as n, type ChatDraft as o, type ChatKind as p, type ChatMessageKind as q, type ChatRole as r, type ChatState as s, type CommsPrefs as t, type MentionRange as u, type MessageDirection as v, PalbeAnalytics as w, PalbeAuth as x, PalbeCalls as y, PalbeFlags as z };
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
__export
|
|
3
|
+
} from "./chunk-PZ5AY32C.js";
|
|
6
4
|
|
|
7
5
|
// ../core/dist/index.js
|
|
8
6
|
var CACHE_TTL_MS = 5 * 60 * 1e3;
|
|
@@ -1486,6 +1484,8 @@ var PalbeAuth = class {
|
|
|
1486
1484
|
// suppresses AuthClient's TOKEN_REFRESHED during re-signIn
|
|
1487
1485
|
signedInState = false;
|
|
1488
1486
|
// dedupes AuthClient's repeated SIGNED_OUT events
|
|
1487
|
+
hydratingUser = false;
|
|
1488
|
+
// guards hydrateUser() to a single boot fetch
|
|
1489
1489
|
stateListeners = /* @__PURE__ */ new Set();
|
|
1490
1490
|
eventListeners = /* @__PURE__ */ new Set();
|
|
1491
1491
|
userListeners = /* @__PURE__ */ new Set();
|
|
@@ -1538,13 +1538,37 @@ var PalbeAuth = class {
|
|
|
1538
1538
|
if (changed) for (const cb of this.userListeners) this.safeInvoke(() => cb(user));
|
|
1539
1539
|
return user;
|
|
1540
1540
|
}
|
|
1541
|
+
/**
|
|
1542
|
+
* Restore the user after a session was rehydrated from storage (page reload).
|
|
1543
|
+
* Hydration in buildRuntime restores the TOKENS synchronously, but the access
|
|
1544
|
+
* token JWT does not carry emailVerified/createdAt, so the full AuthUser can't
|
|
1545
|
+
* be reconstructed offline — this fetches GET /auth/user once and announces
|
|
1546
|
+
* `signedIn`, so the app no longer has to `await pb.auth.refreshUser()` itself
|
|
1547
|
+
* on boot. Idempotent (runs once), browser-safe (no-op when not signed in or
|
|
1548
|
+
* a user is already cached), and never throws (a boot-time network failure
|
|
1549
|
+
* must not break app startup — isSignedIn stays true, the app can retry).
|
|
1550
|
+
*/
|
|
1551
|
+
hydrateUser() {
|
|
1552
|
+
if (this.hydratingUser || this.cachedUser || !this.isSignedIn) return;
|
|
1553
|
+
this.hydratingUser = true;
|
|
1554
|
+
void this.refreshUser().then((user) => {
|
|
1555
|
+
if (this.isSignedIn) {
|
|
1556
|
+
this.signedInState = true;
|
|
1557
|
+
this.emitState({ status: "signedIn", user });
|
|
1558
|
+
}
|
|
1559
|
+
}).catch(() => {
|
|
1560
|
+
}).finally(() => {
|
|
1561
|
+
this.hydratingUser = false;
|
|
1562
|
+
});
|
|
1563
|
+
}
|
|
1541
1564
|
// ── listeners ──────────────────────────────────────────
|
|
1542
1565
|
/**
|
|
1543
1566
|
* Subscribe to signed-in/signed-out state. Fires immediately with the
|
|
1544
|
-
* current snapshot (iOS parity).
|
|
1545
|
-
*
|
|
1546
|
-
*
|
|
1547
|
-
*
|
|
1567
|
+
* current snapshot (iOS parity). A restored session (page reload) hydrates
|
|
1568
|
+
* the user asynchronously via `hydrateUser()` (fired once at boot), so the
|
|
1569
|
+
* FIRST snapshot may report signedOut for a tick even when `isSignedIn` is
|
|
1570
|
+
* true; the listener then fires again with `signedIn` once the user lands.
|
|
1571
|
+
* Rely on `isSignedIn` for the session truth if you need it synchronously.
|
|
1548
1572
|
*/
|
|
1549
1573
|
onAuthStateChange(callback) {
|
|
1550
1574
|
this.stateListeners.add(callback);
|
|
@@ -8902,7 +8926,7 @@ function defaultSessionStorage(key) {
|
|
|
8902
8926
|
}
|
|
8903
8927
|
|
|
8904
8928
|
// src/version.ts
|
|
8905
|
-
var VERSION = "1.
|
|
8929
|
+
var VERSION = "1.10.0";
|
|
8906
8930
|
|
|
8907
8931
|
// src/runtime.ts
|
|
8908
8932
|
function buildRuntime(config) {
|
|
@@ -9020,6 +9044,7 @@ function buildRuntime(config) {
|
|
|
9020
9044
|
void rt.perf;
|
|
9021
9045
|
if (typeof document !== "undefined") {
|
|
9022
9046
|
void new PerfConfigClient().fetchConfig(rt, rt.perf);
|
|
9047
|
+
rt.auth.hydrateUser();
|
|
9023
9048
|
}
|
|
9024
9049
|
recordColdStart(rt);
|
|
9025
9050
|
observeWebVitals((item) => rt.perf.record(item));
|
|
@@ -9315,4 +9340,4 @@ export {
|
|
|
9315
9340
|
pb,
|
|
9316
9341
|
createBoundClient
|
|
9317
9342
|
};
|
|
9318
|
-
//# sourceMappingURL=chunk-
|
|
9343
|
+
//# sourceMappingURL=chunk-4ZJHHXD3.js.map
|