@mesob/auth-react 0.1.1 → 0.2.0
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/components/auth/{auth-page-layout.d.ts → auth-layout.d.ts} +3 -3
- package/dist/components/auth/{auth-page-layout.js → auth-layout.js} +4 -4
- package/dist/components/auth/auth-layout.js.map +1 -0
- package/dist/components/auth/countdown.js +15 -6
- package/dist/components/auth/countdown.js.map +1 -1
- package/dist/components/auth/forgot-password.d.ts +1 -9
- package/dist/components/auth/forgot-password.js +267 -43
- package/dist/components/auth/forgot-password.js.map +1 -1
- package/dist/components/auth/reset-password-form.d.ts +2 -10
- package/dist/components/auth/reset-password-form.js +366 -118
- package/dist/components/auth/reset-password-form.js.map +1 -1
- package/dist/components/auth/sign-in.d.ts +2 -10
- package/dist/components/auth/sign-in.js +358 -130
- package/dist/components/auth/sign-in.js.map +1 -1
- package/dist/components/auth/sign-up.d.ts +2 -10
- package/dist/components/auth/sign-up.js +379 -131
- package/dist/components/auth/sign-up.js.map +1 -1
- package/dist/components/auth/verification-form.d.ts +2 -16
- package/dist/components/auth/verification-form.js +15 -6
- package/dist/components/auth/verification-form.js.map +1 -1
- package/dist/components/auth/verify-email.d.ts +10 -0
- package/dist/components/auth/{pages/verify-email-page.js → verify-email.js} +54 -34
- package/dist/components/auth/verify-email.js.map +1 -0
- package/dist/components/auth/verify-phone.d.ts +11 -0
- package/dist/components/auth/{pages/verify-phone-page.js → verify-phone.js} +53 -46
- package/dist/components/auth/verify-phone.js.map +1 -0
- package/dist/components/error-boundary.d.ts +2 -2
- package/dist/components/iam/permissions.d.ts +5 -0
- package/dist/components/iam/{permissions/permissions-page.js → permissions.js} +29 -13
- package/dist/components/iam/permissions.js.map +1 -0
- package/dist/components/iam/roles.d.ts +5 -0
- package/dist/components/iam/{roles/roles-page.js → roles.js} +29 -13
- package/dist/components/iam/roles.js.map +1 -0
- package/dist/components/iam/sessions.d.ts +5 -0
- package/dist/components/iam/{sessions/sessions-page.js → sessions.js} +13 -11
- package/dist/components/iam/sessions.js.map +1 -0
- package/dist/components/iam/tenants.d.ts +5 -0
- package/dist/components/iam/{tenants/tenants-page.js → tenants.js} +13 -11
- package/dist/components/iam/tenants.js.map +1 -0
- package/dist/components/iam/users.d.ts +5 -0
- package/dist/components/iam/{users/users-page.js → users.js} +13 -11
- package/dist/components/iam/users.js.map +1 -0
- package/dist/components/profile/account.d.ts +5 -0
- package/dist/components/profile/account.js +66 -0
- package/dist/components/profile/account.js.map +1 -0
- package/dist/components/profile/change-email-form.d.ts +5 -0
- package/dist/components/profile/change-email-form.js +721 -0
- package/dist/components/profile/change-email-form.js.map +1 -0
- package/dist/components/profile/change-password-form.d.ts +5 -0
- package/dist/components/profile/change-password-form.js +256 -0
- package/dist/components/profile/change-password-form.js.map +1 -0
- package/dist/components/profile/change-phone-form.d.ts +5 -0
- package/dist/components/profile/change-phone-form.js +758 -0
- package/dist/components/profile/change-phone-form.js.map +1 -0
- package/dist/components/profile/change-profile.d.ts +9 -0
- package/dist/components/profile/change-profile.js +37 -0
- package/dist/components/profile/change-profile.js.map +1 -0
- package/dist/components/profile/otp-verification-modal.d.ts +15 -0
- package/dist/components/profile/otp-verification-modal.js +261 -0
- package/dist/components/profile/otp-verification-modal.js.map +1 -0
- package/dist/components/profile/request-change-email-form.d.ts +10 -0
- package/dist/components/profile/request-change-email-form.js +293 -0
- package/dist/components/profile/request-change-email-form.js.map +1 -0
- package/dist/components/profile/request-change-phone-form.d.ts +10 -0
- package/dist/components/profile/request-change-phone-form.js +331 -0
- package/dist/components/profile/request-change-phone-form.js.map +1 -0
- package/dist/components/profile/security.d.ts +5 -0
- package/dist/components/profile/security.js +1439 -0
- package/dist/components/profile/security.js.map +1 -0
- package/dist/components/profile/verify-change-email-form.d.ts +11 -0
- package/dist/components/profile/verify-change-email-form.js +402 -0
- package/dist/components/profile/verify-change-email-form.js.map +1 -0
- package/dist/components/profile/verify-change-phone-form.d.ts +11 -0
- package/dist/components/profile/verify-change-phone-form.js +406 -0
- package/dist/components/profile/verify-change-phone-form.js.map +1 -0
- package/dist/components/shared/{data-table/data-table.js → data-table.js} +2 -2
- package/dist/components/shared/data-table.js.map +1 -0
- package/dist/index.d.ts +42 -93
- package/dist/index.js +2297 -1299
- package/dist/index.js.map +1 -1
- package/dist/types-D3s9oE-5.d.ts +75 -0
- package/dist/verification-form-ipSRTtQB.d.ts +22 -0
- package/package.json +3 -2
- package/dist/components/auth/auth-page-layout.js.map +0 -1
- package/dist/components/auth/pages/forgot-password-page.d.ts +0 -6
- package/dist/components/auth/pages/forgot-password-page.js +0 -362
- package/dist/components/auth/pages/forgot-password-page.js.map +0 -1
- package/dist/components/auth/pages/reset-password-page.d.ts +0 -9
- package/dist/components/auth/pages/reset-password-page.js +0 -514
- package/dist/components/auth/pages/reset-password-page.js.map +0 -1
- package/dist/components/auth/pages/sign-in-page.d.ts +0 -8
- package/dist/components/auth/pages/sign-in-page.js +0 -565
- package/dist/components/auth/pages/sign-in-page.js.map +0 -1
- package/dist/components/auth/pages/sign-up-page.d.ts +0 -9
- package/dist/components/auth/pages/sign-up-page.js +0 -518
- package/dist/components/auth/pages/sign-up-page.js.map +0 -1
- package/dist/components/auth/pages/verify-email-page.d.ts +0 -10
- package/dist/components/auth/pages/verify-email-page.js.map +0 -1
- package/dist/components/auth/pages/verify-phone-page.d.ts +0 -11
- package/dist/components/auth/pages/verify-phone-page.js.map +0 -1
- package/dist/components/iam/permissions/permissions-page.d.ts +0 -5
- package/dist/components/iam/permissions/permissions-page.js.map +0 -1
- package/dist/components/iam/roles/roles-page.d.ts +0 -5
- package/dist/components/iam/roles/roles-page.js.map +0 -1
- package/dist/components/iam/sessions/sessions-page.d.ts +0 -5
- package/dist/components/iam/sessions/sessions-page.js.map +0 -1
- package/dist/components/iam/tenants/tenants-page.d.ts +0 -5
- package/dist/components/iam/tenants/tenants-page.js.map +0 -1
- package/dist/components/iam/users/users-page.d.ts +0 -5
- package/dist/components/iam/users/users-page.js.map +0 -1
- package/dist/components/profile/profile-page.d.ts +0 -8
- package/dist/components/profile/profile-page.js +0 -163
- package/dist/components/profile/profile-page.js.map +0 -1
- package/dist/components/shared/data-table/data-table.js.map +0 -1
- package/dist/handle-error-BqDMxnQZ.d.ts +0 -8
- /package/dist/components/shared/{data-table/data-table.d.ts → data-table.d.ts} +0 -0
|
@@ -1,518 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/components/auth/pages/sign-up-page.tsx
|
|
4
|
-
import {
|
|
5
|
-
Alert,
|
|
6
|
-
AlertDescription,
|
|
7
|
-
AlertTitle
|
|
8
|
-
} from "@mesob/ui/components/alert";
|
|
9
|
-
import { toast } from "@mesob/ui/components/sonner";
|
|
10
|
-
import { IconAlertCircle } from "@tabler/icons-react";
|
|
11
|
-
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
12
|
-
|
|
13
|
-
// src/lib/translations.ts
|
|
14
|
-
function createTranslator(messages, namespace) {
|
|
15
|
-
return (key, params) => {
|
|
16
|
-
const fullKey = namespace ? `${namespace}.${key}` : key;
|
|
17
|
-
const keys = fullKey.split(".");
|
|
18
|
-
let value = messages;
|
|
19
|
-
for (const k of keys) {
|
|
20
|
-
if (value && typeof value === "object" && value !== null) {
|
|
21
|
-
value = value[k];
|
|
22
|
-
} else {
|
|
23
|
-
return fullKey;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
if (typeof value !== "string") {
|
|
27
|
-
return fullKey;
|
|
28
|
-
}
|
|
29
|
-
if (params) {
|
|
30
|
-
return value.replace(
|
|
31
|
-
/\{(\w+)\}/g,
|
|
32
|
-
(_, param) => String(params[param] ?? `{${param}}`)
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
return value;
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// src/provider.tsx
|
|
40
|
-
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
41
|
-
import { deepmerge } from "deepmerge-ts";
|
|
42
|
-
import createFetchClient from "openapi-fetch";
|
|
43
|
-
import createClient from "openapi-react-query";
|
|
44
|
-
import { createContext, useContext, useEffect, useState } from "react";
|
|
45
|
-
import { jsx } from "react/jsx-runtime";
|
|
46
|
-
var SessionContext = createContext(null);
|
|
47
|
-
var ApiContext = createContext(null);
|
|
48
|
-
var ConfigContext = createContext(null);
|
|
49
|
-
var queryClient = new QueryClient({
|
|
50
|
-
defaultOptions: {
|
|
51
|
-
queries: {
|
|
52
|
-
staleTime: 1e3 * 60 * 5,
|
|
53
|
-
gcTime: 1e3 * 60 * 10,
|
|
54
|
-
retry: 1,
|
|
55
|
-
refetchOnWindowFocus: false
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
function useApi() {
|
|
60
|
-
const context = useContext(ApiContext);
|
|
61
|
-
if (!context) {
|
|
62
|
-
throw new Error("useApi must be used within MesobAuthProvider");
|
|
63
|
-
}
|
|
64
|
-
return context;
|
|
65
|
-
}
|
|
66
|
-
function useConfig() {
|
|
67
|
-
const context = useContext(ConfigContext);
|
|
68
|
-
if (!context) {
|
|
69
|
-
throw new Error("useConfig must be used within MesobAuthProvider");
|
|
70
|
-
}
|
|
71
|
-
return context;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// src/constants/auth.error.codes.ts
|
|
75
|
-
var AUTH_ERROR_MAPPING = {
|
|
76
|
-
USER_NOT_FOUND: {
|
|
77
|
-
title: "Account Not Found",
|
|
78
|
-
description: "We could not find an account with that identifier. Please check your spelling or sign up."
|
|
79
|
-
},
|
|
80
|
-
INVALID_PASSWORD: {
|
|
81
|
-
title: "Invalid Password",
|
|
82
|
-
description: "The password you entered is incorrect. Please try again."
|
|
83
|
-
},
|
|
84
|
-
USER_EXISTS: {
|
|
85
|
-
title: "Account Already Exists",
|
|
86
|
-
description: "An account with this identifier already exists. Please sign in instead."
|
|
87
|
-
},
|
|
88
|
-
VERIFICATION_EXPIRED: {
|
|
89
|
-
title: "Verification Expired",
|
|
90
|
-
description: "The verification code or link has expired. Please request a new one."
|
|
91
|
-
},
|
|
92
|
-
VERIFICATION_MISMATCH: {
|
|
93
|
-
title: "Invalid Code",
|
|
94
|
-
description: "The verification code you entered is invalid. Please double-check and try again."
|
|
95
|
-
},
|
|
96
|
-
VERIFICATION_NOT_FOUND: {
|
|
97
|
-
title: "Verification Not Found",
|
|
98
|
-
description: "We could not find a pending verification request. Please restart the process."
|
|
99
|
-
},
|
|
100
|
-
TOO_MANY_ATTEMPTS: {
|
|
101
|
-
title: "Too Many Attempts",
|
|
102
|
-
description: "You have made too many requests recently. Please wait a moment before trying again."
|
|
103
|
-
},
|
|
104
|
-
REQUIRES_VERIFICATION: {
|
|
105
|
-
title: "Verification Required",
|
|
106
|
-
description: "You need to verify your account before you can continue. Please check your email or phone."
|
|
107
|
-
},
|
|
108
|
-
UNAUTHORIZED: {
|
|
109
|
-
title: "Unauthorized",
|
|
110
|
-
description: "You are not authorized to perform this action. Please sign in again."
|
|
111
|
-
},
|
|
112
|
-
ACCESS_DENIED: {
|
|
113
|
-
title: "Access Denied",
|
|
114
|
-
description: "You do not have permission to access this resource. Please contact support if you believe this is an error."
|
|
115
|
-
},
|
|
116
|
-
HAS_NO_PASSWORD: {
|
|
117
|
-
title: "No Password Set",
|
|
118
|
-
description: "Your account does not have a password set (e.g. social login). Please sign in with your provider or reset your password."
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
var validCodes = Object.keys(AUTH_ERROR_MAPPING);
|
|
122
|
-
|
|
123
|
-
// src/utils/handle-error.ts
|
|
124
|
-
function isAuthError(err) {
|
|
125
|
-
return typeof err === "object" && err !== null && "message" in err && typeof err.message === "string";
|
|
126
|
-
}
|
|
127
|
-
function extractErrorCode(err) {
|
|
128
|
-
if (err.code && validCodes.includes(err.code)) {
|
|
129
|
-
return err.code;
|
|
130
|
-
}
|
|
131
|
-
if (err.message) {
|
|
132
|
-
const messageUpper = err.message.toUpperCase().trim();
|
|
133
|
-
if (validCodes.includes(messageUpper)) {
|
|
134
|
-
return messageUpper;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
return "";
|
|
138
|
-
}
|
|
139
|
-
function handleAuthError(err, setError, t) {
|
|
140
|
-
const errorCode = extractErrorCode(err);
|
|
141
|
-
if (errorCode && AUTH_ERROR_MAPPING[errorCode]) {
|
|
142
|
-
const mapping = AUTH_ERROR_MAPPING[errorCode];
|
|
143
|
-
setError({
|
|
144
|
-
title: mapping.title,
|
|
145
|
-
description: mapping.description
|
|
146
|
-
});
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
setError({
|
|
150
|
-
title: t("errors.fallback"),
|
|
151
|
-
description: err.message || t("errors.fallback")
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
function handleGenericError(err, setError, t) {
|
|
155
|
-
const message = err instanceof Error ? err.message : t("errors.fallback");
|
|
156
|
-
setError({
|
|
157
|
-
title: "Error",
|
|
158
|
-
description: message
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
var handleError = (err, setError, t) => {
|
|
162
|
-
if (isAuthError(err)) {
|
|
163
|
-
handleAuthError(err, setError, t);
|
|
164
|
-
} else {
|
|
165
|
-
handleGenericError(err, setError, t);
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
// src/components/auth/auth-page-layout.tsx
|
|
170
|
-
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
171
|
-
var AuthPageLayout = ({
|
|
172
|
-
title,
|
|
173
|
-
description,
|
|
174
|
-
children,
|
|
175
|
-
footer,
|
|
176
|
-
logoImage
|
|
177
|
-
}) => {
|
|
178
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
179
|
-
/* @__PURE__ */ jsx2("div", { className: "flex size-8 mb-6 w-full items-center justify-center rounded-md", children: /* @__PURE__ */ jsx2("img", { src: logoImage || "", alt: "Mesob", width: 42, height: 42 }) }),
|
|
180
|
-
/* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
181
|
-
/* @__PURE__ */ jsx2("h1", { className: "text-2xl font-bold tracking-tight", children: title }),
|
|
182
|
-
description && /* @__PURE__ */ jsx2("p", { className: "mt-2 text-sm text-muted-foreground", children: description })
|
|
183
|
-
] }),
|
|
184
|
-
children,
|
|
185
|
-
/* @__PURE__ */ jsx2("div", { className: "mt-2 w-full", children: footer && /* @__PURE__ */ jsx2("div", { className: "w-full text-center text-sm text-muted-foreground", children: footer }) })
|
|
186
|
-
] });
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
// src/components/auth/sign-up.tsx
|
|
190
|
-
import { zodResolver } from "@hookform/resolvers/zod";
|
|
191
|
-
import { Button } from "@mesob/ui/components/button";
|
|
192
|
-
import {
|
|
193
|
-
Field,
|
|
194
|
-
FieldError,
|
|
195
|
-
FieldGroup,
|
|
196
|
-
FieldLabel
|
|
197
|
-
} from "@mesob/ui/components/field";
|
|
198
|
-
import { Input } from "@mesob/ui/components/input";
|
|
199
|
-
import { IconEye, IconEyeOff } from "@tabler/icons-react";
|
|
200
|
-
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
201
|
-
import { Controller, useForm } from "react-hook-form";
|
|
202
|
-
import { z } from "zod";
|
|
203
|
-
|
|
204
|
-
// src/hooks/use-translator.ts
|
|
205
|
-
function useTranslator(namespace) {
|
|
206
|
-
const { config } = useConfig();
|
|
207
|
-
return createTranslator(config.messages || {}, namespace);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// src/components/auth/sign-up.tsx
|
|
211
|
-
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
212
|
-
var isPhone = (s) => /^\+?[0-9()[\]\s-]{6,}$/.test(s);
|
|
213
|
-
var signUpSchema = (t) => z.object({
|
|
214
|
-
fullName: z.string().min(1, t("errors.fullNameRequired")),
|
|
215
|
-
identifier: z.string().min(1, t("errors.contactRequired")).refine(
|
|
216
|
-
(val) => {
|
|
217
|
-
if (!val) {
|
|
218
|
-
return false;
|
|
219
|
-
}
|
|
220
|
-
return val.includes("@") || isPhone(val);
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
message: t("errors.invalidEmailOrPhone")
|
|
224
|
-
}
|
|
225
|
-
),
|
|
226
|
-
password: z.string().min(8, t("errors.passwordLength")).max(128, t("errors.longPasswordError")),
|
|
227
|
-
confirmPassword: z.string()
|
|
228
|
-
}).refine((data) => data.password === data.confirmPassword, {
|
|
229
|
-
message: t("errors.passwordsMismatch"),
|
|
230
|
-
path: ["confirmPassword"]
|
|
231
|
-
});
|
|
232
|
-
var SignUp = ({
|
|
233
|
-
onSubmit,
|
|
234
|
-
isLoading = false,
|
|
235
|
-
initialIdentifier
|
|
236
|
-
}) => {
|
|
237
|
-
const t = useTranslator("Auth.signUp");
|
|
238
|
-
const hasInitialIdentifier = !!initialIdentifier;
|
|
239
|
-
const [showPassword, setShowPassword] = useState2(false);
|
|
240
|
-
const [showConfirmPassword, setShowConfirmPassword] = useState2(false);
|
|
241
|
-
const form = useForm({
|
|
242
|
-
resolver: zodResolver(signUpSchema(t)),
|
|
243
|
-
defaultValues: {
|
|
244
|
-
fullName: "",
|
|
245
|
-
identifier: initialIdentifier || "",
|
|
246
|
-
password: "",
|
|
247
|
-
confirmPassword: ""
|
|
248
|
-
}
|
|
249
|
-
});
|
|
250
|
-
useEffect2(() => {
|
|
251
|
-
if (initialIdentifier) {
|
|
252
|
-
form.setValue("identifier", initialIdentifier);
|
|
253
|
-
}
|
|
254
|
-
}, [initialIdentifier, form]);
|
|
255
|
-
const handleSubmit = form.handleSubmit(async (values) => {
|
|
256
|
-
await onSubmit(values);
|
|
257
|
-
});
|
|
258
|
-
const getIdentifierLabel = () => {
|
|
259
|
-
if (!hasInitialIdentifier) {
|
|
260
|
-
return t("form.accountLabel") || "Email/Phone";
|
|
261
|
-
}
|
|
262
|
-
if (initialIdentifier?.includes("@")) {
|
|
263
|
-
return t("form.emailLabel");
|
|
264
|
-
}
|
|
265
|
-
return t("form.phoneLabel");
|
|
266
|
-
};
|
|
267
|
-
const identifierLabel = getIdentifierLabel();
|
|
268
|
-
return /* @__PURE__ */ jsxs2("form", { id: "sign-up-form", onSubmit: handleSubmit, children: [
|
|
269
|
-
/* @__PURE__ */ jsxs2(FieldGroup, { children: [
|
|
270
|
-
/* @__PURE__ */ jsx3(
|
|
271
|
-
Controller,
|
|
272
|
-
{
|
|
273
|
-
name: "fullName",
|
|
274
|
-
control: form.control,
|
|
275
|
-
render: ({ field, fieldState }) => /* @__PURE__ */ jsxs2(Field, { "data-invalid": fieldState.invalid, children: [
|
|
276
|
-
/* @__PURE__ */ jsx3(FieldLabel, { htmlFor: "sign-up-fullName", children: t("form.fullNameLabel") }),
|
|
277
|
-
/* @__PURE__ */ jsx3(
|
|
278
|
-
Input,
|
|
279
|
-
{
|
|
280
|
-
...field,
|
|
281
|
-
id: "sign-up-fullName",
|
|
282
|
-
placeholder: t("form.fullNamePlaceholder"),
|
|
283
|
-
"aria-invalid": fieldState.invalid
|
|
284
|
-
}
|
|
285
|
-
),
|
|
286
|
-
fieldState.invalid && /* @__PURE__ */ jsx3(FieldError, { errors: [fieldState.error] })
|
|
287
|
-
] })
|
|
288
|
-
}
|
|
289
|
-
),
|
|
290
|
-
/* @__PURE__ */ jsx3(
|
|
291
|
-
Controller,
|
|
292
|
-
{
|
|
293
|
-
name: "identifier",
|
|
294
|
-
control: form.control,
|
|
295
|
-
render: ({ field, fieldState }) => /* @__PURE__ */ jsxs2(Field, { "data-invalid": fieldState.invalid, children: [
|
|
296
|
-
/* @__PURE__ */ jsx3(
|
|
297
|
-
FieldLabel,
|
|
298
|
-
{
|
|
299
|
-
htmlFor: "sign-up-identifier",
|
|
300
|
-
className: hasInitialIdentifier ? "block" : void 0,
|
|
301
|
-
children: identifierLabel
|
|
302
|
-
}
|
|
303
|
-
),
|
|
304
|
-
/* @__PURE__ */ jsx3(
|
|
305
|
-
Input,
|
|
306
|
-
{
|
|
307
|
-
...field,
|
|
308
|
-
id: "sign-up-identifier",
|
|
309
|
-
type: field.value.includes("@") ? "email" : "tel",
|
|
310
|
-
placeholder: hasInitialIdentifier ? void 0 : t("form.accountPlaceholder") || "Email or phone number",
|
|
311
|
-
disabled: hasInitialIdentifier,
|
|
312
|
-
"aria-invalid": fieldState.invalid
|
|
313
|
-
}
|
|
314
|
-
),
|
|
315
|
-
fieldState.invalid && /* @__PURE__ */ jsx3(FieldError, { errors: [fieldState.error] })
|
|
316
|
-
] })
|
|
317
|
-
}
|
|
318
|
-
),
|
|
319
|
-
/* @__PURE__ */ jsx3(
|
|
320
|
-
Controller,
|
|
321
|
-
{
|
|
322
|
-
name: "password",
|
|
323
|
-
control: form.control,
|
|
324
|
-
render: ({ field, fieldState }) => /* @__PURE__ */ jsxs2(Field, { "data-invalid": fieldState.invalid, children: [
|
|
325
|
-
/* @__PURE__ */ jsx3(FieldLabel, { htmlFor: "sign-up-password", children: t("form.passwordLabel") }),
|
|
326
|
-
/* @__PURE__ */ jsxs2("div", { className: "relative", children: [
|
|
327
|
-
/* @__PURE__ */ jsx3(
|
|
328
|
-
Input,
|
|
329
|
-
{
|
|
330
|
-
...field,
|
|
331
|
-
id: "sign-up-password",
|
|
332
|
-
type: showPassword ? "text" : "password",
|
|
333
|
-
placeholder: t("form.passwordPlaceholder"),
|
|
334
|
-
"aria-invalid": fieldState.invalid
|
|
335
|
-
}
|
|
336
|
-
),
|
|
337
|
-
/* @__PURE__ */ jsx3(
|
|
338
|
-
"button",
|
|
339
|
-
{
|
|
340
|
-
type: "button",
|
|
341
|
-
onClick: () => setShowPassword(!showPassword),
|
|
342
|
-
className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",
|
|
343
|
-
children: showPassword ? /* @__PURE__ */ jsx3(IconEyeOff, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx3(IconEye, { className: "h-4 w-4" })
|
|
344
|
-
}
|
|
345
|
-
)
|
|
346
|
-
] }),
|
|
347
|
-
fieldState.invalid && /* @__PURE__ */ jsx3(FieldError, { errors: [fieldState.error] })
|
|
348
|
-
] })
|
|
349
|
-
}
|
|
350
|
-
),
|
|
351
|
-
/* @__PURE__ */ jsx3(
|
|
352
|
-
Controller,
|
|
353
|
-
{
|
|
354
|
-
name: "confirmPassword",
|
|
355
|
-
control: form.control,
|
|
356
|
-
render: ({ field, fieldState }) => /* @__PURE__ */ jsxs2(Field, { "data-invalid": fieldState.invalid, children: [
|
|
357
|
-
/* @__PURE__ */ jsx3(FieldLabel, { htmlFor: "sign-up-confirmPassword", children: t("form.confirmPasswordLabel") }),
|
|
358
|
-
/* @__PURE__ */ jsxs2("div", { className: "relative", children: [
|
|
359
|
-
/* @__PURE__ */ jsx3(
|
|
360
|
-
Input,
|
|
361
|
-
{
|
|
362
|
-
...field,
|
|
363
|
-
id: "sign-up-confirmPassword",
|
|
364
|
-
type: showConfirmPassword ? "text" : "password",
|
|
365
|
-
placeholder: t("form.passwordPlaceholder"),
|
|
366
|
-
"aria-invalid": fieldState.invalid
|
|
367
|
-
}
|
|
368
|
-
),
|
|
369
|
-
/* @__PURE__ */ jsx3(
|
|
370
|
-
"button",
|
|
371
|
-
{
|
|
372
|
-
type: "button",
|
|
373
|
-
onClick: () => setShowConfirmPassword(!showConfirmPassword),
|
|
374
|
-
className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",
|
|
375
|
-
children: showConfirmPassword ? /* @__PURE__ */ jsx3(IconEyeOff, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx3(IconEye, { className: "h-4 w-4" })
|
|
376
|
-
}
|
|
377
|
-
)
|
|
378
|
-
] }),
|
|
379
|
-
fieldState.invalid && /* @__PURE__ */ jsx3(FieldError, { errors: [fieldState.error] })
|
|
380
|
-
] })
|
|
381
|
-
}
|
|
382
|
-
)
|
|
383
|
-
] }),
|
|
384
|
-
/* @__PURE__ */ jsx3("div", { className: "mt-4", children: /* @__PURE__ */ jsx3(
|
|
385
|
-
Button,
|
|
386
|
-
{
|
|
387
|
-
type: "submit",
|
|
388
|
-
form: "sign-up-form",
|
|
389
|
-
className: "w-full",
|
|
390
|
-
disabled: isLoading,
|
|
391
|
-
children: isLoading ? t("form.submitting") : t("form.submit")
|
|
392
|
-
}
|
|
393
|
-
) })
|
|
394
|
-
] });
|
|
395
|
-
};
|
|
396
|
-
|
|
397
|
-
// src/components/auth/pages/sign-up-page.tsx
|
|
398
|
-
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
399
|
-
var isPhone2 = (s) => /^\+?[0-9()[\]\s-]{6,}$/.test(s);
|
|
400
|
-
var SignUpPage = ({
|
|
401
|
-
redirectUrl,
|
|
402
|
-
initialIdentifier
|
|
403
|
-
} = {}) => {
|
|
404
|
-
const { hooks, setAuth } = useApi();
|
|
405
|
-
const { config } = useConfig();
|
|
406
|
-
const t = createTranslator(config.messages || {}, "Auth.signUp");
|
|
407
|
-
const [isLoading, setIsLoading] = useState3(false);
|
|
408
|
-
const [error, setError] = useState3(null);
|
|
409
|
-
const signUpMutation = hooks.useMutation("post", "/sign-up");
|
|
410
|
-
const signInLink = config.navigation?.links?.signIn || "/auth/sign-in";
|
|
411
|
-
const Link = config.navigation?.linkComponent;
|
|
412
|
-
const onNavigate = config.navigation?.onNavigate || ((path) => {
|
|
413
|
-
if (typeof window !== "undefined") {
|
|
414
|
-
window.location.href = path;
|
|
415
|
-
}
|
|
416
|
-
});
|
|
417
|
-
const logoImage = config.ui.logoImage;
|
|
418
|
-
const defaultRedirect = redirectUrl || config.navigation?.defaultRedirectUrl || "/";
|
|
419
|
-
useEffect3(() => {
|
|
420
|
-
if (error) {
|
|
421
|
-
toast.error(error.title || "Error", {
|
|
422
|
-
description: error.description
|
|
423
|
-
});
|
|
424
|
-
}
|
|
425
|
-
}, [error]);
|
|
426
|
-
const handleSubmit = async (values) => {
|
|
427
|
-
setIsLoading(true);
|
|
428
|
-
setError(null);
|
|
429
|
-
try {
|
|
430
|
-
const identifier = values.identifier;
|
|
431
|
-
const usingPhone = isPhone2(identifier);
|
|
432
|
-
const res = await signUpMutation.mutateAsync({
|
|
433
|
-
body: usingPhone ? {
|
|
434
|
-
phone: identifier,
|
|
435
|
-
password: values.password,
|
|
436
|
-
fullName: values.fullName,
|
|
437
|
-
handle: values.handle
|
|
438
|
-
} : {
|
|
439
|
-
email: identifier,
|
|
440
|
-
password: values.password,
|
|
441
|
-
fullName: values.fullName,
|
|
442
|
-
handle: values.handle
|
|
443
|
-
}
|
|
444
|
-
});
|
|
445
|
-
if ("verificationId" in res && res.verificationId) {
|
|
446
|
-
if (usingPhone) {
|
|
447
|
-
onNavigate(
|
|
448
|
-
`/auth/verify-phone?context=sign-up&verificationId=${res.verificationId}&phone=${encodeURIComponent(identifier)}`
|
|
449
|
-
);
|
|
450
|
-
} else {
|
|
451
|
-
onNavigate(
|
|
452
|
-
`/auth/verify-email?verificationId=${res.verificationId}&email=${encodeURIComponent(identifier)}`
|
|
453
|
-
);
|
|
454
|
-
}
|
|
455
|
-
return;
|
|
456
|
-
}
|
|
457
|
-
if ("user" in res && "session" in res) {
|
|
458
|
-
setAuth(res);
|
|
459
|
-
}
|
|
460
|
-
onNavigate(defaultRedirect);
|
|
461
|
-
} catch (err) {
|
|
462
|
-
handleError(err, setError, t);
|
|
463
|
-
} finally {
|
|
464
|
-
setIsLoading(false);
|
|
465
|
-
}
|
|
466
|
-
};
|
|
467
|
-
let errorContent = null;
|
|
468
|
-
if (error) {
|
|
469
|
-
if (typeof error === "string") {
|
|
470
|
-
errorContent = { title: "Error", description: error };
|
|
471
|
-
} else {
|
|
472
|
-
errorContent = error;
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
return /* @__PURE__ */ jsxs3(
|
|
476
|
-
AuthPageLayout,
|
|
477
|
-
{
|
|
478
|
-
title: t("title"),
|
|
479
|
-
description: t("description"),
|
|
480
|
-
logoImage,
|
|
481
|
-
footer: /* @__PURE__ */ jsxs3("p", { children: [
|
|
482
|
-
t("footer.hasAccount"),
|
|
483
|
-
" ",
|
|
484
|
-
Link ? /* @__PURE__ */ jsx4(Link, { href: signInLink, className: "text-primary hover:underline", children: t("footer.signInCta") }) : /* @__PURE__ */ jsx4(
|
|
485
|
-
"a",
|
|
486
|
-
{
|
|
487
|
-
href: signInLink,
|
|
488
|
-
onClick: (e) => {
|
|
489
|
-
e.preventDefault();
|
|
490
|
-
onNavigate(signInLink);
|
|
491
|
-
},
|
|
492
|
-
className: "text-primary hover:underline",
|
|
493
|
-
children: t("footer.signInCta")
|
|
494
|
-
}
|
|
495
|
-
)
|
|
496
|
-
] }),
|
|
497
|
-
children: [
|
|
498
|
-
/* @__PURE__ */ jsx4(
|
|
499
|
-
SignUp,
|
|
500
|
-
{
|
|
501
|
-
onSubmit: handleSubmit,
|
|
502
|
-
isLoading: isLoading || signUpMutation.isPending,
|
|
503
|
-
initialIdentifier
|
|
504
|
-
}
|
|
505
|
-
),
|
|
506
|
-
errorContent && /* @__PURE__ */ jsxs3(Alert, { variant: "destructive", className: "mt-4", children: [
|
|
507
|
-
/* @__PURE__ */ jsx4(IconAlertCircle, { className: "h-4 w-4" }),
|
|
508
|
-
/* @__PURE__ */ jsx4(AlertTitle, { children: errorContent.title }),
|
|
509
|
-
/* @__PURE__ */ jsx4(AlertDescription, { children: errorContent.description })
|
|
510
|
-
] })
|
|
511
|
-
]
|
|
512
|
-
}
|
|
513
|
-
);
|
|
514
|
-
};
|
|
515
|
-
export {
|
|
516
|
-
SignUpPage
|
|
517
|
-
};
|
|
518
|
-
//# sourceMappingURL=sign-up-page.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/auth/pages/sign-up-page.tsx","../../../../src/lib/translations.ts","../../../../src/provider.tsx","../../../../src/constants/auth.error.codes.ts","../../../../src/utils/handle-error.ts","../../../../src/components/auth/auth-page-layout.tsx","../../../../src/components/auth/sign-up.tsx","../../../../src/hooks/use-translator.ts"],"sourcesContent":["'use client';\n\nimport {\n Alert,\n AlertDescription,\n AlertTitle,\n} from '@mesob/ui/components/alert';\nimport { toast } from '@mesob/ui/components/sonner';\nimport { IconAlertCircle } from '@tabler/icons-react';\nimport { useEffect, useState } from 'react';\nimport { createTranslator } from '../../../lib/translations';\nimport { useApi, useConfig } from '../../../provider';\nimport type { AuthErrorContent } from '../../../utils/handle-error';\nimport { handleError } from '../../../utils/handle-error';\n\nimport { AuthPageLayout } from '../auth-page-layout';\nimport { SignUp } from '../sign-up';\n\nconst isPhone = (s: string) => /^\\+?[0-9()[\\]\\s-]{6,}$/.test(s);\n\ntype SignUpFormValues = {\n fullName: string;\n identifier: string;\n handle?: string;\n password: string;\n confirmPassword: string;\n};\n\ntype SignUpPageProps = {\n redirectUrl?: string; // Can override defaultRedirectUrl from config\n initialIdentifier?: string;\n};\n\nexport const SignUpPage = ({\n redirectUrl,\n initialIdentifier,\n}: SignUpPageProps = {}) => {\n const { hooks, setAuth } = useApi();\n const { config } = useConfig();\n const t = createTranslator(config.messages || {}, 'Auth.signUp');\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<AuthErrorContent | null>(null);\n\n const signUpMutation = hooks.useMutation('post', '/sign-up');\n\n const signInLink = config.navigation?.links?.signIn || '/auth/sign-in';\n const Link = config.navigation?.linkComponent;\n const onNavigate =\n config.navigation?.onNavigate ||\n ((path: string) => {\n if (typeof window !== 'undefined') {\n window.location.href = path;\n }\n });\n const logoImage = config.ui.logoImage;\n const defaultRedirect =\n redirectUrl || config.navigation?.defaultRedirectUrl || '/';\n\n useEffect(() => {\n if (error) {\n toast.error(error.title || 'Error', {\n description: error.description,\n });\n }\n }, [error]);\n\n const handleSubmit = async (values: SignUpFormValues) => {\n setIsLoading(true);\n setError(null);\n\n try {\n const identifier = values.identifier;\n const usingPhone = isPhone(identifier);\n\n const res = await signUpMutation.mutateAsync({\n body: usingPhone\n ? {\n phone: identifier,\n password: values.password,\n fullName: values.fullName,\n handle: values.handle,\n }\n : {\n email: identifier,\n password: values.password,\n fullName: values.fullName,\n handle: values.handle,\n },\n });\n\n if ('verificationId' in res && res.verificationId) {\n if (usingPhone) {\n onNavigate(\n `/auth/verify-phone?context=sign-up&verificationId=${res.verificationId}&phone=${encodeURIComponent(identifier)}`,\n );\n } else {\n onNavigate(\n `/auth/verify-email?verificationId=${res.verificationId}&email=${encodeURIComponent(identifier)}`,\n );\n }\n return;\n }\n\n if ('user' in res && 'session' in res) {\n setAuth(res);\n }\n onNavigate(defaultRedirect);\n } catch (err) {\n handleError(err, setError, t);\n } finally {\n setIsLoading(false);\n }\n };\n\n let errorContent: AuthErrorContent | null = null;\n if (error) {\n if (typeof error === 'string') {\n errorContent = { title: 'Error', description: error };\n } else {\n errorContent = error;\n }\n }\n\n return (\n <AuthPageLayout\n title={t('title')}\n description={t('description')}\n logoImage={logoImage}\n footer={\n <p>\n {t('footer.hasAccount')}{' '}\n {Link ? (\n <Link href={signInLink} className=\"text-primary hover:underline\">\n {t('footer.signInCta')}\n </Link>\n ) : (\n <a\n href={signInLink}\n onClick={(e) => {\n e.preventDefault();\n onNavigate(signInLink);\n }}\n className=\"text-primary hover:underline\"\n >\n {t('footer.signInCta')}\n </a>\n )}\n </p>\n }\n >\n <SignUp\n onSubmit={handleSubmit}\n isLoading={isLoading || signUpMutation.isPending}\n initialIdentifier={initialIdentifier}\n />\n {errorContent && (\n <Alert variant=\"destructive\" className=\"mt-4\">\n <IconAlertCircle className=\"h-4 w-4\" />\n <AlertTitle>{errorContent.title}</AlertTitle>\n <AlertDescription>{errorContent.description}</AlertDescription>\n </Alert>\n )}\n </AuthPageLayout>\n );\n};\n","type Messages = Record<string, unknown>;\n\nexport function createTranslator(messages: Messages, namespace?: string) {\n return (key: string, params?: Record<string, string | number>): string => {\n const fullKey = namespace ? `${namespace}.${key}` : key;\n const keys = fullKey.split('.');\n\n let value: unknown = messages;\n for (const k of keys) {\n if (value && typeof value === 'object' && value !== null) {\n value = (value as Record<string, unknown>)[k];\n } else {\n return fullKey;\n }\n }\n\n if (typeof value !== 'string') {\n return fullKey;\n }\n\n // Simple parameter replacement\n if (params) {\n return value.replace(/\\{(\\w+)\\}/g, (_, param) =>\n String(params[param] ?? `{${param}}`),\n );\n }\n\n return value;\n };\n}\n","'use client';\n\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { deepmerge } from 'deepmerge-ts';\nimport createFetchClient from 'openapi-fetch';\nimport createClient from 'openapi-react-query';\nimport type { ReactNode } from 'react';\nimport { createContext, useContext, useEffect, useState } from 'react';\nimport type { paths } from './data/openapi';\nimport { createTranslator } from './lib/translations';\nimport {\n type AuthClientConfig,\n type AuthResponse,\n defaultAuthClientConfig,\n type Session,\n type User,\n} from './types';\nimport { createCustomFetch } from './utils/custom-fetch';\n\ntype OpenApiHooks = any;\n\ntype SessionState = {\n user: User | null;\n session: Session | null;\n isLoading: boolean;\n isAuthenticated: boolean;\n error: Error | null;\n};\n\ntype SessionContextValue = SessionState & {\n refresh: () => Promise<void>;\n signOut: () => Promise<void>;\n};\n\ntype ApiContextValue = {\n hooks: OpenApiHooks;\n setAuth: (auth: AuthResponse) => void;\n clearAuth: () => void;\n refresh: () => Promise<void>;\n};\n\ntype ConfigContextValue = {\n config: AuthClientConfig;\n t: (key: string, params?: Record<string, string | number>) => string;\n};\n\nconst SessionContext = createContext<SessionContextValue | null>(null);\nconst ApiContext = createContext<ApiContextValue | null>(null);\nconst ConfigContext = createContext<ConfigContextValue | null>(null);\n\nconst queryClient = new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 1000 * 60 * 5,\n gcTime: 1000 * 60 * 10,\n retry: 1,\n refetchOnWindowFocus: false,\n },\n },\n});\n\nexport function useSession() {\n const context = useContext(SessionContext);\n if (!context) {\n throw new Error('useSession must be used within MesobAuthProvider');\n }\n return context;\n}\n\nexport function useApi() {\n const context = useContext(ApiContext);\n if (!context) {\n throw new Error('useApi must be used within MesobAuthProvider');\n }\n return context;\n}\n\nexport function useConfig() {\n const context = useContext(ConfigContext);\n if (!context) {\n throw new Error('useConfig must be used within MesobAuthProvider');\n }\n return context;\n}\n\ntype MesobAuthProviderProps = {\n config: AuthClientConfig;\n children: ReactNode;\n};\n\nexport function MesobAuthProvider({\n config,\n children,\n}: MesobAuthProviderProps) {\n const mergedConfig = deepmerge(\n { ...defaultAuthClientConfig } as Partial<AuthClientConfig>,\n config,\n ) as AuthClientConfig;\n\n const api = createFetchClient<paths>({\n baseUrl: mergedConfig.baseURL,\n fetch: createCustomFetch(mergedConfig),\n });\n\n const hooks = createClient(api);\n\n return (\n <QueryClientProvider client={queryClient}>\n <AuthStateProvider config={mergedConfig} hooks={hooks}>\n {children}\n </AuthStateProvider>\n </QueryClientProvider>\n );\n}\n\ntype AuthStateProviderProps = {\n config: AuthClientConfig;\n hooks: OpenApiHooks;\n children: ReactNode;\n};\n\nfunction AuthStateProvider({\n config,\n hooks,\n children,\n}: AuthStateProviderProps) {\n const [authState, setAuthState] = useState<{\n user: User | null;\n session: Session | null;\n isLoading: boolean;\n error: Error | null;\n }>({\n user: null,\n session: null,\n isLoading: false,\n error: null,\n });\n\n const {\n data: sessionData,\n isLoading: sessionLoading,\n error: sessionError,\n refetch,\n } = hooks.useQuery(\n 'get',\n '/session',\n {},\n {\n enabled: true,\n refetchOnMount: true,\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n retry: false,\n },\n );\n\n useEffect(() => {\n if (sessionLoading) {\n setAuthState((prev) => ({ ...prev, isLoading: true }));\n return;\n }\n\n if (sessionError) {\n setAuthState({\n user: null,\n session: null,\n isLoading: false,\n error: sessionError as Error,\n });\n return;\n }\n\n if (sessionData) {\n setAuthState({\n user: sessionData.user,\n session: sessionData.session,\n isLoading: false,\n error: null,\n });\n return;\n }\n\n setAuthState({\n user: null,\n session: null,\n isLoading: false,\n error: null,\n });\n }, [sessionData, sessionLoading, sessionError]);\n\n const refresh = async () => {\n await refetch();\n };\n\n const setAuth = (auth: AuthResponse) => {\n setAuthState({\n user: auth.user,\n session: auth.session,\n isLoading: false,\n error: null,\n });\n };\n\n const clearAuth = () => {\n setAuthState({\n user: null,\n session: null,\n isLoading: false,\n error: null,\n });\n };\n\n const signOutMutation = hooks.useMutation('post', '/sign-out');\n\n const signOut = async () => {\n try {\n await signOutMutation.mutateAsync({});\n } finally {\n clearAuth();\n }\n };\n\n const t = createTranslator(config.messages || {});\n\n return (\n <ConfigContext.Provider value={{ config, t }}>\n <ApiContext.Provider value={{ hooks, setAuth, clearAuth, refresh }}>\n <SessionContext.Provider\n value={{\n user: authState.user,\n session: authState.session,\n isLoading: authState.isLoading,\n isAuthenticated: !!authState.user && !!authState.session,\n error: authState.error,\n refresh,\n signOut,\n }}\n >\n {children}\n </SessionContext.Provider>\n </ApiContext.Provider>\n </ConfigContext.Provider>\n );\n}\n","export const AUTH_ERROR_MAPPING: Record<\n string,\n { title: string; description: string }\n> = {\n USER_NOT_FOUND: {\n title: 'Account Not Found',\n description:\n 'We could not find an account with that identifier. Please check your spelling or sign up.',\n },\n INVALID_PASSWORD: {\n title: 'Invalid Password',\n description: 'The password you entered is incorrect. Please try again.',\n },\n USER_EXISTS: {\n title: 'Account Already Exists',\n description:\n 'An account with this identifier already exists. Please sign in instead.',\n },\n VERIFICATION_EXPIRED: {\n title: 'Verification Expired',\n description:\n 'The verification code or link has expired. Please request a new one.',\n },\n VERIFICATION_MISMATCH: {\n title: 'Invalid Code',\n description:\n 'The verification code you entered is invalid. Please double-check and try again.',\n },\n VERIFICATION_NOT_FOUND: {\n title: 'Verification Not Found',\n description:\n 'We could not find a pending verification request. Please restart the process.',\n },\n TOO_MANY_ATTEMPTS: {\n title: 'Too Many Attempts',\n description:\n 'You have made too many requests recently. Please wait a moment before trying again.',\n },\n REQUIRES_VERIFICATION: {\n title: 'Verification Required',\n description:\n 'You need to verify your account before you can continue. Please check your email or phone.',\n },\n UNAUTHORIZED: {\n title: 'Unauthorized',\n description:\n 'You are not authorized to perform this action. Please sign in again.',\n },\n ACCESS_DENIED: {\n title: 'Access Denied',\n description:\n 'You do not have permission to access this resource. Please contact support if you believe this is an error.',\n },\n HAS_NO_PASSWORD: {\n title: 'No Password Set',\n description:\n 'Your account does not have a password set (e.g. social login). Please sign in with your provider or reset your password.',\n },\n};\n\nexport const validCodes = Object.keys(AUTH_ERROR_MAPPING);\n","import { AUTH_ERROR_MAPPING, validCodes } from '../constants/auth.error.codes';\nimport type { AuthError } from '../types';\n\nexport type AuthErrorContent = {\n title: string;\n description: string;\n};\n\n// Translator function type\ntype TranslatorFunction = (\n key: string,\n params?: Record<string, string | number>,\n) => string;\n\n// Type guard to check if error is an AuthError\nfunction isAuthError(err: unknown): err is AuthError {\n return (\n typeof err === 'object' &&\n err !== null &&\n 'message' in err &&\n typeof (err as { message: unknown }).message === 'string'\n );\n}\n\nfunction extractErrorCode(err: AuthError): string {\n if (err.code && validCodes.includes(err.code)) {\n return err.code;\n }\n if (err.message) {\n const messageUpper = err.message.toUpperCase().trim();\n if (validCodes.includes(messageUpper)) {\n return messageUpper;\n }\n }\n return '';\n}\n\nfunction handleAuthError(\n err: AuthError,\n setError: (error: AuthErrorContent | null) => void,\n t: TranslatorFunction,\n) {\n const errorCode = extractErrorCode(err);\n\n if (errorCode && AUTH_ERROR_MAPPING[errorCode]) {\n const mapping = AUTH_ERROR_MAPPING[errorCode];\n setError({\n title: mapping.title,\n description: mapping.description,\n });\n return;\n }\n\n setError({\n title: t('errors.fallback'),\n description: err.message || t('errors.fallback'),\n });\n}\n\nfunction handleGenericError(\n err: unknown,\n setError: (error: AuthErrorContent | null) => void,\n t: TranslatorFunction,\n) {\n const message = err instanceof Error ? err.message : t('errors.fallback');\n setError({\n title: 'Error',\n description: message,\n });\n}\n\nexport const handleError = (\n err: unknown,\n setError: (error: AuthErrorContent | null) => void,\n t: TranslatorFunction,\n) => {\n if (isAuthError(err)) {\n handleAuthError(err, setError, t);\n } else {\n handleGenericError(err, setError, t);\n }\n};\n","'use client';\n\nimport type { ReactNode } from 'react';\n\ntype AuthPageLayoutProps = {\n title: string;\n description?: string;\n children: ReactNode;\n footer?: ReactNode;\n logoImage?: string;\n};\n\nexport const AuthPageLayout = ({\n title,\n description,\n children,\n footer,\n logoImage,\n}: AuthPageLayoutProps) => {\n return (\n <div className=\"space-y-4\">\n <div className=\"flex size-8 mb-6 w-full items-center justify-center rounded-md\">\n {/** biome-ignore lint/performance/noImgElement: logo image */}\n <img src={logoImage || ''} alt=\"Mesob\" width={42} height={42} />\n </div>\n <div className=\"text-center\">\n <h1 className=\"text-2xl font-bold tracking-tight\">{title}</h1>\n {description && (\n <p className=\"mt-2 text-sm text-muted-foreground\">{description}</p>\n )}\n </div>\n\n {children}\n\n <div className=\"mt-2 w-full\">\n {footer && (\n <div className=\"w-full text-center text-sm text-muted-foreground\">\n {footer}\n </div>\n )}\n </div>\n </div>\n );\n};\n","'use client';\n\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { Button } from '@mesob/ui/components/button';\nimport {\n Field,\n FieldError,\n FieldGroup,\n FieldLabel,\n} from '@mesob/ui/components/field';\nimport { Input } from '@mesob/ui/components/input';\nimport { IconEye, IconEyeOff } from '@tabler/icons-react';\nimport { useEffect, useState } from 'react';\nimport { Controller, useForm } from 'react-hook-form';\nimport { z } from 'zod';\nimport { useTranslator } from '../../hooks/use-translator';\n\nconst isPhone = (s: string) => /^\\+?[0-9()[\\]\\s-]{6,}$/.test(s);\n\ntype SignUpFormValues = {\n fullName: string;\n identifier: string;\n handle?: string;\n password: string;\n confirmPassword: string;\n};\n\ntype SignUpProps = {\n onSubmit: (values: SignUpFormValues) => Promise<void> | void;\n isLoading?: boolean;\n initialIdentifier?: string;\n};\n\nconst signUpSchema = (t: (key: string) => string) =>\n z\n .object({\n fullName: z.string().min(1, t('errors.fullNameRequired')),\n identifier: z\n .string()\n .min(1, t('errors.contactRequired'))\n .refine(\n (val) => {\n if (!val) {\n return false;\n }\n return val.includes('@') || isPhone(val);\n },\n {\n message: t('errors.invalidEmailOrPhone'),\n },\n ),\n password: z\n .string()\n .min(8, t('errors.passwordLength'))\n .max(128, t('errors.longPasswordError')),\n confirmPassword: z.string(),\n })\n .refine((data) => data.password === data.confirmPassword, {\n message: t('errors.passwordsMismatch'),\n path: ['confirmPassword'],\n });\n\nexport const SignUp = ({\n onSubmit,\n isLoading = false,\n initialIdentifier,\n}: SignUpProps) => {\n const t = useTranslator('Auth.signUp');\n const hasInitialIdentifier = !!initialIdentifier;\n const [showPassword, setShowPassword] = useState(false);\n const [showConfirmPassword, setShowConfirmPassword] = useState(false);\n\n const form = useForm<SignUpFormValues>({\n resolver: zodResolver(signUpSchema(t)),\n defaultValues: {\n fullName: '',\n identifier: initialIdentifier || '',\n password: '',\n confirmPassword: '',\n },\n });\n\n useEffect(() => {\n if (initialIdentifier) {\n form.setValue('identifier', initialIdentifier);\n }\n }, [initialIdentifier, form]);\n\n const handleSubmit = form.handleSubmit(async (values) => {\n await onSubmit(values);\n });\n\n const getIdentifierLabel = () => {\n if (!hasInitialIdentifier) {\n return t('form.accountLabel') || 'Email/Phone';\n }\n if (initialIdentifier?.includes('@')) {\n return t('form.emailLabel');\n }\n return t('form.phoneLabel');\n };\n const identifierLabel = getIdentifierLabel();\n\n return (\n <form id=\"sign-up-form\" onSubmit={handleSubmit}>\n <FieldGroup>\n <Controller\n name=\"fullName\"\n control={form.control}\n render={({ field, fieldState }) => (\n <Field data-invalid={fieldState.invalid}>\n <FieldLabel htmlFor=\"sign-up-fullName\">\n {t('form.fullNameLabel')}\n </FieldLabel>\n <Input\n {...field}\n id=\"sign-up-fullName\"\n placeholder={t('form.fullNamePlaceholder')}\n aria-invalid={fieldState.invalid}\n />\n {fieldState.invalid && <FieldError errors={[fieldState.error]} />}\n </Field>\n )}\n />\n <Controller\n name=\"identifier\"\n control={form.control}\n render={({ field, fieldState }) => (\n <Field data-invalid={fieldState.invalid}>\n <FieldLabel\n htmlFor=\"sign-up-identifier\"\n className={hasInitialIdentifier ? 'block' : undefined}\n >\n {identifierLabel}\n </FieldLabel>\n <Input\n {...field}\n id=\"sign-up-identifier\"\n type={field.value.includes('@') ? 'email' : 'tel'}\n placeholder={\n hasInitialIdentifier\n ? undefined\n : t('form.accountPlaceholder') || 'Email or phone number'\n }\n disabled={hasInitialIdentifier}\n aria-invalid={fieldState.invalid}\n />\n {fieldState.invalid && <FieldError errors={[fieldState.error]} />}\n </Field>\n )}\n />\n <Controller\n name=\"password\"\n control={form.control}\n render={({ field, fieldState }) => (\n <Field data-invalid={fieldState.invalid}>\n <FieldLabel htmlFor=\"sign-up-password\">\n {t('form.passwordLabel')}\n </FieldLabel>\n <div className=\"relative\">\n <Input\n {...field}\n id=\"sign-up-password\"\n type={showPassword ? 'text' : 'password'}\n placeholder={t('form.passwordPlaceholder')}\n aria-invalid={fieldState.invalid}\n />\n <button\n type=\"button\"\n onClick={() => setShowPassword(!showPassword)}\n className=\"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground\"\n >\n {showPassword ? (\n <IconEyeOff className=\"h-4 w-4\" />\n ) : (\n <IconEye className=\"h-4 w-4\" />\n )}\n </button>\n </div>\n {fieldState.invalid && <FieldError errors={[fieldState.error]} />}\n </Field>\n )}\n />\n <Controller\n name=\"confirmPassword\"\n control={form.control}\n render={({ field, fieldState }) => (\n <Field data-invalid={fieldState.invalid}>\n <FieldLabel htmlFor=\"sign-up-confirmPassword\">\n {t('form.confirmPasswordLabel')}\n </FieldLabel>\n <div className=\"relative\">\n <Input\n {...field}\n id=\"sign-up-confirmPassword\"\n type={showConfirmPassword ? 'text' : 'password'}\n placeholder={t('form.passwordPlaceholder')}\n aria-invalid={fieldState.invalid}\n />\n <button\n type=\"button\"\n onClick={() => setShowConfirmPassword(!showConfirmPassword)}\n className=\"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground\"\n >\n {showConfirmPassword ? (\n <IconEyeOff className=\"h-4 w-4\" />\n ) : (\n <IconEye className=\"h-4 w-4\" />\n )}\n </button>\n </div>\n {fieldState.invalid && <FieldError errors={[fieldState.error]} />}\n </Field>\n )}\n />\n </FieldGroup>\n <div className=\"mt-4\">\n <Button\n type=\"submit\"\n form=\"sign-up-form\"\n className=\"w-full\"\n disabled={isLoading}\n >\n {isLoading ? t('form.submitting') : t('form.submit')}\n </Button>\n </div>\n </form>\n );\n};\n","import { createTranslator } from '../lib/translations';\nimport { useConfig } from '../provider';\n\nexport function useTranslator(namespace?: string) {\n const { config } = useConfig();\n return createTranslator(config.messages || {}, namespace);\n}\n"],"mappings":";;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa;AACtB,SAAS,uBAAuB;AAChC,SAAS,aAAAA,YAAW,YAAAC,iBAAgB;;;ACP7B,SAAS,iBAAiB,UAAoB,WAAoB;AACvE,SAAO,CAAC,KAAa,WAAqD;AACxE,UAAM,UAAU,YAAY,GAAG,SAAS,IAAI,GAAG,KAAK;AACpD,UAAM,OAAO,QAAQ,MAAM,GAAG;AAE9B,QAAI,QAAiB;AACrB,eAAW,KAAK,MAAM;AACpB,UAAI,SAAS,OAAO,UAAU,YAAY,UAAU,MAAM;AACxD,gBAAS,MAAkC,CAAC;AAAA,MAC9C,OAAO;AACL,eAAO;AAAA,MACT;AAAA,IACF;AAEA,QAAI,OAAO,UAAU,UAAU;AAC7B,aAAO;AAAA,IACT;AAGA,QAAI,QAAQ;AACV,aAAO,MAAM;AAAA,QAAQ;AAAA,QAAc,CAAC,GAAG,UACrC,OAAO,OAAO,KAAK,KAAK,IAAI,KAAK,GAAG;AAAA,MACtC;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AACF;;;AC3BA,SAAS,aAAa,2BAA2B;AACjD,SAAS,iBAAiB;AAC1B,OAAO,uBAAuB;AAC9B,OAAO,kBAAkB;AAEzB,SAAS,eAAe,YAAY,WAAW,gBAAgB;AAqGzD;AA9DN,IAAM,iBAAiB,cAA0C,IAAI;AACrE,IAAM,aAAa,cAAsC,IAAI;AAC7D,IAAM,gBAAgB,cAAyC,IA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AA;AAAA,MACC,OAAO,EAAE,OAAO;AAAA,MAChB,aAAa,EAAE,aAAa;AAAA,MAC5B;AAAA,MACA,QACE,gBAAAA,MAAC,OACE;AAAA,UAAE,mBAAmB;AAAA,QAAG;AAAA,QACxB,OACC,gBAAAD,KAAC,QAAK,MAAM,YAAY,WAAU,gCAC/B,YAAE,kBAAkB,GACvB,IAEA,gBAAAA;AAAA,UAAC;AAAA;AAAA,YACC,MAAM;AAAA,YACN,SAAS,CAAC,MAAM;AACd,gBAAE,eAAe;AACjB,yBAAW,UAAU;AAAA,YACvB;AAAA,YACA,WAAU;AAAA,YAET,YAAE,kBAAkB;AAAA;AAAA,QACvB;AAAA,SAEJ;AAAA,MAGF;AAAA,wBAAAA;AAAA,UAAC;AAAA;AAAA,YACC,UAAU;AAAA,YACV,WAAW,aAAa,eAAe;AAAA,YACvC;AAAA;AAAA,QACF;AAAA,QACC,gBACC,gBAAAC,MAAC,SAAM,SAAQ,eAAc,WAAU,QACrC;AAAA,0BAAAD,KAAC,mBAAgB,WAAU,WAAU;AAAA,UACrC,gBAAAA,KAAC,cAAY,uBAAa,OAAM;AAAA,UAChC,gBAAAA,KAAC,oBAAkB,uBAAa,aAAY;AAAA,WAC9C;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":["useEffect","useState","jsx","useEffect","useState","jsx","jsxs","useState","useEffect","jsx","jsxs","isPhone","useState","useEffect"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
|
|
3
|
-
type VerifyEmailPageProps = {
|
|
4
|
-
verificationId: string;
|
|
5
|
-
email: string;
|
|
6
|
-
redirectUrl?: string;
|
|
7
|
-
};
|
|
8
|
-
declare const VerifyEmailPage: ({ verificationId, email, redirectUrl, }: VerifyEmailPageProps) => react_jsx_runtime.JSX.Element;
|
|
9
|
-
|
|
10
|
-
export { VerifyEmailPage };
|