hasting-swatchcart-module 1.0.31 → 1.0.33

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.
@@ -1,2 +1,12 @@
1
+ /**
2
+ * Demo application wrapper for {@link SwatchModule}.
3
+ *
4
+ * Provides local UI controls to:
5
+ * - toggle module open/close state
6
+ * - switch between different data input modes
7
+ * - handle output payload from the module
8
+ *
9
+ * @component
10
+ */
1
11
  declare function App(): import("react/jsx-runtime").JSX.Element;
2
12
  export default App;
@@ -1,11 +1,11 @@
1
1
  declare const rootReducer: import('redux').Reducer<{
2
2
  swatches: import('../../features/swatches/model/types').ISwatchesSlice;
3
3
  cart: import('../../features/Cart/model/types').CartState;
4
- multiProductCart: import('../../features/MultiProduct/model/types').MultiProductState;
4
+ multiProductCart: import('../../features/MultiProduct/model/types').IMultiProductState;
5
5
  }, import('redux').UnknownAction, Partial<{
6
6
  swatches: import('../../features/swatches/model/types').ISwatchesSlice | undefined;
7
7
  cart: import('../../features/Cart/model/types').CartState | undefined;
8
- multiProductCart: import('../../features/MultiProduct/model/types').MultiProductState | undefined;
8
+ multiProductCart: import('../../features/MultiProduct/model/types').IMultiProductState | undefined;
9
9
  }>>;
10
10
  export type RootState = ReturnType<typeof rootReducer>;
11
11
  export default rootReducer;
@@ -1,12 +1,12 @@
1
1
  export declare const store: import('@reduxjs/toolkit').EnhancedStore<{
2
2
  swatches: import('../../features/swatches/model/types').ISwatchesSlice;
3
3
  cart: import('../../features/Cart/model/types').CartState;
4
- multiProductCart: import('../../features/MultiProduct/model/types').MultiProductState;
4
+ multiProductCart: import('../../features/MultiProduct/model/types').IMultiProductState;
5
5
  }, import('redux').UnknownAction, import('@reduxjs/toolkit').Tuple<[import('redux').StoreEnhancer<{
6
6
  dispatch: import('redux-thunk').ThunkDispatch<{
7
7
  swatches: import('../../features/swatches/model/types').ISwatchesSlice;
8
8
  cart: import('../../features/Cart/model/types').CartState;
9
- multiProductCart: import('../../features/MultiProduct/model/types').MultiProductState;
9
+ multiProductCart: import('../../features/MultiProduct/model/types').IMultiProductState;
10
10
  }, undefined, import('redux').UnknownAction>;
11
11
  }>, import('redux').StoreEnhancer]>>;
12
12
  export type RootState = ReturnType<typeof store.getState>;
@@ -14,11 +14,11 @@ export type AppDispatch = typeof store.dispatch;
14
14
  export declare const useAppDispatch: import('react-redux').UseDispatch<import('redux-thunk').ThunkDispatch<{
15
15
  swatches: import('../../features/swatches/model/types').ISwatchesSlice;
16
16
  cart: import('../../features/Cart/model/types').CartState;
17
- multiProductCart: import('../../features/MultiProduct/model/types').MultiProductState;
17
+ multiProductCart: import('../../features/MultiProduct/model/types').IMultiProductState;
18
18
  }, undefined, import('redux').UnknownAction> & import('redux').Dispatch<import('redux').UnknownAction>>;
19
19
  export declare const useAppSelector: import('react-redux').UseSelector<{
20
20
  swatches: import('../../features/swatches/model/types').ISwatchesSlice;
21
21
  cart: import('../../features/Cart/model/types').CartState;
22
- multiProductCart: import('../../features/MultiProduct/model/types').MultiProductState;
22
+ multiProductCart: import('../../features/MultiProduct/model/types').IMultiProductState;
23
23
  }>;
24
24
  export default store;
