@erikey/react 0.4.36 → 0.5.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/dist/styles.css +144 -1
- package/dist/styles.css.map +1 -1
- package/dist/ui/index.mjs +326 -194
- package/dist/ui/index.mjs.map +1 -1
- package/dist/ui/style.css +28 -0
- package/dist/ui/style.css.map +1 -1
- package/package.json +1 -1
- package/src/ui/components/auth/auth-flow.tsx +118 -6
- package/src/ui/components/auth/auth-form.tsx +6 -0
- package/src/ui/components/auth/auth-view.tsx +6 -0
- package/src/ui/components/auth/forms/email-verification-form.tsx +12 -8
- package/src/ui/components/auth/forms/forgot-password-form.tsx +11 -4
- package/src/ui/components/auth/forms/reset-password-form.tsx +18 -8
- package/src/ui/components/auth/forms/sign-in-form.tsx +16 -9
- package/src/ui/components/auth/forms/sign-up-form.tsx +28 -14
- package/src/ui/lib/auth-ui-provider.tsx +5 -0
- package/src/ui/style.css +32 -1
package/dist/ui/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { forwardRef as forwardRef2, createElement as createElement2 } from "react";
|
|
3
3
|
|
|
4
4
|
// ../../../node_modules/.pnpm/lucide-react@0.462.0_react@19.0.0/node_modules/lucide-react/dist/esm/shared/src/utils.js
|
|
5
|
-
var toKebabCase = (
|
|
5
|
+
var toKebabCase = (string2) => string2.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
6
6
|
var mergeClasses = (...classes) => classes.filter((className, index, array) => {
|
|
7
7
|
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
|
|
8
8
|
}).join(" ").trim();
|
|
@@ -736,32 +736,32 @@ function twJoin() {
|
|
|
736
736
|
let index = 0;
|
|
737
737
|
let argument;
|
|
738
738
|
let resolvedValue;
|
|
739
|
-
let
|
|
739
|
+
let string2 = "";
|
|
740
740
|
while (index < arguments.length) {
|
|
741
741
|
if (argument = arguments[index++]) {
|
|
742
742
|
if (resolvedValue = toValue(argument)) {
|
|
743
|
-
|
|
744
|
-
|
|
743
|
+
string2 && (string2 += " ");
|
|
744
|
+
string2 += resolvedValue;
|
|
745
745
|
}
|
|
746
746
|
}
|
|
747
747
|
}
|
|
748
|
-
return
|
|
748
|
+
return string2;
|
|
749
749
|
}
|
|
750
750
|
var toValue = (mix) => {
|
|
751
751
|
if (typeof mix === "string") {
|
|
752
752
|
return mix;
|
|
753
753
|
}
|
|
754
754
|
let resolvedValue;
|
|
755
|
-
let
|
|
755
|
+
let string2 = "";
|
|
756
756
|
for (let k = 0; k < mix.length; k++) {
|
|
757
757
|
if (mix[k]) {
|
|
758
758
|
if (resolvedValue = toValue(mix[k])) {
|
|
759
|
-
|
|
760
|
-
|
|
759
|
+
string2 && (string2 += " ");
|
|
760
|
+
string2 += resolvedValue;
|
|
761
761
|
}
|
|
762
762
|
}
|
|
763
763
|
}
|
|
764
|
-
return
|
|
764
|
+
return string2;
|
|
765
765
|
};
|
|
766
766
|
function createTailwindMerge(createConfigFirst, ...createConfigRest) {
|
|
767
767
|
let configUtils;
|
|
@@ -2954,10 +2954,10 @@ var util;
|
|
|
2954
2954
|
return void 0;
|
|
2955
2955
|
};
|
|
2956
2956
|
util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
|
|
2957
|
-
function
|
|
2957
|
+
function joinValues2(array, separator = " | ") {
|
|
2958
2958
|
return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
|
|
2959
2959
|
}
|
|
2960
|
-
util2.joinValues =
|
|
2960
|
+
util2.joinValues = joinValues2;
|
|
2961
2961
|
util2.jsonStringifyReplacer = (_, value) => {
|
|
2962
2962
|
if (typeof value === "bigint") {
|
|
2963
2963
|
return value.toString();
|
|
@@ -3081,31 +3081,31 @@ var ZodError = class _ZodError extends Error {
|
|
|
3081
3081
|
this.issues = issues;
|
|
3082
3082
|
}
|
|
3083
3083
|
format(_mapper) {
|
|
3084
|
-
const mapper = _mapper || function(
|
|
3085
|
-
return
|
|
3084
|
+
const mapper = _mapper || function(issue2) {
|
|
3085
|
+
return issue2.message;
|
|
3086
3086
|
};
|
|
3087
3087
|
const fieldErrors = { _errors: [] };
|
|
3088
3088
|
const processError = (error) => {
|
|
3089
|
-
for (const
|
|
3090
|
-
if (
|
|
3091
|
-
|
|
3092
|
-
} else if (
|
|
3093
|
-
processError(
|
|
3094
|
-
} else if (
|
|
3095
|
-
processError(
|
|
3096
|
-
} else if (
|
|
3097
|
-
fieldErrors._errors.push(mapper(
|
|
3089
|
+
for (const issue2 of error.issues) {
|
|
3090
|
+
if (issue2.code === "invalid_union") {
|
|
3091
|
+
issue2.unionErrors.map(processError);
|
|
3092
|
+
} else if (issue2.code === "invalid_return_type") {
|
|
3093
|
+
processError(issue2.returnTypeError);
|
|
3094
|
+
} else if (issue2.code === "invalid_arguments") {
|
|
3095
|
+
processError(issue2.argumentsError);
|
|
3096
|
+
} else if (issue2.path.length === 0) {
|
|
3097
|
+
fieldErrors._errors.push(mapper(issue2));
|
|
3098
3098
|
} else {
|
|
3099
3099
|
let curr = fieldErrors;
|
|
3100
3100
|
let i3 = 0;
|
|
3101
|
-
while (i3 <
|
|
3102
|
-
const el =
|
|
3103
|
-
const terminal = i3 ===
|
|
3101
|
+
while (i3 < issue2.path.length) {
|
|
3102
|
+
const el = issue2.path[i3];
|
|
3103
|
+
const terminal = i3 === issue2.path.length - 1;
|
|
3104
3104
|
if (!terminal) {
|
|
3105
3105
|
curr[el] = curr[el] || { _errors: [] };
|
|
3106
3106
|
} else {
|
|
3107
3107
|
curr[el] = curr[el] || { _errors: [] };
|
|
3108
|
-
curr[el]._errors.push(mapper(
|
|
3108
|
+
curr[el]._errors.push(mapper(issue2));
|
|
3109
3109
|
}
|
|
3110
3110
|
curr = curr[el];
|
|
3111
3111
|
i3++;
|
|
@@ -3130,7 +3130,7 @@ var ZodError = class _ZodError extends Error {
|
|
|
3130
3130
|
get isEmpty() {
|
|
3131
3131
|
return this.issues.length === 0;
|
|
3132
3132
|
}
|
|
3133
|
-
flatten(mapper = (
|
|
3133
|
+
flatten(mapper = (issue2) => issue2.message) {
|
|
3134
3134
|
const fieldErrors = {};
|
|
3135
3135
|
const formErrors = [];
|
|
3136
3136
|
for (const sub of this.issues) {
|
|
@@ -3154,30 +3154,30 @@ ZodError.create = (issues) => {
|
|
|
3154
3154
|
};
|
|
3155
3155
|
|
|
3156
3156
|
// ../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js
|
|
3157
|
-
var errorMap = (
|
|
3157
|
+
var errorMap = (issue2, _ctx) => {
|
|
3158
3158
|
let message;
|
|
3159
|
-
switch (
|
|
3159
|
+
switch (issue2.code) {
|
|
3160
3160
|
case ZodIssueCode.invalid_type:
|
|
3161
|
-
if (
|
|
3161
|
+
if (issue2.received === ZodParsedType.undefined) {
|
|
3162
3162
|
message = "Required";
|
|
3163
3163
|
} else {
|
|
3164
|
-
message = `Expected ${
|
|
3164
|
+
message = `Expected ${issue2.expected}, received ${issue2.received}`;
|
|
3165
3165
|
}
|
|
3166
3166
|
break;
|
|
3167
3167
|
case ZodIssueCode.invalid_literal:
|
|
3168
|
-
message = `Invalid literal value, expected ${JSON.stringify(
|
|
3168
|
+
message = `Invalid literal value, expected ${JSON.stringify(issue2.expected, util.jsonStringifyReplacer)}`;
|
|
3169
3169
|
break;
|
|
3170
3170
|
case ZodIssueCode.unrecognized_keys:
|
|
3171
|
-
message = `Unrecognized key(s) in object: ${util.joinValues(
|
|
3171
|
+
message = `Unrecognized key(s) in object: ${util.joinValues(issue2.keys, ", ")}`;
|
|
3172
3172
|
break;
|
|
3173
3173
|
case ZodIssueCode.invalid_union:
|
|
3174
3174
|
message = `Invalid input`;
|
|
3175
3175
|
break;
|
|
3176
3176
|
case ZodIssueCode.invalid_union_discriminator:
|
|
3177
|
-
message = `Invalid discriminator value. Expected ${util.joinValues(
|
|
3177
|
+
message = `Invalid discriminator value. Expected ${util.joinValues(issue2.options)}`;
|
|
3178
3178
|
break;
|
|
3179
3179
|
case ZodIssueCode.invalid_enum_value:
|
|
3180
|
-
message = `Invalid enum value. Expected ${util.joinValues(
|
|
3180
|
+
message = `Invalid enum value. Expected ${util.joinValues(issue2.options)}, received '${issue2.received}'`;
|
|
3181
3181
|
break;
|
|
3182
3182
|
case ZodIssueCode.invalid_arguments:
|
|
3183
3183
|
message = `Invalid function arguments`;
|
|
@@ -3189,50 +3189,50 @@ var errorMap = (issue, _ctx) => {
|
|
|
3189
3189
|
message = `Invalid date`;
|
|
3190
3190
|
break;
|
|
3191
3191
|
case ZodIssueCode.invalid_string:
|
|
3192
|
-
if (typeof
|
|
3193
|
-
if ("includes" in
|
|
3194
|
-
message = `Invalid input: must include "${
|
|
3195
|
-
if (typeof
|
|
3196
|
-
message = `${message} at one or more positions greater than or equal to ${
|
|
3192
|
+
if (typeof issue2.validation === "object") {
|
|
3193
|
+
if ("includes" in issue2.validation) {
|
|
3194
|
+
message = `Invalid input: must include "${issue2.validation.includes}"`;
|
|
3195
|
+
if (typeof issue2.validation.position === "number") {
|
|
3196
|
+
message = `${message} at one or more positions greater than or equal to ${issue2.validation.position}`;
|
|
3197
3197
|
}
|
|
3198
|
-
} else if ("startsWith" in
|
|
3199
|
-
message = `Invalid input: must start with "${
|
|
3200
|
-
} else if ("endsWith" in
|
|
3201
|
-
message = `Invalid input: must end with "${
|
|
3198
|
+
} else if ("startsWith" in issue2.validation) {
|
|
3199
|
+
message = `Invalid input: must start with "${issue2.validation.startsWith}"`;
|
|
3200
|
+
} else if ("endsWith" in issue2.validation) {
|
|
3201
|
+
message = `Invalid input: must end with "${issue2.validation.endsWith}"`;
|
|
3202
3202
|
} else {
|
|
3203
|
-
util.assertNever(
|
|
3203
|
+
util.assertNever(issue2.validation);
|
|
3204
3204
|
}
|
|
3205
|
-
} else if (
|
|
3206
|
-
message = `Invalid ${
|
|
3205
|
+
} else if (issue2.validation !== "regex") {
|
|
3206
|
+
message = `Invalid ${issue2.validation}`;
|
|
3207
3207
|
} else {
|
|
3208
3208
|
message = "Invalid";
|
|
3209
3209
|
}
|
|
3210
3210
|
break;
|
|
3211
3211
|
case ZodIssueCode.too_small:
|
|
3212
|
-
if (
|
|
3213
|
-
message = `Array must contain ${
|
|
3214
|
-
else if (
|
|
3215
|
-
message = `String must contain ${
|
|
3216
|
-
else if (
|
|
3217
|
-
message = `Number must be ${
|
|
3218
|
-
else if (
|
|
3219
|
-
message = `Number must be ${
|
|
3220
|
-
else if (
|
|
3221
|
-
message = `Date must be ${
|
|
3212
|
+
if (issue2.type === "array")
|
|
3213
|
+
message = `Array must contain ${issue2.exact ? "exactly" : issue2.inclusive ? `at least` : `more than`} ${issue2.minimum} element(s)`;
|
|
3214
|
+
else if (issue2.type === "string")
|
|
3215
|
+
message = `String must contain ${issue2.exact ? "exactly" : issue2.inclusive ? `at least` : `over`} ${issue2.minimum} character(s)`;
|
|
3216
|
+
else if (issue2.type === "number")
|
|
3217
|
+
message = `Number must be ${issue2.exact ? `exactly equal to ` : issue2.inclusive ? `greater than or equal to ` : `greater than `}${issue2.minimum}`;
|
|
3218
|
+
else if (issue2.type === "bigint")
|
|
3219
|
+
message = `Number must be ${issue2.exact ? `exactly equal to ` : issue2.inclusive ? `greater than or equal to ` : `greater than `}${issue2.minimum}`;
|
|
3220
|
+
else if (issue2.type === "date")
|
|
3221
|
+
message = `Date must be ${issue2.exact ? `exactly equal to ` : issue2.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue2.minimum))}`;
|
|
3222
3222
|
else
|
|
3223
3223
|
message = "Invalid input";
|
|
3224
3224
|
break;
|
|
3225
3225
|
case ZodIssueCode.too_big:
|
|
3226
|
-
if (
|
|
3227
|
-
message = `Array must contain ${
|
|
3228
|
-
else if (
|
|
3229
|
-
message = `String must contain ${
|
|
3230
|
-
else if (
|
|
3231
|
-
message = `Number must be ${
|
|
3232
|
-
else if (
|
|
3233
|
-
message = `BigInt must be ${
|
|
3234
|
-
else if (
|
|
3235
|
-
message = `Date must be ${
|
|
3226
|
+
if (issue2.type === "array")
|
|
3227
|
+
message = `Array must contain ${issue2.exact ? `exactly` : issue2.inclusive ? `at most` : `less than`} ${issue2.maximum} element(s)`;
|
|
3228
|
+
else if (issue2.type === "string")
|
|
3229
|
+
message = `String must contain ${issue2.exact ? `exactly` : issue2.inclusive ? `at most` : `under`} ${issue2.maximum} character(s)`;
|
|
3230
|
+
else if (issue2.type === "number")
|
|
3231
|
+
message = `Number must be ${issue2.exact ? `exactly` : issue2.inclusive ? `less than or equal to` : `less than`} ${issue2.maximum}`;
|
|
3232
|
+
else if (issue2.type === "bigint")
|
|
3233
|
+
message = `BigInt must be ${issue2.exact ? `exactly` : issue2.inclusive ? `less than or equal to` : `less than`} ${issue2.maximum}`;
|
|
3234
|
+
else if (issue2.type === "date")
|
|
3235
|
+
message = `Date must be ${issue2.exact ? `exactly` : issue2.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue2.maximum))}`;
|
|
3236
3236
|
else
|
|
3237
3237
|
message = "Invalid input";
|
|
3238
3238
|
break;
|
|
@@ -3243,14 +3243,14 @@ var errorMap = (issue, _ctx) => {
|
|
|
3243
3243
|
message = `Intersection results could not be merged`;
|
|
3244
3244
|
break;
|
|
3245
3245
|
case ZodIssueCode.not_multiple_of:
|
|
3246
|
-
message = `Number must be a multiple of ${
|
|
3246
|
+
message = `Number must be a multiple of ${issue2.multipleOf}`;
|
|
3247
3247
|
break;
|
|
3248
3248
|
case ZodIssueCode.not_finite:
|
|
3249
3249
|
message = "Number must be finite";
|
|
3250
3250
|
break;
|
|
3251
3251
|
default:
|
|
3252
3252
|
message = _ctx.defaultError;
|
|
3253
|
-
util.assertNever(
|
|
3253
|
+
util.assertNever(issue2);
|
|
3254
3254
|
}
|
|
3255
3255
|
return { message };
|
|
3256
3256
|
};
|
|
@@ -3290,7 +3290,7 @@ var makeIssue = (params) => {
|
|
|
3290
3290
|
};
|
|
3291
3291
|
function addIssueToContext(ctx, issueData) {
|
|
3292
3292
|
const overrideMap = getErrorMap();
|
|
3293
|
-
const
|
|
3293
|
+
const issue2 = makeIssue({
|
|
3294
3294
|
issueData,
|
|
3295
3295
|
data: ctx.data,
|
|
3296
3296
|
path: ctx.path,
|
|
@@ -3305,7 +3305,7 @@ function addIssueToContext(ctx, issueData) {
|
|
|
3305
3305
|
// then global default map
|
|
3306
3306
|
].filter((x) => !!x)
|
|
3307
3307
|
});
|
|
3308
|
-
ctx.common.issues.push(
|
|
3308
|
+
ctx.common.issues.push(issue2);
|
|
3309
3309
|
}
|
|
3310
3310
|
var ParseStatus = class _ParseStatus {
|
|
3311
3311
|
constructor() {
|
|
@@ -3763,11 +3763,11 @@ function datetimeRegex(args) {
|
|
|
3763
3763
|
regex = `${regex}(${opts.join("|")})`;
|
|
3764
3764
|
return new RegExp(`^${regex}$`);
|
|
3765
3765
|
}
|
|
3766
|
-
function isValidIP(ip,
|
|
3767
|
-
if ((
|
|
3766
|
+
function isValidIP(ip, version2) {
|
|
3767
|
+
if ((version2 === "v4" || !version2) && ipv4Regex.test(ip)) {
|
|
3768
3768
|
return true;
|
|
3769
3769
|
}
|
|
3770
|
-
if ((
|
|
3770
|
+
if ((version2 === "v6" || !version2) && ipv6Regex.test(ip)) {
|
|
3771
3771
|
return true;
|
|
3772
3772
|
}
|
|
3773
3773
|
return false;
|
|
@@ -3779,8 +3779,8 @@ function isValidJWT(jwt, alg) {
|
|
|
3779
3779
|
const [header] = jwt.split(".");
|
|
3780
3780
|
if (!header)
|
|
3781
3781
|
return false;
|
|
3782
|
-
const
|
|
3783
|
-
const decoded = JSON.parse(atob(
|
|
3782
|
+
const base642 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
|
|
3783
|
+
const decoded = JSON.parse(atob(base642));
|
|
3784
3784
|
if (typeof decoded !== "object" || decoded === null)
|
|
3785
3785
|
return false;
|
|
3786
3786
|
if ("typ" in decoded && decoded?.typ !== "JWT")
|
|
@@ -3794,11 +3794,11 @@ function isValidJWT(jwt, alg) {
|
|
|
3794
3794
|
return false;
|
|
3795
3795
|
}
|
|
3796
3796
|
}
|
|
3797
|
-
function isValidCidr(ip,
|
|
3798
|
-
if ((
|
|
3797
|
+
function isValidCidr(ip, version2) {
|
|
3798
|
+
if ((version2 === "v4" || !version2) && ipv4CidrRegex.test(ip)) {
|
|
3799
3799
|
return true;
|
|
3800
3800
|
}
|
|
3801
|
-
if ((
|
|
3801
|
+
if ((version2 === "v6" || !version2) && ipv6CidrRegex.test(ip)) {
|
|
3802
3802
|
return true;
|
|
3803
3803
|
}
|
|
3804
3804
|
return false;
|
|
@@ -5263,9 +5263,9 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
|
5263
5263
|
...this._def,
|
|
5264
5264
|
unknownKeys: "strict",
|
|
5265
5265
|
...message !== void 0 ? {
|
|
5266
|
-
errorMap: (
|
|
5267
|
-
const defaultError = this._def.errorMap?.(
|
|
5268
|
-
if (
|
|
5266
|
+
errorMap: (issue2, ctx) => {
|
|
5267
|
+
const defaultError = this._def.errorMap?.(issue2, ctx).message ?? ctx.defaultError;
|
|
5268
|
+
if (issue2.code === "unrecognized_keys")
|
|
5269
5269
|
return {
|
|
5270
5270
|
message: errorUtil.errToObj(message).message ?? defaultError
|
|
5271
5271
|
};
|
|
@@ -6796,9 +6796,9 @@ var coerce = {
|
|
|
6796
6796
|
function cn(...inputs) {
|
|
6797
6797
|
return twMerge(clsx(inputs));
|
|
6798
6798
|
}
|
|
6799
|
-
function isValidEmail(
|
|
6799
|
+
function isValidEmail(email2) {
|
|
6800
6800
|
const emailRegex2 = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
6801
|
-
return emailRegex2.test(
|
|
6801
|
+
return emailRegex2.test(email2);
|
|
6802
6802
|
}
|
|
6803
6803
|
function getLocalizedError({
|
|
6804
6804
|
error,
|
|
@@ -9751,7 +9751,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
9751
9751
|
}
|
|
9752
9752
|
} else {
|
|
9753
9753
|
const valueDate = ref.valueAsDate || new Date(inputValue);
|
|
9754
|
-
const convertTimeToDate = (
|
|
9754
|
+
const convertTimeToDate = (time2) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + time2);
|
|
9755
9755
|
const isTime = ref.type == "time";
|
|
9756
9756
|
const isWeek = ref.type == "week";
|
|
9757
9757
|
if (isString(maxOutput.value) && inputValue) {
|
|
@@ -10850,7 +10850,7 @@ function n(e) {
|
|
|
10850
10850
|
return e.replace(/\]|\[/g, "");
|
|
10851
10851
|
}
|
|
10852
10852
|
|
|
10853
|
-
// ../../../node_modules/.pnpm/zod@
|
|
10853
|
+
// ../../../node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/core.js
|
|
10854
10854
|
var NEVER = Object.freeze({
|
|
10855
10855
|
status: "aborted"
|
|
10856
10856
|
});
|
|
@@ -10910,7 +10910,7 @@ function config(newConfig) {
|
|
|
10910
10910
|
return globalConfig;
|
|
10911
10911
|
}
|
|
10912
10912
|
|
|
10913
|
-
// ../../../node_modules/.pnpm/zod@
|
|
10913
|
+
// ../../../node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/util.js
|
|
10914
10914
|
function jsonStringifyReplacer(_, value) {
|
|
10915
10915
|
if (typeof value === "bigint")
|
|
10916
10916
|
return value.toString();
|
|
@@ -10929,7 +10929,8 @@ function cached(getter) {
|
|
|
10929
10929
|
}
|
|
10930
10930
|
};
|
|
10931
10931
|
}
|
|
10932
|
-
var
|
|
10932
|
+
var EVALUATING = Symbol("evaluating");
|
|
10933
|
+
var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
|
|
10933
10934
|
};
|
|
10934
10935
|
var allowsEval = cached(() => {
|
|
10935
10936
|
if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
|
|
@@ -10967,7 +10968,7 @@ function finalizeIssue(iss, ctx, config2) {
|
|
|
10967
10968
|
return full;
|
|
10968
10969
|
}
|
|
10969
10970
|
|
|
10970
|
-
// ../../../node_modules/.pnpm/zod@
|
|
10971
|
+
// ../../../node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/errors.js
|
|
10971
10972
|
var initializer = (inst, def) => {
|
|
10972
10973
|
inst.name = "$ZodError";
|
|
10973
10974
|
Object.defineProperty(inst, "_zod", {
|
|
@@ -10978,13 +10979,7 @@ var initializer = (inst, def) => {
|
|
|
10978
10979
|
value: def,
|
|
10979
10980
|
enumerable: false
|
|
10980
10981
|
});
|
|
10981
|
-
|
|
10982
|
-
get() {
|
|
10983
|
-
return JSON.stringify(def, jsonStringifyReplacer, 2);
|
|
10984
|
-
},
|
|
10985
|
-
enumerable: true
|
|
10986
|
-
// configurable: false,
|
|
10987
|
-
});
|
|
10982
|
+
inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
|
|
10988
10983
|
Object.defineProperty(inst, "toString", {
|
|
10989
10984
|
value: () => inst.message,
|
|
10990
10985
|
enumerable: false
|
|
@@ -10993,7 +10988,7 @@ var initializer = (inst, def) => {
|
|
|
10993
10988
|
var $ZodError = $constructor("$ZodError", initializer);
|
|
10994
10989
|
var $ZodRealError = $constructor("$ZodError", initializer, { Parent: Error });
|
|
10995
10990
|
|
|
10996
|
-
// ../../../node_modules/.pnpm/zod@
|
|
10991
|
+
// ../../../node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/parse.js
|
|
10997
10992
|
var _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
10998
10993
|
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
|
10999
10994
|
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
@@ -11022,6 +11017,14 @@ var _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
|
11022
11017
|
};
|
|
11023
11018
|
var parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError);
|
|
11024
11019
|
|
|
11020
|
+
// ../../../node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/regexes.js
|
|
11021
|
+
var dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
|
|
11022
|
+
var date = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
|
|
11023
|
+
|
|
11024
|
+
// ../../../node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/registries.js
|
|
11025
|
+
var $output = Symbol("ZodOutput");
|
|
11026
|
+
var $input = Symbol("ZodInput");
|
|
11027
|
+
|
|
11025
11028
|
// ../../../node_modules/.pnpm/@hookform+resolvers@5.2.2_react-hook-form@7.66.1_react@19.0.0_/node_modules/@hookform/resolvers/zod/dist/zod.mjs
|
|
11026
11029
|
function t(r3, e) {
|
|
11027
11030
|
try {
|
|
@@ -11826,11 +11829,11 @@ function OTPInputGroup({
|
|
|
11826
11829
|
// src/ui/components/auth/forms/email-otp-form.tsx
|
|
11827
11830
|
import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
11828
11831
|
function EmailOTPForm(props) {
|
|
11829
|
-
const [
|
|
11830
|
-
if (!
|
|
11832
|
+
const [email2, setEmail] = useState7();
|
|
11833
|
+
if (!email2) {
|
|
11831
11834
|
return /* @__PURE__ */ jsx16(EmailForm, { ...props, setEmail });
|
|
11832
11835
|
}
|
|
11833
|
-
return /* @__PURE__ */ jsx16(OTPForm, { ...props, email });
|
|
11836
|
+
return /* @__PURE__ */ jsx16(OTPForm, { ...props, email: email2 });
|
|
11834
11837
|
}
|
|
11835
11838
|
function EmailForm({
|
|
11836
11839
|
className,
|
|
@@ -11864,14 +11867,14 @@ function EmailForm({
|
|
|
11864
11867
|
useEffect10(() => {
|
|
11865
11868
|
setIsSubmitting?.(form.formState.isSubmitting);
|
|
11866
11869
|
}, [form.formState.isSubmitting, setIsSubmitting]);
|
|
11867
|
-
async function sendEmailOTP({ email }) {
|
|
11870
|
+
async function sendEmailOTP({ email: email2 }) {
|
|
11868
11871
|
const fetchOptions = {
|
|
11869
11872
|
throw: true,
|
|
11870
11873
|
headers: await getCaptchaHeaders("/email-otp/send-verification-otp")
|
|
11871
11874
|
};
|
|
11872
11875
|
try {
|
|
11873
11876
|
await authClient.emailOtp.sendVerificationOtp({
|
|
11874
|
-
email,
|
|
11877
|
+
email: email2,
|
|
11875
11878
|
type: "sign-in",
|
|
11876
11879
|
fetchOptions
|
|
11877
11880
|
});
|
|
@@ -11879,7 +11882,7 @@ function EmailForm({
|
|
|
11879
11882
|
variant: "success",
|
|
11880
11883
|
message: localization.EMAIL_OTP_VERIFICATION_SENT
|
|
11881
11884
|
});
|
|
11882
|
-
setEmail(
|
|
11885
|
+
setEmail(email2);
|
|
11883
11886
|
} catch (error) {
|
|
11884
11887
|
toast({
|
|
11885
11888
|
variant: "error",
|
|
@@ -11952,7 +11955,7 @@ function OTPForm({
|
|
|
11952
11955
|
otpSeparators = 0,
|
|
11953
11956
|
redirectTo,
|
|
11954
11957
|
setIsSubmitting,
|
|
11955
|
-
email
|
|
11958
|
+
email: email2
|
|
11956
11959
|
}) {
|
|
11957
11960
|
const {
|
|
11958
11961
|
authClient,
|
|
@@ -11984,7 +11987,7 @@ function OTPForm({
|
|
|
11984
11987
|
async function verifyCode({ code }) {
|
|
11985
11988
|
try {
|
|
11986
11989
|
await authClient.signIn.emailOtp({
|
|
11987
|
-
email,
|
|
11990
|
+
email: email2,
|
|
11988
11991
|
otp: code,
|
|
11989
11992
|
fetchOptions: { throw: true }
|
|
11990
11993
|
});
|
|
@@ -12086,12 +12089,13 @@ function EmailVerificationForm({
|
|
|
12086
12089
|
basePath,
|
|
12087
12090
|
viewPaths,
|
|
12088
12091
|
emailVerification,
|
|
12089
|
-
onAuthEvent
|
|
12092
|
+
onAuthEvent,
|
|
12093
|
+
authFlowMode
|
|
12090
12094
|
} = useContext12(AuthUIContext);
|
|
12091
12095
|
localization = { ...contextLocalization, ...localization };
|
|
12092
12096
|
const isOtpMethod = emailVerification?.otp ?? true;
|
|
12093
12097
|
const emailFromUrl = typeof window !== "undefined" ? new URLSearchParams(window.location.search).get("email") || "" : "";
|
|
12094
|
-
const
|
|
12098
|
+
const email2 = emailProp || emailFromUrl;
|
|
12095
12099
|
const { onSuccess, isPending: transitionPending } = useOnSuccessTransition({
|
|
12096
12100
|
redirectTo
|
|
12097
12101
|
});
|
|
@@ -12121,19 +12125,19 @@ function EmailVerificationForm({
|
|
|
12121
12125
|
}
|
|
12122
12126
|
}, [countdown]);
|
|
12123
12127
|
useEffect11(() => {
|
|
12124
|
-
if (
|
|
12128
|
+
if (email2) {
|
|
12125
12129
|
onAuthEvent?.({
|
|
12126
12130
|
type: "VERIFICATION_START",
|
|
12127
|
-
email,
|
|
12131
|
+
email: email2,
|
|
12128
12132
|
method: isOtpMethod ? "otp" : "link"
|
|
12129
12133
|
});
|
|
12130
12134
|
}
|
|
12131
|
-
}, [
|
|
12135
|
+
}, [email2, isOtpMethod, onAuthEvent]);
|
|
12132
12136
|
async function verifyCode({ code }) {
|
|
12133
|
-
onAuthEvent?.({ type: "VERIFICATION_CODE_SUBMITTED", email });
|
|
12137
|
+
onAuthEvent?.({ type: "VERIFICATION_CODE_SUBMITTED", email: email2 });
|
|
12134
12138
|
try {
|
|
12135
12139
|
const data = await authClient.emailOtp.verifyEmail({
|
|
12136
|
-
email,
|
|
12140
|
+
email: email2,
|
|
12137
12141
|
otp: code,
|
|
12138
12142
|
fetchOptions: { throw: true }
|
|
12139
12143
|
});
|
|
@@ -12149,13 +12153,15 @@ function EmailVerificationForm({
|
|
|
12149
12153
|
} else {
|
|
12150
12154
|
const session = { user };
|
|
12151
12155
|
onAuthEvent?.({ type: "VERIFICATION_SUCCESS", user, session });
|
|
12152
|
-
|
|
12153
|
-
|
|
12154
|
-
|
|
12155
|
-
|
|
12156
|
-
|
|
12157
|
-
|
|
12158
|
-
|
|
12156
|
+
if (authFlowMode !== "internal") {
|
|
12157
|
+
navigate(
|
|
12158
|
+
`${basePath}/${viewPaths.SIGN_IN}${window.location.search}`
|
|
12159
|
+
);
|
|
12160
|
+
toast({
|
|
12161
|
+
variant: "success",
|
|
12162
|
+
message: localization.EMAIL_VERIFICATION_SUCCESS
|
|
12163
|
+
});
|
|
12164
|
+
}
|
|
12159
12165
|
}
|
|
12160
12166
|
} catch (error) {
|
|
12161
12167
|
const errorMessage = getLocalizedError({
|
|
@@ -12181,11 +12187,11 @@ function EmailVerificationForm({
|
|
|
12181
12187
|
setCountdown(30);
|
|
12182
12188
|
try {
|
|
12183
12189
|
await authClient.emailOtp.sendVerificationOtp({
|
|
12184
|
-
email,
|
|
12190
|
+
email: email2,
|
|
12185
12191
|
type: "email-verification",
|
|
12186
12192
|
fetchOptions: { throw: true }
|
|
12187
12193
|
});
|
|
12188
|
-
onAuthEvent?.({ type: "VERIFICATION_CODE_RESENT", email });
|
|
12194
|
+
onAuthEvent?.({ type: "VERIFICATION_CODE_RESENT", email: email2 });
|
|
12189
12195
|
toast({
|
|
12190
12196
|
variant: "success",
|
|
12191
12197
|
message: localization.EMAIL_OTP_VERIFICATION_SENT
|
|
@@ -12209,10 +12215,10 @@ function EmailVerificationForm({
|
|
|
12209
12215
|
setCountdown(30);
|
|
12210
12216
|
try {
|
|
12211
12217
|
await authClient.sendVerificationEmail({
|
|
12212
|
-
email,
|
|
12218
|
+
email: email2,
|
|
12213
12219
|
fetchOptions: { throw: true }
|
|
12214
12220
|
});
|
|
12215
|
-
onAuthEvent?.({ type: "VERIFICATION_CODE_RESENT", email });
|
|
12221
|
+
onAuthEvent?.({ type: "VERIFICATION_CODE_RESENT", email: email2 });
|
|
12216
12222
|
toast({
|
|
12217
12223
|
variant: "success",
|
|
12218
12224
|
message: localization.VERIFICATION_EMAIL_SENT || "Verification email sent!"
|
|
@@ -12230,7 +12236,7 @@ function EmailVerificationForm({
|
|
|
12230
12236
|
setCountdown(0);
|
|
12231
12237
|
}
|
|
12232
12238
|
}
|
|
12233
|
-
if (!
|
|
12239
|
+
if (!email2) {
|
|
12234
12240
|
return /* @__PURE__ */ jsx17("div", { className: cn("grid w-full gap-6", className), children: /* @__PURE__ */ jsxs9("div", { className: "text-center", children: [
|
|
12235
12241
|
/* @__PURE__ */ jsx17("h2", { className: "font-semibold text-destructive text-lg", children: "Invalid Request" }),
|
|
12236
12242
|
/* @__PURE__ */ jsx17("p", { className: "text-muted-foreground text-sm", children: localization.EMAIL_REQUIRED || "Email address is required" })
|
|
@@ -12244,7 +12250,7 @@ function EmailVerificationForm({
|
|
|
12244
12250
|
/* @__PURE__ */ jsxs9("p", { className: "text-muted-foreground text-sm", children: [
|
|
12245
12251
|
loc.VERIFICATION_LINK_SENT_TO || "We sent a verification link to",
|
|
12246
12252
|
" ",
|
|
12247
|
-
/* @__PURE__ */ jsx17("strong", { children:
|
|
12253
|
+
/* @__PURE__ */ jsx17("strong", { children: email2 })
|
|
12248
12254
|
] }),
|
|
12249
12255
|
/* @__PURE__ */ jsx17("p", { className: "text-muted-foreground text-xs", children: loc.CLICK_LINK_TO_VERIFY || "Click the link in your email to verify your account." })
|
|
12250
12256
|
] }),
|
|
@@ -12378,7 +12384,9 @@ function ForgotPasswordForm({
|
|
|
12378
12384
|
navigate,
|
|
12379
12385
|
toast,
|
|
12380
12386
|
viewPaths,
|
|
12381
|
-
localizeErrors
|
|
12387
|
+
localizeErrors,
|
|
12388
|
+
onAuthEvent,
|
|
12389
|
+
authFlowMode
|
|
12382
12390
|
} = useContext13(AuthUIContext);
|
|
12383
12391
|
localization = { ...contextLocalization, ...localization };
|
|
12384
12392
|
const formSchema = objectType({
|
|
@@ -12398,24 +12406,27 @@ function ForgotPasswordForm({
|
|
|
12398
12406
|
useEffect12(() => {
|
|
12399
12407
|
setIsSubmitting?.(form.formState.isSubmitting);
|
|
12400
12408
|
}, [form.formState.isSubmitting, setIsSubmitting]);
|
|
12401
|
-
async function forgotPassword({ email }) {
|
|
12409
|
+
async function forgotPassword({ email: email2 }) {
|
|
12402
12410
|
try {
|
|
12403
12411
|
const fetchOptions = {
|
|
12404
12412
|
throw: true,
|
|
12405
12413
|
headers: await getCaptchaHeaders("/forget-password")
|
|
12406
12414
|
};
|
|
12407
12415
|
await authClient.requestPasswordReset({
|
|
12408
|
-
email,
|
|
12416
|
+
email: email2,
|
|
12409
12417
|
redirectTo: `${baseURL}${basePath}/${viewPaths.RESET_PASSWORD}`,
|
|
12410
12418
|
fetchOptions
|
|
12411
12419
|
});
|
|
12420
|
+
onAuthEvent?.({ type: "FORGOT_PASSWORD_EMAIL_SENT", email: email2 });
|
|
12412
12421
|
toast({
|
|
12413
12422
|
variant: "success",
|
|
12414
12423
|
message: localization.FORGOT_PASSWORD_EMAIL
|
|
12415
12424
|
});
|
|
12416
|
-
|
|
12417
|
-
|
|
12418
|
-
|
|
12425
|
+
if (authFlowMode !== "internal") {
|
|
12426
|
+
navigate(
|
|
12427
|
+
`${basePath}/${viewPaths.SIGN_IN}${window.location.search}`
|
|
12428
|
+
);
|
|
12429
|
+
}
|
|
12419
12430
|
} catch (error) {
|
|
12420
12431
|
toast({
|
|
12421
12432
|
variant: "error",
|
|
@@ -12540,14 +12551,14 @@ function MagicLinkForm({
|
|
|
12540
12551
|
useEffect13(() => {
|
|
12541
12552
|
setIsSubmitting?.(form.formState.isSubmitting);
|
|
12542
12553
|
}, [form.formState.isSubmitting, setIsSubmitting]);
|
|
12543
|
-
async function sendMagicLink({ email }) {
|
|
12554
|
+
async function sendMagicLink({ email: email2 }) {
|
|
12544
12555
|
try {
|
|
12545
12556
|
const fetchOptions = {
|
|
12546
12557
|
throw: true,
|
|
12547
12558
|
headers: await getCaptchaHeaders("/sign-in/magic-link")
|
|
12548
12559
|
};
|
|
12549
12560
|
await authClient.signIn.magicLink({
|
|
12550
|
-
email,
|
|
12561
|
+
email: email2,
|
|
12551
12562
|
callbackURL: getCallbackURL(),
|
|
12552
12563
|
fetchOptions
|
|
12553
12564
|
});
|
|
@@ -12788,7 +12799,9 @@ function ResetPasswordForm({
|
|
|
12788
12799
|
viewPaths,
|
|
12789
12800
|
navigate,
|
|
12790
12801
|
toast,
|
|
12791
|
-
localizeErrors
|
|
12802
|
+
localizeErrors,
|
|
12803
|
+
onAuthEvent,
|
|
12804
|
+
authFlowMode
|
|
12792
12805
|
} = useContext16(AuthUIContext);
|
|
12793
12806
|
const confirmPasswordEnabled = credentials?.confirmPassword;
|
|
12794
12807
|
const contextPasswordValidation = credentials?.passwordValidation;
|
|
@@ -12828,12 +12841,14 @@ function ResetPasswordForm({
|
|
|
12828
12841
|
const searchParams = new URLSearchParams(window.location.search);
|
|
12829
12842
|
const token = searchParams.get("token");
|
|
12830
12843
|
if (!token || token === "INVALID_TOKEN") {
|
|
12831
|
-
|
|
12832
|
-
|
|
12833
|
-
|
|
12844
|
+
if (authFlowMode !== "internal") {
|
|
12845
|
+
navigate(
|
|
12846
|
+
`${basePath}/${viewPaths.SIGN_IN}${window.location.search}`
|
|
12847
|
+
);
|
|
12848
|
+
}
|
|
12834
12849
|
toast({ variant: "error", message: localization.INVALID_TOKEN });
|
|
12835
12850
|
}
|
|
12836
|
-
}, [basePath, navigate, toast, viewPaths, localization]);
|
|
12851
|
+
}, [basePath, navigate, toast, viewPaths, localization, authFlowMode]);
|
|
12837
12852
|
async function resetPassword({ newPassword }) {
|
|
12838
12853
|
try {
|
|
12839
12854
|
const searchParams = new URLSearchParams(window.location.search);
|
|
@@ -12843,13 +12858,16 @@ function ResetPasswordForm({
|
|
|
12843
12858
|
token,
|
|
12844
12859
|
fetchOptions: { throw: true }
|
|
12845
12860
|
});
|
|
12861
|
+
onAuthEvent?.({ type: "PASSWORD_RESET_SUCCESS" });
|
|
12846
12862
|
toast({
|
|
12847
12863
|
variant: "success",
|
|
12848
12864
|
message: localization.RESET_PASSWORD_SUCCESS
|
|
12849
12865
|
});
|
|
12850
|
-
|
|
12851
|
-
|
|
12852
|
-
|
|
12866
|
+
if (authFlowMode !== "internal") {
|
|
12867
|
+
navigate(
|
|
12868
|
+
`${basePath}/${viewPaths.SIGN_IN}${window.location.search}`
|
|
12869
|
+
);
|
|
12870
|
+
}
|
|
12853
12871
|
} catch (error) {
|
|
12854
12872
|
toast({
|
|
12855
12873
|
variant: "error",
|
|
@@ -13008,7 +13026,8 @@ function SignInForm({
|
|
|
13008
13026
|
Link,
|
|
13009
13027
|
localizeErrors,
|
|
13010
13028
|
emailVerification,
|
|
13011
|
-
onAuthEvent
|
|
13029
|
+
onAuthEvent,
|
|
13030
|
+
authFlowMode
|
|
13012
13031
|
} = useContext17(AuthUIContext);
|
|
13013
13032
|
const rememberMeEnabled = credentials?.rememberMe;
|
|
13014
13033
|
const usernameEnabled = credentials?.username;
|
|
@@ -13040,20 +13059,20 @@ function SignInForm({
|
|
|
13040
13059
|
setIsSubmitting?.(form.formState.isSubmitting || transitionPending);
|
|
13041
13060
|
}, [form.formState.isSubmitting, transitionPending, setIsSubmitting]);
|
|
13042
13061
|
async function signIn({
|
|
13043
|
-
email,
|
|
13062
|
+
email: email2,
|
|
13044
13063
|
password,
|
|
13045
13064
|
rememberMe
|
|
13046
13065
|
}) {
|
|
13047
|
-
onAuthEvent?.({ type: "SIGN_IN_START", email });
|
|
13066
|
+
onAuthEvent?.({ type: "SIGN_IN_START", email: email2 });
|
|
13048
13067
|
try {
|
|
13049
13068
|
let response = {};
|
|
13050
|
-
if (usernameEnabled && !isValidEmail(
|
|
13069
|
+
if (usernameEnabled && !isValidEmail(email2)) {
|
|
13051
13070
|
const fetchOptions = {
|
|
13052
13071
|
throw: true,
|
|
13053
13072
|
headers: await getCaptchaHeaders("/sign-in/username")
|
|
13054
13073
|
};
|
|
13055
13074
|
response = await authClient.signIn.username({
|
|
13056
|
-
username:
|
|
13075
|
+
username: email2,
|
|
13057
13076
|
password,
|
|
13058
13077
|
rememberMe,
|
|
13059
13078
|
fetchOptions
|
|
@@ -13064,17 +13083,19 @@ function SignInForm({
|
|
|
13064
13083
|
headers: await getCaptchaHeaders("/sign-in/email")
|
|
13065
13084
|
};
|
|
13066
13085
|
response = await authClient.signIn.email({
|
|
13067
|
-
email,
|
|
13086
|
+
email: email2,
|
|
13068
13087
|
password,
|
|
13069
13088
|
rememberMe,
|
|
13070
13089
|
fetchOptions
|
|
13071
13090
|
});
|
|
13072
13091
|
}
|
|
13073
13092
|
if (response.twoFactorRedirect) {
|
|
13074
|
-
onAuthEvent?.({ type: "SIGN_IN_REQUIRES_2FA", email });
|
|
13075
|
-
|
|
13076
|
-
|
|
13077
|
-
|
|
13093
|
+
onAuthEvent?.({ type: "SIGN_IN_REQUIRES_2FA", email: email2 });
|
|
13094
|
+
if (authFlowMode !== "internal") {
|
|
13095
|
+
navigate(
|
|
13096
|
+
`${basePath}/${viewPaths.TWO_FACTOR}${window.location.search}`
|
|
13097
|
+
);
|
|
13098
|
+
}
|
|
13078
13099
|
} else {
|
|
13079
13100
|
const user = response.user;
|
|
13080
13101
|
const session = {
|
|
@@ -13104,10 +13125,12 @@ function SignInForm({
|
|
|
13104
13125
|
message: errorMessage
|
|
13105
13126
|
});
|
|
13106
13127
|
if (errorCode === "EMAIL_NOT_VERIFIED") {
|
|
13107
|
-
onAuthEvent?.({ type: "SIGN_IN_REQUIRES_VERIFICATION", email });
|
|
13108
|
-
|
|
13109
|
-
|
|
13110
|
-
|
|
13128
|
+
onAuthEvent?.({ type: "SIGN_IN_REQUIRES_VERIFICATION", email: email2 });
|
|
13129
|
+
if (authFlowMode !== "internal") {
|
|
13130
|
+
navigate(
|
|
13131
|
+
`${basePath}/${viewPaths.EMAIL_VERIFICATION}?email=${encodeURIComponent(email2)}`
|
|
13132
|
+
);
|
|
13133
|
+
}
|
|
13111
13134
|
}
|
|
13112
13135
|
}
|
|
13113
13136
|
}
|
|
@@ -13286,10 +13309,10 @@ var sha256 = () => new Uint8Array(32);
|
|
|
13286
13309
|
var bytesToHex = (_bytes) => "";
|
|
13287
13310
|
|
|
13288
13311
|
// src/ui/lib/gravatar-utils.ts
|
|
13289
|
-
function getGravatarUrl(
|
|
13290
|
-
if (!
|
|
13312
|
+
function getGravatarUrl(email2, options) {
|
|
13313
|
+
if (!email2) return null;
|
|
13291
13314
|
try {
|
|
13292
|
-
const normalizedEmail =
|
|
13315
|
+
const normalizedEmail = email2.trim().toLowerCase();
|
|
13293
13316
|
const encoder = new TextEncoder();
|
|
13294
13317
|
const emailBytes = encoder.encode(normalizedEmail);
|
|
13295
13318
|
const hash = bytesToHex(sha256(emailBytes));
|
|
@@ -13455,7 +13478,8 @@ function SignUpForm({
|
|
|
13455
13478
|
avatar,
|
|
13456
13479
|
localizeErrors,
|
|
13457
13480
|
emailVerification,
|
|
13458
|
-
onAuthEvent
|
|
13481
|
+
onAuthEvent,
|
|
13482
|
+
authFlowMode
|
|
13459
13483
|
} = useContext19(AuthUIContext);
|
|
13460
13484
|
const confirmPasswordEnabled = credentials?.confirmPassword;
|
|
13461
13485
|
const usernameEnabled = credentials?.username;
|
|
@@ -13615,7 +13639,7 @@ function SignUpForm({
|
|
|
13615
13639
|
};
|
|
13616
13640
|
const openFileDialog = () => fileInputRef.current?.click();
|
|
13617
13641
|
async function signUp({
|
|
13618
|
-
email,
|
|
13642
|
+
email: email2,
|
|
13619
13643
|
password,
|
|
13620
13644
|
name,
|
|
13621
13645
|
username,
|
|
@@ -13625,7 +13649,7 @@ function SignUpForm({
|
|
|
13625
13649
|
}) {
|
|
13626
13650
|
onAuthEvent?.({
|
|
13627
13651
|
type: "SIGN_UP_START",
|
|
13628
|
-
email,
|
|
13652
|
+
email: email2,
|
|
13629
13653
|
name
|
|
13630
13654
|
});
|
|
13631
13655
|
try {
|
|
@@ -13656,7 +13680,7 @@ function SignUpForm({
|
|
|
13656
13680
|
additionalParams.image = image;
|
|
13657
13681
|
}
|
|
13658
13682
|
const data = await authClient.signUp.email({
|
|
13659
|
-
email,
|
|
13683
|
+
email: email2,
|
|
13660
13684
|
password,
|
|
13661
13685
|
name: name || "",
|
|
13662
13686
|
...additionalParams,
|
|
@@ -13670,9 +13694,15 @@ function SignUpForm({
|
|
|
13670
13694
|
onAuthEvent?.({ type: "SIGN_UP_SUCCESS", user });
|
|
13671
13695
|
}
|
|
13672
13696
|
if (response.twoFactorRedirect) {
|
|
13673
|
-
|
|
13674
|
-
|
|
13675
|
-
|
|
13697
|
+
onAuthEvent?.({
|
|
13698
|
+
type: "SIGN_IN_REQUIRES_2FA",
|
|
13699
|
+
email: email2
|
|
13700
|
+
});
|
|
13701
|
+
if (authFlowMode !== "internal") {
|
|
13702
|
+
navigate(
|
|
13703
|
+
`${basePath}/${viewPaths.TWO_FACTOR}${window.location.search}`
|
|
13704
|
+
);
|
|
13705
|
+
}
|
|
13676
13706
|
} else if (response.token && user) {
|
|
13677
13707
|
const session = {
|
|
13678
13708
|
token: response.token,
|
|
@@ -13683,23 +13713,27 @@ function SignUpForm({
|
|
|
13683
13713
|
} else if (user && user.emailVerified === false) {
|
|
13684
13714
|
onAuthEvent?.({
|
|
13685
13715
|
type: "SIGN_UP_REQUIRES_VERIFICATION",
|
|
13686
|
-
email
|
|
13716
|
+
email: email2
|
|
13687
13717
|
});
|
|
13688
|
-
|
|
13689
|
-
|
|
13690
|
-
|
|
13718
|
+
if (authFlowMode !== "internal") {
|
|
13719
|
+
navigate(
|
|
13720
|
+
`${basePath}/${viewPaths.EMAIL_VERIFICATION}?email=${encodeURIComponent(email2)}`
|
|
13721
|
+
);
|
|
13722
|
+
}
|
|
13691
13723
|
} else {
|
|
13692
13724
|
onAuthEvent?.({
|
|
13693
13725
|
type: "SIGN_UP_REQUIRES_VERIFICATION",
|
|
13694
|
-
email
|
|
13695
|
-
});
|
|
13696
|
-
navigate(
|
|
13697
|
-
`${basePath}/${viewPaths.SIGN_IN}${window.location.search}`
|
|
13698
|
-
);
|
|
13699
|
-
toast({
|
|
13700
|
-
variant: "success",
|
|
13701
|
-
message: localization.SIGN_UP_EMAIL
|
|
13726
|
+
email: email2
|
|
13702
13727
|
});
|
|
13728
|
+
if (authFlowMode !== "internal") {
|
|
13729
|
+
navigate(
|
|
13730
|
+
`${basePath}/${viewPaths.SIGN_IN}${window.location.search}`
|
|
13731
|
+
);
|
|
13732
|
+
toast({
|
|
13733
|
+
variant: "success",
|
|
13734
|
+
message: localization.SIGN_UP_EMAIL
|
|
13735
|
+
});
|
|
13736
|
+
}
|
|
13703
13737
|
}
|
|
13704
13738
|
} catch (error) {
|
|
13705
13739
|
const errorMessage = getLocalizedError({
|
|
@@ -14388,6 +14422,7 @@ function AuthForm({
|
|
|
14388
14422
|
className,
|
|
14389
14423
|
classNames,
|
|
14390
14424
|
callbackURL,
|
|
14425
|
+
email: email2,
|
|
14391
14426
|
isSubmitting,
|
|
14392
14427
|
localization,
|
|
14393
14428
|
pathname,
|
|
@@ -14552,6 +14587,7 @@ function AuthForm({
|
|
|
14552
14587
|
className,
|
|
14553
14588
|
classNames,
|
|
14554
14589
|
callbackURL,
|
|
14590
|
+
email: email2,
|
|
14555
14591
|
localization,
|
|
14556
14592
|
otpSeparators,
|
|
14557
14593
|
redirectTo,
|
|
@@ -15107,6 +15143,7 @@ function AuthView({
|
|
|
15107
15143
|
callbackURL,
|
|
15108
15144
|
cardHeader,
|
|
15109
15145
|
cardFooter,
|
|
15146
|
+
email: email2,
|
|
15110
15147
|
localization,
|
|
15111
15148
|
path: pathProp,
|
|
15112
15149
|
pathname,
|
|
@@ -15194,6 +15231,7 @@ function AuthView({
|
|
|
15194
15231
|
{
|
|
15195
15232
|
classNames: classNames?.form,
|
|
15196
15233
|
callbackURL,
|
|
15234
|
+
email: email2,
|
|
15197
15235
|
isSubmitting,
|
|
15198
15236
|
localization,
|
|
15199
15237
|
otpSeparators,
|
|
@@ -15421,36 +15459,65 @@ var flowViewToPathKey = {
|
|
|
15421
15459
|
function parsePathToView(path) {
|
|
15422
15460
|
const url = new URL(path, "http://localhost");
|
|
15423
15461
|
const pathname = url.pathname;
|
|
15424
|
-
const
|
|
15462
|
+
const email2 = url.searchParams.get("email") || void 0;
|
|
15425
15463
|
if (pathname.includes("email-verification")) {
|
|
15426
|
-
return { view: "EMAIL_VERIFICATION", email };
|
|
15464
|
+
return { view: "EMAIL_VERIFICATION", email: email2 };
|
|
15427
15465
|
}
|
|
15428
15466
|
if (pathname.includes("two-factor")) {
|
|
15429
|
-
return { view: "TWO_FACTOR", email };
|
|
15467
|
+
return { view: "TWO_FACTOR", email: email2 };
|
|
15430
15468
|
}
|
|
15431
15469
|
if (pathname.includes("forgot-password")) {
|
|
15432
|
-
return { view: "FORGOT_PASSWORD", email };
|
|
15470
|
+
return { view: "FORGOT_PASSWORD", email: email2 };
|
|
15433
15471
|
}
|
|
15434
15472
|
if (pathname.includes("reset-password")) {
|
|
15435
|
-
return { view: "RESET_PASSWORD", email };
|
|
15473
|
+
return { view: "RESET_PASSWORD", email: email2 };
|
|
15436
15474
|
}
|
|
15437
15475
|
if (pathname.includes("sign-up")) {
|
|
15438
|
-
return { view: "SIGN_UP", email };
|
|
15476
|
+
return { view: "SIGN_UP", email: email2 };
|
|
15439
15477
|
}
|
|
15440
15478
|
if (pathname.includes("magic-link")) {
|
|
15441
|
-
return { view: "MAGIC_LINK", email };
|
|
15479
|
+
return { view: "MAGIC_LINK", email: email2 };
|
|
15442
15480
|
}
|
|
15443
15481
|
if (pathname.includes("email-otp")) {
|
|
15444
|
-
return { view: "SIGN_IN", email };
|
|
15482
|
+
return { view: "SIGN_IN", email: email2 };
|
|
15445
15483
|
}
|
|
15446
15484
|
if (pathname.includes("recover-account")) {
|
|
15447
|
-
return { view: "TWO_FACTOR", email };
|
|
15485
|
+
return { view: "TWO_FACTOR", email: email2 };
|
|
15448
15486
|
}
|
|
15449
|
-
return { view: "SIGN_IN", email };
|
|
15487
|
+
return { view: "SIGN_IN", email: email2 };
|
|
15450
15488
|
}
|
|
15451
15489
|
function isAuthPath(href) {
|
|
15452
15490
|
return href.includes("sign-in") || href.includes("sign-up") || href.includes("email-verification") || href.includes("two-factor") || href.includes("forgot-password") || href.includes("reset-password") || href.includes("magic-link") || href.includes("email-otp") || href.includes("recover-account");
|
|
15453
15491
|
}
|
|
15492
|
+
var AUTH_FLOW_STATE_KEY = "erikey_auth_flow_state";
|
|
15493
|
+
function getPersistedState() {
|
|
15494
|
+
if (typeof window === "undefined") return null;
|
|
15495
|
+
try {
|
|
15496
|
+
const stored = sessionStorage.getItem(AUTH_FLOW_STATE_KEY);
|
|
15497
|
+
if (stored) {
|
|
15498
|
+
return JSON.parse(stored);
|
|
15499
|
+
}
|
|
15500
|
+
} catch {
|
|
15501
|
+
}
|
|
15502
|
+
return null;
|
|
15503
|
+
}
|
|
15504
|
+
function persistState(view, email2) {
|
|
15505
|
+
if (typeof window === "undefined") return;
|
|
15506
|
+
try {
|
|
15507
|
+
sessionStorage.setItem(
|
|
15508
|
+
AUTH_FLOW_STATE_KEY,
|
|
15509
|
+
JSON.stringify({ view, email: email2 })
|
|
15510
|
+
);
|
|
15511
|
+
} catch {
|
|
15512
|
+
}
|
|
15513
|
+
}
|
|
15514
|
+
function clearPersistedState() {
|
|
15515
|
+
if (typeof window === "undefined") return;
|
|
15516
|
+
try {
|
|
15517
|
+
sessionStorage.removeItem(AUTH_FLOW_STATE_KEY);
|
|
15518
|
+
} catch {
|
|
15519
|
+
}
|
|
15520
|
+
}
|
|
15454
15521
|
function AuthFlow({
|
|
15455
15522
|
mode = "internal",
|
|
15456
15523
|
onEvent,
|
|
@@ -15469,8 +15536,22 @@ function AuthFlow({
|
|
|
15469
15536
|
Link: ExternalLink,
|
|
15470
15537
|
...providerProps
|
|
15471
15538
|
}) {
|
|
15472
|
-
const [currentView, setCurrentView] = useState16(
|
|
15473
|
-
|
|
15539
|
+
const [currentView, setCurrentView] = useState16(() => {
|
|
15540
|
+
if (mode === "internal") {
|
|
15541
|
+
const persisted = getPersistedState();
|
|
15542
|
+
if (persisted) {
|
|
15543
|
+
return persisted.view;
|
|
15544
|
+
}
|
|
15545
|
+
}
|
|
15546
|
+
return initialView;
|
|
15547
|
+
});
|
|
15548
|
+
const [verifyEmail, setVerifyEmail] = useState16(() => {
|
|
15549
|
+
if (mode === "internal") {
|
|
15550
|
+
const persisted = getPersistedState();
|
|
15551
|
+
return persisted?.email;
|
|
15552
|
+
}
|
|
15553
|
+
return void 0;
|
|
15554
|
+
});
|
|
15474
15555
|
const handleNavigate = useCallback9(
|
|
15475
15556
|
(href) => {
|
|
15476
15557
|
if (mode === "route") {
|
|
@@ -15481,11 +15562,11 @@ function AuthFlow({
|
|
|
15481
15562
|
}
|
|
15482
15563
|
return;
|
|
15483
15564
|
}
|
|
15484
|
-
const { view, email } = parsePathToView(href);
|
|
15485
|
-
onEvent?.({ type: "VIEW_CHANGE", view, email });
|
|
15565
|
+
const { view, email: email2 } = parsePathToView(href);
|
|
15566
|
+
onEvent?.({ type: "VIEW_CHANGE", view, email: email2 });
|
|
15486
15567
|
setCurrentView(view);
|
|
15487
|
-
if (
|
|
15488
|
-
setVerifyEmail(
|
|
15568
|
+
if (email2) {
|
|
15569
|
+
setVerifyEmail(email2);
|
|
15489
15570
|
}
|
|
15490
15571
|
},
|
|
15491
15572
|
[mode, externalNavigate, onEvent]
|
|
@@ -15542,8 +15623,57 @@ function AuthFlow({
|
|
|
15542
15623
|
const handleAuthEvent = useCallback9(
|
|
15543
15624
|
(event) => {
|
|
15544
15625
|
onEvent?.(event);
|
|
15626
|
+
if (mode === "internal") {
|
|
15627
|
+
switch (event.type) {
|
|
15628
|
+
// Sign-up flow
|
|
15629
|
+
case "SIGN_UP_REQUIRES_VERIFICATION":
|
|
15630
|
+
setCurrentView("EMAIL_VERIFICATION");
|
|
15631
|
+
setVerifyEmail(event.email);
|
|
15632
|
+
persistState("EMAIL_VERIFICATION", event.email);
|
|
15633
|
+
break;
|
|
15634
|
+
// Sign-in flow
|
|
15635
|
+
case "SIGN_IN_REQUIRES_2FA":
|
|
15636
|
+
setCurrentView("TWO_FACTOR");
|
|
15637
|
+
persistState("TWO_FACTOR");
|
|
15638
|
+
break;
|
|
15639
|
+
case "SIGN_IN_REQUIRES_VERIFICATION":
|
|
15640
|
+
setCurrentView("EMAIL_VERIFICATION");
|
|
15641
|
+
setVerifyEmail(event.email);
|
|
15642
|
+
persistState("EMAIL_VERIFICATION", event.email);
|
|
15643
|
+
break;
|
|
15644
|
+
// Verification success without token → sign in
|
|
15645
|
+
case "VERIFICATION_SUCCESS":
|
|
15646
|
+
if (!event.session?.token) {
|
|
15647
|
+
setCurrentView("SIGN_IN");
|
|
15648
|
+
clearPersistedState();
|
|
15649
|
+
}
|
|
15650
|
+
if (event.session?.token) {
|
|
15651
|
+
clearPersistedState();
|
|
15652
|
+
}
|
|
15653
|
+
break;
|
|
15654
|
+
// Password reset flow
|
|
15655
|
+
case "PASSWORD_RESET_SUCCESS":
|
|
15656
|
+
setCurrentView("SIGN_IN");
|
|
15657
|
+
clearPersistedState();
|
|
15658
|
+
break;
|
|
15659
|
+
// View toggles (footer links) - handled by InternalLink
|
|
15660
|
+
case "VIEW_CHANGE":
|
|
15661
|
+
setCurrentView(event.view);
|
|
15662
|
+
if (event.email) setVerifyEmail(event.email);
|
|
15663
|
+
if (event.view !== "SIGN_IN") {
|
|
15664
|
+
persistState(event.view, event.email);
|
|
15665
|
+
} else {
|
|
15666
|
+
clearPersistedState();
|
|
15667
|
+
}
|
|
15668
|
+
break;
|
|
15669
|
+
// AUTH_SUCCESS - clear persisted state, let React re-render via useSession
|
|
15670
|
+
case "AUTH_SUCCESS":
|
|
15671
|
+
clearPersistedState();
|
|
15672
|
+
break;
|
|
15673
|
+
}
|
|
15674
|
+
}
|
|
15545
15675
|
},
|
|
15546
|
-
[onEvent]
|
|
15676
|
+
[onEvent, mode]
|
|
15547
15677
|
);
|
|
15548
15678
|
const viewKey = useMemo5(() => {
|
|
15549
15679
|
if (mode === "route") {
|
|
@@ -15558,6 +15688,7 @@ function AuthFlow({
|
|
|
15558
15688
|
basePath,
|
|
15559
15689
|
navigate: handleNavigate,
|
|
15560
15690
|
onAuthEvent: handleAuthEvent,
|
|
15691
|
+
authFlowMode: mode,
|
|
15561
15692
|
redirectTo,
|
|
15562
15693
|
Link: InternalLink,
|
|
15563
15694
|
...providerProps,
|
|
@@ -15568,6 +15699,7 @@ function AuthFlow({
|
|
|
15568
15699
|
classNames,
|
|
15569
15700
|
cardHeader,
|
|
15570
15701
|
cardFooter,
|
|
15702
|
+
email: verifyEmail,
|
|
15571
15703
|
socialLayout,
|
|
15572
15704
|
otpSeparators,
|
|
15573
15705
|
redirectTo,
|