@leisuresaas/react-native 0.6.9-dev.1 → 0.6.9-dev.2

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-native",
3
- "version": "0.6.9-dev.1",
3
+ "version": "0.6.9-dev.2",
4
4
  "description": "React Native SDK for LeisureSaas: OAuth, Public Ads/App Config, Drive User Plane (publishable keys). Frontend-only — no Integration Key.",
5
5
  "license": "MIT",
6
6
  "repository": {
package/src/index.ts CHANGED
@@ -73,7 +73,6 @@ export {
73
73
  changePassword,
74
74
  changeProductPassword,
75
75
  confirmEmailVerification,
76
- confirmEmailCode,
77
76
  confirmPasswordReset,
78
77
  confirmProductEmailVerification,
79
78
  confirmProductPasswordReset,
@@ -90,9 +89,7 @@ export {
90
89
  refreshSession,
91
90
  register,
92
91
  registerProductAccount,
93
- EmailCodePurpose,
94
92
  inspectPasswordReset,
95
- requestEmailCode,
96
93
  requestEmailVerification,
97
94
  resendVerification,
98
95
  verifyRegistrationCode,
@@ -108,8 +105,6 @@ export {
108
105
  } from "./public-auth";
109
106
  export type {
110
107
  AuthTokens,
111
- EmailCodeRequest,
112
- EmailProof,
113
108
  HeartbeatOptions,
114
109
  PasswordResetInfo,
115
110
  ProductAuthTokens,
@@ -137,8 +137,8 @@ type VerificationJSON = { verification?: string; expires_in?: number; resend_aft
137
137
  /**
138
138
  * Without `emailProof` the platform emails a verification link (`verification: "link"`, default) or a
139
139
  * 6-digit code (`"code"`, confirm with `verifyRegistrationCode`) and returns `verificationRequired`.
140
- * With a proof from `confirmEmailCode` (or the product backend) it returns `tokens` instead and
141
- * ignores `verification`. Errors: EmailAlreadyExists (verified account), FeatureDisabled (`"code"`
140
+ * With a proof from the product backend (Integration `POST /v1/auth/email-proofs`) it returns
141
+ * `tokens` instead and ignores `verification`. Errors: EmailAlreadyExists (verified account), FeatureDisabled (`"code"`
142
142
  * switched off), RateLimited (`"code"`, `err.retryAfter`).
143
143
  */
144
144
  export async function register(
@@ -206,50 +206,9 @@ export async function resendVerification(
206
206
  return out;
207
207
  }
208
208
 
209
- /** `purpose` values for `requestEmailCode`. Only `register` today. */
210
- export const EmailCodePurpose = { Register: "register" } as const;
211
-
212
- /** Result of `requestEmailCode`; the same for registered emails. Times in seconds. */
213
- export type EmailCodeRequest = { expiresIn: number; resendAfter: number };
214
-
215
- /** One-time proof from `confirmEmailCode`; pass `proof` as `register({ emailProof })`. */
216
- export type EmailProof = { proof: string; expiresAtUnix: number };
217
-
218
209
  /** The account behind a valid password reset token. */
219
210
  export type PasswordResetInfo = { email: string; expiresAtUnix: number };
220
211
 
221
- /**
222
- * Emails a 6-digit code. A registered email gets an "account exists" notice without a code; the
223
- * result is the same. Errors: RateLimited (`err.retryAfter`), InvalidArgument, FeatureDisabled.
224
- */
225
- export async function requestEmailCode(
226
- ctx: PublicAuthContext,
227
- input: { email: string; purpose?: string; locale?: string },
228
- ): Promise<EmailCodeRequest> {
229
- const resp = await publicAuthRequest<{ expires_in?: number; resend_after?: number }>(ctx, "/email-code/request", {
230
- email: input.email.trim(), purpose: input.purpose ?? EmailCodePurpose.Register, locale: input.locale ?? "",
231
- });
232
- return { expiresIn: resp.expires_in ?? 0, resendAfter: resp.resend_after ?? 0 };
233
- }
234
-
235
- /**
236
- * Checks the code and returns an email proof for `register`. Errors: EmailCodeInvalid (wrong code,
237
- * no code, or 5 wrong tries), EmailCodeExpired, RateLimited, FeatureDisabled.
238
- */
239
- export async function confirmEmailCode(
240
- ctx: PublicAuthContext,
241
- input: { email: string; purpose?: string; code: string },
242
- ): Promise<EmailProof> {
243
- const resp = await publicAuthRequest<{ email_proof?: string; expires_at_unix?: number }>(ctx, "/email-code/confirm", {
244
- email: input.email.trim(), purpose: input.purpose ?? EmailCodePurpose.Register, code: input.code.trim(),
245
- });
246
- const proof = resp.email_proof?.trim() ?? "";
247
- if (!proof) {
248
- throw PlatformError.fromHttp(502, "missing email_proof");
249
- }
250
- return { proof, expiresAtUnix: resp.expires_at_unix ?? 0 };
251
- }
252
-
253
212
  /**
254
213
  * Returns the email behind the `token` of a password reset link; the token is not consumed.
255
214
  * Errors: PasswordResetTokenInvalid, RateLimited, FeatureDisabled.