@soma-vertical-web/multi-lib 1.0.19 → 1.0.20

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.
Files changed (36) hide show
  1. package/contexts/contexts/plp/FilterContext.d.ts +1 -1
  2. package/contexts/contexts/plp/PLPContext.d.ts +1 -1
  3. package/contexts/contexts/search/Facets.d.ts +1 -1
  4. package/contexts/contexts/search/Search.d.ts +1 -1
  5. package/contexts/hooks/useSimilars.d.ts +7 -0
  6. package/contexts/index.d.ts +4 -4
  7. package/data/helpers/plp/index.d.ts +2 -2
  8. package/data/helpers/search/facets.d.ts +0 -1
  9. package/data/helpers/search/index.d.ts +0 -4
  10. package/data/helpers/search/search.d.ts +0 -1
  11. package/data/index.d.ts +0 -2
  12. package/index-CpUjW-m9.mjs +1877 -0
  13. package/index-xWhZ_YcF.js +4 -0
  14. package/index.js +17 -17
  15. package/index.mjs +8437 -10416
  16. package/index2.js +1 -1
  17. package/index2.mjs +613 -685
  18. package/layout/index.d.ts +3 -3
  19. package/layout/template/PDC/Composite/Pagination/Pagination.d.ts +1 -1
  20. package/layout/template/PDC/Composite/Products/Products.d.ts +1 -1
  21. package/layout/template/PDC/PDC.d.ts +1 -1
  22. package/layout/template/PDC/index.d.ts +2 -2
  23. package/layout/template/PDP/Composite/Info/MainContent/Similars/index.d.ts +1 -1
  24. package/layout/template/PDP/index.d.ts +2 -2
  25. package/package.json +1 -1
  26. package/server.d.ts +1 -7
  27. package/style.css +1 -1
  28. package/types/cms/Sections/SectionZone/index.d.ts +1 -0
  29. package/types/contexts/contexts/plp.d.ts +9 -42
  30. package/types/contexts/contexts/search.d.ts +15 -34
  31. package/types/contexts/hooks/index.d.ts +12 -0
  32. package/types/layout/team-components/PLPNavigation/index.d.ts +2 -0
  33. package/types/layout/team-components/ProductCard/index.d.ts +1 -0
  34. package/types/layout/team-components/ProductList/index.d.ts +2 -1
  35. package/types/layout/templates/PDP/index.d.ts +1 -2
  36. package/types/layout/templates/PLP/index.d.ts +3 -2
@@ -28,6 +28,7 @@ export type ProductCarouselConstants = {
28
28
  TEXTURE_IMAGE: TEXTURE_IMAGEType;
29
29
  Z_INDEX_WAR: Z_INDEX_WARType;
30
30
  StoreConfig_MainSellerId: StoreConfigType['mainSeller']['id'];
31
+ storeId: StoreConfigType['api']['storeId'];
31
32
  };
32
33
  searchModal?: boolean;
33
34
  };
@@ -30,14 +30,14 @@ export type DataLayerEvent = (data: ProductSearchResultPage) => void;
30
30
  export interface PageState {
31
31
  addPage: (state: State, positions: PositionsGrid, callback?: DataLayerEvent, itemsPerPage?: number) => void;
32
32
  banners: number[];
33
- createPagesScroll: (state: State, positions: PositionsGrid, callback?: DataLayerEvent, itemsPerPage?: number) => void;
33
+ createPages: (state: State, positions: PositionsGrid, callback?: DataLayerEvent, itemsPerPage?: number) => void;
34
34
  load: boolean;
35
35
  pages: Page[];
36
36
  products: number[];
37
37
  total: number;
38
38
  updateProducts: (state: State, callback?: DataLayerEvent) => void;
39
39
  }
