@evenicanpm/storefront-core 1.3.0 → 1.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.
Files changed (188) hide show
  1. package/__mocks__/get-product-by-id.ts +0 -1
  2. package/__mocks__/query-client.ts +1 -1
  3. package/package.json +3 -3
  4. package/src/api-manager/datasources/d365/d365-address.datasource.ts +2 -2
  5. package/src/api-manager/datasources/d365/d365-cart.datasource.ts +4 -5
  6. package/src/api-manager/datasources/d365/d365-categories.datasource.ts +1 -1
  7. package/src/api-manager/datasources/d365/d365-product.datasource.ts +21 -7
  8. package/src/api-manager/datasources/d365/d365-session.datasource.ts +5 -7
  9. package/src/api-manager/datasources/d365/d365-user.datasource.ts +12 -23
  10. package/src/api-manager/datasources/d365/d365.datasource.ts +0 -2
  11. package/src/api-manager/datasources/d365/index.ts +2 -4
  12. package/src/api-manager/datasources/d365/utils/decode-jwt.ts +1 -2
  13. package/src/api-manager/datasources/d365/utils/parse-object.ts +1 -1
  14. package/src/api-manager/datasources/e4/address/e4-address.remaps.ts +2 -2
  15. package/src/api-manager/datasources/e4/address/e4-address.translator.ts +1 -1
  16. package/src/api-manager/datasources/e4/cart/e4-cart.datasource.ts +28 -27
  17. package/src/api-manager/datasources/e4/cart/e4-cart.remaps.ts +1 -1
  18. package/src/api-manager/datasources/e4/cart/e4-cart.translator.ts +1 -1
  19. package/src/api-manager/datasources/e4/categories/e4-categories.translator.ts +20 -20
  20. package/src/api-manager/datasources/e4/graphqlRequestSdk.ts +471 -7
  21. package/src/api-manager/datasources/e4/order/e4-order.remaps.ts +2 -2
  22. package/src/api-manager/datasources/e4/organization/e4-organization.datasource.ts +2 -8
  23. package/src/api-manager/datasources/e4/product/e4-product.remaps.ts +3 -3
  24. package/src/api-manager/datasources/e4/product/e4-product.translator.ts +13 -29
  25. package/src/api-manager/datasources/e4/session/e4-session.datasource.ts +1 -3
  26. package/src/api-manager/datasources/e4/user/e4-user.remaps.ts +2 -4
  27. package/src/api-manager/datasources/e4/utils/unwrap-e4-variants.ts +4 -4
  28. package/src/api-manager/index.ts +1 -1
  29. package/src/api-manager/lib/category-helpers.ts +3 -2
  30. package/src/api-manager/lib/get-graphql-client.ts +1 -2
  31. package/src/api-manager/services/cart/mutations/add-discount-code.ts +2 -2
  32. package/src/api-manager/services/cart/mutations/add-to-cart.ts +2 -2
  33. package/src/api-manager/services/product/server/product.server.ts +1 -1
  34. package/src/api-manager/types/Datasource.ts +4 -9
  35. package/src/auth/auth-options.test.ts +2 -58
  36. package/src/auth/auth-options.ts +1 -2
  37. package/src/auth/next-auth-cookie-manager.ts +0 -2
  38. package/src/auth/refresh-token.ts +3 -8
  39. package/src/auth/signout.ts +1 -1
  40. package/src/cms/blocks/block-manager.tsx +3 -3
  41. package/src/cms/blocks/components/category-card.tsx +1 -1
  42. package/src/cms/blocks/components/category-carousel/index.tsx +3 -1
  43. package/src/cms/blocks/components/footer/index.tsx +2 -2
  44. package/src/cms/blocks/components/footer/sections/footer-links.tsx +2 -2
  45. package/src/cms/blocks/components/footer/sections/footer-logo.tsx +1 -1
  46. package/src/cms/blocks/components/footer/sections/footer-social-links.tsx +10 -2
  47. package/src/cms/blocks/components/hero-carousel/index.tsx +29 -25
  48. package/src/cms/blocks/components/media-card.tsx +1 -1
  49. package/src/cms/blocks/components/product-carousel/index.tsx +1 -1
  50. package/src/cms/blocks/components/product-section-fullwidth/index.tsx +2 -2
  51. package/src/cms/blocks/components/seo/index.tsx +5 -1
  52. package/src/cms/blocks/components/services/index.tsx +1 -1
  53. package/src/cms/blocks/components/services/service-card.tsx +1 -1
  54. package/src/cms/blocks/components/shared/featured-product-card.tsx +4 -1
  55. package/src/cms/blocks/components/shared/product-category-item.tsx +1 -1
  56. package/src/cms/blocks/components/shared/product-grid.tsx +4 -1
  57. package/src/cms/blocks/components/shared/top-categories-card.tsx +5 -1
  58. package/src/cms/blocks/components/shared/top-rating-product-card.tsx +1 -1
  59. package/src/components-v2/BazaarImage.tsx +1 -1
  60. package/src/components-v2/BazaarMenu.tsx +2 -2
  61. package/src/components-v2/BazaarTextField.tsx +3 -3
  62. package/src/components-v2/BorderShadowCard.stories.tsx +1 -1
  63. package/src/components-v2/DropZone.tsx +1 -2
  64. package/src/components-v2/Typography.tsx +12 -12
  65. package/src/components-v2/accordion/accordion-header.tsx +1 -1
  66. package/src/components-v2/categories/category-list/styles.ts +0 -7
  67. package/src/components-v2/categories/category-list-item/category-menu-item.tsx +1 -1
  68. package/src/components-v2/categories/category-menu.tsx +16 -13
  69. package/src/components-v2/categories/mega-menu/mega-menu-1.tsx +1 -1
  70. package/src/components-v2/categories/mega-menu/mega-menu-2.tsx +2 -2
  71. package/src/components-v2/header/components/user.tsx +5 -5
  72. package/src/components-v2/mini-cart/__tests__/cart-item.test.tsx +13 -13
  73. package/src/components-v2/mini-cart/components/bottom-actions.tsx +1 -1
  74. package/src/components-v2/mini-cart/components/cart-item.tsx +3 -3
  75. package/src/components-v2/mini-cart/components/top-header.tsx +2 -2
  76. package/src/components-v2/mobile-navigation/mobile-navigation-bar.tsx +1 -1
  77. package/src/components-v2/nav-link/nav-link-2.tsx +1 -1
  78. package/src/components-v2/nav-link/nav-link-3.tsx +1 -1
  79. package/src/components-v2/nav-link/nav-link.tsx +1 -1
  80. package/src/components-v2/navbar/categories.tsx +3 -1
  81. package/src/components-v2/navbar/category-based-menu/category-based-menu.tsx +2 -2
  82. package/src/components-v2/navbar/mobile-menu/mobile-menu.tsx +11 -3
  83. package/src/components-v2/navbar/nav-list/nav-item-child.tsx +1 -1
  84. package/src/components-v2/navbar/nav-list/nav-list.tsx +118 -80
  85. package/src/components-v2/navbar/navbar.tsx +1 -1
  86. package/src/components-v2/no-records.tsx +1 -1
  87. package/src/components-v2/product-cards/favorite-button.tsx +1 -1
  88. package/src/components-v2/product-cards/product-card/product-card.tsx +5 -7
  89. package/src/components-v2/product-cards/product-card-plp/product-card.tsx +7 -6
  90. package/src/components-v2/product-cards/product-card-plp-list/components/tags.tsx +1 -1
  91. package/src/components-v2/product-cards/product-card-plp-list/product-card.tsx +7 -4
  92. package/src/components-v2/product-cards/product-card-search/product-card.tsx +4 -2
  93. package/src/components-v2/product-cards/product-price.tsx +1 -1
  94. package/src/components-v2/product-cards/product-rating.tsx +1 -1
  95. package/src/components-v2/product-cards/product-title.tsx +1 -1
  96. package/src/components-v2/product-cards/quantity-buttons.tsx +1 -1
  97. package/src/components-v2/product-dialog/compound/product-dialog.tsx +2 -2
  98. package/src/components-v2/product-dialog/index.tsx +1 -1
  99. package/src/components-v2/product-dimensions/compound/dimensions-group-list.tsx +6 -1
  100. package/src/components-v2/product-dimensions/index.tsx +3 -3
  101. package/src/components-v2/product-quantity-buttons/compound/quantity-buttons-root.tsx +1 -1
  102. package/src/components-v2/product-quantity-variants/index.tsx +1 -2
  103. package/src/components-v2/products-view/ProductsList.stories.tsx +0 -2
  104. package/src/components-v2/products-view/compound/products-grid-view.tsx +2 -2
  105. package/src/components-v2/products-view/compound/products-list-view.tsx +3 -3
  106. package/src/components-v2/products-view/index.tsx +2 -2
  107. package/src/components-v2/progress/progress.tsx +1 -1
  108. package/src/components-v2/scrollbar/scrollbar.tsx +1 -1
  109. package/src/components-v2/search-bar/compound/results-suspense.tsx +1 -2
  110. package/src/components-v2/search-bar/compound/results.tsx +6 -3
  111. package/src/components-v2/search-bar/compound/search-bar-root.tsx +4 -2
  112. package/src/components-v2/search-bar/compound/textfield-adornment-category.tsx +25 -27
  113. package/src/components-v2/search-bar/compound/textfield.tsx +0 -1
  114. package/src/components-v2/search-bar/hooks/use-search.ts +1 -1
  115. package/src/components-v2/section/Section.stories.tsx +1 -1
  116. package/src/components-v2/side-nav/side-nav.tsx +1 -1
  117. package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/add-to-wishlist-dialog.tsx +1 -1
  118. package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/add-to-wishlist-list.tsx +2 -2
  119. package/src/components-v2/wishlist-dialogs/add-to-wishlist/hooks/use-add-to-wishlist.ts +2 -0
  120. package/src/components-v2/wishlist-dialogs/add-to-wishlist/index.tsx +11 -13
  121. package/src/components-v2/wishlist-dialogs/create-wishlist/compound/create-wishlist-dialog.tsx +2 -1
  122. package/src/hooks/use-variants.ts +25 -27
  123. package/src/lib/build-detail-url.ts +1 -1
  124. package/src/lib/category-helpers.ts +3 -3
  125. package/src/lib/get-palette-color.ts +35 -15
  126. package/src/lib/hexToLuma.ts +2 -2
  127. package/src/lib/store-hours-helper.ts +5 -5
  128. package/src/pages-v2/account/addresses/address-form.tsx +10 -8
  129. package/src/pages-v2/account/addresses/address-item.tsx +1 -1
  130. package/src/pages-v2/account/orders/order-progress.tsx +1 -1
  131. package/src/pages-v2/account/orders/ordered-products.tsx +1 -1
  132. package/src/pages-v2/account/profile/user-info.tsx +1 -2
  133. package/src/pages-v2/account/wishlist/create-new-list.tsx +1 -0
  134. package/src/pages-v2/account/wishlist/wishlist-item.tsx +2 -1
  135. package/src/pages-v2/blog/blog-card.tsx +1 -1
  136. package/src/pages-v2/cart/__tests__/cart-item.test.tsx +0 -1
  137. package/src/pages-v2/cart/__tests__/checkout-form.test.tsx +0 -8
  138. package/src/pages-v2/cart/cart-item.tsx +86 -77
  139. package/src/pages-v2/cart/checkout-form.tsx +4 -4
  140. package/src/pages-v2/cart/coupon-entry.tsx +3 -3
  141. package/src/pages-v2/cart/estimate-shipping.tsx +6 -6
  142. package/src/pages-v2/checkout/checkout-alt-form/checkout-form.tsx +2 -2
  143. package/src/pages-v2/checkout/checkout-alt-form/checkout-step.tsx +2 -2
  144. package/src/pages-v2/checkout/checkout-alt-form/step-heading.tsx +1 -1
  145. package/src/pages-v2/checkout/checkout-alt-form/steps/address/delivery-address.tsx +12 -10
  146. package/src/pages-v2/checkout/checkout-alt-form/steps/address/new-address-form.tsx +5 -6
  147. package/src/pages-v2/checkout/checkout-alt-form/steps/customer-info/customer-information.tsx +8 -9
  148. package/src/pages-v2/checkout/checkout-alt-form/steps/payment/payment-details.tsx +17 -20
  149. package/src/pages-v2/checkout/checkout-alt-form/steps/shipping/delivery-date.tsx +1 -1
  150. package/src/pages-v2/checkout/checkout-alt-form/steps/shipping/delivery-options.tsx +14 -15
  151. package/src/pages-v2/confirmation/confirmation-summary.tsx +8 -7
  152. package/src/pages-v2/confirmation/ordered-products.tsx +3 -3
  153. package/src/pages-v2/product-details/bopis/pickup-option-select.tsx +1 -1
  154. package/src/pages-v2/product-details/bopis/store-card/shop-card.tsx +1 -1
  155. package/src/pages-v2/product-details/checkbox-label.tsx +1 -1
  156. package/src/pages-v2/product-details/frequently-bought.tsx +1 -1
  157. package/src/pages-v2/product-details/frequently-product-card.tsx +1 -1
  158. package/src/pages-v2/product-details/product-comment.tsx +1 -1
  159. package/src/pages-v2/product-details/product-description.tsx +2 -2
  160. package/src/pages-v2/product-details/product-filter-card.tsx +4 -1
  161. package/src/pages-v2/product-details/product-intro/compound/product-intro-images.tsx +36 -31
  162. package/src/pages-v2/product-details/product-intro/compound/product-intro.tsx +1 -1
  163. package/src/pages-v2/product-details/product-intro/compound/thumbnail-with-skeleton.tsx +1 -1
  164. package/src/pages-v2/product-details/product-intro/utils.ts +2 -4
  165. package/src/pages-v2/product-details/product-review.tsx +1 -1
  166. package/src/pages-v2/product-details/product-tabs.tsx +5 -2
  167. package/src/pages-v2/product-details/related-products.tsx +7 -4
  168. package/src/pages-v2/product-list/breadcrumbs.tsx +1 -1
  169. package/src/pages-v2/product-list/checkbox-label.tsx +1 -1
  170. package/src/pages-v2/product-list/facet-group.tsx +1 -1
  171. package/src/pages-v2/product-list/list-filter.tsx +2 -2
  172. package/src/pages-v2/product-list/product-list-context.tsx +5 -1
  173. package/src/pages-v2/product-list/product-list-view.tsx +4 -1
  174. package/src/pages-v2/product-list/product-rating.tsx +4 -1
  175. package/src/pages-v2/product-list/quick-view-dialog-content.tsx +2 -4
  176. package/src/pages-v2/product-list/quick-view-dialog.tsx +5 -1
  177. package/src/pages-v2/product-list/range-filter.tsx +0 -1
  178. package/src/pages-v2/product-list/scrollbar.tsx +1 -1
  179. package/src/pages-v2/product-list/side-nav.tsx +1 -1
  180. package/src/pages-v2/product-list/swatch.tsx +12 -7
  181. package/src/pages-v2/product-list/utils/getCategoryFilterFromSlug.ts +33 -68
  182. package/src/pages-v2/product-list/utils/product-list-helper.ts +1 -1
  183. package/src/pages-v2/product-list/utils/search-for-category.ts +2 -2
  184. package/src/pages-v2/quickorder/order-upload.tsx +90 -76
  185. package/src/pages-v2/quickorder/provider.tsx +6 -4
  186. package/src/pages-v2/quickorder/quick-order-row.tsx +1 -1
  187. package/src/pages-v2/quickorder/quick-order.tsx +28 -21
  188. package/src/providers/notifications/notification-context.tsx +0 -1
