Skip to main content

Interface: UseSparePartsOptions

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

Properties

companyId?

optional companyId?: number

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

Active company — scopes the assortment.


configuration?

optional configuration?: object

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

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:57

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


language

language: string

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

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


machineLanguage?

optional machineLanguage?: string

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

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.


onFiltersChange?

optional onFiltersChange?: (filters) => void

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

Fired with the facet list after each fetch.

Parameters

filters

AttributeFilter[]

Returns

void


onItemsFoundChange?

optional onItemsFoundChange?: (count) => void

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

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:131

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:129

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:125

Fired with the price-slider bounds after each fetch.

Parameters

min

number

max

number

Returns

void


pageSize?

optional pageSize?: number

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

Items per page. Defaults to 12.


parts?

optional parts?: SparePart[]

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

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:102

Price-range filter upper bound.


priceFilterMin?

optional priceFilterMin?: number

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

Price-range filter lower bound.


slug?

optional slug?: string

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

Slug of the machine whose parts to list.


sortField?

optional sortField?: string

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

Sort field.


sortOrder?

optional sortOrder?: string

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

Sort direction.


taxZone?

optional taxZone?: string

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

Tax zone for price calculation.


term?

optional term?: string

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

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


textFilters?

optional textFilters?: ProductTextFilterInput[]

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

Attribute (facet) filters.


user?

optional user?: Contact | Customer | null

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

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