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
Improve Store setup flow (#14669)
Damian Legawiec86926c41b590
diff --git a/packages/dashboard/src/locales/ar.json b/packages/dashboard/src/locales/ar.jsonindex eaade1aee8..e7222e77cb 100644--- a/packages/dashboard/src/locales/ar.json+++ b/packages/dashboard/src/locales/ar.json@@ -5098,7 +5098,9 @@"required_notice_message": "لا يوجد حساب مسؤول. استخدم رابط الإعداد من مخرجات التثبيت لإنشاء حساب.","required_notice_title": "لم يتم إعداد هذا التثبيت بعد","subtitle": "أنشئ حساب المسؤول وأخبرنا عن متجرك. كل شيء هنا يمكن تغييره لاحقًا.",- "title": "إعداد Spree"+ "title": "إعداد Spree",+ "welcome_description": "أكمل قائمة المهام أدناه لفتح {{store}} أمام العملاء.",+ "welcome_title": "مرحبًا، متجرك جاهز الآن!"},"staff": {"actions": {diff --git a/packages/dashboard/src/locales/de.json b/packages/dashboard/src/locales/de.jsonindex 9d6e547cb9..48df1cd7db 100644--- a/packages/dashboard/src/locales/de.json+++ b/packages/dashboard/src/locales/de.json@@ -5068,7 +5068,9 @@"required_notice_message": "Es existiert noch kein Administratorkonto. Verwenden Sie den Setup-Link aus der Installationsausgabe, um eines zu erstellen.","required_notice_title": "Diese Installation ist noch nicht eingerichtet","subtitle": "Erstellen Sie Ihr Administratorkonto und beschreiben Sie Ihren Shop. Alles hier lässt sich später ändern.",- "title": "Spree einrichten"+ "title": "Spree einrichten",+ "welcome_description": "Arbeiten Sie die folgende Checkliste ab, um {{store}} zu eröffnen.",+ "welcome_title": "Willkommen, Ihr Shop ist startklar!"},"staff": {"actions": {diff --git a/packages/dashboard/src/locales/en.json b/packages/dashboard/src/locales/en.jsonindex 5d4d97aa13..93ea55f712 100644--- a/packages/dashboard/src/locales/en.json+++ b/packages/dashboard/src/locales/en.json@@ -5068,7 +5068,9 @@"required_notice_message": "No admin account exists. Use the setup link from the install output to create one.","required_notice_title": "This installation isn't set up yet","subtitle": "Create your admin account and tell us about your store. Everything here can be changed later.",- "title": "Set up Spree"+ "title": "Set up Spree",+ "welcome_description": "Work through the checklist below to open {{store}} for business.",+ "welcome_title": "Welcome, your store is now ready!"},"staff": {"actions": {diff --git a/packages/dashboard/src/locales/fr.json b/packages/dashboard/src/locales/fr.jsonindex 2c744df998..ca4298edf5 100644--- a/packages/dashboard/src/locales/fr.json+++ b/packages/dashboard/src/locales/fr.json@@ -5068,7 +5068,9 @@"required_notice_message": "Aucun compte administrateur n'existe. Utilisez le lien de configuration affiché lors de l'installation pour en créer un.","required_notice_title": "Cette installation n'est pas encore configurée","subtitle": "Créez votre compte administrateur et présentez votre boutique. Tout ceci est modifiable par la suite.",- "title": "Configurer Spree"+ "title": "Configurer Spree",+ "welcome_description": "Suivez la liste ci-dessous pour ouvrir {{store}}.",+ "welcome_title": "Bienvenue, votre boutique est prête !"},"staff": {"actions": {diff --git a/packages/dashboard/src/locales/pl.json b/packages/dashboard/src/locales/pl.jsonindex f3bc359586..b0192042f9 100644--- a/packages/dashboard/src/locales/pl.json+++ b/packages/dashboard/src/locales/pl.json@@ -5130,7 +5130,9 @@"required_notice_message": "Nie istnieje żadne konto administratora. Użyj linku konfiguracyjnego z wyniku instalacji, aby je utworzyć.","required_notice_title": "Ta instalacja nie została jeszcze skonfigurowana","subtitle": "Utwórz konto administratora i opisz swój sklep. Wszystko tutaj możesz później zmienić.",- "title": "Skonfiguruj Spree"+ "title": "Skonfiguruj Spree",+ "welcome_description": "Przejdź przez poniższą listę, aby otworzyć sklep {{store}}.",+ "welcome_title": "Witamy, Twój sklep jest gotowy!"},"staff": {"actions": {diff --git a/packages/dashboard/src/locales/zh-CN.json b/packages/dashboard/src/locales/zh-CN.jsonindex 0528c340cc..5ee22eb17e 100644--- a/packages/dashboard/src/locales/zh-CN.json+++ b/packages/dashboard/src/locales/zh-CN.json@@ -5057,7 +5057,9 @@"required_notice_message": "尚无管理员账户。请使用安装输出中的设置链接创建。","required_notice_title": "此安装尚未完成设置","subtitle": "创建您的管理员账户并介绍您的商店。此处的所有设置之后均可更改。",- "title": "设置 Spree"+ "title": "设置 Spree",+ "welcome_description": "完成下方清单即可让 {{store}} 正式开业。",+ "welcome_title": "欢迎,您的商店已就绪!"},"staff": {"actions": {diff --git a/packages/dashboard/src/routes/setup.tsx b/packages/dashboard/src/routes/setup.tsxindex 30b2cef1af..56374608b1 100644--- a/packages/dashboard/src/routes/setup.tsx+++ b/packages/dashboard/src/routes/setup.tsx@@ -1,9 +1,10 @@import { zodResolver } from '@hookform/resolvers/zod'import type { SpreeError } from '@spree/admin-sdk'import { adminClient, mapSpreeErrorsToForm, useAuth } from '@spree/dashboard-core'-import { Button, Checkbox, Input, Label } from '@spree/dashboard-ui'+import { Button, Checkbox, Input, Label, toastManager } from '@spree/dashboard-ui'import { useQuery } from '@tanstack/react-query'-import { createFileRoute, Link, Navigate, useNavigate } from '@tanstack/react-router'+import { createFileRoute, Link, Navigate } from '@tanstack/react-router'+import { useState } from 'react'import { Controller, useForm } from 'react-hook-form'import { useTranslation } from 'react-i18next'import { z } from 'zod/v4'@@ -24,6 +25,15 @@ function SetupPage() {const { t } = useTranslation()const { token } = Route.useSearch()const { isAuthenticated } = useAuth()+ // Completing setup signs the merchant in, which re-renders this component+ // with `isAuthenticated` true. The guard below would then send them to the+ // store index — so the store setup just claimed is held here and the guard+ // routes to its checklist instead.+ const [setupStoreId, setSetupStoreId] = useState<string | null>(null)++ if (setupStoreId) {+ return <Navigate to="/$storeId/getting-started" params={{ storeId: setupStoreId }} replace />+ }if (isAuthenticated) return <Navigate to="/" replace />@@ -40,12 +50,18 @@ function SetupPage() {return (<AuthShell>- <SetupLoader token={token} />+ <SetupLoader token={token} onCompleted={setSetupStoreId} /></AuthShell>)}-function SetupLoader({ token }: { token: string }) {+function SetupLoader({+ token,+ onCompleted,+}: {+ token: string+ onCompleted: (storeId: string | null) => void+}) {const { t } = useTranslation()const status = useQuery({queryKey: ['setup-status'],@@ -72,13 +88,18 @@ function SetupLoader({ token }: { token: string }) {)}- return <SetupForm token={token} />+ return <SetupForm token={token} onCompleted={onCompleted} />}-function SetupForm({ token }: { token: string }) {+function SetupForm({+ token,+ onCompleted,+}: {+ token: string+ onCompleted: (storeId: string | null) => void+}) {const { t } = useTranslation()const { completeSetup, isLoading } = useAuth()- const navigate = useNavigate()const form = useForm<SetupFormValues>({resolver: zodResolver(setupFormSchema),@@ -110,21 +131,21 @@ function SetupForm({ token }: { token: string }) {const onSubmit = async (data: SetupFormValues) => {try {const session = await completeSetup({ ...data, setup_token: token })+ const store = session.user?.stores?.[0]++ toastManager.add({+ type: 'success',+ title: t('admin.setup.welcome_title'),+ description: t('admin.setup.welcome_description', {+ store: store?.name ?? data.store_name,+ }),+ })// A merchant who has just claimed the installation has an empty store,// so the checklist is the useful landing place rather than a dashboard- // of zeroes. Falls back to the index redirect if the payload carries no- // store, which resolves one for itself.- const storeId = session.user?.stores?.[0]?.id- if (storeId) {- navigate({- to: '/$storeId/getting-started',- params: { storeId },- replace: true,- })- } else {- navigate({ to: '/', replace: true })- }+ // of zeroes. A payload carrying no store falls through to the index+ // redirect, which resolves one for itself.+ onCompleted(store?.id ?? null)} catch (err) {const e = err as SpreeErrorif (e?.status === 404) {