40
- export interface PLPInfiniteContextProps extends PropsWithChildren {
40
+ export interface PLPInfiniteContextProps extends PropsWithChildren<Omit<PageState, 'init'>> {
41
41
  addNewPage(page: Page): void;
42
42
  columns: number;
43
43
  gap: number;
@@ -48,52 +48,17 @@ export interface PLPInfiniteContextProps extends PropsWithChildren {
48
48
  export interface PLPInfiniteProviderProps extends PropsWithChildren {
49
49
  banners: PLPBanners;
50
50
  }
51
- export interface PLPContextProps extends Pick<PLPProviderProps, 'constants' | 'mainSeller'> {
51
+ export interface PLPContextProps {
52
52
  openFilters: boolean;
53
53
  setOpenFilters: Dispatch<SetStateAction<boolean>>;
54
54
  }
55
55
  export interface PLPProviderProps extends PropsWithChildren {
56
- brand?: string | null;
57
- constants: {
58
- BUY_BUTTON_LABELS: BUY_BUTTON_LABELSType;
59
- ICONS: ICONSType;
60
- ITEMS_DEFAULT_SORT: ITEMS_DEFAULT_SORTType;
61
- ITEMS_PER_PAGE: ITEMS_PER_PAGEType;
62
- ITEMS_PER_SECTION: ITEMS_PER_SECTIONType;
63
- MAIN_IMAGE: MAIN_IMAGEType;
64
- NEWSLETTER_CONFIGS: NEWSLETTER_CONFIGSType;
65
- NOTIFY_INFO: NOTIFY_INFOType;
66
- PDC_NAVIGATION: PDC_NAVIGATIONType;
67
- PLP_FILTERS: PLP_FILTERSType;
68
- PLP_FILTERS_COLORS: PLP_FILTERS_COLORSType;
69
- PLP_FILTERS_EMPTY: PLP_FILTERS_EMPTYType;
70
- PLP_FILTERS_TITLE: PLP_FILTERS_TITLEType;
71
- PLP_GRID_SCROLL_BACK: PLP_GRID_SCROLL_BACKType;
72
- PLP_INFINITE_SCROLL: PLP_INFINITE_SCROLLType;
73
- PLP_NOT_RESULT: PLP_NOT_RESULTType;
74
- PLP_PRODUCT_SIMILAR_DELAY: PLP_PRODUCT_SIMILAR_DELAYType;
75
- PLP_SHOW_VIDEO_ON_PRODUCT_CARD: PLP_SHOW_VIDEO_ON_PRODUCT_CARDType;
76
- PLP_SIZE_ORDER: PLP_SIZE_ORDERType;
77
- PLP_SORT_DEFAULT: PLP_SORT_DEFAULTType;
78
- PRODUCT_CARD_IMAGE_ASPECT_RATIO: PRODUCT_CARD_IMAGE_ASPECT_RATIOType;
79
- PRODUCT_CARD_TEXTS: PRODUCT_CARD_TEXTSType;
80
- PRODUCT_CARD_TOP_WISHLIST_TOGGLE: PRODUCT_CARD_TOP_WISHLIST_TOGGLEType;
81
- PRODUCT_IMAGE_DIMENSIONS: PRODUCT_IMAGE_DIMENSIONSType;
82
- SEARCH_PAGE_ITEM_THRESHOLD: SEARCH_PAGE_ITEM_THRESHOLDType;
83
- SEARCH_TOTAL_PORTAL_ID: SEARCH_TOTAL_PORTAL_IDType;
84
- SECOND_IMAGE: SECOND_IMAGEType;
85
- TEXTURE_IMAGE: TEXTURE_IMAGEType;
86
- TEXTCONTENT_EXPANDED?: TEXTCONTENT_EXPANDEDType;
87
- TIME_ZONE: TIME_ZONEType;
88
- VARIANT_PAGINATION: VARIANT_PAGINATIONType;
89
- Z_INDEX_WAR: Z_INDEX_WARType;
90
- };
56
+ slug: string[] | string;
57
+ PLP_SORT_DEFAULT: PLP_SORT_DEFAULTType;
58
+ searchParams?: URLSearchParams;
91
59
  collectionId?: number | null;
92
60
  itemsPerPage?: number;
93
- mainSeller: StoreConfigType['mainSeller']['id'];
94
- pathname: string;
95
- searchParams?: URLSearchParams;
96
- slug: string[] | string;
61
+ brand?: string | null;
97
62
  }
98
63
  export interface PLPConstantsProviderProps extends PropsWithChildren {
99
64
  BUY_BUTTON_LABELS: BUY_BUTTON_LABELSType;
@@ -129,5 +94,7 @@ export interface PLPConstantsProviderProps extends PropsWithChildren {
129
94
  VARIANT_PAGINATION: VARIANT_PAGINATIONType;
130
95
  Z_INDEX_WAR: Z_INDEX_WARType;
131
96
  StoreConfig_MainSellerId: StoreConfigType['mainSeller']['id'];
97
+ searchParams: URLSearchParams;
98
+ storeId: StoreConfigType['api']['storeId'];
132
99
  }
133
100
  export type PLPConstantsContextProps = Omit<PLPConstantsProviderProps, 'children'>;
@@ -1,41 +1,26 @@
1
1
  import { Dispatch, PropsWithChildren, SetStateAction } from 'react';
2
2
  import { ProductSearchResultPage } from '../../data/api/search/product';
3
3
  import { State, Suggestion } from '../../data/api/search';
4
- import { FacetSearchResult, SelectedFacet } from '../../data/api/search/facets';
4
+ import { Facet, SelectedFacet } from '../../data/api/search/facets';
5
5
  import { ITEMS_DEFAULT_SORTType, ITEMS_PER_PAGEType, ITEMS_PER_SECTIONType, PLP_FILTERS_SORT_OPTIONtype, SEARCH_PAGE_ITEM_THRESHOLDType, SEARCH_RESULTType, VARIANT_PAGINATIONType } from '../../constants';
6
+ import { BreadCrumbItemLinkProps } from '../../layout/team-components/PLPNavigation';
6
7
  import { ProductsProps } from '../../layout/templates/PLP';
7
- import { UseQueryOptions } from '@tanstack/react-query';
8
8
 
9
- export interface QueryFacetsContextProps extends FacetSearchResult {
10
- isLoading?: boolean;
11
- deleteAllFacets(): void;
12
- selectedFacets: SelectedFacet[];
13
- onToggleFacet(value: SelectedFacet): void;
14
- onSort(sort: PLP_FILTERS_SORT_OPTIONtype): void;
15
- }
16
9
  export interface FacetsContextProps {
10
+ breadcrumb: BreadCrumbItemLinkProps[];
17
11
  deleteAllFacets(): void;
12
+ facets: Facet[];
13
+ isLoading: boolean;
18
14
  selectedFacets: SelectedFacet[];
19
15
  onToggleFacet(value: SelectedFacet): void;
20
16
  onSort(sort: PLP_FILTERS_SORT_OPTIONtype): void;
21
17
  }
22
- export interface QueryFacetsProviderProps extends PropsWithChildren {
23
- state: State;
24
- forceUpdate?: boolean;
25
- PLP_SORT_DEFAULT: ITEMS_DEFAULT_SORTType;
26
- }
27
18
  export interface FacetsProviderProps extends PropsWithChildren {
28
19
  forceUpdate?: boolean;
29
- searchParams: URLSearchParams;
30
- PLP_SORT_DEFAULT: ITEMS_DEFAULT_SORTType;
31
20
  }
32
21
  export interface FacetsProviderContentProps extends Omit<FacetsProviderProps, 'forceUpdate'> {
33
22
  selectedFacets: SelectedFacet[];
34
23
  }
35
- export interface QueryProductsContextProps extends ProductSearchResultPage {
36
- isLoading: boolean;
37
- total: number;
38
- }
39
24
  export interface ProductsContextProps extends ProductSearchResultPage {
40
25
  isLoading: boolean;
41
26
  total: number;
@@ -48,21 +33,22 @@ export interface SuggestedTermsContextProps {
48
33
  export interface SuggestedTermsProviderProps extends PropsWithChildren {
49
34
  term?: string;
50
35
  }
51
- export interface QueryProductsProviderProps extends PropsWithChildren {
36
+ export interface ProductsProviderProps extends PropsWithChildren {
37
+ query?: string;
52
38
  forceUpdate?: boolean;
53
- options: Omit<UseQueryOptions<DataParams, Error, DataParams, (string | undefined)[]>, 'queryKey' | 'queryFn'>;
54
- state: State;
55
- queryKey: (string | undefined)[];
56
39
  }
57
- export interface ProductsProviderProps extends PropsWithChildren<State> {
58
- forceUpdate?: boolean;
40
+ export interface SearchContextProps extends Pick<SearchProviderProps, 'sort' | 'searchParams'> {
41
+ count: number;
42
+ state: State;
59
43
  }
60
- export type SearchContextProps = Pick<SearchProviderProps, 'state' | 'searchParams'>;
61
44
  export interface SearchProviderProps extends PropsWithChildren {
62
- brand?: string | null;
63
- collectionId?: number | null;
64
45
  searchParams: URLSearchParams;
65
46
  state: State;
47
+ sort?: string;
48
+ collectionId?: number | null;
49
+ brand?: string | null;
50
+ count?: number;
51
+ ITEMS_PER_PAGE: ITEMS_PER_PAGEType;
66
52
  }
67
53
  export interface SearchItem {
68
54
  term: string;
@@ -74,11 +60,6 @@ export interface TopSearchesContextProps {
74
60
  error: string | null;
75
61
  }
76
62
  export type DataParams = FacetsContextProps | ProductSearchResultPage | SuggestedTermsContextProps;
77
- export interface RootQueryContextProps {
78
- data: DataParams | undefined;
79
- isLoading: boolean;
80
- isError?: boolean;
81
- }
82
63
  export interface RootContextProps {
83
64
  data: DataParams | null;
84
65
  isLoading: boolean;
@@ -17,3 +17,15 @@ export type UseScrollRestorationInfiniteProps = {
17
17
  load: boolean;
18
18
  PLP_GRID_SCROLL_BACK: PLP_GRID_SCROLL_BACKType;
19
19
  };
20
+ export type SimilarItem = any;
21
+ export type SimilarCallback = (data: SimilarItem[]) => void;
22
+ export type SimilarsOptions = {
23
+ filterTexture?: string[];
24
+ storeId: string;
25
+ };
26
+ export type PendingRequest = {
27
+ productId: string;
28
+ callbacks: SimilarCallback[];
29
+ filterTexture?: string[];
30
+ storeId: string;
31
+ };
@@ -1,11 +1,13 @@
1
1
  import { Dispatch, HTMLAttributes, SetStateAction } from 'react';
2
2
  import { SearchSort } from '../../../data/api/search';
3
3
  import { FacetsContextProps } from '../../../contexts/contexts/search';
4
+ import { ICONSType } from '../../../constants';
4
5
 
5
6
  export interface BreadCrumbItemLinkProps extends HTMLAttributes<HTMLDivElement> {
6
7
  isLast?: boolean;
7
8
  href?: string;
8
9
  name?: string;
10
+ ICONS: ICONSType;
9
11
  }
10
12
  export type RootProps = HTMLAttributes<HTMLDivElement>;
11
13
  export type Order = {
@@ -33,6 +33,7 @@ export interface RootProps extends HTMLAttributes<HTMLDivElement> {
33
33
  Z_INDEX_WAR: Z_INDEX_WARType;
34
34
  StoreConfig_MainSellerId: StoreConfigType['mainSeller']['id'];
35
35
  ICONS: ICONSType;
36
+ storeId: StoreConfigType['api']['storeId'];
36
37
  };
37
38
  }
38
39
  export type Sizes = (typeof SizesExtended)[number];
@@ -1,5 +1,5 @@
1
1
  import { HTMLAttributes, MutableRefObject } from 'react';
2
- import { PLP_INFINITE_SCROLLType, PLP_PRODUCT_SIMILAR_DELAYType, PLP_SIZE_ORDERType, PRODUCT_CARD_IMAGE_ASPECT_RATIOType, TEXTURE_IMAGEType } from '../../../constants';
2
+ import { PLP_INFINITE_SCROLLType, PLP_PRODUCT_SIMILAR_DELAYType, PLP_SIZE_ORDERType, PRODUCT_CARD_IMAGE_ASPECT_RATIOType, StoreConfigType, TEXTURE_IMAGEType } from '../../../constants';
3
3
  import { HasVariant, ProductType_PDC } from '../../../global/product';
4
4
  import { ProductCardProps, RootProps as ProductCard_RootProps } from '../ProductCard';
5
5
  import { TagCommercialConsumer } from '../../../cms/ContentTypes/FlagsAndTags';
@@ -49,5 +49,6 @@ export interface CardProps {
49
49
  PLP_PRODUCT_SIMILAR_DELAY: PLP_PRODUCT_SIMILAR_DELAYType;
50
50
  PLP_SIZE_ORDER: PLP_SIZE_ORDERType;
51
51
  TEXTURE_IMAGE?: TEXTURE_IMAGEType;
52
+ storeId: StoreConfigType['api']['storeId'];
52
53
  };
53
54
  }
@@ -114,9 +114,8 @@ export type ProductMeasurementsProps = {
114
114
  Z_INDEX_WAR: Z_INDEX_WARType;
115
115
  };
116
116
  export interface PDPSimilarsType extends PropsWithChildren {
117
- apiUrl: string;
117
+ storeId: string;
118
118
  productId: string;
119
- ClientItems: React.ComponentType<ItemsProps>;
120
119
  PDP_INFO: PDP_INFOType;
121
120
  TEXTURE_IMAGE: TEXTURE_IMAGEType;
122
121
  TOGGLE_STYLE_MODIFIER: TOGGLE_STYLE_MODIFIERType;
@@ -2,7 +2,7 @@ import { HTMLAttributes, PropsWithChildren } from 'react';
2
2
  import { AvailabilityNotifyProps } from '../../../../types/layout/team-components/Notify';
3
3
  import { BannerType } from '../../../cms/Sections/Banner';
4
4
  import { BUY_BUTTON_LABELSType, ICONSType, ITEMS_DEFAULT_SORTType, ITEMS_PER_PAGEType, ITEMS_PER_SECTIONType, MAIN_IMAGEType, NEWSLETTER_CONFIGSType, NOTIFY_INFOType, PLP_GRID_SCROLL_BACKType, PLP_INFINITE_SCROLLType, PLP_PRODUCT_SIMILAR_DELAYType, PLP_SHOW_VIDEO_ON_PRODUCT_CARDType, PRODUCT_CARD_IMAGE_ASPECT_RATIOType, PRODUCT_CARD_TEXTSType, PRODUCT_CARD_TOP_WISHLIST_TOGGLEType, PRODUCT_IMAGE_DIMENSIONSType, SEARCH_PAGE_ITEM_THRESHOLDType, SECOND_IMAGEType, StoreConfigType, TEXTURE_IMAGEType, VARIANT_PAGINATIONType, PLP_NOT_RESULTType, Z_INDEX_WARType, PLP_SIZE_ORDERType } from '../../../constants';
5
- import { Page } from '../../../contexts/contexts/plp';
5
+ import { Page, PLPConstantsContextProps } from '../../../contexts/contexts/plp';
6
6
  import { ProductType_PDC } from '../../../global/product';
7
7
  import { ProductCardProps } from '../../team-components/ProductCard';
8
8
 
@@ -113,8 +113,9 @@ export interface ProductsProps {
113
113
  StoreConfig_MainSellerId: StoreConfigType['mainSeller']['id'];
114
114
  TEXTURE_IMAGE: TEXTURE_IMAGEType;
115
115
  Z_INDEX_WAR: Z_INDEX_WARType;
116
+ storeId: StoreConfigType['api']['storeId'];
116
117
  }
117
- export interface PLPRootProps {
118
+ export interface PLPRootProps extends PLPConstantsContextProps {
118
119
  className?: string;
119
120
  }
120
121
  export type EmptyProps = {