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
Add dashboard pages for business customers and tax configuration
Damian Legawiecfdd88eb3d2d7
diff --git a/.changeset/dashboard-companies-and-tax-rates.md b/.changeset/dashboard-companies-and-tax-rates.mdnew file mode 100644index 0000000000..82dc0e1056--- /dev/null+++ b/.changeset/dashboard-companies-and-tax-rates.md@@ -0,0 +1,18 @@+---+"@spree/dashboard": minor+"@spree/dashboard-core": minor+"@spree/dashboard-ui": minor+"@spree/admin-sdk": minor+---++Add dashboard pages for business customers and tax configuration.++Companies get a list and a detail page with their branches, tax registration+and exemption certificates; a branch has its own page listing the buyers+authorised to purchase for it. Customers gain the same tax registration panel+on their profile. Tax rates get a settings page, and a market can now name the+tax engine that prices it — showing what that engine cannot handle, so a+merchant learns about a gap while configuring rather than from a tax bill.++The admin SDK gains the customer tax-identifier endpoints and `tax_provider`+on market params.diff --git a/packages/admin-sdk/src/admin-client.ts b/packages/admin-sdk/src/admin-client.tsindex bcfe0e3496..9095354142 100644--- a/packages/admin-sdk/src/admin-client.ts+++ b/packages/admin-sdk/src/admin-client.ts@@ -3051,6 +3051,70 @@ export class AdminClient {this.request<void>('DELETE', `/customers/${customerId}/addresses/${id}`, options),},+ /**+ * The customer's own tax registrations — the durable profile value, as+ * opposed to the override entered during a single checkout. A company's+ * registration outranks these when the buyer purchases for a business.+ */+ taxIdentifiers: {+ list: (+ customerId: string,+ params?: ListParams & Record<string, unknown>,+ options?: RequestOptions,+ ): Promise<PaginatedResponse<TaxIdentifier>> =>+ this.request<PaginatedResponse<TaxIdentifier>>(+ 'GET',+ `/customers/${customerId}/tax_identifiers`,+ { ...options, params: params ? transformListParams(params) : undefined },+ ),++ get: (customerId: string, id: string, options?: RequestOptions): Promise<TaxIdentifier> =>+ this.request<TaxIdentifier>(+ 'GET',+ `/customers/${customerId}/tax_identifiers/${id}`,+ options,+ ),++ create: (+ customerId: string,+ params: TaxIdentifierParams,+ options?: RequestOptions,+ ): Promise<TaxIdentifier> =>+ this.request<TaxIdentifier>('POST', `/customers/${customerId}/tax_identifiers`, {+ ...options,+ body: params,+ }),++ update: (+ customerId: string,+ id: string,+ params: TaxIdentifierParams,+ options?: RequestOptions,+ ): Promise<TaxIdentifier> =>+ this.request<TaxIdentifier>('PATCH', `/customers/${customerId}/tax_identifiers/${id}`, {+ ...options,+ body: params,+ }),++ delete: (customerId: string, id: string, options?: RequestOptions): Promise<void> =>+ this.request<void>('DELETE', `/customers/${customerId}/tax_identifiers/${id}`, options),++ /**+ * Re-asks the registry. Manual because a registry answers only "valid+ * now" — a number verified last year may have been deregistered since.+ */+ validate: (+ customerId: string,+ id: string,+ options?: RequestOptions,+ ): Promise<TaxIdentifier> =>+ this.request<TaxIdentifier>(+ 'POST',+ `/customers/${customerId}/tax_identifiers/${id}/validate`,+ options,+ ),+ },+storeCredits: {list: (customerId: string,diff --git a/packages/admin-sdk/src/params.ts b/packages/admin-sdk/src/params.tsindex ef89852fcf..3065012431 100644--- a/packages/admin-sdk/src/params.ts+++ b/packages/admin-sdk/src/params.ts@@ -1246,6 +1246,11 @@ export interface MarketCreateParams {position?: number/** 2-letter ISO country codes assigned to this market. At least one is required. */country_isos: string[]+ /**+ * Class name of the tax engine that prices this market, from+ * `taxProviders.list()`. `null` uses the installation default.+ */+ tax_provider?: string | null}export interface MarketUpdateParams {@@ -1257,6 +1262,7 @@ export interface MarketUpdateParams {default?: booleanposition?: numbercountry_isos?: string[]+ tax_provider?: string | null}export interface CustomerGroupCreateParams {diff --git a/packages/dashboard-core/src/index.ts b/packages/dashboard-core/src/index.tsindex 5ede42cccb..ac87adcf82 100644--- a/packages/dashboard-core/src/index.ts+++ b/packages/dashboard-core/src/index.ts@@ -67,6 +67,7 @@ export * from './lib/custom-field-components'// ---------------------------------------------------------------------------// Helpers// ---------------------------------------------------------------------------+export * from './lib/download'export * from './lib/filters-to-ransack'export * from './lib/form-errors'export * from './lib/form-fields-registry'diff --git a/packages/dashboard-core/src/lib/permissions.ts b/packages/dashboard-core/src/lib/permissions.tsindex 89914fa2ee..248116249c 100644--- a/packages/dashboard-core/src/lib/permissions.ts+++ b/packages/dashboard-core/src/lib/permissions.ts@@ -26,6 +26,12 @@ export const Subject = {OptionType: 'Spree::OptionType',OptionValue: 'Spree::OptionValue',TaxCategory: 'Spree::TaxCategory',+ TaxRate: 'Spree::TaxRate',+ TaxIdentifier: 'Spree::TaxIdentifier',+ TaxExemptionCertificate: 'Spree::TaxExemptionCertificate',+ Company: 'Spree::Company',+ CompanyLocation: 'Spree::CompanyLocation',+ CompanyContact: 'Spree::CompanyContact',ReturnReason: 'Spree::ReturnReason',ClaimReason: 'Spree::ClaimReason',RefundReason: 'Spree::RefundReason',diff --git a/packages/dashboard-starter/src/routeTree.gen.ts b/packages/dashboard-starter/src/routeTree.gen.tsindex c4a3a8ea1b..743953fe57 100644--- a/packages/dashboard-starter/src/routeTree.gen.ts+++ b/packages/dashboard-starter/src/routeTree.gen.ts@@ -29,7 +29,9 @@ import { Route as PromotionsIndexRouteImport } from './../../dashboard/src/routeimport { Route as ProductsIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/products/index'import { Route as OrdersIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/orders/index'import { Route as CustomersIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/customers/index'+import { Route as CompaniesIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/companies/index'import { Route as BrandsDotindexRouteImport } from './../../dashboard-plugin-example/src/routes/brands.index'+import { Route as SettingsTaxRatesRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/tax-rates'import { Route as SettingsTaxCategoriesRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/tax-categories'import { Route as SettingsStoreRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/store'import { Route as SettingsStockLocationsRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/stock-locations'@@ -56,6 +58,7 @@ import { Route as OrdersNewRouteImport } from './../../dashboard/src/routes/_autimport { Route as OrdersDraftsRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/orders/drafts'import { Route as CustomersGroupsRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/customers/groups'import { Route as CustomersCustomerIdRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/customers/$customerId'+import { Route as CompaniesCompanyIdRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/companies/$companyId'import { Route as BrandsDotbrandIdRouteImport } from './../../dashboard-plugin-example/src/routes/brands.$brandId'import { Route as SettingsWebhooksIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/webhooks/index'import { Route as SettingsImportsIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/imports/index'@@ -71,6 +74,7 @@ import { Route as ProductsCollectionsCollectionIdRouteImport } from './../../dasimport { Route as ProductsCategoriesNewRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/products/categories/new'import { Route as ProductsCategoriesCategoryIdRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/products/categories/$categoryId'import { Route as OrdersOrderIdEditRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/orders/$orderId/edit'+import { Route as CompaniesLocationsDotlocationIdRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/companies/locations.$locationId'import { Route as SettingsDeliveryProfilesProfileIdIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/delivery-profiles/$profileId/index'import { Route as ProductsPriceListsPriceListIdIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/products/price-lists/$priceListId/index'import { Route as SettingsDeliveryProfilesProfileIdMethodsNewRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/delivery-profiles/$profileId/methods/new'@@ -176,11 +180,21 @@ const CustomersIndexRoute = CustomersIndexRouteImport.update({path: '/customers/',getParentRoute: () => authenticatedStoreIdRoute,} as any)+const CompaniesIndexRoute = CompaniesIndexRouteImport.update({+ id: '/companies/',+ path: '/companies/',+ getParentRoute: () => authenticatedStoreIdRoute,+} as any)const BrandsDotindexRoute = BrandsDotindexRouteImport.update({id: '/brands/',path: '/brands/',getParentRoute: () => authenticatedStoreIdRoute,} as any)+const SettingsTaxRatesRoute = SettingsTaxRatesRouteImport.update({+ id: '/tax-rates',+ path: '/tax-rates',+ getParentRoute: () => SettingsRoute,+} as any)const SettingsTaxCategoriesRoute = SettingsTaxCategoriesRouteImport.update({id: '/tax-categories',path: '/tax-categories',@@ -312,6 +326,11 @@ const CustomersCustomerIdRoute = CustomersCustomerIdRouteImport.update({path: '/customers/$customerId',getParentRoute: () => authenticatedStoreIdRoute,} as any)+const CompaniesCompanyIdRoute = CompaniesCompanyIdRouteImport.update({+ id: '/companies/$companyId',+ path: '/companies/$companyId',+ getParentRoute: () => authenticatedStoreIdRoute,+} as any)const BrandsDotbrandIdRoute = BrandsDotbrandIdRouteImport.update({id: '/brands/$brandId',path: '/brands/$brandId',@@ -392,6 +411,12 @@ const OrdersOrderIdEditRoute = OrdersOrderIdEditRouteImport.update({path: '/orders/$orderId/edit',getParentRoute: () => authenticatedStoreIdRoute,} as any)+const CompaniesLocationsDotlocationIdRoute =+ CompaniesLocationsDotlocationIdRouteImport.update({+ id: '/companies/locations/$locationId',+ path: '/companies/locations/$locationId',+ getParentRoute: () => authenticatedStoreIdRoute,+ } as any)const SettingsDeliveryProfilesProfileIdIndexRoute =SettingsDeliveryProfilesProfileIdIndexRouteImport.update({id: '/delivery-profiles/$profileId/',@@ -433,6 +458,7 @@ export interface FileRoutesByFullPath {'/$storeId/settings': typeof SettingsRouteWithChildren'/$storeId/': typeof IndexRoute'/$storeId/brands/$brandId': typeof BrandsDotbrandIdRoute+ '/$storeId/companies/$companyId': typeof CompaniesCompanyIdRoute'/$storeId/customers/$customerId': typeof CustomersCustomerIdRoute'/$storeId/customers/groups': typeof CustomersGroupsRoute'/$storeId/orders/drafts': typeof OrdersDraftsRoute@@ -459,12 +485,15 @@ export interface FileRoutesByFullPath {'/$storeId/settings/stock-locations': typeof SettingsStockLocationsRoute'/$storeId/settings/store': typeof SettingsStoreRoute'/$storeId/settings/tax-categories': typeof SettingsTaxCategoriesRoute+ '/$storeId/settings/tax-rates': typeof SettingsTaxRatesRoute'/$storeId/brands/': typeof BrandsDotindexRoute+ '/$storeId/companies/': typeof CompaniesIndexRoute'/$storeId/customers/': typeof CustomersIndexRoute'/$storeId/orders/': typeof OrdersIndexRoute'/$storeId/products/': typeof ProductsIndexRoute'/$storeId/promotions/': typeof PromotionsIndexRoute'/$storeId/settings/': typeof SettingsIndexRoute+ '/$storeId/companies/locations/$locationId': typeof CompaniesLocationsDotlocationIdRoute'/$storeId/orders/$orderId/edit': typeof OrdersOrderIdEditRoute'/$storeId/products/categories/$categoryId': typeof ProductsCategoriesCategoryIdRoute'/$storeId/products/categories/new': typeof ProductsCategoriesNewRoute@@ -498,6 +527,7 @@ export interface FileRoutesByTo {'/$storeId/returns': typeof ReturnsRoute'/$storeId': typeof IndexRoute'/$storeId/brands/$brandId': typeof BrandsDotbrandIdRoute+ '/$storeId/companies/$companyId': typeof CompaniesCompanyIdRoute'/$storeId/customers/$customerId': typeof CustomersCustomerIdRoute'/$storeId/customers/groups': typeof CustomersGroupsRoute'/$storeId/orders/drafts': typeof OrdersDraftsRoute@@ -524,12 +554,15 @@ export interface FileRoutesByTo {'/$storeId/settings/stock-locations': typeof SettingsStockLocationsRoute'/$storeId/settings/store': typeof SettingsStoreRoute'/$storeId/settings/tax-categories': typeof SettingsTaxCategoriesRoute+ '/$storeId/settings/tax-rates': typeof SettingsTaxRatesRoute'/$storeId/brands': typeof BrandsDotindexRoute+ '/$storeId/companies': typeof CompaniesIndexRoute'/$storeId/customers': typeof CustomersIndexRoute'/$storeId/orders': typeof OrdersIndexRoute'/$storeId/products': typeof ProductsIndexRoute'/$storeId/promotions': typeof PromotionsIndexRoute'/$storeId/settings': typeof SettingsIndexRoute+ '/$storeId/companies/locations/$locationId': typeof CompaniesLocationsDotlocationIdRoute'/$storeId/orders/$orderId/edit': typeof OrdersOrderIdEditRoute'/$storeId/products/categories/$categoryId': typeof ProductsCategoriesCategoryIdRoute'/$storeId/products/categories/new': typeof ProductsCategoriesNewRoute@@ -567,6 +600,7 @@ export interface FileRoutesById {'/_authenticated/$storeId/settings': typeof SettingsRouteWithChildren'/_authenticated/$storeId/': typeof IndexRoute'/_authenticated/$storeId/brands/$brandId': typeof BrandsDotbrandIdRoute+ '/_authenticated/$storeId/companies/$companyId': typeof CompaniesCompanyIdRoute'/_authenticated/$storeId/customers/$customerId': typeof CustomersCustomerIdRoute'/_authenticated/$storeId/customers/groups': typeof CustomersGroupsRoute'/_authenticated/$storeId/orders/drafts': typeof OrdersDraftsRoute@@ -593,12 +627,15 @@ export interface FileRoutesById {'/_authenticated/$storeId/settings/stock-locations': typeof SettingsStockLocationsRoute'/_authenticated/$storeId/settings/store': typeof SettingsStoreRoute'/_authenticated/$storeId/settings/tax-categories': typeof SettingsTaxCategoriesRoute+ '/_authenticated/$storeId/settings/tax-rates': typeof SettingsTaxRatesRoute'/_authenticated/$storeId/brands/': typeof BrandsDotindexRoute+ '/_authenticated/$storeId/companies/': typeof CompaniesIndexRoute'/_authenticated/$storeId/customers/': typeof CustomersIndexRoute'/_authenticated/$storeId/orders/': typeof OrdersIndexRoute'/_authenticated/$storeId/products/': typeof ProductsIndexRoute'/_authenticated/$storeId/promotions/': typeof PromotionsIndexRoute'/_authenticated/$storeId/settings/': typeof SettingsIndexRoute+ '/_authenticated/$storeId/companies/locations/$locationId': typeof CompaniesLocationsDotlocationIdRoute'/_authenticated/$storeId/orders/$orderId/edit': typeof OrdersOrderIdEditRoute'/_authenticated/$storeId/products/categories/$categoryId': typeof ProductsCategoriesCategoryIdRoute'/_authenticated/$storeId/products/categories/new': typeof ProductsCategoriesNewRoute@@ -636,6 +673,7 @@ export interface FileRouteTypes {| '/$storeId/settings'| '/$storeId/'| '/$storeId/brands/$brandId'+ | '/$storeId/companies/$companyId'| '/$storeId/customers/$customerId'| '/$storeId/customers/groups'| '/$storeId/orders/drafts'@@ -662,12 +700,15 @@ export interface FileRouteTypes {| '/$storeId/settings/stock-locations'| '/$storeId/settings/store'| '/$storeId/settings/tax-categories'+ | '/$storeId/settings/tax-rates'| '/$storeId/brands/'+ | '/$storeId/companies/'| '/$storeId/customers/'| '/$storeId/orders/'| '/$storeId/products/'| '/$storeId/promotions/'| '/$storeId/settings/'+ | '/$storeId/companies/locations/$locationId'| '/$storeId/orders/$orderId/edit'| '/$storeId/products/categories/$categoryId'| '/$storeId/products/categories/new'@@ -701,6 +742,7 @@ export interface FileRouteTypes {| '/$storeId/returns'| '/$storeId'| '/$storeId/brands/$brandId'+ | '/$storeId/companies/$companyId'| '/$storeId/customers/$customerId'| '/$storeId/customers/groups'| '/$storeId/orders/drafts'@@ -727,12 +769,15 @@ export interface FileRouteTypes {| '/$storeId/settings/stock-locations'| '/$storeId/settings/store'| '/$storeId/settings/tax-categories'+ | '/$storeId/settings/tax-rates'| '/$storeId/brands'+ | '/$storeId/companies'| '/$storeId/customers'| '/$storeId/orders'| '/$storeId/products'| '/$storeId/promotions'| '/$storeId/settings'+ | '/$storeId/companies/locations/$locationId'| '/$storeId/orders/$orderId/edit'| '/$storeId/products/categories/$categoryId'| '/$storeId/products/categories/new'@@ -769,6 +814,7 @@ export interface FileRouteTypes {| '/_authenticated/$storeId/settings'| '/_authenticated/$storeId/'| '/_authenticated/$storeId/brands/$brandId'+ | '/_authenticated/$storeId/companies/$companyId'| '/_authenticated/$storeId/customers/$customerId'| '/_authenticated/$storeId/customers/groups'| '/_authenticated/$storeId/orders/drafts'@@ -795,12 +841,15 @@ export interface FileRouteTypes {| '/_authenticated/$storeId/settings/stock-locations'| '/_authenticated/$storeId/settings/store'| '/_authenticated/$storeId/settings/tax-categories'+ | '/_authenticated/$storeId/settings/tax-rates'| '/_authenticated/$storeId/brands/'+ | '/_authenticated/$storeId/companies/'| '/_authenticated/$storeId/customers/'| '/_authenticated/$storeId/orders/'| '/_authenticated/$storeId/products/'| '/_authenticated/$storeId/promotions/'| '/_authenticated/$storeId/settings/'+ | '/_authenticated/$storeId/companies/locations/$locationId'| '/_authenticated/$storeId/orders/$orderId/edit'| '/_authenticated/$storeId/products/categories/$categoryId'| '/_authenticated/$storeId/products/categories/new'@@ -972,6 +1021,13 @@ declare module '@tanstack/react-router' {preLoaderRoute: typeof CustomersIndexRouteImportparentRoute: typeof authenticatedStoreIdRoute}+ '/_authenticated/$storeId/companies/': {+ id: '/_authenticated/$storeId/companies/'+ path: '/companies'+ fullPath: '/$storeId/companies/'+ preLoaderRoute: typeof CompaniesIndexRouteImport+ parentRoute: typeof authenticatedStoreIdRoute+ }'/_authenticated/$storeId/brands/': {id: '/_authenticated/$storeId/brands/'path: '/brands'@@ -979,6 +1035,13 @@ declare module '@tanstack/react-router' {preLoaderRoute: typeof BrandsDotindexRouteImportparentRoute: typeof authenticatedStoreIdRoute}+ '/_authenticated/$storeId/settings/tax-rates': {+ id: '/_authenticated/$storeId/settings/tax-rates'+ path: '/tax-rates'+ fullPath: '/$storeId/settings/tax-rates'+ preLoaderRoute: typeof SettingsTaxRatesRouteImport+ parentRoute: typeof SettingsRoute+ }'/_authenticated/$storeId/settings/tax-categories': {id: '/_authenticated/$storeId/settings/tax-categories'path: '/tax-categories'@@ -1161,6 +1224,13 @@ declare module '@tanstack/react-router' {preLoaderRoute: typeof CustomersCustomerIdRouteImportparentRoute: typeof authenticatedStoreIdRoute}+ '/_authenticated/$storeId/companies/$companyId': {+ id: '/_authenticated/$storeId/companies/$companyId'+ path: '/companies/$companyId'+ fullPath: '/$storeId/companies/$companyId'+ preLoaderRoute: typeof CompaniesCompanyIdRouteImport+ parentRoute: typeof authenticatedStoreIdRoute+ }'/_authenticated/$storeId/brands/$brandId': {id: '/_authenticated/$storeId/brands/$brandId'path: '/brands/$brandId'@@ -1266,6 +1336,13 @@ declare module '@tanstack/react-router' {preLoaderRoute: typeof OrdersOrderIdEditRouteImportparentRoute: typeof authenticatedStoreIdRoute}+ '/_authenticated/$storeId/companies/locations/$locationId': {+ id: '/_authenticated/$storeId/companies/locations/$locationId'+ path: '/companies/locations/$locationId'+ fullPath: '/$storeId/companies/locations/$locationId'+ preLoaderRoute: typeof CompaniesLocationsDotlocationIdRouteImport+ parentRoute: typeof authenticatedStoreIdRoute+ }'/_authenticated/$storeId/settings/delivery-profiles/$profileId/': {id: '/_authenticated/$storeId/settings/delivery-profiles/$profileId/'path: '/delivery-profiles/$profileId'@@ -1313,6 +1390,7 @@ interface SettingsRouteChildren {SettingsStockLocationsRoute: typeof SettingsStockLocationsRouteSettingsStoreRoute: typeof SettingsStoreRouteSettingsTaxCategoriesRoute: typeof SettingsTaxCategoriesRoute+ SettingsTaxRatesRoute: typeof SettingsTaxRatesRouteSettingsIndexRoute: typeof SettingsIndexRouteSettingsWebhooksWebhookEndpointIdRoute: typeof SettingsWebhooksWebhookEndpointIdRouteSettingsDeliveryProfilesIndexRoute: typeof SettingsDeliveryProfilesIndexRoute@@ -1339,6 +1417,7 @@ const SettingsRouteChildren: SettingsRouteChildren = {SettingsStockLocationsRoute: SettingsStockLocationsRoute,SettingsStoreRoute: SettingsStoreRoute,SettingsTaxCategoriesRoute: SettingsTaxCategoriesRoute,+ SettingsTaxRatesRoute: SettingsTaxRatesRoute,SettingsIndexRoute: SettingsIndexRoute,SettingsWebhooksWebhookEndpointIdRoute:SettingsWebhooksWebhookEndpointIdRoute,@@ -1366,6 +1445,7 @@ interface authenticatedStoreIdRouteChildren {SettingsRoute: typeof SettingsRouteWithChildrenIndexRoute: typeof IndexRouteBrandsDotbrandIdRoute: typeof BrandsDotbrandIdRoute+ CompaniesCompanyIdRoute: typeof CompaniesCompanyIdRouteCustomersCustomerIdRoute: typeof CustomersCustomerIdRouteCustomersGroupsRoute: typeof CustomersGroupsRouteOrdersDraftsRoute: typeof OrdersDraftsRoute@@ -1378,10 +1458,12 @@ interface authenticatedStoreIdRouteChildren {PromotionsGiftCardsRoute: typeof PromotionsGiftCardsRoutePromotionsNewRoute: typeof PromotionsNewRouteBrandsDotindexRoute: typeof BrandsDotindexRoute+ CompaniesIndexRoute: typeof CompaniesIndexRouteCustomersIndexRoute: typeof CustomersIndexRouteOrdersIndexRoute: typeof OrdersIndexRouteProductsIndexRoute: typeof ProductsIndexRoutePromotionsIndexRoute: typeof PromotionsIndexRoute+ CompaniesLocationsDotlocationIdRoute: typeof CompaniesLocationsDotlocationIdRouteOrdersOrderIdEditRoute: typeof OrdersOrderIdEditRouteProductsCategoriesCategoryIdRoute: typeof ProductsCategoriesCategoryIdRouteProductsCategoriesNewRoute: typeof ProductsCategoriesNewRoute@@ -1404,6 +1486,7 @@ const authenticatedStoreIdRouteChildren: authenticatedStoreIdRouteChildren = {SettingsRoute: SettingsRouteWithChildren,IndexRoute: IndexRoute,BrandsDotbrandIdRoute: BrandsDotbrandIdRoute,+ CompaniesCompanyIdRoute: CompaniesCompanyIdRoute,CustomersCustomerIdRoute: CustomersCustomerIdRoute,CustomersGroupsRoute: CustomersGroupsRoute,OrdersDraftsRoute: OrdersDraftsRoute,@@ -1416,10 +1499,12 @@ const authenticatedStoreIdRouteChildren: authenticatedStoreIdRouteChildren = {PromotionsGiftCardsRoute: PromotionsGiftCardsRoute,PromotionsNewRoute: PromotionsNewRoute,BrandsDotindexRoute: BrandsDotindexRoute,+ CompaniesIndexRoute: CompaniesIndexRoute,CustomersIndexRoute: CustomersIndexRoute,OrdersIndexRoute: OrdersIndexRoute,ProductsIndexRoute: ProductsIndexRoute,PromotionsIndexRoute: PromotionsIndexRoute,+ CompaniesLocationsDotlocationIdRoute: CompaniesLocationsDotlocationIdRoute,OrdersOrderIdEditRoute: OrdersOrderIdEditRoute,ProductsCategoriesCategoryIdRoute: ProductsCategoriesCategoryIdRoute,ProductsCategoriesNewRoute: ProductsCategoriesNewRoute,diff --git a/packages/dashboard-ui/src/ui/badge.tsx b/packages/dashboard-ui/src/ui/badge.tsxindex e6a74b9525..292343d6b9 100644--- a/packages/dashboard-ui/src/ui/badge.tsx+++ b/packages/dashboard-ui/src/ui/badge.tsx@@ -76,6 +76,12 @@ const statusVariantMap: Record<string, VariantProps<typeof badgeVariants>['variaunfulfilled: 'warning',published: 'success',approved: 'success',+ verified: 'success',+ unverified: 'destructive',+ unavailable: 'secondary',+ unsupported: 'secondary',+ revoked: 'destructive',+ expired: 'destructive',ready: 'warning',draft: 'outline',pending: 'warning',diff --git a/packages/dashboard/src/components/spree/company-location-sheet.tsx b/packages/dashboard/src/components/spree/company-location-sheet.tsxnew file mode 100644index 0000000000..c895b1f169--- /dev/null+++ b/packages/dashboard/src/components/spree/company-location-sheet.tsx@@ -0,0 +1,314 @@+import { zodResolver } from '@hookform/resolvers/zod'+import type { CompanyLocation } from '@spree/admin-sdk'+import {+ CountryCombobox,+ mapSpreeErrorsToForm,+ StateCombobox,+ useCountryStates,+} from '@spree/dashboard-core'+import {+ Button,+ Checkbox,+ Field,+ FieldDescription,+ FieldError,+ FieldGroup,+ FieldLabel,+ Input,+ Sheet,+ SheetContent,+ SheetDescription,+ SheetFooter,+ SheetHeader,+ SheetTitle,+} from '@spree/dashboard-ui'+import { useEffect } from 'react'+import { Controller, type UseFormReturn, useForm } from 'react-hook-form'+import { useTranslation } from 'react-i18next'+import { useCreateCompanyLocation, useUpdateCompanyLocation } from '../../hooks/use-companies'+import {+ addressesMatch,+ COMPANY_LOCATION_DEFAULTS,+ type CompanyLocationFormValues,+ companyLocationFormSchema,+ companyLocationValuesToParams,+} from '../../schemas/company'++/**+ * Creates a branch under a company, or edits one addressed by its own id. A+ * branch carries both a billing and a shipping address because the business+ * it is invoiced at is not always where the goods go.+ */+export function CompanyLocationSheet({+ companyId,+ location,+ open,+ onOpenChange,+}: {+ companyId: string+ location?: CompanyLocation+ open: boolean+ onOpenChange: (open: boolean) => void+}) {+ const { t } = useTranslation()+ const createMutation = useCreateCompanyLocation(companyId)+ const updateMutation = useUpdateCompanyLocation(location?.id ?? '', companyId)++ const form = useForm<CompanyLocationFormValues>({+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ resolver: zodResolver(companyLocationFormSchema) as any,+ defaultValues: COMPANY_LOCATION_DEFAULTS,+ })++ useEffect(() => {+ if (!open) return+ if (!location) {+ form.reset(COMPANY_LOCATION_DEFAULTS)+ return+ }++ const billing = addressToForm(location.billing_address)+ const shipping = addressToForm(location.shipping_address)+ form.reset({+ name: location.name,+ external_id: location.external_id ?? '',+ billing_address: billing,+ shipping_address: shipping,+ // A branch saved with matching addresses reopens with the box ticked, so+ // editing the billing address keeps carrying both.+ shipping_same_as_billing: addressesMatch(billing, shipping),+ })+ }, [open, location, form])++ const sameAsBilling = form.watch('shipping_same_as_billing')++ async function handleSubmit(values: CompanyLocationFormValues) {+ try {+ const params = companyLocationValuesToParams(values)+ if (location) {+ await updateMutation.mutateAsync(params)+ } else {+ await createMutation.mutateAsync(params)+ }+ onOpenChange(false)+ } catch (err) {+ if (!mapSpreeErrorsToForm(err, form.setError)) throw err+ }+ }++ const { errors } = form.formState++ return (+ <Sheet open={open} onOpenChange={onOpenChange}>+ <SheetContent className="sm:max-w-2xl">+ <SheetHeader>+ <SheetTitle>+ {location+ ? t('admin.company_locations.edit_title')+ : t('admin.company_locations.add_title')}+ </SheetTitle>+ <SheetDescription>{t('admin.company_locations.dialog_description')}</SheetDescription>+ </SheetHeader>+ <form+ onSubmit={(event) => {+ form.handleSubmit(handleSubmit)(event)+ event.stopPropagation()+ }}+ className="flex min-h-0 flex-1 flex-col"+ >+ <div className="flex flex-1 flex-col gap-4 overflow-y-auto p-4">+ <FieldGroup>+ {errors.root?.message && (+ <p className="text-destructive text-sm" role="alert">+ {errors.root.message}+ </p>+ )}++ <Field>+ <FieldLabel htmlFor="location-name">{t('admin.fields.name.label')}</FieldLabel>+ <Input+ id="location-name"+ autoFocus+ placeholder={t('admin.fields.company_location.name.placeholder')}+ aria-invalid={!!errors.name || undefined}+ {...form.register('name')}+ />+ <FieldError errors={[errors.name]} />+ </Field>++ <Field>+ <FieldLabel htmlFor="location-external-id">+ {t('admin.fields.external_id.label')}+ </FieldLabel>+ <Input id="location-external-id" {...form.register('external_id')} />+ <FieldDescription>+ {t('admin.fields.company_location.external_id.help')}+ </FieldDescription>+ </Field>++ <AddressFieldset+ form={form}+ prefix="billing_address"+ legend={t('admin.company_locations.billing_address')}+ />++ <Controller+ name="shipping_same_as_billing"+ control={form.control}+ render={({ field }) => (+ <label+ htmlFor="shipping-same-as-billing"+ className="flex cursor-pointer items-center gap-2 text-sm"+ >+ <Checkbox+ id="shipping-same-as-billing"+ checked={!!field.value}+ onCheckedChange={field.onChange}+ />+ {t('admin.company_locations.shipping_same_as_billing')}+ </label>+ )}+ />++ {!sameAsBilling && (+ <AddressFieldset+ form={form}+ prefix="shipping_address"+ legend={t('admin.company_locations.shipping_address')}+ />+ )}+ </FieldGroup>+ </div>+ <SheetFooter>+ <Button+ type="button"+ variant="outline"+ size="sm"+ onClick={() => onOpenChange(false)}+ disabled={form.formState.isSubmitting}+ >+ {t('admin.actions.cancel')}+ </Button>+ <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>+ {form.formState.isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}+ </Button>+ </SheetFooter>+ </form>+ </SheetContent>+ </Sheet>+ )+}++function addressToForm(address: CompanyLocation['billing_address'] | undefined) {+ return {+ first_name: address?.first_name ?? '',+ last_name: address?.last_name ?? '',+ company: address?.company ?? '',+ address1: address?.address1 ?? '',+ address2: address?.address2 ?? '',+ city: address?.city ?? '',+ postal_code: address?.postal_code ?? '',+ phone: address?.phone ?? '',+ country_iso: address?.country_iso ?? '',+ state_abbr: address?.state_abbr ?? '',+ }+}++function AddressFieldset({+ form,+ prefix,+ legend,+}: {+ form: UseFormReturn<CompanyLocationFormValues>+ prefix: 'billing_address' | 'shipping_address'+ legend: string+}) {+ const { t } = useTranslation()+ const countryIso = form.watch(`${prefix}.country_iso`)+ const { states } = useCountryStates(countryIso)++ return (+ <fieldset className="flex flex-col gap-4 rounded-md border p-4">+ <legend className="px-1 font-medium text-sm">{legend}</legend>++ <div className="grid gap-4 sm:grid-cols-2">+ <Field>+ <FieldLabel htmlFor={`${prefix}-first-name`}>+ {t('admin.fields.first_name.label')}+ </FieldLabel>+ <Input id={`${prefix}-first-name`} {...form.register(`${prefix}.first_name`)} />+ </Field>+ <Field>+ <FieldLabel htmlFor={`${prefix}-last-name`}>+ {t('admin.fields.last_name.label')}+ </FieldLabel>+ <Input id={`${prefix}-last-name`} {...form.register(`${prefix}.last_name`)} />+ </Field>+ </div>++ <Field>+ <FieldLabel htmlFor={`${prefix}-address1`}>{t('admin.fields.address1.label')}</FieldLabel>+ <Input id={`${prefix}-address1`} {...form.register(`${prefix}.address1`)} />+ </Field>++ <Field>+ <FieldLabel htmlFor={`${prefix}-address2`}>{t('admin.fields.address2.label')}</FieldLabel>+ <Input id={`${prefix}-address2`} {...form.register(`${prefix}.address2`)} />+ </Field>++ <div className="grid gap-4 sm:grid-cols-2">+ <Field>+ <FieldLabel htmlFor={`${prefix}-city`}>{t('admin.fields.city.label')}</FieldLabel>+ <Input id={`${prefix}-city`} {...form.register(`${prefix}.city`)} />+ </Field>+ <Field>+ <FieldLabel htmlFor={`${prefix}-postal-code`}>+ {t('admin.fields.postal_code.label')}+ </FieldLabel>+ <Input id={`${prefix}-postal-code`} {...form.register(`${prefix}.postal_code`)} />+ </Field>+ </div>++ <div className="grid gap-4 sm:grid-cols-2">+ <Field>+ <FieldLabel htmlFor={`${prefix}-country`}>{t('admin.fields.country.label')}</FieldLabel>+ <Controller+ name={`${prefix}.country_iso`}+ control={form.control}+ render={({ field }) => (+ <CountryCombobox+ value={field.value}+ onValueChange={(iso) => {+ field.onChange(iso)+ form.setValue(`${prefix}.state_abbr`, '', { shouldDirty: true })+ }}+ />+ )}+ />+ </Field>+ {countryIso && states.length > 0 && (+ <Field>+ <FieldLabel htmlFor={`${prefix}-state`}>{t('admin.fields.state.label')}</FieldLabel>+ <Controller+ name={`${prefix}.state_abbr`}+ control={form.control}+ render={({ field }) => (+ <StateCombobox+ countryIso={countryIso}+ states={states}+ value={field.value}+ onValueChange={field.onChange}+ />+ )}+ />+ </Field>+ )}+ </div>++ <Field>+ <FieldLabel htmlFor={`${prefix}-phone`}>{t('admin.fields.phone.label')}</FieldLabel>+ <Input id={`${prefix}-phone`} {...form.register(`${prefix}.phone`)} />+ </Field>+ </fieldset>+ )+}diff --git a/packages/dashboard/src/components/spree/enterprise-upsell.tsx b/packages/dashboard/src/components/spree/enterprise-upsell.tsxnew file mode 100644index 0000000000..c42d515ccd--- /dev/null+++ b/packages/dashboard/src/components/spree/enterprise-upsell.tsx@@ -0,0 +1,41 @@+import { Alert, AlertDescription, AlertTitle } from '@spree/dashboard-ui'+import { ExternalLinkIcon, SparklesIcon } from 'lucide-react'+import { useTranslation } from 'react-i18next'++export const SPREE_ENTERPRISE_URL = 'https://spreecommerce.org/enterprise/'++/**+ * Marks a capability that open-source Spree deliberately stops short of, and+ * sends the merchant somewhere they can act on it. Kept as one component so+ * every such prompt in the dashboard reads the same and points at one URL.+ */+export function EnterpriseUpsell({+ title,+ description,+ className,+}: {+ title: string+ description: string+ className?: string+}) {+ const { t } = useTranslation()++ return (+ <Alert variant="info" className={className}>+ <SparklesIcon />+ <AlertTitle>{title}</AlertTitle>+ <AlertDescription className="flex flex-col items-start gap-1.5">+ {description}+ <a+ href={SPREE_ENTERPRISE_URL}+ target="_blank"+ rel="noopener noreferrer"+ className="inline-flex items-center gap-1 font-medium text-current underline underline-offset-3"+ >+ {t('admin.enterprise.learn_more')}+ <ExternalLinkIcon className="size-3.5" />+ </a>+ </AlertDescription>+ </Alert>+ )+}diff --git a/packages/dashboard/src/components/spree/jurisdiction-label.tsx b/packages/dashboard/src/components/spree/jurisdiction-label.tsxnew file mode 100644index 0000000000..094f5d1bb6--- /dev/null+++ b/packages/dashboard/src/components/spree/jurisdiction-label.tsx@@ -0,0 +1,24 @@+import { useDisplayName } from '@spree/dashboard-core'+import { useTranslation } from 'react-i18next'++/**+ * Where a tax rate or exemption certificate applies. Both store the+ * jurisdiction as codes rather than country rows, and both treat "no country"+ * as everywhere rather than as missing data — so a blank pair reads as a+ * worldwide scope, never as a dash.+ */+export function JurisdictionLabel({+ countryIso,+ stateCode,+}: {+ countryIso?: string | null+ stateCode?: string | null+}) {+ const { t } = useTranslation()+ const regionName = useDisplayName('region')++ if (!countryIso) return <>{t('admin.jurisdiction.everywhere')}</>++ const country = regionName(countryIso) ?? countryIso+ return <>{stateCode ? `${country} — ${stateCode}` : country}</>+}diff --git a/packages/dashboard/src/components/spree/tax-category-label.tsx b/packages/dashboard/src/components/spree/tax-category-label.tsxnew file mode 100644index 0000000000..8f42d14c10--- /dev/null+++ b/packages/dashboard/src/components/spree/tax-category-label.tsx@@ -0,0 +1,15 @@+import { useTaxCategories } from '../../hooks/use-tax-categories'++/**+ * Names the category a tax rate is bound to. The rate serializer carries only+ * the id, so the name is resolved from the categories list — cached and shared+ * across every row, so this costs one request per page rather than one per rate.+ */+export function TaxCategoryLabel({ id }: { id?: string | null }) {+ const { data } = useTaxCategories({ limit: 100 })++ if (!id) return <>—</>++ const category = data?.data?.find((taxCategory) => taxCategory.id === id)+ return <>{category?.name ?? id}</>+}diff --git a/packages/dashboard/src/components/spree/tax-exemption-certificates-card.tsx b/packages/dashboard/src/components/spree/tax-exemption-certificates-card.tsxnew file mode 100644index 0000000000..8f9723bd44--- /dev/null+++ b/packages/dashboard/src/components/spree/tax-exemption-certificates-card.tsx@@ -0,0 +1,561 @@+import { zodResolver } from '@hookform/resolvers/zod'+import type { TaxExemptionCertificate } from '@spree/admin-sdk'+import {+ CountryCombobox,+ downloadFromApi,+ FileUploadField,+ formatFileSize,+ mapSpreeErrorsToForm,+ StateCombobox,+ StoreDatePicker,+ useAuth,+ useCountryStates,+ useStore,+} from '@spree/dashboard-core'+import {+ Badge,+ Button,+ Card,+ CardAction,+ CardContent,+ CardHeader,+ CardTitle,+ Combobox,+ ComboboxContent,+ ComboboxEmpty,+ ComboboxInput,+ ComboboxItem,+ ComboboxList,+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuTrigger,+ Field,+ FieldDescription,+ FieldError,+ FieldGroup,+ FieldLabel,+ Input,+ Sheet,+ SheetContent,+ SheetDescription,+ SheetFooter,+ SheetHeader,+ SheetTitle,+ StatusBadge,+ useConfirm,+} from '@spree/dashboard-ui'+import { parseISO } from 'date-fns'+import { formatInTimeZone } from 'date-fns-tz'+import {+ BadgeCheckIcon,+ BanIcon,+ DownloadIcon,+ EllipsisVerticalIcon,+ PaperclipIcon,+ PlusIcon,+ TrashIcon,+} from 'lucide-react'+import { useEffect, useState } from 'react'+import { Controller, useForm } from 'react-hook-form'+import { useTranslation } from 'react-i18next'+import {+ useCreateTaxExemptionCertificate,+ useDeleteTaxExemptionCertificate,+ useRevokeTaxExemptionCertificate,+ useTaxExemptionCertificates,+ useVerifyTaxExemptionCertificate,+} from '../../hooks/use-companies'+import {+ TAX_EXEMPTION_CERTIFICATE_DEFAULTS,+ TAX_EXEMPTION_REASON_CODES,+ type TaxExemptionCertificateFormValues,+ taxExemptionCertificateFormSchema,+ taxExemptionCertificateValuesToParams,+} from '../../schemas/company'+import { JurisdictionLabel } from './jurisdiction-label'++/**+ * Certificate dates are days, not moments — render them in the store's+ * timezone without a time part so an expiry never reads as the day before.+ */+function StoreDate({ iso }: { iso: string }) {+ const { timezone } = useStore()+ return <>{formatInTimeZone(parseISO(iso), timezone, 'PP')}</>+}++/** One selectable exemption reason. */+interface ReasonOption {+ value: string+ label: string+}++/**+ * Evidence that this business's purchases are not taxed. Accepting or+ * withdrawing one is a decision rather than an edit, so each is its own action+ * — and a certificate that has been acted on is revoked, never deleted.+ */+export function TaxExemptionCertificatesCard({+ companyId,+ canEdit,+}: {+ companyId: string+ canEdit: boolean+}) {+ const { t } = useTranslation()+ const confirm = useConfirm()+ const { token } = useAuth()+ const { data, isLoading } = useTaxExemptionCertificates(companyId)+ const verifyMutation = useVerifyTaxExemptionCertificate(companyId)+ const revokeMutation = useRevokeTaxExemptionCertificate(companyId)+ const deleteMutation = useDeleteTaxExemptionCertificate(companyId)+ const [addOpen, setAddOpen] = useState(false)++ const certificates = data?.data ?? []++ async function handleRevoke(certificate: TaxExemptionCertificate) {+ const ok = await confirm({+ title: t('admin.tax_exemption_certificates.revoke_confirm.title'),+ message: t('admin.tax_exemption_certificates.revoke_confirm.message', {+ number: certificate.certificate_number,+ }),+ variant: 'destructive',+ confirmLabel: t('admin.tax_exemption_certificates.revoke_action'),+ })+ if (!ok) return+ await revokeMutation.mutateAsync(certificate.id).catch(() => undefined)+ }++ async function handleDelete(certificate: TaxExemptionCertificate) {+ const ok = await confirm({+ title: t('admin.tax_exemption_certificates.delete_confirm.title'),+ message: t('admin.tax_exemption_certificates.delete_confirm.message', {+ number: certificate.certificate_number,+ }),+ variant: 'destructive',+ confirmLabel: t('admin.actions.delete'),+ })+ if (!ok) return+ await deleteMutation.mutateAsync(certificate.id).catch(() => undefined)+ }++ async function handleDownload(certificate: TaxExemptionCertificate) {+ if (!certificate.document_url) return+ // Streamed through the admin endpoint rather than a public blob URL, so+ // the request has to carry the admin's credentials.+ await downloadFromApi(+ token,+ certificate.document_url,+ certificate.document_filename ?? 'certificate',+ )+ }++ return (+ <Card>+ <CardHeader>+ <CardTitle>+ {t('admin.tax_exemption_certificates.title')}+ {certificates.length > 0 && <Badge variant="outline">{certificates.length}</Badge>}+ </CardTitle>+ {canEdit && (+ <CardAction>+ <Button size="sm" variant="outline" onClick={() => setAddOpen(true)}>+ <PlusIcon className="size-4" />+ {t('admin.tax_exemption_certificates.add_cta')}+ </Button>+ </CardAction>+ )}+ </CardHeader>++ {isLoading ? (+ <CardContent>+ <p className="text-muted-foreground text-sm">{t('admin.common.loading')}</p>+ </CardContent>+ ) : certificates.length === 0 ? (+ <CardContent>+ <p className="text-muted-foreground text-sm">+ {t('admin.tax_exemption_certificates.empty')}+ </p>+ </CardContent>+ ) : (+ <CardContent className="flex flex-col gap-3">+ {certificates.map((certificate) => (+ <div+ key={certificate.id}+ className="flex items-start justify-between gap-3 rounded-md border p-3"+ >+ <div className="flex min-w-0 flex-col gap-1">+ <div className="flex flex-wrap items-center gap-2">+ <span className="font-medium text-sm">{certificate.certificate_number}</span>+ <StatusBadge+ status={certificate.status}+ label={t(`admin.tax_exemption_certificates.status.${certificate.status}`, {+ defaultValue: certificate.status,+ })}+ />+ {certificate.lapsed && certificate.status !== 'expired' && (+ <Badge variant="destructive">+ {t('admin.tax_exemption_certificates.lapsed')}+ </Badge>+ )}+ </div>+ <span className="text-muted-foreground text-xs">+ {t(`admin.tax_exemption_certificates.reason_codes.${certificate.reason_code}`, {+ defaultValue: certificate.reason_code,+ })}+ {' · '}+ <JurisdictionLabel+ countryIso={certificate.country_iso}+ stateCode={certificate.state_code}+ />+ </span>++ <dl className="mt-1 grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-xs">+ {certificate.issuing_authority && (+ <>+ <dt className="text-muted-foreground">+ {t('admin.fields.issuing_authority.label')}+ </dt>+ <dd>{certificate.issuing_authority}</dd>+ </>+ )}+ {certificate.issued_at && (+ <>+ <dt className="text-muted-foreground">{t('admin.fields.issued_at.label')}</dt>+ <dd>+ <StoreDate iso={certificate.issued_at} />+ </dd>+ </>+ )}+ <dt className="text-muted-foreground">{t('admin.fields.expires_at.label')}</dt>+ <dd>+ {certificate.expires_at ? (+ <StoreDate iso={certificate.expires_at} />+ ) : (+ t('admin.tax_exemption_certificates.never_expires')+ )}+ </dd>+ {certificate.verified_at && (+ <>+ <dt className="text-muted-foreground">+ {t('admin.tax_exemption_certificates.verified_at')}+ </dt>+ <dd>+ <StoreDate iso={certificate.verified_at} />+ </dd>+ </>+ )}+ </dl>++ {certificate.document_filename ? (+ <Button+ type="button"+ variant="link"+ size="sm"+ className="h-auto justify-start p-0 text-xs"+ onClick={() => handleDownload(certificate)}+ >+ <PaperclipIcon className="size-3" />+ {certificate.document_filename}+ {certificate.document_byte_size ? (+ <span className="text-muted-foreground">+ ({formatFileSize(certificate.document_byte_size)})+ </span>+ ) : null}+ </Button>+ ) : (+ <span className="text-muted-foreground text-xs">+ {t('admin.tax_exemption_certificates.no_document')}+ </span>+ )}+ </div>++ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <Button variant="ghost" size="icon-xs">+ <EllipsisVerticalIcon className="size-4" />+ </Button>+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end">+ {certificate.document_url && (+ <DropdownMenuItem onClick={() => handleDownload(certificate)}>+ <DownloadIcon className="size-4" />+ {t('admin.tax_exemption_certificates.download_action')}+ </DropdownMenuItem>+ )}+ {canEdit && certificate.status === 'pending' && (+ <DropdownMenuItem+ disabled={verifyMutation.isPending}+ onClick={() =>+ verifyMutation.mutateAsync(certificate.id).catch(() => undefined)+ }+ >+ <BadgeCheckIcon className="size-4" />+ {t('admin.tax_exemption_certificates.verify_action')}+ </DropdownMenuItem>+ )}+ {canEdit && certificate.status !== 'revoked' && (+ <DropdownMenuItem+ className="text-destructive focus:text-destructive"+ disabled={revokeMutation.isPending}+ onClick={() => handleRevoke(certificate)}+ >+ <BanIcon className="size-4" />+ {t('admin.tax_exemption_certificates.revoke_action')}+ </DropdownMenuItem>+ )}+ {canEdit && certificate.can_be_deleted && (+ <DropdownMenuItem+ className="text-destructive focus:text-destructive"+ onClick={() => handleDelete(certificate)}+ >+ <TrashIcon className="size-4" />+ {t('admin.actions.delete')}+ </DropdownMenuItem>+ )}+ </DropdownMenuContent>+ </DropdownMenu>+ </div>+ ))}+ </CardContent>+ )}++ {addOpen && <CertificateSheet companyId={companyId} open onOpenChange={setAddOpen} />}+ </Card>+ )+}++function CertificateSheet({+ companyId,+ open,+ onOpenChange,+}: {+ companyId: string+ open: boolean+ onOpenChange: (open: boolean) => void+}) {+ const { t } = useTranslation()+ const createMutation = useCreateTaxExemptionCertificate(companyId)+ const form = useForm<TaxExemptionCertificateFormValues>({+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ resolver: zodResolver(taxExemptionCertificateFormSchema) as any,+ defaultValues: TAX_EXEMPTION_CERTIFICATE_DEFAULTS,+ })++ useEffect(() => {+ if (open) form.reset(TAX_EXEMPTION_CERTIFICATE_DEFAULTS)+ }, [open, form])++ const countryIso = form.watch('country_iso')+ const { states } = useCountryStates(countryIso)++ async function handleSubmit(values: TaxExemptionCertificateFormValues) {+ try {+ await createMutation.mutateAsync(taxExemptionCertificateValuesToParams(values))+ onOpenChange(false)+ } catch (err) {+ if (!mapSpreeErrorsToForm(err, form.setError)) throw err+ }+ }++ const { errors } = form.formState++ return (+ <Sheet open={open} onOpenChange={onOpenChange}>+ <SheetContent>+ <SheetHeader>+ <SheetTitle>{t('admin.tax_exemption_certificates.add_title')}</SheetTitle>+ <SheetDescription>+ {t('admin.tax_exemption_certificates.dialog_description')}+ </SheetDescription>+ </SheetHeader>+ <form+ onSubmit={(event) => {+ form.handleSubmit(handleSubmit)(event)+ event.stopPropagation()+ }}+ className="flex min-h-0 flex-1 flex-col"+ >+ <div className="flex flex-1 flex-col gap-4 overflow-y-auto p-4">+ <FieldGroup>+ {errors.root?.message && (+ <p className="text-destructive text-sm" role="alert">+ {errors.root.message}+ </p>+ )}++ <Field>+ <FieldLabel htmlFor="certificate_number">+ {t('admin.fields.certificate_number.label')}+ </FieldLabel>+ <Input+ id="certificate_number"+ autoFocus+ aria-invalid={!!errors.certificate_number || undefined}+ {...form.register('certificate_number')}+ />+ <FieldError errors={[errors.certificate_number]} />+ </Field>++ <Field>+ <FieldLabel htmlFor="reason_code">{t('admin.fields.reason_code.label')}</FieldLabel>+ <Controller+ name="reason_code"+ control={form.control}+ render={({ field }) => {+ const reasonOptions = TAX_EXEMPTION_REASON_CODES.map((code) => ({+ value: code,+ label: t(`admin.tax_exemption_certificates.reason_codes.${code}`, {+ defaultValue: code,+ }),+ }))+ const selected = reasonOptions.find((o) => o.value === field.value) ?? null+ return (+ <Combobox+ items={reasonOptions}+ value={selected}+ onValueChange={(option: ReasonOption | null) =>+ field.onChange(option?.value ?? '')+ }+ itemToStringLabel={(option: ReasonOption | null) => option?.label ?? ''}+ itemToStringValue={(option: ReasonOption | null) => option?.value ?? ''}+ >+ <ComboboxInput+ id="reason_code"+ placeholder={t('admin.tax_exemption_certificates.select_reason')}+ />+ <ComboboxContent>+ <ComboboxEmpty>{t('admin.common.no_results')}</ComboboxEmpty>+ <ComboboxList>+ {(option: ReasonOption) => (+ <ComboboxItem key={option.value} value={option}>+ {option.label}+ </ComboboxItem>+ )}+ </ComboboxList>+ </ComboboxContent>+ </Combobox>+ )+ }}+ />+ <FieldDescription>{t('admin.fields.reason_code.help')}</FieldDescription>+ <FieldError errors={[errors.reason_code]} />+ </Field>++ <Field>+ <FieldLabel htmlFor="certificate-country">+ {t('admin.fields.country.label')}+ </FieldLabel>+ <Controller+ name="country_iso"+ control={form.control}+ render={({ field }) => (+ <CountryCombobox+ value={field.value}+ onValueChange={(iso) => {+ field.onChange(iso)+ form.setValue('state_code', '', { shouldDirty: true })+ }}+ placeholder={t('admin.jurisdiction.everywhere')}+ />+ )}+ />+ <FieldDescription>+ {t('admin.fields.tax_exemption_certificate.country_iso.help')}+ </FieldDescription>+ </Field>++ {countryIso && states.length > 0 && (+ <Field>+ <FieldLabel htmlFor="certificate-state">+ {t('admin.fields.state.label')}+ </FieldLabel>+ <Controller+ name="state_code"+ control={form.control}+ render={({ field }) => (+ <StateCombobox+ countryIso={countryIso}+ states={states}+ value={field.value}+ onValueChange={field.onChange}+ />+ )}+ />+ </Field>+ )}++ <Field>+ <FieldLabel htmlFor="issued_at">{t('admin.fields.issued_at.label')}</FieldLabel>+ <Controller+ name="issued_at"+ control={form.control}+ render={({ field }) => (+ <StoreDatePicker inline value={field.value} onChange={field.onChange} />+ )}+ />+ </Field>++ <Field>+ <FieldLabel htmlFor="expires_at">{t('admin.fields.expires_at.label')}</FieldLabel>+ <Controller+ name="expires_at"+ control={form.control}+ render={({ field }) => (+ <StoreDatePicker inline value={field.value} onChange={field.onChange} />+ )}+ />+ <FieldDescription>+ {t('admin.fields.tax_exemption_certificate.expires_at.help')}+ </FieldDescription>+ </Field>++ <Field>+ <FieldLabel htmlFor="issuing_authority">+ {t('admin.fields.issuing_authority.label')}+ </FieldLabel>+ <Input id="issuing_authority" {...form.register('issuing_authority')} />+ </Field>++ <Field>+ <FieldLabel>{t('admin.fields.certificate_document.label')}</FieldLabel>+ <Controller+ name="document_signed_id"+ control={form.control}+ render={({ field }) => (+ <FileUploadField+ value={{+ signedId: field.value ?? null,+ previewUrl: null,+ cleared: false,+ }}+ onChange={(next) => field.onChange(next.signedId)}+ accept="application/pdf,image/png,image/jpeg"+ />+ )}+ />+ <FieldDescription>{t('admin.fields.certificate_document.help')}</FieldDescription>+ </Field>+ </FieldGroup>+ </div>+ <SheetFooter>+ <Button+ type="button"+ variant="outline"+ size="sm"+ onClick={() => onOpenChange(false)}+ disabled={form.formState.isSubmitting}+ >+ {t('admin.actions.cancel')}+ </Button>+ <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>+ {form.formState.isSubmitting+ ? t('admin.actions.creating')+ : t('admin.actions.create')}+ </Button>+ </SheetFooter>+ </form>+ </SheetContent>+ </Sheet>+ )+}diff --git a/packages/dashboard/src/components/spree/tax-identifiers-card.tsx b/packages/dashboard/src/components/spree/tax-identifiers-card.tsxnew file mode 100644index 0000000000..4d8d77f3b9--- /dev/null+++ b/packages/dashboard/src/components/spree/tax-identifiers-card.tsx@@ -0,0 +1,373 @@+import { zodResolver } from '@hookform/resolvers/zod'+import type { TaxIdentifier, TaxIdentifierParams } from '@spree/admin-sdk'+import { mapSpreeErrorsToForm } from '@spree/dashboard-core'+import {+ Badge,+ Button,+ Card,+ CardAction,+ CardContent,+ CardHeader,+ CardTitle,+ Combobox,+ ComboboxContent,+ ComboboxEmpty,+ ComboboxInput,+ ComboboxItem,+ ComboboxList,+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuTrigger,+ Field,+ FieldDescription,+ FieldError,+ FieldGroup,+ FieldLabel,+ Input,+ RelativeTime,+ Sheet,+ SheetContent,+ SheetDescription,+ SheetFooter,+ SheetHeader,+ SheetTitle,+ StatusBadge,+ useConfirm,+} from '@spree/dashboard-ui'+import { BadgeCheckIcon, EllipsisVerticalIcon, PencilIcon, PlusIcon, TrashIcon } from 'lucide-react'+import { useEffect, useState } from 'react'+import { Controller, useForm } from 'react-hook-form'+import { useTranslation } from 'react-i18next'+import {+ TAX_IDENTIFIER_DEFAULTS,+ TAX_IDENTIFIER_KINDS,+ type TaxIdentifierFormValues,+ taxIdentifierFormSchema,+ taxIdentifierValuesToParams,+} from '../../schemas/company'++/** One selectable registration kind. */+interface KindOption {+ value: string+ label: string+}++/**+ * Mutations differ by owner (a company's registrations hang off the company,+ * a customer's off the customer) while the panel itself does not — so the+ * owner supplies them and this stays one component.+ */+export interface TaxIdentifierMutations {+ create: (params: TaxIdentifierParams) => Promise<unknown>+ update: (id: string, params: TaxIdentifierParams) => Promise<unknown>+ remove: (id: string) => Promise<unknown>+ validate: (id: string) => Promise<unknown>+ isValidating?: boolean+}++/**+ * The buyer's VAT or business number. What makes EU B2B reverse charge+ * possible, so the verdict matters as much as the number: a row nothing can+ * check reads as such rather than as merely unverified.+ */+export function TaxIdentifiersCard({+ identifiers,+ isLoading,+ mutations,+ canEdit,+}: {+ identifiers: TaxIdentifier[]+ isLoading?: boolean+ mutations: TaxIdentifierMutations+ canEdit: boolean+}) {+ const { t } = useTranslation()+ const confirm = useConfirm()+ const [addOpen, setAddOpen] = useState(false)+ const [editing, setEditing] = useState<TaxIdentifier | null>(null)++ async function handleDelete(identifier: TaxIdentifier) {+ const ok = await confirm({+ title: t('admin.tax_identifiers.delete_confirm.title'),+ message: t('admin.tax_identifiers.delete_confirm.message', { value: identifier.value }),+ variant: 'destructive',+ confirmLabel: t('admin.actions.delete'),+ })+ if (!ok) return+ await mutations.remove(identifier.id).catch(() => undefined)+ }++ return (+ <Card>+ <CardHeader>+ <CardTitle>+ {t('admin.tax_identifiers.title')}+ {identifiers.length > 0 && <Badge variant="outline">{identifiers.length}</Badge>}+ </CardTitle>+ {canEdit && (+ <CardAction>+ <Button size="sm" variant="outline" onClick={() => setAddOpen(true)}>+ <PlusIcon className="size-4" />+ {t('admin.tax_identifiers.add_cta')}+ </Button>+ </CardAction>+ )}+ </CardHeader>++ {isLoading ? (+ <CardContent>+ <p className="text-muted-foreground text-sm">{t('admin.common.loading')}</p>+ </CardContent>+ ) : identifiers.length === 0 ? (+ <CardContent>+ <p className="text-muted-foreground text-sm">{t('admin.tax_identifiers.empty')}</p>+ </CardContent>+ ) : (+ <CardContent className="flex flex-col gap-3">+ {identifiers.map((identifier) => (+ <div+ key={identifier.id}+ className="flex items-start justify-between gap-3 rounded-md border p-3"+ >+ <div className="flex min-w-0 flex-col gap-1">+ <div className="flex flex-wrap items-center gap-2">+ <span className="font-medium text-sm">{identifier.value}</span>+ <Badge variant="outline">+ {t(`admin.tax_identifiers.kinds.${identifier.kind}`, {+ defaultValue: identifier.kind,+ })}+ </Badge>+ {identifier.validation_status ? (+ <StatusBadge+ status={identifier.validation_status}+ label={t(+ `admin.tax_identifiers.validation_status.${identifier.validation_status}`,+ { defaultValue: identifier.validation_status },+ )}+ />+ ) : (+ <Badge variant="secondary">+ {t('admin.tax_identifiers.validation_status.not_checked')}+ </Badge>+ )}+ </div>+ {identifier.validated_at && (+ <span className="text-muted-foreground text-xs">+ <RelativeTime+ iso={identifier.validated_at}+ prefix={t('admin.tax_identifiers.checked_prefix')}+ />+ </span>+ )}+ {!identifier.validatable && (+ <span className="text-muted-foreground text-xs">+ {t('admin.tax_identifiers.not_validatable')}+ </span>+ )}+ </div>++ {canEdit && (+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <Button variant="ghost" size="icon-xs">+ <EllipsisVerticalIcon className="size-4" />+ </Button>+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end">+ <DropdownMenuItem+ disabled={!identifier.validatable || mutations.isValidating}+ onClick={() => mutations.validate(identifier.id).catch(() => undefined)}+ >+ <BadgeCheckIcon className="size-4" />+ {t('admin.tax_identifiers.validate_action')}+ </DropdownMenuItem>+ <DropdownMenuItem onClick={() => setEditing(identifier)}>+ <PencilIcon className="size-4" />+ {t('admin.actions.edit')}+ </DropdownMenuItem>+ <DropdownMenuItem+ className="text-destructive focus:text-destructive"+ onClick={() => handleDelete(identifier)}+ >+ <TrashIcon className="size-4" />+ {t('admin.actions.delete')}+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ )}+ </div>+ ))}+ </CardContent>+ )}++ {addOpen && (+ <TaxIdentifierSheet+ open+ onOpenChange={setAddOpen}+ onSubmit={(params) => mutations.create(params)}+ />+ )}+ {editing && (+ <TaxIdentifierSheet+ open+ identifier={editing}+ onOpenChange={(next) => {+ if (!next) setEditing(null)+ }}+ onSubmit={(params) => mutations.update(editing.id, params)}+ />+ )}+ </Card>+ )+}++function TaxIdentifierSheet({+ open,+ onOpenChange,+ identifier,+ onSubmit,+}: {+ open: boolean+ onOpenChange: (open: boolean) => void+ identifier?: TaxIdentifier+ onSubmit: (params: TaxIdentifierParams) => Promise<unknown>+}) {+ const { t } = useTranslation()+ const form = useForm<TaxIdentifierFormValues>({+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ resolver: zodResolver(taxIdentifierFormSchema) as any,+ defaultValues: TAX_IDENTIFIER_DEFAULTS,+ })++ useEffect(() => {+ if (open) {+ form.reset(+ identifier ? { kind: identifier.kind, value: identifier.value } : TAX_IDENTIFIER_DEFAULTS,+ )+ }+ }, [open, identifier, form])++ async function handleSubmit(values: TaxIdentifierFormValues) {+ try {+ await onSubmit(taxIdentifierValuesToParams(values))+ onOpenChange(false)+ } catch (err) {+ if (!mapSpreeErrorsToForm(err, form.setError)) throw err+ }+ }++ const { errors } = form.formState++ return (+ <Sheet open={open} onOpenChange={onOpenChange}>+ <SheetContent>+ <SheetHeader>+ <SheetTitle>+ {identifier+ ? t('admin.tax_identifiers.edit_title')+ : t('admin.tax_identifiers.add_title')}+ </SheetTitle>+ <SheetDescription>{t('admin.tax_identifiers.dialog_description')}</SheetDescription>+ </SheetHeader>+ <form+ onSubmit={(event) => {+ // This sheet can be rendered inside another form; stopping the+ // bubbled submit keeps the outer form from also submitting.+ form.handleSubmit(handleSubmit)(event)+ event.stopPropagation()+ }}+ className="flex min-h-0 flex-1 flex-col"+ >+ <div className="flex flex-1 flex-col gap-4 overflow-y-auto p-4">+ <FieldGroup>+ {errors.root?.message && (+ <p className="text-destructive text-sm" role="alert">+ {errors.root.message}+ </p>+ )}+ <Field>+ <FieldLabel htmlFor="tax-identifier-kind">+ {t('admin.fields.tax_identifier.kind.label')}+ </FieldLabel>+ {/* A constrained list, not free text: the kind has to match the+ key its validator is registered under, and a typo would be+ stored and used as entered rather than rejected. */}+ <Controller+ name="kind"+ control={form.control}+ render={({ field }) => {+ // Combobox rather than Select: this card renders inside a+ // page card, and Base UI's Select popup does not survive+ // that portal nesting (the country picker below is a+ // Combobox for the same reason).+ const kindOptions = TAX_IDENTIFIER_KINDS.map((kind) => ({+ value: kind,+ label: t(`admin.tax_identifiers.kinds.${kind}`, { defaultValue: kind }),+ }))+ const selected = kindOptions.find((o) => o.value === field.value) ?? null+ return (+ <Combobox+ items={kindOptions}+ value={selected}+ onValueChange={(option: KindOption | null) =>+ field.onChange(option?.value ?? '')+ }+ itemToStringLabel={(option: KindOption | null) => option?.label ?? ''}+ itemToStringValue={(option: KindOption | null) => option?.value ?? ''}+ >+ <ComboboxInput+ id="tax-identifier-kind"+ placeholder={t('admin.tax_identifiers.select_kind')}+ />+ <ComboboxContent>+ <ComboboxEmpty>{t('admin.common.no_results')}</ComboboxEmpty>+ <ComboboxList>+ {(option: KindOption) => (+ <ComboboxItem key={option.value} value={option}>+ {option.label}+ </ComboboxItem>+ )}+ </ComboboxList>+ </ComboboxContent>+ </Combobox>+ )+ }}+ />+ <FieldDescription>{t('admin.fields.tax_identifier.kind.help')}</FieldDescription>+ <FieldError errors={[errors.kind]} />+ </Field>++ <Field>+ <FieldLabel htmlFor="tax-identifier-value">+ {t('admin.fields.tax_identifier.value.label')}+ </FieldLabel>+ <Input+ id="tax-identifier-value"+ placeholder={t('admin.fields.tax_identifier.value.placeholder')}+ aria-invalid={!!errors.value || undefined}+ {...form.register('value')}+ />+ <FieldError errors={[errors.value]} />+ </Field>+ </FieldGroup>+ </div>+ <SheetFooter>+ <Button+ type="button"+ variant="outline"+ size="sm"+ onClick={() => onOpenChange(false)}+ disabled={form.formState.isSubmitting}+ >+ {t('admin.actions.cancel')}+ </Button>+ <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>+ {form.formState.isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}+ </Button>+ </SheetFooter>+ </form>+ </SheetContent>+ </Sheet>+ )+}diff --git a/packages/dashboard/src/components/spree/tax-provider-field.tsx b/packages/dashboard/src/components/spree/tax-provider-field.tsxnew file mode 100644index 0000000000..67eadef458--- /dev/null+++ b/packages/dashboard/src/components/spree/tax-provider-field.tsx@@ -0,0 +1,122 @@+import {+ Alert,+ AlertDescription,+ AlertTitle,+ Field,+ FieldDescription,+ FieldLabel,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from '@spree/dashboard-ui'+import { TriangleAlertIcon } from 'lucide-react'+import { Controller, type UseFormReturn } from 'react-hook-form'+import { useTranslation } from 'react-i18next'+import { useTaxProviders } from '../../hooks/use-tax-rates'++/** One entry from `GET /tax_providers` — classes registered in code, not rows. */+interface TaxProviderOption {+ id: string+ name: string+ available: boolean+ default: boolean+ unsupported_capabilities?: Array<{ key: string; label: string; description?: string }>+}++/** Any form whose values carry a `tax_provider` string. */+interface TaxProviderFormShape {+ tax_provider?: string+}++/**+ * Picks the tax engine for a market, and — the reason this endpoint exists —+ * shows what the chosen engine cannot do. A merchant selling into US states+ * should be told at configuration time that the built-in engine has no local+ * tax data, rather than discovering it from a tax bill.+ */+export function TaxProviderField<T extends TaxProviderFormShape>({+ form,+}: {+ form: UseFormReturn<T>+}) {+ const { t } = useTranslation()+ const { data } = useTaxProviders()+ const providers = (data?.data ?? []) as unknown as TaxProviderOption[]++ const defaultProvider = providers.find((provider) => provider.default)+ const defaultLabel = defaultProvider+ ? t('admin.tax_providers.use_default_named', { name: defaultProvider.name })+ : t('admin.tax_providers.use_default')++ return (+ <Controller+ // The cast is the standard react-hook-form generic dance: the shape+ // guarantees the key exists, but Path<T> can't see that.+ name={'tax_provider' as never}+ control={form.control}+ render={({ field }) => {+ const selectedId = (field.value as string) || ''+ const selected = providers.find((provider) => provider.id === selectedId)+ // An unselected market runs on the installation default, so that is+ // whose limits apply.+ const effective = selected ?? defaultProvider+ const unsupported = effective?.unsupported_capabilities ?? []++ return (+ <Field>+ <FieldLabel htmlFor="market-tax-provider">+ {t('admin.fields.market.tax_provider.label')}+ </FieldLabel>+ <Select+ value={selectedId || 'default'}+ onValueChange={(value) => field.onChange(value === 'default' ? '' : value)}+ >+ <SelectTrigger id="market-tax-provider">+ <SelectValue>+ {(value) =>+ !value || value === 'default'+ ? defaultLabel+ : (providers.find((provider) => provider.id === value)?.name ??+ (value as string))+ }+ </SelectValue>+ </SelectTrigger>+ <SelectContent>+ <SelectItem value="default">{defaultLabel}</SelectItem>+ {providers.map((provider) => (+ <SelectItem key={provider.id} value={provider.id} disabled={!provider.available}>+ {provider.available+ ? provider.name+ : t('admin.tax_providers.unavailable_option', { name: provider.name })}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ <FieldDescription>{t('admin.fields.market.tax_provider.help')}</FieldDescription>++ {unsupported.length > 0 && (+ <Alert variant="warning" className="mt-1">+ <TriangleAlertIcon />+ <AlertTitle>+ {t('admin.tax_providers.limitations_title', { name: effective?.name ?? '' })}+ </AlertTitle>+ <AlertDescription>+ <ul className="flex list-disc flex-col gap-1 pl-4">+ {unsupported.map((capability) => (+ <li key={capability.key}>+ {capability.label}+ {capability.description ? ` — ${capability.description}` : ''}+ </li>+ ))}+ </ul>+ </AlertDescription>+ </Alert>+ )}+ </Field>+ )+ }}+ />+ )+}diff --git a/packages/dashboard/src/hooks/use-companies.ts b/packages/dashboard/src/hooks/use-companies.tsnew file mode 100644index 0000000000..427af055fb--- /dev/null+++ b/packages/dashboard/src/hooks/use-companies.ts@@ -0,0 +1,264 @@+import type {+ Company,+ CompanyContact,+ CompanyContactParams,+ CompanyLocation,+ CompanyLocationParams,+ CompanyParams,+ TaxExemptionCertificate,+ TaxExemptionCertificateParams,+ TaxIdentifier,+ TaxIdentifierParams,+} 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 useCompany(id: string | undefined) {+ return useQuery({+ queryKey: useResourceKey('companies', id ?? 'noop'),+ queryFn: () => adminClient.companies.get(id as string),+ enabled: !!id,+ })+}++export function useCreateCompany() {+ return useResourceMutation<Company, Error, CompanyParams>({+ mutationFn: (params) => adminClient.companies.create(params),+ invalidate: [['companies']],+ successMessage: i18n.t('admin.companies.messages.created'),+ errorMessage: i18n.t('admin.errors.failed_to_create'),+ })+}++export function useUpdateCompany(id: string) {+ return useResourceMutation<Company, Error, CompanyParams>({+ mutationFn: (params) => adminClient.companies.update(id, params),+ invalidate: [['companies'], ['companies', id]],+ successMessage: i18n.t('admin.companies.messages.updated'),+ errorMessage: i18n.t('admin.errors.failed_to_update'),+ })+}++export function useDeleteCompany() {+ const queryClient = useQueryClient()+ const buildKey = useResourceKeyBuilder()++ return useResourceMutation<void, Error, string>({+ mutationFn: (id) => adminClient.companies.delete(id),+ invalidate: [['companies']],+ successMessage: i18n.t('admin.companies.messages.deleted'),+ errorMessage: i18n.t('admin.errors.failed_to_delete'),+ onSuccess: (_data, id) => {+ queryClient.removeQueries({ queryKey: buildKey('companies', id) })+ },+ })+}++// ---------------------------------------------------------------------------+// Locations — listed and created under their company, then addressed by id+// ---------------------------------------------------------------------------++export function useCompanyLocations(companyId: string | undefined, page = 1, limit = 25) {+ return useQuery({+ queryKey: useResourceKey('companies', companyId ?? 'noop', 'locations', `${page}:${limit}`),+ queryFn: () => adminClient.companies.locations.list(companyId as string, { page, limit }),+ enabled: !!companyId,+ placeholderData: (previous) => previous,+ })+}++export function useCompanyLocation(id: string | undefined) {+ return useQuery({+ queryKey: useResourceKey('company-locations', id ?? 'noop'),+ queryFn: () => adminClient.companyLocations.get(id as string),+ enabled: !!id,+ })+}++export function useCreateCompanyLocation(companyId: string) {+ return useResourceMutation<CompanyLocation, Error, CompanyLocationParams>({+ mutationFn: (params) => adminClient.companies.locations.create(companyId, params),+ invalidate: [['companies', companyId, 'locations']],+ successMessage: i18n.t('admin.company_locations.messages.created'),+ errorMessage: i18n.t('admin.errors.failed_to_create'),+ })+}++export function useUpdateCompanyLocation(id: string, companyId?: string) {+ return useResourceMutation<CompanyLocation, Error, CompanyLocationParams>({+ mutationFn: (params) => adminClient.companyLocations.update(id, params),+ invalidate: [+ ['company-locations', id],+ ...(companyId ? [['companies', companyId, 'locations']] : []),+ ],+ successMessage: i18n.t('admin.company_locations.messages.updated'),+ errorMessage: i18n.t('admin.errors.failed_to_update'),+ })+}++export function useDeleteCompanyLocation(companyId?: string) {+ const queryClient = useQueryClient()+ const buildKey = useResourceKeyBuilder()++ return useResourceMutation<void, Error, string>({+ mutationFn: (id) => adminClient.companyLocations.delete(id),+ invalidate: companyId ? [['companies', companyId, 'locations']] : [],+ successMessage: i18n.t('admin.company_locations.messages.deleted'),+ errorMessage: i18n.t('admin.errors.failed_to_delete'),+ // Drop just this branch's cached detail; invalidating the whole+ // `company-locations` prefix would refetch every branch visited this session.+ onSuccess: (_data, id) => {+ queryClient.removeQueries({ queryKey: buildKey('company-locations', id) })+ },+ })+}++// ---------------------------------------------------------------------------+// Contacts — the buyers authorised to purchase for a branch+// ---------------------------------------------------------------------------++export function useCompanyLocationContacts(locationId: string | undefined, page = 1, limit = 25) {+ return useQuery({+ queryKey: useResourceKey(+ 'company-locations',+ locationId ?? 'noop',+ 'contacts',+ `${page}:${limit}`,+ ),+ queryFn: () =>+ adminClient.companyLocations.contacts.list(locationId as string, { page, limit }),+ enabled: !!locationId,+ placeholderData: (previous) => previous,+ })+}++export function useCreateCompanyContact(locationId: string) {+ return useResourceMutation<CompanyContact, Error, CompanyContactParams>({+ mutationFn: (params) => adminClient.companyLocations.contacts.create(locationId, params),+ invalidate: [['company-locations', locationId]],+ successMessage: i18n.t('admin.company_contacts.messages.created'),+ errorMessage: i18n.t('admin.errors.failed_to_create'),+ })+}++export function useDeleteCompanyContact(locationId: string) {+ return useResourceMutation<void, Error, string>({+ mutationFn: (id) => adminClient.companyContacts.delete(id),+ invalidate: [['company-locations', locationId]],+ successMessage: i18n.t('admin.company_contacts.messages.deleted'),+ errorMessage: i18n.t('admin.errors.failed_to_delete'),+ })+}++// ---------------------------------------------------------------------------+// Tax identifiers — the registration that goes on the business's invoices+// ---------------------------------------------------------------------------++export function useCompanyTaxIdentifiers(companyId: string | undefined) {+ return useQuery({+ queryKey: useResourceKey('companies', companyId ?? 'noop', 'tax-identifiers'),+ queryFn: () => adminClient.companies.taxIdentifiers.list(companyId as string),+ enabled: !!companyId,+ })+}++export function useCreateCompanyTaxIdentifier(companyId: string) {+ return useResourceMutation<TaxIdentifier, Error, TaxIdentifierParams>({+ mutationFn: (params) => adminClient.companies.taxIdentifiers.create(companyId, params),+ invalidate: [['companies', companyId, 'tax-identifiers']],+ successMessage: i18n.t('admin.tax_identifiers.messages.created'),+ errorMessage: i18n.t('admin.errors.failed_to_create'),+ })+}++/**+ * Which row is being edited is decided by the panel at call time, so the id+ * travels with the variables rather than being bound when the hook is created.+ */+export function useUpdateCompanyTaxIdentifier(companyId: string) {+ return useResourceMutation<TaxIdentifier, Error, { id: string; params: TaxIdentifierParams }>({+ mutationFn: ({ id, params }) =>+ adminClient.companies.taxIdentifiers.update(companyId, id, params),+ invalidate: [['companies', companyId, 'tax-identifiers']],+ successMessage: i18n.t('admin.tax_identifiers.messages.updated'),+ errorMessage: i18n.t('admin.errors.failed_to_update'),+ })+}++export function useDeleteCompanyTaxIdentifier(companyId: string) {+ return useResourceMutation<void, Error, string>({+ mutationFn: (id) => adminClient.companies.taxIdentifiers.delete(companyId, id),+ invalidate: [['companies', companyId, 'tax-identifiers']],+ successMessage: i18n.t('admin.tax_identifiers.messages.deleted'),+ errorMessage: i18n.t('admin.errors.failed_to_delete'),+ })+}++/**+ * Asks the registered validator to check the number with the tax authority.+ * The verdict comes back on the row, so the panel re-reads rather than+ * tracking it locally.+ */+export function useValidateCompanyTaxIdentifier(companyId: string) {+ return useResourceMutation<TaxIdentifier, Error, string>({+ mutationFn: (id) => adminClient.companies.taxIdentifiers.validate(companyId, id),+ invalidate: [['companies', companyId, 'tax-identifiers']],+ successMessage: i18n.t('admin.tax_identifiers.messages.validation_requested'),+ errorMessage: i18n.t('admin.tax_identifiers.messages.validation_failed'),+ })+}++// ---------------------------------------------------------------------------+// Exemption certificates+// ---------------------------------------------------------------------------++export function useTaxExemptionCertificates(companyId: string | undefined) {+ return useQuery({+ queryKey: useResourceKey('companies', companyId ?? 'noop', 'tax-exemption-certificates'),+ queryFn: () => adminClient.companies.taxExemptionCertificates.list(companyId as string),+ enabled: !!companyId,+ })+}++export function useCreateTaxExemptionCertificate(companyId: string) {+ return useResourceMutation<TaxExemptionCertificate, Error, TaxExemptionCertificateParams>({+ mutationFn: (params) =>+ adminClient.companies.taxExemptionCertificates.create(companyId, params),+ invalidate: [['companies', companyId, 'tax-exemption-certificates']],+ successMessage: i18n.t('admin.tax_exemption_certificates.messages.created'),+ errorMessage: i18n.t('admin.errors.failed_to_create'),+ })+}++export function useVerifyTaxExemptionCertificate(companyId: string) {+ return useResourceMutation<TaxExemptionCertificate, Error, string>({+ mutationFn: (id) => adminClient.companies.taxExemptionCertificates.verify(companyId, id),+ invalidate: [['companies', companyId, 'tax-exemption-certificates']],+ successMessage: i18n.t('admin.tax_exemption_certificates.messages.verified'),+ errorMessage: i18n.t('admin.errors.failed_to_update'),+ })+}++export function useRevokeTaxExemptionCertificate(companyId: string) {+ return useResourceMutation<TaxExemptionCertificate, Error, string>({+ mutationFn: (id) => adminClient.companies.taxExemptionCertificates.revoke(companyId, id),+ invalidate: [['companies', companyId, 'tax-exemption-certificates']],+ successMessage: i18n.t('admin.tax_exemption_certificates.messages.revoked'),+ errorMessage: i18n.t('admin.errors.failed_to_update'),+ })+}++export function useDeleteTaxExemptionCertificate(companyId: string) {+ return useResourceMutation<void, Error, string>({+ mutationFn: (id) => adminClient.companies.taxExemptionCertificates.delete(companyId, id),+ invalidate: [['companies', companyId, 'tax-exemption-certificates']],+ successMessage: i18n.t('admin.tax_exemption_certificates.messages.deleted'),+ errorMessage: i18n.t('admin.errors.failed_to_delete'),+ })+}diff --git a/packages/dashboard/src/hooks/use-customers.ts b/packages/dashboard/src/hooks/use-customers.tsindex e44f3e9648..b93704a162 100644--- a/packages/dashboard/src/hooks/use-customers.ts+++ b/packages/dashboard/src/hooks/use-customers.ts@@ -1,4 +1,4 @@-import type { Customer } from '@spree/admin-sdk'+import type { Customer, TaxIdentifier, TaxIdentifierParams } from '@spree/admin-sdk'import {adminClient,i18n,@@ -170,3 +170,53 @@ export function useBulkRemoveCustomerTags() {errorMessage: false,})}++// ---------------------------------------------------------------------------+// Tax identifiers — the customer's own registration, kept on their profile+// ---------------------------------------------------------------------------++export function useCustomerTaxIdentifiers(customerId: string | undefined) {+ return useQuery({+ queryKey: useResourceKey('customers', customerId ?? 'noop', 'tax-identifiers'),+ queryFn: () => adminClient.customers.taxIdentifiers.list(customerId as string),+ enabled: !!customerId,+ })+}++export function useCreateCustomerTaxIdentifier(customerId: string) {+ return useResourceMutation<TaxIdentifier, Error, TaxIdentifierParams>({+ mutationFn: (params) => adminClient.customers.taxIdentifiers.create(customerId, params),+ invalidate: [['customers', customerId, 'tax-identifiers']],+ successMessage: i18n.t('admin.tax_identifiers.messages.created'),+ errorMessage: i18n.t('admin.errors.failed_to_create'),+ })+}++/** The id travels with the variables so one hook serves every row. */+export function useUpdateCustomerTaxIdentifier(customerId: string) {+ return useResourceMutation<TaxIdentifier, Error, { id: string; params: TaxIdentifierParams }>({+ mutationFn: ({ id, params }) =>+ adminClient.customers.taxIdentifiers.update(customerId, id, params),+ invalidate: [['customers', customerId, 'tax-identifiers']],+ successMessage: i18n.t('admin.tax_identifiers.messages.updated'),+ errorMessage: i18n.t('admin.errors.failed_to_update'),+ })+}++export function useDeleteCustomerTaxIdentifier(customerId: string) {+ return useResourceMutation<void, Error, string>({+ mutationFn: (id) => adminClient.customers.taxIdentifiers.delete(customerId, id),+ invalidate: [['customers', customerId, 'tax-identifiers']],+ successMessage: i18n.t('admin.tax_identifiers.messages.deleted'),+ errorMessage: i18n.t('admin.errors.failed_to_delete'),+ })+}++export function useValidateCustomerTaxIdentifier(customerId: string) {+ return useResourceMutation<TaxIdentifier, Error, string>({+ mutationFn: (id) => adminClient.customers.taxIdentifiers.validate(customerId, id),+ invalidate: [['customers', customerId, 'tax-identifiers']],+ successMessage: i18n.t('admin.tax_identifiers.messages.validation_requested'),+ errorMessage: i18n.t('admin.tax_identifiers.messages.validation_failed'),+ })+}diff --git a/packages/dashboard/src/hooks/use-tax-rates.ts b/packages/dashboard/src/hooks/use-tax-rates.tsnew file mode 100644index 0000000000..67ce62936a--- /dev/null+++ b/packages/dashboard/src/hooks/use-tax-rates.ts@@ -0,0 +1,63 @@+import type { TaxRate, TaxRateParams } 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 useTaxRate(id: string | undefined) {+ return useQuery({+ queryKey: useResourceKey('tax-rates', id ?? 'noop'),+ queryFn: () => adminClient.taxRates.get(id as string),+ enabled: !!id,+ })+}++export function useCreateTaxRate() {+ return useResourceMutation<TaxRate, Error, TaxRateParams>({+ mutationFn: (params) => adminClient.taxRates.create(params),+ invalidate: [['tax-rates']],+ successMessage: i18n.t('admin.tax_rates.messages.created'),+ errorMessage: i18n.t('admin.errors.failed_to_create'),+ })+}++export function useUpdateTaxRate(id: string) {+ return useResourceMutation<TaxRate, Error, TaxRateParams>({+ mutationFn: (params) => adminClient.taxRates.update(id, params),+ invalidate: [['tax-rates'], ['tax-rates', id]],+ successMessage: i18n.t('admin.tax_rates.messages.updated'),+ errorMessage: i18n.t('admin.errors.failed_to_update'),+ })+}++export function useDeleteTaxRate() {+ const queryClient = useQueryClient()+ const buildKey = useResourceKeyBuilder()++ return useResourceMutation<void, Error, string>({+ mutationFn: (id) => adminClient.taxRates.delete(id),+ invalidate: [['tax-rates']],+ successMessage: i18n.t('admin.tax_rates.messages.deleted'),+ errorMessage: i18n.t('admin.errors.failed_to_delete'),+ onSuccess: (_data, id) => {+ queryClient.removeQueries({ queryKey: buildKey('tax-rates', id) })+ },+ })+}++/**+ * The tax engines this installation can use, each declaring what it cannot+ * handle. Registered in code rather than stored, so this never changes within+ * a session.+ */+export function useTaxProviders() {+ return useQuery({+ queryKey: useResourceKey('tax-providers'),+ queryFn: () => adminClient.taxProviders.list(),+ staleTime: Number.POSITIVE_INFINITY,+ })+}diff --git a/packages/dashboard/src/locales/ar.json b/packages/dashboard/src/locales/ar.jsonindex e576a7827b..c0e2653097 100644--- a/packages/dashboard/src/locales/ar.json+++ b/packages/dashboard/src/locales/ar.json@@ -750,6 +750,7 @@"label": "ملاحظة داخلية","placeholder": "سياق داخلي للموظفين عن هذا العميل…"},+ "label": "العميل","tags": {"label": "Tags"}@@ -898,6 +899,10 @@"tax_inclusive": {"help": "عرض الأسعار مع الضريبة. شائع في أسواق الاتحاد الأوروبي.","label": "تسعير شامل الضريبة"+ },+ "tax_provider": {+ "help": "ما يحسب الضريبة لطلبات هذا السوق.",+ "label": "محرك حساب الضريبة"}},"match_policy": {@@ -1492,6 +1497,106 @@"label": "Destination URL","placeholder": "https://example.com/webhooks"}+ },+ "external_id": {+ "label": "المرجع"+ },+ "country": {+ "label": "الدولة"+ },+ "state": {+ "label": "المنطقة"+ },+ "postal_code": {+ "label": "الرمز البريدي"+ },+ "certificate_number": {+ "label": "رقم الشهادة"+ },+ "reason_code": {+ "help": "يُمرَّر إلى محرك حساب الضريبة كرمز للاستخدام.",+ "label": "السبب"+ },+ "issued_at": {+ "label": "تاريخ الإصدار"+ },+ "issuing_authority": {+ "label": "الجهة المُصدِرة"+ },+ "certificate_document": {+ "help": "ملف PDF أو صورة، حتى 10 ميغابايت. الموظفون وحدهم يمكنهم تنزيله.",+ "label": "مستند الشهادة"+ },+ "company": {+ "name": {+ "placeholder": "Acme Industries"+ },+ "external_id": {+ "help": "مرجعك الخاص لهذه الشركة، فريد داخل المتجر.",+ "placeholder": "ACME-001"+ }+ },+ "company_location": {+ "name": {+ "placeholder": "المقر الرئيسي"+ },+ "external_id": {+ "help": "مرجعك الخاص لهذا الفرع."+ }+ },+ "company_contact": {+ "role": {+ "label": "الدور"+ }+ },+ "tax_identifier": {+ "kind": {+ "help": "نوع هذا الرقم. يجب أن يطابق التحقق المُعد له، لذا فالكتابة الصحيحة مهمة.",+ "label": "النوع"+ },+ "value": {+ "label": "الرقم",+ "placeholder": "DE123456789"+ }+ },+ "tax_rate": {+ "name": {+ "placeholder": "ضريبة القيمة المضافة الأساسية"+ },+ "amount": {+ "help": "بالنسبة المئوية. أدخل 20 لتعني 20%.",+ "label": "النسبة"+ },+ "jurisdiction": {+ "label": "تسري على"+ },+ "country_iso": {+ "help": "اتركه فارغاً لفرض الضريبة على كل الدول."+ },+ "state_code": {+ "help": "اتركه فارغاً لفرض الضريبة على الدولة بأكملها."+ },+ "tax_category_id": {+ "help": "المنتجات التي تسري عليها هذه النسبة.",+ "label": "الفئة الضريبية"+ },+ "included_in_price": {+ "help": "الأسعار تتضمن هذه الضريبة أصلاً، لذا تُستخرج منها بدلاً من أن تُضاف إليها.",+ "label": "مشمولة في السعر",+ "short": "مشمولة"+ },+ "show_rate_in_label": {+ "help": "يضيف النسبة المئوية إلى سطر الضريبة الذي يراه العميل.",+ "label": "إظهار النسبة في وصف الضريبة"+ }+ },+ "tax_exemption_certificate": {+ "country_iso": {+ "help": "اتركه فارغاً لشهادة تسري في كل المناطق."+ },+ "expires_at": {+ "help": "اتركه فارغاً لشهادة بلا تاريخ انتهاء."+ }}},"delivery_profiles": {@@ -1747,6 +1852,7 @@"categories": "الفئات","claims": "المطالبات","collections": "المجموعات",+ "companies": "الشركات","customer_groups": "المجموعات","customers": "العملاء","draft_orders": "مسودات الطلبات",@@ -2856,6 +2962,10 @@"url": "URL"},"title": "Webhooks"+ },+ "tax_rates": {+ "add_sheet_title": "نسبة ضريبة جديدة",+ "edit_sheet_title": "تعديل نسبة الضريبة"}},"staff": {@@ -3580,6 +3690,7 @@"stock_locations": "مواقع المخزون","store": "المتجر","tax_categories": "فئات الضريبة",+ "tax_rates": "نسب الضريبة","webhooks": "Webhooks"}},@@ -3762,6 +3873,190 @@"saved": "تم حفظ الترجمات","source": "المصدر","title": "الترجمات"+ },+ "jurisdiction": {+ "everywhere": "كل المناطق"+ },+ "companies": {+ "add_cta": "إضافة شركة",+ "add_sheet_title": "شركة جديدة",+ "create_description": "يشتري العملاء من الشركات عبر الفروع. يمكنك إضافة الفروع والرقم الضريبي وشهادات الإعفاء بعد إنشاء الشركة.",+ "create_label": "إنشاء الشركة",+ "delete_confirm": {+ "message": "سيؤدي هذا إلى حذف {{name}} مع فروعها ومشترييها وشهاداتها. لا يمكن التراجع عن هذا الإجراء.",+ "title": "حذف الشركة؟"+ },+ "detail": {+ "delete_label": "حذف الشركة",+ "load_error": "تعذر تحميل هذه الشركة",+ "profile": "الشركة"+ },+ "empty": "لا توجد شركات بعد",+ "locations_column": "الفروع",+ "messages": {+ "created": "تم إنشاء الشركة",+ "deleted": "تم حذف الشركة",+ "updated": "تم تحديث الشركة"+ },+ "search_placeholder": "البحث في الشركات"+ },+ "company_locations": {+ "add_cta": "إضافة فرع",+ "add_title": "فرع جديد",+ "addresses": "العناوين",+ "billing_address": "عنوان الفوترة",+ "contacts_count_few": "{{count}} مشترين",+ "contacts_count_many": "{{count}} مشترياً",+ "contacts_count_one": "مشترٍ واحد",+ "contacts_count_other": "{{count}} مشترٍ",+ "contacts_count_two": "مشتريان",+ "contacts_count_zero": "لا مشترين",+ "detail": {+ "delete_label": "حذف الفرع",+ "load_error": "تعذر تحميل هذا الفرع"+ },+ "dialog_description": "الفرع هو الجهة التي تُصدر لها الفاتورة وتُشحن إليها الطلبات. العناوين اختيارية، لكن أي عنوان تبدأ بتعبئته يتطلب الاسم والدولة.",+ "edit_title": "تعديل الفرع",+ "empty": "لا توجد فروع بعد",+ "messages": {+ "created": "تم إنشاء الفرع",+ "deleted": "تم حذف الفرع",+ "updated": "تم تحديث الفرع"+ },+ "shipping_address": "عنوان الشحن",+ "shipping_same_as_billing": "عنوان الشحن هو نفسه عنوان الفوترة",+ "title": "الفروع"+ },+ "company_contacts": {+ "add_cta": "إضافة مشترٍ",+ "add_title": "تخويل مشترٍ",+ "dialog_description": "عميل يشتري لهذا الفرع. من يشتري لفرع واحد فقط تُنسب طلباته إليه تلقائياً.",+ "empty": "لم يتم تخويل أي مشترٍ بعد",+ "messages": {+ "created": "تمت إضافة المشتري",+ "deleted": "تمت إزالة المشتري"+ },+ "remove_action": "إزالة المشتري",+ "remove_confirm": {+ "message": "لن يعود {{email}} يشتري لهذا الفرع. لن يتأثر حساب العميل.",+ "title": "إزالة هذا المشتري؟"+ },+ "roles_enterprise_help": "يمكن للمشترين المضافين هنا تقديم الطلبات لهذا الفرع. الأدوار ومسارات الموافقة وحدود الإنفاق تأتي مع Spree Enterprise.",+ "roles_enterprise_title": "الأدوار والموافقات من مزايا Enterprise",+ "title": "المشترون"+ },+ "tax_identifiers": {+ "add_cta": "إضافة رقم",+ "add_title": "إضافة رقم ضريبي",+ "checked_prefix": "تم التحقق",+ "delete_confirm": {+ "message": "ستتم إزالة {{value}}. تحتفظ الطلبات المكتملة بالرقم الذي فُوترت به.",+ "title": "حذف هذا الرقم؟"+ },+ "dialog_description": "رقم ضريبة القيمة المضافة أو رقم الشركة الذي يظهر على الفواتير، وهو ما يتيح آلية الاحتساب العكسي بين الشركات في الاتحاد الأوروبي.",+ "edit_title": "تعديل الرقم الضريبي",+ "empty": "لا يوجد رقم ضريبي مسجل",+ "kinds": {+ "au_abn": "رقم الشركة الأسترالي",+ "ch_vat": "ضريبة القيمة المضافة (سويسرا)",+ "eu_vat": "ضريبة القيمة المضافة (الاتحاد الأوروبي)",+ "gb_vat": "ضريبة القيمة المضافة (المملكة المتحدة)",+ "us_ein": "رقم صاحب العمل (الولايات المتحدة)"+ },+ "messages": {+ "created": "تمت إضافة الرقم",+ "deleted": "تم حذف الرقم",+ "updated": "تم تحديث الرقم",+ "validation_failed": "تعذر التحقق من الرقم",+ "validation_requested": "جارٍ التحقق من الرقم لدى السجل"+ },+ "not_validatable": "لا يوجد تحقق مُعد لهذا النوع، لذا يُستخدم الرقم كما أُدخل.",+ "select_kind": "اختر النوع",+ "title": "الرقم الضريبي",+ "validate_action": "التحقق لدى السجل",+ "validation_status": {+ "not_checked": "لم يُتحقق منه",+ "pending": "جارٍ التحقق",+ "unavailable": "السجل غير متاح",+ "unsupported": "يتعذر التحقق منه",+ "unverified": "غير صالح",+ "verified": "تم التحقق"+ }+ },+ "tax_exemption_certificates": {+ "add_cta": "إضافة شهادة",+ "add_title": "إضافة شهادة إعفاء",+ "delete_confirm": {+ "message": "ستتم إزالة الشهادة {{number}}. لا يمكن التراجع عن هذا الإجراء.",+ "title": "حذف هذه الشهادة؟"+ },+ "dialog_description": "إثبات أن مشتريات هذه الشركة غير خاضعة للضريبة. لا تسري الشهادة الجديدة إلا بعد قبولها.",+ "download_action": "تنزيل المستند",+ "empty": "لا توجد شهادات مسجلة",+ "expires_prefix": "تنتهي",+ "lapsed": "منتهية",+ "messages": {+ "created": "تمت إضافة الشهادة",+ "deleted": "تم حذف الشهادة",+ "revoked": "تم إلغاء الشهادة",+ "updated": "تم تحديث الشهادة",+ "verified": "تم قبول الشهادة"+ },+ "never_expires": "بلا تاريخ انتهاء",+ "no_document": "لا يوجد مستند مرفق",+ "reason_codes": {+ "agricultural": "الزراعة",+ "charitable": "جهة خيرية",+ "educational": "جهة تعليمية",+ "government": "جهة حكومية",+ "manufacturing": "التصنيع",+ "resale": "إعادة البيع"+ },+ "revoke_action": "إلغاء",+ "revoke_confirm": {+ "message": "لن تعود الشهادة {{number}} تسري على الطلبات الجديدة، لكنها تبقى محفوظة كسجل.",+ "title": "إلغاء هذه الشهادة؟"+ },+ "select_reason": "اختر السبب",+ "status": {+ "expired": "منتهية الصلاحية",+ "pending": "بانتظار المراجعة",+ "revoked": "ملغاة",+ "verified": "مقبولة"+ },+ "title": "شهادات الإعفاء",+ "verified_at": "تاريخ القبول",+ "verify_action": "قبول"+ },+ "tax_rates": {+ "add_cta": "إضافة نسبة ضريبة",+ "all_categories": "كل الفئات",+ "create_description": "تضبط نسب الضريبة محرك الحساب المدمج. النسبة التي لا تحدد دولة تسري في كل المناطق.",+ "create_label": "إنشاء النسبة",+ "delete_confirm": {+ "message": "لن تُطبَّق {{name}} بعد الآن. تحتفظ الطلبات المكتملة بالضريبة التي حُسبت لها.",+ "title": "حذف نسبة الضريبة؟"+ },+ "edit_description": "تسري التعديلات على الحسابات الجديدة. تحتفظ الطلبات المكتملة بالضريبة التي حُسبت لها.",+ "empty": "لا توجد نسب ضريبة بعد",+ "every_country": "كل الدول",+ "every_state": "كل المناطق",+ "messages": {+ "created": "تم إنشاء النسبة",+ "deleted": "تم حذف النسبة",+ "updated": "تم تحديث النسبة"+ },+ "search_placeholder": "البحث في نسب الضريبة",+ "select_category": "اختر فئة"+ },+ "tax_providers": {+ "limitations_title": "{{name}} لا يغطي",+ "unavailable_option": "{{name}} (غير مُعد)",+ "use_default": "استخدام المحرك الافتراضي",+ "use_default_named": "الافتراضي ({{name}})"+ },+ "enterprise": {+ "learn_more": "تعرّف على Spree Enterprise"}}}diff --git a/packages/dashboard/src/locales/de.json b/packages/dashboard/src/locales/de.jsonindex 18ab3c6090..3790305b4a 100644--- a/packages/dashboard/src/locales/de.json+++ b/packages/dashboard/src/locales/de.json@@ -739,6 +739,7 @@"label": "Interne Notiz","placeholder": "Nur für Mitarbeiter sichtbare Hinweise zu diesem Kunden…"},+ "label": "Kunde","tags": {"label": "Tags"}@@ -887,6 +888,10 @@"tax_inclusive": {"help": "Preise mit enthaltener Steuer anzeigen. In EU-Märkten üblich.","label": "Preise inklusive Steuer"+ },+ "tax_provider": {+ "help": "Womit die Steuer für Bestellungen in diesem Markt berechnet wird.",+ "label": "Steuerberechnung"}},"match_policy": {@@ -1481,6 +1486,106 @@"label": "Ziel-URL","placeholder": "https://example.com/webhooks"}+ },+ "external_id": {+ "label": "Referenz"+ },+ "country": {+ "label": "Land"+ },+ "state": {+ "label": "Bundesland"+ },+ "postal_code": {+ "label": "Postleitzahl"+ },+ "certificate_number": {+ "label": "Bescheinigungsnummer"+ },+ "reason_code": {+ "help": "Wird als Verwendungszweck an die Steuerberechnung übergeben.",+ "label": "Grund"+ },+ "issued_at": {+ "label": "Ausgestellt am"+ },+ "issuing_authority": {+ "label": "Ausstellende Behörde"+ },+ "certificate_document": {+ "help": "PDF oder Bild, bis 10 MB. Nur Mitarbeiter können es herunterladen.",+ "label": "Dokument"+ },+ "company": {+ "name": {+ "placeholder": "Acme Industries"+ },+ "external_id": {+ "help": "Ihre eigene Referenz für diese Firma, eindeutig innerhalb des Shops.",+ "placeholder": "ACME-001"+ }+ },+ "company_location": {+ "name": {+ "placeholder": "Hauptsitz"+ },+ "external_id": {+ "help": "Ihre eigene Referenz für diese Niederlassung."+ }+ },+ "company_contact": {+ "role": {+ "label": "Rolle"+ }+ },+ "tax_identifier": {+ "kind": {+ "help": "Um welche Nummer es sich handelt. Sie muss zur eingerichteten Prüfung passen, die Schreibweise ist also wichtig.",+ "label": "Art"+ },+ "value": {+ "label": "Nummer",+ "placeholder": "DE123456789"+ }+ },+ "tax_rate": {+ "name": {+ "placeholder": "Regelsteuersatz"+ },+ "amount": {+ "help": "In Prozent. Für 20 % geben Sie 20 ein.",+ "label": "Satz"+ },+ "jurisdiction": {+ "label": "Gilt für"+ },+ "country_iso": {+ "help": "Leer lassen, um jedes Land zu besteuern."+ },+ "state_code": {+ "help": "Leer lassen, um das ganze Land zu besteuern."+ },+ "tax_category_id": {+ "help": "Welche Produkte dieser Satz besteuert.",+ "label": "Steuerkategorie"+ },+ "included_in_price": {+ "help": "Die Preise enthalten diese Steuer bereits, sie wird herausgerechnet statt aufgeschlagen.",+ "label": "Im Preis enthalten",+ "short": "Enthalten"+ },+ "show_rate_in_label": {+ "help": "Ergänzt die Steuerzeile für den Kunden um den Prozentsatz.",+ "label": "Satz in der Steuerbezeichnung anzeigen"+ }+ },+ "tax_exemption_certificate": {+ "country_iso": {+ "help": "Leer lassen für eine Bescheinigung, die überall gilt."+ },+ "expires_at": {+ "help": "Leer lassen für eine Bescheinigung ohne Ablaufdatum."+ }}},"delivery_profiles": {@@ -1736,6 +1841,7 @@"categories": "Kategorien","claims": "Reklamationen","collections": "Kollektionen",+ "companies": "Firmen","customer_groups": "Gruppen","customers": "Kunden","draft_orders": "Bestellentwürfe",@@ -2846,6 +2952,10 @@"url": "URL"},"title": "Webhooks"+ },+ "tax_rates": {+ "add_sheet_title": "Neuer Steuersatz",+ "edit_sheet_title": "Steuersatz bearbeiten"}},"staff": {@@ -3564,6 +3674,7 @@"stock_locations": "Lagerstandorte","store": "Shop","tax_categories": "Steuerkategorien",+ "tax_rates": "Steuersätze","webhooks": "Webhooks"}},@@ -3746,6 +3857,186 @@"saved": "Übersetzungen gespeichert","source": "Quelle","title": "Übersetzungen"+ },+ "jurisdiction": {+ "everywhere": "Überall"+ },+ "companies": {+ "add_cta": "Firma hinzufügen",+ "add_sheet_title": "Neue Firma",+ "create_description": "Geschäftskunden kaufen über Niederlassungen ein. Niederlassungen, Steuernummer und Freistellungsbescheinigungen können Sie hinzufügen, sobald die Firma angelegt ist.",+ "create_label": "Firma anlegen",+ "delete_confirm": {+ "message": "Damit werden {{name}} sowie alle Niederlassungen, Einkäufer und Bescheinigungen gelöscht. Das lässt sich nicht rückgängig machen.",+ "title": "Firma löschen?"+ },+ "detail": {+ "delete_label": "Firma löschen",+ "load_error": "Diese Firma konnte nicht geladen werden",+ "profile": "Firma"+ },+ "empty": "Noch keine Firmen",+ "locations_column": "Niederlassungen",+ "messages": {+ "created": "Firma angelegt",+ "deleted": "Firma gelöscht",+ "updated": "Firma aktualisiert"+ },+ "search_placeholder": "Firmen suchen"+ },+ "company_locations": {+ "add_cta": "Niederlassung hinzufügen",+ "add_title": "Neue Niederlassung",+ "addresses": "Adressen",+ "billing_address": "Rechnungsadresse",+ "contacts_count_one": "{{count}} Einkäufer",+ "contacts_count_other": "{{count}} Einkäufer",+ "detail": {+ "delete_label": "Niederlassung löschen",+ "load_error": "Diese Niederlassung konnte nicht geladen werden"+ },+ "dialog_description": "Eine Niederlassung ist der Ort, an den die Rechnung geht und an den geliefert wird. Adressen sind optional, benötigen aber Name und Land, sobald sie ausgefüllt werden.",+ "edit_title": "Niederlassung bearbeiten",+ "empty": "Noch keine Niederlassungen",+ "messages": {+ "created": "Niederlassung angelegt",+ "deleted": "Niederlassung gelöscht",+ "updated": "Niederlassung aktualisiert"+ },+ "shipping_address": "Lieferadresse",+ "shipping_same_as_billing": "Lieferadresse entspricht der Rechnungsadresse",+ "title": "Niederlassungen"+ },+ "company_contacts": {+ "add_cta": "Einkäufer hinzufügen",+ "add_title": "Einkäufer berechtigen",+ "dialog_description": "Ein Kunde, der für diese Niederlassung einkauft. Wer für genau eine Niederlassung einkauft, dessen Bestellungen werden ihr automatisch zugeordnet.",+ "empty": "Noch keine Einkäufer berechtigt",+ "messages": {+ "created": "Einkäufer hinzugefügt",+ "deleted": "Einkäufer entfernt"+ },+ "remove_action": "Einkäufer entfernen",+ "remove_confirm": {+ "message": "{{email}} kauft dann nicht mehr für diese Niederlassung ein. Das Kundenkonto bleibt bestehen.",+ "title": "Diesen Einkäufer entfernen?"+ },+ "roles_enterprise_help": "Hier hinzugefügte Einkäufer können für diese Niederlassung bestellen. Rollen, Freigabeprozesse und Ausgabenlimits gehören zu Spree Enterprise.",+ "roles_enterprise_title": "Rollen und Freigaben sind eine Enterprise-Funktion",+ "title": "Einkäufer"+ },+ "tax_identifiers": {+ "add_cta": "Nummer hinzufügen",+ "add_title": "Steuernummer hinzufügen",+ "checked_prefix": "Geprüft",+ "delete_confirm": {+ "message": "{{value}} wird entfernt. Bereits abgeschlossene Bestellungen behalten die Nummer, mit der sie abgerechnet wurden.",+ "title": "Diese Nummer löschen?"+ },+ "dialog_description": "Die Umsatzsteuer-Identifikationsnummer, die auf Rechnungen erscheint. Sie macht das Reverse-Charge-Verfahren im EU-B2B-Handel möglich.",+ "edit_title": "Steuernummer bearbeiten",+ "empty": "Keine Steuernummer hinterlegt",+ "kinds": {+ "au_abn": "Australische Unternehmensnummer",+ "ch_vat": "Schweizer MWST-Nr.",+ "eu_vat": "EU-USt-IdNr.",+ "gb_vat": "UK-USt-IdNr.",+ "us_ein": "US-EIN"+ },+ "messages": {+ "created": "Nummer hinzugefügt",+ "deleted": "Nummer gelöscht",+ "updated": "Nummer aktualisiert",+ "validation_failed": "Die Nummer konnte nicht geprüft werden",+ "validation_requested": "Die Nummer wird beim Register geprüft"+ },+ "not_validatable": "Für diese Art ist keine Prüfung eingerichtet, die Nummer wird wie eingegeben verwendet.",+ "select_kind": "Art wählen",+ "title": "Steuernummer",+ "validate_action": "Beim Register prüfen",+ "validation_status": {+ "not_checked": "Nicht geprüft",+ "pending": "Wird geprüft",+ "unavailable": "Register nicht erreichbar",+ "unsupported": "Nicht prüfbar",+ "unverified": "Ungültig",+ "verified": "Bestätigt"+ }+ },+ "tax_exemption_certificates": {+ "add_cta": "Bescheinigung hinzufügen",+ "add_title": "Freistellungsbescheinigung hinzufügen",+ "delete_confirm": {+ "message": "Bescheinigung {{number}} wird entfernt. Das lässt sich nicht rückgängig machen.",+ "title": "Diese Bescheinigung löschen?"+ },+ "dialog_description": "Der Nachweis, dass die Einkäufe dieser Firma steuerfrei sind. Eine neue Bescheinigung gilt erst, wenn Sie sie angenommen haben.",+ "download_action": "Dokument herunterladen",+ "empty": "Keine Bescheinigungen hinterlegt",+ "expires_prefix": "Gültig bis",+ "lapsed": "Abgelaufen",+ "messages": {+ "created": "Bescheinigung hinzugefügt",+ "deleted": "Bescheinigung gelöscht",+ "revoked": "Bescheinigung widerrufen",+ "updated": "Bescheinigung aktualisiert",+ "verified": "Bescheinigung angenommen"+ },+ "never_expires": "Läuft nicht ab",+ "no_document": "Kein Dokument hinterlegt",+ "reason_codes": {+ "agricultural": "Landwirtschaft",+ "charitable": "Gemeinnützig",+ "educational": "Bildung",+ "government": "Behörde",+ "manufacturing": "Produktion",+ "resale": "Wiederverkauf"+ },+ "revoke_action": "Widerrufen",+ "revoke_confirm": {+ "message": "Bescheinigung {{number}} gilt dann nicht mehr für neue Bestellungen. Sie bleibt als Nachweis erhalten.",+ "title": "Diese Bescheinigung widerrufen?"+ },+ "select_reason": "Grund wählen",+ "status": {+ "expired": "Abgelaufen",+ "pending": "Wartet auf Prüfung",+ "revoked": "Widerrufen",+ "verified": "Angenommen"+ },+ "title": "Freistellungsbescheinigungen",+ "verified_at": "Angenommen am",+ "verify_action": "Annehmen"+ },+ "tax_rates": {+ "add_cta": "Steuersatz hinzufügen",+ "all_categories": "Alle Kategorien",+ "create_description": "Steuersätze konfigurieren die eingebaute Steuerberechnung. Ein Satz ohne Land gilt überall.",+ "create_label": "Steuersatz anlegen",+ "delete_confirm": {+ "message": "{{name}} wird nicht mehr angewendet. Abgeschlossene Bestellungen behalten die berechnete Steuer.",+ "title": "Steuersatz löschen?"+ },+ "edit_description": "Änderungen gelten für neue Berechnungen. Abgeschlossene Bestellungen behalten die berechnete Steuer.",+ "empty": "Noch keine Steuersätze",+ "every_country": "Jedes Land",+ "every_state": "Jedes Bundesland",+ "messages": {+ "created": "Steuersatz angelegt",+ "deleted": "Steuersatz gelöscht",+ "updated": "Steuersatz aktualisiert"+ },+ "search_placeholder": "Steuersätze suchen",+ "select_category": "Kategorie wählen"+ },+ "tax_providers": {+ "limitations_title": "{{name}} deckt Folgendes nicht ab",+ "unavailable_option": "{{name}} (nicht eingerichtet)",+ "use_default": "Standardberechnung verwenden",+ "use_default_named": "Standard ({{name}})"+ },+ "enterprise": {+ "learn_more": "Mehr über Spree Enterprise erfahren"}}}diff --git a/packages/dashboard/src/locales/en.json b/packages/dashboard/src/locales/en.jsonindex b76aa1679b..563821f838 100644--- a/packages/dashboard/src/locales/en.json+++ b/packages/dashboard/src/locales/en.json@@ -739,6 +739,7 @@"label": "Internal note","placeholder": "Staff-only context about this customer…"},+ "label": "Customer","tags": {"label": "Tags"}@@ -887,6 +888,10 @@"tax_inclusive": {"help": "Display prices with tax included. Common in EU markets.","label": "Tax-inclusive pricing"+ },+ "tax_provider": {+ "help": "Which engine calculates tax for orders in this market.",+ "label": "Tax engine"}},"match_policy": {@@ -1481,6 +1486,106 @@"label": "Destination URL","placeholder": "https://example.com/webhooks"}+ },+ "external_id": {+ "label": "Reference"+ },+ "country": {+ "label": "Country"+ },+ "state": {+ "label": "State"+ },+ "postal_code": {+ "label": "Postal code"+ },+ "certificate_number": {+ "label": "Certificate number"+ },+ "reason_code": {+ "help": "Becomes the tax engine's entity use code.",+ "label": "Reason"+ },+ "issued_at": {+ "label": "Issued on"+ },+ "issuing_authority": {+ "label": "Issuing authority"+ },+ "certificate_document": {+ "help": "PDF or image, up to 10 MB. Only staff can download it.",+ "label": "Certificate document"+ },+ "company": {+ "name": {+ "placeholder": "Acme Industries"+ },+ "external_id": {+ "help": "Your own reference for this business, unique within the store.",+ "placeholder": "ACME-001"+ }+ },+ "company_location": {+ "name": {+ "placeholder": "Head office"+ },+ "external_id": {+ "help": "Your own reference for this branch."+ }+ },+ "company_contact": {+ "role": {+ "label": "Role"+ }+ },+ "tax_identifier": {+ "kind": {+ "help": "Which registration this is. It has to match the validator registered for it, so spelling matters.",+ "label": "Kind"+ },+ "value": {+ "label": "Number",+ "placeholder": "DE123456789"+ }+ },+ "tax_rate": {+ "name": {+ "placeholder": "Standard VAT"+ },+ "amount": {+ "help": "As a percentage. Enter 20 for 20%.",+ "label": "Rate"+ },+ "jurisdiction": {+ "label": "Applies to"+ },+ "country_iso": {+ "help": "Leave empty to tax every country."+ },+ "state_code": {+ "help": "Leave empty to tax the whole country."+ },+ "tax_category_id": {+ "help": "Which products this rate taxes.",+ "label": "Tax category"+ },+ "included_in_price": {+ "help": "Prices already carry this tax, so it is backed out rather than added.",+ "label": "Included in price",+ "short": "Included"+ },+ "show_rate_in_label": {+ "help": "Adds the percentage to the tax line the customer sees.",+ "label": "Show rate in the tax label"+ }+ },+ "tax_exemption_certificate": {+ "country_iso": {+ "help": "Leave empty for a certificate that holds everywhere."+ },+ "expires_at": {+ "help": "Leave empty for a certificate that does not expire."+ }}},"delivery_profiles": {@@ -1736,6 +1841,7 @@"categories": "Categories","claims": "Claims","collections": "Collections",+ "companies": "Companies","customer_groups": "Groups","customers": "Customers","draft_orders": "Draft Orders",@@ -2846,6 +2952,10 @@"url": "URL"},"title": "Webhooks"+ },+ "tax_rates": {+ "add_sheet_title": "New tax rate",+ "edit_sheet_title": "Edit tax rate"}},"staff": {@@ -3564,6 +3674,7 @@"stock_locations": "Stock locations","store": "Store","tax_categories": "Tax categories",+ "tax_rates": "Tax rates","webhooks": "Webhooks"}},@@ -3746,6 +3857,186 @@"saved": "Translations saved","source": "Source","title": "Translations"+ },+ "jurisdiction": {+ "everywhere": "Everywhere"+ },+ "companies": {+ "add_cta": "Add company",+ "add_sheet_title": "New company",+ "create_description": "Business customers buy through branches. You can add branches, tax registration and exemption certificates once the company exists.",+ "create_label": "Create company",+ "delete_confirm": {+ "message": "This deletes {{name}} along with its branches, buyers and certificates. This cannot be undone.",+ "title": "Delete company?"+ },+ "detail": {+ "delete_label": "Delete company",+ "load_error": "Could not load this company",+ "profile": "Company"+ },+ "empty": "No companies yet",+ "locations_column": "Branches",+ "messages": {+ "created": "Company created",+ "deleted": "Company deleted",+ "updated": "Company updated"+ },+ "search_placeholder": "Search companies"+ },+ "company_locations": {+ "add_cta": "Add branch",+ "add_title": "New branch",+ "addresses": "Addresses",+ "billing_address": "Billing address",+ "contacts_count_one": "{{count}} buyer",+ "contacts_count_other": "{{count}} buyers",+ "detail": {+ "delete_label": "Delete branch",+ "load_error": "Could not load this branch"+ },+ "dialog_description": "A branch is where the business is invoiced and where its orders ship. Addresses are optional, but a partial address needs a name and country.",+ "edit_title": "Edit branch",+ "empty": "No branches yet",+ "messages": {+ "created": "Branch created",+ "deleted": "Branch deleted",+ "updated": "Branch updated"+ },+ "shipping_address": "Shipping address",+ "shipping_same_as_billing": "Shipping address is the same as billing",+ "title": "Branches"+ },+ "company_contacts": {+ "add_cta": "Add buyer",+ "add_title": "Authorise a buyer",+ "dialog_description": "A customer who buys for this branch. Someone who buys for exactly one branch has their orders attributed to it automatically.",+ "empty": "No buyers authorised yet",+ "messages": {+ "created": "Buyer added",+ "deleted": "Buyer removed"+ },+ "remove_action": "Remove buyer",+ "remove_confirm": {+ "message": "{{email}} will no longer buy for this branch. Their customer account is not affected.",+ "title": "Remove this buyer?"+ },+ "roles_enterprise_help": "Buyers you add here can place orders for this branch. Roles, approval workflows and spending limits come with Spree Enterprise.",+ "roles_enterprise_title": "Roles and approvals are an Enterprise feature",+ "title": "Buyers"+ },+ "tax_identifiers": {+ "add_cta": "Add registration",+ "add_title": "Add tax registration",+ "checked_prefix": "Checked",+ "delete_confirm": {+ "message": "{{value}} will be removed. Orders already placed keep the number they were invoiced with.",+ "title": "Delete this registration?"+ },+ "dialog_description": "The VAT or business number that appears on invoices. It is what makes EU B2B reverse charge possible.",+ "edit_title": "Edit tax registration",+ "empty": "No tax registration on file",+ "kinds": {+ "au_abn": "Australian Business Number",+ "ch_vat": "Swiss VAT",+ "eu_vat": "EU VAT",+ "gb_vat": "UK VAT",+ "us_ein": "US EIN"+ },+ "messages": {+ "created": "Registration added",+ "deleted": "Registration deleted",+ "updated": "Registration updated",+ "validation_failed": "Could not check the number",+ "validation_requested": "Checking the number with the registry"+ },+ "not_validatable": "No validator is set up for this kind, so the number is used as entered.",+ "select_kind": "Select a kind",+ "title": "Tax registration",+ "validate_action": "Check with registry",+ "validation_status": {+ "not_checked": "Not checked",+ "pending": "Checking",+ "unavailable": "Registry unavailable",+ "unsupported": "Cannot be checked",+ "unverified": "Not valid",+ "verified": "Verified"+ }+ },+ "tax_exemption_certificates": {+ "add_cta": "Add certificate",+ "add_title": "Add exemption certificate",+ "delete_confirm": {+ "message": "Certificate {{number}} will be removed. This cannot be undone.",+ "title": "Delete this certificate?"+ },+ "dialog_description": "Evidence that this business's purchases are not taxed. A new certificate waits for your decision before it applies.",+ "download_action": "Download document",+ "empty": "No certificates on file",+ "expires_prefix": "Expires",+ "lapsed": "Lapsed",+ "messages": {+ "created": "Certificate added",+ "deleted": "Certificate deleted",+ "revoked": "Certificate revoked",+ "updated": "Certificate updated",+ "verified": "Certificate accepted"+ },+ "never_expires": "Does not expire",+ "no_document": "No document attached",+ "reason_codes": {+ "agricultural": "Agricultural",+ "charitable": "Charitable",+ "educational": "Educational",+ "government": "Government",+ "manufacturing": "Manufacturing",+ "resale": "Resale"+ },+ "revoke_action": "Revoke",+ "revoke_confirm": {+ "message": "Certificate {{number}} stops applying to new orders. It stays on file as a record.",+ "title": "Revoke this certificate?"+ },+ "select_reason": "Select a reason",+ "status": {+ "expired": "Expired",+ "pending": "Awaiting review",+ "revoked": "Revoked",+ "verified": "Accepted"+ },+ "title": "Exemption certificates",+ "verified_at": "Accepted on",+ "verify_action": "Accept"+ },+ "tax_rates": {+ "add_cta": "Add tax rate",+ "all_categories": "All categories",+ "create_description": "Tax rates configure the built-in tax engine. A rate that names no country taxes everywhere.",+ "create_label": "Create tax rate",+ "delete_confirm": {+ "message": "{{name}} will no longer be applied. Orders already placed keep the tax they were charged.",+ "title": "Delete tax rate?"+ },+ "edit_description": "Changes apply to new calculations. Orders already placed keep the tax they were charged.",+ "empty": "No tax rates yet",+ "every_country": "Every country",+ "every_state": "Every state",+ "messages": {+ "created": "Tax rate created",+ "deleted": "Tax rate deleted",+ "updated": "Tax rate updated"+ },+ "search_placeholder": "Search tax rates",+ "select_category": "Select a category"+ },+ "tax_providers": {+ "limitations_title": "{{name}} does not handle",+ "unavailable_option": "{{name}} (not configured)",+ "use_default": "Use the default engine",+ "use_default_named": "Default ({{name}})"+ },+ "enterprise": {+ "learn_more": "Learn about Spree Enterprise"}}}diff --git a/packages/dashboard/src/locales/fr.json b/packages/dashboard/src/locales/fr.jsonindex 62f2287f1d..b3b388ef81 100644--- a/packages/dashboard/src/locales/fr.json+++ b/packages/dashboard/src/locales/fr.json@@ -739,6 +739,7 @@"label": "Note interne","placeholder": "Contexte réservé au personnel à propos de ce client…"},+ "label": "Client","tags": {"label": "Étiquettes"}@@ -887,6 +888,10 @@"tax_inclusive": {"help": "Afficher les prix taxes comprises. Courant sur les marchés de l'UE.","label": "Prix taxes comprises"+ },+ "tax_provider": {+ "help": "Ce qui calcule la taxe pour les commandes de ce marché.",+ "label": "Moteur de calcul"}},"match_policy": {@@ -1481,6 +1486,106 @@"label": "URL de destination","placeholder": "https://example.com/webhooks"}+ },+ "external_id": {+ "label": "Référence"+ },+ "country": {+ "label": "Pays"+ },+ "state": {+ "label": "Région"+ },+ "postal_code": {+ "label": "Code postal"+ },+ "certificate_number": {+ "label": "Numéro d'attestation"+ },+ "reason_code": {+ "help": "Transmis au moteur de calcul comme code d'usage.",+ "label": "Motif"+ },+ "issued_at": {+ "label": "Délivrée le"+ },+ "issuing_authority": {+ "label": "Autorité émettrice"+ },+ "certificate_document": {+ "help": "PDF ou image, jusqu'à 10 Mo. Seul le personnel peut le télécharger.",+ "label": "Document"+ },+ "company": {+ "name": {+ "placeholder": "Acme Industries"+ },+ "external_id": {+ "help": "Votre propre référence pour cette entreprise, unique dans la boutique.",+ "placeholder": "ACME-001"+ }+ },+ "company_location": {+ "name": {+ "placeholder": "Siège social"+ },+ "external_id": {+ "help": "Votre propre référence pour cet établissement."+ }+ },+ "company_contact": {+ "role": {+ "label": "Rôle"+ }+ },+ "tax_identifier": {+ "kind": {+ "help": "De quel numéro il s'agit. Il doit correspondre à la vérification configurée, l'orthographe compte donc.",+ "label": "Type"+ },+ "value": {+ "label": "Numéro",+ "placeholder": "FR12345678901"+ }+ },+ "tax_rate": {+ "name": {+ "placeholder": "TVA taux normal"+ },+ "amount": {+ "help": "En pourcentage. Saisissez 20 pour 20 %.",+ "label": "Taux"+ },+ "jurisdiction": {+ "label": "S'applique à"+ },+ "country_iso": {+ "help": "Laissez vide pour taxer tous les pays."+ },+ "state_code": {+ "help": "Laissez vide pour taxer tout le pays."+ },+ "tax_category_id": {+ "help": "Les produits auxquels ce taux s'applique.",+ "label": "Catégorie de taxe"+ },+ "included_in_price": {+ "help": "Les prix contiennent déjà cette taxe, elle est déduite au lieu d'être ajoutée.",+ "label": "Incluse dans le prix",+ "short": "Incluse"+ },+ "show_rate_in_label": {+ "help": "Ajoute le pourcentage à la ligne de taxe vue par le client.",+ "label": "Afficher le taux dans le libellé"+ }+ },+ "tax_exemption_certificate": {+ "country_iso": {+ "help": "Laissez vide pour une attestation valable partout."+ },+ "expires_at": {+ "help": "Laissez vide pour une attestation sans date d'expiration."+ }}},"delivery_profiles": {@@ -1736,6 +1841,7 @@"categories": "Catégories","claims": "Réclamations","collections": "Collections",+ "companies": "Entreprises","customer_groups": "Groupes","customers": "Clients","draft_orders": "Commandes provisoires",@@ -2846,6 +2952,10 @@"url": "URL"},"title": "Webhooks"+ },+ "tax_rates": {+ "add_sheet_title": "Nouveau taux de taxe",+ "edit_sheet_title": "Modifier le taux de taxe"}},"staff": {@@ -3564,6 +3674,7 @@"stock_locations": "Emplacements de stock","store": "Boutique","tax_categories": "Catégories de taxe",+ "tax_rates": "Taux de taxe","webhooks": "Webhooks"}},@@ -3746,6 +3857,186 @@"saved": "Traductions enregistrées","source": "Source","title": "Traductions"+ },+ "jurisdiction": {+ "everywhere": "Partout"+ },+ "companies": {+ "add_cta": "Ajouter une entreprise",+ "add_sheet_title": "Nouvelle entreprise",+ "create_description": "Les clients professionnels achètent via des établissements. Vous pourrez ajouter des établissements, un numéro de TVA et des attestations d'exonération une fois l'entreprise créée.",+ "create_label": "Créer l'entreprise",+ "delete_confirm": {+ "message": "Cela supprime {{name}} ainsi que ses établissements, ses acheteurs et ses attestations. Cette action est irréversible.",+ "title": "Supprimer l'entreprise ?"+ },+ "detail": {+ "delete_label": "Supprimer l'entreprise",+ "load_error": "Impossible de charger cette entreprise",+ "profile": "Entreprise"+ },+ "empty": "Aucune entreprise pour le moment",+ "locations_column": "Établissements",+ "messages": {+ "created": "Entreprise créée",+ "deleted": "Entreprise supprimée",+ "updated": "Entreprise mise à jour"+ },+ "search_placeholder": "Rechercher des entreprises"+ },+ "company_locations": {+ "add_cta": "Ajouter un établissement",+ "add_title": "Nouvel établissement",+ "addresses": "Adresses",+ "billing_address": "Adresse de facturation",+ "contacts_count_one": "{{count}} acheteur",+ "contacts_count_other": "{{count}} acheteurs",+ "detail": {+ "delete_label": "Supprimer l'établissement",+ "load_error": "Impossible de charger cet établissement"+ },+ "dialog_description": "Un établissement est l'adresse de facturation et de livraison de l'entreprise. Les adresses sont facultatives, mais une adresse renseignée exige un nom et un pays.",+ "edit_title": "Modifier l'établissement",+ "empty": "Aucun établissement pour le moment",+ "messages": {+ "created": "Établissement créé",+ "deleted": "Établissement supprimé",+ "updated": "Établissement mis à jour"+ },+ "shipping_address": "Adresse de livraison",+ "shipping_same_as_billing": "L'adresse de livraison est identique à celle de facturation",+ "title": "Établissements"+ },+ "company_contacts": {+ "add_cta": "Ajouter un acheteur",+ "add_title": "Autoriser un acheteur",+ "dialog_description": "Un client qui achète pour cet établissement. Celui qui achète pour un seul établissement voit ses commandes rattachées automatiquement.",+ "empty": "Aucun acheteur autorisé pour le moment",+ "messages": {+ "created": "Acheteur ajouté",+ "deleted": "Acheteur retiré"+ },+ "remove_action": "Retirer l'acheteur",+ "remove_confirm": {+ "message": "{{email}} n'achètera plus pour cet établissement. Son compte client n'est pas modifié.",+ "title": "Retirer cet acheteur ?"+ },+ "roles_enterprise_help": "Les acheteurs ajoutés ici peuvent commander pour cet établissement. Les rôles, circuits de validation et plafonds de dépenses font partie de Spree Enterprise.",+ "roles_enterprise_title": "Les rôles et validations sont une fonctionnalité Enterprise",+ "title": "Acheteurs"+ },+ "tax_identifiers": {+ "add_cta": "Ajouter un numéro",+ "add_title": "Ajouter un numéro de TVA",+ "checked_prefix": "Vérifié",+ "delete_confirm": {+ "message": "{{value}} sera retiré. Les commandes déjà passées conservent le numéro utilisé pour leur facturation.",+ "title": "Supprimer ce numéro ?"+ },+ "dialog_description": "Le numéro de TVA ou d'entreprise qui figure sur les factures. C'est lui qui rend possible l'autoliquidation en B2B dans l'UE.",+ "edit_title": "Modifier le numéro de TVA",+ "empty": "Aucun numéro enregistré",+ "kinds": {+ "au_abn": "Numéro d'entreprise australien",+ "ch_vat": "TVA Suisse",+ "eu_vat": "TVA UE",+ "gb_vat": "TVA Royaume-Uni",+ "us_ein": "EIN (États-Unis)"+ },+ "messages": {+ "created": "Numéro ajouté",+ "deleted": "Numéro supprimé",+ "updated": "Numéro mis à jour",+ "validation_failed": "Impossible de vérifier le numéro",+ "validation_requested": "Vérification du numéro auprès du registre"+ },+ "not_validatable": "Aucune vérification n'est configurée pour ce type, le numéro est utilisé tel qu'il a été saisi.",+ "select_kind": "Choisir un type",+ "title": "Numéro de TVA",+ "validate_action": "Vérifier auprès du registre",+ "validation_status": {+ "not_checked": "Non vérifié",+ "pending": "Vérification en cours",+ "unavailable": "Registre indisponible",+ "unsupported": "Non vérifiable",+ "unverified": "Non valide",+ "verified": "Vérifié"+ }+ },+ "tax_exemption_certificates": {+ "add_cta": "Ajouter une attestation",+ "add_title": "Ajouter une attestation d'exonération",+ "delete_confirm": {+ "message": "L'attestation {{number}} sera retirée. Cette action est irréversible.",+ "title": "Supprimer cette attestation ?"+ },+ "dialog_description": "La preuve que les achats de cette entreprise ne sont pas taxés. Une nouvelle attestation ne s'applique qu'une fois acceptée.",+ "download_action": "Télécharger le document",+ "empty": "Aucune attestation enregistrée",+ "expires_prefix": "Expire",+ "lapsed": "Périmée",+ "messages": {+ "created": "Attestation ajoutée",+ "deleted": "Attestation supprimée",+ "revoked": "Attestation révoquée",+ "updated": "Attestation mise à jour",+ "verified": "Attestation acceptée"+ },+ "never_expires": "Sans expiration",+ "no_document": "Aucun document joint",+ "reason_codes": {+ "agricultural": "Agriculture",+ "charitable": "Organisme caritatif",+ "educational": "Enseignement",+ "government": "Administration",+ "manufacturing": "Production",+ "resale": "Revente"+ },+ "revoke_action": "Révoquer",+ "revoke_confirm": {+ "message": "L'attestation {{number}} ne s'appliquera plus aux nouvelles commandes. Elle reste conservée comme justificatif.",+ "title": "Révoquer cette attestation ?"+ },+ "select_reason": "Choisir un motif",+ "status": {+ "expired": "Expirée",+ "pending": "En attente d'examen",+ "revoked": "Révoquée",+ "verified": "Acceptée"+ },+ "title": "Attestations d'exonération",+ "verified_at": "Acceptée le",+ "verify_action": "Accepter"+ },+ "tax_rates": {+ "add_cta": "Ajouter un taux",+ "all_categories": "Toutes les catégories",+ "create_description": "Les taux de taxe configurent le moteur de calcul intégré. Un taux sans pays s'applique partout.",+ "create_label": "Créer le taux",+ "delete_confirm": {+ "message": "{{name}} ne sera plus appliqué. Les commandes déjà passées conservent la taxe facturée.",+ "title": "Supprimer le taux ?"+ },+ "edit_description": "Les modifications s'appliquent aux nouveaux calculs. Les commandes déjà passées conservent la taxe facturée.",+ "empty": "Aucun taux de taxe pour le moment",+ "every_country": "Tous les pays",+ "every_state": "Toutes les régions",+ "messages": {+ "created": "Taux créé",+ "deleted": "Taux supprimé",+ "updated": "Taux mis à jour"+ },+ "search_placeholder": "Rechercher des taux",+ "select_category": "Choisir une catégorie"+ },+ "tax_providers": {+ "limitations_title": "{{name}} ne prend pas en charge",+ "unavailable_option": "{{name}} (non configuré)",+ "use_default": "Utiliser le moteur par défaut",+ "use_default_named": "Par défaut ({{name}})"+ },+ "enterprise": {+ "learn_more": "En savoir plus sur Spree Enterprise"}}}diff --git a/packages/dashboard/src/locales/pl.json b/packages/dashboard/src/locales/pl.jsonindex 1a48543ff8..e4b054aa30 100644--- a/packages/dashboard/src/locales/pl.json+++ b/packages/dashboard/src/locales/pl.json@@ -753,6 +753,7 @@"label": "Notatka wewnętrzna","placeholder": "Kontekst dotyczący tego klienta tylko dla personelu…"},+ "label": "Klient","tags": {"label": "Tagi"}@@ -901,6 +902,10 @@"tax_inclusive": {"help": "Wyświetlaj ceny z uwzględnionym podatkiem. Powszechne na rynkach UE.","label": "Ceny z podatkiem"+ },+ "tax_provider": {+ "help": "Co nalicza podatek dla zamówień na tym rynku.",+ "label": "Mechanizm podatkowy"}},"match_policy": {@@ -1495,6 +1500,106 @@"label": "Docelowy adres URL","placeholder": "https://example.com/webhooks"}+ },+ "external_id": {+ "label": "Identyfikator"+ },+ "country": {+ "label": "Kraj"+ },+ "state": {+ "label": "Region"+ },+ "postal_code": {+ "label": "Kod pocztowy"+ },+ "certificate_number": {+ "label": "Numer certyfikatu"+ },+ "reason_code": {+ "help": "Przekazywany do naliczania podatku jako kod przeznaczenia.",+ "label": "Powód"+ },+ "issued_at": {+ "label": "Data wydania"+ },+ "issuing_authority": {+ "label": "Organ wydający"+ },+ "certificate_document": {+ "help": "PDF lub obraz, do 10 MB. Pobrać go mogą tylko pracownicy.",+ "label": "Dokument"+ },+ "company": {+ "name": {+ "placeholder": "Acme Industries"+ },+ "external_id": {+ "help": "Twój własny identyfikator tej firmy, unikalny w sklepie.",+ "placeholder": "ACME-001"+ }+ },+ "company_location": {+ "name": {+ "placeholder": "Siedziba główna"+ },+ "external_id": {+ "help": "Twój własny identyfikator tego oddziału."+ }+ },+ "company_contact": {+ "role": {+ "label": "Rola"+ }+ },+ "tax_identifier": {+ "kind": {+ "help": "Jaki to numer. Musi odpowiadać skonfigurowanej weryfikacji, więc pisownia ma znaczenie.",+ "label": "Rodzaj"+ },+ "value": {+ "label": "Numer",+ "placeholder": "PL1234567890"+ }+ },+ "tax_rate": {+ "name": {+ "placeholder": "VAT stawka podstawowa"+ },+ "amount": {+ "help": "W procentach. Dla 20% wpisz 20.",+ "label": "Stawka"+ },+ "jurisdiction": {+ "label": "Obowiązuje dla"+ },+ "country_iso": {+ "help": "Zostaw puste, aby opodatkować każdy kraj."+ },+ "state_code": {+ "help": "Zostaw puste, aby opodatkować cały kraj."+ },+ "tax_category_id": {+ "help": "Które produkty obejmuje ta stawka.",+ "label": "Kategoria podatkowa"+ },+ "included_in_price": {+ "help": "Ceny już zawierają ten podatek, więc jest on wyliczany z ceny, a nie doliczany.",+ "label": "Wliczony w cenę",+ "short": "Wliczony"+ },+ "show_rate_in_label": {+ "help": "Dodaje procent do pozycji podatku widocznej dla klienta.",+ "label": "Pokaż stawkę w opisie podatku"+ }+ },+ "tax_exemption_certificate": {+ "country_iso": {+ "help": "Zostaw puste, aby certyfikat obowiązywał wszędzie."+ },+ "expires_at": {+ "help": "Zostaw puste, aby certyfikat nie wygasał."+ }}},"delivery_profiles": {@@ -1750,6 +1855,7 @@"categories": "Kategorie","claims": "Reklamacje","collections": "Kolekcje",+ "companies": "Firmy","customer_groups": "Grupy","customers": "Klienci","draft_orders": "Zamówienia robocze",@@ -2890,6 +2996,10 @@"url": "URL"},"title": "Webhooki"+ },+ "tax_rates": {+ "add_sheet_title": "Nowa stawka podatku",+ "edit_sheet_title": "Edytuj stawkę podatku"}},"staff": {@@ -3618,6 +3728,7 @@"stock_locations": "Lokalizacje magazynowe","store": "Sklep","tax_categories": "Kategorie podatkowe",+ "tax_rates": "Stawki podatku","webhooks": "Webhooki"}},@@ -3800,6 +3911,188 @@"saved": "Tłumaczenia zapisane","source": "Źródło","title": "Tłumaczenia"+ },+ "jurisdiction": {+ "everywhere": "Wszędzie"+ },+ "companies": {+ "add_cta": "Dodaj firmę",+ "add_sheet_title": "Nowa firma",+ "create_description": "Klienci biznesowi kupują przez oddziały. Oddziały, numer podatkowy i certyfikaty zwolnienia dodasz po utworzeniu firmy.",+ "create_label": "Utwórz firmę",+ "delete_confirm": {+ "message": "Spowoduje to usunięcie {{name}} wraz z oddziałami, kupującymi i certyfikatami. Tej operacji nie można cofnąć.",+ "title": "Usunąć firmę?"+ },+ "detail": {+ "delete_label": "Usuń firmę",+ "load_error": "Nie udało się wczytać tej firmy",+ "profile": "Firma"+ },+ "empty": "Nie ma jeszcze żadnych firm",+ "locations_column": "Oddziały",+ "messages": {+ "created": "Firma utworzona",+ "deleted": "Firma usunięta",+ "updated": "Firma zaktualizowana"+ },+ "search_placeholder": "Szukaj firm"+ },+ "company_locations": {+ "add_cta": "Dodaj oddział",+ "add_title": "Nowy oddział",+ "addresses": "Adresy",+ "billing_address": "Adres rozliczeniowy",+ "contacts_count_few": "{{count}} kupujących",+ "contacts_count_many": "{{count}} kupujących",+ "contacts_count_one": "{{count}} kupujący",+ "contacts_count_other": "{{count}} kupujących",+ "detail": {+ "delete_label": "Usuń oddział",+ "load_error": "Nie udało się wczytać tego oddziału"+ },+ "dialog_description": "Oddział to miejsce, na które wystawiana jest faktura i pod które trafia dostawa. Adresy są opcjonalne, ale wypełniony adres wymaga imienia, nazwiska i kraju.",+ "edit_title": "Edytuj oddział",+ "empty": "Nie ma jeszcze żadnych oddziałów",+ "messages": {+ "created": "Oddział utworzony",+ "deleted": "Oddział usunięty",+ "updated": "Oddział zaktualizowany"+ },+ "shipping_address": "Adres dostawy",+ "shipping_same_as_billing": "Adres dostawy taki sam jak rozliczeniowy",+ "title": "Oddziały"+ },+ "company_contacts": {+ "add_cta": "Dodaj kupującego",+ "add_title": "Uprawnij kupującego",+ "dialog_description": "Klient, który kupuje dla tego oddziału. Jeśli kupuje tylko dla jednego oddziału, jego zamówienia trafiają do niego automatycznie.",+ "empty": "Nie uprawniono jeszcze żadnych kupujących",+ "messages": {+ "created": "Kupujący dodany",+ "deleted": "Kupujący usunięty"+ },+ "remove_action": "Usuń kupującego",+ "remove_confirm": {+ "message": "{{email}} nie będzie już kupować dla tego oddziału. Konto klienta pozostaje bez zmian.",+ "title": "Usunąć tego kupującego?"+ },+ "roles_enterprise_help": "Dodani tutaj kupujący mogą składać zamówienia dla tego oddziału. Role, procesy akceptacji i limity wydatków są częścią Spree Enterprise.",+ "roles_enterprise_title": "Role i akceptacje to funkcja Enterprise",+ "title": "Kupujący"+ },+ "tax_identifiers": {+ "add_cta": "Dodaj numer",+ "add_title": "Dodaj numer podatkowy",+ "checked_prefix": "Sprawdzono",+ "delete_confirm": {+ "message": "{{value}} zostanie usunięty. Złożone już zamówienia zachowują numer, którym je zafakturowano.",+ "title": "Usunąć ten numer?"+ },+ "dialog_description": "Numer VAT lub firmowy, który pojawia się na fakturach. To on umożliwia odwrotne obciążenie w handlu B2B w UE.",+ "edit_title": "Edytuj numer podatkowy",+ "empty": "Brak zapisanego numeru podatkowego",+ "kinds": {+ "au_abn": "Australijski numer firmy",+ "ch_vat": "VAT Szwajcaria",+ "eu_vat": "VAT UE",+ "gb_vat": "VAT Wielka Brytania",+ "us_ein": "EIN (USA)"+ },+ "messages": {+ "created": "Numer dodany",+ "deleted": "Numer usunięty",+ "updated": "Numer zaktualizowany",+ "validation_failed": "Nie udało się sprawdzić numeru",+ "validation_requested": "Trwa sprawdzanie numeru w rejestrze"+ },+ "not_validatable": "Dla tego rodzaju nie skonfigurowano weryfikacji, numer jest używany tak, jak go wpisano.",+ "select_kind": "Wybierz rodzaj",+ "title": "Numer podatkowy",+ "validate_action": "Sprawdź w rejestrze",+ "validation_status": {+ "not_checked": "Niesprawdzony",+ "pending": "Sprawdzanie",+ "unavailable": "Rejestr niedostępny",+ "unsupported": "Nie można sprawdzić",+ "unverified": "Nieprawidłowy",+ "verified": "Potwierdzony"+ }+ },+ "tax_exemption_certificates": {+ "add_cta": "Dodaj certyfikat",+ "add_title": "Dodaj certyfikat zwolnienia",+ "delete_confirm": {+ "message": "Certyfikat {{number}} zostanie usunięty. Tej operacji nie można cofnąć.",+ "title": "Usunąć ten certyfikat?"+ },+ "dialog_description": "Dowód, że zakupy tej firmy nie są opodatkowane. Nowy certyfikat zaczyna obowiązywać dopiero po zaakceptowaniu.",+ "download_action": "Pobierz dokument",+ "empty": "Brak zapisanych certyfikatów",+ "expires_prefix": "Wygasa",+ "lapsed": "Nieważny",+ "messages": {+ "created": "Certyfikat dodany",+ "deleted": "Certyfikat usunięty",+ "revoked": "Certyfikat unieważniony",+ "updated": "Certyfikat zaktualizowany",+ "verified": "Certyfikat zaakceptowany"+ },+ "never_expires": "Bez daty wygaśnięcia",+ "no_document": "Brak załączonego dokumentu",+ "reason_codes": {+ "agricultural": "Rolnictwo",+ "charitable": "Organizacja charytatywna",+ "educational": "Edukacja",+ "government": "Instytucja publiczna",+ "manufacturing": "Produkcja",+ "resale": "Odsprzedaż"+ },+ "revoke_action": "Unieważnij",+ "revoke_confirm": {+ "message": "Certyfikat {{number}} przestanie obowiązywać dla nowych zamówień. Pozostanie zapisany jako dokumentacja.",+ "title": "Unieważnić ten certyfikat?"+ },+ "select_reason": "Wybierz powód",+ "status": {+ "expired": "Wygasł",+ "pending": "Oczekuje na weryfikację",+ "revoked": "Unieważniony",+ "verified": "Zaakceptowany"+ },+ "title": "Certyfikaty zwolnienia",+ "verified_at": "Zaakceptowano",+ "verify_action": "Zaakceptuj"+ },+ "tax_rates": {+ "add_cta": "Dodaj stawkę",+ "all_categories": "Wszystkie kategorie",+ "create_description": "Stawki podatku konfigurują wbudowane naliczanie podatku. Stawka bez kraju obowiązuje wszędzie.",+ "create_label": "Utwórz stawkę",+ "delete_confirm": {+ "message": "{{name}} nie będzie już stosowana. Złożone już zamówienia zachowują naliczony podatek.",+ "title": "Usunąć stawkę?"+ },+ "edit_description": "Zmiany dotyczą nowych obliczeń. Złożone już zamówienia zachowują naliczony podatek.",+ "empty": "Nie ma jeszcze żadnych stawek",+ "every_country": "Każdy kraj",+ "every_state": "Każdy region",+ "messages": {+ "created": "Stawka utworzona",+ "deleted": "Stawka usunięta",+ "updated": "Stawka zaktualizowana"+ },+ "search_placeholder": "Szukaj stawek",+ "select_category": "Wybierz kategorię"+ },+ "tax_providers": {+ "limitations_title": "{{name}} nie obsługuje",+ "unavailable_option": "{{name}} (nieskonfigurowany)",+ "use_default": "Użyj domyślnego mechanizmu",+ "use_default_named": "Domyślny ({{name}})"+ },+ "enterprise": {+ "learn_more": "Dowiedz się więcej o Spree Enterprise"}}}diff --git a/packages/dashboard/src/locales/zh-CN.json b/packages/dashboard/src/locales/zh-CN.jsonindex c687a2cd3c..e8c6695caf 100644--- a/packages/dashboard/src/locales/zh-CN.json+++ b/packages/dashboard/src/locales/zh-CN.json@@ -736,6 +736,7 @@"label": "内部备注","placeholder": "仅员工可见的客户相关备注…"},+ "label": "客户","tags": {"label": "标签"}@@ -884,6 +885,10 @@"tax_inclusive": {"help": "显示含税价格。在欧盟市场较为常见。","label": "含税定价"+ },+ "tax_provider": {+ "help": "用于计算该市场订单税费的引擎。",+ "label": "税费计算引擎"}},"match_policy": {@@ -1478,6 +1483,106 @@"label": "目标 URL","placeholder": "https://example.com/webhooks"}+ },+ "external_id": {+ "label": "外部编号"+ },+ "country": {+ "label": "国家/地区"+ },+ "state": {+ "label": "省/州"+ },+ "postal_code": {+ "label": "邮政编码"+ },+ "certificate_number": {+ "label": "证明编号"+ },+ "reason_code": {+ "help": "作为用途代码传递给税费计算引擎。",+ "label": "事由"+ },+ "issued_at": {+ "label": "签发日期"+ },+ "issuing_authority": {+ "label": "签发机构"+ },+ "certificate_document": {+ "help": "PDF 或图片,最大 10 MB。仅员工可下载。",+ "label": "证明文件"+ },+ "company": {+ "name": {+ "placeholder": "Acme Industries"+ },+ "external_id": {+ "help": "您为该企业设定的编号,在本店内唯一。",+ "placeholder": "ACME-001"+ }+ },+ "company_location": {+ "name": {+ "placeholder": "总部"+ },+ "external_id": {+ "help": "您为该分支机构设定的编号。"+ }+ },+ "company_contact": {+ "role": {+ "label": "职务"+ }+ },+ "tax_identifier": {+ "kind": {+ "help": "该号码的类型。必须与配置的校验方式一致,因此拼写很重要。",+ "label": "类型"+ },+ "value": {+ "label": "号码",+ "placeholder": "DE123456789"+ }+ },+ "tax_rate": {+ "name": {+ "placeholder": "标准增值税"+ },+ "amount": {+ "help": "按百分比填写。20% 请填 20。",+ "label": "税率"+ },+ "jurisdiction": {+ "label": "适用范围"+ },+ "country_iso": {+ "help": "留空表示对所有国家征税。"+ },+ "state_code": {+ "help": "留空表示对整个国家征税。"+ },+ "tax_category_id": {+ "help": "该税率适用于哪些商品。",+ "label": "税务类别"+ },+ "included_in_price": {+ "help": "价格已包含该税费,因此从价格中拆分而非另行加收。",+ "label": "价格含税",+ "short": "含税"+ },+ "show_rate_in_label": {+ "help": "在客户看到的税费行中加上百分比。",+ "label": "在税费名称中显示税率"+ }+ },+ "tax_exemption_certificate": {+ "country_iso": {+ "help": "留空表示该证明在所有地区有效。"+ },+ "expires_at": {+ "help": "留空表示该证明长期有效。"+ }}},"delivery_profiles": {@@ -1733,6 +1838,7 @@"categories": "分类","claims": "索赔","collections": "系列",+ "companies": "企业","customer_groups": "分组","customers": "客户","draft_orders": "草稿订单",@@ -2842,6 +2948,10 @@"url": "URL"},"title": "Webhooks"+ },+ "tax_rates": {+ "add_sheet_title": "新建税率",+ "edit_sheet_title": "编辑税率"}},"staff": {@@ -3560,6 +3670,7 @@"stock_locations": "库存地点","store": "店铺","tax_categories": "税收类别",+ "tax_rates": "税率","webhooks": "Webhooks"}},@@ -3742,6 +3853,186 @@"saved": "翻译已保存","source": "源","title": "翻译"+ },+ "jurisdiction": {+ "everywhere": "所有地区"+ },+ "companies": {+ "add_cta": "添加企业",+ "add_sheet_title": "新建企业",+ "create_description": "企业客户通过分支机构下单。创建企业后即可添加分支机构、税务登记号和免税证明。",+ "create_label": "创建企业",+ "delete_confirm": {+ "message": "将删除 {{name}} 及其所有分支机构、采购人和证明。此操作无法撤销。",+ "title": "删除企业?"+ },+ "detail": {+ "delete_label": "删除企业",+ "load_error": "无法加载该企业",+ "profile": "企业"+ },+ "empty": "暂无企业",+ "locations_column": "分支机构",+ "messages": {+ "created": "企业已创建",+ "deleted": "企业已删除",+ "updated": "企业已更新"+ },+ "search_placeholder": "搜索企业"+ },+ "company_locations": {+ "add_cta": "添加分支机构",+ "add_title": "新建分支机构",+ "addresses": "地址",+ "billing_address": "账单地址",+ "contacts_count_one": "{{count}} 位采购人",+ "contacts_count_other": "{{count}} 位采购人",+ "detail": {+ "delete_label": "删除分支机构",+ "load_error": "无法加载该分支机构"+ },+ "dialog_description": "分支机构是开具发票和收货的地点。地址为选填,但一旦填写则需要姓名和国家/地区。",+ "edit_title": "编辑分支机构",+ "empty": "暂无分支机构",+ "messages": {+ "created": "分支机构已创建",+ "deleted": "分支机构已删除",+ "updated": "分支机构已更新"+ },+ "shipping_address": "收货地址",+ "shipping_same_as_billing": "收货地址与账单地址相同",+ "title": "分支机构"+ },+ "company_contacts": {+ "add_cta": "添加采购人",+ "add_title": "授权采购人",+ "dialog_description": "为该分支机构下单的客户。若客户只为一个分支机构采购,其订单会自动归属该机构。",+ "empty": "尚未授权任何采购人",+ "messages": {+ "created": "采购人已添加",+ "deleted": "采购人已移除"+ },+ "remove_action": "移除采购人",+ "remove_confirm": {+ "message": "{{email}} 将不再为该分支机构采购。其客户账户不受影响。",+ "title": "移除该采购人?"+ },+ "roles_enterprise_help": "在此添加的采购人可为该分支机构下单。角色、审批流程和支出限额由 Spree Enterprise 提供。",+ "roles_enterprise_title": "角色与审批为 Enterprise 功能",+ "title": "采购人"+ },+ "tax_identifiers": {+ "add_cta": "添加登记号",+ "add_title": "添加税务登记号",+ "checked_prefix": "核验于",+ "delete_confirm": {+ "message": "将移除 {{value}}。已完成的订单仍保留开票时使用的号码。",+ "title": "删除该登记号?"+ },+ "dialog_description": "发票上显示的增值税号或企业税号。欧盟企业间交易的反向征收机制依赖于它。",+ "edit_title": "编辑税务登记号",+ "empty": "尚未填写税务登记号",+ "kinds": {+ "au_abn": "澳大利亚企业号",+ "ch_vat": "瑞士增值税号",+ "eu_vat": "欧盟增值税号",+ "gb_vat": "英国增值税号",+ "us_ein": "美国雇主识别号"+ },+ "messages": {+ "created": "登记号已添加",+ "deleted": "登记号已删除",+ "updated": "登记号已更新",+ "validation_failed": "无法核验该号码",+ "validation_requested": "正在向登记机构核验该号码"+ },+ "not_validatable": "该类型未配置校验方式,将按填写的内容直接使用。",+ "select_kind": "选择类型",+ "title": "税务登记号",+ "validate_action": "向登记机构核验",+ "validation_status": {+ "not_checked": "未核验",+ "pending": "核验中",+ "unavailable": "登记机构不可用",+ "unsupported": "无法核验",+ "unverified": "无效",+ "verified": "已核验"+ }+ },+ "tax_exemption_certificates": {+ "add_cta": "添加证明",+ "add_title": "添加免税证明",+ "delete_confirm": {+ "message": "将移除证明 {{number}}。此操作无法撤销。",+ "title": "删除该证明?"+ },+ "dialog_description": "证明该企业的采购无需征税。新证明需经您接受后才会生效。",+ "download_action": "下载文件",+ "empty": "暂无证明",+ "expires_prefix": "有效期至",+ "lapsed": "已失效",+ "messages": {+ "created": "证明已添加",+ "deleted": "证明已删除",+ "revoked": "证明已撤销",+ "updated": "证明已更新",+ "verified": "证明已接受"+ },+ "never_expires": "长期有效",+ "no_document": "未附文件",+ "reason_codes": {+ "agricultural": "农业",+ "charitable": "慈善机构",+ "educational": "教育机构",+ "government": "政府机构",+ "manufacturing": "生产制造",+ "resale": "转售"+ },+ "revoke_action": "撤销",+ "revoke_confirm": {+ "message": "证明 {{number}} 将不再适用于新订单,但会作为记录保留。",+ "title": "撤销该证明?"+ },+ "select_reason": "选择事由",+ "status": {+ "expired": "已过期",+ "pending": "待审核",+ "revoked": "已撤销",+ "verified": "已接受"+ },+ "title": "免税证明",+ "verified_at": "接受日期",+ "verify_action": "接受"+ },+ "tax_rates": {+ "add_cta": "添加税率",+ "all_categories": "所有类别",+ "create_description": "税率用于配置内置的税费计算。未指定国家的税率适用于所有地区。",+ "create_label": "创建税率",+ "delete_confirm": {+ "message": "{{name}} 将不再适用。已完成的订单保留原先收取的税费。",+ "title": "删除税率?"+ },+ "edit_description": "修改仅影响新的计算。已完成的订单保留原先收取的税费。",+ "empty": "暂无税率",+ "every_country": "所有国家",+ "every_state": "所有省/州",+ "messages": {+ "created": "税率已创建",+ "deleted": "税率已删除",+ "updated": "税率已更新"+ },+ "search_placeholder": "搜索税率",+ "select_category": "选择类别"+ },+ "tax_providers": {+ "limitations_title": "{{name}} 不支持",+ "unavailable_option": "{{name}}(未配置)",+ "use_default": "使用默认计算引擎",+ "use_default_named": "默认({{name}})"+ },+ "enterprise": {+ "learn_more": "了解 Spree Enterprise"}}}diff --git a/packages/dashboard/src/nav/default.ts b/packages/dashboard/src/nav/default.tsindex 997d2541cb..b7ea9096e6 100644--- a/packages/dashboard/src/nav/default.ts+++ b/packages/dashboard/src/nav/default.ts@@ -146,6 +146,13 @@ nav.add({subject: Subject.CustomerGroup,position: 100,},+ {+ key: 'customers.companies',+ label: i18n.t('admin.nav.companies'),+ path: '/companies',+ subject: Subject.Company,+ position: 200,+ },],})diff --git a/packages/dashboard/src/nav/settings.ts b/packages/dashboard/src/nav/settings.tsindex 5216507e5a..7b319493f8 100644--- a/packages/dashboard/src/nav/settings.ts+++ b/packages/dashboard/src/nav/settings.ts@@ -8,6 +8,7 @@ import {PercentIcon,PlugIcon,RadioTowerIcon,+ ReceiptTextIcon,RotateCcwIcon,ShapesIcon,ShieldCheckIcon,@@ -92,6 +93,16 @@ settingsNav.add({subject: Subject.TaxCategory,})+settingsNav.add({+ key: 'settings.tax-rates',+ labelKey: 'admin.settings_nav.items.tax_rates',+ path: '/tax-rates',+ icon: ReceiptTextIcon,+ group: 'payments',+ position: 250,+ subject: Subject.TaxRate,+})+settingsNav.add({key: 'settings.markets',labelKey: 'admin.settings_nav.items.markets',diff --git a/packages/dashboard/src/routeTree.gen.ts b/packages/dashboard/src/routeTree.gen.tsindex 91eafbf9a8..b1a684b165 100644--- a/packages/dashboard/src/routeTree.gen.ts+++ b/packages/dashboard/src/routeTree.gen.ts@@ -29,6 +29,8 @@ import { Route as PromotionsIndexRouteImport } from './routes/_authenticated/$stimport { Route as ProductsIndexRouteImport } from './routes/_authenticated/$storeId/products/index'import { Route as OrdersIndexRouteImport } from './routes/_authenticated/$storeId/orders/index'import { Route as CustomersIndexRouteImport } from './routes/_authenticated/$storeId/customers/index'+import { Route as CompaniesIndexRouteImport } from './routes/_authenticated/$storeId/companies/index'+import { Route as SettingsTaxRatesRouteImport } from './routes/_authenticated/$storeId/settings/tax-rates'import { Route as SettingsTaxCategoriesRouteImport } from './routes/_authenticated/$storeId/settings/tax-categories'import { Route as SettingsStoreRouteImport } from './routes/_authenticated/$storeId/settings/store'import { Route as SettingsStockLocationsRouteImport } from './routes/_authenticated/$storeId/settings/stock-locations'@@ -55,6 +57,7 @@ import { Route as OrdersNewRouteImport } from './routes/_authenticated/$storeId/import { Route as OrdersDraftsRouteImport } from './routes/_authenticated/$storeId/orders/drafts'import { Route as CustomersGroupsRouteImport } from './routes/_authenticated/$storeId/customers/groups'import { Route as CustomersCustomerIdRouteImport } from './routes/_authenticated/$storeId/customers/$customerId'+import { Route as CompaniesCompanyIdRouteImport } from './routes/_authenticated/$storeId/companies/$companyId'import { Route as SettingsWebhooksIndexRouteImport } from './routes/_authenticated/$storeId/settings/webhooks/index'import { Route as SettingsImportsIndexRouteImport } from './routes/_authenticated/$storeId/settings/imports/index'import { Route as SettingsDeliveryProfilesIndexRouteImport } from './routes/_authenticated/$storeId/settings/delivery-profiles/index'@@ -69,6 +72,7 @@ import { Route as ProductsCollectionsCollectionIdRouteImport } from './routes/_aimport { Route as ProductsCategoriesNewRouteImport } from './routes/_authenticated/$storeId/products/categories/new'import { Route as ProductsCategoriesCategoryIdRouteImport } from './routes/_authenticated/$storeId/products/categories/$categoryId'import { Route as OrdersOrderIdEditRouteImport } from './routes/_authenticated/$storeId/orders/$orderId/edit'+import { Route as CompaniesLocationsDotlocationIdRouteImport } from './routes/_authenticated/$storeId/companies/locations.$locationId'import { Route as SettingsDeliveryProfilesProfileIdIndexRouteImport } from './routes/_authenticated/$storeId/settings/delivery-profiles/$profileId/index'import { Route as ProductsPriceListsPriceListIdIndexRouteImport } from './routes/_authenticated/$storeId/products/price-lists/$priceListId/index'import { Route as SettingsDeliveryProfilesProfileIdMethodsNewRouteImport } from './routes/_authenticated/$storeId/settings/delivery-profiles/$profileId/methods/new'@@ -174,6 +178,16 @@ const CustomersIndexRoute = CustomersIndexRouteImport.update({path: '/customers/',getParentRoute: () => authenticatedStoreIdRoute,} as any)+const CompaniesIndexRoute = CompaniesIndexRouteImport.update({+ id: '/companies/',+ path: '/companies/',+ getParentRoute: () => authenticatedStoreIdRoute,+} as any)+const SettingsTaxRatesRoute = SettingsTaxRatesRouteImport.update({+ id: '/tax-rates',+ path: '/tax-rates',+ getParentRoute: () => SettingsRoute,+} as any)const SettingsTaxCategoriesRoute = SettingsTaxCategoriesRouteImport.update({id: '/tax-categories',path: '/tax-categories',@@ -305,6 +319,11 @@ const CustomersCustomerIdRoute = CustomersCustomerIdRouteImport.update({path: '/customers/$customerId',getParentRoute: () => authenticatedStoreIdRoute,} as any)+const CompaniesCompanyIdRoute = CompaniesCompanyIdRouteImport.update({+ id: '/companies/$companyId',+ path: '/companies/$companyId',+ getParentRoute: () => authenticatedStoreIdRoute,+} as any)const SettingsWebhooksIndexRoute = SettingsWebhooksIndexRouteImport.update({id: '/webhooks/',path: '/webhooks/',@@ -380,6 +399,12 @@ const OrdersOrderIdEditRoute = OrdersOrderIdEditRouteImport.update({path: '/orders/$orderId/edit',getParentRoute: () => authenticatedStoreIdRoute,} as any)+const CompaniesLocationsDotlocationIdRoute =+ CompaniesLocationsDotlocationIdRouteImport.update({+ id: '/companies/locations/$locationId',+ path: '/companies/locations/$locationId',+ getParentRoute: () => authenticatedStoreIdRoute,+ } as any)const SettingsDeliveryProfilesProfileIdIndexRoute =SettingsDeliveryProfilesProfileIdIndexRouteImport.update({id: '/delivery-profiles/$profileId/',@@ -420,6 +445,7 @@ export interface FileRoutesByFullPath {'/$storeId/returns': typeof ReturnsRoute'/$storeId/settings': typeof SettingsRouteWithChildren'/$storeId/': typeof IndexRoute+ '/$storeId/companies/$companyId': typeof CompaniesCompanyIdRoute'/$storeId/customers/$customerId': typeof CustomersCustomerIdRoute'/$storeId/customers/groups': typeof CustomersGroupsRoute'/$storeId/orders/drafts': typeof OrdersDraftsRoute@@ -446,11 +472,14 @@ export interface FileRoutesByFullPath {'/$storeId/settings/stock-locations': typeof SettingsStockLocationsRoute'/$storeId/settings/store': typeof SettingsStoreRoute'/$storeId/settings/tax-categories': typeof SettingsTaxCategoriesRoute+ '/$storeId/settings/tax-rates': typeof SettingsTaxRatesRoute+ '/$storeId/companies/': typeof CompaniesIndexRoute'/$storeId/customers/': typeof CustomersIndexRoute'/$storeId/orders/': typeof OrdersIndexRoute'/$storeId/products/': typeof ProductsIndexRoute'/$storeId/promotions/': typeof PromotionsIndexRoute'/$storeId/settings/': typeof SettingsIndexRoute+ '/$storeId/companies/locations/$locationId': typeof CompaniesLocationsDotlocationIdRoute'/$storeId/orders/$orderId/edit': typeof OrdersOrderIdEditRoute'/$storeId/products/categories/$categoryId': typeof ProductsCategoriesCategoryIdRoute'/$storeId/products/categories/new': typeof ProductsCategoriesNewRoute@@ -483,6 +512,7 @@ export interface FileRoutesByTo {'/$storeId/getting-started': typeof GettingStartedRoute'/$storeId/returns': typeof ReturnsRoute'/$storeId': typeof IndexRoute+ '/$storeId/companies/$companyId': typeof CompaniesCompanyIdRoute'/$storeId/customers/$customerId': typeof CustomersCustomerIdRoute'/$storeId/customers/groups': typeof CustomersGroupsRoute'/$storeId/orders/drafts': typeof OrdersDraftsRoute@@ -509,11 +539,14 @@ export interface FileRoutesByTo {'/$storeId/settings/stock-locations': typeof SettingsStockLocationsRoute'/$storeId/settings/store': typeof SettingsStoreRoute'/$storeId/settings/tax-categories': typeof SettingsTaxCategoriesRoute+ '/$storeId/settings/tax-rates': typeof SettingsTaxRatesRoute+ '/$storeId/companies': typeof CompaniesIndexRoute'/$storeId/customers': typeof CustomersIndexRoute'/$storeId/orders': typeof OrdersIndexRoute'/$storeId/products': typeof ProductsIndexRoute'/$storeId/promotions': typeof PromotionsIndexRoute'/$storeId/settings': typeof SettingsIndexRoute+ '/$storeId/companies/locations/$locationId': typeof CompaniesLocationsDotlocationIdRoute'/$storeId/orders/$orderId/edit': typeof OrdersOrderIdEditRoute'/$storeId/products/categories/$categoryId': typeof ProductsCategoriesCategoryIdRoute'/$storeId/products/categories/new': typeof ProductsCategoriesNewRoute@@ -550,6 +583,7 @@ export interface FileRoutesById {'/_authenticated/$storeId/returns': typeof ReturnsRoute'/_authenticated/$storeId/settings': typeof SettingsRouteWithChildren'/_authenticated/$storeId/': typeof IndexRoute+ '/_authenticated/$storeId/companies/$companyId': typeof CompaniesCompanyIdRoute'/_authenticated/$storeId/customers/$customerId': typeof CustomersCustomerIdRoute'/_authenticated/$storeId/customers/groups': typeof CustomersGroupsRoute'/_authenticated/$storeId/orders/drafts': typeof OrdersDraftsRoute@@ -576,11 +610,14 @@ export interface FileRoutesById {'/_authenticated/$storeId/settings/stock-locations': typeof SettingsStockLocationsRoute'/_authenticated/$storeId/settings/store': typeof SettingsStoreRoute'/_authenticated/$storeId/settings/tax-categories': typeof SettingsTaxCategoriesRoute+ '/_authenticated/$storeId/settings/tax-rates': typeof SettingsTaxRatesRoute+ '/_authenticated/$storeId/companies/': typeof CompaniesIndexRoute'/_authenticated/$storeId/customers/': typeof CustomersIndexRoute'/_authenticated/$storeId/orders/': typeof OrdersIndexRoute'/_authenticated/$storeId/products/': typeof ProductsIndexRoute'/_authenticated/$storeId/promotions/': typeof PromotionsIndexRoute'/_authenticated/$storeId/settings/': typeof SettingsIndexRoute+ '/_authenticated/$storeId/companies/locations/$locationId': typeof CompaniesLocationsDotlocationIdRoute'/_authenticated/$storeId/orders/$orderId/edit': typeof OrdersOrderIdEditRoute'/_authenticated/$storeId/products/categories/$categoryId': typeof ProductsCategoriesCategoryIdRoute'/_authenticated/$storeId/products/categories/new': typeof ProductsCategoriesNewRoute@@ -617,6 +654,7 @@ export interface FileRouteTypes {| '/$storeId/returns'| '/$storeId/settings'| '/$storeId/'+ | '/$storeId/companies/$companyId'| '/$storeId/customers/$customerId'| '/$storeId/customers/groups'| '/$storeId/orders/drafts'@@ -643,11 +681,14 @@ export interface FileRouteTypes {| '/$storeId/settings/stock-locations'| '/$storeId/settings/store'| '/$storeId/settings/tax-categories'+ | '/$storeId/settings/tax-rates'+ | '/$storeId/companies/'| '/$storeId/customers/'| '/$storeId/orders/'| '/$storeId/products/'| '/$storeId/promotions/'| '/$storeId/settings/'+ | '/$storeId/companies/locations/$locationId'| '/$storeId/orders/$orderId/edit'| '/$storeId/products/categories/$categoryId'| '/$storeId/products/categories/new'@@ -680,6 +721,7 @@ export interface FileRouteTypes {| '/$storeId/getting-started'| '/$storeId/returns'| '/$storeId'+ | '/$storeId/companies/$companyId'| '/$storeId/customers/$customerId'| '/$storeId/customers/groups'| '/$storeId/orders/drafts'@@ -706,11 +748,14 @@ export interface FileRouteTypes {| '/$storeId/settings/stock-locations'| '/$storeId/settings/store'| '/$storeId/settings/tax-categories'+ | '/$storeId/settings/tax-rates'+ | '/$storeId/companies'| '/$storeId/customers'| '/$storeId/orders'| '/$storeId/products'| '/$storeId/promotions'| '/$storeId/settings'+ | '/$storeId/companies/locations/$locationId'| '/$storeId/orders/$orderId/edit'| '/$storeId/products/categories/$categoryId'| '/$storeId/products/categories/new'@@ -746,6 +791,7 @@ export interface FileRouteTypes {| '/_authenticated/$storeId/returns'| '/_authenticated/$storeId/settings'| '/_authenticated/$storeId/'+ | '/_authenticated/$storeId/companies/$companyId'| '/_authenticated/$storeId/customers/$customerId'| '/_authenticated/$storeId/customers/groups'| '/_authenticated/$storeId/orders/drafts'@@ -772,11 +818,14 @@ export interface FileRouteTypes {| '/_authenticated/$storeId/settings/stock-locations'| '/_authenticated/$storeId/settings/store'| '/_authenticated/$storeId/settings/tax-categories'+ | '/_authenticated/$storeId/settings/tax-rates'+ | '/_authenticated/$storeId/companies/'| '/_authenticated/$storeId/customers/'| '/_authenticated/$storeId/orders/'| '/_authenticated/$storeId/products/'| '/_authenticated/$storeId/promotions/'| '/_authenticated/$storeId/settings/'+ | '/_authenticated/$storeId/companies/locations/$locationId'| '/_authenticated/$storeId/orders/$orderId/edit'| '/_authenticated/$storeId/products/categories/$categoryId'| '/_authenticated/$storeId/products/categories/new'@@ -948,6 +997,20 @@ declare module '@tanstack/react-router' {preLoaderRoute: typeof CustomersIndexRouteImportparentRoute: typeof authenticatedStoreIdRoute}+ '/_authenticated/$storeId/companies/': {+ id: '/_authenticated/$storeId/companies/'+ path: '/companies'+ fullPath: '/$storeId/companies/'+ preLoaderRoute: typeof CompaniesIndexRouteImport+ parentRoute: typeof authenticatedStoreIdRoute+ }+ '/_authenticated/$storeId/settings/tax-rates': {+ id: '/_authenticated/$storeId/settings/tax-rates'+ path: '/tax-rates'+ fullPath: '/$storeId/settings/tax-rates'+ preLoaderRoute: typeof SettingsTaxRatesRouteImport+ parentRoute: typeof SettingsRoute+ }'/_authenticated/$storeId/settings/tax-categories': {id: '/_authenticated/$storeId/settings/tax-categories'path: '/tax-categories'@@ -1130,6 +1193,13 @@ declare module '@tanstack/react-router' {preLoaderRoute: typeof CustomersCustomerIdRouteImportparentRoute: typeof authenticatedStoreIdRoute}+ '/_authenticated/$storeId/companies/$companyId': {+ id: '/_authenticated/$storeId/companies/$companyId'+ path: '/companies/$companyId'+ fullPath: '/$storeId/companies/$companyId'+ preLoaderRoute: typeof CompaniesCompanyIdRouteImport+ parentRoute: typeof authenticatedStoreIdRoute+ }'/_authenticated/$storeId/settings/webhooks/': {id: '/_authenticated/$storeId/settings/webhooks/'path: '/webhooks'@@ -1228,6 +1298,13 @@ declare module '@tanstack/react-router' {preLoaderRoute: typeof OrdersOrderIdEditRouteImportparentRoute: typeof authenticatedStoreIdRoute}+ '/_authenticated/$storeId/companies/locations/$locationId': {+ id: '/_authenticated/$storeId/companies/locations/$locationId'+ path: '/companies/locations/$locationId'+ fullPath: '/$storeId/companies/locations/$locationId'+ preLoaderRoute: typeof CompaniesLocationsDotlocationIdRouteImport+ parentRoute: typeof authenticatedStoreIdRoute+ }'/_authenticated/$storeId/settings/delivery-profiles/$profileId/': {id: '/_authenticated/$storeId/settings/delivery-profiles/$profileId/'path: '/delivery-profiles/$profileId'@@ -1275,6 +1352,7 @@ interface SettingsRouteChildren {SettingsStockLocationsRoute: typeof SettingsStockLocationsRouteSettingsStoreRoute: typeof SettingsStoreRouteSettingsTaxCategoriesRoute: typeof SettingsTaxCategoriesRoute+ SettingsTaxRatesRoute: typeof SettingsTaxRatesRouteSettingsIndexRoute: typeof SettingsIndexRouteSettingsWebhooksWebhookEndpointIdRoute: typeof SettingsWebhooksWebhookEndpointIdRouteSettingsDeliveryProfilesIndexRoute: typeof SettingsDeliveryProfilesIndexRoute@@ -1301,6 +1379,7 @@ const SettingsRouteChildren: SettingsRouteChildren = {SettingsStockLocationsRoute: SettingsStockLocationsRoute,SettingsStoreRoute: SettingsStoreRoute,SettingsTaxCategoriesRoute: SettingsTaxCategoriesRoute,+ SettingsTaxRatesRoute: SettingsTaxRatesRoute,SettingsIndexRoute: SettingsIndexRoute,SettingsWebhooksWebhookEndpointIdRoute:SettingsWebhooksWebhookEndpointIdRoute,@@ -1327,6 +1406,7 @@ interface authenticatedStoreIdRouteChildren {ReturnsRoute: typeof ReturnsRouteSettingsRoute: typeof SettingsRouteWithChildrenIndexRoute: typeof IndexRoute+ CompaniesCompanyIdRoute: typeof CompaniesCompanyIdRouteCustomersCustomerIdRoute: typeof CustomersCustomerIdRouteCustomersGroupsRoute: typeof CustomersGroupsRouteOrdersDraftsRoute: typeof OrdersDraftsRoute@@ -1338,10 +1418,12 @@ interface authenticatedStoreIdRouteChildren {PromotionsPromotionIdRoute: typeof PromotionsPromotionIdRoutePromotionsGiftCardsRoute: typeof PromotionsGiftCardsRoutePromotionsNewRoute: typeof PromotionsNewRoute+ CompaniesIndexRoute: typeof CompaniesIndexRouteCustomersIndexRoute: typeof CustomersIndexRouteOrdersIndexRoute: typeof OrdersIndexRouteProductsIndexRoute: typeof ProductsIndexRoutePromotionsIndexRoute: typeof PromotionsIndexRoute+ CompaniesLocationsDotlocationIdRoute: typeof CompaniesLocationsDotlocationIdRouteOrdersOrderIdEditRoute: typeof OrdersOrderIdEditRouteProductsCategoriesCategoryIdRoute: typeof ProductsCategoriesCategoryIdRouteProductsCategoriesNewRoute: typeof ProductsCategoriesNewRoute@@ -1363,6 +1445,7 @@ const authenticatedStoreIdRouteChildren: authenticatedStoreIdRouteChildren = {ReturnsRoute: ReturnsRoute,SettingsRoute: SettingsRouteWithChildren,IndexRoute: IndexRoute,+ CompaniesCompanyIdRoute: CompaniesCompanyIdRoute,CustomersCustomerIdRoute: CustomersCustomerIdRoute,CustomersGroupsRoute: CustomersGroupsRoute,OrdersDraftsRoute: OrdersDraftsRoute,@@ -1374,10 +1457,12 @@ const authenticatedStoreIdRouteChildren: authenticatedStoreIdRouteChildren = {PromotionsPromotionIdRoute: PromotionsPromotionIdRoute,PromotionsGiftCardsRoute: PromotionsGiftCardsRoute,PromotionsNewRoute: PromotionsNewRoute,+ CompaniesIndexRoute: CompaniesIndexRoute,CustomersIndexRoute: CustomersIndexRoute,OrdersIndexRoute: OrdersIndexRoute,ProductsIndexRoute: ProductsIndexRoute,PromotionsIndexRoute: PromotionsIndexRoute,+ CompaniesLocationsDotlocationIdRoute: CompaniesLocationsDotlocationIdRoute,OrdersOrderIdEditRoute: OrdersOrderIdEditRoute,ProductsCategoriesCategoryIdRoute: ProductsCategoriesCategoryIdRoute,ProductsCategoriesNewRoute: ProductsCategoriesNewRoute,diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/companies/$companyId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/companies/$companyId.tsxnew file mode 100644index 0000000000..10e63c8048--- /dev/null+++ b/packages/dashboard/src/routes/_authenticated/$storeId/companies/$companyId.tsx@@ -0,0 +1,300 @@+import { zodResolver } from '@hookform/resolvers/zod'+import type { Company, CompanyLocation } from '@spree/admin-sdk'+import {+ mapSpreeErrorsToForm,+ PageHeader,+ Slot,+ Subject,+ usePermissions,+} from '@spree/dashboard-core'+import {+ Badge,+ Button,+ Card,+ CardAction,+ CardContent,+ CardHeader,+ CardTitle,+ ErrorState,+ Field,+ FieldDescription,+ FieldError,+ FieldGroup,+ FieldLabel,+ Input,+ Pagination,+ ResourceLayout,+} from '@spree/dashboard-ui'+import { createFileRoute, Link, useNavigate } from '@tanstack/react-router'+import { PlusIcon } from 'lucide-react'+import { useEffect, useState } from 'react'+import { useForm } from 'react-hook-form'+import { useTranslation } from 'react-i18next'+import { CompanyLocationSheet } from '../../../../components/spree/company-location-sheet'+import { TaxExemptionCertificatesCard } from '../../../../components/spree/tax-exemption-certificates-card'+import { TaxIdentifiersCard } from '../../../../components/spree/tax-identifiers-card'+import {+ useCompany,+ useCompanyLocations,+ useCompanyTaxIdentifiers,+ useCreateCompanyTaxIdentifier,+ useDeleteCompany,+ useDeleteCompanyTaxIdentifier,+ useUpdateCompany,+ useUpdateCompanyTaxIdentifier,+ useValidateCompanyTaxIdentifier,+} from '../../../../hooks/use-companies'+import {+ COMPANY_DEFAULTS,+ type CompanyFormValues,+ companyFormSchema,+ companyValuesToParams,+} from '../../../../schemas/company'++export const Route = createFileRoute('/_authenticated/$storeId/companies/$companyId')({+ component: CompanyDetailPage,+})++function CompanyDetailPage() {+ const { t } = useTranslation()+ const { companyId } = Route.useParams()+ const { data: company, isLoading, error, refetch } = useCompany(companyId)++ if (isLoading) return <p className="text-muted-foreground">{t('admin.common.loading')}</p>+ if (error || !company) {+ return (+ <ErrorState+ title={t('admin.companies.detail.load_error')}+ error={error as Error | undefined}+ onRetry={() => refetch()}+ />+ )+ }++ return <CompanyBody company={company} />+}++function CompanyBody({ company }: { company: Company }) {+ const { t } = useTranslation()+ const { storeId } = Route.useParams()+ const navigate = useNavigate()+ const { permissions } = usePermissions()+ const deleteMutation = useDeleteCompany()++ const canEdit = permissions.can('update', Subject.Company)++ async function handleDelete() {+ await deleteMutation.mutateAsync(company.id)+ navigate({ to: '/$storeId/companies', params: { storeId } })+ }++ return (+ <ResourceLayout+ header={+ <PageHeader+ title={company.name}+ subtitle={company.external_id ?? undefined}+ backTo="companies"+ resource={{ id: company.id }}+ onDelete={permissions.can('destroy', Subject.Company) ? handleDelete : undefined}+ deleteLabel={t('admin.companies.detail.delete_label')}+ />+ }+ main={+ <>+ <CompanyLocationsCard company={company} canEdit={canEdit} />+ <TaxExemptionCertificatesCard companyId={company.id} canEdit={canEdit} />+ {/* Company-wide panels an extension owns: roles, purchase limits,+ approval settings (docs: Enterprise b2b-companies plan). */}+ <Slot name="company.form_main" context={{ company, canEdit }} />+ </>+ }+ sidebar={+ <>+ <CompanyProfileCard company={company} canEdit={canEdit} />+ <CompanyTaxIdentifiersCard companyId={company.id} canEdit={canEdit} />+ <Slot name="company.form_sidebar" context={{ company, canEdit }} />+ </>+ }+ />+ )+}++function CompanyProfileCard({ company, canEdit }: { company: Company; canEdit: boolean }) {+ const { t } = useTranslation()+ const updateMutation = useUpdateCompany(company.id)++ const form = useForm<CompanyFormValues>({+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ resolver: zodResolver(companyFormSchema) as any,+ defaultValues: COMPANY_DEFAULTS,+ })++ useEffect(() => {+ form.reset({ name: company.name, external_id: company.external_id ?? '' })+ }, [company, form])++ async function onSubmit(values: CompanyFormValues) {+ try {+ await updateMutation.mutateAsync(companyValuesToParams(values))+ form.reset(values)+ } catch (err) {+ if (!mapSpreeErrorsToForm(err, form.setError)) throw err+ }+ }++ const { errors } = form.formState++ return (+ <Card>+ <CardHeader>+ <CardTitle>{t('admin.companies.detail.profile')}</CardTitle>+ </CardHeader>+ <CardContent>+ <FieldGroup>+ {errors.root?.message && (+ <p className="text-destructive text-sm" role="alert">+ {errors.root.message}+ </p>+ )}+ <Field>+ <FieldLabel htmlFor="company-name">{t('admin.fields.name.label')}</FieldLabel>+ <Input+ id="company-name"+ disabled={!canEdit}+ aria-invalid={!!errors.name || undefined}+ {...form.register('name')}+ />+ <FieldError errors={[errors.name]} />+ </Field>+ <Field>+ <FieldLabel htmlFor="company-external-id">+ {t('admin.fields.external_id.label')}+ </FieldLabel>+ <Input+ id="company-external-id"+ disabled={!canEdit}+ aria-invalid={!!errors.external_id || undefined}+ {...form.register('external_id')}+ />+ <FieldDescription>{t('admin.fields.company.external_id.help')}</FieldDescription>+ <FieldError errors={[errors.external_id]} />+ </Field>+ {canEdit && (+ <div className="flex justify-end">+ {/* This card sits inside a page that is not itself a form, but+ keep it a button so nesting never becomes a problem. */}+ <Button+ type="button"+ size="sm"+ disabled={form.formState.isSubmitting || !form.formState.isDirty}+ onClick={form.handleSubmit(onSubmit)}+ >+ {form.formState.isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}+ </Button>+ </div>+ )}+ </FieldGroup>+ </CardContent>+ </Card>+ )+}++function CompanyTaxIdentifiersCard({+ companyId,+ canEdit,+}: {+ companyId: string+ canEdit: boolean+}) {+ const { data, isLoading } = useCompanyTaxIdentifiers(companyId)+ const createMutation = useCreateCompanyTaxIdentifier(companyId)+ const updateMutation = useUpdateCompanyTaxIdentifier(companyId)+ const deleteMutation = useDeleteCompanyTaxIdentifier(companyId)+ const validateMutation = useValidateCompanyTaxIdentifier(companyId)++ return (+ <TaxIdentifiersCard+ identifiers={data?.data ?? []}+ isLoading={isLoading}+ canEdit={canEdit}+ mutations={{+ create: (params) => createMutation.mutateAsync(params),+ update: (id, params) => updateMutation.mutateAsync({ id, params }),+ remove: (id) => deleteMutation.mutateAsync(id),+ validate: (id) => validateMutation.mutateAsync(id),+ isValidating: validateMutation.isPending,+ }}+ />+ )+}++function CompanyLocationsCard({ company, canEdit }: { company: Company; canEdit: boolean }) {+ const { t } = useTranslation()+ const { storeId } = Route.useParams()+ const [page, setPage] = useState(1)+ const { data, isLoading } = useCompanyLocations(company.id, page)+ const [addOpen, setAddOpen] = useState(false)++ const locations = data?.data ?? []+ const meta = data?.meta++ return (+ <Card>+ <CardHeader>+ <CardTitle>+ {t('admin.company_locations.title')}+ {meta?.count ? <Badge variant="outline">{meta.count}</Badge> : null}+ </CardTitle>+ {canEdit && (+ <CardAction>+ <Button size="sm" variant="outline" onClick={() => setAddOpen(true)}>+ <PlusIcon className="size-4" />+ {t('admin.company_locations.add_cta')}+ </Button>+ </CardAction>+ )}+ </CardHeader>++ {isLoading ? (+ <CardContent>+ <p className="text-muted-foreground text-sm">{t('admin.common.loading')}</p>+ </CardContent>+ ) : locations.length === 0 ? (+ <CardContent>+ <p className="text-muted-foreground text-sm">{t('admin.company_locations.empty')}</p>+ </CardContent>+ ) : (+ <CardContent className="p-0">+ <div className="flex flex-col">+ {locations.map((location: CompanyLocation) => (+ <Link+ key={location.id}+ to={'/$storeId/companies/locations/$locationId' as string}+ params={{ storeId, locationId: location.id }}+ className="flex items-start justify-between gap-3 border-b px-6 py-3 no-underline last:border-b-0 hover:bg-muted/50"+ >+ <div className="flex min-w-0 flex-col">+ <span className="font-medium text-foreground text-sm">{location.name}</span>+ <span className="text-muted-foreground text-xs">+ {[location.billing_address?.city, location.billing_address?.country_name]+ .filter(Boolean)+ .join(', ')}+ </span>+ </div>+ <span className="shrink-0 text-muted-foreground text-xs">+ {t('admin.company_locations.contacts_count', {+ count: location.contacts_count,+ })}+ </span>+ </Link>+ ))}+ </div>+ {meta && <Pagination meta={meta} onPageChange={setPage} />}+ </CardContent>+ )}++ {addOpen && <CompanyLocationSheet companyId={company.id} open onOpenChange={setAddOpen} />}+ </Card>+ )+}diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/companies/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/companies/index.tsxnew file mode 100644index 0000000000..da44212701--- /dev/null+++ b/packages/dashboard/src/routes/_authenticated/$storeId/companies/index.tsx@@ -0,0 +1,229 @@+import { zodResolver } from '@hookform/resolvers/zod'+import type { Company } from '@spree/admin-sdk'+import {+ adminClient,+ Can,+ mapSpreeErrorsToForm,+ ResourceTable,+ resourceSearchSchema,+ Subject,+ usePermissions,+} from '@spree/dashboard-core'+import {+ Button,+ Field,+ FieldDescription,+ FieldError,+ FieldGroup,+ FieldLabel,+ Input,+ RowActions,+ Sheet,+ SheetContent,+ SheetDescription,+ SheetFooter,+ SheetHeader,+ SheetTitle,+ useConfirm,+} from '@spree/dashboard-ui'+import { createFileRoute, useNavigate } from '@tanstack/react-router'+import { PlusIcon } from 'lucide-react'+import { useForm } from 'react-hook-form'+import { useTranslation } from 'react-i18next'+import { z } from 'zod/v4'+import { useCreateCompany, useDeleteCompany } from '../../../../hooks/use-companies'+import {+ COMPANY_DEFAULTS,+ type CompanyFormValues,+ companyFormSchema,+ companyValuesToParams,+} from '../../../../schemas/company'+import '../../../../tables/companies'++const companiesSearchSchema = resourceSearchSchema.extend({+ new: z.coerce.boolean().optional(),+})++export const Route = createFileRoute('/_authenticated/$storeId/companies/')({+ validateSearch: companiesSearchSchema,+ component: CompaniesPage,+})++function CompaniesPage() {+ const { t } = useTranslation()+ const search = Route.useSearch() as z.infer<typeof companiesSearchSchema>+ const { storeId } = Route.useParams()+ const navigate = useNavigate()+ const confirm = useConfirm()+ const deleteMutation = useDeleteCompany()+ const { permissions } = usePermissions()++ const isCreating = !!search.new++ const closeSheet = () =>+ navigate({+ search: (prev: Record<string, unknown>) => {+ const { new: _n, ...rest } = prev+ return rest as never+ },+ })++ const openCreate = () =>+ navigate({ search: (prev: Record<string, unknown>) => ({ ...prev, new: true }) as never })++ async function handleDelete(company: Company) {+ const ok = await confirm({+ title: t('admin.companies.delete_confirm.title'),+ message: t('admin.companies.delete_confirm.message', { name: company.name ?? '' }),+ variant: 'destructive',+ confirmLabel: t('admin.actions.delete'),+ })+ if (!ok) return+ await deleteMutation.mutateAsync(company.id).catch(() => undefined)+ }++ return (+ <>+ <ResourceTable<Company>+ tableKey="companies"+ queryKey="companies"+ queryFn={(params) => adminClient.companies.list(params)}+ searchParams={search}+ rowActions={(company) => (+ <RowActions+ actions={[+ {+ key: 'edit',+ onSelect: () =>+ navigate({+ to: '/$storeId/companies/$companyId',+ params: { storeId, companyId: company.id },+ }),+ },+ {+ key: 'delete',+ destructive: true,+ visible: permissions.can('destroy', Subject.Company),+ disabled: deleteMutation.isPending,+ onSelect: () => handleDelete(company),+ },+ ]}+ />+ )}+ actions={+ <Can I="create" a={Subject.Company}>+ <Button size="sm" className="h-[2.125rem]" onClick={openCreate}>+ <PlusIcon className="size-4" />+ {t('admin.companies.add_cta')}+ </Button>+ </Can>+ }+ />++ {isCreating && <CreateCompanySheet open onOpenChange={(o) => !o && closeSheet()} />}+ </>+ )+}++function CreateCompanySheet({+ open,+ onOpenChange,+}: {+ open: boolean+ onOpenChange: (open: boolean) => void+}) {+ const { t } = useTranslation()+ const { storeId } = Route.useParams()+ const navigate = useNavigate()+ const createMutation = useCreateCompany()+ const form = useForm<CompanyFormValues>({+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ resolver: zodResolver(companyFormSchema) as any,+ defaultValues: COMPANY_DEFAULTS,+ })++ // A new company has no branches, registration or certificates yet, and all+ // three live on its detail page — so that is where the merchant is headed.+ async function onSubmit(values: CompanyFormValues) {+ try {+ const company = await createMutation.mutateAsync(companyValuesToParams(values))+ form.reset(COMPANY_DEFAULTS)+ onOpenChange(false)+ navigate({+ to: '/$storeId/companies/$companyId',+ params: { storeId, companyId: company.id },+ })+ } catch (err) {+ if (!mapSpreeErrorsToForm(err, form.setError)) throw err+ }+ }++ const { errors } = form.formState++ return (+ <Sheet+ open={open}+ onOpenChange={(next) => {+ if (!next) form.reset(COMPANY_DEFAULTS)+ onOpenChange(next)+ }}+ >+ <SheetContent>+ <SheetHeader>+ <SheetTitle>{t('admin.companies.add_sheet_title')}</SheetTitle>+ <SheetDescription>{t('admin.companies.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">+ <FieldGroup>+ {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.company.name.placeholder')}+ aria-invalid={!!errors.name || undefined}+ {...form.register('name')}+ />+ <FieldError errors={[errors.name]} />+ </Field>++ <Field>+ <FieldLabel htmlFor="external_id">{t('admin.fields.external_id.label')}</FieldLabel>+ <Input+ id="external_id"+ placeholder={t('admin.fields.company.external_id.placeholder')}+ aria-invalid={!!errors.external_id || undefined}+ {...form.register('external_id')}+ />+ <FieldDescription>{t('admin.fields.company.external_id.help')}</FieldDescription>+ <FieldError errors={[errors.external_id]} />+ </Field>+ </FieldGroup>+ </div>+ <SheetFooter>+ <Button+ type="button"+ variant="outline"+ size="sm"+ onClick={() => onOpenChange(false)}+ disabled={form.formState.isSubmitting}+ >+ {t('admin.actions.cancel')}+ </Button>+ <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>+ {form.formState.isSubmitting+ ? t('admin.actions.creating')+ : t('admin.companies.create_label')}+ </Button>+ </SheetFooter>+ </form>+ </SheetContent>+ </Sheet>+ )+}diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/companies/locations.$locationId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/companies/locations.$locationId.tsxnew file mode 100644index 0000000000..da56687bf5--- /dev/null+++ b/packages/dashboard/src/routes/_authenticated/$storeId/companies/locations.$locationId.tsx@@ -0,0 +1,359 @@+import type {+ CompanyContact,+ CompanyContactParams,+ CompanyLocation,+ Customer,+} from '@spree/admin-sdk'+import { PageHeader, ResourceCombobox, Slot, Subject, usePermissions } from '@spree/dashboard-core'+import {+ AddressBlock,+ Badge,+ Button,+ Card,+ CardAction,+ CardContent,+ CardHeader,+ CardTitle,+ Dialog,+ DialogBody,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle,+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuTrigger,+ ErrorState,+ Field,+ FieldGroup,+ FieldLabel,+ Pagination,+ ResourceLayout,+ useConfirm,+} from '@spree/dashboard-ui'+import { createFileRoute, Link, useNavigate } from '@tanstack/react-router'+import { EllipsisVerticalIcon, PencilIcon, PlusIcon, TrashIcon } from 'lucide-react'+import { useState } from 'react'+import { useTranslation } from 'react-i18next'+import { CompanyLocationSheet } from '../../../../components/spree/company-location-sheet'+import { EnterpriseUpsell } from '../../../../components/spree/enterprise-upsell'+import {+ useCompanyLocation,+ useCompanyLocationContacts,+ useCreateCompanyContact,+ useDeleteCompanyContact,+ useDeleteCompanyLocation,+} from '../../../../hooks/use-companies'+import { customerAutocompleteProps } from '../../../../hooks/use-customers'++export const Route = createFileRoute('/_authenticated/$storeId/companies/locations/$locationId')({+ component: CompanyLocationDetailPage,+})++function CompanyLocationDetailPage() {+ const { t } = useTranslation()+ const { locationId } = Route.useParams()+ const { data: location, isLoading, error, refetch } = useCompanyLocation(locationId)++ if (isLoading) return <p className="text-muted-foreground">{t('admin.common.loading')}</p>+ if (error || !location) {+ return (+ <ErrorState+ title={t('admin.company_locations.detail.load_error')}+ error={error as Error | undefined}+ onRetry={() => refetch()}+ />+ )+ }++ return <CompanyLocationBody location={location} />+}++function CompanyLocationBody({ location }: { location: CompanyLocation }) {+ const { t } = useTranslation()+ const { storeId } = Route.useParams()+ const navigate = useNavigate()+ const { permissions } = usePermissions()+ const deleteMutation = useDeleteCompanyLocation(location.company_id)+ const [editOpen, setEditOpen] = useState(false)++ const canEdit = permissions.can('update', Subject.CompanyLocation)++ async function handleDelete() {+ await deleteMutation.mutateAsync(location.id)+ navigate({+ to: '/$storeId/companies/$companyId',+ params: { storeId, companyId: location.company_id },+ })+ }++ return (+ <>+ <ResourceLayout+ header={+ <PageHeader+ title={location.name}+ subtitle={location.external_id ?? undefined}+ backTo={`companies/${location.company_id}`}+ resource={{ id: location.id }}+ actions={+ canEdit ? (+ <Button size="sm" variant="outline" onClick={() => setEditOpen(true)}>+ <PencilIcon className="size-4" />+ {t('admin.actions.edit')}+ </Button>+ ) : undefined+ }+ onDelete={+ permissions.can('destroy', Subject.CompanyLocation) ? handleDelete : undefined+ }+ deleteLabel={t('admin.company_locations.detail.delete_label')}+ />+ }+ main={+ <>+ <ContactsCard location={location} canEdit={canEdit} />+ {/* Per-branch panels an extension owns: approval rules, spending+ limits (docs: Enterprise b2b-companies plan). */}+ <Slot name="company_location.form_main" context={{ location, canEdit }} />+ </>+ }+ sidebar={+ <>+ <AddressesCard location={location} />+ <Slot name="company_location.form_sidebar" context={{ location, canEdit }} />+ </>+ }+ />++ {editOpen && (+ <CompanyLocationSheet+ companyId={location.company_id}+ location={location}+ open+ onOpenChange={setEditOpen}+ />+ )}+ </>+ )+}++function AddressesCard({ location }: { location: CompanyLocation }) {+ const { t } = useTranslation()++ return (+ <Card>+ <CardHeader>+ <CardTitle>{t('admin.company_locations.addresses')}</CardTitle>+ </CardHeader>+ <CardContent className="flex flex-col gap-4">+ <AddressBlock+ title={t('admin.company_locations.billing_address')}+ address={location.billing_address}+ />+ <AddressBlock+ title={t('admin.company_locations.shipping_address')}+ address={location.shipping_address}+ />+ </CardContent>+ </Card>+ )+}++function ContactsCard({ location, canEdit }: { location: CompanyLocation; canEdit: boolean }) {+ const { t } = useTranslation()+ const { storeId } = Route.useParams()+ const confirm = useConfirm()+ const [page, setPage] = useState(1)+ const { data, isLoading } = useCompanyLocationContacts(location.id, page)+ const deleteMutation = useDeleteCompanyContact(location.id)+ const [addOpen, setAddOpen] = useState(false)++ const contacts = data?.data ?? []+ const meta = data?.meta++ async function handleRemove(contact: CompanyContact) {+ const ok = await confirm({+ title: t('admin.company_contacts.remove_confirm.title'),+ message: t('admin.company_contacts.remove_confirm.message', {+ email: contact.email ?? contact.customer_id,+ }),+ variant: 'destructive',+ confirmLabel: t('admin.company_contacts.remove_action'),+ })+ if (!ok) return+ await deleteMutation.mutateAsync(contact.id).catch(() => undefined)+ }++ return (+ <Card>+ <CardHeader>+ <CardTitle>+ {t('admin.company_contacts.title')}+ {meta?.count ? <Badge variant="outline">{meta.count}</Badge> : null}+ </CardTitle>+ {canEdit && (+ <CardAction>+ <Button size="sm" variant="outline" onClick={() => setAddOpen(true)}>+ <PlusIcon className="size-4" />+ {t('admin.company_contacts.add_cta')}+ </Button>+ </CardAction>+ )}+ </CardHeader>++ {isLoading ? (+ <CardContent>+ <p className="text-muted-foreground text-sm">{t('admin.common.loading')}</p>+ </CardContent>+ ) : contacts.length === 0 ? (+ <CardContent>+ <p className="text-muted-foreground text-sm">{t('admin.company_contacts.empty')}</p>+ </CardContent>+ ) : (+ <CardContent className="p-0">+ <div className="flex flex-col">+ {contacts.map((contact) => (+ <div+ key={contact.id}+ className="flex items-center justify-between gap-3 border-b px-6 py-3 last:border-b-0"+ >+ <div className="flex min-w-0 flex-col">+ <Link+ to={'/$storeId/customers/$customerId' as string}+ params={{ storeId, customerId: contact.customer_id }}+ className="font-medium text-foreground text-sm no-underline hover:underline"+ >+ {contact.email ?? contact.customer_id}+ </Link>+ {/* An extension owning roles renders the buyer's real role+ here; the fallback is the cosmetic label OSS stores. */}+ <Slot+ name="company_contact.row_meta"+ context={{ contact, locationId: location.id, canEdit }}+ fallback={+ contact.role ? (+ <span className="text-muted-foreground text-xs">{contact.role}</span>+ ) : null+ }+ />+ </div>+ {canEdit && (+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <Button variant="ghost" size="icon-xs">+ <EllipsisVerticalIcon className="size-4" />+ </Button>+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end">+ {/* Above the destructive item, so "change role" never+ sits next to "remove buyer". */}+ <Slot+ name="company_contact.row_actions"+ context={{ contact, locationId: location.id }}+ />+ <DropdownMenuItem+ className="text-destructive focus:text-destructive"+ onClick={() => handleRemove(contact)}+ >+ <TrashIcon className="size-4" />+ {t('admin.company_contacts.remove_action')}+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ )}+ </div>+ ))}+ </div>+ {meta && <Pagination meta={meta} onPageChange={setPage} />}+ </CardContent>+ )}++ {addOpen && <AddContactDialog locationId={location.id} open onOpenChange={setAddOpen} />}+ </Card>+ )+}++function AddContactDialog({+ locationId,+ open,+ onOpenChange,+}: {+ locationId: string+ open: boolean+ onOpenChange: (open: boolean) => void+}) {+ const { t } = useTranslation()+ const createMutation = useCreateCompanyContact(locationId)+ const [customerId, setCustomerId] = useState('')+ // Written by whatever the `company_contact.form_fields` slot renders (the+ // Enterprise role picker); merged into the create payload untouched, so core+ // never needs to know which fields that plugin owns.+ const [extraParams, setExtraParams] = useState<CompanyContactParams>({})++ async function handleSubmit() {+ if (!customerId) return+ await createMutation+ .mutateAsync({ ...extraParams, customer_id: customerId })+ .then(() => onOpenChange(false))+ .catch(() => undefined)+ }++ return (+ <Dialog open={open} onOpenChange={onOpenChange}>+ <DialogContent>+ <DialogHeader>+ <DialogTitle>{t('admin.company_contacts.add_title')}</DialogTitle>+ <DialogDescription>{t('admin.company_contacts.dialog_description')}</DialogDescription>+ </DialogHeader>+ <DialogBody>+ <FieldGroup>+ <Field>+ <FieldLabel>{t('admin.fields.customer.label')}</FieldLabel>+ <ResourceCombobox<Customer>+ {...customerAutocompleteProps('company-contact-customers')}+ value={customerId || undefined}+ onChange={(id) => setCustomerId(id ?? '')}+ />+ </Field>++ {/* Roles are an Enterprise capability. The slot is where its role+ picker mounts; with no plugin installed the fallback names the+ limit rather than leaving a gap. */}+ <Slot+ name="company_contact.form_fields"+ context={{ locationId, onChange: setExtraParams }}+ fallback={+ <EnterpriseUpsell+ title={t('admin.company_contacts.roles_enterprise_title')}+ description={t('admin.company_contacts.roles_enterprise_help')}+ />+ }+ />+ </FieldGroup>+ </DialogBody>+ <DialogFooter>+ <Button+ type="button"+ variant="outline"+ size="sm"+ onClick={() => onOpenChange(false)}+ disabled={createMutation.isPending}+ >+ {t('admin.actions.cancel')}+ </Button>+ <Button+ type="button"+ size="sm"+ disabled={createMutation.isPending || !customerId}+ onClick={handleSubmit}+ >+ {createMutation.isPending ? t('admin.actions.saving') : t('admin.actions.add')}+ </Button>+ </DialogFooter>+ </DialogContent>+ </Dialog>+ )+}diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/customers/$customerId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/customers/$customerId.tsxindex f0de6017a0..d961e2cf47 100644--- a/packages/dashboard/src/routes/_authenticated/$storeId/customers/$customerId.tsx+++ b/packages/dashboard/src/routes/_authenticated/$storeId/customers/$customerId.tsx@@ -11,6 +11,7 @@ import {Subject,TagCombobox,useCountries,+ usePermissions,useStore,} from '@spree/dashboard-core'import {@@ -79,6 +80,7 @@ import {CustomFieldsInlineCard,EditableApiCustomFieldsProvider,} from '../../../../components/spree/custom-fields/custom-fields-inline'+import { TaxIdentifiersCard } from '../../../../components/spree/tax-identifiers-card'import { useCurrencyLocale } from '../../../../hooks/use-currency-locale'import {customerGroupAutocompleteProps,@@ -92,13 +94,18 @@ import {} from '../../../../hooks/use-customer-store-credits'import {useCreateCustomerAddress,+ useCreateCustomerTaxIdentifier,useCustomer,useCustomerOrders,+ useCustomerTaxIdentifiers,useDeleteCustomer,useDeleteCustomerAddress,+ useDeleteCustomerTaxIdentifier,useUpdateCustomer,useUpdateCustomerAddress,useUpdateCustomerGroups,+ useUpdateCustomerTaxIdentifier,+ useValidateCustomerTaxIdentifier,} from '../../../../hooks/use-customers'import { useStoreCreditCategories } from '../../../../hooks/use-store-credit-categories'import { spreeJsonLinkResolver } from '../../../../lib/json-link-resolver'@@ -216,6 +223,7 @@ function CustomerBody({ customer }: { customer: Customer }) {<ProfileCard customer={customer} /><CustomerGroupsCard customer={customer} /><AddressesCard customer={customer} />+ <CustomerTaxIdentifiersCard customer={customer} /><InternalNoteCard customer={customer} /><Slot name="customer.form_sidebar" context={{ customer }} /></>@@ -857,6 +865,34 @@ function InternalNoteCard({ customer }: { customer: Customer }) {)}+// ---------------------------------------------------------------------------+// Tax identifiers+// ---------------------------------------------------------------------------++function CustomerTaxIdentifiersCard({ customer }: { customer: Customer }) {+ const { permissions } = usePermissions()+ const { data, isLoading } = useCustomerTaxIdentifiers(customer.id)+ const createMutation = useCreateCustomerTaxIdentifier(customer.id)+ const updateMutation = useUpdateCustomerTaxIdentifier(customer.id)+ const deleteMutation = useDeleteCustomerTaxIdentifier(customer.id)+ const validateMutation = useValidateCustomerTaxIdentifier(customer.id)++ return (+ <TaxIdentifiersCard+ identifiers={data?.data ?? []}+ isLoading={isLoading}+ canEdit={permissions.can('update', Subject.Customer)}+ mutations={{+ create: (params) => createMutation.mutateAsync(params),+ update: (id, params) => updateMutation.mutateAsync({ id, params }),+ remove: (id) => deleteMutation.mutateAsync(id),+ validate: (id) => validateMutation.mutateAsync(id),+ isValidating: validateMutation.isPending,+ }}+ />+ )+}+// ---------------------------------------------------------------------------// Addresses// ---------------------------------------------------------------------------diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/markets.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/markets.tsxindex d125b6c7ed..c84fd788e9 100644--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/markets.tsx+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/markets.tsx@@ -39,6 +39,7 @@ import { useEffect, useMemo } from 'react'import { Controller, type UseFormReturn, useForm } from 'react-hook-form'import { useTranslation } from 'react-i18next'import { z } from 'zod/v4'+import { TaxProviderField } from '../../../../components/spree/tax-provider-field'import {useCreateMarket,useDeleteMarket,@@ -251,6 +252,7 @@ function EditMarketSheet({tax_inclusive: market.tax_inclusive,default: market.default,country_isos: market.country_isos,+ tax_provider: market.tax_provider ?? '',})}}, [market, form])@@ -416,6 +418,8 @@ function MarketFormFields({ form }: { form: UseFormReturn<MarketFormValues> }) {<FieldError errors={[errors.country_isos]} /></Field>+ <TaxProviderField form={form} />+<Field><div className="flex items-start justify-between gap-4"><div className="flex flex-col">diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/tax-rates.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/tax-rates.tsxnew file mode 100644index 0000000000..bc0f153dc9--- /dev/null+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/tax-rates.tsx@@ -0,0 +1,458 @@+import { zodResolver } from '@hookform/resolvers/zod'+import type { TaxRate } from '@spree/admin-sdk'+import {+ adminClient,+ Can,+ CountryCombobox,+ mapSpreeErrorsToForm,+ ResourceTable,+ resourceSearchSchema,+ StateCombobox,+ Subject,+ useCountryStates,+ usePermissions,+} from '@spree/dashboard-core'+import {+ Button,+ Field,+ FieldDescription,+ FieldError,+ FieldGroup,+ FieldLabel,+ Input,+ RowActions,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+ Sheet,+ SheetContent,+ SheetDescription,+ SheetFooter,+ SheetHeader,+ SheetTitle,+ Switch,+ useConfirm,+ useRowClickBridge,+} from '@spree/dashboard-ui'+import { createFileRoute, useNavigate } from '@tanstack/react-router'+import { PlusIcon } from 'lucide-react'+import { useEffect } from 'react'+import { Controller, type UseFormReturn, useForm } from 'react-hook-form'+import { useTranslation } from 'react-i18next'+import { z } from 'zod/v4'+import { useTaxCategories } from '../../../../hooks/use-tax-categories'+import {+ useCreateTaxRate,+ useDeleteTaxRate,+ useTaxRate,+ useUpdateTaxRate,+} from '../../../../hooks/use-tax-rates'+import {+ TAX_RATE_DEFAULTS,+ type TaxRateFormValues,+ taxRateFormSchema,+ taxRateValuesToParams,+} from '../../../../schemas/tax-rate'+import '../../../../tables/tax-rates'++const taxRatesSearchSchema = resourceSearchSchema.extend({+ edit: z.string().optional(),+ new: z.coerce.boolean().optional(),+})++export const Route = createFileRoute('/_authenticated/$storeId/settings/tax-rates')({+ validateSearch: taxRatesSearchSchema,+ component: TaxRatesPage,+})++function TaxRatesPage() {+ const { t } = useTranslation()+ const search = Route.useSearch() as z.infer<typeof taxRatesSearchSchema>+ const navigate = useNavigate()+ const confirm = useConfirm()+ const deleteMutation = useDeleteTaxRate()+ const { permissions } = usePermissions()++ const editId = search.edit+ const isCreating = !!search.new++ 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>) => ({ ...prev, new: true }) as never })++ const openEdit = (id: string) =>+ navigate({ search: (prev: Record<string, unknown>) => ({ ...prev, edit: id }) as never })++ useRowClickBridge('data-tax-rate-id', openEdit)++ async function handleDelete(taxRate: TaxRate) {+ const ok = await confirm({+ title: t('admin.tax_rates.delete_confirm.title'),+ message: t('admin.tax_rates.delete_confirm.message', { name: taxRate.name ?? '' }),+ variant: 'destructive',+ confirmLabel: t('admin.actions.delete'),+ })+ if (!ok) return+ await deleteMutation.mutateAsync(taxRate.id).catch(() => undefined)+ }++ return (+ <>+ <ResourceTable<TaxRate>+ tableKey="tax-rates"+ queryKey="tax-rates"+ queryFn={(params) => adminClient.taxRates.list(params)}+ searchParams={search}+ rowActions={(taxRate) => (+ <RowActions+ actions={[+ { key: 'edit', onSelect: () => openEdit(taxRate.id) },+ {+ key: 'delete',+ destructive: true,+ visible: permissions.can('destroy', Subject.TaxRate),+ disabled: deleteMutation.isPending,+ onSelect: () => handleDelete(taxRate),+ },+ ]}+ />+ )}+ actions={+ <Can I="create" a={Subject.TaxRate}>+ <Button size="sm" className="h-[2.125rem]" onClick={openCreate}>+ <PlusIcon className="size-4" />+ {t('admin.tax_rates.add_cta')}+ </Button>+ </Can>+ }+ />++ {isCreating && <CreateTaxRateSheet open onOpenChange={(o) => !o && closeSheet()} />}+ {editId && <EditTaxRateSheet id={editId} open onOpenChange={(o) => !o && closeSheet()} />}+ </>+ )+}++function CreateTaxRateSheet({+ open,+ onOpenChange,+}: {+ open: boolean+ onOpenChange: (open: boolean) => void+}) {+ const { t } = useTranslation()+ const createMutation = useCreateTaxRate()+ const form = useForm<TaxRateFormValues>({+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ resolver: zodResolver(taxRateFormSchema) as any,+ defaultValues: TAX_RATE_DEFAULTS,+ })++ async function onSubmit(values: TaxRateFormValues) {+ try {+ await createMutation.mutateAsync(taxRateValuesToParams(values))+ form.reset(TAX_RATE_DEFAULTS)+ onOpenChange(false)+ } catch (err) {+ if (!mapSpreeErrorsToForm(err, form.setError)) throw err+ }+ }++ return (+ <Sheet+ open={open}+ onOpenChange={(next) => {+ if (!next) form.reset(TAX_RATE_DEFAULTS)+ onOpenChange(next)+ }}+ >+ <SheetContent>+ <SheetHeader>+ <SheetTitle>{t('admin.pages.settings.tax_rates.add_sheet_title')}</SheetTitle>+ <SheetDescription>{t('admin.tax_rates.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">+ <TaxRateFormFields form={form} />+ </div>+ <SheetFooter>+ <Button+ type="button"+ variant="outline"+ size="sm"+ onClick={() => onOpenChange(false)}+ disabled={form.formState.isSubmitting}+ >+ {t('admin.actions.cancel')}+ </Button>+ <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>+ {form.formState.isSubmitting+ ? t('admin.actions.creating')+ : t('admin.tax_rates.create_label')}+ </Button>+ </SheetFooter>+ </form>+ </SheetContent>+ </Sheet>+ )+}++function EditTaxRateSheet({+ id,+ open,+ onOpenChange,+}: {+ id: string+ open: boolean+ onOpenChange: (open: boolean) => void+}) {+ const { t } = useTranslation()+ const { data: taxRate, isLoading } = useTaxRate(id)+ const updateMutation = useUpdateTaxRate(id)++ const form = useForm<TaxRateFormValues>({+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ resolver: zodResolver(taxRateFormSchema) as any,+ defaultValues: TAX_RATE_DEFAULTS,+ })++ useEffect(() => {+ if (taxRate) {+ form.reset({+ name: taxRate.name,+ amount_percentage: taxRate.amount_percentage ?? 0,+ tax_category_id: taxRate.tax_category_id ?? '',+ country_iso: taxRate.country_iso ?? '',+ state_code: taxRate.state_code ?? '',+ included_in_price: taxRate.included_in_price,+ show_rate_in_label: taxRate.show_rate_in_label,+ })+ }+ }, [taxRate, form])++ async function onSubmit(values: TaxRateFormValues) {+ try {+ await updateMutation.mutateAsync(taxRateValuesToParams(values))+ form.reset(values)+ onOpenChange(false)+ } catch (err) {+ if (!mapSpreeErrorsToForm(err, form.setError)) throw err+ }+ }++ return (+ <Sheet open={open} onOpenChange={onOpenChange}>+ <SheetContent>+ <SheetHeader>+ <SheetTitle>+ {taxRate?.name ?? t('admin.pages.settings.tax_rates.edit_sheet_title')}+ </SheetTitle>+ <SheetDescription>{t('admin.tax_rates.edit_description')}</SheetDescription>+ </SheetHeader>+ {isLoading ? (+ <div className="p-4 text-sm text-muted-foreground">{t('admin.common.loading')}</div>+ ) : (+ <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">+ <TaxRateFormFields form={form} />+ </div>+ <SheetFooter>+ <Button+ type="button"+ variant="outline"+ size="sm"+ onClick={() => onOpenChange(false)}+ disabled={form.formState.isSubmitting}+ >+ {t('admin.actions.cancel')}+ </Button>+ <Button+ type="submit"+ size="sm"+ disabled={form.formState.isSubmitting || !form.formState.isDirty}+ >+ {form.formState.isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}+ </Button>+ </SheetFooter>+ </form>+ )}+ </SheetContent>+ </Sheet>+ )+}++function TaxRateFormFields({ form }: { form: UseFormReturn<TaxRateFormValues> }) {+ const { t } = useTranslation()+ const { errors } = form.formState+ const { data: taxCategories } = useTaxCategories({ limit: 100 })+ const countryIso = form.watch('country_iso')+ const { states } = useCountryStates(countryIso)++ return (+ <FieldGroup>+ {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.tax_rate.name.placeholder')}+ aria-invalid={!!errors.name || undefined}+ {...form.register('name')}+ />+ <FieldError errors={[errors.name]} />+ </Field>++ <Field>+ <FieldLabel htmlFor="amount_percentage">+ {t('admin.fields.tax_rate.amount.label')}+ </FieldLabel>+ <Input+ id="amount_percentage"+ type="number"+ step="0.01"+ min="0"+ max="100"+ inputMode="decimal"+ aria-invalid={!!errors.amount_percentage || undefined}+ {...form.register('amount_percentage')}+ />+ <FieldDescription>{t('admin.fields.tax_rate.amount.help')}</FieldDescription>+ <FieldError errors={[errors.amount_percentage]} />+ </Field>++ <Field>+ <FieldLabel htmlFor="tax_category_id">+ {t('admin.fields.tax_rate.tax_category_id.label')}+ </FieldLabel>+ <Controller+ name="tax_category_id"+ control={form.control}+ render={({ field }) => (+ <Select value={field.value} onValueChange={field.onChange}>+ <SelectTrigger id="tax_category_id" aria-invalid={!!errors.tax_category_id}>+ <SelectValue placeholder={t('admin.tax_rates.select_category')}>+ {(value) =>+ taxCategories?.data?.find((c) => c.id === value)?.name ?? (value as string)+ }+ </SelectValue>+ </SelectTrigger>+ <SelectContent>+ {taxCategories?.data?.map((taxCategory) => (+ <SelectItem key={taxCategory.id} value={taxCategory.id}>+ {taxCategory.name}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ )}+ />+ <FieldDescription>{t('admin.fields.tax_rate.tax_category_id.help')}</FieldDescription>+ <FieldError errors={[errors.tax_category_id]} />+ </Field>++ <Field>+ <FieldLabel htmlFor="country_iso">{t('admin.fields.country.label')}</FieldLabel>+ <Controller+ name="country_iso"+ control={form.control}+ render={({ field }) => (+ <CountryCombobox+ value={field.value}+ onValueChange={(iso) => {+ field.onChange(iso)+ // The old state belongs to the old country; keeping it would+ // silently narrow the rate to a state that no longer exists.+ form.setValue('state_code', '', { shouldDirty: true })+ }}+ placeholder={t('admin.tax_rates.every_country')}+ />+ )}+ />+ <FieldDescription>{t('admin.fields.tax_rate.country_iso.help')}</FieldDescription>+ </Field>++ {countryIso && states.length > 0 && (+ <Field>+ <FieldLabel htmlFor="state_code">{t('admin.fields.state.label')}</FieldLabel>+ <Controller+ name="state_code"+ control={form.control}+ render={({ field }) => (+ <StateCombobox+ countryIso={countryIso}+ value={field.value}+ onValueChange={field.onChange}+ states={states}+ placeholder={t('admin.tax_rates.every_state')}+ />+ )}+ />+ <FieldDescription>{t('admin.fields.tax_rate.state_code.help')}</FieldDescription>+ </Field>+ )}++ <Field>+ <div className="flex items-start justify-between gap-4">+ <div className="flex flex-col">+ <FieldLabel htmlFor="included_in_price" className="cursor-pointer">+ {t('admin.fields.tax_rate.included_in_price.label')}+ </FieldLabel>+ <span className="text-xs text-muted-foreground">+ {t('admin.fields.tax_rate.included_in_price.help')}+ </span>+ </div>+ <Controller+ name="included_in_price"+ control={form.control}+ render={({ field }) => (+ <Switch+ id="included_in_price"+ checked={!!field.value}+ onCheckedChange={field.onChange}+ />+ )}+ />+ </div>+ </Field>++ <Field>+ <div className="flex items-start justify-between gap-4">+ <div className="flex flex-col">+ <FieldLabel htmlFor="show_rate_in_label" className="cursor-pointer">+ {t('admin.fields.tax_rate.show_rate_in_label.label')}+ </FieldLabel>+ <span className="text-xs text-muted-foreground">+ {t('admin.fields.tax_rate.show_rate_in_label.help')}+ </span>+ </div>+ <Controller+ name="show_rate_in_label"+ control={form.control}+ render={({ field }) => (+ <Switch+ id="show_rate_in_label"+ checked={!!field.value}+ onCheckedChange={field.onChange}+ />+ )}+ />+ </div>+ </Field>+ </FieldGroup>+ )+}diff --git a/packages/dashboard/src/schemas/company.ts b/packages/dashboard/src/schemas/company.tsnew file mode 100644index 0000000000..48521f58db--- /dev/null+++ b/packages/dashboard/src/schemas/company.ts@@ -0,0 +1,193 @@+import type {+ CompanyLocationParams,+ CompanyParams,+ TaxExemptionCertificateParams,+ TaxIdentifierParams,+} from '@spree/admin-sdk'+import { blankToNull } from '@spree/dashboard-core'+import { requiredMessage } from '@spree/dashboard-ui'+import { z } from 'zod/v4'++export const companyFormSchema = z.object({+ name: z.string().min(1, { error: requiredMessage('name') }),+ external_id: z.string().optional(),+})++export type CompanyFormValues = z.infer<typeof companyFormSchema>++export const COMPANY_DEFAULTS: CompanyFormValues = { name: '', external_id: '' }++export function companyValuesToParams(values: CompanyFormValues): CompanyParams {+ return {+ name: values.name,+ external_id: blankToNull(values.external_id),+ }+}++const addressSchema = z.object({+ first_name: z.string().optional(),+ last_name: z.string().optional(),+ company: z.string().optional(),+ address1: z.string().optional(),+ address2: z.string().optional(),+ city: z.string().optional(),+ postal_code: z.string().optional(),+ phone: z.string().optional(),+ country_iso: z.string().optional(),+ state_abbr: z.string().optional(),+})++export const companyLocationFormSchema = z.object({+ name: z.string().min(1, { error: requiredMessage('name') }),+ external_id: z.string().optional(),+ billing_address: addressSchema,+ // Kept separate from billing rather than merged on submit, so a branch that+ // ships somewhere other than it is invoiced stays expressible.+ shipping_address: addressSchema,+ // Form-only: when set, the billing address is copied over the shipping one+ // on submit. Never sent to the API, which always takes both addresses.+ shipping_same_as_billing: z.boolean(),+})++export type CompanyLocationFormValues = z.infer<typeof companyLocationFormSchema>++const EMPTY_ADDRESS = {+ first_name: '',+ last_name: '',+ company: '',+ address1: '',+ address2: '',+ city: '',+ postal_code: '',+ phone: '',+ country_iso: '',+ state_abbr: '',+}++export const COMPANY_LOCATION_DEFAULTS: CompanyLocationFormValues = {+ name: '',+ external_id: '',+ billing_address: { ...EMPTY_ADDRESS },+ shipping_address: { ...EMPTY_ADDRESS },+ shipping_same_as_billing: true,+}++export function companyLocationValuesToParams(+ values: CompanyLocationFormValues,+): CompanyLocationParams {+ const billing = values.billing_address+ const shipping = values.shipping_same_as_billing ? { ...billing } : values.shipping_address++ return {+ name: values.name,+ external_id: blankToNull(values.external_id),+ // A branch may have no address at all, but an address that exists must be+ // complete — so an untouched fieldset is omitted rather than sent empty,+ // which would fail the address record's own validations.+ ...(isAddressBlank(billing) ? {} : { billing_address: billing }),+ ...(isAddressBlank(shipping) ? {} : { shipping_address: shipping }),+ }+}++function isAddressBlank(address: Record<string, string | undefined>): boolean {+ return Object.values(address).every((value) => !value?.trim())+}++/**+ * Whether a saved branch's two addresses are the same, deciding how the edit+ * form opens. Compared field by field because they are separate records.+ */+export function addressesMatch(+ billing: Record<string, unknown> | null | undefined,+ shipping: Record<string, unknown> | null | undefined,+): boolean {+ if (!billing || !shipping) return false++ return ADDRESS_COMPARISON_KEYS.every((key) => (billing[key] ?? '') === (shipping[key] ?? ''))+}++const ADDRESS_COMPARISON_KEYS = [+ 'first_name',+ 'last_name',+ 'company',+ 'address1',+ 'address2',+ 'city',+ 'postal_code',+ 'phone',+ 'country_iso',+ 'state_abbr',+] as const++export const taxIdentifierFormSchema = z.object({+ kind: z.string().min(1, { error: requiredMessage('tax_identifier.kind') }),+ value: z.string().min(1, { error: requiredMessage('tax_identifier.value') }),+})++export type TaxIdentifierFormValues = z.infer<typeof taxIdentifierFormSchema>++export const TAX_IDENTIFIER_DEFAULTS: TaxIdentifierFormValues = { kind: '', value: '' }++export function taxIdentifierValuesToParams(values: TaxIdentifierFormValues): TaxIdentifierParams {+ return { kind: values.kind, value: values.value }+}++/**+ * The registration kinds core ships strings for. Any string is accepted by the+ * API — what a kind means is decided by whichever validator is registered for+ * it — so the merchant can type their own.+ */+export const TAX_IDENTIFIER_KINDS = ['eu_vat', 'gb_vat', 'ch_vat', 'au_abn', 'us_ein'] as const++export const taxExemptionCertificateFormSchema = z.object({+ certificate_number: z.string().min(1, { error: requiredMessage('certificate_number') }),+ reason_code: z.string().min(1, { error: requiredMessage('reason_code') }),+ country_iso: z.string().optional(),+ state_code: z.string().optional(),+ issued_at: z.string().optional(),+ expires_at: z.string().optional(),+ issuing_authority: z.string().optional(),+ document_signed_id: z.string().nullable().optional(),+})++export type TaxExemptionCertificateFormValues = z.infer<typeof taxExemptionCertificateFormSchema>++export const TAX_EXEMPTION_CERTIFICATE_DEFAULTS: TaxExemptionCertificateFormValues = {+ certificate_number: '',+ reason_code: '',+ country_iso: '',+ state_code: '',+ issued_at: '',+ expires_at: '',+ issuing_authority: '',+ document_signed_id: null,+}++/**+ * Reason codes become the tax provider's entity use code. These are the ones in+ * common circulation; the field stays free text because the set is the+ * provider's, not Spree's.+ */+export const TAX_EXEMPTION_REASON_CODES = [+ 'resale',+ 'government',+ 'charitable',+ 'educational',+ 'manufacturing',+ 'agricultural',+] as const++export function taxExemptionCertificateValuesToParams(+ values: TaxExemptionCertificateFormValues,+): TaxExemptionCertificateParams {+ return {+ certificate_number: values.certificate_number,+ reason_code: values.reason_code,+ country_iso: blankToNull(values.country_iso),+ state_code: blankToNull(values.state_code),+ issued_at: blankToNull(values.issued_at),+ expires_at: blankToNull(values.expires_at),+ issuing_authority: blankToNull(values.issuing_authority),+ ...(values.document_signed_id ? { document: values.document_signed_id } : {}),+ }+}diff --git a/packages/dashboard/src/schemas/market.ts b/packages/dashboard/src/schemas/market.tsindex 629a5be1a0..98429177f0 100644--- a/packages/dashboard/src/schemas/market.ts+++ b/packages/dashboard/src/schemas/market.ts@@ -10,6 +10,8 @@ export const marketFormSchema = z.object({tax_inclusive: z.boolean(),default: z.boolean(),country_isos: z.array(z.string()).min(1, { error: requiredMessage('market.country_isos') }),+ // Empty means the installation default rather than "no tax".+ tax_provider: z.string().optional(),})export type MarketFormValues = z.infer<typeof marketFormSchema>@@ -22,6 +24,7 @@ export const MARKET_DEFAULTS: MarketFormValues = {tax_inclusive: false,default: false,country_isos: [],+ tax_provider: '',}export function marketValuesToParams(v: MarketFormValues): MarketCreateParams & MarketUpdateParams {@@ -35,5 +38,6 @@ export function marketValuesToParams(v: MarketFormValues): MarketCreateParams &tax_inclusive: v.tax_inclusive,default: v.default,country_isos: v.country_isos,+ tax_provider: v.tax_provider || null,}}diff --git a/packages/dashboard/src/schemas/tax-rate.ts b/packages/dashboard/src/schemas/tax-rate.tsnew file mode 100644index 0000000000..62a017cd69--- /dev/null+++ b/packages/dashboard/src/schemas/tax-rate.ts@@ -0,0 +1,46 @@+import type { TaxRateParams } from '@spree/admin-sdk'+import { blankToNull } from '@spree/dashboard-core'+import { requiredMessage } from '@spree/dashboard-ui'+import { z } from 'zod/v4'++export const taxRateFormSchema = z.object({+ name: z.string().min(1, { error: requiredMessage('name') }),+ // The merchant types a percentage (20), the API stores a fraction (0.2).+ amount_percentage: z.coerce.number().min(0).max(100),+ // Required: a rate always taxes exactly one category.+ tax_category_id: z.string().min(1, { error: requiredMessage('tax_rate.tax_category_id') }),+ // Empty means the rate applies everywhere, so neither field is required.+ country_iso: z.string().optional(),+ state_code: z.string().optional(),+ included_in_price: z.boolean(),+ show_rate_in_label: z.boolean(),+})++export type TaxRateFormValues = z.infer<typeof taxRateFormSchema>++export const TAX_RATE_DEFAULTS: TaxRateFormValues = {+ name: '',+ amount_percentage: 0,+ tax_category_id: '',+ country_iso: '',+ state_code: '',+ included_in_price: false,+ show_rate_in_label: false,+}++/**+ * A blank jurisdiction field is sent as null rather than omitted: clearing the+ * country on an existing rate has to widen it back to everywhere, which an+ * omitted key would not do.+ */+export function taxRateValuesToParams(values: TaxRateFormValues): TaxRateParams {+ return {+ name: values.name,+ amount: values.amount_percentage / 100,+ tax_category_id: values.tax_category_id,+ country_iso: blankToNull(values.country_iso),+ state_code: blankToNull(values.state_code),+ included_in_price: values.included_in_price,+ show_rate_in_label: values.show_rate_in_label,+ }+}diff --git a/packages/dashboard/src/tables/companies.tsx b/packages/dashboard/src/tables/companies.tsxnew file mode 100644index 0000000000..76e2c483a6--- /dev/null+++ b/packages/dashboard/src/tables/companies.tsx@@ -0,0 +1,54 @@+import type { Company } from '@spree/admin-sdk'+import { defineTable } from '@spree/dashboard-core'+import { RelativeTime } from '@spree/dashboard-ui'+import { Link } from '@tanstack/react-router'+import i18n from 'i18next'+import { Building2Icon } from 'lucide-react'++defineTable<Company>('companies', {+ title: i18n.t('admin.nav.companies'),+ searchParam: 'name_cont',+ searchPlaceholder: i18n.t('admin.companies.search_placeholder'),+ defaultSort: { field: 'name', direction: 'asc' },+ emptyIcon: <Building2Icon className="size-8 text-muted-foreground" />,+ emptyMessage: i18n.t('admin.companies.empty'),+ columns: [+ {+ key: 'name',+ label: i18n.t('admin.fields.name.label'),+ sortable: true,+ filterable: true,+ default: true,+ render: (company) => (+ <Link+ to={'/$storeId/companies/$companyId' as string}+ params={{ companyId: company.id }}+ className="font-medium text-foreground no-underline"+ >+ {company.name}+ </Link>+ ),+ },+ {+ key: 'locations_count',+ label: i18n.t('admin.companies.locations_column'),+ default: true,+ render: (company) => company.locations_count,+ },+ {+ key: 'external_id',+ label: i18n.t('admin.fields.external_id.label'),+ sortable: true,+ filterable: true,+ default: true,+ render: (company) => company.external_id ?? '—',+ },+ {+ key: 'created_at',+ label: i18n.t('admin.fields.created_at.label'),+ sortable: true,+ default: true,+ render: (company) => <RelativeTime iso={company.created_at} />,+ },+ ],+})diff --git a/packages/dashboard/src/tables/tax-rates.tsx b/packages/dashboard/src/tables/tax-rates.tsxnew file mode 100644index 0000000000..cf63b5b4cc--- /dev/null+++ b/packages/dashboard/src/tables/tax-rates.tsx@@ -0,0 +1,74 @@+import type { TaxRate } from '@spree/admin-sdk'+import { defineTable } from '@spree/dashboard-core'+import { ActiveBadge, ResourceNameCell } from '@spree/dashboard-ui'+import i18n from 'i18next'+import { ReceiptTextIcon } from 'lucide-react'+import { JurisdictionLabel } from '../components/spree/jurisdiction-label'+import { TaxCategoryLabel } from '../components/spree/tax-category-label'++defineTable<TaxRate>('tax-rates', {+ title: i18n.t('admin.settings_nav.items.tax_rates'),+ searchParam: 'name_cont',+ searchPlaceholder: i18n.t('admin.tax_rates.search_placeholder'),+ defaultSort: { field: 'name', direction: 'asc' },+ emptyIcon: <ReceiptTextIcon className="size-8 text-muted-foreground" />,+ emptyMessage: i18n.t('admin.tax_rates.empty'),+ columns: [+ {+ key: 'name',+ label: i18n.t('admin.fields.name.label'),+ sortable: true,+ filterable: true,+ default: true,+ render: (taxRate) => (+ <ResourceNameCell id={taxRate.id} dataAttr="data-tax-rate-id" name={taxRate.name} />+ ),+ },+ {+ key: 'amount',+ label: i18n.t('admin.fields.tax_rate.amount.label'),+ sortable: true,+ default: true,+ render: (taxRate) =>+ taxRate.amount_percentage === null ? '—' : `${taxRate.amount_percentage}%`,+ },+ {+ key: 'country_iso',+ label: i18n.t('admin.fields.tax_rate.jurisdiction.label'),+ sortable: true,+ filterable: true,+ default: true,+ render: (taxRate) => (+ <JurisdictionLabel countryIso={taxRate.country_iso} stateCode={taxRate.state_code} />+ ),+ },+ {+ key: 'included_in_price',+ label: i18n.t('admin.fields.tax_rate.included_in_price.label'),+ default: true,+ render: (taxRate) => (+ <ActiveBadge+ active={taxRate.included_in_price}+ activeLabel={i18n.t('admin.fields.tax_rate.included_in_price.short')}+ dashWhenInactive+ />+ ),+ },+ {+ key: 'show_rate_in_label',+ label: i18n.t('admin.fields.tax_rate.show_rate_in_label.label'),+ render: (taxRate) => (+ <ActiveBadge+ active={taxRate.show_rate_in_label}+ activeLabel={i18n.t('admin.common.yes')}+ dashWhenInactive+ />+ ),+ },+ {+ key: 'tax_category_id',+ label: i18n.t('admin.settings_nav.items.tax_categories'),+ render: (taxRate) => <TaxCategoryLabel id={taxRate.tax_category_id} />,+ },+ ],+})