Skip to content

The complete open source platform to run your entire marketplace. Storefront, vendor panel, admin console, and integrations in one enterprise-grade platform you own.

feat(vendor): redesign seller onboarding as 4-step wizard with invite flow (#853)

Jakub Sieradzkib20557236a32
diff --git a/packages/admin/src/components/search/use-search-results.tsx b/packages/admin/src/components/search/use-search-results.tsx
index ab243c600..5676bc0c4 100644
--- a/packages/admin/src/components/search/use-search-results.tsx
+++ b/packages/admin/src/components/search/use-search-results.tsx
@@ -92,6 +92,7 @@ const useDynamicSearchResults = (
const { t } = useTranslation()
const debouncedSearch = useDebouncedSearch(q, 300)
+ const isSearchEnabled = Boolean(debouncedSearch)
const orderResponse = useOrders(
{
@@ -100,7 +101,7 @@ const useDynamicSearchResults = (
fields: "id,display_id,email",
},
{
- enabled: isAreaEnabled(currentArea, "order"),
+ enabled: isSearchEnabled && isAreaEnabled(currentArea, "order"),
placeholderData: keepPreviousData,
}
)
@@ -114,7 +115,7 @@ const useDynamicSearchResults = (
"id,title,thumbnail,-type,-collection,-options,-tags,-images,-variants,-sales_channels",
},
{
- enabled: isAreaEnabled(currentArea, "product"),
+ enabled: isSearchEnabled && isAreaEnabled(currentArea, "product"),
placeholderData: keepPreviousData,
}
)
@@ -127,7 +128,7 @@ const useDynamicSearchResults = (
fields: "id,name",
},
{
- enabled: isAreaEnabled(currentArea, "category"),
+ enabled: isSearchEnabled && isAreaEnabled(currentArea, "category"),
placeholderData: keepPreviousData,
}
)
@@ -139,7 +140,7 @@ const useDynamicSearchResults = (
fields: "id,title",
},
{
- enabled: isAreaEnabled(currentArea, "collection"),
+ enabled: isSearchEnabled && isAreaEnabled(currentArea, "collection"),
placeholderData: keepPreviousData,
}
)
@@ -151,7 +152,7 @@ const useDynamicSearchResults = (
fields: "id,email,first_name,last_name",
},
{
- enabled: isAreaEnabled(currentArea, "customer"),
+ enabled: isSearchEnabled && isAreaEnabled(currentArea, "customer"),
placeholderData: keepPreviousData,
}
)
@@ -163,7 +164,7 @@ const useDynamicSearchResults = (
fields: "id,name",
},
{
- enabled: isAreaEnabled(currentArea, "seller"),
+ enabled: isSearchEnabled && isAreaEnabled(currentArea, "seller"),
placeholderData: keepPreviousData,
}
)
@@ -175,7 +176,7 @@ const useDynamicSearchResults = (
fields: "id,title,sku",
},
{
- enabled: isAreaEnabled(currentArea, "inventory"),
+ enabled: isSearchEnabled && isAreaEnabled(currentArea, "inventory"),
placeholderData: keepPreviousData,
}
)
@@ -187,7 +188,7 @@ const useDynamicSearchResults = (
fields: "id,code,status",
},
{
- enabled: isAreaEnabled(currentArea, "promotion"),
+ enabled: isSearchEnabled && isAreaEnabled(currentArea, "promotion"),
placeholderData: keepPreviousData,
}
)
@@ -199,7 +200,7 @@ const useDynamicSearchResults = (
fields: "id,name",
},
{
- enabled: isAreaEnabled(currentArea, "campaign"),
+ enabled: isSearchEnabled && isAreaEnabled(currentArea, "campaign"),
placeholderData: keepPreviousData,
}
)
@@ -211,7 +212,7 @@ const useDynamicSearchResults = (
fields: "id,title",
},
{
- enabled: isAreaEnabled(currentArea, "priceList"),
+ enabled: isSearchEnabled && isAreaEnabled(currentArea, "priceList"),
placeholderData: keepPreviousData,
}
)
@@ -223,7 +224,7 @@ const useDynamicSearchResults = (
fields: "id,value",
},
{
- enabled: isAreaEnabled(currentArea, "productType"),
+ enabled: isSearchEnabled && isAreaEnabled(currentArea, "productType"),
placeholderData: keepPreviousData,
}
)
@@ -235,7 +236,7 @@ const useDynamicSearchResults = (
fields: "id,value",
},
{
- enabled: isAreaEnabled(currentArea, "productTag"),
+ enabled: isSearchEnabled && isAreaEnabled(currentArea, "productTag"),
placeholderData: keepPreviousData,
}
)
@@ -247,7 +248,7 @@ const useDynamicSearchResults = (
fields: "id,name",
},
{
- enabled: isAreaEnabled(currentArea, "location"),
+ enabled: isSearchEnabled && isAreaEnabled(currentArea, "location"),
placeholderData: keepPreviousData,
}
)
diff --git a/packages/admin/src/hooks/api/sellers.tsx b/packages/admin/src/hooks/api/sellers.tsx
index b32b5d4df..9186463d6 100644
--- a/packages/admin/src/hooks/api/sellers.tsx
+++ b/packages/admin/src/hooks/api/sellers.tsx
@@ -69,6 +69,32 @@ export const useSellers = (
return { ...data, ...rest };
};
+export const useSellerProducts = (
+ id: string,
+ query?: Omit<
+ InferClientInput<typeof sdk.admin.sellers.$id.products.query>,
+ "$id"
+ >,
+ options?: Omit<
+ UseQueryOptions<
+ InferClientOutput<typeof sdk.admin.sellers.$id.products.query>,
+ ClientError,
+ InferClientOutput<typeof sdk.admin.sellers.$id.products.query>,
+ QueryKey
+ >,
+ "queryKey" | "queryFn"
+ >,
+) => {
+ const { data, ...rest } = useQuery({
+ queryFn: () =>
+ sdk.admin.sellers.$id.products.query({ $id: id, ...query }),
+ queryKey: [...sellersQueryKeys.detail(id), "products", query],
+ ...options,
+ });
+
+ return { ...data, ...rest };
+};
+
export const useCreateSeller = (
options?: UseMutationOptions<
InferClientOutput<typeof sdk.admin.sellers.mutate>,
diff --git a/packages/admin/src/i18n/translations/en.json b/packages/admin/src/i18n/translations/en.json
index b5c065105..d4b6a975c 100644
--- a/packages/admin/src/i18n/translations/en.json
+++ b/packages/admin/src/i18n/translations/en.json
@@ -2509,6 +2509,10 @@
"banner": "Banner",
"address": {
"header": "Address",
+ "empty": {
+ "title": "No address",
+ "message": "There are no records to show"
+ },
"edit": {
"header": "Edit Address",
"description": "Update the address for this store.",
@@ -2517,6 +2521,10 @@
},
"paymentDetails": {
"header": "Payment Details",
+ "empty": {
+ "title": "No payment details",
+ "message": "There are no records to show"
+ },
"edit": {
"header": "Edit Payment Details",
"description": "Update the payment details for this store.",
@@ -2534,6 +2542,10 @@
},
"professionalDetails": {
"header": "Company Details",
+ "empty": {
+ "title": "No company details",
+ "message": "There are no records to show"
+ },
"edit": {
"header": "Edit Professional Details",
"description": "Update the professional details for this store.",
@@ -2545,6 +2557,14 @@
"taxId": "Tax ID"
}
},
+ "timeOff": {
+ "header": "Time off",
+ "empty": {
+ "title": "No time off yet",
+ "message": "This store doesn't have scheduled time off",
+ "action": "Create"
+ }
+ },
"scheduledClosure": {
"header": "Scheduled Closure",
"edit": {
@@ -3238,7 +3258,7 @@
"taxInclusivePricing": "Tax inclusive pricing",
"currency": "Currency",
"website": "Website",
- "premium": "Premium",
+ "premium": "Featured Store",
"professional": "Professional",
"address": "Address",
"address2": "Apartment, suite, etc.",
@@ -3392,7 +3412,7 @@
"city": "City",
"province": "Province",
"country_code": "Country Code",
- "premium": "Premium"
+ "premium": "Featured"
},
"status": {
"open": "Open",
@@ -3402,9 +3422,9 @@
"terminated": "Terminated"
},
"premium": {
- "yes": "Premium",
+ "yes": "Featured",
"no": "Standard",
- "description": "Mark this store as a premium seller"
+ "description": "If checked, the store will be highlighted with a special badge for internal use or promotional purposes."
},
"invite": {
"button": "Invite",
@@ -3430,6 +3450,14 @@
"ownerEmailHint": "The owner will be granted the Store Administration role.",
"successToast": "Store created successfully"
},
+ "request": {
+ "title": "Store request",
+ "description": "A new store request has been submitted. Review the details, make any necessary updates, and choose whether to confirm and publish the store or suspend the request.",
+ "reasonLabel": "Suspend reason",
+ "reasonPlaceholder": "Optional reason for suspending this store...",
+ "confirm": "Confirm",
+ "suspend": "Suspend"
+ },
"actions": {
"approve": {
"label": "Approve",
@@ -3482,4 +3510,4 @@
"commissionLines": {
"domain": "Commission Lines"
}
-}
\ No newline at end of file
+}
diff --git a/packages/admin/src/pages/stores/store-details/components/store-address-section.tsx b/packages/admin/src/pages/stores/store-details/components/store-address-section.tsx
index e24481616..94a76e33a 100644
--- a/packages/admin/src/pages/stores/store-details/components/store-address-section.tsx
+++ b/packages/admin/src/pages/stores/store-details/components/store-address-section.tsx
@@ -49,29 +49,40 @@ export const StoreAddressSection = ({ seller }: StoreAddressSectionProps) => {
]}
/>
</div>
- <div className="flex flex-col gap-2 px-2 pb-2">
- <div className="px-4 pb-2">
- <div className="flex items-center gap-4">
- <IconAvatar size="large" variant="squared">
- <BuildingStorefront />
- </IconAvatar>
- <div className="flex flex-1 flex-col">
- <Text size="small" leading="compact" weight="plus">
- {[address?.first_name, address?.last_name]
- .filter(Boolean)
- .join(" ") || "-"}
- </Text>
- <Text
- size="small"
- leading="compact"
- className="text-ui-fg-subtle"
- >
- {formattedAddress || "-"}
- </Text>
+ {formattedAddress ? (
+ <div className="flex flex-col gap-2 px-2 pb-2">
+ <div className="px-4 pb-2">
+ <div className="flex items-center gap-4">
+ <IconAvatar size="large" variant="squared">
+ <BuildingStorefront />
+ </IconAvatar>
+ <div className="flex flex-1 flex-col">
+ <Text size="small" leading="compact" weight="plus">
+ {[address?.first_name, address?.last_name]
+ .filter(Boolean)
+ .join(" ") || address?.company || formattedAddress}
+ </Text>
+ <Text
+ size="small"
+ leading="compact"
+ className="text-ui-fg-subtle"
+ >
+ {formattedAddress}
+ </Text>
+ </div>
</div>
</div>
</div>
- </div>
+ ) : (
+ <div className="flex flex-col items-center gap-y-1 pb-6 pt-2">
+ <Text size="small" leading="compact" weight="plus">
+ {t("store.address.empty.title")}
+ </Text>
+ <Text size="small" className="text-ui-fg-muted">
+ {t("store.address.empty.message")}
+ </Text>
+ </div>
+ )}
</Container>
);
};
diff --git a/packages/admin/src/pages/stores/store-details/components/store-company-details-section.tsx b/packages/admin/src/pages/stores/store-details/components/store-company-details-section.tsx
index 0757919f2..634be266e 100644
--- a/packages/admin/src/pages/stores/store-details/components/store-company-details-section.tsx
+++ b/packages/admin/src/pages/stores/store-details/components/store-company-details-section.tsx
@@ -18,6 +18,8 @@ export const StoreCompanyDetailsSection = ({
}: StoreCompanyDetailsSectionProps) => {
const { t } = useTranslation();
const details = seller.professional_details;
+ const hasDetails =
+ details?.corporate_name || details?.registration_number || details?.tax_id;
return (
<Container className="p-0">
@@ -39,29 +41,40 @@ export const StoreCompanyDetailsSection = ({
]}
/>
</div>
- <div className="flex flex-col gap-2 px-2 pb-2">
- <div className="px-4 pb-2">
- <div className="flex items-center gap-4">
- <IconAvatar size="large" variant="squared">
- <Buildings />
- </IconAvatar>
- <div className="flex flex-1 flex-col">
- <Text size="small" leading="compact" weight="plus">
- {details?.corporate_name || "-"}
- </Text>
- <Text
- size="small"
- leading="compact"
- className="text-ui-fg-subtle"
- >
- {[details?.registration_number, details?.tax_id]
- .filter(Boolean)
- .join(" · ") || "-"}
- </Text>
+ {hasDetails ? (
+ <div className="flex flex-col gap-2 px-2 pb-2">
+ <div className="px-4 pb-2">
+ <div className="flex items-center gap-4">
+ <IconAvatar size="large" variant="squared">
+ <Buildings />
+ </IconAvatar>
+ <div className="flex flex-1 flex-col">
+ <Text size="small" leading="compact" weight="plus">
+ {details?.corporate_name || "-"}
+ </Text>
+ <Text
+ size="small"
+ leading="compact"
+ className="text-ui-fg-subtle"
+ >
+ {[details?.registration_number, details?.tax_id]
+ .filter(Boolean)
+ .join(" · ") || "-"}
+ </Text>
+ </div>
</div>
</div>
</div>
- </div>
+ ) : (
+ <div className="flex flex-col items-center gap-y-1 pb-6 pt-2">
+ <Text size="small" leading="compact" weight="plus">
+ {t("store.professionalDetails.empty.title")}
+ </Text>
+ <Text size="small" className="text-ui-fg-muted">
+ {t("store.professionalDetails.empty.message")}
+ </Text>
+ </div>
+ )}
</Container>
);
};
diff --git a/packages/admin/src/pages/stores/store-details/components/store-configuration-section.tsx b/packages/admin/src/pages/stores/store-details/components/store-configuration-section.tsx
index 4f2d4df89..ee897df0b 100644
--- a/packages/admin/src/pages/stores/store-details/components/store-configuration-section.tsx
+++ b/packages/admin/src/pages/stores/store-details/components/store-configuration-section.tsx
@@ -1,9 +1,9 @@
import { PencilSquare } from "@medusajs/icons";
-import { Container, Heading } from "@medusajs/ui";
+import { Container, Heading, Table, Text } from "@medusajs/ui";
import { useTranslation } from "react-i18next";
import { ActionMenu } from "../../../../components/common/action-menu";
-import { DateRangeDisplay } from "../../../../components/common/date-range-display";
+import { DateCell } from "../../../../components/table/table-cells/common/date-cell";
import { InferClientOutput } from "@mercurjs/client";
import { sdk } from "@lib/client";
@@ -17,13 +17,12 @@ export const StoreConfigurationSection = ({
seller,
}: StoreConfigurationSectionProps) => {
const { t } = useTranslation();
+ const hasTimeOff = Boolean(seller.closed_from || seller.closed_to);
return (
- <Container className="flex flex-col gap-y-4">
- <div className="flex items-center justify-between">
- <Heading level="h2">
- {t("store.scheduledClosure.header")}
- </Heading>
+ <Container className="divide-y p-0">
+ <div className="flex items-center justify-between px-6 py-4">
+ <Heading level="h2">{t("store.timeOff.header")}</Heading>
<ActionMenu
groups={[
{
@@ -38,11 +37,35 @@ export const StoreConfigurationSection = ({
]}
/>
</div>
- <DateRangeDisplay
- startsAt={seller.closed_from}
- endsAt={seller.closed_to}
- showTime
- />
+ {hasTimeOff ? (
+ <Table>
+ <Table.Header>
+ <Table.Row>
+ <Table.HeaderCell>{t("fields.startDate")}</Table.HeaderCell>
+ <Table.HeaderCell>{t("fields.endDate")}</Table.HeaderCell>
+ </Table.Row>
+ </Table.Header>
+ <Table.Body>
+ <Table.Row>
+ <Table.Cell>
+ <DateCell date={seller.closed_from ?? null} />
+ </Table.Cell>
+ <Table.Cell>
+ <DateCell date={seller.closed_to ?? null} />
+ </Table.Cell>
+ </Table.Row>
+ </Table.Body>
+ </Table>
+ ) : (
+ <div className="flex flex-col items-center gap-y-1 pb-6 pt-2">
+ <Text size="small" leading="compact" weight="plus">
+ {t("store.timeOff.empty.title")}
+ </Text>
+ <Text size="small" className="text-ui-fg-muted">
+ {t("store.timeOff.empty.message")}
+ </Text>
+ </div>
+ )}
</Container>
);
};
diff --git a/packages/admin/src/pages/stores/store-details/components/store-details.tsx b/packages/admin/src/pages/stores/store-details/components/store-details.tsx
index c6a95d583..f5ad2a8da 100644
--- a/packages/admin/src/pages/stores/store-details/components/store-details.tsx
+++ b/packages/admin/src/pages/stores/store-details/components/store-details.tsx
@@ -1,5 +1,6 @@
import { ReactNode, Children, useState } from "react";
import { useParams } from "react-router-dom";
+import { useTranslation } from "react-i18next";
import { TwoColumnPageSkeleton } from "../../../../components/common/skeleton";
import { TwoColumnPage } from "../../../../components/layout/pages";
@@ -14,6 +15,8 @@ import { StoreAddressSection } from "./store-address-section";
import { StoreSubscriptionSection } from "./store-subscription-section";
import { StoreMembersSection } from "./store-members-section";
import { StoreRequestSection } from "./store-request-section";
+import { StoreOrdersSection } from "./store-orders-section";
+import { StoreProductsSection } from "./store-products-section";
import {
StoreDetailHeader,
StoreDetailTitle,
@@ -21,9 +24,9 @@ import {
StoreDetailEditButton,
} from "./store-detail-header";
-const TABS = [{ value: "users", label: "Users" }] as const;
+const TABS = ["orders", "users", "products", "timeOff"] as const;
-type Tab = (typeof TABS)[number]["value"];
+type Tab = (typeof TABS)[number];
const TabBar = ({
activeTab,
@@ -32,22 +35,42 @@ const TabBar = ({
activeTab: Tab;
onTabChange: (tab: Tab) => void;
}) => {
+ const { t } = useTranslation();
+
+ const labels: Record<Tab, string> = {
+ orders: t("orders.domain"),
+ users: t("users.domain"),
+ products: t("products.domain"),
+ timeOff: t("store.timeOff.header"),
+ };
+
return (
- <div className="flex items-center gap-x-3 py-2">
+ <div
+ role="tablist"
+ aria-label={t("stores.domain")}
+ className="flex flex-wrap items-center gap-x-3 py-2"
+ data-testid="store-detail-tabs"
+ >
{TABS.map((tab) => {
- const isActive = activeTab === tab.value;
+ const isActive = activeTab === tab;
return (
<button
- key={tab.value}
- onClick={() => onTabChange(tab.value)}
+ key={tab}
+ type="button"
+ onClick={() => onTabChange(tab)}
+ role="tab"
+ aria-selected={isActive}
+ aria-controls={`store-detail-tab-panel-${tab}`}
+ id={`store-detail-tab-${tab}`}
+ data-testid={`store-detail-tab-${tab}`}
className={`txt-compact-medium-plus rounded-full px-4 py-1.5 transition-colors ${
isActive
? "border-ui-border-base bg-ui-bg-base shadow-borders-base text-ui-fg-base"
: "text-ui-fg-subtle hover:text-ui-fg-base"
}`}
>
- {tab.label}
+ {labels[tab]}
</button>
);
})}
@@ -57,7 +80,7 @@ const TabBar = ({
const Root = ({ children }: { children?: ReactNode }) => {
const { id } = useParams();
- const [activeTab, setActiveTab] = useState<Tab>("users");
+ const [activeTab, setActiveTab] = useState<Tab>("orders");
const { seller, isLoading, isError, error } = useSeller(id!);
@@ -85,10 +108,44 @@ const Root = ({ children }: { children?: ReactNode }) => {
)}
<StoreGeneralSection seller={seller} />
<TabBar activeTab={activeTab} onTabChange={setActiveTab} />
- {activeTab === "users" && <StoreMembersSection sellerId={seller.id} />}
+ {activeTab === "orders" && (
+ <div
+ role="tabpanel"
+ id="store-detail-tab-panel-orders"
+ aria-labelledby="store-detail-tab-orders"
+ >
+ <StoreOrdersSection sellerId={seller.id} />
+ </div>
+ )}
+ {activeTab === "users" && (
+ <div
+ role="tabpanel"
+ id="store-detail-tab-panel-users"
+ aria-labelledby="store-detail-tab-users"
+ >
+ <StoreMembersSection sellerId={seller.id} />
+ </div>
+ )}
+ {activeTab === "products" && (
+ <div
+ role="tabpanel"
+ id="store-detail-tab-panel-products"
+ aria-labelledby="store-detail-tab-products"
+ >
+ <StoreProductsSection sellerId={seller.id} />
+ </div>
+ )}
+ {activeTab === "timeOff" && (
+ <div
+ role="tabpanel"
+ id="store-detail-tab-panel-timeOff"
+ aria-labelledby="store-detail-tab-timeOff"
+ >
+ <StoreConfigurationSection seller={seller} />
+ </div>
+ )}
</TwoColumnPage.Main>
<TwoColumnPage.Sidebar>
- <StoreConfigurationSection seller={seller} />
<StoreAddressSection seller={seller} />
<StoreCompanyDetailsSection seller={seller} />
<StorePaymentDetailsSection seller={seller} />
@@ -102,9 +159,9 @@ export const StoreDetailPage = Object.assign(Root, {
Main: TwoColumnPage.Main,
Sidebar: TwoColumnPage.Sidebar,
MainGeneralSection: StoreGeneralSection,
+ MainConfigurationSection: StoreConfigurationSection,
MainPaymentDetailsSection: StorePaymentDetailsSection,
MainCompanyDetailsSection: StoreCompanyDetailsSection,
- SidebarConfigurationSection: StoreConfigurationSection,
SidebarAddressSection: StoreAddressSection,
SidebarSubscriptionSection: StoreSubscriptionSection,
SidebarMembersSection: StoreMembersSection,
diff --git a/packages/admin/src/pages/stores/store-details/components/store-general-section.tsx b/packages/admin/src/pages/stores/store-details/components/store-general-section.tsx
index 6e53d1197..eab97c182 100644
--- a/packages/admin/src/pages/stores/store-details/components/store-general-section.tsx
+++ b/packages/admin/src/pages/stores/store-details/components/store-general-section.tsx
@@ -1,5 +1,4 @@
import { Children, ReactNode } from "react";
-import { Photo } from "@medusajs/icons";
import { Badge, Container, Text } from "@medusajs/ui";
import { useTranslation } from "react-i18next";
@@ -37,7 +36,18 @@ export const StoreGeneralSection = ({
/>
) : (
<div className="flex h-full w-full items-center justify-center">
- <Photo className="text-ui-fg-muted" />
+ <div
+ className="h-full w-full"
+ style={{
+ background: `repeating-linear-gradient(
+ -45deg,
+ transparent,
+ transparent 10px,
+ rgba(255,255,255,0.5) 10px,
+ rgba(255,255,255,0.5) 20px
+ )`,
+ }}
+ />
</div>
)}
</div>
@@ -83,7 +93,7 @@ export const StoreGeneralSection = ({
{seller.currency_code?.toUpperCase()}
</Badge>
<Text size="small" leading="compact">
- {currencies[seller.currency_code.toUpperCase()].name}
+ {currencies[seller.currency_code?.toUpperCase()]?.name || "-"}
</Text>
</div>
</div>
@@ -92,7 +102,7 @@ export const StoreGeneralSection = ({
{t("fields.premium")}
</Text>
<Text size="small" leading="compact">
- {seller.is_premium ? t("general.yes") : t("general.no")}
+ {seller.is_premium ? t("stores.premium.yes") : t("stores.premium.no")}
</Text>
</div>
<div className="text-ui-fg-subtle grid grid-cols-2 items-center px-6 py-4">
diff --git a/packages/admin/src/pages/stores/store-details/components/store-orders-section.tsx b/packages/admin/src/pages/stores/store-details/components/store-orders-section.tsx
new file mode 100644
index 000000000..7df8f640d
--- /dev/null
+++ b/packages/admin/src/pages/stores/store-details/components/store-orders-section.tsx
@@ -0,0 +1,92 @@
+import { Container, Heading } from "@medusajs/ui";
+import { keepPreviousData } from "@tanstack/react-query";
+import { useTranslation } from "react-i18next";
+
+import { _DataTable } from "../../../../components/table/data-table";
+import { useOrders } from "../../../../hooks/api/orders";
+import { useOrderTableColumns } from "../../../../hooks/table/columns/use-order-table-columns";
+import { useOrderTableFilters } from "../../../../hooks/table/filters/use-order-table-filters";
+import { useOrderTableQuery } from "../../../../hooks/table/query/use-order-table-query";
+import { useDataTable } from "../../../../hooks/use-data-table";
+
+const PAGE_SIZE = 10;
+const PREFIX = "store-orders";
+const DEFAULT_RELATIONS = "*customer,*items,*sales_channel";
+const DEFAULT_FIELDS =
+ "id,status,display_id,created_at,email,fulfillment_status,payment_status,total,currency_code";
+
+type StoreOrdersSectionProps = {
+ sellerId: string;
+};
+
+export const StoreOrdersSection = ({ sellerId }: StoreOrdersSectionProps) => {
+ const { t } = useTranslation();
+
+ const { searchParams, raw } = useOrderTableQuery({
+ pageSize: PAGE_SIZE,
+ prefix: PREFIX,
+ });
+
+ const { orders, count, isLoading, isError, error } = useOrders(
+ {
+ ...searchParams,
+ seller_id: [sellerId],
+ fields: `${DEFAULT_FIELDS},${DEFAULT_RELATIONS}`,
+ },
+ {
+ placeholderData: keepPreviousData,
+ },
+ );
+
+ const columns = useOrderTableColumns({
+ exclude: ["sales_channel", "actions"],
+ });
+ const filters = useOrderTableFilters();
+
+ const { table } = useDataTable({
+ data: orders ?? [],
+ columns,
+ enablePagination: true,
+ count,
+ pageSize: PAGE_SIZE,
+ prefix: PREFIX,
+ });
+
+ if (isError) {
+ throw error;
+ }
+
+ return (
+ <Container className="divide-y p-0" data-testid="store-orders-section">
+ <div
+ className="flex items-center justify-between px-6 py-4"
+ data-testid="store-orders-section-header"
+ >
+ <Heading level="h2" data-testid="store-orders-section-heading">
+ {t("orders.domain")}
+ </Heading>
+ </div>
+ <_DataTable
+ columns={columns}
+ table={table}
+ pagination
+ navigateTo={(row) => `/orders/${row.original.id}`}
+ filters={filters}
+ count={count}
+ isLoading={isLoading}
+ pageSize={PAGE_SIZE}
+ orderBy={[
+ { key: "display_id", label: t("orders.fields.displayId") },
+ { key: "created_at", label: t("fields.createdAt") },
+ { key: "updated_at", label: t("fields.updatedAt") },
+ ]}
+ search
+ queryObject={raw}
+ prefix={PREFIX}
+ noRecords={{
+ message: t("orders.list.noRecordsMessage"),
+ }}
+ />
+ </Container>
+ );
+};
diff --git a/packages/admin/src/pages/stores/store-details/components/store-payment-details-section.tsx b/packages/admin/src/pages/stores/store-details/components/store-payment-details-section.tsx
index ac4ed0de1..05440a1a7 100644
--- a/packages/admin/src/pages/stores/store-details/components/store-payment-details-section.tsx
+++ b/packages/admin/src/pages/stores/store-details/components/store-payment-details-section.tsx
@@ -48,27 +48,38 @@ export const StorePaymentDetailsSection = ({
]}
/>
</div>
- <div className="flex flex-col gap-2 px-2 pb-2">
- <div className="px-4 pb-2">
- <div className="flex items-center gap-4">
- <IconAvatar size="large" variant="squared">
- <CreditCard />
- </IconAvatar>
- <div className="flex flex-1 flex-col">
- <Text size="small" leading="compact" weight="plus">
- {details?.holder_name || "-"}
- </Text>
- <Text
- size="small"
- leading="compact"
- className="text-ui-fg-subtle"
- >
- {subtitle || "-"}
- </Text>
+ {details ? (
+ <div className="flex flex-col gap-2 px-2 pb-2">
+ <div className="px-4 pb-2">
+ <div className="flex items-center gap-4">
+ <IconAvatar size="large" variant="squared">
+ <CreditCard />
+ </IconAvatar>
+ <div className="flex flex-1 flex-col">
+ <Text size="small" leading="compact" weight="plus">
+ {details.holder_name || "-"}
+ </Text>
+ <Text
+ size="small"
+ leading="compact"
+ className="text-ui-fg-subtle"
+ >
+ {subtitle || "-"}
+ </Text>
+ </div>
</div>
</div>
</div>
- </div>
+ ) : (
+ <div className="flex flex-col items-center gap-y-1 pb-6 pt-2">
+ <Text size="small" leading="compact" weight="plus">
+ {t("store.paymentDetails.empty.title")}
+ </Text>
+ <Text size="small" className="text-ui-fg-muted">
+ {t("store.paymentDetails.empty.message")}
+ </Text>
+ </div>
+ )}
</Container>
);
};
diff --git a/packages/admin/src/pages/stores/store-details/components/store-products-section.tsx b/packages/admin/src/pages/stores/store-details/components/store-products-section.tsx
new file mode 100644
index 000000000..ec335fdb5
--- /dev/null
+++ b/packages/admin/src/pages/stores/store-details/components/store-products-section.tsx
@@ -0,0 +1,86 @@
+import { Container, Heading } from "@medusajs/ui";
+import { keepPreviousData } from "@tanstack/react-query";
+import { useTranslation } from "react-i18next";
+
+import { _DataTable } from "../../../../components/table/data-table";
+import { useSellerProducts } from "../../../../hooks/api/sellers";
+import { useProductTableColumns } from "../../../../hooks/table/columns/use-product-table-columns";
+import { useProductTableFilters } from "../../../../hooks/table/filters/use-product-table-filters";
+import { useProductTableQuery } from "../../../../hooks/table/query/use-product-table-query";
+import { useDataTable } from "../../../../hooks/use-data-table";
+
+const PAGE_SIZE = 10;
+const PREFIX = "store-products";
+
+type StoreProductsSectionProps = {
+ sellerId: string;
+};
+
+export const StoreProductsSection = ({
+ sellerId,
+}: StoreProductsSectionProps) => {
+ const { t } = useTranslation();
+
+ const { searchParams, raw } = useProductTableQuery({
+ pageSize: PAGE_SIZE,
+ prefix: PREFIX,
+ });
+
+ const { products, count, isPending, isError, error } = useSellerProducts(
+ sellerId,
+ searchParams,
+ {
+ placeholderData: keepPreviousData,
+ },
+ );
+
+ const columns = useProductTableColumns();
+ const filters = useProductTableFilters(["product_types"]);
+
+ const { table } = useDataTable({
+ columns,
+ data: products ?? [],
+ count,
+ getRowId: (row) => row.id,
+ pageSize: PAGE_SIZE,
+ prefix: PREFIX,
+ });
+
+ if (isError) {
+ throw error;
+ }
+
+ return (
+ <Container className="divide-y p-0" data-testid="store-products-section">
+ <div
+ className="flex items-center justify-between px-6 py-4"
+ data-testid="store-products-section-header"
+ >
+ <Heading level="h2" data-testid="store-products-section-heading">
+ {t("products.domain")}
+ </Heading>
+ </div>
+ <_DataTable
+ table={table}
+ filters={filters}
+ isLoading={isPending}
+ columns={columns}
+ count={count}
+ pageSize={PAGE_SIZE}
+ navigateTo={({ original }) => `/products/${original.id}`}
+ orderBy={[
+ { key: "title", label: t("fields.title") },
+ { key: "created_at", label: t("fields.createdAt") },
+ { key: "updated_at", label: t("fields.updatedAt") },
+ ]}
+ queryObject={raw}
+ search
+ pagination
+ prefix={PREFIX}
+ noRecords={{
+ message: t("products.list.noRecordsMessage"),
+ }}
+ />
+ </Container>
+ );
+};
diff --git a/packages/admin/src/pages/stores/store-details/components/store-request-section.tsx b/packages/admin/src/pages/stores/store-details/components/store-request-section.tsx
index 9d7283192..c99f27269 100644
--- a/packages/admin/src/pages/stores/store-details/components/store-request-section.tsx
+++ b/packages/admin/src/pages/stores/store-details/components/store-request-section.tsx
@@ -54,62 +54,46 @@ export const StoreRequestSection = ({ seller }: StoreRequestSectionProps) => {
};
return (
- <div
- style={{
- background:
- "repeating-linear-gradient(-45deg, rgb(212, 212, 216, 0.15), rgb(212, 212, 216,.15) 10px, transparent 10px, transparent 20px)",
- }}
- className="-m-4 mb-1 border-b border-l p-4"
- >
- <Container className="flex items-center justify-between p-0">
- <div className="flex w-full flex-col divide-y divide-dashed">
- <div className="flex items-center gap-2 px-6 py-4">
- <ExclamationCircleSolid className="text-orange-500" />
- <Heading level="h2">
- {t("stores.request.title", "Store request")}
- </Heading>
- </div>
- <div className="px-6 py-4">
- <Text className="text-ui-fg-subtle">
- {t(
- "stores.request.description",
- "A new store request has been submitted. Review the details, make any necessary updates, and choose whether to confirm and publish the store or suspend the request.",
- )}
- </Text>
- </div>
- <div className="flex flex-col gap-y-2 px-6 py-4">
- <Text size="small" weight="plus" className="text-ui-fg-subtle">
- {t("stores.request.reasonLabel", "Suspend reason")}
- </Text>
- <Textarea
- placeholder={t(
- "stores.request.reasonPlaceholder",
- "Optional reason for suspending this store...",
- )}
- value={reason}
- onChange={(e) => setReason(e.target.value)}
- />
- </div>
- <div className="bg-ui-bg-subtle flex items-center justify-end gap-x-2 rounded-b-xl px-4 py-4">
- <Button
- size="small"
- variant="secondary"
- onClick={handleConfirm}
- isLoading={isApproving}
- >
- {t("stores.request.confirm", "Confirm")}
- </Button>
- <Button
- size="small"
- variant="secondary"
- onClick={handleReject}
- isLoading={isSuspending}
- >
- {t("stores.request.suspend", "Suspend")}
- </Button>
- </div>
- </div>
- </Container>
- </div>
+ <Container className="p-0">
+ <div className="flex items-center gap-x-3 border-b border-ui-border-base px-6 py-4">
+ <ExclamationCircleSolid className="text-orange-500" />
+ <Heading level="h2">
+ {t("stores.request.title")}
+ </Heading>
+ </div>
+ <div className="px-6 py-4">
+ <Text className="text-ui-fg-subtle">
+ {t("stores.request.description")}
+ </Text>
+ </div>
+ <div className="flex flex-col gap-y-2 border-t border-ui-border-base px-6 py-4">
+ <Text size="small" weight="plus" className="text-ui-fg-subtle">
+ {t("stores.request.reasonLabel")}
+ </Text>
+ <Textarea
+ placeholder={t("stores.request.reasonPlaceholder")}
+ value={reason}
+ onChange={(e) => setReason(e.target.value)}
+ />
+ </div>
+ <div className="flex items-center justify-end gap-x-2 rounded-b-lg border-t border-ui-border-base bg-ui-bg-subtle px-6 py-4">
+ <Button
+ size="small"
+ variant="secondary"
+ onClick={handleConfirm}
+ isLoading={isApproving}
+ >
+ {t("stores.request.confirm")}
+ </Button>
+ <Button
+ size="small"
+ variant="secondary"
+ onClick={handleReject}
+ isLoading={isSuspending}
+ >
+ {t("stores.request.suspend")}
+ </Button>
+ </div>
+ </Container>
);
};
diff --git a/packages/admin/src/pages/stores/store-list/components/store-list-table/store-list-data-table.tsx b/packages/admin/src/pages/stores/store-list/components/store-list-table/store-list-data-table.tsx
index 75ae5ae34..64751694a 100644
--- a/packages/admin/src/pages/stores/store-list/components/store-list-table/store-list-data-table.tsx
+++ b/packages/admin/src/pages/stores/store-list/components/store-list-table/store-list-data-table.tsx
@@ -1,8 +1,8 @@
import { useMemo, useState } from "react"
import { useTranslation } from "react-i18next"
-import { Checkbox, toast } from "@medusajs/ui"
+import { Checkbox, toast, usePrompt } from "@medusajs/ui"
-import { PencilSquare } from "@medusajs/icons"
+import { PencilSquare, XCircleSolid } from "@medusajs/icons"
import { keepPreviousData } from "@tanstack/react-query"
import { RowSelectionState, createColumnHelper } from "@tanstack/react-table"
@@ -15,10 +15,11 @@ import { useSellersTableColumns } from "../../../../../hooks/table/columns/use-s
import { useSellerTableFilters } from "../../../../../hooks/table/filters"
import { useSellersTableQuery } from "../../../../../hooks/table/query"
import { useDataTable } from "../../../../../hooks/use-data-table"
-import { SellerDTO } from "@mercurjs/types"
+import { SellerDTO, SellerStatus } from "@mercurjs/types"
import { sdk } from "../../../../../lib/client"
import { queryClient } from "../../../../../lib/query-client"
import { sellersQueryKeys } from "../../../../../hooks/api/sellers"
+import { useTerminateSeller } from "../../../../../hooks/api/sellers"
const PAGE_SIZE = 10
@@ -122,6 +123,33 @@ export const StoreListDataTable = () => {
const columnHelper = createColumnHelper<SellerDTO>()
const StoreActions = ({ seller }: { seller: SellerDTO }) => {
+ const { t } = useTranslation()
+ const prompt = usePrompt()
+ const { mutateAsync: terminateSeller } = useTerminateSeller(seller.id)
+
+ const handleTerminate = async () => {
+ const confirmed = await prompt({
+ title: t("stores.actions.terminate.title"),
+ description: t("stores.actions.terminate.description"),
+ verificationText: seller.email || seller.name,
+ confirmText: t("actions.confirm"),
+ cancelText: t("actions.cancel"),
+ })
+
+ if (!confirmed) {
+ return
+ }
+
+ await terminateSeller(undefined, {
+ onSuccess: () => {
+ toast.success(t("stores.actions.terminate.success"))
+ },
+ onError: (error) => {
+ toast.error(error.message)
+ },
+ })
+ }
+
return (
<ActionMenu
groups={[
@@ -129,9 +157,18 @@ const StoreActions = ({ seller }: { seller: SellerDTO }) => {
actions: [
{
icon: <PencilSquare />,
- label: "Edit",
+ label: t("actions.edit"),
to: `/stores/${seller.id}/edit`,
},
+ ...(seller.status !== SellerStatus.TERMINATED
+ ? [
+ {
+ icon: <XCircleSolid />,
+ label: t("stores.actions.terminate.label"),
+ onClick: handleTerminate,
+ },
+ ]
+ : []),
],
},
]}
diff --git a/packages/core/src/api/admin/sellers/[id]/products/route.ts b/packages/core/src/api/admin/sellers/[id]/products/route.ts
new file mode 100644
index 000000000..8058287f4
--- /dev/null
+++ b/packages/core/src/api/admin/sellers/[id]/products/route.ts
@@ -0,0 +1,51 @@
+import {
+ AuthenticatedMedusaRequest,
+ MedusaResponse,
+} from "@medusajs/framework/http";
+import { ContainerRegistrationKeys } from "@medusajs/framework/utils";
+import { HttpTypes } from "@mercurjs/types";
+
+import { AdminGetSellerProductsParamsType } from "../../validators";
+
+export const GET = async (
+ req: AuthenticatedMedusaRequest<AdminGetSellerProductsParamsType>,
+ res: MedusaResponse<HttpTypes.AdminProductListResponse>,
+) => {
+ const query = req.scope.resolve(ContainerRegistrationKeys.QUERY);
+
+ const { data: sellerProducts, metadata } = await query.graph({
+ entity: "product_seller",
+ fields: ["product_id"],
+ filters: {
+ seller_id: req.params.id,
+ },
+ pagination: req.queryConfig.pagination,
+ });
+
+ const productIds = sellerProducts.map((entry) => entry.product_id);
+
+ if (!productIds.length) {
+ return res.json({
+ products: [],
+ count: 0,
+ offset: metadata?.skip ?? 0,
+ limit: metadata?.take ?? 0,
+ });
+ }
+
+ const { data: products } = await query.graph({
+ entity: "product",
+ fields: req.queryConfig.fields,
+ filters: {
+ ...req.filterableFields,
+ id: productIds,
+ },
+ });
+
+ res.json({
+ products,
+ count: metadata?.count ?? products.length,
+ offset: metadata?.skip ?? 0,
+ limit: metadata?.take ?? 0,
+ });
+};
diff --git a/packages/core/src/api/admin/sellers/middlewares.ts b/packages/core/src/api/admin/sellers/middlewares.ts
index b95ffacc9..ac6de9718 100644
--- a/packages/core/src/api/admin/sellers/middlewares.ts
+++ b/packages/core/src/api/admin/sellers/middlewares.ts
@@ -4,10 +4,16 @@ import {
validateAndTransformQuery,
} from "@medusajs/framework"
-import { adminSellerQueryConfig, adminMembersQueryConfig, adminMemberInvitesQueryConfig } from "./query-config"
+import {
+ adminSellerQueryConfig,
+ adminMembersQueryConfig,
+ adminMemberInvitesQueryConfig,
+ adminSellerProductsQueryConfig,
+} from "./query-config"
import {
AdminGetSellerParams,
AdminGetSellersParams,
+ AdminGetSellerProductsParams,
AdminCreateSeller,
AdminUpdateSeller,
AdminSuspendSeller,
@@ -181,6 +187,17 @@ export const adminSellersMiddlewares: MiddlewareRoute[] = [
),
],
},
+ // GET /admin/sellers/:id/products — list seller products
+ {
+ method: ["GET"],
+ matcher: "/admin/sellers/:id/products",
+ middlewares: [
+ validateAndTransformQuery(
+ AdminGetSellerProductsParams,
+ adminSellerProductsQueryConfig.list
+ ),
+ ],
+ },
// POST /admin/sellers/:id/members — direct add member
{
method: ["POST"],
diff --git a/packages/core/src/api/admin/sellers/query-config.ts b/packages/core/src/api/admin/sellers/query-config.ts
index b67385869..615cc4697 100644
--- a/packages/core/src/api/admin/sellers/query-config.ts
+++ b/packages/core/src/api/admin/sellers/query-config.ts
@@ -14,6 +14,7 @@ export const adminSellerFields = [
"is_premium",
"closed_from",
"closed_to",
+ "closure_note",
"*address",
"*payment_details",
"*professional_details",
@@ -74,3 +75,22 @@ export const adminMemberInvitesQueryConfig = {
isList: true,
},
}
+
+export const adminSellerProductsQueryConfig = {
+ list: {
+ defaults: [
+ "id",
+ "title",
+ "handle",
+ "status",
+ "thumbnail",
+ "*collection",
+ "*sales_channels",
+ "variants.id",
+ "created_at",
+ "updated_at",
+ ],
+ defaultLimit: 50,
+ isList: true,
+ },
+}
diff --git a/packages/core/src/api/admin/sellers/validators.ts b/packages/core/src/api/admin/sellers/validators.ts
index 5efa2ab90..cd8b839a9 100644
--- a/packages/core/src/api/admin/sellers/validators.ts
+++ b/packages/core/src/api/admin/sellers/validators.ts
@@ -28,6 +28,26 @@ export const AdminGetSellersParams = createFindParams({
})
)
+export type AdminGetSellerProductsParamsType = z.infer<
+ typeof AdminGetSellerProductsParams
+>
+export const AdminGetSellerProductsParams = createFindParams({
+ offset: 0,
+ limit: 50,
+}).merge(
+ z.object({
+ q: z.string().optional(),
+ id: z.union([z.string(), z.array(z.string())]).optional(),
+ status: z.union([z.string(), z.array(z.string())]).optional(),
+ collection_id: z.union([z.string(), z.array(z.string())]).optional(),
+ sales_channel_id: z.union([z.string(), z.array(z.string())]).optional(),
+ type_id: z.union([z.string(), z.array(z.string())]).optional(),
+ tag_id: z.union([z.string(), z.array(z.string())]).optional(),
+ created_at: createOperatorMap().optional(),
+ updated_at: createOperatorMap().optional(),
+ })
+)
+
export type AdminCreateSellerType = z.infer<typeof AdminCreateSeller>
export const AdminCreateSeller = z.object({
name: z.string(),
@@ -44,6 +64,7 @@ export const AdminCreateSeller = z.object({
is_premium: z.boolean().optional(),
closed_from: z.coerce.date().nullable().optional(),
closed_to: z.coerce.date().nullable().optional(),
+ closure_note: z.string().nullable().optional(),
metadata: z.record(z.unknown()).nullable().optional(),
member: z.object({
email: z.string().email(),
@@ -65,6 +86,7 @@ export const AdminUpdateSeller = z.object({
is_premium: z.boolean().optional(),
closed_from: z.coerce.date().nullable().optional(),
closed_to: z.coerce.date().nullable().optional(),
+ closure_note: z.string().nullable().optional(),
metadata: z.record(z.unknown()).nullable().optional(),
})
diff --git a/packages/core/src/api/vendor/sellers/query-config.ts b/packages/core/src/api/vendor/sellers/query-config.ts
index 352b8bccd..c5268edfb 100644
--- a/packages/core/src/api/vendor/sellers/query-config.ts
+++ b/packages/core/src/api/vendor/sellers/query-config.ts
@@ -29,6 +29,7 @@ export const retrieveVendorSellerQueryConfig = {
"is_premium",
"closed_from",
"closed_to",
+ "closure_note",
"*address",
"*payment_details",
"*professional_details",
diff --git a/packages/core/src/api/vendor/sellers/route.ts b/packages/core/src/api/vendor/sellers/route.ts
index a41e0dfd1..a914cef92 100644
--- a/packages/core/src/api/vendor/sellers/route.ts
+++ b/packages/core/src/api/vendor/sellers/route.ts
@@ -49,15 +49,17 @@ export const POST = async (
req: AuthenticatedMedusaRequest<VendorCreateSellerAccountType>,
res: MedusaResponse<HttpTypes.VendorSellerResponse>
) => {
- const { address, professional_details, member_email, ...sellerData } = req.validatedBody
+ const { address, professional_details, payment_details, member_email, ...sellerData } = req.validatedBody
const { result: seller } = await createSellerAccountWorkflow(req.scope).run({
input: {
auth_identity_id: req.auth_context.auth_identity_id,
+ member_id: req.auth_context.actor_id || undefined,
seller: sellerData,
member_email,
address,
professional_details,
+ payment_details,
},
})
diff --git a/packages/core/src/api/vendor/sellers/validators.ts b/packages/core/src/api/vendor/sellers/validators.ts
index e8f3bf2c5..c3d6ca494 100644
--- a/packages/core/src/api/vendor/sellers/validators.ts
+++ b/packages/core/src/api/vendor/sellers/validators.ts
@@ -17,6 +17,7 @@ export const VendorGetSellerParams = createSelectParams()
export type VendorCreateSellerAccountType = z.infer<typeof VendorCreateSellerAccount>
export const VendorCreateSellerAccount = z.object({
name: z.string(),
+ handle: z.string().optional(),
email: z.string().email(),
member_email: z.string().email(),
description: z.string().nullable().optional(),
@@ -42,6 +43,17 @@ export const VendorCreateSellerAccount = z.object({
tax_id: z.string().nullable().optional(),
})
.optional(),
+ payment_details: z
+ .object({
+ country_code: z.string().optional(),
+ holder_name: z.string().optional(),
+ bank_name: z.string().nullable().optional(),
+ iban: z.string().nullable().optional(),
+ bic: z.string().nullable().optional(),
+ routing_number: z.string().nullable().optional(),
+ account_number: z.string().nullable().optional(),
+ })
+ .optional(),
metadata: z.record(z.unknown()).nullable().optional(),
})
@@ -56,6 +68,7 @@ export const VendorUpdateSeller = z.object({
website_url: z.string().nullable().optional(),
closed_from: z.coerce.date().nullable().optional(),
closed_to: z.coerce.date().nullable().optional(),
+ closure_note: z.string().nullable().optional(),
metadata: z.record(z.unknown()).nullable().optional(),
})
diff --git a/packages/core/src/modules/seller/migrations/Migration20260410120000.ts b/packages/core/src/modules/seller/migrations/Migration20260410120000.ts
new file mode 100644
index 000000000..039e8fd09
--- /dev/null
+++ b/packages/core/src/modules/seller/migrations/Migration20260410120000.ts
@@ -0,0 +1,15 @@
+import { Migration } from "@medusajs/framework/mikro-orm/migrations";
+
+export class Migration20260410120000 extends Migration {
+
+ override async up(): Promise<void> {
+ this.addSql(`alter table if exists "seller" add column if not exists "closure_note" text null;`);
+ this.addSql(`alter table if exists "professional_details" alter column "corporate_name" type text, alter column "corporate_name" drop not null;`);
+ }
+
+ override async down(): Promise<void> {
+ this.addSql(`alter table if exists "seller" drop column if exists "closure_note";`);
+ this.addSql(`alter table if exists "professional_details" alter column "corporate_name" type text, alter column "corporate_name" set not null;`);
+ }
+
+}
diff --git a/packages/core/src/modules/seller/models/seller.ts b/packages/core/src/modules/seller/models/seller.ts
index 21628c328..223ff3306 100644
--- a/packages/core/src/modules/seller/models/seller.ts
+++ b/packages/core/src/modules/seller/models/seller.ts
@@ -24,6 +24,7 @@ const Seller = model
is_premium: model.boolean().default(false),
closed_from: model.dateTime().nullable(),
closed_to: model.dateTime().nullable(),
+ closure_note: model.text().nullable(),
professional_details: model.hasOne(() => ProfessionalDetails, {
mappedBy: "seller",
}),
diff --git a/packages/core/src/modules/seller/service.ts b/packages/core/src/modules/seller/service.ts
index 92750a82e..cb850760d 100644
--- a/packages/core/src/modules/seller/service.ts
+++ b/packages/core/src/modules/seller/service.ts
@@ -61,7 +61,7 @@ class SellerModuleService extends MedusaService({
...opts,
jwt_secret:
opts.jwt_secret ??
- configManager.config.projectConfig.http.jwtSecret as string,
+ (configManager.config.projectConfig.http.jwtSecret as string),
}
}
diff --git a/packages/core/src/workflows/seller/workflows/create-seller-account.ts b/packages/core/src/workflows/seller/workflows/create-seller-account.ts
index f0bedf88e..56a7e9a12 100644
--- a/packages/core/src/workflows/seller/workflows/create-seller-account.ts
+++ b/packages/core/src/workflows/seller/workflows/create-seller-account.ts
@@ -15,6 +15,7 @@ import {
SellerStatus,
UpdateSellerAddressDTO,
UpdateProfessionalDetailsDTO,
+ UpdatePaymentDetailsDTO,
} from "@mercurjs/types"
import { AdditionalData } from "@medusajs/framework/types"
@@ -26,6 +27,7 @@ import {
import { SellerWorkflowEvents } from "../../events"
import { updateSellerAddressWorkflow } from "./update-seller-address"
import { updateSellerProfessionalDetailsWorkflow } from "./update-seller-professional-details"
+import { updateSellerPaymentDetailsWorkflow } from "./update-seller-payment-details"
export const createSellerAccountWorkflowId = "create-seller-account"
@@ -36,6 +38,7 @@ type CreateSellerAccountWorkflowInput = {
member_id?: string
address?: UpdateSellerAddressDTO
professional_details?: UpdateProfessionalDetailsDTO
+ payment_details?: UpdatePaymentDetailsDTO
} & AdditionalData
export const createSellerAccountWorkflow = createWorkflow(
@@ -102,6 +105,15 @@ export const createSellerAccountWorkflow = createWorkflow(
}
)
+ when(input, ({ payment_details }) => !!payment_details).then(() => {
+ updateSellerPaymentDetailsWorkflow.runAsStep({
+ input: transform({ seller, input }, ({ seller, input }) => ({
+ seller_id: seller.id,
+ data: input.payment_details!,
+ })),
+ })
+ })
+
const sellerAccountCreated = createHook("sellerAccountCreated", {
seller,
additional_data: input.additional_data,
diff --git a/packages/types/src/seller/common.ts b/packages/types/src/seller/common.ts
index 280db15e6..2d204e660 100644
--- a/packages/types/src/seller/common.ts
+++ b/packages/types/src/seller/common.ts
@@ -191,6 +191,7 @@ export interface SellerDTO {
is_premium: boolean
closed_from: Date | null
closed_to: Date | null
+ closure_note: string | null
professional_details: ProfessionalDetailsDTO | null
address: SellerAddressDTO | null
payment_details: PaymentDetailsDTO | null
diff --git a/packages/vendor/src/components/layout/shell/shell.tsx b/packages/vendor/src/components/layout/shell/shell.tsx
index 2b7de7a30..d4ea1224f 100644
--- a/packages/vendor/src/components/layout/shell/shell.tsx
+++ b/packages/vendor/src/components/layout/shell/shell.tsx
@@ -270,7 +270,7 @@ const MobileSidebarContainer = ({ children }: PropsWithChildren) => {
const isTopLevelRoute = (pathname: string) => {
const clean = pathname.replace(/\/$/, "")
const segments = clean.split("/").filter(Boolean)
- return segments.length === 1 || clean === "/settings/store"
+ return segments.length === 1
}
const StoreSetupWidget = () => {
diff --git a/packages/vendor/src/components/onboarding-wizard/constants.ts b/packages/vendor/src/components/onboarding-wizard/constants.ts
new file mode 100644
index 000000000..db4a50051
--- /dev/null
+++ b/packages/vendor/src/components/onboarding-wizard/constants.ts
@@ -0,0 +1,26 @@
+export const WIZARD_STEPS = [
+ {
+ id: "store",
+ number: 1,
+ labelKey: "onboarding.wizard.steps.store",
+ },
+ {
+ id: "address",
+ number: 2,
+ labelKey: "onboarding.wizard.steps.address",
+ },
+ {
+ id: "company",
+ number: 3,
+ labelKey: "onboarding.wizard.steps.company",
+ },
+ {
+ id: "payment",
+ number: 4,
+ labelKey: "onboarding.wizard.steps.payment",
+ },
+] as const;
+
+export type WizardStepId = (typeof WIZARD_STEPS)[number]["id"];
+
+export const TOTAL_STEPS = WIZARD_STEPS.length;
diff --git a/packages/vendor/src/components/onboarding-wizard/hooks/use-onboarding.ts b/packages/vendor/src/components/onboarding-wizard/hooks/use-onboarding.ts
new file mode 100644
index 000000000..578ae985d
--- /dev/null
+++ b/packages/vendor/src/components/onboarding-wizard/hooks/use-onboarding.ts
@@ -0,0 +1,206 @@
+import { useState, useCallback, useRef } from "react";
+import { useNavigate } from "react-router-dom";
+import { toast } from "@medusajs/ui";
+
+import { useCreateSellerAccount } from "@hooks/api";
+import { TOTAL_STEPS } from "../constants";
+
+type StoreData = {
+ name: string;
+ email: string;
+ currency_code: string;
+ description?: string;
+ handle?: string;
+};
+
+type AddressData = {
+ address_1?: string;
+ address_2?: string;
+ postal_code?: string;
+ city?: string;
+ country_code: string;
+ province?: string;
+};
+
+type CompanyData = {
+ corporate_name?: string;
+ registration_number?: string;
+ tax_id?: string;
+};
+
+type PaymentData = {
+ country_code: string;
+ holder_name: string;
+ iban?: string;
+ bic?: string;
+ routing_number?: string;
+ account_number?: string;
+};
+
+export const useOnboarding = (memberEmail: string) => {
+ const navigate = useNavigate();
+ const [currentStep, setCurrentStep] = useState(0);
+ const [isSubmitting, setIsSubmitting] = useState(false);
+
+ const sellerIdRef = useRef<string | null>(null);
+ const [sellerIdState, setSellerIdState] = useState<string | null>(null);
+
+ const setSellerId = (id: string) => {
+ sellerIdRef.current = id;
+ setSellerIdState(id);
+ };
+
+ const storeDataRef = useRef<StoreData | null>(null);
+ const addressDataRef = useRef<AddressData | null>(null);
+ const companyDataRef = useRef<CompanyData | null>(null);
+
+ const { mutateAsync: createSeller, isPending: isCreating } =
+ useCreateSellerAccount();
+
+ const isPending = isCreating || isSubmitting;
+
+ // Step 1: Store — save locally
+ const submitStoreStep = useCallback(async (data: StoreData) => {
+ storeDataRef.current = data;
+ setCurrentStep(1);
+ }, []);
+
+ // Step 2: Address — save locally
+ const submitAddressStep = useCallback(async (data: AddressData) => {
+ addressDataRef.current = data;
+ setCurrentStep(2);
+ }, []);
+
+ const skipAddressStep = useCallback(() => {
+ addressDataRef.current = null;
+ setCurrentStep(2);
+ }, []);
+
+ // Step 3: Company — save locally
+ const submitCompanyStep = useCallback(async (data: CompanyData) => {
+ companyDataRef.current = data;
+ setCurrentStep(3);
+ }, []);
+
+ const skipCompanyStep = useCallback(() => {
+ companyDataRef.current = null;
+ setCurrentStep(3);
+ }, []);
+
+ /**
+ * Creates seller with ALL collected data (Steps 1-4) in one API call.
+ * This goes through POST /vendor/sellers which is unauthenticated —
+ * no seller_context needed, no session issues.
+ */
+ const createSellerWithAllData = useCallback(
+ async (paymentData?: PaymentData) => {
+ const storeData = storeDataRef.current;
+ if (!storeData) return;
+
+ // Already created (user went back and forward)
+ if (sellerIdRef.current) {
+ navigate("/store-select", { replace: true });
+ return;
+ }
+
+ const addressData = addressDataRef.current;
+ const companyData = companyDataRef.current;
+ const hasCompanyData =
+ companyData?.corporate_name ||
+ companyData?.registration_number ||
+ companyData?.tax_id;
+
+ const isUS = paymentData?.country_code === "us";
+
+ try {
+ setIsSubmitting(true);
+
+ const result = await createSeller({
+ name: storeData.name,
+ handle: storeData.handle || undefined,
+ email: storeData.email,
+ member_email: memberEmail,
+ currency_code: storeData.currency_code.toLowerCase(),
+ description: storeData.description || undefined,
+ address: addressData
+ ? {
+ address_1: addressData.address_1 || undefined,
+ address_2: addressData.address_2 || undefined,
+ postal_code: addressData.postal_code || undefined,
+ city: addressData.city || undefined,
+ country_code: addressData.country_code,
+ province: addressData.province || undefined,
+ }
+ : undefined,
+ professional_details: hasCompanyData
+ ? {
+ corporate_name: companyData!.corporate_name || undefined,
+ registration_number:
+ companyData!.registration_number || undefined,
+ tax_id: companyData!.tax_id || undefined,
+ }
+ : undefined,
+ payment_details: paymentData
+ ? {
+ country_code: paymentData.country_code,
+ holder_name: paymentData.holder_name,
+ iban: isUS ? null : paymentData.iban || null,
+ bic: isUS ? null : paymentData.bic || null,
+ routing_number: isUS
+ ? paymentData.routing_number || null
+ : null,
+ account_number: isUS
+ ? null
+ : paymentData.account_number || null,
+ }
+ : undefined,
+ });
+
+ const newSellerId = result.seller.id;
+ setSellerId(newSellerId);
+
+ navigate("/store-select", { replace: true });
+ } catch (error: any) {
+ toast.error(error.message);
+ } finally {
+ setIsSubmitting(false);
+ }
+ },
+ [createSeller, memberEmail, navigate],
+ );
+
+ // Step 4: Payment — create seller with everything and finish
+ const submitPaymentStep = useCallback(
+ async (data: PaymentData) => {
+ await createSellerWithAllData(data);
+ },
+ [createSellerWithAllData],
+ );
+
+ // Skip payment — create seller without payment details
+ const skipPaymentStep = useCallback(async () => {
+ await createSellerWithAllData();
+ }, [createSellerWithAllData]);
+
+ const goBack = useCallback(() => {
+ if (currentStep > 0) {
+ setCurrentStep((prev) => prev - 1);
+ }
+ }, [currentStep]);
+
+ return {
+ currentStep,
+ totalSteps: TOTAL_STEPS,
+ sellerId: sellerIdState,
+ isPending,
+ canGoBack: currentStep > 0,
+ goBack,
+ submitStoreStep,
+ submitAddressStep,
+ skipAddressStep,
+ submitCompanyStep,
+ skipCompanyStep,
+ submitPaymentStep,
+ skipPaymentStep,
+ };
+};
diff --git a/packages/vendor/src/components/onboarding-wizard/index.ts b/packages/vendor/src/components/onboarding-wizard/index.ts
new file mode 100644
index 000000000..060f342dd
--- /dev/null
+++ b/packages/vendor/src/components/onboarding-wizard/index.ts
@@ -0,0 +1 @@
+export { OnboardingWizard } from "./onboarding-wizard";
diff --git a/packages/vendor/src/components/onboarding-wizard/onboarding-wizard.tsx b/packages/vendor/src/components/onboarding-wizard/onboarding-wizard.tsx
new file mode 100644
index 000000000..4a710be0d
--- /dev/null
+++ b/packages/vendor/src/components/onboarding-wizard/onboarding-wizard.tsx
@@ -0,0 +1,110 @@
+import { AnimatePresence } from "motion/react";
+import { useNavigate } from "react-router-dom";
+
+import { useLogout, useSellers } from "@hooks/api";
+import { queryClient } from "@lib/query-client";
+import { WizardSidebar } from "./wizard-sidebar";
+import { WizardPreview } from "./wizard-preview";
+import { WizardStep } from "./wizard-step";
+import { useOnboarding } from "./hooks/use-onboarding";
+import { StoreStep } from "./steps/store-step";
+import { AddressStep } from "./steps/address-step";
+import { CompanyStep } from "./steps/company-step";
+import { PaymentStep } from "./steps/payment-step";
+
+type OnboardingWizardProps = {
+ memberEmail: string;
+};
+
+export const OnboardingWizard = ({ memberEmail }: OnboardingWizardProps) => {
+ const navigate = useNavigate();
+ const { mutateAsync: logoutMutation } = useLogout();
+ const { seller_members } = useSellers();
+ const hasStores = (seller_members?.length ?? 0) > 0;
+
+ const {
+ currentStep,
+ sellerId,
+ isPending,
+ goBack,
+ submitStoreStep,
+ submitAddressStep,
+ skipAddressStep,
+ submitCompanyStep,
+ skipCompanyStep,
+ submitPaymentStep,
+ skipPaymentStep,
+ } = useOnboarding(memberEmail);
+
+ const handleBack = async () => {
+ if (currentStep === 0) {
+ if (hasStores) {
+ navigate("/store-select", { replace: true });
+ } else {
+ await logoutMutation(undefined, {
+ onSuccess: () => queryClient.clear(),
+ onSettled: () => navigate("/login"),
+ });
+ }
+ } else {
+ goBack();
+ }
+ };
+
+ const renderStep = () => {
+ switch (currentStep) {
+ case 0:
+ return (
+ <WizardStep key="store">
+ <StoreStep onSubmit={submitStoreStep} isPending={isPending} />
+ </WizardStep>
+ );
+ case 1:
+ return (
+ <WizardStep key="address">
+ <AddressStep
+ onSubmit={submitAddressStep}
+ onSkip={skipAddressStep}
+ isPending={isPending}
+ />
+ </WizardStep>
+ );
+ case 2:
+ return (
+ <WizardStep key="company">
+ <CompanyStep
+ onSubmit={submitCompanyStep}
+ onSkip={skipCompanyStep}
+ isPending={isPending}
+ />
+ </WizardStep>
+ );
+ case 3:
+ return (
+ <WizardStep key="payment">
+ <PaymentStep
+ sellerId={sellerId!}
+ onSubmit={submitPaymentStep}
+ onSkip={skipPaymentStep}
+ isPending={isPending}
+ />
+ </WizardStep>
+ );
+ default:
+ return null;
+ }
+ };
+
+ return (
+ <div className="flex h-dvh w-dvw overflow-hidden">
+ <WizardSidebar
+ currentStep={currentStep}
+ onBack={handleBack}
+ showBack
+ >
+ <AnimatePresence mode="wait">{renderStep()}</AnimatePresence>
+ </WizardSidebar>
+ <WizardPreview currentStep={currentStep} />
+ </div>
+ );
+};
diff --git a/packages/vendor/src/components/onboarding-wizard/steps/address-step.tsx b/packages/vendor/src/components/onboarding-wizard/steps/address-step.tsx
new file mode 100644
index 000000000..7815fa683
--- /dev/null
+++ b/packages/vendor/src/components/onboarding-wizard/steps/address-step.tsx
@@ -0,0 +1,154 @@
+import { zodResolver } from "@hookform/resolvers/zod";
+import { Button, Heading, Input } from "@medusajs/ui";
+import i18n from "i18next";
+import { useForm } from "react-hook-form";
+import { useTranslation } from "react-i18next";
+import * as z from "zod";
+
+import { Form } from "@components/common/form";
+import { CountrySelect } from "@components/inputs/country-select/country-select";
+
+const AddressStepSchema = z.object({
+ address_1: z.string().optional(),
+ address_2: z.string().optional(),
+ postal_code: z.string().optional(),
+ city: z.string().optional(),
+ country_code: z.string().min(1, i18n.t("onboarding.wizard.validation.countryRequired")),
+ province: z.string().optional(),
+});
+
+type AddressStepValues = z.infer<typeof AddressStepSchema>;
+
+type AddressStepProps = {
+ onSubmit: (data: AddressStepValues) => Promise<void>;
+ onSkip: () => void;
+ isPending?: boolean;
+};
+
+export const AddressStep = ({ onSubmit, onSkip, isPending }: AddressStepProps) => {
+ const { t } = useTranslation();
+
+ const form = useForm<AddressStepValues>({
+ resolver: zodResolver(AddressStepSchema),
+ defaultValues: {
+ address_1: "",
+ address_2: "",
+ postal_code: "",
+ city: "",
+ country_code: "",
+ province: "",
+ },
+ });
+
+ const handleSubmit = form.handleSubmit(async (data) => {
+ await onSubmit(data);
+ });
+
+ return (
+ <div className="flex flex-col gap-y-8">
+ <Heading level="h2" className="text-ui-fg-base text-lg">
+ {t("onboarding.wizard.address.title")}
+ </Heading>
+
+ <Form {...form}>
+ <form onSubmit={handleSubmit} className="flex flex-col gap-y-6">
+ <div className="flex flex-col gap-y-4">
+ <Form.Field
+ control={form.control}
+ name="address_1"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label optional>{t("onboarding.wizard.address.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("onboarding.wizard.address.address2")}
+ </Form.Label>
+ <Form.Control>
+ <Input autoComplete="address-line2" {...field} />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+ <Form.Field
+ control={form.control}
+ name="postal_code"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label optional>{t("onboarding.wizard.address.postalCode")}</Form.Label>
+ <Form.Control>
+ <Input autoComplete="postal-code" {...field} />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+ <Form.Field
+ control={form.control}
+ name="city"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label optional>{t("onboarding.wizard.address.city")}</Form.Label>
+ <Form.Control>
+ <Input autoComplete="address-level2" {...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("onboarding.wizard.address.country")}</Form.Label>
+ <Form.Control>
+ <CountrySelect {...field} onChange={onChange} />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+ <Form.Field
+ control={form.control}
+ name="province"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label optional>{t("onboarding.wizard.address.state")}</Form.Label>
+ <Form.Control>
+ <Input autoComplete="address-level1" {...field} />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+ </div>
+ <div className="flex flex-col gap-y-2">
+ <Button type="submit" className="w-full" isLoading={isPending}>
+ {t("actions.continue")}
+ </Button>
+ <Button
+ type="button"
+ variant="transparent"
+ className="w-full"
+ onClick={onSkip}
+ >
+ {t("onboarding.wizard.skip")}
+ </Button>
+ </div>
+ </form>
+ </Form>
+ </div>
+ );
+};
diff --git a/packages/vendor/src/components/onboarding-wizard/steps/company-step.tsx b/packages/vendor/src/components/onboarding-wizard/steps/company-step.tsx
new file mode 100644
index 000000000..96afb34c5
--- /dev/null
+++ b/packages/vendor/src/components/onboarding-wizard/steps/company-step.tsx
@@ -0,0 +1,111 @@
+import { zodResolver } from "@hookform/resolvers/zod";
+import { Button, Heading, Input } from "@medusajs/ui";
+import { useForm } from "react-hook-form";
+import { useTranslation } from "react-i18next";
+import * as z from "zod";
+
+import { Form } from "@components/common/form";
+
+const CompanyStepSchema = z.object({
+ corporate_name: z.string().optional(),
+ registration_number: z.string().optional(),
+ tax_id: z.string().optional(),
+});
+
+type CompanyStepValues = z.infer<typeof CompanyStepSchema>;
+
+type CompanyStepProps = {
+ onSubmit: (data: CompanyStepValues) => Promise<void>;
+ onSkip: () => void;
+ isPending?: boolean;
+};
+
+export const CompanyStep = ({ onSubmit, onSkip, isPending }: CompanyStepProps) => {
+ const { t } = useTranslation();
+
+ const form = useForm<CompanyStepValues>({
+ resolver: zodResolver(CompanyStepSchema),
+ defaultValues: {
+ corporate_name: "",
+ registration_number: "",
+ tax_id: "",
+ },
+ });
+
+ const handleSubmit = form.handleSubmit(async (data) => {
+ await onSubmit(data);
+ });
+
+ return (
+ <div className="flex flex-col gap-y-8">
+ <Heading level="h2" className="text-ui-fg-base text-lg">
+ {t("onboarding.wizard.company.title")}
+ </Heading>
+
+ <Form {...form}>
+ <form onSubmit={handleSubmit} className="flex flex-col gap-y-6">
+ <div className="flex flex-col gap-y-4">
+ <Form.Field
+ control={form.control}
+ name="corporate_name"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label optional>
+ {t("onboarding.wizard.company.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.wizard.company.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.wizard.company.taxId")}
+ </Form.Label>
+ <Form.Control>
+ <Input {...field} />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+ </div>
+ <div className="flex flex-col gap-y-2">
+ <Button type="submit" className="w-full" isLoading={isPending}>
+ {t("actions.continue")}
+ </Button>
+ <Button
+ type="button"
+ variant="transparent"
+ className="w-full"
+ onClick={onSkip}
+ >
+ {t("onboarding.wizard.skip")}
+ </Button>
+ </div>
+ </form>
+ </Form>
+ </div>
+ );
+};
diff --git a/packages/vendor/src/components/onboarding-wizard/steps/payment-step.tsx b/packages/vendor/src/components/onboarding-wizard/steps/payment-step.tsx
new file mode 100644
index 000000000..0b21e131d
--- /dev/null
+++ b/packages/vendor/src/components/onboarding-wizard/steps/payment-step.tsx
@@ -0,0 +1,201 @@
+import { zodResolver } from "@hookform/resolvers/zod";
+import { Button, Heading, Input } from "@medusajs/ui";
+import i18n from "i18next";
+import { useForm } from "react-hook-form";
+import { useTranslation } from "react-i18next";
+import * as z from "zod";
+
+import { Form } from "@components/common/form";
+import { CountrySelect } from "@components/inputs/country-select/country-select";
+
+const PaymentStepSchema = z.object({
+ country_code: z.string().min(1, i18n.t("onboarding.wizard.validation.countryRequired")),
+ holder_name: z.string().min(1, i18n.t("onboarding.wizard.validation.accountNameRequired")),
+ iban: z.string().optional(),
+ bic: z.string().optional(),
+ routing_number: z.string().optional(),
+ account_number: z.string().optional(),
+});
+
+type PaymentStepValues = z.infer<typeof PaymentStepSchema>;
+
+type PaymentStepProps = {
+ sellerId: string;
+ onSubmit: (data: PaymentStepValues) => Promise<void>;
+ onSkip: () => void;
+ isPending?: boolean;
+};
+
+export const PaymentStep = ({
+ onSubmit,
+ onSkip,
+ isPending,
+}: PaymentStepProps) => {
+ const { t } = useTranslation();
+
+ const form = useForm<PaymentStepValues>({
+ resolver: zodResolver(PaymentStepSchema),
+ defaultValues: {
+ country_code: "",
+ holder_name: "",
+ iban: "",
+ bic: "",
+ routing_number: "",
+ account_number: "",
+ },
+ });
+
+ const selectedCountry = form.watch("country_code");
+ const isUS = selectedCountry === "us";
+
+ const handleSubmit = form.handleSubmit(async (data) => {
+ await onSubmit(data);
+ });
+
+ return (
+ <div className="flex flex-col gap-y-8">
+ <Heading level="h2" className="text-ui-fg-base text-lg">
+ {t("onboarding.wizard.payment.title")}
+ </Heading>
+
+ <Form {...form}>
+ <form onSubmit={handleSubmit} className="flex flex-col gap-y-6">
+ <div className="flex flex-col gap-y-4">
+ <Form.Field
+ control={form.control}
+ name="country_code"
+ render={({ field: { onChange, ref: _ref, ...field } }) => (
+ <Form.Item>
+ <Form.Label>
+ {t("onboarding.wizard.address.country")}
+ </Form.Label>
+ <Form.Control>
+ <CountrySelect {...field} onChange={onChange} />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+
+ {selectedCountry && (
+ <>
+ <Form.Field
+ control={form.control}
+ name="holder_name"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label>
+ {t("onboarding.wizard.payment.accountName")}
+ </Form.Label>
+ <Form.Control>
+ <Input {...field} />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+
+ {isUS ? (
+ <>
+ <Form.Field
+ control={form.control}
+ name="account_number"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label optional>
+ {t("onboarding.wizard.payment.accountNumber")}
+ </Form.Label>
+ <Form.Control>
+ <Input {...field} />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+ <Form.Field
+ control={form.control}
+ name="routing_number"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label optional>
+ {t("onboarding.wizard.payment.achRoutingNumber")}
+ </Form.Label>
+ <Form.Control>
+ <Input {...field} />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+ </>
+ ) : (
+ <>
+ <Form.Field
+ control={form.control}
+ name="iban"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label optional>
+ {t("onboarding.wizard.payment.iban")}
+ </Form.Label>
+ <Form.Control>
+ <Input {...field} />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+ <Form.Field
+ control={form.control}
+ name="account_number"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label optional>
+ {t("onboarding.wizard.payment.accountNumber")}
+ </Form.Label>
+ <Form.Control>
+ <Input {...field} />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+ <Form.Field
+ control={form.control}
+ name="bic"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label optional>
+ {t("onboarding.wizard.payment.swiftBic")}
+ </Form.Label>
+ <Form.Control>
+ <Input {...field} />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+ </>
+ )}
+ </>
+ )}
+ </div>
+
+ <div className="flex flex-col gap-y-2">
+ <Button type="submit" className="w-full" isLoading={isPending}>
+ {t("actions.continue")}
+ </Button>
+ <Button
+ type="button"
+ variant="transparent"
+ className="w-full"
+ onClick={onSkip}
+ >
+ {t("onboarding.wizard.skip")}
+ </Button>
+ </div>
+ </form>
+ </Form>
+ </div>
+ );
+};
diff --git a/packages/vendor/src/components/onboarding-wizard/steps/store-step.tsx b/packages/vendor/src/components/onboarding-wizard/steps/store-step.tsx
new file mode 100644
index 000000000..7ecb9801d
--- /dev/null
+++ b/packages/vendor/src/components/onboarding-wizard/steps/store-step.tsx
@@ -0,0 +1,155 @@
+import { zodResolver } from "@hookform/resolvers/zod";
+import { Button, Heading, Input, Select, Textarea } from "@medusajs/ui";
+import i18n from "i18next";
+import { useForm } from "react-hook-form";
+import { useTranslation } from "react-i18next";
+import { useLoaderData } from "react-router-dom";
+import * as z from "zod";
+
+import { Form } from "@components/common/form";
+import { HandleInput } from "@components/inputs/handle-input";
+import { useStore } from "@hooks/api";
+import { onboardingLoader } from "../../../pages/onboarding/loader";
+
+const StoreStepSchema = z.object({
+ name: z.string().min(1, i18n.t("onboarding.wizard.validation.nameRequired")),
+ email: z.string().email(i18n.t("onboarding.wizard.validation.emailInvalid")),
+ currency_code: z.string().min(1, i18n.t("onboarding.wizard.validation.currencyRequired")),
+ description: z.string().optional(),
+ handle: z.string().optional(),
+});
+
+type StoreStepValues = z.infer<typeof StoreStepSchema>;
+
+type StoreStepProps = {
+ onSubmit: (data: StoreStepValues) => Promise<void>;
+ isPending?: boolean;
+};
+
+export const StoreStep = ({ onSubmit, isPending }: StoreStepProps) => {
+ const { t } = useTranslation();
+ const initialData = useLoaderData() as Awaited<
+ ReturnType<typeof onboardingLoader>
+ >;
+ const { store } = useStore(undefined, { initialData });
+
+ const form = useForm<StoreStepValues>({
+ resolver: zodResolver(StoreStepSchema),
+ defaultValues: {
+ name: "",
+ email: "",
+ currency_code: "",
+ description: "",
+ handle: "",
+ },
+ });
+
+ const handleSubmit = form.handleSubmit(async (data) => {
+ await onSubmit(data);
+ });
+
+ return (
+ <div className="flex flex-col gap-y-8">
+ <Heading level="h2" className="text-ui-fg-base text-lg">
+ {t("onboarding.wizard.store.title")}
+ </Heading>
+
+ <Form {...form}>
+ <form onSubmit={handleSubmit} className="flex flex-col gap-y-6">
+ <div className="flex flex-col gap-y-4">
+ <Form.Field
+ control={form.control}
+ name="name"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label>{t("onboarding.wizard.store.name")}</Form.Label>
+ <Form.Control>
+ <Input autoComplete="organization" {...field} />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+ <Form.Field
+ control={form.control}
+ name="email"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label>{t("onboarding.wizard.store.email")}</Form.Label>
+ <Form.Control>
+ <Input type="email" autoComplete="email" {...field} />
+ </Form.Control>
+ <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} />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+ <Form.Field
+ control={form.control}
+ name="handle"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label optional>
+ {t("onboarding.wizard.store.handle")}
+ </Form.Label>
+ <Form.Control>
+ <HandleInput {...field} />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+ <Form.Field
+ control={form.control}
+ name="currency_code"
+ render={({ field: { onChange, ref, ...field } }) => (
+ <Form.Item>
+ <Form.Label>
+ {t("onboarding.wizard.store.currency")}
+ </Form.Label>
+ <Form.Control>
+ <Select {...field} onValueChange={onChange}>
+ <Select.Trigger ref={ref}>
+ <Select.Value
+ placeholder={t("onboarding.wizard.store.selectCurrency")}
+ />
+ </Select.Trigger>
+ <Select.Content>
+ {store?.supported_currencies?.map((sc) => (
+ <Select.Item
+ key={sc.currency_code}
+ value={sc.currency_code}
+ >
+ {sc.currency_code.toUpperCase()}
+ </Select.Item>
+ ))}
+ </Select.Content>
+ </Select>
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+ </div>
+ <Button type="submit" className="w-full" isLoading={isPending}>
+ {t("actions.continue")}
+ </Button>
+ </form>
+ </Form>
+ </div>
+ );
+};
diff --git a/packages/vendor/src/components/onboarding-wizard/wizard-preview.tsx b/packages/vendor/src/components/onboarding-wizard/wizard-preview.tsx
new file mode 100644
index 000000000..675a398c3
--- /dev/null
+++ b/packages/vendor/src/components/onboarding-wizard/wizard-preview.tsx
@@ -0,0 +1,38 @@
+import { useEffect } from "react";
+
+type WizardPreviewProps = {
+ currentStep: number;
+};
+
+const STEP_IMAGES: Record<number, string> = {
+ 0: "/onboarding/1.png",
+ 1: "/onboarding/2.png",
+ 2: "/onboarding/3.png",
+ 3: "/onboarding/4.png",
+};
+
+const preloadImages = () => {
+ Object.values(STEP_IMAGES).forEach((src) => {
+ const img = new Image();
+ img.src = src;
+ });
+};
+
+export const WizardPreview = ({ currentStep }: WizardPreviewProps) => {
+ useEffect(preloadImages, []);
+
+ const image = STEP_IMAGES[currentStep];
+
+ return (
+ <div
+ className="hidden lg:flex flex-1 relative overflow-hidden items-center justify-center"
+ style={{ backgroundImage: "url(/onboarding/bg.svg)", backgroundSize: "cover", backgroundPosition: "center" }}
+ >
+ <img
+ src={image}
+ alt=""
+ className="w-[75%] max-h-[75%] object-contain"
+ />
+ </div>
+ );
+};
diff --git a/packages/vendor/src/components/onboarding-wizard/wizard-sidebar.tsx b/packages/vendor/src/components/onboarding-wizard/wizard-sidebar.tsx
new file mode 100644
index 000000000..8e3c44eef
--- /dev/null
+++ b/packages/vendor/src/components/onboarding-wizard/wizard-sidebar.tsx
@@ -0,0 +1,46 @@
+import { ReactNode } from "react";
+import { ChevronLeft } from "@medusajs/icons";
+import { Text } from "@medusajs/ui";
+import { useTranslation } from "react-i18next";
+
+import { TOTAL_STEPS } from "./constants";
+
+type WizardSidebarProps = {
+ currentStep: number;
+ onBack?: () => void;
+ showBack?: boolean;
+ children: ReactNode;
+};
+
+export const WizardSidebar = ({
+ currentStep,
+ onBack,
+ showBack,
+ children,
+}: WizardSidebarProps) => {
+ const { t } = useTranslation();
+
+ return (
+ <div className="flex w-full flex-col lg:w-[584px] lg:shrink-0 h-full bg-ui-bg-base border-r border-ui-border-base overflow-y-auto">
+ <div className="flex flex-1 flex-col p-8 lg:px-14 lg:py-12">
+ {showBack && onBack && (
+ <button
+ type="button"
+ onClick={onBack}
+ className="txt-compact-small text-ui-fg-base flex items-center gap-x-0.5 font-medium transition-colors hover:text-ui-fg-subtle self-start mb-6"
+ >
+ <ChevronLeft className="size-4" />
+ <span>{t("actions.back")}</span>
+ </button>
+ )}
+ <Text size="small" className="text-ui-fg-subtle mb-1">
+ {t("onboarding.wizard.stepOf", {
+ current: currentStep + 1,
+ total: TOTAL_STEPS,
+ })}
+ </Text>
+ {children}
+ </div>
+ </div>
+ );
+};
diff --git a/packages/vendor/src/components/onboarding-wizard/wizard-step.tsx b/packages/vendor/src/components/onboarding-wizard/wizard-step.tsx
new file mode 100644
index 000000000..b7710a0f8
--- /dev/null
+++ b/packages/vendor/src/components/onboarding-wizard/wizard-step.tsx
@@ -0,0 +1,32 @@
+import { ReactNode } from "react";
+import { motion } from "motion/react";
+
+type WizardStepProps = {
+ children: ReactNode;
+};
+
+const stepVariants = {
+ initial: { opacity: 0, y: 12, filter: "blur(4px)" },
+ animate: { opacity: 1, y: 0, filter: "blur(0px)" },
+ exit: {
+ opacity: 0,
+ y: -8,
+ filter: "blur(4px)",
+ transition: { duration: 0.2, ease: [0.23, 1, 0.32, 1] },
+ },
+};
+
+export const WizardStep = ({ children }: WizardStepProps) => {
+ return (
+ <motion.div
+ variants={stepVariants}
+ initial="initial"
+ animate="animate"
+ exit="exit"
+ transition={{ duration: 0.35, ease: [0.23, 1, 0.32, 1] }}
+ className="flex flex-col"
+ >
+ {children}
+ </motion.div>
+ );
+};
diff --git a/packages/vendor/src/i18n/translations/en.json b/packages/vendor/src/i18n/translations/en.json
index ff1c1ac48..6135c60ac 100644
--- a/packages/vendor/src/i18n/translations/en.json
+++ b/packages/vendor/src/i18n/translations/en.json
@@ -2697,14 +2697,14 @@
},
"status": {
"active": "Active",
- "pendingApproval": "Pending approval",
+ "pendingApproval": "Pending",
"suspended": "Suspended",
"terminated": "Terminated"
},
"alert": {
"pendingApproval": {
- "title": "Your store is under review",
- "description": "Your application is being reviewed by our team. You will be notified once your store is approved."
+ "title": "Store request",
+ "description": "Store request has been submitted successfully. Once the Admin reviews it, you'll receive a notification in your panel."
},
"suspended": {
"title": "Your store has been suspended",
@@ -2746,6 +2746,10 @@
},
"address": {
"header": "Address",
+ "empty": {
+ "title": "No address",
+ "message": "There are no records to show"
+ },
"edit": {
"header": "Edit Address",
"description": "Update the address for your store.",
@@ -2754,6 +2758,10 @@
},
"paymentDetails": {
"header": "Payment Details",
+ "empty": {
+ "title": "No payment details",
+ "message": "There are no records to show"
+ },
"edit": {
"header": "Edit Payment Details",
"description": "Update the payment details for your store.",
@@ -2771,6 +2779,10 @@
},
"professionalDetails": {
"header": "Company Details",
+ "empty": {
+ "title": "No company details",
+ "message": "There are no records to show"
+ },
"edit": {
"header": "Edit Professional Details",
"description": "Update the professional details for your store.",
@@ -2782,18 +2794,34 @@
"taxId": "Tax ID"
}
},
- "scheduledClosure": {
- "header": "Scheduled Closure",
- "edit": {
- "header": "Schedule Store Closure",
- "description": "Configure the scheduled closure dates for your store.",
- "successToast": "Scheduled closure updated"
+ "timeOff": {
+ "header": "Time off",
+ "columns": {
+ "firstDay": "First day",
+ "lastDay": "Last day",
+ "note": "Note"
+ },
+ "empty": {
+ "title": "No time off yet",
+ "message": "This store doesn't have scheduled time off",
+ "action": "Create"
+ },
+ "create": {
+ "header": "Create Time Off",
+ "description": "Schedule a time off period for your store.",
+ "successToast": "Time off saved"
},
"fields": {
- "closedFrom": "Close from",
- "closedTo": "Close until",
- "closedToHint": "If empty, the store will remain closed indefinitely."
- }
+ "firstDay": "First day",
+ "lastDay": "Last day",
+ "lastDayHint": "Leave empty to keep the store closed indefinitely",
+ "note": "Note"
+ },
+ "deleteConfirm": {
+ "title": "Delete time off",
+ "description": "Are you sure you want to remove this time off period?"
+ },
+ "deleteSuccess": "Time off removed"
},
"subscription": {
"header": "Subscription",
@@ -2805,6 +2833,9 @@
"requiresOrders": "Requires orders",
"month": "month"
},
+ "edit": {
+ "websiteHint": "Must include protocol (e.g. https://)"
+ },
"toast": {
"update": "Store successfully updated",
"currenciesUpdated": "Currencies updated successfully",
@@ -3203,20 +3234,78 @@
"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 select your store and complete your setup.",
"action": "Continue to dashboard"
+ },
+ "wizard": {
+ "stepOf": "Step {{current}} of {{total}}",
+ "steps": {
+ "store": "Store Details",
+ "address": "Address",
+ "company": "Company Details",
+ "payment": "Payment Details"
+ },
+ "store": {
+ "title": "Enter your store details",
+ "name": "Name",
+ "email": "Email",
+ "handle": "Handle",
+ "handlePlaceholder": "my-store",
+ "currency": "Currency",
+ "selectCurrency": "Select",
+ "currencyHint": "Cannot be changed after store is created"
+ },
+ "skip": "Skip",
+ "address": {
+ "title": "Enter your address",
+ "address": "Address",
+ "address2": "Apartment, suite, etc.",
+ "postalCode": "Postal Code",
+ "city": "City",
+ "country": "Country",
+ "state": "State"
+ },
+ "company": {
+ "title": "Enter your company details",
+ "subtitle": "Professional seller information",
+ "corporateName": "Corporate name",
+ "registrationNumber": "Registration number",
+ "taxId": "Tax ID"
+ },
+ "payment": {
+ "title": "Enter your payment details",
+ "subtitle": "How you'd like to receive payouts",
+ "accountName": "Account name",
+ "accountNumber": "Account number",
+ "achRoutingNumber": "ACH routing number",
+ "iban": "IBAN",
+ "swiftBic": "SWIFT / BIC"
+ },
+ "validation": {
+ "nameRequired": "Please enter a name",
+ "emailInvalid": "Please enter an email",
+ "currencyRequired": "Please select a currency",
+ "countryRequired": "Please select a country",
+ "accountNameRequired": "Please enter account name"
+ },
+ "preview": {
+ "title": "Welcome to Mercur",
+ "description": "Your all-in-one vendor portal for managing your store, products, orders, and payouts.",
+ "placeholder": "App preview"
+ }
}
},
"invite": {
- "title": "You've been invited to {{name}}",
- "hint": "Create your account below",
+ "title": "You're invited to join {{name}}!",
+ "hint": "Enter your details and create a password to set up your account.",
"existingMemberHint": "Sign in with your existing account",
"backToLogin": "Back to login",
"createAccount": "Create account",
"signIn": "Sign in",
- "alreadyHaveAccount": "Already have an account? - <0>Log in</0>",
+ "alreadyHaveAccount": "Already have an account?",
+ "logIn": "Log in",
"emailTooltip": "Your email cannot be changed. If you would like to use another email, a new invite must be sent.",
"invalidInvite": "The invite is invalid or has expired.",
- "successTitle": "You joined {{name}}",
- "successHint": "You can now access the vendor portal. Log in to get started.",
+ "successTitle": "Welcome to {{name}}!",
+ "successHint": "Setting up your account...",
"invalidTokenTitle": "Your invite token is invalid",
"invalidTokenHint": "Try requesting a new invite link.",
"passwordMismatch": "Passwords do not match",
diff --git a/packages/vendor/src/pages/invite/invite.tsx b/packages/vendor/src/pages/invite/invite.tsx
index 0b41da592..8887ed014 100644
--- a/packages/vendor/src/pages/invite/invite.tsx
+++ b/packages/vendor/src/pages/invite/invite.tsx
@@ -1,19 +1,29 @@
import { zodResolver } from "@hookform/resolvers/zod";
-import { Alert, Button, Heading, Hint, Input, Text, toast } from "@medusajs/ui";
+import {
+ Alert,
+ Button,
+ Heading,
+ Hint,
+ Input,
+ Text,
+ toast,
+} from "@medusajs/ui";
import i18n from "i18next";
import { AnimatePresence, motion } from "motion/react";
-import { useState } from "react";
+import { useEffect, useRef, useState } from "react";
import { useForm } from "react-hook-form";
import { useTranslation } from "react-i18next";
import { decodeToken } from "react-jwt";
-import { Link, useSearchParams } from "react-router-dom";
+import { Link, useNavigate, useSearchParams } from "react-router-dom";
import * as z from "zod";
import { Form } from "@components/common/form";
import AvatarBox from "@components/common/logo-box/avatar-box";
import { useSignInForInvite, useSignUpForInvite } from "@hooks/api/auth";
import { useAcceptInvite } from "@hooks/api/invites";
+import { useSelectSeller } from "@hooks/api";
import { isFetchError } from "@lib/is-fetch-error";
+import { sdk } from "@lib/client";
const CreateAccountSchema = z
.object({
@@ -51,80 +61,123 @@ export const Invite = () => {
const isValidInvite = invite && validateDecodedInvite(invite);
return (
- <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">
- <AvatarBox checked={success} />
- <div className="w-full will-change-contents">
- {isValidInvite ? (
- <AnimatePresence>
- {!success ? (
- <motion.div
- key="create-account"
- initial={false}
- animate={{ y: 0 }}
- exit={{ height: 0, y: 40 }}
- transition={{
- duration: 0.8,
- delay: 0.6,
- ease: [0, 0.71, 0.2, 1.01],
- }}
- className="w-full will-change-transform"
- >
- <motion.div
- initial={false}
- animate={{ opacity: 1, scale: 1 }}
- exit={{ opacity: 0, scale: 0.7 }}
- transition={{
- duration: 0.6,
- delay: 0,
- ease: [0, 0.71, 0.2, 1.01],
- }}
- key="inner-create-account"
- >
- <CreateView
- onSuccess={() => setSuccess(true)}
- token={token!}
- invite={invite}
- />
- </motion.div>
- </motion.div>
- ) : (
- <motion.div
- key="success-view"
- initial={{ opacity: 0, scale: 0.4 }}
- animate={{ opacity: 1, scale: 1 }}
- transition={{
- duration: 1,
- delay: 0.6,
- ease: [0, 0.71, 0.2, 1.01],
- }}
- className="w-full"
- >
- <SuccessView sellerName={invite.seller_name} />
- </motion.div>
- )}
- </AnimatePresence>
+ <div className="flex h-dvh w-dvw overflow-hidden">
+ <div className="flex w-full flex-col lg:w-[584px] lg:shrink-0 h-full bg-ui-bg-base border-r border-ui-border-base overflow-y-auto">
+ <AnimatePresence mode="wait">
+ {success && invite ? (
+ <motion.div
+ key="success"
+ initial={{ opacity: 0 }}
+ animate={{ opacity: 1 }}
+ transition={{ duration: 0.6, delay: 0.2 }}
+ className="flex flex-1 flex-col items-center justify-center p-8 lg:px-14"
+ >
+ <SuccessView sellerName={invite.seller_name} />
+ </motion.div>
) : (
- <InvalidView />
+ <motion.div
+ key="form"
+ exit={{ opacity: 0, y: -20 }}
+ transition={{ duration: 0.4, ease: "easeInOut" }}
+ className="flex flex-1 flex-col p-8 lg:px-14 lg:py-12"
+ >
+ <AvatarBox />
+ <div className="mt-8 w-full">
+ {isValidInvite ? (
+ <CreateView
+ token={token!}
+ invite={invite}
+ onSuccess={() => setSuccess(true)}
+ />
+ ) : (
+ <InvalidView />
+ )}
+ </div>
+ </motion.div>
)}
- </div>
+ </AnimatePresence>
+ </div>
+ <div
+ className="hidden lg:flex flex-1 relative overflow-hidden items-center justify-center"
+ style={{
+ backgroundImage: "url(/onboarding/bg.svg)",
+ backgroundSize: "cover",
+ backgroundPosition: "center",
+ }}
+ >
+ <img
+ src="/onboarding/0.png"
+ alt=""
+ className="w-[75%] max-h-[75%] object-contain"
+ />
</div>
</div>
);
};
-const LoginLink = () => {
+const SuccessView = ({ sellerName }: { sellerName: string }) => {
const { t } = useTranslation();
+ const navigate = useNavigate();
+ const { mutateAsync: selectSeller } = useSelectSeller();
+ const hasRedirected = useRef(false);
+
+ useEffect(() => {
+ if (hasRedirected.current) return;
+ hasRedirected.current = true;
+
+ const redirect = async () => {
+ await new Promise((r) => setTimeout(r, 2500));
+
+ try {
+ const { seller_members } = await sdk.vendor.sellers.query({});
+ if (seller_members?.length === 1) {
+ await selectSeller({ seller_id: seller_members[0].seller.id });
+ navigate("/", { replace: true });
+ return;
+ }
+ } catch {
+ // Fall through
+ }
+
+ navigate("/store-select", { replace: true });
+ };
+
+ redirect();
+ }, [navigate, selectSeller]);
return (
- <div className="flex w-full flex-col items-center">
- <div className="my-6 h-px w-full border-b border-dotted" />
- <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"
+ <div className="flex flex-col items-center text-center">
+ <AvatarBox checked />
+ <motion.div
+ initial={{ opacity: 0, y: 10 }}
+ animate={{ opacity: 1, y: 0 }}
+ transition={{ duration: 0.5, delay: 0.6 }}
>
- {t("invite.backToLogin")}
- </Link>
+ <Heading>
+ {t("invite.successTitle", { name: sellerName })}
+ </Heading>
+ <Text size="small" className="text-ui-fg-subtle mt-1">
+ {t("invite.successHint")}
+ </Text>
+ </motion.div>
+ </div>
+ );
+};
+
+const LoginLink = () => {
+ const { t } = useTranslation();
+
+ return (
+ <div className="mt-8">
+ <span className="text-ui-fg-muted txt-small">
+ {t("invite.alreadyHaveAccount", "Already have an account?")}{" "}
+ <Link
+ to="/login"
+ className="txt-small text-ui-fg-interactive transition-fg hover:text-ui-fg-interactive-hover focus-visible:text-ui-fg-interactive-hover font-medium outline-none"
+ >
+ {t("invite.logIn", "Log in")}
+ </Link>
+ </span>
</div>
);
};
@@ -133,26 +186,24 @@ const InvalidView = () => {
const { t } = useTranslation();
return (
- <div className="flex flex-col items-center">
- <div className="flex flex-col items-center gap-y-1">
- <Heading>{t("invite.invalidTokenTitle")}</Heading>
- <Text size="small" className="text-ui-fg-subtle text-center">
- {t("invite.invalidTokenHint")}
- </Text>
- </div>
+ <div className="flex flex-col">
+ <Heading>{t("invite.invalidTokenTitle")}</Heading>
+ <Text size="small" className="text-ui-fg-subtle mt-1">
+ {t("invite.invalidTokenHint")}
+ </Text>
<LoginLink />
</div>
);
};
const CreateView = ({
- onSuccess,
token,
invite,
+ onSuccess,
}: {
- onSuccess: () => void;
token: string;
invite: DecodedInvite;
+ onSuccess: () => void;
}) => {
const { t } = useTranslation();
const [invalid, setInvalid] = useState(false);
@@ -195,6 +246,21 @@ const CreateView = ({
auth_token: authToken,
});
+ // Re-login to get a fresh token with updated actor_id
+ const { token: freshToken } = await signIn({
+ email: data.email,
+ password: data.password,
+ });
+
+ // Establish session with the fresh token
+ await sdk.auth.session.mutate({
+ fetchOptions: {
+ headers: {
+ Authorization: `Bearer ${freshToken}`,
+ },
+ },
+ });
+
toast.success(t("invite.toast.accepted"));
onSuccess();
} catch (error) {
@@ -231,33 +297,30 @@ const CreateView = ({
form.formState.errors.repeat_password?.message;
return (
- <div className="flex w-full flex-col items-center">
- <div className="mb-4 flex flex-col items-center">
- <Heading>
- {t("invite.title", {
- name: invite.seller_name,
- })}
- </Heading>
- <Text size="small" className="text-ui-fg-subtle text-center">
- {isExistingMember
- ? t("invite.existingMemberHint")
- : t("invite.hint")}
- </Text>
- </div>
+ <div className="flex w-full flex-col">
+ <Heading>
+ {t("invite.title", {
+ name: invite.seller_name,
+ })}
+ </Heading>
+ <Text size="small" className="text-ui-fg-subtle mt-1 mb-6">
+ {isExistingMember
+ ? t("invite.existingMemberHint")
+ : t("invite.hint")}
+ </Text>
<Form {...form}>
<form onSubmit={handleSubmit} className="flex w-full flex-col gap-y-6">
- <div className="flex flex-col gap-y-2">
+ <div className="flex flex-col gap-y-4">
<Form.Field
control={form.control}
name="email"
render={({ field }) => (
<Form.Item>
+ <Form.Label>{t("fields.email")}</Form.Label>
<Form.Control>
<Input
autoComplete="off"
{...field}
- className="bg-ui-bg-field-component"
- placeholder={t("fields.email")}
disabled
/>
</Form.Control>
@@ -269,13 +332,12 @@ const CreateView = ({
name="password"
render={({ field }) => (
<Form.Item>
+ <Form.Label>{t("fields.password")}</Form.Label>
<Form.Control>
<Input
autoComplete="new-password"
type="password"
{...field}
- className="bg-ui-bg-field-component"
- placeholder={t("fields.password")}
/>
</Form.Control>
</Form.Item>
@@ -287,13 +349,12 @@ const CreateView = ({
name="repeat_password"
render={({ field }) => (
<Form.Item>
+ <Form.Label>{t("fields.repeatPassword")}</Form.Label>
<Form.Control>
<Input
autoComplete="off"
type="password"
{...field}
- className="bg-ui-bg-field-component"
- placeholder={t("fields.repeatPassword")}
/>
</Form.Control>
</Form.Item>
@@ -301,11 +362,9 @@ const CreateView = ({
/>
)}
{validationError && (
- <div className="mt-6 text-center">
- <Hint className="inline-flex" variant="error">
- {validationError}
- </Hint>
- </div>
+ <Hint className="inline-flex" variant="error">
+ {validationError}
+ </Hint>
)}
{serverError && (
<Alert
@@ -323,9 +382,7 @@ const CreateView = ({
isLoading={isCreatingAuthUser || isSigningIn || isAcceptingInvite}
disabled={invalid}
>
- {isExistingMember
- ? t("invite.signIn")
- : t("invite.createAccount")}
+ {t("actions.continue")}
</Button>
</form>
</Form>
@@ -334,28 +391,6 @@ const CreateView = ({
);
};
-const SuccessView = ({ sellerName }: { sellerName: string }) => {
- const { t } = useTranslation();
-
- return (
- <div className="flex w-full flex-col items-center gap-y-6">
- <div className="flex flex-col items-center gap-y-1">
- <Heading className="text-center">
- {t("invite.successTitle", { name: sellerName })}
- </Heading>
- <Text size="small" className="text-ui-fg-subtle text-center">
- {t("invite.successHint")}
- </Text>
- </div>
- <Button variant="secondary" asChild className="w-full">
- <Link to="/login" replace>
- {t("invite.backToLogin")}
- </Link>
- </Button>
- </div>
- );
-};
-
const InviteSchema = z.object({
id: z.string(),
jti: z.string(),
diff --git a/packages/vendor/src/pages/onboarding/onboarding.tsx b/packages/vendor/src/pages/onboarding/onboarding.tsx
index 17d956aa3..6615f3795 100644
--- a/packages/vendor/src/pages/onboarding/onboarding.tsx
+++ b/packages/vendor/src/pages/onboarding/onboarding.tsx
@@ -1,871 +1,27 @@
-import { useState } from "react";
+import { useEffect } from "react";
+import { Navigate, useLocation } from "react-router-dom";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { OpenRectArrowOut } from "@medusajs/icons";
-import {
- Avatar,
- Button,
- Heading,
- Input,
- Select,
- Text,
- Textarea,
- toast,
-} from "@medusajs/ui";
-import { AnimatePresence, motion } from "motion/react";
-import { useForm } from "react-hook-form";
-import { useTranslation } from "react-i18next";
-import {
- useLocation,
- Navigate,
- useNavigate,
- useLoaderData,
-} from "react-router-dom";
-import * as z from "zod";
+import { OnboardingWizard } from "@components/onboarding-wizard";
-import { Form } from "@components/common/form";
-import { CountrySelect } from "@components/inputs/country-select/country-select";
-import { useLogout, useCreateSellerAccount, useStore } from "@hooks/api";
-import { onboardingLoader } from "./loader";
-import { queryClient } from "@lib/query-client";
-
-const StoreSetupSchema = z.object({
- name: z.string().min(1),
- email: z.string().email(),
- 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(),
- 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>;
+const ONBOARDING_EMAIL_KEY = "mercur_onboarding_email";
export const Onboarding = () => {
- const { t } = useTranslation();
- const navigate = useNavigate();
const location = useLocation();
- const email = location.state?.email ?? "";
+ const stateEmail = (location.state as { email?: string })?.email;
+
+ // Persist email to sessionStorage for refresh resilience
+ useEffect(() => {
+ if (stateEmail) {
+ sessionStorage.setItem(ONBOARDING_EMAIL_KEY, stateEmail);
+ }
+ }, [stateEmail]);
- const [step, setStep] = useState(1);
- const [layoutStep, setLayoutStep] = useState(1);
- const totalSteps = 2;
+ const email =
+ stateEmail || sessionStorage.getItem(ONBOARDING_EMAIL_KEY) || "";
if (!email) {
return <Navigate to="/login" replace />;
}
- const { mutateAsync: logoutMutation } = useLogout();
-
- const handleLogout = async () => {
- await logoutMutation(undefined, {
- onSuccess: () => {
- queryClient.clear();
- },
- onSettled: () => {
- navigate("/login");
- },
- });
- };
-
- const storeForm = useForm<StoreSetupFormValues>({
- resolver: zodResolver(StoreSetupSchema),
- defaultValues: {
- name: "",
- email: "",
- 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: "",
- 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 { corporate_name, registration_number, tax_id, ...addressFields } =
- details;
-
- try {
- await createSellerAccount({
- name: storeData.name,
- email: storeData.email,
- member_email: email,
- currency_code: storeData.currency_code.toLowerCase(),
- description: storeData.description || undefined,
- address: addressFields,
- professional_details:
- corporate_name || registration_number || tax_id
- ? { corporate_name, registration_number, tax_id }
- : undefined,
- });
- setStep(3);
- } catch (error: any) {
- toast.error(error.message);
- }
- });
-
- 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}
- onBack={() => setStep(1)}
- 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();
- const initialData = useLoaderData() as Awaited<
- ReturnType<typeof onboardingLoader>
- >;
- const { store } = useStore(undefined, { initialData });
-
- 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="email"
- render={({ field }) => (
- <Form.Item>
- <Form.Label>
- {t("onboarding.storeSetup.storeEmail")}
- </Form.Label>
- <Form.Control>
- <Input
- type="email"
- autoComplete="email"
- {...field}
- placeholder="[email protected]"
- />
- </Form.Control>
- <Form.Hint>
- {t("onboarding.storeSetup.storeEmailHint")}
- </Form.Hint>
- <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>
- {store?.supported_currencies?.map((sc) => (
- <Select.Item
- key={sc.currency_code}
- value={sc.currency_code}
- >
- {sc.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,
- onBack,
- isPending,
-}: {
- form: ReturnType<typeof useForm<DetailsSetupFormValues>>;
- onSubmit: () => void;
- onBack: () => void;
- isPending?: boolean;
-}) => {
- 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.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">
- <Form.Field
- control={form.control}
- name="corporate_name"
- render={({ field }) => (
- <Form.Item>
- <Form.Label optional>
- {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>
- )}
- />
- </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 />
- <div className="flex gap-x-2">
- <Button
- type="button"
- variant="secondary"
- className="w-full"
- onClick={onBack}
- >
- {t("actions.back")}
- </Button>
- <Button type="submit" className="w-full" isLoading={isPending}>
- {t("onboarding.detailsSetup.completeSetup")}
- </Button>
- </div>
- </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>
- );
+ return <OnboardingWizard memberEmail={email} />;
};
diff --git a/packages/vendor/src/pages/register/register.tsx b/packages/vendor/src/pages/register/register.tsx
index 56f3fe9f8..6101e50fb 100644
--- a/packages/vendor/src/pages/register/register.tsx
+++ b/packages/vendor/src/pages/register/register.tsx
@@ -181,8 +181,8 @@ const Root = ({ children }: { children?: ReactNode }) => {
}
return (
- <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">
+ <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">
{Children.count(children) > 0 ? (
children
) : (
diff --git a/packages/vendor/src/pages/settings/store/_components/store-address-section.tsx b/packages/vendor/src/pages/settings/store/_components/store-address-section.tsx
index b4484d154..89e25ba08 100644
--- a/packages/vendor/src/pages/settings/store/_components/store-address-section.tsx
+++ b/packages/vendor/src/pages/settings/store/_components/store-address-section.tsx
@@ -45,29 +45,40 @@ export const StoreAddressSection = ({ seller }: StoreAddressSectionProps) => {
]}
/>
</div>
- <div className="flex flex-col gap-2 px-2 pb-2">
- <div className="px-4 pb-2">
- <div className="flex items-center gap-4">
- <IconAvatar size="large" variant="squared">
- <BuildingStorefront />
- </IconAvatar>
- <div className="flex flex-1 flex-col">
- <Text size="small" leading="compact" weight="plus">
- {[address?.first_name, address?.last_name]
- .filter(Boolean)
- .join(" ") || "-"}
- </Text>
- <Text
- size="small"
- leading="compact"
- className="text-ui-fg-subtle"
- >
- {formattedAddress || "-"}
- </Text>
+ {formattedAddress ? (
+ <div className="flex flex-col gap-2 px-2 pb-2">
+ <div className="px-4 pb-2">
+ <div className="flex items-center gap-4">
+ <IconAvatar size="large" variant="squared">
+ <BuildingStorefront />
+ </IconAvatar>
+ <div className="flex flex-1 flex-col">
+ <Text size="small" leading="compact" weight="plus">
+ {[address?.first_name, address?.last_name]
+ .filter(Boolean)
+ .join(" ") || address?.company || formattedAddress}
+ </Text>
+ <Text
+ size="small"
+ leading="compact"
+ className="text-ui-fg-subtle"
+ >
+ {formattedAddress}
+ </Text>
+ </div>
</div>
</div>
</div>
- </div>
+ ) : (
+ <div className="flex flex-col items-center gap-y-1 pb-6 pt-2">
+ <Text size="small" leading="compact" weight="plus">
+ {t("store.address.empty.title")}
+ </Text>
+ <Text size="small" className="text-ui-fg-muted">
+ {t("store.address.empty.message")}
+ </Text>
+ </div>
+ )}
</Container>
);
};
diff --git a/packages/vendor/src/pages/settings/store/_components/store-general-section.tsx b/packages/vendor/src/pages/settings/store/_components/store-general-section.tsx
index 3d1eb94c4..e2889b065 100644
--- a/packages/vendor/src/pages/settings/store/_components/store-general-section.tsx
+++ b/packages/vendor/src/pages/settings/store/_components/store-general-section.tsx
@@ -1,5 +1,4 @@
import { Children, ReactNode } from "react";
-import { Photo } from "@medusajs/icons";
import { Badge, Container, Text } from "@medusajs/ui";
import { useTranslation } from "react-i18next";
@@ -33,9 +32,18 @@ export const StoreGeneralSection = ({
className="h-full w-full object-cover"
/>
) : (
- <div className="flex h-full w-full items-center justify-center">
- <Photo className="text-ui-fg-muted" />
- </div>
+ <div
+ className="h-full w-full"
+ style={{
+ background: `repeating-linear-gradient(
+ -45deg,
+ transparent,
+ transparent 10px,
+ rgba(255,255,255,0.5) 10px,
+ rgba(255,255,255,0.5) 20px
+ )`,
+ }}
+ />
)}
</div>
<StoreDetailHeader seller={seller} />
diff --git a/packages/vendor/src/pages/settings/store/_components/store-payment-details-section.tsx b/packages/vendor/src/pages/settings/store/_components/store-payment-details-section.tsx
index 234537571..9ebfda2e9 100644
--- a/packages/vendor/src/pages/settings/store/_components/store-payment-details-section.tsx
+++ b/packages/vendor/src/pages/settings/store/_components/store-payment-details-section.tsx
@@ -45,27 +45,38 @@ export const StorePaymentDetailsSection = ({
]}
/>
</div>
- <div className="flex flex-col gap-2 px-2 pb-2">
- <div className="px-4 pb-2">
- <div className="flex items-center gap-4">
- <IconAvatar size="large" variant="squared">
- <CreditCard />
- </IconAvatar>
- <div className="flex flex-1 flex-col">
- <Text size="small" leading="compact" weight="plus">
- {details?.holder_name || "-"}
- </Text>
- <Text
- size="small"
- leading="compact"
- className="text-ui-fg-subtle"
- >
- {subtitle || "-"}
- </Text>
+ {details ? (
+ <div className="flex flex-col gap-2 px-2 pb-2">
+ <div className="px-4 pb-2">
+ <div className="flex items-center gap-4">
+ <IconAvatar size="large" variant="squared">
+ <CreditCard />
+ </IconAvatar>
+ <div className="flex flex-1 flex-col">
+ <Text size="small" leading="compact" weight="plus">
+ {details.holder_name || "-"}
+ </Text>
+ <Text
+ size="small"
+ leading="compact"
+ className="text-ui-fg-subtle"
+ >
+ {subtitle || "-"}
+ </Text>
+ </div>
</div>
</div>
</div>
- </div>
+ ) : (
+ <div className="flex flex-col items-center gap-y-1 pb-6 pt-2">
+ <Text size="small" leading="compact" weight="plus">
+ {t("store.paymentDetails.empty.title")}
+ </Text>
+ <Text size="small" className="text-ui-fg-muted">
+ {t("store.paymentDetails.empty.message")}
+ </Text>
+ </div>
+ )}
</Container>
);
};
diff --git a/packages/vendor/src/pages/settings/store/_components/store-professional-details-section.tsx b/packages/vendor/src/pages/settings/store/_components/store-professional-details-section.tsx
index daebaf507..ba13129e2 100644
--- a/packages/vendor/src/pages/settings/store/_components/store-professional-details-section.tsx
+++ b/packages/vendor/src/pages/settings/store/_components/store-professional-details-section.tsx
@@ -16,6 +16,8 @@ export const StoreProfessionalDetailsSection = ({
const { t } = useTranslation();
const details = seller.professional_details;
+ const hasDetails = details?.corporate_name || details?.registration_number || details?.tax_id;
+
return (
<Container className="p-0">
<div className="flex items-center justify-between px-6 py-4">
@@ -36,29 +38,40 @@ export const StoreProfessionalDetailsSection = ({
]}
/>
</div>
- <div className="flex flex-col gap-2 px-2 pb-2">
- <div className="px-4 pb-2">
- <div className="flex items-center gap-4">
- <IconAvatar size="large" variant="squared">
- <Buildings />
- </IconAvatar>
- <div className="flex flex-1 flex-col">
- <Text size="small" leading="compact" weight="plus">
- {details?.corporate_name || "-"}
- </Text>
- <Text
- size="small"
- leading="compact"
- className="text-ui-fg-subtle"
- >
- {[details?.registration_number, details?.tax_id]
- .filter(Boolean)
- .join(" · ") || "-"}
- </Text>
+ {hasDetails ? (
+ <div className="flex flex-col gap-2 px-2 pb-2">
+ <div className="px-4 pb-2">
+ <div className="flex items-center gap-4">
+ <IconAvatar size="large" variant="squared">
+ <Buildings />
+ </IconAvatar>
+ <div className="flex flex-1 flex-col">
+ <Text size="small" leading="compact" weight="plus">
+ {details?.corporate_name || "-"}
+ </Text>
+ <Text
+ size="small"
+ leading="compact"
+ className="text-ui-fg-subtle"
+ >
+ {[details?.registration_number, details?.tax_id]
+ .filter(Boolean)
+ .join(" · ") || "-"}
+ </Text>
+ </div>
</div>
</div>
</div>
- </div>
+ ) : (
+ <div className="flex flex-col items-center gap-y-1 pb-6 pt-2">
+ <Text size="small" leading="compact" weight="plus">
+ {t("store.professionalDetails.empty.title")}
+ </Text>
+ <Text size="small" className="text-ui-fg-muted">
+ {t("store.professionalDetails.empty.message")}
+ </Text>
+ </div>
+ )}
</Container>
);
};
diff --git a/packages/vendor/src/pages/settings/store/_components/store-time-off-section.tsx b/packages/vendor/src/pages/settings/store/_components/store-time-off-section.tsx
new file mode 100644
index 000000000..3e94fd7c5
--- /dev/null
+++ b/packages/vendor/src/pages/settings/store/_components/store-time-off-section.tsx
@@ -0,0 +1,164 @@
+import { CalendarMini, EllipsisHorizontal, PencilSquare, Trash } from "@medusajs/icons";
+import {
+ Container,
+ DropdownMenu,
+ Heading,
+ IconButton,
+ Text,
+ toast,
+ usePrompt,
+} from "@medusajs/ui";
+import { useMemo } from "react";
+import { useTranslation } from "react-i18next";
+import { Link } from "react-router-dom";
+
+import { DataTable } from "@components/data-table/data-table";
+import { NoRecords } from "@components/common/empty-table-content";
+import { useDate } from "../../../../hooks/use-date";
+import { useUpdateSeller } from "@hooks/api";
+import { HttpTypes } from "@mercurjs/types";
+
+type TimeOffEntry = {
+ id: string;
+ closed_from: Date;
+ closed_to: Date | null;
+ note: string | null;
+};
+
+type StoreTimeOffSectionProps = {
+ seller: HttpTypes.StoreSellerResponse["seller"];
+};
+
+export const StoreTimeOffSection = ({ seller }: StoreTimeOffSectionProps) => {
+ const { t } = useTranslation();
+ const { getFullDate } = useDate();
+ const prompt = usePrompt();
+ const { mutateAsync: updateSeller } = useUpdateSeller(seller.id);
+
+ const data: TimeOffEntry[] = useMemo(() => {
+ if (!seller.closed_from) return [];
+ return [
+ {
+ id: "closure",
+ closed_from: new Date(seller.closed_from),
+ closed_to: seller.closed_to ? new Date(seller.closed_to) : null,
+ note: seller.closure_note ?? null,
+ },
+ ];
+ }, [seller.closed_from, seller.closed_to, seller.closure_note]);
+
+ const handleDelete = async () => {
+ const confirmed = await prompt({
+ title: t("store.timeOff.deleteConfirm.title"),
+ description: t("store.timeOff.deleteConfirm.description"),
+ confirmText: t("actions.delete"),
+ cancelText: t("actions.cancel"),
+ });
+
+ if (!confirmed) return;
+
+ await updateSeller(
+ { closed_from: null, closed_to: null, closure_note: null },
+ {
+ onSuccess: () => {
+ toast.success(t("store.timeOff.deleteSuccess"));
+ },
+ onError: (error: Error) => {
+ toast.error(error.message);
+ },
+ }
+ );
+ };
+
+ const columns = useMemo(
+ () => [
+ {
+ id: "closed_from",
+ header: t("store.timeOff.columns.firstDay"),
+ accessorFn: (row: TimeOffEntry) =>
+ getFullDate({ date: row.closed_from }),
+ },
+ {
+ id: "closed_to",
+ header: t("store.timeOff.columns.lastDay"),
+ accessorFn: (row: TimeOffEntry) =>
+ row.closed_to ? getFullDate({ date: row.closed_to }) : "-",
+ },
+ {
+ id: "note",
+ header: t("store.timeOff.columns.note"),
+ accessorFn: (row: TimeOffEntry) => row.note || "-",
+ },
+ {
+ id: "actions",
+ header: "",
+ cell: () => (
+ <div className="flex justify-end">
+ <DropdownMenu>
+ <DropdownMenu.Trigger asChild>
+ <IconButton variant="transparent" size="small">
+ <EllipsisHorizontal />
+ </IconButton>
+ </DropdownMenu.Trigger>
+ <DropdownMenu.Content>
+ <DropdownMenu.Item asChild>
+ <Link to="store-closure">
+ <PencilSquare className="mr-2" />
+ {t("actions.edit")}
+ </Link>
+ </DropdownMenu.Item>
+ <DropdownMenu.Separator />
+ <DropdownMenu.Item onClick={handleDelete}>
+ <Trash className="mr-2" />
+ {t("actions.delete")}
+ </DropdownMenu.Item>
+ </DropdownMenu.Content>
+ </DropdownMenu>
+ </div>
+ ),
+ meta: {
+ className: "w-[1%]",
+ },
+ },
+ ],
+ [t, getFullDate, handleDelete]
+ );
+
+ if (data.length === 0) {
+ return (
+ <Container className="flex flex-col overflow-hidden p-0">
+ <div className="flex items-center justify-between px-6 py-4">
+ <Heading level="h2">{t("store.timeOff.header")}</Heading>
+ </div>
+ <NoRecords
+ icon={<CalendarMini className="text-ui-fg-subtle" />}
+ title={t("store.timeOff.empty.title")}
+ message={t("store.timeOff.empty.message")}
+ action={{
+ to: "store-closure",
+ label: t("store.timeOff.empty.action"),
+ }}
+ className="h-[300px]"
+ />
+ </Container>
+ );
+ }
+
+ return (
+ <Container className="flex flex-col overflow-hidden p-0">
+ <DataTable
+ data={data}
+ columns={columns}
+ getRowId={(row) => row.id}
+ rowCount={data.length}
+ heading={t("store.timeOff.header")}
+ enableSearch={false}
+ enablePagination={false}
+ action={{
+ to: "store-closure",
+ label: t("actions.create"),
+ }}
+ />
+ </Container>
+ );
+};
diff --git a/packages/vendor/src/pages/settings/store/edit/_components/edit-store-form.tsx b/packages/vendor/src/pages/settings/store/edit/_components/edit-store-form.tsx
index 909582c71..7d56fdc90 100644
--- a/packages/vendor/src/pages/settings/store/edit/_components/edit-store-form.tsx
+++ b/packages/vendor/src/pages/settings/store/edit/_components/edit-store-form.tsx
@@ -237,7 +237,7 @@ export const EditStoreForm = ({ seller }: EditStoreFormProps) => {
<Form.Item>
<Form.Label optional>{t("fields.website")}</Form.Label>
<Form.Control>
- <Input {...field} />
+ <Input placeholder="https://example.com" {...field} />
</Form.Control>
<Form.ErrorMessage />
</Form.Item>
diff --git a/packages/vendor/src/pages/settings/store/store-closure/index.tsx b/packages/vendor/src/pages/settings/store/store-closure/index.tsx
index fe504730f..538b4ad9d 100644
--- a/packages/vendor/src/pages/settings/store/store-closure/index.tsx
+++ b/packages/vendor/src/pages/settings/store/store-closure/index.tsx
@@ -21,11 +21,11 @@ export const Component = () => {
<RouteDrawer.Header>
<RouteDrawer.Title asChild>
<Heading>
- {t("store.scheduledClosure.edit.header")}
+ {t("store.timeOff.create.header")}
</Heading>
</RouteDrawer.Title>
<RouteDrawer.Description className="sr-only">
- {t("store.scheduledClosure.edit.description")}
+ {t("store.timeOff.create.description")}
</RouteDrawer.Description>
</RouteDrawer.Header>
{!isPending && seller && <StoreClosureForm seller={seller} />}
diff --git a/packages/vendor/src/pages/settings/store/store-closure/store-closure-form.tsx b/packages/vendor/src/pages/settings/store/store-closure/store-closure-form.tsx
index 9cb28e95c..dea949c59 100644
--- a/packages/vendor/src/pages/settings/store/store-closure/store-closure-form.tsx
+++ b/packages/vendor/src/pages/settings/store/store-closure/store-closure-form.tsx
@@ -1,5 +1,5 @@
import { zodResolver } from "@hookform/resolvers/zod";
-import { Button, DatePicker, toast } from "@medusajs/ui";
+import { Button, DatePicker, Textarea, toast } from "@medusajs/ui";
import { useForm } from "react-hook-form";
import { useTranslation } from "react-i18next";
import { z } from "zod";
@@ -14,15 +14,11 @@ type StoreClosureFormProps = {
seller: HttpTypes.StoreSellerResponse["seller"];
};
-const StoreClosureSchema = z
- .object({
- closed_from: z.date({ required_error: "Close from date is required" }),
- closed_to: z.date().nullable(),
- })
- .refine((data) => data.closed_from >= new Date(new Date().toDateString()), {
- message: "Close from date cannot be in the past",
- path: ["closed_from"],
- });
+const StoreClosureSchema = z.object({
+ closed_from: z.date({ required_error: "Please enter a first day" }),
+ closed_to: z.date().nullable(),
+ closure_note: z.string().nullable(),
+});
export const StoreClosureForm = ({ seller }: StoreClosureFormProps) => {
const { t } = useTranslation();
@@ -34,6 +30,7 @@ export const StoreClosureForm = ({ seller }: StoreClosureFormProps) => {
? new Date(seller.closed_from)
: null,
closed_to: seller.closed_to ? new Date(seller.closed_to) : null,
+ closure_note: seller.closure_note ?? "",
},
resolver: zodResolver(StoreClosureSchema),
});
@@ -45,12 +42,11 @@ export const StoreClosureForm = ({ seller }: StoreClosureFormProps) => {
{
closed_from: data.closed_from || null,
closed_to: data.closed_to || null,
+ closure_note: data.closure_note || null,
},
{
onSuccess: () => {
- toast.success(
- t("store.scheduledClosure.edit.successToast"),
- );
+ toast.success(t("store.timeOff.create.successToast"));
handleSuccess();
},
onError: (error: Error) => {
@@ -72,12 +68,11 @@ export const StoreClosureForm = ({ seller }: StoreClosureFormProps) => {
return (
<Form.Item>
<Form.Label>
- {t("store.scheduledClosure.fields.closedFrom")}
+ {t("store.timeOff.fields.firstDay")}
</Form.Label>
<Form.Control>
<DatePicker
granularity="minute"
- hourCycle={12}
shouldCloseOnSelect={false}
{...field}
/>
@@ -95,11 +90,8 @@ export const StoreClosureForm = ({ seller }: StoreClosureFormProps) => {
return (
<Form.Item>
<Form.Label optional>
- {t("store.scheduledClosure.fields.closedTo")}
+ {t("store.timeOff.fields.lastDay")}
</Form.Label>
- <Form.Hint>
- {t("store.scheduledClosure.fields.closedToHint")}
- </Form.Hint>
<Form.Control>
<DatePicker
granularity="minute"
@@ -107,6 +99,30 @@ export const StoreClosureForm = ({ seller }: StoreClosureFormProps) => {
{...field}
/>
</Form.Control>
+ <Form.Hint>
+ {t("store.timeOff.fields.lastDayHint")}
+ </Form.Hint>
+ <Form.ErrorMessage />
+ </Form.Item>
+ );
+ }}
+ />
+
+ <Form.Field
+ control={form.control}
+ name="closure_note"
+ render={({ field }) => {
+ return (
+ <Form.Item>
+ <Form.Label optional>
+ {t("store.timeOff.fields.note")}
+ </Form.Label>
+ <Form.Control>
+ <Textarea
+ {...field}
+ value={field.value ?? ""}
+ />
+ </Form.Control>
<Form.ErrorMessage />
</Form.Item>
);
diff --git a/packages/vendor/src/pages/settings/store/store-detail-page.tsx b/packages/vendor/src/pages/settings/store/store-detail-page.tsx
index ed77340ed..bd8d0623e 100644
--- a/packages/vendor/src/pages/settings/store/store-detail-page.tsx
+++ b/packages/vendor/src/pages/settings/store/store-detail-page.tsx
@@ -1,6 +1,8 @@
-import { Children, ReactNode } from "react";
-import { Alert, Text } from "@medusajs/ui";
+import React, { Children, ReactNode } from "react";
+import { InformationCircleSolid } from "@medusajs/icons";
+import { Alert, Button, Container, Heading, Text } from "@medusajs/ui";
import { useTranslation } from "react-i18next";
+import components from "virtual:mercur/components";
import { TwoColumnPageSkeleton } from "@components/common/skeleton";
import { TwoColumnPage } from "@components/layout/pages";
@@ -8,7 +10,7 @@ import { useMe, useSubscription } from "@/hooks/api";
import { SellerStatus } from "@mercurjs/types";
import { StoreAddressSection } from "./_components/store-address-section";
-import { StoreConfigurationSection } from "./_components/store-configuration-section";
+import { StoreTimeOffSection } from "./_components/store-time-off-section";
import { StoreGeneralSection } from "./_components/store-general-section";
import { StoreSubscriptionSection } from "./_components/store-subscription-section";
import { StorePaymentDetailsSection } from "./_components/store-payment-details-section";
@@ -39,14 +41,10 @@ const Root = ({ children }: { children?: ReactNode }) => {
throw error;
}
+ const isPendingApproval = seller.status === SellerStatus.PENDING_APPROVAL;
+
const statusAlert = (() => {
switch (seller.status) {
- case SellerStatus.PENDING_APPROVAL:
- return {
- variant: "warning" as const,
- title: t("store.alert.pendingApproval.title"),
- description: t("store.alert.pendingApproval.description"),
- };
case SellerStatus.SUSPENDED:
return {
variant: "error" as const,
@@ -66,29 +64,31 @@ const Root = ({ children }: { children?: ReactNode }) => {
}
})();
- if (Children.count(children) > 0) {
- return (
- <div className="flex flex-col gap-y-3">
- {statusAlert && (
- <Alert variant={statusAlert.variant} dismissible className="p-5">
- <div className="text-ui-fg-subtle txt-small pb-2 font-medium leading-[20px]">
- {statusAlert.title}
- </div>
- <Text className="text-ui-fg-subtle txt-small leading-normal">
- {statusAlert.description}
- </Text>
- </Alert>
- )}
-
- <TwoColumnPage data={seller} hasOutlet>
- {children}
- </TwoColumnPage>
- </div>
- );
- }
+ const StoreSetup = components.StoreSetup as
+ | React.ComponentType<{ seller: any }>
+ | undefined;
- return (
- <div className="flex flex-col gap-y-3">
+ const StatusBanner = () => (
+ <>
+ {isPendingApproval && (
+ <Container className="p-0">
+ <div className="flex items-center gap-x-3 px-6 py-4 border-b border-ui-border-base">
+ <InformationCircleSolid className="text-ui-fg-interactive" />
+ <Heading level="h2">{t("store.alert.pendingApproval.title")}</Heading>
+ </div>
+ <div className="px-6 py-4">
+ <Text size="small" className="text-ui-fg-subtle">
+ {t("store.alert.pendingApproval.description")}
+ </Text>
+ </div>
+ <div className="flex justify-end px-6 py-4 border-t border-ui-border-base bg-ui-bg-subtle rounded-b-lg">
+ <Button variant="secondary" size="small">
+ {t("actions.cancel")}
+ </Button>
+ </div>
+ </Container>
+ )}
+ {StoreSetup && <StoreSetup seller={seller} />}
{statusAlert && (
<Alert variant={statusAlert.variant} dismissible className="p-5">
<div className="text-ui-fg-subtle txt-small pb-2 font-medium leading-[20px]">
@@ -99,22 +99,34 @@ const Root = ({ children }: { children?: ReactNode }) => {
</Text>
</Alert>
)}
+ </>
+ );
+
+ if (Children.count(children) > 0) {
+ return (
<TwoColumnPage data={seller} hasOutlet>
- <TwoColumnPage.Main>
- <StoreGeneralSection seller={seller} />
- </TwoColumnPage.Main>
- <TwoColumnPage.Sidebar>
- <StoreConfigurationSection seller={seller} />
- <StoreAddressSection seller={seller} />
- <StoreProfessionalDetailsSection seller={seller} />
- <StorePaymentDetailsSection seller={seller} />
- <StoreSubscriptionSection
- subscription_plan={subscription_plan}
- subscription_override={subscription_override}
- />
- </TwoColumnPage.Sidebar>
+ {children}
</TwoColumnPage>
- </div>
+ );
+ }
+
+ return (
+ <TwoColumnPage data={seller} hasOutlet>
+ <TwoColumnPage.Main>
+ <StatusBanner />
+ <StoreGeneralSection seller={seller} />
+ <StoreTimeOffSection seller={seller} />
+ </TwoColumnPage.Main>
+ <TwoColumnPage.Sidebar>
+ <StoreAddressSection seller={seller} />
+ <StoreProfessionalDetailsSection seller={seller} />
+ <StorePaymentDetailsSection seller={seller} />
+ <StoreSubscriptionSection
+ subscription_plan={subscription_plan}
+ subscription_override={subscription_override}
+ />
+ </TwoColumnPage.Sidebar>
+ </TwoColumnPage>
);
};
@@ -124,7 +136,7 @@ export const StoreDetailPage = Object.assign(Root, {
MainGeneralSection: StoreGeneralSection,
MainPaymentDetailsSection: StorePaymentDetailsSection,
MainProfessionalDetailsSection: StoreProfessionalDetailsSection,
- SidebarConfigurationSection: StoreConfigurationSection,
+ MainTimeOffSection: StoreTimeOffSection,
SidebarAddressSection: StoreAddressSection,
SidebarSubscriptionSection: StoreSubscriptionSection,
Header: StoreDetailHeader,
diff --git a/templates/basic/apps/vendor/public/onboarding/0.png b/templates/basic/apps/vendor/public/onboarding/0.png
new file mode 100644
index 000000000..de8d306e5
Binary files /dev/null and b/templates/basic/apps/vendor/public/onboarding/0.png differ
diff --git a/templates/basic/apps/vendor/public/onboarding/1.png b/templates/basic/apps/vendor/public/onboarding/1.png
new file mode 100644
index 000000000..d0073d3ce
Binary files /dev/null and b/templates/basic/apps/vendor/public/onboarding/1.png differ
diff --git a/templates/basic/apps/vendor/public/onboarding/2.png b/templates/basic/apps/vendor/public/onboarding/2.png
new file mode 100644
index 000000000..c265436d5
Binary files /dev/null and b/templates/basic/apps/vendor/public/onboarding/2.png differ
diff --git a/templates/basic/apps/vendor/public/onboarding/3.png b/templates/basic/apps/vendor/public/onboarding/3.png
new file mode 100644
index 000000000..b450a79bb
Binary files /dev/null and b/templates/basic/apps/vendor/public/onboarding/3.png differ
diff --git a/templates/basic/apps/vendor/public/onboarding/4.png b/templates/basic/apps/vendor/public/onboarding/4.png
new file mode 100644
index 000000000..6d4345407
Binary files /dev/null and b/templates/basic/apps/vendor/public/onboarding/4.png differ
diff --git a/templates/basic/apps/vendor/public/onboarding/bg.svg b/templates/basic/apps/vendor/public/onboarding/bg.svg
new file mode 100644
index 000000000..6eccd827f
--- /dev/null
+++ b/templates/basic/apps/vendor/public/onboarding/bg.svg
@@ -0,0 +1,13 @@
+<svg width="856" height="812" viewBox="0 0 856 812" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g clip-path="url(#clip0_40018437_84109)">
+<path d="M0 12.8C0 8.31957 0 6.07937 0.871948 4.36808C1.63893 2.86278 2.86278 1.63893 4.36808 0.871948C6.07937 0 8.31958 0 12.8 0H843.2C847.68 0 849.921 0 851.632 0.871948C853.137 1.63893 854.361 2.86278 855.128 4.36808C856 6.07937 856 8.31958 856 12.8V799.2C856 803.68 856 805.921 855.128 807.632C854.361 809.137 853.137 810.361 851.632 811.128C849.921 812 847.68 812 843.2 812H12.8C8.31958 812 6.07937 812 4.36808 811.128C2.86278 810.361 1.63893 809.137 0.871948 807.632C0 805.921 0 803.68 0 799.2V12.8Z" fill="#200F6E"/>
+<path d="M-36.4502 -25.4326L94.3418 50.1094L95.0908 50.542L94.3418 50.9756L-36.4502 126.518L-346.25 305.433L-347 305.866V153.627L-346.75 153.482L-36.9502 -25.4326L-36.7002 -25.5771L-36.4502 -25.4326ZM1203 305.866L1202.25 305.433L1071.46 229.891L1070.71 229.458L1071.46 229.024L1202.25 153.482L1203 153.05V305.866ZM273.35 -25.4326L404.142 50.1094L404.891 50.542L404.142 50.9756L273.35 126.518L-36.4502 305.433L-36.7002 305.577L-36.9502 305.433L-167.741 229.891L-168.491 229.458L-167.741 229.024L-36.9502 153.482L272.85 -25.4326L273.1 -25.5771L273.35 -25.4326ZM583.15 -25.4326L713.941 50.1094L714.691 50.542L713.941 50.9756L583.15 126.518L273.35 305.433L273.1 305.577L272.85 305.433L142.059 229.891L141.309 229.458L142.059 229.024L272.85 153.482L582.65 -25.4326L582.9 -25.5771L583.15 -25.4326ZM892.95 -25.4326L1023.74 50.1094L1024.49 50.542L1023.74 50.9756L892.95 126.518L583.15 305.433L582.9 305.577L582.65 305.433L451.858 229.891L451.109 229.458L451.858 229.024L582.65 153.482L892.45 -25.4326L892.7 -25.5771L892.95 -25.4326ZM1203 126.373L1202.75 126.518L892.95 305.433L892.7 305.577L892.45 305.433L761.659 229.891L760.909 229.458L761.659 229.024L892.45 153.482L1202.25 -25.4326L1203 -25.8662V126.373ZM-346.25 -25.4326L-215.459 50.1094L-214.709 50.542L-215.459 50.9756L-346.25 126.518L-347 126.95V-25.8662L-346.25 -25.4326Z" fill="#200F6E" stroke="#351A98"/>
+<path d="M-811.35 240.567L-680.517 316.109L-679.767 316.542L-680.517 316.976L-811.35 392.518L-1121.25 571.433L-1122 571.866V419.627L-1121.75 419.482L-811.85 240.567L-811.6 240.423L-811.35 240.567ZM1978 571.866L1977.25 571.433L1846.42 495.891L1845.67 495.458L1846.42 495.024L1977.25 419.482L1978 419.05V571.866ZM-501.45 240.567L-370.616 316.109L-369.866 316.542L-370.616 316.976L-501.45 392.518L-811.35 571.433L-811.6 571.577L-811.85 571.433L-942.684 495.891L-943.434 495.458L-942.684 495.024L-811.85 419.482L-501.95 240.567L-501.7 240.423L-501.45 240.567ZM-191.55 240.567L-60.7168 316.109L-59.9668 316.542L-60.7168 316.976L-191.55 392.518L-501.45 571.433L-501.7 571.577L-501.95 571.433L-632.783 495.891L-633.533 495.458L-632.783 495.024L-501.95 419.482L-192.05 240.567L-191.8 240.423L-191.55 240.567ZM118.35 240.567L249.184 316.109L249.934 316.542L249.184 316.976L118.35 392.518L-191.55 571.433L-191.8 571.577L-192.05 571.433L-322.884 495.891L-323.634 495.458L-322.884 495.024L-192.05 419.482L117.85 240.567L118.1 240.423L118.35 240.567ZM428.25 240.567L559.083 316.109L559.833 316.542L559.083 316.976L428.25 392.518L118.35 571.433L118.1 571.577L117.85 571.433L-12.9834 495.891L-13.7334 495.458L-12.9834 495.024L117.85 419.482L427.75 240.567L428 240.423L428.25 240.567ZM738.15 240.567L868.983 316.109L869.733 316.542L868.983 316.976L738.15 392.518L428.25 571.433L428 571.577L427.75 571.433L296.917 495.891L296.167 495.458L296.917 495.024L427.75 419.482L737.65 240.567L737.9 240.423L738.15 240.567ZM1048.05 240.567L1178.88 316.109L1179.63 316.542L1178.88 316.976L1048.05 392.518L738.15 571.433L737.9 571.577L737.65 571.433L606.816 495.891L606.066 495.458L606.816 495.024L737.65 419.482L1047.55 240.567L1047.8 240.423L1048.05 240.567ZM1357.95 240.567L1488.78 316.109L1489.53 316.542L1488.78 316.976L1357.95 392.518L1048.05 571.433L1047.8 571.577L1047.55 571.433L916.717 495.891L915.967 495.458L916.717 495.024L1047.55 419.482L1357.45 240.567L1357.7 240.423L1357.95 240.567ZM1667.85 240.567L1798.68 316.109L1799.43 316.542L1798.68 316.976L1667.85 392.518L1357.95 571.433L1357.7 571.577L1357.45 571.433L1226.62 495.891L1225.87 495.458L1226.62 495.024L1357.45 419.482L1667.35 240.567L1667.6 240.423L1667.85 240.567ZM1978 392.373L1977.75 392.518L1667.85 571.433L1667.6 571.577L1667.35 571.433L1536.52 495.891L1535.77 495.458L1536.52 495.024L1667.35 419.482L1977.25 240.567L1978 240.134V392.373ZM-1121.25 240.567L-990.417 316.109L-989.667 316.542L-990.417 316.976L-1121.25 392.518L-1122 392.95V240.134L-1121.25 240.567Z" fill="#200F6E" stroke="#351A98"/>
+<path d="M-36.4502 506.567L94.3418 582.109L95.0908 582.542L94.3418 582.976L-36.4502 658.518L-346.25 837.433L-347 837.866V685.627L-346.75 685.482L-36.9502 506.567L-36.7002 506.423L-36.4502 506.567ZM1203 837.866L1202.25 837.433L1071.46 761.891L1070.71 761.458L1071.46 761.024L1202.25 685.482L1203 685.05V837.866ZM273.35 506.567L404.142 582.109L404.891 582.542L404.142 582.976L273.35 658.518L-36.4502 837.433L-36.7002 837.577L-36.9502 837.433L-167.741 761.891L-168.491 761.458L-167.741 761.024L-36.9502 685.482L272.85 506.567L273.1 506.423L273.35 506.567ZM583.15 506.567L713.941 582.109L714.691 582.542L713.941 582.976L583.15 658.518L273.35 837.433L273.1 837.577L272.85 837.433L142.059 761.891L141.309 761.458L142.059 761.024L272.85 685.482L582.65 506.567L582.9 506.423L583.15 506.567ZM892.95 506.567L1023.74 582.109L1024.49 582.542L1023.74 582.976L892.95 658.518L583.15 837.433L582.9 837.577L582.65 837.433L451.858 761.891L451.109 761.458L451.858 761.024L582.65 685.482L892.45 506.567L892.7 506.423L892.95 506.567ZM1203 658.373L1202.75 658.518L892.95 837.433L892.7 837.577L892.45 837.433L761.659 761.891L760.909 761.458L761.659 761.024L892.45 685.482L1202.25 506.567L1203 506.134V658.373ZM-346.25 506.567L-215.459 582.109L-214.709 582.542L-215.459 582.976L-346.25 658.518L-347 658.95V506.134L-346.25 506.567Z" fill="#200F6E" stroke="#351A98"/>
+</g>
+<defs>
+<clipPath id="clip0_40018437_84109">
+<path d="M0 12.8C0 8.31957 0 6.07937 0.871948 4.36808C1.63893 2.86278 2.86278 1.63893 4.36808 0.871948C6.07937 0 8.31958 0 12.8 0H843.2C847.68 0 849.921 0 851.632 0.871948C853.137 1.63893 854.361 2.86278 855.128 4.36808C856 6.07937 856 8.31958 856 12.8V799.2C856 803.68 856 805.921 855.128 807.632C854.361 809.137 853.137 810.361 851.632 811.128C849.921 812 847.68 812 843.2 812H12.8C8.31958 812 6.07937 812 4.36808 811.128C2.86278 810.361 1.63893 809.137 0.871948 807.632C0 805.921 0 803.68 0 799.2V12.8Z" fill="white"/>
+</clipPath>
+</defs>
+</svg>