@palbase/web 5.0.1 → 7.0.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 (45) hide show
  1. package/README.md +15 -15
  2. package/dist/{analytics-facade-Cp3d4QI-.d.ts → analytics-facade-CdTK9Y0s.d.ts} +42 -1
  3. package/dist/{analytics-facade-CaluA4bW.d.cts → analytics-facade-TB-D4ww8.d.cts} +42 -1
  4. package/dist/{chunk-QKFPPZLF.js → chunk-7SNSLY5M.js} +20 -3
  5. package/dist/chunk-7SNSLY5M.js.map +1 -0
  6. package/dist/{chunk-BNAGRUIQ.js → chunk-ACCJV6FV.js} +32 -2
  7. package/dist/chunk-ACCJV6FV.js.map +1 -0
  8. package/dist/{chunk-OWLTZG2V.js → chunk-ZC6Q3GPX.js} +2 -2
  9. package/dist/index.cjs +18 -1
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +3 -3
  12. package/dist/index.d.ts +3 -3
  13. package/dist/index.js +2 -2
  14. package/dist/internal.cjs +49 -2
  15. package/dist/internal.cjs.map +1 -1
  16. package/dist/internal.d.cts +3 -3
  17. package/dist/internal.d.ts +3 -3
  18. package/dist/internal.js +2 -2
  19. package/dist/next/client.cjs +49 -2
  20. package/dist/next/client.cjs.map +1 -1
  21. package/dist/next/client.js +2 -2
  22. package/dist/next/index.cjs +49 -2
  23. package/dist/next/index.cjs.map +1 -1
  24. package/dist/next/index.d.cts +2 -2
  25. package/dist/next/index.d.ts +2 -2
  26. package/dist/next/index.js +3 -3
  27. package/dist/next/{middleware.cjs → proxy.cjs} +11 -11
  28. package/dist/next/proxy.cjs.map +1 -0
  29. package/dist/next/{middleware.d.cts → proxy.d.cts} +32 -31
  30. package/dist/next/{middleware.d.ts → proxy.d.ts} +32 -31
  31. package/dist/next/{middleware.js → proxy.js} +8 -8
  32. package/dist/next/proxy.js.map +1 -0
  33. package/dist/{pb-DUK5qy81.d.ts → pb-B6ZcZy8v.d.ts} +1 -1
  34. package/dist/{pb-DvV6ftmf.d.cts → pb-CiSj4lM3.d.cts} +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 -2
  40. package/package.json +8 -8
  41. package/dist/chunk-BNAGRUIQ.js.map +0 -1
  42. package/dist/chunk-QKFPPZLF.js.map +0 -1
  43. package/dist/next/middleware.cjs.map +0 -1
  44. package/dist/next/middleware.js.map +0 -1
  45. /package/dist/{chunk-OWLTZG2V.js.map → chunk-ZC6Q3GPX.js.map} +0 -0
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
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-CaluA4bW.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 SignInMethods, V as UnreadView, W as Unsubscribe } from './analytics-facade-TB-D4ww8.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-DvV6ftmf.cjs';
3
+ export { C as CallOptions, P as PB, U as UploadOptions, a as UploadProgress, p as pb } from './pb-CiSj4lM3.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-4GtDtsiu.js';
6
6
 
@@ -206,6 +206,6 @@ interface MlsGlue {
206
206
  */
207
207
  declare function initMls(): Promise<MlsGlue>;
208
208
 
209
- declare const VERSION = "5.0.1";
209
+ declare const VERSION = "7.0.0";
210
210
 
211
211
  export { VERSION, initMls };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
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-Cp3d4QI-.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 SignInMethods, V as UnreadView, W as Unsubscribe } from './analytics-facade-CdTK9Y0s.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-DUK5qy81.js';
3
+ export { C as CallOptions, P as PB, U as UploadOptions, a as UploadProgress, p as pb } from './pb-B6ZcZy8v.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-4GtDtsiu.js';
6
6
 
