UNPKG

@better-auth-ui/core

Version:

Authentication components and data utilities for [Better Auth](https://better-auth.com), available for React and Solid.

177 lines (176 loc) 4.02 kB
import { t as e } from "../../auth-query-keys-B_bcsA3s.js"; import { t } from "../../create-auth-plugin-BXWyolC8.js"; //#region src/plugins/email-otp/email-otp-mutation-keys.ts var n = { signIn: [ "auth", "signIn", "emailOtp" ], sendVerificationOtp: [ "auth", "emailOtp", "sendVerificationOtp" ], verifyEmail: [ "auth", "emailOtp", "verifyEmail" ], requestPasswordReset: [ "auth", "emailOtp", "requestPasswordReset" ], resetPassword: [ "auth", "emailOtp", "resetPassword" ], requestEmailChange: [ "auth", "emailOtp", "requestEmailChange" ], changeEmail: [ "auth", "emailOtp", "changeEmail" ] }; //#endregion //#region src/plugins/email-otp/change-email-otp-mutation.ts function r(t) { return { mutationKey: n.changeEmail, mutationFn: (e) => t.emailOtp.changeEmail({ ...e, fetchOptions: { ...e?.fetchOptions, throw: !0 } }), meta: { awaits: [e.session] } }; } //#endregion //#region src/plugins/email-otp/email-otp-localization.ts var i = { emailOtp: "Email Code", sendCode: "Send code", code: "Code", verifyCode: "Verify code", codeSentTo: "We sent a code to {{email}}", codeLengthMismatch: "Enter the {{length}}-digit code", useDifferentEmail: "Use a different email", codeSent: "Code sent", emailVerified: "Email verified", confirmCurrentEmail: "Confirm your current email", confirmNewEmail: "Confirm your new email", confirmEmailDescription: "Enter the code we sent to {{email}} to finish the change" }, a = 6; function o(e) { return e === void 0 || !Number.isFinite(e) ? a : Math.max(1, Math.floor(e)); } var s = t("emailOtp", (e = {}) => ({ localization: { ...i, ...e.localization }, otpLength: o(e.otpLength), signIn: e.signIn ?? !0, emailVerification: e.emailVerification ?? !1, passwordReset: e.passwordReset ?? !1, changeEmail: e.changeEmail ?? !1, verifyCurrentEmail: e.verifyCurrentEmail ?? !1, disableSignUp: e.disableSignUp ?? !0, viewPaths: { auth: { emailOtp: e.path ?? "email-otp" } } })); //#endregion //#region src/plugins/email-otp/request-email-change-otp-mutation.ts function c(e) { return { mutationKey: n.requestEmailChange, mutationFn: (t) => e.emailOtp.requestEmailChange({ ...t, fetchOptions: { ...t?.fetchOptions, throw: !0 } }) }; } //#endregion //#region src/plugins/email-otp/request-password-reset-otp-mutation.ts function l(e) { return { mutationKey: n.requestPasswordReset, mutationFn: (t) => e.emailOtp.requestPasswordReset({ ...t, fetchOptions: { ...t?.fetchOptions, throw: !0 } }) }; } //#endregion //#region src/plugins/email-otp/reset-password-otp-mutation.ts function u(e) { return { mutationKey: n.resetPassword, mutationFn: (t) => e.emailOtp.resetPassword({ ...t, fetchOptions: { ...t?.fetchOptions, throw: !0 } }) }; } //#endregion //#region src/plugins/email-otp/send-verification-otp-mutation.ts function d(e) { return { mutationKey: n.sendVerificationOtp, mutationFn: (t) => e.emailOtp.sendVerificationOtp({ ...t, fetchOptions: { ...t?.fetchOptions, throw: !0 } }) }; } //#endregion //#region src/plugins/email-otp/sign-in-email-otp-mutation.ts function f(t) { return { mutationKey: n.signIn, mutationFn: (e) => t.signIn.emailOtp({ ...e, fetchOptions: { ...e?.fetchOptions, throw: !0 } }), meta: { awaits: [e.session] } }; } //#endregion //#region src/plugins/email-otp/verify-email-otp-mutation.ts function p(t) { return { mutationKey: n.verifyEmail, mutationFn: (e) => t.emailOtp.verifyEmail({ ...e, fetchOptions: { ...e?.fetchOptions, throw: !0 } }), meta: { awaits: [e.session] } }; } //#endregion export { r as changeEmailOtpOptions, i as emailOtpLocalization, n as emailOtpMutationKeys, s as emailOtpPlugin, c as requestEmailChangeOtpOptions, l as requestPasswordResetOtpOptions, u as resetPasswordOtpOptions, d as sendVerificationOtpOptions, f as signInEmailOtpOptions, p as verifyEmailOtpOptions };