@palbase/web 7.1.0 → 7.2.1

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.
@@ -1,7 +1,7 @@
1
- import { P as PalbeConfig } from './analytics-facade-esr6cOBN.cjs';
2
- export { d as PalbeRuntime, e as buildRuntime } from './analytics-facade-esr6cOBN.cjs';
1
+ import { P as PalbeConfig } from './analytics-facade-jyXv7Cu4.cjs';
2
+ export { d as PalbeRuntime, e as buildRuntime } from './analytics-facade-jyXv7Cu4.cjs';
3
3
  import { B as BackendError } from './errors-fDoNdTrJ.cjs';
4
- export { P as PB, c as createBoundClient } from './pb-BT-vKA4j.cjs';
4
+ export { P as PB, c as createBoundClient } from './pb-CfYQGEn0.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-CZIwbsvG.js';
2
- export { d as PalbeRuntime, e as buildRuntime } from './analytics-facade-CZIwbsvG.js';
1
+ import { P as PalbeConfig } from './analytics-facade-DLfnVVwL.js';
2
+ export { d as PalbeRuntime, e as buildRuntime } from './analytics-facade-DLfnVVwL.js';
3
3
  import { B as BackendError } from './errors-fDoNdTrJ.js';
4
- export { P as PB, c as createBoundClient } from './pb-AWwslm5m.js';
4
+ export { P as PB, c as createBoundClient } from './pb-DdzpEkPY.js';
5
5
  import './storage-BPaeSG8K.js';
6
6
  import './pooled-flags-4GtDtsiu.js';
7
7
 
package/dist/internal.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  createBoundClient,
7
7
  getRuntime,
8
8
  onConfigured
9
- } from "./chunk-P6TWUWZC.js";
9
+ } from "./chunk-GITHW5JK.js";
10
10
  import "./chunk-ACCJV6FV.js";
11
11
  import "./chunk-CFDU23TB.js";
12
12
  import "./chunk-PZ5AY32C.js";
@@ -735,6 +735,20 @@ var AuthClient = class {
735
735
  body: params
736
736
  });
737
737
  }
738
+ /**
739
+ * Give a PASSWORDLESS account its first password.
740
+ *
741
+ * Separate from `changePassword` because that one cannot serve the case: it
742
+ * sends a current password and palauth answers an account that has none with
743
+ * 401. Requires a RECENT sign-in (403 `reauthentication_required` otherwise,
744
+ * the same gate passkey enrollment carries); an account that already has a
745
+ * password gets 409 `password_already_set`.
746
+ */
747
+ async setPassword(params) {
748
+ return this.httpClient.request("POST", "/auth/password/set", {
749
+ body: params
750
+ });
751
+ }
738
752
  // ── Token ───────────────────────────────────────────────
739
753
  async refresh() {
740
754
  const refreshToken = this.tokenManager.getRefreshToken();
@@ -1765,6 +1779,26 @@ var PalbeAuth = class {
1765
1779
  })
1766
1780
  );
1767
1781
  }
1782
+ /**
1783
+ * Give a passwordless account its FIRST password, in-app.
1784
+ *
1785
+ * For accounts created with a passkey or a social provider: they have no
1786
+ * current password, so `updatePassword` cannot serve them — it sends one and
1787
+ * the server answers 401. Before this existed the only route was the
1788
+ * password-RESET e-mail, which asks someone already signed in to go find
1789
+ * their inbox.
1790
+ *
1791
+ * Requires a RECENT sign-in, not merely a session: a first password is a
1792
+ * credential that outlives the rest, so the server answers 403
1793
+ * `reauthentication_required` on a stale one — the same gate
1794
+ * `registerPasskey` carries. An account that already has a password gets 409
1795
+ * `password_already_set`; change it with `updatePassword` instead.
1796
+ *
1797
+ * The session stays valid — no re-login.
1798
+ */
1799
+ async setPassword(newPassword) {
1800
+ unwrap(await this.rt.authClient.setPassword({ new_password: newPassword }));
1801
+ }
1768
1802
  async verifyEmail(params) {
1769
1803
  unwrap(await this.rt.authClient.verifyEmail(params));
1770
1804
  }
@@ -9064,7 +9098,7 @@ function defaultSessionStorage(key) {
9064
9098
  }
9065
9099
 
9066
9100
  // src/version.ts
9067
- var VERSION = "7.1.0";
9101
+ var VERSION = "7.2.1";
9068
9102
 
9069
9103
  // src/runtime.ts
9070
9104
  function buildRuntime(config) {