@palbase/web 6.0.0 → 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 (37) hide show
  1. package/dist/{analytics-facade-Cp3d4QI-.d.ts → analytics-facade-CdTK9Y0s.d.ts} +42 -1
  2. package/dist/{analytics-facade-CaluA4bW.d.cts → analytics-facade-TB-D4ww8.d.cts} +42 -1
  3. package/dist/{chunk-KOJ4OAAR.js → chunk-7SNSLY5M.js} +20 -3
  4. package/dist/chunk-7SNSLY5M.js.map +1 -0
  5. package/dist/{chunk-BNAGRUIQ.js → chunk-ACCJV6FV.js} +32 -2
  6. package/dist/chunk-ACCJV6FV.js.map +1 -0
  7. package/dist/{chunk-OWLTZG2V.js → chunk-ZC6Q3GPX.js} +2 -2
  8. package/dist/index.cjs +18 -1
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.d.cts +3 -3
  11. package/dist/index.d.ts +3 -3
  12. package/dist/index.js +2 -2
  13. package/dist/internal.cjs +49 -2
  14. package/dist/internal.cjs.map +1 -1
  15. package/dist/internal.d.cts +3 -3
  16. package/dist/internal.d.ts +3 -3
  17. package/dist/internal.js +2 -2
  18. package/dist/next/client.cjs +49 -2
  19. package/dist/next/client.cjs.map +1 -1
  20. package/dist/next/client.js +2 -2
  21. package/dist/next/index.cjs +49 -2
  22. package/dist/next/index.cjs.map +1 -1
  23. package/dist/next/index.d.cts +2 -2
  24. package/dist/next/index.d.ts +2 -2
  25. package/dist/next/index.js +3 -3
  26. package/dist/next/proxy.js +2 -2
  27. package/dist/{pb-DUK5qy81.d.ts → pb-B6ZcZy8v.d.ts} +1 -1
  28. package/dist/{pb-DvV6ftmf.d.cts → pb-CiSj4lM3.d.cts} +1 -1
  29. package/dist/react/index.cjs +1 -1
  30. package/dist/react/index.cjs.map +1 -1
  31. package/dist/react/index.d.cts +1 -1
  32. package/dist/react/index.d.ts +1 -1
  33. package/dist/react/index.js +2 -2
  34. package/package.json +2 -2
  35. package/dist/chunk-BNAGRUIQ.js.map +0 -1
  36. package/dist/chunk-KOJ4OAAR.js.map +0 -1
  37. /package/dist/{chunk-OWLTZG2V.js.map → chunk-ZC6Q3GPX.js.map} +0 -0
@@ -6,8 +6,8 @@ import {
6
6
  import {
7
7
  __configure,
8
8
  getRuntime
9
- } from "../chunk-KOJ4OAAR.js";
10
- import "../chunk-BNAGRUIQ.js";
9
+ } from "../chunk-7SNSLY5M.js";
10
+ import "../chunk-ACCJV6FV.js";
11
11
  import "../chunk-CFDU23TB.js";
12
12
  import "../chunk-PZ5AY32C.js";
13
13
 
@@ -166,6 +166,27 @@ var PalbaseError = class extends Error {
166
166
  this.details = details;
167
167
  }
168
168
  };
169
+ function detectPlatform() {
170
+ if (typeof Deno !== "undefined") {
171
+ return "deno";
172
+ }
173
+ if (process?.versions) {
174
+ if ("bun" in process.versions) {
175
+ return "bun";
176
+ }
177
+ if ("node" in process.versions) {
178
+ return "node";
179
+ }
180
+ }
181
+ if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
182
+ return "react-native";
183
+ }
184
+ return "browser";
185
+ }
186
+ function wirePlatform() {
187
+ const host = detectPlatform();
188
+ return host === "browser" ? "web" : host;
189
+ }
169
190
  var PALBASE_DEFAULT_HOST = "api.palbase.studio";
170
191
  var API_KEY_RE2 = /^pb_([a-z0-9]{4,24})_c[A-Za-z0-9]{20}$/;
171
192
  function parseEnvironmentRef(apiKey) {
@@ -251,8 +272,17 @@ var HttpClient = class _HttpClient {
251
272
  }
252
273
  buildHeaders(options) {
253
274
  const headers = {
254
- "Content-Type": "application/json"
275
+ "Content-Type": "application/json",
276
+ // Client identity, the web counterpart of the iOS SDK's
277
+ // ClientInfo.augment(). The server reads these to resolve flag targeting
278
+ // conditions and to label telemetry, so an app declares nothing and calls
279
+ // nothing — whatever the SDK can know, it sends.
280
+ "X-Platform": wirePlatform()
255
281
  };
282
+ const appVersion = this.options?.appVersion?.trim();
283
+ if (appVersion) {
284
+ headers["X-Palbase-Client-Version"] = appVersion;
285
+ }
256
286
  const effectiveKey = this.apiKey;
257
287
  if (effectiveKey) {
258
288
  headers["apikey"] = effectiveKey;
@@ -1593,6 +1623,23 @@ var PalbeAuth = class {
1593
1623
  const raw = await palbeRequest(this.rt, "GET", "/auth/user");
1594
1624
  return mapWireUser(raw);
1595
1625
  }
1626
+ /**
1627
+ * Which credentials this account actually has.
1628
+ *
1629
+ * An account reached through Google has no password, so showing it a
1630
+ * "current password" field gives the user something they can never fill —
1631
+ * and `getUser()` cannot tell you, because GET /auth/user carries no
1632
+ * credential information. Read this before rendering any re-auth or
1633
+ * change-password form.
1634
+ */
1635
+ async getSignInMethods() {
1636
+ const raw = await palbeRequest(this.rt, "GET", "/auth/me");
1637
+ return {
1638
+ password: raw.has_password,
1639
+ mfa: raw.has_mfa,
1640
+ providers: raw.providers ?? null
1641
+ };
1642
+ }
1596
1643
  async refreshUser() {
1597
1644
  const user = await this.getUser();
1598
1645
  const changed = !usersEqual(user, this.cachedUser);
@@ -9037,7 +9084,7 @@ function defaultSessionStorage(key) {
9037
9084
  }
9038
9085
 
9039
9086
  // src/version.ts
9040
- var VERSION = "6.0.0";
9087
+ var VERSION = "7.0.0";
9041
9088
 
9042
9089
  // src/runtime.ts
9043
9090
  function buildRuntime(config) {