@sonic-equipment/ui 0.0.46 → 0.0.48

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/config.d.ts CHANGED
@@ -3,6 +3,7 @@ interface Config {
3
3
  ALGOLIA_API_KEY: string;
4
4
  ALGOLIA_APP_ID: string;
5
5
  ALGOLIA_HOST: string;
6
+ ALGOLIA_PROXY_HOST: string;
6
7
  BFF_API_URL: string;
7
8
  SHOP_API_URL: string;
8
9
  }
package/dist/index.d.ts CHANGED
@@ -16,6 +16,7 @@ interface Config {
16
16
  ALGOLIA_API_KEY: string;
17
17
  ALGOLIA_APP_ID: string;
18
18
  ALGOLIA_HOST: string;
19
+ ALGOLIA_PROXY_HOST: string;
19
20
  BFF_API_URL: string;
20
21
  SHOP_API_URL: string;
21
22
  }
package/dist/index.js CHANGED
@@ -53,6 +53,7 @@ const configPerEnvironment = {
53
53
  ALGOLIA_API_KEY: 'e31a3a53449eceb4d0f9273b9bcd9759',
54
54
  ALGOLIA_APP_ID: '14CUFCVMAD',
55
55
  ALGOLIA_HOST: 'bff.shop.sonic-equipment.com',
56
+ ALGOLIA_PROXY_HOST: 'https://shop.sonic-equipment.com/bff',
56
57
  BFF_API_URL: 'https://bff.shop.sonic-equipment.com',
57
58
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
58
59
  SHOP_API_URL: '',
@@ -61,6 +62,7 @@ const configPerEnvironment = {
61
62
  ALGOLIA_API_KEY: 'e0edf30798a6b2e4e44fd25f0f2f9646',
62
63
  ALGOLIA_APP_ID: 'testing9VXJ0U4GSV',
63
64
  ALGOLIA_HOST: 'test-bff.shop.sonic-equipment.com',
65
+ ALGOLIA_PROXY_HOST: 'https://sonicequipment.commerce.insitesandbox.com/bff',
64
66
  BFF_API_URL: 'https://test-bff.shop.sonic-equipment.com',
65
67
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
66
68
  SHOP_API_URL: '',
@@ -1348,7 +1350,22 @@ function elementChildren(element, selector) {
1348
1350
  if (selector === void 0) {
1349
1351
  selector = '';
1350
1352
  }
1351
- return [...element.children].filter(el => el.matches(selector));
1353
+ const children = [...element.children];
1354
+ if (element instanceof HTMLSlotElement) {
1355
+ children.push(...element.assignedElements());
1356
+ }
1357
+ if (!selector) {
1358
+ return children;
1359
+ }
1360
+ return children.filter(el => el.matches(selector));
1361
+ }
1362
+ function elementIsChildOf(el, parent) {
1363
+ const isChild = parent.contains(el);
1364
+ if (!isChild && parent instanceof HTMLSlotElement) {
1365
+ const children = [...element.assignedElements()];
1366
+ return children.includes(el);
1367
+ }
1368
+ return isChild;
1352
1369
  }
1353
1370
  function showWarning(text) {
1354
1371
  try {
@@ -3857,7 +3874,7 @@ function onTouchStart(event) {
3857
3874
  }
3858
3875
  let targetEl = e.target;
3859
3876
  if (params.touchEventsTarget === 'wrapper') {
3860
- if (!swiper.wrapperEl.contains(targetEl)) return;
3877
+ if (!elementIsChildOf(targetEl, swiper.wrapperEl)) return;
3861
3878
  }
3862
3879
  if ('which' in e && e.which === 3) return;
3863
3880
  if ('button' in e && e.button > 0) return;
@@ -5926,7 +5943,7 @@ const updateOnVirtualData = swiper => {
5926
5943
  };
5927
5944
 
5928
5945
  /**
5929
- * Swiper React 11.1.5
5946
+ * Swiper React 11.1.7
5930
5947
  * Most modern mobile touch slider and framework with hardware accelerated transitions
5931
5948
  * https://swiperjs.com
5932
5949
  *
@@ -5934,7 +5951,7 @@ const updateOnVirtualData = swiper => {
5934
5951
  *
5935
5952
  * Released under the MIT License
5936
5953
  *
5937
- * Released on: July 15, 2024
5954
+ * Released on: July 24, 2024
5938
5955
  */
5939
5956
 
5940
5957
 
@@ -6339,6 +6356,7 @@ function Carousel({ breakpoints, className, hasNavigation = true, hasOverflow =
6339
6356
  const [isDragging, setIsDragging] = useState(false);
6340
6357
  function handleSlideChange(swiper) {
6341
6358
  setIsEnd(swiper.isEnd);
6359
+ setIsLocked(swiper.isLocked);
6342
6360
  setIsBeginning(swiper.isBeginning);
6343
6361
  }
6344
6362
  const showNavigation = hasNavigation && !isLocked;
@@ -6348,7 +6366,7 @@ function Carousel({ breakpoints, className, hasNavigation = true, hasOverflow =
6348
6366
  }), freeMode: {
6349
6367
  enabled: true,
6350
6368
  sticky: true,
6351
- }, modules: [freeMode], onSlideChange: swiper => handleSlideChange(swiper), onSwiper: swiper => setIsLocked(swiper.isLocked), onTouchEnd: () => setIsDragging(false), onTouchStart: () => setIsDragging(true), slidesPerView: slidesPerView, spaceBetween: spaceBetween, children: [slides.map((slide, index) => (jsx(SwiperSlide, { className: clsx(styles$t.slide, slideClasses), children: slide }, index))), showNavigation && (jsxs("div", { className: clsx(styles$t['navigation-buttons'], styles$t[navigationButtonsPosition]), children: [jsx("div", { className: clsx(styles$t['navigation-button-wrapper'], styles$t['navigation-button-prev']), children: jsx(CarouselNavigationButton, { direction: "previous", isDisabled: isBeginning }) }), jsx("div", { className: clsx(styles$t['navigation-button-wrapper'], styles$t['navigation-button-next']), children: jsx(CarouselNavigationButton, { direction: "next", isDisabled: isEnd }) })] }))] }) }));
6369
+ }, modules: [freeMode], onSwiper: swiper => setIsLocked(swiper.isLocked), onTouchEnd: () => setIsDragging(false), onTouchStart: () => setIsDragging(true), onUpdate: swiper => handleSlideChange(swiper), slidesPerView: slidesPerView, spaceBetween: spaceBetween, children: [slides.map((slide, index) => (jsx(SwiperSlide, { className: clsx(styles$t.slide, slideClasses), children: slide }, index))), showNavigation && (jsxs("div", { className: clsx(styles$t['navigation-buttons'], styles$t[navigationButtonsPosition]), children: [jsx("div", { className: clsx(styles$t['navigation-button-wrapper'], styles$t['navigation-button-prev']), children: jsx(CarouselNavigationButton, { direction: "previous", isDisabled: isBeginning }) }), jsx("div", { className: clsx(styles$t['navigation-button-wrapper'], styles$t['navigation-button-next']), children: jsx(CarouselNavigationButton, { direction: "next", isDisabled: isEnd }) })] }))] }) }));
6352
6370
  }
