@rovela-ai/sdk 0.11.1 → 0.12.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/admin/api/categories.d.ts.map +1 -1
- package/dist/admin/api/categories.js +4 -0
- package/dist/admin/api/categories.js.map +1 -1
- package/dist/admin/api/orders.d.ts.map +1 -1
- package/dist/admin/api/orders.js +6 -0
- package/dist/admin/api/orders.js.map +1 -1
- package/dist/admin/api/products.d.ts.map +1 -1
- package/dist/admin/api/products.js +4 -0
- package/dist/admin/api/products.js.map +1 -1
- package/dist/admin/components/CatalogTranslationsEditor.d.ts +15 -0
- package/dist/admin/components/CatalogTranslationsEditor.d.ts.map +1 -0
- package/dist/admin/components/CatalogTranslationsEditor.js +59 -0
- package/dist/admin/components/CatalogTranslationsEditor.js.map +1 -0
- package/dist/admin/components/CategoryForm.d.ts.map +1 -1
- package/dist/admin/components/CategoryForm.js +4 -1
- package/dist/admin/components/CategoryForm.js.map +1 -1
- package/dist/admin/components/ProductForm.d.ts.map +1 -1
- package/dist/admin/components/ProductForm.js +5 -1
- package/dist/admin/components/ProductForm.js.map +1 -1
- package/dist/admin/types.d.ts +10 -0
- package/dist/admin/types.d.ts.map +1 -1
- package/dist/auth/api/register.d.ts.map +1 -1
- package/dist/auth/api/register.js +4 -1
- package/dist/auth/api/register.js.map +1 -1
- package/dist/auth/components/AddressBook.d.ts.map +1 -1
- package/dist/auth/components/AddressBook.js +10 -8
- package/dist/auth/components/AddressBook.js.map +1 -1
- package/dist/auth/components/AddressForm.d.ts.map +1 -1
- package/dist/auth/components/AddressForm.js +8 -6
- package/dist/auth/components/AddressForm.js.map +1 -1
- package/dist/auth/components/ForgotPasswordForm.d.ts.map +1 -1
- package/dist/auth/components/ForgotPasswordForm.js +4 -2
- package/dist/auth/components/ForgotPasswordForm.js.map +1 -1
- package/dist/auth/components/ResetPasswordForm.d.ts.map +1 -1
- package/dist/auth/components/ResetPasswordForm.js +10 -8
- package/dist/auth/components/ResetPasswordForm.js.map +1 -1
- package/dist/auth/components/SignInForm.d.ts.map +1 -1
- package/dist/auth/components/SignInForm.js +5 -3
- package/dist/auth/components/SignInForm.js.map +1 -1
- package/dist/auth/components/SignUpForm.d.ts.map +1 -1
- package/dist/auth/components/SignUpForm.js +7 -5
- package/dist/auth/components/SignUpForm.js.map +1 -1
- package/dist/auth/components/UserMenu.d.ts.map +1 -1
- package/dist/auth/components/UserMenu.js +4 -2
- package/dist/auth/components/UserMenu.js.map +1 -1
- package/dist/auth/components/VerifyEmailNotice.d.ts.map +1 -1
- package/dist/auth/components/VerifyEmailNotice.js +6 -4
- package/dist/auth/components/VerifyEmailNotice.js.map +1 -1
- package/dist/auth/hooks/useAuth.d.ts.map +1 -1
- package/dist/auth/hooks/useAuth.js +11 -1
- package/dist/auth/hooks/useAuth.js.map +1 -1
- package/dist/auth/server/customer-service.d.ts +1 -1
- package/dist/auth/server/customer-service.d.ts.map +1 -1
- package/dist/auth/server/customer-service.js +2 -1
- package/dist/auth/server/customer-service.js.map +1 -1
- package/dist/auth/types.d.ts +2 -0
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/cart/components/CartDrawer.js +1 -1
- package/dist/cart/components/CartDrawer.js.map +1 -1
- package/dist/cart/components/CartItem.d.ts.map +1 -1
- package/dist/cart/components/CartItem.js +4 -3
- package/dist/cart/components/CartItem.js.map +1 -1
- package/dist/cart/components/CartSummary.d.ts.map +1 -1
- package/dist/cart/components/CartSummary.js +6 -5
- package/dist/cart/components/CartSummary.js.map +1 -1
- package/dist/checkout/api/manual.d.ts.map +1 -1
- package/dist/checkout/api/manual.js +6 -0
- package/dist/checkout/api/manual.js.map +1 -1
- package/dist/checkout/components/CheckoutFlow.d.ts.map +1 -1
- package/dist/checkout/components/CheckoutFlow.js +3 -2
- package/dist/checkout/components/CheckoutFlow.js.map +1 -1
- package/dist/checkout/components/OrderSummary.d.ts.map +1 -1
- package/dist/checkout/components/OrderSummary.js +5 -3
- package/dist/checkout/components/OrderSummary.js.map +1 -1
- package/dist/checkout/components/OrderTimeline.d.ts.map +1 -1
- package/dist/checkout/components/OrderTimeline.js +8 -6
- package/dist/checkout/components/OrderTimeline.js.map +1 -1
- package/dist/checkout/components/ShippingOptions.d.ts.map +1 -1
- package/dist/checkout/components/ShippingOptions.js +6 -4
- package/dist/checkout/components/ShippingOptions.js.map +1 -1
- package/dist/checkout/hooks/useCheckout.d.ts.map +1 -1
- package/dist/checkout/hooks/useCheckout.js +6 -2
- package/dist/checkout/hooks/useCheckout.js.map +1 -1
- package/dist/checkout/server/create-checkout-session.d.ts.map +1 -1
- package/dist/checkout/server/create-checkout-session.js +1 -0
- package/dist/checkout/server/create-checkout-session.js.map +1 -1
- package/dist/checkout/server/handle-webhook.js +1 -0
- package/dist/checkout/server/handle-webhook.js.map +1 -1
- package/dist/checkout/server/order-service.d.ts.map +1 -1
- package/dist/checkout/server/order-service.js +2 -0
- package/dist/checkout/server/order-service.js.map +1 -1
- package/dist/checkout/types.d.ts +4 -0
- package/dist/checkout/types.d.ts.map +1 -1
- package/dist/core/cookie-consent/CookieBanner.d.ts.map +1 -1
- package/dist/core/cookie-consent/CookieBanner.js +7 -4
- package/dist/core/cookie-consent/CookieBanner.js.map +1 -1
- package/dist/core/db/queries.d.ts +42 -2
- package/dist/core/db/queries.d.ts.map +1 -1
- package/dist/core/db/queries.js +49 -0
- package/dist/core/db/queries.js.map +1 -1
- package/dist/core/db/schema.d.ts +88 -0
- package/dist/core/db/schema.d.ts.map +1 -1
- package/dist/core/db/schema.js +16 -0
- package/dist/core/db/schema.js.map +1 -1
- package/dist/core/i18n/LocaleLink.d.ts +27 -0
- package/dist/core/i18n/LocaleLink.d.ts.map +1 -0
- package/dist/core/i18n/LocaleLink.js +52 -0
- package/dist/core/i18n/LocaleLink.js.map +1 -0
- package/dist/core/i18n/catalog.d.ts +45 -0
- package/dist/core/i18n/catalog.d.ts.map +1 -0
- package/dist/core/i18n/catalog.js +72 -0
- package/dist/core/i18n/catalog.js.map +1 -0
- package/dist/core/i18n/index.d.ts +5 -1
- package/dist/core/i18n/index.d.ts.map +1 -1
- package/dist/core/i18n/index.js +2 -0
- package/dist/core/i18n/index.js.map +1 -1
- package/dist/core/i18n/messages/en.d.ts.map +1 -1
- package/dist/core/i18n/messages/en.js +99 -0
- package/dist/core/i18n/messages/en.js.map +1 -1
- package/dist/core/i18n/messages/fr.d.ts.map +1 -1
- package/dist/core/i18n/messages/fr.js +99 -0
- package/dist/core/i18n/messages/fr.js.map +1 -1
- package/dist/core/i18n/resolve.d.ts +15 -3
- package/dist/core/i18n/resolve.d.ts.map +1 -1
- package/dist/core/i18n/resolve.js +7 -5
- package/dist/core/i18n/resolve.js.map +1 -1
- package/dist/core/server/index.d.ts +3 -0
- package/dist/core/server/index.d.ts.map +1 -1
- package/dist/core/server/index.js +3 -0
- package/dist/core/server/index.js.map +1 -1
- package/dist/core/server/locale-metadata.d.ts +32 -0
- package/dist/core/server/locale-metadata.d.ts.map +1 -0
- package/dist/core/server/locale-metadata.js +65 -0
- package/dist/core/server/locale-metadata.js.map +1 -0
- package/dist/core/server/request-locale.d.ts +24 -0
- package/dist/core/server/request-locale.d.ts.map +1 -0
- package/dist/core/server/request-locale.js +44 -0
- package/dist/core/server/request-locale.js.map +1 -0
- package/dist/emails/i18n.d.ts +27 -0
- package/dist/emails/i18n.d.ts.map +1 -0
- package/dist/emails/i18n.js +273 -0
- package/dist/emails/i18n.js.map +1 -0
- package/dist/emails/send/auth.d.ts +6 -0
- package/dist/emails/send/auth.d.ts.map +1 -1
- package/dist/emails/send/auth.js +3 -0
- package/dist/emails/send/auth.js.map +1 -1
- package/dist/emails/send/orders.d.ts +12 -0
- package/dist/emails/send/orders.d.ts.map +1 -1
- package/dist/emails/send/orders.js +6 -0
- package/dist/emails/send/orders.js.map +1 -1
- package/dist/emails/sender.d.ts.map +1 -1
- package/dist/emails/sender.js +3 -2
- package/dist/emails/sender.js.map +1 -1
- package/dist/emails/types.d.ts +2 -0
- package/dist/emails/types.d.ts.map +1 -1
- package/dist/products/api/product.d.ts +1 -1
- package/dist/products/api/product.d.ts.map +1 -1
- package/dist/products/api/product.js +5 -2
- package/dist/products/api/product.js.map +1 -1
- package/dist/products/api/products.d.ts.map +1 -1
- package/dist/products/api/products.js +7 -1
- package/dist/products/api/products.js.map +1 -1
- package/dist/products/components/ProductCard.js +1 -1
- package/dist/products/components/ProductCard.js.map +1 -1
- package/dist/products/hooks/useProduct.d.ts.map +1 -1
- package/dist/products/hooks/useProduct.js +4 -2
- package/dist/products/hooks/useProduct.js.map +1 -1
- package/dist/products/hooks/useProducts.d.ts.map +1 -1
- package/dist/products/hooks/useProducts.js +4 -1
- package/dist/products/hooks/useProducts.js.map +1 -1
- package/package.json +1 -1
|
@@ -9,6 +9,7 @@ import { useState, useCallback } from 'react';
|
|
|
9
9
|
import { Mail } from 'lucide-react';
|
|
10
10
|
import { useAuth } from '../hooks/useAuth';
|
|
11
11
|
import { Label } from './Label';
|
|
12
|
+
import { useT } from '../../core/i18n';
|
|
12
13
|
/**
|
|
13
14
|
* Forgot password form for requesting password reset email.
|
|
14
15
|
*
|
|
@@ -22,6 +23,7 @@ import { Label } from './Label';
|
|
|
22
23
|
* ```
|
|
23
24
|
*/
|
|
24
25
|
export function ForgotPasswordForm({ onSuccess, signInHref = '/auth/signin', className = '', }) {
|
|
26
|
+
const t = useT();
|
|
25
27
|
const { requestPasswordReset } = useAuth();
|
|
26
28
|
const [email, setEmail] = useState('');
|
|
27
29
|
const [isLoading, setIsLoading] = useState(false);
|
|
@@ -36,8 +38,8 @@ export function ForgotPasswordForm({ onSuccess, signInHref = '/auth/signin', cla
|
|
|
36
38
|
}, [email, requestPasswordReset, onSuccess]);
|
|
37
39
|
// Show success state
|
|
38
40
|
if (success) {
|
|
39
|
-
return (_jsx("div", { className: `w-full max-w-md ${className}`, children: _jsxs("div", { className: "rounded-md bg-green-50 p-6 text-center", children: [_jsx(Mail, { className: "mx-auto h-12 w-12 text-green-500" }), _jsx("h3", { className: "mt-4 text-lg font-medium text-green-800", children:
|
|
41
|
+
return (_jsx("div", { className: `w-full max-w-md ${className}`, children: _jsxs("div", { className: "rounded-md bg-green-50 p-6 text-center", children: [_jsx(Mail, { className: "mx-auto h-12 w-12 text-green-500" }), _jsx("h3", { className: "mt-4 text-lg font-medium text-green-800", children: t('auth.checkYourEmail') }), _jsx("p", { className: "mt-2 text-sm text-green-600", children: t('auth.forgotSuccessBody') }), _jsx("a", { href: signInHref, className: "mt-4 inline-block text-sm font-medium text-green-700 hover:text-green-800", children: "Back to sign in" })] }) }));
|
|
40
42
|
}
|
|
41
|
-
return (_jsxs("div", { className: `w-full max-w-md ${className}`, children: [_jsxs("div", { className: "mb-6 text-center", children: [_jsx("h2", { className: "text-xl font-semibold text-foreground", children: "Forgot your password?" }), _jsx("p", { className: "mt-2 text-sm text-muted-foreground", children:
|
|
43
|
+
return (_jsxs("div", { className: `w-full max-w-md ${className}`, children: [_jsxs("div", { className: "mb-6 text-center", children: [_jsx("h2", { className: "text-xl font-semibold text-foreground", children: "Forgot your password?" }), _jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: t('auth.forgotIntro') })] }), _jsxs("form", { onSubmit: handleSubmit, className: "space-y-4", children: [_jsxs("div", { children: [_jsx(Label, { htmlFor: "forgot-email", required: true, children: t('form.email') }), _jsx("input", { id: "forgot-email", type: "email", value: email, onChange: (e) => setEmail(e.target.value), required: true, autoComplete: "email", className: "mt-1 block w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary", placeholder: t('form.emailPlaceholder') })] }), _jsx("button", { type: "submit", disabled: isLoading, className: "w-full rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", children: isLoading ? t('auth.sending') : t('auth.sendResetLink') }), _jsxs("p", { className: "text-center text-sm text-muted-foreground", children: ["Remember your password?", ' ', _jsx("a", { href: signInHref, className: "font-medium text-primary hover:text-primary/80", children: "Sign in" })] })] })] }));
|
|
42
44
|
}
|
|
43
45
|
//# sourceMappingURL=ForgotPasswordForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ForgotPasswordForm.js","sourceRoot":"","sources":["../../../src/auth/components/ForgotPasswordForm.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"ForgotPasswordForm.js","sourceRoot":"","sources":["../../../src/auth/components/ForgotPasswordForm.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAEtC;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kBAAkB,CAAC,EACjC,SAAS,EACT,UAAU,GAAG,cAAc,EAC3B,SAAS,GAAG,EAAE,GACU;IACxB,MAAM,CAAC,GAAG,IAAI,EAAE,CAAA;IAChB,MAAM,EAAE,oBAAoB,EAAE,GAAG,OAAO,EAAE,CAAA;IAE1C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAA;IACtC,M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AAO,EAAC,cAAc,EAAC,QAAQ,kBACnC,CAAC,CAAC,YAAY,CAAC,GACV,EACR,gBACE,EAAE,EAAC,cAAc,EACjB,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EACzC,QAAQ,QACR,YAAY,EAAC,OAAO,EACpB,SAAS,EAAC,4LAA4L,EACtM,WAAW,EAAE,CAAC,CAAC,uBAAuB,CAAC,GACvC,IACE,EAGN,iBACE,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,SAAS,EACnB,SAAS,EAAC,+NAA+N,YAExO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,GACjD,EAGT,aAAG,SAAS,EAAC,2CAA2C,wCAC9B,GAAG,EAC3B,YAAG,IAAI,EAAE,UAAU,EAAE,SAAS,EAAC,gDAAgD,wBAE3E,IACF,IACC,IACH,CACP,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResetPasswordForm.d.ts","sourceRoot":"","sources":["../../../src/auth/components/ResetPasswordForm.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"ResetPasswordForm.d.ts","sourceRoot":"","sources":["../../../src/auth/components/ResetPasswordForm.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAGtD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,SAAS,EACT,UAA2B,EAC3B,SAAc,GACf,EAAE,sBAAsB,2CA8LxB"}
|
|
@@ -9,6 +9,7 @@ import { useState, useCallback, useEffect } from 'react';
|
|
|
9
9
|
import { AlertTriangle, CheckCircle } from 'lucide-react';
|
|
10
10
|
import { useAuth } from '../hooks/useAuth';
|
|
11
11
|
import { Label } from './Label';
|
|
12
|
+
import { useT } from '../../core/i18n';
|
|
12
13
|
/**
|
|
13
14
|
* Reset password form for setting a new password with a token.
|
|
14
15
|
*
|
|
@@ -25,6 +26,7 @@ import { Label } from './Label';
|
|
|
25
26
|
* ```
|
|
26
27
|
*/
|
|
27
28
|
export function ResetPasswordForm({ token, onSuccess, signInHref = '/auth/signin', className = '', }) {
|
|
29
|
+
const t = useT();
|
|
28
30
|
const { validateResetToken, resetPassword } = useAuth();
|
|
29
31
|
const [password, setPassword] = useState('');
|
|
30
32
|
const [confirmPassword, setConfirmPassword] = useState('');
|
|
@@ -39,24 +41,24 @@ export function ResetPasswordForm({ token, onSuccess, signInHref = '/auth/signin
|
|
|
39
41
|
const result = await validateResetToken(token);
|
|
40
42
|
setIsValidating(false);
|
|
41
43
|
if (!result.valid) {
|
|
42
|
-
setTokenError(result.error || '
|
|
44
|
+
setTokenError(result.error || t('auth.invalidResetLink'));
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
validateToken();
|
|
46
|
-
}, [token, validateResetToken]);
|
|
48
|
+
}, [token, validateResetToken, t]);
|
|
47
49
|
const handleSubmit = useCallback(async (e) => {
|
|
48
50
|
e.preventDefault();
|
|
49
51
|
setIsLoading(true);
|
|
50
52
|
setError(null);
|
|
51
53
|
// Validate passwords match
|
|
52
54
|
if (password !== confirmPassword) {
|
|
53
|
-
setError('
|
|
55
|
+
setError(t('auth.passwordsNoMatch'));
|
|
54
56
|
setIsLoading(false);
|
|
55
57
|
return;
|
|
56
58
|
}
|
|
57
59
|
// Validate password length
|
|
58
60
|
if (password.length < 8) {
|
|
59
|
-
setError('
|
|
61
|
+
setError(t('auth.password8'));
|
|
60
62
|
setIsLoading(false);
|
|
61
63
|
return;
|
|
62
64
|
}
|
|
@@ -67,9 +69,9 @@ export function ResetPasswordForm({ token, onSuccess, signInHref = '/auth/signin
|
|
|
67
69
|
onSuccess?.();
|
|
68
70
|
}
|
|
69
71
|
else {
|
|
70
|
-
setError(result.error || '
|
|
72
|
+
setError(result.error || t('auth.resetFailed'));
|
|
71
73
|
}
|
|
72
|
-
}, [password, confirmPassword, token, resetPassword, onSuccess]);
|
|
74
|
+
}, [password, confirmPassword, token, resetPassword, onSuccess, t]);
|
|
73
75
|
// Loading state while validating token
|
|
74
76
|
if (isValidating) {
|
|
75
77
|
return (_jsx("div", { className: `w-full max-w-md ${className}`, children: _jsxs("div", { className: "text-center", children: [_jsx("div", { className: "mx-auto h-8 w-8 animate-spin rounded-full border-2 border-primary border-t-transparent" }), _jsx("p", { className: "mt-4 text-sm text-muted-foreground", children: "Validating reset link..." })] }) }));
|
|
@@ -80,8 +82,8 @@ export function ResetPasswordForm({ token, onSuccess, signInHref = '/auth/signin
|
|
|
80
82
|
}
|
|
81
83
|
// Show success state
|
|
82
84
|
if (success) {
|
|
83
|
-
return (_jsx("div", { className: `w-full max-w-md ${className}`, children: _jsxs("div", { className: "rounded-md bg-green-50 p-6 text-center", children: [_jsx(CheckCircle, { className: "mx-auto h-12 w-12 text-green-500" }), _jsx("h3", { className: "mt-4 text-lg font-medium text-green-800", children: "Password Reset Successfully" }), _jsx("p", { className: "mt-2 text-sm text-green-600", children: "Your password has been updated. You can now sign in with your new password." }), _jsx("a", { href: signInHref, className: "mt-4 inline-block rounded-md bg-green-600 px-4 py-2 text-sm font-medium text-white hover:bg-green-700", children:
|
|
85
|
+
return (_jsx("div", { className: `w-full max-w-md ${className}`, children: _jsxs("div", { className: "rounded-md bg-green-50 p-6 text-center", children: [_jsx(CheckCircle, { className: "mx-auto h-12 w-12 text-green-500" }), _jsx("h3", { className: "mt-4 text-lg font-medium text-green-800", children: "Password Reset Successfully" }), _jsx("p", { className: "mt-2 text-sm text-green-600", children: "Your password has been updated. You can now sign in with your new password." }), _jsx("a", { href: signInHref, className: "mt-4 inline-block rounded-md bg-green-600 px-4 py-2 text-sm font-medium text-white hover:bg-green-700", children: t('auth.signIn') })] }) }));
|
|
84
86
|
}
|
|
85
|
-
return (_jsxs("div", { className: `w-full max-w-md ${className}`, children: [_jsxs("div", { className: "mb-6 text-center", children: [_jsx("h2", { className: "text-xl font-semibold text-foreground", children:
|
|
87
|
+
return (_jsxs("div", { className: `w-full max-w-md ${className}`, children: [_jsxs("div", { className: "mb-6 text-center", children: [_jsx("h2", { className: "text-xl font-semibold text-foreground", children: t('auth.resetTitle') }), _jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: "Enter your new password below." })] }), _jsxs("form", { onSubmit: handleSubmit, className: "space-y-4", children: [error && (_jsx("div", { className: "rounded-md bg-red-50 p-4 text-sm text-red-600", children: error })), _jsxs("div", { children: [_jsx(Label, { htmlFor: "reset-password", required: true, children: t('auth.newPassword') }), _jsx("input", { id: "reset-password", type: "password", value: password, onChange: (e) => setPassword(e.target.value), required: true, autoComplete: "new-password", minLength: 8, className: "mt-1 block w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary", placeholder: t('auth.atLeast8') })] }), _jsxs("div", { children: [_jsx(Label, { htmlFor: "reset-confirm-password", required: true, children: t('auth.confirmNewPassword') }), _jsx("input", { id: "reset-confirm-password", type: "password", value: confirmPassword, onChange: (e) => setConfirmPassword(e.target.value), required: true, autoComplete: "new-password", minLength: 8, className: "mt-1 block w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary", placeholder: t('auth.confirmYourPassword') })] }), _jsx("button", { type: "submit", disabled: isLoading, className: "w-full rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", children: isLoading ? t('auth.resetting') : t('auth.resetPassword') }), _jsx("p", { className: "text-center text-sm text-muted-foreground", children: _jsx("a", { href: signInHref, className: "font-medium text-primary hover:text-primary/80", children: "Back to sign in" }) })] })] }));
|
|
86
88
|
}
|
|
87
89
|
//# sourceMappingURL=ResetPasswordForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResetPasswordForm.js","sourceRoot":"","sources":["../../../src/auth/components/ResetPasswordForm.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"ResetPasswordForm.js","sourceRoot":"","sources":["../../../src/auth/components/ResetPasswordForm.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAEtC;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAChC,KAAK,EACL,SAAS,EACT,UAAU,GAAG,cAAc,EAC3B,SAAS,GAAG,EAAE,GACS;IACvB,MAAM,CAAC,GAAG,IAAI,EAAE,CAAA;IAChB,MAAM,EAAE,kBAAkB,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAA;IAEvD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAA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E,KAAC,KAAK,IAAC,OAAO,EAAC,wBAAwB,EAAC,QAAQ,kBAC7C,CAAC,CAAC,yBAAyB,CAAC,GACvB,EACR,gBACE,EAAE,EAAC,wBAAwB,EAC3B,IAAI,EAAC,UAAU,EACf,KAAK,EAAE,eAAe,EACtB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EACnD,QAAQ,QACR,YAAY,EAAC,cAAc,EAC3B,SAAS,EAAE,CAAC,EACZ,SAAS,EAAC,4LAA4L,EACtM,WAAW,EAAE,CAAC,CAAC,0BAA0B,CAAC,GAC1C,IACE,EAGN,iBACE,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,SAAS,EACnB,SAAS,EAAC,+NAA+N,YAExO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,GACnD,EAGT,YAAG,SAAS,EAAC,2CAA2C,YACtD,YAAG,IAAI,EAAE,UAAU,EAAE,SAAS,EAAC,gDAAgD,gCAE3E,GACF,IACC,IACH,CACP,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignInForm.d.ts","sourceRoot":"","sources":["../../../src/auth/components/SignInForm.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"SignInForm.d.ts","sourceRoot":"","sources":["../../../src/auth/components/SignInForm.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAG/C;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,UAAU,CAAC,EACzB,UAAU,EACV,SAAS,EACT,cAAqB,EACrB,UAA2B,EAC3B,kBAA4C,EAC5C,SAAc,GACf,EAAE,eAAe,2CAwIjB"}
|
|
@@ -8,6 +8,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
8
8
|
import { useState, useCallback } from 'react';
|
|
9
9
|
import { useAuth } from '../hooks/useAuth';
|
|
10
10
|
import { Label } from './Label';
|
|
11
|
+
import { useT } from '../../core/i18n';
|
|
11
12
|
/**
|
|
12
13
|
* Sign in form for customer authentication.
|
|
13
14
|
*
|
|
@@ -27,6 +28,7 @@ import { Label } from './Label';
|
|
|
27
28
|
* ```
|
|
28
29
|
*/
|
|
29
30
|
export function SignInForm({ redirectTo, onSuccess, showRememberMe = true, signUpHref = '/auth/signup', forgotPasswordHref = '/auth/forgot-password', className = '', }) {
|
|
31
|
+
const t = useT();
|
|
30
32
|
const { signIn } = useAuth();
|
|
31
33
|
const [email, setEmail] = useState('');
|
|
32
34
|
const [password, setPassword] = useState('');
|
|
@@ -53,9 +55,9 @@ export function SignInForm({ redirectTo, onSuccess, showRememberMe = true, signU
|
|
|
53
55
|
if (result.requiresVerification) {
|
|
54
56
|
setRequiresVerification(true);
|
|
55
57
|
}
|
|
56
|
-
setError(result.error || '
|
|
58
|
+
setError(result.error || t('auth.signInFailed'));
|
|
57
59
|
}
|
|
58
|
-
}, [email, password, rememberMe, redirectTo, signIn, onSuccess]);
|
|
59
|
-
return (_jsx("div", { className: `w-full max-w-md ${className}`, children: _jsxs("form", { onSubmit: handleSubmit, className: "space-y-4", children: [error && (_jsxs("div", { className: "rounded-md bg-red-50 p-4 text-sm text-red-600", children: [error, requiresVerification && (_jsx("p", { className: "mt-2", children: _jsx("a", { href: `/auth/resend-verification?email=${encodeURIComponent(email)}`, className: "font-medium text-red-700 underline hover:text-red-800", children: "Resend verification email" }) }))] })), _jsxs("div", { children: [_jsx(Label, { htmlFor: "signin-email", required: true, children:
|
|
60
|
+
}, [email, password, rememberMe, redirectTo, signIn, onSuccess, t]);
|
|
61
|
+
return (_jsx("div", { className: `w-full max-w-md ${className}`, children: _jsxs("form", { onSubmit: handleSubmit, className: "space-y-4", children: [error && (_jsxs("div", { className: "rounded-md bg-red-50 p-4 text-sm text-red-600", children: [error, requiresVerification && (_jsx("p", { className: "mt-2", children: _jsx("a", { href: `/auth/resend-verification?email=${encodeURIComponent(email)}`, className: "font-medium text-red-700 underline hover:text-red-800", children: "Resend verification email" }) }))] })), _jsxs("div", { children: [_jsx(Label, { htmlFor: "signin-email", required: true, children: t('form.email') }), _jsx("input", { id: "signin-email", type: "email", value: email, onChange: (e) => setEmail(e.target.value), required: true, autoComplete: "email", className: "mt-1 block w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary", placeholder: t('form.emailPlaceholder') })] }), _jsxs("div", { children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx(Label, { htmlFor: "signin-password", required: true, children: t('auth.password') }), _jsx("a", { href: forgotPasswordHref, className: "text-sm text-primary hover:text-primary/80", children: t('auth.forgotPassword') })] }), _jsx("input", { id: "signin-password", type: "password", value: password, onChange: (e) => setPassword(e.target.value), required: true, autoComplete: "current-password", className: "mt-1 block w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary", placeholder: t('auth.enterPassword') })] }), showRememberMe && (_jsxs("div", { className: "flex items-center", children: [_jsx("input", { id: "remember-me", type: "checkbox", checked: rememberMe, onChange: (e) => setRememberMe(e.target.checked), className: "h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary" }), _jsx("label", { htmlFor: "remember-me", className: "ml-2 block text-sm text-muted-foreground", children: t('auth.rememberMe') })] })), _jsx("button", { type: "submit", disabled: isLoading, className: "w-full rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", children: isLoading ? t('auth.signingIn') : t('auth.signIn') }), _jsxs("p", { className: "text-center text-sm text-muted-foreground", children: ["Don't have an account?", ' ', _jsx("a", { href: signUpHref, className: "font-medium text-primary hover:text-primary/80", children: "Sign up" })] })] }) }));
|
|
60
62
|
}
|
|
61
63
|
//# sourceMappingURL=SignInForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignInForm.js","sourceRoot":"","sources":["../../../src/auth/components/SignInForm.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"SignInForm.js","sourceRoot":"","sources":["../../../src/auth/components/SignInForm.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAEtC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,UAAU,EACV,SAAS,EACT,cAAc,GAAG,IAAI,EACrB,UAAU,GAAG,cAAc,EAC3B,kBAAkB,GAAG,uBAAuB,EAC5C,SAAS,GAAG,EAAE,GACE;IAChB,MAAM,CAAC,GAAG,IAAI,EAAE,CAAA;IAChB,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,CAAA;IAE5B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAA;IACtC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAA;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ACf,OAAO,EAAE,UAAU,EACnB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAChD,SAAS,EAAC,iEAAiE,GAC3E,EACF,gBACE,OAAO,EAAC,aAAa,EACrB,SAAS,EAAC,0CAA0C,YAEnD,CAAC,CAAC,iBAAiB,CAAC,GACf,IACJ,CACP,EAGD,iBACE,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,SAAS,EACnB,SAAS,EAAC,+NAA+N,YAExO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,GAC5C,EAGT,aAAG,SAAS,EAAC,2CAA2C,uCAC1B,GAAG,EAC/B,YAAG,IAAI,EAAE,UAAU,EAAE,SAAS,EAAC,gDAAgD,wBAE3E,IACF,IACC,GACH,CACP,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignUpForm.d.ts","sourceRoot":"","sources":["../../../src/auth/components/SignUpForm.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"SignUpForm.d.ts","sourceRoot":"","sources":["../../../src/auth/components/SignUpForm.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAG/C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,UAAU,CAAC,EACzB,UAAU,EACV,SAAS,EACT,UAA2B,EAC3B,SAAc,GACf,EAAE,eAAe,2CA+KjB"}
|
|
@@ -9,6 +9,7 @@ import { useState, useCallback } from 'react';
|
|
|
9
9
|
import { CheckCircle } from 'lucide-react';
|
|
10
10
|
import { useAuth } from '../hooks/useAuth';
|
|
11
11
|
import { Label } from './Label';
|
|
12
|
+
import { useT } from '../../core/i18n';
|
|
12
13
|
/**
|
|
13
14
|
* Sign up form for customer registration.
|
|
14
15
|
*
|
|
@@ -25,6 +26,7 @@ import { Label } from './Label';
|
|
|
25
26
|
* ```
|
|
26
27
|
*/
|
|
27
28
|
export function SignUpForm({ redirectTo, onSuccess, signInHref = '/auth/signin', className = '', }) {
|
|
29
|
+
const t = useT();
|
|
28
30
|
const { signUp } = useAuth();
|
|
29
31
|
const [name, setName] = useState('');
|
|
30
32
|
const [email, setEmail] = useState('');
|
|
@@ -39,13 +41,13 @@ export function SignUpForm({ redirectTo, onSuccess, signInHref = '/auth/signin',
|
|
|
39
41
|
setError(null);
|
|
40
42
|
// Validate passwords match
|
|
41
43
|
if (password !== confirmPassword) {
|
|
42
|
-
setError('
|
|
44
|
+
setError(t('auth.passwordsNoMatch'));
|
|
43
45
|
setIsLoading(false);
|
|
44
46
|
return;
|
|
45
47
|
}
|
|
46
48
|
// Validate password length
|
|
47
49
|
if (password.length < 8) {
|
|
48
|
-
setError('
|
|
50
|
+
setError(t('auth.password8'));
|
|
49
51
|
setIsLoading(false);
|
|
50
52
|
return;
|
|
51
53
|
}
|
|
@@ -66,13 +68,13 @@ export function SignUpForm({ redirectTo, onSuccess, signInHref = '/auth/signin',
|
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
70
|
else {
|
|
69
|
-
setError(result.error || '
|
|
71
|
+
setError(result.error || t('auth.createAccountFailed'));
|
|
70
72
|
}
|
|
71
|
-
}, [name, email, password, confirmPassword, signUp, onSuccess, redirectTo]);
|
|
73
|
+
}, [name, email, password, confirmPassword, signUp, onSuccess, redirectTo, t]);
|
|
72
74
|
// Show success state
|
|
73
75
|
if (success) {
|
|
74
76
|
return (_jsx("div", { className: `w-full max-w-md ${className}`, children: _jsxs("div", { className: "rounded-md bg-green-50 p-6 text-center", children: [_jsx(CheckCircle, { className: "mx-auto h-12 w-12 text-green-500" }), _jsx("h3", { className: "mt-4 text-lg font-medium text-green-800", children: "Account created!" }), _jsx("p", { className: "mt-2 text-sm text-green-600", children: "Please check your email to verify your account before signing in." }), _jsx("a", { href: signInHref, className: "mt-4 inline-block text-sm font-medium text-green-700 hover:text-green-800", children: "Go to sign in" })] }) }));
|
|
75
77
|
}
|
|
76
|
-
return (_jsx("div", { className: `w-full max-w-md ${className}`, children: _jsxs("form", { onSubmit: handleSubmit, className: "space-y-4", children: [error && (_jsx("div", { className: "rounded-md bg-red-50 p-4 text-sm text-red-600", children: error })), _jsxs("div", { children: [_jsxs(Label, { htmlFor: "signup-name", children: ["
|
|
78
|
+
return (_jsx("div", { className: `w-full max-w-md ${className}`, children: _jsxs("form", { onSubmit: handleSubmit, className: "space-y-4", children: [error && (_jsx("div", { className: "rounded-md bg-red-50 p-4 text-sm text-red-600", children: error })), _jsxs("div", { children: [_jsxs(Label, { htmlFor: "signup-name", children: [t('auth.name'), " ", _jsx("span", { className: "text-muted-foreground", children: t('auth.optionalSuffix') })] }), _jsx("input", { id: "signup-name", type: "text", value: name, onChange: (e) => setName(e.target.value), autoComplete: "name", className: "mt-1 block w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary", placeholder: t('auth.namePlaceholder') })] }), _jsxs("div", { children: [_jsx(Label, { htmlFor: "signup-email", required: true, children: t('form.email') }), _jsx("input", { id: "signup-email", type: "email", value: email, onChange: (e) => setEmail(e.target.value), required: true, autoComplete: "email", className: "mt-1 block w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary", placeholder: t('form.emailPlaceholder') })] }), _jsxs("div", { children: [_jsx(Label, { htmlFor: "signup-password", required: true, children: t('auth.password') }), _jsx("input", { id: "signup-password", type: "password", value: password, onChange: (e) => setPassword(e.target.value), required: true, autoComplete: "new-password", minLength: 8, className: "mt-1 block w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary", placeholder: t('auth.atLeast8') })] }), _jsxs("div", { children: [_jsx(Label, { htmlFor: "signup-confirm-password", required: true, children: t('auth.confirmPassword') }), _jsx("input", { id: "signup-confirm-password", type: "password", value: confirmPassword, onChange: (e) => setConfirmPassword(e.target.value), required: true, autoComplete: "new-password", minLength: 8, className: "mt-1 block w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary", placeholder: t('auth.confirmYourPassword') })] }), _jsx("button", { type: "submit", disabled: isLoading, className: "w-full rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", children: isLoading ? t('auth.creatingAccount') : t('auth.createAccount') }), _jsxs("p", { className: "text-center text-sm text-muted-foreground", children: ["Already have an account?", ' ', _jsx("a", { href: signInHref, className: "font-medium text-primary hover:text-primary/80", children: "Sign in" })] })] }) }));
|
|
77
79
|
}
|
|
78
80
|
//# sourceMappingURL=SignUpForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignUpForm.js","sourceRoot":"","sources":["../../../src/auth/components/SignUpForm.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"SignUpForm.js","sourceRoot":"","sources":["../../../src/auth/components/SignUpForm.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAC7C,OAAO,E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AAE,aAAa,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"UserMenu.d.ts","sourceRoot":"","sources":["../../../src/auth/components/UserMenu.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAG7C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,QAAQ,CAAC,EACvB,WAAwB,EACxB,UAA8B,EAC9B,YAAkC,EAClC,SAAc,GACf,EAAE,aAAa,2CAsJf"}
|
|
@@ -8,6 +8,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
8
8
|
import { useState, useCallback, useRef, useEffect } from 'react';
|
|
9
9
|
import { User, ChevronDown, ShoppingBag, Settings, LogOut } from 'lucide-react';
|
|
10
10
|
import { useAuth } from '../hooks/useAuth';
|
|
11
|
+
import { useT } from '../../core/i18n';
|
|
11
12
|
/**
|
|
12
13
|
* User menu dropdown for authenticated customers.
|
|
13
14
|
*
|
|
@@ -24,6 +25,7 @@ import { useAuth } from '../hooks/useAuth';
|
|
|
24
25
|
* ```
|
|
25
26
|
*/
|
|
26
27
|
export function UserMenu({ accountHref = '/account', ordersHref = '/account/orders', settingsHref = '/account/settings', className = '', }) {
|
|
28
|
+
const t = useT();
|
|
27
29
|
const { customer, isAuthenticated, isLoading, signOut } = useAuth();
|
|
28
30
|
const [isOpen, setIsOpen] = useState(false);
|
|
29
31
|
const menuRef = useRef(null);
|
|
@@ -57,7 +59,7 @@ export function UserMenu({ accountHref = '/account', ordersHref = '/account/orde
|
|
|
57
59
|
}
|
|
58
60
|
// Not authenticated - show sign in link
|
|
59
61
|
if (!isAuthenticated || !customer) {
|
|
60
|
-
return (_jsx("div", { className: `relative ${className}`, children: _jsxs("a", { href: "/auth/signin", className: "flex items-center gap-2 text-sm font-medium text-foreground hover:text-primary", children: [_jsx(User, { className: "h-5 w-5" }), _jsx("span", { children:
|
|
62
|
+
return (_jsx("div", { className: `relative ${className}`, children: _jsxs("a", { href: "/auth/signin", className: "flex items-center gap-2 text-sm font-medium text-foreground hover:text-primary", children: [_jsx(User, { className: "h-5 w-5" }), _jsx("span", { children: t('auth.signIn') })] }) }));
|
|
61
63
|
}
|
|
62
64
|
// Get initials for avatar
|
|
63
65
|
const initials = customer.name
|
|
@@ -68,6 +70,6 @@ export function UserMenu({ accountHref = '/account', ordersHref = '/account/orde
|
|
|
68
70
|
.toUpperCase()
|
|
69
71
|
.slice(0, 2)
|
|
70
72
|
: customer.email[0].toUpperCase();
|
|
71
|
-
return (_jsxs("div", { className: `relative ${className}`, ref: menuRef, children: [_jsxs("button", { type: "button", onClick: () => setIsOpen(!isOpen), className: "flex items-center gap-2 rounded-full focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2", "aria-expanded": isOpen, "aria-haspopup": "true", children: [_jsx("div", { className: "flex h-8 w-8 items-center justify-center rounded-full bg-primary text-xs font-medium text-primary-foreground", children: initials }), _jsx(ChevronDown, { className: `h-4 w-4 text-muted-foreground transition-transform ${isOpen ? 'rotate-180' : ''}` })] }), isOpen && (_jsxs("div", { className: "absolute right-0 z-50 mt-2 w-56 origin-top-right rounded-md border border-border bg-background shadow-lg ring-1 ring-black ring-opacity-5", children: [_jsxs("div", { className: "border-b border-border px-4 py-3", children: [_jsx("p", { className: "text-sm font-medium text-foreground", children: customer.name || '
|
|
73
|
+
return (_jsxs("div", { className: `relative ${className}`, ref: menuRef, children: [_jsxs("button", { type: "button", onClick: () => setIsOpen(!isOpen), className: "flex items-center gap-2 rounded-full focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2", "aria-expanded": isOpen, "aria-haspopup": "true", children: [_jsx("div", { className: "flex h-8 w-8 items-center justify-center rounded-full bg-primary text-xs font-medium text-primary-foreground", children: initials }), _jsx(ChevronDown, { className: `h-4 w-4 text-muted-foreground transition-transform ${isOpen ? 'rotate-180' : ''}` })] }), isOpen && (_jsxs("div", { className: "absolute right-0 z-50 mt-2 w-56 origin-top-right rounded-md border border-border bg-background shadow-lg ring-1 ring-black ring-opacity-5", children: [_jsxs("div", { className: "border-b border-border px-4 py-3", children: [_jsx("p", { className: "text-sm font-medium text-foreground", children: customer.name || t('auth.customer') }), _jsx("p", { className: "truncate text-xs text-muted-foreground", children: customer.email }), !customer.emailVerified && (_jsx("p", { className: "mt-1 text-xs text-amber-600", children: "Email not verified" }))] }), _jsxs("div", { className: "py-1", children: [_jsxs("a", { href: accountHref, className: "flex items-center gap-2 px-4 py-2 text-sm text-foreground hover:bg-muted", onClick: () => setIsOpen(false), children: [_jsx(User, { className: "h-4 w-4 text-muted-foreground" }), t('auth.myAccount')] }), _jsxs("a", { href: ordersHref, className: "flex items-center gap-2 px-4 py-2 text-sm text-foreground hover:bg-muted", onClick: () => setIsOpen(false), children: [_jsx(ShoppingBag, { className: "h-4 w-4 text-muted-foreground" }), t('auth.orders')] }), _jsxs("a", { href: settingsHref, className: "flex items-center gap-2 px-4 py-2 text-sm text-foreground hover:bg-muted", onClick: () => setIsOpen(false), children: [_jsx(Settings, { className: "h-4 w-4 text-muted-foreground" }), t('auth.settings')] })] }), _jsx("div", { className: "border-t border-border py-1", children: _jsxs("button", { type: "button", onClick: handleSignOut, className: "flex w-full items-center gap-2 px-4 py-2 text-sm text-foreground hover:bg-muted", children: [_jsx(LogOut, { className: "h-4 w-4 text-muted-foreground" }), t('auth.signOut')] }) })] }))] }));
|
|
72
74
|
}
|
|
73
75
|
//# sourceMappingURL=UserMenu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserMenu.js","sourceRoot":"","sources":["../../../src/auth/components/UserMenu.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAChE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,cAA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ClB,EACJ,aACE,IAAI,EAAE,UAAU,EAChB,SAAS,EAAC,0EAA0E,EACpF,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,aAE/B,KAAC,WAAW,IAAC,SAAS,EAAC,+BAA+B,GAAG,EACxD,CAAC,CAAC,aAAa,CAAC,IACf,EACJ,aACE,IAAI,EAAE,YAAY,EAClB,SAAS,EAAC,0EAA0E,EACpF,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,aAE/B,KAAC,QAAQ,IAAC,SAAS,EAAC,+BAA+B,GAAG,EACrD,CAAC,CAAC,eAAe,CAAC,IACjB,IACA,EAGN,cAAK,SAAS,EAAC,6BAA6B,YAC1C,kBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,aAAa,EACtB,SAAS,EAAC,iFAAiF,aAE3F,KAAC,MAAM,IAAC,SAAS,EAAC,+BAA+B,GAAG,EACnD,CAAC,CAAC,cAAc,CAAC,IACX,GACL,IACF,CACP,IACG,CACP,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VerifyEmailNotice.d.ts","sourceRoot":"","sources":["../../../src/auth/components/VerifyEmailNotice.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"VerifyEmailNotice.d.ts","sourceRoot":"","sources":["../../../src/auth/components/VerifyEmailNotice.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAGtD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,QAAQ,EACR,SAAc,GACf,EAAE,sBAAsB,2CAgGxB"}
|
|
@@ -8,6 +8,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
8
8
|
import { useState, useCallback } from 'react';
|
|
9
9
|
import { Mail, Check } from 'lucide-react';
|
|
10
10
|
import { useAuth } from '../hooks/useAuth';
|
|
11
|
+
import { useT } from '../../core/i18n';
|
|
11
12
|
/**
|
|
12
13
|
* Notice component shown when email verification is required.
|
|
13
14
|
*
|
|
@@ -26,6 +27,7 @@ import { useAuth } from '../hooks/useAuth';
|
|
|
26
27
|
* ```
|
|
27
28
|
*/
|
|
28
29
|
export function VerifyEmailNotice({ email, onResend, className = '', }) {
|
|
30
|
+
const t = useT();
|
|
29
31
|
const { resendVerification } = useAuth();
|
|
30
32
|
const [isResending, setIsResending] = useState(false);
|
|
31
33
|
const [resent, setResent] = useState(false);
|
|
@@ -40,7 +42,7 @@ export function VerifyEmailNotice({ email, onResend, className = '', }) {
|
|
|
40
42
|
else {
|
|
41
43
|
const result = await resendVerification(email);
|
|
42
44
|
if (!result.success) {
|
|
43
|
-
setError(result.error || '
|
|
45
|
+
setError(result.error || t('auth.resendFailed'));
|
|
44
46
|
setIsResending(false);
|
|
45
47
|
return;
|
|
46
48
|
}
|
|
@@ -48,10 +50,10 @@ export function VerifyEmailNotice({ email, onResend, className = '', }) {
|
|
|
48
50
|
setResent(true);
|
|
49
51
|
}
|
|
50
52
|
catch (err) {
|
|
51
|
-
setError('
|
|
53
|
+
setError(t('auth.resendFailedVerification'));
|
|
52
54
|
}
|
|
53
55
|
setIsResending(false);
|
|
54
|
-
}, [email, onResend, resendVerification]);
|
|
55
|
-
return (_jsx("div", { className: `w-full max-w-md ${className}`, children: _jsx("div", { className: "rounded-md bg-blue-50 p-6", children: _jsxs("div", { className: "flex", children: [_jsx("div", { className: "flex-shrink-0", children: _jsx(Mail, { className: "h-6 w-6 text-blue-500" }) }), _jsxs("div", { className: "ml-4", children: [_jsx("h3", { className: "text-lg font-medium text-blue-800", children:
|
|
56
|
+
}, [email, onResend, resendVerification, t]);
|
|
57
|
+
return (_jsx("div", { className: `w-full max-w-md ${className}`, children: _jsx("div", { className: "rounded-md bg-blue-50 p-6", children: _jsxs("div", { className: "flex", children: [_jsx("div", { className: "flex-shrink-0", children: _jsx(Mail, { className: "h-6 w-6 text-blue-500" }) }), _jsxs("div", { className: "ml-4", children: [_jsx("h3", { className: "text-lg font-medium text-blue-800", children: t('auth.verifyYourEmail') }), _jsxs("div", { className: "mt-2 text-sm text-blue-700", children: [_jsxs("p", { children: [t('auth.verifySentTo'), ' ', _jsx("strong", { className: "font-medium", children: email })] }), _jsx("p", { className: "mt-2", children: t('auth.verifyCheckInbox') })] }), error && (_jsx("p", { className: "mt-3 text-sm text-red-600", children: error })), _jsx("div", { className: "mt-4", children: resent ? (_jsxs("p", { className: "text-sm text-green-700", children: [_jsx(Check, { className: "mr-1.5 inline-block h-4 w-4" }), "Verification email sent! Check your inbox."] })) : (_jsxs("p", { className: "text-sm text-blue-600", children: ["Didn't receive the email?", ' ', _jsx("button", { type: "button", onClick: handleResend, disabled: isResending, className: "font-medium text-blue-700 underline hover:text-blue-800 disabled:cursor-not-allowed disabled:opacity-50", children: isResending ? t('auth.sending') : t('auth.resendVerification') })] })) }), _jsxs("div", { className: "mt-4 rounded-md bg-blue-100 p-3", children: [_jsx("p", { className: "text-xs text-blue-700", children: _jsx("strong", { children: t('auth.tips') }) }), _jsxs("ul", { className: "mt-1 list-inside list-disc text-xs text-blue-600", children: [_jsx("li", { children: t('auth.tipSpam') }), _jsx("li", { children: t('auth.tipExpiry') }), _jsx("li", { children: t('auth.tipCorrectEmail') })] })] })] })] }) }) }));
|
|
56
58
|
}
|
|
57
59
|
//# sourceMappingURL=VerifyEmailNotice.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VerifyEmailNotice.js","sourceRoot":"","sources":["../../../src/auth/components/VerifyEmailNotice.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,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GAAG,EAClC,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,WAAW,EACrB,SAAS,EAAC,yGAAyG,YAElH,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,yBAAyB,CAAC,GACxD,IACP,CACL,GACG,EAGN,eAAK,SAAS,EAAC,iCAAiC,aAC9C,YAAG,SAAS,EAAC,uBAAuB,YAClC,2BAAS,CAAC,CAAC,WAAW,CAAC,GAAU,GAC/B,EACJ,cAAI,SAAS,EAAC,kDAAkD,aAC9D,uBAAK,CAAC,CAAC,cAAc,CAAC,GAAM,EAC5B,uBAAK,CAAC,CAAC,gBAAgB,CAAC,GAAM,EAC9B,uBAAK,CAAC,CAAC,sBAAsB,CAAC,GAAM,IACjC,IACD,IACF,IACF,GACF,GACF,CACP,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAuth.d.ts","sourceRoot":"","sources":["../../../src/auth/hooks/useAuth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useAuth.d.ts","sourceRoot":"","sources":["../../../src/auth/hooks/useAuth.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,aAAa,EAUd,MAAM,UAAU,CAAA;AAejB;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,OAAO,IAAI,aAAa,CAyOvC"}
|
|
@@ -7,6 +7,16 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { useCallback, useMemo } from 'react';
|
|
9
9
|
import { useSession, signIn as nextAuthSignIn, signOut as nextAuthSignOut } from 'next-auth/react';
|
|
10
|
+
import { LOCALE_COOKIE } from '../../core/i18n/types';
|
|
11
|
+
/** Visitor locale from the provider-maintained cookie (email language only). */
|
|
12
|
+
function readLocaleCookie() {
|
|
13
|
+
try {
|
|
14
|
+
return document.cookie.match(new RegExp(`${LOCALE_COOKIE}=(\\w+)`))?.[1];
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
10
20
|
// =============================================================================
|
|
11
21
|
// Hook Implementation
|
|
12
22
|
// =============================================================================
|
|
@@ -107,7 +117,7 @@ export function useAuth() {
|
|
|
107
117
|
const response = await fetch('/api/auth/register', {
|
|
108
118
|
method: 'POST',
|
|
109
119
|
headers: { 'Content-Type': 'application/json' },
|
|
110
|
-
body: JSON.stringify({ email, password, name }),
|
|
120
|
+
body: JSON.stringify({ email, password, name, locale: readLocaleCookie() }),
|
|
111
121
|
});
|
|
112
122
|
const result = await response.json();
|
|
113
123
|
if (!response.ok) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAuth.js","sourceRoot":"","sources":["../../../src/auth/hooks/useAuth.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,cAAc,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"useAuth.js","sourceRoot":"","sources":["../../../src/auth/hooks/useAuth.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,cAAc,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAClG,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAcrD,gFAAgF;AAChF,SAAS,gBAAgB;IACvB,IAAI,CAAC;QACH,OAAO,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,GAAG,aAAa,SAAS,CAAC,CAAC,EA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,CAAC,KAAK,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAA;YACvD,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,kDAAkD;aAC1D,CAAA;QACH,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO;QACL,QAAQ;QACR,QAAQ;QACR,eAAe;QACf,SAAS;QACT,eAAe;QAEf,UAAU;QACV,MAAM;QACN,MAAM;QACN,OAAO;QACP,kBAAkB;QAClB,oBAAoB;QACpB,aAAa;QACb,kBAAkB;KACnB,CAAA;AACH,CAAC"}
|
|
@@ -41,7 +41,7 @@ export interface AuthenticateError {
|
|
|
41
41
|
* )
|
|
42
42
|
* ```
|
|
43
43
|
*/
|
|
44
|
-
export declare function createCustomer(email: string, password: string, name?: string): Promise<CreateCustomerResult>;
|
|
44
|
+
export declare function createCustomer(email: string, password: string, name?: string, locale?: string | null): Promise<CreateCustomerResult>;
|
|
45
45
|
/**
|
|
46
46
|
* Authenticate a customer by email and password.
|
|
47
47
|
* Checks email verification status.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customer-service.d.ts","sourceRoot":"","sources":["../../../src/auth/server/customer-service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,MAAM,MAAM,sBAAsB,CAAA;AAG9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAM/C,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAA;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,sFAAsF;IACtF,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,IAAI,CAAA;IACb,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAA;CAC1B;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,KAAK,CAAA;IACd,KAAK,EAAE,MAA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;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAyBjC;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,CAYjC;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,CAYjC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,CAClC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAC7D,OAAO,CAAC,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,CAiCjC;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC,CASf;AAED;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOzE;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAGjE"}
|
|
@@ -32,7 +32,7 @@ import { hashPassword, verifyPassword } from './password';
|
|
|
32
32
|
* )
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
35
|
-
export async function createCustomer(email, password, name) {
|
|
35
|
+
export async function createCustomer(email, password, name, locale) {
|
|
36
36
|
const db = getDb();
|
|
37
37
|
// Hash password
|
|
38
38
|
const passwordHash = await hashPassword(password);
|
|
@@ -40,6 +40,7 @@ export async function createCustomer(email, password, name) {
|
|
|
40
40
|
const [customer] = await db
|
|
41
41
|
.insert(schema.customers)
|
|
42
42
|
.values({
|
|
43
|
+
locale: locale ?? null,
|
|
43
44
|
email: email.toLowerCase().trim(),
|
|
44
45
|
name: name?.trim() || null,
|
|
45
46
|
passwordHash,
|