@erikey/react 0.5.0 → 0.5.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/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
|
});
|
|
@@ -12092,7 +12095,7 @@ function EmailVerificationForm({
|
|
|
12092
12095
|
localization = { ...contextLocalization, ...localization };
|
|
12093
12096
|
const isOtpMethod = emailVerification?.otp ?? true;
|
|
12094
12097
|
const emailFromUrl = typeof window !== "undefined" ? new URLSearchParams(window.location.search).get("email") || "" : "";
|
|
12095
|
-
const
|
|
12098
|
+
const email2 = emailProp || emailFromUrl;
|
|
12096
12099
|
const { onSuccess, isPending: transitionPending } = useOnSuccessTransition({
|
|
12097
12100
|
redirectTo
|
|
12098
12101
|
});
|
|
@@ -12122,19 +12125,19 @@ function EmailVerificationForm({
|
|
|
12122
12125
|
}
|
|
12123
12126
|
}, [countdown]);
|
|
12124
12127
|
useEffect11(() => {
|
|
12125
|
-
if (
|
|
12128
|
+
if (email2) {
|
|
12126
12129
|
onAuthEvent?.({
|
|
12127
12130
|
type: "VERIFICATION_START",
|
|
12128
|
-
email,
|
|
12131
|
+
email: email2,
|
|
12129
12132
|
method: isOtpMethod ? "otp" : "link"
|
|
12130
12133
|
});
|
|
12131
12134
|
}
|
|
12132
|
-
}, [
|
|
12135
|
+
}, [email2, isOtpMethod, onAuthEvent]);
|
|
12133
12136
|
async function verifyCode({ code }) {
|
|
12134
|
-
onAuthEvent?.({ type: "VERIFICATION_CODE_SUBMITTED", email });
|
|
12137
|
+
onAuthEvent?.({ type: "VERIFICATION_CODE_SUBMITTED", email: email2 });
|
|
12135
12138
|
try {
|
|
12136
12139
|
const data = await authClient.emailOtp.verifyEmail({
|
|
12137
|
-
email,
|
|
12140
|
+
email: email2,
|
|
12138
12141
|
otp: code,
|
|
12139
12142
|
fetchOptions: { throw: true }
|
|
12140
12143
|
});
|
|
@@ -12184,11 +12187,11 @@ function EmailVerificationForm({
|
|
|
12184
12187
|
setCountdown(30);
|
|
12185
12188
|
try {
|
|
12186
12189
|
await authClient.emailOtp.sendVerificationOtp({
|
|
12187
|
-
email,
|
|
12190
|
+
email: email2,
|
|
12188
12191
|
type: "email-verification",
|
|
12189
12192
|
fetchOptions: { throw: true }
|
|
12190
12193
|
});
|
|
12191
|
-
onAuthEvent?.({ type: "VERIFICATION_CODE_RESENT", email });
|
|
12194
|
+
onAuthEvent?.({ type: "VERIFICATION_CODE_RESENT", email: email2 });
|
|
12192
12195
|
toast({
|
|
12193
12196
|
variant: "success",
|
|
12194
12197
|
message: localization.EMAIL_OTP_VERIFICATION_SENT
|
|
@@ -12212,10 +12215,10 @@ function EmailVerificationForm({
|
|
|
12212
12215
|
setCountdown(30);
|
|
12213
12216
|
try {
|
|
12214
12217
|
await authClient.sendVerificationEmail({
|
|
12215
|
-
email,
|
|
12218
|
+
email: email2,
|
|
12216
12219
|
fetchOptions: { throw: true }
|
|
12217
12220
|
});
|
|
12218
|
-
onAuthEvent?.({ type: "VERIFICATION_CODE_RESENT", email });
|
|
12221
|
+
onAuthEvent?.({ type: "VERIFICATION_CODE_RESENT", email: email2 });
|
|
12219
12222
|
toast({
|
|
12220
12223
|
variant: "success",
|
|
12221
12224
|
message: localization.VERIFICATION_EMAIL_SENT || "Verification email sent!"
|
|
@@ -12233,7 +12236,7 @@ function EmailVerificationForm({
|
|
|
12233
12236
|
setCountdown(0);
|
|
12234
12237
|
}
|
|
12235
12238
|
}
|
|
12236
|
-
if (!
|
|
12239
|
+
if (!email2) {
|
|
12237
12240
|
return /* @__PURE__ */ jsx17("div", { className: cn("grid w-full gap-6", className), children: /* @__PURE__ */ jsxs9("div", { className: "text-center", children: [
|
|
12238
12241
|
/* @__PURE__ */ jsx17("h2", { className: "font-semibold text-destructive text-lg", children: "Invalid Request" }),
|
|
12239
12242
|
/* @__PURE__ */ jsx17("p", { className: "text-muted-foreground text-sm", children: localization.EMAIL_REQUIRED || "Email address is required" })
|
|
@@ -12247,7 +12250,7 @@ function EmailVerificationForm({
|
|
|
12247
12250
|
/* @__PURE__ */ jsxs9("p", { className: "text-muted-foreground text-sm", children: [
|
|
12248
12251
|
loc.VERIFICATION_LINK_SENT_TO || "We sent a verification link to",
|
|
12249
12252
|
" ",
|
|
12250
|
-
/* @__PURE__ */ jsx17("strong", { children:
|
|
12253
|
+
/* @__PURE__ */ jsx17("strong", { children: email2 })
|
|
12251
12254
|
] }),
|
|
12252
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." })
|
|
12253
12256
|
] }),
|
|
@@ -12403,18 +12406,18 @@ function ForgotPasswordForm({
|
|
|
12403
12406
|
useEffect12(() => {
|
|
12404
12407
|
setIsSubmitting?.(form.formState.isSubmitting);
|
|
12405
12408
|
}, [form.formState.isSubmitting, setIsSubmitting]);
|
|
12406
|
-
async function forgotPassword({ email }) {
|
|
12409
|
+
async function forgotPassword({ email: email2 }) {
|
|
12407
12410
|
try {
|
|
12408
12411
|
const fetchOptions = {
|
|
12409
12412
|
throw: true,
|
|
12410
12413
|
headers: await getCaptchaHeaders("/forget-password")
|
|
12411
12414
|
};
|
|
12412
12415
|
await authClient.requestPasswordReset({
|
|
12413
|
-
email,
|
|
12416
|
+
email: email2,
|
|
12414
12417
|
redirectTo: `${baseURL}${basePath}/${viewPaths.RESET_PASSWORD}`,
|
|
12415
12418
|
fetchOptions
|
|
12416
12419
|
});
|
|
12417
|
-
onAuthEvent?.({ type: "FORGOT_PASSWORD_EMAIL_SENT", email });
|
|
12420
|
+
onAuthEvent?.({ type: "FORGOT_PASSWORD_EMAIL_SENT", email: email2 });
|
|
12418
12421
|
toast({
|
|
12419
12422
|
variant: "success",
|
|
12420
12423
|
message: localization.FORGOT_PASSWORD_EMAIL
|
|
@@ -12548,14 +12551,14 @@ function MagicLinkForm({
|
|
|
12548
12551
|
useEffect13(() => {
|
|
12549
12552
|
setIsSubmitting?.(form.formState.isSubmitting);
|
|
12550
12553
|
}, [form.formState.isSubmitting, setIsSubmitting]);
|
|
12551
|
-
async function sendMagicLink({ email }) {
|
|
12554
|
+
async function sendMagicLink({ email: email2 }) {
|
|
12552
12555
|
try {
|
|
12553
12556
|
const fetchOptions = {
|
|
12554
12557
|
throw: true,
|
|
12555
12558
|
headers: await getCaptchaHeaders("/sign-in/magic-link")
|
|
12556
12559
|
};
|
|
12557
12560
|
await authClient.signIn.magicLink({
|
|
12558
|
-
email,
|
|
12561
|
+
email: email2,
|
|
12559
12562
|
callbackURL: getCallbackURL(),
|
|
12560
12563
|
fetchOptions
|
|
12561
12564
|
});
|
|
@@ -13056,20 +13059,20 @@ function SignInForm({
|
|
|
13056
13059
|
setIsSubmitting?.(form.formState.isSubmitting || transitionPending);
|
|
13057
13060
|
}, [form.formState.isSubmitting, transitionPending, setIsSubmitting]);
|
|
13058
13061
|
async function signIn({
|
|
13059
|
-
email,
|
|
13062
|
+
email: email2,
|
|
13060
13063
|
password,
|
|
13061
13064
|
rememberMe
|
|
13062
13065
|
}) {
|
|
13063
|
-
onAuthEvent?.({ type: "SIGN_IN_START", email });
|
|
13066
|
+
onAuthEvent?.({ type: "SIGN_IN_START", email: email2 });
|
|
13064
13067
|
try {
|
|
13065
13068
|
let response = {};
|
|
13066
|
-
if (usernameEnabled && !isValidEmail(
|
|
13069
|
+
if (usernameEnabled && !isValidEmail(email2)) {
|
|
13067
13070
|
const fetchOptions = {
|
|
13068
13071
|
throw: true,
|
|
13069
13072
|
headers: await getCaptchaHeaders("/sign-in/username")
|
|
13070
13073
|
};
|
|
13071
13074
|
response = await authClient.signIn.username({
|
|
13072
|
-
username:
|
|
13075
|
+
username: email2,
|
|
13073
13076
|
password,
|
|
13074
13077
|
rememberMe,
|
|
13075
13078
|
fetchOptions
|
|
@@ -13080,14 +13083,14 @@ function SignInForm({
|
|
|
13080
13083
|
headers: await getCaptchaHeaders("/sign-in/email")
|
|
13081
13084
|
};
|
|
13082
13085
|
response = await authClient.signIn.email({
|
|
13083
|
-
email,
|
|
13086
|
+
email: email2,
|
|
13084
13087
|
password,
|
|
13085
13088
|
rememberMe,
|
|
13086
13089
|
fetchOptions
|
|
13087
13090
|
});
|
|
13088
13091
|
}
|
|
13089
13092
|
if (response.twoFactorRedirect) {
|
|
13090
|
-
onAuthEvent?.({ type: "SIGN_IN_REQUIRES_2FA", email });
|
|
13093
|
+
onAuthEvent?.({ type: "SIGN_IN_REQUIRES_2FA", email: email2 });
|
|
13091
13094
|
if (authFlowMode !== "internal") {
|
|
13092
13095
|
navigate(
|
|
13093
13096
|
`${basePath}/${viewPaths.TWO_FACTOR}${window.location.search}`
|
|
@@ -13122,10 +13125,10 @@ function SignInForm({
|
|
|
13122
13125
|
message: errorMessage
|
|
13123
13126
|
});
|
|
13124
13127
|
if (errorCode === "EMAIL_NOT_VERIFIED") {
|
|
13125
|
-
onAuthEvent?.({ type: "SIGN_IN_REQUIRES_VERIFICATION", email });
|
|
13128
|
+
onAuthEvent?.({ type: "SIGN_IN_REQUIRES_VERIFICATION", email: email2 });
|
|
13126
13129
|
if (authFlowMode !== "internal") {
|
|
13127
13130
|
navigate(
|
|
13128
|
-
`${basePath}/${viewPaths.EMAIL_VERIFICATION}?email=${encodeURIComponent(
|
|
13131
|
+
`${basePath}/${viewPaths.EMAIL_VERIFICATION}?email=${encodeURIComponent(email2)}`
|
|
13129
13132
|
);
|
|
13130
13133
|
}
|
|
13131
13134
|
}
|
|
@@ -13306,10 +13309,10 @@ var sha256 = () => new Uint8Array(32);
|
|
|
13306
13309
|
var bytesToHex = (_bytes) => "";
|
|
13307
13310
|
|
|
13308
13311
|
// src/ui/lib/gravatar-utils.ts
|
|
13309
|
-
function getGravatarUrl(
|
|
13310
|
-
if (!
|
|
13312
|
+
function getGravatarUrl(email2, options) {
|
|
13313
|
+
if (!email2) return null;
|
|
13311
13314
|
try {
|
|
13312
|
-
const normalizedEmail =
|
|
13315
|
+
const normalizedEmail = email2.trim().toLowerCase();
|
|
13313
13316
|
const encoder = new TextEncoder();
|
|
13314
13317
|
const emailBytes = encoder.encode(normalizedEmail);
|
|
13315
13318
|
const hash = bytesToHex(sha256(emailBytes));
|
|
@@ -13636,7 +13639,7 @@ function SignUpForm({
|
|
|
13636
13639
|
};
|
|
13637
13640
|
const openFileDialog = () => fileInputRef.current?.click();
|
|
13638
13641
|
async function signUp({
|
|
13639
|
-
email,
|
|
13642
|
+
email: email2,
|
|
13640
13643
|
password,
|
|
13641
13644
|
name,
|
|
13642
13645
|
username,
|
|
@@ -13646,7 +13649,7 @@ function SignUpForm({
|
|
|
13646
13649
|
}) {
|
|
13647
13650
|
onAuthEvent?.({
|
|
13648
13651
|
type: "SIGN_UP_START",
|
|
13649
|
-
email,
|
|
13652
|
+
email: email2,
|
|
13650
13653
|
name
|
|
13651
13654
|
});
|
|
13652
13655
|
try {
|
|
@@ -13677,7 +13680,7 @@ function SignUpForm({
|
|
|
13677
13680
|
additionalParams.image = image;
|
|
13678
13681
|
}
|
|
13679
13682
|
const data = await authClient.signUp.email({
|
|
13680
|
-
email,
|
|
13683
|
+
email: email2,
|
|
13681
13684
|
password,
|
|
13682
13685
|
name: name || "",
|
|
13683
13686
|
...additionalParams,
|
|
@@ -13693,7 +13696,7 @@ function SignUpForm({
|
|
|
13693
13696
|
if (response.twoFactorRedirect) {
|
|
13694
13697
|
onAuthEvent?.({
|
|
13695
13698
|
type: "SIGN_IN_REQUIRES_2FA",
|
|
13696
|
-
email
|
|
13699
|
+
email: email2
|
|
13697
13700
|
});
|
|
13698
13701
|
if (authFlowMode !== "internal") {
|
|
13699
13702
|
navigate(
|
|
@@ -13710,17 +13713,17 @@ function SignUpForm({
|
|
|
13710
13713
|
} else if (user && user.emailVerified === false) {
|
|
13711
13714
|
onAuthEvent?.({
|
|
13712
13715
|
type: "SIGN_UP_REQUIRES_VERIFICATION",
|
|
13713
|
-
email
|
|
13716
|
+
email: email2
|
|
13714
13717
|
});
|
|
13715
13718
|
if (authFlowMode !== "internal") {
|
|
13716
13719
|
navigate(
|
|
13717
|
-
`${basePath}/${viewPaths.EMAIL_VERIFICATION}?email=${encodeURIComponent(
|
|
13720
|
+
`${basePath}/${viewPaths.EMAIL_VERIFICATION}?email=${encodeURIComponent(email2)}`
|
|
13718
13721
|
);
|
|
13719
13722
|
}
|
|
13720
13723
|
} else {
|
|
13721
13724
|
onAuthEvent?.({
|
|
13722
13725
|
type: "SIGN_UP_REQUIRES_VERIFICATION",
|
|
13723
|
-
email
|
|
13726
|
+
email: email2
|
|
13724
13727
|
});
|
|
13725
13728
|
if (authFlowMode !== "internal") {
|
|
13726
13729
|
navigate(
|
|
@@ -14419,7 +14422,7 @@ function AuthForm({
|
|
|
14419
14422
|
className,
|
|
14420
14423
|
classNames,
|
|
14421
14424
|
callbackURL,
|
|
14422
|
-
email,
|
|
14425
|
+
email: email2,
|
|
14423
14426
|
isSubmitting,
|
|
14424
14427
|
localization,
|
|
14425
14428
|
pathname,
|
|
@@ -14584,7 +14587,7 @@ function AuthForm({
|
|
|
14584
14587
|
className,
|
|
14585
14588
|
classNames,
|
|
14586
14589
|
callbackURL,
|
|
14587
|
-
email,
|
|
14590
|
+
email: email2,
|
|
14588
14591
|
localization,
|
|
14589
14592
|
otpSeparators,
|
|
14590
14593
|
redirectTo,
|
|
@@ -15140,7 +15143,7 @@ function AuthView({
|
|
|
15140
15143
|
callbackURL,
|
|
15141
15144
|
cardHeader,
|
|
15142
15145
|
cardFooter,
|
|
15143
|
-
email,
|
|
15146
|
+
email: email2,
|
|
15144
15147
|
localization,
|
|
15145
15148
|
path: pathProp,
|
|
15146
15149
|
pathname,
|
|
@@ -15151,6 +15154,7 @@ function AuthView({
|
|
|
15151
15154
|
}) {
|
|
15152
15155
|
const isHydrated = useIsHydrated();
|
|
15153
15156
|
const {
|
|
15157
|
+
authFlowMode,
|
|
15154
15158
|
basePath,
|
|
15155
15159
|
credentials,
|
|
15156
15160
|
localization: contextLocalization,
|
|
@@ -15228,7 +15232,7 @@ function AuthView({
|
|
|
15228
15232
|
{
|
|
15229
15233
|
classNames: classNames?.form,
|
|
15230
15234
|
callbackURL,
|
|
15231
|
-
email,
|
|
15235
|
+
email: email2,
|
|
15232
15236
|
isSubmitting,
|
|
15233
15237
|
localization,
|
|
15234
15238
|
otpSeparators,
|
|
@@ -15421,6 +15425,27 @@ function AuthView({
|
|
|
15421
15425
|
}
|
|
15422
15426
|
)
|
|
15423
15427
|
}
|
|
15428
|
+
) : authFlowMode === "internal" ? /* @__PURE__ */ jsx37(
|
|
15429
|
+
Link,
|
|
15430
|
+
{
|
|
15431
|
+
className: cn(
|
|
15432
|
+
"text-foreground underline",
|
|
15433
|
+
classNames?.footerLink
|
|
15434
|
+
),
|
|
15435
|
+
href: `${basePath}/${viewPaths.SIGN_IN}${isHydrated ? window.location.search : ""}`,
|
|
15436
|
+
children: /* @__PURE__ */ jsx37(
|
|
15437
|
+
Button,
|
|
15438
|
+
{
|
|
15439
|
+
variant: "link",
|
|
15440
|
+
size: "sm",
|
|
15441
|
+
className: cn(
|
|
15442
|
+
"px-0 text-foreground underline",
|
|
15443
|
+
classNames?.footerLink
|
|
15444
|
+
),
|
|
15445
|
+
children: localization.GO_BACK
|
|
15446
|
+
}
|
|
15447
|
+
)
|
|
15448
|
+
}
|
|
15424
15449
|
) : /* @__PURE__ */ jsx37(
|
|
15425
15450
|
Button,
|
|
15426
15451
|
{
|
|
@@ -15456,36 +15481,65 @@ var flowViewToPathKey = {
|
|
|
15456
15481
|
function parsePathToView(path) {
|
|
15457
15482
|
const url = new URL(path, "http://localhost");
|
|
15458
15483
|
const pathname = url.pathname;
|
|
15459
|
-
const
|
|
15484
|
+
const email2 = url.searchParams.get("email") || void 0;
|
|
15460
15485
|
if (pathname.includes("email-verification")) {
|
|
15461
|
-
return { view: "EMAIL_VERIFICATION", email };
|
|
15486
|
+
return { view: "EMAIL_VERIFICATION", email: email2 };
|
|
15462
15487
|
}
|
|
15463
15488
|
if (pathname.includes("two-factor")) {
|
|
15464
|
-
return { view: "TWO_FACTOR", email };
|
|
15489
|
+
return { view: "TWO_FACTOR", email: email2 };
|
|
15465
15490
|
}
|
|
15466
15491
|
if (pathname.includes("forgot-password")) {
|
|
15467
|
-
return { view: "FORGOT_PASSWORD", email };
|
|
15492
|
+
return { view: "FORGOT_PASSWORD", email: email2 };
|
|
15468
15493
|
}
|
|
15469
15494
|
if (pathname.includes("reset-password")) {
|
|
15470
|
-
return { view: "RESET_PASSWORD", email };
|
|
15495
|
+
return { view: "RESET_PASSWORD", email: email2 };
|
|
15471
15496
|
}
|
|
15472
15497
|
if (pathname.includes("sign-up")) {
|
|
15473
|
-
return { view: "SIGN_UP", email };
|
|
15498
|
+
return { view: "SIGN_UP", email: email2 };
|
|
15474
15499
|
}
|
|
15475
15500
|
if (pathname.includes("magic-link")) {
|
|
15476
|
-
return { view: "MAGIC_LINK", email };
|
|
15501
|
+
return { view: "MAGIC_LINK", email: email2 };
|
|
15477
15502
|
}
|
|
15478
15503
|
if (pathname.includes("email-otp")) {
|
|
15479
|
-
return { view: "SIGN_IN", email };
|
|
15504
|
+
return { view: "SIGN_IN", email: email2 };
|
|
15480
15505
|
}
|
|
15481
15506
|
if (pathname.includes("recover-account")) {
|
|
15482
|
-
return { view: "TWO_FACTOR", email };
|
|
15507
|
+
return { view: "TWO_FACTOR", email: email2 };
|
|
15483
15508
|
}
|
|
15484
|
-
return { view: "SIGN_IN", email };
|
|
15509
|
+
return { view: "SIGN_IN", email: email2 };
|
|
15485
15510
|
}
|
|
15486
15511
|
function isAuthPath(href) {
|
|
15487
15512
|
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");
|
|
15488
15513
|
}
|
|
15514
|
+
var AUTH_FLOW_STATE_KEY = "erikey_auth_flow_state";
|
|
15515
|
+
function getPersistedState() {
|
|
15516
|
+
if (typeof window === "undefined") return null;
|
|
15517
|
+
try {
|
|
15518
|
+
const stored = sessionStorage.getItem(AUTH_FLOW_STATE_KEY);
|
|
15519
|
+
if (stored) {
|
|
15520
|
+
return JSON.parse(stored);
|
|
15521
|
+
}
|
|
15522
|
+
} catch {
|
|
15523
|
+
}
|
|
15524
|
+
return null;
|
|
15525
|
+
}
|
|
15526
|
+
function persistState(view, email2) {
|
|
15527
|
+
if (typeof window === "undefined") return;
|
|
15528
|
+
try {
|
|
15529
|
+
sessionStorage.setItem(
|
|
15530
|
+
AUTH_FLOW_STATE_KEY,
|
|
15531
|
+
JSON.stringify({ view, email: email2 })
|
|
15532
|
+
);
|
|
15533
|
+
} catch {
|
|
15534
|
+
}
|
|
15535
|
+
}
|
|
15536
|
+
function clearPersistedState() {
|
|
15537
|
+
if (typeof window === "undefined") return;
|
|
15538
|
+
try {
|
|
15539
|
+
sessionStorage.removeItem(AUTH_FLOW_STATE_KEY);
|
|
15540
|
+
} catch {
|
|
15541
|
+
}
|
|
15542
|
+
}
|
|
15489
15543
|
function AuthFlow({
|
|
15490
15544
|
mode = "internal",
|
|
15491
15545
|
onEvent,
|
|
@@ -15504,8 +15558,22 @@ function AuthFlow({
|
|
|
15504
15558
|
Link: ExternalLink,
|
|
15505
15559
|
...providerProps
|
|
15506
15560
|
}) {
|
|
15507
|
-
const [currentView, setCurrentView] = useState16(
|
|
15508
|
-
|
|
15561
|
+
const [currentView, setCurrentView] = useState16(() => {
|
|
15562
|
+
if (mode === "internal") {
|
|
15563
|
+
const persisted = getPersistedState();
|
|
15564
|
+
if (persisted) {
|
|
15565
|
+
return persisted.view;
|
|
15566
|
+
}
|
|
15567
|
+
}
|
|
15568
|
+
return initialView;
|
|
15569
|
+
});
|
|
15570
|
+
const [verifyEmail, setVerifyEmail] = useState16(() => {
|
|
15571
|
+
if (mode === "internal") {
|
|
15572
|
+
const persisted = getPersistedState();
|
|
15573
|
+
return persisted?.email;
|
|
15574
|
+
}
|
|
15575
|
+
return void 0;
|
|
15576
|
+
});
|
|
15509
15577
|
const handleNavigate = useCallback9(
|
|
15510
15578
|
(href) => {
|
|
15511
15579
|
if (mode === "route") {
|
|
@@ -15516,11 +15584,11 @@ function AuthFlow({
|
|
|
15516
15584
|
}
|
|
15517
15585
|
return;
|
|
15518
15586
|
}
|
|
15519
|
-
const { view, email } = parsePathToView(href);
|
|
15520
|
-
onEvent?.({ type: "VIEW_CHANGE", view, email });
|
|
15587
|
+
const { view, email: email2 } = parsePathToView(href);
|
|
15588
|
+
onEvent?.({ type: "VIEW_CHANGE", view, email: email2 });
|
|
15521
15589
|
setCurrentView(view);
|
|
15522
|
-
if (
|
|
15523
|
-
setVerifyEmail(
|
|
15590
|
+
if (email2) {
|
|
15591
|
+
setVerifyEmail(email2);
|
|
15524
15592
|
}
|
|
15525
15593
|
},
|
|
15526
15594
|
[mode, externalNavigate, onEvent]
|
|
@@ -15583,29 +15651,46 @@ function AuthFlow({
|
|
|
15583
15651
|
case "SIGN_UP_REQUIRES_VERIFICATION":
|
|
15584
15652
|
setCurrentView("EMAIL_VERIFICATION");
|
|
15585
15653
|
setVerifyEmail(event.email);
|
|
15654
|
+
persistState("EMAIL_VERIFICATION", event.email);
|
|
15586
15655
|
break;
|
|
15587
15656
|
// Sign-in flow
|
|
15588
15657
|
case "SIGN_IN_REQUIRES_2FA":
|
|
15589
15658
|
setCurrentView("TWO_FACTOR");
|
|
15659
|
+
persistState("TWO_FACTOR");
|
|
15590
15660
|
break;
|
|
15591
15661
|
case "SIGN_IN_REQUIRES_VERIFICATION":
|
|
15592
15662
|
setCurrentView("EMAIL_VERIFICATION");
|
|
15593
15663
|
setVerifyEmail(event.email);
|
|
15664
|
+
persistState("EMAIL_VERIFICATION", event.email);
|
|
15594
15665
|
break;
|
|
15595
15666
|
// Verification success without token → sign in
|
|
15596
15667
|
case "VERIFICATION_SUCCESS":
|
|
15597
15668
|
if (!event.session?.token) {
|
|
15598
15669
|
setCurrentView("SIGN_IN");
|
|
15670
|
+
clearPersistedState();
|
|
15671
|
+
}
|
|
15672
|
+
if (event.session?.token) {
|
|
15673
|
+
clearPersistedState();
|
|
15599
15674
|
}
|
|
15600
15675
|
break;
|
|
15601
15676
|
// Password reset flow
|
|
15602
15677
|
case "PASSWORD_RESET_SUCCESS":
|
|
15603
15678
|
setCurrentView("SIGN_IN");
|
|
15679
|
+
clearPersistedState();
|
|
15604
15680
|
break;
|
|
15605
15681
|
// View toggles (footer links) - handled by InternalLink
|
|
15606
15682
|
case "VIEW_CHANGE":
|
|
15607
15683
|
setCurrentView(event.view);
|
|
15608
15684
|
if (event.email) setVerifyEmail(event.email);
|
|
15685
|
+
if (event.view !== "SIGN_IN") {
|
|
15686
|
+
persistState(event.view, event.email);
|
|
15687
|
+
} else {
|
|
15688
|
+
clearPersistedState();
|
|
15689
|
+
}
|
|
15690
|
+
break;
|
|
15691
|
+
// AUTH_SUCCESS - clear persisted state, let React re-render via useSession
|
|
15692
|
+
case "AUTH_SUCCESS":
|
|
15693
|
+
clearPersistedState();
|
|
15609
15694
|
break;
|
|
15610
15695
|
}
|
|
15611
15696
|
}
|