Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Added shared status and kind lists to @spree/core (#14944)

Damian Legawieca0e5b6641956
diff --git a/.changeset/shared-status-lists.md b/.changeset/shared-status-lists.md
new file mode 100644
index 0000000000..ccef416a46
--- /dev/null
+++ b/.changeset/shared-status-lists.md
@@ -0,0 +1,12 @@
+---
+"@spree/core": minor
+"@spree/sdk": patch
+"@spree/admin-sdk": patch
+"@spree/seller-sdk": patch
+"@spree/dashboard": patch
+"@spree/dashboard-core": patch
+"@spree/dashboard-ui": patch
+"@spree/seller-dashboard": patch
+---
+
+Added every status, kind and other value list the Spree API returns to `@spree/core`, each as a list of its values (`PRODUCT_STATUSES`, `MEDIA_TYPES`, …) and a type (`ProductStatus`, `MediaType`, …) — open where extensions may add values, closed otherwise — plus `subsetOf` for picking the values an action accepts with each one checked at compile time. The SDKs re-export these types instead of each carrying its own copy, so their names and values are unchanged. The dashboards and the seller panel build their status filters and action checks from these lists, so a status added on the server shows up without a dashboard change. Value lists the SDKs used to spell out inline, such as a seller transfer's `kind`, now have names of their own; `MediaType`, `CollectionRuleMatchPolicy` and `CollectionSortOrder` in `@spree/admin-sdk`, and `ClaimResolution` in `@spree/dashboard-ui`, now come from the generated lists under the same names. A seller's `tax_remittance` and `payouts_schedule_interval`, a claim's `resolution`, a collection's `sort_order`, a shipping label's `format`, purchase order and stock transfer statuses, and tax and commission lines' `taxability_reason` are now typed with their lists instead of as plain strings.
diff --git a/CLAUDE.md b/CLAUDE.md
index 5abd4c28b1..e422dc5356 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -416,8 +416,8 @@ end
- `typelize attr: :type` for computed/delegated attribute types
- Value lists come in three tiers — picking the wrong one is a contract bug:
- - **Closed** (nothing can extend it — units, match policies): `enum: Model::KINDS` → closed TS union, plain OpenAPI `enum`
- - **Open** (extensions may add, built-ins known at class-load — `has_status`, `Spree::Fee::KINDS`): add `enum_type_name: 'ModelStatus'` → open TS union (`'a' | 'b' | (string & {})`) + OpenAPI `anyOf`, so clients autocomplete the built-ins and still accept extension values
+ - **Closed** (nothing can extend it — units, match policies): `enum: Model::KINDS, enum_type_name: 'ModelKind'` and add the name to `Typelizer::OpenEnums::CLOSED_LIST_NAMES` → closed TS union defined once in `@spree/core` (`MODEL_KINDS` + `ModelKind`), plain OpenAPI `enum`. Never leave a list unnamed: an inline union is copied into every SDK and cannot be imported by the dashboards
+ - **Open** (extensions may add, built-ins known at class-load — `has_status`, `Spree::Fee::KINDS`): add `enum_type_name: 'ModelStatus'` → open TS union (`'a' | 'b' | (string & {})`) + OpenAPI `anyOf`, so clients autocomplete the built-ins and still accept extension values. The list is generated once into `@spree/core` (`MODEL_STATUSES` + `ModelStatus`) and each SDK's `Enums.ts` re-exports the type; two serializers giving one name different values stop generation. Dashboards never copy a list: iterate the generated constant, and pick a subset with `subsetOf(MODEL_STATUSES, [...])` so a typo fails to compile
- **Registry-driven `type`** (the typed families above): plain `:string` + `comment:` listing the built-in shorthands. It *cannot* use `enum:` — registries fill in `to_prepare`/initializers, after serializer classes load, so generated types would depend on boot order and installed extensions. Cost: no autocomplete, no machine-readable list, and the comment is hand-maintained
- Never use `typelize_from` — it connects to the database
- **A deprecated field is marked, never only described.** Response attributes: `typelize state_abbr: [:string, nullable: true, deprecated: 'Use `state_code`. Removed in 6.1.']`. Request fields: `string :country_iso, deprecated: 'Use `country_code`. Removed in 6.1.'`. Both reach the API reference (`deprecated: true`) and the SDK types (`@deprecated`, struck through in editors). The message names the replacement and the release that removes it; a "Deprecated:" sentence in a `comment:` or `description:` alone is invisible to clients
@@ -721,7 +721,7 @@ When displaying amount or percentage fields please always use `<InputGroup>` wit
### @spree/core — Universal code
-Published package for code that is not tied to HTTP or a framework: the code lists (`pnpm generate:code-lists`) and code-shape checks, unit systems, display names, money helpers (arithmetic, percentages, reading typed amounts) and the filter vocabulary. The dashboard packages and the seller panel import it directly — never through `@spree/admin-sdk` / `@spree/seller-sdk`, which re-export the same code; `@spree/dashboard-core` still re-exports its money helpers for plugin authors. Code any client could use — a conversion, a format, a validation rule shared with the server — goes here, never into an SDK or a dashboard package. No runtime dependencies. `@spree/sdk-core` re-exports it and the SDKs bundle it, offering its code lists and money helpers under the same names as before. The code generators read it from source (the `@spree/source` export condition), so they run before anything is built.
+Published package for code that is not tied to HTTP or a framework: the code lists (`pnpm generate:code-lists`) and code-shape checks, the open status/kind lists (`enums.generated.ts`, written by `rake typelizer:generate`), unit systems, display names, money helpers (arithmetic, percentages, reading typed amounts) and the filter vocabulary. The dashboard packages and the seller panel import it directly — never through `@spree/admin-sdk` / `@spree/seller-sdk`, which re-export the same code; `@spree/dashboard-core` still re-exports its money helpers for plugin authors. Code any client could use — a conversion, a format, a validation rule shared with the server — goes here, never into an SDK or a dashboard package. No runtime dependencies. `@spree/sdk-core` re-exports it and the SDKs bundle it, offering its code lists and money helpers under the same names as before. The code generators read it from source (the `@spree/source` export condition), so they run before anything is built.
### @spree/sdk-core — Shared HTTP Layer
diff --git a/docs/api-reference/admin.yaml b/docs/api-reference/admin.yaml
index 155bf10406..55673c02eb 100644
--- a/docs/api-reference/admin.yaml
+++ b/docs/api-reference/admin.yaml
@@ -58226,7 +58226,7 @@ components:
- admin_user
- api_key
- type: string
- nullable: true
+ nullable: true
description: The values listed are the built-in ones; extensions may add
more.
created_by_label:
@@ -58880,6 +58880,9 @@ components:
type: string
assignable_type:
type: string
+ enum:
+ - customer_group
+ - company
assignable_id:
type: string
assignable_name:
@@ -59721,6 +59724,10 @@ components:
resolution:
type: string
nullable: true
+ enum:
+ - refund
+ - replacement
+ - refund_and_replacement
order_id:
type: string
nullable: true
@@ -59766,7 +59773,7 @@ components:
- admin_user
- api_key
- type: string
- nullable: true
+ nullable: true
description: The values listed are the built-in ones; extensions may add
more.
created_by:
@@ -59834,6 +59841,15 @@ components:
type: number
sort_order:
type: string
+ enum:
+ - manual
+ - best_selling
+ - price asc
+ - price desc
+ - available_on desc
+ - available_on asc
+ - name asc
+ - name desc
meta_title:
type: string
nullable: true
@@ -60090,8 +60106,23 @@ components:
- ZWN
- ZWR
taxability_reason:
- type: string
- nullable: true
+ anyOf:
+ - type: string
+ enum:
+ - standard_rated
+ - reduced_rated
+ - zero_rated
+ - reverse_charge
+ - intra_community_supply
+ - export
+ - customer_exempt
+ - product_exempt
+ - not_collecting
+ - not_subject_to_tax
+ - type: string
+ nullable: true
+ description: The values listed are the built-in ones; extensions may add
+ more.
country_code:
type: string
nullable: true
@@ -62268,7 +62299,7 @@ components:
- admin_user
- api_key
- type: string
- nullable: true
+ nullable: true
description: The values listed are the built-in ones; extensions may add
more.
updated_by:
@@ -62329,7 +62360,7 @@ components:
- admin_user
- api_key
- type: string
- nullable: true
+ nullable: true
description: The values listed are the built-in ones; extensions may add
more.
published_by:
@@ -62548,7 +62579,7 @@ components:
- admin_user
- api_key
- type: string
- nullable: true
+ nullable: true
description: The values listed are the built-in ones; extensions may add
more.
created_by:
@@ -66527,7 +66558,7 @@ components:
- admin_user
- api_key
- type: string
- nullable: true
+ nullable: true
description: The values listed are the built-in ones; extensions may add
more.
approver:
@@ -66542,7 +66573,7 @@ components:
- admin_user
- api_key
- type: string
- nullable: true
+ nullable: true
description: The values listed are the built-in ones; extensions may add
more.
canceler:
@@ -66557,7 +66588,7 @@ components:
- admin_user
- api_key
- type: string
- nullable: true
+ nullable: true
description: The values listed are the built-in ones; extensions may add
more.
created_by:
@@ -68660,7 +68691,18 @@ components:
number:
type: string
status:
- type: string
+ anyOf:
+ - type: string
+ enum:
+ - draft
+ - ordered
+ - partially_received
+ - received
+ - over_received
+ - canceled
+ - type: string
+ description: The values listed are the built-in ones; extensions may add
+ more.
currency:
type: string
enum:
@@ -68994,7 +69036,7 @@ components:
- admin_user
- api_key
- type: string
- nullable: true
+ nullable: true
description: The values listed are the built-in ones; extensions may add
more.
refunder:
@@ -69168,7 +69210,7 @@ components:
- admin_user
- api_key
- type: string
- nullable: true
+ nullable: true
description: The values listed are the built-in ones; extensions may add
more.
created_by:
@@ -70143,9 +70185,18 @@ components:
nullable: true
tax_remittance:
type: string
+ enum:
+ - seller
+ - platform
payouts_schedule_interval:
type: string
nullable: true
+ enum:
+ - daily
+ - weekly
+ - biweekly
+ - monthly
+ - manual
metadata:
type: object
nullable: true
@@ -70925,6 +70976,10 @@ components:
format:
type: string
nullable: true
+ enum:
+ - pdf
+ - png
+ - zpl
external_id:
type: string
nullable: true
@@ -71632,7 +71687,7 @@ components:
- admin_user
- api_key
- type: string
- nullable: true
+ nullable: true
description: The values listed are the built-in ones; extensions may add
more.
received_by:
@@ -71776,7 +71831,19 @@ components:
destination_location_id:
type: string
status:
- type: string
+ anyOf:
+ - type: string
+ enum:
+ - draft
+ - ready_to_ship
+ - in_transit
+ - partially_received
+ - received
+ - over_received
+ - canceled
+ - type: string
+ description: The values listed are the built-in ones; extensions may add
+ more.
notes:
type: string
nullable: true
@@ -74169,8 +74236,23 @@ components:
type: object
nullable: true
taxability_reason:
- type: string
- nullable: true
+ anyOf:
+ - type: string
+ enum:
+ - standard_rated
+ - reduced_rated
+ - zero_rated
+ - reverse_charge
+ - intra_community_supply
+ - export
+ - customer_exempt
+ - product_exempt
+ - not_collecting
+ - not_subject_to_tax
+ - type: string
+ nullable: true
+ description: The values listed are the built-in ones; extensions may add
+ more.
country_code:
type: string
nullable: true
diff --git a/docs/api-reference/seller.yaml b/docs/api-reference/seller.yaml
index d2850fc216..baa8e5472a 100644
--- a/docs/api-reference/seller.yaml
+++ b/docs/api-reference/seller.yaml
@@ -25075,6 +25075,10 @@ components:
resolution:
type: string
nullable: true
+ enum:
+ - refund
+ - replacement
+ - refund_and_replacement
order_id:
type: string
nullable: true
@@ -27984,9 +27988,18 @@ components:
nullable: true
tax_remittance:
type: string
+ enum:
+ - seller
+ - platform
payouts_schedule_interval:
type: string
nullable: true
+ enum:
+ - daily
+ - weekly
+ - biweekly
+ - monthly
+ - manual
holiday_mode_until:
type: string
nullable: true
@@ -28906,6 +28919,10 @@ components:
format:
type: string
nullable: true
+ enum:
+ - pdf
+ - png
+ - zpl
external_id:
type: string
nullable: true
diff --git a/docs/api-reference/store.yaml b/docs/api-reference/store.yaml
index b3beeb94a8..e29be05146 100644
--- a/docs/api-reference/store.yaml
+++ b/docs/api-reference/store.yaml
@@ -14873,6 +14873,10 @@ components:
resolution:
type: string
nullable: true
+ enum:
+ - refund
+ - replacement
+ - refund_and_replacement
order_id:
type: string
nullable: true
@@ -14933,6 +14937,15 @@ components:
type: number
sort_order:
type: string
+ enum:
+ - manual
+ - best_selling
+ - price asc
+ - price desc
+ - available_on desc
+ - available_on asc
+ - name asc
+ - name desc
meta_title:
type: string
nullable: true
diff --git a/lefthook.yml b/lefthook.yml
index cfbc05f6cb..82c06c9e80 100644
--- a/lefthook.yml
+++ b/lefthook.yml
@@ -18,6 +18,7 @@ pre-commit:
git add packages/sdk/src/types/generated/ packages/sdk/src/zod/generated/ packages/sdk/src/webhooks/generated/
git add packages/admin-sdk/src/types/generated/ packages/admin-sdk/src/zod/generated/
git add packages/seller-sdk/src/types/generated/ packages/seller-sdk/src/zod/generated/
+ git add packages/core/src/enums.generated.ts
zod:
# Types regenerated or edited without a serializer change, and changes to
# the generator itself, still need fresh schemas.
diff --git a/packages/admin-sdk/src/params.ts b/packages/admin-sdk/src/params.ts
index 9c47939340..6f5e80df5b 100644
--- a/packages/admin-sdk/src/params.ts
+++ b/packages/admin-sdk/src/params.ts
@@ -96,8 +96,6 @@ export type ShippingLabelUploadParams = ShippingLabelCreateParams
/** @deprecated Renamed to `ShippingLabelCreateParams`. */
export type ShippingLabelPurchaseParams = ShippingLabelCreateParams
-export type MediaType = 'image' | 'video' | 'external_video'
-
/** Where one library file is in use. */
export interface MediaUsageReference {
/**
@@ -144,33 +142,12 @@ export type ProductPublicationInput = ProductPublicationParams
/** @deprecated Renamed to `ProductVariantParams`. */
export type ProductVariantInput = ProductVariantParams
-/**
- * Default product sort applied to a collection's storefront listing. A
- * shopper's own `sort` param always wins over this; `manual` means the
- * merchant's hand-set product order.
- */
-export type CollectionSortOrder =
- | 'manual'
- | 'best_selling'
- | 'price asc'
- | 'price desc'
- | 'available_on desc'
- | 'available_on asc'
- | 'name asc'
- | 'name desc'
-
/**
* Wire shorthand (`api_type`) for an automatic-collection rule — what
* `collectionRules.types()` returns. Ruby class names are not accepted.
*/
export type CollectionRuleType = 'tag' | 'sale' | 'available_on' | (string & {})
-export type CollectionRuleMatchPolicy =
- | 'is_equal_to'
- | 'is_not_equal_to'
- | 'contains'
- | 'does_not_contain'
-
/** @deprecated Renamed to `CollectionRuleParams`. */
export type CollectionRuleParam = CollectionRuleParams
diff --git a/packages/admin-sdk/src/types/generated/Actor.ts b/packages/admin-sdk/src/types/generated/Actor.ts
index e9867834bf..b05894bd6b 100644
--- a/packages/admin-sdk/src/types/generated/Actor.ts
+++ b/packages/admin-sdk/src/types/generated/Actor.ts
@@ -1,4 +1,4 @@
-// Typelizer digest cf4ce773eab1e4708e162f6ca583c608
+// Typelizer digest 448d92ef4bb7fb11cb22f415d5043f5d
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {ActorKind} from '@/types'
diff --git a/packages/admin-sdk/src/types/generated/ApiKey.ts b/packages/admin-sdk/src/types/generated/ApiKey.ts
index 1714e4d82d..09ff8f025d 100644
--- a/packages/admin-sdk/src/types/generated/ApiKey.ts
+++ b/packages/admin-sdk/src/types/generated/ApiKey.ts
@@ -1,12 +1,12 @@
-// Typelizer digest 5232769f6b064a4e68b5002343f1ed50
+// Typelizer digest f355f4cbe2d0eb4b17fdf50891a563d7
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {ActorKind} from '@/types'
+import type {ApiKeyType, ActorKind} from '@/types'
interface ApiKey {
id: string;
name: string;
- key_type: 'publishable' | 'secret';
+ key_type: ApiKeyType;
token_prefix: string | null;
scopes: Array<string>;
created_at: string;
diff --git a/packages/admin-sdk/src/types/generated/CatalogAssignment.ts b/packages/admin-sdk/src/types/generated/CatalogAssignment.ts
index ef46cd96cd..cf385bb5de 100644
--- a/packages/admin-sdk/src/types/generated/CatalogAssignment.ts
+++ b/packages/admin-sdk/src/types/generated/CatalogAssignment.ts
@@ -1,12 +1,13 @@
-// Typelizer digest e56595ed7ad8430de5e7e18f97b6bcb9
+// Typelizer digest cd9b6f6045e58280aa1db2580f1a4f87
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
+import type {CatalogAssignableType} from '@/types'
interface CatalogAssignment {
id: string;
created_at: string;
catalog_id: string;
- assignable_type: string;
+ assignable_type: CatalogAssignableType;
assignable_id: string;
assignable_name: string | null;
}
diff --git a/packages/admin-sdk/src/types/generated/CatalogPrice.ts b/packages/admin-sdk/src/types/generated/CatalogPrice.ts
index e8bb564e8b..3808176ef5 100644
--- a/packages/admin-sdk/src/types/generated/CatalogPrice.ts
+++ b/packages/admin-sdk/src/types/generated/CatalogPrice.ts
@@ -1,14 +1,14 @@
-// Typelizer digest 21d40ca78516d21a73f876dc87b10072
+// Typelizer digest 928b61496c10fdc2e45cc245e79f3a1a
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {CatalogPriceTier, CurrencyCode} from '@/types'
+import type {CatalogPriceTier, CurrencyCode, CatalogPriceSource} from '@/types'
interface CatalogPrice {
id: string | null;
label: string | null;
sku: string | null;
currency: CurrencyCode;
- source: 'explicit' | 'automatic' | 'base';
+ source: CatalogPriceSource;
break_count: number;
amount: string;
tiers: Array<CatalogPriceTier>;
diff --git a/packages/admin-sdk/src/types/generated/Channel.ts b/packages/admin-sdk/src/types/generated/Channel.ts
index 8a0c46d5c6..fe787b8a98 100644
--- a/packages/admin-sdk/src/types/generated/Channel.ts
+++ b/packages/admin-sdk/src/types/generated/Channel.ts
@@ -1,6 +1,7 @@
-// Typelizer digest 1e3c6c4c2fb1f69409903640da00d4de
+// Typelizer digest f2bd1ec50a5cef997dea34b686051733
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
+import type {StorefrontAccess} from '@/types'
interface Channel {
id: string;
@@ -8,7 +9,7 @@ interface Channel {
code: string;
active: boolean;
default: boolean;
- storefront_access: 'public' | 'prices_hidden' | 'login_required' | null;
+ storefront_access: StorefrontAccess | null;
guest_checkout: boolean | null;
created_at: string;
updated_at: string;
diff --git a/packages/admin-sdk/src/types/generated/Claim.ts b/packages/admin-sdk/src/types/generated/Claim.ts
index 466d4ddf53..d071f972c8 100644
--- a/packages/admin-sdk/src/types/generated/Claim.ts
+++ b/packages/admin-sdk/src/types/generated/Claim.ts
@@ -1,13 +1,13 @@
-// Typelizer digest f2d81d3863047d1f166e0f021077ce93
+// Typelizer digest 3140d1210fcede1a932c25f95586b1f3
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {ClaimReason, ClaimLineItem, Actor, Order, Refund, ClaimStatus, ActorKind} from '@/types'
+import type {ClaimReason, ClaimLineItem, Actor, Order, Refund, ClaimStatus, ClaimResolution, ActorKind} from '@/types'
interface Claim {
id: string;
number: string;
status: ClaimStatus;
- resolution: string | null;
+ resolution: ClaimResolution | null;
order_id: string | null;
reason_id: string | null;
refund_total: string;
diff --git a/packages/admin-sdk/src/types/generated/Collection.ts b/packages/admin-sdk/src/types/generated/Collection.ts
index dc6df59e82..5711dfc532 100644
--- a/packages/admin-sdk/src/types/generated/Collection.ts
+++ b/packages/admin-sdk/src/types/generated/Collection.ts
@@ -1,14 +1,14 @@
-// Typelizer digest bd551a4319c138b58d4248f1896811d2
+// Typelizer digest fc8d42dede7f8a6fa6a777c7fb78b159
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {CustomField, CollectionRule} from '@/types'
+import type {CustomField, CollectionRule, CollectionSortOrder, MatchPolicy} from '@/types'
interface Collection {
id: string;
name: string;
permalink: string;
position: number;
- sort_order: string;
+ sort_order: CollectionSortOrder;
meta_title: string | null;
meta_description: string | null;
meta_keywords: string | null;
@@ -20,7 +20,7 @@ interface Collection {
custom_fields?: Array<CustomField>;
translations?: Record<string, Record<string, string | number | null>>;
automatic: boolean;
- rules_match_policy: 'all' | 'any';
+ rules_match_policy: MatchPolicy;
metadata: Record<string, unknown>;
created_at: string;
updated_at: string;
diff --git a/packages/admin-sdk/src/types/generated/CollectionRule.ts b/packages/admin-sdk/src/types/generated/CollectionRule.ts
index cc677afc06..e8ddca0cea 100644
--- a/packages/admin-sdk/src/types/generated/CollectionRule.ts
+++ b/packages/admin-sdk/src/types/generated/CollectionRule.ts
@@ -1,11 +1,12 @@
-// Typelizer digest 15334e0423eda7084dc365163f4ee10a
+// Typelizer digest 0679c66b0446f3b8fd54f4937950aeea
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
+import type {CollectionRuleMatchPolicy} from '@/types'
interface CollectionRule {
id: string;
value: string | null;
- match_policy: 'is_equal_to' | 'is_not_equal_to' | 'contains' | 'does_not_contain';
+ match_policy: CollectionRuleMatchPolicy;
/** Rule type. Built-in: tag, available_on, sale. Extensions may register more. */
type: string;
}
diff --git a/packages/admin-sdk/src/types/generated/CommissionLine.ts b/packages/admin-sdk/src/types/generated/CommissionLine.ts
index d42bb03230..b47a562e69 100644
--- a/packages/admin-sdk/src/types/generated/CommissionLine.ts
+++ b/packages/admin-sdk/src/types/generated/CommissionLine.ts
@@ -1,13 +1,13 @@
-// Typelizer digest 1124cc66695f250b370cb68a4eebe2c4
+// Typelizer digest b50ffcd169fa4be50817b156c5b91686
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {CommissionRate, CurrencyCode, CountryCode} from '@/types'
+import type {CommissionRate, CommissionKind, CurrencyCode, TaxabilityReason, CountryCode} from '@/types'
interface CommissionLine {
id: string;
- kind: 'percentage' | 'fixed';
+ kind: CommissionKind;
currency: CurrencyCode;
- taxability_reason: string | null;
+ taxability_reason: TaxabilityReason | null;
country_code: CountryCode | null;
state_code: string | null;
created_at: string;
diff --git a/packages/admin-sdk/src/types/generated/CommissionRate.ts b/packages/admin-sdk/src/types/generated/CommissionRate.ts
index a75a419ce9..010ca3a8ca 100644
--- a/packages/admin-sdk/src/types/generated/CommissionRate.ts
+++ b/packages/admin-sdk/src/types/generated/CommissionRate.ts
@@ -1,7 +1,7 @@
-// Typelizer digest 76b8faf2e89ba5aa51f4be3e3cf60742
+// Typelizer digest e807eb4795a346cf9f3653085887b298
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {CommissionRule} from '@/types'
+import type {CommissionRule, CommissionKind} from '@/types'
interface CommissionRate {
id: string;
@@ -9,7 +9,7 @@ interface CommissionRate {
code: string | null;
enabled: boolean;
position: number;
- kind: 'percentage' | 'fixed';
+ kind: CommissionKind;
tax_inclusive: boolean;
include_shipping: boolean;
metadata: Record<string, unknown> | null;
diff --git a/packages/admin-sdk/src/types/generated/Company.ts b/packages/admin-sdk/src/types/generated/Company.ts
index 428804ff12..0dee613207 100644
--- a/packages/admin-sdk/src/types/generated/Company.ts
+++ b/packages/admin-sdk/src/types/generated/Company.ts
@@ -1,12 +1,12 @@
-// Typelizer digest 2d0411984e0d66a497032d50f00fb306
+// Typelizer digest 0dec66866ce90abf81254d6bd0fb403f
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {Address, CompanyMembership} from '@/types'
+import type {Address, CompanyMembership, CompanyKind} from '@/types'
interface Company {
id: string;
name: string;
- kind: 'company' | 'division';
+ kind: CompanyKind;
po_number_required: boolean;
parent_id: string | null;
ancestors: Array<{id: string, name: string, kind: string}>;
diff --git a/packages/admin-sdk/src/types/generated/CompanyInvitation.ts b/packages/admin-sdk/src/types/generated/CompanyInvitation.ts
index 3a518ee1cb..aedec72318 100644
--- a/packages/admin-sdk/src/types/generated/CompanyInvitation.ts
+++ b/packages/admin-sdk/src/types/generated/CompanyInvitation.ts
@@ -1,13 +1,14 @@
-// Typelizer digest 1bf94eb731a27d45b404bbca4f4927b8
+// Typelizer digest dcd254d9cfc9e527ba81e14c0cf9ee6b
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
+import type {CompanyInvitationStatus} from '@/types'
interface CompanyInvitation {
id: string;
email: string;
expires_at: string | null;
company_id: string;
- status: 'pending' | 'accepted' | 'revoked' | 'expired';
+ status: CompanyInvitationStatus;
accepted_at: string | null;
revoked_at: string | null;
created_at: string;
diff --git a/packages/admin-sdk/src/types/generated/ConsentRecord.ts b/packages/admin-sdk/src/types/generated/ConsentRecord.ts
index a1f2c08ab6..3a57d3bc1a 100644
--- a/packages/admin-sdk/src/types/generated/ConsentRecord.ts
+++ b/packages/admin-sdk/src/types/generated/ConsentRecord.ts
@@ -1,11 +1,12 @@
-// Typelizer digest f85b1021312d363ecd02d87be9e2b02a
+// Typelizer digest c08c11416e57ba49ee3ed9c8a73d2906
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
+import type {ConsentSource} from '@/types'
interface ConsentRecord {
id: string;
purpose: string;
- source: 'checkout' | 'registration' | 'account' | 'admin' | 'newsletter' | 'anonymization' | 'unknown' | 'import' | 'storefront';
+ source: ConsentSource;
accepted: boolean;
email: string | null;
ip_address: string | null;
diff --git a/packages/admin-sdk/src/types/generated/DataRequest.ts b/packages/admin-sdk/src/types/generated/DataRequest.ts
index 2d3b3e9b53..4806f16eb3 100644
--- a/packages/admin-sdk/src/types/generated/DataRequest.ts
+++ b/packages/admin-sdk/src/types/generated/DataRequest.ts
@@ -1,12 +1,12 @@
-// Typelizer digest beb2d0c28b620fff4d37468e01447d09
+// Typelizer digest 625f1b925d26d15194019866a5871546
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {Customer, DataRequestStatus} from '@/types'
+import type {Customer, DataRequestKind, DataRequestStatus} from '@/types'
interface DataRequest {
id: string;
number: string;
- kind: 'access' | 'erasure';
+ kind: DataRequestKind;
status: DataRequestStatus;
requested_at: string | null;
completed_at: string | null;
diff --git a/packages/admin-sdk/src/types/generated/Delivery.ts b/packages/admin-sdk/src/types/generated/Delivery.ts
index babfd294a9..f5a25261fb 100644
--- a/packages/admin-sdk/src/types/generated/Delivery.ts
+++ b/packages/admin-sdk/src/types/generated/Delivery.ts
@@ -1,6 +1,7 @@
-// Typelizer digest f8a1a8d2a16f2a1973c6c88c36bd06f8
+// Typelizer digest cede6d7dcdafc7603c5cbea3e6eed048
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
+import type {DeliveryStatus} from '@/types'
interface Delivery {
id: string;
@@ -8,7 +9,7 @@ interface Delivery {
carrier: string | null;
carrier_name: string | null;
service: string | null;
- status: 'pending' | 'pre_transit' | 'in_transit' | 'out_for_delivery' | 'available_for_pickup' | 'delivered' | 'return_to_sender' | 'failure' | 'unknown';
+ status: DeliveryStatus;
tracking_url: string | null;
estimated_delivery_at: string | null;
delivered_at: string | null;
diff --git a/packages/admin-sdk/src/types/generated/DeliveryZoneMember.ts b/packages/admin-sdk/src/types/generated/DeliveryZoneMember.ts
index 00dcbaf69a..cb3d3b127d 100644
--- a/packages/admin-sdk/src/types/generated/DeliveryZoneMember.ts
+++ b/packages/admin-sdk/src/types/generated/DeliveryZoneMember.ts
@@ -1,11 +1,11 @@
-// Typelizer digest 840c3a759dfdcb97fa40fddc909e91c5
+// Typelizer digest 9523fc8c188cabb8f9c87a29ec6ebda9
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {CountryCode} from '@/types'
+import type {DeliveryZoneMemberType, CountryCode} from '@/types'
interface DeliveryZoneMember {
id: string;
- member_type: 'country' | 'state' | 'postal_code';
+ member_type: DeliveryZoneMemberType;
country_code: CountryCode | null;
state_code: string | null;
postal_code_prefix: string | null;
diff --git a/packages/admin-sdk/src/types/generated/Discount.ts b/packages/admin-sdk/src/types/generated/Discount.ts
index 63716e9828..5eb8f1d51d 100644
--- a/packages/admin-sdk/src/types/generated/Discount.ts
+++ b/packages/admin-sdk/src/types/generated/Discount.ts
@@ -1,11 +1,12 @@
-// Typelizer digest 71aebb8c53f1498f5a8a728c7aec5e4f
+// Typelizer digest 1b7df6f4e6b3975420c1b61bc2e4c461
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
+import type {DiscountKind} from '@/types'
interface Discount {
id: string;
label: string;
- kind: 'promotion' | 'manual';
+ kind: DiscountKind;
code: string | null;
value_type: string | null;
value: string | null;
diff --git a/packages/admin-sdk/src/types/generated/EmailTemplate.ts b/packages/admin-sdk/src/types/generated/EmailTemplate.ts
index 343d35cd55..11419b1969 100644
--- a/packages/admin-sdk/src/types/generated/EmailTemplate.ts
+++ b/packages/admin-sdk/src/types/generated/EmailTemplate.ts
@@ -1,7 +1,7 @@
-// Typelizer digest b8e6011a04828879c460e7d9549166b2
+// Typelizer digest 37f2de38946b3d51fa367aae4cf2d1ae
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {EmailTemplateDraft} from '@/types'
+import type {EmailTemplateDraft, EmailTemplateKind} from '@/types'
interface EmailTemplate {
id: string;
@@ -10,7 +10,7 @@ interface EmailTemplate {
body: string;
language: string;
customized_languages: Array<string>;
- kind: 'email' | 'layout' | 'partial';
+ kind: EmailTemplateKind;
customized: boolean;
published_at: string | null;
default_subject: string | null;
diff --git a/packages/admin-sdk/src/types/generated/EmailTemplateDraft.ts b/packages/admin-sdk/src/types/generated/EmailTemplateDraft.ts
index fdd3c2b136..6662495ae2 100644
--- a/packages/admin-sdk/src/types/generated/EmailTemplateDraft.ts
+++ b/packages/admin-sdk/src/types/generated/EmailTemplateDraft.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 504fb35cefcb3210e6e4ae2893a5ce22
+// Typelizer digest 4eb4e195b82cf5a28bb90d6706550d7b
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {Actor, ActorKind} from '@/types'
diff --git a/packages/admin-sdk/src/types/generated/EmailTemplateRevision.ts b/packages/admin-sdk/src/types/generated/EmailTemplateRevision.ts
index dbccd170db..92a81ec8b3 100644
--- a/packages/admin-sdk/src/types/generated/EmailTemplateRevision.ts
+++ b/packages/admin-sdk/src/types/generated/EmailTemplateRevision.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 91484d0e4bfb593251bf2dc2985aa842
+// Typelizer digest 2a547ca9f2603474d5ab17a6a45467e7
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {Actor, ActorKind} from '@/types'
diff --git a/packages/admin-sdk/src/types/generated/Enums.ts b/packages/admin-sdk/src/types/generated/Enums.ts
index 3580e46669..7318a07b02 100644
--- a/packages/admin-sdk/src/types/generated/Enums.ts
+++ b/packages/admin-sdk/src/types/generated/Enums.ts
@@ -1,31 +1,81 @@
-// Typelizer digest 9aff97510b37a847b605a9f369433d6a
+// Typelizer digest cdb6adfc6a419646986c78dcee805b20
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-export type ActorKind = 'admin_user' | 'api_key' | (string & {});
-export type ClaimStatus = 'open' | 'approved' | 'resolved' | 'denied' | 'canceled' | (string & {});
+export type { ActorKind } from '@spree/sdk-core';
+export type { ApiKeyType } from '@spree/sdk-core';
+export type { CaptureMethod } from '@spree/sdk-core';
+export type { CatalogAssignableType } from '@spree/sdk-core';
+export type { CatalogPriceSource } from '@spree/sdk-core';
+export type { ClaimResolution } from '@spree/sdk-core';
+export type { ClaimStatus } from '@spree/sdk-core';
+export type { CollectionRuleMatchPolicy } from '@spree/sdk-core';
+export type { CollectionSortOrder } from '@spree/sdk-core';
+export type { CommissionKind } from '@spree/sdk-core';
+export type { CompanyInvitationStatus } from '@spree/sdk-core';
+export type { CompanyKind } from '@spree/sdk-core';
+export type { ConsentSource } from '@spree/sdk-core';
export type { CountryCode } from '@spree/sdk-core';
export type { CurrencyCode } from '@spree/sdk-core';
-export type DataRequestStatus = 'awaiting_confirmation' | 'pending' | 'processing' | 'completed' | 'failed' | 'lapsed' | (string & {});
+export type { DataRequestKind } from '@spree/sdk-core';
+export type { DataRequestStatus } from '@spree/sdk-core';
+export type { DeliveryStatus } from '@spree/sdk-core';
+export type { DeliveryZoneMemberType } from '@spree/sdk-core';
export type { DimensionUnit } from '@spree/sdk-core';
-export type ExchangeStatus = 'requested' | 'approved' | 'received' | 'fulfilled' | 'canceled' | (string & {});
-export type FeeKind = 'surcharge' | 'handling' | 'gift_wrap' | 'cod' | 'payment' | 'duty' | 'exchange' | (string & {});
-export type FulfillmentItemStatus = 'on_hand' | 'backordered' | 'shipped' | 'returned' | (string & {});
-export type FulfillmentStatus = 'unfulfilled' | 'fulfilled' | 'delivered' | 'canceled' | (string & {});
-export type GiftCardStatus = 'active' | 'partially_redeemed' | 'redeemed' | 'canceled' | 'expired' | (string & {});
-export type ImportRowStatus = 'pending' | 'processing' | 'completed' | 'failed' | (string & {});
-export type ImportStatus = 'pending' | 'mapping' | 'completed_mapping' | 'processing' | 'completed' | 'failed' | (string & {});
-export type InvitationStatus = 'pending' | 'accepted' | (string & {});
+export type { DiscountKind } from '@spree/sdk-core';
+export type { DocumentNumberFormat } from '@spree/sdk-core';
+export type { EmailFont } from '@spree/sdk-core';
+export type { EmailTemplateKind } from '@spree/sdk-core';
+export type { ExchangeStatus } from '@spree/sdk-core';
+export type { FeeKind } from '@spree/sdk-core';
+export type { FileUploadVisibility } from '@spree/sdk-core';
+export type { FulfillmentItemStatus } from '@spree/sdk-core';
+export type { FulfillmentStatus } from '@spree/sdk-core';
+export type { FulfillmentType } from '@spree/sdk-core';
+export type { GiftCardStatus } from '@spree/sdk-core';
+export type { ImportRowStatus } from '@spree/sdk-core';
+export type { ImportStatus } from '@spree/sdk-core';
+export type { InvitationStatus } from '@spree/sdk-core';
export type { LocaleCode } from '@spree/sdk-core';
-export type PaymentStatus = 'checkout' | 'processing' | 'pending' | 'completed' | 'failed' | 'void' | 'invalid' | (string & {});
-export type PriceListStatus = 'draft' | 'active' | 'inactive' | 'scheduled' | (string & {});
-export type ProductStatus = 'draft' | 'active' | 'archived' | 'proposed' | 'rejected' | (string & {});
-export type ProductSubmissionStatus = 'pending' | 'approved' | 'rejected' | 'withdrawn' | (string & {});
-export type ReturnStatus = 'requested' | 'approved' | 'received' | 'refunded' | 'canceled' | (string & {});
-export type SellerPayoutStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'unresolved' | (string & {});
-export type SellerRequirementSubmissionStatus = 'pending' | 'accepted' | 'rejected' | 'waived' | (string & {});
-export type SellerStatus = 'pending' | 'invited' | 'canceled' | 'onboarding' | 'ready_for_review' | 'approved' | 'rejected' | 'suspended' | (string & {});
-export type SellerTransferStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'unresolved' | (string & {});
-export type ShippingLabelStatus = 'purchased' | 'refund_requested' | 'refunded' | (string & {});
-export type StockLocationKind = 'warehouse' | 'store' | 'fulfillment_center' | (string & {});
-export type TaxExemptionCertificateStatus = 'pending' | 'verified' | 'expired' | 'revoked' | (string & {});
+export type { MatchPolicy } from '@spree/sdk-core';
+export type { MediaType } from '@spree/sdk-core';
+export type { OptionTypeKind } from '@spree/sdk-core';
+export type { OrderFulfillmentStatus } from '@spree/sdk-core';
+export type { OrderPaymentStatus } from '@spree/sdk-core';
+export type { OrderStatus } from '@spree/sdk-core';
+export type { PackageTypeKind } from '@spree/sdk-core';
+export type { PaymentSourceType } from '@spree/sdk-core';
+export type { PaymentStatus } from '@spree/sdk-core';
+export type { PayoutScheduleInterval } from '@spree/sdk-core';
+export type { PermissionKind } from '@spree/sdk-core';
+export type { PickupStockPolicy } from '@spree/sdk-core';
+export type { PriceListStatus } from '@spree/sdk-core';
+export type { ProductStatus } from '@spree/sdk-core';
+export type { ProductSubmissionStatus } from '@spree/sdk-core';
+export type { ProviderFailurePolicy } from '@spree/sdk-core';
+export type { PurchaseOrderStatus } from '@spree/sdk-core';
+export type { PurchaseUnit } from '@spree/sdk-core';
+export type { ReturnStatus } from '@spree/sdk-core';
+export type { SellerPayoutStatus } from '@spree/sdk-core';
+export type { SellerRequirementState } from '@spree/sdk-core';
+export type { SellerRequirementSubmissionStatus } from '@spree/sdk-core';
+export type { SellerStatus } from '@spree/sdk-core';
+export type { SellerTransferKind } from '@spree/sdk-core';
+export type { SellerTransferStatus } from '@spree/sdk-core';
+export type { ShippingLabelFormat } from '@spree/sdk-core';
+export type { ShippingLabelOwnerType } from '@spree/sdk-core';
+export type { ShippingLabelSource } from '@spree/sdk-core';
+export type { ShippingLabelStatus } from '@spree/sdk-core';
+export type { StockLocationKind } from '@spree/sdk-core';
+export type { StockMovementKind } from '@spree/sdk-core';
+export type { StockReceiptLineType } from '@spree/sdk-core';
+export type { StockReceiptReceivableType } from '@spree/sdk-core';
+export type { StockReceiptRejectionReason } from '@spree/sdk-core';
+export type { StockTransferStatus } from '@spree/sdk-core';
+export type { StorefrontAccess } from '@spree/sdk-core';
+export type { TaxExemptionCertificateStatus } from '@spree/sdk-core';
+export type { TaxIdentifierSource } from '@spree/sdk-core';
+export type { TaxIdentifierValidationStatus } from '@spree/sdk-core';
+export type { TaxRemittance } from '@spree/sdk-core';
+export type { TaxabilityReason } from '@spree/sdk-core';
+export type { UnitSystem } from '@spree/sdk-core';
export type { WeightUnit } from '@spree/sdk-core';
diff --git a/packages/admin-sdk/src/types/generated/Exchange.ts b/packages/admin-sdk/src/types/generated/Exchange.ts
index 88208585da..b3cf44b669 100644
--- a/packages/admin-sdk/src/types/generated/Exchange.ts
+++ b/packages/admin-sdk/src/types/generated/Exchange.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 436a660d1e6265e20bb9cc442d8d3fb8
+// Typelizer digest 62143a23dcd7dfb86cc756a9974e3e11
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {ReturnReason, ExchangeLineItem, Actor, Order, StockLocation, Refund, ExchangeStatus, ActorKind} from '@/types'
diff --git a/packages/admin-sdk/src/types/generated/Fee.ts b/packages/admin-sdk/src/types/generated/Fee.ts
index 5751eee13b..075f93cf1b 100644
--- a/packages/admin-sdk/src/types/generated/Fee.ts
+++ b/packages/admin-sdk/src/types/generated/Fee.ts
@@ -1,4 +1,4 @@
-// Typelizer digest fd4257dbeaae8a5c1fbea6d9224a9b36
+// Typelizer digest fc0e0236de58a2a6d18026297a384582
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {FeeKind} from '@/types'
diff --git a/packages/admin-sdk/src/types/generated/FileUpload.ts b/packages/admin-sdk/src/types/generated/FileUpload.ts
index 81ba092905..c489ba07c5 100644
--- a/packages/admin-sdk/src/types/generated/FileUpload.ts
+++ b/packages/admin-sdk/src/types/generated/FileUpload.ts
@@ -1,14 +1,14 @@
-// Typelizer digest 7a884ae6d631bee1659086d1f953f34f
+// Typelizer digest 4f3e7718354f467bc1e83b6fb28e64b3
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {FileUploadTarget} from '@/types'
+import type {FileUploadTarget, FileUploadVisibility} from '@/types'
interface FileUpload {
signed_id: string;
filename: string;
content_type: string;
byte_size: number;
- visibility: 'public' | 'private';
+ visibility: FileUploadVisibility;
expires_at: string;
upload: FileUploadTarget | null;
}
diff --git a/packages/admin-sdk/src/types/generated/Fulfillment.ts b/packages/admin-sdk/src/types/generated/Fulfillment.ts
index c8a356d550..5c2638a661 100644
--- a/packages/admin-sdk/src/types/generated/Fulfillment.ts
+++ b/packages/admin-sdk/src/types/generated/Fulfillment.ts
@@ -1,7 +1,7 @@
-// Typelizer digest 3685ae389170e27b399962a159f71382
+// Typelizer digest 5b76e561882d0c792ffc50bd4d29b092
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {Delivery, DeliveryMethod, StockLocation, DeliveryRate, TaxLine, ShippingLabel, FulfillmentItem, Order, FulfillmentStatus} from '@/types'
+import type {Delivery, DeliveryMethod, StockLocation, DeliveryRate, TaxLine, ShippingLabel, FulfillmentItem, Order, FulfillmentStatus, FulfillmentType} from '@/types'
interface Fulfillment {
id: string;
@@ -18,7 +18,7 @@ interface Fulfillment {
included_tax_total: string;
tax_total: string;
status: FulfillmentStatus;
- fulfillment_type: 'shipping' | 'digital' | 'pickup' | 'pickup_point';
+ fulfillment_type: FulfillmentType;
fulfilled_at: string | null;
delivered_at: string | null;
items: Array<{ item_id: string; variant_id: string; quantity: number }>;
diff --git a/packages/admin-sdk/src/types/generated/FulfillmentItem.ts b/packages/admin-sdk/src/types/generated/FulfillmentItem.ts
index cf89ec509a..6c80c3e5d2 100644
--- a/packages/admin-sdk/src/types/generated/FulfillmentItem.ts
+++ b/packages/admin-sdk/src/types/generated/FulfillmentItem.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 906035f991fd2519c19d43c075bb1898
+// Typelizer digest eb05fd21629350cae4f3b2002b823a5d
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {FulfillmentItemStatus} from '@/types'
diff --git a/packages/admin-sdk/src/types/generated/GiftCard.ts b/packages/admin-sdk/src/types/generated/GiftCard.ts
index 98ae5f06b7..a877454713 100644
--- a/packages/admin-sdk/src/types/generated/GiftCard.ts
+++ b/packages/admin-sdk/src/types/generated/GiftCard.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 3f89ef88dc8b03960dc32d1cafb0d0b9
+// Typelizer digest 3c136698da8ceff42146afb60adc97ee
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {Customer, AdminUser, GiftCardBatch, Order, GiftCardStatus, CurrencyCode} from '@/types'
diff --git a/packages/admin-sdk/src/types/generated/Import.ts b/packages/admin-sdk/src/types/generated/Import.ts
index a0daaece78..8342c08468 100644
--- a/packages/admin-sdk/src/types/generated/Import.ts
+++ b/packages/admin-sdk/src/types/generated/Import.ts
@@ -1,4 +1,4 @@
-// Typelizer digest b85bbe53aeda363eb0baa21e861b3b6c
+// Typelizer digest 5cb31819f8e84f07a3418f7f9a9ca997
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {ImportMapping, ImportStatus} from '@/types'
diff --git a/packages/admin-sdk/src/types/generated/ImportRow.ts b/packages/admin-sdk/src/types/generated/ImportRow.ts
index 1f9424358c..a9f82265a7 100644
--- a/packages/admin-sdk/src/types/generated/ImportRow.ts
+++ b/packages/admin-sdk/src/types/generated/ImportRow.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 53b02b14bf92a5a0451aabdeab4f9636
+// Typelizer digest 5d8664a9cdc28c24fd16d81e21383315
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {ImportRowStatus} from '@/types'
diff --git a/packages/admin-sdk/src/types/generated/Invitation.ts b/packages/admin-sdk/src/types/generated/Invitation.ts
index f7aeca6979..1317ae6ef8 100644
--- a/packages/admin-sdk/src/types/generated/Invitation.ts
+++ b/packages/admin-sdk/src/types/generated/Invitation.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 73489f6cdb59f0e72c3ec0ad9df13200
+// Typelizer digest 38ea522ab813d12dd2556ddc6aad5286
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {InvitationStatus} from '@/types'
diff --git a/packages/admin-sdk/src/types/generated/Media.ts b/packages/admin-sdk/src/types/generated/Media.ts
index ca7467d1c3..72c47b2f6d 100644
--- a/packages/admin-sdk/src/types/generated/Media.ts
+++ b/packages/admin-sdk/src/types/generated/Media.ts
@@ -1,6 +1,7 @@
-// Typelizer digest f44abcf127cfb2adc2d34feffe5748cb
+// Typelizer digest 93e6db216732e4df23dd10172f8a2f5e
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
+import type {MediaType} from '@/types'
interface Media {
id: string;
@@ -8,7 +9,7 @@ interface Media {
variant_ids: Array<string>;
position: number;
alt: string | null;
- media_type: 'image' | 'video' | 'external_video';
+ media_type: MediaType;
external_video_url: string | null;
focal_point_x: number | null;
focal_point_y: number | null;
diff --git a/packages/admin-sdk/src/types/generated/OptionType.ts b/packages/admin-sdk/src/types/generated/OptionType.ts
index 7c510df899..a061365c0a 100644
--- a/packages/admin-sdk/src/types/generated/OptionType.ts
+++ b/packages/admin-sdk/src/types/generated/OptionType.ts
@@ -1,14 +1,14 @@
-// Typelizer digest 9cda9500e59713a9ecf3d432b4ac1b34
+// Typelizer digest 0c4d0cdb4f95caa421925df41b2c30aa
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {OptionValue} from '@/types'
+import type {OptionValue, OptionTypeKind} from '@/types'
interface OptionType {
id: string;
name: string;
label: string;
position: number;
- kind: 'dropdown' | 'color_swatch' | 'buttons';
+ kind: OptionTypeKind;
translations?: Record<string, Record<string, string | number | null>>;
metadata: Record<string, unknown>;
filterable: boolean;
diff --git a/packages/admin-sdk/src/types/generated/Order.ts b/packages/admin-sdk/src/types/generated/Order.ts
index 64eb28fd3c..8f7f801931 100644
--- a/packages/admin-sdk/src/types/generated/Order.ts
+++ b/packages/admin-sdk/src/types/generated/Order.ts
@@ -1,7 +1,7 @@
-// Typelizer digest 6c118f1474f350a48d9c3230dac29974
+// Typelizer digest 2137b2726a7eca8cb973dc8d181e83a6
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {FreightSummary, Payment, LineItem, Fulfillment, Address, GiftCard, Market, Seller, Actor, AppliedPromotion, PaymentSplit, Cart, Channel, StockLocation, PaymentMethod, Customer, OrderCancellationReason, Return, Exchange, Claim, CurrencyCode, LocaleCode, ActorKind} from '@/types'
+import type {FreightSummary, Payment, LineItem, Fulfillment, Address, GiftCard, Market, Seller, Actor, AppliedPromotion, PaymentSplit, Cart, Channel, StockLocation, PaymentMethod, Customer, OrderCancellationReason, Return, Exchange, Claim, CurrencyCode, LocaleCode, OrderFulfillmentStatus, OrderPaymentStatus, OrderStatus, ActorKind} from '@/types'
interface Order {
id: string;
@@ -23,8 +23,8 @@ interface Order {
locale: LocaleCode | null;
total_quantity: number;
coupon_code: string | null;
- fulfillment_status: 'backorder' | 'canceled' | 'partial' | 'unfulfilled' | 'fulfilled' | 'delivered' | 'pending' | 'ready' | 'shipped' | null;
- payment_status: 'none' | 'authorized' | 'partially_paid' | 'paid' | 'partially_refunded' | 'refunded' | 'overcharged' | 'voided' | null;
+ fulfillment_status: OrderFulfillmentStatus | null;
+ payment_status: OrderPaymentStatus | null;
completed_at: string | null;
/** The line items: each price times its quantity, before discounts, fees and delivery. */
item_total: string;
@@ -59,7 +59,7 @@ interface Order {
gift_card: GiftCard | null;
market: Market | null;
external_references: Record<string, string>;
- status: 'draft' | 'placed' | 'canceled';
+ status: OrderStatus;
last_ip_address: string | null;
considered_risky: boolean;
confirmation_delivered: boolean;
diff --git a/packages/admin-sdk/src/types/generated/OrderGroup.ts b/packages/admin-sdk/src/types/generated/OrderGroup.ts
index e8b6552bb7..3f5fa81778 100644
--- a/packages/admin-sdk/src/types/generated/OrderGroup.ts
+++ b/packages/admin-sdk/src/types/generated/OrderGroup.ts
@@ -1,7 +1,7 @@
-// Typelizer digest 9d17f7c57f9f28ee6985e71b7b6ee6a9
+// Typelizer digest a9b3548cc8f3884d628be8be06beea36
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {Payment, Address, Order, CurrencyCode} from '@/types'
+import type {Payment, Address, Order, CurrencyCode, OrderFulfillmentStatus, OrderPaymentStatus} from '@/types'
interface OrderGroup {
id: string;
@@ -32,8 +32,8 @@ interface OrderGroup {
amount_due: string | null;
covered_by_store_credit: boolean;
payments: Array<Payment>;
- fulfillment_status: 'backorder' | 'canceled' | 'partial' | 'unfulfilled' | 'fulfilled' | 'delivered' | 'pending' | 'ready' | 'shipped' | null;
- payment_status: 'none' | 'authorized' | 'partially_paid' | 'paid' | 'partially_refunded' | 'refunded' | 'overcharged' | 'voided' | null;
+ fulfillment_status: OrderFulfillmentStatus | null;
+ payment_status: OrderPaymentStatus | null;
completed_at: string | null;
billing_address: Address | null;
shipping_address: Address | null;
diff --git a/packages/admin-sdk/src/types/generated/PackageType.ts b/packages/admin-sdk/src/types/generated/PackageType.ts
index 39a66549fe..ac2130ce57 100644
--- a/packages/admin-sdk/src/types/generated/PackageType.ts
+++ b/packages/admin-sdk/src/types/generated/PackageType.ts
@@ -1,12 +1,12 @@
-// Typelizer digest f8fce4158f49c94c93611bbeaaf795f2
+// Typelizer digest b71d95ee78b59a6acea53d92c9a0a245
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {DimensionUnit, WeightUnit} from '@/types'
+import type {PackageTypeKind, DimensionUnit, WeightUnit} from '@/types'
interface PackageType {
id: string;
name: string;
- kind: 'box' | 'envelope' | 'carton' | 'pallet' | 'container';
+ kind: PackageTypeKind;
length: string | null;
width: string | null;
height: string | null;
diff --git a/packages/admin-sdk/src/types/generated/Payment.ts b/packages/admin-sdk/src/types/generated/Payment.ts
index 32b69753ad..95e9bba21c 100644
--- a/packages/admin-sdk/src/types/generated/Payment.ts
+++ b/packages/admin-sdk/src/types/generated/Payment.ts
@@ -1,7 +1,7 @@
-// Typelizer digest 4c466bf3ac1117acca6f28a528dd8f2e
+// Typelizer digest 72fa3e2d7d60cebd8d995b5ca32c0e78
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {CreditCard, StoreCredit, PaymentSource, PaymentMethod, PaymentCaptureEvent, Order, Refund, PaymentSplit, PaymentStatus} from '@/types'
+import type {CreditCard, StoreCredit, PaymentSource, PaymentMethod, PaymentCaptureEvent, Order, Refund, PaymentSplit, PaymentStatus, PaymentSourceType} from '@/types'
interface Payment {
id: string;
@@ -10,7 +10,7 @@ interface Payment {
number: string;
status: PaymentStatus;
amount: string;
- source_type: 'credit_card' | 'store_credit' | 'payment_source' | null;
+ source_type: PaymentSourceType | null;
source_id: string | null;
source: CreditCard | StoreCredit | PaymentSource | null;
payment_method?: PaymentMethod;
diff --git a/packages/admin-sdk/src/types/generated/Permission.ts b/packages/admin-sdk/src/types/generated/Permission.ts
index 51aeb6b4fc..b82920133b 100644
--- a/packages/admin-sdk/src/types/generated/Permission.ts
+++ b/packages/admin-sdk/src/types/generated/Permission.ts
@@ -1,11 +1,12 @@
-// Typelizer digest 0cfad8f89d2201c393b676fb3e175429
+// Typelizer digest fa80a51e9e7ff256f197687b46e76ee9
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
+import type {PermissionKind} from '@/types'
interface Permission {
key: string;
resource: string;
- kind: 'read' | 'write';
+ kind: PermissionKind;
group: string;
group_label: string;
label: string;
diff --git a/packages/admin-sdk/src/types/generated/PriceList.ts b/packages/admin-sdk/src/types/generated/PriceList.ts
index 7ad6e61a19..07b099aff3 100644
--- a/packages/admin-sdk/src/types/generated/PriceList.ts
+++ b/packages/admin-sdk/src/types/generated/PriceList.ts
@@ -1,7 +1,7 @@
-// Typelizer digest edece20e85cf57a5362cdb2bb477574c
+// Typelizer digest b9ddb54699e920a546a641dc0e403919
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {PriceAdjustmentTier, PriceRule, PriceListStatus} from '@/types'
+import type {PriceAdjustmentTier, PriceRule, PriceListStatus, MatchPolicy} from '@/types'
interface PriceList {
id: string;
@@ -9,7 +9,7 @@ interface PriceList {
description: string | null;
status: PriceListStatus;
position: number;
- match_policy: 'all' | 'any';
+ match_policy: MatchPolicy;
adjust_compare_at: boolean;
starts_at: string | null;
ends_at: string | null;
diff --git a/packages/admin-sdk/src/types/generated/Product.ts b/packages/admin-sdk/src/types/generated/Product.ts
index 12f7275547..b8a2a0d6f2 100644
--- a/packages/admin-sdk/src/types/generated/Product.ts
+++ b/packages/admin-sdk/src/types/generated/Product.ts
@@ -1,4 +1,4 @@
-// Typelizer digest ab502d9234d08dac445290aeb0d0bd62
+// Typelizer digest c99c0ac8f4db77f4065614d1813382f4
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {Price, PriceHistory, ProductSubmission, Seller, Media, Variant, OptionType, OptionValue, Category, CustomField, DigitalAsset, Collection, ProductPublication, Channel, ProductType, ProductStatus} from '@/types'
diff --git a/packages/admin-sdk/src/types/generated/ProductSubmission.ts b/packages/admin-sdk/src/types/generated/ProductSubmission.ts
index 6c4aaed9c1..6f189a2b96 100644
--- a/packages/admin-sdk/src/types/generated/ProductSubmission.ts
+++ b/packages/admin-sdk/src/types/generated/ProductSubmission.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 2e7732b90b82b9ed357852341d6f8ea1
+// Typelizer digest c1d1ac6b1917d660f8f467124f5263f3
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {ProductSubmissionStatus} from '@/types'
diff --git a/packages/admin-sdk/src/types/generated/PurchaseOrder.ts b/packages/admin-sdk/src/types/generated/PurchaseOrder.ts
index 4ffcd883d6..953262c8b8 100644
--- a/packages/admin-sdk/src/types/generated/PurchaseOrder.ts
+++ b/packages/admin-sdk/src/types/generated/PurchaseOrder.ts
@@ -1,12 +1,12 @@
-// Typelizer digest 90c18511c6cb80debfa3a50ea7afea1c
+// Typelizer digest 08f5c6f45d9bf65cce699244f4348d15
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {PurchaseOrderItem, StockReceipt, Supplier, StockLocation, CurrencyCode} from '@/types'
+import type {PurchaseOrderItem, StockReceipt, Supplier, StockLocation, PurchaseOrderStatus, CurrencyCode} from '@/types'
interface PurchaseOrder {
id: string;
number: string;
- status: string;
+ status: PurchaseOrderStatus;
currency: CurrencyCode;
reference: string | null;
notes: string | null;
diff --git a/packages/admin-sdk/src/types/generated/Refund.ts b/packages/admin-sdk/src/types/generated/Refund.ts
index 313f97288e..697a7476e6 100644
--- a/packages/admin-sdk/src/types/generated/Refund.ts
+++ b/packages/admin-sdk/src/types/generated/Refund.ts
@@ -1,4 +1,4 @@
-// Typelizer digest dfde925969be7b4ebaa92ab107508b67
+// Typelizer digest d7aaf72e6f68bbcef9babb9852cfb8ea
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {Actor, Payment, ActorKind} from '@/types'
diff --git a/packages/admin-sdk/src/types/generated/Return.ts b/packages/admin-sdk/src/types/generated/Return.ts
index d85f2d5309..2e9cccac8a 100644
--- a/packages/admin-sdk/src/types/generated/Return.ts
+++ b/packages/admin-sdk/src/types/generated/Return.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 6448d004d7a749aba6bf142762d627e2
+// Typelizer digest 8fde4966de277998b24a0f73e9b7f441
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {ReturnReason, ReturnLineItem, Actor, Order, StockLocation, Refund, ShippingLabel, Delivery, ReturnStatus, ActorKind} from '@/types'
diff --git a/packages/admin-sdk/src/types/generated/Seller.ts b/packages/admin-sdk/src/types/generated/Seller.ts
index 7faee67ec2..f7bd329321 100644
--- a/packages/admin-sdk/src/types/generated/Seller.ts
+++ b/packages/admin-sdk/src/types/generated/Seller.ts
@@ -1,7 +1,7 @@
-// Typelizer digest 4a8247473ccfdaa2cb94e42bf1b6c69d
+// Typelizer digest 01b675cdfca3530367d0bdd2a498d5dc
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {Address, SellerStatus} from '@/types'
+import type {Address, SellerStatus, TaxRemittance, PayoutScheduleInterval} from '@/types'
interface Seller {
id: string;
@@ -15,8 +15,8 @@ interface Seller {
status: SellerStatus;
contact_email: string | null;
billing_email: string | null;
- tax_remittance: string;
- payouts_schedule_interval: string | null;
+ tax_remittance: TaxRemittance;
+ payouts_schedule_interval: PayoutScheduleInterval | null;
metadata: Record<string, unknown> | null;
holiday_mode_until: string | null;
terms_accepted_at: string | null;
diff --git a/packages/admin-sdk/src/types/generated/SellerPayout.ts b/packages/admin-sdk/src/types/generated/SellerPayout.ts
index 71d6692bab..bf4192ecde 100644
--- a/packages/admin-sdk/src/types/generated/SellerPayout.ts
+++ b/packages/admin-sdk/src/types/generated/SellerPayout.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 508c1868d63fa6144b5248276474ef0d
+// Typelizer digest 3d1e66c9099bace2f5dd3496ef77ea54
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {SellerPayoutStatus, CurrencyCode} from '@/types'
diff --git a/packages/admin-sdk/src/types/generated/SellerRequirementStatus.ts b/packages/admin-sdk/src/types/generated/SellerRequirementStatus.ts
index fda9d8a3fb..cfd635f847 100644
--- a/packages/admin-sdk/src/types/generated/SellerRequirementStatus.ts
+++ b/packages/admin-sdk/src/types/generated/SellerRequirementStatus.ts
@@ -1,7 +1,7 @@
-// Typelizer digest 43a03ee2d7654408fa9be40bfc88169d
+// Typelizer digest 5175f52580ab02b7ebc595a847842e27
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {SellerRequirementSubmission, Policy} from '@/types'
+import type {SellerRequirementSubmission, Policy, SellerRequirementState} from '@/types'
interface SellerRequirementStatus {
id: string;
@@ -11,7 +11,7 @@ interface SellerRequirementStatus {
description: string | null;
required: boolean;
position: number;
- status: 'complete' | 'incomplete' | 'pending' | 'rejected';
+ status: SellerRequirementState;
action_url: string | null;
blocker: { state: string; message: string | null } | null;
blocking: boolean;
diff --git a/packages/admin-sdk/src/types/generated/SellerRequirementSubmission.ts b/packages/admin-sdk/src/types/generated/SellerRequirementSubmission.ts
index b9a507076d..5235523cbc 100644
--- a/packages/admin-sdk/src/types/generated/SellerRequirementSubmission.ts
+++ b/packages/admin-sdk/src/types/generated/SellerRequirementSubmission.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 2035e4a9ee7c77fd6c6b230339b7455e
+// Typelizer digest a9e43f190695420cf95c0fba4c6cca2e
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {SellerRequirementSubmissionStatus} from '@/types'
diff --git a/packages/admin-sdk/src/types/generated/SellerTransfer.ts b/packages/admin-sdk/src/types/generated/SellerTransfer.ts
index eee254b95b..2abda285b9 100644
--- a/packages/admin-sdk/src/types/generated/SellerTransfer.ts
+++ b/packages/admin-sdk/src/types/generated/SellerTransfer.ts
@@ -1,11 +1,11 @@
-// Typelizer digest e5e39d043b13341db4c0d79d5bb456cc
+// Typelizer digest 0b0e0ed309da775b473180f012678748
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {SellerTransferStatus, CurrencyCode} from '@/types'
+import type {SellerTransferKind, SellerTransferStatus, CurrencyCode} from '@/types'
interface SellerTransfer {
id: string;
- kind: 'earning' | 'refund_reversal';
+ kind: SellerTransferKind;
status: SellerTransferStatus;
currency: CurrencyCode;
reference: string | null;
diff --git a/packages/admin-sdk/src/types/generated/ShippingLabel.ts b/packages/admin-sdk/src/types/generated/ShippingLabel.ts
index a1e78ce2ef..e99539d466 100644
--- a/packages/admin-sdk/src/types/generated/ShippingLabel.ts
+++ b/packages/admin-sdk/src/types/generated/ShippingLabel.ts
@@ -1,25 +1,25 @@
-// Typelizer digest b25dde4577e69c227604574ade1dc28b
+// Typelizer digest b67b94c781f76ac15f85db09069ee3be
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {ShippingLabelStatus, CurrencyCode} from '@/types'
+import type {ShippingLabelSource, ShippingLabelStatus, CurrencyCode, ShippingLabelFormat, ShippingLabelOwnerType} from '@/types'
interface ShippingLabel {
id: string;
- source: 'purchased' | 'uploaded';
+ source: ShippingLabelSource;
status: ShippingLabelStatus;
carrier: string | null;
carrier_name: string | null;
service: string | null;
tracking_number: string | null;
currency: CurrencyCode | null;
- format: string | null;
+ format: ShippingLabelFormat | null;
external_id: string | null;
metadata: Record<string, unknown>;
refunded_at: string | null;
created_at: string;
updated_at: string;
owner_id: string;
- owner_type: 'fulfillment' | 'return';
+ owner_type: ShippingLabelOwnerType;
cost: string;
integration_id: string | null;
file_pending: boolean;
diff --git a/packages/admin-sdk/src/types/generated/StockLocation.ts b/packages/admin-sdk/src/types/generated/StockLocation.ts
index 6279de3c37..7fee86cd3d 100644
--- a/packages/admin-sdk/src/types/generated/StockLocation.ts
+++ b/packages/admin-sdk/src/types/generated/StockLocation.ts
@@ -1,7 +1,7 @@
-// Typelizer digest a0f5218c0dfee2c4b219b4a65f8a9a89
+// Typelizer digest 27fabc7b734db242b37b839bd7ab8f26
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {Seller, CountryCode, StockLocationKind} from '@/types'
+import type {Seller, CountryCode, StockLocationKind, PickupStockPolicy} from '@/types'
interface StockLocation {
id: string;
@@ -27,7 +27,7 @@ interface StockLocation {
propagate_all_variants: boolean;
kind: StockLocationKind;
pickup_enabled: boolean;
- pickup_stock_policy: 'local' | 'any';
+ pickup_stock_policy: PickupStockPolicy;
returns_enabled: boolean;
created_at: string;
updated_at: string;
diff --git a/packages/admin-sdk/src/types/generated/StockMovement.ts b/packages/admin-sdk/src/types/generated/StockMovement.ts
index 4b7069635a..d360dc29a0 100644
--- a/packages/admin-sdk/src/types/generated/StockMovement.ts
+++ b/packages/admin-sdk/src/types/generated/StockMovement.ts
@@ -1,11 +1,12 @@
-// Typelizer digest c8bdcb894b7c3f8f2280aac9231e1de1
+// Typelizer digest 79c5db5452d11c9c722b13757b077fb9
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
+import type {StockMovementKind} from '@/types'
interface StockMovement {
id: string;
quantity: number;
- kind: 'received' | 'allocated' | 'shipped' | 'released' | 'adjusted' | null;
+ kind: StockMovementKind | null;
reason: string | null;
created_at: string;
updated_at: string;
diff --git a/packages/admin-sdk/src/types/generated/StockReceipt.ts b/packages/admin-sdk/src/types/generated/StockReceipt.ts
index 648b49532c..bd55c72f47 100644
--- a/packages/admin-sdk/src/types/generated/StockReceipt.ts
+++ b/packages/admin-sdk/src/types/generated/StockReceipt.ts
@@ -1,7 +1,7 @@
-// Typelizer digest 396db57d875cc3a63a3995f1e1c2bb2b
+// Typelizer digest 4132491b6eacf192441c9aa2b7f501e3
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {Actor, StockReceiptItem, ActorKind} from '@/types'
+import type {Actor, StockReceiptItem, StockReceiptReceivableType, ActorKind} from '@/types'
interface StockReceipt {
id: string;
@@ -14,7 +14,7 @@ interface StockReceipt {
received_at: string;
created_at: string;
updated_at: string;
- receivable_type: 'purchase_order' | 'stock_transfer';
+ receivable_type: StockReceiptReceivableType;
receivable_id: string;
received_by_id: string | null;
received_by_type: ActorKind | null;
diff --git a/packages/admin-sdk/src/types/generated/StockReceiptItem.ts b/packages/admin-sdk/src/types/generated/StockReceiptItem.ts
index 567c6e89eb..32e47813b4 100644
--- a/packages/admin-sdk/src/types/generated/StockReceiptItem.ts
+++ b/packages/admin-sdk/src/types/generated/StockReceiptItem.ts
@@ -1,14 +1,15 @@
-// Typelizer digest 8327d2e44ffd63ce99f8bba067077b3c
+// Typelizer digest 62e4b2869d549e3e0c61551a7f6d4c36
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
+import type {StockReceiptRejectionReason, StockReceiptLineType} from '@/types'
interface StockReceiptItem {
id: string;
quantity_accepted: number;
quantity_rejected: number;
- rejection_reason: 'damaged' | 'wrong_item' | 'expired' | 'other' | null;
+ rejection_reason: StockReceiptRejectionReason | null;
notes: string | null;
- line_type: 'purchase_order_item' | 'stock_transfer_item';
+ line_type: StockReceiptLineType;
line_id: string | null;
variant_id: string | null;
product_id: string | null;
diff --git a/packages/admin-sdk/src/types/generated/StockTransfer.ts b/packages/admin-sdk/src/types/generated/StockTransfer.ts
index 0bf56f0ef7..5fb4f26a6a 100644
--- a/packages/admin-sdk/src/types/generated/StockTransfer.ts
+++ b/packages/admin-sdk/src/types/generated/StockTransfer.ts
@@ -1,7 +1,7 @@
-// Typelizer digest a1f6e773b861b1aabf383a4b37cc2bf8
+// Typelizer digest 0f8a240d04216e042baa7c6373f6c624
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {StockTransferItem, StockReceipt, StockLocation} from '@/types'
+import type {StockTransferItem, StockReceipt, StockLocation, StockTransferStatus} from '@/types'
interface StockTransfer {
id: string;
@@ -11,7 +11,7 @@ interface StockTransfer {
updated_at: string;
source_location_id: string;
destination_location_id: string;
- status: string;
+ status: StockTransferStatus;
notes: string | null;
metadata: Record<string, unknown>;
close_reason: string | null;
diff --git a/packages/admin-sdk/src/types/generated/Store.ts b/packages/admin-sdk/src/types/generated/Store.ts
index d4245693e5..33932e6648 100644
--- a/packages/admin-sdk/src/types/generated/Store.ts
+++ b/packages/admin-sdk/src/types/generated/Store.ts
@@ -1,7 +1,7 @@
-// Typelizer digest ce801fb0d3e343de46a8e6f7e78ec5cf
+// Typelizer digest 9c505ea4d837ab23033514c186f95de4
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {SetupTask, CurrencyCode, LocaleCode, WeightUnit} from '@/types'
+import type {SetupTask, CurrencyCode, LocaleCode, WeightUnit, UnitSystem, StorefrontAccess, CaptureMethod, ProviderFailurePolicy, PayoutScheduleInterval, DocumentNumberFormat, EmailFont} from '@/types'
interface Store {
id: string;
@@ -24,14 +24,14 @@ interface Store {
timezone: string;
storefront_url: string | null;
weight_unit: WeightUnit;
- unit_system: 'metric' | 'imperial';
- storefront_access: 'public' | 'prices_hidden' | 'login_required';
+ unit_system: UnitSystem;
+ storefront_access: StorefrontAccess;
guest_checkout: boolean;
always_include_confirm_step: boolean;
company_field_enabled: boolean;
address_requires_company: boolean;
address_requires_phone: boolean;
- capture_method: 'checkout' | 'on_dispatch' | 'manual';
+ capture_method: CaptureMethod;
track_inventory_levels: boolean;
stock_reservations_enabled: boolean;
low_stock_threshold: number;
@@ -41,13 +41,13 @@ interface Store {
disable_sku_validation: boolean;
pricing_provider: string;
inventory_provider: string;
- pricing_provider_failure_policy: 'fallback' | 'strict';
- inventory_provider_failure_policy: 'fallback' | 'strict';
- default_payouts_schedule_interval: 'daily' | 'weekly' | 'biweekly' | 'monthly' | 'manual';
+ pricing_provider_failure_policy: ProviderFailurePolicy;
+ inventory_provider_failure_policy: ProviderFailurePolicy;
+ default_payouts_schedule_interval: PayoutScheduleInterval;
auto_approve_sellers: boolean;
auto_approve_seller_products: boolean;
send_seller_transactional_emails: boolean;
- document_number_format: 'sequential' | 'random';
+ document_number_format: DocumentNumberFormat;
order_number_prefix: string;
order_number_suffix: string;
order_number_sequence_start: number;
@@ -61,7 +61,7 @@ interface Store {
email_card_color: string | null;
email_text_color: string | null;
email_heading_color: string | null;
- email_font: 'inter' | 'system' | 'helvetica' | 'georgia' | 'roboto' | 'lato' | 'merriweather' | null;
+ email_font: EmailFont | null;
order_number_sequence_started: boolean;
default_minimum_payout_amount: string | null;
default_commission_tax_rate: string | null;
diff --git a/packages/admin-sdk/src/types/generated/TaxExemptionCertificate.ts b/packages/admin-sdk/src/types/generated/TaxExemptionCertificate.ts
index dd322457af..b99fc65629 100644
--- a/packages/admin-sdk/src/types/generated/TaxExemptionCertificate.ts
+++ b/packages/admin-sdk/src/types/generated/TaxExemptionCertificate.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 294ca3bacaa4074112b2feeeb49e8f3b
+// Typelizer digest 6c319f2bd6d99c31c33217e62d981648
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {TaxExemptionReason, TaxExemptionCertificateStatus, CountryCode} from '@/types'
diff --git a/packages/admin-sdk/src/types/generated/TaxIdentifier.ts b/packages/admin-sdk/src/types/generated/TaxIdentifier.ts
index a6f2311efc..8b10f64a79 100644
--- a/packages/admin-sdk/src/types/generated/TaxIdentifier.ts
+++ b/packages/admin-sdk/src/types/generated/TaxIdentifier.ts
@@ -1,15 +1,16 @@
-// Typelizer digest 03e2db450547be9c71dca312f3d8747f
+// Typelizer digest 8ce8e681cb60a87fc5dbd47a28c6e9b3
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
+import type {TaxIdentifierValidationStatus, TaxIdentifierSource} from '@/types'
interface TaxIdentifier {
id: string;
/** Tax identifier kind, keyed to a registered validator. Built-in: eu_vat. Extensions may register more. */
kind: string;
value: string;
- validation_status: 'pending' | 'verified' | 'unverified' | 'unavailable' | 'unsupported' | null;
+ validation_status: TaxIdentifierValidationStatus | null;
validation_evidence: Record<string, unknown> | null;
- source: 'override' | 'company' | 'customer' | null;
+ source: TaxIdentifierSource | null;
validated_at: string | null;
created_at: string;
updated_at: string;
diff --git a/packages/admin-sdk/src/types/generated/TaxLine.ts b/packages/admin-sdk/src/types/generated/TaxLine.ts
index 244b12a5c5..c91c7d1618 100644
--- a/packages/admin-sdk/src/types/generated/TaxLine.ts
+++ b/packages/admin-sdk/src/types/generated/TaxLine.ts
@@ -1,7 +1,7 @@
-// Typelizer digest 77c93af8a12a7cdff9031b6cf24979da
+// Typelizer digest 2b68da23af6166851be02be5490c60a5
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {CountryCode} from '@/types'
+import type {TaxabilityReason, CountryCode} from '@/types'
interface TaxLine {
id: string;
@@ -19,7 +19,7 @@ interface TaxLine {
amount: string;
provider_id: string | null;
metadata: Record<string, unknown> | null;
- taxability_reason: string | null;
+ taxability_reason: TaxabilityReason | null;
country_code: CountryCode | null;
state_code: string | null;
data: Record<string, unknown> | null;
diff --git a/packages/admin-sdk/src/types/generated/Variant.ts b/packages/admin-sdk/src/types/generated/Variant.ts
index 40fb5a4286..61d59b62fe 100644
--- a/packages/admin-sdk/src/types/generated/Variant.ts
+++ b/packages/admin-sdk/src/types/generated/Variant.ts
@@ -1,7 +1,7 @@
-// Typelizer digest df2caf951c22d8471f40a4d39811cb5a
+// Typelizer digest 79be8077061370d371691a6127f05b3c
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {Price, PriceHistory, Seller, Media, OptionValue, CustomField, StockLevel, WeightUnit, DimensionUnit, CurrencyCode, CountryCode} from '@/types'
+import type {Price, PriceHistory, Seller, Media, OptionValue, CustomField, StockLevel, WeightUnit, DimensionUnit, PurchaseUnit, CurrencyCode, CountryCode} from '@/types'
interface Variant {
id: string;
@@ -24,7 +24,7 @@ interface Variant {
dimensions_unit: DimensionUnit;
minimum_order_quantity: number | null;
order_multiple: number | null;
- purchase_unit: 'unit' | 'carton' | null;
+ purchase_unit: PurchaseUnit | null;
units_per_carton: number | null;
price: Price;
original_price: Price | null;
diff --git a/packages/admin-sdk/src/types/generated/emails/EmailDelivery.ts b/packages/admin-sdk/src/types/generated/emails/EmailDelivery.ts
index 9ba2843fda..f882d9af59 100644
--- a/packages/admin-sdk/src/types/generated/emails/EmailDelivery.ts
+++ b/packages/admin-sdk/src/types/generated/emails/EmailDelivery.ts
@@ -1,6 +1,7 @@
-// Typelizer digest 807b14721c02d4091eccea5f1f01389f
+// Typelizer digest 498876850d5738d88a35fcbf9b07ce67
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
+import type {DeliveryStatus} from '.'
interface EmailDelivery {
id: string;
@@ -8,7 +9,7 @@ interface EmailDelivery {
carrier: string | null;
carrier_name: string | null;
service: string | null;
- status: 'pending' | 'pre_transit' | 'in_transit' | 'out_for_delivery' | 'available_for_pickup' | 'delivered' | 'return_to_sender' | 'failure' | 'unknown';
+ status: DeliveryStatus;
tracking_url: string | null;
estimated_delivery_at: string | null;
delivered_at: string | null;
diff --git a/packages/admin-sdk/src/types/generated/emails/EmailFee.ts b/packages/admin-sdk/src/types/generated/emails/EmailFee.ts
index cb5ec87072..db331aedad 100644
--- a/packages/admin-sdk/src/types/generated/emails/EmailFee.ts
+++ b/packages/admin-sdk/src/types/generated/emails/EmailFee.ts
@@ -1,4 +1,4 @@
-// Typelizer digest af895b5f438769429ae6f1a0791d2114
+// Typelizer digest 382eec5e4373f312e906836659aab506
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {FeeKind} from '.'
diff --git a/packages/admin-sdk/src/types/generated/emails/EmailFulfillment.ts b/packages/admin-sdk/src/types/generated/emails/EmailFulfillment.ts
index ac23f740b9..dfb4b5de5e 100644
--- a/packages/admin-sdk/src/types/generated/emails/EmailFulfillment.ts
+++ b/packages/admin-sdk/src/types/generated/emails/EmailFulfillment.ts
@@ -1,7 +1,7 @@
-// Typelizer digest 4db1b59ddeebd9e61a6a130c462d4122
+// Typelizer digest 7161380282b4505541584a35856c9d6e
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {EmailDelivery, EmailDeliveryMethod, EmailStockLocation, EmailDeliveryRate, EmailParcelItem, FulfillmentStatus} from '.'
+import type {EmailDelivery, EmailDeliveryMethod, EmailStockLocation, EmailDeliveryRate, EmailParcelItem, FulfillmentStatus, FulfillmentType} from '.'
interface EmailFulfillment {
id: string;
@@ -18,7 +18,7 @@ interface EmailFulfillment {
included_tax_total: string | null;
tax_total: string | null;
status: FulfillmentStatus;
- fulfillment_type: 'shipping' | 'digital' | 'pickup' | 'pickup_point';
+ fulfillment_type: FulfillmentType;
fulfilled_at: string | null;
delivered_at: string | null;
items: Array<{ item_id: string; variant_id: string; quantity: number }>;
diff --git a/packages/admin-sdk/src/types/generated/emails/EmailGiftCard.ts b/packages/admin-sdk/src/types/generated/emails/EmailGiftCard.ts
index 8cdb0fa48a..2a31c7e857 100644
--- a/packages/admin-sdk/src/types/generated/emails/EmailGiftCard.ts
+++ b/packages/admin-sdk/src/types/generated/emails/EmailGiftCard.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 1f6349e963dba60b689ca3a0ded4db2a
+// Typelizer digest dcc4b45ac3d67cefdf25c2bfe41e24ef
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {GiftCardStatus, CurrencyCode} from '.'
diff --git a/packages/admin-sdk/src/types/generated/emails/EmailOrder.ts b/packages/admin-sdk/src/types/generated/emails/EmailOrder.ts
index 658ce37491..35fa16f8e4 100644
--- a/packages/admin-sdk/src/types/generated/emails/EmailOrder.ts
+++ b/packages/admin-sdk/src/types/generated/emails/EmailOrder.ts
@@ -1,7 +1,7 @@
-// Typelizer digest 6ed7a98cfb5a64c6d07dad5581595c5f
+// Typelizer digest 4b0c8a3a05127c5f84109b81f3a76afa
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {EmailPayment, EmailAppliedPromotion, EmailFee, EmailLineItem, EmailFulfillment, EmailAddress, EmailGiftCard, EmailMarket, EmailAmountLine, CurrencyCode, LocaleCode} from '.'
+import type {EmailPayment, EmailAppliedPromotion, EmailFee, EmailLineItem, EmailFulfillment, EmailAddress, EmailGiftCard, EmailMarket, EmailAmountLine, CurrencyCode, LocaleCode, OrderFulfillmentStatus, OrderPaymentStatus} from '.'
interface EmailOrder {
id: string;
@@ -23,8 +23,8 @@ interface EmailOrder {
locale: LocaleCode | null;
total_quantity: number;
coupon_code: string | null;
- fulfillment_status: 'backorder' | 'canceled' | 'partial' | 'unfulfilled' | 'fulfilled' | 'delivered' | 'pending' | 'ready' | 'shipped' | null;
- payment_status: 'none' | 'authorized' | 'partially_paid' | 'paid' | 'partially_refunded' | 'refunded' | 'overcharged' | 'voided' | null;
+ fulfillment_status: OrderFulfillmentStatus | null;
+ payment_status: OrderPaymentStatus | null;
completed_at: string | null;
/** The line items: each price times its quantity, before discounts, fees and delivery. */
item_total: string | null;
diff --git a/packages/admin-sdk/src/types/generated/emails/EmailOrderGroup.ts b/packages/admin-sdk/src/types/generated/emails/EmailOrderGroup.ts
index 8e8c1f1fea..d4d9679339 100644
--- a/packages/admin-sdk/src/types/generated/emails/EmailOrderGroup.ts
+++ b/packages/admin-sdk/src/types/generated/emails/EmailOrderGroup.ts
@@ -1,7 +1,7 @@
-// Typelizer digest e8becd73fc08977e0e8efb05516805aa
+// Typelizer digest cb9f10be39f61882b52fd10a435eae46
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {EmailPayment, EmailAddress, EmailLineItem, EmailAmountLine, EmailFulfillmentGroup, CurrencyCode} from '.'
+import type {EmailPayment, EmailAddress, EmailLineItem, EmailAmountLine, EmailFulfillmentGroup, CurrencyCode, OrderFulfillmentStatus, OrderPaymentStatus} from '.'
interface EmailOrderGroup {
id: string;
@@ -32,8 +32,8 @@ interface EmailOrderGroup {
amount_due: string | null;
covered_by_store_credit: boolean;
payments: Array<EmailPayment>;
- fulfillment_status: 'backorder' | 'canceled' | 'partial' | 'unfulfilled' | 'fulfilled' | 'delivered' | 'pending' | 'ready' | 'shipped' | null;
- payment_status: 'none' | 'authorized' | 'partially_paid' | 'paid' | 'partially_refunded' | 'refunded' | 'overcharged' | 'voided' | null;
+ fulfillment_status: OrderFulfillmentStatus | null;
+ payment_status: OrderPaymentStatus | null;
completed_at: string | null;
billing_address: EmailAddress | null;
shipping_address: EmailAddress | null;
diff --git a/packages/admin-sdk/src/types/generated/emails/EmailPayment.ts b/packages/admin-sdk/src/types/generated/emails/EmailPayment.ts
index b3330f76ce..9d4b04dcf0 100644
--- a/packages/admin-sdk/src/types/generated/emails/EmailPayment.ts
+++ b/packages/admin-sdk/src/types/generated/emails/EmailPayment.ts
@@ -1,7 +1,7 @@
-// Typelizer digest e015c656ea88ba4749d7b941afbe6560
+// Typelizer digest 9c1c78a5f83679b6541f4402fe51e497
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {EmailPaymentMethod, PaymentStatus} from '.'
+import type {EmailPaymentMethod, PaymentStatus, PaymentSourceType} from '.'
interface EmailPayment {
id: string;
@@ -10,7 +10,7 @@ interface EmailPayment {
number: string;
status: PaymentStatus;
amount: string | null;
- source_type: 'credit_card' | 'store_credit' | 'payment_source' | null;
+ source_type: PaymentSourceType | null;
source_id: string | null;
source: Record<string, unknown> | null;
payment_method: EmailPaymentMethod;
diff --git a/packages/admin-sdk/src/types/generated/emails/EmailReturn.ts b/packages/admin-sdk/src/types/generated/emails/EmailReturn.ts
index 9bc5790e44..53f217ed27 100644
--- a/packages/admin-sdk/src/types/generated/emails/EmailReturn.ts
+++ b/packages/admin-sdk/src/types/generated/emails/EmailReturn.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 19889738c266c62ade981ecd0a2aa645
+// Typelizer digest d0c767783b2132abd8340b012dfceac6
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {EmailLineItem, ReturnStatus} from '.'
diff --git a/packages/admin-sdk/src/types/generated/emails/Enums.ts b/packages/admin-sdk/src/types/generated/emails/Enums.ts
index b5883f4dbb..0a394c909a 100644
--- a/packages/admin-sdk/src/types/generated/emails/Enums.ts
+++ b/packages/admin-sdk/src/types/generated/emails/Enums.ts
@@ -1,11 +1,16 @@
-// Typelizer digest 0a1194ebb7cb5847b4f32b4d00d61f61
+// Typelizer digest 9581da712e0198ee3b35e17a5cbff39a
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
export type { CountryCode } from '@spree/sdk-core';
export type { CurrencyCode } from '@spree/sdk-core';
-export type FeeKind = 'surcharge' | 'handling' | 'gift_wrap' | 'cod' | 'payment' | 'duty' | 'exchange' | (string & {});
-export type FulfillmentStatus = 'unfulfilled' | 'fulfilled' | 'delivered' | 'canceled' | (string & {});
-export type GiftCardStatus = 'active' | 'partially_redeemed' | 'redeemed' | 'canceled' | 'expired' | (string & {});
+export type { DeliveryStatus } from '@spree/sdk-core';
+export type { FeeKind } from '@spree/sdk-core';
+export type { FulfillmentStatus } from '@spree/sdk-core';
+export type { FulfillmentType } from '@spree/sdk-core';
+export type { GiftCardStatus } from '@spree/sdk-core';
export type { LocaleCode } from '@spree/sdk-core';
-export type PaymentStatus = 'checkout' | 'processing' | 'pending' | 'completed' | 'failed' | 'void' | 'invalid' | (string & {});
-export type ReturnStatus = 'requested' | 'approved' | 'received' | 'refunded' | 'canceled' | (string & {});
+export type { OrderFulfillmentStatus } from '@spree/sdk-core';
+export type { OrderPaymentStatus } from '@spree/sdk-core';
+export type { PaymentSourceType } from '@spree/sdk-core';
+export type { PaymentStatus } from '@spree/sdk-core';
+export type { ReturnStatus } from '@spree/sdk-core';
diff --git a/packages/admin-sdk/src/types/generated/emails/index.ts b/packages/admin-sdk/src/types/generated/emails/index.ts
index d5926d8eb7..4eb0d47551 100644
--- a/packages/admin-sdk/src/types/generated/emails/index.ts
+++ b/packages/admin-sdk/src/types/generated/emails/index.ts
@@ -1,7 +1,7 @@
-// Typelizer digest a61e52614828f8917eddc10afd0e93a9
+// Typelizer digest d88a4a30b89cd034b6ece8b43fa8fed2
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-export type { CountryCode, CurrencyCode, FeeKind, FulfillmentStatus, GiftCardStatus, LocaleCode, PaymentStatus, ReturnStatus } from './Enums'
+export type { CountryCode, CurrencyCode, DeliveryStatus, FeeKind, FulfillmentStatus, FulfillmentType, GiftCardStatus, LocaleCode, OrderFulfillmentStatus, OrderPaymentStatus, PaymentSourceType, PaymentStatus, ReturnStatus } from './Enums'
export type { default as EmailAddress } from './EmailAddress'
export type { default as EmailAmountLine } from './EmailAmountLine'
export type { default as EmailAppliedPromotion } from './EmailAppliedPromotion'
diff --git a/packages/admin-sdk/src/types/generated/index.ts b/packages/admin-sdk/src/types/generated/index.ts
index f687ccb726..2ec19e91b3 100644
--- a/packages/admin-sdk/src/types/generated/index.ts
+++ b/packages/admin-sdk/src/types/generated/index.ts
@@ -1,7 +1,7 @@
-// Typelizer digest 89833a8cea1c379ef8e7070bba4ca299
+// Typelizer digest b31c2be73196fd09d9e083281ce62250
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-export type { ActorKind, ClaimStatus, CountryCode, CurrencyCode, DataRequestStatus, DimensionUnit, ExchangeStatus, FeeKind, FulfillmentItemStatus, FulfillmentStatus, GiftCardStatus, ImportRowStatus, ImportStatus, InvitationStatus, LocaleCode, PaymentStatus, PriceListStatus, ProductStatus, ProductSubmissionStatus, ReturnStatus, SellerPayoutStatus, SellerRequirementSubmissionStatus, SellerStatus, SellerTransferStatus, ShippingLabelStatus, StockLocationKind, TaxExemptionCertificateStatus, WeightUnit } from './Enums'
+export type { ActorKind, ApiKeyType, CaptureMethod, CatalogAssignableType, CatalogPriceSource, ClaimResolution, ClaimStatus, CollectionRuleMatchPolicy, CollectionSortOrder, CommissionKind, CompanyInvitationStatus, CompanyKind, ConsentSource, CountryCode, CurrencyCode, DataRequestKind, DataRequestStatus, DeliveryStatus, DeliveryZoneMemberType, DimensionUnit, DiscountKind, DocumentNumberFormat, EmailFont, EmailTemplateKind, ExchangeStatus, FeeKind, FileUploadVisibility, FulfillmentItemStatus, FulfillmentStatus, FulfillmentType, GiftCardStatus, ImportRowStatus, ImportStatus, InvitationStatus, LocaleCode, MatchPolicy, MediaType, OptionTypeKind, OrderFulfillmentStatus, OrderPaymentStatus, OrderStatus, PackageTypeKind, PaymentSourceType, PaymentStatus, PayoutScheduleInterval, PermissionKind, PickupStockPolicy, PriceListStatus, ProductStatus, ProductSubmissionStatus, ProviderFailurePolicy, PurchaseOrderStatus, PurchaseUnit, ReturnStatus, SellerPayoutStatus, SellerRequirementState, SellerRequirementSubmissionStatus, SellerStatus, SellerTransferKind, SellerTransferStatus, ShippingLabelFormat, ShippingLabelOwnerType, ShippingLabelSource, ShippingLabelStatus, StockLocationKind, StockMovementKind, StockReceiptLineType, StockReceiptReceivableType, StockReceiptRejectionReason, StockTransferStatus, StorefrontAccess, TaxExemptionCertificateStatus, TaxIdentifierSource, TaxIdentifierValidationStatus, TaxRemittance, TaxabilityReason, UnitSystem, WeightUnit } from './Enums'
export type { default as Actor } from './Actor'
export type { default as Address } from './Address'
export type { default as AdminUser } from './AdminUser'
diff --git a/packages/core/README.md b/packages/core/README.md
index 74ca03d19b..c5c74ad0bd 100644
--- a/packages/core/README.md
+++ b/packages/core/README.md
@@ -13,6 +13,7 @@ npm install @spree/core
## Contents
- [Code lists](#code-lists) — countries, currencies, locales, weight and dimension units, and checking a code you received
+- [Statuses and kinds](#statuses-and-kinds) — every status and kind the API returns, and picking the ones an action accepts
- [Unit systems](#unit-systems) — which weight units belong to metric and imperial
- [Display names](#display-names) — country, currency and language names in any language
- [Money](#money) — exact arithmetic, percentages and formatting for decimal-string amounts
@@ -65,6 +66,36 @@ They check the shape only, `US` but not `us` or `USA`, and accept a code missing
`CurrencyCode` includes replaced currencies, such as the Croatian kuna, so that amounts recorded in them stay valid. `ACTIVE_CURRENCY_CODES` leaves them out, for a picker offering any currency for new prices, and `RETIRED_CURRENCY_CODES` lists the ones it leaves out.
+## Statuses and kinds
+
+Every status, kind and other value list the Spree API returns — `ProductStatus`, `PaymentStatus`, `FeeKind`, `MediaType` and the rest — generated from the API itself. Each comes as a list of its built-in values and a type:
+
+```typescript
+import { PRODUCT_STATUSES, type ProductStatus } from '@spree/core';
+
+PRODUCT_STATUSES; // ['draft', 'active', 'archived', 'proposed', 'rejected']
+
+// A filter built from the list stays complete when Spree adds a status.
+const options = PRODUCT_STATUSES.map((status) => ({ value: status, label: t(status) }));
+```
+
+Statuses and kinds an extension may add to — `ProductStatus`, `PaymentStatus`, `FeeKind` and the like — are open: the type still accepts any string, while your editor suggests the built-in ones. The rest are closed, like the code lists: `OrderPaymentStatus`, `MediaType`, `DiscountKind` and every other list the API never grows accept only their own values.
+
+When only some values matter — the statuses an action accepts, say — pick them with `subsetOf`. A misspelled or retired value fails to compile, and `includes` takes any status the API returns:
+
+```typescript
+import { RETURN_STATUSES, subsetOf } from '@spree/core';
+
+const ACTIONABLE = subsetOf(RETURN_STATUSES, ['requested', 'approved', 'received']);
+subsetOf(RETURN_STATUSES, ['requsted']); // Type error
+
+if (ACTIONABLE.includes(ret.status)) {
+ // show the actions
+}
+```
+
+The SDKs re-export the types each of them uses, so `import type { PaymentStatus } from '@spree/sdk'` works too.
+
## Unit systems
A Spree store uses either the metric or the imperial system. `UNIT_SYSTEM_WEIGHT_UNITS` lists the weight units each one offers, the usual one first, so a settings screen can offer only the units that fit:
diff --git a/packages/core/src/enums.generated.ts b/packages/core/src/enums.generated.ts
new file mode 100644
index 0000000000..0535a0219e
--- /dev/null
+++ b/packages/core/src/enums.generated.ts
@@ -0,0 +1,547 @@
+// This file is auto-generated from the API serializers by `rake typelizer:generate`. Do not edit directly.
+
+/** The built-in values of `ActorKind`. Extensions may add more. */
+export const ACTOR_KINDS = ['admin_user', 'api_key'] as const
+export type ActorKind = (typeof ACTOR_KINDS)[number] | (string & {})
+
+/** Every value of `ApiKeyType`. */
+export const API_KEY_TYPES = ['publishable', 'secret'] as const
+export type ApiKeyType = (typeof API_KEY_TYPES)[number]
+
+/** Every value of `CaptureMethod`. */
+export const CAPTURE_METHODS = ['checkout', 'on_dispatch', 'manual'] as const
+export type CaptureMethod = (typeof CAPTURE_METHODS)[number]
+
+/** Every value of `CatalogAssignableType`. */
+export const CATALOG_ASSIGNABLE_TYPES = ['customer_group', 'company'] as const
+export type CatalogAssignableType = (typeof CATALOG_ASSIGNABLE_TYPES)[number]
+
+/** Every value of `CatalogPriceSource`. */
+export const CATALOG_PRICE_SOURCES = ['explicit', 'automatic', 'base'] as const
+export type CatalogPriceSource = (typeof CATALOG_PRICE_SOURCES)[number]
+
+/** Every value of `ClaimResolution`. */
+export const CLAIM_RESOLUTIONS = ['refund', 'replacement', 'refund_and_replacement'] as const
+export type ClaimResolution = (typeof CLAIM_RESOLUTIONS)[number]
+
+/** The built-in values of `ClaimStatus`. Extensions may add more. */
+export const CLAIM_STATUSES = ['open', 'approved', 'resolved', 'denied', 'canceled'] as const
+export type ClaimStatus = (typeof CLAIM_STATUSES)[number] | (string & {})
+
+/** Every value of `CollectionRuleMatchPolicy`. */
+export const COLLECTION_RULE_MATCH_POLICIES = [
+ 'is_equal_to',
+ 'is_not_equal_to',
+ 'contains',
+ 'does_not_contain',
+] as const
+export type CollectionRuleMatchPolicy = (typeof COLLECTION_RULE_MATCH_POLICIES)[number]
+
+/** Every value of `CollectionSortOrder`. */
+export const COLLECTION_SORT_ORDERS = [
+ 'manual',
+ 'best_selling',
+ 'price asc',
+ 'price desc',
+ 'available_on desc',
+ 'available_on asc',
+ 'name asc',
+ 'name desc',
+] as const
+export type CollectionSortOrder = (typeof COLLECTION_SORT_ORDERS)[number]
+
+/** Every value of `CommissionKind`. */
+export const COMMISSION_KINDS = ['percentage', 'fixed'] as const
+export type CommissionKind = (typeof COMMISSION_KINDS)[number]
+
+/** Every value of `CompanyInvitationStatus`. */
+export const COMPANY_INVITATION_STATUSES = ['pending', 'accepted', 'revoked', 'expired'] as const
+export type CompanyInvitationStatus = (typeof COMPANY_INVITATION_STATUSES)[number]
+
+/** Every value of `CompanyKind`. */
+export const COMPANY_KINDS = ['company', 'division'] as const
+export type CompanyKind = (typeof COMPANY_KINDS)[number]
+
+/** Every value of `ConsentSource`. */
+export const CONSENT_SOURCES = [
+ 'checkout',
+ 'registration',
+ 'account',
+ 'admin',
+ 'newsletter',
+ 'anonymization',
+ 'unknown',
+ 'import',
+ 'storefront',
+] as const
+export type ConsentSource = (typeof CONSENT_SOURCES)[number]
+
+/** Every value of `DataRequestKind`. */
+export const DATA_REQUEST_KINDS = ['access', 'erasure'] as const
+export type DataRequestKind = (typeof DATA_REQUEST_KINDS)[number]
+
+/** The built-in values of `DataRequestStatus`. Extensions may add more. */
+export const DATA_REQUEST_STATUSES = [
+ 'awaiting_confirmation',
+ 'pending',
+ 'processing',
+ 'completed',
+ 'failed',
+ 'lapsed',
+] as const
+export type DataRequestStatus = (typeof DATA_REQUEST_STATUSES)[number] | (string & {})
+
+/** Every value of `DeliveryStatus`. */
+export const DELIVERY_STATUSES = [
+ 'pending',
+ 'pre_transit',
+ 'in_transit',
+ 'out_for_delivery',
+ 'available_for_pickup',
+ 'delivered',
+ 'return_to_sender',
+ 'failure',
+ 'unknown',
+] as const
+export type DeliveryStatus = (typeof DELIVERY_STATUSES)[number]
+
+/** Every value of `DeliveryZoneMemberType`. */
+export const DELIVERY_ZONE_MEMBER_TYPES = ['country', 'state', 'postal_code'] as const
+export type DeliveryZoneMemberType = (typeof DELIVERY_ZONE_MEMBER_TYPES)[number]
+
+/** Every value of `DiscountKind`. */
+export const DISCOUNT_KINDS = ['promotion', 'manual'] as const
+export type DiscountKind = (typeof DISCOUNT_KINDS)[number]
+
+/** Every value of `DocumentNumberFormat`. */
+export const DOCUMENT_NUMBER_FORMATS = ['sequential', 'random'] as const
+export type DocumentNumberFormat = (typeof DOCUMENT_NUMBER_FORMATS)[number]
+
+/** Every value of `EmailFont`. */
+export const EMAIL_FONTS = [
+ 'inter',
+ 'system',
+ 'helvetica',
+ 'georgia',
+ 'roboto',
+ 'lato',
+ 'merriweather',
+] as const
+export type EmailFont = (typeof EMAIL_FONTS)[number]
+
+/** Every value of `EmailTemplateKind`. */
+export const EMAIL_TEMPLATE_KINDS = ['email', 'layout', 'partial'] as const
+export type EmailTemplateKind = (typeof EMAIL_TEMPLATE_KINDS)[number]
+
+/** The built-in values of `ExchangeStatus`. Extensions may add more. */
+export const EXCHANGE_STATUSES = [
+ 'requested',
+ 'approved',
+ 'received',
+ 'fulfilled',
+ 'canceled',
+] as const
+export type ExchangeStatus = (typeof EXCHANGE_STATUSES)[number] | (string & {})
+
+/** The built-in values of `FeeKind`. Extensions may add more. */
+export const FEE_KINDS = [
+ 'surcharge',
+ 'handling',
+ 'gift_wrap',
+ 'cod',
+ 'payment',
+ 'duty',
+ 'exchange',
+] as const
+export type FeeKind = (typeof FEE_KINDS)[number] | (string & {})
+
+/** Every value of `FileUploadVisibility`. */
+export const FILE_UPLOAD_VISIBILITIES = ['public', 'private'] as const
+export type FileUploadVisibility = (typeof FILE_UPLOAD_VISIBILITIES)[number]
+
+/** The built-in values of `FulfillmentItemStatus`. Extensions may add more. */
+export const FULFILLMENT_ITEM_STATUSES = ['on_hand', 'backordered', 'shipped', 'returned'] as const
+export type FulfillmentItemStatus = (typeof FULFILLMENT_ITEM_STATUSES)[number] | (string & {})
+
+/** The built-in values of `FulfillmentStatus`. Extensions may add more. */
+export const FULFILLMENT_STATUSES = ['unfulfilled', 'fulfilled', 'delivered', 'canceled'] as const
+export type FulfillmentStatus = (typeof FULFILLMENT_STATUSES)[number] | (string & {})
+
+/** Every value of `FulfillmentType`. */
+export const FULFILLMENT_TYPES = ['shipping', 'digital', 'pickup', 'pickup_point'] as const
+export type FulfillmentType = (typeof FULFILLMENT_TYPES)[number]
+
+/** The built-in values of `GiftCardStatus`. Extensions may add more. */
+export const GIFT_CARD_STATUSES = [
+ 'active',
+ 'partially_redeemed',
+ 'redeemed',
+ 'canceled',
+ 'expired',
+] as const
+export type GiftCardStatus = (typeof GIFT_CARD_STATUSES)[number] | (string & {})
+
+/** The built-in values of `ImportRowStatus`. Extensions may add more. */
+export const IMPORT_ROW_STATUSES = ['pending', 'processing', 'completed', 'failed'] as const
+export type ImportRowStatus = (typeof IMPORT_ROW_STATUSES)[number] | (string & {})
+
+/** The built-in values of `ImportStatus`. Extensions may add more. */
+export const IMPORT_STATUSES = [
+ 'pending',
+ 'mapping',
+ 'completed_mapping',
+ 'processing',
+ 'completed',
+ 'failed',
+] as const
+export type ImportStatus = (typeof IMPORT_STATUSES)[number] | (string & {})
+
+/** The built-in values of `InvitationStatus`. Extensions may add more. */
+export const INVITATION_STATUSES = ['pending', 'accepted'] as const
+export type InvitationStatus = (typeof INVITATION_STATUSES)[number] | (string & {})
+
+/** Every value of `MatchPolicy`. */
+export const MATCH_POLICIES = ['all', 'any'] as const
+export type MatchPolicy = (typeof MATCH_POLICIES)[number]
+
+/** Every value of `MediaType`. */
+export const MEDIA_TYPES = ['image', 'video', 'external_video'] as const
+export type MediaType = (typeof MEDIA_TYPES)[number]
+
+/** Every value of `OptionTypeKind`. */
+export const OPTION_TYPE_KINDS = ['dropdown', 'color_swatch', 'buttons'] as const
+export type OptionTypeKind = (typeof OPTION_TYPE_KINDS)[number]
+
+/** Every value of `OrderFulfillmentStatus`. */
+export const ORDER_FULFILLMENT_STATUSES = [
+ 'backorder',
+ 'canceled',
+ 'partial',
+ 'unfulfilled',
+ 'fulfilled',
+ 'delivered',
+ 'pending',
+ 'ready',
+ 'shipped',
+] as const
+export type OrderFulfillmentStatus = (typeof ORDER_FULFILLMENT_STATUSES)[number]
+
+/** Every value of `OrderPaymentStatus`. */
+export const ORDER_PAYMENT_STATUSES = [
+ 'none',
+ 'authorized',
+ 'partially_paid',
+ 'paid',
+ 'partially_refunded',
+ 'refunded',
+ 'overcharged',
+ 'voided',
+] as const
+export type OrderPaymentStatus = (typeof ORDER_PAYMENT_STATUSES)[number]
+
+/** Every value of `OrderStatus`. */
+export const ORDER_STATUSES = ['draft', 'placed', 'canceled'] as const
+export type OrderStatus = (typeof ORDER_STATUSES)[number]
+
+/** Every value of `PackageTypeKind`. */
+export const PACKAGE_TYPE_KINDS = ['box', 'envelope', 'carton', 'pallet', 'container'] as const
+export type PackageTypeKind = (typeof PACKAGE_TYPE_KINDS)[number]
+
+/** The built-in values of `PaymentSessionStatus`. Extensions may add more. */
+export const PAYMENT_SESSION_STATUSES = [
+ 'pending',
+ 'processing',
+ 'completed',
+ 'failed',
+ 'canceled',
+ 'expired',
+] as const
+export type PaymentSessionStatus = (typeof PAYMENT_SESSION_STATUSES)[number] | (string & {})
+
+/** The built-in values of `PaymentSetupSessionStatus`. Extensions may add more. */
+export const PAYMENT_SETUP_SESSION_STATUSES = [
+ 'pending',
+ 'processing',
+ 'completed',
+ 'failed',
+ 'canceled',
+ 'expired',
+] as const
+export type PaymentSetupSessionStatus =
+ | (typeof PAYMENT_SETUP_SESSION_STATUSES)[number]
+ | (string & {})
+
+/** Every value of `PaymentSourceType`. */
+export const PAYMENT_SOURCE_TYPES = ['credit_card', 'store_credit', 'payment_source'] as const
+export type PaymentSourceType = (typeof PAYMENT_SOURCE_TYPES)[number]
+
+/** The built-in values of `PaymentStatus`. Extensions may add more. */
+export const PAYMENT_STATUSES = [
+ 'checkout',
+ 'processing',
+ 'pending',
+ 'completed',
+ 'failed',
+ 'void',
+ 'invalid',
+] as const
+export type PaymentStatus = (typeof PAYMENT_STATUSES)[number] | (string & {})
+
+/** Every value of `PayoutScheduleInterval`. */
+export const PAYOUT_SCHEDULE_INTERVALS = [
+ 'daily',
+ 'weekly',
+ 'biweekly',
+ 'monthly',
+ 'manual',
+] as const
+export type PayoutScheduleInterval = (typeof PAYOUT_SCHEDULE_INTERVALS)[number]
+
+/** Every value of `PermissionKind`. */
+export const PERMISSION_KINDS = ['read', 'write'] as const
+export type PermissionKind = (typeof PERMISSION_KINDS)[number]
+
+/** Every value of `PickupStockPolicy`. */
+export const PICKUP_STOCK_POLICIES = ['local', 'any'] as const
+export type PickupStockPolicy = (typeof PICKUP_STOCK_POLICIES)[number]
+
+/** The built-in values of `PriceListStatus`. Extensions may add more. */
+export const PRICE_LIST_STATUSES = ['draft', 'active', 'inactive', 'scheduled'] as const
+export type PriceListStatus = (typeof PRICE_LIST_STATUSES)[number] | (string & {})
+
+/** The built-in values of `ProductStatus`. Extensions may add more. */
+export const PRODUCT_STATUSES = ['draft', 'active', 'archived', 'proposed', 'rejected'] as const
+export type ProductStatus = (typeof PRODUCT_STATUSES)[number] | (string & {})
+
+/** The built-in values of `ProductSubmissionStatus`. Extensions may add more. */
+export const PRODUCT_SUBMISSION_STATUSES = ['pending', 'approved', 'rejected', 'withdrawn'] as const
+export type ProductSubmissionStatus = (typeof PRODUCT_SUBMISSION_STATUSES)[number] | (string & {})
+
+/** Every value of `ProviderFailurePolicy`. */
+export const PROVIDER_FAILURE_POLICIES = ['fallback', 'strict'] as const
+export type ProviderFailurePolicy = (typeof PROVIDER_FAILURE_POLICIES)[number]
+
+/** The built-in values of `PurchaseOrderStatus`. Extensions may add more. */
+export const PURCHASE_ORDER_STATUSES = [
+ 'draft',
+ 'ordered',
+ 'partially_received',
+ 'received',
+ 'over_received',
+ 'canceled',
+] as const
+export type PurchaseOrderStatus = (typeof PURCHASE_ORDER_STATUSES)[number] | (string & {})
+
+/** Every value of `PurchaseUnit`. */
+export const PURCHASE_UNITS = ['unit', 'carton'] as const
+export type PurchaseUnit = (typeof PURCHASE_UNITS)[number]
+
+/** The built-in values of `ReturnStatus`. Extensions may add more. */
+export const RETURN_STATUSES = [
+ 'requested',
+ 'approved',
+ 'received',
+ 'refunded',
+ 'canceled',
+] as const
+export type ReturnStatus = (typeof RETURN_STATUSES)[number] | (string & {})
+
+/** The built-in values of `SellerPayoutStatus`. Extensions may add more. */
+export const SELLER_PAYOUT_STATUSES = [
+ 'pending',
+ 'processing',
+ 'completed',
+ 'failed',
+ 'unresolved',
+] as const
+export type SellerPayoutStatus = (typeof SELLER_PAYOUT_STATUSES)[number] | (string & {})
+
+/** Every value of `SellerRequirementState`. */
+export const SELLER_REQUIREMENT_STATES = ['complete', 'incomplete', 'pending', 'rejected'] as const
+export type SellerRequirementState = (typeof SELLER_REQUIREMENT_STATES)[number]
+
+/** The built-in values of `SellerRequirementSubmissionStatus`. Extensions may add more. */
+export const SELLER_REQUIREMENT_SUBMISSION_STATUSES = [
+ 'pending',
+ 'accepted',
+ 'rejected',
+ 'waived',
+] as const
+export type SellerRequirementSubmissionStatus =
+ | (typeof SELLER_REQUIREMENT_SUBMISSION_STATUSES)[number]
+ | (string & {})
+
+/** The built-in values of `SellerStatus`. Extensions may add more. */
+export const SELLER_STATUSES = [
+ 'pending',
+ 'invited',
+ 'canceled',
+ 'onboarding',
+ 'ready_for_review',
+ 'approved',
+ 'rejected',
+ 'suspended',
+] as const
+export type SellerStatus = (typeof SELLER_STATUSES)[number] | (string & {})
+
+/** Every value of `SellerTransferKind`. */
+export const SELLER_TRANSFER_KINDS = ['earning', 'refund_reversal'] as const
+export type SellerTransferKind = (typeof SELLER_TRANSFER_KINDS)[number]
+
+/** The built-in values of `SellerTransferStatus`. Extensions may add more. */
+export const SELLER_TRANSFER_STATUSES = [
+ 'pending',
+ 'processing',
+ 'completed',
+ 'failed',
+ 'unresolved',
+] as const
+export type SellerTransferStatus = (typeof SELLER_TRANSFER_STATUSES)[number] | (string & {})
+
+/** Every value of `ShippingLabelFormat`. */
+export const SHIPPING_LABEL_FORMATS = ['pdf', 'png', 'zpl'] as const
+export type ShippingLabelFormat = (typeof SHIPPING_LABEL_FORMATS)[number]
+
+/** Every value of `ShippingLabelOwnerType`. */
+export const SHIPPING_LABEL_OWNER_TYPES = ['fulfillment', 'return'] as const
+export type ShippingLabelOwnerType = (typeof SHIPPING_LABEL_OWNER_TYPES)[number]
+
+/** Every value of `ShippingLabelSource`. */
+export const SHIPPING_LABEL_SOURCES = ['purchased', 'uploaded'] as const
+export type ShippingLabelSource = (typeof SHIPPING_LABEL_SOURCES)[number]
+
+/** The built-in values of `ShippingLabelStatus`. Extensions may add more. */
+export const SHIPPING_LABEL_STATUSES = ['purchased', 'refund_requested', 'refunded'] as const
+export type ShippingLabelStatus = (typeof SHIPPING_LABEL_STATUSES)[number] | (string & {})
+
+/** Every value of `StockAvailability`. */
+export const STOCK_AVAILABILITIES = ['in_stock', 'out_of_stock'] as const
+export type StockAvailability = (typeof STOCK_AVAILABILITIES)[number]
+
+/** The built-in values of `StockLocationKind`. Extensions may add more. */
+export const STOCK_LOCATION_KINDS = ['warehouse', 'store', 'fulfillment_center'] as const
+export type StockLocationKind = (typeof STOCK_LOCATION_KINDS)[number] | (string & {})
+
+/** Every value of `StockMovementKind`. */
+export const STOCK_MOVEMENT_KINDS = [
+ 'received',
+ 'allocated',
+ 'shipped',
+ 'released',
+ 'adjusted',
+] as const
+export type StockMovementKind = (typeof STOCK_MOVEMENT_KINDS)[number]
+
+/** Every value of `StockReceiptLineType`. */
+export const STOCK_RECEIPT_LINE_TYPES = ['purchase_order_item', 'stock_transfer_item'] as const
+export type StockReceiptLineType = (typeof STOCK_RECEIPT_LINE_TYPES)[number]
+
+/** Every value of `StockReceiptReceivableType`. */
+export const STOCK_RECEIPT_RECEIVABLE_TYPES = ['purchase_order', 'stock_transfer'] as const
+export type StockReceiptReceivableType = (typeof STOCK_RECEIPT_RECEIVABLE_TYPES)[number]
+
+/** Every value of `StockReceiptRejectionReason`. */
+export const STOCK_RECEIPT_REJECTION_REASONS = [
+ 'damaged',
+ 'wrong_item',
+ 'expired',
+ 'other',
+] as const
+export type StockReceiptRejectionReason = (typeof STOCK_RECEIPT_REJECTION_REASONS)[number]
+
+/** The built-in values of `StockTransferStatus`. Extensions may add more. */
+export const STOCK_TRANSFER_STATUSES = [
+ 'draft',
+ 'ready_to_ship',
+ 'in_transit',
+ 'partially_received',
+ 'received',
+ 'over_received',
+ 'canceled',
+] as const
+export type StockTransferStatus = (typeof STOCK_TRANSFER_STATUSES)[number] | (string & {})
+
+/** Every value of `StorefrontAccess`. */
+export const STOREFRONT_ACCESSES = ['public', 'prices_hidden', 'login_required'] as const
+export type StorefrontAccess = (typeof STOREFRONT_ACCESSES)[number]
+
+/** The built-in values of `TaxExemptionCertificateStatus`. Extensions may add more. */
+export const TAX_EXEMPTION_CERTIFICATE_STATUSES = [
+ 'pending',
+ 'verified',
+ 'expired',
+ 'revoked',
+] as const
+export type TaxExemptionCertificateStatus =
+ | (typeof TAX_EXEMPTION_CERTIFICATE_STATUSES)[number]
+ | (string & {})
+
+/** Every value of `TaxIdentifierSource`. */
+export const TAX_IDENTIFIER_SOURCES = ['override', 'company', 'customer'] as const
+export type TaxIdentifierSource = (typeof TAX_IDENTIFIER_SOURCES)[number]
+
+/** Every value of `TaxIdentifierValidationStatus`. */
+export const TAX_IDENTIFIER_VALIDATION_STATUSES = [
+ 'pending',
+ 'verified',
+ 'unverified',
+ 'unavailable',
+ 'unsupported',
+] as const
+export type TaxIdentifierValidationStatus = (typeof TAX_IDENTIFIER_VALIDATION_STATUSES)[number]
+
+/** Every value of `TaxRemittance`. */
+export const TAX_REMITTANCES = ['seller', 'platform'] as const
+export type TaxRemittance = (typeof TAX_REMITTANCES)[number]
+
+/** The built-in values of `TaxabilityReason`. Extensions may add more. */
+export const TAXABILITY_REASONS = [
+ 'standard_rated',
+ 'reduced_rated',
+ 'zero_rated',
+ 'reverse_charge',
+ 'intra_community_supply',
+ 'export',
+ 'customer_exempt',
+ 'product_exempt',
+ 'not_collecting',
+ 'not_subject_to_tax',
+] as const
+export type TaxabilityReason = (typeof TAXABILITY_REASONS)[number] | (string & {})
+
+/** Every value of `UnitSystem`. */
+export const UNIT_SYSTEMS = ['metric', 'imperial'] as const
+export type UnitSystem = (typeof UNIT_SYSTEMS)[number]
+
+/** Every built-in value of every status list above. */
+export type BuiltInStatus =
+ | (typeof CLAIM_STATUSES)[number]
+ | (typeof COMPANY_INVITATION_STATUSES)[number]
+ | (typeof DATA_REQUEST_STATUSES)[number]
+ | (typeof DELIVERY_STATUSES)[number]
+ | (typeof EXCHANGE_STATUSES)[number]
+ | (typeof FULFILLMENT_ITEM_STATUSES)[number]
+ | (typeof FULFILLMENT_STATUSES)[number]
+ | (typeof GIFT_CARD_STATUSES)[number]
+ | (typeof IMPORT_ROW_STATUSES)[number]
+ | (typeof IMPORT_STATUSES)[number]
+ | (typeof INVITATION_STATUSES)[number]
+ | (typeof ORDER_FULFILLMENT_STATUSES)[number]
+ | (typeof ORDER_PAYMENT_STATUSES)[number]
+ | (typeof ORDER_STATUSES)[number]
+ | (typeof PAYMENT_SESSION_STATUSES)[number]
+ | (typeof PAYMENT_SETUP_SESSION_STATUSES)[number]
+ | (typeof PAYMENT_STATUSES)[number]
+ | (typeof PRICE_LIST_STATUSES)[number]
+ | (typeof PRODUCT_STATUSES)[number]
+ | (typeof PRODUCT_SUBMISSION_STATUSES)[number]
+ | (typeof PURCHASE_ORDER_STATUSES)[number]
+ | (typeof RETURN_STATUSES)[number]
+ | (typeof SELLER_PAYOUT_STATUSES)[number]
+ | (typeof SELLER_REQUIREMENT_SUBMISSION_STATUSES)[number]
+ | (typeof SELLER_STATUSES)[number]
+ | (typeof SELLER_TRANSFER_STATUSES)[number]
+ | (typeof SHIPPING_LABEL_STATUSES)[number]
+ | (typeof STOCK_TRANSFER_STATUSES)[number]
+ | (typeof TAX_EXEMPTION_CERTIFICATE_STATUSES)[number]
+ | (typeof TAX_IDENTIFIER_VALIDATION_STATUSES)[number]
diff --git a/packages/core/src/enums.ts b/packages/core/src/enums.ts
new file mode 100644
index 0000000000..2a61f93aa8
--- /dev/null
+++ b/packages/core/src/enums.ts
@@ -0,0 +1,24 @@
+/**
+ * A hand-picked part of a value list. Its own values keep their narrow type,
+ * while `includes` takes any string, since the API may answer with a status
+ * the subset leaves out or one an extension added.
+ */
+export interface Subset<Value extends string> extends ReadonlyArray<Value> {
+ includes(value: string): boolean
+}
+
+/**
+ * A hand-picked part of a generated value list — the statuses an action
+ * accepts, say. Each value is checked against the list's built-in values, so a
+ * typo or a value the server dropped fails to compile.
+ *
+ * @example
+ * const OWED = subsetOf(SELLER_PAYOUT_STATUSES, ['pending', 'processing', 'unresolved'])
+ * OWED.includes(payout.status)
+ */
+export function subsetOf<const Value extends string, const Picked extends Value>(
+ _list: readonly Value[],
+ subset: readonly Picked[],
+): Subset<Picked> {
+ return subset
+}
diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts
index 6ca01bd843..97f54287cb 100644
--- a/packages/core/src/index.ts
+++ b/packages/core/src/index.ts
@@ -17,6 +17,10 @@ export {
export { CURRENCY_EXPONENTS } from './currency-exponents'
// Display names
export { intlDisplayName, localeEndonym } from './display-names'
+// Statuses, kinds and the other open value lists, generated from the API serializers
+export type { Subset } from './enums'
+export { subsetOf } from './enums'
+export * from './enums.generated'
// Filters
export type {
BooleanFilters,
@@ -51,5 +55,4 @@ export {
} from './money'
export { currencyParts, normalizeMoneyInput } from './money-input'
// Units
-export type { UnitSystem } from './unit-systems'
-export { UNIT_SYSTEM_WEIGHT_UNITS, UNIT_SYSTEMS } from './unit-systems'
+export { UNIT_SYSTEM_WEIGHT_UNITS } from './unit-systems'
diff --git a/packages/core/src/unit-systems.ts b/packages/core/src/unit-systems.ts
index d5e77c4ea9..43a7f3ef9d 100644
--- a/packages/core/src/unit-systems.ts
+++ b/packages/core/src/unit-systems.ts
@@ -1,9 +1,5 @@
import type { WeightUnit } from './code-lists.generated'
-
-/** The measurement systems a store can use. */
-export type UnitSystem = 'metric' | 'imperial'
-
-export const UNIT_SYSTEMS: readonly UnitSystem[] = ['metric', 'imperial']
+import type { UnitSystem } from './enums.generated'
/** The weight units each system offers, the usual one first. */
export const UNIT_SYSTEM_WEIGHT_UNITS: Readonly<Record<UnitSystem, readonly WeightUnit[]>> = {
diff --git a/packages/core/tests/enums.test.ts b/packages/core/tests/enums.test.ts
new file mode 100644
index 0000000000..03243e9c5e
--- /dev/null
+++ b/packages/core/tests/enums.test.ts
@@ -0,0 +1,22 @@
+import { describe, expect, expectTypeOf, it } from 'vitest'
+import { PRODUCT_STATUSES, type ProductStatus, subsetOf } from '../src'
+
+describe('subsetOf', () => {
+ it('keeps the picked values and their narrow type', () => {
+ const editable = subsetOf(PRODUCT_STATUSES, ['draft', 'active'])
+
+ expect(editable).toEqual(['draft', 'active'])
+ expectTypeOf(editable[0]).toEqualTypeOf<'draft' | 'active'>()
+ })
+
+ it('answers includes for any status the API returns', () => {
+ const status: ProductStatus = 'archived'
+
+ expect(subsetOf(PRODUCT_STATUSES, ['draft']).includes(status)).toBe(false)
+ })
+
+ it('rejects a value the list does not hold', () => {
+ // @ts-expect-error 'published' is not a built-in product status
+ subsetOf(PRODUCT_STATUSES, ['draft', 'published'])
+ })
+})
diff --git a/packages/dashboard-core/src/api-client.ts b/packages/dashboard-core/src/api-client.ts
index a489eac4f0..dbc31b7197 100644
--- a/packages/dashboard-core/src/api-client.ts
+++ b/packages/dashboard-core/src/api-client.ts
@@ -1,3 +1,4 @@
+import type { PackageTypeKind, PickupStockPolicy } from '@spree/core'
/**
* The client registry.
*
@@ -387,7 +388,8 @@ export interface PanelPackageTypeWrites extends PanelPackageTypeReads {
delete?(id: string): Promise<void>
}
-export type PanelPackageTypeKind = 'box' | 'envelope' | 'carton' | 'pallet' | 'container'
+/** @deprecated Use `PackageTypeKind` from `@spree/core`. */
+export type PanelPackageTypeKind = PackageTypeKind
/** @deprecated Use `DimensionUnit` from `@spree/core`. */
export type PanelPackageDimensionUnit = DimensionUnit
/** @deprecated Use `WeightUnit` from `@spree/core`. */
@@ -601,7 +603,7 @@ export type PanelStockLocationParams = Partial<
* because plugins register their own, but the pickup policy is a fixed pair
* the server validates, and both SDKs type it that way.
*/
- pickup_stock_policy?: 'local' | 'any'
+ pickup_stock_policy?: PickupStockPolicy
}
/**
diff --git a/packages/dashboard-core/src/hooks/use-file-upload.ts b/packages/dashboard-core/src/hooks/use-file-upload.ts
index 1894006f39..d708929d97 100644
--- a/packages/dashboard-core/src/hooks/use-file-upload.ts
+++ b/packages/dashboard-core/src/hooks/use-file-upload.ts
@@ -1,3 +1,4 @@
+import type { FileUploadVisibility } from '@spree/core'
import { useMutation } from '@tanstack/react-query'
import { getApiClient } from '../api-client'
@@ -31,7 +32,7 @@ interface FileUploadOptions {
* (documents, imports, digital products). Attaching a file never moves it
* between storage services, so this has to be decided up front.
*/
- visibility?: 'public' | 'private'
+ visibility?: FileUploadVisibility
}
export function useFileUpload(options: FileUploadOptions = {}) {
diff --git a/packages/dashboard-core/src/hooks/use-import.ts b/packages/dashboard-core/src/hooks/use-import.ts
index 86e7cd58e5..c6e8026409 100644
--- a/packages/dashboard-core/src/hooks/use-import.ts
+++ b/packages/dashboard-core/src/hooks/use-import.ts
@@ -1,3 +1,4 @@
+import { IMPORT_STATUSES, subsetOf } from '@spree/core'
import { toastManager } from '@spree/dashboard-ui'
import {
type QueryClient,
@@ -20,7 +21,7 @@ import { useTenantId } from '../providers/tenant-provider'
import { useAuth } from './use-auth'
/** Statuses the wizard polls through — row creation and processing. */
-const ACTIVE_STATUSES = new Set(['completed_mapping', 'processing'])
+const ACTIVE_STATUSES = subsetOf(IMPORT_STATUSES, ['completed_mapping', 'processing'])
const IMPORT_POLL_INTERVAL_MS = 2000
const ROWS_POLL_INTERVAL_MS = 5000
@@ -49,7 +50,7 @@ const IMPORT_TOUCHED_RESOURCES = [
/** Whether the import's pipeline is still running (the poll's continue predicate). */
export function isImportActive(status: string | undefined): boolean {
- return !!status && ACTIVE_STATUSES.has(status)
+ return !!status && ACTIVE_STATUSES.includes(status)
}
/**
diff --git a/packages/dashboard-core/src/lib/fulfillment-items.ts b/packages/dashboard-core/src/lib/fulfillment-items.ts
index c117e08208..9742f980db 100644
--- a/packages/dashboard-core/src/lib/fulfillment-items.ts
+++ b/packages/dashboard-core/src/lib/fulfillment-items.ts
@@ -1,3 +1,4 @@
+import { ORDER_FULFILLMENT_STATUSES, subsetOf } from '@spree/core'
import i18n from 'i18next'
import { formatMoney } from './formatters'
@@ -86,6 +87,16 @@ function claimedQuantities(fulfillments: GroupableFulfillment[]): Map<string, nu
*/
export const GONE_STATUSES = ['fulfilled', 'delivered']
+/** The order-level fulfillment statuses the order lists filter on. */
+export const FILTERABLE_ORDER_FULFILLMENT_STATUSES = subsetOf(ORDER_FULFILLMENT_STATUSES, [
+ 'backorder',
+ 'canceled',
+ 'partial',
+ 'unfulfilled',
+ 'fulfilled',
+ 'delivered',
+])
+
export function fulfilledQuantities(fulfillments: GroupableFulfillment[]): Map<string, number> {
const fulfilled = new Map<string, number>()
diff --git a/packages/dashboard-core/src/products/normalize-quantity.ts b/packages/dashboard-core/src/products/normalize-quantity.ts
index 1be4f0385f..a4b5a79fb5 100644
--- a/packages/dashboard-core/src/products/normalize-quantity.ts
+++ b/packages/dashboard-core/src/products/normalize-quantity.ts
@@ -2,10 +2,9 @@
// `Spree::Variant`'s own validations so a merchant hears about a bad value
// while typing rather than on save.
-/** What a buyer is quoted in. Stored quantities stay units at every level. */
-export const PURCHASE_UNITS = ['unit', 'carton'] as const
+import { PURCHASE_UNITS, type PurchaseUnit } from '@spree/core'
-export type PurchaseUnit = (typeof PURCHASE_UNITS)[number]
+export { PURCHASE_UNITS, type PurchaseUnit }
/**
* Reads a quantity rule from a number input. Blank means the rule is unset,
diff --git a/packages/dashboard-core/src/products/product-form-cards.tsx b/packages/dashboard-core/src/products/product-form-cards.tsx
index 99acf80a82..441027a0d5 100644
--- a/packages/dashboard-core/src/products/product-form-cards.tsx
+++ b/packages/dashboard-core/src/products/product-form-cards.tsx
@@ -87,7 +87,11 @@ import { InventorySection } from './inventory-section'
import { MediaEditSheet } from './media-edit-sheet'
import { ProductBulkPriceEditor } from './product-bulk-price-editor'
import { variantHasTaxCategoryOverride } from './product-form-mapping'
-import type { MediaFormValues, VariantFormValues } from './product-schema'
+import {
+ ASSIGNABLE_PRODUCT_STATUSES,
+ type MediaFormValues,
+ type VariantFormValues,
+} from './product-schema'
import type {
PanelMedia as Media,
PanelProduct as Product,
@@ -915,8 +919,6 @@ export function SEOCard({ form, product }: FormCardProps & { product?: Product }
// Status
// ---------------------------------------------------------------------------
-const ASSIGNABLE_STATUSES = ['draft', 'active', 'archived']
-
export function StatusCard({
form,
reviewActions,
@@ -941,9 +943,11 @@ export function StatusCard({
// made, so the operator can move the product on from here like any other —
// overriding their own refusal is not a review action, and leaving the
// picker disabled there was a dead end with no way out.
- const inReview = Boolean(status) && !ASSIGNABLE_STATUSES.includes(status as string)
+ const inReview = Boolean(status) && !ASSIGNABLE_PRODUCT_STATUSES.includes(status as string)
const awaitingDecision = status === 'proposed'
- const values = inReview ? [status as string, ...ASSIGNABLE_STATUSES] : ASSIGNABLE_STATUSES
+ const values = inReview
+ ? [status as string, ...ASSIGNABLE_PRODUCT_STATUSES]
+ : ASSIGNABLE_PRODUCT_STATUSES
return (
<SharedStatusCard<ProductFormValues>
diff --git a/packages/dashboard-core/src/products/product-schema.test.ts b/packages/dashboard-core/src/products/product-schema.test.ts
new file mode 100644
index 0000000000..820fe58ddf
--- /dev/null
+++ b/packages/dashboard-core/src/products/product-schema.test.ts
@@ -0,0 +1,8 @@
+import { describe, expect, it } from 'vitest'
+import { productFormSchema } from './product-schema'
+
+describe('productFormSchema status', () => {
+ it('accepts a status an extension added, so the form still saves', () => {
+ expect(productFormSchema.shape.status.safeParse('pending_compliance').success).toBe(true)
+ })
+})
diff --git a/packages/dashboard-core/src/products/product-schema.ts b/packages/dashboard-core/src/products/product-schema.ts
index 97755a509f..a80986aee9 100644
--- a/packages/dashboard-core/src/products/product-schema.ts
+++ b/packages/dashboard-core/src/products/product-schema.ts
@@ -1,3 +1,4 @@
+import { MEDIA_TYPES, type MediaType, PRODUCT_STATUSES, subsetOf } from '@spree/core'
import { requiredMessage } from '@spree/dashboard-ui'
import i18n from 'i18next'
import { z } from 'zod/v4'
@@ -103,9 +104,7 @@ export type CustomFieldFormValues = z.infer<typeof customFieldFormSchema>
// `source_media_id` (a file picked from the library). All can hold edits to
// alt, position, and variant_ids that the parent product PATCH/POST ships
// inline. previewUrl + uploadId are UI-only; stripped at submit.
-export const MEDIA_TYPES = ['image', 'video', 'external_video'] as const
-
-export type MediaType = (typeof MEDIA_TYPES)[number]
+export { MEDIA_TYPES, type MediaType }
export const mediaFormSchema = z
.object({
@@ -169,6 +168,13 @@ export const productPublicationFormSchema = z.object({
export type ProductPublicationFormValues = z.infer<typeof productPublicationFormSchema>
+/** Statuses a merchant sets by hand; the rest come from the review workflow. */
+export const ASSIGNABLE_PRODUCT_STATUSES = subsetOf(PRODUCT_STATUSES, [
+ 'draft',
+ 'active',
+ 'archived',
+])
+
export const productFormSchema = z.object({
// General
name: z.string().min(1, { error: requiredMessage('name') }),
@@ -176,10 +182,11 @@ export const productFormSchema = z.object({
// Status
// Every status the API may answer, not just the ones a form sets. A
- // marketplace product also comes back `proposed` or `rejected`, and a schema
- // that rejects those makes the whole form unsavable rather than flagging a
- // field (docs/plans/6.0-seller-product-submission.md).
- status: z.enum(['draft', 'active', 'archived', 'proposed', 'rejected']).optional(),
+ // marketplace product also comes back `proposed` or `rejected`, an extension
+ // may add statuses of its own, and a schema that rejects any of those makes
+ // the whole form unsavable rather than flagging a field
+ // (docs/plans/6.0-seller-product-submission.md).
+ status: z.string().optional(),
// Categorization
category_ids: z.array(z.string()).optional(),
diff --git a/packages/dashboard-core/src/schemas/package-type.ts b/packages/dashboard-core/src/schemas/package-type.ts
index 9849e78e9c..3caffd1081 100644
--- a/packages/dashboard-core/src/schemas/package-type.ts
+++ b/packages/dashboard-core/src/schemas/package-type.ts
@@ -1,14 +1,10 @@
-import { DimensionUnit, WeightUnit } from '@spree/core'
+import { DimensionUnit, PACKAGE_TYPE_KINDS, type PackageTypeKind, WeightUnit } from '@spree/core'
import { requiredMessage } from '@spree/dashboard-ui'
import i18n from 'i18next'
import { z } from 'zod/v4'
import type { PanelPackageType, PanelPackageTypeCreateParams } from '../api-client'
-// The vocabulary the server validates against; typing anything else could
-// only fail on save.
-export const PACKAGE_TYPE_KINDS = ['box', 'envelope', 'carton', 'pallet', 'container'] as const
-
-export type PackageTypeKind = (typeof PACKAGE_TYPE_KINDS)[number]
+export { PACKAGE_TYPE_KINDS, type PackageTypeKind }
/** @deprecated Use `Object.values(DimensionUnit)` from `@spree/admin-sdk`. */
export const PACKAGE_DIMENSION_UNITS = Object.values(DimensionUnit)
diff --git a/packages/dashboard-core/src/schemas/stock-location.ts b/packages/dashboard-core/src/schemas/stock-location.ts
index b0bb282cd4..b7835759e5 100644
--- a/packages/dashboard-core/src/schemas/stock-location.ts
+++ b/packages/dashboard-core/src/schemas/stock-location.ts
@@ -1,3 +1,4 @@
+import { PICKUP_STOCK_POLICIES, type PickupStockPolicy, STOCK_LOCATION_KINDS } from '@spree/core'
import { requiredMessage } from '@spree/dashboard-ui'
import { z } from 'zod/v4'
import type { PanelStockLocation, PanelStockLocationCreateParams } from '../api-client'
@@ -7,9 +8,7 @@ import { countryCodeSchema } from '../lib/iso-codes'
// Labels live in `en.json` under `admin.stock_locations.kinds.*` and
// `admin.stock_locations.pickup_stock_policies.*`. Consumers map these
// values to translated labels at render time.
-export const STOCK_LOCATION_KINDS = ['warehouse', 'store', 'fulfillment_center'] as const
-export const PICKUP_STOCK_POLICIES = ['local', 'any'] as const
-export type PickupStockPolicy = (typeof PICKUP_STOCK_POLICIES)[number]
+export { PICKUP_STOCK_POLICIES, type PickupStockPolicy, STOCK_LOCATION_KINDS }
export const stockLocationFormSchema = z.object({
name: z
diff --git a/packages/dashboard-core/src/tables/stock-locations.tsx b/packages/dashboard-core/src/tables/stock-locations.tsx
index d37c550a77..952a4cc681 100644
--- a/packages/dashboard-core/src/tables/stock-locations.tsx
+++ b/packages/dashboard-core/src/tables/stock-locations.tsx
@@ -1,3 +1,4 @@
+import { STOCK_LOCATION_KINDS } from '@spree/core'
import { ActiveBadge, ResourceNameCell } from '@spree/dashboard-ui'
import { WarehouseIcon } from '@spree/dashboard-ui/icons'
import i18n from 'i18next'
@@ -35,14 +36,10 @@ defineTable<PanelStockLocation>('stock-locations', {
filterable: true,
default: true,
filterType: 'enum',
- filterOptions: [
- { value: 'warehouse', label: i18n.t('admin.stock_locations.kinds.warehouse') },
- { value: 'store', label: i18n.t('admin.stock_locations.kinds.store') },
- {
- value: 'fulfillment_center',
- label: i18n.t('admin.stock_locations.kinds.fulfillment_center'),
- },
- ],
+ filterOptions: STOCK_LOCATION_KINDS.map((kind) => ({
+ value: kind,
+ label: i18n.t(`admin.stock_locations.kinds.${kind}`),
+ })),
quickFilter: true,
render: (sl) => {
const key = `admin.stock_locations.kinds.${sl.kind}`
diff --git a/packages/dashboard-ui/src/spree/claim-resolve-dialog.tsx b/packages/dashboard-ui/src/spree/claim-resolve-dialog.tsx
index fed59c781d..5f7f5f45bc 100644
--- a/packages/dashboard-ui/src/spree/claim-resolve-dialog.tsx
+++ b/packages/dashboard-ui/src/spree/claim-resolve-dialog.tsx
@@ -1,4 +1,4 @@
-import { isPositiveMoney } from '@spree/core'
+import { CLAIM_RESOLUTIONS, type ClaimResolution, isPositiveMoney } from '@spree/core'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
import { Button } from '../ui/button'
@@ -17,8 +17,7 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '.
import { Switch } from '../ui/switch'
import type { RefundMethod } from './return-dialogs'
-/** How a claim is settled. */
-export type ClaimResolution = 'refund' | 'replacement' | 'refund_and_replacement'
+export type { ClaimResolution }
/** One claimed line, as the resolve form needs it. */
export type ClaimLineForResolve = {
@@ -75,12 +74,10 @@ export function ClaimResolveDialog({
.filter(([, on]) => on)
.map(([id]) => id)
- const resolutionOptions = (['refund', 'replacement', 'refund_and_replacement'] as const).map(
- (value) => ({
- value,
- label: t(`admin.pages.orders.detail.claims.resolutions.${value}`),
- }),
- )
+ const resolutionOptions = CLAIM_RESOLUTIONS.map((value) => ({
+ value,
+ label: t(`admin.pages.orders.detail.claims.resolutions.${value}`),
+ }))
const methodOptions = [
{
diff --git a/packages/dashboard-ui/src/ui/badge.tsx b/packages/dashboard-ui/src/ui/badge.tsx
index 30bb752054..c31261d3b9 100644
--- a/packages/dashboard-ui/src/ui/badge.tsx
+++ b/packages/dashboard-ui/src/ui/badge.tsx
@@ -1,3 +1,4 @@
+import type { BuiltInStatus } from '@spree/core'
import { cva, type VariantProps } from 'class-variance-authority'
import type * as React from 'react'
import { useTranslation } from 'react-i18next'
@@ -80,6 +81,7 @@ const statusToneMap: Record<string, StatusTone> = {
authorized: 'info',
complete: 'success',
completed: 'success',
+ placed: 'success',
paid: 'success',
fulfilled: 'success',
delivered: 'success',
@@ -157,18 +159,36 @@ const statusToneMap: Record<string, StatusTone> = {
ready_to_ship: 'warning',
ordered: 'info',
partially_received: 'info',
+ // More arrived than was ordered: done, but worth a look.
+ over_received: 'warning',
// Gift cards.
partially_redeemed: 'info',
redeemed: 'neutral',
// Price lists — `scheduled` is live-but-not-yet, which is the same shape as
// any other "waiting on the clock" state.
scheduled: 'info',
+ // The rest of the API's own statuses, on the same rule as above.
+ accepted: 'success',
+ waived: 'neutral',
+ withdrawn: 'neutral',
+ awaiting_confirmation: 'warning',
+ lapsed: 'neutral',
+ mapping: 'warning',
+ completed_mapping: 'info',
+ unresolved: 'destructive',
+ on_hand: 'success',
+ backordered: 'warning',
+ shipped: 'success',
+ checkout: 'neutral',
+ invalid: 'destructive',
+ purchased: 'success',
+ refund_requested: 'warning',
// Boolean filter values. A yes/no pair is a state like any other — "in
// stock: no" is the row an operator is looking for, and reading it in the
// same green/red the rest of the app uses saves them parsing the word.
true: 'success',
false: 'destructive',
-}
+} satisfies Record<BuiltInStatus, StatusTone> & Record<string, StatusTone>
// Dot fills, by tone. These read the same `--status-*` ramps the tinted Badge
// variants use, but take the *reading* step rather than the fill step: a 6px
diff --git a/packages/dashboard/e2e/commission-rates.spec.ts b/packages/dashboard/e2e/commission-rates.spec.ts
index 416fa03386..af95fd884e 100644
--- a/packages/dashboard/e2e/commission-rates.spec.ts
+++ b/packages/dashboard/e2e/commission-rates.spec.ts
@@ -114,7 +114,11 @@ test.describe('commission rates', () => {
await expect(rowButton(page, name)).toBeVisible({ timeout: 15_000 })
await page.reload()
- await rowButton(page, name).click()
+ // A click landing while the app is still booting after the reload is lost.
+ await expect(async () => {
+ await rowButton(page, name).click()
+ await expect(page.locator('#value')).toBeVisible({ timeout: 3_000 })
+ }).toPass({ timeout: 15_000 })
await expect(page.locator('#value')).toHaveValue(/^8(\.0+)?$/, { timeout: 15_000 })
await expect(sheet.getByText(FIXTURE_LEDGER_SELLER)).toBeVisible()
await expect(sheet.getByText(FIXTURE_PROMO_TAXON).first()).toBeVisible()
diff --git a/packages/dashboard/e2e/products-translations.spec.ts b/packages/dashboard/e2e/products-translations.spec.ts
index 7307772031..6f61e83a25 100644
--- a/packages/dashboard/e2e/products-translations.spec.ts
+++ b/packages/dashboard/e2e/products-translations.spec.ts
@@ -168,7 +168,13 @@ test.describe('product translations', () => {
await coverageSearch(page).fill(name)
const row = page.getByRole('row', { name: new RegExp(name) })
await expect(row).toBeVisible({ timeout: 15_000 })
- await expect(row.getByText('—')).toBeVisible()
+ // Other specs may add languages to the shared store, so read the German
+ // column rather than the whole row.
+ const headers = page.getByRole('table').filter({ has: row }).getByRole('columnheader')
+ const germanColumn = (await headers.allInnerTexts()).findIndex((text) => text.trim() === 'de')
+ expect(germanColumn).toBeGreaterThan(-1)
+ const germanCell = row.getByRole('cell').nth(germanColumn)
+ await expect(germanCell.getByText('—')).toBeVisible()
await row.getByRole('button', { name }).click()
const dialog = page.getByRole('dialog')
@@ -179,7 +185,7 @@ test.describe('product translations', () => {
await expect(page.getByText(/translations saved/i)).toBeVisible({ timeout: 15_000 })
await dialog.getByRole('button', { name: /^close$/i }).click()
- await expect(row.getByText('—')).toBeHidden({ timeout: 15_000 })
- await expect(row.getByText(/\d+\/\d+/)).toBeVisible()
+ await expect(germanCell.getByText('—')).toBeHidden({ timeout: 15_000 })
+ await expect(germanCell.getByText(/\d+\/\d+/)).toBeVisible()
})
})
diff --git a/packages/dashboard/src/components/spree/api-keys/api-key-create-sheet.tsx b/packages/dashboard/src/components/spree/api-keys/api-key-create-sheet.tsx
index 720ffd5c85..849bd4ee5b 100644
--- a/packages/dashboard/src/components/spree/api-keys/api-key-create-sheet.tsx
+++ b/packages/dashboard/src/components/spree/api-keys/api-key-create-sheet.tsx
@@ -1,5 +1,6 @@
import { zodResolver } from '@hookform/resolvers/zod'
import { type ApiKey, type ApiKeyCreateParams, SpreeError } from '@spree/admin-sdk'
+import { API_KEY_TYPES } from '@spree/core'
import { mapSpreeErrorsToForm } from '@spree/dashboard-core'
import {
Button,
@@ -35,7 +36,7 @@ const buildCreateSchema = (t: TFunction) =>
z
.object({
name: z.string().min(1, t('admin.fields.api_key.name.required')),
- key_type: z.enum(['publishable', 'secret']),
+ key_type: z.enum(API_KEY_TYPES),
scopes: z.array(z.string()),
channel_id: z.string(),
})
diff --git a/packages/dashboard/src/components/spree/api-keys/api-key-form-fields.tsx b/packages/dashboard/src/components/spree/api-keys/api-key-form-fields.tsx
index f72b6b8282..f5235cad78 100644
--- a/packages/dashboard/src/components/spree/api-keys/api-key-form-fields.tsx
+++ b/packages/dashboard/src/components/spree/api-keys/api-key-form-fields.tsx
@@ -1,3 +1,4 @@
+import type { ApiKeyType } from '@spree/core'
import {
Field,
FieldContent,
@@ -58,7 +59,7 @@ export function KeyTypeChoice({
title,
description,
}: {
- value: 'publishable' | 'secret'
+ value: ApiKeyType
title: string
description: string
}) {
diff --git a/packages/dashboard/src/components/spree/catalog-price-columns.tsx b/packages/dashboard/src/components/spree/catalog-price-columns.tsx
index 730723e93d..79608fadb7 100644
--- a/packages/dashboard/src/components/spree/catalog-price-columns.tsx
+++ b/packages/dashboard/src/components/spree/catalog-price-columns.tsx
@@ -1,4 +1,5 @@
import type { CatalogPrice } from '@spree/admin-sdk'
+import { CATALOG_PRICE_SOURCES, subsetOf } from '@spree/core'
import { Money } from '@spree/dashboard-core'
import type { ProductMembershipRow, SubRowLayout } from '@spree/dashboard-ui'
import {
@@ -11,7 +12,7 @@ import {
} from '@spree/dashboard-ui'
import i18n from 'i18next'
-const AGREEMENT_SOURCES = ['explicit', 'automatic'] as const
+const AGREEMENT_SOURCES = subsetOf(CATALOG_PRICE_SOURCES, ['explicit', 'automatic'])
/** Where the copy comes from: the catalog's strings, or a page's own. */
const CATALOG_NAMESPACE = 'admin.catalogs.prices'
@@ -83,7 +84,7 @@ export function catalogPriceColumns({
* catalog has every reason to assume it prices what it lists.
*/
function PriceSourceBadge({ source, namespace }: { source: string; namespace: string }) {
- const fromAgreement = (AGREEMENT_SOURCES as readonly string[]).includes(source)
+ const fromAgreement = AGREEMENT_SOURCES.includes(source)
const help = text(namespace, `source_help.${source}`)
return (
diff --git a/packages/dashboard/src/components/spree/collections/collection-form.tsx b/packages/dashboard/src/components/spree/collections/collection-form.tsx
index deede06128..fddf01276d 100644
--- a/packages/dashboard/src/components/spree/collections/collection-form.tsx
+++ b/packages/dashboard/src/components/spree/collections/collection-form.tsx
@@ -1,4 +1,5 @@
import type { Collection } from '@spree/admin-sdk'
+import { COLLECTION_SORT_ORDERS } from '@spree/core'
import {
Card,
CardContent,
@@ -21,11 +22,7 @@ import {
import type { UseFormReturn } from 'react-hook-form'
import { Controller } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
-import {
- COLLECTION_SORT_ORDERS,
- type CollectionFormValues,
- sortOrderLabelKey,
-} from '../../../schemas/collection'
+import { type CollectionFormValues, sortOrderLabelKey } from '../../../schemas/collection'
import {
CustomFieldsInlineCard,
FormBackedCustomFieldsProvider,
diff --git a/packages/dashboard/src/components/spree/collections/collection-rules-card.tsx b/packages/dashboard/src/components/spree/collections/collection-rules-card.tsx
index a9e48bbf3e..6a0fa11c60 100644
--- a/packages/dashboard/src/components/spree/collections/collection-rules-card.tsx
+++ b/packages/dashboard/src/components/spree/collections/collection-rules-card.tsx
@@ -1,3 +1,4 @@
+import { COLLECTION_RULE_MATCH_POLICIES, MATCH_POLICIES } from '@spree/core'
import { typeLabel } from '@spree/dashboard-core'
import {
Button,
@@ -22,12 +23,7 @@ import { Controller, type UseFormReturn, useFieldArray } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { useCollectionRuleTypes } from '../../../hooks/use-collections'
-import {
- blankCollectionRule,
- COLLECTION_RULE_MATCH_POLICIES,
- COLLECTION_RULES_MATCH_POLICIES,
- type CollectionFormValues,
-} from '../../../schemas/collection'
+import { blankCollectionRule, type CollectionFormValues } from '../../../schemas/collection'
/**
* Membership card: the manual/automatic switch plus, for automatic
@@ -61,7 +57,7 @@ export function CollectionRulesCard({ form }: { form: UseFormReturn<CollectionFo
value,
label: t(`admin.collections.rule_match_policies.${value}`),
}))
- const rulesMatchPolicyOptions = COLLECTION_RULES_MATCH_POLICIES.map((value) => ({
+ const rulesMatchPolicyOptions = MATCH_POLICIES.map((value) => ({
value,
label: t(`admin.collections.rules_match_policies.${value}`),
}))
diff --git a/packages/dashboard/src/components/spree/order-post-sale-cards.tsx b/packages/dashboard/src/components/spree/order-post-sale-cards.tsx
index 4319dba417..c51ea6dbbb 100644
--- a/packages/dashboard/src/components/spree/order-post-sale-cards.tsx
+++ b/packages/dashboard/src/components/spree/order-post-sale-cards.tsx
@@ -1,4 +1,5 @@
import type { Claim, Exchange, Order } from '@spree/admin-sdk'
+import { CLAIM_STATUSES, EXCHANGE_STATUSES, subsetOf } from '@spree/core'
import { isPositiveMoney, Money } from '@spree/dashboard-core'
import {
Badge,
@@ -47,8 +48,9 @@ import {
// Statuses that still offer an action. A terminal record would otherwise
// show a menu button that opens onto nothing.
-const EXCHANGE_ACTIONABLE = ['requested', 'approved', 'received']
-const CLAIM_ACTIONABLE = ['open', 'approved']
+const EXCHANGE_ACTIONABLE = subsetOf(EXCHANGE_STATUSES, ['requested', 'approved', 'received'])
+const CLAIM_ACTIONABLE = subsetOf(CLAIM_STATUSES, ['open', 'approved'])
+const EXCHANGE_CANCELABLE = subsetOf(EXCHANGE_STATUSES, ['requested', 'approved'])
/** Exchanges on an order, with the actions available at each status. */
export function OrderExchangesCard({ order }: { order: Order }) {
@@ -149,7 +151,7 @@ export function OrderExchangesCard({ order }: { order: Order }) {
{t('admin.pages.orders.detail.exchanges.actions.fulfill')}
</DropdownMenuItem>
)}
- {['requested', 'approved'].includes(exchange.status) && (
+ {EXCHANGE_CANCELABLE.includes(exchange.status) && (
<>
<DropdownMenuSeparator />
<DropdownMenuItem
@@ -293,7 +295,7 @@ export function OrderClaimsCard({ order }: { order: Order }) {
{t('admin.pages.orders.detail.claims.actions.resolve')}
</DropdownMenuItem>
)}
- {['open', 'approved'].includes(claim.status) && <DropdownMenuSeparator />}
+ {CLAIM_ACTIONABLE.includes(claim.status) && <DropdownMenuSeparator />}
{claim.status === 'open' && (
<DropdownMenuItem
variant="destructive"
@@ -313,7 +315,7 @@ export function OrderClaimsCard({ order }: { order: Order }) {
{t('admin.pages.orders.detail.claims.actions.deny')}
</DropdownMenuItem>
)}
- {['open', 'approved'].includes(claim.status) && (
+ {CLAIM_ACTIONABLE.includes(claim.status) && (
<DropdownMenuItem
variant="destructive"
onClick={async () => {
diff --git a/packages/dashboard/src/components/spree/order-returns-card.tsx b/packages/dashboard/src/components/spree/order-returns-card.tsx
index 4dc5aef3f6..912d55f9ff 100644
--- a/packages/dashboard/src/components/spree/order-returns-card.tsx
+++ b/packages/dashboard/src/components/spree/order-returns-card.tsx
@@ -1,4 +1,5 @@
import type { Order, Return, ReturnLineItem } from '@spree/admin-sdk'
+import { RETURN_STATUSES, subsetOf } from '@spree/core'
import {
currencyParts,
formatAmount,
@@ -48,7 +49,10 @@ import { CreateReturnDialog, fulfilledUnits } from './post-sale-create-dialogs'
// Statuses that still offer an action; refunded and canceled are done and
// would render a menu button that opens onto nothing.
-const RETURN_ACTIONABLE = ['requested', 'approved', 'received']
+const RETURN_ACTIONABLE = subsetOf(RETURN_STATUSES, ['requested', 'approved', 'received'])
+// Once goods have arrived the return can only be refunded.
+const RETURN_CANCELABLE = subsetOf(RETURN_STATUSES, ['requested', 'approved'])
+const RETURN_RECEIVED = subsetOf(RETURN_STATUSES, ['received', 'refunded'])
/**
* Returns on an order. Each status change is a distinct action rather than an
@@ -146,7 +150,7 @@ export function OrderReturnsCard({ order }: { order: Order }) {
)}
</DropdownMenuItem>
)}
- {['requested', 'approved'].includes(returnRecord.status) && (
+ {RETURN_CANCELABLE.includes(returnRecord.status) && (
<>
<DropdownMenuSeparator />
<DropdownMenuItem
@@ -245,7 +249,7 @@ export function OrderReturnsCard({ order }: { order: Order }) {
}
/** A return is only worth a label while the goods are still coming back. */
-const RETURN_LABEL_STATUSES = ['requested', 'approved']
+const RETURN_LABEL_STATUSES = subsetOf(RETURN_STATUSES, ['requested', 'approved'])
/**
* The prepaid label for the parcel coming back, and the button to buy one.
@@ -353,7 +357,7 @@ function RefundSummaryFooter({
function ReturnLineRow({ line, status }: { line: ReturnLineItem; status: string }) {
const { t } = useTranslation()
- const received = ['received', 'refunded'].includes(status)
+ const received = RETURN_RECEIVED.includes(status)
return (
<div className="flex items-center justify-between text-sm">
diff --git a/packages/dashboard/src/components/spree/orders/fulfillments-card.tsx b/packages/dashboard/src/components/spree/orders/fulfillments-card.tsx
index 8f684484dd..b4a96677f4 100644
--- a/packages/dashboard/src/components/spree/orders/fulfillments-card.tsx
+++ b/packages/dashboard/src/components/spree/orders/fulfillments-card.tsx
@@ -1,4 +1,5 @@
import type { Delivery, Fulfillment, Order } from '@spree/admin-sdk'
+import { FULFILLMENT_STATUSES, subsetOf } from '@spree/core'
import {
type FulfillmentItemRow,
formatAmount,
@@ -410,11 +411,11 @@ function CreateFulfillmentDialog({
// Which transitions the workflows actually accept, so the card does not
// present an action that can only 422.
-const CAN_SHIP = ['unfulfilled']
-const CAN_CANCEL = ['unfulfilled']
-const CAN_EDIT = ['unfulfilled']
+const CAN_SHIP = subsetOf(FULFILLMENT_STATUSES, ['unfulfilled'])
+const CAN_CANCEL = subsetOf(FULFILLMENT_STATUSES, ['unfulfilled'])
+const CAN_EDIT = subsetOf(FULFILLMENT_STATUSES, ['unfulfilled'])
// Receipt is confirmed after handover, never before.
-const CAN_MARK_DELIVERED = ['fulfilled']
+const CAN_MARK_DELIVERED = subsetOf(FULFILLMENT_STATUSES, ['fulfilled'])
function FulfillmentRow({ order, fulfillment }: { order: Order; fulfillment: Fulfillment }) {
const { t } = useTranslation()
diff --git a/packages/dashboard/src/components/spree/orders/order-adjustments-cards.tsx b/packages/dashboard/src/components/spree/orders/order-adjustments-cards.tsx
index 704dc0a7f8..3752839299 100644
--- a/packages/dashboard/src/components/spree/orders/order-adjustments-cards.tsx
+++ b/packages/dashboard/src/components/spree/orders/order-adjustments-cards.tsx
@@ -1,5 +1,12 @@
import type { Discount, Fee, FeeCreateParams, Order } from '@spree/admin-sdk'
-import { compareMoney, isDecimalString, isZeroMoney, sumMoney } from '@spree/core'
+import {
+ compareMoney,
+ FEE_KINDS,
+ type FeeKind,
+ isDecimalString,
+ isZeroMoney,
+ sumMoney,
+} from '@spree/core'
import { adminClient, currencyParts, formatMoney, Money, percentOf } from '@spree/dashboard-core'
import {
Badge,
@@ -63,11 +70,11 @@ import {
showsTaxabilityReason,
type TaxLineGroup,
} from '../../../lib/tax-line-groups'
-import { FEE_KINDS, SYSTEM_FEE_KINDS } from '../../../schemas/order'
+import { MANUAL_FEE_KINDS } from '../../../schemas/order'
/** The API accepts any kind string, so unknown values fall back to the raw value. */
function feeKindLabel(kind: string) {
- return ([...FEE_KINDS, ...SYSTEM_FEE_KINDS] as readonly string[]).includes(kind)
+ return (FEE_KINDS as readonly string[]).includes(kind)
? i18n.t(`admin.orders.detail.adjustment_lines.fee_kind_${kind}`)
: kind
}
@@ -562,7 +569,7 @@ function AddFeeDialog({
const { t } = useTranslation()
const orderId = order.id
const [target, setTarget] = useState('order')
- const [kind, setKind] = useState<(typeof FEE_KINDS)[number]>('surcharge')
+ const [kind, setKind] = useState<FeeKind>('surcharge')
const mutation = useOrderAdjustmentLinesMutation(orderId, (params: FeeCreateParams) =>
adminClient.orders.fees.create(orderId, params),
@@ -573,7 +580,7 @@ function AddFeeDialog({
...(order.items ?? []).map((item) => ({ value: item.id, label: item.name ?? item.id })),
]
- const kindOptions = FEE_KINDS.map((value) => ({
+ const kindOptions = MANUAL_FEE_KINDS.map((value) => ({
value,
label: t(`admin.orders.detail.adjustment_lines.fee_kind_${value}`),
}))
@@ -635,7 +642,7 @@ function AddFeeDialog({
<Select
items={kindOptions}
value={kind}
- onValueChange={(v) => setKind(v as (typeof FEE_KINDS)[number])}
+ onValueChange={(v) => setKind(v as FeeKind)}
>
<SelectTrigger>
<SelectValue />
diff --git a/packages/dashboard/src/components/spree/payment-method-editors/payment-method-form.tsx b/packages/dashboard/src/components/spree/payment-method-editors/payment-method-form.tsx
index d3e9214718..5d00a10971 100644
--- a/packages/dashboard/src/components/spree/payment-method-editors/payment-method-form.tsx
+++ b/packages/dashboard/src/components/spree/payment-method-editors/payment-method-form.tsx
@@ -1,4 +1,5 @@
import type { PaymentMethod, PreferenceSchema } from '@spree/admin-sdk'
+import { CAPTURE_METHODS } from '@spree/core'
import { PreferencesForm, Slot, useSlotEntries } from '@spree/dashboard-core'
import {
Field,
@@ -17,7 +18,6 @@ import {
} from '@spree/dashboard-ui'
import { Controller, type UseFormReturn } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
-import { CAPTURE_METHODS } from '../../../schemas/store'
import {
type PaymentMethodEditorContext,
type PaymentMethodFormMode,
diff --git a/packages/dashboard/src/components/spree/post-sale-create-dialogs.tsx b/packages/dashboard/src/components/spree/post-sale-create-dialogs.tsx
index a93d83c140..22c2666f04 100644
--- a/packages/dashboard/src/components/spree/post-sale-create-dialogs.tsx
+++ b/packages/dashboard/src/components/spree/post-sale-create-dialogs.tsx
@@ -1,5 +1,5 @@
import type { Claim, Order, Variant } from '@spree/admin-sdk'
-import { sumMoney } from '@spree/core'
+import { type ClaimResolution, sumMoney } from '@spree/core'
import {
adminClient,
currencyParts,
@@ -11,7 +11,6 @@ import {
} from '@spree/dashboard-core'
import {
Button,
- type ClaimResolution,
ClaimResolveDialog,
Dialog,
DialogBody,
diff --git a/packages/dashboard/src/components/spree/price-list-editors/price-list-form.tsx b/packages/dashboard/src/components/spree/price-list-editors/price-list-form.tsx
index 2aa0db370f..a618784a1a 100644
--- a/packages/dashboard/src/components/spree/price-list-editors/price-list-form.tsx
+++ b/packages/dashboard/src/components/spree/price-list-editors/price-list-form.tsx
@@ -5,6 +5,7 @@ import type {
PriceRule,
ResourceTypeDefinition,
} from '@spree/admin-sdk'
+import { MATCH_POLICIES, type MatchPolicy } from '@spree/core'
import {
adminClient,
Can,
@@ -97,7 +98,6 @@ import {
useRemovePriceListProducts,
} from '../../../hooks/use-price-lists'
import {
- MATCH_POLICIES,
PRICE_LIST_DEFAULTS,
type PriceListFormValues,
type PriceRuleFormDraft,
@@ -184,7 +184,7 @@ export function PriceListForm({
description: priceList.description ?? '',
starts_at: priceList.starts_at,
ends_at: priceList.ends_at,
- match_policy: (priceList.match_policy as 'all' | 'any') ?? 'all',
+ match_policy: (priceList.match_policy as MatchPolicy) ?? 'all',
rules: initialRules.map(ruleDraftFromRule),
staged_products: { adds: [], removes: [] },
...extensionFormValues('price_list', priceList),
diff --git a/packages/dashboard/src/components/spree/price-list-editors/status-badge.tsx b/packages/dashboard/src/components/spree/price-list-editors/status-badge.tsx
index b86879c2a4..f6e39a70d3 100644
--- a/packages/dashboard/src/components/spree/price-list-editors/status-badge.tsx
+++ b/packages/dashboard/src/components/spree/price-list-editors/status-badge.tsx
@@ -1,16 +1,15 @@
import type { PriceList } from '@spree/admin-sdk'
+import { PRICE_LIST_STATUSES } from '@spree/core'
import { StatusBadge } from '@spree/dashboard-ui'
import { useTranslation } from 'react-i18next'
// Colour comes from the shared status map; this component owns only the
// question of *which* status a price list is actually in.
-const PRICE_LIST_STATUSES = ['active', 'scheduled', 'inactive', 'draft'] as const
+type BuiltInStatus = (typeof PRICE_LIST_STATUSES)[number]
-type PriceListStatus = (typeof PRICE_LIST_STATUSES)[number]
-
-function normalizeStatus(value: unknown): PriceListStatus {
+function normalizeStatus(value: unknown): BuiltInStatus {
return typeof value === 'string' && (PRICE_LIST_STATUSES as readonly string[]).includes(value)
- ? (value as PriceListStatus)
+ ? (value as BuiltInStatus)
: 'draft'
}
@@ -20,7 +19,7 @@ export function PriceListStatusBadge({ priceList }: { priceList: PriceList }) {
// `scheduled` collapses into the active treatment whenever the date
// range puts it live now. Keep `inactive` distinct even when the API
// reports a stale `currently_active: true`.
- const status: PriceListStatus = priceList.currently_active && raw !== 'inactive' ? 'active' : raw
+ const status: BuiltInStatus = priceList.currently_active && raw !== 'inactive' ? 'active' : raw
return <StatusBadge status={status} label={t(`admin.fields.price_list.status.${status}`)} />
}
diff --git a/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx b/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx
index 69d41af2d0..659a3976d6 100644
--- a/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx
+++ b/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx
@@ -8,6 +8,7 @@ import type {
PromotionRuleDraftParams,
ResourceTypeDefinition,
} from '@spree/admin-sdk'
+import { MATCH_POLICIES, type MatchPolicy } from '@spree/core'
import { Can, PageHeader, PreferencesForm, StoreDatePicker } from '@spree/dashboard-core'
import {
Alert,
@@ -88,8 +89,6 @@ import {
} from '../../../hooks/use-promotions'
import {
- MATCH_POLICIES,
- type MatchPolicy,
PROMOTION_DEFAULTS,
PROMOTION_KINDS,
type PromotionFormValues,
diff --git a/packages/dashboard/src/components/spree/receive-delivery-card.tsx b/packages/dashboard/src/components/spree/receive-delivery-card.tsx
index 53ecf74e1a..023f96c478 100644
--- a/packages/dashboard/src/components/spree/receive-delivery-card.tsx
+++ b/packages/dashboard/src/components/spree/receive-delivery-card.tsx
@@ -1,4 +1,5 @@
import type { StockReceiptCreateParams } from '@spree/admin-sdk'
+import { STOCK_RECEIPT_REJECTION_REASONS, type StockReceiptRejectionReason } from '@spree/core'
import { Can, StoreDatePicker, type SubjectName } from '@spree/dashboard-core'
import {
Button,
@@ -24,7 +25,6 @@ import {
} from '@spree/dashboard-ui'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
-import { REJECTION_REASONS, type RejectionReason } from '../../schemas/inventory-operations'
import { QuantityCell, QuantityHead } from './quantity-cell'
import { VariantLink } from './variant-link'
@@ -48,7 +48,7 @@ export interface ReceivableLine {
interface Count {
accepted: number
rejected: number
- reason: RejectionReason | ''
+ reason: StockReceiptRejectionReason | ''
}
/**
@@ -215,20 +215,22 @@ export function ReceiveDeliveryCard({
<TableCell className="rounded-none!">
{count.rejected > 0 ? (
<Select
- items={REJECTION_REASONS.map((value) => ({
+ items={STOCK_RECEIPT_REJECTION_REASONS.map((value) => ({
value,
label: t(`admin.stock_receipts.rejection_reasons.${value}`),
}))}
value={count.reason}
onValueChange={(value) =>
- setCount(line.id, { reason: (value as RejectionReason | null) ?? '' })
+ setCount(line.id, {
+ reason: (value as StockReceiptRejectionReason | null) ?? '',
+ })
}
>
<SelectTrigger aria-label={t('admin.stock_receipts.columns.reason')}>
<SelectValue placeholder={t('admin.stock_receipts.reason_placeholder')} />
</SelectTrigger>
<SelectContent>
- {REJECTION_REASONS.map((value) => (
+ {STOCK_RECEIPT_REJECTION_REASONS.map((value) => (
<SelectItem key={value} value={value}>
{t(`admin.stock_receipts.rejection_reasons.${value}`)}
</SelectItem>
diff --git a/packages/dashboard/src/components/spree/sellers/seller-edit-settlement-sheet.tsx b/packages/dashboard/src/components/spree/sellers/seller-edit-settlement-sheet.tsx
index 0bf10865b9..a9b894217b 100644
--- a/packages/dashboard/src/components/spree/sellers/seller-edit-settlement-sheet.tsx
+++ b/packages/dashboard/src/components/spree/sellers/seller-edit-settlement-sheet.tsx
@@ -1,5 +1,6 @@
import { zodResolver } from '@hookform/resolvers/zod'
import type { Seller } from '@spree/admin-sdk'
+import { PAYOUT_SCHEDULE_INTERVALS, TAX_REMITTANCES } from '@spree/core'
import {
currencyParts,
mapSpreeErrorsToForm,
@@ -35,12 +36,10 @@ import { useTranslation } from 'react-i18next'
import { useOnSheetOpen } from '../../../hooks/use-on-sheet-open'
import { useUpdateSeller } from '../../../hooks/use-sellers'
import {
- PAYOUT_INTERVALS,
SELLER_DEFAULTS,
type SellerFormValues,
sellerFormSchema,
sellerValuesToParams,
- TAX_REMITTANCES,
} from '../../../schemas/seller'
export function SellerEditSettlementSheet({
@@ -100,7 +99,7 @@ export function SellerEditSettlementSheet({
}))
const intervalOptions = [
{ value: '', label: t('admin.sellers.payout_interval.inherit') },
- ...PAYOUT_INTERVALS.map((value) => ({
+ ...PAYOUT_SCHEDULE_INTERVALS.map((value) => ({
value,
label: t(`admin.sellers.payout_interval.${value}`),
})),
diff --git a/packages/dashboard/src/hooks/use-post-sale.ts b/packages/dashboard/src/hooks/use-post-sale.ts
index 06f1d5a71a..74f6e5ce0e 100644
--- a/packages/dashboard/src/hooks/use-post-sale.ts
+++ b/packages/dashboard/src/hooks/use-post-sale.ts
@@ -1,3 +1,4 @@
+import type { ClaimResolution } from '@spree/core'
import { adminClient, useResourceKey, useResourceKeyBuilder } from '@spree/dashboard-core'
import { toastManager } from '@spree/dashboard-ui'
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
@@ -162,7 +163,7 @@ export function useClaimActions(orderId: string) {
replacementLineItemIds,
}: {
claimId: string
- resolution: 'refund' | 'replacement' | 'refund_and_replacement'
+ resolution: ClaimResolution
refundMethod?: 'original_payment' | 'store_credit'
amount?: string
replacementLineItemIds?: string[]
diff --git a/packages/dashboard/src/hooks/use-seller-ledger.ts b/packages/dashboard/src/hooks/use-seller-ledger.ts
index bcc962d3be..38fc64b784 100644
--- a/packages/dashboard/src/hooks/use-seller-ledger.ts
+++ b/packages/dashboard/src/hooks/use-seller-ledger.ts
@@ -1,9 +1,21 @@
import { SpreeError } from '@spree/admin-sdk'
+import { SELLER_PAYOUT_STATUSES, subsetOf } from '@spree/core'
import { adminClient, useResourceKey, useResourceMutation } from '@spree/dashboard-core'
import { toastManager } from '@spree/dashboard-ui'
import { useQuery } from '@tanstack/react-query'
import i18n from 'i18next'
+/**
+ * A settlement the sweep has written but nobody has confirmed. The workflow
+ * accepts exactly these, so offering the action on anything else would
+ * promise a move the server refuses.
+ */
+export const OWED_PAYOUT_STATUSES = subsetOf(SELLER_PAYOUT_STATUSES, [
+ 'pending',
+ 'processing',
+ 'unresolved',
+])
+
/** Where one seller stands with the marketplace, one row per currency. */
export function useSellerBalances(sellerId: string | undefined) {
return useQuery({
diff --git a/packages/dashboard/src/locales/ar.json b/packages/dashboard/src/locales/ar.json
index ddd75f3885..ed2273bc97 100644
--- a/packages/dashboard/src/locales/ar.json
+++ b/packages/dashboard/src/locales/ar.json
@@ -2676,6 +2676,7 @@
"updated": "تم تحديث بطاقة الهدايا"
},
"statuses": {
+ "active": "نشطة",
"canceled": "ملغاة",
"expired": "منتهية الصلاحية",
"partially_redeemed": "مُستَخدمة جزئيًا",
diff --git a/packages/dashboard/src/locales/de.json b/packages/dashboard/src/locales/de.json
index 4613e8d5a0..0575203ff5 100644
--- a/packages/dashboard/src/locales/de.json
+++ b/packages/dashboard/src/locales/de.json
@@ -2658,6 +2658,7 @@
"updated": "Geschenkkarte aktualisiert"
},
"statuses": {
+ "active": "Aktiv",
"canceled": "Storniert",
"expired": "Abgelaufen",
"partially_redeemed": "Teilweise eingelöst",
diff --git a/packages/dashboard/src/locales/en.json b/packages/dashboard/src/locales/en.json
index 15f66a8203..c654c6ed89 100644
--- a/packages/dashboard/src/locales/en.json
+++ b/packages/dashboard/src/locales/en.json
@@ -2658,6 +2658,7 @@
"updated": "Gift card updated"
},
"statuses": {
+ "active": "Active",
"canceled": "Canceled",
"expired": "Expired",
"partially_redeemed": "Partially redeemed",
diff --git a/packages/dashboard/src/locales/es.json b/packages/dashboard/src/locales/es.json
index 0c2128e518..f6152d1241 100644
--- a/packages/dashboard/src/locales/es.json
+++ b/packages/dashboard/src/locales/es.json
@@ -5698,6 +5698,7 @@
"updated": "Tarjeta de regalo actualizada"
},
"statuses": {
+ "active": "Activa",
"canceled": "Cancelada",
"expired": "Vencida",
"partially_redeemed": "Canjeada parcialmente",
diff --git a/packages/dashboard/src/locales/fr.json b/packages/dashboard/src/locales/fr.json
index 609e406798..8ced251026 100644
--- a/packages/dashboard/src/locales/fr.json
+++ b/packages/dashboard/src/locales/fr.json
@@ -2658,6 +2658,7 @@
"updated": "Carte cadeau mise à jour"
},
"statuses": {
+ "active": "Active",
"canceled": "Annulée",
"expired": "Expirée",
"partially_redeemed": "Partiellement utilisée",
diff --git a/packages/dashboard/src/locales/pl.json b/packages/dashboard/src/locales/pl.json
index 2a04dcf627..5426c0bdac 100644
--- a/packages/dashboard/src/locales/pl.json
+++ b/packages/dashboard/src/locales/pl.json
@@ -2676,6 +2676,7 @@
"updated": "Karta podarunkowa została zaktualizowana"
},
"statuses": {
+ "active": "Aktywna",
"canceled": "Anulowana",
"expired": "Wygasła",
"partially_redeemed": "Częściowo zrealizowana",
diff --git a/packages/dashboard/src/locales/zh-CN.json b/packages/dashboard/src/locales/zh-CN.json
index e407cbc825..9156f98507 100644
--- a/packages/dashboard/src/locales/zh-CN.json
+++ b/packages/dashboard/src/locales/zh-CN.json
@@ -2653,6 +2653,7 @@
"updated": "礼品卡已更新"
},
"statuses": {
+ "active": "启用",
"canceled": "已取消",
"expired": "已过期",
"partially_redeemed": "部分已兑换",
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/companies/$companyId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/companies/$companyId.tsx
index 74b0e13977..cf021659a9 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/companies/$companyId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/companies/$companyId.tsx
@@ -1,5 +1,6 @@
import { zodResolver } from '@hookform/resolvers/zod'
import type { Address, Company, CompanyInvitation, CompanyMembership } from '@spree/admin-sdk'
+import { COMPANY_KINDS } from '@spree/core'
import {
adminClient,
mapSpreeErrorsToForm,
@@ -82,7 +83,6 @@ import { spreeJsonLinkResolver } from '../../../../lib/json-link-resolver'
import {
COMPANY_CHILD_DEFAULTS,
COMPANY_DEFAULTS,
- COMPANY_KINDS,
type CompanyChildFormValues,
type CompanyFormValues,
companyChildFormSchema,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/index.tsx
index dcadaa0442..7b8ae58c4a 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/index.tsx
@@ -1,6 +1,7 @@
import type { Product } from '@spree/admin-sdk'
import type { BulkAction, BulkActionFormProps, ColumnDef } from '@spree/dashboard-core'
import {
+ ASSIGNABLE_PRODUCT_STATUSES,
adminClient,
ExportButton,
ImportButton,
@@ -81,8 +82,8 @@ export const Route = createFileRoute('/_authenticated/$storeId/products/')({
component: ProductsPage,
})
-type ProductStatus = 'draft' | 'active' | 'archived'
-type StatusFormValues = { status: ProductStatus }
+type AssignableStatus = (typeof ASSIGNABLE_PRODUCT_STATUSES)[number]
+type StatusFormValues = { status: AssignableStatus }
type CategoriesFormValues = { category_ids: string[] }
type CollectionsFormValues = { collection_ids: string[] }
type ChannelsFormValues = { channel_ids: string[] }
@@ -451,13 +452,11 @@ function ProductRowActions({ product, storeId }: { product: Product; storeId: st
)
}
-const PRODUCT_STATUSES: ProductStatus[] = ['draft', 'active', 'archived']
-
function StatusPickerSheet({ onSubmit, onCancel }: BulkActionFormProps<StatusFormValues>) {
const { t } = useTranslation()
- const [status, setStatus] = useState<ProductStatus>('active')
+ const [status, setStatus] = useState<AssignableStatus>('active')
- const statusItems = PRODUCT_STATUSES.map((value) => ({
+ const statusItems = ASSIGNABLE_PRODUCT_STATUSES.map((value) => ({
value,
label: t(`admin.pages.products.status_options.${value}`),
}))
@@ -475,7 +474,7 @@ function StatusPickerSheet({ onSubmit, onCancel }: BulkActionFormProps<StatusFor
<Select
items={statusItems}
value={status}
- onValueChange={(v) => setStatus(v as ProductStatus)}
+ onValueChange={(v) => setStatus(v as AssignableStatus)}
>
<SelectTrigger>
<SelectValue />
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/media.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/media.tsx
index 1b59f49303..7b4905dc5c 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/media.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/media.tsx
@@ -1,4 +1,5 @@
import type { Media, MediaUsageReference } from '@spree/admin-sdk'
+import { MEDIA_TYPES } from '@spree/core'
import {
adminClient,
Can,
@@ -72,7 +73,7 @@ import {
const PLACEMENT_FILTERS = ['all', 'attached', 'unattached'] as const
type PlacementFilter = (typeof PLACEMENT_FILTERS)[number]
-const TYPE_FILTERS = ['all', 'image', 'video', 'external_video'] as const
+const TYPE_FILTERS = ['all', ...MEDIA_TYPES] as const
type TypeFilter = (typeof TYPE_FILTERS)[number]
// Multiples of the widest grid (6 columns at lg), so a full page always ends
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/options.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/options.tsx
index 109e0a3594..f65d9b288d 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/options.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/options.tsx
@@ -16,6 +16,7 @@ import {
import { CSS } from '@dnd-kit/utilities'
import { zodResolver } from '@hookform/resolvers/zod'
import type { OptionType, OptionTypeCreateParams } from '@spree/admin-sdk'
+import { OPTION_TYPE_KINDS } from '@spree/core'
import {
adminClient,
Can,
@@ -97,7 +98,6 @@ import {
} from '../../../../hooks/use-option-types'
import {
OPTION_TYPE_DEFAULTS,
- OPTION_TYPE_KINDS,
type OptionTypeFormValues,
type OptionValueFormValue,
optionTypeFormSchema,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/sellers/$sellerId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/sellers/$sellerId.tsx
index fdb2d2c0d0..0d9cab95d3 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/sellers/$sellerId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/sellers/$sellerId.tsx
@@ -1,4 +1,5 @@
import type { Seller } from '@spree/admin-sdk'
+import { SELLER_STATUSES, subsetOf } from '@spree/core'
import { adminClient, PageHeader, Slot, Subject, usePermissions } from '@spree/dashboard-core'
import {
Badge,
@@ -39,6 +40,23 @@ import {
} from '../../../../hooks/use-sellers'
import { spreeJsonLinkResolver } from '../../../../lib/json-link-resolver'
+// Mirrors the workflow guards, so the operator is never offered a move the
+// server would refuse.
+const INVITABLE = subsetOf(SELLER_STATUSES, ['pending', 'invited', 'canceled'])
+const APPROVABLE = subsetOf(SELLER_STATUSES, [
+ 'onboarding',
+ 'ready_for_review',
+ 'suspended',
+ 'rejected',
+])
+const SUSPENDABLE = subsetOf(SELLER_STATUSES, ['approved', 'onboarding', 'ready_for_review'])
+const REJECTABLE = subsetOf(SELLER_STATUSES, [
+ 'pending',
+ 'invited',
+ 'onboarding',
+ 'ready_for_review',
+])
+
export const Route = createFileRoute('/_authenticated/$storeId/sellers/$sellerId')({
component: SellerDetailPage,
})
@@ -91,12 +109,10 @@ function SellerBody({ seller }: { seller: Seller }) {
const canEdit = permissions.can('update', Subject.Seller)
const status = seller.status
- // Mirrors the workflow guards, so the operator is never offered a move the
- // server would refuse.
- const canInvite = ['pending', 'invited', 'canceled'].includes(status)
- const canApprove = ['onboarding', 'ready_for_review', 'suspended', 'rejected'].includes(status)
- const canSuspend = ['approved', 'onboarding', 'ready_for_review'].includes(status)
- const canReject = ['pending', 'invited', 'onboarding', 'ready_for_review'].includes(status)
+ const canInvite = INVITABLE.includes(status)
+ const canApprove = APPROVABLE.includes(status)
+ const canSuspend = SUSPENDABLE.includes(status)
+ const canReject = REJECTABLE.includes(status)
const busy =
approveMutation.isPending || suspendMutation.isPending || rejectMutation.isPending || !canEdit
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/sellers/commission-rates.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/sellers/commission-rates.tsx
index 3eec370f29..863ea2505a 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/sellers/commission-rates.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/sellers/commission-rates.tsx
@@ -4,6 +4,7 @@ import type {
CommissionRateCreateParams,
CommissionRuleType,
} from '@spree/admin-sdk'
+import { COMMISSION_KINDS } from '@spree/core'
import {
adminClient,
Can,
@@ -75,7 +76,6 @@ import {
import { slugify } from '../../../../lib/slugify'
import {
COMMISSION_RATE_DEFAULTS,
- COMMISSION_RATE_KINDS,
type CommissionRateFormValues,
commissionRateFormSchema,
commissionRateToFormValues,
@@ -339,7 +339,7 @@ function CommissionRateFormFields({ form }: { form: UseFormReturn<CommissionRate
form.setValue('code', slugify(name ?? ''))
}, [name, form])
- const kindOptions = COMMISSION_RATE_KINDS.map((value) => ({
+ const kindOptions = COMMISSION_KINDS.map((value) => ({
value,
label: t(`admin.fields.commission_rate.kind.options.${value}`),
}))
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/sellers/payouts/$payoutId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/sellers/payouts/$payoutId.tsx
index 20d6b7e8da..8baf0e86b8 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/sellers/payouts/$payoutId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/sellers/payouts/$payoutId.tsx
@@ -32,9 +32,11 @@ import { useTranslation } from 'react-i18next'
import { ResourceDetailSkeleton } from '../../../../../components/spree/route-pending'
import { PayoutCompleteDialog } from '../../../../../components/spree/sellers/payout-complete-dialog'
import { ReadRow } from '../../../../../components/spree/sellers/seller-read-row'
-import { usePayout, useSellerTransfers } from '../../../../../hooks/use-seller-ledger'
-
-const OWED = ['pending', 'processing', 'unresolved']
+import {
+ OWED_PAYOUT_STATUSES,
+ usePayout,
+ useSellerTransfers,
+} from '../../../../../hooks/use-seller-ledger'
export const Route = createFileRoute('/_authenticated/$storeId/sellers/payouts/$payoutId')({
component: PayoutDetailPage,
@@ -75,7 +77,7 @@ function PayoutDetailPage() {
const rows = transfers?.data ?? []
const canComplete =
- permissions.can('update', Subject.SellerPayout) && OWED.includes(payout.status)
+ permissions.can('update', Subject.SellerPayout) && OWED_PAYOUT_STATUSES.includes(payout.status)
return (
<>
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/sellers/payouts/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/sellers/payouts/index.tsx
index 23eef6460a..4848474b06 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/sellers/payouts/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/sellers/payouts/index.tsx
@@ -12,13 +12,9 @@ import { createFileRoute, useNavigate } from '@tanstack/react-router'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
import { PayoutCompleteDialog } from '../../../../../components/spree/sellers/payout-complete-dialog'
+import { OWED_PAYOUT_STATUSES } from '../../../../../hooks/use-seller-ledger'
import '../../../../../tables/seller-ledger'
-// A settlement the sweep has written but nobody has confirmed. The workflow
-// accepts exactly these, so offering the action on anything else would
-// promise a move the server refuses.
-const OWED = ['pending', 'processing', 'unresolved']
-
export const Route = createFileRoute('/_authenticated/$storeId/sellers/payouts/')({
validateSearch: resourceSearchSchema,
component: SellerPayoutsPage,
@@ -59,7 +55,7 @@ function SellerPayoutsPage() {
key: 'complete',
label: t('admin.payouts.complete.action'),
icon: <CheckCircleIcon className="size-4" />,
- visible: canComplete && OWED.includes(payout.status),
+ visible: canComplete && OWED_PAYOUT_STATUSES.includes(payout.status),
onSelect: () => setCompleting(payout),
},
]}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/emails/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/emails/index.tsx
index 529822e934..469a12326d 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/emails/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/emails/index.tsx
@@ -1,5 +1,6 @@
import { zodResolver } from '@hookform/resolvers/zod'
import { SpreeError, type Store, type StoreUpdateParams } from '@spree/admin-sdk'
+import { EMAIL_FONTS } from '@spree/core'
import {
ImageUploadField,
mapSpreeErrorsToForm,
@@ -46,7 +47,6 @@ import { useEmailTemplatePreview } from '../../../../../hooks/use-email-template
import { useStoreSettings, useUpdateStoreSettings } from '../../../../../hooks/use-store-settings'
import {
EMAIL_BRANDING_COLORS,
- EMAIL_FONTS,
type StoreEmailsFormValues,
storeEmailsFormSchema,
} from '../../../../../schemas/store-emails'
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/emails/templates/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/emails/templates/index.tsx
index 9b14b70ff7..cc4a82571b 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/emails/templates/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/emails/templates/index.tsx
@@ -1,4 +1,5 @@
import type { EmailTemplate } from '@spree/admin-sdk'
+import { EMAIL_TEMPLATE_KINDS, type EmailTemplateKind } from '@spree/core'
import {
PageHeader,
Subject,
@@ -33,8 +34,6 @@ export const Route = createFileRoute('/_authenticated/$storeId/settings/emails/t
component: EmailTemplatesPage,
})
-const GROUPS = ['email', 'layout', 'partial'] as const
-
function EmailTemplatesPage() {
const { t } = useTranslation()
const { permissions } = usePermissions()
@@ -72,7 +71,7 @@ function EmailTemplatesPage() {
</CardContent>
</Card>
) : (
- GROUPS.map((kind) => (
+ EMAIL_TEMPLATE_KINDS.map((kind) => (
<TemplateGroup
key={kind}
kind={kind}
@@ -90,7 +89,7 @@ function TemplateGroup({
kind,
templates,
}: {
- kind: (typeof GROUPS)[number]
+ kind: EmailTemplateKind
templates: EmailTemplate[]
}) {
const { t } = useTranslation()
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/marketplace.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/marketplace.tsx
index 2fcbe56599..82134c9627 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/marketplace.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/marketplace.tsx
@@ -1,5 +1,6 @@
import { zodResolver } from '@hookform/resolvers/zod'
import { SpreeError, type Store } from '@spree/admin-sdk'
+import { PAYOUT_SCHEDULE_INTERVALS } from '@spree/core'
import {
currencyParts,
fractionToPercent,
@@ -58,7 +59,6 @@ import {
import {
type MarketplaceSettingsFormValues,
marketplaceSettingsFormSchema,
- PAYOUT_SCHEDULE_INTERVALS,
} from '../../../../schemas/marketplace'
export const Route = createFileRoute('/_authenticated/$storeId/settings/marketplace')({
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsx
index 4687c0c03e..0ba1cd4620 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsx
@@ -1,6 +1,14 @@
import { zodResolver } from '@hookform/resolvers/zod'
import { SpreeError, type Store, type StoreDataSourceProvider } from '@spree/admin-sdk'
-import { UNIT_SYSTEM_WEIGHT_UNITS, UNIT_SYSTEMS } from '@spree/core'
+import {
+ CAPTURE_METHODS,
+ DOCUMENT_NUMBER_FORMATS,
+ PROVIDER_FAILURE_POLICIES,
+ STOREFRONT_ACCESSES,
+ UNIT_SYSTEM_WEIGHT_UNITS,
+ UNIT_SYSTEMS,
+ type UnitSystem,
+} from '@spree/core'
import {
extensionFormValues,
extensionSubmitValues,
@@ -65,11 +73,7 @@ import {
} from '../../../../hooks/use-store-settings'
import { getAvailableUiLocales } from '../../../../i18n-setup'
import {
- CAPTURE_METHODS,
- DOCUMENT_NUMBER_FORMATS,
INTERNAL_PROVIDER_KEY,
- PROVIDER_FAILURE_POLICIES,
- STOREFRONT_ACCESS_LEVELS,
type StoreSettingsFormValues,
storeSettingsFormSchema,
} from '../../../../schemas/store'
@@ -109,10 +113,10 @@ function storeToFormValues(store: Store): StoreSettingsFormValues {
name: store.name,
admin_locale: store.admin_locale ?? '',
timezone: store.timezone,
- unit_system: (store.unit_system as 'metric' | 'imperial') ?? 'metric',
+ unit_system: (store.unit_system as UnitSystem) ?? 'metric',
weight_unit: store.weight_unit,
storefront_access:
- (store.storefront_access as (typeof STOREFRONT_ACCESS_LEVELS)[number]) ?? 'public',
+ (store.storefront_access as (typeof STOREFRONT_ACCESSES)[number]) ?? 'public',
guest_checkout: store.guest_checkout ?? true,
always_include_confirm_step: store.always_include_confirm_step ?? false,
company_field_enabled: store.company_field_enabled ?? false,
@@ -330,7 +334,7 @@ function StoreSettingsForm({ store }: { store: Store }) {
)
const storefrontAccessOptions = useMemo(
() =>
- STOREFRONT_ACCESS_LEVELS.map((value) => ({
+ STOREFRONT_ACCESSES.map((value) => ({
value,
label: t(`admin.fields.store.storefront_access.options.${value}`),
})),
diff --git a/packages/dashboard/src/schemas/catalog.ts b/packages/dashboard/src/schemas/catalog.ts
index 93557210ff..b4fcc1b5ee 100644
--- a/packages/dashboard/src/schemas/catalog.ts
+++ b/packages/dashboard/src/schemas/catalog.ts
@@ -1,5 +1,10 @@
import type { CatalogCreateParams, PriceList } from '@spree/admin-sdk'
-import { type CurrencyCode, compareMoney, negateMoney } from '@spree/core'
+import {
+ type CatalogAssignableType,
+ type CurrencyCode,
+ compareMoney,
+ negateMoney,
+} from '@spree/core'
import {
blankToNull,
isPositiveMoney,
@@ -216,7 +221,7 @@ export interface OrderMinimumEntry {
*/
export interface AssignmentEntry {
id?: string
- assignable_type: 'company' | 'customer_group'
+ assignable_type: CatalogAssignableType
assignable_id: string
assignable_name?: string | null
/**
diff --git a/packages/dashboard/src/schemas/channel.ts b/packages/dashboard/src/schemas/channel.ts
index ef2330726d..317f682a66 100644
--- a/packages/dashboard/src/schemas/channel.ts
+++ b/packages/dashboard/src/schemas/channel.ts
@@ -1,4 +1,5 @@
import type { ChannelCreateParams, ChannelUpdateParams } from '@spree/admin-sdk'
+import { STOREFRONT_ACCESSES } from '@spree/core'
import { requiredMessage } from '@spree/dashboard-ui'
import i18n from 'i18next'
import { z } from 'zod/v4'
@@ -11,7 +12,7 @@ export const ORDER_ROUTING_STRATEGY_VALUES = ['', RULES_ORDER_ROUTING_STRATEGY]
export type OrderRoutingStrategyValue = (typeof ORDER_ROUTING_STRATEGY_VALUES)[number]
// Empty string clears the channel-level override → falls back to store.
-export const STOREFRONT_ACCESS_VALUES = ['', 'public', 'prices_hidden', 'login_required'] as const
+export const STOREFRONT_ACCESS_VALUES = ['', ...STOREFRONT_ACCESSES] as const
// Tri-state form representation of the channel's boolean guest_checkout
// override: '' inherits the store value, 'true'/'false' set an explicit value.
diff --git a/packages/dashboard/src/schemas/collection.ts b/packages/dashboard/src/schemas/collection.ts
index 2f869b3795..ee5630b1d3 100644
--- a/packages/dashboard/src/schemas/collection.ts
+++ b/packages/dashboard/src/schemas/collection.ts
@@ -1,26 +1,15 @@
-import type { Collection, CollectionRuleParams, CollectionSortOrder } from '@spree/admin-sdk'
+import type { Collection, CollectionRuleParams } from '@spree/admin-sdk'
+import {
+ COLLECTION_RULE_MATCH_POLICIES,
+ COLLECTION_SORT_ORDERS,
+ type CollectionSortOrder,
+ MATCH_POLICIES,
+} from '@spree/core'
import { customFieldFormSchema, signedIdParam } from '@spree/dashboard-core'
import { requiredMessage } from '@spree/dashboard-ui'
import { z } from 'zod/v4'
import type { ProductMembershipStagingValue } from '../components/spree/product-membership-staging'
-/**
- * Canonical values only — labels are resolved at render time via
- * {@link sortOrderLabelKey}. The space-separated form is the server's own
- * vocabulary (Spree::Collection::SORT_ORDERS) and is what goes back on the
- * wire unchanged.
- */
-export const COLLECTION_SORT_ORDERS = [
- 'manual',
- 'best_selling',
- 'price asc',
- 'price desc',
- 'available_on desc',
- 'available_on asc',
- 'name asc',
- 'name desc',
-] as const satisfies ReadonlyArray<CollectionSortOrder>
-
/**
* Locale key for a sort order's label. The server vocabulary is
* space-separated (`price asc`) while the locale keys are underscored, so the
@@ -54,15 +43,6 @@ function knownMatchPolicy(value: string | null): CollectionRuleFormValues['match
: 'is_equal_to'
}
-export const COLLECTION_RULE_MATCH_POLICIES = [
- 'is_equal_to',
- 'is_not_equal_to',
- 'contains',
- 'does_not_contain',
-] as const
-
-export const COLLECTION_RULES_MATCH_POLICIES = ['all', 'any'] as const
-
// Each image field is a small state machine: untouched (omit on save),
// uploaded (send signed_id), or cleared (send null to purge).
const imageFields = {
@@ -101,7 +81,7 @@ export const collectionFormSchema = z.object({
meta_description: z.string(),
sort_order: z.enum(COLLECTION_SORT_ORDERS),
automatic: z.boolean(),
- rules_match_policy: z.enum(COLLECTION_RULES_MATCH_POLICIES),
+ rules_match_policy: z.enum(MATCH_POLICIES),
rules: z.array(collectionRuleSchema),
custom_fields: z.array(customFieldFormSchema).optional(),
...imageFields,
diff --git a/packages/dashboard/src/schemas/commission-rate.ts b/packages/dashboard/src/schemas/commission-rate.ts
index eef37f38b4..4d14fae045 100644
--- a/packages/dashboard/src/schemas/commission-rate.ts
+++ b/packages/dashboard/src/schemas/commission-rate.ts
@@ -3,18 +3,16 @@ import type {
CommissionRateCreateParams,
CommissionRateUpdateParams,
} from '@spree/admin-sdk'
-import { compareMoney, isDecimalString } from '@spree/core'
+import { COMMISSION_KINDS, compareMoney, isDecimalString } from '@spree/core'
import { blankToNull, fractionToPercent, i18n, percentToFraction } from '@spree/dashboard-core'
import { requiredMessage } from '@spree/dashboard-ui'
import { z } from 'zod/v4'
-export const COMMISSION_RATE_KINDS = ['percentage', 'fixed'] as const
-
const commissionRateFieldsSchema = z.object({
name: z.string().min(1, { error: requiredMessage('name') }),
code: z.string().optional(),
enabled: z.boolean(),
- kind: z.enum(COMMISSION_RATE_KINDS),
+ kind: z.enum(COMMISSION_KINDS),
// A canonical decimal string from a number input, sent as typed.
value: z
.string()
diff --git a/packages/dashboard/src/schemas/company.ts b/packages/dashboard/src/schemas/company.ts
index fb8f850f6d..64629e9277 100644
--- a/packages/dashboard/src/schemas/company.ts
+++ b/packages/dashboard/src/schemas/company.ts
@@ -3,12 +3,11 @@ import type {
TaxExemptionCertificateCreateParams,
TaxIdentifierCreateParams,
} from '@spree/admin-sdk'
+import { COMPANY_KINDS } from '@spree/core'
import { blankToNull, countryCodeSchema, signedIdParam } from '@spree/dashboard-core'
import { requiredMessage } from '@spree/dashboard-ui'
import { z } from 'zod/v4'
-export const COMPANY_KINDS = ['company', 'division'] as const
-
export const companyFormSchema = z.object({
name: z.string().min(1, { error: requiredMessage('name') }),
// Whether this buyer's own procurement process demands a PO reference on
diff --git a/packages/dashboard/src/schemas/delivery-zone.ts b/packages/dashboard/src/schemas/delivery-zone.ts
index 9d39c6b4f4..47585368ea 100644
--- a/packages/dashboard/src/schemas/delivery-zone.ts
+++ b/packages/dashboard/src/schemas/delivery-zone.ts
@@ -1,10 +1,9 @@
+import { DELIVERY_ZONE_MEMBER_TYPES } from '@spree/core'
import { countryCodeSchema } from '@spree/dashboard-core'
import { z } from 'zod/v4'
-export const MEMBER_TYPES = ['country', 'state', 'postal_code'] as const
-
export const deliveryZoneMemberSchema = z.object({
- member_type: z.enum(MEMBER_TYPES),
+ member_type: z.enum(DELIVERY_ZONE_MEMBER_TYPES),
country_code: countryCodeSchema.or(z.literal('')).optional(),
state_code: z.string().optional(),
postal_code_prefix: z.string().optional(),
diff --git a/packages/dashboard/src/schemas/inventory-operations.ts b/packages/dashboard/src/schemas/inventory-operations.ts
index f926331f0e..abd8b75c7b 100644
--- a/packages/dashboard/src/schemas/inventory-operations.ts
+++ b/packages/dashboard/src/schemas/inventory-operations.ts
@@ -1,41 +1,3 @@
-/**
- * Canonical status values for the two inventory documents, matching
- * `Spree::HasStatus` on the models. Values only — labels are built at render
- * time from `admin.stock_transfers.statuses.*` and
- * `admin.purchase_orders.statuses.*`.
- */
-export const STOCK_TRANSFER_STATUSES = [
- 'draft',
- 'ready_to_ship',
- 'in_transit',
- 'partially_received',
- 'received',
- 'over_received',
- 'canceled',
-] as const
-
-export type StockTransferStatus = (typeof STOCK_TRANSFER_STATUSES)[number]
-
-export const PURCHASE_ORDER_STATUSES = [
- 'draft',
- 'ordered',
- 'partially_received',
- 'received',
- 'over_received',
- 'canceled',
-] as const
-
-export type PurchaseOrderStatus = (typeof PURCHASE_ORDER_STATUSES)[number]
-
-/**
- * Why a delivery refused units, matching `Spree::StockReceiptItem::REJECTION_REASONS`.
- * A closed list: the server accepts nothing else, and a fixed vocabulary is
- * what makes the figures worth reporting on.
- */
-export const REJECTION_REASONS = ['damaged', 'wrong_item', 'expired', 'other'] as const
-
-export type RejectionReason = (typeof REJECTION_REASONS)[number]
-
/** What happens to units still in flight when a shipped transfer is called off. */
export const IN_TRANSIT_RESOLUTIONS = ['restock', 'write_off'] as const
diff --git a/packages/dashboard/src/schemas/marketplace.ts b/packages/dashboard/src/schemas/marketplace.ts
index c498a2490f..a9832cd13e 100644
--- a/packages/dashboard/src/schemas/marketplace.ts
+++ b/packages/dashboard/src/schemas/marketplace.ts
@@ -1,4 +1,4 @@
-import { compareMoney, isDecimalString } from '@spree/core'
+import { compareMoney, isDecimalString, PAYOUT_SCHEDULE_INTERVALS } from '@spree/core'
import { z } from 'zod'
const nonNegativeDecimal = z
@@ -6,15 +6,6 @@ const nonNegativeDecimal = z
.trim()
.refine((value) => isDecimalString(value) && !value.startsWith('-'))
-/** How often a marketplace settles its sellers, unless one carries its own. */
-export const PAYOUT_SCHEDULE_INTERVALS = [
- 'daily',
- 'weekly',
- 'biweekly',
- 'monthly',
- 'manual',
-] as const
-
export const marketplaceSettingsFormSchema = z.object({
// Blank is the built-in provider: the marketplace keeps the books and
// settles by hand.
diff --git a/packages/dashboard/src/schemas/option-type.ts b/packages/dashboard/src/schemas/option-type.ts
index 68754a0668..838c03fd91 100644
--- a/packages/dashboard/src/schemas/option-type.ts
+++ b/packages/dashboard/src/schemas/option-type.ts
@@ -1,12 +1,9 @@
import type { OptionValue, OptionValueParams } from '@spree/admin-sdk'
+import { OPTION_TYPE_KINDS } from '@spree/core'
import { i18n, signedIdParam } from '@spree/dashboard-core'
import { requiredMessage } from '@spree/dashboard-ui'
import { z } from 'zod/v4'
-// Labels live in `en.json` under `admin.products.options.kinds.*` — consumers
-// translate at render time.
-export const OPTION_TYPE_KINDS = ['dropdown', 'color_swatch', 'buttons'] as const
-
const HEX_RE = /^#[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$/
export const optionValueSchema = z.object({
diff --git a/packages/dashboard/src/schemas/order.ts b/packages/dashboard/src/schemas/order.ts
index 77980c44aa..8dc4d7635c 100644
--- a/packages/dashboard/src/schemas/order.ts
+++ b/packages/dashboard/src/schemas/order.ts
@@ -1,5 +1,5 @@
import type { LineItem, OrderUpdateParams } from '@spree/admin-sdk'
-import { isDecimalString, multiplyMoney, sumMoney } from '@spree/core'
+import { FEE_KINDS, isDecimalString, multiplyMoney, subsetOf, sumMoney } from '@spree/core'
import { fulfilledQuantities, type GroupableFulfillment, i18n } from '@spree/dashboard-core'
import { z } from 'zod/v4'
@@ -53,15 +53,17 @@ export const NEW_ORDER_DEFAULTS: NewOrderFormValues = {
}
/**
- * Fee kinds offered when adding a manual fee to an order. The backend accepts
- * any string, so this is the curated admin-facing set, not a DB constraint.
+ * Fee kinds offered when adding a manual fee to an order. `exchange` is left
+ * out: Spree writes it itself, so it is labelled on the order but never offered.
*/
-export const FEE_KINDS = ['surcharge', 'handling', 'gift_wrap', 'cod', 'payment', 'duty'] as const
-
-export type FeeKind = (typeof FEE_KINDS)[number]
-
-/** Kinds Spree writes itself — labelled on the order, never offered when adding a fee. */
-export const SYSTEM_FEE_KINDS = ['exchange'] as const
+export const MANUAL_FEE_KINDS = subsetOf(FEE_KINDS, [
+ 'surcharge',
+ 'handling',
+ 'gift_wrap',
+ 'cod',
+ 'payment',
+ 'duty',
+])
/**
* One row of the order edit table. Everything here is a primitive on purpose:
diff --git a/packages/dashboard/src/schemas/payment-method.ts b/packages/dashboard/src/schemas/payment-method.ts
index 68acb93ddb..7705561727 100644
--- a/packages/dashboard/src/schemas/payment-method.ts
+++ b/packages/dashboard/src/schemas/payment-method.ts
@@ -1,7 +1,7 @@
import type { PaymentMethodCreateParams, PaymentMethodUpdateParams } from '@spree/admin-sdk'
+import { CAPTURE_METHODS } from '@spree/core'
import { requiredMessage } from '@spree/dashboard-ui'
import { z } from 'zod/v4'
-import { CAPTURE_METHODS } from './store'
// Empty means "inherit from the store" — the API models that as null, so the
// form's empty option maps back to null on submit.
diff --git a/packages/dashboard/src/schemas/price-list.ts b/packages/dashboard/src/schemas/price-list.ts
index 0862b48299..b32a147b3d 100644
--- a/packages/dashboard/src/schemas/price-list.ts
+++ b/packages/dashboard/src/schemas/price-list.ts
@@ -4,7 +4,7 @@ import type {
PriceListUpdateParams,
PriceRule,
} from '@spree/admin-sdk'
-import { isDecimalString, isZeroMoney } from '@spree/core'
+import { isDecimalString, isZeroMoney, MATCH_POLICIES } from '@spree/core'
import {
blankToNull,
defaultPreferences,
@@ -16,9 +16,6 @@ import i18n from 'i18next'
import { z } from 'zod/v4'
import type { ProductMembershipStagingValue } from '../components/spree/product-membership-staging'
-export const MATCH_POLICIES = ['all', 'any'] as const
-export type MatchPolicy = (typeof MATCH_POLICIES)[number]
-
/**
* How a list produces prices. `fixed` prices only what it holds explicit
* rows for — every list that existed before automatic pricing. `automatic`
diff --git a/packages/dashboard/src/schemas/promotion.ts b/packages/dashboard/src/schemas/promotion.ts
index 3b5c2582dc..9c567f181b 100644
--- a/packages/dashboard/src/schemas/promotion.ts
+++ b/packages/dashboard/src/schemas/promotion.ts
@@ -1,3 +1,4 @@
+import { MATCH_POLICIES } from '@spree/core'
import { emptyToUndefined, i18n } from '@spree/dashboard-core'
import { requiredMessage } from '@spree/dashboard-ui'
import { z } from 'zod/v4'
@@ -7,7 +8,6 @@ import type {
} from '../components/spree/promotion-editors/types'
export type PromotionKind = 'coupon_code' | 'automatic'
-export type MatchPolicy = 'all' | 'any'
// Labels live in `en.json` under `admin.promotions.kinds.*` and
// `admin.promotions.match_policies.*`. Consumers translate at render time.
@@ -15,7 +15,6 @@ export const PROMOTION_KINDS = [
'coupon_code',
'automatic',
] as const satisfies ReadonlyArray<PromotionKind>
-export const MATCH_POLICIES = ['all', 'any'] as const satisfies ReadonlyArray<MatchPolicy>
/**
* Promotion form schema.
@@ -47,7 +46,7 @@ export const promotionFormSchema = z
starts_at: z.string(),
expires_at: z.string(),
usage_limit: z.preprocess(emptyToUndefined, z.coerce.number().int().positive().optional()),
- match_policy: z.enum(['all', 'any']),
+ match_policy: z.enum(MATCH_POLICIES),
// Rule/action drafts are owned by the editor components; we accept whatever
// shape they emit and let the server's rule/action serializers validate.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
diff --git a/packages/dashboard/src/schemas/seller.ts b/packages/dashboard/src/schemas/seller.ts
index 5dfa1f0fab..42ec7c9a70 100644
--- a/packages/dashboard/src/schemas/seller.ts
+++ b/packages/dashboard/src/schemas/seller.ts
@@ -1,29 +1,9 @@
import type { SellerCreateParams } from '@spree/admin-sdk'
+import { PAYOUT_SCHEDULE_INTERVALS, TAX_REMITTANCES } from '@spree/core'
import { blankToNull, signedIdParam } from '@spree/dashboard-core'
import { requiredMessage } from '@spree/dashboard-ui'
import { z } from 'zod/v4'
-/**
- * The lifecycle, in the order a seller normally travels it. `status` is
- * never part of a form: each move is its own workflow on the server, so the
- * list here is only for rendering labels and filters.
- */
-export const SELLER_STATUSES = [
- 'pending',
- 'invited',
- 'onboarding',
- 'ready_for_review',
- 'approved',
- 'suspended',
- 'rejected',
- 'canceled',
-] as const
-
-export type SellerStatus = (typeof SELLER_STATUSES)[number]
-
-export const TAX_REMITTANCES = ['seller', 'platform'] as const
-export const PAYOUT_INTERVALS = ['daily', 'weekly', 'biweekly', 'monthly', 'manual'] as const
-
export const sellerFormSchema = z.object({
name: z
.string()
@@ -34,7 +14,7 @@ export const sellerFormSchema = z.object({
billing_email: z.email().or(z.literal('')).optional(),
about: z.string().optional(),
tax_remittance: z.enum(TAX_REMITTANCES).optional(),
- payouts_schedule_interval: z.enum(PAYOUT_INTERVALS).or(z.literal('')).optional(),
+ payouts_schedule_interval: z.enum(PAYOUT_SCHEDULE_INTERVALS).or(z.literal('')).optional(),
minimum_payout_amount: z.string().trim().optional(),
holiday_mode_until: z.string().optional(),
// Three-state image fields, one triple per attachment. See ResourceImageField.
diff --git a/packages/dashboard/src/schemas/store-emails.ts b/packages/dashboard/src/schemas/store-emails.ts
index cb15d5420d..b941a4473e 100644
--- a/packages/dashboard/src/schemas/store-emails.ts
+++ b/packages/dashboard/src/schemas/store-emails.ts
@@ -1,3 +1,4 @@
+import { EMAIL_FONTS } from '@spree/core'
import { requiredMessage } from '@spree/dashboard-ui'
import { z } from 'zod/v4'
@@ -12,17 +13,6 @@ const optionalColor = z
.nullable()
.optional()
-/** Fonts customer emails can use; mirrors `Spree::Emails::Branding::FONTS`. */
-export const EMAIL_FONTS = [
- 'inter',
- 'system',
- 'helvetica',
- 'georgia',
- 'roboto',
- 'lato',
- 'merriweather',
-] as const
-
/** Colors customer emails can be branded with, in the order the card shows them. */
export const EMAIL_BRANDING_COLORS = [
'accent_color',
diff --git a/packages/dashboard/src/schemas/store.ts b/packages/dashboard/src/schemas/store.ts
index 6f2bfaf61d..4e9e981ac2 100644
--- a/packages/dashboard/src/schemas/store.ts
+++ b/packages/dashboard/src/schemas/store.ts
@@ -1,32 +1,18 @@
-import { WeightUnit } from '@spree/core'
+import {
+ CAPTURE_METHODS,
+ DOCUMENT_NUMBER_FORMATS,
+ PROVIDER_FAILURE_POLICIES,
+ STOREFRONT_ACCESSES,
+ UNIT_SYSTEMS,
+ WeightUnit,
+} from '@spree/core'
import { requiredMessage } from '@spree/dashboard-ui'
import { z } from 'zod/v4'
-// Store-wide storefront posture. Unlike the channel field there is no blank
-// "inherit" option — the store is the terminal fallback in the resolution
-// chain, so it always holds a concrete value. Labels live in `en.json` under
-// `admin.fields.store.storefront_access.options.*`.
-export const STOREFRONT_ACCESS_LEVELS = ['public', 'prices_hidden', 'login_required'] as const
-
-/**
- * How document numbers are produced. `sequential` counts up from a starting
- * value; `random` is the pre-6.0 behaviour, opted into by merchants who would
- * rather not disclose order volume. Labels live in `en.json` under
- * `admin.fields.store.document_number_format.options.*`.
- */
-export const DOCUMENT_NUMBER_FORMATS = ['sequential', 'random'] as const
-
// Prefix/suffix accept the characters that read cleanly on an invoice and
// survive a phone call: uppercase letters, digits, dash and hash.
const NUMBER_AFFIX_PATTERN = /^[A-Z0-9#-]*$/
-// When customers are charged rather than only authorized. A payment method may
-// override this; the store is the terminal fallback, so it always holds a
-// concrete value. Labels live in `en.json` under
-// `admin.fields.store.capture_method.options.*`.
-export const CAPTURE_METHODS = ['checkout', 'on_dispatch', 'manual'] as const
-/** What a store does when its pricing or inventory provider cannot answer. */
-export const PROVIDER_FAILURE_POLICIES = ['strict', 'fallback'] as const
/** Spree's own catalog and stock records — the default for both providers. */
export const INTERNAL_PROVIDER_KEY = 'internal'
@@ -34,9 +20,9 @@ export const storeSettingsFormSchema = z.object({
name: z.string().min(1, { error: requiredMessage('store.name') }),
admin_locale: z.string().nullable().optional(),
timezone: z.string().min(1, { error: requiredMessage('store.timezone') }),
- unit_system: z.enum(['metric', 'imperial']),
+ unit_system: z.enum(UNIT_SYSTEMS),
weight_unit: z.enum(WeightUnit),
- storefront_access: z.enum(STOREFRONT_ACCESS_LEVELS),
+ storefront_access: z.enum(STOREFRONT_ACCESSES),
guest_checkout: z.boolean(),
always_include_confirm_step: z.boolean(),
company_field_enabled: z.boolean(),
diff --git a/packages/dashboard/src/tables/companies.tsx b/packages/dashboard/src/tables/companies.tsx
index 75d4984b36..aa638cbe95 100644
--- a/packages/dashboard/src/tables/companies.tsx
+++ b/packages/dashboard/src/tables/companies.tsx
@@ -1,4 +1,5 @@
import type { Company } from '@spree/admin-sdk'
+import { COMPANY_KINDS } from '@spree/core'
import { defineTable } from '@spree/dashboard-core'
import { RelativeTime, ResourceNameCell } from '@spree/dashboard-ui'
import { Building2Icon } from '@spree/dashboard-ui/icons'
@@ -41,10 +42,10 @@ defineTable<Company>('companies', {
sortable: true,
filterable: true,
filterType: 'enum',
- filterOptions: [
- { value: 'company', label: i18n.t('admin.companies.kind.company') },
- { value: 'division', label: i18n.t('admin.companies.kind.division') },
- ],
+ filterOptions: COMPANY_KINDS.map((kind) => ({
+ value: kind,
+ label: i18n.t(`admin.companies.kind.${kind}`),
+ })),
quickFilter: true,
default: true,
render: (company) => <CompanyKindBadge kind={company.kind} />,
diff --git a/packages/dashboard/src/tables/gift-cards.tsx b/packages/dashboard/src/tables/gift-cards.tsx
index f3b31fef09..d5f1a9d146 100644
--- a/packages/dashboard/src/tables/gift-cards.tsx
+++ b/packages/dashboard/src/tables/gift-cards.tsx
@@ -1,4 +1,5 @@
import type { GiftCard } from '@spree/admin-sdk'
+import { GIFT_CARD_STATUSES, subsetOf } from '@spree/core'
import { defineTable, Money } from '@spree/dashboard-core'
import { Badge, RelativeTime, ResourceNameCell, StatusBadge } from '@spree/dashboard-ui'
import { GiftIcon } from '@spree/dashboard-ui/icons'
@@ -9,16 +10,14 @@ import { giftCardBatchAutocompleteProps } from '../hooks/use-gift-cards'
import { erasedFieldValue } from '../lib/erased-customer'
import { translatedLabel } from '../lib/translated-label'
-// Server `Spree::GiftCard#display_status` exposes "expired" when the card
-// is past its expiration date, even though the underlying column is still
-// "active" — keep this list in sync with the statuses + display_status
-// override in `app/models/spree/gift_card.rb`.
-const STATUS_OPTIONS = [
- { value: 'active', label: i18n.t('admin.fields.active.label') },
- { value: 'partially_redeemed', label: i18n.t('admin.gift_cards.statuses.partially_redeemed') },
- { value: 'redeemed', label: i18n.t('admin.gift_cards.statuses.redeemed') },
- { value: 'canceled', label: i18n.t('admin.gift_cards.statuses.canceled') },
-] as const
+// The filter reads the stored status. `expired` is shown on a card past its
+// expiration date, but the column still says `active`, so it cannot be filtered.
+const FILTERABLE_STATUSES = subsetOf(GIFT_CARD_STATUSES, [
+ 'active',
+ 'partially_redeemed',
+ 'redeemed',
+ 'canceled',
+])
function statusLabel(value: string): string {
return translatedLabel('admin.gift_cards.statuses', value)
@@ -59,8 +58,7 @@ defineTable<GiftCard>('gift-cards', {
ransackAttribute: 'status',
filterable: true,
filterType: 'enum',
- // Spread to narrow the readonly type into ColumnDef's mutable shape.
- filterOptions: STATUS_OPTIONS.map(({ value, label }) => ({ value, label })),
+ filterOptions: FILTERABLE_STATUSES.map((value) => ({ value, label: statusLabel(value) })),
quickFilter: true,
default: true,
render: (g) => {
diff --git a/packages/dashboard/src/tables/imports.tsx b/packages/dashboard/src/tables/imports.tsx
index 9e4f77ef72..00f4d4253d 100644
--- a/packages/dashboard/src/tables/imports.tsx
+++ b/packages/dashboard/src/tables/imports.tsx
@@ -1,19 +1,11 @@
import type { Import } from '@spree/admin-sdk'
+import { IMPORT_STATUSES } from '@spree/core'
import { defineTable } from '@spree/dashboard-core'
import { RelativeTime, ResourceNameCell, StatusBadge } from '@spree/dashboard-ui'
import { UploadIcon } from '@spree/dashboard-ui/icons'
import i18n from 'i18next'
import { importTypeLabel } from '../lib/import-types'
-const IMPORT_STATUSES = [
- 'pending',
- 'mapping',
- 'completed_mapping',
- 'processing',
- 'completed',
- 'failed',
-]
-
defineTable<Import>('imports', {
title: i18n.t('admin.pages.settings.imports.title'),
docsPath: 'manage-products/import-products',
diff --git a/packages/dashboard/src/tables/option-types.tsx b/packages/dashboard/src/tables/option-types.tsx
index aecaca5220..29424362f9 100644
--- a/packages/dashboard/src/tables/option-types.tsx
+++ b/packages/dashboard/src/tables/option-types.tsx
@@ -1,10 +1,11 @@
import type { OptionType } from '@spree/admin-sdk'
+import type { OptionTypeKind } from '@spree/core'
import { defineTable } from '@spree/dashboard-core'
import { ActiveBadge, Badge, ResourceNameCell } from '@spree/dashboard-ui'
import { ListChecksIcon } from '@spree/dashboard-ui/icons'
import i18n from 'i18next'
-const KIND_LABELS: Record<string, string> = {
+const KIND_LABELS: Record<OptionTypeKind, string> = {
dropdown: i18n.t('admin.option_types.kinds.dropdown'),
color_swatch: i18n.t('admin.option_types.kinds.color_swatch'),
buttons: i18n.t('admin.option_types.kinds.buttons'),
diff --git a/packages/dashboard/src/tables/orders.tsx b/packages/dashboard/src/tables/orders.tsx
index f4cc622a73..9ab5b0cef8 100644
--- a/packages/dashboard/src/tables/orders.tsx
+++ b/packages/dashboard/src/tables/orders.tsx
@@ -1,4 +1,10 @@
-import { defineTable, LocaleLabel, Money } from '@spree/dashboard-core'
+import { ORDER_PAYMENT_STATUSES } from '@spree/core'
+import {
+ defineTable,
+ FILTERABLE_ORDER_FULFILLMENT_STATUSES,
+ LocaleLabel,
+ Money,
+} from '@spree/dashboard-core'
import { RelativeTime, StatusBadge, TagList } from '@spree/dashboard-ui'
import { ShoppingCartIcon } from '@spree/dashboard-ui/icons'
import { Link } from '@tanstack/react-router'
@@ -90,19 +96,10 @@ defineTable('orders', {
filterable: true,
default: true,
filterType: 'enum',
- filterOptions: [
- { value: 'none', label: i18n.t('admin.orders.payment_statuses.none') },
- { value: 'authorized', label: i18n.t('admin.orders.payment_statuses.authorized') },
- { value: 'partially_paid', label: i18n.t('admin.orders.payment_statuses.partially_paid') },
- { value: 'paid', label: i18n.t('admin.orders.payment_statuses.paid') },
- {
- value: 'partially_refunded',
- label: i18n.t('admin.orders.payment_statuses.partially_refunded'),
- },
- { value: 'refunded', label: i18n.t('admin.orders.payment_statuses.refunded') },
- { value: 'overcharged', label: i18n.t('admin.orders.payment_statuses.overcharged') },
- { value: 'voided', label: i18n.t('admin.orders.payment_statuses.voided') },
- ],
+ filterOptions: ORDER_PAYMENT_STATUSES.map((status) => ({
+ value: status,
+ label: i18n.t(`admin.orders.payment_statuses.${status}`),
+ })),
quickFilter: true,
render: (order) =>
order.payment_status ? (
@@ -121,14 +118,10 @@ defineTable('orders', {
filterable: true,
default: true,
filterType: 'enum',
- filterOptions: [
- { value: 'backorder', label: i18n.t('admin.orders.fulfillment_statuses.backorder') },
- { value: 'canceled', label: i18n.t('admin.orders.fulfillment_statuses.canceled') },
- { value: 'partial', label: i18n.t('admin.orders.fulfillment_statuses.partial') },
- { value: 'unfulfilled', label: i18n.t('admin.orders.fulfillment_statuses.unfulfilled') },
- { value: 'fulfilled', label: i18n.t('admin.orders.fulfillment_statuses.fulfilled') },
- { value: 'delivered', label: i18n.t('admin.orders.fulfillment_statuses.delivered') },
- ],
+ filterOptions: FILTERABLE_ORDER_FULFILLMENT_STATUSES.map((status) => ({
+ value: status,
+ label: i18n.t(`admin.orders.fulfillment_statuses.${status}`),
+ })),
quickFilter: true,
render: (order) =>
order.fulfillment_status ? (
diff --git a/packages/dashboard/src/tables/post-sale.tsx b/packages/dashboard/src/tables/post-sale.tsx
index 0bb1da8316..14b616da01 100644
--- a/packages/dashboard/src/tables/post-sale.tsx
+++ b/packages/dashboard/src/tables/post-sale.tsx
@@ -1,4 +1,5 @@
import type { Claim, Exchange, Return } from '@spree/admin-sdk'
+import { CLAIM_STATUSES, EXCHANGE_STATUSES, RETURN_STATUSES } from '@spree/core'
import { defineTable, Money } from '@spree/dashboard-core'
import { RelativeTime, StatusBadge } from '@spree/dashboard-ui'
import { RepeatIcon, RotateCcwIcon, ShieldAlertIcon } from '@spree/dashboard-ui/icons'
@@ -28,7 +29,7 @@ function statusLabel(value: string): string {
return translatedLabel('admin.post_sale.statuses', value)
}
-function statusColumn(values: string[]) {
+function statusColumn(values: readonly string[]) {
return {
key: 'status',
label: i18n.t('admin.fields.status.label'),
@@ -81,7 +82,7 @@ defineTable<Return>('returns', {
default: true,
render: (r) => numberCell(r),
},
- statusColumn(['requested', 'approved', 'received', 'refunded', 'canceled']),
+ statusColumn(RETURN_STATUSES),
orderColumn<Return>(),
{
key: 'refund_total',
@@ -112,7 +113,7 @@ defineTable<Exchange>('exchanges', {
default: true,
render: (e) => numberCell(e),
},
- statusColumn(['requested', 'approved', 'received', 'fulfilled', 'canceled']),
+ statusColumn(EXCHANGE_STATUSES),
orderColumn<Exchange>(),
{
key: 'price_difference',
@@ -143,7 +144,7 @@ defineTable<Claim>('claims', {
default: true,
render: (c) => numberCell(c),
},
- statusColumn(['open', 'approved', 'resolved', 'denied', 'canceled']),
+ statusColumn(CLAIM_STATUSES),
orderColumn<Claim>(),
createdColumn<Claim>(),
],
diff --git a/packages/dashboard/src/tables/price-lists.tsx b/packages/dashboard/src/tables/price-lists.tsx
index 957eb34287..6f31199228 100644
--- a/packages/dashboard/src/tables/price-lists.tsx
+++ b/packages/dashboard/src/tables/price-lists.tsx
@@ -1,4 +1,5 @@
import type { PriceList } from '@spree/admin-sdk'
+import { PRICE_LIST_STATUSES } from '@spree/core'
import { defineTable } from '@spree/dashboard-core'
import { ResourceNameCell } from '@spree/dashboard-ui'
import { TagsIcon } from '@spree/dashboard-ui/icons'
@@ -35,12 +36,10 @@ defineTable<PriceList>('price-lists', {
sortable: true,
filterable: true,
filterType: 'enum',
- filterOptions: [
- { value: 'draft', label: i18n.t('admin.fields.price_list.status.draft') },
- { value: 'active', label: i18n.t('admin.fields.price_list.status.active') },
- { value: 'scheduled', label: i18n.t('admin.fields.price_list.status.scheduled') },
- { value: 'inactive', label: i18n.t('admin.fields.price_list.status.inactive') },
- ],
+ filterOptions: PRICE_LIST_STATUSES.map((status) => ({
+ value: status,
+ label: i18n.t(`admin.fields.price_list.status.${status}`),
+ })),
quickFilter: true,
default: true,
// Filters the stored `status`, which is the only thing the API can
diff --git a/packages/dashboard/src/tables/products.tsx b/packages/dashboard/src/tables/products.tsx
index 891bc76524..22f68f22d8 100644
--- a/packages/dashboard/src/tables/products.tsx
+++ b/packages/dashboard/src/tables/products.tsx
@@ -1,5 +1,5 @@
import type { Channel } from '@spree/admin-sdk'
-import { defineTable, formatPrice } from '@spree/dashboard-core'
+import { ASSIGNABLE_PRODUCT_STATUSES, defineTable, formatPrice } from '@spree/dashboard-core'
import { StatusBadge, TagList, Thumbnail } from '@spree/dashboard-ui'
import { PackageIcon } from '@spree/dashboard-ui/icons'
import { Link } from '@tanstack/react-router'
@@ -45,11 +45,10 @@ defineTable('products', {
default: true,
filterType: 'enum',
quickFilter: true,
- filterOptions: [
- { value: 'draft', label: i18n.t('admin.pages.products.status_options.draft') },
- { value: 'active', label: i18n.t('admin.fields.active.label') },
- { value: 'archived', label: i18n.t('admin.pages.products.status_options.archived') },
- ],
+ filterOptions: ASSIGNABLE_PRODUCT_STATUSES.map((status) => ({
+ value: status,
+ label: i18n.t(`admin.pages.products.status_options.${status}`),
+ })),
render: (product) => <StatusBadge status={product.status} />,
},
{
diff --git a/packages/dashboard/src/tables/purchase-orders.tsx b/packages/dashboard/src/tables/purchase-orders.tsx
index ba79246db9..b4c42e11c9 100644
--- a/packages/dashboard/src/tables/purchase-orders.tsx
+++ b/packages/dashboard/src/tables/purchase-orders.tsx
@@ -1,10 +1,11 @@
import type { PurchaseOrder } from '@spree/admin-sdk'
+import { PURCHASE_ORDER_STATUSES } from '@spree/core'
import { defineTable, Money } from '@spree/dashboard-core'
import { Badge, RelativeTime, ResourceNameCell, StatusBadge } from '@spree/dashboard-ui'
import { TruckIcon } from '@spree/dashboard-ui/icons'
import i18n from 'i18next'
import { supplierAutocompleteProps } from '../hooks/use-suppliers'
-import { isClosed, PURCHASE_ORDER_STATUSES } from '../schemas/inventory-operations'
+import { isClosed } from '../schemas/inventory-operations'
// A calendar day, compared as text: both sides are `yyyy-mm-dd`. Display
// only — the list filters below are answered by the server's own scopes.
diff --git a/packages/dashboard/src/tables/seller-ledger.tsx b/packages/dashboard/src/tables/seller-ledger.tsx
index 64d242073b..f653b79b44 100644
--- a/packages/dashboard/src/tables/seller-ledger.tsx
+++ b/packages/dashboard/src/tables/seller-ledger.tsx
@@ -1,4 +1,9 @@
import type { SellerPayout, SellerTransfer } from '@spree/admin-sdk'
+import {
+ SELLER_PAYOUT_STATUSES,
+ SELLER_TRANSFER_KINDS,
+ SELLER_TRANSFER_STATUSES,
+} from '@spree/core'
import { defineTable, formatStoreDateTime, Money, useStore } from '@spree/dashboard-core'
import { ResourceNameCell, StatusBadge } from '@spree/dashboard-ui'
import { BanknoteIcon, HandCoinsIcon } from '@spree/dashboard-ui/icons'
@@ -19,11 +24,8 @@ function LedgerDate({ iso }: { iso: string }) {
return <>{formatStoreDateTime(iso, timezone)}</>
}
-const LEDGER_STATUSES = ['pending', 'processing', 'completed', 'failed', 'unresolved'] as const
-const TRANSFER_KINDS = ['earning', 'refund_reversal'] as const
-
-function statusOptions() {
- return LEDGER_STATUSES.map((status) => ({
+function statusOptions(statuses: readonly string[]) {
+ return statuses.map((status) => ({
value: status,
label: i18n.t(`admin.payouts.statuses.${status}`),
}))
@@ -97,7 +99,7 @@ defineTable<SellerTransfer>('seller-transfers', {
label: i18n.t('admin.payouts.columns.kind'),
filterable: true,
filterType: 'enum',
- filterOptions: TRANSFER_KINDS.map((kind) => ({
+ filterOptions: SELLER_TRANSFER_KINDS.map((kind) => ({
value: kind,
label: i18n.t(`admin.payouts.kinds.${kind}`),
})),
@@ -112,7 +114,7 @@ defineTable<SellerTransfer>('seller-transfers', {
sortable: true,
filterable: true,
filterType: 'enum',
- filterOptions: statusOptions(),
+ filterOptions: statusOptions(SELLER_TRANSFER_STATUSES),
quickFilter: true,
default: true,
render: (transfer) => (
@@ -195,7 +197,7 @@ defineTable<SellerPayout>('seller-payouts', {
sortable: true,
filterable: true,
filterType: 'enum',
- filterOptions: statusOptions(),
+ filterOptions: statusOptions(SELLER_PAYOUT_STATUSES),
quickFilter: true,
default: true,
render: (payout) => (
diff --git a/packages/dashboard/src/tables/sellers.tsx b/packages/dashboard/src/tables/sellers.tsx
index b9ca5d2ade..7ea74cc89a 100644
--- a/packages/dashboard/src/tables/sellers.tsx
+++ b/packages/dashboard/src/tables/sellers.tsx
@@ -1,10 +1,10 @@
import type { Seller } from '@spree/admin-sdk'
+import { SELLER_STATUSES } from '@spree/core'
import { defineTable, progressPercentage } from '@spree/dashboard-core'
import { Progress, RelativeTime, StatusBadge } from '@spree/dashboard-ui'
import { StoreIcon } from '@spree/dashboard-ui/icons'
import { Link } from '@tanstack/react-router'
import i18n from 'i18next'
-import { SELLER_STATUSES } from '../schemas/seller'
defineTable<Seller>('sellers', {
docsPath: 'sellers/managing-sellers',
diff --git a/packages/dashboard/src/tables/stock-transfers.tsx b/packages/dashboard/src/tables/stock-transfers.tsx
index 22271d0479..11c7acacfb 100644
--- a/packages/dashboard/src/tables/stock-transfers.tsx
+++ b/packages/dashboard/src/tables/stock-transfers.tsx
@@ -1,9 +1,9 @@
import type { StockTransfer } from '@spree/admin-sdk'
+import { STOCK_TRANSFER_STATUSES } from '@spree/core'
import { defineTable } from '@spree/dashboard-core'
import { RelativeTime, ResourceNameCell, StatusBadge } from '@spree/dashboard-ui'
import { ArrowLeftRightIcon } from '@spree/dashboard-ui/icons'
import i18n from 'i18next'
-import { STOCK_TRANSFER_STATUSES } from '../schemas/inventory-operations'
function statusLabel(value: string): string {
return i18n.t(`admin.stock_transfers.statuses.${value}`)
diff --git a/packages/sdk/src/types/generated/Claim.ts b/packages/sdk/src/types/generated/Claim.ts
index afbedc3ac0..9bcbc450cb 100644
--- a/packages/sdk/src/types/generated/Claim.ts
+++ b/packages/sdk/src/types/generated/Claim.ts
@@ -1,13 +1,13 @@
-// Typelizer digest ef87731277e11830c562eee0219e802d
+// Typelizer digest dd9393ed06c69bf8cb3de3d1f78e63aa
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {ClaimReason, ClaimLineItem, ClaimStatus} from '@/types'
+import type {ClaimReason, ClaimLineItem, ClaimStatus, ClaimResolution} from '@/types'
interface Claim {
id: string;
number: string;
status: ClaimStatus;
- resolution: string | null;
+ resolution: ClaimResolution | null;
order_id: string | null;
reason_id: string | null;
refund_total: string | null;
diff --git a/packages/sdk/src/types/generated/Collection.ts b/packages/sdk/src/types/generated/Collection.ts
index 05678c63ff..9e20abe676 100644
--- a/packages/sdk/src/types/generated/Collection.ts
+++ b/packages/sdk/src/types/generated/Collection.ts
@@ -1,14 +1,14 @@
-// Typelizer digest a7e6fd6063a93a58924c567439e30449
+// Typelizer digest b788daa6462c15850090a31348532def
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {CustomField} from '@/types'
+import type {CustomField, CollectionSortOrder} from '@/types'
interface Collection {
id: string;
name: string;
permalink: string;
position: number;
- sort_order: string;
+ sort_order: CollectionSortOrder;
meta_title: string | null;
meta_description: string | null;
meta_keywords: string | null;
diff --git a/packages/sdk/src/types/generated/Company.ts b/packages/sdk/src/types/generated/Company.ts
index b1261419b7..7b5ea9890a 100644
--- a/packages/sdk/src/types/generated/Company.ts
+++ b/packages/sdk/src/types/generated/Company.ts
@@ -1,11 +1,12 @@
-// Typelizer digest 0364b44dd5143e883d0a2c7e4db2896e
+// Typelizer digest 6c9e2e97df228e41fb7b8d9fe200def2
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
+import type {CompanyKind} from '@/types'
interface Company {
id: string;
name: string;
- kind: 'company' | 'division';
+ kind: CompanyKind;
po_number_required: boolean;
parent_id: string | null;
ancestors: Array<{id: string, name: string, kind: string}>;
diff --git a/packages/sdk/src/types/generated/CompanyInvitation.ts b/packages/sdk/src/types/generated/CompanyInvitation.ts
index 090e90976b..d4aa8b74c7 100644
--- a/packages/sdk/src/types/generated/CompanyInvitation.ts
+++ b/packages/sdk/src/types/generated/CompanyInvitation.ts
@@ -1,13 +1,14 @@
-// Typelizer digest 1e87e9fa9f3731e3047bde04bfbc091d
+// Typelizer digest 6ea1bfecfd7d278d7fef225329c7627c
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
+import type {CompanyInvitationStatus} from '@/types'
interface CompanyInvitation {
id: string;
email: string;
expires_at: string | null;
company_id: string;
- status: 'pending' | 'accepted' | 'revoked' | 'expired';
+ status: CompanyInvitationStatus;
}
export default CompanyInvitation;
diff --git a/packages/sdk/src/types/generated/DataRequest.ts b/packages/sdk/src/types/generated/DataRequest.ts
index dbfa47f9e2..f13020a8b1 100644
--- a/packages/sdk/src/types/generated/DataRequest.ts
+++ b/packages/sdk/src/types/generated/DataRequest.ts
@@ -1,12 +1,12 @@
-// Typelizer digest bcf82011390ed00470315f02b5b367e4
+// Typelizer digest 4d84a6ed97ff188eb46ab0cadba1398c
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {DataRequestStatus} from '@/types'
+import type {DataRequestKind, DataRequestStatus} from '@/types'
interface DataRequest {
id: string;
number: string;
- kind: 'access' | 'erasure';
+ kind: DataRequestKind;
status: DataRequestStatus;
requested_at: string | null;
completed_at: string | null;
diff --git a/packages/sdk/src/types/generated/DataRequestConfirmationRequestedEvent.ts b/packages/sdk/src/types/generated/DataRequestConfirmationRequestedEvent.ts
index 641a367d93..8ec4cf0037 100644
--- a/packages/sdk/src/types/generated/DataRequestConfirmationRequestedEvent.ts
+++ b/packages/sdk/src/types/generated/DataRequestConfirmationRequestedEvent.ts
@@ -1,12 +1,12 @@
-// Typelizer digest d31f214c2ea06eae46b8db85a2a87cec
+// Typelizer digest a6ba5a54e57abf3d5480c2a2e0a374b4
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {DataRequestStatus} from '@/types'
+import type {DataRequestKind, DataRequestStatus} from '@/types'
interface DataRequestConfirmationRequestedEvent {
id: string;
number: string;
- kind: 'access' | 'erasure';
+ kind: DataRequestKind;
status: DataRequestStatus;
requested_at: string | null;
completed_at: string | null;
diff --git a/packages/sdk/src/types/generated/DataRequestEvent.ts b/packages/sdk/src/types/generated/DataRequestEvent.ts
index 9a211fb057..7629c794e2 100644
--- a/packages/sdk/src/types/generated/DataRequestEvent.ts
+++ b/packages/sdk/src/types/generated/DataRequestEvent.ts
@@ -1,12 +1,12 @@
-// Typelizer digest b78893ceac5cfb91c7e0630561ca731f
+// Typelizer digest ae8ec54d0e5b9c0745a58abc182e026e
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {DataRequestStatus} from '@/types'
+import type {DataRequestKind, DataRequestStatus} from '@/types'
interface DataRequestEvent {
id: string;
number: string;
- kind: 'access' | 'erasure';
+ kind: DataRequestKind;
status: DataRequestStatus;
requested_at: string | null;
completed_at: string | null;
diff --git a/packages/sdk/src/types/generated/Delivery.ts b/packages/sdk/src/types/generated/Delivery.ts
index 9189630952..41845693c5 100644
--- a/packages/sdk/src/types/generated/Delivery.ts
+++ b/packages/sdk/src/types/generated/Delivery.ts
@@ -1,6 +1,7 @@
-// Typelizer digest 91fa6c6951b70c259d2fd09d6d81453c
+// Typelizer digest a15da927f99af78a7624086d21584739
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
+import type {DeliveryStatus} from '@/types'
interface Delivery {
id: string;
@@ -8,7 +9,7 @@ interface Delivery {
carrier: string | null;
carrier_name: string | null;
service: string | null;
- status: 'pending' | 'pre_transit' | 'in_transit' | 'out_for_delivery' | 'available_for_pickup' | 'delivered' | 'return_to_sender' | 'failure' | 'unknown';
+ status: DeliveryStatus;
tracking_url: string | null;
estimated_delivery_at: string | null;
delivered_at: string | null;
diff --git a/packages/sdk/src/types/generated/DeliveryZoneMember.ts b/packages/sdk/src/types/generated/DeliveryZoneMember.ts
index 28be3028e7..692afc2460 100644
--- a/packages/sdk/src/types/generated/DeliveryZoneMember.ts
+++ b/packages/sdk/src/types/generated/DeliveryZoneMember.ts
@@ -1,11 +1,11 @@
-// Typelizer digest e3b705bb110a040240fda559793a7c4a
+// Typelizer digest 4c9f19f5d59da926b2cd7501c6548b5b
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {CountryCode} from '@/types'
+import type {DeliveryZoneMemberType, CountryCode} from '@/types'
interface DeliveryZoneMember {
id: string;
- member_type: 'country' | 'state' | 'postal_code';
+ member_type: DeliveryZoneMemberType;
country_code: CountryCode | null;
state_code: string | null;
postal_code_prefix: string | null;
diff --git a/packages/sdk/src/types/generated/Discount.ts b/packages/sdk/src/types/generated/Discount.ts
index 6b795d45ad..c08596f3c5 100644
--- a/packages/sdk/src/types/generated/Discount.ts
+++ b/packages/sdk/src/types/generated/Discount.ts
@@ -1,11 +1,12 @@
-// Typelizer digest df83b754c48138153f2677ca7d877ef4
+// Typelizer digest 231b299415f40e69372a182394701629
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
+import type {DiscountKind} from '@/types'
interface Discount {
id: string;
label: string;
- kind: 'promotion' | 'manual';
+ kind: DiscountKind;
code: string | null;
value_type: string | null;
value: string | null;
diff --git a/packages/sdk/src/types/generated/Enums.ts b/packages/sdk/src/types/generated/Enums.ts
index dcb2a9222f..e651e2e34e 100644
--- a/packages/sdk/src/types/generated/Enums.ts
+++ b/packages/sdk/src/types/generated/Enums.ts
@@ -1,23 +1,43 @@
-// Typelizer digest 9441893a974e59fb804b75fcf039b4f6
+// Typelizer digest 4d64a7bd647c2e146960a67b8bcf16f0
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-export type ClaimStatus = 'open' | 'approved' | 'resolved' | 'denied' | 'canceled' | (string & {});
+export type { ClaimResolution } from '@spree/sdk-core';
+export type { ClaimStatus } from '@spree/sdk-core';
+export type { CollectionSortOrder } from '@spree/sdk-core';
+export type { CompanyInvitationStatus } from '@spree/sdk-core';
+export type { CompanyKind } from '@spree/sdk-core';
export type { CountryCode } from '@spree/sdk-core';
export type { CurrencyCode } from '@spree/sdk-core';
-export type DataRequestStatus = 'awaiting_confirmation' | 'pending' | 'processing' | 'completed' | 'failed' | 'lapsed' | (string & {});
+export type { DataRequestKind } from '@spree/sdk-core';
+export type { DataRequestStatus } from '@spree/sdk-core';
+export type { DeliveryStatus } from '@spree/sdk-core';
+export type { DeliveryZoneMemberType } from '@spree/sdk-core';
export type { DimensionUnit } from '@spree/sdk-core';
-export type ExchangeStatus = 'requested' | 'approved' | 'received' | 'fulfilled' | 'canceled' | (string & {});
-export type FeeKind = 'surcharge' | 'handling' | 'gift_wrap' | 'cod' | 'payment' | 'duty' | 'exchange' | (string & {});
-export type FulfillmentStatus = 'unfulfilled' | 'fulfilled' | 'delivered' | 'canceled' | (string & {});
-export type GiftCardStatus = 'active' | 'partially_redeemed' | 'redeemed' | 'canceled' | 'expired' | (string & {});
-export type ImportRowStatus = 'pending' | 'processing' | 'completed' | 'failed' | (string & {});
-export type ImportStatus = 'pending' | 'mapping' | 'completed_mapping' | 'processing' | 'completed' | 'failed' | (string & {});
-export type InvitationStatus = 'pending' | 'accepted' | (string & {});
+export type { DiscountKind } from '@spree/sdk-core';
+export type { ExchangeStatus } from '@spree/sdk-core';
+export type { FeeKind } from '@spree/sdk-core';
+export type { FileUploadVisibility } from '@spree/sdk-core';
+export type { FulfillmentStatus } from '@spree/sdk-core';
+export type { FulfillmentType } from '@spree/sdk-core';
+export type { GiftCardStatus } from '@spree/sdk-core';
+export type { ImportRowStatus } from '@spree/sdk-core';
+export type { ImportStatus } from '@spree/sdk-core';
+export type { InvitationStatus } from '@spree/sdk-core';
export type { LocaleCode } from '@spree/sdk-core';
-export type PaymentSessionStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'canceled' | 'expired' | (string & {});
-export type PaymentSetupSessionStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'canceled' | 'expired' | (string & {});
-export type PaymentStatus = 'checkout' | 'processing' | 'pending' | 'completed' | 'failed' | 'void' | 'invalid' | (string & {});
-export type ProductSubmissionStatus = 'pending' | 'approved' | 'rejected' | 'withdrawn' | (string & {});
-export type ReturnStatus = 'requested' | 'approved' | 'received' | 'refunded' | 'canceled' | (string & {});
-export type ShippingLabelStatus = 'purchased' | 'refund_requested' | 'refunded' | (string & {});
+export type { MediaType } from '@spree/sdk-core';
+export type { OptionTypeKind } from '@spree/sdk-core';
+export type { OrderFulfillmentStatus } from '@spree/sdk-core';
+export type { OrderPaymentStatus } from '@spree/sdk-core';
+export type { PaymentSessionStatus } from '@spree/sdk-core';
+export type { PaymentSetupSessionStatus } from '@spree/sdk-core';
+export type { PaymentSourceType } from '@spree/sdk-core';
+export type { PaymentStatus } from '@spree/sdk-core';
+export type { ProductSubmissionStatus } from '@spree/sdk-core';
+export type { PurchaseUnit } from '@spree/sdk-core';
+export type { ReturnStatus } from '@spree/sdk-core';
+export type { ShippingLabelOwnerType } from '@spree/sdk-core';
+export type { ShippingLabelStatus } from '@spree/sdk-core';
+export type { StockAvailability } from '@spree/sdk-core';
+export type { StockMovementKind } from '@spree/sdk-core';
+export type { StockReceiptReceivableType } from '@spree/sdk-core';
export type { WeightUnit } from '@spree/sdk-core';
diff --git a/packages/sdk/src/types/generated/Exchange.ts b/packages/sdk/src/types/generated/Exchange.ts
index c6b787c318..ecd951e82d 100644
--- a/packages/sdk/src/types/generated/Exchange.ts
+++ b/packages/sdk/src/types/generated/Exchange.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 3cbfdc942cc197194c2021c453c79338
+// Typelizer digest 03a479e12dd53f46943e7f2d51924ccd
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {ReturnReason, ExchangeLineItem, ExchangeStatus} from '@/types'
diff --git a/packages/sdk/src/types/generated/Fee.ts b/packages/sdk/src/types/generated/Fee.ts
index 3f04243ff0..8d47ee4ff0 100644
--- a/packages/sdk/src/types/generated/Fee.ts
+++ b/packages/sdk/src/types/generated/Fee.ts
@@ -1,4 +1,4 @@
-// Typelizer digest e68a896e1cb69e579a19cd9d48dbffd6
+// Typelizer digest ebbde84b0f45ebf91a3aab38823b7ea8
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {FeeKind} from '@/types'
diff --git a/packages/sdk/src/types/generated/FileUpload.ts b/packages/sdk/src/types/generated/FileUpload.ts
index 81ba092905..c489ba07c5 100644
--- a/packages/sdk/src/types/generated/FileUpload.ts
+++ b/packages/sdk/src/types/generated/FileUpload.ts
@@ -1,14 +1,14 @@
-// Typelizer digest 7a884ae6d631bee1659086d1f953f34f
+// Typelizer digest 4f3e7718354f467bc1e83b6fb28e64b3
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {FileUploadTarget} from '@/types'
+import type {FileUploadTarget, FileUploadVisibility} from '@/types'
interface FileUpload {
signed_id: string;
filename: string;
content_type: string;
byte_size: number;
- visibility: 'public' | 'private';
+ visibility: FileUploadVisibility;
expires_at: string;
upload: FileUploadTarget | null;
}
diff --git a/packages/sdk/src/types/generated/Fulfillment.ts b/packages/sdk/src/types/generated/Fulfillment.ts
index 524c847a83..647c6827b1 100644
--- a/packages/sdk/src/types/generated/Fulfillment.ts
+++ b/packages/sdk/src/types/generated/Fulfillment.ts
@@ -1,7 +1,7 @@
-// Typelizer digest 9faf3738ce1482d6a2efea52774a3604
+// Typelizer digest eb55a3c0b35b17e16a5b3a574de37e45
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {Delivery, DeliveryMethod, StockLocation, DeliveryRate, TaxLine, FulfillmentStatus} from '@/types'
+import type {Delivery, DeliveryMethod, StockLocation, DeliveryRate, TaxLine, FulfillmentStatus, FulfillmentType} from '@/types'
interface Fulfillment {
id: string;
@@ -36,7 +36,7 @@ interface Fulfillment {
* @deprecated Format `tax_total` with its currency instead. Removed in 6.1. */
display_tax_total: string | null;
status: FulfillmentStatus;
- fulfillment_type: 'shipping' | 'digital' | 'pickup' | 'pickup_point';
+ fulfillment_type: FulfillmentType;
fulfilled_at: string | null;
delivered_at: string | null;
items: Array<{ item_id: string; variant_id: string; quantity: number }>;
diff --git a/packages/sdk/src/types/generated/GiftCard.ts b/packages/sdk/src/types/generated/GiftCard.ts
index 9b8b61bc08..d1eea32d18 100644
--- a/packages/sdk/src/types/generated/GiftCard.ts
+++ b/packages/sdk/src/types/generated/GiftCard.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 852c163fd67a1dec70c2edc8413ce677
+// Typelizer digest 7860083be25b23f29071246d2152cb7d
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {GiftCardStatus, CurrencyCode} from '@/types'
diff --git a/packages/sdk/src/types/generated/Import.ts b/packages/sdk/src/types/generated/Import.ts
index 86553bc8a4..215d275f52 100644
--- a/packages/sdk/src/types/generated/Import.ts
+++ b/packages/sdk/src/types/generated/Import.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 3d735df6662c77e7119c0a26d2d259a5
+// Typelizer digest c56ad8105e0e0f06c652fea3b2c54acc
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {ImportStatus} from '@/types'
diff --git a/packages/sdk/src/types/generated/ImportRow.ts b/packages/sdk/src/types/generated/ImportRow.ts
index 07ccf9776b..e488bfc7c6 100644
--- a/packages/sdk/src/types/generated/ImportRow.ts
+++ b/packages/sdk/src/types/generated/ImportRow.ts
@@ -1,4 +1,4 @@
-// Typelizer digest dae6743107c66cf17b7db9f73656c1bb
+// Typelizer digest 9ac955fd0db39aeb38a9fd3af1d9596e
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {ImportRowStatus} from '@/types'
diff --git a/packages/sdk/src/types/generated/Invitation.ts b/packages/sdk/src/types/generated/Invitation.ts
index 380674dbc5..cd0f80fa1f 100644
--- a/packages/sdk/src/types/generated/Invitation.ts
+++ b/packages/sdk/src/types/generated/Invitation.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 9f746a6aac634976ba16419a620399b8
+// Typelizer digest 0d6e5d4cd860187253fa5c7ed4c62a5a
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {InvitationStatus} from '@/types'
diff --git a/packages/sdk/src/types/generated/Media.ts b/packages/sdk/src/types/generated/Media.ts
index d36bb37b73..4a43f6b320 100644
--- a/packages/sdk/src/types/generated/Media.ts
+++ b/packages/sdk/src/types/generated/Media.ts
@@ -1,6 +1,7 @@
-// Typelizer digest 9315ed2484375d252fa5b21b94435c4a
+// Typelizer digest f3e93394a0406eeca7b437f42496fd80
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
+import type {MediaType} from '@/types'
interface Media {
id: string;
@@ -8,7 +9,7 @@ interface Media {
variant_ids: Array<string>;
position: number;
alt: string | null;
- media_type: 'image' | 'video' | 'external_video';
+ media_type: MediaType;
external_video_url: string | null;
focal_point_x: number | null;
focal_point_y: number | null;
diff --git a/packages/sdk/src/types/generated/MediaEvent.ts b/packages/sdk/src/types/generated/MediaEvent.ts
index bbbc760560..2b8a76e50f 100644
--- a/packages/sdk/src/types/generated/MediaEvent.ts
+++ b/packages/sdk/src/types/generated/MediaEvent.ts
@@ -1,12 +1,13 @@
-// Typelizer digest 5eb99b51f1e2779bc7e620b4f4afe632
+// Typelizer digest 882d16bf9972ee1693b825af0f2ec5d7
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
+import type {MediaType} from '@/types'
interface MediaEvent {
id: string;
viewable_id: string;
viewable_type: string;
- media_type: 'image' | 'video' | 'external_video';
+ media_type: MediaType;
position: number | null;
alt: string | null;
created_at: string;
diff --git a/packages/sdk/src/types/generated/OptionType.ts b/packages/sdk/src/types/generated/OptionType.ts
index b68cc0acc0..cc815cfd81 100644
--- a/packages/sdk/src/types/generated/OptionType.ts
+++ b/packages/sdk/src/types/generated/OptionType.ts
@@ -1,13 +1,14 @@
-// Typelizer digest 1c15410ad483e0374f08aade417a9bf6
+// Typelizer digest ccc36c14b64d467e098f9c20f09fe4b2
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
+import type {OptionTypeKind} from '@/types'
interface OptionType {
id: string;
name: string;
label: string;
position: number;
- kind: 'dropdown' | 'color_swatch' | 'buttons';
+ kind: OptionTypeKind;
}
export default OptionType;
diff --git a/packages/sdk/src/types/generated/Order.ts b/packages/sdk/src/types/generated/Order.ts
index d692e50b9e..d5a2b6290a 100644
--- a/packages/sdk/src/types/generated/Order.ts
+++ b/packages/sdk/src/types/generated/Order.ts
@@ -1,7 +1,7 @@
-// Typelizer digest 70cad850e62121c3d89734f7746244a8
+// Typelizer digest 7e3696c89d17b74e77c382cc98b33c69
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {Payment, AppliedPromotion, Fee, LineItem, Fulfillment, Address, GiftCard, Market, CurrencyCode, LocaleCode} from '@/types'
+import type {Payment, AppliedPromotion, Fee, LineItem, Fulfillment, Address, GiftCard, Market, CurrencyCode, LocaleCode, OrderFulfillmentStatus, OrderPaymentStatus} from '@/types'
interface Order {
id: string;
@@ -23,8 +23,8 @@ interface Order {
locale: LocaleCode | null;
total_quantity: number;
coupon_code: string | null;
- fulfillment_status: 'backorder' | 'canceled' | 'partial' | 'unfulfilled' | 'fulfilled' | 'delivered' | 'pending' | 'ready' | 'shipped' | null;
- payment_status: 'none' | 'authorized' | 'partially_paid' | 'paid' | 'partially_refunded' | 'refunded' | 'overcharged' | 'voided' | null;
+ fulfillment_status: OrderFulfillmentStatus | null;
+ payment_status: OrderPaymentStatus | null;
completed_at: string | null;
/** The line items: each price times its quantity, before discounts, fees and delivery. */
item_total: string | null;
diff --git a/packages/sdk/src/types/generated/OrderGroup.ts b/packages/sdk/src/types/generated/OrderGroup.ts
index 9c460592bf..ea40a637c8 100644
--- a/packages/sdk/src/types/generated/OrderGroup.ts
+++ b/packages/sdk/src/types/generated/OrderGroup.ts
@@ -1,7 +1,7 @@
-// Typelizer digest bc6b604d193d8badc97fc119a26a47e1
+// Typelizer digest d1003c0bf3b674d72dbb334a65a4f715
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {Payment, Address, Order, CurrencyCode} from '@/types'
+import type {Payment, Address, Order, CurrencyCode, OrderFulfillmentStatus, OrderPaymentStatus} from '@/types'
interface OrderGroup {
id: string;
@@ -65,8 +65,8 @@ interface OrderGroup {
display_amount_due: string | null;
covered_by_store_credit: boolean;
payments: Array<Payment>;
- fulfillment_status: 'backorder' | 'canceled' | 'partial' | 'unfulfilled' | 'fulfilled' | 'delivered' | 'pending' | 'ready' | 'shipped' | null;
- payment_status: 'none' | 'authorized' | 'partially_paid' | 'paid' | 'partially_refunded' | 'refunded' | 'overcharged' | 'voided' | null;
+ fulfillment_status: OrderFulfillmentStatus | null;
+ payment_status: OrderPaymentStatus | null;
completed_at: string | null;
billing_address: Address | null;
shipping_address: Address | null;
diff --git a/packages/sdk/src/types/generated/Payment.ts b/packages/sdk/src/types/generated/Payment.ts
index e3f8933dc4..caa9ad1a25 100644
--- a/packages/sdk/src/types/generated/Payment.ts
+++ b/packages/sdk/src/types/generated/Payment.ts
@@ -1,7 +1,7 @@
-// Typelizer digest d95a4d6d93c59aa450be14d060c73f41
+// Typelizer digest 0c5793f272dddddfe5980a2e83d20994
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {CreditCard, StoreCredit, PaymentSource, PaymentMethod, PaymentStatus} from '@/types'
+import type {CreditCard, StoreCredit, PaymentSource, PaymentMethod, PaymentStatus, PaymentSourceType} from '@/types'
interface Payment {
id: string;
@@ -13,7 +13,7 @@ interface Payment {
/** `amount` formatted with its currency symbol in the request's language.
* @deprecated Format `amount` with its currency instead. Removed in 6.1. */
display_amount: string | null;
- source_type: 'credit_card' | 'store_credit' | 'payment_source' | null;
+ source_type: PaymentSourceType | null;
source_id: string | null;
source: CreditCard | StoreCredit | PaymentSource | null;
payment_method: PaymentMethod;
diff --git a/packages/sdk/src/types/generated/PaymentSession.ts b/packages/sdk/src/types/generated/PaymentSession.ts
index bff9e6d63d..0a8ef14091 100644
--- a/packages/sdk/src/types/generated/PaymentSession.ts
+++ b/packages/sdk/src/types/generated/PaymentSession.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 44737f4548342c3e3b28cc722308d65f
+// Typelizer digest a13b2d9d71bd73ae3d44229280a65427
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {PaymentMethod, Payment, PaymentSessionStatus, CurrencyCode} from '@/types'
diff --git a/packages/sdk/src/types/generated/PaymentSetupSession.ts b/packages/sdk/src/types/generated/PaymentSetupSession.ts
index 70a9750342..5a13cf01cc 100644
--- a/packages/sdk/src/types/generated/PaymentSetupSession.ts
+++ b/packages/sdk/src/types/generated/PaymentSetupSession.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 9c48687fd62549a34d35cdf434685342
+// Typelizer digest b128d61b289c648069f6e51fa40245c9
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {PaymentMethod, PaymentSetupSessionStatus} from '@/types'
diff --git a/packages/sdk/src/types/generated/ProductFilterAvailabilityOption.ts b/packages/sdk/src/types/generated/ProductFilterAvailabilityOption.ts
index 094e54eebf..f877eb5521 100644
--- a/packages/sdk/src/types/generated/ProductFilterAvailabilityOption.ts
+++ b/packages/sdk/src/types/generated/ProductFilterAvailabilityOption.ts
@@ -1,9 +1,10 @@
-// Typelizer digest 55cf1d7d82e3023e844ac6a1be1603e4
+// Typelizer digest 8fdba6ae9f92f40f84c754ecac01d98e
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
+import type {StockAvailability} from '@/types'
interface ProductFilterAvailabilityOption {
- id: 'in_stock' | 'out_of_stock';
+ id: StockAvailability;
count: number;
}
diff --git a/packages/sdk/src/types/generated/ProductFilterOption.ts b/packages/sdk/src/types/generated/ProductFilterOption.ts
index 1ed3a6533a..f2de58b9a8 100644
--- a/packages/sdk/src/types/generated/ProductFilterOption.ts
+++ b/packages/sdk/src/types/generated/ProductFilterOption.ts
@@ -1,14 +1,14 @@
-// Typelizer digest bc5fa94fad7857562d90a159c880040c
+// Typelizer digest ddd632385e40b8fc29060994cfa99d4b
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {ProductFilterOptionValue} from '@/types'
+import type {ProductFilterOptionValue, OptionTypeKind} from '@/types'
interface ProductFilterOption {
id: string;
type: 'option';
name: string;
label: string;
- kind: 'dropdown' | 'color_swatch' | 'buttons';
+ kind: OptionTypeKind;
options: Array<ProductFilterOptionValue>;
}
diff --git a/packages/sdk/src/types/generated/ProductSubmission.ts b/packages/sdk/src/types/generated/ProductSubmission.ts
index 8f32e50185..2076224c1c 100644
--- a/packages/sdk/src/types/generated/ProductSubmission.ts
+++ b/packages/sdk/src/types/generated/ProductSubmission.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 22f0175c103eaa9be3d28ffc3d6a7e25
+// Typelizer digest da3fcd4cba1a822fddf64c1adc7c1311
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {ProductSubmissionStatus} from '@/types'
diff --git a/packages/sdk/src/types/generated/Return.ts b/packages/sdk/src/types/generated/Return.ts
index d3d30b3420..4bcb2451a4 100644
--- a/packages/sdk/src/types/generated/Return.ts
+++ b/packages/sdk/src/types/generated/Return.ts
@@ -1,4 +1,4 @@
-// Typelizer digest b18e0146b31024777365e5185b7f1ce1
+// Typelizer digest 58a1849f55bb5ea29eb737ca319a28db
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {ReturnReason, ReturnLineItem, ReturnStatus} from '@/types'
diff --git a/packages/sdk/src/types/generated/ShippingLabelEvent.ts b/packages/sdk/src/types/generated/ShippingLabelEvent.ts
index 74e8e8efc4..7ebf149722 100644
--- a/packages/sdk/src/types/generated/ShippingLabelEvent.ts
+++ b/packages/sdk/src/types/generated/ShippingLabelEvent.ts
@@ -1,7 +1,7 @@
-// Typelizer digest 015fd564efa095d7312617c300535453
+// Typelizer digest 0b0eb2883e581031b48cb836c1c2c59a
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {ShippingLabelStatus} from '@/types'
+import type {ShippingLabelStatus, ShippingLabelOwnerType} from '@/types'
interface ShippingLabelEvent {
id: string;
@@ -13,7 +13,7 @@ interface ShippingLabelEvent {
created_at: string;
updated_at: string;
owner_id: string;
- owner_type: 'fulfillment' | 'return';
+ owner_type: ShippingLabelOwnerType;
}
export default ShippingLabelEvent;
diff --git a/packages/sdk/src/types/generated/StockMovement.ts b/packages/sdk/src/types/generated/StockMovement.ts
index f29a57abba..fa937d4cc3 100644
--- a/packages/sdk/src/types/generated/StockMovement.ts
+++ b/packages/sdk/src/types/generated/StockMovement.ts
@@ -1,11 +1,12 @@
-// Typelizer digest 6916b4dbc9fdc8f367db016c224244da
+// Typelizer digest 462d0b421b8b1b18ffa66ade474b4b14
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
+import type {StockMovementKind} from '@/types'
interface StockMovement {
id: string;
quantity: number;
- kind: 'received' | 'allocated' | 'shipped' | 'released' | 'adjusted' | null;
+ kind: StockMovementKind | null;
reason: string | null;
created_at: string;
updated_at: string;
diff --git a/packages/sdk/src/types/generated/StockReceiptEvent.ts b/packages/sdk/src/types/generated/StockReceiptEvent.ts
index 37644179d4..83325dfd51 100644
--- a/packages/sdk/src/types/generated/StockReceiptEvent.ts
+++ b/packages/sdk/src/types/generated/StockReceiptEvent.ts
@@ -1,6 +1,7 @@
-// Typelizer digest 0080e8c60cbbcf5e9027ab10ac0f4497
+// Typelizer digest 4365580132a9c0adbe1b7354aae09c86
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
+import type {StockReceiptReceivableType} from '@/types'
interface StockReceiptEvent {
id: string;
@@ -10,7 +11,7 @@ interface StockReceiptEvent {
received_at: string;
created_at: string;
updated_at: string;
- receivable_type: 'purchase_order' | 'stock_transfer';
+ receivable_type: StockReceiptReceivableType;
receivable_id: string;
}
diff --git a/packages/sdk/src/types/generated/Variant.ts b/packages/sdk/src/types/generated/Variant.ts
index 85e270bc25..c07e5cad93 100644
--- a/packages/sdk/src/types/generated/Variant.ts
+++ b/packages/sdk/src/types/generated/Variant.ts
@@ -1,7 +1,7 @@
-// Typelizer digest 05ca910d3ebb0c6ce232fd224b019df4
+// Typelizer digest cb446b74bd507f374240af1eb12eda8d
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {Price, PriceHistory, Seller, Media, OptionValue, CustomField, WeightUnit, DimensionUnit} from '@/types'
+import type {Price, PriceHistory, Seller, Media, OptionValue, CustomField, WeightUnit, DimensionUnit, PurchaseUnit} from '@/types'
interface Variant {
id: string;
@@ -24,7 +24,7 @@ interface Variant {
dimensions_unit: DimensionUnit;
minimum_order_quantity: number;
order_multiple: number;
- purchase_unit: 'unit' | 'carton';
+ purchase_unit: PurchaseUnit;
units_per_carton: number | null;
price: Price;
original_price: Price | null;
diff --git a/packages/sdk/src/types/generated/index.ts b/packages/sdk/src/types/generated/index.ts
index a568e5f645..7e9f518841 100644
--- a/packages/sdk/src/types/generated/index.ts
+++ b/packages/sdk/src/types/generated/index.ts
@@ -1,7 +1,7 @@
-// Typelizer digest 6cf1c023876556016d0774360f3e76b3
+// Typelizer digest cfd112ed419f6758d03a3ef2986bfd8a
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-export type { ClaimStatus, CountryCode, CurrencyCode, DataRequestStatus, DimensionUnit, ExchangeStatus, FeeKind, FulfillmentStatus, GiftCardStatus, ImportRowStatus, ImportStatus, InvitationStatus, LocaleCode, PaymentSessionStatus, PaymentSetupSessionStatus, PaymentStatus, ProductSubmissionStatus, ReturnStatus, ShippingLabelStatus, WeightUnit } from './Enums'
+export type { ClaimResolution, ClaimStatus, CollectionSortOrder, CompanyInvitationStatus, CompanyKind, CountryCode, CurrencyCode, DataRequestKind, DataRequestStatus, DeliveryStatus, DeliveryZoneMemberType, DimensionUnit, DiscountKind, ExchangeStatus, FeeKind, FileUploadVisibility, FulfillmentStatus, FulfillmentType, GiftCardStatus, ImportRowStatus, ImportStatus, InvitationStatus, LocaleCode, MediaType, OptionTypeKind, OrderFulfillmentStatus, OrderPaymentStatus, PaymentSessionStatus, PaymentSetupSessionStatus, PaymentSourceType, PaymentStatus, ProductSubmissionStatus, PurchaseUnit, ReturnStatus, ShippingLabelOwnerType, ShippingLabelStatus, StockAvailability, StockMovementKind, StockReceiptReceivableType, WeightUnit } from './Enums'
export type { default as Address } from './Address'
export type { default as AppliedPromotion } from './AppliedPromotion'
export type { default as Base } from './Base'
diff --git a/packages/seller-dashboard/src/components/orders/fulfillments-card.tsx b/packages/seller-dashboard/src/components/orders/fulfillments-card.tsx
index 3a8c6a99bf..f67d52b9c0 100644
--- a/packages/seller-dashboard/src/components/orders/fulfillments-card.tsx
+++ b/packages/seller-dashboard/src/components/orders/fulfillments-card.tsx
@@ -1,3 +1,4 @@
+import { FULFILLMENT_STATUSES, subsetOf } from '@spree/core'
import { fulfillmentItemRows } from '@spree/dashboard-core'
import {
Badge,
@@ -44,8 +45,8 @@ import { ShippingLabelRow } from './shipping-label-row'
// A parcel that has not gone out is the only one still to ship or cancel.
// Reading these off "not unfulfilled" once badged a canceled parcel as a
// success.
-const CAN_SHIP = ['unfulfilled']
-const CAN_CANCEL = ['unfulfilled']
+const CAN_SHIP = subsetOf(FULFILLMENT_STATUSES, ['unfulfilled'])
+const CAN_CANCEL = subsetOf(FULFILLMENT_STATUSES, ['unfulfilled'])
/** Every parcel owed on this order, and what the seller can do with each. */
export function FulfillmentsCard({ order }: { order: Order }) {
diff --git a/packages/seller-dashboard/src/components/orders/post-sale-cards.tsx b/packages/seller-dashboard/src/components/orders/post-sale-cards.tsx
index c5870202cd..b36bb41b4c 100644
--- a/packages/seller-dashboard/src/components/orders/post-sale-cards.tsx
+++ b/packages/seller-dashboard/src/components/orders/post-sale-cards.tsx
@@ -1,4 +1,4 @@
-import { sumMoney } from '@spree/core'
+import { CLAIM_STATUSES, EXCHANGE_STATUSES, subsetOf, sumMoney } from '@spree/core'
import { currencyParts, formatMoney, isPositiveMoney, useMoneyLocale } from '@spree/dashboard-core'
import {
Button,
@@ -36,8 +36,8 @@ import {
import { lineLabel } from './line-label'
import { CreateClaimDialog } from './post-sale-create-dialogs'
-const EXCHANGE_ACTIONABLE = ['requested', 'approved', 'received']
-const CLAIM_ACTIONABLE = ['open', 'approved']
+const EXCHANGE_ACTIONABLE = subsetOf(EXCHANGE_STATUSES, ['requested', 'approved', 'received'])
+const CLAIM_ACTIONABLE = subsetOf(CLAIM_STATUSES, ['open', 'approved'])
/**
* Goods swapped for different ones.
diff --git a/packages/seller-dashboard/src/components/orders/returns-card.tsx b/packages/seller-dashboard/src/components/orders/returns-card.tsx
index 6eadc757a0..40c65ed595 100644
--- a/packages/seller-dashboard/src/components/orders/returns-card.tsx
+++ b/packages/seller-dashboard/src/components/orders/returns-card.tsx
@@ -1,3 +1,4 @@
+import { RETURN_STATUSES, subsetOf } from '@spree/core'
import {
currencyParts,
formatMoney,
@@ -35,7 +36,7 @@ import { CreateReturnDialog, fulfilledUnits } from './post-sale-create-dialogs'
// Refunded and canceled returns are finished; offering a menu on them would
// open onto nothing.
-const ACTIONABLE = ['requested', 'approved', 'received']
+const ACTIONABLE = subsetOf(RETURN_STATUSES, ['requested', 'approved', 'received'])
/**
* Goods coming back on this order.
diff --git a/packages/seller-dashboard/src/hooks/use-post-sale.ts b/packages/seller-dashboard/src/hooks/use-post-sale.ts
index a9b73f5551..173840c007 100644
--- a/packages/seller-dashboard/src/hooks/use-post-sale.ts
+++ b/packages/seller-dashboard/src/hooks/use-post-sale.ts
@@ -1,3 +1,4 @@
+import type { ClaimResolution } from '@spree/core'
import { useResourceKey, useResourceKeyBuilder } from '@spree/dashboard-core'
import { toastManager } from '@spree/dashboard-ui'
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
@@ -182,7 +183,7 @@ export function useClaimActions(orderId: string) {
replacementLineItemIds,
}: {
claimId: string
- resolution: 'refund' | 'replacement' | 'refund_and_replacement'
+ resolution: ClaimResolution
refundMethod?: 'original_payment' | 'store_credit'
amount?: string
replacementLineItemIds?: string[]
diff --git a/packages/seller-dashboard/src/pages/products.tsx b/packages/seller-dashboard/src/pages/products.tsx
index d3c9a58988..50d8af9a15 100644
--- a/packages/seller-dashboard/src/pages/products.tsx
+++ b/packages/seller-dashboard/src/pages/products.tsx
@@ -1,3 +1,4 @@
+import { PRODUCT_STATUSES, subsetOf } from '@spree/core'
import type {
BulkAction,
BulkActionFormProps,
@@ -40,7 +41,7 @@ import '../tables/products'
* approves it, so the only moves offered here are the two a seller makes
* alone (docs/plans/6.0-seller-product-submission.md).
*/
-const BULK_STATUSES = ['draft', 'archived'] as const
+const BULK_STATUSES = subsetOf(PRODUCT_STATUSES, ['draft', 'archived'])
type BulkStatus = (typeof BULK_STATUSES)[number]
type StatusFormValues = { status: BulkStatus }
diff --git a/packages/seller-dashboard/src/tables/orders.tsx b/packages/seller-dashboard/src/tables/orders.tsx
index a8dd45649f..a185355339 100644
--- a/packages/seller-dashboard/src/tables/orders.tsx
+++ b/packages/seller-dashboard/src/tables/orders.tsx
@@ -1,4 +1,10 @@
-import { defineTable, formatMoney, formatStoreDateTime } from '@spree/dashboard-core'
+import { ORDER_PAYMENT_STATUSES } from '@spree/core'
+import {
+ defineTable,
+ FILTERABLE_ORDER_FULFILLMENT_STATUSES,
+ formatMoney,
+ formatStoreDateTime,
+} from '@spree/dashboard-core'
import { ResourceNameCell, StatusBadge } from '@spree/dashboard-ui'
import { PackageIcon } from '@spree/dashboard-ui/icons'
import type { Order } from '@spree/seller-sdk'
@@ -17,26 +23,6 @@ function OrderDate({ iso }: { iso: string }) {
return <>{formatStoreDateTime(iso, timezone)}</>
}
-/** Mirrors the operator dashboard's order status vocabularies. */
-const FULFILLMENT_STATUSES = [
- 'unfulfilled',
- 'backorder',
- 'partial',
- 'fulfilled',
- 'delivered',
- 'canceled',
-] as const
-const PAYMENT_STATUSES = [
- 'none',
- 'authorized',
- 'partially_paid',
- 'paid',
- 'partially_refunded',
- 'refunded',
- 'overcharged',
- 'voided',
-] as const
-
defineTable<Order>('seller-orders', {
title: i18n.t('orders.title'),
searchParam: 'number_cont',
@@ -69,7 +55,7 @@ defineTable<Order>('seller-orders', {
label: i18n.t('orders.columns.fulfillment'),
filterable: true,
filterType: 'enum',
- filterOptions: FULFILLMENT_STATUSES.map((status) => ({
+ filterOptions: FILTERABLE_ORDER_FULFILLMENT_STATUSES.map((status) => ({
value: status,
label: i18n.t(`orders.fulfillment_statuses.${status}`),
})),
@@ -90,7 +76,7 @@ defineTable<Order>('seller-orders', {
label: i18n.t('orders.columns.payment'),
filterable: true,
filterType: 'enum',
- filterOptions: PAYMENT_STATUSES.map((status) => ({
+ filterOptions: ORDER_PAYMENT_STATUSES.map((status) => ({
value: status,
label: i18n.t(`orders.payment_statuses.${status}`),
})),
diff --git a/packages/seller-dashboard/src/tables/payouts.tsx b/packages/seller-dashboard/src/tables/payouts.tsx
index 4cacc87ab7..ad06efc129 100644
--- a/packages/seller-dashboard/src/tables/payouts.tsx
+++ b/packages/seller-dashboard/src/tables/payouts.tsx
@@ -1,3 +1,4 @@
+import { SELLER_PAYOUT_STATUSES } from '@spree/core'
import { defineTable, formatMoney, formatStoreDateTime } from '@spree/dashboard-core'
import { ResourceNameCell, StatusBadge } from '@spree/dashboard-ui'
import { HandCoinsIcon } from '@spree/dashboard-ui/icons'
@@ -18,8 +19,6 @@ function LedgerDate({ iso }: { iso: string }) {
return <>{formatStoreDateTime(iso, timezone)}</>
}
-const STATUSES = ['pending', 'processing', 'completed', 'failed', 'unresolved'] as const
-
defineTable<Payout>('seller-payouts', {
title: i18n.t('payouts.title'),
searchParam: 'search',
@@ -50,7 +49,7 @@ defineTable<Payout>('seller-payouts', {
sortable: true,
filterable: true,
filterType: 'enum',
- filterOptions: STATUSES.map((status) => ({
+ filterOptions: SELLER_PAYOUT_STATUSES.map((status) => ({
value: status,
label: i18n.t(`earnings.statuses.${status}`),
})),
diff --git a/packages/seller-dashboard/src/tables/products.tsx b/packages/seller-dashboard/src/tables/products.tsx
index c60d8e5c43..115578ab0f 100644
--- a/packages/seller-dashboard/src/tables/products.tsx
+++ b/packages/seller-dashboard/src/tables/products.tsx
@@ -1,12 +1,10 @@
+import { PRODUCT_STATUSES } from '@spree/core'
import { defineTable, formatPrice } from '@spree/dashboard-core'
import { ResourceNameCell, StatusBadge, Thumbnail } from '@spree/dashboard-ui'
import { PackageIcon } from '@spree/dashboard-ui/icons'
import type { Product } from '@spree/seller-sdk'
import i18n from 'i18next'
-/** Mirrors the operator dashboard's product statuses. */
-const PRODUCT_STATUSES = ['active', 'draft', 'proposed', 'rejected', 'archived'] as const
-
defineTable<Product>('seller-products', {
title: i18n.t('products.title'),
searchParam: 'search',
diff --git a/packages/seller-dashboard/src/tables/transfers.tsx b/packages/seller-dashboard/src/tables/transfers.tsx
index c0d6f8e15c..38d4c42b30 100644
--- a/packages/seller-dashboard/src/tables/transfers.tsx
+++ b/packages/seller-dashboard/src/tables/transfers.tsx
@@ -1,3 +1,4 @@
+import { SELLER_TRANSFER_KINDS, SELLER_TRANSFER_STATUSES } from '@spree/core'
import { defineTable, formatMoney, formatStoreDateTime, useTenantId } from '@spree/dashboard-core'
import { StatusBadge } from '@spree/dashboard-ui'
import { BanknoteIcon } from '@spree/dashboard-ui/icons'
@@ -43,9 +44,6 @@ function LedgerDate({ iso }: { iso: string }) {
return <>{formatStoreDateTime(iso, timezone)}</>
}
-const STATUSES = ['pending', 'processing', 'completed', 'failed', 'unresolved'] as const
-const KINDS = ['earning', 'refund_reversal'] as const
-
defineTable<Transfer>('seller-transfers', {
title: i18n.t('earnings.transfers.title'),
// Without this the toolbar sends `name_cont`, which the ledger does not
@@ -78,7 +76,7 @@ defineTable<Transfer>('seller-transfers', {
label: i18n.t('earnings.columns.kind'),
filterable: true,
filterType: 'enum',
- filterOptions: KINDS.map((kind) => ({
+ filterOptions: SELLER_TRANSFER_KINDS.map((kind) => ({
value: kind,
label: i18n.t(`earnings.kinds.${kind}`),
})),
@@ -93,7 +91,7 @@ defineTable<Transfer>('seller-transfers', {
sortable: true,
filterable: true,
filterType: 'enum',
- filterOptions: STATUSES.map((status) => ({
+ filterOptions: SELLER_TRANSFER_STATUSES.map((status) => ({
value: status,
label: i18n.t(`earnings.statuses.${status}`),
})),
diff --git a/packages/seller-sdk/src/types/generated/Claim.ts b/packages/seller-sdk/src/types/generated/Claim.ts
index 99c40170f8..af24e2e5cb 100644
--- a/packages/seller-sdk/src/types/generated/Claim.ts
+++ b/packages/seller-sdk/src/types/generated/Claim.ts
@@ -1,13 +1,13 @@
-// Typelizer digest 87b2bec984bdc6510ce3b0eec9898a0c
+// Typelizer digest 77d6b78c74903a566cc617b4fc67c5c0
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {Reason, ClaimLineItem, ClaimStatus} from '@/types'
+import type {Reason, ClaimLineItem, ClaimStatus, ClaimResolution} from '@/types'
type Claim = {
id: string;
number: string;
status: ClaimStatus;
- resolution: string | null;
+ resolution: ClaimResolution | null;
order_id: string | null;
reason_id: string | null;
refund_total: string;
diff --git a/packages/seller-sdk/src/types/generated/Delivery.ts b/packages/seller-sdk/src/types/generated/Delivery.ts
index d6a1516ec6..1920f1a04b 100644
--- a/packages/seller-sdk/src/types/generated/Delivery.ts
+++ b/packages/seller-sdk/src/types/generated/Delivery.ts
@@ -1,6 +1,7 @@
-// Typelizer digest 85b87a3ac0b974e4c936fa0943a83bb0
+// Typelizer digest e77841ceeb0ad6255130c731ca6c2ee7
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
+import type {DeliveryStatus} from '@/types'
type Delivery = {
id: string;
@@ -8,7 +9,7 @@ type Delivery = {
carrier: string | null;
carrier_name: string | null;
service: string | null;
- status: 'pending' | 'pre_transit' | 'in_transit' | 'out_for_delivery' | 'available_for_pickup' | 'delivered' | 'return_to_sender' | 'failure' | 'unknown';
+ status: DeliveryStatus;
tracking_url: string | null;
estimated_delivery_at: string | null;
delivered_at: string | null;
diff --git a/packages/seller-sdk/src/types/generated/Enums.ts b/packages/seller-sdk/src/types/generated/Enums.ts
index 6b88b6a7df..755711ce8d 100644
--- a/packages/seller-sdk/src/types/generated/Enums.ts
+++ b/packages/seller-sdk/src/types/generated/Enums.ts
@@ -1,20 +1,37 @@
-// Typelizer digest 4510ea48f0daea8d6b462a6990fedf77
+// Typelizer digest 4475b95541a9751cfedeb9ea7c2b0d68
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-export type ClaimStatus = 'open' | 'approved' | 'resolved' | 'denied' | 'canceled' | (string & {});
+export type { ClaimResolution } from '@spree/sdk-core';
+export type { ClaimStatus } from '@spree/sdk-core';
export type { CountryCode } from '@spree/sdk-core';
export type { CurrencyCode } from '@spree/sdk-core';
+export type { DeliveryStatus } from '@spree/sdk-core';
export type { DimensionUnit } from '@spree/sdk-core';
-export type ExchangeStatus = 'requested' | 'approved' | 'received' | 'fulfilled' | 'canceled' | (string & {});
-export type FulfillmentStatus = 'unfulfilled' | 'fulfilled' | 'delivered' | 'canceled' | (string & {});
-export type ImportRowStatus = 'pending' | 'processing' | 'completed' | 'failed' | (string & {});
-export type ImportStatus = 'pending' | 'mapping' | 'completed_mapping' | 'processing' | 'completed' | 'failed' | (string & {});
-export type InvitationStatus = 'pending' | 'accepted' | (string & {});
-export type ProductStatus = 'draft' | 'active' | 'archived' | 'proposed' | 'rejected' | (string & {});
-export type ProductSubmissionStatus = 'pending' | 'approved' | 'rejected' | 'withdrawn' | (string & {});
-export type ReturnStatus = 'requested' | 'approved' | 'received' | 'refunded' | 'canceled' | (string & {});
-export type SellerRequirementSubmissionStatus = 'pending' | 'accepted' | 'rejected' | 'waived' | (string & {});
-export type SellerStatus = 'pending' | 'invited' | 'canceled' | 'onboarding' | 'ready_for_review' | 'approved' | 'rejected' | 'suspended' | (string & {});
-export type ShippingLabelStatus = 'purchased' | 'refund_requested' | 'refunded' | (string & {});
-export type StockLocationKind = 'warehouse' | 'store' | 'fulfillment_center' | (string & {});
+export type { ExchangeStatus } from '@spree/sdk-core';
+export type { FileUploadVisibility } from '@spree/sdk-core';
+export type { FulfillmentStatus } from '@spree/sdk-core';
+export type { ImportRowStatus } from '@spree/sdk-core';
+export type { ImportStatus } from '@spree/sdk-core';
+export type { InvitationStatus } from '@spree/sdk-core';
+export type { MediaType } from '@spree/sdk-core';
+export type { OptionTypeKind } from '@spree/sdk-core';
+export type { OrderFulfillmentStatus } from '@spree/sdk-core';
+export type { OrderPaymentStatus } from '@spree/sdk-core';
+export type { OrderStatus } from '@spree/sdk-core';
+export type { PackageTypeKind } from '@spree/sdk-core';
+export type { PayoutScheduleInterval } from '@spree/sdk-core';
+export type { ProductStatus } from '@spree/sdk-core';
+export type { ProductSubmissionStatus } from '@spree/sdk-core';
+export type { PurchaseUnit } from '@spree/sdk-core';
+export type { ReturnStatus } from '@spree/sdk-core';
+export type { SellerRequirementState } from '@spree/sdk-core';
+export type { SellerRequirementSubmissionStatus } from '@spree/sdk-core';
+export type { SellerStatus } from '@spree/sdk-core';
+export type { ShippingLabelFormat } from '@spree/sdk-core';
+export type { ShippingLabelOwnerType } from '@spree/sdk-core';
+export type { ShippingLabelSource } from '@spree/sdk-core';
+export type { ShippingLabelStatus } from '@spree/sdk-core';
+export type { StockLocationKind } from '@spree/sdk-core';
+export type { TaxIdentifierValidationStatus } from '@spree/sdk-core';
+export type { TaxRemittance } from '@spree/sdk-core';
export type { WeightUnit } from '@spree/sdk-core';
diff --git a/packages/seller-sdk/src/types/generated/Exchange.ts b/packages/seller-sdk/src/types/generated/Exchange.ts
index 5ef03969e6..f2b52e159a 100644
--- a/packages/seller-sdk/src/types/generated/Exchange.ts
+++ b/packages/seller-sdk/src/types/generated/Exchange.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 3a12c00a32a710da5ca445c048005031
+// Typelizer digest 90df17ed7014c2b10c5601fa268084d5
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {Reason, ExchangeLineItem, ExchangeStatus} from '@/types'
diff --git a/packages/seller-sdk/src/types/generated/FileUpload.ts b/packages/seller-sdk/src/types/generated/FileUpload.ts
index fbca555d15..7c98f0b611 100644
--- a/packages/seller-sdk/src/types/generated/FileUpload.ts
+++ b/packages/seller-sdk/src/types/generated/FileUpload.ts
@@ -1,14 +1,14 @@
-// Typelizer digest 7a884ae6d631bee1659086d1f953f34f
+// Typelizer digest 4f3e7718354f467bc1e83b6fb28e64b3
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {FileUploadTarget} from '@/types'
+import type {FileUploadTarget, FileUploadVisibility} from '@/types'
type FileUpload = {
signed_id: string;
filename: string;
content_type: string;
byte_size: number;
- visibility: 'public' | 'private';
+ visibility: FileUploadVisibility;
expires_at: string;
upload: FileUploadTarget | null;
}
diff --git a/packages/seller-sdk/src/types/generated/Fulfillment.ts b/packages/seller-sdk/src/types/generated/Fulfillment.ts
index 67f92316c7..6e58b60a82 100644
--- a/packages/seller-sdk/src/types/generated/Fulfillment.ts
+++ b/packages/seller-sdk/src/types/generated/Fulfillment.ts
@@ -1,4 +1,4 @@
-// Typelizer digest f19cfd2c8cc3b0f27161718fd05a3bcd
+// Typelizer digest 3c2d363a0763434f12660bec504b957b
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {FulfillmentItem, DeliveryRate, Delivery, ShippingLabel, FulfillmentStatus} from '@/types'
diff --git a/packages/seller-sdk/src/types/generated/Import.ts b/packages/seller-sdk/src/types/generated/Import.ts
index e63e44609a..250a8e8dfc 100644
--- a/packages/seller-sdk/src/types/generated/Import.ts
+++ b/packages/seller-sdk/src/types/generated/Import.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 0aedc5df79e66c6727f2048143abb3bd
+// Typelizer digest 26f8cb7ac5f819d3cd9f0e902d1c0fd7
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {ImportMapping, ImportStatus} from '@/types'
diff --git a/packages/seller-sdk/src/types/generated/ImportRow.ts b/packages/seller-sdk/src/types/generated/ImportRow.ts
index da7352171b..ec251539cf 100644
--- a/packages/seller-sdk/src/types/generated/ImportRow.ts
+++ b/packages/seller-sdk/src/types/generated/ImportRow.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 53b02b14bf92a5a0451aabdeab4f9636
+// Typelizer digest 5d8664a9cdc28c24fd16d81e21383315
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {ImportRowStatus} from '@/types'
diff --git a/packages/seller-sdk/src/types/generated/Invitation.ts b/packages/seller-sdk/src/types/generated/Invitation.ts
index bc7d82c359..dbb56a4f52 100644
--- a/packages/seller-sdk/src/types/generated/Invitation.ts
+++ b/packages/seller-sdk/src/types/generated/Invitation.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 82b23b3aa65e23088346388740a94f37
+// Typelizer digest d19765a6d7e7e17a401825da307ac6db
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {InvitationStatus} from '@/types'
diff --git a/packages/seller-sdk/src/types/generated/Media.ts b/packages/seller-sdk/src/types/generated/Media.ts
index c9c2ca65df..3bfe85a000 100644
--- a/packages/seller-sdk/src/types/generated/Media.ts
+++ b/packages/seller-sdk/src/types/generated/Media.ts
@@ -1,6 +1,7 @@
-// Typelizer digest becc137165a218235666651f0c1c3e57
+// Typelizer digest e153110cfce404048a94574c3fdaf4a5
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
+import type {MediaType} from '@/types'
type Media = {
id: string;
@@ -8,7 +9,7 @@ type Media = {
variant_ids: Array<string>;
position: number;
alt: string | null;
- media_type: 'image' | 'video' | 'external_video';
+ media_type: MediaType;
external_video_url: string | null;
focal_point_x: number | null;
focal_point_y: number | null;
diff --git a/packages/seller-sdk/src/types/generated/OptionType.ts b/packages/seller-sdk/src/types/generated/OptionType.ts
index d26aa270db..2b61fbdc6f 100644
--- a/packages/seller-sdk/src/types/generated/OptionType.ts
+++ b/packages/seller-sdk/src/types/generated/OptionType.ts
@@ -1,13 +1,14 @@
-// Typelizer digest 1c15410ad483e0374f08aade417a9bf6
+// Typelizer digest ccc36c14b64d467e098f9c20f09fe4b2
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
+import type {OptionTypeKind} from '@/types'
type OptionType = {
id: string;
name: string;
label: string;
position: number;
- kind: 'dropdown' | 'color_swatch' | 'buttons';
+ kind: OptionTypeKind;
}
export default OptionType;
diff --git a/packages/seller-sdk/src/types/generated/Order.ts b/packages/seller-sdk/src/types/generated/Order.ts
index 9558a82a2c..b171efae59 100644
--- a/packages/seller-sdk/src/types/generated/Order.ts
+++ b/packages/seller-sdk/src/types/generated/Order.ts
@@ -1,7 +1,7 @@
-// Typelizer digest a648c3c71ee6b2f1346a52e9cd00ee82
+// Typelizer digest aaa95934699f8ffe9dde0f156b3855b7
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {OrderLineItem, PaymentSplit, Fulfillment, Address, CurrencyCode} from '@/types'
+import type {OrderLineItem, PaymentSplit, Fulfillment, Address, CurrencyCode, OrderStatus, OrderFulfillmentStatus, OrderPaymentStatus} from '@/types'
type Order = {
id: string;
@@ -9,9 +9,9 @@ type Order = {
customer_note: string | null;
currency: CurrencyCode;
total_quantity: number;
- status: 'draft' | 'placed' | 'canceled';
- fulfillment_status: 'backorder' | 'canceled' | 'partial' | 'unfulfilled' | 'fulfilled' | 'delivered' | 'pending' | 'ready' | 'shipped' | null;
- payment_status: 'none' | 'authorized' | 'partially_paid' | 'paid' | 'partially_refunded' | 'refunded' | 'overcharged' | 'voided' | null;
+ status: OrderStatus;
+ fulfillment_status: OrderFulfillmentStatus | null;
+ payment_status: OrderPaymentStatus | null;
completed_at: string;
created_at: string;
updated_at: string;
diff --git a/packages/seller-sdk/src/types/generated/PackageType.ts b/packages/seller-sdk/src/types/generated/PackageType.ts
index d62ffe86ca..e307718a63 100644
--- a/packages/seller-sdk/src/types/generated/PackageType.ts
+++ b/packages/seller-sdk/src/types/generated/PackageType.ts
@@ -1,12 +1,12 @@
-// Typelizer digest abb3545569a8ce72b4c66999664fca9c
+// Typelizer digest da7dd278f9958845c028c72c4dda9e12
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {DimensionUnit, WeightUnit} from '@/types'
+import type {PackageTypeKind, DimensionUnit, WeightUnit} from '@/types'
type PackageType = {
id: string;
name: string;
- kind: 'box' | 'envelope' | 'carton' | 'pallet' | 'container';
+ kind: PackageTypeKind;
length: string | null;
width: string | null;
height: string | null;
diff --git a/packages/seller-sdk/src/types/generated/Product.ts b/packages/seller-sdk/src/types/generated/Product.ts
index eb26fdf06b..798973016a 100644
--- a/packages/seller-sdk/src/types/generated/Product.ts
+++ b/packages/seller-sdk/src/types/generated/Product.ts
@@ -1,4 +1,4 @@
-// Typelizer digest a160bc9d34413b3ce24d1b056fcf1ff7
+// Typelizer digest 7992f9c29e15c8abca70d2c75c5eae94
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {Price, PriceHistory, ProductSubmission, Seller, Media, Variant, OptionType, OptionValue, Category, CustomField, ProductStatus} from '@/types'
diff --git a/packages/seller-sdk/src/types/generated/ProductSubmission.ts b/packages/seller-sdk/src/types/generated/ProductSubmission.ts
index bbdf1029ba..d01f602597 100644
--- a/packages/seller-sdk/src/types/generated/ProductSubmission.ts
+++ b/packages/seller-sdk/src/types/generated/ProductSubmission.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 22f0175c103eaa9be3d28ffc3d6a7e25
+// Typelizer digest da3fcd4cba1a822fddf64c1adc7c1311
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {ProductSubmissionStatus} from '@/types'
diff --git a/packages/seller-sdk/src/types/generated/Profile.ts b/packages/seller-sdk/src/types/generated/Profile.ts
index 014cd9a0ff..fc02c20aed 100644
--- a/packages/seller-sdk/src/types/generated/Profile.ts
+++ b/packages/seller-sdk/src/types/generated/Profile.ts
@@ -1,7 +1,7 @@
-// Typelizer digest a01fd423e49b866e06dc48dfbe7d76e5
+// Typelizer digest c70694e614578d3b11f52d629ea04532
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {Policy, Address, SellerStatus, CurrencyCode} from '@/types'
+import type {Policy, Address, SellerStatus, TaxRemittance, PayoutScheduleInterval, CurrencyCode} from '@/types'
type Profile = {
id: string;
@@ -18,8 +18,8 @@ type Profile = {
registration_number: string | null;
contact_email: string | null;
billing_email: string | null;
- tax_remittance: string;
- payouts_schedule_interval: string | null;
+ tax_remittance: TaxRemittance;
+ payouts_schedule_interval: PayoutScheduleInterval | null;
holiday_mode_until: string | null;
terms_accepted_at: string | null;
created_at: string;
diff --git a/packages/seller-sdk/src/types/generated/RequirementStatus.ts b/packages/seller-sdk/src/types/generated/RequirementStatus.ts
index 91503d2001..2c7cf32402 100644
--- a/packages/seller-sdk/src/types/generated/RequirementStatus.ts
+++ b/packages/seller-sdk/src/types/generated/RequirementStatus.ts
@@ -1,7 +1,7 @@
-// Typelizer digest c3e47131f6be0040127cc94287730754
+// Typelizer digest 09e631b71ee7e615b438789fb3b842a0
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {RequirementSubmission, RequirementCustomField} from '@/types'
+import type {RequirementSubmission, RequirementCustomField, SellerRequirementState} from '@/types'
type RequirementStatus = {
id: string;
@@ -11,7 +11,7 @@ type RequirementStatus = {
description: string | null;
required: boolean;
position: number;
- status: 'complete' | 'incomplete' | 'pending' | 'rejected';
+ status: SellerRequirementState;
action_url: string | null;
blocker: { state: string; message: string | null } | null;
blocking: boolean;
diff --git a/packages/seller-sdk/src/types/generated/RequirementSubmission.ts b/packages/seller-sdk/src/types/generated/RequirementSubmission.ts
index 0746cb8312..393b5ba5d1 100644
--- a/packages/seller-sdk/src/types/generated/RequirementSubmission.ts
+++ b/packages/seller-sdk/src/types/generated/RequirementSubmission.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 9412b931ad0dcb35335e7f8e02aae567
+// Typelizer digest f3a7bad5a8129a53a95ec8191ab6d44b
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {SellerRequirementSubmissionStatus} from '@/types'
diff --git a/packages/seller-sdk/src/types/generated/Return.ts b/packages/seller-sdk/src/types/generated/Return.ts
index 4989b70386..cf33062eaf 100644
--- a/packages/seller-sdk/src/types/generated/Return.ts
+++ b/packages/seller-sdk/src/types/generated/Return.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 4ecdc042e68c766872927de2ed32fa38
+// Typelizer digest 29f21477b93a7164e860348c12547936
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {Reason, ReturnLineItem, ReturnStatus} from '@/types'
diff --git a/packages/seller-sdk/src/types/generated/ShippingLabel.ts b/packages/seller-sdk/src/types/generated/ShippingLabel.ts
index 9dfd7edbcf..5875ba55fb 100644
--- a/packages/seller-sdk/src/types/generated/ShippingLabel.ts
+++ b/packages/seller-sdk/src/types/generated/ShippingLabel.ts
@@ -1,25 +1,25 @@
-// Typelizer digest b25dde4577e69c227604574ade1dc28b
+// Typelizer digest b67b94c781f76ac15f85db09069ee3be
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {ShippingLabelStatus, CurrencyCode} from '@/types'
+import type {ShippingLabelSource, ShippingLabelStatus, CurrencyCode, ShippingLabelFormat, ShippingLabelOwnerType} from '@/types'
type ShippingLabel = {
id: string;
- source: 'purchased' | 'uploaded';
+ source: ShippingLabelSource;
status: ShippingLabelStatus;
carrier: string | null;
carrier_name: string | null;
service: string | null;
tracking_number: string | null;
currency: CurrencyCode | null;
- format: string | null;
+ format: ShippingLabelFormat | null;
external_id: string | null;
metadata: Record<string, unknown>;
refunded_at: string | null;
created_at: string;
updated_at: string;
owner_id: string;
- owner_type: 'fulfillment' | 'return';
+ owner_type: ShippingLabelOwnerType;
cost: string;
integration_id: string | null;
file_pending: boolean;
diff --git a/packages/seller-sdk/src/types/generated/StockLocation.ts b/packages/seller-sdk/src/types/generated/StockLocation.ts
index 1be3efd8a7..7de8089b5b 100644
--- a/packages/seller-sdk/src/types/generated/StockLocation.ts
+++ b/packages/seller-sdk/src/types/generated/StockLocation.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 875ba9b79ec8ff249ec5557f24ce9ef8
+// Typelizer digest a1404bfe4657a011f04174d850b24640
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {CountryCode, StockLocationKind} from '@/types'
diff --git a/packages/seller-sdk/src/types/generated/TaxIdentifier.ts b/packages/seller-sdk/src/types/generated/TaxIdentifier.ts
index 87efae69f9..988e786a6e 100644
--- a/packages/seller-sdk/src/types/generated/TaxIdentifier.ts
+++ b/packages/seller-sdk/src/types/generated/TaxIdentifier.ts
@@ -1,13 +1,14 @@
-// Typelizer digest 548e96449a9cfc00e3ddb345a807c2d3
+// Typelizer digest e825a2568ccaccd64d59300281d13100
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
+import type {TaxIdentifierValidationStatus} from '@/types'
type TaxIdentifier = {
id: string;
/** Tax identifier kind, keyed to a registered validator. Built-in: eu_vat. Extensions may register more. */
kind: string;
value: string;
- validation_status: 'pending' | 'verified' | 'unverified' | 'unavailable' | 'unsupported' | null;
+ validation_status: TaxIdentifierValidationStatus | null;
validated_at: string | null;
}
diff --git a/packages/seller-sdk/src/types/generated/Variant.ts b/packages/seller-sdk/src/types/generated/Variant.ts
index 9b2d31e898..8388787f22 100644
--- a/packages/seller-sdk/src/types/generated/Variant.ts
+++ b/packages/seller-sdk/src/types/generated/Variant.ts
@@ -1,7 +1,7 @@
-// Typelizer digest 7dec84a4d81d921f20568d64bcc06d4a
+// Typelizer digest 0ea142c8a2f82b13217e217439591304
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-import type {Price, PriceHistory, Seller, Media, OptionValue, CustomField, StockLevel, WeightUnit, DimensionUnit, CurrencyCode, CountryCode} from '@/types'
+import type {Price, PriceHistory, Seller, Media, OptionValue, CustomField, StockLevel, WeightUnit, DimensionUnit, PurchaseUnit, CurrencyCode, CountryCode} from '@/types'
type Variant = {
id: string;
@@ -24,7 +24,7 @@ type Variant = {
dimensions_unit: DimensionUnit;
minimum_order_quantity: number | null;
order_multiple: number | null;
- purchase_unit: 'unit' | 'carton' | null;
+ purchase_unit: PurchaseUnit | null;
units_per_carton: number | null;
price: Price;
original_price: Price | null;
diff --git a/packages/seller-sdk/src/types/generated/index.ts b/packages/seller-sdk/src/types/generated/index.ts
index c84e51f3d9..a0b0605b4d 100644
--- a/packages/seller-sdk/src/types/generated/index.ts
+++ b/packages/seller-sdk/src/types/generated/index.ts
@@ -1,7 +1,7 @@
-// Typelizer digest cf1009151ae7c417f75ea6a9689fd70a
+// Typelizer digest 93a5fe78d0d0284f819d939e2352d8b2
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
-export type { ClaimStatus, CountryCode, CurrencyCode, DimensionUnit, ExchangeStatus, FulfillmentStatus, ImportRowStatus, ImportStatus, InvitationStatus, ProductStatus, ProductSubmissionStatus, ReturnStatus, SellerRequirementSubmissionStatus, SellerStatus, ShippingLabelStatus, StockLocationKind, WeightUnit } from './Enums'
+export type { ClaimResolution, ClaimStatus, CountryCode, CurrencyCode, DeliveryStatus, DimensionUnit, ExchangeStatus, FileUploadVisibility, FulfillmentStatus, ImportRowStatus, ImportStatus, InvitationStatus, MediaType, OptionTypeKind, OrderFulfillmentStatus, OrderPaymentStatus, OrderStatus, PackageTypeKind, PayoutScheduleInterval, ProductStatus, ProductSubmissionStatus, PurchaseUnit, ReturnStatus, SellerRequirementState, SellerRequirementSubmissionStatus, SellerStatus, ShippingLabelFormat, ShippingLabelOwnerType, ShippingLabelSource, ShippingLabelStatus, StockLocationKind, TaxIdentifierValidationStatus, TaxRemittance, WeightUnit } from './Enums'
export type { default as Category } from './Category'
export type { default as CustomField } from './CustomField'
export type { default as OptionType } from './OptionType'
diff --git a/spree/api/app/serializers/spree/api/v3/admin/api_key_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/api_key_serializer.rb
index 2c93fe7d71..0906f94a6d 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/api_key_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/api_key_serializer.rb
@@ -12,7 +12,7 @@ module Spree
# via {#plaintext_token} below — it is `nil` everywhere else.
class ApiKeySerializer < V3::BaseSerializer
typelize name: :string,
- key_type: [:string, enum: Spree::ApiKey::KEY_TYPES],
+ key_type: [:string, enum: Spree::ApiKey::KEY_TYPES, enum_type_name: 'ApiKeyType'],
token_prefix: [:string, nullable: true],
plaintext_token: [:string, nullable: true],
scopes: [:string, multi: true],
diff --git a/spree/api/app/serializers/spree/api/v3/admin/catalog_assignment_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/catalog_assignment_serializer.rb
index 97822d7bfb..aef9a7319b 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/catalog_assignment_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/catalog_assignment_serializer.rb
@@ -3,7 +3,7 @@ module Spree
module V3
module Admin
class CatalogAssignmentSerializer < V3::BaseSerializer
- typelize catalog_id: :string, assignable_type: :string, assignable_id: :string,
+ typelize catalog_id: :string, assignable_type: [:string, enum: Spree::CatalogAssignment::ASSIGNABLE_TYPES.map { |type| Spree::Base.polymorphic_api_type(type) }, enum_type_name: 'CatalogAssignableType'], assignable_id: :string,
assignable_name: [:string, nullable: true]
attributes created_at: :iso8601
diff --git a/spree/api/app/serializers/spree/api/v3/admin/catalog_price_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/catalog_price_serializer.rb
index aa5953605b..decdfcf6d7 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/catalog_price_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/catalog_price_serializer.rb
@@ -17,7 +17,7 @@ module Spree
_attributes.delete(:id)
typelize id: 'string | null', label: 'string | null', sku: 'string | null',
- currency: [:string, enum: Spree::Money::Rounding::CURRENCY_CODES, enum_type_name: 'CurrencyCode'], source: [:string, enum: Spree::CatalogPrice::SOURCES], break_count: :number
+ currency: [:string, enum: Spree::Money::Rounding::CURRENCY_CODES, enum_type_name: 'CurrencyCode'], source: [:string, enum: Spree::CatalogPrice::SOURCES, enum_type_name: 'CatalogPriceSource'], break_count: :number
# The variant this prices, so a row can name what it is showing —
# a product's variants can be priced differently, and one figure
diff --git a/spree/api/app/serializers/spree/api/v3/admin/collection_rule_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/collection_rule_serializer.rb
index 58ac41565e..4dda06702c 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/collection_rule_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/collection_rule_serializer.rb
@@ -8,7 +8,7 @@ module Spree
# wire shorthand (e.g. "tag"), matching every other typed-rule
# serializer and what the writer accepts.
class CollectionRuleSerializer < BaseSerializer
- typelize type: [:string, comment: 'Rule type. Built-in: tag, available_on, sale. Extensions may register more.'], value: [:string, nullable: true], match_policy: [:string, enum: Spree::CollectionRule::MATCH_POLICIES]
+ typelize type: [:string, comment: 'Rule type. Built-in: tag, available_on, sale. Extensions may register more.'], value: [:string, nullable: true], match_policy: [:string, enum: Spree::CollectionRule::MATCH_POLICIES, enum_type_name: 'CollectionRuleMatchPolicy']
attributes :value, :match_policy
diff --git a/spree/api/app/serializers/spree/api/v3/admin/collection_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/collection_serializer.rb
index e9f2e4a962..8f07f22ec2 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/collection_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/collection_serializer.rb
@@ -8,7 +8,7 @@ module Spree
class CollectionSerializer < V3::CollectionSerializer
include Spree::Api::V3::Admin::Translatable
- typelize automatic: :boolean, rules_match_policy: [:string, enum: Spree::Collection::RULES_MATCH_POLICIES],
+ typelize automatic: :boolean, rules_match_policy: [:string, enum: Spree::Collection::RULES_MATCH_POLICIES, enum_type_name: 'MatchPolicy'],
metadata: 'Record<string, unknown>'
attributes :automatic, :rules_match_policy, :metadata,
diff --git a/spree/api/app/serializers/spree/api/v3/admin/commission_line_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/commission_line_serializer.rb
index 1384191a13..f672b6a7aa 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/commission_line_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/commission_line_serializer.rb
@@ -19,8 +19,8 @@ module Spree
line_item_id: 'string | null',
fulfillment_id: 'string | null',
commission_rate_id: 'string | null',
- kind: [:string, enum: Spree::CommissionRate::KINDS],
- taxability_reason: 'string | null',
+ kind: [:string, enum: Spree::CommissionRate::KINDS, enum_type_name: 'CommissionKind'],
+ taxability_reason: [:string, nullable: true, enum: Spree::TaxLine::BUILT_IN_TAXABILITY_REASONS, enum_type_name: 'TaxabilityReason'],
country_code: [:string, nullable: true, enum: Spree::IsoData.country_codes, enum_type_name: 'CountryCode'],
state_code: 'string | null',
currency: [:string, enum: Spree::Money::Rounding::CURRENCY_CODES, enum_type_name: 'CurrencyCode']
diff --git a/spree/api/app/serializers/spree/api/v3/admin/commission_rate_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/commission_rate_serializer.rb
index 56745a8f19..edfb5ecdd7 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/commission_rate_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/commission_rate_serializer.rb
@@ -15,7 +15,7 @@ module Spree
enabled: :boolean,
position: :number,
global: :boolean,
- kind: [:string, enum: Spree::CommissionRate::KINDS],
+ kind: [:string, enum: Spree::CommissionRate::KINDS, enum_type_name: 'CommissionKind'],
amounts: 'Record<string, string>',
bounds: 'Record<string, { min_amount: string | null; max_amount: string | null }>',
tax_inclusive: :boolean,
diff --git a/spree/api/app/serializers/spree/api/v3/admin/consent_record_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/consent_record_serializer.rb
index ffdc2ebbc6..c07a3cac81 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/consent_record_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/consent_record_serializer.rb
@@ -5,7 +5,7 @@ module Spree
# Admin API Consent Record Serializer
# The evidence trail behind a customer's consent state.
class ConsentRecordSerializer < BaseSerializer
- typelize purpose: :string, source: [:string, enum: Spree::ConsentRecord::SOURCES], accepted: :boolean,
+ typelize purpose: :string, source: [:string, enum: Spree::ConsentRecord::SOURCES, enum_type_name: 'ConsentSource'], accepted: :boolean,
email: [:string, nullable: true],
ip_address: [:string, nullable: true],
recorded_at: [:string, nullable: true],
diff --git a/spree/api/app/serializers/spree/api/v3/admin/email_template_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/email_template_serializer.rb
index e0e5920883..554f33cec8 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/email_template_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/email_template_serializer.rb
@@ -7,7 +7,7 @@ module Spree
# default, and the draft in progress.
class EmailTemplateSerializer < V3::BaseSerializer
typelize key: :string,
- kind: [:string, enum: Spree::Emails::EditableTemplates::KINDS.map(&:to_s)],
+ kind: [:string, enum: Spree::Emails::EditableTemplates::KINDS.map(&:to_s), enum_type_name: 'EmailTemplateKind'],
language: :string,
customized: :boolean,
customized_languages: [:string, multi: true],
diff --git a/spree/api/app/serializers/spree/api/v3/admin/order_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/order_serializer.rb
index fcaebe8823..f697b7d991 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/order_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/order_serializer.rb
@@ -31,7 +31,7 @@ module Spree
total: [:string, nullable: false],
amount_due: [:string, nullable: false]
- typelize status: [:string, enum: Spree::Order::STATUSES],
+ typelize status: [:string, enum: Spree::Order::STATUSES, enum_type_name: 'OrderStatus'],
last_ip_address: [:string, nullable: true],
considered_risky: :boolean, confirmation_delivered: :boolean,
store_owner_notification_delivered: [:boolean, nullable: true],
diff --git a/spree/api/app/serializers/spree/api/v3/admin/package_type_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/package_type_serializer.rb
index be92cf43de..3ca73b675d 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/package_type_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/package_type_serializer.rb
@@ -7,7 +7,7 @@ module Spree
# only — a shopper never picks their packaging.
class PackageTypeSerializer < V3::BaseSerializer
typelize name: :string,
- kind: [:string, enum: Spree::PackageType::KINDS],
+ kind: [:string, enum: Spree::PackageType::KINDS, enum_type_name: 'PackageTypeKind'],
length: [:string, nullable: true],
width: [:string, nullable: true],
height: [:string, nullable: true],
diff --git a/spree/api/app/serializers/spree/api/v3/admin/permission_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/permission_serializer.rb
index 28c0d9af8f..bf61de49de 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/permission_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/permission_serializer.rb
@@ -10,7 +10,7 @@ module Spree
include Alba::Resource
include Typelizer::DSL
- typelize key: :string, resource: :string, kind: [:string, enum: %w[read write]], group: :string,
+ typelize key: :string, resource: :string, kind: [:string, enum: %w[read write], enum_type_name: 'PermissionKind'], group: :string,
group_label: :string, label: :string, description: :string
attributes :key
diff --git a/spree/api/app/serializers/spree/api/v3/admin/price_list_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/price_list_serializer.rb
index 81e1b51911..1ea28aebb2 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/price_list_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/price_list_serializer.rb
@@ -14,7 +14,7 @@ module Spree
starts_at: 'string | null',
ends_at: 'string | null',
deleted_at: 'string | null',
- match_policy: [:string, enum: Spree::PriceList::MATCH_POLICIES],
+ match_policy: [:string, enum: Spree::PriceList::MATCH_POLICIES, enum_type_name: 'MatchPolicy'],
price_adjustment_percentage: 'string | null',
adjust_compare_at: :boolean,
automatic_pricing: :boolean,
diff --git a/spree/api/app/serializers/spree/api/v3/admin/purchase_order_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/purchase_order_serializer.rb
index e5e2698c88..72a56e576b 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/purchase_order_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/purchase_order_serializer.rb
@@ -6,7 +6,7 @@ module Spree
# the merchant owes and expects, which no customer ever sees.
class PurchaseOrderSerializer < V3::BaseSerializer
typelize number: :string,
- status: :string,
+ status: [:string, enum: Spree::PurchaseOrder.statuses, enum_type_name: 'PurchaseOrderStatus'],
currency: [:string, enum: Spree::Money::Rounding::CURRENCY_CODES, enum_type_name: 'CurrencyCode'],
reference: 'string | null',
notes: 'string | null',
diff --git a/spree/api/app/serializers/spree/api/v3/admin/seller_requirement_status_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/seller_requirement_status_serializer.rb
index 4d0132a9e7..2e195bec3a 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/seller_requirement_status_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/seller_requirement_status_serializer.rb
@@ -12,7 +12,7 @@ module Spree
typelize id: :string, kind: [:string, comment: 'Requirement kind. Built-in: accept_terms, complete_profile, billing_address, returns_address, delivery_method, package_type, minimum_products, payout_account, required_custom_fields, policy, attestation, operator_review, document. Extensions may register more.'], name: :string,
description: [:string, nullable: true],
- required: :boolean, position: :number, status: [:string, enum: Spree::SellerRequirementStatus::STATUSES],
+ required: :boolean, position: :number, status: [:string, enum: Spree::SellerRequirementStatus::STATUSES, enum_type_name: 'SellerRequirementState'],
blocking: :boolean, action_url: [:string, nullable: true],
blocker: ['{ state: string; message: string | null } | null'],
required_policy_name: [:string, nullable: true]
diff --git a/spree/api/app/serializers/spree/api/v3/admin/seller_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/seller_serializer.rb
index 16af30b146..172b2845d9 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/seller_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/seller_serializer.rb
@@ -10,8 +10,8 @@ module Spree
legal_name: [:string, nullable: true],
registration_number: [:string, nullable: true],
contact_email: [:string, nullable: true], billing_email: [:string, nullable: true],
- tax_remittance: :string,
- payouts_schedule_interval: [:string, nullable: true],
+ tax_remittance: [:string, enum: Spree::Seller::TAX_REMITTANCES, enum_type_name: 'TaxRemittance'],
+ payouts_schedule_interval: [:string, nullable: true, enum: Spree::Seller::PAYOUT_INTERVALS, enum_type_name: 'PayoutScheduleInterval'],
minimum_payout_amount: [:string, nullable: true],
holiday_mode_until: [:string, nullable: true],
terms_accepted_at: [:string, nullable: true],
diff --git a/spree/api/app/serializers/spree/api/v3/admin/seller_transfer_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/seller_transfer_serializer.rb
index 92170c61f6..281a343d92 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/seller_transfer_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/seller_transfer_serializer.rb
@@ -14,7 +14,7 @@ module Spree
refund_id: 'string | null',
seller_name: 'string | null',
order_number: 'string | null',
- kind: [:string, enum: Spree::SellerTransfer::KINDS],
+ kind: [:string, enum: Spree::SellerTransfer::KINDS, enum_type_name: 'SellerTransferKind'],
status: [:string, enum: Spree::SellerTransfer.statuses, enum_type_name: 'SellerTransferStatus'],
provider: [:string, comment: 'Payout provider. Built-in: system. Provider gems register more (e.g. stripe).'],
amount: :string,
diff --git a/spree/api/app/serializers/spree/api/v3/admin/shipping_label_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/shipping_label_serializer.rb
index ef730a2b3e..2d0e3f20dc 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/shipping_label_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/shipping_label_serializer.rb
@@ -7,15 +7,15 @@ module Spree
# The file is streamed through +download_url+, never linked to storage.
class ShippingLabelSerializer < V3::BaseSerializer
typelize owner_id: :string,
- owner_type: [:string, enum: Spree::ShippingLabel::OWNER_TYPES.map { |type| Spree::Base.polymorphic_api_type(type) }],
- source: [:string, enum: Spree::ShippingLabel::SOURCES],
+ owner_type: [:string, enum: Spree::ShippingLabel::OWNER_TYPES.map { |type| Spree::Base.polymorphic_api_type(type) }, enum_type_name: 'ShippingLabelOwnerType'],
+ source: [:string, enum: Spree::ShippingLabel::SOURCES, enum_type_name: 'ShippingLabelSource'],
status: [:string, enum: Spree::ShippingLabel.statuses, enum_type_name: 'ShippingLabelStatus'],
carrier: [:string, nullable: true],
carrier_name: [:string, nullable: true],
service: [:string, nullable: true],
tracking_number: [:string, nullable: true],
currency: [:string, nullable: true, enum: Spree::Money::Rounding::CURRENCY_CODES, enum_type_name: 'CurrencyCode'],
- format: [:string, nullable: true],
+ format: [:string, nullable: true, enum: Spree::ShippingLabel::FORMATS, enum_type_name: 'ShippingLabelFormat'],
external_id: [:string, nullable: true],
integration_id: [:string, nullable: true],
download_url: [:string, nullable: true],
diff --git a/spree/api/app/serializers/spree/api/v3/admin/stock_location_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/stock_location_serializer.rb
index 45cf17d1d9..03d04b6c88 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/stock_location_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/stock_location_serializer.rb
@@ -15,7 +15,7 @@ module Spree
address2: [:string, nullable: true], state_name: [:string, nullable: true],
phone: [:string, nullable: true], company: [:string, nullable: true],
kind: [:string, enum: Spree::StockLocation::KINDS, enum_type_name: 'StockLocationKind'],
- pickup_stock_policy: [:string, enum: Spree::StockLocation::PICKUP_STOCK_POLICIES],
+ pickup_stock_policy: [:string, enum: Spree::StockLocation::PICKUP_STOCK_POLICIES, enum_type_name: 'PickupStockPolicy'],
pickup_ready_in_minutes: [:number, nullable: true],
pickup_instructions: [:string, nullable: true]
diff --git a/spree/api/app/serializers/spree/api/v3/admin/stock_receipt_item_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/stock_receipt_item_serializer.rb
index 5fd2fa6eb8..7de7f7cef8 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/stock_receipt_item_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/stock_receipt_item_serializer.rb
@@ -7,9 +7,9 @@ module Spree
class StockReceiptItemSerializer < V3::BaseSerializer
typelize quantity_accepted: :number,
quantity_rejected: :number,
- rejection_reason: [:string, enum: Spree::StockReceiptItem::REJECTION_REASONS, nullable: true],
+ rejection_reason: [:string, enum: Spree::StockReceiptItem::REJECTION_REASONS, nullable: true, enum_type_name: 'StockReceiptRejectionReason'],
notes: 'string | null',
- line_type: [:string, enum: %w[purchase_order_item stock_transfer_item]],
+ line_type: [:string, enum: %w[purchase_order_item stock_transfer_item], enum_type_name: 'StockReceiptLineType'],
line_id: 'string | null',
product_id: 'string | null',
variant_id: 'string | null',
diff --git a/spree/api/app/serializers/spree/api/v3/admin/stock_receipt_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/stock_receipt_serializer.rb
index ace0aa5c73..fa8085969d 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/stock_receipt_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/stock_receipt_serializer.rb
@@ -9,7 +9,7 @@ module Spree
reference: 'string | null',
notes: 'string | null',
received_at: :string,
- receivable_type: [:string, enum: %w[purchase_order stock_transfer]],
+ receivable_type: [:string, enum: %w[purchase_order stock_transfer], enum_type_name: 'StockReceiptReceivableType'],
receivable_id: :string,
received_by_id: 'string | null',
received_by_type: [:string, nullable: true, enum: Spree::Actor::BUILT_IN_KINDS, enum_type_name: 'ActorKind'],
diff --git a/spree/api/app/serializers/spree/api/v3/admin/stock_transfer_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/stock_transfer_serializer.rb
index 1f38ef6f9b..7202cb872f 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/stock_transfer_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/stock_transfer_serializer.rb
@@ -6,7 +6,7 @@ module Spree
# has a middle: `shipped_at` is when the units left the source,
# `received_at` when the destination finished counting them in.
class StockTransferSerializer < V3::StockTransferSerializer
- typelize status: :string,
+ typelize status: [:string, enum: Spree::StockTransfer.statuses, enum_type_name: 'StockTransferStatus'],
notes: 'string | null',
items_count: :number,
quantity_shipped_total: :number,
diff --git a/spree/api/app/serializers/spree/api/v3/admin/tax_identifier_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/tax_identifier_serializer.rb
index c058335f74..0422e7a65d 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/tax_identifier_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/tax_identifier_serializer.rb
@@ -3,10 +3,10 @@ module Spree
module V3
module Admin
class TaxIdentifierSerializer < V3::TaxIdentifierSerializer
- typelize validation_status: [:string, nullable: true, enum: Spree::TaxIdentifier::VALIDATION_STATUSES],
+ typelize validation_status: [:string, nullable: true, enum: Spree::TaxIdentifier::VALIDATION_STATUSES, enum_type_name: 'TaxIdentifierValidationStatus'],
validated_at: [:string, nullable: true],
validation_evidence: ['Record<string, unknown>', nullable: true],
- source: [:string, nullable: true, enum: Spree::TaxIdentifier::SOURCES],
+ source: [:string, nullable: true, enum: Spree::TaxIdentifier::SOURCES, enum_type_name: 'TaxIdentifierSource'],
validatable: :boolean,
customer_id: [:string, nullable: true],
cart_id: [:string, nullable: true],
diff --git a/spree/api/app/serializers/spree/api/v3/admin/tax_line_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/tax_line_serializer.rb
index b61d2f5e7d..e9c22b849b 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/tax_line_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/tax_line_serializer.rb
@@ -7,7 +7,7 @@ module Spree
typelize amount: [:string, nullable: false],
provider_id: [:string, nullable: true], metadata: ['Record<string, unknown>', nullable: true],
- taxability_reason: [:string, nullable: true], country_code: [:string, nullable: true, enum: Spree::IsoData.country_codes, enum_type_name: 'CountryCode'],
+ taxability_reason: [:string, nullable: true, enum: Spree::TaxLine::BUILT_IN_TAXABILITY_REASONS, enum_type_name: 'TaxabilityReason'], country_code: [:string, nullable: true, enum: Spree::IsoData.country_codes, enum_type_name: 'CountryCode'],
state_code: [:string, nullable: true], data: ['Record<string, unknown>', nullable: true],
original_tax_line_id: [:string, nullable: true]
diff --git a/spree/api/app/serializers/spree/api/v3/admin/variant_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/variant_serializer.rb
index de0bd419bb..3852c0ab52 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/variant_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/variant_serializer.rb
@@ -24,7 +24,7 @@ module Spree
deleted_at: [:string, nullable: true],
delivery_profile_id: [:string, nullable: true],
minimum_order_quantity: ['number | null'], order_multiple: ['number | null'],
- purchase_unit: [:string, nullable: true, enum: Spree::Variant::PURCHASE_UNITS],
+ purchase_unit: [:string, nullable: true, enum: Spree::Variant::PURCHASE_UNITS, enum_type_name: 'PurchaseUnit'],
carton_package_type_id: [:string, nullable: true],
carton_weight: [:string, nullable: true],
cartons_per_pallet: ['number | null'],
diff --git a/spree/api/app/serializers/spree/api/v3/base_serializer.rb b/spree/api/app/serializers/spree/api/v3/base_serializer.rb
index be8bcd1975..21c899f7d8 100644
--- a/spree/api/app/serializers/spree/api/v3/base_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/base_serializer.rb
@@ -126,7 +126,7 @@ module Spree
names = model.exposed_preference_names.to_a - except if names.empty?
definitions = model.preference_definitions
names.each do |name|
- typelize name => preference_type_hint(Spree::PreferenceSchema::JsonSchema.property_schema(definitions.fetch(name)))
+ typelize name => preference_type_hint(Spree::PreferenceSchema::JsonSchema.property_schema(definitions.fetch(name)), name)
reader = :"preferred_#{name}"
attribute(name) do |object|
value = object.public_send(reader)
@@ -138,12 +138,29 @@ module Spree
TYPELIZER_TYPES = { 'string' => :string, 'integer' => :number, 'number' => :number, 'boolean' => :boolean }.freeze
private_constant :TYPELIZER_TYPES
- def self.preference_type_hint(schema)
+ # The shared name of each setting's value list, so it is defined once
+ # in `@spree/core` rather than inline wherever the setting appears.
+ PREFERENCE_LIST_NAMES = {
+ capture_method: 'CaptureMethod',
+ default_payouts_schedule_interval: 'PayoutScheduleInterval',
+ document_number_format: 'DocumentNumberFormat',
+ email_font: 'EmailFont',
+ inventory_provider_failure_policy: 'ProviderFailurePolicy',
+ pricing_provider_failure_policy: 'ProviderFailurePolicy',
+ storefront_access: 'StorefrontAccess',
+ unit_system: 'UnitSystem'
+ }.freeze
+ private_constant :PREFERENCE_LIST_NAMES
+
+ def self.preference_type_hint(schema, name)
types = Array(schema['type'])
hint = TYPELIZER_TYPES.fetch((types - ['null']).first, :unknown)
options = {}
options[:nullable] = true if types.include?('null')
- options[:enum] = schema['enum'].compact if schema['enum']
+ if schema['enum']
+ options[:enum] = schema['enum'].compact
+ options[:enum_type_name] = PREFERENCE_LIST_NAMES[name.to_sym] if PREFERENCE_LIST_NAMES.key?(name.to_sym)
+ end
options.empty? ? hint : [hint, options]
end
private_class_method :preference_type_hint
diff --git a/spree/api/app/serializers/spree/api/v3/claim_serializer.rb b/spree/api/app/serializers/spree/api/v3/claim_serializer.rb
index b9484d0ecf..6547c71ca5 100644
--- a/spree/api/app/serializers/spree/api/v3/claim_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/claim_serializer.rb
@@ -7,7 +7,7 @@ module Spree
class ClaimSerializer < BaseSerializer
typelize number: :string,
status: [:string, enum: Spree::Claim.statuses, enum_type_name: 'ClaimStatus'],
- resolution: [:string, nullable: true],
+ resolution: [:string, nullable: true, enum: Spree::Claim::RESOLUTIONS, enum_type_name: 'ClaimResolution'],
order_id: [:string, nullable: true],
reason_id: [:string, nullable: true],
approved_at: [:string, nullable: true],
diff --git a/spree/api/app/serializers/spree/api/v3/collection_serializer.rb b/spree/api/app/serializers/spree/api/v3/collection_serializer.rb
index a5074adbe1..535b775f39 100644
--- a/spree/api/app/serializers/spree/api/v3/collection_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/collection_serializer.rb
@@ -6,7 +6,7 @@ module Spree
# back-office state exposed only by the Admin serializer.
class CollectionSerializer < BaseSerializer
typelize name: :string, permalink: :string, position: :number,
- sort_order: :string,
+ sort_order: [:string, enum: Spree::Collection::SORT_ORDERS, enum_type_name: 'CollectionSortOrder'],
meta_title: [:string, nullable: true], meta_description: [:string, nullable: true], meta_keywords: [:string, nullable: true],
description: :string, description_html: :string,
image_url: [:string, nullable: true], square_image_url: [:string, nullable: true],
diff --git a/spree/api/app/serializers/spree/api/v3/company_invitation_serializer.rb b/spree/api/app/serializers/spree/api/v3/company_invitation_serializer.rb
index 86c819953a..fceced7e1a 100644
--- a/spree/api/app/serializers/spree/api/v3/company_invitation_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/company_invitation_serializer.rb
@@ -4,7 +4,7 @@ module Spree
# A pending (or spent) invitation into a company node. The token is
# deliberately absent — it travels only in the invite email.
class CompanyInvitationSerializer < BaseSerializer
- typelize email: :string, company_id: :string, status: [:string, enum: %w[pending accepted revoked expired]],
+ typelize email: :string, company_id: :string, status: [:string, enum: %w[pending accepted revoked expired], enum_type_name: 'CompanyInvitationStatus'],
expires_at: [:string, nullable: true]
attributes :email, expires_at: :iso8601
diff --git a/spree/api/app/serializers/spree/api/v3/company_serializer.rb b/spree/api/app/serializers/spree/api/v3/company_serializer.rb
index 1c0952a223..278d11a368 100644
--- a/spree/api/app/serializers/spree/api/v3/company_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/company_serializer.rb
@@ -7,7 +7,7 @@ module Spree
# back-office fields stay in one place.
class CompanySerializer < BaseSerializer
typelize name: :string,
- kind: [:string, enum: Spree::Company::KINDS], parent_id: [:string, nullable: true],
+ kind: [:string, enum: Spree::Company::KINDS, enum_type_name: 'CompanyKind'], parent_id: [:string, nullable: true],
po_number_required: :boolean,
ancestors: 'Array<{id: string, name: string, kind: string}>'
diff --git a/spree/api/app/serializers/spree/api/v3/data_request_event_serializer.rb b/spree/api/app/serializers/spree/api/v3/data_request_event_serializer.rb
index 857ca2684f..c4c4816cae 100644
--- a/spree/api/app/serializers/spree/api/v3/data_request_event_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/data_request_event_serializer.rb
@@ -11,7 +11,7 @@ module Spree
# log. Subscribers get the fact that a request finished; fetching the
# file stays an authenticated act by the person it belongs to.
class DataRequestEventSerializer < BaseSerializer
- typelize number: :string, kind: [:string, enum: Spree::DataRequest::KINDS], status: [:string, enum: Spree::DataRequest.statuses, enum_type_name: 'DataRequestStatus'],
+ typelize number: :string, kind: [:string, enum: Spree::DataRequest::KINDS, enum_type_name: 'DataRequestKind'], status: [:string, enum: Spree::DataRequest.statuses, enum_type_name: 'DataRequestStatus'],
requested_at: [:string, nullable: true],
completed_at: [:string, nullable: true]
diff --git a/spree/api/app/serializers/spree/api/v3/data_request_serializer.rb b/spree/api/app/serializers/spree/api/v3/data_request_serializer.rb
index 0d5470b673..f133d860a8 100644
--- a/spree/api/app/serializers/spree/api/v3/data_request_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/data_request_serializer.rb
@@ -4,7 +4,7 @@ module Spree
# Store API Data Request Serializer
# A customer's own GDPR access or erasure request.
class DataRequestSerializer < BaseSerializer
- typelize number: :string, kind: [:string, enum: Spree::DataRequest::KINDS], status: [:string, enum: Spree::DataRequest.statuses, enum_type_name: 'DataRequestStatus'],
+ typelize number: :string, kind: [:string, enum: Spree::DataRequest::KINDS, enum_type_name: 'DataRequestKind'], status: [:string, enum: Spree::DataRequest.statuses, enum_type_name: 'DataRequestStatus'],
requested_at: [:string, nullable: true],
completed_at: [:string, nullable: true],
expires_at: [:string, nullable: true],
diff --git a/spree/api/app/serializers/spree/api/v3/delivery_serializer.rb b/spree/api/app/serializers/spree/api/v3/delivery_serializer.rb
index f6959477e7..db81eeddb7 100644
--- a/spree/api/app/serializers/spree/api/v3/delivery_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/delivery_serializer.rb
@@ -10,7 +10,7 @@ module Spree
carrier: [:string, nullable: true],
carrier_name: [:string, nullable: true],
service: [:string, nullable: true],
- status: [:string, enum: Spree::Delivery::STATUSES],
+ status: [:string, enum: Spree::Delivery::STATUSES, enum_type_name: 'DeliveryStatus'],
estimated_delivery_at: [:string, nullable: true],
delivered_at: [:string, nullable: true]
diff --git a/spree/api/app/serializers/spree/api/v3/delivery_zone_member_serializer.rb b/spree/api/app/serializers/spree/api/v3/delivery_zone_member_serializer.rb
index 305ae1c645..359cb30e7f 100644
--- a/spree/api/app/serializers/spree/api/v3/delivery_zone_member_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/delivery_zone_member_serializer.rb
@@ -2,7 +2,7 @@ module Spree
module Api
module V3
class DeliveryZoneMemberSerializer < BaseSerializer
- typelize member_type: [:string, enum: Spree::DeliveryZoneMember::MEMBER_TYPES], country_code: [:string, nullable: true, enum: Spree::IsoData.country_codes, enum_type_name: 'CountryCode'],
+ typelize member_type: [:string, enum: Spree::DeliveryZoneMember::MEMBER_TYPES, enum_type_name: 'DeliveryZoneMemberType'], country_code: [:string, nullable: true, enum: Spree::IsoData.country_codes, enum_type_name: 'CountryCode'],
country_name: [:string, nullable: true],
state_code: [:string, nullable: true], state_name: [:string, nullable: true],
postal_code_prefix: [:string, nullable: true],
diff --git a/spree/api/app/serializers/spree/api/v3/discount_serializer.rb b/spree/api/app/serializers/spree/api/v3/discount_serializer.rb
index 747469d276..40af88f55b 100644
--- a/spree/api/app/serializers/spree/api/v3/discount_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/discount_serializer.rb
@@ -5,7 +5,7 @@ module Spree
# line item or fulfillment. The embedded `discounts` key on Cart/Order
# stays the applied-promotion summary — see AppliedPromotionSerializer.
class DiscountSerializer < BaseSerializer
- typelize label: :string, kind: [:string, enum: Spree::Discount::KINDS], code: [:string, nullable: true],
+ typelize label: :string, kind: [:string, enum: Spree::Discount::KINDS, enum_type_name: 'DiscountKind'], code: [:string, nullable: true],
value: [:string, nullable: true], value_type: [:string, nullable: true],
promotion_id: [:string, nullable: true], line_item_id: [:string, nullable: true],
fulfillment_id: [:string, nullable: true]
diff --git a/spree/api/app/serializers/spree/api/v3/file_upload_serializer.rb b/spree/api/app/serializers/spree/api/v3/file_upload_serializer.rb
index e30c506198..7ae5f1652e 100644
--- a/spree/api/app/serializers/spree/api/v3/file_upload_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/file_upload_serializer.rb
@@ -15,7 +15,7 @@ module Spree
filename: :string,
content_type: :string,
byte_size: :number,
- visibility: [:string, enum: Spree::FileUpload::VISIBILITIES],
+ visibility: [:string, enum: Spree::FileUpload::VISIBILITIES, enum_type_name: 'FileUploadVisibility'],
expires_at: :string,
upload: [:FileUploadTarget, nullable: true]
diff --git a/spree/api/app/serializers/spree/api/v3/fulfillment_serializer.rb b/spree/api/app/serializers/spree/api/v3/fulfillment_serializer.rb
index 798f6a09e2..d0dd0ea74a 100644
--- a/spree/api/app/serializers/spree/api/v3/fulfillment_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/fulfillment_serializer.rb
@@ -4,7 +4,7 @@ module Spree
class FulfillmentSerializer < BaseSerializer
typelize number: :string,
status: [:string, enum: Spree::Fulfillment.statuses, enum_type_name: 'FulfillmentStatus'],
- fulfillment_type: [:string, enum: %w[shipping digital pickup pickup_point]],
+ fulfillment_type: [:string, enum: %w[shipping digital pickup pickup_point], enum_type_name: 'FulfillmentType'],
tracking: [:string, nullable: true], tracking_url: [:string, nullable: true],
fulfilled_at: [:string, nullable: true], delivered_at: [:string, nullable: true], unpriced: :boolean,
items: 'Array<{ item_id: string; variant_id: string; quantity: number }>',
diff --git a/spree/api/app/serializers/spree/api/v3/media_event_serializer.rb b/spree/api/app/serializers/spree/api/v3/media_event_serializer.rb
index 4e05fd70a0..77725c2c6d 100644
--- a/spree/api/app/serializers/spree/api/v3/media_event_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/media_event_serializer.rb
@@ -7,7 +7,7 @@ module Spree
# `type` is not exposed: the old Spree::Image/Spree::Video STI collapsed
# into one class, so the column is a legacy vestige with no subclasses
# — `media_type` is the discriminator (see MediaSerializer).
- typelize media_type: [:string, enum: Spree::Media::MEDIA_TYPES], viewable_type: :string,
+ typelize media_type: [:string, enum: Spree::Media::MEDIA_TYPES, enum_type_name: 'MediaType'], viewable_type: :string,
viewable_id: :string, position: [:number, nullable: true],
alt: [:string, nullable: true]
diff --git a/spree/api/app/serializers/spree/api/v3/media_serializer.rb b/spree/api/app/serializers/spree/api/v3/media_serializer.rb
index 211825eaf7..929583c943 100644
--- a/spree/api/app/serializers/spree/api/v3/media_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/media_serializer.rb
@@ -5,7 +5,7 @@ module Spree
typelize position: :number, alt: [:string, nullable: true],
product_id: [:string, nullable: true],
variant_ids: [:string, multi: true],
- media_type: [:string, enum: Spree::Media::MEDIA_TYPES],
+ media_type: [:string, enum: Spree::Media::MEDIA_TYPES, enum_type_name: 'MediaType'],
focal_point_x: [:number, nullable: true],
focal_point_y: [:number, nullable: true],
external_video_url: [:string, nullable: true],
diff --git a/spree/api/app/serializers/spree/api/v3/option_type_serializer.rb b/spree/api/app/serializers/spree/api/v3/option_type_serializer.rb
index 5ce7524537..e7d96ccaf9 100644
--- a/spree/api/app/serializers/spree/api/v3/option_type_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/option_type_serializer.rb
@@ -2,7 +2,7 @@ module Spree
module Api
module V3
class OptionTypeSerializer < BaseSerializer
- typelize name: :string, label: :string, position: :number, kind: [:string, enum: Spree::OptionType::KINDS]
+ typelize name: :string, label: :string, position: :number, kind: [:string, enum: Spree::OptionType::KINDS, enum_type_name: 'OptionTypeKind']
attributes :name, :label, :position, :kind
end
diff --git a/spree/api/app/serializers/spree/api/v3/order_group_serializer.rb b/spree/api/app/serializers/spree/api/v3/order_group_serializer.rb
index d24fed5632..2bf482598b 100644
--- a/spree/api/app/serializers/spree/api/v3/order_group_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/order_group_serializer.rb
@@ -9,8 +9,8 @@ module Spree
# inside it, each carrying its own items, delivery and tracking.
class OrderGroupSerializer < BaseSerializer
typelize number: :string, email: [:string, nullable: true], currency: [:string, enum: Spree::Money::Rounding::CURRENCY_CODES, enum_type_name: 'CurrencyCode'],
- fulfillment_status: [:string, nullable: true, enum: Spree::Order::FULFILLMENT_STATUSES],
- payment_status: [:string, nullable: true, enum: Spree::Order::PAYMENT_STATUSES],
+ fulfillment_status: [:string, nullable: true, enum: Spree::Order::FULFILLMENT_STATUSES, enum_type_name: 'OrderFulfillmentStatus'],
+ payment_status: [:string, nullable: true, enum: Spree::Order::PAYMENT_STATUSES, enum_type_name: 'OrderPaymentStatus'],
completed_at: [:string, nullable: true],
billing_address: { nullable: true }, shipping_address: { nullable: true }
diff --git a/spree/api/app/serializers/spree/api/v3/order_serializer.rb b/spree/api/app/serializers/spree/api/v3/order_serializer.rb
index fa1d5acdcf..da1a3a3cc3 100644
--- a/spree/api/app/serializers/spree/api/v3/order_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/order_serializer.rb
@@ -11,8 +11,8 @@ module Spree
po_document_filename: [:string, nullable: true], po_document_byte_size: ['number | null'],
currency: [:string, enum: Spree::Money::Rounding::CURRENCY_CODES, enum_type_name: 'CurrencyCode'], locale: [:string, nullable: true, enum: Spree::Locales::ALL, enum_type_name: 'LocaleCode'], total_quantity: :number,
coupon_code: [:string, nullable: true],
- fulfillment_status: [:string, nullable: true, enum: Spree::Order::FULFILLMENT_STATUSES],
- payment_status: [:string, nullable: true, enum: Spree::Order::PAYMENT_STATUSES],
+ fulfillment_status: [:string, nullable: true, enum: Spree::Order::FULFILLMENT_STATUSES, enum_type_name: 'OrderFulfillmentStatus'],
+ payment_status: [:string, nullable: true, enum: Spree::Order::PAYMENT_STATUSES, enum_type_name: 'OrderPaymentStatus'],
completed_at: [:string, nullable: true],
withdrawal_period_ends_at: [:string, nullable: true], within_withdrawal_period: :boolean,
shipping_eq_billing_address: :boolean,
diff --git a/spree/api/app/serializers/spree/api/v3/payment_serializer.rb b/spree/api/app/serializers/spree/api/v3/payment_serializer.rb
index dee230d5db..1c160e7cc3 100644
--- a/spree/api/app/serializers/spree/api/v3/payment_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/payment_serializer.rb
@@ -4,7 +4,7 @@ module Spree
class PaymentSerializer < BaseSerializer
typelize status: [:string, enum: Spree::Payment.statuses, enum_type_name: 'PaymentStatus'],
payment_method_id: :string, response_code: [:string, nullable: true], number: :string,
- source_type: [:string, nullable: true, enum: %w[credit_card store_credit payment_source]],
+ source_type: [:string, nullable: true, enum: %w[credit_card store_credit payment_source], enum_type_name: 'PaymentSourceType'],
source_id: [:string, nullable: true], source: 'CreditCard | StoreCredit | PaymentSource | null'
prefixed_id_attributes :payment_method
diff --git a/spree/api/app/serializers/spree/api/v3/product_filter_availability_option_serializer.rb b/spree/api/app/serializers/spree/api/v3/product_filter_availability_option_serializer.rb
index 99e0c1ac35..0290b1a025 100644
--- a/spree/api/app/serializers/spree/api/v3/product_filter_availability_option_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/product_filter_availability_option_serializer.rb
@@ -2,7 +2,7 @@ module Spree
module Api
module V3
class ProductFilterAvailabilityOptionSerializer < BaseSerializer
- typelize id: [:string, enum: %w[in_stock out_of_stock]], count: :number
+ typelize id: [:string, enum: %w[in_stock out_of_stock], enum_type_name: 'StockAvailability'], count: :number
attributes :id, :count
end
diff --git a/spree/api/app/serializers/spree/api/v3/product_filter_option_serializer.rb b/spree/api/app/serializers/spree/api/v3/product_filter_option_serializer.rb
index 99d5c9a5f8..2c2a57a366 100644
--- a/spree/api/app/serializers/spree/api/v3/product_filter_option_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/product_filter_option_serializer.rb
@@ -6,7 +6,7 @@ module Spree
type: "'option'",
name: :string,
label: :string,
- kind: [:string, enum: Spree::OptionType::KINDS],
+ kind: [:string, enum: Spree::OptionType::KINDS, enum_type_name: 'OptionTypeKind'],
options: [:ProductFilterOptionValue, multi: true]
attributes :id, :type, :name, :label, :kind
diff --git a/spree/api/app/serializers/spree/api/v3/seller/order_serializer.rb b/spree/api/app/serializers/spree/api/v3/seller/order_serializer.rb
index 79e5895998..c89902b1c9 100644
--- a/spree/api/app/serializers/spree/api/v3/seller/order_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/seller/order_serializer.rb
@@ -23,9 +23,9 @@ module Spree
class OrderSerializer < V3::BaseSerializer
typelize number: :string, customer_note: [:string, nullable: true], currency: [:string, enum: Spree::Money::Rounding::CURRENCY_CODES, enum_type_name: 'CurrencyCode'],
total_quantity: :number,
- fulfillment_status: [:string, nullable: true, enum: Spree::Order::FULFILLMENT_STATUSES],
- payment_status: [:string, nullable: true, enum: Spree::Order::PAYMENT_STATUSES],
- status: [:string, enum: Spree::Order::STATUSES], canceled_at: [:string, nullable: true],
+ fulfillment_status: [:string, nullable: true, enum: Spree::Order::FULFILLMENT_STATUSES, enum_type_name: 'OrderFulfillmentStatus'],
+ payment_status: [:string, nullable: true, enum: Spree::Order::PAYMENT_STATUSES, enum_type_name: 'OrderPaymentStatus'],
+ status: [:string, enum: Spree::Order::STATUSES, enum_type_name: 'OrderStatus'], canceled_at: [:string, nullable: true],
cancel_reason_name: [:string, nullable: true], cancel_note: [:string, nullable: true],
internal_note: [:string, nullable: true], internal_note_html: [:string, nullable: true]
diff --git a/spree/api/app/serializers/spree/api/v3/seller/package_type_serializer.rb b/spree/api/app/serializers/spree/api/v3/seller/package_type_serializer.rb
index 38160b7363..e91025cfb4 100644
--- a/spree/api/app/serializers/spree/api/v3/seller/package_type_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/seller/package_type_serializer.rb
@@ -15,7 +15,7 @@ module Spree
# refuses to write them (docs/plans/6.0-seller-package-types.md).
class PackageTypeSerializer < V3::BaseSerializer
typelize name: :string,
- kind: [:string, enum: Spree::PackageType::KINDS],
+ kind: [:string, enum: Spree::PackageType::KINDS, enum_type_name: 'PackageTypeKind'],
length: [:string, nullable: true],
width: [:string, nullable: true],
height: [:string, nullable: true],
diff --git a/spree/api/app/serializers/spree/api/v3/seller/profile_serializer.rb b/spree/api/app/serializers/spree/api/v3/seller/profile_serializer.rb
index 4fdd12052e..5e7c3cfcea 100644
--- a/spree/api/app/serializers/spree/api/v3/seller/profile_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/seller/profile_serializer.rb
@@ -8,8 +8,8 @@ module Spree
registration_number: [:string, nullable: true],
contact_email: [:string, nullable: true],
billing_email: [:string, nullable: true],
- tax_remittance: :string,
- payouts_schedule_interval: [:string, nullable: true],
+ tax_remittance: [:string, enum: Spree::Seller::TAX_REMITTANCES, enum_type_name: 'TaxRemittance'],
+ payouts_schedule_interval: [:string, nullable: true, enum: Spree::Seller::PAYOUT_INTERVALS, enum_type_name: 'PayoutScheduleInterval'],
minimum_payout_amount: [:string, nullable: true],
holiday_mode_until: [:string, nullable: true],
terms_accepted_at: [:string, nullable: true],
diff --git a/spree/api/app/serializers/spree/api/v3/seller/requirement_status_serializer.rb b/spree/api/app/serializers/spree/api/v3/seller/requirement_status_serializer.rb
index a92c437654..76d7a6ab79 100644
--- a/spree/api/app/serializers/spree/api/v3/seller/requirement_status_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/seller/requirement_status_serializer.rb
@@ -8,7 +8,7 @@ module Spree
typelize id: :string, kind: [:string, comment: 'Requirement kind. Built-in: accept_terms, complete_profile, billing_address, returns_address, delivery_method, package_type, minimum_products, payout_account, required_custom_fields, policy, attestation, operator_review, document. Extensions may register more.'], name: :string,
description: [:string, nullable: true],
- required: :boolean, position: :number, status: [:string, enum: Spree::SellerRequirementStatus::STATUSES],
+ required: :boolean, position: :number, status: [:string, enum: Spree::SellerRequirementStatus::STATUSES, enum_type_name: 'SellerRequirementState'],
blocking: :boolean, action_url: [:string, nullable: true],
blocker: ['{ state: string; message: string | null } | null'],
accepts_submissions: :boolean, requires_file: :boolean,
diff --git a/spree/api/app/serializers/spree/api/v3/seller/tax_identifier_serializer.rb b/spree/api/app/serializers/spree/api/v3/seller/tax_identifier_serializer.rb
index 4e79188b32..b4ef945913 100644
--- a/spree/api/app/serializers/spree/api/v3/seller/tax_identifier_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/seller/tax_identifier_serializer.rb
@@ -4,7 +4,7 @@ module Spree
module Seller
class TaxIdentifierSerializer < V3::BaseSerializer
typelize kind: [:string, comment: 'Tax identifier kind, keyed to a registered validator. Built-in: eu_vat. Extensions may register more.'], value: :string,
- validation_status: [:string, nullable: true, enum: Spree::TaxIdentifier::VALIDATION_STATUSES],
+ validation_status: [:string, nullable: true, enum: Spree::TaxIdentifier::VALIDATION_STATUSES, enum_type_name: 'TaxIdentifierValidationStatus'],
validated_at: [:string, nullable: true]
attributes :kind, :value, :validation_status, validated_at: :iso8601
diff --git a/spree/api/app/serializers/spree/api/v3/seller/variant_serializer.rb b/spree/api/app/serializers/spree/api/v3/seller/variant_serializer.rb
index 3071e074fe..bfe34a1966 100644
--- a/spree/api/app/serializers/spree/api/v3/seller/variant_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/seller/variant_serializer.rb
@@ -25,7 +25,7 @@ module Spree
country_of_origin: [:string, nullable: true, enum: Spree::IsoData.country_codes, enum_type_name: 'CountryCode'],
customs_description: [:string, nullable: true],
minimum_order_quantity: ['number | null'], order_multiple: ['number | null'],
- purchase_unit: [:string, nullable: true, enum: Spree::Variant::PURCHASE_UNITS],
+ purchase_unit: [:string, nullable: true, enum: Spree::Variant::PURCHASE_UNITS, enum_type_name: 'PurchaseUnit'],
metadata: 'Record<string, unknown>'
attributes :metadata, :position, :cost_currency,
diff --git a/spree/api/app/serializers/spree/api/v3/shipping_label_event_serializer.rb b/spree/api/app/serializers/spree/api/v3/shipping_label_event_serializer.rb
index 00eb8c6ab5..587d868fe4 100644
--- a/spree/api/app/serializers/spree/api/v3/shipping_label_event_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/shipping_label_event_serializer.rb
@@ -6,7 +6,7 @@ module Spree
# stay behind the Admin API.
class ShippingLabelEventSerializer < BaseSerializer
typelize owner_id: :string,
- owner_type: [:string, enum: %w[fulfillment return]],
+ owner_type: [:string, enum: %w[fulfillment return], enum_type_name: 'ShippingLabelOwnerType'],
status: [:string, enum: Spree::ShippingLabel.statuses, enum_type_name: 'ShippingLabelStatus'],
carrier: [:string, nullable: true],
service: [:string, nullable: true],
diff --git a/spree/api/app/serializers/spree/api/v3/stock_movement_serializer.rb b/spree/api/app/serializers/spree/api/v3/stock_movement_serializer.rb
index 7104cb4cc2..6dfa844732 100644
--- a/spree/api/app/serializers/spree/api/v3/stock_movement_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/stock_movement_serializer.rb
@@ -7,7 +7,7 @@ module Spree
# `kind` is nullable for the lifetime of 6.0: a legacy row on an
# install that has not run spree:migrate_stock_movements_to_typed_rows
# has no kind yet.
- typelize quantity: :number, kind: [:string, nullable: true, enum: Spree::StockMovement::KINDS],
+ typelize quantity: :number, kind: [:string, nullable: true, enum: Spree::StockMovement::KINDS, enum_type_name: 'StockMovementKind'],
reason: [:string, nullable: true], stock_level_id: [:string, nullable: true]
attributes :quantity, :kind, :reason,
diff --git a/spree/api/app/serializers/spree/api/v3/stock_receipt_event_serializer.rb b/spree/api/app/serializers/spree/api/v3/stock_receipt_event_serializer.rb
index 85c646f69d..bd630ba5c7 100644
--- a/spree/api/app/serializers/spree/api/v3/stock_receipt_event_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/stock_receipt_event_serializer.rb
@@ -6,7 +6,7 @@ module Spree
class StockReceiptEventSerializer < BaseSerializer
typelize number: :string,
received_at: :string,
- receivable_type: [:string, enum: %w[purchase_order stock_transfer]],
+ receivable_type: [:string, enum: %w[purchase_order stock_transfer], enum_type_name: 'StockReceiptReceivableType'],
receivable_id: :string,
quantity_accepted_total: :number,
quantity_rejected_total: :number
diff --git a/spree/api/app/serializers/spree/api/v3/variant_serializer.rb b/spree/api/app/serializers/spree/api/v3/variant_serializer.rb
index 2aba789fc6..cd76fbd72f 100644
--- a/spree/api/app/serializers/spree/api/v3/variant_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/variant_serializer.rb
@@ -14,7 +14,7 @@ module Spree
price: 'Price',
original_price: ['Price', nullable: true],
minimum_order_quantity: :number, order_multiple: :number,
- purchase_unit: [:string, enum: Spree::Variant::PURCHASE_UNITS], units_per_carton: ['number | null'],
+ purchase_unit: [:string, enum: Spree::Variant::PURCHASE_UNITS, enum_type_name: 'PurchaseUnit'], units_per_carton: ['number | null'],
seller_id: [:string, nullable: true]
prefixed_id_attributes :product
diff --git a/spree/api/lib/spree/api/enum_types.rb b/spree/api/lib/spree/api/enum_types.rb
new file mode 100644
index 0000000000..ddd2530007
--- /dev/null
+++ b/spree/api/lib/spree/api/enum_types.rb
@@ -0,0 +1,118 @@
+module Spree
+ module Api
+ # Renders every value list the serializers name (`enum_type_name:`, see
+ # {Typelizer::OpenEnums}) into `@spree/core`, once, as both the values and
+ # the type — open unless the name is one of `CLOSED_LIST_NAMES`. Each SDK's `Enums.ts` re-exports the type
+ # from there instead of carrying its own copy, and the dashboards read the
+ # values instead of repeating them by hand.
+ #
+ # Run by `rake typelizer:generate`; `enum_types_spec.rb` fails when the
+ # committed file no longer matches the serializers.
+ class EnumTypes
+ class ConflictError < StandardError; end
+
+ HEADER = "// This file is auto-generated from the API serializers by `rake typelizer:generate`. Do not edit directly.\n".freeze
+ PATH = 'packages/core/src/enums.generated.ts'.freeze
+ LINE_WIDTH = 100
+
+ # @param properties [Array<Typelizer::Property>] every named enum property, across all serializers
+ def initialize(properties = self.class.serializer_properties)
+ @properties = properties
+ end
+
+ # Walks every property rather than Typelizer's own `enum_types`, which
+ # keeps one property per name within a serializer and so would hide two
+ # attributes of one serializer that disagree.
+ #
+ # @return [Array<Typelizer::Property>] the named enum properties of every serializer each Typelizer writer emits
+ def self.serializer_properties
+ Typelizer.configuration.writers.keys
+ .flat_map { |writer_name| Typelizer.interfaces(writer_name: writer_name) }
+ .flat_map { |interface| named_properties(interface.properties + interface.trait_interfaces.flat_map(&:properties)) }
+ end
+
+ # @param properties [Array<Typelizer::Property>]
+ # @return [Array<Typelizer::Property>] those carrying a named list, nested and inline ones included
+ def self.named_properties(properties)
+ properties.flat_map do |property|
+ nested = property.nested_properties.to_a
+ nested += property.type.properties if property.type.is_a?(Typelizer::Interface) && property.type.inline?
+
+ [property, *named_properties(nested)]
+ end.select { |property| property.enum && property.enum_type_name }
+ end
+
+ # @return [Hash{String => Array<String>}] built-in values keyed by type name
+ # @raise [ConflictError] when two serializers give one type name different values
+ def lists
+ @lists ||= @properties
+ .select(&:enum_type_name)
+ .reject { |property| Typelizer::OpenEnums::CLOSED_TYPE_NAMES.include?(property.enum_type_name) }
+ .group_by(&:enum_type_name)
+ .sort
+ .to_h { |name, properties| [name, values_of(name, properties)] }
+ end
+
+ # @return [Array<String>] closed list names no serializer declares any more
+ def stale_closed_names
+ Typelizer::OpenEnums::CLOSED_LIST_NAMES - lists.keys
+ end
+
+ # @return [String] the file's contents
+ def render
+ HEADER + lists.map { |name, values| definition(name, values) }.join + built_in_status
+ end
+
+ # @param root [Pathname] the monorepo root
+ # @return [void]
+ # @raise [ConflictError] when `CLOSED_LIST_NAMES` names a list no serializer declares
+ def write!(root)
+ raise ConflictError, "No serializer names #{stale_closed_names.join(', ')}; remove it from CLOSED_LIST_NAMES." if stale_closed_names.any?
+
+ File.write(root.join(PATH), render)
+ end
+
+ # @param name [String] a type name, e.g. `ProductStatus`
+ # @return [String] the constant holding its values, e.g. `PRODUCT_STATUSES`
+ def self.constant_name(name)
+ name.underscore.pluralize.upcase
+ end
+
+ private
+
+ def values_of(name, properties)
+ variants = properties.map { |property| property.enum.map(&:to_s) }.uniq
+ return variants.first if variants.one?
+
+ raise ConflictError, "#{name} is declared with different values: " \
+ "#{variants.map { |values| values.join(', ') }.join(' / ')}. " \
+ 'Give every serializer the same list, or give the lists different names.'
+ end
+
+ # Every built-in value of every status list, so a surface that styles
+ # statuses can be checked for one the server added.
+ def built_in_status
+ members = lists.keys.grep(/Status\z/).map { |name| " | (typeof #{self.class.constant_name(name)})[number]\n" }
+ return '' if members.empty?
+
+ "\n/** Every built-in value of every status list above. */\nexport type BuiltInStatus =\n#{members.join}"
+ end
+
+ def definition(name, values)
+ constant = self.class.constant_name(name)
+ quoted = values.map { |value| "'#{value}'" }
+ line = "export const #{constant} = [#{quoted.join(', ')}] as const"
+ line = "export const #{constant} = [\n#{quoted.map { |value| " #{value},\n" }.join}] as const" if line.length > LINE_WIDTH
+
+ if Typelizer::OpenEnums.closed?(name)
+ "\n/** Every value of `#{name}`. */\n#{line}\nexport type #{name} = (typeof #{constant})[number]\n"
+ else
+ type = "export type #{name} = (typeof #{constant})[number] | (string & {})"
+ type = "export type #{name} =\n | (typeof #{constant})[number]\n | (string & {})" if type.length > LINE_WIDTH
+
+ "\n/** The built-in values of `#{name}`. Extensions may add more. */\n#{line}\n#{type}\n"
+ end
+ end
+ end
+ end
+end
diff --git a/spree/api/lib/spree/api/typelizer_generation.rb b/spree/api/lib/spree/api/typelizer_generation.rb
index 8e855f0368..dad75884aa 100644
--- a/spree/api/lib/spree/api/typelizer_generation.rb
+++ b/spree/api/lib/spree/api/typelizer_generation.rb
@@ -9,6 +9,11 @@ module Spree
def self.call(serializer_dirs)
serializer_dirs.each { |dir| Rails.autoloaders.main.eager_load_dir(dir.to_s) }
+ # Before the SDK types, so two serializers disagreeing on a list's
+ # values stop generation instead of one of them silently winning.
+ require Spree::Api::Engine.root.join('lib/spree/api/enum_types').to_s
+ Spree::Api::EnumTypes.new.write!(Spree::Api::Engine.root.join('../..'))
+
require 'typelizer/generator'
Typelizer::Generator.call(force: true)
diff --git a/spree/api/lib/typelizer/open_enums.rb b/spree/api/lib/typelizer/open_enums.rb
index 42a8114762..3201d9b879 100644
--- a/spree/api/lib/typelizer/open_enums.rb
+++ b/spree/api/lib/typelizer/open_enums.rb
@@ -8,23 +8,41 @@ module Typelizer
# from either still accepts an added value while every built-in value stays
# documented and autocompletable.
#
- # Shared code lists are the exception: a named type several serializers and
- # the request types share, but closed, since nothing outside the standard
- # can add a country, a currency or a unit, and markets only accept the
- # locales `Spree::Locales::ALL` lists. The SDKs define them once, as values
- # and types, in `@spree/sdk-core` (generated from the API reference by
- # `pnpm generate:code-lists`), so each SDK's `Enums.ts` re-exports that
- # definition instead of carrying a copy of the list.
+ # Every named list is defined once, as values and type, in `@spree/core`, and
+ # each SDK's `Enums.ts` re-exports it through `@spree/sdk-core` instead of
+ # carrying a copy. {Spree::Api::EnumTypes} writes them there.
+ #
+ # A name in `CLOSED_LIST_NAMES` keeps its list closed — named only so it is
+ # defined once — and both contracts stay exactly what `enum:` alone gives.
+ # Shared code lists are closed too, but come from the API reference
+ # (`pnpm generate:code-lists`) rather than the serializers: nothing outside
+ # the standard can add a country, a currency or a unit, and markets only
+ # accept the locales `Spree::Locales::ALL` lists.
module OpenEnums
CLOSED_TYPE_NAMES = %w[CountryCode CurrencyCode LocaleCode WeightUnit DimensionUnit].freeze
+ CLOSED_LIST_NAMES = %w[
+ ApiKeyType CaptureMethod CatalogAssignableType CatalogPriceSource ClaimResolution
+ CollectionRuleMatchPolicy CollectionSortOrder CommissionKind CompanyInvitationStatus CompanyKind
+ ConsentSource DataRequestKind DeliveryStatus DeliveryZoneMemberType DiscountKind DocumentNumberFormat
+ EmailFont EmailTemplateKind FileUploadVisibility FulfillmentType MatchPolicy MediaType OptionTypeKind
+ OrderFulfillmentStatus OrderPaymentStatus OrderStatus PackageTypeKind PaymentSourceType
+ PayoutScheduleInterval PermissionKind PickupStockPolicy ProviderFailurePolicy PurchaseUnit
+ SellerRequirementState SellerTransferKind ShippingLabelFormat ShippingLabelOwnerType ShippingLabelSource
+ StockAvailability StockMovementKind StockReceiptLineType StockReceiptReceivableType
+ StockReceiptRejectionReason StorefrontAccess TaxIdentifierSource TaxIdentifierValidationStatus
+ TaxRemittance UnitSystem
+ ].freeze
+
+ # @param name [String, nil] a list's `enum_type_name`
+ # @return [Boolean] whether the list is closed: no value outside it is valid
+ def self.closed?(name)
+ CLOSED_TYPE_NAMES.include?(name) || CLOSED_LIST_NAMES.include?(name)
+ end
+
module Property
def enum_definition(...)
- definition = super
- return definition unless definition
- return "type { #{enum_type_name} } from '@spree/sdk-core'" if CLOSED_TYPE_NAMES.include?(enum_type_name)
-
- "#{definition} | (string & {})"
+ super && "type { #{enum_type_name} } from '@spree/sdk-core'"
end
# Typelizer skips rewriting a file whose digest is unchanged, and the
@@ -32,7 +50,7 @@ module Typelizer
# the re-export in makes a checkout that still carries the old inline
# list regenerate.
def fingerprint
- return super unless CLOSED_TYPE_NAMES.include?(enum_type_name)
+ return super unless enum_type_name
[super, enum_definition].inspect
end
@@ -43,10 +61,16 @@ module Typelizer
def inline_schema(definition, property, openapi_version:)
return super unless property.enum_type_name && property.enum.is_a?(Array) && !property.multi
- return super if CLOSED_TYPE_NAMES.include?(property.enum_type_name)
+ return super if OpenEnums.closed?(property.enum_type_name)
open = { anyOf: [{ type: :string, enum: property.enum.compact }, { type: :string }] }
- apply_nullable(open, property, openapi_version: openapi_version)
+ # OpenAPI 3.0 ignores `nullable` beside `anyOf`, which is where
+ # Typelizer puts it, so the free-string branch carries it instead.
+ if property.nullable && !v31?(openapi_version)
+ open[:anyOf].last[:nullable] = true
+ else
+ apply_nullable(open, property, openapi_version: openapi_version)
+ end
apply_metadata(open, property)
open[:description] ||= OPEN_ENUM_DESCRIPTION
open
diff --git a/spree/api/spec/lib/spree/api/enum_types_spec.rb b/spree/api/spec/lib/spree/api/enum_types_spec.rb
new file mode 100644
index 0000000000..de53b01547
--- /dev/null
+++ b/spree/api/spec/lib/spree/api/enum_types_spec.rb
@@ -0,0 +1,56 @@
+require 'spec_helper'
+require Spree::Api::Engine.root.join('lib/spree/api/enum_types').to_s
+
+RSpec.describe Spree::Api::EnumTypes do
+ def property(enum_type_name, enum)
+ Typelizer::Property.new(name: :status, type: :string, enum: enum, enum_type_name: enum_type_name)
+ end
+
+ let(:monorepo_root) { Spree::Api::Engine.root.join('../..') }
+
+ it 'matches the committed @spree/core file (run `bundle exec rake typelizer:generate` to refresh it)' do
+ Rails.autoloaders.main.eager_load_dir(Spree::Api::Engine.root.join('app/serializers/spree/api/v3').to_s)
+
+ expect(monorepo_root.join(described_class::PATH).read).to eq(described_class.new.render)
+ end
+
+ it 'writes each open list once, as values and an open type, leaving out the code lists' do
+ source = described_class.new([
+ property('ProductStatus', %w[draft active]),
+ property('ProductStatus', %w[draft active]),
+ property('CurrencyCode', %w[EUR USD]),
+ property(nil, %w[a b])
+ ]).render
+
+ expect(source.scan('PRODUCT_STATUSES =').size).to eq(1)
+ expect(source).to include("export const PRODUCT_STATUSES = ['draft', 'active'] as const\n")
+ expect(source).to include("export type ProductStatus = (typeof PRODUCT_STATUSES)[number] | (string & {})\n")
+ expect(source).not_to include('Currency')
+ end
+
+ it 'keeps a closed list closed' do
+ source = described_class.new([property('SellerTransferKind', %w[earning refund_reversal])]).render
+
+ expect(source).to include("export type SellerTransferKind = (typeof SELLER_TRANSFER_KINDS)[number]\n")
+ end
+
+ it 'joins every status list into one type of the built-in statuses' do
+ source = described_class.new([property('ProductStatus', %w[draft]), property('FeeKind', %w[duty])]).render
+
+ expect(source).to include("export type BuiltInStatus =\n | (typeof PRODUCT_STATUSES)[number]\n")
+ expect(source[/export type BuiltInStatus.*/m]).not_to include('FEE_KINDS')
+ end
+
+ it 'finds two attributes of one serializer that disagree, which Typelizer would collapse into one' do
+ nested = property('ProductStatus', %w[draft])
+ parent = Typelizer::Property.new(name: :product, type: :object, nested_properties: [nested])
+
+ expect(described_class.named_properties([property('ProductStatus', %w[draft active]), parent]).size).to eq(2)
+ end
+
+ it 'refuses a list two serializers declare with different values' do
+ generator = described_class.new([property('ProductStatus', %w[draft active]), property('ProductStatus', %w[draft])])
+
+ expect { generator.render }.to raise_error(described_class::ConflictError, /ProductStatus/)
+ end
+end
diff --git a/spree/api/spec/lib/typelizer/open_enums_spec.rb b/spree/api/spec/lib/typelizer/open_enums_spec.rb
index 3b700c1bd7..3c971f6de0 100644
--- a/spree/api/spec/lib/typelizer/open_enums_spec.rb
+++ b/spree/api/spec/lib/typelizer/open_enums_spec.rb
@@ -6,9 +6,9 @@ RSpec.describe Typelizer::OpenEnums::Property do
end
describe '#enum_definition' do
- it 'keeps an extensible list open' do
+ it 're-exports an extensible list from sdk-core instead of copying it' do
expect(property('ProductStatus', %w[draft active]).enum_definition)
- .to eq("type ProductStatus = 'draft' | 'active' | (string & {})")
+ .to eq("type { ProductStatus } from '@spree/sdk-core'")
end
it 're-exports an ISO code list from sdk-core instead of copying it' do
@@ -22,12 +22,30 @@ RSpec.describe Typelizer::OpenEnums::Property do
end
describe '#fingerprint' do
- it 'changes with the re-export for an ISO code list, so files written before it regenerate' do
- closed = property('CountryCode', %w[DE US])
- plain = Typelizer::Property.new(**closed.to_h, enum_type_name: 'CountryKind')
+ it 'changes with the re-export for a named list, so files written before it regenerate' do
+ named = property('CountryCode', %w[DE US])
+ inline = Typelizer::Property.new(**named.to_h, enum_type_name: nil)
- expect(closed.fingerprint).to include("from '@spree/sdk-core'")
- expect(plain.fingerprint).not_to include('sdk-core')
+ expect(named.fingerprint).to include("from '@spree/sdk-core'")
+ expect(inline.fingerprint).not_to include('sdk-core')
end
end
end
+
+RSpec.describe Typelizer::OpenEnums::Schema do
+ def schema(**attributes)
+ property = Typelizer::Property.new(name: :reason, type: :string, enum: %w[export], enum_type_name: 'TaxabilityReason', **attributes)
+ Typelizer::OpenAPI.property_schema(property, openapi_version: '3.0.3')
+ end
+
+ it 'lets a nullable open list accept null where OpenAPI 3.0 reads it' do
+ expect(schema(nullable: true)).to include(anyOf: [{ type: :string, enum: %w[export] }, { type: :string, nullable: true }])
+ expect(schema(nullable: true)).not_to have_key(:nullable)
+ end
+
+ it 'keeps a list closed when its name is closed' do
+ property = Typelizer::Property.new(name: :format, type: :string, enum: %w[pdf], enum_type_name: 'ShippingLabelFormat')
+
+ expect(Typelizer::OpenAPI.property_schema(property, openapi_version: '3.0.3')).to include(type: :string, enum: %w[pdf])
+ end
+end
diff --git a/spree/core/app/models/spree/tax_line.rb b/spree/core/app/models/spree/tax_line.rb
index e129493287..8b2a3bafd9 100644
--- a/spree/core/app/models/spree/tax_line.rb
+++ b/spree/core/app/models/spree/tax_line.rb
@@ -22,10 +22,11 @@ module Spree
# core doesn't know about registers its reason here. The bar for a new
# value: it distinguishes a treatment that reporting or invoicing has to
# tell apart, not merely a different amount.
- class_attribute :taxability_reasons,
- default: %w[standard_rated reduced_rated zero_rated reverse_charge
- intra_community_supply export customer_exempt product_exempt
- not_collecting not_subject_to_tax]
+ BUILT_IN_TAXABILITY_REASONS = %w[standard_rated reduced_rated zero_rated reverse_charge
+ intra_community_supply export customer_exempt product_exempt
+ not_collecting not_subject_to_tax].freeze
+
+ class_attribute :taxability_reasons, default: BUILT_IN_TAXABILITY_REASONS.dup
# Provider payloads (jurisdiction breakdowns, external ids) read nil-safe.
attribute :data, default: -> { {} }