@bowlos/reservations 0.26.0 → 0.28.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.
- package/HEADLESS.md +109 -16
- package/README.md +7 -5
- package/dist/{account-BXf9e6UW.d.cts → account-BZ-lZcs5.d.cts} +1 -1
- package/dist/{account-N1Zs7yvQ.d.ts → account-DVAwhiki.d.ts} +1 -1
- package/dist/{catalog-CVvwgrbZ.d.cts → catalog-BdOZC2nx.d.cts} +1 -1
- package/dist/{catalog-BF_xtQxf.d.ts → catalog-C-YyKVk5.d.ts} +1 -1
- package/dist/{chunk-AYQIKZCU.js → chunk-44AWSRIG.js} +32 -4
- package/dist/chunk-44AWSRIG.js.map +1 -0
- package/dist/{chunk-PPCQFT3U.js → chunk-P5YWNLEC.js} +30 -4
- package/dist/chunk-P5YWNLEC.js.map +1 -0
- package/dist/cli.cjs +24 -0
- package/dist/cli.cjs.map +1 -1
- package/dist/components.cjs +136 -20
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +17 -4
- package/dist/components.d.ts +17 -4
- package/dist/components.js +138 -22
- package/dist/components.js.map +1 -1
- package/dist/{data-BCbYaSC1.d.cts → data-BzO2guh0.d.cts} +23 -3
- package/dist/{data-BCbYaSC1.d.ts → data-BzO2guh0.d.ts} +23 -3
- package/dist/index.cjs +28 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/payments.d.cts +1 -1
- package/dist/payments.d.ts +1 -1
- package/dist/{react-BQikV5KJ.d.ts → react-BQaKMnCR.d.ts} +8 -2
- package/dist/{react-Y11QkXEQ.d.cts → react-CYgFZdHO.d.cts} +8 -2
- package/dist/react.cjs +53 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +5 -5
- package/dist/react.d.ts +5 -5
- package/dist/react.js +3 -3
- package/package.json +1 -1
- package/templates/center-site/package.json +1 -1
- package/dist/chunk-AYQIKZCU.js.map +0 -1
- package/dist/chunk-PPCQFT3U.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { A as AuthState, g as BowlosClient, h as BowlosClientConfig, l as Customer, L as LinkProfile } from './data-
|
|
4
|
-
import { a as BowlosApiError } from './catalog-
|
|
3
|
+
import { A as AuthState, g as BowlosClient, h as BowlosClientConfig, l as Customer, L as LinkProfile } from './data-BzO2guh0.cjs';
|
|
4
|
+
import { a as BowlosApiError } from './catalog-BdOZC2nx.cjs';
|
|
5
5
|
|
|
6
6
|
interface BowlosProviderProps {
|
|
7
7
|
/** A prebuilt client, or pass `config` to have one created and memoized. */
|
|
@@ -21,6 +21,12 @@ interface UseAccountResult {
|
|
|
21
21
|
register: (email: string, password: string, profile: Omit<LinkProfile, "email">) => Promise<void>;
|
|
22
22
|
signUp: (email: string, password: string) => Promise<void>;
|
|
23
23
|
link: (profile: LinkProfile) => Promise<void>;
|
|
24
|
+
/** Forgot-password step 1: email a reset code (no session change). Always
|
|
25
|
+
* resolves — the server never reveals whether the email has an account. */
|
|
26
|
+
requestPasswordReset: (email: string) => Promise<void>;
|
|
27
|
+
/** Forgot-password step 2: verify the code + set a new password. On success
|
|
28
|
+
* the customer is signed in (status flips to linked). */
|
|
29
|
+
resetPassword: (email: string, code: string, newPassword: string) => Promise<void>;
|
|
24
30
|
signOut: () => Promise<void>;
|
|
25
31
|
refresh: () => Promise<void>;
|
|
26
32
|
}
|
package/dist/react.cjs
CHANGED
|
@@ -228,6 +228,30 @@ var BowlosClient = class {
|
|
|
228
228
|
this.store.set(tokens);
|
|
229
229
|
return tokens;
|
|
230
230
|
}
|
|
231
|
+
/**
|
|
232
|
+
* Forgot-password step 1: email a reset code to the address (if it has an
|
|
233
|
+
* account at this center). Resolves regardless of whether the email exists —
|
|
234
|
+
* the server never reveals that, to prevent account enumeration. No session
|
|
235
|
+
* needed.
|
|
236
|
+
*/
|
|
237
|
+
async requestPasswordReset(email) {
|
|
238
|
+
await this.call("auth/request-reset", { email });
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Forgot-password step 2: verify the emailed code + set a new password. On
|
|
242
|
+
* success the customer is signed in (the session is stored), so the UI can
|
|
243
|
+
* continue straight into the funnel. Throws `INVALID_RESET` on a bad/expired
|
|
244
|
+
* code and `PASSWORD_TOO_WEAK` if the new password fails the policy.
|
|
245
|
+
*/
|
|
246
|
+
async resetPassword(email, code, newPassword) {
|
|
247
|
+
const { tokens } = await this.call("auth/reset", {
|
|
248
|
+
email,
|
|
249
|
+
code,
|
|
250
|
+
newPassword
|
|
251
|
+
});
|
|
252
|
+
this.store.set(tokens);
|
|
253
|
+
return tokens;
|
|
254
|
+
}
|
|
231
255
|
/** Link the signed-in auth user to a customer profile at the brand. */
|
|
232
256
|
async link(profile) {
|
|
233
257
|
return this.call("auth/link", { ...profile }, { auth: true });
|
|
@@ -341,8 +365,36 @@ function useAccountState(client) {
|
|
|
341
365
|
[client, run]
|
|
342
366
|
);
|
|
343
367
|
const link = react.useCallback((profile) => run(() => client.link(profile)), [client, run]);
|
|
368
|
+
const requestPasswordReset = react.useCallback(
|
|
369
|
+
async (email) => {
|
|
370
|
+
setError(null);
|
|
371
|
+
try {
|
|
372
|
+
await client.requestPasswordReset(email);
|
|
373
|
+
} catch (e) {
|
|
374
|
+
if (e instanceof BowlosApiError) setError(e);
|
|
375
|
+
throw e;
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
[client]
|
|
379
|
+
);
|
|
380
|
+
const resetPassword = react.useCallback(
|
|
381
|
+
(email, code, newPassword) => run(() => client.resetPassword(email, code, newPassword)),
|
|
382
|
+
[client, run]
|
|
383
|
+
);
|
|
344
384
|
const signOut = react.useCallback(() => run(() => client.signOut()), [client, run]);
|
|
345
|
-
return {
|
|
385
|
+
return {
|
|
386
|
+
status,
|
|
387
|
+
customer,
|
|
388
|
+
error,
|
|
389
|
+
signIn,
|
|
390
|
+
register,
|
|
391
|
+
signUp,
|
|
392
|
+
link,
|
|
393
|
+
requestPasswordReset,
|
|
394
|
+
resetPassword,
|
|
395
|
+
signOut,
|
|
396
|
+
refresh
|
|
397
|
+
};
|
|
346
398
|
}
|
|
347
399
|
function useAccount() {
|
|
348
400
|
const account = react.useContext(AccountContext);
|