@@ -9,37 +9,41 @@ import React from "react";
9
9
  import type { HeroCarouselBlock, Slide } from "@/cms/blocks/interfaces";
10
10
  import { getImageUrl } from "@/cms/endpoints";
11
11
 
12
- export default function HeroCarousel(data: HeroCarouselBlock) {
12
+ export default function HeroCarousel(data: Readonly<HeroCarouselBlock>) {
13
13
  return (
14
14
  <Box sx={{ backgroundColor: "white" }}>
15
15
  <Container className="pt-2 pb-2">
16
16
  <Carousel slidesToShow={1} autoplay={true} arrows={false} dots={true}>
17
- {data.Slides.map((data: Slide, ind: number) => (
18
- <CarouselCard1 key={ind}>
19
- <CarouselCard1.Info>
20
- <CarouselCard1.Title title={data?.heading} />
21
- <CarouselCard1.Description description={data?.description} />
22
- <CarouselCard1.Button
23
- buttonLink={
24
- data?.linkToPage?.slug
25
- ? `/pages/${data?.linkToPage?.slug}`
26
- : data?.linkToProduct?.sku
27
- ? `/product/${data?.linkToProduct?.sku}`
28
- : ""
17
+ {data.Slides.map((data: Slide, ind: number) => {
18
+ const productLink = data?.linkToProduct?.sku
19
+ ? `/product/${data.linkToProduct.sku}`
20
+ : "";
21
+
22
+ const buttonLink = data?.linkToPage?.slug
23
+ ? `/pages/${data.linkToPage.slug}`
24
+ : productLink;
25
+
26
+ return (
27
+ <CarouselCard1 key={data.id + ind}>
28
+ <CarouselCard1.Info>
29
+ <CarouselCard1.Title title={data?.heading} />
30
+ <CarouselCard1.Description description={data?.description} />
31
+ <CarouselCard1.Button
32
+ buttonLink={buttonLink}
33
+ buttonText={data?.buttonText}
34
+ />
35
+ </CarouselCard1.Info>
36
+
37
+ <CarouselCard1.Image
38
+ imgUrl={
39
+ data?.image?.formats
40
+ ? getImageUrl(data?.image?.formats)
41
+ : data?.image?.url
29
42
  }
30
- buttonText={data?.buttonText}
31
43
  />
32
- </CarouselCard1.Info>
33
-
34
- <CarouselCard1.Image
35
- imgUrl={
36
- data?.image?.formats
37
- ? getImageUrl(data?.image?.formats)
38
- : data?.image?.url
39
- }
40
- />
41
- </CarouselCard1>
42
- ))}
44
+ </CarouselCard1>
45
+ );
46
+ })}
43
47
  </Carousel>
44
48
  </Container>
45
49
  </Box>
@@ -12,7 +12,7 @@ interface Props {
12
12
  imgUrl: string;
13
13
  }
14
14
 
15
- export default function MediaCard({ name, imgUrl }: Props) {
15
+ export default function MediaCard({ name, imgUrl }: Readonly<Props>) {
16
16
  return (
17
17
  <Card sx={{ width: "100%" }}>
18
18
  <Box
@@ -13,7 +13,7 @@ import { getImageUrl } from "@/cms/endpoints";
13
13
 
14
14
  type CombinedProduct = Product & SimpleProduct;
15
15
 
16
- export default function ProductCarousel(data: ProductCarouselBlock) {
16
+ export default function ProductCarousel(data: Readonly<ProductCarouselBlock>) {
17
17
  const { data: e4Products = [], error } = getProductByIds.useData({
18
18
  id: data?.products?.map((product: Product) => product.sku),
19
19
  });
@@ -26,7 +26,7 @@ import { getImageUrl } from "@/cms/endpoints";
26
26
 
27
27
  type CombinedProduct = Product & SimpleProduct;
28
28
  export default async function ProductSectionFullWidth(
29
- data: ProductSectionFullWidthBlock,
29
+ data: Readonly<ProductSectionFullWidthBlock>,
30
30
  ) {
31
31
  const queryClient = getQueryClient();
32
32
 
@@ -34,7 +34,7 @@ export default async function ProductSectionFullWidth(
34
34
 
35
35
  const e4Products = await getProductByIds.fetchData(queryClient, { id: skus });
36
36
 
37
- if (!(e4Products && e4Products.length)) {
37
+ if (!e4Products?.length) {
38
38
  return null;
39
39
  }
40
40
 
@@ -36,7 +36,11 @@ const Seo = (pageData: SeoPageData) => {
36
36
  </>
37
37
  )}
38
38
  {pageData?.seo?.meta?.map((metaItem: MetaItem, i: number) => (
39
- <meta name={metaItem.name} key={i} content={metaItem.content} />
39
+ <meta
40
+ name={metaItem.name}
41
+ key={metaItem.id}
42
+ content={metaItem.content}
43
+ />
40
44
  ))}
41
45
  <script type="application/ld+json">
42
46
  {JSON.stringify(pageData?.seo?.structuredData)}
@@ -8,7 +8,7 @@ import type {
8
8
  ServicesBlock,
9
9
  } from "@/cms/blocks/interfaces";
10
10
 
11
- export default function Services(data: ServicesBlock) {
11
+ export default function Services(data: Readonly<ServicesBlock>) {
12
12
  return (
13
13
  <Container sx={{ marginBottom: "80px", marginTop: "80px" }}>
14
14
  <Grid container spacing={3}>
@@ -45,7 +45,7 @@ const StyledCard = styled(Card)(({ theme }) => ({
45
45
  type Props = { service: Service };
46
46
  // ==================================================
47
47
 
48
- export default function ServiceCard({ service }: Props) {
48
+ export default function ServiceCard({ service }: Readonly<Props>) {
49
49
  const { icon, title, description } = service;
50
50
 
51
51
  const Icon = getIcon(icon);
@@ -8,7 +8,10 @@ import React from "react";
8
8
  type Props = { title: string; imgUrl: string };
9
9
  // ==========================================================
10
10
 
11
- export default function FeaturedProductCard({ imgUrl, title }: Props) {
11
+ export default function FeaturedProductCard({
12
+ imgUrl,
13
+ title,
14
+ }: Readonly<Props>) {
12
15
  return (
13
16
  <div>
14
17
  <HoverBox borderRadius="5px" mb={1}>
@@ -31,7 +31,7 @@ export default function ProductCategoryItem({
31
31
  isSelected,
32
32
  sx = {},
33
33
  ...others
34
- }: Props) {
34
+ }: Readonly<Props>) {
35
35
  return (
36
36
  <StyledBazaarCard
37
37
  elevation={isSelected ? 2 : 0}
@@ -20,7 +20,10 @@ interface Product {
20
20
 
21
21
  type Props = { products: Product[]; heading: string };
22
22
 
23
- export default function ProductGridList({ products, heading }: Props) {
23
+ export default function ProductGridList({
24
+ products,
25
+ heading,
26
+ }: Readonly<Props>) {
24
27
  return (
25
28
  <Box flex="1 1 0">
26
29
  <Section>
@@ -26,7 +26,11 @@ interface Props {
26
26
  }
27
27
  // ========================================================
28
28
 
29
- export default function TopCategoriesCard({ title, subtitle, imgUrl }: Props) {
29
+ export default function TopCategoriesCard({
30
+ title,
31
+ subtitle,
32
+ imgUrl,
33
+ }: Readonly<Props>) {
30
34
  const theme = useTheme();
31
35
  const color = theme.palette.secondary.main;
32
36
  return (
@@ -21,7 +21,7 @@ interface Props {
21
21
  }
22
22
  // ======================================================
23
23
 
24
- export default function TopRatingProductCard(props: Props) {
24
+ export default function TopRatingProductCard(props: Readonly<Props>) {
25
25
  const { title, price, imgUrl, rating = 5, reviewCount = 10 } = props;
26
26
 
27
27
  return (
@@ -7,6 +7,6 @@ interface Props extends BoxProps {
7
7
  }
8
8
  // ==============================================================
9
9
 
10
- export default function BazaarImage(props: Props) {
10
+ export default function BazaarImage(props: Readonly<Props>) {
11
11
  return <Box component="img" {...props} />;
12
12
  }
@@ -21,7 +21,7 @@ export default function BazaarMenu({
21
21
  direction = "left",
22
22
  sx,
23
23
  ...props
24
- }: Props) {
24
+ }: Readonly<Props>) {
25
25
  const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);
26
26
 
27
27
  const handleClose = () => setAnchorEl(null);
@@ -36,7 +36,7 @@ export default function BazaarMenu({
36
36
  elevation={0}
37
37
  anchorEl={anchorEl}
38
38
  onClose={handleClose}
39
- open={open !== undefined ? open : !!anchorEl}
39
+ open={open ?? Boolean(anchorEl)}
40
40
  anchorOrigin={{ vertical: "bottom", horizontal: direction }}
41
41
  transformOrigin={{ vertical: "top", horizontal: direction }}
42
42
  sx={sx}
@@ -17,7 +17,7 @@ export default function BazaarTextField({
17
17
 
18
18
  // Splits props into Box and TextField props. Bracket notation allows dynamic names like "mt" or "mb".
19
19
  for (const key in props) {
20
- if (SPACE_PROPS_LIST.includes(key)) {
20
+ if (SPACE_PROPS_LIST.has(key)) {
21
21
  (boxProps as any)[key] = (props as any)[key];
22
22
  } else {
23
23
  (textFieldProps as any)[key] = (props as any)[key];
@@ -45,7 +45,7 @@ export default function BazaarTextField({
45
45
  );
46
46
  }
47
47
 
48
- const SPACE_PROPS_LIST = [
48
+ const SPACE_PROPS_LIST = new Set([
49
49
  "m",
50
50
  "mt",
51
51
  "mr",
@@ -74,4 +74,4 @@ const SPACE_PROPS_LIST = [
74
74
  "paddingLeft",
75
75
  "paddingX",
76
76
  "paddingY",
77
- ];
77
+ ]);
@@ -1,6 +1,6 @@
1
1
  import { Box, Typography } from "@mui/material";
2
2
  import type { Meta, StoryObj } from "@storybook/react";
3
- import { BorderShadowCard, lightBorder, lightShadow } from "./BoxShadowCard";
3
+ import { BorderShadowCard } from "./BoxShadowCard";
4
4
 
5
5
  const meta = {
6
6
  title: "Bazaar/BorderShadowCard",
@@ -26,8 +26,7 @@ export default function DropZone({
26
26
  onChange,
27
27
  title = "Drag & drop files here",
28
28
  handleReject,
29
- accept,
30
- }: Props) {
29
+ }: Readonly<Props>) {
31
30
  const onDrop = useCallback(
32
31
  (acceptedFiles: File[]) => onChange(acceptedFiles),
33
32
  [onChange],
@@ -22,7 +22,7 @@ const StyledBox = styled(Box, {
22
22
  }),
23
23
  }));
24
24
 
25
- export function H1(props: EllipsisProps) {
25
+ export function H1(props: Readonly<EllipsisProps>) {
26
26
  const { ellipsis, children, className, ...others } = props;
27
27
 
28
28
  return (
@@ -39,7 +39,7 @@ export function H1(props: EllipsisProps) {
39
39
  );
40
40
  }
41
41
 
42
- export function H2(props: EllipsisProps) {
42
+ export function H2(props: Readonly<EllipsisProps>) {
43
43
  const { ellipsis, children, className, ...others } = props;
44
44
 
45
45
  return (
@@ -56,7 +56,7 @@ export function H2(props: EllipsisProps) {
56
56
  );
57
57
  }
58
58
 
59
- export function H3(props: EllipsisProps) {
59
+ export function H3(props: Readonly<EllipsisProps>) {
60
60
  const { ellipsis, children, className, ...others } = props;
61
61
 
62
62
  return (
@@ -73,7 +73,7 @@ export function H3(props: EllipsisProps) {
73
73
  );
74
74
  }
75
75
 
76
- export function H4(props: EllipsisProps) {
76
+ export function H4(props: Readonly<EllipsisProps>) {
77
77
  const { ellipsis, children, className, ...others } = props;
78
78
 
79
79
  return (
@@ -90,7 +90,7 @@ export function H4(props: EllipsisProps) {
90
90
  );
91
91
  }
92
92
 
93
- export function H5(props: EllipsisProps) {
93
+ export function H5(props: Readonly<EllipsisProps>) {
94
94
  const { ellipsis, children, className, ...others } = props;
95
95
 
96
96
  return (
@@ -108,7 +108,7 @@ export function H5(props: EllipsisProps) {
108
108
  );
109
109
  }
110
110
 
111
- export function H6(props: EllipsisProps) {
111
+ export function H6(props: Readonly<EllipsisProps>) {
112
112
  const { ellipsis, children, className, ...others } = props;
113
113
 
114
114
  return (
@@ -125,7 +125,7 @@ export function H6(props: EllipsisProps) {
125
125
  );
126
126
  }
127
127
 
128
- export function Paragraph(props: EllipsisProps) {
128
+ export function Paragraph(props: Readonly<EllipsisProps>) {
129
129
  const { ellipsis, children, className, ...others } = props;
130
130
 
131
131
  return (
@@ -142,7 +142,7 @@ export function Paragraph(props: EllipsisProps) {
142
142
  );
143
143
  }
144
144
 
145
- export function Small(props: EllipsisProps) {
145
+ export function Small(props: Readonly<EllipsisProps>) {
146
146
  const { ellipsis = false, children, className, ...others } = props;
147
147
 
148
148
  return (
@@ -159,7 +159,7 @@ export function Small(props: EllipsisProps) {
159
159
  );
160
160
  }
161
161
 
162
- export function Span(props: EllipsisProps) {
162
+ export function Span(props: Readonly<EllipsisProps>) {
163
163
  const { ellipsis = false, children, className, ...others } = props;
164
164
 
165
165
  return (
@@ -174,7 +174,7 @@ export function Span(props: EllipsisProps) {
174
174
  );
175
175
  }
176
176
 
177
- export function Tiny(props: EllipsisProps) {
177
+ export function Tiny(props: Readonly<EllipsisProps>) {
178
178
  const { ellipsis = false, children, className, ...others } = props;
179
179
 
180
180
  return (
@@ -191,7 +191,7 @@ export function Tiny(props: EllipsisProps) {
191
191
  );
192
192
  }
193
193
 
194
- export function Display(props: EllipsisProps) {
194
+ export function Display(props: Readonly<EllipsisProps>) {
195
195
  const { ellipsis, children, className, ...others } = props;
196
196
 
197
197
  return (
@@ -208,7 +208,7 @@ export function Display(props: EllipsisProps) {
208
208
  );
209
209
  }
210
210
 
211
- export function Subtitle(props: EllipsisProps) {
211
+ export function Subtitle(props: Readonly<EllipsisProps>) {
212
212
  const { ellipsis, children, className, ...others } = props;
213
213
 
214
214
  return (
@@ -31,7 +31,7 @@ interface Props extends BoxProps {
31
31
  }
32
32
  // =================================================================
33
33
 
34
- export default function AccordionHeader(props: Props) {
34
+ export default function AccordionHeader(props: Readonly<Props>) {
35
35
  const { open, children, showIcon = true, ...others } = props;
36
36
 
37
37
  return (
@@ -2,13 +2,6 @@ import type { Props } from "@evenicanpm/storefront-core/src/components-v2/catego
2
2
  import Card from "@mui/material/Card";
3
3
  import styled from "@mui/material/styles/styled";
4
4
 
5
- /*
6
- interface StyledRootProps extends React.HTMLAttributes<HTMLDivElement> {
7
- elevation: number;
8
- open?: boolean;
9
- position: "absolute" | "relative";
10
- }
11
- */
12
5
  // styled component
13
6
  export const StyledRoot = styled("div", {
14
7
  shouldForwardProp: (prop) => prop !== "position" && prop !== "open",
@@ -16,7 +16,7 @@ interface Props {
16
16
  }
17
17
  // =============================================================
18
18
 
19
- export default function CategoryListItem(props: Props) {
19
+ export default function CategoryListItem(props: Readonly<Props>) {
20
20
  const { href, title, render, caret = true, icon: Icon } = props;
21
21
 
22
22
  return (
@@ -7,16 +7,19 @@ import { type MouseEvent, useCallback, useEffect, useState } from "react";
7
7
  // STYLED COMPONENT
8
8
  const Wrapper = styled("div", {
9
9
  shouldForwardProp: (prop) => prop !== "open",
10
- })<{ open: boolean }>(({ open, theme: { direction } }) => ({
11
- cursor: "pointer",
12
- position: "relative",
13
- "& .dropdown-icon": {
14
- transition: "all 250ms ease-in-out",
15
- transform: `rotate(${
16
- open ? (direction === "rtl" ? "-90deg" : "90deg") : "0deg"
17
- })`,
18
- },
19
- }));
10
+ })<{ open: boolean }>(({ open, theme: { direction } }) => {
11
+ const rotationDegrees = direction === "rtl" ? "-90deg" : "90deg";
12
+ const rotation = open ? rotationDegrees : "0deg";
13
+
14
+ return {
15
+ cursor: "pointer",
16
+ position: "relative",
17
+ "& .dropdown-icon": {
18
+ transition: "all 250ms ease-in-out",
19
+ transform: `rotate(${rotation})`,
20
+ },
21
+ };
22
+ });
20
23
 
21
24
  type Props = {
22
25
  render: (
@@ -26,7 +29,7 @@ type Props = {
26
29
 
27
30
  // CategoryMenu is acting purely as a configuration/wiring component,
28
31
  // not as a reusable UI element that needs further extensibility.
29
- export default function CategoryMenu({ render }: Props) {
32
+ export default function CategoryMenu({ render }: Readonly<Props>) {
30
33
  const [open, setOpen] = useState(false);
31
34
 
32
35
  const onClick = (e: MouseEvent<HTMLButtonElement>) => {
@@ -37,8 +40,8 @@ export default function CategoryMenu({ render }: Props) {
37
40
  const handleDocumentClick = useCallback(() => setOpen(false), []);
38
41
 
39
42
  useEffect(() => {
40
- window.addEventListener("click", handleDocumentClick);
41
- return () => window.removeEventListener("click", handleDocumentClick);
43
+ document.addEventListener("click", handleDocumentClick);
44
+ return () => document.removeEventListener("click", handleDocumentClick);
42
45
  }, [handleDocumentClick]);
43
46
 
44
47
  return (
@@ -19,7 +19,7 @@ interface Props {
19
19
 
20
20
  // MegaMenu1 is acting purely as a configuration/wiring component,
21
21
  // not as a reusable UI element that needs further extensibility.
22
- export default function MegaMenu1({ banner, data }: Props) {
22
+ export default function MegaMenu1({ banner, data }: Readonly<Props>) {
23
23
  return (
24
24
  <ColumnList>
25
25
  <ColumnList.Wrapper>
@@ -16,7 +16,7 @@ interface Props {
16
16
 
17
17
  // MegaMenu2 is acting purely as a configuration/wiring component,
18
18
  // not as a reusable UI element that needs further extensibility.
19
- export default function MegaMenu2({ data }: Props) {
19
+ export default function MegaMenu2({ data }: Readonly<Props>) {
20
20
  return (
21
21
  <StyledRoot elevation={2}>
22
22
  {data.map((item) => (
@@ -25,7 +25,7 @@ export default function MegaMenu2({ data }: Props) {
25
25
  //icon={item.icon} // No icon information
26
26
  key={item.RecordId}
27
27
  title={item.Name ?? ""}
28
- caret={!!(item.Children && item.Children.length)}
28
+ caret={!!item?.Children?.length}
29
29
  render={
30
30
  item.Children?.length ? (
31
31
  <ColumnList minWidth={550}>
@@ -51,9 +51,9 @@ interface UserContextValue {
51
51
  isAuthenticated: boolean;
52
52
  status: string;
53
53
  menuItems: typeof MENU_ITEMS;
54
- handleLogout: () => void;
54
+ handleLogout: () => Promise<void>;
55
55
  signIn: typeof signIn;
56
- signOut: () => void;
56
+ signOut: () => Promise<void>;
57
57
  anchorEl: HTMLButtonElement | null;
58
58
  setAnchorEl: (el: HTMLButtonElement | null) => void;
59
59
  open: boolean;
@@ -147,15 +147,15 @@ const User = ({ children }: Props) => {
147
147
  // Subcomponents
148
148
  User.MobileTrigger = function MobileTrigger() {
149
149
  const ctx = useContext(UserContext);
150
+ const router = useRouter();
150
151
  if (!ctx) return null;
151
152
  const { isAuthenticated, signIn } = ctx;
152
- const router = useRouter();
153
153
  return (
154
154
  <IconButton
155
155
  aria-label="User Menu"
156
156
  onClick={() => {
157
- if (!isAuthenticated) signIn();
158
- else router.push("/account/profile");
157
+ if (isAuthenticated) router.push("/account/profile");
158
+ else signIn();
159
159
  }}
160
160
  >
161
161
  <MobileUserIcon style={{ fontSize: "1.25rem" }} />
@@ -6,7 +6,7 @@ import { setupServer } from "msw/node";
6
6
  import { NextIntlClientProvider } from "next-intl";
7
7
  import type React from "react";
8
8
  import { vi } from "vitest";
9
- import type { Cart, CartLine } from "@/schemas/cart.schema";
9
+ import type { Cart } from "@/schemas/cart.schema";
10
10
  import CartItem from "../components/cart-item";
11
11
  import cartData from "./test-cart-with-item.json";
12
12
 
@@ -36,10 +36,10 @@ describe("cart-item", () => {
36
36
  item={cart.CartLines[0]}
37
37
  isLineUpdating={false}
38
38
  closeDrawer={() => {
39
- fn;
39
+ fn();
40
40
  }}
41
- handleCartAmountChange={(cartline: CartLine) => {
42
- cartline;
41
+ handleCartAmountChange={() => {
42
+ fn();
43
43
  }}
44
44
  >
45
45
  <CartItem.ProductDetails />
@@ -57,10 +57,10 @@ describe("cart-item", () => {
57
57
  item={cart.CartLines[0]}
58
58
  isLineUpdating={false}
59
59
  closeDrawer={() => {
60
- fn;
60
+ fn();
61
61
  }}
62
- handleCartAmountChange={(cartline: CartLine) => {
63
- cartline;
62
+ handleCartAmountChange={() => {
63
+ fn();
64
64
  }}
65
65
  >
66
66
  <CartItem.QuantityControls />
@@ -80,10 +80,10 @@ describe("cart-item", () => {
80
80
  item={cart.CartLines[0]}
81
81
  isLineUpdating={true}
82
82
  closeDrawer={() => {
83
- fn;
83
+ fn();
84
84
  }}
85
- handleCartAmountChange={(cartline: CartLine) => {
86
- cartline;
85
+ handleCartAmountChange={() => {
86
+ fn();
87
87
  }}
88
88
  >
89
89
  <CartItem.QuantityControls />
@@ -103,7 +103,7 @@ describe("cart-item", () => {
103
103
  item={cart.CartLines[0]}
104
104
  isLineUpdating={false}
105
105
  closeDrawer={() => {
106
- fn;
106
+ fn();
107
107
  }}
108
108
  handleCartAmountChange={testClick}
109
109
  >
@@ -125,7 +125,7 @@ describe("cart-item", () => {
125
125
  item={cart.CartLines[0]}
126
126
  isLineUpdating={false}
127
127
  closeDrawer={() => {
128
- fn;
128
+ fn();
129
129
  }}
130
130
  handleCartAmountChange={testClick}
131
131
  >
@@ -148,7 +148,7 @@ describe("cart-item", () => {
148
148
  item={cart.CartLines[0]}
149
149
  isLineUpdating={false}
150
150
  closeDrawer={() => {
151
- fn;
151
+ fn();
152
152
  }}
153
153
  handleCartAmountChange={testClick}
154
154
  >
@@ -41,9 +41,9 @@ BottomActions.ViewCartButton = function ViewCartButton(
41
41
  props: Omit<ButtonProps, "onClick" | "children">,
42
42
  ) {
43
43
  const ctx = useContext(BottomActionsContext);
44
+ const t = useTranslations("Cart");
44
45
  if (!ctx) return null;
45
46
  const { total, handleNavigate } = ctx;
46
- const t = useTranslations("Cart");
47
47
  return (
48
48
  <Button
49
49
  fullWidth
@@ -74,9 +74,9 @@ const MiniCartItem = ({
74
74
 
75
75
  MiniCartItem.QuantityControls = () => {
76
76
  const ctx = useContext(MiniCartItemContext);
77
+ const t = useTranslations("Cart.CartLine");
77
78
  if (!ctx) return null;
78
79
  const { item, handleCartAmountChange, isLineUpdating } = ctx;
79
- const t = useTranslations("Cart.CartLine");
80
80
  const quantity = item?.Quantity || 0;
81
81
 
82
82
  if (isLineUpdating) {
@@ -173,7 +173,7 @@ MiniCartItem.ProductDetails = () => {
173
173
  </Link>
174
174
  <H6 color="grey.600" mt={0.5}>
175
175
  {item?.Product?.Dimensions?.map((d, i) => (
176
- <span key={i}>{d?.DimensionValue?.Value + " "}</span>
176
+ <span key={`dim-${i + 1}`}>{`${d?.DimensionValue?.Value} `}</span>
177
177
  ))}
178
178
  </H6>
179
179
  <Tiny color="grey.600">
@@ -188,9 +188,9 @@ MiniCartItem.ProductDetails = () => {
188
188
 
189
189
  MiniCartItem.RemoveButton = () => {
190
190
  const ctx = useContext(MiniCartItemContext);
191
+ const t = useTranslations("Cart.CartLine");
191
192
  if (!ctx) return null;
192
193
  const { item, handleCartAmountChange } = ctx;
193
- const t = useTranslations("Cart.CartLine");
194
194
  return (
195
195
  <IconButton
196
196
  size="small"
@@ -43,9 +43,9 @@ TopHeader.Heading = ({
43
43
  icon?: React.ReactNode;
44
44
  }) => {
45
45
  const ctx = useContext(TopHeaderContext);
46
+ const t = useTranslations("Cart");
46
47
  if (!ctx) return null;
47
48
  const { total } = ctx;
48
- const t = useTranslations("Cart");
49
49
 
50
50
  return (
51
51
  <FlexBox gap={1} alignItems="center" color="secondary.main">
@@ -63,9 +63,9 @@ TopHeader.CloseButton = ({
63
63
  icon?: React.ReactNode;
64
64
  }) => {
65
65
  const ctx = useContext(TopHeaderContext);
66
+ const t = useTranslations("Cart");
66
67
  if (!ctx) return null;
67
68
  const { toggle } = ctx;
68
- const t = useTranslations("Cart");
69
69
 
70
70
  return (
71
71
  <IconButton onClick={toggle} title={t("closeMiniCart")}>