hasting-swatchcart-module 1.0.35 → 1.0.36
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/dist/assets/index.css +24 -4
- package/dist/cdn/lib/store/store.d.ts +2 -2
- package/dist/cdn/main.css +24 -4
- package/dist/cdn/main.js +7042 -7021
- package/dist/cdn/src/app/store/storageMiddleware.d.ts +7 -0
- package/dist/cdn/src/app/store/store.d.ts +2 -2
- package/dist/cdn/src/features/DataAdapter/lib/DataAdapterServices.d.ts +7 -2
- package/dist/cdn/src/features/MultiProduct/model/API/api.d.ts +4 -1
- package/dist/cdn/src/features/MultiProduct/model/API/routes.d.ts +3 -0
- package/dist/cdn/src/features/MultiProduct/model/multiProductCartSlice.d.ts +1 -1
- package/dist/cdn/src/features/MultiProduct/model/types.d.ts +8 -0
- package/dist/cdn/src/features/swatches/model/swatchesSlice.d.ts +2 -1
- package/dist/cdn/src/features/swatches/model/thunks.d.ts +11 -1
- package/dist/cdn/src/shared/ui/MaterialListItem/MaterialListItem.d.ts +2 -1
- package/dist/cdn/src/shared/utils/storageService.d.ts +38 -0
- package/dist/main.cjs +51 -51
- package/dist/main.cjs.map +1 -1
- package/dist/main.js +4725 -4553
- package/dist/main.js.map +1 -1
- package/dist/store/store.d.ts +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Middleware } from '@reduxjs/toolkit';
|
|
2
|
+
import { RootState } from './rootReducer';
|
|
3
|
+
/**
|
|
4
|
+
* Redux middleware that persists swatch selections to localStorage
|
|
5
|
+
* whenever relevant state changes occur.
|
|
6
|
+
*/
|
|
7
|
+
export declare const storageMiddleware: Middleware<object, RootState>;
|
|
@@ -7,7 +7,7 @@ export declare const store: import('@reduxjs/toolkit').EnhancedStore<{
|
|
|
7
7
|
swatches: import('../../features/swatches/model/types').ISwatchesSlice;
|
|
8
8
|
cart: import('../../features/Cart/model/types').CartState;
|
|
9
9
|
multiProductCart: import('../../features/MultiProduct/model/types').IMultiProductState;
|
|
10
|
-
}, undefined, import('redux').UnknownAction
|
|
10
|
+
}, undefined, import('redux').UnknownAction> & object;
|
|
11
11
|
}>, import('redux').StoreEnhancer]>>;
|
|
12
12
|
export type RootState = ReturnType<typeof store.getState>;
|
|
13
13
|
export type AppDispatch = typeof store.dispatch;
|
|
@@ -15,7 +15,7 @@ export declare const useAppDispatch: import('react-redux').UseDispatch<import('r
|
|
|
15
15
|
swatches: import('../../features/swatches/model/types').ISwatchesSlice;
|
|
16
16
|
cart: import('../../features/Cart/model/types').CartState;
|
|
17
17
|
multiProductCart: import('../../features/MultiProduct/model/types').IMultiProductState;
|
|
18
|
-
}, undefined, import('redux').UnknownAction> & import('redux').Dispatch<import('redux').UnknownAction>>;
|
|
18
|
+
}, undefined, import('redux').UnknownAction> & object & 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;
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { IFetchProductData } from '../../../shared/types/fetchData';
|
|
2
|
+
import { IProductListItem } from '../../MultiProduct/model/types';
|
|
2
3
|
import { IAttributeAsset, ISection } from '../../swatches/model/types';
|
|
3
4
|
import { EDataInputType, IMapUIData } from '../utils/types';
|
|
4
5
|
export declare class DataAdapterServices {
|
|
5
|
-
static getTransformedData({ dataType, data, }: {
|
|
6
|
+
static getTransformedData({ dataType, data, selectedProduct, }: {
|
|
6
7
|
dataType: EDataInputType;
|
|
7
8
|
data: IFetchProductData | any;
|
|
9
|
+
selectedProduct?: IProductListItem;
|
|
8
10
|
}): any;
|
|
9
11
|
static getGroupingValue(attributes: any[]): any;
|
|
10
12
|
static getAllMaterialValuesKeys(attributes: ISection[]): string[] | undefined;
|
|
11
13
|
static getAllMaterialOptions(attributes: IAttributeAsset[]): IMapUIData | undefined;
|
|
12
14
|
static getMapUIData(data: IAttributeAsset[]): IMapUIData | undefined;
|
|
13
|
-
static getTransformedFetchProductData(data
|
|
15
|
+
static getTransformedFetchProductData({ data, selectedProduct, }: {
|
|
16
|
+
data: IFetchProductData;
|
|
17
|
+
selectedProduct?: IProductListItem;
|
|
18
|
+
}): any;
|
|
14
19
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { IFetchProductData } from '../../../../shared/types/fetchData';
|
|
2
|
-
import { IGetProductParameters, IProductListResponse } from '../types';
|
|
2
|
+
import { IGetProductParameters, IProductInformationResponse, IProductListResponse } from '../types';
|
|
3
3
|
export declare const getProductListAPI: () => Promise<IProductListResponse>;
|
|
4
4
|
export declare const getSelectedProductAPI: ({ assetId, }: IGetProductParameters) => Promise<IFetchProductData>;
|
|
5
|
+
export declare const getSelectedProductListInformationAPI: ({ assetId, }: {
|
|
6
|
+
assetId: string;
|
|
7
|
+
}) => Promise<IProductInformationResponse>;
|
|
@@ -4,6 +4,6 @@ type Key = {
|
|
|
4
4
|
label: string;
|
|
5
5
|
parentName: string;
|
|
6
6
|
};
|
|
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<
|
|
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<any, "multiProduct/setActiveMultiCartProduct">;
|
|
8
8
|
export declare const multiProductCartReducer: import('redux').Reducer<IMultiProductState>;
|
|
9
9
|
export {};
|
|
@@ -9,6 +9,7 @@ export interface IMultiProductState {
|
|
|
9
9
|
}
|
|
10
10
|
export interface ICartItem extends AttributeValue {
|
|
11
11
|
count: number;
|
|
12
|
+
productInformation?: IProductListItem | null;
|
|
12
13
|
}
|
|
13
14
|
export interface IProductCart {
|
|
14
15
|
items: ICartItem[];
|
|
@@ -16,6 +17,7 @@ export interface IProductCart {
|
|
|
16
17
|
name: string;
|
|
17
18
|
assetId?: string;
|
|
18
19
|
productId?: number;
|
|
20
|
+
productInformation?: IProductListItem | null;
|
|
19
21
|
}
|
|
20
22
|
export interface ISliderItem {
|
|
21
23
|
items: ICartItem[];
|
|
@@ -35,6 +37,7 @@ export interface IMultiCartProductItem {
|
|
|
35
37
|
assetId: string;
|
|
36
38
|
items: ICartItem[];
|
|
37
39
|
name: string;
|
|
40
|
+
productInformation?: IProductListItem | null;
|
|
38
41
|
}
|
|
39
42
|
export interface IMultiProductCartHandleProps {
|
|
40
43
|
item: ICartItem;
|
|
@@ -54,10 +57,15 @@ export interface IProductListItem {
|
|
|
54
57
|
createdAt: string;
|
|
55
58
|
updatedAt: string;
|
|
56
59
|
}
|
|
60
|
+
export interface IProductInformationResponse {
|
|
61
|
+
rows: IProductListItem[];
|
|
62
|
+
count: number;
|
|
63
|
+
}
|
|
57
64
|
/**
|
|
58
65
|
* This interface extends the base AttributeValue and add a new property productName
|
|
59
66
|
*
|
|
60
67
|
*/
|
|
61
68
|
export interface ISwatchSelectedMaterial extends AttributeValue {
|
|
69
|
+
productInformation?: IProductListItem | null;
|
|
62
70
|
productName?: string;
|
|
63
71
|
}
|
|
@@ -32,6 +32,7 @@ export declare const swatchesSlice: import('@reduxjs/toolkit').Slice<ISwatchesSl
|
|
|
32
32
|
selectedMaterial: AttributeValue;
|
|
33
33
|
next: number;
|
|
34
34
|
}>): void;
|
|
35
|
+
setCartMaterials(state: import('immer').WritableDraft<ISwatchesSlice>, action: PayloadAction<AttributeValue[]>): void;
|
|
35
36
|
}, "swatches", "swatches", import('@reduxjs/toolkit').SliceSelectors<ISwatchesSlice>>;
|
|
36
37
|
export declare const swatchesReducer: import('redux').Reducer<ISwatchesSlice>;
|
|
37
38
|
export declare const setMaterialSelect: import('@reduxjs/toolkit').ActionCreatorWithPayload<ISetFiltersPayload, "swatches/setMaterialSelect">, setAllMaterialsOptions: import('@reduxjs/toolkit').ActionCreatorWithPayload<IMapUIData, "swatches/setAllMaterialsOptions">, setPanelFilter: import('@reduxjs/toolkit').ActionCreatorWithPayload<{
|
|
@@ -49,4 +50,4 @@ export declare const setMaterialSelect: import('@reduxjs/toolkit').ActionCreator
|
|
|
49
50
|
}, "swatches/decrement">, setCount: import('@reduxjs/toolkit').ActionCreatorWithPayload<{
|
|
50
51
|
selectedMaterial: AttributeValue;
|
|
51
52
|
next: number;
|
|
52
|
-
}, "swatches/setCount">;
|
|
53
|
+
}, "swatches/setCount">, setCartMaterials: import('@reduxjs/toolkit').ActionCreatorWithPayload<AttributeValue[], "swatches/setCartMaterials">;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IGetProductParameters } from '../../MultiProduct/model/types';
|
|
1
|
+
import { IGetProductParameters, IProductInformationResponse } from '../../MultiProduct/model/types';
|
|
2
2
|
import { IFetchProductData } from '../../../shared/types/fetchData';
|
|
3
3
|
export declare const getSelectedProductThunk: import('@reduxjs/toolkit').AsyncThunk<IFetchProductData | null, IGetProductParameters, {
|
|
4
4
|
rejectValue: string;
|
|
@@ -10,3 +10,13 @@ export declare const getSelectedProductThunk: import('@reduxjs/toolkit').AsyncTh
|
|
|
10
10
|
fulfilledMeta?: unknown;
|
|
11
11
|
rejectedMeta?: unknown;
|
|
12
12
|
}>;
|
|
13
|
+
export declare const getSelectedProductInformationThunk: import('@reduxjs/toolkit').AsyncThunk<IProductInformationResponse, IGetProductParameters, {
|
|
14
|
+
rejectValue: string;
|
|
15
|
+
state?: unknown;
|
|
16
|
+
dispatch?: import('redux-thunk').ThunkDispatch<unknown, unknown, import('redux').UnknownAction> | undefined;
|
|
17
|
+
extra?: unknown;
|
|
18
|
+
serializedErrorType?: unknown;
|
|
19
|
+
pendingMeta?: unknown;
|
|
20
|
+
fulfilledMeta?: unknown;
|
|
21
|
+
rejectedMeta?: unknown;
|
|
22
|
+
}>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { AttributeValue } from '../../../features/swatches/model/types';
|
|
2
2
|
interface IMaterialListItemProps {
|
|
3
3
|
val: AttributeValue;
|
|
4
|
+
isSelected: boolean;
|
|
4
5
|
onClick: (item: AttributeValue) => void;
|
|
5
6
|
}
|
|
6
|
-
export declare const MaterialListItem: ({ val, onClick }: IMaterialListItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const MaterialListItem: ({ val, isSelected, onClick, }: IMaterialListItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { AttributeValue } from '../../features/swatches/model/types';
|
|
2
|
+
import { IProductCart } from '../../features/MultiProduct/model/types';
|
|
3
|
+
/**
|
|
4
|
+
* Service for persisting and retrieving swatch selections from localStorage.
|
|
5
|
+
* Data expires after 24 hours to prevent stale selections.
|
|
6
|
+
*/
|
|
7
|
+
export declare const StorageService: {
|
|
8
|
+
/**
|
|
9
|
+
* Stores selected materials (single product mode) to localStorage.
|
|
10
|
+
*/
|
|
11
|
+
setSelectedMaterials(materials: AttributeValue[]): void;
|
|
12
|
+
/**
|
|
13
|
+
* Retrieves selected materials from localStorage.
|
|
14
|
+
* Returns empty array if data is expired or invalid.
|
|
15
|
+
*/
|
|
16
|
+
getSelectedMaterials(): AttributeValue[];
|
|
17
|
+
/**
|
|
18
|
+
* Clears selected materials from localStorage.
|
|
19
|
+
*/
|
|
20
|
+
clearSelectedMaterials(): void;
|
|
21
|
+
/**
|
|
22
|
+
* Stores multi-product cart items to localStorage.
|
|
23
|
+
*/
|
|
24
|
+
setMultiProductItems(items: IProductCart[]): void;
|
|
25
|
+
/**
|
|
26
|
+
* Retrieves multi-product cart items from localStorage.
|
|
27
|
+
* Returns empty array if data is expired or invalid.
|
|
28
|
+
*/
|
|
29
|
+
getMultiProductItems(): IProductCart[];
|
|
30
|
+
/**
|
|
31
|
+
* Clears multi-product cart items from localStorage.
|
|
32
|
+
*/
|
|
33
|
+
clearMultiProductItems(): void;
|
|
34
|
+
/**
|
|
35
|
+
* Clears all stored swatch selections.
|
|
36
|
+
*/
|
|
37
|
+
clearAll(): void;
|
|
38
|
+
};
|