Skip to content

armgit / spree

Public Imported from GitHub
0

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.

Give pricing and inventory sources a card each

Damian Legawiecda5e7c2766ef
diff --git a/packages/dashboard/src/locales/ar.json b/packages/dashboard/src/locales/ar.json
index dac524df4d..a0e35741ba 100644
--- a/packages/dashboard/src/locales/ar.json
+++ b/packages/dashboard/src/locales/ar.json
@@ -1622,7 +1622,14 @@
"label": "استخدم أرقام Spree"
}
},
- "description": "يقدّم Spree الأسعار والمخزون من سجلاته الخاصة. اربط نظام ERP أو PIM أو نظام مستودع ليتولى الإجابة بدلاً منه."
+ "pricing": {
+ "title": "مصدر الأسعار",
+ "description": "اربط نظام ERP أو نظام تسعير تعاقدي ليجيب عن الأسعار بدلاً من كتالوج Spree."
+ },
+ "inventory": {
+ "title": "مصدر المخزون",
+ "description": "اربط نظام مستودعات أو ERP ليجيب عن المخزون بدلاً من سجلات Spree."
+ }
}
},
"store_credit": {
@@ -3156,8 +3163,7 @@
"tab_payments": "المدفوعات",
"tab_standards": "المعايير والأشكال",
"tab_storefront_access": "الوصول إلى المتجر",
- "title": "إعدادات المتجر",
- "tab_data_sources": "مصادر الأسعار والمخزون"
+ "title": "إعدادات المتجر"
},
"tax_categories": {
"add_sheet_title": "إضافة فئة الضريبة",
diff --git a/packages/dashboard/src/locales/de.json b/packages/dashboard/src/locales/de.json
index d001f9c5b8..b0ea94f04a 100644
--- a/packages/dashboard/src/locales/de.json
+++ b/packages/dashboard/src/locales/de.json
@@ -1607,7 +1607,14 @@
"label": "Sprees eigene Zahlen verwenden"
}
},
- "description": "Spree liefert Preise und Bestände aus den eigenen Datensätzen. Verbinden Sie ein ERP-, PIM- oder Lagersystem, damit dieses stattdessen antwortet."
+ "pricing": {
+ "title": "Preisquelle",
+ "description": "Verbinden Sie ein ERP- oder Vertragspreissystem, damit es statt des Spree-Katalogs die Preise beantwortet."
+ },
+ "inventory": {
+ "title": "Bestandsquelle",
+ "description": "Verbinden Sie ein Lager- oder ERP-System, damit es statt der Spree-Bestände den Lagerbestand beantwortet."
+ }
}
},
"store_credit": {
@@ -3142,8 +3149,7 @@
"tab_payments": "Zahlungen",
"tab_standards": "Standards und Formate",
"tab_storefront_access": "Storefront-Zugriff",
- "title": "Shop-Einstellungen",
- "tab_data_sources": "Preis- und Bestandsquellen"
+ "title": "Shop-Einstellungen"
},
"tax_categories": {
"add_sheet_title": "Steuerkategorie hinzufügen",
diff --git a/packages/dashboard/src/locales/en.json b/packages/dashboard/src/locales/en.json
index 4043137dcc..6b406fdde2 100644
--- a/packages/dashboard/src/locales/en.json
+++ b/packages/dashboard/src/locales/en.json
@@ -1607,7 +1607,14 @@
"label": "Use Spree's own figures"
}
},
- "description": "Spree serves prices and stock from its own records. Connect an ERP, PIM or warehouse system to have it answer instead."
+ "pricing": {
+ "title": "Pricing source",
+ "description": "Connect an ERP or contract-pricing system to answer prices instead of Spree's catalog."
+ },
+ "inventory": {
+ "title": "Inventory source",
+ "description": "Connect a warehouse or ERP system to answer stock instead of Spree's own records."
+ }
}
},
"store_credit": {
@@ -3142,8 +3149,7 @@
"tab_payments": "Payments",
"tab_standards": "Standards and formats",
"tab_storefront_access": "Storefront access",
- "title": "Store settings",
- "tab_data_sources": "Pricing and inventory sources"
+ "title": "Store settings"
},
"tax_categories": {
"add_sheet_title": "Add tax category",
diff --git a/packages/dashboard/src/locales/fr.json b/packages/dashboard/src/locales/fr.json
index 0f75ee11ee..16e59fb892 100644
--- a/packages/dashboard/src/locales/fr.json
+++ b/packages/dashboard/src/locales/fr.json
@@ -1607,7 +1607,14 @@
"label": "Utiliser les chiffres de Spree"
}
},
- "description": "Spree fournit les prix et les stocks à partir de ses propres enregistrements. Connectez un ERP, un PIM ou un système d'entrepôt pour qu'il réponde à la place."
+ "pricing": {
+ "title": "Source des prix",
+ "description": "Connectez un ERP ou un système de prix contractuels pour répondre aux prix à la place du catalogue Spree."
+ },
+ "inventory": {
+ "title": "Source des stocks",
+ "description": "Connectez un système d'entrepôt ou un ERP pour répondre aux stocks à la place des enregistrements de Spree."
+ }
}
},
"store_credit": {
@@ -3142,8 +3149,7 @@
"tab_payments": "Paiements",
"tab_standards": "Normes et formats",
"tab_storefront_access": "Accès à la vitrine",
- "title": "Paramètres de la boutique",
- "tab_data_sources": "Sources de prix et de stock"
+ "title": "Paramètres de la boutique"
},
"tax_categories": {
"add_sheet_title": "Ajouter une catégorie de taxe",
diff --git a/packages/dashboard/src/locales/pl.json b/packages/dashboard/src/locales/pl.json
index e13b744162..8b8bfffb24 100644
--- a/packages/dashboard/src/locales/pl.json
+++ b/packages/dashboard/src/locales/pl.json
@@ -1623,7 +1623,14 @@
"label": "Użyj danych Spree"
}
},
- "description": "Spree podaje ceny i stany magazynowe z własnych danych. Podłącz system ERP, PIM lub magazynowy, aby to on udzielał odpowiedzi."
+ "pricing": {
+ "title": "Źródło cen",
+ "description": "Podłącz system ERP lub cen kontraktowych, aby odpowiadał na ceny zamiast katalogu Spree."
+ },
+ "inventory": {
+ "title": "Źródło stanów magazynowych",
+ "description": "Podłącz system magazynowy lub ERP, aby odpowiadał na stany zamiast rekordów Spree."
+ }
}
},
"store_credit": {
@@ -3186,8 +3193,7 @@
"tab_payments": "Płatności",
"tab_standards": "Standardy i formaty",
"tab_storefront_access": "Dostęp do sklepu",
- "title": "Ustawienia sklepu",
- "tab_data_sources": "Źródła cen i stanów magazynowych"
+ "title": "Ustawienia sklepu"
},
"tax_categories": {
"add_sheet_title": "Dodaj kategorię podatkową",
diff --git a/packages/dashboard/src/locales/zh-CN.json b/packages/dashboard/src/locales/zh-CN.json
index 4ade6a089f..5cb7c243eb 100644
--- a/packages/dashboard/src/locales/zh-CN.json
+++ b/packages/dashboard/src/locales/zh-CN.json
@@ -1604,7 +1604,14 @@
"label": "使用 Spree 自己的数据"
}
},
- "description": "Spree 使用自身记录提供价格和库存。连接 ERP、PIM 或仓储系统后,可改由其提供数据。"
+ "pricing": {
+ "title": "价格来源",
+ "description": "连接 ERP 或合同定价系统,由其代替 Spree 目录来提供价格。"
+ },
+ "inventory": {
+ "title": "库存来源",
+ "description": "连接仓储或 ERP 系统,由其代替 Spree 自身记录来提供库存。"
+ }
}
},
"store_credit": {
@@ -3136,8 +3143,7 @@
"tab_payments": "支付",
"tab_standards": "标准与格式",
"tab_storefront_access": "店铺访问权限",
- "title": "店铺设置",
- "tab_data_sources": "价格与库存来源"
+ "title": "店铺设置"
},
"tax_categories": {
"add_sheet_title": "添加税收类别",
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsx
index a4fbdacdf8..441234631b 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsx
@@ -71,10 +71,8 @@ export const Route = createFileRoute('/_authenticated/$storeId/settings/store')(
component: StoreSettingsPage,
})
-const PRICING_PROVIDER_DOCS_URL =
- 'https://spreecommerce.org/docs/v6/developer/how-to/custom-pricing-provider'
-const INVENTORY_PROVIDER_DOCS_URL =
- 'https://spreecommerce.org/docs/v6/developer/how-to/custom-inventory-provider'
+const PRICING_PROVIDER_DOCS_URL = 'https://spreecommerce.org/docs/developer/providers/pim'
+const INVENTORY_PROVIDER_DOCS_URL = 'https://spreecommerce.org/docs/developer/providers/erp'
function DocsLink({ href, children }: { href: string; children: ReactNode }) {
return (
@@ -204,6 +202,12 @@ function StoreSettingsForm({ store }: { store: Store }) {
// Once the counter has issued its first number the starting value is inert,
// so the field says so rather than accepting a value that does nothing.
const sequenceStarted = store.order_number_sequence_started ?? false
+ // The failure-policy selects only render for a provider that can fail —
+ // Spree's own records cannot, so 'internal' has no policy to choose.
+ const externalPricingSelected = form.watch('preferred_pricing_provider') !== INTERNAL_PROVIDER_KEY
+ const externalInventorySelected =
+ form.watch('preferred_inventory_provider') !== INTERNAL_PROVIDER_KEY
+
const numberFormat = form.watch('preferred_document_number_format')
const numberPrefix = form.watch('preferred_order_number_prefix')
const numberSuffix = form.watch('preferred_order_number_suffix')
@@ -719,9 +723,9 @@ function StoreSettingsForm({ store }: { store: Store }) {
</Card>
<Card>
<CardHeader>
- <CardTitle>{t('admin.pages.settings.store.tab_data_sources')}</CardTitle>
+ <CardTitle>{t('admin.fields.store.data_sources.pricing.title')}</CardTitle>
<CardDescription>
- {t('admin.fields.store.data_sources.description')}
+ {t('admin.fields.store.data_sources.pricing.description')}
</CardDescription>
</CardHeader>
<CardContent>
@@ -734,14 +738,36 @@ function StoreSettingsForm({ store }: { store: Store }) {
control={form.control}
options={providerOptions(dataSources?.pricing_providers)}
/>
- <SelectField
- id="store-pricing-failure-policy"
- label={t('admin.fields.store.data_sources.pricing_failure_policy.label')}
- help={t('admin.fields.store.data_sources.pricing_failure_policy.help')}
- name="preferred_pricing_provider_failure_policy"
- control={form.control}
- options={failurePolicyOptions}
- />
+ {/* Spree's own catalog cannot fail to answer, so there is
+ no failure to have a policy about until an external
+ provider is selected. */}
+ {externalPricingSelected && (
+ <SelectField
+ id="store-pricing-failure-policy"
+ label={t('admin.fields.store.data_sources.pricing_failure_policy.label')}
+ help={t('admin.fields.store.data_sources.pricing_failure_policy.help')}
+ name="preferred_pricing_provider_failure_policy"
+ control={form.control}
+ options={failurePolicyOptions}
+ />
+ )}
+ </FieldGroup>
+ <div className="mt-6 border-t pt-4">
+ <DocsLink href={PRICING_PROVIDER_DOCS_URL}>
+ {t('admin.fields.store.data_sources.pricing_provider.docs_link')}
+ </DocsLink>
+ </div>
+ </CardContent>
+ </Card>
+ <Card>
+ <CardHeader>
+ <CardTitle>{t('admin.fields.store.data_sources.inventory.title')}</CardTitle>
+ <CardDescription>
+ {t('admin.fields.store.data_sources.inventory.description')}
+ </CardDescription>
+ </CardHeader>
+ <CardContent>
+ <FieldGroup>
<SelectField
id="store-inventory-provider"
label={t('admin.fields.store.data_sources.inventory_provider.label')}
@@ -750,19 +776,18 @@ function StoreSettingsForm({ store }: { store: Store }) {
control={form.control}
options={providerOptions(dataSources?.inventory_providers)}
/>
- <SelectField
- id="store-inventory-failure-policy"
- label={t('admin.fields.store.data_sources.inventory_failure_policy.label')}
- help={t('admin.fields.store.data_sources.inventory_failure_policy.help')}
- name="preferred_inventory_provider_failure_policy"
- control={form.control}
- options={failurePolicyOptions}
- />
+ {externalInventorySelected && (
+ <SelectField
+ id="store-inventory-failure-policy"
+ label={t('admin.fields.store.data_sources.inventory_failure_policy.label')}
+ help={t('admin.fields.store.data_sources.inventory_failure_policy.help')}
+ name="preferred_inventory_provider_failure_policy"
+ control={form.control}
+ options={failurePolicyOptions}
+ />
+ )}
</FieldGroup>
- <div className="mt-6 flex flex-col gap-2 border-t pt-4 sm:flex-row sm:gap-6">
- <DocsLink href={PRICING_PROVIDER_DOCS_URL}>
- {t('admin.fields.store.data_sources.pricing_provider.docs_link')}
- </DocsLink>
+ <div className="mt-6 border-t pt-4">
<DocsLink href={INVENTORY_PROVIDER_DOCS_URL}>
{t('admin.fields.store.data_sources.inventory_provider.docs_link')}
</DocsLink>