Skip to main content

Interface: UseSparePartsOptions

Defined in: composables/react/useSpareParts.ts:59

Properties​

companyId?​

optional companyId?: number

Defined in: composables/react/useSpareParts.ts:107

Active company — scopes the assortment.


configuration?​

optional configuration?: object

Defined in: composables/react/useSpareParts.ts:143

Image filter config, mirroring useProductSearch's configuration.

anonymousUserId?​

optional anonymousUserId?: number

The channel's anonymous user, seeded by the host. Scopes logged-out listings exactly like the SSR seed does.

imageSearchFiltersGrid?​

optional imageSearchFiltersGrid?: unknown

imageVariantFiltersMedium?​

optional imageVariantFiltersMedium?: unknown


graphqlClient?​

optional graphqlClient?: GraphQLClient

Defined in: composables/react/useSpareParts.ts:61

SDK client. Without it the hook stays idle (controlled mode needs no client).


language​

language: string

Defined in: composables/react/useSpareParts.ts:77

Language for the spare parts themselves (the storefront language).


machineLanguage?​

optional machineLanguage?: string

Defined in: composables/react/useSpareParts.ts:88

Language the MACHINE TREE is authored in. Defaults to language.

machine(slug:, language:) is language-scoped and hard-errors with "No machine found for slug and language" when the machine has no name/slug in that language. Machine trees are commonly maintained in one language (typically EN) while their spare parts are localized — so the lookup and the parts list need different languages. Set this when they diverge.


machineLanguages?​

optional machineLanguages?: string[]

Defined in: composables/react/useSpareParts.ts:98

Extra languages to try when the slug does not resolve in machineLanguage.

A slug resolves only in the language it was authored in, so a tree that is only half-translated has machines reachable by an NL slug but not an EN one. machineLanguage and language are always tried first; list the shop's other locales here to cover the rest. Order is the try order.


onFiltersChange?​

optional onFiltersChange?: (filters) => void

Defined in: composables/react/useSpareParts.ts:152

Fired with the facet list after each fetch.

Parameters​

filters​

AttributeFilter[]

Returns​

void


onItemsFoundChange?​

optional onItemsFoundChange?: (count) => void

Defined in: composables/react/useSpareParts.ts:156

Fired with the total item count after each fetch.

Parameters​

count​

number

Returns​

void


onMachineChange?​

optional onMachineChange?: (machine) => void

Defined in: composables/react/useSpareParts.ts:160

Fired with the machine itself after each fetch (name, child machines, …).

Parameters​

machine​

SparePartsMachine

Returns​

void


onPartsResponse?​

optional onPartsResponse?: (response) => void

Defined in: composables/react/useSpareParts.ts:158

Fired with the raw parts response after each fetch.

Parameters​

response​

SparePartsResponse

Returns​

void


onPriceBoundsChange?​

optional onPriceBoundsChange?: (min, max) => void

Defined in: composables/react/useSpareParts.ts:154

Fired with the price-slider bounds after each fetch.

Parameters​

min​

number

max​

number

Returns​

void


page?​

optional page?: number

Defined in: composables/react/useSpareParts.ts:140

Controlled page. When provided the hook renders (and fetches) this page and goToPage becomes advisory - the host owns the number, typically from the URL.

Every other listing input (term, textFilters, sortField, pageSize) was already an option, so its absence read as "paging is internal" and it was not: driving the hook from URL state and rendering GridPagination changed the URL but re-rendered the same first page, because the only way in was a useEffect(() => goToPage(page)) that MachineGrid does internally and nothing documented (PWP-995b). Omit it to keep the previous uncontrolled behaviour.


pageSize?​

optional pageSize?: number

Defined in: composables/react/useSpareParts.ts:125

Items per page. Defaults to 12.


parts?​

optional parts?: SparePart[]

Defined in: composables/react/useSpareParts.ts:68

Controlled mode: pre-fetched parts (e.g. SSR-seeded). When DEFINED the hook performs no fetching at all and simply echoes these back. Pass [] (not undefined) to show an empty state while the host controls loading.


priceFilterMax?​

optional priceFilterMax?: number

Defined in: composables/react/useSpareParts.ts:116

Price-range filter upper bound.


priceFilterMin?​

optional priceFilterMin?: number

Defined in: composables/react/useSpareParts.ts:113

Price-range filter lower bound.


slug?​

optional slug?: string

Defined in: composables/react/useSpareParts.ts:71

Slug of the machine whose parts to list.


sortField?​

optional sortField?: string

Defined in: composables/react/useSpareParts.ts:119

Sort field.


sortOrder?​

optional sortOrder?: string

Defined in: composables/react/useSpareParts.ts:122

Sort direction.


taxZone?​

optional taxZone?: string

Defined in: composables/react/useSpareParts.ts:101

Tax zone for price calculation.


term?​

optional term?: string

Defined in: composables/react/useSpareParts.ts:74

Free-text search, scoped server-side to this machine's parts.


textFilters?​

optional textFilters?: ProductTextFilterInput[]

Defined in: composables/react/useSpareParts.ts:110

Attribute (facet) filters.


user?​

optional user?: Contact | Customer | null

Defined in: composables/react/useSpareParts.ts:104

Active user — drives userId scoping and contact/customer pricing.