Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Move the seller panel onto the shared toast
Damian Legawiec6bda7a325696
diff --git a/packages/seller-dashboard/package.json b/packages/seller-dashboard/package.jsonindex ec94020f2d..9ef3f679cb 100644--- a/packages/seller-dashboard/package.json+++ b/packages/seller-dashboard/package.json@@ -39,7 +39,6 @@"lucide-react": "^0.545.0","react-hook-form": "^7.65.0","react-i18next": "^17.0.8",- "sonner": "^2.0.7","zod": "^4.4.3"},"peerDependencies": {diff --git a/packages/seller-dashboard/src/components/seller-address-card.tsx b/packages/seller-dashboard/src/components/seller-address-card.tsxindex b3b52d8a09..232df056ff 100644--- a/packages/seller-dashboard/src/components/seller-address-card.tsx+++ b/packages/seller-dashboard/src/components/seller-address-card.tsx@@ -8,6 +8,7 @@ import {CardContent,CardHeader,CardTitle,+ toastManager,} from '@spree/dashboard-ui'import type { Profile, SellerAddressParams } from '@spree/seller-sdk'import { useMutation, useQueryClient } from '@tanstack/react-query'@@ -15,7 +16,6 @@ import { useParams } from '@tanstack/react-router'import { PencilIcon, PlusIcon } from 'lucide-react'import { useState } from 'react'import { useTranslation } from 'react-i18next'-import { toast } from 'sonner'import { sellerClient } from '../api-client'/**@@ -56,9 +56,13 @@ export function SellerAddressCard({// The checklist reads addresses too, so it has to re-evaluate.void queryClient.invalidateQueries({ queryKey: ['seller', sellerId, 'onboarding'] })setEditing(false)- toast.success(t('profile.saved'))+ toastManager.add({ type: 'success', title: t('profile.saved') })},- onError: (err) => toast.error(err instanceof Error ? err.message : t('common.error')),+ onError: (err) =>+ toastManager.add({+ type: 'error',+ title: err instanceof Error ? err.message : t('common.error'),+ }),})const body = address ? (diff --git a/packages/seller-dashboard/src/components/seller-business-card.tsx b/packages/seller-dashboard/src/components/seller-business-card.tsxindex 9e3c9c5a4c..a1a5414a47 100644--- a/packages/seller-dashboard/src/components/seller-business-card.tsx+++ b/packages/seller-dashboard/src/components/seller-business-card.tsx@@ -13,6 +13,7 @@ import {SheetFooter,SheetHeader,SheetTitle,+ toastManager,} from '@spree/dashboard-ui'import type { Profile } from '@spree/seller-sdk'import { useMutation, useQueryClient } from '@tanstack/react-query'@@ -20,7 +21,6 @@ import { useParams } from '@tanstack/react-router'import { PencilIcon } from 'lucide-react'import { useState } from 'react'import { useTranslation } from 'react-i18next'-import { toast } from 'sonner'import { sellerClient } from '../api-client'/** The registration kind this panel collects. */@@ -59,9 +59,13 @@ export function SellerBusinessCard({ profile }: { profile: Profile }) {// A checklist kind may read these, so it has to re-evaluate.void queryClient.invalidateQueries({ queryKey: ['seller', sellerId, 'onboarding'] })setEditing(false)- toast.success(t('profile.saved'))+ toastManager.add({ type: 'success', title: t('profile.saved') })},- onError: (err) => toast.error(err instanceof Error ? err.message : t('common.error')),+ onError: (err) =>+ toastManager.add({+ type: 'error',+ title: err instanceof Error ? err.message : t('common.error'),+ }),})const rows = [diff --git a/packages/seller-dashboard/src/components/seller-returns-location-card.tsx b/packages/seller-dashboard/src/components/seller-returns-location-card.tsxindex 8c549b163c..c240fcd3c7 100644--- a/packages/seller-dashboard/src/components/seller-returns-location-card.tsx+++ b/packages/seller-dashboard/src/components/seller-returns-location-card.tsx@@ -8,6 +8,7 @@ import {CardContent,CardHeader,CardTitle,+ toastManager,} from '@spree/dashboard-ui'import type { StockLocation, StockLocationParams } from '@spree/seller-sdk'import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'@@ -15,7 +16,6 @@ import { useParams } from '@tanstack/react-router'import { PencilIcon, PlusIcon } from 'lucide-react'import { useState } from 'react'import { useTranslation } from 'react-i18next'-import { toast } from 'sonner'import { sellerClient } from '../api-client'/**@@ -60,9 +60,13 @@ export function SellerReturnsLocationCard({ headless = false }: { headless?: boo// re-evaluate.void queryClient.invalidateQueries({ queryKey: ['seller', sellerId, 'onboarding'] })setEditing(false)- toast.success(t('profile.saved'))+ toastManager.add({ type: 'success', title: t('profile.saved') })},- onError: (err) => toast.error(err instanceof Error ? err.message : t('common.error')),+ onError: (err) =>+ toastManager.add({+ type: 'error',+ title: err instanceof Error ? err.message : t('common.error'),+ }),})const body =diff --git a/packages/seller-dashboard/src/pages/onboarding.tsx b/packages/seller-dashboard/src/pages/onboarding.tsxindex c0c3eca61f..75126c6918 100644--- a/packages/seller-dashboard/src/pages/onboarding.tsx+++ b/packages/seller-dashboard/src/pages/onboarding.tsx@@ -15,6 +15,7 @@ import {Input,Progress,Textarea,+ toastManager,} from '@spree/dashboard-ui'import type { RequirementStatus } from '@spree/seller-sdk'import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'@@ -29,7 +30,6 @@ import {} from 'lucide-react'import { useState } from 'react'import { useTranslation } from 'react-i18next'-import { toast } from 'sonner'import { sellerClient } from '../api-client'import { CenteredMessage } from '../components/centered-message'import { SellerAddressCard } from '../components/seller-address-card'@@ -61,11 +61,15 @@ export function OnboardingPage() {mutationFn: () => sellerClient().onboarding.submitForReview(),onSuccess: (next) => {queryClient.setQueryData(['seller', sellerId, 'onboarding'], next)- toast.success(t('onboarding.submitted'))+ toastManager.add({ type: 'success', title: t('onboarding.submitted') })},// The server names what is outstanding; showing our own wording instead// would tell the seller less than the API already knows.- onError: (err) => toast.error(err instanceof Error ? err.message : t('common.error')),+ onError: (err) =>+ toastManager.add({+ type: 'error',+ title: err instanceof Error ? err.message : t('common.error'),+ }),})if (isLoading) return <CenteredMessage>{t('common.loading')}</CenteredMessage>@@ -208,10 +212,14 @@ function RequirementAction({ requirement }: { requirement: RequirementStatus })const acceptTerms = useMutation({mutationFn: () => sellerClient().profile.update({ accept_terms: true }),onSuccess: () => {- toast.success(t('onboarding.terms_accepted'))+ toastManager.add({ type: 'success', title: t('onboarding.terms_accepted') })void invalidate()},- onError: (err) => toast.error(err instanceof Error ? err.message : t('common.error')),+ onError: (err) =>+ toastManager.add({+ type: 'error',+ title: err instanceof Error ? err.message : t('common.error'),+ }),})// One submit for every kind that takes one — an attestation the seller@@ -226,10 +234,14 @@ function RequirementAction({ requirement }: { requirement: RequirementStatus })onSuccess: () => {setNote('')setFile(EMPTY_FILE_UPLOAD_VALUE)- toast.success(t('onboarding.submitted_requirement'))+ toastManager.add({ type: 'success', title: t('onboarding.submitted_requirement') })void invalidate()},- onError: (err) => toast.error(err instanceof Error ? err.message : t('common.error')),+ onError: (err) =>+ toastManager.add({+ type: 'error',+ title: err instanceof Error ? err.message : t('common.error'),+ }),})// Custom fields are the seller's own profile data, so they save through the@@ -243,10 +255,14 @@ function RequirementAction({ requirement }: { requirement: RequirementStatus })})),}),onSuccess: () => {- toast.success(t('profile.saved'))+ toastManager.add({ type: 'success', title: t('profile.saved') })void invalidate()},- onError: (err) => toast.error(err instanceof Error ? err.message : t('common.error')),+ onError: (err) =>+ toastManager.add({+ type: 'error',+ title: err instanceof Error ? err.message : t('common.error'),+ }),})const submission = requirement.submissiondiff --git a/packages/seller-dashboard/src/pages/profile.tsx b/packages/seller-dashboard/src/pages/profile.tsxindex 7acee05046..aef9190fb7 100644--- a/packages/seller-dashboard/src/pages/profile.tsx+++ b/packages/seller-dashboard/src/pages/profile.tsx@@ -19,6 +19,7 @@ import {SheetTitle,StatusBadge,Textarea,+ toastManager,} from '@spree/dashboard-ui'import type { Profile } from '@spree/seller-sdk'import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'@@ -28,7 +29,6 @@ import type { ReactNode } from 'react'import { useEffect, useState } from 'react'import { useForm } from 'react-hook-form'import { useTranslation } from 'react-i18next'-import { toast } from 'sonner'import { sellerClient } from '../api-client'import { CenteredMessage } from '../components/centered-message'import { SellerAddressCard } from '../components/seller-address-card'@@ -320,9 +320,13 @@ function EditProfileSheet({onSuccess: (updated) => {queryClient.setQueryData(['seller', sellerId, 'profile'], updated)onOpenChange(false)- toast.success(t('profile.saved'))+ toastManager.add({ type: 'success', title: t('profile.saved') })},- onError: (err) => toast.error(err instanceof Error ? err.message : t('common.error')),+ onError: (err) =>+ toastManager.add({+ type: 'error',+ title: err instanceof Error ? err.message : t('common.error'),+ }),})const { errors } = form.formStatediff --git a/packages/seller-dashboard/src/pages/team.tsx b/packages/seller-dashboard/src/pages/team.tsxindex 227d550065..bc59479d5c 100644--- a/packages/seller-dashboard/src/pages/team.tsx+++ b/packages/seller-dashboard/src/pages/team.tsx@@ -33,6 +33,7 @@ import {TableHead,TableHeader,TableRow,+ toastManager,useConfirm,useCopyToClipboard,} from '@spree/dashboard-ui'@@ -52,7 +53,6 @@ import {import { useState } from 'react'import { useForm } from 'react-hook-form'import { useTranslation } from 'react-i18next'-import { toast } from 'sonner'import { sellerClient } from '../api-client'/**@@ -177,12 +177,16 @@ function MemberRow({ member, lastOne }: { member: TeamMember; lastOne: boolean }const remove = useMutation({mutationFn: (id: string) => sellerClient().team.remove(id),onSuccess: () => {- toast.success(t('team.messages.removed'))+ toastManager.add({ type: 'success', title: t('team.messages.removed') })void queryClient.invalidateQueries({ queryKey: ['seller', sellerId, 'team'] })},// Read the server's own message rather than assuming which rule was hit —// "last member" is one refusal among several the API may grow.- onError: (err) => toast.error(err instanceof Error ? err.message : t('common.error')),+ onError: (err) =>+ toastManager.add({+ type: 'error',+ title: err instanceof Error ? err.message : t('common.error'),+ }),})async function handleRemove() {@@ -286,19 +290,27 @@ function InvitationRow({ invitation }: { invitation: Invitation }) {const resend = useMutation({mutationFn: (id: string) => sellerClient().invitations.resend(id),onSuccess: () => {- toast.success(t('team.messages.resent'))+ toastManager.add({ type: 'success', title: t('team.messages.resent') })void invalidate()},- onError: (err) => toast.error(err instanceof Error ? err.message : t('common.error')),+ onError: (err) =>+ toastManager.add({+ type: 'error',+ title: err instanceof Error ? err.message : t('common.error'),+ }),})const revoke = useMutation({mutationFn: (id: string) => sellerClient().invitations.revoke(id),onSuccess: () => {- toast.success(t('team.messages.revoked'))+ toastManager.add({ type: 'success', title: t('team.messages.revoked') })void invalidate()},- onError: (err) => toast.error(err instanceof Error ? err.message : t('common.error')),+ onError: (err) =>+ toastManager.add({+ type: 'error',+ title: err instanceof Error ? err.message : t('common.error'),+ }),})async function handleCopyLink() {@@ -314,7 +326,7 @@ function InvitationRow({ invitation }: { invitation: Invitation }) {: invitation.acceptance_urlawait copy(url)- toast.success(t('team.messages.link_copied'))+ toastManager.add({ type: 'success', title: t('team.messages.link_copied') })}async function handleRevoke() {@@ -393,12 +405,16 @@ function InviteDialog({onSuccess: () => {form.reset({ email: '' })onOpenChange(false)- toast.success(t('team.messages.invited'))+ toastManager.add({ type: 'success', title: t('team.messages.invited') })// The new row lands in pending invitations, not in members — they are// not a member until they accept.void queryClient.invalidateQueries({ queryKey: ['seller', sellerId, 'invitations'] })},- onError: (err) => toast.error(err instanceof Error ? err.message : t('common.error')),+ onError: (err) =>+ toastManager.add({+ type: 'error',+ title: err instanceof Error ? err.message : t('common.error'),+ }),})const { errors } = form.formStatediff --git a/packages/seller-dashboard/src/routes/__root.tsx b/packages/seller-dashboard/src/routes/__root.tsxindex d24bb29953..aefb54511a 100644--- a/packages/seller-dashboard/src/routes/__root.tsx+++ b/packages/seller-dashboard/src/routes/__root.tsx@@ -9,7 +9,7 @@ function RootLayout() {return (<><Outlet />- <Toaster position="bottom-right" />+ <Toaster /></>)}diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 57c8b0474b..7d85063556 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -686,9 +686,6 @@ importers:react-i18next:specifier: ^17.0.8version: 17.0.8([email protected]([email protected]))([email protected]([email protected]))([email protected])([email protected])- sonner:- specifier: ^2.0.7zod:specifier: ^4.4.3version: 4.4.3