@@ -3,7 +3,7 @@ export declare const getCartItems: (state: RootState) => import('./types').ICart
3
3
  export declare const getCartTotalCount: ((state: {
4
4
  swatches: import('../../swatches/model/types').ISwatchesSlice;
5
5
  cart: import('./types').CartState;
6
- multiProductCart: import('../../MultiProduct/model/types').MultiProductState;
6
+ multiProductCart: import('../../MultiProduct/model/types').IMultiProductState;
7
7
  }) => number) & {
8
8
  clearCache: () => void;
9
9
  resultsCount: () => number;
@@ -28,7 +28,7 @@ export declare const getCartTotalCount: ((state: {
28
28
  export declare const getCartFreeSlots: ((state: {
29
29
  swatches: import('../../swatches/model/types').ISwatchesSlice;
30
30
  cart: import('./types').CartState;
31
- multiProductCart: import('../../MultiProduct/model/types').MultiProductState;
31
+ multiProductCart: import('../../MultiProduct/model/types').IMultiProductState;
32
32
  }) => number) & {
33
33
  clearCache: () => void;
34
34
  resultsCount: () => number;
@@ -44,7 +44,7 @@ export declare const getCartFreeSlots: ((state: {
44
44
  dependencies: [((state: {
45
45
  swatches: import('../../swatches/model/types').ISwatchesSlice;
46
46
  cart: import('./types').CartState;
47
- multiProductCart: import('../../MultiProduct/model/types').MultiProductState;
47
+ multiProductCart: import('../../MultiProduct/model/types').IMultiProductState;
48
48
  }) => number) & {
49
49
  clearCache: () => void;
50
50
  resultsCount: () => number;
@@ -77,7 +77,7 @@ export declare const getCartFreeSlots: ((state: {
77
77
  export declare const getCartCanIncrement: ((state: {
78
78
  swatches: import('../../swatches/model/types').ISwatchesSlice;
79
79
  cart: import('./types').CartState;
80
- multiProductCart: import('../../MultiProduct/model/types').MultiProductState;
80
+ multiProductCart: import('../../MultiProduct/model/types').IMultiProductState;
81
81
  }) => boolean) & {
82
82
  clearCache: () => void;
83
83
  resultsCount: () => number;
@@ -93,7 +93,7 @@ export declare const getCartCanIncrement: ((state: {
93
93
  dependencies: [((state: {
94
94
  swatches: import('../../swatches/model/types').ISwatchesSlice;
95
95
  cart: import('./types').CartState;
96
- multiProductCart: import('../../MultiProduct/model/types').MultiProductState;
96
+ multiProductCart: import('../../MultiProduct/model/types').IMultiProductState;
97
97
  }) => number) & {
98
98
  clearCache: () => void;
99
99
  resultsCount: () => number;
@@ -109,7 +109,7 @@ export declare const getCartCanIncrement: ((state: {
109
109
  dependencies: [((state: {
110
110
  swatches: import('../../swatches/model/types').ISwatchesSlice;
111
111
  cart: import('./types').CartState;
112
- multiProductCart: import('../../MultiProduct/model/types').MultiProductState;
112
+ multiProductCart: import('../../MultiProduct/model/types').IMultiProductState;
113
113
  }) => number) & {
114
114
  clearCache: () => void;
115
115
  resultsCount: () => number;
@@ -150,7 +150,7 @@ export declare const getCartCanIncrement: ((state: {
150
150
  export declare const getCartItemById: (assetId: string) => ((state: {
151
151
  swatches: import('../../swatches/model/types').ISwatchesSlice;
152
152
  cart: import('./types').CartState;
153
- multiProductCart: import('../../MultiProduct/model/types').MultiProductState;
153
+ multiProductCart: import('../../MultiProduct/model/types').IMultiProductState;
154
154
  }) => import('./types').ICartItem | undefined) & {
155
155
  clearCache: () => void;
156
156
  resultsCount: () => number;
@@ -175,7 +175,7 @@ export declare const getCartItemById: (assetId: string) => ((state: {
175
175
  export declare const getCartItemCountById: (id: string) => ((state: {
176
176
  swatches: import('../../swatches/model/types').ISwatchesSlice;
177
177
  cart: import('./types').CartState;
178
- multiProductCart: import('../../MultiProduct/model/types').MultiProductState;
178
+ multiProductCart: import('../../MultiProduct/model/types').IMultiProductState;
179
179
  }) => number) & {
180
180
  clearCache: () => void;
181
181
  resultsCount: () => number;
@@ -191,7 +191,7 @@ export declare const getCartItemCountById: (id: string) => ((state: {
191
191
  dependencies: [((state: {
192
192
  swatches: import('../../swatches/model/types').ISwatchesSlice;
193
193
  cart: import('./types').CartState;
194
- multiProductCart: import('../../MultiProduct/model/types').MultiProductState;
194
+ multiProductCart: import('../../MultiProduct/model/types').IMultiProductState;
195
195
  }) => import('./types').ICartItem | undefined) & {
196
196
  clearCache: () => void;
197
197
  resultsCount: () => number;
@@ -1,7 +1,31 @@
1
1
  import { EActiveTab } from '../../../../shared/types/activeTab';
2
+ /**
3
+ * Props for {@link CartHeader}.
4
+ */
2
5
  interface ICartHeaderProps {
6
+ /**
7
+ * Optional callback for switching the active tab (e.g. back to swatches).
8
+ *
9
+ * @param arg - Active tab value
10
+ */
3
11
  onSetActiveTab?: (arg: EActiveTab) => void;
12
+ /**
13
+ * Callback for closing or toggling the sidebar.
14
+ */
4
15
  onToggleSidebar: () => void;
5
16
  }
17
+ /**
18
+ * Renders the cart header with navigation, count limit messaging, and close action.
19
+ *
20
+ * Displays:
21
+ * - back navigation button (optional tab switch)
22
+ * - cart title
23
+ * - max swatches warning when {@link MAX_SLOTS} is reached
24
+ * - close button to toggle the sidebar
25
+ *
26
+ * @component
27
+ *
28
+ * @param props - {@link ICartHeaderProps}
29
+ */
6
30
  export declare const CartHeader: ({ onSetActiveTab, onToggleSidebar, }: ICartHeaderProps) => import("react/jsx-runtime").JSX.Element;
7
31
  export {};
@@ -1,9 +1,9 @@
1
- import { MultiProductState, IMultiCartProductItem, IProductCart } from './types';
1
+ import { IMultiProductState, IMultiCartProductItem, IProductCart } from './types';
2
2
  type Key = {
3
3
  assetId: string;
4
4
  label: string;
5
5
  parentName: string;
6
6
  };
7
7
  export declare const setCartForProduct: import('@reduxjs/toolkit').ActionCreatorWithPayload<IProductCart, "multiProduct/setCartForProduct">, setMultiCartItems: import('@reduxjs/toolkit').ActionCreatorWithPayload<IMultiCartProductItem, "multiProduct/setMultiCartItems">, incrementMultiProductItem: import('@reduxjs/toolkit').ActionCreatorWithPayload<Key, "multiProduct/incrementMultiProductItem">, decrementMultiProductItem: import('@reduxjs/toolkit').ActionCreatorWithPayload<Key, "multiProduct/decrementMultiProductItem">, removeMultiProductItem: import('@reduxjs/toolkit').ActionCreatorWithPayload<Key, "multiProduct/removeMultiProductItem">, clear: import('@reduxjs/toolkit').ActionCreatorWithoutPayload<"multiProduct/clear">, setActiveMultiCartProduct: import('@reduxjs/toolkit').ActionCreatorWithPayload<IProductCart, "multiProduct/setActiveMultiCartProduct">;
8
- export declare const multiProductCartReducer: import('redux').Reducer<MultiProductState>;
8
+ export declare const multiProductCartReducer: import('redux').Reducer<IMultiProductState>;
9
9
  export {};
@@ -4,7 +4,7 @@ export declare const getMultiCartItems: (state: RootState) => IProductCart[];
4
4
  export declare const getMultiSelectedMaterials: (assetId: string) => ((state: {
5
5
  swatches: import('../../swatches/model/types').ISwatchesSlice;
6
6
  cart: import('../../Cart/model/types').CartState;
7
- multiProductCart: import('./types').MultiProductState;
7
+ multiProductCart: import('./types').IMultiProductState;
8
8
  }) => ICartItem[]) & {
9
9
  clearCache: () => void;
10
10
  resultsCount: () => number;
@@ -1,5 +1,5 @@
1
1
  import { AttributeValue } from '../../swatches/model/types';
2
- export interface MultiProductState {
2
+ export interface IMultiProductState {
3
3
  items: IProductCart[];
4
4
  activeMultiCartProduct: IProductCart | null;
5
5
  productList: IProductListItem[];
@@ -1,5 +1,25 @@
1
+ /**
2
+ * Props for {@link MultiProductItemCart}.
3
+ */
1
4
  interface IMultiProductItemCartProps {
5
+ /**
6
+ * Optional callback fired when user proceeds to shipping.
7
+ * Receives the current selected products payload.
8
+ */
2
9
  onSendData?: (data: unknown) => void;
3
10
  }
11
+ /**
12
+ * Renders a multi-product cart with grouped items, quantity controls, and totals.
13
+ *
14
+ * Features:
15
+ * - grouped rendering by product
16
+ * - increment/decrement/delete actions for cart items
17
+ * - synchronizes deletion with the swatches selected materials state
18
+ * - shows totals and a "Go to shipping" action
19
+ *
20
+ * @component
21
+ *
22
+ * @param props - {@link IMultiProductItemCartProps}
23
+ */
4
24
  export declare const MultiProductItemCart: ({ onSendData, }: IMultiProductItemCartProps) => import("react/jsx-runtime").JSX.Element;
5
25
  export {};
@@ -1 +1,14 @@
1
+ /**
2
+ * Renders the product list with category filtering, search, and sorting.
3
+ *
4
+ * Features:
5
+ * - fetches the product list on mount
6
+ * - builds unique categories for the slider
7
+ * - supports debounced text search
8
+ * - supports A–Z and Z–A sorting
9
+ * - hides the header image while the user scrolls down
10
+ * - shows swatch cart content when products are selected
11
+ *
12
+ * @component
13
+ */
1
14
  export declare const ProductList: () => import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,28 @@
1
+ /**
2
+ * Props for {@link ProductElement}.
3
+ */
1
4
  interface IProductElementProps {
5
+ /**
6
+ * ClassName string applied to the outer container.
7
+ */
2
8
  containerStyles: string;
9
+ /**
10
+ * ClassName string applied to the {@link MultiSelect} component.
11
+ */
3
12
  selectStyles: string;
4
13
  }
14
+ /**
15
+ * Renders a product element filter based on a multi-select control.
16
+ *
17
+ * Builds selectable options from `allProductElementOptions` and
18
+ * applies filtering logic that:
19
+ * - updates selected product element values
20
+ * - remaps and prunes related filters based on available counts
21
+ * - updates the panel attributes list according to selection
22
+ *
23
+ * @component
24
+ *
25
+ * @param props - {@link IProductElementProps}
26
+ */
5
27
  export declare const ProductElement: ({ containerStyles, selectStyles, }: IProductElementProps) => import("react/jsx-runtime").JSX.Element;
6
28
  export {};
@@ -1,7 +1,28 @@
1
1
  import { AttributeValue } from '../../model/types';
2
+ /**
3
+ * Props for {@link SwatchesList}.
4
+ */
2
5
  interface ISwatchesListProps {
6
+ /**
7
+ * Optional className string applied to the outer container.
8
+ */
3
9
  containerStyles?: string;
10
+ /**
11
+ * Currently selected swatch materials.
12
+ */
4
13
  selectedMaterials: AttributeValue[];
5
14
  }
15
+ /**
16
+ * Renders the swatches list with selected materials and remaining empty slots.
17
+ *
18
+ * Displays:
19
+ * - header with selected count
20
+ * - selected swatches as list items
21
+ * - placeholder tiles for unused slots up to {@link MAX_SLOTS}
22
+ *
23
+ * @component
24
+ *
25
+ * @param props - {@link ISwatchesListProps}
26
+ */
6
27
  export declare const SwatchesList: ({ selectedMaterials, containerStyles, }: ISwatchesListProps) => import("react/jsx-runtime").JSX.Element;
7
28
  export {};
@@ -0,0 +1,18 @@
1
+ type WithCount = {
2
+ /**
3
+ * Numeric count value.
4
+ * Can be `null` when the item is not counted.
5
+ */
6
+ count: number | null;
7
+ };
8
+ /**
9
+ * Calculates the total count of items.
10
+ *
11
+ * Sums the `count` property of all provided items and
12
+ * memoizes the result to prevent unnecessary recalculations.
13
+ *
14
+ * @param items - Array of items containing a `count` field
15
+ * @returns Total count of all items
16
+ */
17
+ export declare function useCartCount<T extends WithCount>(items: T[]): number;
18
+ export {};