@propeller-commerce/propeller-v2-react-ui 0.4.28 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +65 -0
- package/dist/index.cjs +6527 -5901
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +277 -2
- package/dist/index.d.ts +277 -2
- package/dist/index.js +6524 -5903
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ import { Services, ShopMode, UserMode, PriceComponentProps, StockComponentProps,
|
|
|
3
3
|
export * from '@propeller-commerce/propeller-v2-core-ui';
|
|
4
4
|
import * as React$1 from 'react';
|
|
5
5
|
import React__default, { ReactNode, ComponentType } from 'react';
|
|
6
|
-
import { GraphQLClient, Contact, Customer, Cart, CartMainItem, Product, Cluster, AddressType, Gender, YesNo, Address, TransformationsInput, MediaImageProductSearchInput, CartProcessResponse, Crossupsell, CartUpdateAddressInput, CartUpdateInput, CartAddressType, ClusterConfig, Company, CompanyVariables, PurchaseAuthorizationConfigCreateInput, PurchaseAuthorizationConfigUpdateInput, FavoriteList, DateSearchInput, DecimalSearchInput, OrderSortInput, OrderType, OrderSearchFields, Order, ProductTextFilterInput, AttributeFilter, ProductsResponse, Category, CrossupsellType, AttributeResult, RegisterContactInput as RegisterContactInput$1, PurchaseAuthorizationConfig, CartChildItemInput, CartAddress, WarehouseAddress, OrderAddress, CartBaseItem, CartCarrier, CartPaymethod, ClusterOption, ProductInventory, OrderItem, ProductPrice, Bundle, PaginatedMediaDocumentResponse, PaginatedMediaVideoResponse } from '@propeller-commerce/propeller-sdk-v2';
|
|
6
|
+
import { GraphQLClient, Contact, Customer, Cart, CartMainItem, Product, Cluster, AddressType, Gender, YesNo, Address, TransformationsInput, MediaImageProductSearchInput, CartProcessResponse, Crossupsell, CartUpdateAddressInput, CartUpdateInput, CartAddressType, ClusterConfig, Company, CompanyVariables, PurchaseAuthorizationConfigCreateInput, PurchaseAuthorizationConfigUpdateInput, FavoriteList, DateSearchInput, DecimalSearchInput, OrderSortInput, OrderType, OrderSearchFields, Order, ProductTextFilterInput, AttributeFilter, ProductsResponse, Category, SparePart, ProductSortField, SortOrder, SparePartsResponse, SparePartsMachine, CrossupsellType, AttributeResult, RegisterContactInput as RegisterContactInput$1, PurchaseAuthorizationConfig, CartChildItemInput, CartAddress, WarehouseAddress, OrderAddress, CartBaseItem, CartCarrier, CartPaymethod, ClusterOption, ProductInventory, OrderItem, ProductPrice, Bundle, PaginatedMediaDocumentResponse, PaginatedMediaVideoResponse } from '@propeller-commerce/propeller-sdk-v2';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Tier 1 — application-wide infrastructure. Bound by `<PropellerDepsProvider>`
|
|
@@ -1474,6 +1474,149 @@ interface UseProductSearchReturn {
|
|
|
1474
1474
|
*/
|
|
1475
1475
|
declare function useProductSearch(options: UseProductSearchOptions): UseProductSearchReturn;
|
|
1476
1476
|
|
|
1477
|
+
/**
|
|
1478
|
+
* useSpareParts (React) — a machine node's spare-parts list.
|
|
1479
|
+
*
|
|
1480
|
+
* The machine-tree sibling of `useProductSearch`: same contract (options in,
|
|
1481
|
+
* state + actions out), same controlled/uncontrolled sentinel, same race
|
|
1482
|
+
* guards — but sourced from `machine(slug:).sparePartProducts` instead of
|
|
1483
|
+
* `category(categoryId:).products`.
|
|
1484
|
+
*
|
|
1485
|
+
* Two things it deliberately does NOT copy from `useProductSearch`:
|
|
1486
|
+
* - the debounced search-bar path (`search()` / `searchResults`). Searching
|
|
1487
|
+
* within a machine is server-side and scoped to this node's parts, so it is
|
|
1488
|
+
* just the `term` option feeding the same fetch.
|
|
1489
|
+
* - the derived price-bounds fallback. The parts response carries the same
|
|
1490
|
+
* aggregate `minPrice`/`maxPrice` fields, so the fallback is kept — see
|
|
1491
|
+
* the note at the call site.
|
|
1492
|
+
*/
|
|
1493
|
+
|
|
1494
|
+
interface UseSparePartsOptions {
|
|
1495
|
+
/** SDK client. Without it the hook stays idle (controlled mode needs no client). */
|
|
1496
|
+
graphqlClient?: GraphQLClient;
|
|
1497
|
+
/**
|
|
1498
|
+
* Controlled mode: pre-fetched parts (e.g. SSR-seeded). When DEFINED the hook
|
|
1499
|
+
* performs no fetching at all and simply echoes these back. Pass `[]` (not
|
|
1500
|
+
* `undefined`) to show an empty state while the host controls loading.
|
|
1501
|
+
*/
|
|
1502
|
+
parts?: SparePart[];
|
|
1503
|
+
/** Slug of the machine whose parts to list. */
|
|
1504
|
+
slug?: string;
|
|
1505
|
+
/** Free-text search, scoped server-side to this machine's parts. */
|
|
1506
|
+
term?: string;
|
|
1507
|
+
/** Language for the spare parts themselves (the storefront language). */
|
|
1508
|
+
language: string;
|
|
1509
|
+
/**
|
|
1510
|
+
* Language the MACHINE TREE is authored in. Defaults to `language`.
|
|
1511
|
+
*
|
|
1512
|
+
* `machine(slug:, language:)` is language-scoped and hard-errors with
|
|
1513
|
+
* "No machine found for slug and language" when the machine has no name/slug
|
|
1514
|
+
* in that language. Machine trees are commonly maintained in one language
|
|
1515
|
+
* (typically EN) while their spare parts are localized — so the lookup and the
|
|
1516
|
+
* parts list need different languages. Set this when they diverge.
|
|
1517
|
+
*/
|
|
1518
|
+
machineLanguage?: string;
|
|
1519
|
+
/** Tax zone for price calculation. */
|
|
1520
|
+
taxZone?: string;
|
|
1521
|
+
/** Active user — drives `userId` scoping and contact/customer pricing. */
|
|
1522
|
+
user?: Contact | Customer | null;
|
|
1523
|
+
/** Active company — scopes the assortment. */
|
|
1524
|
+
companyId?: number;
|
|
1525
|
+
/** Attribute (facet) filters. */
|
|
1526
|
+
textFilters?: ProductTextFilterInput[];
|
|
1527
|
+
/** Price-range filter lower bound. */
|
|
1528
|
+
priceFilterMin?: number;
|
|
1529
|
+
/** Price-range filter upper bound. */
|
|
1530
|
+
priceFilterMax?: number;
|
|
1531
|
+
/** Sort field. */
|
|
1532
|
+
sortField?: ProductSortField | string;
|
|
1533
|
+
/** Sort direction. */
|
|
1534
|
+
sortOrder?: SortOrder | string;
|
|
1535
|
+
/** Items per page. Defaults to 12. */
|
|
1536
|
+
pageSize?: number;
|
|
1537
|
+
/** Image filter config, mirroring `useProductSearch`'s `configuration`. */
|
|
1538
|
+
configuration?: {
|
|
1539
|
+
imageSearchFiltersGrid?: unknown;
|
|
1540
|
+
imageVariantFiltersMedium?: unknown;
|
|
1541
|
+
};
|
|
1542
|
+
/** Fired with the facet list after each fetch. */
|
|
1543
|
+
onFiltersChange?: (filters: AttributeFilter[]) => void;
|
|
1544
|
+
/** Fired with the price-slider bounds after each fetch. */
|
|
1545
|
+
onPriceBoundsChange?: (min: number, max: number) => void;
|
|
1546
|
+
/** Fired with the total item count after each fetch. */
|
|
1547
|
+
onItemsFoundChange?: (count: number) => void;
|
|
1548
|
+
/** Fired with the raw parts response after each fetch. */
|
|
1549
|
+
onPartsResponse?: (response: SparePartsResponse) => void;
|
|
1550
|
+
/** Fired with the machine itself after each fetch (name, child machines, …). */
|
|
1551
|
+
onMachineChange?: (machine: SparePartsMachine) => void;
|
|
1552
|
+
}
|
|
1553
|
+
interface UseSparePartsReturn {
|
|
1554
|
+
/** The parts to render — the controlled prop when set, else the fetched list. */
|
|
1555
|
+
displayParts: SparePart[];
|
|
1556
|
+
/** Child machines of this node, for rendering alongside the parts. */
|
|
1557
|
+
childMachines: SparePartsMachine[];
|
|
1558
|
+
/** Total parts found. */
|
|
1559
|
+
itemsFound: number;
|
|
1560
|
+
/** `true` while an internal fetch is in flight. Always `false` when controlled. */
|
|
1561
|
+
isLoading: boolean;
|
|
1562
|
+
/** Current page (1-based). */
|
|
1563
|
+
currentPage: number;
|
|
1564
|
+
/** Total pages. */
|
|
1565
|
+
totalPages: number;
|
|
1566
|
+
/** Re-run the fetch. No-op in controlled mode. */
|
|
1567
|
+
fetchParts: () => Promise<void>;
|
|
1568
|
+
/** Navigate to a page. */
|
|
1569
|
+
goToPage: (page: number) => void;
|
|
1570
|
+
}
|
|
1571
|
+
/**
|
|
1572
|
+
* useSpareParts — fetch and paginate a machine node's spare-parts list.
|
|
1573
|
+
*
|
|
1574
|
+
* @param options - see {@link UseSparePartsOptions}
|
|
1575
|
+
* @returns parts, child machines, paging state and actions — see {@link UseSparePartsReturn}
|
|
1576
|
+
*/
|
|
1577
|
+
declare function useSpareParts(options: UseSparePartsOptions): UseSparePartsReturn;
|
|
1578
|
+
|
|
1579
|
+
/**
|
|
1580
|
+
* Build ONE aliased query resolving every installation in a single request:
|
|
1581
|
+
* `machine_0: machine(source: $source, sourceId: $sourceId_0, language: $language) { … }`
|
|
1582
|
+
* per id. One shared `$source`/`$language`/`$imageVariantFilters`, one
|
|
1583
|
+
* `$sourceId_N` per id. `imageVariants(input:)` is NON_NULL — the same
|
|
1584
|
+
* `TransformationsInput!` the SDK `machine`/`category` queries require.
|
|
1585
|
+
*/
|
|
1586
|
+
declare function buildRootMachinesQuery(count: number): string;
|
|
1587
|
+
interface UseMachinesOptions {
|
|
1588
|
+
/** SDK client. Without it the hook stays idle. */
|
|
1589
|
+
graphqlClient?: GraphQLClient;
|
|
1590
|
+
/** External system the machine ids belong to (pairs with each id). */
|
|
1591
|
+
source?: string;
|
|
1592
|
+
/** Installation ids (from the `MY_INSTALLATIONS` company track attribute). */
|
|
1593
|
+
sourceIds?: string[];
|
|
1594
|
+
/** Language the machine TREE is authored in (usually EN). */
|
|
1595
|
+
language?: string;
|
|
1596
|
+
/**
|
|
1597
|
+
* Image transformation for the card thumbnail — the `TransformationsInput!`
|
|
1598
|
+
* the schema requires on `imageVariants(input:)`. Without it the query fails
|
|
1599
|
+
* validation ("argument input of type TransformationsInput! is required").
|
|
1600
|
+
* Pass `config.imageVariantFiltersMedium` (same value the node query uses).
|
|
1601
|
+
*/
|
|
1602
|
+
imageVariantFilters?: unknown;
|
|
1603
|
+
}
|
|
1604
|
+
interface UseMachinesReturn {
|
|
1605
|
+
/** Resolved installations, in `sourceIds` order, nulls dropped. */
|
|
1606
|
+
machines: SparePartsMachine[];
|
|
1607
|
+
/** `true` while the concat request is in flight. */
|
|
1608
|
+
isLoading: boolean;
|
|
1609
|
+
/** Re-run the fetch. */
|
|
1610
|
+
fetchMachines: () => Promise<void>;
|
|
1611
|
+
}
|
|
1612
|
+
/**
|
|
1613
|
+
* useMachines — resolve a company's installations in one concatenated request.
|
|
1614
|
+
*
|
|
1615
|
+
* @param options - see {@link UseMachinesOptions}
|
|
1616
|
+
* @returns machines + loading + refetch — see {@link UseMachinesReturn}
|
|
1617
|
+
*/
|
|
1618
|
+
declare function useMachines(options: UseMachinesOptions): UseMachinesReturn;
|
|
1619
|
+
|
|
1477
1620
|
/**
|
|
1478
1621
|
* useProductSlider (React) — Crossupsell/product fetch + scroll tracking.
|
|
1479
1622
|
*
|
|
@@ -3525,6 +3668,138 @@ type ClusterCardComponent = typeof MemoizedRoot$1 & {
|
|
|
3525
3668
|
};
|
|
3526
3669
|
declare const ClusterCardExport: ClusterCardComponent;
|
|
3527
3670
|
|
|
3671
|
+
/**
|
|
3672
|
+
* @rsc-blocked — Client-only component: JSX event handlers (onClick).
|
|
3673
|
+
* Must be rendered inside (or below) a Client Component boundary; cannot be
|
|
3674
|
+
* imported directly into a React Server Component. The 'use client' header
|
|
3675
|
+
* above marks this boundary to Next.js.
|
|
3676
|
+
*/
|
|
3677
|
+
|
|
3678
|
+
interface MachineCardProps {
|
|
3679
|
+
/** The machine (spare-parts tree node) to display. */
|
|
3680
|
+
machine: SparePartsMachine;
|
|
3681
|
+
/**
|
|
3682
|
+
* Destination for the card link — the child node's URL.
|
|
3683
|
+
*
|
|
3684
|
+
* Passed in rather than derived from `configuration.urls` because a machine's
|
|
3685
|
+
* URL is its ancestor path (`/machines/a/b/c`), which only the host route
|
|
3686
|
+
* knows; the machine object carries just its own slug.
|
|
3687
|
+
*/
|
|
3688
|
+
href: string;
|
|
3689
|
+
/** Show the machine image. Defaults to true. */
|
|
3690
|
+
showImage?: boolean;
|
|
3691
|
+
/** Show the machine description under the name. Defaults to false. */
|
|
3692
|
+
showDescription?: boolean;
|
|
3693
|
+
/** Language used to resolve the localized name/description. */
|
|
3694
|
+
language?: string;
|
|
3695
|
+
/** UI label overrides. Supported key: `viewMachine`. */
|
|
3696
|
+
labels?: Record<string, string>;
|
|
3697
|
+
/** Extra classes on the card root. */
|
|
3698
|
+
className?: string;
|
|
3699
|
+
/** Click handler for the card link (e.g. analytics). Does not prevent navigation. */
|
|
3700
|
+
onClick?: (machine: SparePartsMachine) => void;
|
|
3701
|
+
}
|
|
3702
|
+
/**
|
|
3703
|
+
* A single node in the spare-parts machine tree, rendered as a card that
|
|
3704
|
+
* navigates one level deeper.
|
|
3705
|
+
*
|
|
3706
|
+
* Deliberately a plain link, not an add-to-cart surface: a machine is a
|
|
3707
|
+
* container you browse into. (The WP reference styles this link with its
|
|
3708
|
+
* add-to-basket button class, which reads as "buy" — not copied.)
|
|
3709
|
+
*/
|
|
3710
|
+
declare function MachineCard(props: MachineCardProps): React$1.JSX.Element;
|
|
3711
|
+
|
|
3712
|
+
/**
|
|
3713
|
+
* @rsc-blocked — Client-only component: hooks + effects (via useSpareParts /
|
|
3714
|
+
* useMachines) and event handlers. Render inside a Client boundary.
|
|
3715
|
+
*/
|
|
3716
|
+
/**
|
|
3717
|
+
* MachineGrid — the spare-parts machine tree, as one self-contained grid.
|
|
3718
|
+
*
|
|
3719
|
+
* The machine-tree sibling of `ProductGrid`. Driven by the current URL path
|
|
3720
|
+
* (`segments`), it renders one of two modes:
|
|
3721
|
+
*
|
|
3722
|
+
* - **Root** (`segments` empty): resolves the company's installations in ONE
|
|
3723
|
+
* concatenated request via `useMachines(source, sourceIds)` and renders them
|
|
3724
|
+
* as `MachineCard`s.
|
|
3725
|
+
* - **Node** (`segments` non-empty): fetches that machine by its leaf slug via
|
|
3726
|
+
* `useSpareParts`, and renders its child machines (`MachineCard`s) above a
|
|
3727
|
+
* category-style spare-parts listing (facets + toolbar + a permanently
|
|
3728
|
+
* controlled `ProductGrid` + pagination, with the qty-in-machine `belowName`).
|
|
3729
|
+
*
|
|
3730
|
+
* Navigation between levels is via `MachineCard`'s `href` (built from `basePath`
|
|
3731
|
+
* + segments + child slug) — the package owns no router. The parts listing is
|
|
3732
|
+
* **controlled**: the current state comes in via `listing`, and every filter /
|
|
3733
|
+
* sort / page / search interaction emits the next state via `onListingChange`.
|
|
3734
|
+
* The host route maps that to the URL (so a filtered view is shareable), exactly
|
|
3735
|
+
* as `ProductGrid` + the category island already do.
|
|
3736
|
+
*/
|
|
3737
|
+
|
|
3738
|
+
/**
|
|
3739
|
+
* The controlled listing state for the spare-parts view — mirrors what the host
|
|
3740
|
+
* derives from the URL (`page`/`offset`/`sort`/attribute-`filters`/`price`/`term`).
|
|
3741
|
+
* Primitives + SDK enums only, so no app type leaks into the package.
|
|
3742
|
+
*/
|
|
3743
|
+
interface MachineListingState {
|
|
3744
|
+
page: number;
|
|
3745
|
+
offset: number;
|
|
3746
|
+
sortField: ProductSortField | string;
|
|
3747
|
+
sortOrder: SortOrder | string;
|
|
3748
|
+
/** Attribute name → selected facet values. */
|
|
3749
|
+
filters: Record<string, string[]>;
|
|
3750
|
+
minPrice?: number;
|
|
3751
|
+
maxPrice?: number;
|
|
3752
|
+
term: string;
|
|
3753
|
+
}
|
|
3754
|
+
interface MachineGridProps {
|
|
3755
|
+
/** Current URL path under the machines root, e.g. `['mixer','frame']`. `[]` = root. */
|
|
3756
|
+
segments: string[];
|
|
3757
|
+
/** Localized machines base path (e.g. `/nl/machines`) — used to build hrefs. */
|
|
3758
|
+
basePath: string;
|
|
3759
|
+
/** External system the installation ids belong to (root mode). */
|
|
3760
|
+
source?: string;
|
|
3761
|
+
/** Installation ids from `MY_INSTALLATIONS` (root mode). */
|
|
3762
|
+
sourceIds?: string[];
|
|
3763
|
+
/** Title for the root list. Defaults to `'Machines'`. */
|
|
3764
|
+
rootTitle?: string;
|
|
3765
|
+
/** Language the machine tree is authored in (usually EN). Defaults to `'EN'`. */
|
|
3766
|
+
machineLanguage?: string;
|
|
3767
|
+
listing: MachineListingState;
|
|
3768
|
+
onListingChange: (next: MachineListingState) => void;
|
|
3769
|
+
graphqlClient?: GraphQLClient;
|
|
3770
|
+
user?: Contact | Customer | null;
|
|
3771
|
+
companyId?: number;
|
|
3772
|
+
/** Storefront language (parts). */
|
|
3773
|
+
language?: string;
|
|
3774
|
+
taxZone?: string;
|
|
3775
|
+
configuration?: {
|
|
3776
|
+
imageSearchFiltersGrid?: unknown;
|
|
3777
|
+
imageVariantFiltersMedium?: unknown;
|
|
3778
|
+
};
|
|
3779
|
+
portalMode?: string;
|
|
3780
|
+
cartId?: string;
|
|
3781
|
+
createCart?: boolean;
|
|
3782
|
+
onCartCreated?: (cart: Cart) => void;
|
|
3783
|
+
/**
|
|
3784
|
+
* Fired after every successful add-to-cart (adds into an EXISTING cart too, not
|
|
3785
|
+
* just the first create). Forward this to `CartContext.saveCart` or the cart
|
|
3786
|
+
* icon/sidebar/page won't reflect parts added from the grid — `onCartCreated`
|
|
3787
|
+
* alone only fires when a brand-new cart is created.
|
|
3788
|
+
*/
|
|
3789
|
+
afterAddToCart?: (cart: Cart, item?: CartMainItem) => void;
|
|
3790
|
+
allowAddToCart?: boolean;
|
|
3791
|
+
showPrice?: boolean;
|
|
3792
|
+
showStock?: boolean;
|
|
3793
|
+
showAvailability?: boolean;
|
|
3794
|
+
onProductClick?: (product: Product) => void;
|
|
3795
|
+
paginationLabels?: Record<string, string>;
|
|
3796
|
+
filtersLabels?: Record<string, string>;
|
|
3797
|
+
toolbarLabels?: Record<string, string>;
|
|
3798
|
+
machineCardLabels?: Record<string, string>;
|
|
3799
|
+
className?: string;
|
|
3800
|
+
}
|
|
3801
|
+
declare function MachineGrid(rawProps: MachineGridProps): React$1.JSX.Element;
|
|
3802
|
+
|
|
3528
3803
|
/**
|
|
3529
3804
|
* @rsc-blocked — Client-only component: side effects (useEffect).
|
|
3530
3805
|
* Must be rendered inside (or below) a Client Component boundary; cannot be
|
|
@@ -6773,4 +7048,4 @@ declare function DefaultProductBadges(props: BadgesComponentProps): React__defau
|
|
|
6773
7048
|
*/
|
|
6774
7049
|
declare function DefaultProductSurcharges(props: ProductSurchargesComponentProps): React__default.JSX.Element | null;
|
|
6775
7050
|
|
|
6776
|
-
export { AccountIconAndMenu, type AccountIconAndMenuProps, ActionCode, type ActionCodeProps, type AddContactFormState, type AddItemOptions, _default$1 as AddToCart, type AddToCartProps, AddToFavorite, type AddToFavoriteProps, AddressCardExport as AddressCard, type AddressCardProps, type AddressInput, AddressSelector, type AddressSelectorProps, type AttributeDisplayItem, type AttributeGroup, BreadcrumbsWithProvider as Breadcrumbs, type BreadcrumbsProps, CartBonusItems, type CartBonusItemsProps, CartCarriers, type CartCarriersProps, CartIconAndSidebar, type CartIconAndSidebarProps, type CartInitConfig, CartItemExport as CartItem, type CartItemProps, CartOverview, type CartOverviewProps, CartPaymethods, type CartPaymethodsProps, CartSummary, type CartSummaryProps, CategoryDescription, type CategoryDescriptionProps, CategoryShortDescriptionWithProvider as CategoryShortDescription, type CategoryShortDescriptionProps, ClusterCardExport as ClusterCard, type ClusterCardProps, ClusterConfigurator, type ClusterConfiguratorProps, ClusterInfo, type ClusterInfoProps, ClusterOptions, type ClusterOptionsProps, CompanySwitcher, type CompanySwitcherProps, type ConfiguredSetting, _default$1 as DefaultAddToCart, AddToFavorite as DefaultAddToFavorite, _default as DefaultItemStock, DefaultProductBadges, ProductBulkPrices as DefaultProductBulkPrices, ProductBundles as DefaultProductBundles, DefaultProductImage, ProductPriceDisplay as DefaultProductPrice, DefaultProductSurcharges, DeliveryDate, type DeliveryDateProps, FavoriteListDetails, type FavoriteListDetailsProps, type FavoriteListFormData, FavoriteListItemExport as FavoriteListItem, type FavoriteListItemProps, FavoriteLists, type FavoriteListsProps, type FetchActiveCartConfig, type FetchCrossupsellsInput, ForgotPassword, type ForgotPasswordProps, type GetCrossupsellsOptions, GridFilters, GridFiltersPanel, type GridFiltersPanelProps, type GridFiltersProps, GridPagination, type GridPaginationProps, GridTitleWithProvider as GridTitle, type GridTitleProps, GridToolbar, type GridToolbarProps, _default as ItemStock, type ItemStockProps, ItemsOverview, type ItemsOverviewProps, LoginFormExport as LoginForm, type LoginFormProps, Menu, type MenuCategory, type MenuProps, OrderActions, type OrderActionsProps, OrderBonusItems, type OrderBonusItemsProps, OrderItemCard, type OrderItemCardProps, OrderList, type OrderListProps, type OrderSearchForm, OrderShipments, type OrderShipmentsProps, OrderSummary, type OrderSummaryProps, OrderTotals, type OrderTotalsProps, type PlaceOrderOptions, PriceToggle, type PriceToggleProps, ProductBulkPricesWithProvider as ProductBulkPrices, type ProductBulkPricesProps, ProductBundles, type ProductBundlesProps, ProductCard, type ProductCardProps, ProductDescription, type ProductDescriptionProps, ProductDownloads, type ProductDownloadsProps, ProductGallery, type ProductGalleryProps, ProductGridCompound as ProductGrid, type ProductGridConfig, ProductGridConfigProvider, type ProductGridProps, ProductInfoExport as ProductInfo, type ProductInfoProps, ProductPriceWithProvider as ProductPrice, type ProductPriceProps, ProductShortDescriptionWithProvider as ProductShortDescription, type ProductShortDescriptionProps, ProductSlider, type ProductSliderProps, ProductSpecifications, type ProductSpecificationsProps, ProductTabs, type ProductTabsProps, ProductVideos, type ProductVideosProps, type PropellerDeps, PropellerDepsProvider, type PropellerDepsProviderProps, type PropellerInfra, PropellerProvider, type PropellerProviderProps, type PropellerScope, PurchaseAuthorizationConfigurator, type PurchaseAuthorizationConfiguratorProps, PurchaseAuthorizationRequests, type PurchaseAuthorizationRequestsProps, QuoteActions, type QuoteActionsProps, RegisterForm, type RegisterFormProps, type ResolveSpec, type RowEdit, SearchBar, type SearchBarProps, type UseAddressOptions, type UseAddressReturn, type LoginResult as UseAuthLoginResult, type UseAuthOptions, type RegisterContactInput as UseAuthRegisterContactInput, type RegisterCustomerInput as UseAuthRegisterCustomerInput, type UseAuthReturn, type UseCartOptions, type UseCartReturn, type UseCheckoutOptions, type UseCheckoutReturn, type UseClusterConfiguratorOptions, type UseClusterConfiguratorReturn, type UseCompanyOptions, type UseCompanyReturn, type UseFavoritesOptions, type UseFavoritesReturn, type UseMenuOptions, type UseMenuReturn, type UseOrdersOptions, type UseOrdersReturn, type BundleItem as UseProductBundlesBundleItem, type UseProductBundlesOptions, type UseProductBundlesReturn, type UseProductInfoOptions, type UseProductInfoReturn, type UseProductSearchOptions, type UseProductSearchReturn, type UseProductSliderOptions, type UseProductSliderReturn, type UseProductSpecsOptions, type UseProductSpecsReturn, type UsePurchaseAuthorizationConfiguratorOptions, type UsePurchaseAuthorizationConfiguratorReturn, type UsePurchaseAuthorizationRequestsOptions, type UsePurchaseAuthorizationRequestsReturn, UserDetails, type UserDetailsProps, fetchActiveCart, initCart, mergeAnonymousCart, useAddress, useAuth, useCart, useCheckout, useClusterConfigurator, useCompany, useFavorites, useInfraProps, useMenu, useOrders, useProductBundles, useProductGridConfig, useProductInfo, useProductSearch, useProductSlider, useProductSpecs, usePropellerContext, usePropellerDeps, usePropellerScope, usePurchaseAuthorizationConfigurator, usePurchaseAuthorizationRequests, useRequiredPropellerDeps, useResolvedProps, useServices, useUserMode };
|
|
7051
|
+
export { AccountIconAndMenu, type AccountIconAndMenuProps, ActionCode, type ActionCodeProps, type AddContactFormState, type AddItemOptions, _default$1 as AddToCart, type AddToCartProps, AddToFavorite, type AddToFavoriteProps, AddressCardExport as AddressCard, type AddressCardProps, type AddressInput, AddressSelector, type AddressSelectorProps, type AttributeDisplayItem, type AttributeGroup, BreadcrumbsWithProvider as Breadcrumbs, type BreadcrumbsProps, CartBonusItems, type CartBonusItemsProps, CartCarriers, type CartCarriersProps, CartIconAndSidebar, type CartIconAndSidebarProps, type CartInitConfig, CartItemExport as CartItem, type CartItemProps, CartOverview, type CartOverviewProps, CartPaymethods, type CartPaymethodsProps, CartSummary, type CartSummaryProps, CategoryDescription, type CategoryDescriptionProps, CategoryShortDescriptionWithProvider as CategoryShortDescription, type CategoryShortDescriptionProps, ClusterCardExport as ClusterCard, type ClusterCardProps, ClusterConfigurator, type ClusterConfiguratorProps, ClusterInfo, type ClusterInfoProps, ClusterOptions, type ClusterOptionsProps, CompanySwitcher, type CompanySwitcherProps, type ConfiguredSetting, _default$1 as DefaultAddToCart, AddToFavorite as DefaultAddToFavorite, _default as DefaultItemStock, DefaultProductBadges, ProductBulkPrices as DefaultProductBulkPrices, ProductBundles as DefaultProductBundles, DefaultProductImage, ProductPriceDisplay as DefaultProductPrice, DefaultProductSurcharges, DeliveryDate, type DeliveryDateProps, FavoriteListDetails, type FavoriteListDetailsProps, type FavoriteListFormData, FavoriteListItemExport as FavoriteListItem, type FavoriteListItemProps, FavoriteLists, type FavoriteListsProps, type FetchActiveCartConfig, type FetchCrossupsellsInput, ForgotPassword, type ForgotPasswordProps, type GetCrossupsellsOptions, GridFilters, GridFiltersPanel, type GridFiltersPanelProps, type GridFiltersProps, GridPagination, type GridPaginationProps, GridTitleWithProvider as GridTitle, type GridTitleProps, GridToolbar, type GridToolbarProps, _default as ItemStock, type ItemStockProps, ItemsOverview, type ItemsOverviewProps, LoginFormExport as LoginForm, type LoginFormProps, MachineCard, type MachineCardProps, MachineGrid, type MachineGridProps, type MachineListingState, Menu, type MenuCategory, type MenuProps, OrderActions, type OrderActionsProps, OrderBonusItems, type OrderBonusItemsProps, OrderItemCard, type OrderItemCardProps, OrderList, type OrderListProps, type OrderSearchForm, OrderShipments, type OrderShipmentsProps, OrderSummary, type OrderSummaryProps, OrderTotals, type OrderTotalsProps, type PlaceOrderOptions, PriceToggle, type PriceToggleProps, ProductBulkPricesWithProvider as ProductBulkPrices, type ProductBulkPricesProps, ProductBundles, type ProductBundlesProps, ProductCard, type ProductCardProps, ProductDescription, type ProductDescriptionProps, ProductDownloads, type ProductDownloadsProps, ProductGallery, type ProductGalleryProps, ProductGridCompound as ProductGrid, type ProductGridConfig, ProductGridConfigProvider, type ProductGridProps, ProductInfoExport as ProductInfo, type ProductInfoProps, ProductPriceWithProvider as ProductPrice, type ProductPriceProps, ProductShortDescriptionWithProvider as ProductShortDescription, type ProductShortDescriptionProps, ProductSlider, type ProductSliderProps, ProductSpecifications, type ProductSpecificationsProps, ProductTabs, type ProductTabsProps, ProductVideos, type ProductVideosProps, type PropellerDeps, PropellerDepsProvider, type PropellerDepsProviderProps, type PropellerInfra, PropellerProvider, type PropellerProviderProps, type PropellerScope, PurchaseAuthorizationConfigurator, type PurchaseAuthorizationConfiguratorProps, PurchaseAuthorizationRequests, type PurchaseAuthorizationRequestsProps, QuoteActions, type QuoteActionsProps, RegisterForm, type RegisterFormProps, type ResolveSpec, type RowEdit, SearchBar, type SearchBarProps, type UseAddressOptions, type UseAddressReturn, type LoginResult as UseAuthLoginResult, type UseAuthOptions, type RegisterContactInput as UseAuthRegisterContactInput, type RegisterCustomerInput as UseAuthRegisterCustomerInput, type UseAuthReturn, type UseCartOptions, type UseCartReturn, type UseCheckoutOptions, type UseCheckoutReturn, type UseClusterConfiguratorOptions, type UseClusterConfiguratorReturn, type UseCompanyOptions, type UseCompanyReturn, type UseFavoritesOptions, type UseFavoritesReturn, type UseMachinesOptions, type UseMachinesReturn, type UseMenuOptions, type UseMenuReturn, type UseOrdersOptions, type UseOrdersReturn, type BundleItem as UseProductBundlesBundleItem, type UseProductBundlesOptions, type UseProductBundlesReturn, type UseProductInfoOptions, type UseProductInfoReturn, type UseProductSearchOptions, type UseProductSearchReturn, type UseProductSliderOptions, type UseProductSliderReturn, type UseProductSpecsOptions, type UseProductSpecsReturn, type UsePurchaseAuthorizationConfiguratorOptions, type UsePurchaseAuthorizationConfiguratorReturn, type UsePurchaseAuthorizationRequestsOptions, type UsePurchaseAuthorizationRequestsReturn, type UseSparePartsOptions, type UseSparePartsReturn, UserDetails, type UserDetailsProps, buildRootMachinesQuery, fetchActiveCart, initCart, mergeAnonymousCart, useAddress, useAuth, useCart, useCheckout, useClusterConfigurator, useCompany, useFavorites, useInfraProps, useMachines, useMenu, useOrders, useProductBundles, useProductGridConfig, useProductInfo, useProductSearch, useProductSlider, useProductSpecs, usePropellerContext, usePropellerDeps, usePropellerScope, usePurchaseAuthorizationConfigurator, usePurchaseAuthorizationRequests, useRequiredPropellerDeps, useResolvedProps, useServices, useSpareParts, useUserMode };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Services, ShopMode, UserMode, PriceComponentProps, StockComponentProps,
|
|
|
3
3
|
export * from '@propeller-commerce/propeller-v2-core-ui';
|
|
4
4
|
import * as React$1 from 'react';
|
|
5
5
|
import React__default, { ReactNode, ComponentType } from 'react';
|
|
6
|
-
import { GraphQLClient, Contact, Customer, Cart, CartMainItem, Product, Cluster, AddressType, Gender, YesNo, Address, TransformationsInput, MediaImageProductSearchInput, CartProcessResponse, Crossupsell, CartUpdateAddressInput, CartUpdateInput, CartAddressType, ClusterConfig, Company, CompanyVariables, PurchaseAuthorizationConfigCreateInput, PurchaseAuthorizationConfigUpdateInput, FavoriteList, DateSearchInput, DecimalSearchInput, OrderSortInput, OrderType, OrderSearchFields, Order, ProductTextFilterInput, AttributeFilter, ProductsResponse, Category, CrossupsellType, AttributeResult, RegisterContactInput as RegisterContactInput$1, PurchaseAuthorizationConfig, CartChildItemInput, CartAddress, WarehouseAddress, OrderAddress, CartBaseItem, CartCarrier, CartPaymethod, ClusterOption, ProductInventory, OrderItem, ProductPrice, Bundle, PaginatedMediaDocumentResponse, PaginatedMediaVideoResponse } from '@propeller-commerce/propeller-sdk-v2';
|
|
6
|
+
import { GraphQLClient, Contact, Customer, Cart, CartMainItem, Product, Cluster, AddressType, Gender, YesNo, Address, TransformationsInput, MediaImageProductSearchInput, CartProcessResponse, Crossupsell, CartUpdateAddressInput, CartUpdateInput, CartAddressType, ClusterConfig, Company, CompanyVariables, PurchaseAuthorizationConfigCreateInput, PurchaseAuthorizationConfigUpdateInput, FavoriteList, DateSearchInput, DecimalSearchInput, OrderSortInput, OrderType, OrderSearchFields, Order, ProductTextFilterInput, AttributeFilter, ProductsResponse, Category, SparePart, ProductSortField, SortOrder, SparePartsResponse, SparePartsMachine, CrossupsellType, AttributeResult, RegisterContactInput as RegisterContactInput$1, PurchaseAuthorizationConfig, CartChildItemInput, CartAddress, WarehouseAddress, OrderAddress, CartBaseItem, CartCarrier, CartPaymethod, ClusterOption, ProductInventory, OrderItem, ProductPrice, Bundle, PaginatedMediaDocumentResponse, PaginatedMediaVideoResponse } from '@propeller-commerce/propeller-sdk-v2';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Tier 1 — application-wide infrastructure. Bound by `<PropellerDepsProvider>`
|
|
@@ -1474,6 +1474,149 @@ interface UseProductSearchReturn {
|
|
|
1474
1474
|
*/
|
|
1475
1475
|
declare function useProductSearch(options: UseProductSearchOptions): UseProductSearchReturn;
|
|
1476
1476
|
|
|
1477
|
+
/**
|
|
1478
|
+
* useSpareParts (React) — a machine node's spare-parts list.
|
|
1479
|
+
*
|
|
1480
|
+
* The machine-tree sibling of `useProductSearch`: same contract (options in,
|
|
1481
|
+
* state + actions out), same controlled/uncontrolled sentinel, same race
|
|
1482
|
+
* guards — but sourced from `machine(slug:).sparePartProducts` instead of
|
|
1483
|
+
* `category(categoryId:).products`.
|
|
1484
|
+
*
|
|
1485
|
+
* Two things it deliberately does NOT copy from `useProductSearch`:
|
|
1486
|
+
* - the debounced search-bar path (`search()` / `searchResults`). Searching
|
|
1487
|
+
* within a machine is server-side and scoped to this node's parts, so it is
|
|
1488
|
+
* just the `term` option feeding the same fetch.
|
|
1489
|
+
* - the derived price-bounds fallback. The parts response carries the same
|
|
1490
|
+
* aggregate `minPrice`/`maxPrice` fields, so the fallback is kept — see
|
|
1491
|
+
* the note at the call site.
|
|
1492
|
+
*/
|
|
1493
|
+
|
|
1494
|
+
interface UseSparePartsOptions {
|
|
1495
|
+
/** SDK client. Without it the hook stays idle (controlled mode needs no client). */
|
|
1496
|
+
graphqlClient?: GraphQLClient;
|
|
1497
|
+
/**
|
|
1498
|
+
* Controlled mode: pre-fetched parts (e.g. SSR-seeded). When DEFINED the hook
|
|
1499
|
+
* performs no fetching at all and simply echoes these back. Pass `[]` (not
|
|
1500
|
+
* `undefined`) to show an empty state while the host controls loading.
|
|
1501
|
+
*/
|
|
1502
|
+
parts?: SparePart[];
|
|
1503
|
+
/** Slug of the machine whose parts to list. */
|
|
1504
|
+
slug?: string;
|
|
1505
|
+
/** Free-text search, scoped server-side to this machine's parts. */
|
|
1506
|
+
term?: string;
|
|
1507
|
+
/** Language for the spare parts themselves (the storefront language). */
|
|
1508
|
+
language: string;
|
|
1509
|
+
/**
|
|
1510
|
+
* Language the MACHINE TREE is authored in. Defaults to `language`.
|
|
1511
|
+
*
|
|
1512
|
+
* `machine(slug:, language:)` is language-scoped and hard-errors with
|
|
1513
|
+
* "No machine found for slug and language" when the machine has no name/slug
|
|
1514
|
+
* in that language. Machine trees are commonly maintained in one language
|
|
1515
|
+
* (typically EN) while their spare parts are localized — so the lookup and the
|
|
1516
|
+
* parts list need different languages. Set this when they diverge.
|
|
1517
|
+
*/
|
|
1518
|
+
machineLanguage?: string;
|
|
1519
|
+
/** Tax zone for price calculation. */
|
|
1520
|
+
taxZone?: string;
|
|
1521
|
+
/** Active user — drives `userId` scoping and contact/customer pricing. */
|
|
1522
|
+
user?: Contact | Customer | null;
|
|
1523
|
+
/** Active company — scopes the assortment. */
|
|
1524
|
+
companyId?: number;
|
|
1525
|
+
/** Attribute (facet) filters. */
|
|
1526
|
+
textFilters?: ProductTextFilterInput[];
|
|
1527
|
+
/** Price-range filter lower bound. */
|
|
1528
|
+
priceFilterMin?: number;
|
|
1529
|
+
/** Price-range filter upper bound. */
|
|
1530
|
+
priceFilterMax?: number;
|
|
1531
|
+
/** Sort field. */
|
|
1532
|
+
sortField?: ProductSortField | string;
|
|
1533
|
+
/** Sort direction. */
|
|
1534
|
+
sortOrder?: SortOrder | string;
|
|
1535
|
+
/** Items per page. Defaults to 12. */
|
|
1536
|
+
pageSize?: number;
|
|
1537
|
+
/** Image filter config, mirroring `useProductSearch`'s `configuration`. */
|
|
1538
|
+
configuration?: {
|
|
1539
|
+
imageSearchFiltersGrid?: unknown;
|
|
1540
|
+
imageVariantFiltersMedium?: unknown;
|
|
1541
|
+
};
|
|
1542
|
+
/** Fired with the facet list after each fetch. */
|
|
1543
|
+
onFiltersChange?: (filters: AttributeFilter[]) => void;
|
|
1544
|
+
/** Fired with the price-slider bounds after each fetch. */
|
|
1545
|
+
onPriceBoundsChange?: (min: number, max: number) => void;
|
|
1546
|
+
/** Fired with the total item count after each fetch. */
|
|
1547
|
+
onItemsFoundChange?: (count: number) => void;
|
|
1548
|
+
/** Fired with the raw parts response after each fetch. */
|
|
1549
|
+
onPartsResponse?: (response: SparePartsResponse) => void;
|
|
1550
|
+
/** Fired with the machine itself after each fetch (name, child machines, …). */
|
|
1551
|
+
onMachineChange?: (machine: SparePartsMachine) => void;
|
|
1552
|
+
}
|
|
1553
|
+
interface UseSparePartsReturn {
|
|
1554
|
+
/** The parts to render — the controlled prop when set, else the fetched list. */
|
|
1555
|
+
displayParts: SparePart[];
|
|
1556
|
+
/** Child machines of this node, for rendering alongside the parts. */
|
|
1557
|
+
childMachines: SparePartsMachine[];
|
|
1558
|
+
/** Total parts found. */
|
|
1559
|
+
itemsFound: number;
|
|
1560
|
+
/** `true` while an internal fetch is in flight. Always `false` when controlled. */
|
|
1561
|
+
isLoading: boolean;
|
|
1562
|
+
/** Current page (1-based). */
|
|
1563
|
+
currentPage: number;
|
|
1564
|
+
/** Total pages. */
|
|
1565
|
+
totalPages: number;
|
|
1566
|
+
/** Re-run the fetch. No-op in controlled mode. */
|
|
1567
|
+
fetchParts: () => Promise<void>;
|
|
1568
|
+
/** Navigate to a page. */
|
|
1569
|
+
goToPage: (page: number) => void;
|
|
1570
|
+
}
|
|
1571
|
+
/**
|
|
1572
|
+
* useSpareParts — fetch and paginate a machine node's spare-parts list.
|
|
1573
|
+
*
|
|
1574
|
+
* @param options - see {@link UseSparePartsOptions}
|
|
1575
|
+
* @returns parts, child machines, paging state and actions — see {@link UseSparePartsReturn}
|
|
1576
|
+
*/
|
|
1577
|
+
declare function useSpareParts(options: UseSparePartsOptions): UseSparePartsReturn;
|
|
1578
|
+
|
|
1579
|
+
/**
|
|
1580
|
+
* Build ONE aliased query resolving every installation in a single request:
|
|
1581
|
+
* `machine_0: machine(source: $source, sourceId: $sourceId_0, language: $language) { … }`
|
|
1582
|
+
* per id. One shared `$source`/`$language`/`$imageVariantFilters`, one
|
|
1583
|
+
* `$sourceId_N` per id. `imageVariants(input:)` is NON_NULL — the same
|
|
1584
|
+
* `TransformationsInput!` the SDK `machine`/`category` queries require.
|
|
1585
|
+
*/
|
|
1586
|
+
declare function buildRootMachinesQuery(count: number): string;
|
|
1587
|
+
interface UseMachinesOptions {
|
|
1588
|
+
/** SDK client. Without it the hook stays idle. */
|
|
1589
|
+
graphqlClient?: GraphQLClient;
|
|
1590
|
+
/** External system the machine ids belong to (pairs with each id). */
|
|
1591
|
+
source?: string;
|
|
1592
|
+
/** Installation ids (from the `MY_INSTALLATIONS` company track attribute). */
|
|
1593
|
+
sourceIds?: string[];
|
|
1594
|
+
/** Language the machine TREE is authored in (usually EN). */
|
|
1595
|
+
language?: string;
|
|
1596
|
+
/**
|
|
1597
|
+
* Image transformation for the card thumbnail — the `TransformationsInput!`
|
|
1598
|
+
* the schema requires on `imageVariants(input:)`. Without it the query fails
|
|
1599
|
+
* validation ("argument input of type TransformationsInput! is required").
|
|
1600
|
+
* Pass `config.imageVariantFiltersMedium` (same value the node query uses).
|
|
1601
|
+
*/
|
|
1602
|
+
imageVariantFilters?: unknown;
|
|
1603
|
+
}
|
|
1604
|
+
interface UseMachinesReturn {
|
|
1605
|
+
/** Resolved installations, in `sourceIds` order, nulls dropped. */
|
|
1606
|
+
machines: SparePartsMachine[];
|
|
1607
|
+
/** `true` while the concat request is in flight. */
|
|
1608
|
+
isLoading: boolean;
|
|
1609
|
+
/** Re-run the fetch. */
|
|
1610
|
+
fetchMachines: () => Promise<void>;
|
|
1611
|
+
}
|
|
1612
|
+
/**
|
|
1613
|
+
* useMachines — resolve a company's installations in one concatenated request.
|
|
1614
|
+
*
|
|
1615
|
+
* @param options - see {@link UseMachinesOptions}
|
|
1616
|
+
* @returns machines + loading + refetch — see {@link UseMachinesReturn}
|
|
1617
|
+
*/
|
|
1618
|
+
declare function useMachines(options: UseMachinesOptions): UseMachinesReturn;
|
|
1619
|
+
|
|
1477
1620
|
/**
|
|
1478
1621
|
* useProductSlider (React) — Crossupsell/product fetch + scroll tracking.
|
|
1479
1622
|
*
|
|
@@ -3525,6 +3668,138 @@ type ClusterCardComponent = typeof MemoizedRoot$1 & {
|
|
|
3525
3668
|
};
|
|
3526
3669
|
declare const ClusterCardExport: ClusterCardComponent;
|
|
3527
3670
|
|
|
3671
|
+
/**
|
|
3672
|
+
* @rsc-blocked — Client-only component: JSX event handlers (onClick).
|
|
3673
|
+
* Must be rendered inside (or below) a Client Component boundary; cannot be
|
|
3674
|
+
* imported directly into a React Server Component. The 'use client' header
|
|
3675
|
+
* above marks this boundary to Next.js.
|
|
3676
|
+
*/
|
|
3677
|
+
|
|
3678
|
+
interface MachineCardProps {
|
|
3679
|
+
/** The machine (spare-parts tree node) to display. */
|
|
3680
|
+
machine: SparePartsMachine;
|
|
3681
|
+
/**
|
|
3682
|
+
* Destination for the card link — the child node's URL.
|
|
3683
|
+
*
|
|
3684
|
+
* Passed in rather than derived from `configuration.urls` because a machine's
|
|
3685
|
+
* URL is its ancestor path (`/machines/a/b/c`), which only the host route
|
|
3686
|
+
* knows; the machine object carries just its own slug.
|
|
3687
|
+
*/
|
|
3688
|
+
href: string;
|
|
3689
|
+
/** Show the machine image. Defaults to true. */
|
|
3690
|
+
showImage?: boolean;
|
|
3691
|
+
/** Show the machine description under the name. Defaults to false. */
|
|
3692
|
+
showDescription?: boolean;
|
|
3693
|
+
/** Language used to resolve the localized name/description. */
|
|
3694
|
+
language?: string;
|
|
3695
|
+
/** UI label overrides. Supported key: `viewMachine`. */
|
|
3696
|
+
labels?: Record<string, string>;
|
|
3697
|
+
/** Extra classes on the card root. */
|
|
3698
|
+
className?: string;
|
|
3699
|
+
/** Click handler for the card link (e.g. analytics). Does not prevent navigation. */
|
|
3700
|
+
onClick?: (machine: SparePartsMachine) => void;
|
|
3701
|
+
}
|
|
3702
|
+
/**
|
|
3703
|
+
* A single node in the spare-parts machine tree, rendered as a card that
|
|
3704
|
+
* navigates one level deeper.
|
|
3705
|
+
*
|
|
3706
|
+
* Deliberately a plain link, not an add-to-cart surface: a machine is a
|
|
3707
|
+
* container you browse into. (The WP reference styles this link with its
|
|
3708
|
+
* add-to-basket button class, which reads as "buy" — not copied.)
|
|
3709
|
+
*/
|
|
3710
|
+
declare function MachineCard(props: MachineCardProps): React$1.JSX.Element;
|
|
3711
|
+
|
|
3712
|
+
/**
|
|
3713
|
+
* @rsc-blocked — Client-only component: hooks + effects (via useSpareParts /
|
|
3714
|
+
* useMachines) and event handlers. Render inside a Client boundary.
|
|
3715
|
+
*/
|
|
3716
|
+
/**
|
|
3717
|
+
* MachineGrid — the spare-parts machine tree, as one self-contained grid.
|
|
3718
|
+
*
|
|
3719
|
+
* The machine-tree sibling of `ProductGrid`. Driven by the current URL path
|
|
3720
|
+
* (`segments`), it renders one of two modes:
|
|
3721
|
+
*
|
|
3722
|
+
* - **Root** (`segments` empty): resolves the company's installations in ONE
|
|
3723
|
+
* concatenated request via `useMachines(source, sourceIds)` and renders them
|
|
3724
|
+
* as `MachineCard`s.
|
|
3725
|
+
* - **Node** (`segments` non-empty): fetches that machine by its leaf slug via
|
|
3726
|
+
* `useSpareParts`, and renders its child machines (`MachineCard`s) above a
|
|
3727
|
+
* category-style spare-parts listing (facets + toolbar + a permanently
|
|
3728
|
+
* controlled `ProductGrid` + pagination, with the qty-in-machine `belowName`).
|
|
3729
|
+
*
|
|
3730
|
+
* Navigation between levels is via `MachineCard`'s `href` (built from `basePath`
|
|
3731
|
+
* + segments + child slug) — the package owns no router. The parts listing is
|
|
3732
|
+
* **controlled**: the current state comes in via `listing`, and every filter /
|
|
3733
|
+
* sort / page / search interaction emits the next state via `onListingChange`.
|
|
3734
|
+
* The host route maps that to the URL (so a filtered view is shareable), exactly
|
|
3735
|
+
* as `ProductGrid` + the category island already do.
|
|
3736
|
+
*/
|
|
3737
|
+
|
|
3738
|
+
/**
|
|
3739
|
+
* The controlled listing state for the spare-parts view — mirrors what the host
|
|
3740
|
+
* derives from the URL (`page`/`offset`/`sort`/attribute-`filters`/`price`/`term`).
|
|
3741
|
+
* Primitives + SDK enums only, so no app type leaks into the package.
|
|
3742
|
+
*/
|
|
3743
|
+
interface MachineListingState {
|
|
3744
|
+
page: number;
|
|
3745
|
+
offset: number;
|
|
3746
|
+
sortField: ProductSortField | string;
|
|
3747
|
+
sortOrder: SortOrder | string;
|
|
3748
|
+
/** Attribute name → selected facet values. */
|
|
3749
|
+
filters: Record<string, string[]>;
|
|
3750
|
+
minPrice?: number;
|
|
3751
|
+
maxPrice?: number;
|
|
3752
|
+
term: string;
|
|
3753
|
+
}
|
|
3754
|
+
interface MachineGridProps {
|
|
3755
|
+
/** Current URL path under the machines root, e.g. `['mixer','frame']`. `[]` = root. */
|
|
3756
|
+
segments: string[];
|
|
3757
|
+
/** Localized machines base path (e.g. `/nl/machines`) — used to build hrefs. */
|
|
3758
|
+
basePath: string;
|
|
3759
|
+
/** External system the installation ids belong to (root mode). */
|
|
3760
|
+
source?: string;
|
|
3761
|
+
/** Installation ids from `MY_INSTALLATIONS` (root mode). */
|
|
3762
|
+
sourceIds?: string[];
|
|
3763
|
+
/** Title for the root list. Defaults to `'Machines'`. */
|
|
3764
|
+
rootTitle?: string;
|
|
3765
|
+
/** Language the machine tree is authored in (usually EN). Defaults to `'EN'`. */
|
|
3766
|
+
machineLanguage?: string;
|
|
3767
|
+
listing: MachineListingState;
|
|
3768
|
+
onListingChange: (next: MachineListingState) => void;
|
|
3769
|
+
graphqlClient?: GraphQLClient;
|
|
3770
|
+
user?: Contact | Customer | null;
|
|
3771
|
+
companyId?: number;
|
|
3772
|
+
/** Storefront language (parts). */
|
|
3773
|
+
language?: string;
|
|
3774
|
+
taxZone?: string;
|
|
3775
|
+
configuration?: {
|
|
3776
|
+
imageSearchFiltersGrid?: unknown;
|
|
3777
|
+
imageVariantFiltersMedium?: unknown;
|
|
3778
|
+
};
|
|
3779
|
+
portalMode?: string;
|
|
3780
|
+
cartId?: string;
|
|
3781
|
+
createCart?: boolean;
|
|
3782
|
+
onCartCreated?: (cart: Cart) => void;
|
|
3783
|
+
/**
|
|
3784
|
+
* Fired after every successful add-to-cart (adds into an EXISTING cart too, not
|
|
3785
|
+
* just the first create). Forward this to `CartContext.saveCart` or the cart
|
|
3786
|
+
* icon/sidebar/page won't reflect parts added from the grid — `onCartCreated`
|
|
3787
|
+
* alone only fires when a brand-new cart is created.
|
|
3788
|
+
*/
|
|
3789
|
+
afterAddToCart?: (cart: Cart, item?: CartMainItem) => void;
|
|
3790
|
+
allowAddToCart?: boolean;
|
|
3791
|
+
showPrice?: boolean;
|
|
3792
|
+
showStock?: boolean;
|
|
3793
|
+
showAvailability?: boolean;
|
|
3794
|
+
onProductClick?: (product: Product) => void;
|
|
3795
|
+
paginationLabels?: Record<string, string>;
|
|
3796
|
+
filtersLabels?: Record<string, string>;
|
|
3797
|
+
toolbarLabels?: Record<string, string>;
|
|
3798
|
+
machineCardLabels?: Record<string, string>;
|
|
3799
|
+
className?: string;
|
|
3800
|
+
}
|
|
3801
|
+
declare function MachineGrid(rawProps: MachineGridProps): React$1.JSX.Element;
|
|
3802
|
+
|
|
3528
3803
|
/**
|
|
3529
3804
|
* @rsc-blocked — Client-only component: side effects (useEffect).
|
|
3530
3805
|
* Must be rendered inside (or below) a Client Component boundary; cannot be
|
|
@@ -6773,4 +7048,4 @@ declare function DefaultProductBadges(props: BadgesComponentProps): React__defau
|
|
|
6773
7048
|
*/
|
|
6774
7049
|
declare function DefaultProductSurcharges(props: ProductSurchargesComponentProps): React__default.JSX.Element | null;
|
|
6775
7050
|
|
|
6776
|
-
export { AccountIconAndMenu, type AccountIconAndMenuProps, ActionCode, type ActionCodeProps, type AddContactFormState, type AddItemOptions, _default$1 as AddToCart, type AddToCartProps, AddToFavorite, type AddToFavoriteProps, AddressCardExport as AddressCard, type AddressCardProps, type AddressInput, AddressSelector, type AddressSelectorProps, type AttributeDisplayItem, type AttributeGroup, BreadcrumbsWithProvider as Breadcrumbs, type BreadcrumbsProps, CartBonusItems, type CartBonusItemsProps, CartCarriers, type CartCarriersProps, CartIconAndSidebar, type CartIconAndSidebarProps, type CartInitConfig, CartItemExport as CartItem, type CartItemProps, CartOverview, type CartOverviewProps, CartPaymethods, type CartPaymethodsProps, CartSummary, type CartSummaryProps, CategoryDescription, type CategoryDescriptionProps, CategoryShortDescriptionWithProvider as CategoryShortDescription, type CategoryShortDescriptionProps, ClusterCardExport as ClusterCard, type ClusterCardProps, ClusterConfigurator, type ClusterConfiguratorProps, ClusterInfo, type ClusterInfoProps, ClusterOptions, type ClusterOptionsProps, CompanySwitcher, type CompanySwitcherProps, type ConfiguredSetting, _default$1 as DefaultAddToCart, AddToFavorite as DefaultAddToFavorite, _default as DefaultItemStock, DefaultProductBadges, ProductBulkPrices as DefaultProductBulkPrices, ProductBundles as DefaultProductBundles, DefaultProductImage, ProductPriceDisplay as DefaultProductPrice, DefaultProductSurcharges, DeliveryDate, type DeliveryDateProps, FavoriteListDetails, type FavoriteListDetailsProps, type FavoriteListFormData, FavoriteListItemExport as FavoriteListItem, type FavoriteListItemProps, FavoriteLists, type FavoriteListsProps, type FetchActiveCartConfig, type FetchCrossupsellsInput, ForgotPassword, type ForgotPasswordProps, type GetCrossupsellsOptions, GridFilters, GridFiltersPanel, type GridFiltersPanelProps, type GridFiltersProps, GridPagination, type GridPaginationProps, GridTitleWithProvider as GridTitle, type GridTitleProps, GridToolbar, type GridToolbarProps, _default as ItemStock, type ItemStockProps, ItemsOverview, type ItemsOverviewProps, LoginFormExport as LoginForm, type LoginFormProps, Menu, type MenuCategory, type MenuProps, OrderActions, type OrderActionsProps, OrderBonusItems, type OrderBonusItemsProps, OrderItemCard, type OrderItemCardProps, OrderList, type OrderListProps, type OrderSearchForm, OrderShipments, type OrderShipmentsProps, OrderSummary, type OrderSummaryProps, OrderTotals, type OrderTotalsProps, type PlaceOrderOptions, PriceToggle, type PriceToggleProps, ProductBulkPricesWithProvider as ProductBulkPrices, type ProductBulkPricesProps, ProductBundles, type ProductBundlesProps, ProductCard, type ProductCardProps, ProductDescription, type ProductDescriptionProps, ProductDownloads, type ProductDownloadsProps, ProductGallery, type ProductGalleryProps, ProductGridCompound as ProductGrid, type ProductGridConfig, ProductGridConfigProvider, type ProductGridProps, ProductInfoExport as ProductInfo, type ProductInfoProps, ProductPriceWithProvider as ProductPrice, type ProductPriceProps, ProductShortDescriptionWithProvider as ProductShortDescription, type ProductShortDescriptionProps, ProductSlider, type ProductSliderProps, ProductSpecifications, type ProductSpecificationsProps, ProductTabs, type ProductTabsProps, ProductVideos, type ProductVideosProps, type PropellerDeps, PropellerDepsProvider, type PropellerDepsProviderProps, type PropellerInfra, PropellerProvider, type PropellerProviderProps, type PropellerScope, PurchaseAuthorizationConfigurator, type PurchaseAuthorizationConfiguratorProps, PurchaseAuthorizationRequests, type PurchaseAuthorizationRequestsProps, QuoteActions, type QuoteActionsProps, RegisterForm, type RegisterFormProps, type ResolveSpec, type RowEdit, SearchBar, type SearchBarProps, type UseAddressOptions, type UseAddressReturn, type LoginResult as UseAuthLoginResult, type UseAuthOptions, type RegisterContactInput as UseAuthRegisterContactInput, type RegisterCustomerInput as UseAuthRegisterCustomerInput, type UseAuthReturn, type UseCartOptions, type UseCartReturn, type UseCheckoutOptions, type UseCheckoutReturn, type UseClusterConfiguratorOptions, type UseClusterConfiguratorReturn, type UseCompanyOptions, type UseCompanyReturn, type UseFavoritesOptions, type UseFavoritesReturn, type UseMenuOptions, type UseMenuReturn, type UseOrdersOptions, type UseOrdersReturn, type BundleItem as UseProductBundlesBundleItem, type UseProductBundlesOptions, type UseProductBundlesReturn, type UseProductInfoOptions, type UseProductInfoReturn, type UseProductSearchOptions, type UseProductSearchReturn, type UseProductSliderOptions, type UseProductSliderReturn, type UseProductSpecsOptions, type UseProductSpecsReturn, type UsePurchaseAuthorizationConfiguratorOptions, type UsePurchaseAuthorizationConfiguratorReturn, type UsePurchaseAuthorizationRequestsOptions, type UsePurchaseAuthorizationRequestsReturn, UserDetails, type UserDetailsProps, fetchActiveCart, initCart, mergeAnonymousCart, useAddress, useAuth, useCart, useCheckout, useClusterConfigurator, useCompany, useFavorites, useInfraProps, useMenu, useOrders, useProductBundles, useProductGridConfig, useProductInfo, useProductSearch, useProductSlider, useProductSpecs, usePropellerContext, usePropellerDeps, usePropellerScope, usePurchaseAuthorizationConfigurator, usePurchaseAuthorizationRequests, useRequiredPropellerDeps, useResolvedProps, useServices, useUserMode };
|
|
7051
|
+
export { AccountIconAndMenu, type AccountIconAndMenuProps, ActionCode, type ActionCodeProps, type AddContactFormState, type AddItemOptions, _default$1 as AddToCart, type AddToCartProps, AddToFavorite, type AddToFavoriteProps, AddressCardExport as AddressCard, type AddressCardProps, type AddressInput, AddressSelector, type AddressSelectorProps, type AttributeDisplayItem, type AttributeGroup, BreadcrumbsWithProvider as Breadcrumbs, type BreadcrumbsProps, CartBonusItems, type CartBonusItemsProps, CartCarriers, type CartCarriersProps, CartIconAndSidebar, type CartIconAndSidebarProps, type CartInitConfig, CartItemExport as CartItem, type CartItemProps, CartOverview, type CartOverviewProps, CartPaymethods, type CartPaymethodsProps, CartSummary, type CartSummaryProps, CategoryDescription, type CategoryDescriptionProps, CategoryShortDescriptionWithProvider as CategoryShortDescription, type CategoryShortDescriptionProps, ClusterCardExport as ClusterCard, type ClusterCardProps, ClusterConfigurator, type ClusterConfiguratorProps, ClusterInfo, type ClusterInfoProps, ClusterOptions, type ClusterOptionsProps, CompanySwitcher, type CompanySwitcherProps, type ConfiguredSetting, _default$1 as DefaultAddToCart, AddToFavorite as DefaultAddToFavorite, _default as DefaultItemStock, DefaultProductBadges, ProductBulkPrices as DefaultProductBulkPrices, ProductBundles as DefaultProductBundles, DefaultProductImage, ProductPriceDisplay as DefaultProductPrice, DefaultProductSurcharges, DeliveryDate, type DeliveryDateProps, FavoriteListDetails, type FavoriteListDetailsProps, type FavoriteListFormData, FavoriteListItemExport as FavoriteListItem, type FavoriteListItemProps, FavoriteLists, type FavoriteListsProps, type FetchActiveCartConfig, type FetchCrossupsellsInput, ForgotPassword, type ForgotPasswordProps, type GetCrossupsellsOptions, GridFilters, GridFiltersPanel, type GridFiltersPanelProps, type GridFiltersProps, GridPagination, type GridPaginationProps, GridTitleWithProvider as GridTitle, type GridTitleProps, GridToolbar, type GridToolbarProps, _default as ItemStock, type ItemStockProps, ItemsOverview, type ItemsOverviewProps, LoginFormExport as LoginForm, type LoginFormProps, MachineCard, type MachineCardProps, MachineGrid, type MachineGridProps, type MachineListingState, Menu, type MenuCategory, type MenuProps, OrderActions, type OrderActionsProps, OrderBonusItems, type OrderBonusItemsProps, OrderItemCard, type OrderItemCardProps, OrderList, type OrderListProps, type OrderSearchForm, OrderShipments, type OrderShipmentsProps, OrderSummary, type OrderSummaryProps, OrderTotals, type OrderTotalsProps, type PlaceOrderOptions, PriceToggle, type PriceToggleProps, ProductBulkPricesWithProvider as ProductBulkPrices, type ProductBulkPricesProps, ProductBundles, type ProductBundlesProps, ProductCard, type ProductCardProps, ProductDescription, type ProductDescriptionProps, ProductDownloads, type ProductDownloadsProps, ProductGallery, type ProductGalleryProps, ProductGridCompound as ProductGrid, type ProductGridConfig, ProductGridConfigProvider, type ProductGridProps, ProductInfoExport as ProductInfo, type ProductInfoProps, ProductPriceWithProvider as ProductPrice, type ProductPriceProps, ProductShortDescriptionWithProvider as ProductShortDescription, type ProductShortDescriptionProps, ProductSlider, type ProductSliderProps, ProductSpecifications, type ProductSpecificationsProps, ProductTabs, type ProductTabsProps, ProductVideos, type ProductVideosProps, type PropellerDeps, PropellerDepsProvider, type PropellerDepsProviderProps, type PropellerInfra, PropellerProvider, type PropellerProviderProps, type PropellerScope, PurchaseAuthorizationConfigurator, type PurchaseAuthorizationConfiguratorProps, PurchaseAuthorizationRequests, type PurchaseAuthorizationRequestsProps, QuoteActions, type QuoteActionsProps, RegisterForm, type RegisterFormProps, type ResolveSpec, type RowEdit, SearchBar, type SearchBarProps, type UseAddressOptions, type UseAddressReturn, type LoginResult as UseAuthLoginResult, type UseAuthOptions, type RegisterContactInput as UseAuthRegisterContactInput, type RegisterCustomerInput as UseAuthRegisterCustomerInput, type UseAuthReturn, type UseCartOptions, type UseCartReturn, type UseCheckoutOptions, type UseCheckoutReturn, type UseClusterConfiguratorOptions, type UseClusterConfiguratorReturn, type UseCompanyOptions, type UseCompanyReturn, type UseFavoritesOptions, type UseFavoritesReturn, type UseMachinesOptions, type UseMachinesReturn, type UseMenuOptions, type UseMenuReturn, type UseOrdersOptions, type UseOrdersReturn, type BundleItem as UseProductBundlesBundleItem, type UseProductBundlesOptions, type UseProductBundlesReturn, type UseProductInfoOptions, type UseProductInfoReturn, type UseProductSearchOptions, type UseProductSearchReturn, type UseProductSliderOptions, type UseProductSliderReturn, type UseProductSpecsOptions, type UseProductSpecsReturn, type UsePurchaseAuthorizationConfiguratorOptions, type UsePurchaseAuthorizationConfiguratorReturn, type UsePurchaseAuthorizationRequestsOptions, type UsePurchaseAuthorizationRequestsReturn, type UseSparePartsOptions, type UseSparePartsReturn, UserDetails, type UserDetailsProps, buildRootMachinesQuery, fetchActiveCart, initCart, mergeAnonymousCart, useAddress, useAuth, useCart, useCheckout, useClusterConfigurator, useCompany, useFavorites, useInfraProps, useMachines, useMenu, useOrders, useProductBundles, useProductGridConfig, useProductInfo, useProductSearch, useProductSlider, useProductSpecs, usePropellerContext, usePropellerDeps, usePropellerScope, usePurchaseAuthorizationConfigurator, usePurchaseAuthorizationRequests, useRequiredPropellerDeps, useResolvedProps, useServices, useSpareParts, useUserMode };
|