@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.
Files changed (42) hide show
  1. package/dist/{analytics-facade-DfJ420F5.d.cts → analytics-facade-B7vujhPJ.d.cts} +18 -5
  2. package/dist/{analytics-facade-CgURkjpP.d.ts → analytics-facade-CHh5EGC2.d.ts} +18 -5
  3. package/dist/{chunk-AWVNDAMG.js → chunk-4ZJHHXD3.js} +36 -11
  4. package/dist/chunk-4ZJHHXD3.js.map +1 -0
  5. package/dist/chunk-PZ5AY32C.js +10 -0
  6. package/dist/chunk-PZ5AY32C.js.map +1 -0
  7. package/dist/gen/cli.cjs +1220 -0
  8. package/dist/gen/cli.cjs.map +1 -0
  9. package/dist/gen/cli.d.cts +1 -0
  10. package/dist/gen/cli.d.ts +1 -0
  11. package/dist/gen/cli.js +1198 -0
  12. package/dist/gen/cli.js.map +1 -0
  13. package/dist/index.cjs +31 -5
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +3 -3
  16. package/dist/index.d.ts +3 -3
  17. package/dist/index.js +2 -1
  18. package/dist/internal.cjs +32 -5
  19. package/dist/internal.cjs.map +1 -1
  20. package/dist/internal.d.cts +3 -3
  21. package/dist/internal.d.ts +3 -3
  22. package/dist/internal.js +2 -1
  23. package/dist/next/client.cjs +32 -5
  24. package/dist/next/client.cjs.map +1 -1
  25. package/dist/next/client.js +2 -1
  26. package/dist/next/client.js.map +1 -1
  27. package/dist/next/index.cjs +32 -5
  28. package/dist/next/index.cjs.map +1 -1
  29. package/dist/next/index.d.cts +2 -2
  30. package/dist/next/index.d.ts +2 -2
  31. package/dist/next/index.js +2 -1
  32. package/dist/next/index.js.map +1 -1
  33. package/dist/{pb-BwQwp411.d.cts → pb-6965XULp.d.cts} +1 -1
  34. package/dist/{pb-C1v9ErPy.d.ts → pb-ChNq987M.d.ts} +1 -1
  35. package/dist/react/index.cjs +1 -1
  36. package/dist/react/index.cjs.map +1 -1
  37. package/dist/react/index.d.cts +1 -1
  38. package/dist/react/index.d.ts +1 -1
  39. package/dist/react/index.js +2 -1
  40. package/dist/react/index.js.map +1 -1
  41. package/package.json +6 -2
  42. package/dist/chunk-AWVNDAMG.js.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- export { A as AnalyticsProperties, a as AuthChangeEvent, b as AuthState, c as AuthSuccess, d as AuthUser, C as Call, e as CallChangeCallback, f as CallParticipant, g as CallState, h as Chat, i as ChatBackend, j as ChatDraft, k as ChatKind, l as ChatMember, m as ChatMessage, n as ChatMessageKind, o as ChatRole, p as ChatState, q as CommsPrefs, F as FlagsView, M as MagicLinkResult, r as MentionRange, s as MessageDirection, N as NotifyScope, O as OAuthExchangeResult, P as PalbeAnalytics, t as PalbeAuth, u as PalbeCalls, v as PalbeConfig, w as PalbeFlags, x as PalbeMessaging, y as PalbeOAuthConfig, z as PalbeRealtime, B as PresenceState, R as RealtimeChannel, D as RealtimeConnectionState, E as RealtimeHandler, G as RealtimePayload, H as RealtimeStatus, I as RealtimeStatusSnapshot, J as RealtimeSubscription, K as ResolvedMention, L as ResolvedReply, S as SentReceipt, U as UnreadView, Q as Unsubscribe } from './analytics-facade-DfJ420F5.cjs';
1
+ export { f as AnalyticsProperties, g as AuthChangeEvent, h as AuthState, i as AuthSuccess, A as AuthUser, j as Call, k as CallChangeCallback, l as CallParticipant, m as CallState, C as Chat, n as ChatBackend, o as ChatDraft, p as ChatKind, b as ChatMember, c as ChatMessage, q as ChatMessageKind, r as ChatRole, s as ChatState, t as CommsPrefs, F as FlagsView, M as MagicLinkResult, u as MentionRange, v as MessageDirection, N as NotifyScope, O as OAuthExchangeResult, w as PalbeAnalytics, x as PalbeAuth, y as PalbeCalls, P as PalbeConfig, z as PalbeFlags, B as PalbeMessaging, D as PalbeOAuthConfig, E as PalbeRealtime, G as PresenceState, H as RealtimeChannel, R as RealtimeConnectionState, I as RealtimeHandler, a as RealtimePayload, J as RealtimeStatus, K as RealtimeStatusSnapshot, L as RealtimeSubscription, Q as ResolvedMention, S as ResolvedReply, T as SentReceipt, U as UnreadView, V as Unsubscribe } from './analytics-facade-B7vujhPJ.cjs';
2
2
  export { B as BackendError, a as BackendErrorKind, F as FieldError, i as isBackendError } from './errors-fDoNdTrJ.cjs';
