@leisuresaas/react 0.1.0 → 0.1.2-dev.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leisuresaas/react",
3
- "version": "0.1.0",
3
+ "version": "0.1.2-dev.1",
4
4
  "description": "Browser SDK for LeisureSaas: product auth, OAuth PKCE, Public Ads, Drive. No Expo or Integration Key.",
5
5
  "license": "MIT",
6
6
  "repository": {
package/src/auth.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { LeisureSaasHttpError } from "./errors";
2
2
  import { applyPublishableKeyHeaders } from "./publishable-key";
3
3
 
4
+ export { LeisureSaasHttpError };
5
+
4
6
  /** Browser product-account calls. Platform is always web; pass the site origin. */
5
7
  export type PublicAuthContext = {
6
8
  gatewayUrl: string;
@@ -122,6 +124,18 @@ export async function requestProductEmailVerification(
122
124
  await publicAuthRequest(ctx, "/email-verification", { email: input.email, locale: input.locale ?? "" });
123
125
  }
124
126
 
127
+ export async function confirmProductEmailVerification(ctx: PublicAuthContext, token: string): Promise<ProductAuthTokens> {
128
+ const resp = await publicAuthRequest<TokenJSON>(ctx, "/email-verification/confirm", { token });
129
+ return tokensFromJSON(resp);
130
+ }
131
+
132
+ export async function confirmProductPasswordReset(
133
+ ctx: PublicAuthContext,
134
+ input: { token: string; newPassword: string },
135
+ ): Promise<void> {
136
+ await publicAuthRequest(ctx, "/password-reset/confirm", { token: input.token, new_password: input.newPassword });
137
+ }
138
+
125
139
  export async function changeProductPassword(
126
140
  ctx: PublicAuthContext,
127
141
  accessToken: string,
package/src/index.ts CHANGED
@@ -12,6 +12,8 @@ export {
12
12
  logoutProductAccount,
13
13
  refreshProductSession,
14
14
  registerProductAccount,
15
+ confirmProductEmailVerification,
16
+ confirmProductPasswordReset,
15
17
  requestProductEmailVerification,
16
18
  requestProductPasswordReset,
17
19
  startPlatformAuthorize,