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
Added packaging settings and order logistics to the dashboard
Damian Legawiec6d789a3d17a6
diff --git a/packages/dashboard-core/src/api-client.ts b/packages/dashboard-core/src/api-client.tsindex e111e49e1f..06edfecfcf 100644--- a/packages/dashboard-core/src/api-client.ts+++ b/packages/dashboard-core/src/api-client.ts@@ -151,6 +151,14 @@ export interface PanelApiClient {deliveryProfiles?: {list(params?: Record<string, unknown>): Promise<{ data: PanelDeliveryProfile[] }>}+ /**+ * The store's packaging vocabulary. Read by the variant editor to offer+ * the carton a product is packed into; the panel passes `kind` through so+ * only cartons are listed.+ */+ packageTypes?: {+ list(params?: Record<string, unknown>): Promise<{ data: PanelPackageType[] }>+ }/*** Headers a file download must carry beyond the bearer token.*@@ -268,6 +276,18 @@ export interface PanelDeliveryProfile extends PanelNamedRecord {default?: boolean}+export interface PanelPackageType extends PanelNamedRecord {+ kind?: string+ /**+ * Read alongside the name so a picker can tell two cartons apart. Decimals+ * arrive as strings, as every measurement on the wire does.+ */+ length?: string | null+ width?: string | null+ height?: string | null+ dimensions_unit?: string | null+}+/*** One CSV import, as the shared wizard reads it: the mapping payload while* `mapping`, the poll counters once processing starts.diff --git a/packages/dashboard-core/src/lib/permissions.ts b/packages/dashboard-core/src/lib/permissions.tsindex b053f11d32..b0d2776443 100644--- a/packages/dashboard-core/src/lib/permissions.ts+++ b/packages/dashboard-core/src/lib/permissions.ts@@ -19,6 +19,9 @@ export const Subject = {ApiKey: 'Spree::ApiKey',AllowedOrigin: 'Spree::AllowedOrigin',Store: 'Spree::Store',+ // The store's packaging vocabulary: the box it ships parcels in, and the+ // cartons, pallets and containers a wholesale order leaves on.+ PackageType: 'Spree::PackageType',Channel: 'Spree::Channel',OrderRoutingRule: 'Spree::OrderRoutingRule',// Categories are Spree::Category < Spree::Taxon; abilities are published underdiff --git a/packages/dashboard-core/src/locales/ar.json b/packages/dashboard-core/src/locales/ar.jsonindex f3a96f79a7..799f4571b9 100644--- a/packages/dashboard-core/src/locales/ar.json+++ b/packages/dashboard-core/src/locales/ar.json@@ -840,7 +840,19 @@"units_per_carton": {"label": "الوحدات في الكرتونة"},- "quantity_rule_invalid": "أدخل عددًا صحيحًا أكبر من صفر، أو اترك الحقل فارغًا."+ "quantity_rule_invalid": "أدخل عددًا صحيحًا أكبر من صفر، أو اترك الحقل فارغًا.",+ "carton_package_type_id": {+ "label": "الكرتونة",+ "help": "الكرتونة التي يُعبأ فيها هذا المنتج. مقاساتها تسري على كل ما يُعبأ بالطريقة نفسها."+ },+ "carton_weight": {+ "label": "وزن الكرتونة",+ "help": "وزن الكرتونة الواحدة بعد تعبئتها."+ },+ "cartons_per_pallet": {+ "label": "الكراتين لكل منصة"+ },+ "carton_weight_invalid": "أدخل وزن كرتونة أكبر من صفر، أو اترك الحقل فارغًا."},"minimum_order_quantity": {"label": "الحد الأدنى لكمية الطلب",@@ -1294,6 +1306,8 @@"local": "العناصر فقط في هذا الموقع"},"search_placeholder": "البحث بالاسم…",+ "section_behavior": "السلوك",+ "section_details": "التفاصيل","section_pickup": "يلتقط","section_returns": "المرتجعات","stock_levels": {@@ -1510,7 +1524,11 @@"identity": "هوية","tax_category_placeholder": "ترث من المنتج","ordering": "الطلب للشركات",- "ordering_help": "الكمية التي يجب على المشتري أخذها. لا يزال المخزون يُحسب بالوحدات."+ "ordering_help": "الكمية التي يجب على المشتري أخذها. لا يزال المخزون يُحسب بالوحدات.",+ "packing": "التعبئة",+ "packing_help": "كيف يغادر هذا المنتج المستودع بالجملة. تُبنى عروض أسعار الشحن على هذه الأرقام.",+ "carton_placeholder": "بدون كرتونة",+ "pending_save": "تُحفظ التغييرات هنا مع المنتج."},"title": "المتغيرات","variant_label": "البديل"@@ -1713,6 +1731,10 @@"name": "قناة البيع","description": "إتاحة طريقة التوصيل هذه في قنوات البيع المحددة فقط"},+ "company_rule": {+ "name": "الشركة",+ "description": "إتاحة طريقة التوصيل هذه فقط للطلبات المقدمة لشركة، أو فقط لغير ذلك"+ },"excluded_products_rule": {"name": "المنتجات المستثناة","description": "إخفاء طريقة التوصيل هذه عندما يحتوي الطلب على أي من هذه المنتجات"@@ -1721,6 +1743,10 @@"name": "إجمالي الطلب","description": "إتاحة طريقة التوصيل هذه فقط عندما يقع إجمالي الطلب ضمن نطاق"},+ "volume_rule": {+ "name": "الحجم",+ "description": "إتاحة طريقة التوصيل هذه فقط عندما يقع حجم الشحنة ضمن نطاق، بالمتر المكعب"+ },"weight_rule": {"name": "الوزن","description": "إتاحة طريقة التوصيل هذه فقط عندما يقع وزن الطرد ضمن نطاق"diff --git a/packages/dashboard-core/src/locales/de.json b/packages/dashboard-core/src/locales/de.jsonindex 4c8a737c40..a8ab6dff59 100644--- a/packages/dashboard-core/src/locales/de.json+++ b/packages/dashboard-core/src/locales/de.json@@ -840,7 +840,19 @@"units_per_carton": {"label": "Stück pro Karton"},- "quantity_rule_invalid": "Geben Sie eine ganze Zahl größer als null ein oder lassen Sie das Feld leer."+ "quantity_rule_invalid": "Geben Sie eine ganze Zahl größer als null ein oder lassen Sie das Feld leer.",+ "carton_package_type_id": {+ "label": "Karton",+ "help": "Der Karton, in den dieses Produkt verpackt wird. Seine Maße gelten für alles, was gleich verpackt wird."+ },+ "carton_weight": {+ "label": "Kartongewicht",+ "help": "Das Gewicht eines gepackten Kartons."+ },+ "cartons_per_pallet": {+ "label": "Kartons pro Palette"+ },+ "carton_weight_invalid": "Geben Sie ein Kartongewicht größer als null ein oder lassen Sie das Feld leer."},"minimum_order_quantity": {"label": "Mindestbestellmenge",@@ -1294,6 +1306,8 @@"local": "Nur Artikel an diesem Standort"},"search_placeholder": "Nach Name suchen…",+ "section_behavior": "Verhalten",+ "section_details": "Details","section_pickup": "Abholung","section_returns": "Rücksendungen","stock_levels": {@@ -1511,7 +1525,11 @@"identity": "Identität","tax_category_placeholder": "Vom Produkt übernehmen","ordering": "B2B-Bestellung",- "ordering_help": "Wie viel ein Käufer abnehmen muss. Der Bestand wird weiterhin in Stück gezählt."+ "ordering_help": "Wie viel ein Käufer abnehmen muss. Der Bestand wird weiterhin in Stück gezählt.",+ "packing": "Verpackung",+ "packing_help": "Wie dieses Produkt als Großmenge das Lager verlässt. Frachtangebote beruhen auf diesen Zahlen.",+ "carton_placeholder": "Kein Karton",+ "pending_save": "Änderungen hier werden mit dem Produkt gespeichert."},"title": "Varianten","variant_label": "Variante"@@ -1708,6 +1726,10 @@"name": "Vertriebskanal","description": "Diese Versandart nur in den gewählten Vertriebskanälen anbieten"},+ "company_rule": {+ "name": "Firma",+ "description": "Diese Versandart nur für Bestellungen auf eine Firma anbieten – oder nur für die übrigen"+ },"excluded_products_rule": {"name": "Ausgeschlossene Produkte","description": "Diese Versandart ausblenden, wenn die Bestellung eines dieser Produkte enthält"@@ -1716,6 +1738,10 @@"name": "Warenwert","description": "Diese Versandart nur anbieten, wenn der Bestellwert im Bereich liegt"},+ "volume_rule": {+ "name": "Volumen",+ "description": "Diese Versandart nur anbieten, wenn das Sendungsvolumen in Kubikmetern im Bereich liegt"+ },"weight_rule": {"name": "Gewicht","description": "Diese Versandart nur anbieten, wenn das Paketgewicht im Bereich liegt"diff --git a/packages/dashboard-core/src/locales/en.json b/packages/dashboard-core/src/locales/en.jsonindex 48402988d7..09fbd9f337 100644--- a/packages/dashboard-core/src/locales/en.json+++ b/packages/dashboard-core/src/locales/en.json@@ -842,7 +842,19 @@"units_per_carton": {"label": "Units per carton"},- "quantity_rule_invalid": "Enter a whole number greater than zero, or leave blank."+ "quantity_rule_invalid": "Enter a whole number greater than zero, or leave blank.",+ "carton_package_type_id": {+ "label": "Carton",+ "help": "The carton this product is packed into. Its size is shared by everything packed the same way."+ },+ "carton_weight": {+ "label": "Carton weight",+ "help": "What one packed carton weighs."+ },+ "cartons_per_pallet": {+ "label": "Cartons per pallet"+ },+ "carton_weight_invalid": "Enter a carton weight greater than zero, or leave it blank."},"minimum_order_quantity": {"label": "Minimum order quantity",@@ -1296,6 +1308,8 @@"local": "Only items at this location"},"search_placeholder": "Search by name…",+ "section_behavior": "Behavior",+ "section_details": "Details","section_pickup": "Pickup","section_returns": "Returns","stock_levels": {@@ -1513,7 +1527,11 @@"identity": "Identity","tax_category_placeholder": "Inherit from product","ordering": "B2B ordering",- "ordering_help": "How much a buyer must take. Stock is still counted in units."+ "ordering_help": "How much a buyer must take. Stock is still counted in units.",+ "packing": "Packing",+ "packing_help": "How this product leaves the warehouse in bulk. Freight quotes are built from these numbers.",+ "carton_placeholder": "No carton",+ "pending_save": "Changes here are saved with the product."},"title": "Variants","variant_label": "Variant"@@ -1710,6 +1728,10 @@"name": "Channel","description": "Offer this delivery method only on the selected sales channels"},+ "company_rule": {+ "name": "Company",+ "description": "Offer this delivery method only to orders placed for a company, or only to those that are not"+ },"excluded_products_rule": {"name": "Excluded products","description": "Hide this delivery method when the order contains any of these products"@@ -1718,6 +1740,10 @@"name": "Item total","description": "Offer this delivery method only when the order total is within a range"},+ "volume_rule": {+ "name": "Volume",+ "description": "Offer this delivery method only when the shipment volume is within a range, in cubic meters"+ },"weight_rule": {"name": "Weight","description": "Offer this delivery method only when the parcel weight is within a range"diff --git a/packages/dashboard-core/src/locales/fr.json b/packages/dashboard-core/src/locales/fr.jsonindex dc1b19ec66..10175c354b 100644--- a/packages/dashboard-core/src/locales/fr.json+++ b/packages/dashboard-core/src/locales/fr.json@@ -840,7 +840,19 @@"units_per_carton": {"label": "Unités par carton"},- "quantity_rule_invalid": "Saisissez un nombre entier supérieur à zéro, ou laissez vide."+ "quantity_rule_invalid": "Saisissez un nombre entier supérieur à zéro, ou laissez vide.",+ "carton_package_type_id": {+ "label": "Carton",+ "help": "Le carton dans lequel ce produit est emballé. Ses dimensions valent pour tout ce qui est emballé de la même façon."+ },+ "carton_weight": {+ "label": "Poids du carton",+ "help": "Le poids d’un carton rempli."+ },+ "cartons_per_pallet": {+ "label": "Cartons par palette"+ },+ "carton_weight_invalid": "Saisissez un poids de carton supérieur à zéro, ou laissez le champ vide."},"minimum_order_quantity": {"label": "Quantité minimale de commande",@@ -1294,6 +1306,8 @@"local": "Uniquement les articles à cet emplacement"},"search_placeholder": "Rechercher par nom…",+ "section_behavior": "Comportement",+ "section_details": "Détails","section_pickup": "Retrait","section_returns": "Retours","stock_levels": {@@ -1511,7 +1525,11 @@"identity": "Identité","tax_category_placeholder": "Hériter du produit","ordering": "Commande B2B",- "ordering_help": "Combien un acheteur doit prendre. Le stock reste compté en unités."+ "ordering_help": "Combien un acheteur doit prendre. Le stock reste compté en unités.",+ "packing": "Emballage",+ "packing_help": "Comment ce produit quitte l’entrepôt en gros. Les devis de fret reposent sur ces chiffres.",+ "carton_placeholder": "Aucun carton",+ "pending_save": "Les modifications sont enregistrées avec le produit."},"title": "Variantes","variant_label": "Variante"@@ -1708,6 +1726,10 @@"name": "Canal de vente","description": "Proposer ce mode de livraison uniquement sur les canaux choisis"},+ "company_rule": {+ "name": "Entreprise",+ "description": "Proposer ce mode de livraison uniquement aux commandes passées pour une entreprise, ou uniquement aux autres"+ },"excluded_products_rule": {"name": "Produits exclus","description": "Masquer ce mode de livraison si la commande contient un de ces produits"@@ -1716,6 +1738,10 @@"name": "Total des articles","description": "Proposer ce mode de livraison uniquement si le total est dans une plage"},+ "volume_rule": {+ "name": "Volume",+ "description": "Proposer ce mode de livraison uniquement si le volume est dans une plage, en mètres cubes"+ },"weight_rule": {"name": "Poids","description": "Proposer ce mode de livraison uniquement si le poids est dans une plage"diff --git a/packages/dashboard-core/src/locales/pl.json b/packages/dashboard-core/src/locales/pl.jsonindex 2dc31d3196..2d66d6f34d 100644--- a/packages/dashboard-core/src/locales/pl.json+++ b/packages/dashboard-core/src/locales/pl.json@@ -841,7 +841,19 @@"units_per_carton": {"label": "Sztuk w kartonie"},- "quantity_rule_invalid": "Podaj liczbę całkowitą większą od zera lub pozostaw pole puste."+ "quantity_rule_invalid": "Podaj liczbę całkowitą większą od zera lub pozostaw pole puste.",+ "carton_package_type_id": {+ "label": "Karton",+ "help": "Karton, w który pakowany jest ten produkt. Jego wymiary dotyczą wszystkiego pakowanego tak samo."+ },+ "carton_weight": {+ "label": "Waga kartonu",+ "help": "Waga jednego zapakowanego kartonu."+ },+ "cartons_per_pallet": {+ "label": "Kartonów na palecie"+ },+ "carton_weight_invalid": "Podaj wagę kartonu większą od zera albo zostaw pole puste."},"minimum_order_quantity": {"label": "Minimalna wielkość zamówienia",@@ -1311,6 +1323,8 @@"local": "Tylko produkty w tej lokalizacji"},"search_placeholder": "Szukaj według nazwy…",+ "section_behavior": "Zachowanie",+ "section_details": "Szczegóły","section_pickup": "Odbiór","section_returns": "Zwroty","stock_levels": {@@ -1534,7 +1548,11 @@"identity": "Tożsamość","tax_category_placeholder": "Dziedzicz z produktu","ordering": "Zamówienia B2B",- "ordering_help": "Ile kupujący musi wziąć. Stan magazynowy nadal liczony jest w sztukach."+ "ordering_help": "Ile kupujący musi wziąć. Stan magazynowy nadal liczony jest w sztukach.",+ "packing": "Pakowanie",+ "packing_help": "Jak ten produkt opuszcza magazyn hurtowo. Na tych liczbach opierają się wyceny frachtu.",+ "carton_placeholder": "Brak kartonu",+ "pending_save": "Zmiany zapisują się razem z produktem."},"title": "Warianty","variant_label": "Wariant"@@ -1737,6 +1755,10 @@"name": "Kanał sprzedaży","description": "Oferuj tę metodę dostawy tylko w wybranych kanałach sprzedaży"},+ "company_rule": {+ "name": "Firma",+ "description": "Oferuj tę metodę dostawy tylko dla zamówień składanych na firmę albo tylko dla pozostałych"+ },"excluded_products_rule": {"name": "Wykluczone produkty","description": "Ukryj tę metodę dostawy, gdy zamówienie zawiera któryś z tych produktów"@@ -1745,6 +1767,10 @@"name": "Wartość zamówienia","description": "Oferuj tę metodę dostawy tylko, gdy wartość zamówienia mieści się w przedziale"},+ "volume_rule": {+ "name": "Objętość",+ "description": "Oferuj tę metodę dostawy tylko, gdy objętość przesyłki mieści się w przedziale, w metrach sześciennych"+ },"weight_rule": {"name": "Waga","description": "Oferuj tę metodę dostawy tylko, gdy waga paczki mieści się w przedziale"diff --git a/packages/dashboard-core/src/locales/zh-CN.json b/packages/dashboard-core/src/locales/zh-CN.jsonindex 4f30f4eb1e..9c1cc8ac03 100644--- a/packages/dashboard-core/src/locales/zh-CN.json+++ b/packages/dashboard-core/src/locales/zh-CN.json@@ -840,7 +840,19 @@"units_per_carton": {"label": "每箱件数"},- "quantity_rule_invalid": "请输入大于零的整数,或留空。"+ "quantity_rule_invalid": "请输入大于零的整数,或留空。",+ "carton_package_type_id": {+ "label": "纸箱",+ "help": "此商品所装的纸箱。同样装法的商品共用它的尺寸。"+ },+ "carton_weight": {+ "label": "整箱重量",+ "help": "装满一箱后的重量。"+ },+ "cartons_per_pallet": {+ "label": "每托盘箱数"+ },+ "carton_weight_invalid": "请输入大于零的整箱重量,或留空。"},"minimum_order_quantity": {"label": "最小起订量",@@ -1294,6 +1306,8 @@"local": "仅限此地点的商品"},"search_placeholder": "按名称搜索…",+ "section_behavior": "行为",+ "section_details": "详细信息","section_pickup": "自提","section_returns": "退货","stock_levels": {@@ -1510,7 +1524,11 @@"identity": "标识","tax_category_placeholder": "继承自商品","ordering": "B2B 订购",- "ordering_help": "买家必须订购的数量。库存仍以件计算。"+ "ordering_help": "买家必须订购的数量。库存仍以件计算。",+ "packing": "装箱",+ "packing_help": "此商品成批出库的方式。货运报价依据这些数字计算。",+ "carton_placeholder": "未装箱",+ "pending_save": "此处的更改随商品一并保存。"},"title": "变体","variant_label": "变体"@@ -1707,6 +1725,10 @@"name": "销售渠道","description": "仅在所选销售渠道提供此配送方式"},+ "company_rule": {+ "name": "公司",+ "description": "仅向以公司名义下的订单提供此配送方式,或仅向非公司订单提供"+ },"excluded_products_rule": {"name": "排除的商品","description": "当订单包含其中任一商品时隐藏此配送方式"@@ -1715,6 +1737,10 @@"name": "订单金额","description": "仅当订单金额在区间内时提供此配送方式"},+ "volume_rule": {+ "name": "体积",+ "description": "仅当发货体积(立方米)在区间内时提供此配送方式"+ },"weight_rule": {"name": "重量","description": "仅当包裹重量在区间内时提供此配送方式"diff --git a/packages/dashboard-core/src/pages/stock-locations.tsx b/packages/dashboard-core/src/pages/stock-locations.tsxindex 704444621d..bd7287158e 100644--- a/packages/dashboard-core/src/pages/stock-locations.tsx+++ b/packages/dashboard-core/src/pages/stock-locations.tsx@@ -3,8 +3,8 @@ import {Button,Field,FieldError,- FieldGroup,FieldLabel,+ FormSection,Input,RowActions,Select,@@ -345,296 +345,290 @@ function StockLocationFormFields({ form }: { form: UseFormReturn<StockLocationFoconst pickupEnabled = form.watch('pickup_enabled')return (- <FieldGroup>+ // Sections are siblings: each is its own fieldset, so nesting them inside+ // one group would make every field a member of a group it does not belong+ // to as well as its own.+ <div className="flex flex-col gap-6">{errors.root?.message && (<p className="text-sm text-destructive" role="alert">{errors.root.message}</p>)}- <Field>- <FieldLabel htmlFor="name">{t('admin.fields.name.label')}</FieldLabel>- <Input- id="name"- autoFocus- placeholder={t('admin.fields.stock_location.name.placeholder')}- aria-invalid={!!errors.name || undefined}- {...form.register('name')}+ <FormSection title={t('admin.stock_locations.section_details')}>+ <Field>+ <FieldLabel htmlFor="name">{t('admin.fields.name.label')}</FieldLabel>+ <Input+ id="name"+ autoFocus+ placeholder={t('admin.fields.stock_location.name.placeholder')}+ aria-invalid={!!errors.name || undefined}+ {...form.register('name')}+ />+ <FieldError errors={[errors.name]} />+ </Field>++ <Field>+ <FieldLabel htmlFor="admin-name">+ {t('admin.fields.stock_location.admin_name.label')}+ </FieldLabel>+ <Input+ id="admin-name"+ placeholder={t('admin.fields.stock_location.admin_name.placeholder')}+ aria-invalid={!!errors.admin_name || undefined}+ {...form.register('admin_name')}+ />+ <FieldError errors={[errors.admin_name]} />+ </Field>++ <Field>+ <FieldLabel htmlFor="kind">{t('admin.fields.stock_location.kind.label')}</FieldLabel>+ <Controller+ name="kind"+ control={form.control}+ render={({ field }) => {+ const items = STOCK_LOCATION_KINDS.map((value) => ({+ value,+ label: t(`admin.stock_locations.kinds.${value}`),+ }))+ return (+ <Select items={items as never} value={field.value} onValueChange={field.onChange}>+ <SelectTrigger id="kind">+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ {items.map((o) => (+ <SelectItem key={o.value} value={o.value}>+ {o.label}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ )+ }}+ />+ <FieldError errors={[errors.kind]} />+ </Field>+ </FormSection>++ <FormSection title={t('admin.stock_locations.section_behavior')}>+ <BooleanRow+ id="active"+ label={t('admin.fields.stock_location.active.label')}+ help={t('admin.fields.stock_location.active.help')}+ form={form}+ name="active"/>- <FieldError errors={[errors.name]} />- </Field>-- <Field>- <FieldLabel htmlFor="admin-name">- {t('admin.fields.stock_location.admin_name.label')}- </FieldLabel>- <Input- id="admin-name"- placeholder={t('admin.fields.stock_location.admin_name.placeholder')}- aria-invalid={!!errors.admin_name || undefined}- {...form.register('admin_name')}+ <BooleanRow+ id="default"+ label={t('admin.fields.stock_location.default.label')}+ help={t('admin.fields.stock_location.default.help')}+ form={form}+ name="default"/>- <FieldError errors={[errors.admin_name]} />- </Field>-- <Field>- <FieldLabel htmlFor="kind">{t('admin.fields.stock_location.kind.label')}</FieldLabel>- <Controller- name="kind"- control={form.control}- render={({ field }) => {- const items = STOCK_LOCATION_KINDS.map((value) => ({- value,- label: t(`admin.stock_locations.kinds.${value}`),- }))- return (- <Select items={items as never} value={field.value} onValueChange={field.onChange}>- <SelectTrigger id="kind">- <SelectValue />- </SelectTrigger>- <SelectContent>- {items.map((o) => (- <SelectItem key={o.value} value={o.value}>- {o.label}- </SelectItem>- ))}- </SelectContent>- </Select>- )- }}+ <BooleanRow+ id="backorderable-default"+ label={t('admin.fields.stock_location.backorderable_default.label')}+ help={t('admin.fields.stock_location.backorderable_default.help')}+ form={form}+ name="backorderable_default"/>- <FieldError errors={[errors.kind]} />- </Field>-- <BooleanRow- id="active"- label={t('admin.fields.stock_location.active.label')}- help={t('admin.fields.stock_location.active.help')}- form={form}- name="active"- />- <BooleanRow- id="default"- label={t('admin.fields.stock_location.default.label')}- help={t('admin.fields.stock_location.default.help')}- form={form}- name="default"- />- <BooleanRow- id="backorderable-default"- label={t('admin.fields.stock_location.backorderable_default.label')}- help={t('admin.fields.stock_location.backorderable_default.help')}- form={form}- name="backorderable_default"- />- <BooleanRow- id="propagate-all-variants"- label={t('admin.fields.stock_location.propagate_all_variants.label')}- help={t('admin.fields.stock_location.propagate_all_variants.help')}- form={form}- name="propagate_all_variants"- />-- <div className="border-t border-border pt-4">- <h3 className="mb-3 text-sm font-medium">{t('admin.fields.address.address1.label')}</h3>- <FieldGroup>+ <BooleanRow+ id="propagate-all-variants"+ label={t('admin.fields.stock_location.propagate_all_variants.label')}+ help={t('admin.fields.stock_location.propagate_all_variants.help')}+ form={form}+ name="propagate_all_variants"+ />+ </FormSection>++ <FormSection title={t('admin.fields.address.address1.label')}>+ <Field>+ <FieldLabel htmlFor="address1">{t('admin.fields.address1.label')}</FieldLabel>+ <Input+ id="address1"+ aria-invalid={!!errors.address1 || undefined}+ {...form.register('address1')}+ />+ <FieldError errors={[errors.address1]} />+ </Field>+ <Field>+ <FieldLabel htmlFor="address2">{t('admin.fields.address2.label')}</FieldLabel>+ <Input+ id="address2"+ aria-invalid={!!errors.address2 || undefined}+ {...form.register('address2')}+ />+ <FieldError errors={[errors.address2]} />+ </Field>+ <div className="grid grid-cols-2 gap-3"><Field>- <FieldLabel htmlFor="address1">{t('admin.fields.address1.label')}</FieldLabel>- <Input- id="address1"- aria-invalid={!!errors.address1 || undefined}- {...form.register('address1')}- />- <FieldError errors={[errors.address1]} />+ <FieldLabel htmlFor="city">{t('admin.fields.city.label')}</FieldLabel>+ <Input id="city" aria-invalid={!!errors.city || undefined} {...form.register('city')} />+ <FieldError errors={[errors.city]} /></Field><Field>- <FieldLabel htmlFor="address2">{t('admin.fields.address2.label')}</FieldLabel>+ <FieldLabel htmlFor="zipcode">{t('admin.fields.zipcode.label')}</FieldLabel><Input- id="address2"- aria-invalid={!!errors.address2 || undefined}- {...form.register('address2')}+ id="zipcode"+ aria-invalid={!!errors.zipcode || undefined}+ {...form.register('zipcode')}/>- <FieldError errors={[errors.address2]} />+ <FieldError errors={[errors.zipcode]} /></Field>- <div className="grid grid-cols-2 gap-3">- <Field>- <FieldLabel htmlFor="city">{t('admin.fields.city.label')}</FieldLabel>- <Input- id="city"- aria-invalid={!!errors.city || undefined}- {...form.register('city')}- />- <FieldError errors={[errors.city]} />- </Field>- <Field>- <FieldLabel htmlFor="zipcode">{t('admin.fields.zipcode.label')}</FieldLabel>- <Input- id="zipcode"- aria-invalid={!!errors.zipcode || undefined}- {...form.register('zipcode')}+ </div>+ <Field>+ <FieldLabel>{t('admin.fields.country_code.label')}</FieldLabel>+ <Controller+ name="country_code"+ control={form.control}+ render={({ field }) => (+ <CountryCombobox+ value={field.value}+ onValueChange={(iso) => {+ field.onChange(iso)+ form.setValue('state_code', '', { shouldDirty: true })+ form.setValue('state_name', '', { shouldDirty: true })+ }}/>- <FieldError errors={[errors.zipcode]} />- </Field>- </div>+ )}+ />+ <FieldError errors={[errors.country_code]} />+ </Field>+ {states.length > 0 ? (<Field>- <FieldLabel>{t('admin.fields.country_code.label')}</FieldLabel>+ <FieldLabel>{t('admin.fields.state_code.label')}</FieldLabel><Controller- name="country_code"+ name="state_code"control={form.control}render={({ field }) => (- <CountryCombobox+ <StateCombobox+ countryCode={countryCode}+ states={states}value={field.value}- onValueChange={(iso) => {- field.onChange(iso)- form.setValue('state_code', '', { shouldDirty: true })- form.setValue('state_name', '', { shouldDirty: true })- }}+ onValueChange={field.onChange}/>)}/>- <FieldError errors={[errors.country_code]} />+ <FieldError errors={[errors.state_code]} />+ </Field>+ ) : (+ <Field>+ <FieldLabel htmlFor="state-name">{t('admin.fields.state_name.label')}</FieldLabel>+ <Input+ id="state-name"+ aria-invalid={!!errors.state_name || undefined}+ {...form.register('state_name')}+ />+ <FieldError errors={[errors.state_name]} /></Field>- {states.length > 0 ? (+ )}+ <Field>+ <FieldLabel htmlFor="phone">{t('admin.fields.phone.label')}</FieldLabel>+ <Input+ id="phone"+ aria-invalid={!!errors.phone || undefined}+ {...form.register('phone')}+ />+ <FieldError errors={[errors.phone]} />+ </Field>+ <Field>+ <FieldLabel htmlFor="company">{t('admin.fields.company.label')}</FieldLabel>+ <Input+ id="company"+ aria-invalid={!!errors.company || undefined}+ {...form.register('company')}+ />+ <FieldError errors={[errors.company]} />+ </Field>+ </FormSection>++ <FormSection title={t('admin.stock_locations.section_returns')}>+ <BooleanRow+ id="returns-enabled"+ label={t('admin.fields.stock_location.returns_enabled.label')}+ help={t('admin.fields.stock_location.returns_enabled.help')}+ form={form}+ name="returns_enabled"+ />+ </FormSection>++ <FormSection title={t('admin.stock_locations.section_pickup')}>+ <BooleanRow+ id="pickup-enabled"+ label={t('admin.fields.stock_location.pickup_enabled.label')}+ help={t('admin.fields.stock_location.pickup_enabled.help')}+ form={form}+ name="pickup_enabled"+ />+ {pickupEnabled && (+ <><Field>- <FieldLabel>{t('admin.fields.state_code.label')}</FieldLabel>+ <FieldLabel htmlFor="pickup-stock-policy">+ {t('admin.fields.stock_location.pickup_stock_policy.label')}+ </FieldLabel><Controller- name="state_code"+ name="pickup_stock_policy"control={form.control}- render={({ field }) => (- <StateCombobox- countryCode={countryCode}- states={states}- value={field.value}- onValueChange={field.onChange}- />- )}+ render={({ field }) => {+ const items = PICKUP_STOCK_POLICIES.map((value) => ({+ value,+ label: t(`admin.stock_locations.pickup_stock_policies.${value}`),+ }))+ return (+ <Select+ items={items as never}+ value={field.value}+ onValueChange={field.onChange}+ >+ <SelectTrigger id="pickup-stock-policy">+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ {items.map((o) => (+ <SelectItem key={o.value} value={o.value}>+ {o.label}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ )+ }}/>- <FieldError errors={[errors.state_code]} />+ <FieldError errors={[errors.pickup_stock_policy]} /></Field>- ) : (<Field>- <FieldLabel htmlFor="state-name">{t('admin.fields.state_name.label')}</FieldLabel>+ <FieldLabel htmlFor="pickup-ready-in-minutes">+ {t('admin.fields.stock_location.pickup_ready_in_minutes.label')}+ </FieldLabel><Input- id="state-name"- aria-invalid={!!errors.state_name || undefined}- {...form.register('state_name')}+ id="pickup-ready-in-minutes"+ type="number"+ min={0}+ step={5}+ placeholder={t('admin.fields.stock_location.pickup_ready_in_minutes.placeholder')}+ aria-invalid={!!errors.pickup_ready_in_minutes || undefined}+ {...form.register('pickup_ready_in_minutes')}/>- <FieldError errors={[errors.state_name]} />+ <FieldError errors={[errors.pickup_ready_in_minutes]} /></Field>- )}- <Field>- <FieldLabel htmlFor="phone">{t('admin.fields.phone.label')}</FieldLabel>- <Input- id="phone"- aria-invalid={!!errors.phone || undefined}- {...form.register('phone')}- />- <FieldError errors={[errors.phone]} />- </Field>- <Field>- <FieldLabel htmlFor="company">{t('admin.fields.company.label')}</FieldLabel>- <Input- id="company"- aria-invalid={!!errors.company || undefined}- {...form.register('company')}- />- <FieldError errors={[errors.company]} />- </Field>- </FieldGroup>- </div>-- <div className="border-t border-border pt-4">- <h3 className="mb-3 text-sm font-medium">{t('admin.stock_locations.section_returns')}</h3>- <FieldGroup>- <BooleanRow- id="returns-enabled"- label={t('admin.fields.stock_location.returns_enabled.label')}- help={t('admin.fields.stock_location.returns_enabled.help')}- form={form}- name="returns_enabled"- />- </FieldGroup>- </div>-- <div className="border-t border-border pt-4">- <h3 className="mb-3 text-sm font-medium">{t('admin.stock_locations.section_pickup')}</h3>- <FieldGroup>- <BooleanRow- id="pickup-enabled"- label={t('admin.fields.stock_location.pickup_enabled.label')}- help={t('admin.fields.stock_location.pickup_enabled.help')}- form={form}- name="pickup_enabled"- />- {pickupEnabled && (- <>- <Field>- <FieldLabel htmlFor="pickup-stock-policy">- {t('admin.fields.stock_location.pickup_stock_policy.label')}- </FieldLabel>- <Controller- name="pickup_stock_policy"- control={form.control}- render={({ field }) => {- const items = PICKUP_STOCK_POLICIES.map((value) => ({- value,- label: t(`admin.stock_locations.pickup_stock_policies.${value}`),- }))- return (- <Select- items={items as never}- value={field.value}- onValueChange={field.onChange}- >- <SelectTrigger id="pickup-stock-policy">- <SelectValue />- </SelectTrigger>- <SelectContent>- {items.map((o) => (- <SelectItem key={o.value} value={o.value}>- {o.label}- </SelectItem>- ))}- </SelectContent>- </Select>- )- }}- />- <FieldError errors={[errors.pickup_stock_policy]} />- </Field>- <Field>- <FieldLabel htmlFor="pickup-ready-in-minutes">- {t('admin.fields.stock_location.pickup_ready_in_minutes.label')}- </FieldLabel>- <Input- id="pickup-ready-in-minutes"- type="number"- min={0}- step={5}- placeholder={t('admin.fields.stock_location.pickup_ready_in_minutes.placeholder')}- aria-invalid={!!errors.pickup_ready_in_minutes || undefined}- {...form.register('pickup_ready_in_minutes')}- />- <FieldError errors={[errors.pickup_ready_in_minutes]} />- </Field>- <Field>- <FieldLabel htmlFor="pickup-instructions">- {t('admin.fields.stock_location.pickup_instructions.label')}- </FieldLabel>- <Textarea- id="pickup-instructions"- rows={3}- placeholder={t('admin.fields.stock_location.pickup_instructions.placeholder')}- aria-invalid={!!errors.pickup_instructions || undefined}- {...form.register('pickup_instructions')}- />- <FieldError errors={[errors.pickup_instructions]} />- </Field>- </>- )}- </FieldGroup>- </div>- </FieldGroup>+ <Field>+ <FieldLabel htmlFor="pickup-instructions">+ {t('admin.fields.stock_location.pickup_instructions.label')}+ </FieldLabel>+ <Textarea+ id="pickup-instructions"+ rows={3}+ placeholder={t('admin.fields.stock_location.pickup_instructions.placeholder')}+ aria-invalid={!!errors.pickup_instructions || undefined}+ {...form.register('pickup_instructions')}+ />+ <FieldError errors={[errors.pickup_instructions]} />+ </Field>+ </>+ )}+ </FormSection>+ </div>)}diff --git a/packages/dashboard-core/src/products/bulk-variants-dialog.tsx b/packages/dashboard-core/src/products/bulk-variants-dialog.tsxindex 6f8a96123e..b580be7296 100644--- a/packages/dashboard-core/src/products/bulk-variants-dialog.tsx+++ b/packages/dashboard-core/src/products/bulk-variants-dialog.tsx@@ -14,8 +14,10 @@ import {import { useCallback, useEffect, useMemo, useRef } from 'react'import { type UseFormReturn, useWatch } from 'react-hook-form'import { useTranslation } from 'react-i18next'+import { cartonSize } from './carton-size'import { normalizeCustomsDescription, normalizeHsCode } from './normalize-customs'import {+ useFormCartonPackageTypes as useCartonPackageTypes,useFormOptionTypes as useOptionTypes,useFormTaxCategories as useTaxCategories,} from './use-product-form-data'@@ -50,6 +52,8 @@ export function BulkVariantsDialog({ form, open, onOpenChange }: Props) {const optionTypes = useMemo(() => optionTypesData?.data ?? [], [optionTypesData])const { data: taxCategoriesResponse } = useTaxCategories()const taxCategories = taxCategoriesResponse?.data ?? []+ const { data: cartonTypesResponse } = useCartonPackageTypes()+ const cartonTypes = cartonTypesResponse?.data ?? []const { countries } = useCountries()const countryName = useCountryDisplayName()@@ -112,6 +116,10 @@ export function BulkVariantsDialog({ form, open, onOpenChange }: Props) {hsCode: v.hs_code ?? null,countryOfOrigin: v.country_of_origin ?? null,customsDescription: v.customs_description ?? null,+ unitsPerCarton: v.units_per_carton ?? null,+ cartonPackageTypeId: v.carton_package_type_id ?? null,+ cartonWeight: v.carton_weight != null ? String(v.carton_weight) : null,+ cartonsPerPallet: v.cartons_per_pallet != null ? String(v.cartons_per_pallet) : null,})),[variants, optionTypes],)@@ -151,6 +159,27 @@ export function BulkVariantsDialog({ form, open, onOpenChange }: Props) {case 'customsDescription':set(`variants.${idx}.customs_description`, normalizeCustomsDescription(change.value))break+ case 'cartonPackageTypeId':+ set(`variants.${idx}.carton_package_type_id`, change.value)+ break+ // Counts are held as typed strings so an unusable entry can be+ // reported rather than silently coerced away.+ case 'unitsPerCarton':+ set(`variants.${idx}.units_per_carton`, change.value)+ break+ case 'cartonsPerPallet':+ set(`variants.${idx}.cartons_per_pallet`, change.value)+ break+ case 'cartonWeight': {+ if (change.value == null || change.value.trim() === '') {+ set(`variants.${idx}.carton_weight`, null)+ break+ }+ const parsed = Number(change.value.trim().replace(',', '.'))+ if (!Number.isFinite(parsed) || parsed < 0) break+ set(`variants.${idx}.carton_weight`, parsed)+ break+ }case 'preorderable':set(`variants.${idx}.preorderable`, change.value)break@@ -218,6 +247,16 @@ export function BulkVariantsDialog({ form, open, onOpenChange }: Props) {: undefined}countryOptions={countryOptions.length > 0 ? countryOptions : undefined}+ cartonOptions={+ cartonTypes.length > 0+ ? cartonTypes.map((carton) => ({+ value: carton.id,+ // The name stays the label: a pasted column matches on it.+ label: carton.name,+ hint: cartonSize(carton) ?? undefined,+ }))+ : undefined+ }labels={{variant: t('admin.pages.products.price_lists.edit_prices.columns.variant'),sku: t('admin.fields.variant.sku.label'),@@ -234,10 +273,15 @@ export function BulkVariantsDialog({ form, open, onOpenChange }: Props) {hsCode: t('admin.fields.variant.hs_code.label'),countryOfOrigin: t('admin.fields.variant.country_of_origin.label'),customsDescription: t('admin.fields.variant.customs_description.label'),+ unitsPerCarton: t('admin.fields.variant.units_per_carton.label'),+ cartonPackageType: t('admin.fields.variant.carton_package_type_id.label'),+ cartonWeight: t('admin.fields.variant.carton_weight.label'),+ cartonsPerPallet: t('admin.fields.variant.cartons_per_pallet.label'),variantDefault: t('admin.products.variants.default_variant'),unitDefault: t('admin.products.variants.bulk_edit.unset'),taxCategoryNone: t('admin.products.variants.sheet.tax_category_placeholder'),countryOfOriginNone: t('admin.products.variants.bulk_edit.unset'),+ cartonPackageTypeNone: t('admin.products.variants.bulk_edit.unset'),gridAriaLabel: t('admin.products.variants.bulk_edit.grid_aria'),}}/>diff --git a/packages/dashboard-core/src/products/carton-size.test.ts b/packages/dashboard-core/src/products/carton-size.test.tsnew file mode 100644index 0000000000..e917041e0e--- /dev/null+++ b/packages/dashboard-core/src/products/carton-size.test.ts@@ -0,0 +1,51 @@+import { describe, expect, it } from 'vitest'+import { cartonSize } from './carton-size'++describe('cartonSize', () => {+ it('reads back the way a merchant would write it', () => {+ expect(+ cartonSize({+ id: '1',+ name: 'Large',+ length: '60.0',+ width: '40.0',+ height: '40.0',+ dimensions_unit: 'cm',+ }),+ ).toBe('60 × 40 × 40 cm')+ })++ it('keeps a real decimal', () => {+ expect(+ cartonSize({+ id: '1',+ name: 'Small',+ length: '12.5',+ width: '9.0',+ height: '4.25',+ dimensions_unit: 'in',+ }),+ ).toBe('12.5 × 9 × 4.25 in')+ })++ // Half a box is not a size — better to say nothing than "60 × × cm".+ it('says nothing when a measurement is missing', () => {+ expect(+ cartonSize({+ id: '1',+ name: 'Partial',+ length: '60.0',+ width: null,+ height: '40.0',+ dimensions_unit: 'cm',+ }),+ ).toBeNull()+ expect(cartonSize({ id: '1', name: 'Bare' })).toBeNull()+ })++ it('omits an absent unit rather than trailing a space', () => {+ expect(cartonSize({ id: '1', name: 'Unitless', length: '10', width: '10', height: '10' })).toBe(+ '10 × 10 × 10',+ )+ })+})diff --git a/packages/dashboard-core/src/products/carton-size.ts b/packages/dashboard-core/src/products/carton-size.tsnew file mode 100644index 0000000000..8f20e00e20--- /dev/null+++ b/packages/dashboard-core/src/products/carton-size.ts@@ -0,0 +1,20 @@+import type { PanelPackageType } from '../api-client'++/**+ * A carton's size, as the merchant recorded it — for telling two similarly+ * named cartons apart wherever one is chosen.+ *+ * Null unless all three measurements are there: half a box is not a size. The+ * unit travels with the numbers because the same three read as inches rather+ * than centimeters describe a box sixteen times the volume.+ */+export function cartonSize(carton: PanelPackageType): string | null {+ const { length, width, height, dimensions_unit } = carton+ if (length == null || width == null || height == null) return null++ // Decimals arrive as strings, so `60.0` would read back as a precision the+ // merchant never typed.+ const trim = (value: string) => String(Number(value))++ return `${trim(length)} × ${trim(width)} × ${trim(height)} ${dimensions_unit ?? ''}`.trim()+}diff --git a/packages/dashboard-core/src/products/product-form-mapping.ts b/packages/dashboard-core/src/products/product-form-mapping.tsindex 964cb760ee..b236905f9f 100644--- a/packages/dashboard-core/src/products/product-form-mapping.ts+++ b/packages/dashboard-core/src/products/product-form-mapping.ts@@ -36,6 +36,9 @@ export function variantToFormValues(variant: PanelVariant, position: number): Vaorder_multiple: variant.order_multiple?.toString() ?? null,purchase_unit: variant.purchase_unit ?? null,units_per_carton: variant.units_per_carton?.toString() ?? null,+ cartons_per_pallet: variant.cartons_per_pallet?.toString() ?? null,+ carton_weight: variant.carton_weight == null ? null : Number(variant.carton_weight),+ carton_package_type_id: variant.carton_package_type_id ?? null,track_inventory: variant.track_inventory,preorderable: variant.preorderable ?? false,preorder_ships_at: variant.preorder_ships_at ?? null,@@ -182,6 +185,9 @@ export function variantToWirePayload(v: VariantFormValues, index: number) {order_multiple: normalizeQuantityRule(v.order_multiple),purchase_unit: v.purchase_unit ?? null,units_per_carton: normalizeQuantityRule(v.units_per_carton),+ cartons_per_pallet: normalizeQuantityRule(v.cartons_per_pallet),+ carton_weight: v.carton_weight ?? null,+ carton_package_type_id: v.carton_package_type_id ?? null,}if (v.id) payload.id = v.idif (v.track_inventory != null) payload.track_inventory = v.track_inventorydiff --git a/packages/dashboard-core/src/products/product-schema.ts b/packages/dashboard-core/src/products/product-schema.tsindex 1136c4bb38..62ecea3287 100644--- a/packages/dashboard-core/src/products/product-schema.ts+++ b/packages/dashboard-core/src/products/product-schema.ts@@ -70,6 +70,15 @@ export const variantFormSchema = z.object({order_multiple: quantityRuleField,purchase_unit: z.string().nullable().optional(),units_per_carton: quantityRuleField,+ cartons_per_pallet: quantityRuleField,+ // The server refuses a carton that weighs nothing, and a 422 on a nested+ // variant lands on a banner naming no variant — so it is caught on the field.+ carton_weight: z.coerce+ .number()+ .positive({ error: () => i18n.t('admin.fields.variant.carton_weight_invalid') })+ .nullable()+ .optional(),+ carton_package_type_id: z.string().nullable().optional(),track_inventory: z.boolean().optional(),preorderable: z.boolean().optional(),preorder_ships_at: z.string().nullable().optional(),@@ -296,6 +305,9 @@ export function isPlaceholderDefaultVariant(v: VariantFormValues): boolean {!v.order_multiple &&v.purchase_unit == null &&!v.units_per_carton &&+ !v.cartons_per_pallet &&+ v.carton_weight == null &&+ v.carton_package_type_id == null &&v.preorderable !== true &&v.preorder_ships_at == null &&v.backorder_limit == null &&diff --git a/packages/dashboard-core/src/products/product-types.ts b/packages/dashboard-core/src/products/product-types.tsindex 68f37be753..89ed96911a 100644--- a/packages/dashboard-core/src/products/product-types.ts+++ b/packages/dashboard-core/src/products/product-types.ts@@ -60,6 +60,9 @@ export interface PanelVariant {order_multiple?: number | nullpurchase_unit?: string | nullunits_per_carton?: number | null+ cartons_per_pallet?: number | null+ carton_weight?: string | number | null+ carton_package_type_id?: string | nulltrack_inventory?: booleanpreorderable?: booleanpreorder_ships_at?: string | nulldiff --git a/packages/dashboard-core/src/products/use-product-form-data.ts b/packages/dashboard-core/src/products/use-product-form-data.tsindex e17c0eb844..323dce8d3a 100644--- a/packages/dashboard-core/src/products/use-product-form-data.ts+++ b/packages/dashboard-core/src/products/use-product-form-data.ts@@ -5,6 +5,7 @@ import type {PanelMarket,PanelNamedRecord,PanelOptionType,+ PanelPackageType,PanelProductType,} from '../api-client'import { getApiClient } from '../api-client'@@ -128,6 +129,18 @@ export function useFormDeliveryProfiles() {})}+export function useFormCartonPackageTypes() {+ const client = getApiClient()++ return useQuery({+ queryKey: useResourceKey('panel-form-carton-package-types'),+ queryFn: async (): Promise<{ data: PanelPackageType[] }> =>+ (await client.packageTypes?.list({ limit: 100, kind_eq: 'carton' })) ?? { data: [] },+ enabled: Boolean(client.packageTypes),+ staleTime: FIVE_MINUTES,+ })+}+/*** Removing a file already on the product. A panel whose client registers no* deletion answers a no-op mutation, so the gallery still drops the row fromdiff --git a/packages/dashboard-core/src/products/variant-edit-sheet.tsx b/packages/dashboard-core/src/products/variant-edit-sheet.tsxindex 3b91bc0db2..efbf54bdac 100644--- a/packages/dashboard-core/src/products/variant-edit-sheet.tsx+++ b/packages/dashboard-core/src/products/variant-edit-sheet.tsx@@ -3,9 +3,15 @@ import { CountryCombobox, StoreDatePicker } from '@spree/dashboard-core'import {Button,Field,+ FieldDescription,FieldError,FieldLabel,+ FormSection,Input,+ InputGroup,+ InputGroupAddon,+ InputGroupInput,+ InputGroupText,Select,SelectContent,SelectItem,@@ -13,6 +19,7 @@ import {SelectValue,Sheet,SheetContent,+ SheetDescription,SheetFooter,SheetHeader,SheetTitle,@@ -21,9 +28,11 @@ import {import { useEffect, useRef } from 'react'import { Controller, type UseFormReturn } from 'react-hook-form'import { useTranslation } from 'react-i18next'+import { cartonSize } from './carton-size'import { normalizeCustomsDescription, normalizeHsCode } from './normalize-customs'import { PURCHASE_UNITS } from './normalize-quantity'import {+ useFormCartonPackageTypes as useCartonPackageTypes,useFormOptionTypes as useOptionTypes,useFormTaxCategories as useTaxCategories,} from './use-product-form-data'@@ -51,6 +60,14 @@ export function VariantEditSheet({ form, variantIndex, open, onOpenChange }: Proconst hasTaxCategories = taxCategories.length > 0const { data: optionTypesData } = useOptionTypes()const optionTypes = optionTypesData?.data ?? []+ // Nothing to pack into means nothing to ask: the section stays hidden until+ // the store has recorded a carton.+ const { data: cartonTypesResponse } = useCartonPackageTypes()+ const cartonTypes = cartonTypesResponse?.data ?? []+ const hasCartonTypes = cartonTypes.length > 0+ // A packed carton is weighed on the same scale as the goods inside it, so+ // this follows the variant's own unit rather than offering a second one.+ const cartonWeightUnit = form.watch(`variants.${variantIndex}.weight_unit`) || ''// Snapshot the variant when the sheet opens so Cancel can restore it.// Re-snapshot if the user switches between variant rows without closing@@ -117,13 +134,16 @@ export function VariantEditSheet({ form, variantIndex, open, onOpenChange }: Proreturn (<Sheet open={open} onOpenChange={(o) => (o ? onOpenChange(o) : handleCancel())}>- <SheetContent side="right" showCloseButton={false} className="flex flex-col">+ <SheetContent side="right" className="flex flex-col"><SheetHeader><SheetTitle>{t('admin.products.variants.edit_variant', { name: label })}</SheetTitle>+ {/* Nothing here is written until the product itself is saved, and a+ sheet that closes with a tick invites the opposite reading. */}+ <SheetDescription>{t('admin.products.variants.sheet.pending_save')}</SheetDescription></SheetHeader><div className="flex-1 overflow-y-auto p-4 flex flex-col gap-6">- <Section title={t('admin.products.variants.sheet.identity')}>+ <FormSection title={t('admin.products.variants.sheet.identity')}><Field><FieldLabel htmlFor={`variant-${variantIndex}-sku`}>{t('admin.fields.variant.sku.label')}@@ -162,9 +182,9 @@ export function VariantEditSheet({ form, variantIndex, open, onOpenChange }: Pro/><FieldError errors={[form.formState.errors.variants?.[variantIndex]?.barcode]} /></Field>- </Section>+ </FormSection>- <Section title={t('admin.fields.shipping.label')}>+ <FormSection title={t('admin.fields.shipping.label')}><div className="grid grid-cols-[1fr_120px] gap-3"><Field><FieldLabel htmlFor={`variant-${variantIndex}-weight`}>@@ -270,9 +290,118 @@ export function VariantEditSheet({ form, variantIndex, open, onOpenChange }: Pro/></Field></div>- </Section>+ </FormSection>- <Section title={t('admin.products.variants.sheet.customs')}>+ {hasCartonTypes && (+ <FormSection title={t('admin.products.variants.sheet.packing')}>+ <p className="text-sm text-muted-foreground">+ {t('admin.products.variants.sheet.packing_help')}+ </p>+ <Field>+ <FieldLabel htmlFor={`variant-${variantIndex}-carton`}>+ {t('admin.fields.variant.carton_package_type_id.label')}+ </FieldLabel>+ <Controller+ name={`variants.${variantIndex}.carton_package_type_id`}+ control={form.control}+ render={({ field }) => (+ <Select+ value={field.value ?? ''}+ onValueChange={(value) => field.onChange(value || null)}+ >+ <SelectTrigger id={`variant-${variantIndex}-carton`} className="w-full">+ <SelectValue+ placeholder={t('admin.products.variants.sheet.carton_placeholder')}+ >+ {(value) =>+ cartonTypes.find((carton) => carton.id === value)?.name ??+ t('admin.products.variants.sheet.carton_placeholder')+ }+ </SelectValue>+ </SelectTrigger>+ <SelectContent>+ {cartonTypes.map((carton) => (+ <SelectItem key={carton.id} value={carton.id}>+ <span className="flex w-full items-baseline justify-between gap-4">+ <span>{carton.name}</span>+ {/* Two cartons named alike are told apart by their+ size, and the merchant is about to state what a+ packed one weighs. */}+ {cartonSize(carton) && (+ <span className="text-xs text-muted-foreground tabular-nums">+ {cartonSize(carton)}+ </span>+ )}+ </span>+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ )}+ />+ <FieldDescription>+ {t('admin.fields.variant.carton_package_type_id.help')}+ </FieldDescription>+ </Field>+ <div className="grid grid-cols-2 gap-3">+ <Field>+ <FieldLabel htmlFor={`variant-${variantIndex}-carton-weight`}>+ {t('admin.fields.variant.carton_weight.label')}+ </FieldLabel>+ {/* Cleared means unmeasured, not zero — and a zero carton+ weight is refused, so coercing a blank to 0 would leave+ the merchant unable to undo their own entry. */}+ <Controller+ name={`variants.${variantIndex}.carton_weight`}+ control={form.control}+ render={({ field }) => (+ <InputGroup>+ <InputGroupInput+ id={`variant-${variantIndex}-carton-weight`}+ type="number"+ step="0.01"+ min="0"+ value={field.value ?? ''}+ onChange={(event) => {+ const parsed = Number(event.target.value)+ field.onChange(+ event.target.value === '' || Number.isNaN(parsed) ? null : parsed,+ )+ }}+ />+ {/* The same scale the variant's own weight is in —+ there is one weight unit per variant, so saying+ which beats offering a second selector. */}+ <InputGroupAddon align="inline-end">+ <InputGroupText>{cartonWeightUnit}</InputGroupText>+ </InputGroupAddon>+ </InputGroup>+ )}+ />+ <FieldDescription>+ {t('admin.fields.variant.carton_weight.help')}+ </FieldDescription>+ </Field>+ <Field>+ <FieldLabel htmlFor={`variant-${variantIndex}-cartons-per-pallet`}>+ {t('admin.fields.variant.cartons_per_pallet.label')}+ </FieldLabel>+ <Input+ id={`variant-${variantIndex}-cartons-per-pallet`}+ type="number"+ min="1"+ step="1"+ {...form.register(`variants.${variantIndex}.cartons_per_pallet`)}+ />+ <FieldError+ errors={[form.formState.errors.variants?.[variantIndex]?.cartons_per_pallet]}+ />+ </Field>+ </div>+ </FormSection>+ )}++ <FormSection title={t('admin.products.variants.sheet.customs')}><p className="text-sm text-muted-foreground">{t('admin.products.variants.sheet.customs_help')}</p>@@ -326,9 +455,9 @@ export function VariantEditSheet({ form, variantIndex, open, onOpenChange }: Proerrors={[form.formState.errors.variants?.[variantIndex]?.customs_description]}/></Field>- </Section>+ </FormSection>- <Section title={t('admin.products.variants.sheet.ordering')}>+ <FormSection title={t('admin.products.variants.sheet.ordering')}><p className="text-sm text-muted-foreground">{t('admin.products.variants.sheet.ordering_help')}</p>@@ -416,9 +545,9 @@ export function VariantEditSheet({ form, variantIndex, open, onOpenChange }: Pro/></Field></div>- </Section>+ </FormSection>- <Section title={t('admin.products.variants.sheet.availability')}>+ <FormSection title={t('admin.products.variants.sheet.availability')}><Field><div className="flex items-start justify-between gap-4"><div className="flex flex-col">@@ -501,10 +630,10 @@ export function VariantEditSheet({ form, variantIndex, open, onOpenChange }: Proerrors={[form.formState.errors.variants?.[variantIndex]?.backorder_limit]}/></Field>- </Section>+ </FormSection>{hasTaxCategories && (- <Section title={t('admin.fields.tax.label')}>+ <FormSection title={t('admin.fields.tax.label')}><Field><FieldLabel htmlFor={`variant-${variantIndex}-tax-cat`}>{t('admin.fields.tax_category_id.label')}@@ -538,7 +667,7 @@ export function VariantEditSheet({ form, variantIndex, open, onOpenChange }: Pro)}/></Field>- </Section>+ </FormSection>)}</div>@@ -554,12 +683,3 @@ export function VariantEditSheet({ form, variantIndex, open, onOpenChange }: Pro</Sheet>)}--function Section({ title, children }: { title: string; children: React.ReactNode }) {- return (- <section className="flex flex-col gap-3">- <h3 className="text-sm font-medium">{title}</h3>- {children}- </section>- )-}diff --git a/packages/dashboard-core/src/products/variants-section.tsx b/packages/dashboard-core/src/products/variants-section.tsxindex 3825292e9a..07924b7055 100644--- a/packages/dashboard-core/src/products/variants-section.tsx+++ b/packages/dashboard-core/src/products/variants-section.tsx@@ -236,6 +236,9 @@ export function VariantsSection({ form, seedFromType = false }: Props) {order_multiple: carry?.order_multiple ?? null,purchase_unit: carry?.purchase_unit ?? null,units_per_carton: carry?.units_per_carton ?? null,+ cartons_per_pallet: carry?.cartons_per_pallet ?? null,+ carton_weight: carry?.carton_weight ?? null,+ carton_package_type_id: carry?.carton_package_type_id ?? null,prices: carry?.prices ?? [],stock_levels: carry?.stock_levels ?? [],}diff --git a/packages/dashboard-starter/src/routeTree.gen.ts b/packages/dashboard-starter/src/routeTree.gen.tsindex fd0aa4a00e..0cfcf180ca 100644--- a/packages/dashboard-starter/src/routeTree.gen.ts+++ b/packages/dashboard-starter/src/routeTree.gen.ts@@ -44,6 +44,7 @@ import { Route as SettingsProductTypesRouteImport } from './../../dashboard/src/import { Route as SettingsPoliciesRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/policies'import { Route as SettingsPayoutsRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/payouts'import { Route as SettingsPaymentMethodsRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/payment-methods'+import { Route as SettingsPackageTypesRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/package-types'import { Route as SettingsMarketsRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/markets'import { Route as SettingsIntegrationsRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/integrations'import { Route as SettingsEmailsRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/emails'@@ -265,6 +266,11 @@ const SettingsPaymentMethodsRoute = SettingsPaymentMethodsRouteImport.update({path: '/payment-methods',getParentRoute: () => SettingsRoute,} as any)+const SettingsPackageTypesRoute = SettingsPackageTypesRouteImport.update({+ id: '/package-types',+ path: '/package-types',+ getParentRoute: () => SettingsRoute,+} as any)const SettingsMarketsRoute = SettingsMarketsRouteImport.update({id: '/markets',path: '/markets',@@ -536,6 +542,7 @@ export interface FileRoutesByFullPath {'/$storeId/settings/emails': typeof SettingsEmailsRoute'/$storeId/settings/integrations': typeof SettingsIntegrationsRoute'/$storeId/settings/markets': typeof SettingsMarketsRoute+ '/$storeId/settings/package-types': typeof SettingsPackageTypesRoute'/$storeId/settings/payment-methods': typeof SettingsPaymentMethodsRoute'/$storeId/settings/payouts': typeof SettingsPayoutsRoute'/$storeId/settings/policies': typeof SettingsPoliciesRoute@@ -614,6 +621,7 @@ export interface FileRoutesByTo {'/$storeId/settings/emails': typeof SettingsEmailsRoute'/$storeId/settings/integrations': typeof SettingsIntegrationsRoute'/$storeId/settings/markets': typeof SettingsMarketsRoute+ '/$storeId/settings/package-types': typeof SettingsPackageTypesRoute'/$storeId/settings/payment-methods': typeof SettingsPaymentMethodsRoute'/$storeId/settings/payouts': typeof SettingsPayoutsRoute'/$storeId/settings/policies': typeof SettingsPoliciesRoute@@ -696,6 +704,7 @@ export interface FileRoutesById {'/_authenticated/$storeId/settings/emails': typeof SettingsEmailsRoute'/_authenticated/$storeId/settings/integrations': typeof SettingsIntegrationsRoute'/_authenticated/$storeId/settings/markets': typeof SettingsMarketsRoute+ '/_authenticated/$storeId/settings/package-types': typeof SettingsPackageTypesRoute'/_authenticated/$storeId/settings/payment-methods': typeof SettingsPaymentMethodsRoute'/_authenticated/$storeId/settings/payouts': typeof SettingsPayoutsRoute'/_authenticated/$storeId/settings/policies': typeof SettingsPoliciesRoute@@ -778,6 +787,7 @@ export interface FileRouteTypes {| '/$storeId/settings/emails'| '/$storeId/settings/integrations'| '/$storeId/settings/markets'+ | '/$storeId/settings/package-types'| '/$storeId/settings/payment-methods'| '/$storeId/settings/payouts'| '/$storeId/settings/policies'@@ -856,6 +866,7 @@ export interface FileRouteTypes {| '/$storeId/settings/emails'| '/$storeId/settings/integrations'| '/$storeId/settings/markets'+ | '/$storeId/settings/package-types'| '/$storeId/settings/payment-methods'| '/$storeId/settings/payouts'| '/$storeId/settings/policies'@@ -937,6 +948,7 @@ export interface FileRouteTypes {| '/_authenticated/$storeId/settings/emails'| '/_authenticated/$storeId/settings/integrations'| '/_authenticated/$storeId/settings/markets'+ | '/_authenticated/$storeId/settings/package-types'| '/_authenticated/$storeId/settings/payment-methods'| '/_authenticated/$storeId/settings/payouts'| '/_authenticated/$storeId/settings/policies'@@ -1235,6 +1247,13 @@ declare module '@tanstack/react-router' {preLoaderRoute: typeof SettingsPaymentMethodsRouteImportparentRoute: typeof SettingsRoute}+ '/_authenticated/$storeId/settings/package-types': {+ id: '/_authenticated/$storeId/settings/package-types'+ path: '/package-types'+ fullPath: '/$storeId/settings/package-types'+ preLoaderRoute: typeof SettingsPackageTypesRouteImport+ parentRoute: typeof SettingsRoute+ }'/_authenticated/$storeId/settings/markets': {id: '/_authenticated/$storeId/settings/markets'path: '/markets'@@ -1555,6 +1574,7 @@ interface SettingsRouteChildren {SettingsEmailsRoute: typeof SettingsEmailsRouteSettingsIntegrationsRoute: typeof SettingsIntegrationsRouteSettingsMarketsRoute: typeof SettingsMarketsRoute+ SettingsPackageTypesRoute: typeof SettingsPackageTypesRouteSettingsPaymentMethodsRoute: typeof SettingsPaymentMethodsRouteSettingsPayoutsRoute: typeof SettingsPayoutsRouteSettingsPoliciesRoute: typeof SettingsPoliciesRoute@@ -1586,6 +1606,7 @@ const SettingsRouteChildren: SettingsRouteChildren = {SettingsEmailsRoute: SettingsEmailsRoute,SettingsIntegrationsRoute: SettingsIntegrationsRoute,SettingsMarketsRoute: SettingsMarketsRoute,+ SettingsPackageTypesRoute: SettingsPackageTypesRoute,SettingsPaymentMethodsRoute: SettingsPaymentMethodsRoute,SettingsPayoutsRoute: SettingsPayoutsRoute,SettingsPoliciesRoute: SettingsPoliciesRoute,diff --git a/packages/dashboard-ui/src/index.ts b/packages/dashboard-ui/src/index.tsindex 56cb1779fa..fe3f0e4d9e 100644--- a/packages/dashboard-ui/src/index.ts+++ b/packages/dashboard-ui/src/index.ts@@ -42,6 +42,7 @@ export * from './spree/drag-handle'export * from './spree/editable-note-card'export * from './spree/file-type-icon'export * from './spree/form-actions'+export * from './spree/form-section'export * from './spree/fulfill-items-form'export * from './spree/fulfillment-edit-dialog'export * from './spree/fulfillment-item-list'diff --git a/packages/dashboard-ui/src/spree/bulk-variants-table.tsx b/packages/dashboard-ui/src/spree/bulk-variants-table.tsxindex c9714e5fc4..87b59e6a32 100644--- a/packages/dashboard-ui/src/spree/bulk-variants-table.tsx+++ b/packages/dashboard-ui/src/spree/bulk-variants-table.tsx@@ -21,6 +21,10 @@ export interface BulkVariantsRow {/** ISO 3166-1 alpha-2 code, never a country record id. */countryOfOrigin?: string | nullcustomsDescription?: string | null+ unitsPerCarton?: string | null+ cartonPackageTypeId?: string | null+ cartonWeight?: string | null+ cartonsPerPallet?: string | null}export type BulkVariantsField =@@ -38,6 +42,10 @@ export type BulkVariantsField =| 'hsCode'| 'countryOfOrigin'| 'customsDescription'+ | 'unitsPerCarton'+ | 'cartonPackageTypeId'+ | 'cartonWeight'+ | 'cartonsPerPallet'export type BulkVariantsChange =| { field: Exclude<BulkVariantsField, 'preorderable'>; value: string | null }@@ -60,6 +68,10 @@ export interface BulkVariantsTableLabels {hsCode: stringcountryOfOrigin: stringcustomsDescription: string+ unitsPerCarton: string+ cartonPackageType: string+ cartonWeight: string+ cartonsPerPallet: string/** Placeholder for a variant row with no options text (e.g. "Default"). */variantDefault: string/** Shown in unit cells with no explicit value ("inherit the default"). */@@ -68,6 +80,8 @@ export interface BulkVariantsTableLabels {taxCategoryNone: string/** Shown in the country-of-origin cell when none is set. */countryOfOriginNone: string+ /** Shown in the carton cell when the variant is packed into none. */+ cartonPackageTypeNone: string/** Aria label on the DataGrid for screen readers. */gridAriaLabel?: string}@@ -80,6 +94,12 @@ export interface BulkVariantsTableProps {dimensionUnitOptions: ReadonlyArray<{ value: string; label: string }>/** Omit to hide the tax-category column (no tax categories configured). */taxCategoryOptions?: ReadonlyArray<{ value: string; label: string }>+ /**+ * The store's cartons. Omit to hide the packing columns entirely. The+ * optional `hint` carries each carton's size, so two similarly named ones+ * are told apart without leaving the sheet.+ */+ cartonOptions?: ReadonlyArray<{ value: string; label: string; hint?: string }>/*** Countries as `{ value: ISO, label: name }`. Omit to hide the customs* columns entirely (e.g. the country list has not loaded yet). Values are@@ -116,13 +136,15 @@ export function BulkVariantsTable({dimensionUnitOptions,taxCategoryOptions,countryOptions,+ cartonOptions,onChange,}: BulkVariantsTableProps) {const columns = useMemo<ColumnDef<BulkVariantsRow>[]>(() => {// Keyboard column coordinates, fixed per column: variant label is// read-only (unregistered), then sku=1, barcode=2, weight=3, unit=4,// height=5, width=6, depth=7, unit=8, preorderable=9, backorder=10,- // tax=11, hs code=12, origin=13, customs description=14.+ // tax=11, hs code=12, origin=13, customs description=14, carton=15,+ // carton weight=16, cartons per pallet=17, units per carton=18.const numericHeader = (label: string) => () => <span className="block text-right">{label}</span>const rowLabel = (r: BulkVariantsRow) => r.variantLabel ?? labels.variantDefault@@ -292,6 +314,69 @@ export function BulkVariantsTable({)}+ // The packing chain travels together: a carton weight or a pallet count+ // means nothing without the carton they describe.+ if (cartonOptions) {+ defs.push(+ {+ id: 'units_per_carton',+ header: numericHeader(labels.unitsPerCarton),+ cell: ({ row }) => (+ <DecimalCell+ coords={{ row: row.index, col: 18 }}+ value={row.original.unitsPerCarton ?? null}+ onChange={(next) =>+ onChange(row.original.id, { field: 'unitsPerCarton', value: next })+ }+ ariaLabel={`${labels.unitsPerCarton} — ${rowLabel(row.original)}`}+ />+ ),+ },+ {+ id: 'carton_package_type',+ header: labels.cartonPackageType,+ cell: ({ row }) => (+ <SelectCell+ coords={{ row: row.index, col: 15 }}+ value={row.original.cartonPackageTypeId ?? null}+ options={cartonOptions}+ nullLabel={labels.cartonPackageTypeNone}+ onChange={(next) =>+ onChange(row.original.id, { field: 'cartonPackageTypeId', value: next })+ }+ ariaLabel={`${labels.cartonPackageType} — ${rowLabel(row.original)}`}+ />+ ),+ },+ {+ id: 'carton_weight',+ header: numericHeader(labels.cartonWeight),+ cell: ({ row }) => (+ <DecimalCell+ coords={{ row: row.index, col: 16 }}+ value={row.original.cartonWeight ?? null}+ onChange={(next) => onChange(row.original.id, { field: 'cartonWeight', value: next })}+ ariaLabel={`${labels.cartonWeight} — ${rowLabel(row.original)}`}+ />+ ),+ },+ {+ id: 'cartons_per_pallet',+ header: numericHeader(labels.cartonsPerPallet),+ cell: ({ row }) => (+ <DecimalCell+ coords={{ row: row.index, col: 17 }}+ value={row.original.cartonsPerPallet ?? null}+ onChange={(next) =>+ onChange(row.original.id, { field: 'cartonsPerPallet', value: next })+ }+ ariaLabel={`${labels.cartonsPerPallet} — ${rowLabel(row.original)}`}+ />+ ),+ },+ )+ }+// Reorder to visual sequence: the coordinate map above is stable, but// the defs array built column groups out of order for concision.const order = [@@ -310,6 +395,10 @@ export function BulkVariantsTable({'hs_code','country_of_origin','customs_description',+ 'units_per_carton',+ 'carton_package_type',+ 'carton_weight',+ 'cartons_per_pallet',]return defs.sort((a, b) => order.indexOf(a.id as string) - order.indexOf(b.id as string))}, [@@ -319,6 +408,7 @@ export function BulkVariantsTable({dimensionUnitOptions,taxCategoryOptions,countryOptions,+ cartonOptions,])return (@@ -327,7 +417,9 @@ export function BulkVariantsTable({rows={rows}columns={columns}getRowId={(row) => row.id}- className={countryOptions ? 'min-w-[1500px]' : 'min-w-[1100px]'}+ className={+ cartonOptions ? 'min-w-[1900px]' : countryOptions ? 'min-w-[1500px]' : 'min-w-[1100px]'+ }aria-label={labels.gridAriaLabel}/></div>diff --git a/packages/dashboard-ui/src/spree/data-grid/cells.tsx b/packages/dashboard-ui/src/spree/data-grid/cells.tsxindex 775ccc2aa1..5c865b7089 100644--- a/packages/dashboard-ui/src/spree/data-grid/cells.tsx+++ b/packages/dashboard-ui/src/spree/data-grid/cells.tsx@@ -491,7 +491,12 @@ interface SelectCellProps<V extends string> extends BaseCellProps {value: V | null/** `null` when the cell is cleared (Delete key, or pasting a blank). */onChange: (next: V | null) => void- options: ReadonlyArray<{ value: V; label: string }>+ /**+ * `label` is what the cell shows and what a pasted value matches against, so+ * it stays the plain name. `hint` is extra detail shown only in the open+ * list — a size, a code — for telling similar options apart.+ */+ options: ReadonlyArray<{ value: V; label: string; hint?: string }>/** Shown when value is null — e.g. "—" for "inherit the default". */nullLabel?: string}@@ -557,7 +562,14 @@ export function SelectCell<V extends string>({<SelectContent>{options.map((opt) => (<SelectItem key={opt.value} value={opt.value}>- {opt.label}+ {opt.hint ? (+ <span className="flex w-full items-baseline justify-between gap-4">+ <span>{opt.label}</span>+ <span className="text-xs text-muted-foreground tabular-nums">{opt.hint}</span>+ </span>+ ) : (+ opt.label+ )}</SelectItem>))}</SelectContent>diff --git a/packages/dashboard-ui/src/spree/form-section.tsx b/packages/dashboard-ui/src/spree/form-section.tsxnew file mode 100644index 0000000000..cec2d22e55--- /dev/null+++ b/packages/dashboard-ui/src/spree/form-section.tsx@@ -0,0 +1,46 @@+import type { ReactNode } from 'react'+import { FieldGroup, FieldLegend, FieldSet } from '../ui/field'++interface FormSectionProps {+ /** Names the group. Rendered as a legend, so it labels the fields inside it+ * rather than merely preceding them. */+ title?: string+ description?: string+ /** Right-aligned beside the title — an "Add" button, a count, a toggle. */+ action?: ReactNode+ children: ReactNode+}++/**+ * A titled group of form fields.+ *+ * Built on FieldSet/FieldLegend rather than a heading beside a div: a heading+ * only precedes the inputs, while a legend is announced as the group they+ * belong to — the difference between "Pickup" read once and every control+ * under it being understood as part of pickup.+ */+export function FormSection({ title, description, action, children }: FormSectionProps) {+ const hasHeading = title || description || action++ return (+ <FieldSet className="gap-3">+ {hasHeading && (+ <div className="flex items-start justify-between gap-2">+ <div className="flex flex-col gap-0.5">+ {title && (+ <FieldLegend variant="label" className="mb-0">+ {title}+ </FieldLegend>+ )}+ {description && <p className="text-muted-foreground text-xs">{description}</p>}+ </div>+ {action}+ </div>+ )}+ {/* The group paints the card that separates one section from the next.+ Sections are siblings, never nested, so no card ever sits inside+ another. */}+ <FieldGroup>{children}</FieldGroup>+ </FieldSet>+ )+}diff --git a/packages/dashboard-ui/src/ui/field.tsx b/packages/dashboard-ui/src/ui/field.tsxindex 521081e530..b4a5821c62 100644--- a/packages/dashboard-ui/src/ui/field.tsx+++ b/packages/dashboard-ui/src/ui/field.tsx@@ -9,7 +9,7 @@ function FieldSet({ className, ...props }: React.ComponentProps<'fieldset'>) {<fieldsetdata-slot="field-set"className={cn(- 'flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3',+ 'flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3 rounded-md p-3 border border-border-subtle shadow-xs bg-card',className,)}{...props}@@ -27,7 +27,7 @@ function FieldLegend({data-slot="field-legend"data-variant={variant}className={cn(- 'mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base',+ 'mb-1.5 font-semibold data-[variant=label]:text-sm data-[variant=legend]:text-base',className,)}{...props}diff --git a/packages/dashboard/src/api-client-setup.ts b/packages/dashboard/src/api-client-setup.tsindex 147390231e..a6b49af921 100644--- a/packages/dashboard/src/api-client-setup.ts+++ b/packages/dashboard/src/api-client-setup.ts@@ -66,6 +66,7 @@ setApiClient({},taxCategories: { list: (params) => adminClient.taxCategories.list(params) },deliveryProfiles: { list: (params) => adminClient.deliveryProfiles.list(params) },+ packageTypes: { list: (params) => adminClient.packageTypes.list(params) },deleteProductMedia: (productId, mediaId) => adminClient.products.media.delete(productId, mediaId),mediaLibrary: { list: (params) => adminClient.media.list(params) },markets: { list: (params) => adminClient.markets.list(params) },diff --git a/packages/dashboard/src/components/spree/orders/fulfillment-edit-dialog.tsx b/packages/dashboard/src/components/spree/orders/fulfillment-edit-dialog.tsxindex da6c74904c..6d19932994 100644--- a/packages/dashboard/src/components/spree/orders/fulfillment-edit-dialog.tsx+++ b/packages/dashboard/src/components/spree/orders/fulfillment-edit-dialog.tsx@@ -52,10 +52,13 @@ export function FulfillmentEditDialog({}).sort((left, right) => Number(right.covered) - Number(left.covered))+ // An unpriced freight rate also costs zero, and calling it "Free" over a+ // container of goods is the one thing this must never say — so the server's+ // own wording wins wherever it has already decided the price is pending.const rateOptions = (fulfillment.delivery_rates ?? []).map((rate) => ({value: rate.id,label: `${rate.name} — ${- Number.parseFloat(rate.cost) === 0+ !rate.unpriced && Number.parseFloat(rate.cost) === 0? t('admin.orders.detail.fulfillments.free'): rate.display_cost}`,diff --git a/packages/dashboard/src/components/spree/orders/fulfillments-card.tsx b/packages/dashboard/src/components/spree/orders/fulfillments-card.tsxindex 4fb0a88b51..2acb4c849b 100644--- a/packages/dashboard/src/components/spree/orders/fulfillments-card.tsx+++ b/packages/dashboard/src/components/spree/orders/fulfillments-card.tsx@@ -540,7 +540,12 @@ function FulfillmentRow({ order, fulfillment }: { order: Order; fulfillment: Ful</DropdownMenu>}>- {(fulfillment.delivery_method || Number.parseFloat(fulfillment.cost) > 0) && (+ {/* A freight fulfillment awaiting a forwarder's quote costs zero until+ it arrives, and hiding the row would hide the very fact that a quote+ is still pending. */}+ {(fulfillment.delivery_method ||+ fulfillment.unpriced ||+ Number.parseFloat(fulfillment.cost) > 0) && (<CardContent className="flex items-center justify-between border-b border-border-subtle py-3 text-sm"><span className="text-muted-foreground">{/* The selected rate names the carrier service that actuallydiff --git a/packages/dashboard/src/components/spree/orders/order-logistics-card.tsx b/packages/dashboard/src/components/spree/orders/order-logistics-card.tsxnew file mode 100644index 0000000000..8aada402f3--- /dev/null+++ b/packages/dashboard/src/components/spree/orders/order-logistics-card.tsx@@ -0,0 +1,80 @@+import type { Order } from '@spree/admin-sdk'+import { Card, CardContent, CardHeader, CardTitle } from '@spree/dashboard-ui'+import { useTranslation } from 'react-i18next'++function Row({ label, value }: { label: string; value: string }) {+ return (+ <div className="flex items-baseline justify-between gap-4 text-sm">+ <span className="text-muted-foreground">{label}</span>+ <span className="font-medium tabular-nums">{value}</span>+ </div>+ )+}++/**+ * What is being shipped, and what is still owed for it.+ *+ * Both halves are read from what the order froze at placement rather than+ * re-derived from the catalog: a carton resized months later must not silently+ * restate the volume a forwarder already quoted against.+ */+export function OrderLogisticsCard({ order }: { order: Order }) {+ const { t } = useTranslation()++ const freight = order.freight_summary++ // Nothing measured is an ordinary retail order, which this card has+ // nothing to say about.+ if (!freight) return null++ return (+ <Card>+ <CardHeader>+ <CardTitle>{t('admin.orders.detail.logistics.title')}</CardTitle>+ </CardHeader>+ <CardContent className="flex flex-col gap-2">+ {freight && (+ <>+ {freight.total_units != null && (+ <Row+ label={t('admin.orders.detail.logistics.units')}+ value={String(freight.total_units)}+ />+ )}+ {freight.total_cartons != null && (+ <Row+ label={t('admin.orders.detail.logistics.cartons')}+ value={String(freight.total_cartons)}+ />+ )}+ {freight.total_pallets != null && (+ <Row+ label={t('admin.orders.detail.logistics.pallets')}+ value={String(freight.total_pallets)}+ />+ )}+ {freight.total_volume != null && (+ <Row+ label={t('admin.orders.detail.logistics.volume')}+ value={t('admin.orders.detail.logistics.cbm', { value: freight.total_volume })}+ />+ )}+ {freight.total_weight != null && (+ <Row+ label={t('admin.orders.detail.logistics.weight')}+ value={t('admin.orders.detail.logistics.kg', { value: freight.total_weight })}+ />+ )}+ {/* Said plainly rather than left to be inferred from the figures:+ an incomplete rollup understates every one of them. */}+ {freight.complete === false && (+ <p className="text-sm text-muted-foreground">+ {t('admin.orders.detail.logistics.incomplete')}+ </p>+ )}+ </>+ )}+ </CardContent>+ </Card>+ )+}diff --git a/packages/dashboard/src/components/spree/shipping/delivery-method-form.tsx b/packages/dashboard/src/components/spree/shipping/delivery-method-form.tsxindex 89bb988b9d..42e20fdec1 100644--- a/packages/dashboard/src/components/spree/shipping/delivery-method-form.tsx+++ b/packages/dashboard/src/components/spree/shipping/delivery-method-form.tsx@@ -30,6 +30,7 @@ import {Field,FieldError,FieldLabel,+ FormSection,Input,InputGroup,InputGroupAddon,@@ -127,35 +128,6 @@ function useSelectedFulfillmentProvider(form: UseFormReturn<DeliveryMethodFormVa* "Providers" above two selects both named "…provider" is a label for a label.* A title is for a block whose fields do not announce themselves.*/-function FormSection({- title,- description,- action,- children,-}: {- title?: string- description?: string- action?: React.ReactNode- children: React.ReactNode-}) {- const heading = title || description || action-- return (- <section className="flex flex-col gap-4 border-t pt-6 first:border-t-0 first:pt-0">- {heading && (- <div className="flex items-start justify-between gap-2">- <div className="flex flex-col gap-0.5">- {title && <h3 className="font-medium text-sm">{title}</h3>}- {description && <p className="text-muted-foreground text-xs">{description}</p>}- </div>- {action}- </div>- )}- {children}- </section>- )-}-/*** Every section of the delivery method form, in the order a merchant answers* them: who fulfills and prices it (which decides what the rest even asks),@@ -703,7 +675,13 @@ function CarrierServicesCard({ form }: { form: UseFormReturn<DeliveryMethodFormVif (rows.length > 0) setScope('selected')}, [rows.length])+ // A provider that names no services has nothing to narrow. Freight is the+ // case: a forwarder booking has no service list, and its tiers are separate+ // delivery methods with volume rules. Offering the picker anyway would let+ // a merchant choose "specific services" with none available, which filters+ // every quote out and silently disables the method.if (!carrierPriced) return null+ if (catalog.length === 0 && !catalogError && rows.length === 0) return nullconst rowIndex = (entry: DeliveryRateProviderCatalogEntry) =>rows.findIndex((row) => row.carrier === entry.carrier && row.service === entry.service)diff --git a/packages/dashboard/src/components/spree/shipping/delivery-method-sheet.tsx b/packages/dashboard/src/components/spree/shipping/delivery-method-sheet.tsxindex edfd0c3b84..77198aacbe 100644--- a/packages/dashboard/src/components/spree/shipping/delivery-method-sheet.tsx+++ b/packages/dashboard/src/components/spree/shipping/delivery-method-sheet.tsx@@ -99,11 +99,19 @@ export function DeliveryMethodSheet({defaultValues: { ...DELIVERY_METHOD_DEFAULTS, delivery_zone_id: zoneId ?? '' },})+ // A new method is seeded once, from values that owe nothing to any query.+ // Running this again when the rule types land would wipe whatever had been+ // set in between — including the provider "Offer pickup" preselects, which+ // is why that button appeared to do nothing whenever the catalog resolved+ // in the other order.useEffect(() => {if (!editing) {form.reset({ ...DELIVERY_METHOD_DEFAULTS, delivery_zone_id: zoneId ?? '' })- return}+ }, [editing, zoneId, form])++ useEffect(() => {+ if (!editing) return// Wait for rule types too — seeding the form before they arrive would// reset again once they land, discarding anything already edited.if (!method || !ruleTypes) return@@ -145,7 +153,7 @@ export function DeliveryMethodSheet({takes_products: takesProducts(ruleTypes?.data, rule.type),})),})- }, [editing, method, ruleTypes, zoneId, form])+ }, [editing, method, ruleTypes, form])// The merchant arrived by asking for a specific kind of fulfillment// ("Offer pickup"), so select the provider that does it as soon as thediff --git a/packages/dashboard/src/hooks/use-package-types.ts b/packages/dashboard/src/hooks/use-package-types.tsnew file mode 100644index 0000000000..10bfd06857--- /dev/null+++ b/packages/dashboard/src/hooks/use-package-types.ts@@ -0,0 +1,54 @@+import type {+ PackageType,+ PackageTypeCreateParams,+ PackageTypeUpdateParams,+} from '@spree/admin-sdk'+import {+ adminClient,+ useResourceKey,+ useResourceKeyBuilder,+ useResourceMutation,+} from '@spree/dashboard-core'+import { useQuery, useQueryClient } from '@tanstack/react-query'+import i18n from 'i18next'++export function usePackageType(id: string | undefined) {+ return useQuery({+ queryKey: useResourceKey('package-types', id ?? 'noop'),+ queryFn: () => adminClient.packageTypes.get(id as string),+ enabled: !!id,+ })+}++export function useCreatePackageType() {+ return useResourceMutation<PackageType, Error, PackageTypeCreateParams>({+ mutationFn: (params) => adminClient.packageTypes.create(params),+ invalidate: [['package-types']],+ successMessage: i18n.t('admin.package_types.messages.added'),+ errorMessage: i18n.t('admin.errors.failed_to_create'),+ })+}++export function useUpdatePackageType(id: string) {+ return useResourceMutation<PackageType, Error, PackageTypeUpdateParams>({+ mutationFn: (params) => adminClient.packageTypes.update(id, params),+ invalidate: [['package-types'], ['package-types', id]],+ successMessage: i18n.t('admin.package_types.messages.updated'),+ errorMessage: i18n.t('admin.errors.failed_to_update'),+ })+}++export function useDeletePackageType() {+ const queryClient = useQueryClient()+ const buildKey = useResourceKeyBuilder()++ return useResourceMutation<void, Error, string>({+ mutationFn: (id) => adminClient.packageTypes.delete(id),+ invalidate: [['package-types']],+ successMessage: i18n.t('admin.package_types.messages.deleted'),+ errorMessage: i18n.t('admin.errors.failed_to_delete'),+ onSuccess: (_data, id) => {+ queryClient.removeQueries({ queryKey: buildKey('package-types', id) })+ },+ })+}diff --git a/packages/dashboard/src/locales/ar.json b/packages/dashboard/src/locales/ar.jsonindex 6db0611368..9f95237af9 100644--- a/packages/dashboard/src/locales/ar.json+++ b/packages/dashboard/src/locales/ar.json@@ -2059,17 +2059,6 @@"label": "لغة لوحة الإدارة","placeholder": "استخدام اللغة الافتراضية"},- "preferred_default_package_dimensions": {- "height": "الارتفاع",- "help": "الصندوق المعتاد للشحن، تستخدمه شركات النقل لتسعير الوزن الحجمي — بوصات للنظام الإمبراطوري وسنتيمترات للمتري. تلزم القيم الثلاث ليصبح ساريًا.",- "label": "أبعاد الطرد الافتراضية",- "length": "الطول",- "width": "العرض"- },- "preferred_default_package_weight": {- "help": "وزن التغليف (الصندوق والحشو) الذي يُضاف إلى محتويات كل طرد عند حساب أسعار التوصيل. اضبطه على 0 للتعطيل.",- "label": "الوزن الافتراضي للطرد"- },"preferred_send_consumer_transactional_emails": {"help": "عند الإيقاف، لا تُرسل رسائل تأكيد الطلب أو الشحن أو الاسترداد.","label": "إرسال رسائل المعاملات للعملاء"@@ -2310,7 +2299,19 @@"units_per_carton": {"label": "الوحدات في الكرتونة"},- "quantity_rule_invalid": "أدخل عددًا صحيحًا أكبر من صفر، أو اترك الحقل فارغًا."+ "quantity_rule_invalid": "أدخل عددًا صحيحًا أكبر من صفر، أو اترك الحقل فارغًا.",+ "carton_package_type_id": {+ "label": "الكرتونة",+ "help": "الكرتونة التي يُعبأ فيها هذا المنتج. مقاساتها تسري على كل ما يُعبأ بالطريقة نفسها."+ },+ "carton_weight": {+ "label": "وزن الكرتونة",+ "help": "وزن الكرتونة الواحدة بعد تعبئتها."+ },+ "cartons_per_pallet": {+ "label": "الكراتين لكل منصة"+ },+ "carton_weight_invalid": "أدخل وزن كرتونة أكبر من صفر، أو اترك الحقل فارغًا."},"webhook_endpoint": {"active": {@@ -2338,6 +2339,45 @@"order_multiple": {"label": "مضاعف الطلب","help": "كل زيادة فوق الحد الأدنى. اتركه فارغًا للسماح بأي كمية."+ },+ "package_type": {+ "name": {+ "label": "الاسم"+ },+ "kind": {+ "label": "النوع",+ "help": "الكرتونة وحدها يمكن أن تكون تغليف المنتج."+ },+ "length": {+ "label": "الطول"+ },+ "width": {+ "label": "العرض"+ },+ "height": {+ "label": "الارتفاع"+ },+ "dimensions_unit": {+ "label": "الوحدة"+ },+ "dimensions": {+ "help": "تُستخدم للوزن الحجمي للناقل وللأمتار المكعبة في فئات الشحن."+ },+ "weight": {+ "label": "الوزن فارغًا",+ "help": "التغليف نفسه، يُضاف إلى محتواه."+ },+ "max_weight": {+ "label": "أقصى وزن",+ "help": "ما يمكنه حمله."+ },+ "weight_unit": {+ "label": "الوحدة"+ },+ "default": {+ "label": "صندوق المتجر الافتراضي",+ "help": "أساس كل تسعيرة طرد. واحد فقط لكل متجر."+ }}},"gift_cards": {@@ -2872,6 +2912,17 @@"label": "متغير البحث","placeholder": "اكتب اسم المنتج أو SKU (3 أحرف على الأقل)…","sku_prefix": "SKU"+ },+ "logistics": {+ "title": "الخدمات اللوجستية",+ "units": "الوحدات",+ "cartons": "الكراتين",+ "pallets": "المنصات",+ "volume": "الحجم",+ "weight": "الوزن الإجمالي",+ "cbm": "{{value}} م³",+ "kg": "{{value}} كجم",+ "incomplete": "بعض الأصناف غير مقاسة، لذا هذه الأرقام حد أدنى وليست إجماليًا."}},"edit": {@@ -3650,11 +3701,9 @@"search_placeholder": "البحث عن مواقع المخزون…"},"store": {- "default_package_description": "الصندوق المعتاد للشحن. يضيف مزوّدو أسعار النقل وزنه إلى كل طرد ويستخدمون أبعاده لتسعير الوزن الحجمي.","subtitle": "التكوين العام والإعدادات الافتراضية على مستوى المتجر.","tab_addresses": "العناوين","tab_catalog": "الكتالوج",- "tab_default_package": "الطرد الافتراضي","tab_general": "عام","tab_inventory": "المخزون","tab_order_numbers": "أرقام الطلبات",@@ -3806,6 +3855,9 @@"payouts": {"title": "المدفوعات","subtitle": "كيف ومتى يدفع هذا السوق لبائعيه."+ },+ "package_types": {+ "add_sheet_title": "إضافة نوع تغليف"}},"staff": {@@ -4007,6 +4059,8 @@"api_key_description": "يوجد في لوحة تحكم EasyPost. مفتاح الاختبار والمفتاح الحي يعملان بشكل مختلف — المفتاح نفسه يحدد الوضع.","base_amount": "Base Amount","base_percent": "Base Percent",+ "company_orders_only": "لطلبات الشركات فقط",+ "company_orders_only_description": "عند التفعيل تُعرض هذه الطريقة على طلبات الشركات فقط، وعند الإيقاف على الطلبات الأخرى فقط. أزل القاعدة لعرضها للاثنين.","currency": "Currency","customs_contents_type": "نوع محتويات البيان الجمركي","customs_contents_type_description": "ما يحتويه الطرد الدولي وفق تصنيف الجمارك.",@@ -4273,7 +4327,11 @@"identity": "هوية","tax_category_placeholder": "ترث من المنتج","ordering": "الطلب للشركات",- "ordering_help": "الكمية التي يجب على المشتري أخذها. لا يزال المخزون يُحسب بالوحدات."+ "ordering_help": "الكمية التي يجب على المشتري أخذها. لا يزال المخزون يُحسب بالوحدات.",+ "packing": "التعبئة",+ "packing_help": "كيف يغادر هذا المنتج المستودع بالجملة. تُبنى عروض أسعار الشحن على هذه الأرقام.",+ "carton_placeholder": "بدون كرتونة",+ "pending_save": "تُحفظ التغييرات هنا مع المنتج."},"title": "المتغيرات","variant_label": "البديل"@@ -4830,7 +4888,8 @@"tax_categories": "فئات الضريبة المخصصة للمنتجات","tax_rates": "النسب المطبقة حسب السوق والمنطقة","webhooks": "نقاط النهاية التي تُخطر عند وقوع الأحداث",- "payouts": "من يدفع لبائعيك، وكم مرة، والحد الأدنى الذي يستحق الإرسال"+ "payouts": "من يدفع لبائعيك، وكم مرة، والحد الأدنى الذي يستحق الإرسال",+ "package_types": "صناديق وكراتين ومنصات وحاويات"},"groups": {"audit": "التدقيق",@@ -4866,7 +4925,8 @@"tax_categories": "فئات الضريبة","tax_rates": "نسب الضريبة","webhooks": "Webhooks",- "payouts": "المدفوعات"+ "payouts": "المدفوعات",+ "package_types": "أنواع التغليف"}},"setup": {@@ -4960,6 +5020,8 @@"local": "العناصر فقط في هذا الموقع"},"search_placeholder": "البحث بالاسم…",+ "section_behavior": "السلوك",+ "section_details": "التفاصيل","section_pickup": "يلتقط","stock_levels": {"empty": "لا توجد مستويات مخزون في هذا الموقع حتى الآن.",@@ -5172,6 +5234,37 @@"saved": "تم حفظ الترجمات","source": "المصدر","title": "الترجمات"+ },+ "package_types": {+ "table_title": "أنواع التغليف",+ "search_placeholder": "ابحث عن تغليف",+ "empty": "لا يوجد تغليف بعد. أضف صندوق الشحن، والكراتين والمنصات التي تغادر بها طلبات الجملة.",+ "add_cta": "إضافة نوع تغليف",+ "default_badge": "افتراضي المتجر",+ "edit_sheet_title": "نوع التغليف",+ "create_description": "صندوق أو كرتونة أو منصة أو حاوية يعبّئ فيها هذا المتجر بضاعته.",+ "edit_description": "المنتجات المعبأة في هذه الكرتونة تتبع مقاساتها، فتعديل واحد يصحّحها جميعًا.",+ "dimensions_column": "الأبعاد",+ "volume_column": "الحجم",+ "kinds": {+ "box": "صندوق",+ "envelope": "ظرف",+ "carton": "كرتونة",+ "pallet": "منصة",+ "container": "حاوية"+ },+ "messages": {+ "added": "تمت إضافة نوع التغليف",+ "updated": "تم تحديث نوع التغليف",+ "deleted": "تم حذف نوع التغليف"+ },+ "delete_confirm": {+ "title": "حذف نوع التغليف؟",+ "message": "سيتم حذف {{name}}. يجب أولًا إعادة تعبئة المنتجات المعبأة فيه."+ },+ "validation": {+ "non_negative": "يجب أن يكون صفرًا أو أكثر"+ }}}}diff --git a/packages/dashboard/src/locales/de.json b/packages/dashboard/src/locales/de.jsonindex 84db8d7c4c..412344ac34 100644--- a/packages/dashboard/src/locales/de.json+++ b/packages/dashboard/src/locales/de.json@@ -2041,17 +2041,6 @@"label": "Admin-Sprache","placeholder": "Standardsprache verwenden"},- "preferred_default_package_dimensions": {- "height": "Höhe",- "help": "Der übliche Versandkarton, von Carrier-Tarifanbietern für Volumengewicht-Preise genutzt — Zoll bei imperial, Zentimeter bei metrisch. Wirksam nur mit allen drei Werten.",- "label": "Standard-Paketabmessungen",- "length": "Länge",- "width": "Breite"- },- "preferred_default_package_weight": {- "help": "Verpackungsgewicht (Karton und Füllmaterial), das bei der Berechnung von Versandtarifen zum Inhalt jedes Pakets addiert wird. 0 deaktiviert es.",- "label": "Standard-Paketgewicht"- },"preferred_send_consumer_transactional_emails": {"help": "Wenn deaktiviert, werden keine Bestellbestätigungen, Versand- oder Erstattungs-E-Mails gesendet.","label": "Transaktionale E-Mails an Kunden senden"@@ -2292,7 +2281,19 @@"units_per_carton": {"label": "Stück pro Karton"},- "quantity_rule_invalid": "Geben Sie eine ganze Zahl größer als null ein oder lassen Sie das Feld leer."+ "quantity_rule_invalid": "Geben Sie eine ganze Zahl größer als null ein oder lassen Sie das Feld leer.",+ "carton_package_type_id": {+ "label": "Karton",+ "help": "Der Karton, in den dieses Produkt verpackt wird. Seine Maße gelten für alles, was gleich verpackt wird."+ },+ "carton_weight": {+ "label": "Kartongewicht",+ "help": "Das Gewicht eines gepackten Kartons."+ },+ "cartons_per_pallet": {+ "label": "Kartons pro Palette"+ },+ "carton_weight_invalid": "Geben Sie ein Kartongewicht größer als null ein oder lassen Sie das Feld leer."},"webhook_endpoint": {"active": {@@ -2320,6 +2321,45 @@"order_multiple": {"label": "Bestellvielfaches","help": "Jeder Schritt über der Mindestmenge. Leer lassen für beliebige Mengen."+ },+ "package_type": {+ "name": {+ "label": "Name"+ },+ "kind": {+ "label": "Art",+ "help": "Nur ein Umkarton kann die Verpackung eines Produkts sein."+ },+ "length": {+ "label": "Länge"+ },+ "width": {+ "label": "Breite"+ },+ "height": {+ "label": "Höhe"+ },+ "dimensions_unit": {+ "label": "Einheit"+ },+ "dimensions": {+ "help": "Für das Volumengewicht des Carriers und die Kubikmeter der Frachtstufen."+ },+ "weight": {+ "label": "Leergewicht",+ "help": "Die Verpackung selbst, zusätzlich zum Inhalt."+ },+ "max_weight": {+ "label": "Max. Gewicht",+ "help": "Was sie tragen kann."+ },+ "weight_unit": {+ "label": "Einheit"+ },+ "default": {+ "label": "Standardkarton des Shops",+ "help": "Grundlage jeder Paketberechnung. Nur einer pro Shop."+ }}},"gift_cards": {@@ -2855,6 +2895,17 @@"label": "Variante suchen","placeholder": "Produktname oder SKU eingeben (min. 3 Zeichen)…","sku_prefix": "SKU"+ },+ "logistics": {+ "title": "Logistik",+ "units": "Einheiten",+ "cartons": "Kartons",+ "pallets": "Paletten",+ "volume": "Volumen",+ "weight": "Bruttogewicht",+ "cbm": "{{value}} m³",+ "kg": "{{value}} kg",+ "incomplete": "Einige Artikel sind nicht vermessen. Diese Werte sind daher ein Mindestwert, keine Gesamtsumme."}},"edit": {@@ -3633,11 +3684,9 @@"search_placeholder": "Lagerstandorte suchen…"},"store": {- "default_package_description": "Der Karton, in dem Sie üblicherweise versenden. Carrier-Tarifanbieter addieren sein Gewicht zu jedem Paket und nutzen seine Abmessungen für Volumengewicht-Preise.","subtitle": "Allgemeine Konfiguration und shopweite Standardwerte.","tab_addresses": "Adressen","tab_catalog": "Katalog",- "tab_default_package": "Standardpaket","tab_general": "Allgemein","tab_inventory": "Lagerbestand","tab_order_numbers": "Bestellnummern",@@ -3789,6 +3838,9 @@"payouts": {"title": "Auszahlungen","subtitle": "Wie und wann dieser Marktplatz seine Verkäufer bezahlt."+ },+ "package_types": {+ "add_sheet_title": "Verpackungsart hinzufügen"}},"staff": {@@ -3990,6 +4042,8 @@"api_key_description": "In Ihrem EasyPost-Dashboard zu finden. Test- und Live-Schlüssel verhalten sich unterschiedlich — der Schlüssel bestimmt den Modus.","base_amount": "Grundbetrag","base_percent": "Grundprozentsatz",+ "company_orders_only": "Nur für Firmenbestellungen",+ "company_orders_only_description": "Aktiviert wird diese Methode nur für Bestellungen auf ein Unternehmen angeboten, deaktiviert nur für die übrigen. Ohne diese Regel gilt sie für beide.","currency": "Währung","customs_contents_type": "Zollinhaltsart","customs_contents_type_description": "Was eine internationale Sendung enthält, wie der Zoll es einstuft.",@@ -4251,7 +4305,11 @@"identity": "Identität","tax_category_placeholder": "Vom Produkt übernehmen","ordering": "B2B-Bestellung",- "ordering_help": "Wie viel ein Käufer abnehmen muss. Der Bestand wird weiterhin in Stück gezählt."+ "ordering_help": "Wie viel ein Käufer abnehmen muss. Der Bestand wird weiterhin in Stück gezählt.",+ "packing": "Verpackung",+ "packing_help": "Wie dieses Produkt als Großmenge das Lager verlässt. Frachtangebote beruhen auf diesen Zahlen.",+ "carton_placeholder": "Kein Karton",+ "pending_save": "Änderungen hier werden mit dem Produkt gespeichert."},"title": "Varianten","variant_label": "Variante"@@ -4808,7 +4866,8 @@"tax_categories": "Steuerklassen für Produkte","tax_rates": "Sätze pro Markt und Region","webhooks": "Endpunkte, die bei Ereignissen benachrichtigt werden",- "payouts": "Wer Ihre Verkäufer bezahlt, wie oft und ab welchem Betrag"+ "payouts": "Wer Ihre Verkäufer bezahlt, wie oft und ab welchem Betrag",+ "package_types": "Kartons, Paletten und Container"},"groups": {"audit": "Audit",@@ -4844,7 +4903,8 @@"tax_categories": "Steuerkategorien","tax_rates": "Steuersätze","webhooks": "Webhooks",- "payouts": "Auszahlungen"+ "payouts": "Auszahlungen",+ "package_types": "Verpackungsarten"}},"setup": {@@ -4938,6 +4998,8 @@"local": "Nur Artikel an diesem Standort"},"search_placeholder": "Nach Name suchen…",+ "section_behavior": "Verhalten",+ "section_details": "Details","section_pickup": "Abholung","stock_levels": {"empty": "An diesem Standort sind noch keine Lagerbestände vorhanden.",@@ -5150,6 +5212,37 @@"saved": "Übersetzungen gespeichert","source": "Quelle","title": "Übersetzungen"+ },+ "package_types": {+ "table_title": "Verpackungsarten",+ "search_placeholder": "Verpackung suchen",+ "empty": "Noch keine Verpackung. Legen Sie Ihren Versandkarton an sowie die Kartons und Paletten für Großbestellungen.",+ "add_cta": "Verpackungsart hinzufügen",+ "default_badge": "Standard des Shops",+ "edit_sheet_title": "Verpackungsart",+ "create_description": "Ein Karton, eine Palette oder ein Container, in den dieser Shop Ware packt.",+ "edit_description": "Produkte in diesem Karton übernehmen seine Maße — eine Änderung korrigiert alle.",+ "dimensions_column": "Maße",+ "volume_column": "Volumen",+ "kinds": {+ "box": "Karton",+ "envelope": "Umschlag",+ "carton": "Umkarton",+ "pallet": "Palette",+ "container": "Container"+ },+ "messages": {+ "added": "Verpackungsart hinzugefügt",+ "updated": "Verpackungsart aktualisiert",+ "deleted": "Verpackungsart gelöscht"+ },+ "delete_confirm": {+ "title": "Verpackungsart löschen?",+ "message": "{{name}} wird entfernt. Darin verpackte Produkte müssen zuerst umgepackt werden."+ },+ "validation": {+ "non_negative": "muss null oder größer sein"+ }}}}diff --git a/packages/dashboard/src/locales/en.json b/packages/dashboard/src/locales/en.jsonindex ef6e5e9ad4..896b8cc0db 100644--- a/packages/dashboard/src/locales/en.json+++ b/packages/dashboard/src/locales/en.json@@ -2041,17 +2041,6 @@"label": "Admin language","placeholder": "Use the default language"},- "preferred_default_package_dimensions": {- "height": "Height",- "help": "The box you usually ship in, used by carrier rate providers for dimensional-weight pricing — inches for imperial, centimeters for metric. All three are needed to take effect.",- "label": "Default package dimensions",- "length": "Length",- "width": "Width"- },- "preferred_default_package_weight": {- "help": "Packaging weight (box and filler) added to every package's contents when calculating delivery rates. Set to 0 to disable.",- "label": "Default package weight"- },"preferred_send_consumer_transactional_emails": {"help": "When off, no order confirmation, shipping, or refund emails are sent.","label": "Send transactional emails to customers"@@ -2292,7 +2281,19 @@"units_per_carton": {"label": "Units per carton"},- "quantity_rule_invalid": "Enter a whole number greater than zero, or leave blank."+ "quantity_rule_invalid": "Enter a whole number greater than zero, or leave blank.",+ "carton_package_type_id": {+ "label": "Carton",+ "help": "The carton this product is packed into. Its size is shared by everything packed the same way."+ },+ "carton_weight": {+ "label": "Carton weight",+ "help": "What one packed carton weighs."+ },+ "cartons_per_pallet": {+ "label": "Cartons per pallet"+ },+ "carton_weight_invalid": "Enter a carton weight greater than zero, or leave it blank."},"webhook_endpoint": {"active": {@@ -2320,6 +2321,45 @@"order_multiple": {"label": "Order multiple","help": "Each step up from the minimum. Leave blank for any quantity."+ },+ "package_type": {+ "name": {+ "label": "Name"+ },+ "kind": {+ "label": "Kind",+ "help": "Only a carton can be the packaging a product is packed into."+ },+ "length": {+ "label": "Length"+ },+ "width": {+ "label": "Width"+ },+ "height": {+ "label": "Height"+ },+ "dimensions_unit": {+ "label": "Unit"+ },+ "dimensions": {+ "help": "Used for carrier dimensional weight, and for the cubic meters freight tiers compare."+ },+ "weight": {+ "label": "Empty weight",+ "help": "The packaging itself, added to what it holds."+ },+ "max_weight": {+ "label": "Max weight",+ "help": "What it can carry."+ },+ "weight_unit": {+ "label": "Unit"+ },+ "default": {+ "label": "Store default box",+ "help": "The packaging every parcel quote is built on. Only one per store."+ }}},"gift_cards": {@@ -2855,6 +2895,17 @@"label": "Search variant","placeholder": "Type product name or SKU (min 3 chars)…","sku_prefix": "SKU"+ },+ "logistics": {+ "title": "Logistics",+ "units": "Units",+ "cartons": "Cartons",+ "pallets": "Pallets",+ "volume": "Volume",+ "weight": "Gross weight",+ "cbm": "{{value}} CBM",+ "kg": "{{value}} kg",+ "incomplete": "Some items are not measured, so these figures are a floor rather than a total."}},"edit": {@@ -3633,11 +3684,9 @@"search_placeholder": "Search stock locations…"},"store": {- "default_package_description": "The box you usually ship in. Carrier rate providers add its weight to every package and use its dimensions for dimensional-weight pricing.","subtitle": "General configuration and store-wide defaults.","tab_addresses": "Addresses","tab_catalog": "Catalog",- "tab_default_package": "Default package","tab_general": "General","tab_inventory": "Inventory","tab_order_numbers": "Order numbers",@@ -3789,6 +3838,9 @@"payouts": {"title": "Payouts","subtitle": "How and when this marketplace pays its sellers."+ },+ "package_types": {+ "add_sheet_title": "Add package type"}},"staff": {@@ -3990,6 +4042,8 @@"api_key_description": "Found in your EasyPost dashboard. A test key and a live key behave differently — the key itself decides the mode.","base_amount": "Base Amount","base_percent": "Base Percent",+ "company_orders_only": "Only for company orders",+ "company_orders_only_description": "On, this method is offered only to orders placed for a company. Off, only to orders that are not. Remove the rule to offer it to both.","currency": "Currency","customs_contents_type": "Customs contents type","customs_contents_type_description": "What an international parcel holds, as customs classifies it.",@@ -4251,7 +4305,11 @@"identity": "Identity","tax_category_placeholder": "Inherit from product","ordering": "B2B ordering",- "ordering_help": "How much a buyer must take. Stock is still counted in units."+ "ordering_help": "How much a buyer must take. Stock is still counted in units.",+ "packing": "Packing",+ "packing_help": "How this product leaves the warehouse in bulk. Freight quotes are built from these numbers.",+ "carton_placeholder": "No carton",+ "pending_save": "Changes here are saved with the product."},"title": "Variants","variant_label": "Variant"@@ -4808,7 +4866,8 @@"tax_categories": "Tax classes assigned to products","tax_rates": "Rates applied per market and region","webhooks": "Endpoints notified when events happen",- "payouts": "Who pays your sellers, how often, and the minimum worth sending"+ "payouts": "Who pays your sellers, how often, and the minimum worth sending",+ "package_types": "Boxes, cartons, pallets and containers"},"groups": {"audit": "Audit",@@ -4844,7 +4903,8 @@"tax_categories": "Tax categories","tax_rates": "Tax rates","webhooks": "Webhooks",- "payouts": "Payouts"+ "payouts": "Payouts",+ "package_types": "Package types"}},"setup": {@@ -4938,6 +4998,8 @@"local": "Only items at this location"},"search_placeholder": "Search by name…",+ "section_behavior": "Behavior",+ "section_details": "Details","section_pickup": "Pickup","stock_levels": {"empty": "No stock levels at this location yet.",@@ -5150,6 +5212,37 @@"saved": "Translations saved","source": "Source","title": "Translations"+ },+ "package_types": {+ "table_title": "Package types",+ "search_placeholder": "Search packaging",+ "empty": "No packaging yet. Add the box you ship in, and the cartons and pallets wholesale orders leave on.",+ "add_cta": "Add package type",+ "default_badge": "Store default",+ "edit_sheet_title": "Package type",+ "create_description": "A box, carton, pallet or container this store packs goods into.",+ "edit_description": "Products packed into this carton follow its measurements, so one edit corrects them all.",+ "dimensions_column": "Dimensions",+ "volume_column": "Volume",+ "kinds": {+ "box": "Box",+ "envelope": "Envelope",+ "carton": "Carton",+ "pallet": "Pallet",+ "container": "Container"+ },+ "messages": {+ "added": "Package type added",+ "updated": "Package type updated",+ "deleted": "Package type deleted"+ },+ "delete_confirm": {+ "title": "Delete package type?",+ "message": "{{name}} will be removed. Products packed into it must be repacked first."+ },+ "validation": {+ "non_negative": "must be zero or more"+ }}}}diff --git a/packages/dashboard/src/locales/fr.json b/packages/dashboard/src/locales/fr.jsonindex fc78bd8214..5d0433b2a4 100644--- a/packages/dashboard/src/locales/fr.json+++ b/packages/dashboard/src/locales/fr.json@@ -2041,17 +2041,6 @@"label": "Langue de l'administration","placeholder": "Utiliser la langue par défaut"},- "preferred_default_package_dimensions": {- "height": "Hauteur",- "help": "Le carton habituel d'expédition, utilisé par les transporteurs pour le poids volumétrique — pouces en impérial, centimètres en métrique. Les trois valeurs sont requises.",- "label": "Dimensions de colis par défaut",- "length": "Longueur",- "width": "Largeur"- },- "preferred_default_package_weight": {- "help": "Poids d'emballage (carton et calage) ajouté au contenu de chaque colis lors du calcul des tarifs de livraison. 0 pour désactiver.",- "label": "Poids de colis par défaut"- },"preferred_send_consumer_transactional_emails": {"help": "Si désactivé, aucun e-mail de confirmation de commande, d'expédition ou de remboursement n'est envoyé.","label": "Envoyer les e-mails transactionnels aux clients"@@ -2292,7 +2281,19 @@"units_per_carton": {"label": "Unités par carton"},- "quantity_rule_invalid": "Saisissez un nombre entier supérieur à zéro, ou laissez vide."+ "quantity_rule_invalid": "Saisissez un nombre entier supérieur à zéro, ou laissez vide.",+ "carton_package_type_id": {+ "label": "Carton",+ "help": "Le carton dans lequel ce produit est emballé. Ses dimensions valent pour tout ce qui est emballé de la même façon."+ },+ "carton_weight": {+ "label": "Poids du carton",+ "help": "Le poids d’un carton rempli."+ },+ "cartons_per_pallet": {+ "label": "Cartons par palette"+ },+ "carton_weight_invalid": "Saisissez un poids de carton supérieur à zéro, ou laissez le champ vide."},"webhook_endpoint": {"active": {@@ -2320,6 +2321,45 @@"order_multiple": {"label": "Multiple de commande","help": "Chaque palier au-dessus du minimum. Laisser vide pour toute quantité."+ },+ "package_type": {+ "name": {+ "label": "Nom"+ },+ "kind": {+ "label": "Type",+ "help": "Seul un carton maître peut être l'emballage d'un produit."+ },+ "length": {+ "label": "Longueur"+ },+ "width": {+ "label": "Largeur"+ },+ "height": {+ "label": "Hauteur"+ },+ "dimensions_unit": {+ "label": "Unité"+ },+ "dimensions": {+ "help": "Utilisées pour le poids volumétrique et pour les mètres cubes des paliers de fret."+ },+ "weight": {+ "label": "Poids à vide",+ "help": "L'emballage lui-même, ajouté à son contenu."+ },+ "max_weight": {+ "label": "Poids max.",+ "help": "Ce qu'il peut porter."+ },+ "weight_unit": {+ "label": "Unité"+ },+ "default": {+ "label": "Carton par défaut",+ "help": "La base de chaque cotation colis. Un seul par boutique."+ }}},"gift_cards": {@@ -2855,6 +2895,17 @@"label": "Rechercher une variante","placeholder": "Saisissez le nom du produit ou le SKU (3 caractères min.)…","sku_prefix": "SKU"+ },+ "logistics": {+ "title": "Logistique",+ "units": "Unités",+ "cartons": "Cartons",+ "pallets": "Palettes",+ "volume": "Volume",+ "weight": "Poids brut",+ "cbm": "{{value}} m³",+ "kg": "{{value}} kg",+ "incomplete": "Certains articles ne sont pas mesurés : ces chiffres sont un minimum, pas un total."}},"edit": {@@ -3633,11 +3684,9 @@"search_placeholder": "Rechercher des emplacements de stock…"},"store": {- "default_package_description": "Le carton habituel d'expédition. Les transporteurs ajoutent son poids à chaque colis et utilisent ses dimensions pour le poids volumétrique.","subtitle": "Configuration générale et valeurs par défaut à l'échelle de la boutique.","tab_addresses": "Adresses","tab_catalog": "Catalogue",- "tab_default_package": "Colis par défaut","tab_general": "Général","tab_inventory": "Stock","tab_order_numbers": "Numéros de commande",@@ -3789,6 +3838,9 @@"payouts": {"title": "Paiements","subtitle": "Comment et quand cette marketplace paie ses vendeurs."+ },+ "package_types": {+ "add_sheet_title": "Ajouter un type d'emballage"}},"staff": {@@ -3990,6 +4042,8 @@"api_key_description": "Disponible dans votre tableau de bord EasyPost. Une clé de test et une clé live se comportent différemment — la clé détermine le mode.","base_amount": "Montant de base","base_percent": "Pourcentage de base",+ "company_orders_only": "Réservée aux commandes d'entreprise",+ "company_orders_only_description": "Activée, cette méthode n'est proposée qu'aux commandes passées pour une entreprise ; désactivée, uniquement aux autres. Sans cette règle, elle s'applique aux deux.","currency": "Devise","customs_contents_type": "Type de contenu douanier","customs_contents_type_description": "Ce que contient un colis international, selon la classification douanière.",@@ -4251,7 +4305,11 @@"identity": "Identité","tax_category_placeholder": "Hériter du produit","ordering": "Commande B2B",- "ordering_help": "Combien un acheteur doit prendre. Le stock reste compté en unités."+ "ordering_help": "Combien un acheteur doit prendre. Le stock reste compté en unités.",+ "packing": "Emballage",+ "packing_help": "Comment ce produit quitte l’entrepôt en gros. Les devis de fret reposent sur ces chiffres.",+ "carton_placeholder": "Aucun carton",+ "pending_save": "Les modifications sont enregistrées avec le produit."},"title": "Variantes","variant_label": "Variante"@@ -4808,7 +4866,8 @@"tax_categories": "Classes de taxe attribuées aux produits","tax_rates": "Taux appliqués par marché et région","webhooks": "Points de terminaison notifiés lors d'événements",- "payouts": "Qui paie vos vendeurs, à quelle fréquence et à partir de quel montant"+ "payouts": "Qui paie vos vendeurs, à quelle fréquence et à partir de quel montant",+ "package_types": "Cartons, palettes et conteneurs"},"groups": {"audit": "Audit",@@ -4844,7 +4903,8 @@"tax_categories": "Catégories de taxe","tax_rates": "Taux de taxe","webhooks": "Webhooks",- "payouts": "Paiements"+ "payouts": "Paiements",+ "package_types": "Types d'emballage"}},"setup": {@@ -4938,6 +4998,8 @@"local": "Uniquement les articles à cet emplacement"},"search_placeholder": "Rechercher par nom…",+ "section_behavior": "Comportement",+ "section_details": "Détails","section_pickup": "Retrait","stock_levels": {"empty": "Aucun niveau de stock à cet emplacement pour le moment.",@@ -5150,6 +5212,37 @@"saved": "Traductions enregistrées","source": "Source","title": "Traductions"+ },+ "package_types": {+ "table_title": "Types d'emballage",+ "search_placeholder": "Rechercher un emballage",+ "empty": "Aucun emballage. Ajoutez votre carton d'expédition, ainsi que les cartons et palettes des commandes en gros.",+ "add_cta": "Ajouter un type d'emballage",+ "default_badge": "Par défaut",+ "edit_sheet_title": "Type d'emballage",+ "create_description": "Un carton, une palette ou un conteneur dans lequel cette boutique emballe ses produits.",+ "edit_description": "Les produits emballés dans ce carton suivent ses dimensions : une modification les corrige tous.",+ "dimensions_column": "Dimensions",+ "volume_column": "Volume",+ "kinds": {+ "box": "Carton",+ "envelope": "Enveloppe",+ "carton": "Carton maître",+ "pallet": "Palette",+ "container": "Conteneur"+ },+ "messages": {+ "added": "Type d'emballage ajouté",+ "updated": "Type d'emballage mis à jour",+ "deleted": "Type d'emballage supprimé"+ },+ "delete_confirm": {+ "title": "Supprimer ce type d'emballage ?",+ "message": "{{name}} sera supprimé. Les produits qui y sont emballés doivent d'abord être reconditionnés."+ },+ "validation": {+ "non_negative": "doit être supérieur ou égal à zéro"+ }}}}diff --git a/packages/dashboard/src/locales/pl.json b/packages/dashboard/src/locales/pl.jsonindex 446146b4a7..630796ea63 100644--- a/packages/dashboard/src/locales/pl.json+++ b/packages/dashboard/src/locales/pl.json@@ -2059,17 +2059,6 @@"label": "Język panelu administracyjnego","placeholder": "Użyj języka domyślnego"},- "preferred_default_package_dimensions": {- "height": "Wysokość",- "help": "Karton, w którym zwykle wysyłasz, używany przez przewoźników do wyceny wagi wymiarowej — cale dla systemu imperialnego, centymetry dla metrycznego. Działa dopiero po podaniu wszystkich trzech.",- "label": "Domyślne wymiary paczki",- "length": "Długość",- "width": "Szerokość"- },- "preferred_default_package_weight": {- "help": "Waga opakowania (karton i wypełnienie) dodawana do zawartości każdej paczki przy wyliczaniu stawek dostawy. 0 wyłącza.",- "label": "Domyślna waga paczki"- },"preferred_send_consumer_transactional_emails": {"help": "Gdy wyłączone, nie są wysyłane żadne wiadomości z potwierdzeniem zamówienia, wysyłki ani zwrotu.","label": "Wysyłaj wiadomości transakcyjne do klientów"@@ -2310,7 +2299,19 @@"units_per_carton": {"label": "Sztuk w kartonie"},- "quantity_rule_invalid": "Podaj liczbę całkowitą większą od zera lub pozostaw pole puste."+ "quantity_rule_invalid": "Podaj liczbę całkowitą większą od zera lub pozostaw pole puste.",+ "carton_package_type_id": {+ "label": "Karton",+ "help": "Karton, w który pakowany jest ten produkt. Jego wymiary dotyczą wszystkiego pakowanego tak samo."+ },+ "carton_weight": {+ "label": "Waga kartonu",+ "help": "Waga jednego zapakowanego kartonu."+ },+ "cartons_per_pallet": {+ "label": "Kartonów na palecie"+ },+ "carton_weight_invalid": "Podaj wagę kartonu większą od zera albo zostaw pole puste."},"webhook_endpoint": {"active": {@@ -2338,6 +2339,45 @@"order_multiple": {"label": "Wielokrotność zamówienia","help": "Każdy kolejny krok powyżej minimum. Pozostaw puste, aby dopuścić dowolną ilość."+ },+ "package_type": {+ "name": {+ "label": "Nazwa"+ },+ "kind": {+ "label": "Rodzaj",+ "help": "Tylko karton zbiorczy może być opakowaniem produktu."+ },+ "length": {+ "label": "Długość"+ },+ "width": {+ "label": "Szerokość"+ },+ "height": {+ "label": "Wysokość"+ },+ "dimensions_unit": {+ "label": "Jednostka"+ },+ "dimensions": {+ "help": "Do wagi objętościowej przewoźnika i metrów sześciennych progów frachtowych."+ },+ "weight": {+ "label": "Waga pustego",+ "help": "Samo opakowanie, doliczane do zawartości."+ },+ "max_weight": {+ "label": "Maks. waga",+ "help": "Ile może unieść."+ },+ "weight_unit": {+ "label": "Jednostka"+ },+ "default": {+ "label": "Domyślny karton sklepu",+ "help": "Podstawa każdej wyceny paczki. Tylko jeden na sklep."+ }}},"gift_cards": {@@ -2881,6 +2921,17 @@"label": "Wyszukaj wariant","placeholder": "Wpisz nazwę produktu lub SKU (min. 3 znaki)…","sku_prefix": "SKU"+ },+ "logistics": {+ "title": "Logistyka",+ "units": "Sztuki",+ "cartons": "Kartony",+ "pallets": "Palety",+ "volume": "Objętość",+ "weight": "Waga brutto",+ "cbm": "{{value}} m³",+ "kg": "{{value}} kg",+ "incomplete": "Część towaru nie ma wymiarów, więc te liczby to wartość minimalna, a nie suma."}},"edit": {@@ -3675,11 +3726,9 @@"search_placeholder": "Szukaj lokalizacji magazynowych…"},"store": {- "default_package_description": "Karton, w którym zwykle wysyłasz. Dostawcy stawek przewoźników dodają jego wagę do każdej paczki i używają wymiarów do wyceny wagi wymiarowej.","subtitle": "Ogólna konfiguracja i domyślne ustawienia dla całego sklepu.","tab_addresses": "Adresy","tab_catalog": "Katalog",- "tab_default_package": "Domyślna paczka","tab_general": "Ogólne","tab_inventory": "Stan magazynowy","tab_order_numbers": "Numery zamówień",@@ -3837,6 +3886,9 @@"payouts": {"title": "Wypłaty","subtitle": "Jak i kiedy ten marketplace płaci swoim sprzedawcom."+ },+ "package_types": {+ "add_sheet_title": "Dodaj rodzaj opakowania"}},"staff": {@@ -4038,6 +4090,8 @@"api_key_description": "Znajdziesz go w panelu EasyPost. Klucz testowy i produkcyjny działają inaczej — to klucz decyduje o trybie.","base_amount": "Kwota podstawowa","base_percent": "Procent podstawowy",+ "company_orders_only": "Tylko dla zamówień firmowych",+ "company_orders_only_description": "Włączone — ta metoda jest oferowana wyłącznie zamówieniom składanym na firmę; wyłączone — tylko pozostałym. Bez tej reguły obowiązuje dla obu.","currency": "Waluta","customs_contents_type": "Rodzaj zawartości celnej","customs_contents_type_description": "Co zawiera przesyłka międzynarodowa według klasyfikacji celnej.",@@ -4309,7 +4363,11 @@"identity": "Tożsamość","tax_category_placeholder": "Dziedzicz z produktu","ordering": "Zamówienia B2B",- "ordering_help": "Ile kupujący musi wziąć. Stan magazynowy nadal liczony jest w sztukach."+ "ordering_help": "Ile kupujący musi wziąć. Stan magazynowy nadal liczony jest w sztukach.",+ "packing": "Pakowanie",+ "packing_help": "Jak ten produkt opuszcza magazyn hurtowo. Na tych liczbach opierają się wyceny frachtu.",+ "carton_placeholder": "Brak kartonu",+ "pending_save": "Zmiany zapisują się razem z produktem."},"title": "Warianty","variant_label": "Wariant"@@ -4866,7 +4924,8 @@"tax_categories": "Klasy podatkowe przypisane do produktów","tax_rates": "Stawki stosowane według rynku i regionu","webhooks": "Adresy powiadamiane o zdarzeniach",- "payouts": "Kto płaci Twoim sprzedawcom, jak często i od jakiej kwoty"+ "payouts": "Kto płaci Twoim sprzedawcom, jak często i od jakiej kwoty",+ "package_types": "Kartony, palety i kontenery"},"groups": {"audit": "Audyt",@@ -4902,7 +4961,8 @@"tax_categories": "Kategorie podatkowe","tax_rates": "Stawki podatku","webhooks": "Webhooki",- "payouts": "Wypłaty"+ "payouts": "Wypłaty",+ "package_types": "Rodzaje opakowań"}},"setup": {@@ -4996,6 +5056,8 @@"local": "Tylko produkty w tej lokalizacji"},"search_placeholder": "Szukaj według nazwy…",+ "section_behavior": "Zachowanie",+ "section_details": "Szczegóły","section_pickup": "Odbiór","stock_levels": {"empty": "Brak stanów magazynowych w tej lokalizacji.",@@ -5208,6 +5270,37 @@"saved": "Tłumaczenia zapisane","source": "Źródło","title": "Tłumaczenia"+ },+ "package_types": {+ "table_title": "Rodzaje opakowań",+ "search_placeholder": "Szukaj opakowania",+ "empty": "Brak opakowań. Dodaj karton wysyłkowy oraz kartony i palety dla zamówień hurtowych.",+ "add_cta": "Dodaj rodzaj opakowania",+ "default_badge": "Domyślne sklepu",+ "edit_sheet_title": "Rodzaj opakowania",+ "create_description": "Karton, paleta lub kontener, w który ten sklep pakuje towar.",+ "edit_description": "Produkty pakowane w ten karton przyjmują jego wymiary — jedna zmiana poprawia wszystkie.",+ "dimensions_column": "Wymiary",+ "volume_column": "Objętość",+ "kinds": {+ "box": "Karton",+ "envelope": "Koperta",+ "carton": "Karton zbiorczy",+ "pallet": "Paleta",+ "container": "Kontener"+ },+ "messages": {+ "added": "Dodano rodzaj opakowania",+ "updated": "Zaktualizowano rodzaj opakowania",+ "deleted": "Usunięto rodzaj opakowania"+ },+ "delete_confirm": {+ "title": "Usunąć rodzaj opakowania?",+ "message": "{{name}} zostanie usunięty. Produkty w nim zapakowane trzeba najpierw przepakować."+ },+ "validation": {+ "non_negative": "musi wynosić zero lub więcej"+ }}}}diff --git a/packages/dashboard/src/locales/zh-CN.json b/packages/dashboard/src/locales/zh-CN.jsonindex 29ffb92009..54cf0cfc66 100644--- a/packages/dashboard/src/locales/zh-CN.json+++ b/packages/dashboard/src/locales/zh-CN.json@@ -2036,17 +2036,6 @@"label": "后台语言","placeholder": "使用默认语言"},- "preferred_default_package_dimensions": {- "height": "高",- "help": "常用的发货纸箱尺寸,承运商费率提供方据此计算体积重量——英制为英寸,公制为厘米。三项都填写后才生效。",- "label": "默认包裹尺寸",- "length": "长",- "width": "宽"- },- "preferred_default_package_weight": {- "help": "计算配送费率时加到每个包裹内容上的包装重量(纸箱与填充物)。设为 0 可停用。",- "label": "默认包裹重量"- },"preferred_send_consumer_transactional_emails": {"help": "关闭后,将不会发送订单确认、发货或退款邮件。","label": "向客户发送交易类邮件"@@ -2287,7 +2276,19 @@"units_per_carton": {"label": "每箱件数"},- "quantity_rule_invalid": "请输入大于零的整数,或留空。"+ "quantity_rule_invalid": "请输入大于零的整数,或留空。",+ "carton_package_type_id": {+ "label": "纸箱",+ "help": "此商品所装的纸箱。同样装法的商品共用它的尺寸。"+ },+ "carton_weight": {+ "label": "整箱重量",+ "help": "装满一箱后的重量。"+ },+ "cartons_per_pallet": {+ "label": "每托盘箱数"+ },+ "carton_weight_invalid": "请输入大于零的整箱重量,或留空。"},"webhook_endpoint": {"active": {@@ -2315,6 +2316,45 @@"order_multiple": {"label": "订购倍数","help": "在最小起订量之上的每一档增量。留空表示不限数量。"+ },+ "package_type": {+ "name": {+ "label": "名称"+ },+ "kind": {+ "label": "类型",+ "help": "只有外箱可以作为商品的包装。"+ },+ "length": {+ "label": "长"+ },+ "width": {+ "label": "宽"+ },+ "height": {+ "label": "高"+ },+ "dimensions_unit": {+ "label": "单位"+ },+ "dimensions": {+ "help": "用于承运商的体积重量,以及运费档位比较的立方米。"+ },+ "weight": {+ "label": "空重",+ "help": "包装本身的重量,计入所装货物之外。"+ },+ "max_weight": {+ "label": "最大承重",+ "help": "可承载的重量。"+ },+ "weight_unit": {+ "label": "单位"+ },+ "default": {+ "label": "店铺默认纸箱",+ "help": "所有包裹报价的基础。每个店铺仅一个。"+ }}},"gift_cards": {@@ -2847,6 +2887,17 @@"label": "搜索变体","placeholder": "输入商品名称或 SKU(至少 3 个字符)…","sku_prefix": "SKU"+ },+ "logistics": {+ "title": "物流",+ "units": "件数",+ "cartons": "箱数",+ "pallets": "托盘数",+ "volume": "体积",+ "weight": "毛重",+ "cbm": "{{value}} 立方米",+ "kg": "{{value}} 公斤",+ "incomplete": "部分商品未量尺寸,因此以上数字是下限而非总量。"}},"edit": {@@ -3625,11 +3676,9 @@"search_placeholder": "搜索库存位置…"},"store": {- "default_package_description": "常用的发货纸箱。承运商费率提供方会将其重量加到每个包裹上,并使用其尺寸计算体积重量。","subtitle": "通用配置与店铺级默认设置。","tab_addresses": "地址","tab_catalog": "商品目录",- "tab_default_package": "默认包裹","tab_general": "通用","tab_inventory": "库存","tab_order_numbers": "订单编号",@@ -3781,6 +3830,9 @@"payouts": {"title": "付款","subtitle": "本平台如何以及何时向卖家付款。"+ },+ "package_types": {+ "add_sheet_title": "添加包装类型"}},"staff": {@@ -3982,6 +4034,8 @@"api_key_description": "在您的 EasyPost 控制台中获取。测试密钥与正式密钥行为不同——密钥本身决定模式。","base_amount": "基础金额","base_percent": "基础百分比",+ "company_orders_only": "仅限公司订单",+ "company_orders_only_description": "开启后,此配送方式仅提供给以公司名义下的订单;关闭后仅提供给其他订单。移除此规则则两者都可使用。","currency": "货币","customs_contents_type": "报关内容类型","customs_contents_type_description": "按海关分类,国际包裹所含物品的类型。",@@ -4242,7 +4296,11 @@"identity": "标识","tax_category_placeholder": "继承自商品","ordering": "B2B 订购",- "ordering_help": "买家必须订购的数量。库存仍以件计算。"+ "ordering_help": "买家必须订购的数量。库存仍以件计算。",+ "packing": "装箱",+ "packing_help": "此商品成批出库的方式。货运报价依据这些数字计算。",+ "carton_placeholder": "未装箱",+ "pending_save": "此处的更改随商品一并保存。"},"title": "变体","variant_label": "变体"@@ -4799,7 +4857,8 @@"tax_categories": "分配给商品的税务类别","tax_rates": "按市场和地区适用的税率","webhooks": "事件发生时接收通知的端点",- "payouts": "由谁向卖家付款、多久一次,以及值得发放的最低金额"+ "payouts": "由谁向卖家付款、多久一次,以及值得发放的最低金额",+ "package_types": "纸箱、外箱、托盘与集装箱"},"groups": {"audit": "审计",@@ -4835,7 +4894,8 @@"tax_categories": "税收类别","tax_rates": "税率","webhooks": "Webhooks",- "payouts": "付款"+ "payouts": "付款",+ "package_types": "包装类型"}},"setup": {@@ -4929,6 +4989,8 @@"local": "仅限此地点的商品"},"search_placeholder": "按名称搜索…",+ "section_behavior": "行为",+ "section_details": "详细信息","section_pickup": "自提","stock_levels": {"empty": "此地点暂无库存水平。",@@ -5141,6 +5203,37 @@"saved": "翻译已保存","source": "源","title": "翻译"+ },+ "package_types": {+ "table_title": "包装类型",+ "search_placeholder": "搜索包装",+ "empty": "尚无包装。请添加发货纸箱,以及批发订单使用的外箱和托盘。",+ "add_cta": "添加包装类型",+ "default_badge": "店铺默认",+ "edit_sheet_title": "包装类型",+ "create_description": "本店用于装载商品的纸箱、外箱、托盘或集装箱。",+ "edit_description": "装入此外箱的商品沿用其尺寸,修改一次即可全部更正。",+ "dimensions_column": "尺寸",+ "volume_column": "体积",+ "kinds": {+ "box": "纸箱",+ "envelope": "信封袋",+ "carton": "外箱",+ "pallet": "托盘",+ "container": "集装箱"+ },+ "messages": {+ "added": "已添加包装类型",+ "updated": "已更新包装类型",+ "deleted": "已删除包装类型"+ },+ "delete_confirm": {+ "title": "删除包装类型?",+ "message": "将删除 {{name}}。装入其中的商品需先重新包装。"+ },+ "validation": {+ "non_negative": "必须大于或等于零"+ }}}}diff --git a/packages/dashboard/src/nav/settings.ts b/packages/dashboard/src/nav/settings.tsindex 04483881d1..0c59517725 100644--- a/packages/dashboard/src/nav/settings.ts+++ b/packages/dashboard/src/nav/settings.ts@@ -8,6 +8,7 @@ import {HandCoinsIcon,KeyRoundIcon,MailIcon,+ PackageIcon,PercentIcon,PlugIcon,RadioTowerIcon,@@ -210,6 +211,18 @@ settingsNav.add({subject: Subject.StockLocation,})+settingsNav.add({+ key: 'settings.package-types',+ labelKey: 'admin.settings_nav.items.package_types',+ descriptionKey: 'admin.settings_nav.descriptions.package_types',+ keywords: ['box', 'carton', 'pallet', 'container', 'packaging', 'parcel', 'freight'],+ path: '/package-types',+ icon: PackageIcon,+ group: 'shipping',+ position: 250,+ subject: Subject.PackageType,+})+settingsNav.add({key: 'settings.product-types',labelKey: 'admin.settings_nav.items.product_types',diff --git a/packages/dashboard/src/routeTree.gen.ts b/packages/dashboard/src/routeTree.gen.tsindex 8eb2af15be..57f38aff6d 100644--- a/packages/dashboard/src/routeTree.gen.ts+++ b/packages/dashboard/src/routeTree.gen.ts@@ -43,6 +43,7 @@ import { Route as SettingsProductTypesRouteImport } from './routes/_authenticateimport { Route as SettingsPoliciesRouteImport } from './routes/_authenticated/$storeId/settings/policies'import { Route as SettingsPayoutsRouteImport } from './routes/_authenticated/$storeId/settings/payouts'import { Route as SettingsPaymentMethodsRouteImport } from './routes/_authenticated/$storeId/settings/payment-methods'+import { Route as SettingsPackageTypesRouteImport } from './routes/_authenticated/$storeId/settings/package-types'import { Route as SettingsMarketsRouteImport } from './routes/_authenticated/$storeId/settings/markets'import { Route as SettingsIntegrationsRouteImport } from './routes/_authenticated/$storeId/settings/integrations'import { Route as SettingsEmailsRouteImport } from './routes/_authenticated/$storeId/settings/emails'@@ -258,6 +259,11 @@ const SettingsPaymentMethodsRoute = SettingsPaymentMethodsRouteImport.update({path: '/payment-methods',getParentRoute: () => SettingsRoute,} as any)+const SettingsPackageTypesRoute = SettingsPackageTypesRouteImport.update({+ id: '/package-types',+ path: '/package-types',+ getParentRoute: () => SettingsRoute,+} as any)const SettingsMarketsRoute = SettingsMarketsRouteImport.update({id: '/markets',path: '/markets',@@ -523,6 +529,7 @@ export interface FileRoutesByFullPath {'/$storeId/settings/emails': typeof SettingsEmailsRoute'/$storeId/settings/integrations': typeof SettingsIntegrationsRoute'/$storeId/settings/markets': typeof SettingsMarketsRoute+ '/$storeId/settings/package-types': typeof SettingsPackageTypesRoute'/$storeId/settings/payment-methods': typeof SettingsPaymentMethodsRoute'/$storeId/settings/payouts': typeof SettingsPayoutsRoute'/$storeId/settings/policies': typeof SettingsPoliciesRoute@@ -599,6 +606,7 @@ export interface FileRoutesByTo {'/$storeId/settings/emails': typeof SettingsEmailsRoute'/$storeId/settings/integrations': typeof SettingsIntegrationsRoute'/$storeId/settings/markets': typeof SettingsMarketsRoute+ '/$storeId/settings/package-types': typeof SettingsPackageTypesRoute'/$storeId/settings/payment-methods': typeof SettingsPaymentMethodsRoute'/$storeId/settings/payouts': typeof SettingsPayoutsRoute'/$storeId/settings/policies': typeof SettingsPoliciesRoute@@ -679,6 +687,7 @@ export interface FileRoutesById {'/_authenticated/$storeId/settings/emails': typeof SettingsEmailsRoute'/_authenticated/$storeId/settings/integrations': typeof SettingsIntegrationsRoute'/_authenticated/$storeId/settings/markets': typeof SettingsMarketsRoute+ '/_authenticated/$storeId/settings/package-types': typeof SettingsPackageTypesRoute'/_authenticated/$storeId/settings/payment-methods': typeof SettingsPaymentMethodsRoute'/_authenticated/$storeId/settings/payouts': typeof SettingsPayoutsRoute'/_authenticated/$storeId/settings/policies': typeof SettingsPoliciesRoute@@ -759,6 +768,7 @@ export interface FileRouteTypes {| '/$storeId/settings/emails'| '/$storeId/settings/integrations'| '/$storeId/settings/markets'+ | '/$storeId/settings/package-types'| '/$storeId/settings/payment-methods'| '/$storeId/settings/payouts'| '/$storeId/settings/policies'@@ -835,6 +845,7 @@ export interface FileRouteTypes {| '/$storeId/settings/emails'| '/$storeId/settings/integrations'| '/$storeId/settings/markets'+ | '/$storeId/settings/package-types'| '/$storeId/settings/payment-methods'| '/$storeId/settings/payouts'| '/$storeId/settings/policies'@@ -914,6 +925,7 @@ export interface FileRouteTypes {| '/_authenticated/$storeId/settings/emails'| '/_authenticated/$storeId/settings/integrations'| '/_authenticated/$storeId/settings/markets'+ | '/_authenticated/$storeId/settings/package-types'| '/_authenticated/$storeId/settings/payment-methods'| '/_authenticated/$storeId/settings/payouts'| '/_authenticated/$storeId/settings/policies'@@ -1204,6 +1216,13 @@ declare module '@tanstack/react-router' {preLoaderRoute: typeof SettingsPaymentMethodsRouteImportparentRoute: typeof SettingsRoute}+ '/_authenticated/$storeId/settings/package-types': {+ id: '/_authenticated/$storeId/settings/package-types'+ path: '/package-types'+ fullPath: '/$storeId/settings/package-types'+ preLoaderRoute: typeof SettingsPackageTypesRouteImport+ parentRoute: typeof SettingsRoute+ }'/_authenticated/$storeId/settings/markets': {id: '/_authenticated/$storeId/settings/markets'path: '/markets'@@ -1517,6 +1536,7 @@ interface SettingsRouteChildren {SettingsEmailsRoute: typeof SettingsEmailsRouteSettingsIntegrationsRoute: typeof SettingsIntegrationsRouteSettingsMarketsRoute: typeof SettingsMarketsRoute+ SettingsPackageTypesRoute: typeof SettingsPackageTypesRouteSettingsPaymentMethodsRoute: typeof SettingsPaymentMethodsRouteSettingsPayoutsRoute: typeof SettingsPayoutsRouteSettingsPoliciesRoute: typeof SettingsPoliciesRoute@@ -1548,6 +1568,7 @@ const SettingsRouteChildren: SettingsRouteChildren = {SettingsEmailsRoute: SettingsEmailsRoute,SettingsIntegrationsRoute: SettingsIntegrationsRoute,SettingsMarketsRoute: SettingsMarketsRoute,+ SettingsPackageTypesRoute: SettingsPackageTypesRoute,SettingsPaymentMethodsRoute: SettingsPaymentMethodsRoute,SettingsPayoutsRoute: SettingsPayoutsRoute,SettingsPoliciesRoute: SettingsPoliciesRoute,diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/orders/$orderId/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/orders/$orderId/index.tsxindex ca92b7af6c..763cf17a92 100644--- a/packages/dashboard/src/routes/_authenticated/$storeId/orders/$orderId/index.tsx+++ b/packages/dashboard/src/routes/_authenticated/$storeId/orders/$orderId/index.tsx@@ -22,6 +22,7 @@ import { CommissionLinesCard } from '../../../../../components/spree/orders/ordeimport { CustomerCard } from '../../../../../components/spree/orders/order-customer-card'import { DiscountsCard } from '../../../../../components/spree/orders/order-discounts-sidebar-card'import { OrderHeader } from '../../../../../components/spree/orders/order-header'+import { OrderLogisticsCard } from '../../../../../components/spree/orders/order-logistics-card'import { MarketplaceCard } from '../../../../../components/spree/orders/order-marketplace-card'import {InternalNoteCard,@@ -100,6 +101,7 @@ function OrderDetailPage() {<MarketplaceCard order={order} /><TagsCard order={order} /><DiscountsCard order={order} />+ <OrderLogisticsCard order={order} /><OrderPurchaseOrderCard order={order} /><SpecialInstructionsCard order={order} /><InternalNoteCard order={order} />diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/new.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/new.tsxindex 5d2dacdcb5..c037ea7aef 100644--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/new.tsx+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/new.tsx@@ -132,6 +132,9 @@ function NewProductPage() {!!v.order_multiple ||v.purchase_unit != null ||!!v.units_per_carton ||+ !!v.cartons_per_pallet ||+ v.carton_weight != null ||+ v.carton_package_type_id != null ||v.track_inventory === false ||v.preorderable === true ||v.preorder_ships_at != null ||diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/package-types.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/package-types.tsxnew file mode 100644index 0000000000..bd9829f142--- /dev/null+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/package-types.tsx@@ -0,0 +1,495 @@+import { zodResolver } from '@hookform/resolvers/zod'+import type { PackageType, PackageTypeCreateParams } from '@spree/admin-sdk'+import {+ adminClient,+ Can,+ i18n,+ mapSpreeErrorsToForm,+ ResourceTable,+ resourceSearchSchema,+ Subject,+ usePermissions,+} from '@spree/dashboard-core'+import {+ Button,+ Field,+ FieldDescription,+ FieldError,+ FieldGroup,+ FieldLabel,+ Input,+ RowActions,+ requiredMessage,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+ Sheet,+ SheetContent,+ SheetDescription,+ SheetFooter,+ SheetHeader,+ SheetTitle,+ Switch,+ useConfirm,+ useRowClickBridge,+} from '@spree/dashboard-ui'+import { PlusIcon } from '@spree/dashboard-ui/icons'+import { createFileRoute, useNavigate } from '@tanstack/react-router'+import { Controller, type UseFormReturn, useForm } from 'react-hook-form'+import { useTranslation } from 'react-i18next'+import { z } from 'zod/v4'+import {+ useCreatePackageType,+ useDeletePackageType,+ usePackageType,+ useUpdatePackageType,+} from '../../../../hooks/use-package-types'+import '../../../../tables/package-types'++// The vocabulary the server validates against; typing anything else could+// only fail on save.+const KINDS = ['box', 'envelope', 'carton', 'pallet', 'container'] as const+const DIMENSION_UNITS = ['mm', 'cm', 'in', 'ft'] as const+const WEIGHT_UNITS = ['g', 'kg', 'lb', 'oz'] as const++// Blank is how a merchant says "not measured", so every number is optional+// and an empty string reaches the API as null rather than zero — a box+// recorded as zero long, zero wide is not the same as one nobody measured.+const optionalNumber = z+ .union([z.string(), z.number()])+ .optional()+ .refine(+ (value) =>+ value === '' || value === undefined || (!Number.isNaN(Number(value)) && Number(value) >= 0),+ {+ error: () => i18n.t('admin.package_types.validation.non_negative'),+ },+ )++const packageTypeFormSchema = z.object({+ name: z+ .string()+ .trim()+ .min(1, { error: requiredMessage('package_type.name') }),+ kind: z.enum(KINDS),+ length: optionalNumber,+ width: optionalNumber,+ height: optionalNumber,+ dimensions_unit: z.enum(DIMENSION_UNITS).optional(),+ weight: optionalNumber,+ max_weight: optionalNumber,+ weight_unit: z.enum(WEIGHT_UNITS).optional(),+ default: z.boolean().optional(),+})++type PackageTypeFormValues = z.input<typeof packageTypeFormSchema>++// Blank erases a measurement, so it has to reach the API as an explicit null;+// undefined would leave whatever was recorded before untouched.+function toParams(values: PackageTypeFormValues): PackageTypeCreateParams {+ const measurement = (value: string | number | undefined) =>+ value === '' || value === undefined ? null : Number(value)++ return {+ name: values.name,+ kind: values.kind,+ length: measurement(values.length),+ width: measurement(values.width),+ height: measurement(values.height),+ weight: measurement(values.weight),+ max_weight: measurement(values.max_weight),+ dimensions_unit: values.dimensions_unit,+ weight_unit: values.weight_unit,+ default: values.default,+ }+}++const DEFAULT_VALUES: PackageTypeFormValues = {+ name: '',+ kind: 'box',+ length: '',+ width: '',+ height: '',+ dimensions_unit: 'cm',+ weight: '',+ max_weight: '',+ weight_unit: 'kg',+ default: false,+}++const packageTypesSearchSchema = resourceSearchSchema.extend({+ edit: z.string().optional(),+ new: z.coerce.boolean().optional(),+})++export const Route = createFileRoute('/_authenticated/$storeId/settings/package-types')({+ validateSearch: packageTypesSearchSchema,+ component: PackageTypesPage,+})++function PackageTypesPage() {+ const { t } = useTranslation()+ const search = Route.useSearch() as z.infer<typeof packageTypesSearchSchema>+ const navigate = useNavigate()+ const confirm = useConfirm()+ const deleteMutation = useDeletePackageType()+ const { permissions } = usePermissions()++ const isCreating = !!search.new+ const editId = isCreating ? undefined : search.edit++ const closeSheet = () =>+ navigate({+ search: (prev: Record<string, unknown>) => {+ const { edit: _e, new: _n, ...rest } = prev+ return rest as never+ },+ })++ const openCreate = () =>+ navigate({+ search: (prev: Record<string, unknown>) => {+ const { edit: _e, ...rest } = prev+ return { ...rest, new: true } as never+ },+ })++ const openEdit = (id: string) =>+ navigate({+ search: (prev: Record<string, unknown>) => {+ const { new: _n, ...rest } = prev+ return { ...rest, edit: id } as never+ },+ })++ useRowClickBridge('data-package-type-id', openEdit)++ async function handleDelete(packageType: PackageType) {+ const ok = await confirm({+ title: t('admin.package_types.delete_confirm.title'),+ message: t('admin.package_types.delete_confirm.message', { name: packageType.name }),+ variant: 'destructive',+ confirmLabel: t('admin.actions.delete'),+ })+ if (!ok) return+ await deleteMutation.mutateAsync(packageType.id).catch(() => undefined)+ }++ return (+ <>+ <ResourceTable<PackageType>+ tableKey="package-types"+ queryKey="package-types"+ queryFn={(params) => adminClient.packageTypes.list(params)}+ searchParams={search}+ rowActions={(packageType) => (+ <RowActions+ actions={[+ { key: 'edit', onSelect: () => openEdit(packageType.id) },+ {+ key: 'delete',+ destructive: true,+ visible: permissions.can('destroy', Subject.PackageType),+ disabled: deleteMutation.isPending,+ onSelect: () => handleDelete(packageType),+ },+ ]}+ />+ )}+ actions={+ <Can I="create" a={Subject.PackageType}>+ <Button size="sm" className="h-[2.125rem]" onClick={openCreate}>+ <PlusIcon className="size-4" />+ {t('admin.package_types.add_cta')}+ </Button>+ </Can>+ }+ />++ {isCreating && <CreatePackageTypeSheet open onOpenChange={(o) => !o && closeSheet()} />}+ {editId && <EditPackageTypeSheet id={editId} open onOpenChange={(o) => !o && closeSheet()} />}+ </>+ )+}++function CreatePackageTypeSheet({+ open,+ onOpenChange,+}: {+ open: boolean+ onOpenChange: (open: boolean) => void+}) {+ const { t } = useTranslation()+ const createMutation = useCreatePackageType()+ const form = useForm<PackageTypeFormValues>({+ resolver: zodResolver(packageTypeFormSchema),+ defaultValues: DEFAULT_VALUES,+ })++ async function onSubmit(values: PackageTypeFormValues) {+ try {+ await createMutation.mutateAsync(toParams(values))+ form.reset(DEFAULT_VALUES)+ onOpenChange(false)+ } catch (err) {+ if (!mapSpreeErrorsToForm(err, form.setError)) throw err+ }+ }++ return (+ <Sheet+ open={open}+ onOpenChange={(next) => {+ if (!next) form.reset(DEFAULT_VALUES)+ onOpenChange(next)+ }}+ >+ <SheetContent>+ <SheetHeader>+ <SheetTitle>{t('admin.pages.settings.package_types.add_sheet_title')}</SheetTitle>+ <SheetDescription>{t('admin.package_types.create_description')}</SheetDescription>+ </SheetHeader>+ <form onSubmit={form.handleSubmit(onSubmit)} className="flex min-h-0 flex-1 flex-col">+ <div className="flex flex-1 flex-col gap-4 overflow-y-auto p-4">+ <PackageTypeFormFields form={form} />+ </div>+ <SheetFooter>+ <Button type="submit" disabled={createMutation.isPending}>+ {t('admin.actions.save')}+ </Button>+ </SheetFooter>+ </form>+ </SheetContent>+ </Sheet>+ )+}++function EditPackageTypeSheet({+ id,+ open,+ onOpenChange,+}: {+ id: string+ open: boolean+ onOpenChange: (open: boolean) => void+}) {+ const { t } = useTranslation()+ const { data: packageType } = usePackageType(id)+ const updateMutation = useUpdatePackageType(id)+ const form = useForm<PackageTypeFormValues>({+ resolver: zodResolver(packageTypeFormSchema),+ defaultValues: DEFAULT_VALUES,+ values: packageType+ ? {+ name: packageType.name,+ kind: packageType.kind as (typeof KINDS)[number],+ length: packageType.length ?? '',+ width: packageType.width ?? '',+ height: packageType.height ?? '',+ dimensions_unit: packageType.dimensions_unit as (typeof DIMENSION_UNITS)[number],+ weight: packageType.weight ?? '',+ max_weight: packageType.max_weight ?? '',+ weight_unit: packageType.weight_unit as (typeof WEIGHT_UNITS)[number],+ default: packageType.default,+ }+ : undefined,+ })++ async function onSubmit(values: PackageTypeFormValues) {+ try {+ await updateMutation.mutateAsync(toParams(values))+ onOpenChange(false)+ } catch (err) {+ if (!mapSpreeErrorsToForm(err, form.setError)) throw err+ }+ }++ return (+ <Sheet open={open} onOpenChange={onOpenChange}>+ <SheetContent>+ <SheetHeader>+ <SheetTitle>{packageType?.name ?? t('admin.package_types.edit_sheet_title')}</SheetTitle>+ <SheetDescription>{t('admin.package_types.edit_description')}</SheetDescription>+ </SheetHeader>+ <form onSubmit={form.handleSubmit(onSubmit)} className="flex min-h-0 flex-1 flex-col">+ <div className="flex flex-1 flex-col gap-4 overflow-y-auto p-4">+ <PackageTypeFormFields form={form} />+ </div>+ <SheetFooter>+ <Button type="submit" disabled={updateMutation.isPending}>+ {t('admin.actions.save')}+ </Button>+ </SheetFooter>+ </form>+ </SheetContent>+ </Sheet>+ )+}++function PackageTypeFormFields({ form }: { form: UseFormReturn<PackageTypeFormValues> }) {+ const { t } = useTranslation()+ const errors = form.formState.errors++ return (+ <FieldGroup>+ <Field>+ <FieldLabel htmlFor="package-type-name">+ {t('admin.fields.package_type.name.label')}+ </FieldLabel>+ <Input id="package-type-name" {...form.register('name')} aria-invalid={!!errors.name} />+ <FieldError errors={[errors.name]} />+ </Field>++ <Field>+ <FieldLabel htmlFor="package-type-kind">+ {t('admin.fields.package_type.kind.label')}+ </FieldLabel>+ <Controller+ control={form.control}+ name="kind"+ render={({ field }) => {+ const options = KINDS.map((kind) => ({+ value: kind,+ label: t(`admin.package_types.kinds.${kind}`),+ }))+ return (+ <Select items={options} value={field.value} onValueChange={field.onChange}>+ <SelectTrigger id="package-type-kind">+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ {options.map((option) => (+ <SelectItem key={option.value} value={option.value}>+ {option.label}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ )+ }}+ />+ <FieldDescription>{t('admin.fields.package_type.kind.help')}</FieldDescription>+ </Field>++ <div className="grid grid-cols-[1fr_1fr_1fr_110px] gap-3">+ {(['length', 'width', 'height'] as const).map((side) => (+ <Field key={side}>+ <FieldLabel htmlFor={`package-type-${side}`}>+ {t(`admin.fields.package_type.${side}.label`)}+ </FieldLabel>+ <Input+ id={`package-type-${side}`}+ type="number"+ min="0"+ step="0.01"+ {...form.register(side)}+ />+ </Field>+ ))}+ <UnitField+ form={form}+ name="dimensions_unit"+ units={DIMENSION_UNITS}+ label={t('admin.fields.package_type.dimensions_unit.label')}+ />+ </div>+ <FieldDescription>{t('admin.fields.package_type.dimensions.help')}</FieldDescription>++ <div className="grid grid-cols-[1fr_1fr_110px] gap-3">+ <Field>+ <FieldLabel htmlFor="package-type-weight">+ {t('admin.fields.package_type.weight.label')}+ </FieldLabel>+ <Input+ id="package-type-weight"+ type="number"+ min="0"+ step="0.01"+ {...form.register('weight')}+ />+ <FieldDescription>{t('admin.fields.package_type.weight.help')}</FieldDescription>+ </Field>+ <Field>+ <FieldLabel htmlFor="package-type-max-weight">+ {t('admin.fields.package_type.max_weight.label')}+ </FieldLabel>+ <Input+ id="package-type-max-weight"+ type="number"+ min="0"+ step="0.01"+ {...form.register('max_weight')}+ />+ <FieldDescription>{t('admin.fields.package_type.max_weight.help')}</FieldDescription>+ </Field>+ <UnitField+ form={form}+ name="weight_unit"+ units={WEIGHT_UNITS}+ label={t('admin.fields.package_type.weight_unit.label')}+ />+ </div>++ <Field>+ <div className="flex items-start justify-between gap-4">+ <FieldLabel htmlFor="package-type-default" className="cursor-pointer">+ {t('admin.fields.package_type.default.label')}+ </FieldLabel>+ <Controller+ control={form.control}+ name="default"+ render={({ field }) => (+ <Switch+ id="package-type-default"+ checked={!!field.value}+ onCheckedChange={field.onChange}+ />+ )}+ />+ </div>+ <FieldDescription>{t('admin.fields.package_type.default.help')}</FieldDescription>+ </Field>+ </FieldGroup>+ )+}++function UnitField({+ form,+ name,+ units,+ label,+}: {+ form: UseFormReturn<PackageTypeFormValues>+ name: 'dimensions_unit' | 'weight_unit'+ units: readonly string[]+ label: string+}) {+ return (+ <Field>+ <FieldLabel htmlFor={`package-type-${name}`}>{label}</FieldLabel>+ <Controller+ control={form.control}+ name={name}+ render={({ field }) => {+ const options = units.map((unit) => ({ value: unit, label: unit }))+ return (+ <Select items={options} value={field.value ?? ''} onValueChange={field.onChange}>+ <SelectTrigger id={`package-type-${name}`}>+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ {options.map((option) => (+ <SelectItem key={option.value} value={option.value}>+ {option.label}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ )+ }}+ />+ </Field>+ )+}diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsxindex 247c24a4b1..8bca9bb211 100644--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsx+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsx@@ -115,10 +115,6 @@ function storeToFormValues(store: Store): StoreSettingsFormValues {preferred_timezone: store.preferred_timezone,preferred_unit_system: (store.preferred_unit_system as 'metric' | 'imperial') ?? 'metric',preferred_weight_unit: store.preferred_weight_unit,- preferred_default_package_weight: Number(store.preferred_default_package_weight ?? 0),- preferred_default_package_length: Number(store.preferred_default_package_length ?? 0),- preferred_default_package_width: Number(store.preferred_default_package_width ?? 0),- preferred_default_package_height: Number(store.preferred_default_package_height ?? 0),preferred_storefront_access:(store.preferred_storefront_access as (typeof STOREFRONT_ACCESS_LEVELS)[number]) ?? 'public',preferred_guest_checkout: store.preferred_guest_checkout ?? true,@@ -220,10 +216,6 @@ function StoreSettingsForm({ store }: { store: Store }) {numberFormat === 'random' ? '482910375' : (numberStart ?? 1001)}${numberSuffix ?? ''}`- // Live unit suffixes for the default-package inputs.- const weightUnit = form.watch('preferred_weight_unit')- const dimensionUnit = form.watch('preferred_unit_system') === 'metric' ? 'cm' : 'in'-// When unit_system flips, reset weight_unit to the first valid option for// that system so the form never holds an inconsistent pair.const unitSystem = form.watch('preferred_unit_system')@@ -252,10 +244,6 @@ function StoreSettingsForm({ store }: { store: Store }) {preferred_timezone: values.preferred_timezone,preferred_unit_system: values.preferred_unit_system,preferred_weight_unit: values.preferred_weight_unit,- preferred_default_package_weight: values.preferred_default_package_weight,- preferred_default_package_length: values.preferred_default_package_length,- preferred_default_package_width: values.preferred_default_package_width,- preferred_default_package_height: values.preferred_default_package_height,preferred_storefront_access: values.preferred_storefront_access,preferred_guest_checkout: values.preferred_guest_checkout,preferred_company_field_enabled: values.preferred_company_field_enabled,@@ -477,73 +465,6 @@ function StoreSettingsForm({ store }: { store: Store }) {</CardContent></Card>- <Card>- <CardHeader>- <CardTitle>{t('admin.pages.settings.store.tab_default_package')}</CardTitle>- </CardHeader>- <CardContent>- <FieldGroup>- <FieldDescription>- {t('admin.pages.settings.store.default_package_description')}- </FieldDescription>- <div className="grid grid-cols-[1fr_120px] gap-3">- <Field>- <FieldLabel htmlFor="store-default-package-weight">- {t('admin.fields.store.preferred_default_package_weight.label')}- </FieldLabel>- <Input- id="store-default-package-weight"- type="number"- min="0"- step="0.01"- {...form.register('preferred_default_package_weight')}- />- <FieldError- errors={[form.formState.errors.preferred_default_package_weight]}- />- </Field>- <Field>- <FieldLabel htmlFor="store-default-package-weight-unit">- {t('admin.fields.variant.weight_unit.label')}- </FieldLabel>- <Input id="store-default-package-weight-unit" value={weightUnit} disabled />- </Field>- </div>- <div className="grid grid-cols-[1fr_1fr_1fr_120px] gap-3">- {(- [- ['length', 'store-default-package-length'],- ['width', 'store-default-package-width'],- ['height', 'store-default-package-height'],- ] as const- ).map(([side, id]) => (- <Field key={side}>- <FieldLabel htmlFor={id}>- {t(`admin.fields.store.preferred_default_package_dimensions.${side}`)}- </FieldLabel>- <Input- id={id}- type="number"- min="0"- step="0.01"- {...form.register(`preferred_default_package_${side}`)}- />- </Field>- ))}- <Field>- <FieldLabel htmlFor="store-default-package-dim-unit">- {t('admin.fields.variant.dimensions_unit.label')}- </FieldLabel>- <Input id="store-default-package-dim-unit" value={dimensionUnit} disabled />- </Field>- </div>- <FieldDescription>- {t('admin.fields.store.preferred_default_package_dimensions.help')}- </FieldDescription>- </FieldGroup>- </CardContent>- </Card>-<Card><CardHeader><CardTitle>{t('admin.pages.settings.store.tab_storefront_access')}</CardTitle>diff --git a/packages/dashboard/src/schemas/delivery-method.ts b/packages/dashboard/src/schemas/delivery-method.tsindex a0063e6909..92f7b60813 100644--- a/packages/dashboard/src/schemas/delivery-method.ts+++ b/packages/dashboard/src/schemas/delivery-method.ts@@ -56,6 +56,8 @@ export const deliveryMethodFormSchema = z.object({rules: z.array(deliveryMethodRuleSchema),markup_flat: z.string().optional(),markup_percent: z.string().optional(),+ // Held as strings like the other decimals: what the merchant typed reaches+ // the server intact, which is what parses it.services: z.array(deliveryMethodServiceSchema),})diff --git a/packages/dashboard/src/schemas/store.ts b/packages/dashboard/src/schemas/store.tsindex 362bdf5259..d9e8edb950 100644--- a/packages/dashboard/src/schemas/store.ts+++ b/packages/dashboard/src/schemas/store.ts@@ -45,10 +45,6 @@ export const storeSettingsFormSchema = z.object({preferred_timezone: z.string().min(1, { error: requiredMessage('store.preferred_timezone') }),preferred_unit_system: z.enum(['metric', 'imperial']),preferred_weight_unit: z.enum(ALL_WEIGHT_UNITS),- preferred_default_package_weight: z.coerce.number().min(0),- preferred_default_package_length: z.coerce.number().min(0),- preferred_default_package_width: z.coerce.number().min(0),- preferred_default_package_height: z.coerce.number().min(0),preferred_storefront_access: z.enum(STOREFRONT_ACCESS_LEVELS),preferred_guest_checkout: z.boolean(),preferred_company_field_enabled: z.boolean(),diff --git a/packages/dashboard/src/tables/package-types.tsx b/packages/dashboard/src/tables/package-types.tsxnew file mode 100644index 0000000000..344ecb9579--- /dev/null+++ b/packages/dashboard/src/tables/package-types.tsx@@ -0,0 +1,68 @@+import type { PackageType } from '@spree/admin-sdk'+import { defineTable } from '@spree/dashboard-core'+import { RelativeTime, ResourceNameCell } from '@spree/dashboard-ui'+import { PackageIcon } from '@spree/dashboard-ui/icons'+import i18n from 'i18next'++defineTable<PackageType>('package-types', {+ title: i18n.t('admin.package_types.table_title'),+ searchParam: 'name_cont',+ searchPlaceholder: i18n.t('admin.package_types.search_placeholder'),+ defaultSort: { field: 'name', direction: 'asc' },+ emptyIcon: <PackageIcon className="size-8 text-muted-foreground" />,+ emptyMessage: i18n.t('admin.package_types.empty'),+ columns: [+ {+ key: 'name',+ label: i18n.t('admin.fields.package_type.name.label'),+ sortable: true,+ default: true,+ render: (packageType) => (+ <ResourceNameCell+ id={packageType.id}+ dataAttr="data-package-type-id"+ name={packageType.name}+ // The store's own box, called out because every parcel quote is+ // built on it.+ secondary={packageType.default ? i18n.t('admin.package_types.default_badge') : undefined}+ />+ ),+ },+ {+ key: 'kind',+ label: i18n.t('admin.fields.package_type.kind.label'),+ sortable: true,+ default: true,+ render: (packageType) => i18n.t(`admin.package_types.kinds.${packageType.kind}`),+ },+ {+ key: 'dimensions',+ label: i18n.t('admin.package_types.dimensions_column'),+ default: true,+ className: 'text-sm text-muted-foreground whitespace-nowrap',+ // Three numbers mean nothing without the unit they were measured in —+ // the same figures read as inches or centimetres differ sixteenfold by+ // volume, which is what the freight tiers compare.+ render: (packageType) =>+ packageType.length && packageType.width && packageType.height+ ? `${packageType.length} × ${packageType.width} × ${packageType.height} ${packageType.dimensions_unit}`+ : '—',+ },+ {+ key: 'volume',+ label: i18n.t('admin.package_types.volume_column'),+ className: 'text-sm text-muted-foreground whitespace-nowrap',+ render: (packageType) =>+ packageType.volume ? `${Number(packageType.volume).toFixed(3)} m³` : '—',+ },+ {+ key: 'created_at',+ label: i18n.t('admin.fields.created_at.label'),+ sortable: true,+ filterable: true,+ filterType: 'date',+ className: 'text-sm text-muted-foreground whitespace-nowrap',+ render: (packageType) => <RelativeTime iso={packageType.created_at} />,+ },+ ],+})