6353
6371
 
6354
6372
  function CategoryCarousel({ categoryCards }) {
@@ -7069,47 +7087,49 @@ function PromoCard({ alt, href, srcSet, variant }) {
7069
7087
  var styles$a = {"promos":"promo-cards-module-Dy4p3"};
7070
7088
 
7071
7089
  // TODO: Remove this and use actual data instead when backend is implemented
7072
- const tempPromoCards = [
7073
- {
7074
- alt: 'Large promo card',
7075
- href: '#',
7076
- srcSet: [
7077
- {
7078
- src: '/images/promo-cards/promo-content-block-on-sale-svp.webp',
7079
- width: 310,
7080
- },
7081
- {
7082
- src: '/images/promo-cards/promo-content-block-on-sale-mvp.webp',
7083
- width: 527,
7084
- },
7085
- {
7086
- src: '/images/promo-cards/promo-content-block-on-sale-lvp.webp',
7087
- width: 720,
7088
- },
7089
- ],
7090
- },
7091
- {
7092
- alt: 'Small promo card',
7093
- href: '#',
7094
- srcSet: [
7095
- {
7096
- src: '/images/promo-cards/promo-content-block-cross-sell-svp.png',
7097
- width: 250,
7098
- },
7099
- {
7100
- src: '/images/promo-cards/promo-content-block-cross-sell-mvp.webp',
7101
- width: 264,
7102
- },
7103
- {
7104
- src: '/images/promo-cards/promo-content-block-cross-sell-lvp.webp',
7105
- width: 480,
7106
- },
7107
- ],
7108
- },
7109
- ];
7110
- function PromoCards({ promoCardsData = tempPromoCards, }) {
7090
+ // const tempPromoCards: BannerItem[] = [
7091
+ // {
7092
+ // alt: 'Large promo card',
7093
+ // href: '#',
7094
+ // srcSet: [
7095
+ // {
7096
+ // src: '/images/promo-cards/promo-content-block-on-sale-svp.webp',
7097
+ // width: 310,
7098
+ // },
7099
+ // {
7100
+ // src: '/images/promo-cards/promo-content-block-on-sale-mvp.webp',
7101
+ // width: 527,
7102
+ // },
7103
+ // {
7104
+ // src: '/images/promo-cards/promo-content-block-on-sale-lvp.webp',
7105
+ // width: 720,
7106
+ // },
7107
+ // ],
7108
+ // },
7109
+ // {
7110
+ // alt: 'Small promo card',
7111
+ // href: '#',
7112
+ // srcSet: [
7113
+ // {
7114
+ // src: '/images/promo-cards/promo-content-block-cross-sell-svp.png',
7115
+ // width: 250,
7116
+ // },
7117
+ // {
7118
+ // src: '/images/promo-cards/promo-content-block-cross-sell-mvp.webp',
7119
+ // width: 264,
7120
+ // },
7121
+ // {
7122
+ // src: '/images/promo-cards/promo-content-block-cross-sell-lvp.webp',
7123
+ // width: 480,
7124
+ // },
7125
+ // ],
7126
+ // },
7127
+ // ]
7128
+ function PromoCards({ promoCardsData = [], }) {
7111
7129
  const { lg } = useBreakpoint();
7112
7130
  const promoCards = promoCardsData.map((promoCard, index) => (jsx(PromoCard, { alt: promoCard.alt, href: promoCard.href, srcSet: promoCard.srcSet, variant: index % 2 === 0 ? 'lg' : 'sm' }, `promo-card-${index}`)));
7131
+ if (promoCardsData.length === 0)
7132
+ return null;
7113
7133
  return (jsx("div", { className: styles$a.promos, children: lg ? (jsx(Fragment, { children: promoCards })) : (jsx(Carousel, { hasNavigation: false, hasOverflow: false, slides: promoCards, spaceBetween: 16 })) }));
7114
7134
  }
7115
7135
 
@@ -7168,7 +7188,7 @@ function ProductListingPage({ pageUrl, searchClient: _searchClient, }) {
7168
7188
  createSonicSearchClient({
7169
7189
  apiKey: config.ALGOLIA_API_KEY,
7170
7190
  appId: config.ALGOLIA_APP_ID,
7171
- host: config.ALGOLIA_HOST,
7191
+ host: config.ALGOLIA_PROXY_HOST,
7172
7192
  path: '/search',
7173
7193
  }), [_searchClient]);
7174
7194
  if (isError) {
@@ -1,4 +1,4 @@
1
1
  import { BannerItem } from 'shared/api/bff/model/bff.model';
2
2
  export declare function PromoCards({ promoCardsData, }: {
3
3
  promoCardsData?: BannerItem[];
4
- }): import("react/jsx-runtime").JSX.Element;
4
+ }): import("react/jsx-runtime").JSX.Element | null;
package/dist/styles.css CHANGED
@@ -991,7 +991,7 @@
991
991
  }
992
992
 
993
993
  /**
994
- * Swiper 11.1.5
994
+ * Swiper 11.1.7
995
995
  * Most modern mobile touch slider and framework with hardware accelerated transitions
996
996
  * https://swiperjs.com
997
997
  *
@@ -999,7 +999,7 @@
999
999
  *
1000
1000
  * Released under the MIT License
1001
1001
  *
1002
- * Released on: July 15, 2024
1002
+ * Released on: July 24, 2024
1003
1003
  */
1004
1004
 
1005
1005
  /* FONT_START */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonic-equipment/ui",
3
- "version": "0.0.46",
3
+ "version": "0.0.48",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "engines": {