@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
@@ -1,7 +1,7 @@
1
- import { P as PalbeConfig } from './analytics-facade-CaluA4bW.cjs';
2
- export { d as PalbeRuntime, e as buildRuntime } from './analytics-facade-CaluA4bW.cjs';
1
+ import { P as PalbeConfig } from './analytics-facade-TB-D4ww8.cjs';
2
+ export { d as PalbeRuntime, e as buildRuntime } from './analytics-facade-TB-D4ww8.cjs';
3
3
  import { B as BackendError } from './errors-fDoNdTrJ.cjs';
4
- export { P as PB, c as createBoundClient } from './pb-DvV6ftmf.cjs';
4
+ export { P as PB, c as createBoundClient } from './pb-CiSj4lM3.cjs';
5
5
  import './storage-BPaeSG8K.cjs';
6
6
  import './pooled-flags-4GtDtsiu.js';
7
7
 
@@ -1,7 +1,7 @@
1
- import { P as PalbeConfig } from './analytics-facade-Cp3d4QI-.js';
2
- export { d as PalbeRuntime, e as buildRuntime } from './analytics-facade-Cp3d4QI-.js';
1
+ import { P as PalbeConfig } from './analytics-facade-CdTK9Y0s.js';
2
+ export { d as PalbeRuntime, e as buildRuntime } from './analytics-facade-CdTK9Y0s.js';
3
3
  import { B as BackendError } from './errors-fDoNdTrJ.js';
4
- export { P as PB, c as createBoundClient } from './pb-DUK5qy81.js';
4
+ export { P as PB, c as createBoundClient } from './pb-B6ZcZy8v.js';
5
5
  import './storage-BPaeSG8K.js';
6
6
  import './pooled-flags-4GtDtsiu.js';
7
7
 
package/dist/internal.js CHANGED
@@ -6,8 +6,8 @@ import {
6
6
  createBoundClient,
7
7
  getRuntime,
8
8
  onConfigured
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
  export {
@@ -49,6 +49,27 @@ var PalbaseError = class extends Error {
49
49
  this.details = details;
50
50
  }
51
51
  };
52
+ function detectPlatform() {
53
+ if (typeof Deno !== "undefined") {
54
+ return "deno";
55
+ }
56
+ if (process?.versions) {
57
+ if ("bun" in process.versions) {
58
+ return "bun";
59
+ }
60
+ if ("node" in process.versions) {
61
+ return "node";
62
+ }
63
+ }
64
+ if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
65
+ return "react-native";
66
+ }
67
+ return "browser";
68
+ }
69
+ function wirePlatform() {
70
+ const host = detectPlatform();
71
+ return host === "browser" ? "web" : host;
72
+ }
52
73
  var PALBASE_DEFAULT_HOST = "api.palbase.studio";
53
74
  var API_KEY_RE = /^pb_([a-z0-9]{4,24})_c[A-Za-z0-9]{20}$/;
54
75
  function parseEnvironmentRef(apiKey) {
@@ -134,8 +155,17 @@ var HttpClient = class _HttpClient {
134
155
  }
135
156
  buildHeaders(options) {
136
157
  const headers = {
137
- "Content-Type": "application/json"
158
+ "Content-Type": "application/json",
159
+ // Client identity, the web counterpart of the iOS SDK's
160
+ // ClientInfo.augment(). The server reads these to resolve flag targeting
161
+ // conditions and to label telemetry, so an app declares nothing and calls
162
+ // nothing — whatever the SDK can know, it sends.
163
+ "X-Platform": wirePlatform()
138
164
  };
165
+ const appVersion = this.options?.appVersion?.trim();
166
+ if (appVersion) {
167
+ headers["X-Palbase-Client-Version"] = appVersion;
168
+ }
139
169
  const effectiveKey = this.apiKey;
140
170
  if (effectiveKey) {
141
171
  headers["apikey"] = effectiveKey;
@@ -1384,6 +1414,23 @@ var PalbeAuth = class {
1384
1414
  const raw = await palbeRequest(this.rt, "GET", "/auth/user");
1385
1415
  return mapWireUser(raw);
1386
1416
  }
1417
+ /**
1418
+ * Which credentials this account actually has.
1419
+ *
1420
+ * An account reached through Google has no password, so showing it a
1421
+ * "current password" field gives the user something they can never fill —
1422
+ * and `getUser()` cannot tell you, because GET /auth/user carries no
1423
+ * credential information. Read this before rendering any re-auth or
1424
+ * change-password form.
1425
+ */
1426
+ async getSignInMethods() {
1427
+ const raw = await palbeRequest(this.rt, "GET", "/auth/me");
1428
+ return {
1429
+ password: raw.has_password,
1430
+ mfa: raw.has_mfa,
1431
+ providers: raw.providers ?? null
1432
+ };
1433
+ }
1387
1434
  async refreshUser() {
1388
1435
  const user = await this.getUser();
1389
1436
  const changed = !usersEqual(user, this.cachedUser);
@@ -8828,7 +8875,7 @@ function defaultSessionStorage(key) {
8828
8875
  }
8829
8876
 
8830
8877
  // src/version.ts
8831
- var VERSION = "6.0.0";
8878
+ var VERSION = "7.0.0";
8832
8879
 
8833
8880
  // src/runtime.ts
8834
8881
  function buildRuntime(config) {