Interface: UseSparePartsOptions
Defined in: composables/react/useSpareParts.ts:59
Properties
companyId?
optionalcompanyId?:number
Defined in: composables/react/useSpareParts.ts:107
Active company — scopes the assortment.
configuration?
optionalconfiguration?:object
Defined in: composables/react/useSpareParts.ts:143
Image filter config, mirroring useProductSearch's configuration.
anonymousUserId?
optionalanonymousUserId?:number
The channel's anonymous user, seeded by the host. Scopes logged-out listings exactly like the SSR seed does.
imageSearchFiltersGrid?
optionalimageSearchFiltersGrid?:unknown
imageVariantFiltersMedium?
optionalimageVariantFiltersMedium?:unknown
graphqlClient?
optionalgraphqlClient?: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?
optionalmachineLanguage?: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?
optionalmachineLanguages?: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?
optionalonFiltersChange?: (filters) =>void
Defined in: composables/react/useSpareParts.ts:152
Fired with the facet list after each fetch.
Parameters
filters
AttributeFilter[]
Returns
void
onItemsFoundChange?
optionalonItemsFoundChange?: (count) =>void
Defined in: composables/react/useSpareParts.ts:156
Fired with the total item count after each fetch.
Parameters
count
number
Returns
void
onMachineChange?
optionalonMachineChange?: (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?
optionalonPartsResponse?: (response) =>void
Defined in: composables/react/useSpareParts.ts:158
Fired with the raw parts response after each fetch.
Parameters
response
SparePartsResponse
Returns
void
onPriceBoundsChange?
optionalonPriceBoundsChange?: (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?
optionalpage?: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?
optionalpageSize?:number
Defined in: composables/react/useSpareParts.ts:125
Items per page. Defaults to 12.
parts?
optionalparts?: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?
optionalpriceFilterMax?:number
Defined in: composables/react/useSpareParts.ts:116
Price-range filter upper bound.
priceFilterMin?
optionalpriceFilterMin?:number
Defined in: composables/react/useSpareParts.ts:113
Price-range filter lower bound.
slug?
optionalslug?:string
Defined in: composables/react/useSpareParts.ts:71
Slug of the machine whose parts to list.
sortField?
optionalsortField?:string
Defined in: composables/react/useSpareParts.ts:119
Sort field.
sortOrder?
optionalsortOrder?:string
Defined in: composables/react/useSpareParts.ts:122
Sort direction.
taxZone?
optionaltaxZone?:string
Defined in: composables/react/useSpareParts.ts:101
Tax zone for price calculation.
term?
optionalterm?:string
Defined in: composables/react/useSpareParts.ts:74
Free-text search, scoped server-side to this machine's parts.
textFilters?
optionaltextFilters?:ProductTextFilterInput[]
Defined in: composables/react/useSpareParts.ts:110
Attribute (facet) filters.
user?
optionaluser?:Contact|Customer|null
Defined in: composables/react/useSpareParts.ts:104
Active user — drives userId scoping and contact/customer pricing.