3
- export { C as CallOptions, P as PB, U as UploadOptions, a as UploadProgress, p as pb } from './pb-BwQwp411.cjs';
3
+ export { C as CallOptions, P as PB, U as UploadOptions, a as UploadProgress, p as pb } from './pb-6965XULp.cjs';
4
4
  export { P as PersistedSession, S as SessionStorageAdapter, l as localStorageSessionStorage, m as memorySessionStorage } from './storage-BPaeSG8K.cjs';
5
5
  export { F as FlagValue } from './pooled-flags-Bwq4usn0.js';
6
6
  import 'livekit-client';
@@ -207,6 +207,6 @@ interface MlsGlue {
207
207
  */
208
208
  declare function initMls(): Promise<MlsGlue>;
209
209
 
210
- declare const VERSION = "1.8.0";
210
+ declare const VERSION = "1.10.0";
211
211
 
212
212
  export { VERSION, initMls };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export { A as AnalyticsProperties, a as AuthChangeEvent, b as AuthState, c as AuthSuccess, d as AuthUser, C as Call, e as CallChangeCallback, f as CallParticipant, g as CallState, h as Chat, i as ChatBackend, j as ChatDraft, k as ChatKind, l as ChatMember, m as ChatMessage, n as ChatMessageKind, o as ChatRole, p as ChatState, q as CommsPrefs, F as FlagsView, M as MagicLinkResult, r as MentionRange, s as MessageDirection, N as NotifyScope, O as OAuthExchangeResult, P as PalbeAnalytics, t as PalbeAuth, u as PalbeCalls, v as PalbeConfig, w as PalbeFlags, x as PalbeMessaging, y as PalbeOAuthConfig, z as PalbeRealtime, B as PresenceState, R as RealtimeChannel, D as RealtimeConnectionState, E as RealtimeHandler, G as RealtimePayload, H as RealtimeStatus, I as RealtimeStatusSnapshot, J as RealtimeSubscription, K as ResolvedMention, L as ResolvedReply, S as SentReceipt, U as UnreadView, Q as Unsubscribe } from './analytics-facade-CgURkjpP.js';
1
+ export { f as AnalyticsProperties, g as AuthChangeEvent, h as AuthState, i as AuthSuccess, A as AuthUser, j as Call, k as CallChangeCallback, l as CallParticipant, m as CallState, C as Chat, n as ChatBackend, o as ChatDraft, p as ChatKind, b as ChatMember, c as ChatMessage, q as ChatMessageKind, r as ChatRole, s as ChatState, t as CommsPrefs, F as FlagsView, M as MagicLinkResult, u as MentionRange, v as MessageDirection, N as NotifyScope, O as OAuthExchangeResult, w as PalbeAnalytics, x as PalbeAuth, y as PalbeCalls, P as PalbeConfig, z as PalbeFlags, B as PalbeMessaging, D as PalbeOAuthConfig, E as PalbeRealtime, G as PresenceState, H as RealtimeChannel, R as RealtimeConnectionState, I as RealtimeHandler, a as RealtimePayload, J as RealtimeStatus, K as RealtimeStatusSnapshot, L as RealtimeSubscription, Q as ResolvedMention, S as ResolvedReply, T as SentReceipt, U as UnreadView, V as Unsubscribe } from './analytics-facade-CHh5EGC2.js';
2
2
  export { B as BackendError, a as BackendErrorKind, F as FieldError, i as isBackendError } from './errors-fDoNdTrJ.js';
3
- export { C as CallOptions, P as PB, U as UploadOptions, a as UploadProgress, p as pb } from './pb-C1v9ErPy.js';
3
+ export { C as CallOptions, P as PB, U as UploadOptions, a as UploadProgress, p as pb } from './pb-ChNq987M.js';
4
4
  export { P as PersistedSession, S as SessionStorageAdapter, l as localStorageSessionStorage, m as memorySessionStorage } from './storage-BPaeSG8K.js';
5
5
  export { F as FlagValue } from './pooled-flags-Bwq4usn0.js';
6
6
  import 'livekit-client';
@@ -207,6 +207,6 @@ interface MlsGlue {
207
207
  */
208
208
  declare function initMls(): Promise<MlsGlue>;
209
209
 
210
- declare const VERSION = "1.8.0";
210
+ declare const VERSION = "1.10.0";
211
211
 
212
212
  export { VERSION, initMls };
package/dist/index.js CHANGED
@@ -13,7 +13,8 @@ import {
13
13
  localStorageSessionStorage,
14
14
  memorySessionStorage,
15
15
  pb
16
- } from "./chunk-AWVNDAMG.js";
16
+ } from "./chunk-4ZJHHXD3.js";
17
+ import "./chunk-PZ5AY32C.js";
17
18
  export {
18
19
  BackendError,
19
20
  PalbeAnalytics,
package/dist/internal.cjs CHANGED
@@ -1512,6 +1512,8 @@ var PalbeAuth = class {
1512
1512
  // suppresses AuthClient's TOKEN_REFRESHED during re-signIn
1513
1513
  signedInState = false;
1514
1514
  // dedupes AuthClient's repeated SIGNED_OUT events
1515
+ hydratingUser = false;
1516
+ // guards hydrateUser() to a single boot fetch
1515
1517
  stateListeners = /* @__PURE__ */ new Set();
1516
1518
  eventListeners = /* @__PURE__ */ new Set();
1517
1519
  userListeners = /* @__PURE__ */ new Set();
@@ -1564,13 +1566,37 @@ var PalbeAuth = class {
1564
1566
  if (changed) for (const cb of this.userListeners) this.safeInvoke(() => cb(user));
1565
1567
  return user;
1566
1568
  }
1569
+ /**
1570
+ * Restore the user after a session was rehydrated from storage (page reload).
1571
+ * Hydration in buildRuntime restores the TOKENS synchronously, but the access
1572
+ * token JWT does not carry emailVerified/createdAt, so the full AuthUser can't
1573
+ * be reconstructed offline — this fetches GET /auth/user once and announces
1574
+ * `signedIn`, so the app no longer has to `await pb.auth.refreshUser()` itself
1575
+ * on boot. Idempotent (runs once), browser-safe (no-op when not signed in or
1576
+ * a user is already cached), and never throws (a boot-time network failure
1577
+ * must not break app startup — isSignedIn stays true, the app can retry).
1578
+ */
1579
+ hydrateUser() {
1580
+ if (this.hydratingUser || this.cachedUser || !this.isSignedIn) return;
1581
+ this.hydratingUser = true;
1582
+ void this.refreshUser().then((user) => {
1583
+ if (this.isSignedIn) {
1584
+ this.signedInState = true;
1585
+ this.emitState({ status: "signedIn", user });
1586
+ }
1587
+ }).catch(() => {
1588
+ }).finally(() => {
1589
+ this.hydratingUser = false;
1590
+ });
1591
+ }
1567
1592
  // ── listeners ──────────────────────────────────────────
1568
1593
  /**
1569
1594
  * Subscribe to signed-in/signed-out state. Fires immediately with the
1570
- * current snapshot (iOS parity). NOTE: a restored session (page reload) has
1571
- * no cached user yet, so the immediate snapshot reports signedOut even when
1572
- * `isSignedIn` is true call `refreshUser()` on boot to populate the user
1573
- * and rely on `isSignedIn` for the session truth.
1595
+ * current snapshot (iOS parity). A restored session (page reload) hydrates
1596
+ * the user asynchronously via `hydrateUser()` (fired once at boot), so the
1597
+ * FIRST snapshot may report signedOut for a tick even when `isSignedIn` is
1598
+ * true; the listener then fires again with `signedIn` once the user lands.
1599
+ * Rely on `isSignedIn` for the session truth if you need it synchronously.
1574
1600
  */
1575
1601
  onAuthStateChange(callback) {
1576
1602
  this.stateListeners.add(callback);
@@ -8924,7 +8950,7 @@ function defaultSessionStorage(key) {
8924
8950
  }
8925
8951
 
8926
8952
  // src/version.ts
8927
- var VERSION = "1.8.0";
8953
+ var VERSION = "1.10.0";
8928
8954
 
8929
8955
  // src/runtime.ts
8930
8956
  function buildRuntime(config) {
@@ -9042,6 +9068,7 @@ function buildRuntime(config) {
9042
9068
  void rt.perf;
9043
9069
  if (typeof document !== "undefined") {
9044
9070
  void new PerfConfigClient().fetchConfig(rt, rt.perf);
9071
+ rt.auth.hydrateUser();
9045
9072
  }
9046
9073
  recordColdStart(rt);
9047
9074
  observeWebVitals((item) => rt.perf.record(item));