The complete open source platform to run your entire marketplace. Storefront, vendor panel, admin console, and integrations in one enterprise-grade platform you own.
TypeScript b2b-marketplacecomposable-commerceecommerceenterpriseheadless-commercemarketplacemedusamedusajsmulti-vendortypescript
feat(vendor): add two-step seller onboarding flow (#814)
Viktor Holik10c304c208b0
diff --git a/packages/core-plugin/.mercur/_generated/index.ts b/packages/core-plugin/.mercur/_generated/index.tsindex 603cf95e3..93c43b05d 100644--- a/packages/core-plugin/.mercur/_generated/index.ts+++ b/packages/core-plugin/.mercur/_generated/index.ts@@ -142,6 +142,7 @@ export type Routes = {$id: typeof import("@medusajs/medusa/api/admin/invites/[id]/route") & {resend: typeof import("@medusajs/medusa/api/admin/invites/[id]/resend/route");};+ accept: typeof import("@mercurjs/core-plugin/api/admin/invites/accept/route");};locales: typeof import("@medusajs/medusa/api/admin/locales/route") & {$code: typeof import("@medusajs/medusa/api/admin/locales/[code]/route");@@ -426,8 +427,28 @@ export type Routes = {$id: typeof import("../../src/api/admin/payouts/[id]/route");};sellers: typeof import("../../src/api/admin/sellers/route") & {- invite: typeof import("../../src/api/admin/sellers/invite/route");- $id: typeof import("../../src/api/admin/sellers/[id]/route");+ invite: typeof import("@mercurjs/core-plugin/api/admin/sellers/invite/route");+ $id: typeof import("../../src/api/admin/sellers/[id]/route") & {+ address: typeof import("../../src/api/admin/sellers/[id]/address/route");+ approve: typeof import("../../src/api/admin/sellers/[id]/approve/route");+ members: typeof import("../../src/api/admin/sellers/[id]/members/route") & {+ $memberId: typeof import("../../src/api/admin/sellers/[id]/members/[member_id]/route");+ invite: typeof import("../../src/api/admin/sellers/[id]/members/invite/route");+ };+ paymentDetails: typeof import("../../src/api/admin/sellers/[id]/payment-details/route");+ professionalDetails: typeof import("../../src/api/admin/sellers/[id]/professional-details/route");+ suspend: typeof import("../../src/api/admin/sellers/[id]/suspend/route");+ terminate: typeof import("../../src/api/admin/sellers/[id]/terminate/route");+ unsuspend: typeof import("../../src/api/admin/sellers/[id]/unsuspend/route");+ unterminate: typeof import("../../src/api/admin/sellers/[id]/unterminate/route");+ };+ };+ subscriptionPlans: typeof import("../../src/api/admin/subscription-plans/route") & {+ $id: typeof import("../../src/api/admin/subscription-plans/[id]/route") & {+ overrides: typeof import("../../src/api/admin/subscription-plans/[id]/overrides/route") & {+ $overrideId: typeof import("../../src/api/admin/subscription-plans/[id]/overrides/[override_id]/route");+ };+ };};};auth: {@@ -676,7 +697,15 @@ export type Routes = {};};sellers: typeof import("../../src/api/vendor/sellers/route") & {- me: typeof import("../../src/api/vendor/sellers/me/route");+ me: typeof import("@mercurjs/core-plugin/api/vendor/sellers/me/route");+ $id: typeof import("../../src/api/vendor/sellers/[id]/route") & {+ address: typeof import("../../src/api/vendor/sellers/[id]/address/route");+ members: typeof import("../../src/api/vendor/sellers/[id]/members/route") & {+ $memberId: typeof import("../../src/api/vendor/sellers/[id]/members/[member_id]/route");+ };+ paymentDetails: typeof import("../../src/api/vendor/sellers/[id]/payment-details/route");+ professionalDetails: typeof import("../../src/api/vendor/sellers/[id]/professional-details/route");+ };};shippingOptionTypes: typeof import("../../src/api/vendor/shipping-option-types/route") & {$id: typeof import("../../src/api/vendor/shipping-option-types/[id]/route");diff --git a/packages/core-plugin/package.json b/packages/core-plugin/package.jsonindex c359fcc52..b23ab6e66 100644--- a/packages/core-plugin/package.json+++ b/packages/core-plugin/package.json@@ -34,7 +34,7 @@"medusa-v2"],"scripts": {- "build": "rm -rf .medusa && tsc --declaration --outDir .medusa/server",+ "build": "bunx @mercurjs/cli@latest codegen && rm -rf .medusa && tsc --declaration --outDir .medusa/server","dev": "medusa plugin:develop","prepublishOnly": "tsc --declaration --outDir .medusa/server"},diff --git a/packages/core-plugin/src/api/vendor/sellers/route.ts b/packages/core-plugin/src/api/vendor/sellers/route.tsindex 597223cc3..8c155445a 100644--- a/packages/core-plugin/src/api/vendor/sellers/route.ts+++ b/packages/core-plugin/src/api/vendor/sellers/route.ts@@ -6,10 +6,7 @@ import { ContainerRegistrationKeys, FeatureFlag, MedusaError } from "@medusajs/fimport { HttpTypes } from "@mercurjs/types"import { VendorCreateSellerAccountType } from "./validators"-import {- createSellerAccountWorkflow,- updateSellerAddressWorkflow,-} from "../../../workflows/seller"+import { createSellerAccountWorkflow } from "../../../workflows/seller"import SellerRegistrationFeatureFlag from "../../../feature-flags/seller-registration"export const GET = async (@@ -61,24 +58,17 @@ export const POST = async ()}- const { address, ...sellerData } = req.validatedBody+ const { address, professional_details, ...sellerData } = req.validatedBodyconst { result: seller } = await createSellerAccountWorkflow(req.scope).run({input: {auth_identity_id: req.auth_context.auth_identity_id,seller: sellerData,member: { email: sellerData.email },+ address,+ professional_details,},})- if (address) {- await updateSellerAddressWorkflow(req.scope).run({- input: {- seller_id: seller.id,- data: address,- },- })- }-res.status(201).json({ seller })}diff --git a/packages/core-plugin/src/api/vendor/sellers/validators.ts b/packages/core-plugin/src/api/vendor/sellers/validators.tsindex 14a70746d..4db3a423d 100644--- a/packages/core-plugin/src/api/vendor/sellers/validators.ts+++ b/packages/core-plugin/src/api/vendor/sellers/validators.ts@@ -33,6 +33,13 @@ export const VendorCreateSellerAccount = z.object({phone: z.string().nullable().optional(),}).optional(),+ professional_details: z+ .object({+ corporate_name: z.string().optional(),+ registration_number: z.string().nullable().optional(),+ tax_id: z.string().nullable().optional(),+ })+ .optional(),metadata: z.record(z.unknown()).nullable().optional(),})diff --git a/packages/core-plugin/src/workflows/seller/workflows/create-seller-account.ts b/packages/core-plugin/src/workflows/seller/workflows/create-seller-account.tsindex 9b118755a..cd90f80d0 100644--- a/packages/core-plugin/src/workflows/seller/workflows/create-seller-account.ts+++ b/packages/core-plugin/src/workflows/seller/workflows/create-seller-account.ts@@ -2,13 +2,20 @@ import {createHook,createWorkflow,transform,+ when,WorkflowResponse,} from "@medusajs/framework/workflows-sdk"import {emitEventStep,setAuthAppMetadataStep,} from "@medusajs/medusa/core-flows"-import { CreateSellerDTO, SellerRole, SellerStatus } from "@mercurjs/types"+import {+ CreateSellerDTO,+ SellerRole,+ SellerStatus,+ UpdateSellerAddressDTO,+ UpdateProfessionalDetailsDTO,+} from "@mercurjs/types"import { AdditionalData } from "@medusajs/framework/types"import {@@ -17,6 +24,8 @@ import {createSellerMembersStep,} from "../steps"import { SellerWorkflowEvents } from "../../events"+import { updateSellerAddressWorkflow } from "./update-seller-address"+import { updateSellerProfessionalDetailsWorkflow } from "./update-seller-professional-details"export const createSellerAccountWorkflowId = "create-seller-account"@@ -24,6 +33,8 @@ type CreateSellerAccountWorkflowInput = {auth_identity_id: stringseller: CreateSellerDTOmember: { email: string }+ address?: UpdateSellerAddressDTO+ professional_details?: UpdateProfessionalDetailsDTO} & AdditionalDataexport const createSellerAccountWorkflow = createWorkflow(@@ -62,6 +73,26 @@ export const createSellerAccountWorkflow = createWorkflow(value: member.id,})+ when(input, ({ address }) => !!address).then(() => {+ updateSellerAddressWorkflow.runAsStep({+ input: transform({ seller, input }, ({ seller, input }) => ({+ seller_id: seller.id,+ data: input.address!,+ })),+ })+ })++ when(input, ({ professional_details }) => !!professional_details).then(+ () => {+ updateSellerProfessionalDetailsWorkflow.runAsStep({+ input: transform({ seller, input }, ({ seller, input }) => ({+ seller_id: seller.id,+ data: input.professional_details!,+ })),+ })+ }+ )+const sellerAccountCreated = createHook("sellerAccountCreated", {seller,additional_data: input.additional_data,diff --git a/packages/vendor/src/get-route-map.tsx b/packages/vendor/src/get-route-map.tsxindex afdd6e3d7..b2f651f75 100644--- a/packages/vendor/src/get-route-map.tsx+++ b/packages/vendor/src/get-route-map.tsx@@ -1323,6 +1323,10 @@ export function getRouteMap({return { Component: RegisterPage };},},+ {+ path: "/onboarding",+ lazy: () => import("./pages/onboarding"),+ },...customPublicRoutes,{path: "*",diff --git a/packages/vendor/src/hooks/api/index.ts b/packages/vendor/src/hooks/api/index.tsindex 5f5eda244..73ea10c0a 100644--- a/packages/vendor/src/hooks/api/index.ts+++ b/packages/vendor/src/hooks/api/index.ts@@ -24,6 +24,7 @@ export * from "./refund-reasons"export * from "./regions"export * from "./reservations"export * from "./sales-channels"+export * from "./sellers"export * from "./shipping-option-types"export * from "./shipping-options"export * from "./shipping-profiles"diff --git a/packages/vendor/src/hooks/api/sellers.tsx b/packages/vendor/src/hooks/api/sellers.tsxnew file mode 100644index 000000000..cb391b884--- /dev/null+++ b/packages/vendor/src/hooks/api/sellers.tsx@@ -0,0 +1,31 @@+import {+ ClientError,+ InferClientInput,+ InferClientOutput,+} from "@mercurjs/client";+import { UseMutationOptions, useMutation } from "@tanstack/react-query";+import { sdk } from "../../lib/client";+import { queryClient } from "../../lib/query-client";+import { queryKeysFactory } from "../../lib/query-key-factory";++const SELLERS_QUERY_KEY = "sellers" as const;+export const sellersQueryKeys = queryKeysFactory(SELLERS_QUERY_KEY);++export const useCreateSellerAccount = (+ options?: UseMutationOptions<+ InferClientOutput<typeof sdk.vendor.sellers.mutate>,+ ClientError,+ InferClientInput<typeof sdk.vendor.sellers.mutate>+ >,+) => {+ return useMutation({+ mutationFn: (payload) => sdk.vendor.sellers.mutate(payload),+ onSuccess: (data, variables, context) => {+ queryClient.invalidateQueries({+ queryKey: ["users", "me"],+ });+ options?.onSuccess?.(data, variables, context);+ },+ ...options,+ });+};diff --git a/packages/vendor/src/i18n/translations/en.json b/packages/vendor/src/i18n/translations/en.jsonindex 771b23fb0..604c0e5f0 100644--- a/packages/vendor/src/i18n/translations/en.json+++ b/packages/vendor/src/i18n/translations/en.json@@ -2945,25 +2945,60 @@"notSellerYet": "Not a seller yet? - <0>Create an account</0>"},"register": {- "title": "Join Mercur Seller Panel",- "hint": "Sign up to start selling",+ "title": "Start selling on {{name}}",+ "hint": "Create account to get started","companyName": "Company name","confirmPassword": "Confirm password","signUp": "Sign up","alreadySeller": "Already have an account? - <0>Sign In</0>","passwordMismatch": "Passwords don't match","emailTaken": "Provided email is already taken",+ "validation": {+ "nameRequired": "Name must be at least 2 characters",+ "emailInvalid": "Please enter a valid email address",+ "passwordMinLength": "Password must be at least 8 characters",+ "confirmPasswordRequired": "Please confirm your password"+ },"successTitle": "Thank you for registering!","successHint": "You may need to wait for admin authorization before logging in. A confirmation email will be sent to you shortly.","backToLogin": "Back to login"},- "validation": {- "rules": {- "lower": "At least one lowercase letter",- "upper": "At least one uppercase letter",- "12chars": "At least 12 characters",- "digit": "At least one digit",- "specialChar": "At least one special character"+ "onboarding": {+ "step": "Step {{current}} / {{total}}",+ "organizationSetup": {+ "title": "Setup your organization",+ "subtitle": "Specify the name of your organization",+ "organizationName": "Organization name",+ "organizationNamePlaceholder": "My Organization"+ },+ "storeSetup": {+ "title": "Setup your store",+ "subtitle": "Specify the details of your store",+ "storeName": "Store name",+ "storeNamePlaceholder": "My Store",+ "selectCurrency": "Select a currency",+ "currencyHint": "Cannot be changed after store is created",+ "descriptionPlaceholder": "A description of your store"+ },+ "detailsSetup": {+ "title": "Complete your profile",+ "subtitle": "Add your address and business details",+ "addressTitle": "Address",+ "addressSubtitle": "Your business address",+ "professionalTitle": "Business details",+ "professionalSubtitle": "Professional seller information",+ "isProfessional": "Professional seller",+ "isProfessionalDescription": "Register as a business entity",+ "corporateName": "Corporate name",+ "registrationNumber": "Registration number",+ "taxId": "Tax ID",+ "completeSetup": "Complete setup"+ },+ "submitted": {+ "title": "Application submitted!",+ "description": "Your seller account has been created and is pending approval. We'll notify you at {{email}} once your store is reviewed.",+ "hint": "In the meantime, you can log in to complete your store setup.",+ "action": "Go to login"}},"invite": {diff --git a/packages/vendor/src/pages/login/login.tsx b/packages/vendor/src/pages/login/login.tsxindex 4d71a7e3b..88ad7323f 100644--- a/packages/vendor/src/pages/login/login.tsx+++ b/packages/vendor/src/pages/login/login.tsx@@ -100,7 +100,7 @@ const LoginForm = () => {onSubmit={handleSubmit}className="flex w-full flex-col gap-y-6">- <div className="flex flex-col gap-y-1">+ <div className="flex flex-col gap-y-2"><Form.Fieldcontrol={form.control}name="email"@@ -125,7 +125,6 @@ const LoginForm = () => {render={({ field }) => {return (<Form.Item>- <Form.Label>{}</Form.Label><Form.Control><Inputtype="password"@@ -139,24 +138,23 @@ const LoginForm = () => {)}}/>+ {validationError && (+ <div className="mt-6 text-center">+ <Hint className="inline-flex" variant={"error"}>+ {validationError}+ </Hint>+ </div>+ )}+ {serverError && (+ <Alert+ className="bg-ui-bg-base items-center p-2"+ dismissible+ variant="error"+ >+ {serverError}+ </Alert>+ )}</div>- {validationError && (- <div className="text-center">- <Hint className="inline-flex" variant={"error"}>- {validationError}- </Hint>- </div>- )}-- {serverError && (- <Alert- className="bg-ui-bg-base items-center p-2"- dismissible- variant="error"- >- {serverError}- </Alert>- )}<Button className="w-full" type="submit" isLoading={isPending}>Sign In</Button>diff --git a/packages/vendor/src/pages/onboarding/index.ts b/packages/vendor/src/pages/onboarding/index.tsnew file mode 100644index 000000000..340437be8--- /dev/null+++ b/packages/vendor/src/pages/onboarding/index.ts@@ -0,0 +1 @@+export { Onboarding as Component } from "./onboarding"diff --git a/packages/vendor/src/pages/onboarding/onboarding.tsx b/packages/vendor/src/pages/onboarding/onboarding.tsxnew file mode 100644index 000000000..aa4b5c507--- /dev/null+++ b/packages/vendor/src/pages/onboarding/onboarding.tsx@@ -0,0 +1,867 @@+import { useState } from "react";++import { zodResolver } from "@hookform/resolvers/zod";+import { OpenRectArrowOut } from "@medusajs/icons";+import {+ Avatar,+ Button,+ Heading,+ Input,+ Select,+ Text,+ Textarea,+} from "@medusajs/ui";+import { AnimatePresence, motion } from "motion/react";+import { useForm, useWatch } from "react-hook-form";+import { useTranslation } from "react-i18next";+import { useLocation, useNavigate } from "react-router-dom";+import * as z from "zod";++import { Form } from "@components/common/form";+import { SwitchBox } from "@components/common/switch-box/switch-box";+import { CountrySelect } from "@components/inputs/country-select/country-select";+import { useLogout, useCreateSellerAccount } from "@hooks/api";+import { currencies } from "@lib/data/currencies";+import { queryClient } from "@lib/query-client";++const currencyList = Object.values(currencies);++const StoreSetupSchema = z.object({+ name: z.string().min(1),+ currency_code: z.string().min(1),+ description: z.string().optional(),+});++const DetailsSetupSchema = z.object({+ first_name: z.string().min(1),+ last_name: z.string().min(1),+ company: z.string().optional(),+ address_1: z.string().min(1),+ address_2: z.string().optional(),+ city: z.string().min(1),+ country_code: z.string().min(1),+ province: z.string().optional(),+ postal_code: z.string().min(1),+ phone: z.string().optional(),+ is_professional: z.boolean(),+ corporate_name: z.string().optional(),+ registration_number: z.string().optional(),+ tax_id: z.string().optional(),+});++type StoreSetupFormValues = z.infer<typeof StoreSetupSchema>;+type DetailsSetupFormValues = z.infer<typeof DetailsSetupSchema>;++export const Onboarding = () => {+ const { t } = useTranslation();+ const navigate = useNavigate();+ const location = useLocation();+ const email = location.state?.email ?? "";++ const [step, setStep] = useState(1);+ const [layoutStep, setLayoutStep] = useState(1);+ const totalSteps = 2;++ const { mutateAsync: logoutMutation } = useLogout();++ const handleLogout = async () => {+ await logoutMutation(undefined, {+ onSuccess: () => {+ queryClient.clear();+ navigate("/login");+ },+ });+ };++ const storeForm = useForm<StoreSetupFormValues>({+ resolver: zodResolver(StoreSetupSchema),+ defaultValues: {+ name: "",+ currency_code: "",+ description: "",+ },+ });++ const detailsForm = useForm<DetailsSetupFormValues>({+ resolver: zodResolver(DetailsSetupSchema),+ defaultValues: {+ first_name: "",+ last_name: "",+ company: "",+ address_1: "",+ address_2: "",+ city: "",+ country_code: "",+ province: "",+ postal_code: "",+ phone: "",+ is_professional: true,+ corporate_name: "",+ registration_number: "",+ tax_id: "",+ },+ });++ const handleStoreSubmit = storeForm.handleSubmit(async (_data) => {+ setStep(2);+ });++ const { mutateAsync: createSellerAccount, isPending: isCreating } =+ useCreateSellerAccount();++ const handleDetailsSubmit = detailsForm.handleSubmit(async (details) => {+ const storeData = storeForm.getValues();+ const {+ is_professional,+ corporate_name,+ registration_number,+ tax_id,+ ...addressFields+ } = details;++ try {+ await createSellerAccount({+ name: storeData.name,+ email,+ currency_code: storeData.currency_code,+ description: storeData.description || undefined,+ address: addressFields,+ professional_details: is_professional+ ? { corporate_name, registration_number, tax_id }+ : undefined,+ });+ setStep(3);+ } catch (error: any) {+ // Stay on step 2 — error is visible via mutation state+ }+ });++ return (+ <div className="bg-ui-bg-subtle flex min-h-dvh w-dvw flex-col">+ <div className="flex items-center justify-center py-4">+ <button+ onClick={handleLogout}+ className="txt-compact-small text-ui-fg-subtle flex items-center gap-x-1 font-medium transition-colors hover:text-ui-fg-base"+ >+ <OpenRectArrowOut />+ <span>+ {t("actions.logout")}+ {email && ` (${email})`}+ </span>+ </button>+ </div>++ <AnimatePresence mode="wait">+ {step <= 2 ? (+ <motion.div+ key="form-steps"+ className={`flex flex-1 flex-col items-center px-4 ${+ layoutStep === 1 ? "justify-center" : "pt-8"+ }`}+ exit={{+ opacity: 0,+ y: 40,+ filter: "blur(6px)",+ transition: { duration: 0.5, ease: [0, 0.71, 0.2, 1.01] },+ }}+ >+ <div+ className="flex w-full max-w-[720px] flex-col"+ style={layoutStep === 2 ? { paddingBottom: "5rem" } : undefined}+ >+ <AnimatePresence mode="wait" onExitComplete={() => setLayoutStep(step)}>+ {step === 1 ? (+ <motion.div+ key="store-step"+ initial={{ opacity: 0, y: 8, filter: "blur(4px)" }}+ animate={{ opacity: 1, y: 0, filter: "blur(0px)" }}+ exit={{+ opacity: 0,+ y: -3,+ filter: "blur(4px)",+ transition: {+ duration: 0.25,+ ease: [0.23, 1, 0.32, 1],+ },+ }}+ transition={{+ duration: 0.4,+ ease: [0.23, 1, 0.32, 1],+ }}+ >+ <StoreStep form={storeForm} onSubmit={handleStoreSubmit} />+ </motion.div>+ ) : (+ <motion.div+ key="details-step"+ initial={{ opacity: 0, y: 8, filter: "blur(4px)" }}+ animate={{ opacity: 1, y: 0, filter: "blur(0px)" }}+ exit={{+ opacity: 0,+ y: -3,+ filter: "blur(4px)",+ transition: {+ duration: 0.25,+ ease: [0.23, 1, 0.32, 1],+ },+ }}+ transition={{+ duration: 0.4,+ ease: [0.23, 1, 0.32, 1],+ }}+ >+ <DetailsStep+ form={detailsForm}+ onSubmit={handleDetailsSubmit}+ isPending={isCreating}+ />+ </motion.div>+ )}+ </AnimatePresence>+ </div>+ </motion.div>+ ) : (+ <motion.div+ key="submitted"+ className="flex flex-1 flex-col items-center justify-center px-4"+ initial={{ opacity: 0, scale: 0.95 }}+ animate={{ opacity: 1, scale: 1 }}+ transition={{+ duration: 0.6,+ delay: 0.3,+ ease: [0, 0.71, 0.2, 1.01],+ }}+ >+ <SubmittedStep email={email} />+ </motion.div>+ )}+ </AnimatePresence>++ <AnimatePresence>+ {step <= 2 && (+ <motion.div+ className="fixed bottom-0 left-0 right-0 flex items-center justify-center py-4 bg-ui-bg-subtle"+ exit={{+ opacity: 0,+ transition: { duration: 0.3, ease: [0.23, 1, 0.32, 1] },+ }}+ >+ <Text size="small" weight="plus" className="text-ui-fg-muted">+ {t("onboarding.step", {+ current: String(step).padStart(2, "0"),+ total: String(totalSteps).padStart(2, "0"),+ })}+ </Text>+ </motion.div>+ )}+ </AnimatePresence>+ </div>+ );+};++const sectionVariants = {+ hidden: { opacity: 0, y: 8 },+ visible: (i: number) => ({+ opacity: 1,+ y: 0,+ transition: {+ delay: 0.06 * i,+ duration: 0.35,+ ease: [0.23, 1, 0.32, 1],+ },+ }),+};++const StoreStep = ({+ form,+ onSubmit,+}: {+ form: ReturnType<typeof useForm<StoreSetupFormValues>>;+ onSubmit: () => void;+}) => {+ const { t } = useTranslation();++ return (+ <>+ <motion.div+ className="pb-8 flex items-center gap-x-4"+ variants={sectionVariants}+ initial="hidden"+ animate="visible"+ custom={0}+ >+ <Avatar fallback="?" variant="rounded" size="xlarge" />+ <div>+ <Heading level="h1" className="text-ui-fg-base">+ {t("onboarding.storeSetup.title")}+ </Heading>+ <Text size="small" className="text-ui-fg-subtle">+ {t("onboarding.storeSetup.subtitle")}+ </Text>+ </div>+ </motion.div>++ <Form {...form}>+ <form onSubmit={onSubmit}>+ <motion.div+ className="border-t border-dotted border-ui-border-base"+ variants={sectionVariants}+ initial="hidden"+ animate="visible"+ custom={1}+ />++ <motion.div+ className="grid grid-cols-2 gap-x-12 py-8"+ variants={sectionVariants}+ initial="hidden"+ animate="visible"+ custom={2}+ >+ <div>+ <Text size="small" weight="plus" className="text-ui-fg-base">+ {t("onboarding.storeSetup.title")}+ </Text>+ <Text size="small" className="text-ui-fg-subtle mt-1">+ {t("onboarding.storeSetup.subtitle")}+ </Text>+ </div>+ <div className="flex flex-col gap-y-4">+ <Form.Field+ control={form.control}+ name="name"+ render={({ field }) => (+ <Form.Item>+ <Form.Label>+ {t("onboarding.storeSetup.storeName")}+ </Form.Label>+ <Form.Control>+ <Input+ autoComplete="organization"+ {...field}+ placeholder={t(+ "onboarding.storeSetup.storeNamePlaceholder",+ )}+ />+ </Form.Control>+ <Form.ErrorMessage />+ </Form.Item>+ )}+ />+ <Form.Field+ control={form.control}+ name="currency_code"+ render={({ field: { onChange, ref, ...field } }) => (+ <Form.Item>+ <Form.Label>{t("fields.currency")}</Form.Label>+ <Form.Control>+ <Select {...field} onValueChange={onChange}>+ <Select.Trigger ref={ref}>+ <Select.Value+ placeholder={t(+ "onboarding.storeSetup.selectCurrency",+ )}+ />+ </Select.Trigger>+ <Select.Content>+ {currencyList.map((currency) => (+ <Select.Item+ key={currency.code}+ value={currency.code}+ >+ {currency.name} ({currency.code.toUpperCase()})+ </Select.Item>+ ))}+ </Select.Content>+ </Select>+ </Form.Control>+ <Form.Hint>+ {t("onboarding.storeSetup.currencyHint")}+ </Form.Hint>+ <Form.ErrorMessage />+ </Form.Item>+ )}+ />+ <Form.Field+ control={form.control}+ name="description"+ render={({ field }) => (+ <Form.Item>+ <Form.Label optional>{t("fields.description")}</Form.Label>+ <Form.Control>+ <Textarea+ {...field}+ placeholder={t(+ "onboarding.storeSetup.descriptionPlaceholder",+ )}+ />+ </Form.Control>+ <Form.ErrorMessage />+ </Form.Item>+ )}+ />+ </div>+ </motion.div>++ <motion.div+ className="border-t border-dotted border-ui-border-base"+ variants={sectionVariants}+ initial="hidden"+ animate="visible"+ custom={3}+ />++ <motion.div+ className="grid grid-cols-2 gap-x-12 py-8"+ variants={sectionVariants}+ initial="hidden"+ animate="visible"+ custom={4}+ >+ <div />+ <Button type="submit" className="w-full">+ {t("actions.continue")}+ </Button>+ </motion.div>+ </form>+ </Form>+ </>+ );+};++const DetailsStep = ({+ form,+ onSubmit,+ isPending,+}: {+ form: ReturnType<typeof useForm<DetailsSetupFormValues>>;+ onSubmit: () => void;+ isPending?: boolean;+}) => {+ const { t } = useTranslation();++ const isProfessional = useWatch({+ control: form.control,+ name: "is_professional",+ });++ return (+ <>+ <motion.div+ className="pb-8 flex items-center gap-x-4"+ variants={sectionVariants}+ initial="hidden"+ animate="visible"+ custom={0}+ >+ <Avatar fallback="?" variant="rounded" size="xlarge" />+ <div>+ <Heading level="h1" className="text-ui-fg-base">+ {t("onboarding.detailsSetup.title")}+ </Heading>+ <Text size="small" className="text-ui-fg-subtle">+ {t("onboarding.detailsSetup.subtitle")}+ </Text>+ </div>+ </motion.div>++ <Form {...form}>+ <form onSubmit={onSubmit}>+ <motion.div+ className="border-t border-dotted border-ui-border-base"+ variants={sectionVariants}+ initial="hidden"+ animate="visible"+ custom={1}+ />++ {/* Address section */}+ <motion.div+ className="grid grid-cols-2 gap-x-12 py-8"+ variants={sectionVariants}+ initial="hidden"+ animate="visible"+ custom={2}+ >+ <div>+ <Text size="small" weight="plus" className="text-ui-fg-base">+ {t("onboarding.detailsSetup.addressTitle")}+ </Text>+ <Text size="small" className="text-ui-fg-subtle mt-1">+ {t("onboarding.detailsSetup.addressSubtitle")}+ </Text>+ </div>+ <div className="flex flex-col gap-y-4">+ <div className="grid grid-cols-2 gap-4">+ <Form.Field+ control={form.control}+ name="first_name"+ render={({ field }) => (+ <Form.Item>+ <Form.Label>{t("fields.firstName")}</Form.Label>+ <Form.Control>+ <Input autoComplete="given-name" {...field} />+ </Form.Control>+ <Form.ErrorMessage />+ </Form.Item>+ )}+ />+ <Form.Field+ control={form.control}+ name="last_name"+ render={({ field }) => (+ <Form.Item>+ <Form.Label>{t("fields.lastName")}</Form.Label>+ <Form.Control>+ <Input autoComplete="family-name" {...field} />+ </Form.Control>+ <Form.ErrorMessage />+ </Form.Item>+ )}+ />+ </div>+ <Form.Field+ control={form.control}+ name="company"+ render={({ field }) => (+ <Form.Item>+ <Form.Label optional>{t("fields.company")}</Form.Label>+ <Form.Control>+ <Input autoComplete="organization" {...field} />+ </Form.Control>+ <Form.ErrorMessage />+ </Form.Item>+ )}+ />+ <Form.Field+ control={form.control}+ name="country_code"+ render={({ field: { onChange, ref: _ref, ...field } }) => (+ <Form.Item>+ <Form.Label>{t("fields.country")}</Form.Label>+ <Form.Control>+ <CountrySelect {...field} onChange={onChange} />+ </Form.Control>+ <Form.ErrorMessage />+ </Form.Item>+ )}+ />+ <Form.Field+ control={form.control}+ name="address_1"+ render={({ field }) => (+ <Form.Item>+ <Form.Label>{t("fields.address")}</Form.Label>+ <Form.Control>+ <Input autoComplete="address-line1" {...field} />+ </Form.Control>+ <Form.ErrorMessage />+ </Form.Item>+ )}+ />+ <Form.Field+ control={form.control}+ name="address_2"+ render={({ field }) => (+ <Form.Item>+ <Form.Label optional>{t("fields.address2")}</Form.Label>+ <Form.Control>+ <Input autoComplete="address-line2" {...field} />+ </Form.Control>+ <Form.ErrorMessage />+ </Form.Item>+ )}+ />+ <div className="grid grid-cols-2 gap-4">+ <Form.Field+ control={form.control}+ name="city"+ render={({ field }) => (+ <Form.Item>+ <Form.Label>{t("fields.city")}</Form.Label>+ <Form.Control>+ <Input autoComplete="address-level2" {...field} />+ </Form.Control>+ <Form.ErrorMessage />+ </Form.Item>+ )}+ />+ <Form.Field+ control={form.control}+ name="postal_code"+ render={({ field }) => (+ <Form.Item>+ <Form.Label>{t("fields.postalCode")}</Form.Label>+ <Form.Control>+ <Input autoComplete="postal-code" {...field} />+ </Form.Control>+ <Form.ErrorMessage />+ </Form.Item>+ )}+ />+ </div>+ <Form.Field+ control={form.control}+ name="province"+ render={({ field }) => (+ <Form.Item>+ <Form.Label optional>{t("fields.province")}</Form.Label>+ <Form.Control>+ <Input autoComplete="address-level1" {...field} />+ </Form.Control>+ <Form.ErrorMessage />+ </Form.Item>+ )}+ />+ <Form.Field+ control={form.control}+ name="phone"+ render={({ field }) => (+ <Form.Item>+ <Form.Label optional>{t("fields.phone")}</Form.Label>+ <Form.Control>+ <Input autoComplete="tel" {...field} />+ </Form.Control>+ <Form.ErrorMessage />+ </Form.Item>+ )}+ />+ </div>+ </motion.div>++ <motion.div+ className="border-t border-dotted border-ui-border-base"+ variants={sectionVariants}+ initial="hidden"+ animate="visible"+ custom={3}+ />++ {/* Professional details section */}+ <motion.div+ className="grid grid-cols-2 gap-x-12 py-8"+ variants={sectionVariants}+ initial="hidden"+ animate="visible"+ custom={4}+ >+ <div>+ <Text size="small" weight="plus" className="text-ui-fg-base">+ {t("onboarding.detailsSetup.professionalTitle")}+ </Text>+ <Text size="small" className="text-ui-fg-subtle mt-1">+ {t("onboarding.detailsSetup.professionalSubtitle")}+ </Text>+ </div>+ <div className="flex flex-col gap-y-4">+ <SwitchBox+ control={form.control}+ name="is_professional"+ label={t("onboarding.detailsSetup.isProfessional")}+ description={t(+ "onboarding.detailsSetup.isProfessionalDescription",+ )}+ />+ <AnimatePresence initial={false}>+ {isProfessional && (+ <motion.div+ className="flex flex-col gap-y-4"+ initial={{ opacity: 0, height: 0 }}+ animate={{+ opacity: 1,+ height: "auto",+ transition: {+ height: {+ duration: 0.35,+ ease: [0.23, 1, 0.32, 1],+ },+ opacity: { duration: 0.25, delay: 0.1 },+ },+ }}+ exit={{+ opacity: 0,+ height: 0,+ transition: {+ height: {+ duration: 0.25,+ ease: [0.23, 1, 0.32, 1],+ delay: 0.05,+ },+ opacity: { duration: 0.15 },+ },+ }}+ >+ <Form.Field+ control={form.control}+ name="corporate_name"+ render={({ field }) => (+ <Form.Item>+ <Form.Label>+ {t("onboarding.detailsSetup.corporateName")}+ </Form.Label>+ <Form.Control>+ <Input {...field} />+ </Form.Control>+ <Form.ErrorMessage />+ </Form.Item>+ )}+ />+ <Form.Field+ control={form.control}+ name="registration_number"+ render={({ field }) => (+ <Form.Item>+ <Form.Label optional>+ {t("onboarding.detailsSetup.registrationNumber")}+ </Form.Label>+ <Form.Control>+ <Input {...field} />+ </Form.Control>+ <Form.ErrorMessage />+ </Form.Item>+ )}+ />+ <Form.Field+ control={form.control}+ name="tax_id"+ render={({ field }) => (+ <Form.Item>+ <Form.Label optional>+ {t("onboarding.detailsSetup.taxId")}+ </Form.Label>+ <Form.Control>+ <Input {...field} />+ </Form.Control>+ <Form.ErrorMessage />+ </Form.Item>+ )}+ />+ </motion.div>+ )}+ </AnimatePresence>+ </div>+ </motion.div>++ <motion.div+ className="border-t border-dotted border-ui-border-base"+ variants={sectionVariants}+ initial="hidden"+ animate="visible"+ custom={5}+ />++ <motion.div+ className="grid grid-cols-2 gap-x-12 py-8"+ variants={sectionVariants}+ initial="hidden"+ animate="visible"+ custom={6}+ >+ <div />+ <Button type="submit" className="w-full" isLoading={isPending}>+ {t("onboarding.detailsSetup.completeSetup")}+ </Button>+ </motion.div>+ </form>+ </Form>+ </>+ );+};++const SubmittedStep = ({ email }: { email: string }) => {+ const { t } = useTranslation();+ const navigate = useNavigate();++ return (+ <div className="flex w-full max-w-[360px] flex-col items-center">+ <div className="relative mb-6">+ <motion.div+ className="flex size-14 items-center justify-center rounded-xl bg-ui-button-neutral shadow-buttons-neutral"+ initial={{ opacity: 0, scale: 0.8 }}+ animate={{ opacity: 1, scale: 1 }}+ transition={{+ duration: 0.5,+ delay: 0.1,+ ease: [0, 0.71, 0.2, 1.01],+ }}+ >+ <Avatar fallback="M" variant="rounded" size="xlarge" />+ </motion.div>+ <motion.div+ className="absolute -right-[5px] -top-1 flex size-5 items-center justify-center rounded-full border-[0.5px] border-[rgba(3,7,18,0.2)] bg-[#3B82F6] bg-gradient-to-b from-white/0 to-white/20 shadow-[0px_1px_2px_0px_rgba(3,7,18,0.12),0px_1px_2px_0px_rgba(255,255,255,0.10)_inset,0px_-1px_5px_0px_rgba(255,255,255,0.10)_inset]"+ initial={{ opacity: 0, scale: 0.5 }}+ animate={{ opacity: 1, scale: 1 }}+ transition={{+ duration: 1.2,+ delay: 0.8,+ ease: [0, 0.71, 0.2, 1.01],+ }}+ >+ <svg+ xmlns="http://www.w3.org/2000/svg"+ width="20"+ height="20"+ viewBox="0 0 20 20"+ fill="none"+ >+ <motion.path+ d="M5.8335 10.4167L9.16683 13.75L14.1668 6.25"+ stroke="white"+ strokeWidth="1.5"+ strokeLinecap="round"+ strokeLinejoin="round"+ initial={{ pathLength: 0, opacity: 0 }}+ animate={{ pathLength: 1, opacity: 1 }}+ transition={{+ duration: 1.3,+ delay: 1.1,+ bounce: 0.6,+ ease: [0.1, 0.8, 0.2, 1.01],+ }}+ />+ </svg>+ </motion.div>+ </div>++ <motion.div+ className="flex flex-col items-center gap-y-1"+ initial={{ opacity: 0, y: 8 }}+ animate={{ opacity: 1, y: 0 }}+ transition={{+ duration: 0.5,+ delay: 0.4,+ ease: [0.23, 1, 0.32, 1],+ }}+ >+ <Heading level="h1" className="text-center text-ui-fg-base">+ {t("onboarding.submitted.title")}+ </Heading>+ <Text+ size="small"+ className="text-ui-fg-subtle text-center max-w-[300px]"+ >+ {t("onboarding.submitted.description", { email })}+ </Text>+ </motion.div>++ <motion.div+ className="mt-6 w-full"+ initial={{ opacity: 0, y: 8 }}+ animate={{ opacity: 1, y: 0 }}+ transition={{+ duration: 0.5,+ delay: 0.7,+ ease: [0.23, 1, 0.32, 1],+ }}+ >+ <Button+ variant="secondary"+ className="w-full"+ onClick={() => navigate("/login")}+ >+ {t("onboarding.submitted.action")}+ </Button>+ </motion.div>+ </div>+ );+};diff --git a/packages/vendor/src/pages/register/password-validator.tsx b/packages/vendor/src/pages/register/password-validator.tsxdeleted file mode 100644index 9df2e08b4..000000000--- a/packages/vendor/src/pages/register/password-validator.tsx+++ /dev/null@@ -1,115 +0,0 @@-import { useCallback, useEffect, useState } from "react"--import { CheckCircle } from "@medusajs/icons"-import { Container, Text } from "@medusajs/ui"-import { useTranslation } from "react-i18next"--export interface PasswordValidationState {- isValid: boolean- lower: boolean- upper: boolean- "12chars": boolean- digit: boolean- specialChar: boolean-}--export const INITIAL_VALIDATION_STATE: PasswordValidationState = {- isValid: false,- lower: false,- upper: false,- "12chars": false,- digit: false,- specialChar: false,-}--function validatePassword(password: string) {- const errors = {- tooShort: password.length < 12,- noLower: !/[a-z]/.test(password),- noUpper: !/[A-Z]/.test(password),- noDigit: !/[0-9]/.test(password),- noSpecialChar: !/[!@#$%^&*(),.?":{}|<>_\-+=\[\]\\\/~`]/.test(password),- }-- return {- isValid: !Object.values(errors).some(Boolean),- errors,- }-}--type RuleKey = Exclude<keyof PasswordValidationState, "isValid">--const RULE_KEYS: RuleKey[] = ["12chars", "lower", "upper", "digit", "specialChar"]--const RULE_I18N_MAP: Record<RuleKey, string> = {- lower: "validation.rules.lower",- upper: "validation.rules.upper",- "12chars": "validation.rules.12chars",- digit: "validation.rules.digit",- specialChar: "validation.rules.specialChar",-}--const PasswordRule = ({- ruleKey,- hasError,-}: {- ruleKey: RuleKey- hasError: boolean-}) => {- const { t } = useTranslation()-- return (- <Text- as="p"- size="xsmall"- className={`flex items-center gap-2 ${hasError ? "text-ui-fg-error" : "text-ui-tag-green-text"}`}- >- <CheckCircle /> {t(RULE_I18N_MAP[ruleKey])}- </Text>- )-}--export const PasswordValidator = ({- password,- onValidationChange,-}: {- password: string- onValidationChange: (state: PasswordValidationState) => void-}) => {- const [dirty, setDirty] = useState(false)- const [state, setState] = useState<PasswordValidationState>(INITIAL_VALIDATION_STATE)-- const handleValidationChange = useCallback(onValidationChange, [])-- useEffect(() => {- if (!dirty && password.length > 0) {- setDirty(true)- }-- const validation = validatePassword(password)-- const nextState: PasswordValidationState = {- isValid: validation.isValid,- lower: validation.errors.noLower,- upper: validation.errors.noUpper,- "12chars": validation.errors.tooShort,- digit: validation.errors.noDigit,- specialChar: validation.errors.noSpecialChar,- }-- handleValidationChange(nextState)- setState(nextState)- }, [password, handleValidationChange])-- if (!dirty) {- return null- }-- return (- <Container className="flex flex-col gap-y-1 p-2">- {RULE_KEYS.map((key) => (- <PasswordRule key={key} ruleKey={key} hasError={state[key]} />- ))}- </Container>- )-}diff --git a/packages/vendor/src/pages/register/register-schema.ts b/packages/vendor/src/pages/register/register-schema.tsindex cdf468937..00f86d233 100644--- a/packages/vendor/src/pages/register/register-schema.ts+++ b/packages/vendor/src/pages/register/register-schema.ts@@ -3,16 +3,9 @@ import * as z from "zod"export const RegisterSchema = z.object({- name: z.string().min(2),- email: z.string().email(),- password: z- .string()- .min(12)- .regex(/[a-z]/)- .regex(/[A-Z]/)- .regex(/[0-9]/)- .regex(/[!@#$%^&*(),.?":{}|<>_\-+=\[\]\\\/~`]/),- confirmPassword: z.string(),+ email: z.string().email(i18n.t("register.validation.emailInvalid")),+ password: z.string().min(8, i18n.t("register.validation.passwordMinLength")),+ confirmPassword: z.string().min(1),}).refine((data) => data.password === data.confirmPassword, {message: i18n.t("register.passwordMismatch"),diff --git a/packages/vendor/src/pages/register/register.tsx b/packages/vendor/src/pages/register/register.tsxindex abef43646..558dde3ff 100644--- a/packages/vendor/src/pages/register/register.tsx+++ b/packages/vendor/src/pages/register/register.tsx@@ -1,23 +1,17 @@import { Children, ReactNode, useState } from "react"import { zodResolver } from "@hookform/resolvers/zod"-import { Alert, Button, Heading, Hint, Input, Text } from "@medusajs/ui"+import { Button, Heading, Hint, Input, Text } from "@medusajs/ui"import { useForm } from "react-hook-form"import { Trans, useTranslation } from "react-i18next"-import { Link, Navigate } from "react-router-dom"+import { Link, useNavigate } from "react-router-dom"import config from "virtual:mercur/config"import * as z from "zod"import { Form } from "@components/common/form"import AvatarBox from "@components/common/logo-box/avatar-box"-import { useSignUpWithEmailPass } from "@hooks/api"-import { fetchQuery } from "@lib/client"+import { useSignUpWithEmailPass, useSignInWithEmailPass } from "@hooks/api"-import {- INITIAL_VALIDATION_STATE,- PasswordValidationState,- PasswordValidator,-} from "./password-validator"import { RegisterSchema } from "./register-schema"const RegisterLogo = () => {@@ -29,7 +23,7 @@ const RegisterHeader = () => {return (<div className="mb-4 flex flex-col items-center">- <Heading>{t("register.title")}</Heading>+ <Heading>{t("register.title", { name: config.name ?? "Mercur" })}</Heading><Text size="small" className="text-ui-fg-subtle text-center">{t("register.hint")}</Text>@@ -39,106 +33,53 @@ const RegisterHeader = () => {const RegisterForm = () => {const { t } = useTranslation()- const [success, setSuccess] = useState(false)-- const [passwordValidation, setPasswordValidation] =- useState<PasswordValidationState>(INITIAL_VALIDATION_STATE)+ const navigate = useNavigate()+ const [serverError, setServerError] = useState<string | null>(null)const form = useForm<z.infer<typeof RegisterSchema>>({resolver: zodResolver(RegisterSchema),defaultValues: {- name: "",email: "",password: "",confirmPassword: "",},})- const { mutateAsync, isPending } = useSignUpWithEmailPass()- const [isCreatingSeller, setIsCreatingSeller] = useState(false)+ const { mutateAsync: signUp, isPending: isSigningUp } =+ useSignUpWithEmailPass()+ const { mutateAsync: signIn, isPending: isSigningIn } =+ useSignInWithEmailPass()- const handleSubmit = form.handleSubmit(async ({ name, email, password, confirmPassword }) => {- if (!passwordValidation.isValid) {- return- }+ const isPending = isSigningUp || isSigningIn+ const handleSubmit = form.handleSubmit(async ({ email, password }) => {+ setServerError(null)try {- const authResponse = await mutateAsync({ name, email, password, confirmPassword })- const token = (authResponse as { token: string }).token-- setIsCreatingSeller(true)-- await fetchQuery("/vendor/sellers", {- method: "POST",- body: { name, email },- headers: {- Authorization: `Bearer ${token}`,- },- })-- setSuccess(true)+ await signUp({ email, password })+ await signIn({ email, password })+ navigate("/onboarding", { state: { email } })} catch (error: any) {- setIsCreatingSeller(false)- const status = "status" in error ? error.status : undefined-- if (status === 401) {- form.setError("email", {- type: "manual",- message: error.message,- })- return- }-- if (status === 409) {- form.setError("email", {- type: "manual",- message: t("register.emailTaken"),- })- return- }-- form.setError("root.serverError", {- type: "manual",- message: error.message,- })+ setServerError(+ error?.message || t("register.error")+ )}})- const serverError = form.formState.errors?.root?.serverError?.messageconst validationError =form.formState.errors.email?.message ||form.formState.errors.password?.message ||- form.formState.errors.name?.message ||form.formState.errors.confirmPassword?.message- if (success) {- return <RegisterSuccess />- }+ const displayError = validationError || serverErrorreturn (- <div className="flex w-full flex-col gap-y-3">+ <div className="flex w-full flex-col items-center"><Form {...form}><formonSubmit={handleSubmit}className="flex w-full flex-col gap-y-6"><div className="flex flex-col gap-y-2">- <Form.Field- control={form.control}- name="name"- render={({ field }) => (- <Form.Item>- <Form.Control>- <Input- autoComplete="organization"- {...field}- className="bg-ui-bg-field-component"- placeholder={t("register.companyName")}- />- </Form.Control>- </Form.Item>- )}- /><Form.Fieldcontrol={form.control}name="email"@@ -189,80 +130,48 @@ const RegisterForm = () => {</Form.Item>)}/>- <PasswordValidator- password={form.watch("password")}- onValidationChange={setPasswordValidation}- />+ {displayError && (+ <div className="mt-6 text-center">+ <Hint className="inline-flex" variant={"error"}>+ {displayError}+ </Hint>+ </div>+ )}</div>- {validationError && (- <div className="text-center">- <Hint className="inline-flex" variant={"error"}>- {validationError}- </Hint>- </div>- )}- {serverError && (- <Alert- className="items-center bg-ui-bg-base p-2"- dismissible- variant="error"- >- {serverError}- </Alert>- )}- <Button className="w-full" type="submit" isLoading={isPending || isCreatingSeller}>- {t("register.signUp")}+ <Button className="w-full" type="submit" isLoading={isPending}>+ {t("actions.continue")}</Button></form></Form>- </div>- )-}--const RegisterSuccess = () => {- const { t } = useTranslation()-- return (- <div className="flex flex-col items-center">- <Heading>{t("register.successTitle")}</Heading>- <Text- size="small"- className="mt-2 max-w-[320px] text-center text-ui-fg-subtle"- >- {t("register.successHint")}- </Text>- <Link to="/login">- <Button className="mt-8">{t("register.backToLogin")}</Button>- </Link>+ <RegisterFooter /></div>)}const RegisterFooter = () => {return (- <span className="txt-small my-6 text-ui-fg-muted">- <Trans- i18nKey="register.alreadySeller"- components={[- <Link- key="login-link"- to="/login"- className="text-ui-fg-interactive transition-fg hover:text-ui-fg-interactive-hover focus-visible:text-ui-fg-interactive-hover font-medium outline-none"- />,- ]}- />- </span>+ <div className="flex w-full flex-col items-center">+ <div className="my-6 h-px w-full border-b border-dotted" />+ <span className="text-ui-fg-muted txt-small">+ <Trans+ i18nKey="register.alreadySeller"+ components={[+ <Link+ key="login-link"+ to="/login"+ className="txt-small text-ui-fg-base transition-fg hover:text-ui-fg-base-hover focus-visible:text-ui-fg-base-hover font-medium outline-none"+ />,+ ]}+ />+ </span>+ </div>)}const Root = ({ children }: { children?: ReactNode }) => {- if (!config.enableSellerRegistration) {- return <Navigate to="/login" replace />- }-return (- <div className="bg-ui-bg-subtle flex min-h-dvh w-dvw items-center justify-center">- <div className="m-4 flex w-full max-w-[280px] flex-col items-center">+ <div className="bg-ui-bg-subtle relative flex min-h-dvh w-dvw items-center justify-center p-4">+ <div className="flex w-full max-w-[360px] flex-col items-center">{Children.count(children) > 0 ? (children) : (@@ -270,7 +179,6 @@ const Root = ({ children }: { children?: ReactNode }) => {<RegisterLogo /><RegisterHeader /><RegisterForm />- <RegisterFooter /></>)}</div>@@ -282,6 +190,5 @@ export const RegisterPage = Object.assign(Root, {Logo: RegisterLogo,Header: RegisterHeader,Form: RegisterForm,- Success: RegisterSuccess,Footer: RegisterFooter,})