@@ -206,6 +206,6 @@ interface MlsGlue {
206
206
  */
207
207
  declare function initMls(): Promise<MlsGlue>;
208
208
 
209
- declare const VERSION = "5.0.1";
209
+ declare const VERSION = "7.0.0";
210
210
 
211
211
  export { VERSION, initMls };
package/dist/index.js CHANGED
@@ -11,11 +11,11 @@ import {
11
11
  localStorageSessionStorage,
12
12
  memorySessionStorage,
13
13
  pb
14
- } from "./chunk-QKFPPZLF.js";
14
+ } from "./chunk-7SNSLY5M.js";
15
15
  import {
16
16
  BackendError,
17
17
  isBackendError
18
- } from "./chunk-BNAGRUIQ.js";
18
+ } from "./chunk-ACCJV6FV.js";
19
19
  import "./chunk-CFDU23TB.js";
20
20
  import "./chunk-PZ5AY32C.js";
21
21
  export {
package/dist/internal.cjs CHANGED
@@ -54,6 +54,27 @@ var PalbaseError = class extends Error {
54
54
  this.details = details;
55
55
  }
56
56
  };
57
+ function detectPlatform() {
58
+ if (typeof Deno !== "undefined") {
59
+ return "deno";
60
+ }
61
+ if (process?.versions) {
62
+ if ("bun" in process.versions) {
63
+ return "bun";
64
+ }
65
+ if ("node" in process.versions) {
66
+ return "node";
67
+ }
68
+ }
69
+ if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
70
+ return "react-native";
71
+ }
72
+ return "browser";
73
+ }
74
+ function wirePlatform() {
75
+ const host = detectPlatform();
76
+ return host === "browser" ? "web" : host;
77
+ }
57
78
  var PALBASE_DEFAULT_HOST = "api.palbase.studio";
58
79
  var API_KEY_RE = /^pb_([a-z0-9]{4,24})_c[A-Za-z0-9]{20}$/;
59
80
  function parseEnvironmentRef(apiKey) {
@@ -139,8 +160,17 @@ var HttpClient = class _HttpClient {
139
160
  }
140
161
  buildHeaders(options) {
141
162
  const headers = {
142
- "Content-Type": "application/json"
163
+ "Content-Type": "application/json",
164
+ // Client identity, the web counterpart of the iOS SDK's
165
+ // ClientInfo.augment(). The server reads these to resolve flag targeting
166
+ // conditions and to label telemetry, so an app declares nothing and calls
167
+ // nothing — whatever the SDK can know, it sends.
168
+ "X-Platform": wirePlatform()
143
169
  };
170
+ const appVersion = this.options?.appVersion?.trim();
171
+ if (appVersion) {
172
+ headers["X-Palbase-Client-Version"] = appVersion;
173
+ }
144
174
  const effectiveKey = this.apiKey;
145
175
  if (effectiveKey) {
146
176
  headers["apikey"] = effectiveKey;
@@ -1584,6 +1614,23 @@ var PalbeAuth = class {
1584
1614
  const raw = await palbeRequest(this.rt, "GET", "/auth/user");
1585
1615
  return mapWireUser(raw);
1586
1616
  }
1617
+ /**
1618
+ * Which credentials this account actually has.
1619
+ *
1620
+ * An account reached through Google has no password, so showing it a
1621
+ * "current password" field gives the user something they can never fill —
1622
+ * and `getUser()` cannot tell you, because GET /auth/user carries no
1623
+ * credential information. Read this before rendering any re-auth or
1624
+ * change-password form.
1625
+ */
1626
+ async getSignInMethods() {
1627
+ const raw = await palbeRequest(this.rt, "GET", "/auth/me");
1628
+ return {
1629
+ password: raw.has_password,
1630
+ mfa: raw.has_mfa,
1631
+ providers: raw.providers ?? null
1632
+ };
1633
+ }
1587
1634
  async refreshUser() {
1588
1635
  const user = await this.getUser();
1589
1636
  const changed = !usersEqual(user, this.cachedUser);
@@ -9028,7 +9075,7 @@ function defaultSessionStorage(key) {
9028
9075
  }
9029
9076
 
9030
9077
  // src/version.ts
9031
- var VERSION = "5.0.1";
9078
+ var VERSION = "7.0.0";
9032
9079
 
9033
9080
  // src/runtime.ts
9034
9081
  function buildRuntime(config) {