@sonic-equipment/ui 0.0.119 → 120.0.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 (407) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +5 -0
  2. package/dist/_virtual/index.js +7 -0
  3. package/dist/algolia/algolia-active-categories.js +38 -0
  4. package/dist/algolia/algolia-active-filters.js +33 -0
  5. package/dist/algolia/algolia-categories-filters.js +29 -0
  6. package/dist/algolia/algolia-dummy-refinement-list-consumer.js +20 -0
  7. package/dist/algolia/algolia-filter-panel.js +42 -0
  8. package/dist/algolia/algolia-filter-panel.module.css.js +3 -0
  9. package/dist/algolia/algolia-hit-type.js +6 -0
  10. package/dist/algolia/algolia-hits-provider.js +17 -0
  11. package/dist/algolia/algolia-index-config.js +175 -0
  12. package/dist/algolia/algolia-insight-instant-search-provider.js +14 -0
  13. package/dist/algolia/algolia-insights-provider.js +18 -0
  14. package/dist/algolia/algolia-instant-search-state-provider.js +16 -0
  15. package/dist/algolia/algolia-intialization.js +26 -0
  16. package/dist/algolia/algolia-multi-select-filter-section.js +27 -0
  17. package/dist/algolia/algolia-pagination.js +18 -0
  18. package/dist/algolia/algolia-provider.js +34 -0
  19. package/dist/algolia/algolia-query-string-routing.js +106 -0
  20. package/dist/algolia/algolia-results-count.js +14 -0
  21. package/dist/algolia/algolia-search-provider.js +139 -0
  22. package/dist/algolia/algolia-searchclient-offline.js +25 -0
  23. package/dist/algolia/algolia-sonic-searchclient.js +25 -0
  24. package/dist/algolia/algolia-sort-by.js +29 -0
  25. package/dist/algolia/filter-section.js +33 -0
  26. package/dist/algolia/filter-section.module.css.js +3 -0
  27. package/dist/algolia/use-algolia-hits.js +19 -0
  28. package/dist/algolia/use-algolia-insights-provider-global-state.js +9 -0
  29. package/dist/algolia/use-algolia-insights.js +181 -0
  30. package/dist/algolia/use-algolia-instant-search-state.js +25 -0
  31. package/dist/algolia/use-algolia-search.js +41 -0
  32. package/dist/background-overlay/background-overlay.js +36 -0
  33. package/dist/background-overlay/background-overlay.module.css.js +3 -0
  34. package/dist/badges/badge/badge.js +22 -0
  35. package/dist/badges/badge/badge.module.css.js +3 -0
  36. package/dist/badges/badge/icon-with-badge/icon-with-badge.js +8 -0
  37. package/dist/badges/badge/icon-with-badge/icon-with-badge.module.css.js +3 -0
  38. package/dist/badges/tag/tag.js +10 -0
  39. package/dist/badges/tag/tag.module.css.js +3 -0
  40. package/dist/breadcrumbs/breadcrumb.js +35 -0
  41. package/dist/breadcrumbs/breadcrumb.module.css.js +3 -0
  42. package/dist/buttons/add-to-cart-button/add-to-cart-button.js +113 -0
  43. package/dist/buttons/add-to-cart-button/add-to-cart-button.module.css.js +3 -0
  44. package/dist/buttons/add-to-cart-button/connected-add-to-cart-button.js +92 -0
  45. package/dist/buttons/button/button.js +21 -0
  46. package/dist/buttons/button/button.module.css.js +3 -0
  47. package/dist/buttons/favorite/connected-favorite-button.js +64 -0
  48. package/dist/buttons/favorite/favorite-button.js +15 -0
  49. package/dist/buttons/favorite/favorite-button.module.css.js +3 -0
  50. package/dist/buttons/icon-button/icon-button.js +15 -0
  51. package/dist/buttons/icon-button/icon-button.module.css.js +3 -0
  52. package/dist/buttons/link/link.js +10 -0
  53. package/dist/buttons/link/link.module.css.js +3 -0
  54. package/dist/buttons/print-button/print-button.js +9 -0
  55. package/dist/cards/category-card/category-card.js +15 -0
  56. package/dist/cards/category-card/category-card.module.css.js +3 -0
  57. package/dist/cards/orderline-card/connected-orderline-card.js +13 -0
  58. package/dist/cards/orderline-card/connected-remove-button.js +19 -0
  59. package/dist/cards/orderline-card/orderline-card.js +17 -0
  60. package/dist/cards/orderline-card/orderline-card.module.css.js +3 -0
  61. package/dist/cards/product-card/connected-product-card.js +11 -0
  62. package/dist/cards/product-card/product-card.js +15 -0
  63. package/dist/cards/product-card/product-card.module.css.js +3 -0
  64. package/dist/carousel/card-carousel/card-carousel.js +23 -0
  65. package/dist/carousel/card-carousel/card-carousel.module.css.js +3 -0
  66. package/dist/carousel/carousel-navigation-button.js +13 -0
  67. package/dist/carousel/carousel-navigation-button.module.css.js +3 -0
  68. package/dist/carousel/carousel.js +69 -0
  69. package/dist/carousel/carousel.module.css.js +3 -0
  70. package/dist/carousel/category-carousel/category-carousel.js +9 -0
  71. package/dist/carousel/category-carousel/category-carousel.module.css.js +3 -0
  72. package/dist/carousel/pagination/pagination.js +40 -0
  73. package/dist/carousel/pagination/pagination.module.css.js +3 -0
  74. package/dist/carousel/pagination/transitions.js +144 -0
  75. package/dist/carousel/usp-carousel/product-usp-carousel-slide.js +10 -0
  76. package/dist/carousel/usp-carousel/product-usp-carousel.js +9 -0
  77. package/dist/carousel/usp-carousel/usp-carousel.js +47 -0
  78. package/dist/carousel/usp-carousel/usp-carousel.module.css.js +3 -0
  79. package/dist/cart-totals/cart-totals-summary.js +11 -0
  80. package/dist/cart-totals/cart-totals-summary.module.css.js +3 -0
  81. package/dist/cart-totals/cart-totals.js +10 -0
  82. package/dist/cart-totals/cart-totals.module.css.js +3 -0
  83. package/dist/collapsables/accordion/accordion-item.js +18 -0
  84. package/dist/collapsables/accordion/accordion.js +15 -0
  85. package/dist/collapsables/accordion/accordion.module.css.js +3 -0
  86. package/dist/collapsables/show-all/show-all.js +33 -0
  87. package/dist/collapsables/show-all/show-all.module.css.js +3 -0
  88. package/dist/config.d.ts +1 -1
  89. package/dist/config.js +82 -0
  90. package/dist/country-selector/connected-country-selector.js +37 -0
  91. package/dist/country-selector/country-selector-dialog/country-selector-dialog.js +42 -0
  92. package/dist/country-selector/country-selector-dialog/country-selector-dialog.module.css.js +3 -0
  93. package/dist/country-selector/country-selector-trigger/country-selector-trigger.js +16 -0
  94. package/dist/country-selector/country-selector-trigger/country-selector-trigger.module.css.js +3 -0
  95. package/dist/country-selector/use-countries-languages.js +72 -0
  96. package/dist/delivery-time/delivery-time.js +18 -0
  97. package/dist/delivery-time/delivery-time.module.css.js +3 -0
  98. package/dist/display/product-price/product-price.js +19 -0
  99. package/dist/display/product-price/product-price.module.css.js +3 -0
  100. package/dist/display/product-price/product-total-price.js +16 -0
  101. package/dist/display/product-price/product-total-price.module.css.js +3 -0
  102. package/dist/display/product-sku/product-sku.js +8 -0
  103. package/dist/display/product-sku/product-sku.module.css.js +3 -0
  104. package/dist/exports.d.ts +4 -4
  105. package/dist/filters/active-filters/active-filters.js +20 -0
  106. package/dist/filters/active-filters/active-filters.module.css.js +3 -0
  107. package/dist/filters/multi-select/multi-select.js +20 -0
  108. package/dist/filters/multi-select/multi-select.module.css.js +3 -0
  109. package/dist/filters/pagination/pagination.js +14 -0
  110. package/dist/filters/pagination/pagination.module.css.js +3 -0
  111. package/dist/forms/checkbox/checkbox.js +11 -0
  112. package/dist/forms/checkbox/checkbox.module.css.js +3 -0
  113. package/dist/forms/color-checkbox/color-checkbox.js +13 -0
  114. package/dist/forms/field-error/field-error.js +10 -0
  115. package/dist/forms/field-error/field-error.module.css.js +3 -0
  116. package/dist/forms/input/input.js +31 -0
  117. package/dist/forms/input/input.module.css.js +3 -0
  118. package/dist/forms/label/label.js +12 -0
  119. package/dist/forms/label/label.module.css.js +3 -0
  120. package/dist/forms/number-field/number-field.js +29 -0
  121. package/dist/forms/number-field/number-field.module.css.js +3 -0
  122. package/dist/forms/select/select.js +31 -0
  123. package/dist/forms/select/select.module.css.js +3 -0
  124. package/dist/forms/text-field/text-field.js +22 -0
  125. package/dist/forms/text-field/text-field.module.css.js +3 -0
  126. package/dist/forms/textarea/textarea.js +54 -0
  127. package/dist/forms/textarea/textarea.module.css.js +3 -0
  128. package/dist/global-search/categories-grid/categories-grid.js +14 -0
  129. package/dist/global-search/categories-grid/categories-grid.module.css.js +3 -0
  130. package/dist/global-search/global-search-provider/global-search-provider.js +15 -0
  131. package/dist/global-search/global-search-provider/use-search-disclosure.js +13 -0
  132. package/dist/global-search/global-search.js +43 -0
  133. package/dist/global-search/global-search.module.css.js +3 -0
  134. package/dist/global-search/plugins/categories-plugin.js +35 -0
  135. package/dist/global-search/plugins/popular-categories-plugin.js +32 -0
  136. package/dist/global-search/plugins/popular-searches-plugin.js +23 -0
  137. package/dist/global-search/plugins/query-suggestions-plugin.js +21 -0
  138. package/dist/global-search/plugins/quick-access-plugin.js +34 -0
  139. package/dist/global-search/plugins/recent-searches-plugin.js +16 -0
  140. package/dist/global-search/search-highlight/highlight.js +13 -0
  141. package/dist/global-search/search-input/connected-search-input.js +22 -0
  142. package/dist/global-search/search-input/search-input.js +29 -0
  143. package/dist/global-search/search-input/search-input.module.css.js +3 -0
  144. package/dist/global-search/search-result-panel/panel-content.js +13 -0
  145. package/dist/global-search/search-result-panel/search-result-panel.js +17 -0
  146. package/dist/global-search/search-result-panel/search-result-panel.module.css.js +3 -0
  147. package/dist/global-search/search-result-panel/sections/no-search-results.js +30 -0
  148. package/dist/global-search/search-result-panel/sections/no-search.js +56 -0
  149. package/dist/global-search/search-result-panel/sections/search-content.module.css.js +3 -0
  150. package/dist/global-search/search-result-panel/sections/section-container.js +8 -0
  151. package/dist/global-search/search-result-panel/sections/with-results.js +101 -0
  152. package/dist/global-search/search-section/search-list-item.js +25 -0
  153. package/dist/global-search/search-section/search-list-item.module.css.js +3 -0
  154. package/dist/global-search/search-section/search-list.js +9 -0
  155. package/dist/global-search/search-section/search-list.module.css.js +3 -0
  156. package/dist/global-search/search-section/search-section.js +9 -0
  157. package/dist/global-search/search-section/search-section.module.css.js +3 -0
  158. package/dist/header/cart-icon/connected-cart-icon.js +14 -0
  159. package/dist/icons/glyph/glyphs-arrow-boldcaps-left-icon.js +7 -0
  160. package/dist/icons/glyph/glyphs-arrow-boldcaps-right-icon.js +7 -0
  161. package/dist/icons/glyph/glyphs-arrow-semibold-right-icon.js +7 -0
  162. package/dist/icons/glyph/glyphs-chevrons-bold-down-icon.js +7 -0
  163. package/dist/icons/glyph/glyphs-chevrons-slim-down-icon.js +7 -0
  164. package/dist/icons/glyph/glyphs-chevrons-slim-left-icon.js +7 -0
  165. package/dist/icons/glyph/glyphs-chevrons-slim-right-icon.js +7 -0
  166. package/dist/icons/solid/solid-attention-icon.js +7 -0
  167. package/dist/icons/solid/solid-cart-icon.js +7 -0
  168. package/dist/icons/solid/solid-close-icon.js +7 -0
  169. package/dist/icons/solid/solid-event-icon.js +7 -0
  170. package/dist/icons/solid/solid-favorite-icon.js +7 -0
  171. package/dist/icons/solid/solid-home-icon.js +7 -0
  172. package/dist/icons/solid/solid-information-icon.js +7 -0
  173. package/dist/icons/solid/solid-news-icon.js +7 -0
  174. package/dist/icons/solid/solid-notice-icon.js +7 -0
  175. package/dist/icons/solid/solid-okay-icon.js +7 -0
  176. package/dist/icons/solid/solid-sale-icon.js +7 -0
  177. package/dist/icons/solid/solid-tag-icon.js +7 -0
  178. package/dist/icons/stroke/stroke-categories-icon.js +7 -0
  179. package/dist/icons/stroke/stroke-checkmark-icon.js +7 -0
  180. package/dist/icons/stroke/stroke-closebox-icon.js +7 -0
  181. package/dist/icons/stroke/stroke-collapse-icon.js +7 -0
  182. package/dist/icons/stroke/stroke-download-icon.js +7 -0
  183. package/dist/icons/stroke/stroke-expand-icon.js +7 -0
  184. package/dist/icons/stroke/stroke-favorite-icon.js +7 -0
  185. package/dist/icons/stroke/stroke-filter-icon.js +7 -0
  186. package/dist/icons/stroke/stroke-recent-icon.js +7 -0
  187. package/dist/icons/stroke/stroke-search-icon.js +7 -0
  188. package/dist/icons/stroke/stroke-trash-icon.js +7 -0
  189. package/dist/index.d.ts +2 -0
  190. package/dist/index.js +254 -12972
  191. package/dist/intl/formatted-message.js +6 -0
  192. package/dist/intl/intl-context.js +10 -0
  193. package/dist/intl/intl-provider.js +15 -0
  194. package/dist/intl/types.js +17 -0
  195. package/dist/intl/use-culture-code.js +14 -0
  196. package/dist/intl/use-formatted-message.js +17 -0
  197. package/dist/intl/use-language-code.js +11 -0
  198. package/dist/intl/utils.js +29 -0
  199. package/dist/lists/download-document-list/download-document-list.js +16 -0
  200. package/dist/lists/download-document-list/download-document-list.module.css.js +3 -0
  201. package/dist/lists/feature-list/feature-list.js +22 -0
  202. package/dist/lists/feature-list/feature-list.module.css.js +3 -0
  203. package/dist/lists/orderline-list/orderline-list.js +25 -0
  204. package/dist/lists/orderline-list/orderline-list.module.css.js +3 -0
  205. package/dist/lists/product-overview-grid/product-overview-grid.js +10 -0
  206. package/dist/lists/product-overview-grid/product-overview-grid.module.css.js +3 -0
  207. package/dist/lists/ul/list.js +11 -0
  208. package/dist/lists/ul/list.module.css.js +3 -0
  209. package/dist/loading/blank-page-spacer.js +8 -0
  210. package/dist/loading/blank-page-spacer.module.css.js +3 -0
  211. package/dist/loading/loading-overlay.js +9 -0
  212. package/dist/loading/loading-overlay.module.css.js +3 -0
  213. package/dist/loading/progress-circle.js +9 -0
  214. package/dist/loading/progress-circle.module.css.js +3 -0
  215. package/dist/media/image/image.js +46 -0
  216. package/dist/media/image/image.module.css.js +3 -0
  217. package/dist/media/image-grid/images-grid.js +32 -0
  218. package/dist/media/image-grid/images-grid.module.css.js +3 -0
  219. package/dist/media/image-lightbox/image-lightbox.js +35 -0
  220. package/dist/media/image-lightbox/image-lightbox.module.css.js +3 -0
  221. package/dist/media/zoom-image/zoom-image.js +33 -0
  222. package/dist/media/zoom-image/zoom-image.module.css.js +3 -0
  223. package/dist/modals/confirmation/confirmation-dialog.js +12 -0
  224. package/dist/modals/confirmation/confirmation-dialog.module.css.js +3 -0
  225. package/dist/modals/dialog/dialog.js +30 -0
  226. package/dist/modals/dialog/dialog.module.css.js +3 -0
  227. package/dist/modals/favorite/add-to-favorite-dialog.js +60 -0
  228. package/dist/modals/favorite/add-to-favorite-dialog.module.css.js +3 -0
  229. package/dist/modals/modal/modal.js +34 -0
  230. package/dist/modals/modal/modal.module.css.js +3 -0
  231. package/dist/modals/signin/sign-in-dialog.js +22 -0
  232. package/dist/modals/signin/sign-in-dialog.module.css.js +3 -0
  233. package/dist/node_modules/.pnpm/instantsearch.js@4.75.4_algoliasearch@4.24.0/node_modules/instantsearch.js/es/lib/routers/history.js +341 -0
  234. package/dist/node_modules/.pnpm/instantsearch.js@4.75.4_algoliasearch@4.24.0/node_modules/instantsearch.js/es/lib/stateMappings/simple.js +36 -0
  235. package/dist/node_modules/.pnpm/instantsearch.js@4.75.4_algoliasearch@4.24.0/node_modules/instantsearch.js/es/lib/utils/documentation.js +8 -0
  236. package/dist/node_modules/.pnpm/instantsearch.js@4.75.4_algoliasearch@4.24.0/node_modules/instantsearch.js/es/lib/utils/logger.js +32 -0
  237. package/dist/node_modules/.pnpm/instantsearch.js@4.75.4_algoliasearch@4.24.0/node_modules/instantsearch.js/es/lib/utils/noop.js +3 -0
  238. package/dist/node_modules/.pnpm/instantsearch.js@4.75.4_algoliasearch@4.24.0/node_modules/instantsearch.js/es/lib/utils/safelyRunOnBrowser.js +24 -0
  239. package/dist/node_modules/.pnpm/qs@6.9.7/node_modules/qs/lib/formats.js +33 -0
  240. package/dist/node_modules/.pnpm/qs@6.9.7/node_modules/qs/lib/index.js +25 -0
  241. package/dist/node_modules/.pnpm/qs@6.9.7/node_modules/qs/lib/parse.js +269 -0
  242. package/dist/node_modules/.pnpm/qs@6.9.7/node_modules/qs/lib/stringify.js +300 -0
  243. package/dist/node_modules/.pnpm/qs@6.9.7/node_modules/qs/lib/utils.js +264 -0
  244. package/dist/node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/modules/free-mode.js +237 -0
  245. package/dist/node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/modules/navigation.js +200 -0
  246. package/dist/node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/modules/thumbs.js +193 -0
  247. package/dist/node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/shared/create-element-if-not-defined.js +21 -0
  248. package/dist/node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/shared/ssr-window.esm.js +145 -0
  249. package/dist/node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/shared/swiper-core.js +3912 -0
  250. package/dist/node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/shared/update-on-virtual-data.js +130 -0
  251. package/dist/node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/shared/update-swiper.js +230 -0
  252. package/dist/node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/shared/utils.js +287 -0
  253. package/dist/node_modules/.pnpm/swiper@11.1.14/node_modules/swiper/swiper-react.js +389 -0
  254. package/dist/notifications/announcements/announcement-provider.js +32 -0
  255. package/dist/notifications/announcements/announcement-provider.module.css.js +3 -0
  256. package/dist/notifications/announcements/announcement.js +30 -0
  257. package/dist/notifications/announcements/announcement.module.css.js +3 -0
  258. package/dist/notifications/announcements/connected-announcement.js +27 -0
  259. package/dist/observers/intersection-observer.js +18 -0
  260. package/dist/pages/cart-page/cart-page.js +114 -0
  261. package/dist/pages/error-page/error-page.js +22 -0
  262. package/dist/pages/layouts/checkout-page-layout/checkout-page-layout.js +30 -0
  263. package/dist/pages/layouts/checkout-page-layout/checkout-page-layout.module.css.js +3 -0
  264. package/dist/pages/layouts/product-details-page-layout/product-details-page-layout.js +8 -0
  265. package/dist/pages/layouts/product-details-page-layout/product-details-page-layout.module.css.js +3 -0
  266. package/dist/pages/loading-page/loading-page.js +9 -0
  267. package/dist/pages/page/page.js +18 -0
  268. package/dist/pages/page/page.module.css.js +3 -0
  269. package/dist/pages/page-container/page-container.js +9 -0
  270. package/dist/pages/page-container/page-container.module.css.js +3 -0
  271. package/dist/pages/product-details-page/components/product-details-images/product-detail-images.js +35 -0
  272. package/dist/pages/product-details-page/components/product-details-images/product-detail-images.module.css.js +3 -0
  273. package/dist/pages/product-details-page/components/product-details-panel/product-details-panel.d.ts +3 -2
  274. package/dist/pages/product-details-page/components/product-details-panel/product-details-panel.js +35 -0
  275. package/dist/pages/product-details-page/components/product-details-panel/product-details-panel.module.css.js +3 -0
  276. package/dist/pages/product-details-page/components/product-details-recently-viewed/product-details-recently-viewed.d.ts +4 -0
  277. package/dist/pages/product-details-page/components/product-details-recently-viewed/product-details-recently-viewed.js +15 -0
  278. package/dist/pages/product-details-page/product-details-page.js +22 -0
  279. package/dist/pages/product-details-page/product-details.d.ts +6 -0
  280. package/dist/pages/product-details-page/product-details.js +25 -0
  281. package/dist/pages/product-listing-page/no-results/no-results.js +14 -0
  282. package/dist/pages/product-listing-page/no-results/no-results.module.css.js +3 -0
  283. package/dist/pages/product-listing-page/product-listing-page-category-carousel/product-listing-page-category-carousel.js +22 -0
  284. package/dist/pages/product-listing-page/product-listing-page-provider/product-listing-page-context.js +8 -0
  285. package/dist/pages/product-listing-page/product-listing-page-provider/product-listing-page-provider.js +13 -0
  286. package/dist/pages/product-listing-page/product-listing-page.js +29 -0
  287. package/dist/pages/product-listing-page/product-listing-page.module.css.js +3 -0
  288. package/dist/pages/product-listing-page/product-listing-product-overview/product-listing-product-overview.js +36 -0
  289. package/dist/pages/product-listing-page/product-listing.d.ts +6 -0
  290. package/dist/pages/product-listing-page/product-listing.js +42 -0
  291. package/dist/pages/search-result-page/search-result-product-overview/search-result-product-overview.js +38 -0
  292. package/dist/pages/search-result-page/search-results-page-category-carousel/search-results-page-category-carousel.js +22 -0
  293. package/dist/pages/search-result-page/search-results-page.js +49 -0
  294. package/dist/pages/search-result-page/search-results-page.module.css.js +3 -0
  295. package/dist/promos/promo-banner/promo-banner.js +11 -0
  296. package/dist/promos/promo-banner/promo-banner.module.css.js +3 -0
  297. package/dist/promos/promo-banners/promo-banners.js +16 -0
  298. package/dist/promos/promo-banners/promo-banners.module.css.js +3 -0
  299. package/dist/promos/promo-card/promo-card.js +11 -0
  300. package/dist/promos/promo-card/promo-card.module.css.js +3 -0
  301. package/dist/shared/api/bff/hooks/use-fetch-announcements.js +15 -0
  302. package/dist/shared/api/bff/hooks/use-fetch-product-details-page-data.js +14 -0
  303. package/dist/shared/api/bff/hooks/use-fetch-product-listing-page-data.js +14 -0
  304. package/dist/shared/api/bff/model/bff.model.d.ts +1 -1
  305. package/dist/shared/api/bff/model/bff.model.js +1 -0
  306. package/dist/shared/api/bff/services/bff-service.js +76 -0
  307. package/dist/shared/api/storefront/hooks/authentication/use-fetch-session.js +18 -0
  308. package/dist/shared/api/storefront/hooks/authentication/use-invalidate-session.js +9 -0
  309. package/dist/shared/api/storefront/hooks/authentication/use-is-authenticated.js +8 -0
  310. package/dist/shared/api/storefront/hooks/authentication/use-sign-in.js +21 -0
  311. package/dist/shared/api/storefront/hooks/authentication/use-sign-out.js +25 -0
  312. package/dist/shared/api/storefront/hooks/cart/use-add-product-to-current-cart.js +31 -0
  313. package/dist/shared/api/storefront/hooks/cart/use-delete-cart-line-by-id.js +23 -0
  314. package/dist/shared/api/storefront/hooks/cart/use-delete-current-cart.js +18 -0
  315. package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-checkout-atp.js +15 -0
  316. package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-count.js +8 -0
  317. package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-lines-with-atp.js +11 -0
  318. package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-lines.js +11 -0
  319. package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-product-atp.js +15 -0
  320. package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-promotions.js +15 -0
  321. package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-with-atp.js +26 -0
  322. package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart.js +17 -0
  323. package/dist/shared/api/storefront/hooks/cart/use-invalidate-current-cart.js +9 -0
  324. package/dist/shared/api/storefront/hooks/cart/use-patch-cart.js +15 -0
  325. package/dist/shared/api/storefront/hooks/cart/use-place-order.js +15 -0
  326. package/dist/shared/api/storefront/hooks/cart/use-save-cart-for-later.js +17 -0
  327. package/dist/shared/api/storefront/hooks/cart/use-update-cart-line-by-id.js +30 -0
  328. package/dist/shared/api/storefront/hooks/translation/use-fetch-translations.js +15 -0
  329. package/dist/shared/api/storefront/hooks/website/use-fetch-countries-languages.js +15 -0
  330. package/dist/shared/api/storefront/hooks/website/use-fetch-countries-with-languages.js +15 -0
  331. package/dist/shared/api/storefront/hooks/website/use-fetch-countries.js +14 -0
  332. package/dist/shared/api/storefront/hooks/website/use-fetch-settings.js +18 -0
  333. package/dist/shared/api/storefront/hooks/website/use-update-locale.js +11 -0
  334. package/dist/shared/api/storefront/hooks/wishlist/use-add-wishlist-item-to-current-wishlist.js +34 -0
  335. package/dist/shared/api/storefront/hooks/wishlist/use-add-wishlist-item-to-wishlist.js +33 -0
  336. package/dist/shared/api/storefront/hooks/wishlist/use-create-wishlist.js +17 -0
  337. package/dist/shared/api/storefront/hooks/wishlist/use-delete-wishlist-item-from-wishlist.js +21 -0
  338. package/dist/shared/api/storefront/hooks/wishlist/use-fetch-all-wishlists-items.js +36 -0
  339. package/dist/shared/api/storefront/hooks/wishlist/use-fetch-wishlists.js +14 -0
  340. package/dist/shared/api/storefront/model/shop.model.js +42 -0
  341. package/dist/shared/api/storefront/services/authentication-service.js +80 -0
  342. package/dist/shared/api/storefront/services/cart-service.js +128 -0
  343. package/dist/shared/api/storefront/services/translation-service.js +16 -0
  344. package/dist/shared/api/storefront/services/website-service.js +83 -0
  345. package/dist/shared/api/storefront/services/wishlist-service.js +72 -0
  346. package/dist/shared/feature-flags/use-feature-flags.js +45 -0
  347. package/dist/shared/fetch/request.d.ts +5 -0
  348. package/dist/shared/fetch/request.js +263 -0
  349. package/dist/shared/hooks/use-breakpoint.js +24 -0
  350. package/dist/shared/hooks/use-cookie.js +27 -0
  351. package/dist/shared/hooks/use-debounced-callback.js +18 -0
  352. package/dist/shared/hooks/use-disclosure.js +24 -0
  353. package/dist/shared/hooks/use-enable-mobile-zoom.js +36 -0
  354. package/dist/shared/hooks/use-intersection-observer.js +66 -0
  355. package/dist/shared/hooks/use-is-breakpoint.js +19 -0
  356. package/dist/shared/hooks/use-local-storage.js +19 -0
  357. package/dist/shared/hooks/use-resize-observer.d.ts +2 -2
  358. package/dist/shared/hooks/use-resize-observer.js +30 -0
  359. package/dist/shared/hooks/use-scroll-lock.js +11 -0
  360. package/dist/shared/hooks/use-scroll-to.js +19 -0
  361. package/dist/shared/hooks/use-session-storage.js +19 -0
  362. package/dist/shared/hooks/use-watch-css-property.d.ts +1 -0
  363. package/dist/shared/hooks/use-watch-css-property.js +29 -0
  364. package/dist/shared/model/announcement.js +18 -0
  365. package/dist/shared/model/category.js +25 -0
  366. package/dist/shared/model/currency.js +29 -0
  367. package/dist/shared/model/hit.js +45 -0
  368. package/dist/shared/model/image.js +5 -0
  369. package/dist/shared/providers/cart-provider.js +13 -0
  370. package/dist/shared/providers/favorite-provider.js +33 -0
  371. package/dist/shared/providers/global-state-provider.js +83 -0
  372. package/dist/shared/providers/react-query-container.js +20 -0
  373. package/dist/shared/routing/route-button.js +7 -0
  374. package/dist/shared/routing/route-icon-button.js +7 -0
  375. package/dist/shared/routing/route-link.js +7 -0
  376. package/dist/shared/routing/route-provider.d.ts +3 -1
  377. package/dist/shared/routing/route-provider.js +48 -0
  378. package/dist/shared/routing/with-routing.js +36 -0
  379. package/dist/shared/utils/array.js +5 -0
  380. package/dist/shared/utils/breakpoints.js +33 -0
  381. package/dist/shared/utils/date.js +58 -0
  382. package/dist/shared/utils/environment.d.ts +2 -2
  383. package/dist/shared/utils/environment.js +61 -0
  384. package/dist/shared/utils/event-emitter.js +34 -0
  385. package/dist/shared/utils/local-storage.js +108 -0
  386. package/dist/shared/utils/merge.js +70 -0
  387. package/dist/shared/utils/price.js +6 -0
  388. package/dist/shared/utils/time.js +9 -0
  389. package/dist/shared/utils/uuid.js +15 -0
  390. package/dist/shared/utils/wait.js +5 -0
  391. package/dist/sidebar/sidebar-provider.js +46 -0
  392. package/dist/sidebar/sidebar-provider.module.css.js +3 -0
  393. package/dist/sidebar/sidebar.js +23 -0
  394. package/dist/sidebar/sidebar.module.css.js +3 -0
  395. package/dist/sidebar/toggle-sidebar-button.js +13 -0
  396. package/dist/sidebar/use-sidebar.js +38 -0
  397. package/dist/styles.css +5 -16
  398. package/dist/toast/toast-provider.js +9 -0
  399. package/dist/toast/toast-provider.module.css.js +3 -0
  400. package/dist/toast/toast.js +24 -0
  401. package/dist/toast/toast.module.css.js +3 -0
  402. package/dist/toast/use-toast.js +21 -0
  403. package/dist/tokens/tokens.js +8 -0
  404. package/dist/typography/heading/heading.js +27 -0
  405. package/dist/typography/heading/heading.module.css.js +3 -0
  406. package/package.json +3 -2
  407. package/dist/pages/product-listing-page/product-listing-page-provider/use-subcategories.d.ts +0 -4
@@ -53,9 +53,14 @@ type RequestHeadersWithBody = RequestHeaders & {
53
53
  'Content-Type': string;
54
54
  };
55
55
  interface BaseRequestOptions {
56
+ cache?: RequestCache;
56
57
  credentials?: RequestCredentials;
57
58
  headers?: RequestHeaders;
58
59
  method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
60
+ next?: {
61
+ revalidate?: number | false;
62
+ tags?: string[];
63
+ };
59
64
  params?: Record<string, any>;
60
65
  timeout?: number;
61
66
  url: string;
@@ -0,0 +1,263 @@
1
+ import qs from 'query-string';
2
+
3
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
+ const isResponse = (response) => Boolean(response?.json);
5
+ class RequestError extends Error {
6
+ constructor(
7
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
+ responseOrError, options, status, statusText) {
9
+ super(isResponse(responseOrError)
10
+ ? `${responseOrError.status || status || -1}: ${responseOrError.statusText || statusText}`
11
+ : responseOrError?.message || responseOrError, {
12
+ cause: responseOrError,
13
+ });
14
+ Object.defineProperty(this, "isRequestError", {
15
+ enumerable: true,
16
+ configurable: true,
17
+ writable: true,
18
+ value: true
19
+ });
20
+ Object.defineProperty(this, "status", {
21
+ enumerable: true,
22
+ configurable: true,
23
+ writable: true,
24
+ value: -1
25
+ });
26
+ Object.defineProperty(this, "statusText", {
27
+ enumerable: true,
28
+ configurable: true,
29
+ writable: true,
30
+ value: void 0
31
+ });
32
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
+ Object.defineProperty(this, "body", {
34
+ enumerable: true,
35
+ configurable: true,
36
+ writable: true,
37
+ value: void 0
38
+ });
39
+ Object.defineProperty(this, "context", {
40
+ enumerable: true,
41
+ configurable: true,
42
+ writable: true,
43
+ value: void 0
44
+ });
45
+ Object.defineProperty(this, "options", {
46
+ enumerable: true,
47
+ configurable: true,
48
+ writable: true,
49
+ value: void 0
50
+ });
51
+ if (isResponse(responseOrError)) {
52
+ this.status = responseOrError.status || status || -1;
53
+ this.statusText = responseOrError.statusText || statusText;
54
+ }
55
+ else {
56
+ this.status = -1;
57
+ }
58
+ this.context = options?.context;
59
+ this.body = options?.body;
60
+ this.options = options?.options;
61
+ // eslint-disable-next-line unicorn/custom-error-definition
62
+ this.name = this.name || this.constructor.name || 'RequestError';
63
+ }
64
+ toJSON() {
65
+ return {
66
+ context: this.context,
67
+ error: {
68
+ message: this.message,
69
+ stack: this.stack,
70
+ },
71
+ isRequestError: this.isRequestError,
72
+ request: {
73
+ ...this.options,
74
+ },
75
+ response: {
76
+ body: this.body,
77
+ status: this.status,
78
+ statusText: this.statusText,
79
+ },
80
+ };
81
+ }
82
+ }
83
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
84
+ const isRequestError = (error) => Boolean(error?.isRequestError);
85
+ class BadRequestError extends RequestError {
86
+ constructor(responseOrError, options) {
87
+ super(responseOrError, options, 400, 'bad request');
88
+ this.name = 'BadRequestError';
89
+ }
90
+ }
91
+ class UnauthorizedRequestError extends RequestError {
92
+ constructor(responseOrError, options) {
93
+ super(responseOrError, options, 401, 'unauthorized');
94
+ this.name = 'UnauthorizedRequestError';
95
+ }
96
+ }
97
+ class ForbiddenRequestError extends RequestError {
98
+ constructor(responseOrError, options) {
99
+ super(responseOrError, options, 403, 'forbidden');
100
+ this.name = 'ForbiddenRequestError';
101
+ }
102
+ }
103
+ class NotFoundRequestError extends RequestError {
104
+ constructor(responseOrError, options) {
105
+ super(responseOrError, options, 404, 'not found');
106
+ this.name = 'NotFoundRequestError';
107
+ }
108
+ }
109
+ class MethodNotAllowedRequestError extends RequestError {
110
+ constructor(responseOrError, options) {
111
+ super(responseOrError, options, 405, 'method not allowed');
112
+ this.name = 'MethodNotAllowedRequestError';
113
+ }
114
+ }
115
+ class UnprocessableContentRequestError extends RequestError {
116
+ constructor(responseOrError, options) {
117
+ super(responseOrError, options, 422, 'unprocessable content');
118
+ this.name = 'UnprocessableContentRequestError';
119
+ }
120
+ }
121
+ class TimeoutRequestError extends RequestError {
122
+ constructor(responseOrError, options) {
123
+ super(responseOrError, options, -1, `timeout occured after ${options?.options?.timeout || 'unknown'}ms`);
124
+ this.name = 'TimeoutRequestError';
125
+ }
126
+ }
127
+ class InternalServerErrorRequestError extends RequestError {
128
+ constructor(responseOrError, options) {
129
+ super(responseOrError, options, 500, 'internal server error');
130
+ this.name = 'InternalServerErrorRequestError';
131
+ }
132
+ }
133
+ const createRequestError = (
134
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
135
+ responseOrError, options, flags) => {
136
+ if (isResponse(responseOrError)) {
137
+ switch (responseOrError.status) {
138
+ case 400:
139
+ return new BadRequestError(responseOrError, options);
140
+ case 401:
141
+ return new UnauthorizedRequestError(responseOrError, options);
142
+ case 403:
143
+ return new ForbiddenRequestError(responseOrError, options);
144
+ case 404:
145
+ return new NotFoundRequestError(responseOrError, options);
146
+ case 405:
147
+ return new MethodNotAllowedRequestError(responseOrError, options);
148
+ case 422:
149
+ return new UnprocessableContentRequestError(responseOrError, options);
150
+ case 500:
151
+ return new InternalServerErrorRequestError(responseOrError, options);
152
+ default:
153
+ return new RequestError(responseOrError, options);
154
+ }
155
+ }
156
+ else if (isRequestError(responseOrError)) {
157
+ return options
158
+ ? new RequestError(responseOrError, options)
159
+ : responseOrError;
160
+ }
161
+ else {
162
+ if (flags?.isTimeout) {
163
+ throw new TimeoutRequestError(new Error(`timeout occured after ${options?.options?.timeout || 'unknown'}ms`), options);
164
+ }
165
+ return new RequestError(responseOrError, options);
166
+ }
167
+ };
168
+ const isJsonBody = (options) => Boolean(options.headers?.['content-type']?.match(/json/i) ||
169
+ (options.body && typeof options.body === 'object'));
170
+ const isFormData = (body) => body instanceof FormData;
171
+ const createBody = (options) => {
172
+ const { body, method, url } = options;
173
+ if (!body || method === 'GET' || method === 'HEAD')
174
+ return undefined;
175
+ if (typeof body === 'string')
176
+ return body;
177
+ if (isFormData(body))
178
+ return body;
179
+ if (isJsonBody(options))
180
+ return JSON.stringify(body);
181
+ throw new Error(`request: Unknown body type for request ${url}. Unable to send request.`);
182
+ };
183
+ const createHeaders = (...headers) => {
184
+ const allHeaders = {};
185
+ for (const header of headers) {
186
+ if (!header)
187
+ continue;
188
+ for (const key of Object.keys(header)) {
189
+ if (header[key])
190
+ allHeaders[key] = header[key];
191
+ }
192
+ }
193
+ return allHeaders;
194
+ };
195
+ /* Because of a bug in the rollup dts package the following code must be put inside of a IIFE.
196
+ * The bug occurs when assigning properties to the request function at the top level of this file.
197
+ * request.headers = {}
198
+ * TODO: Remove the DTS dependency
199
+ */
200
+ const request = (function createRequestFunction() {
201
+ const request = async (options) => {
202
+ let response;
203
+ let body;
204
+ let error;
205
+ let isTimeout = false;
206
+ try {
207
+ options = request._beforeHandlers.reduce((options, handler) => handler(options) || options, options);
208
+ options.timeout = options.timeout || 1000 * 60 * 2;
209
+ const url = qs.stringifyUrl({ query: options.params, url: options.url });
210
+ const controller = new AbortController();
211
+ const id = options.timeout
212
+ ? setTimeout(() => {
213
+ isTimeout = true;
214
+ controller.abort();
215
+ }, options.timeout)
216
+ : -1;
217
+ response = await fetch(url, {
218
+ body: createBody(options),
219
+ cache: options.cache,
220
+ credentials: 'include',
221
+ // 'include' sends cookies and HTTP authentication to the server
222
+ headers: createHeaders(request.headers, options.headers),
223
+ method: options.method || 'GET',
224
+ // @ts-expect-error - TS doesn't know about the next options
225
+ next: options.next,
226
+ signal: controller.signal,
227
+ });
228
+ clearTimeout(id);
229
+ const contentType = response.headers.get('content-type');
230
+ body = contentType?.includes('json')
231
+ ? (await response.json())
232
+ : (await response.text());
233
+ if (!response.ok)
234
+ throw response;
235
+ const result = {
236
+ body,
237
+ headers: response.headers,
238
+ status: response.status,
239
+ statusText: response.statusText,
240
+ };
241
+ return result;
242
+ }
243
+ catch (err) {
244
+ error = createRequestError(err, { body, options }, { isTimeout });
245
+ throw error;
246
+ }
247
+ finally {
248
+ request._afterHandlers.forEach(handler => handler({ body, error, options, response }));
249
+ }
250
+ };
251
+ request.headers = {};
252
+ request._afterHandlers = [];
253
+ request._beforeHandlers = [];
254
+ request.after = (handler) => {
255
+ request._afterHandlers.push(handler);
256
+ };
257
+ request.before = (handler) => {
258
+ request._beforeHandlers.push(handler);
259
+ };
260
+ return request;
261
+ })();
262
+
263
+ export { BadRequestError, ForbiddenRequestError, InternalServerErrorRequestError, NotFoundRequestError, RequestError, TimeoutRequestError, UnauthorizedRequestError, UnprocessableContentRequestError, isRequestError, request };
@@ -0,0 +1,24 @@
1
+ import { useState, useCallback, useEffect } from 'react';
2
+ import { getCurrentBreakpoints } from '../utils/breakpoints.js';
3
+
4
+ const useBreakpoint = () => {
5
+ const [device, setDevice] = useState(getCurrentBreakpoints());
6
+ const handleResize = useCallback(() => {
7
+ const breakpoints = getCurrentBreakpoints();
8
+ setDevice(previousBreakpoints => {
9
+ if (previousBreakpoints.current === breakpoints.current)
10
+ return previousBreakpoints;
11
+ return breakpoints;
12
+ });
13
+ }, []);
14
+ useEffect(() => {
15
+ if (typeof window === 'undefined')
16
+ return;
17
+ handleResize();
18
+ window.addEventListener('resize', handleResize);
19
+ return () => window?.removeEventListener('resize', handleResize);
20
+ }, [handleResize]);
21
+ return device;
22
+ };
23
+
24
+ export { useBreakpoint };
@@ -0,0 +1,27 @@
1
+ import { useState, useEffect } from 'react';
2
+ import Cookies from 'js-cookie';
3
+
4
+ function useCookie(name, options) {
5
+ const cookieValue = Cookies.get()[name];
6
+ const [stateValue, setStateValue] = useState(cookieValue);
7
+ useEffect(() => {
8
+ if (cookieValue === stateValue)
9
+ return;
10
+ setStateValue(cookieValue);
11
+ }, [cookieValue, stateValue]);
12
+ function setValue(valueOrFn) {
13
+ setStateValue(oldValue => {
14
+ const newValue = typeof valueOrFn === 'function' ? valueOrFn(oldValue) : valueOrFn;
15
+ if (newValue) {
16
+ Cookies.set(name, newValue, options);
17
+ }
18
+ else {
19
+ Cookies.remove(name);
20
+ }
21
+ return newValue;
22
+ });
23
+ }
24
+ return [stateValue, setValue];
25
+ }
26
+
27
+ export { useCookie };
@@ -0,0 +1,18 @@
1
+ import { useRef, useCallback } from 'react';
2
+
3
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
+ function useDebouncedCallback(func, delay) {
5
+ const timeoutId = useRef();
6
+ return useCallback(function debounced(...args) {
7
+ return new Promise(resolve => {
8
+ if (typeof window === 'undefined')
9
+ return resolve(func(...args));
10
+ clearTimeout(timeoutId.current);
11
+ timeoutId.current = setTimeout(() => {
12
+ resolve(func(...args));
13
+ }, delay);
14
+ });
15
+ }, [delay, func]);
16
+ }
17
+
18
+ export { useDebouncedCallback };
@@ -0,0 +1,24 @@
1
+ import { useState, useCallback } from 'react';
2
+
3
+ const useDisclosure = (initialState = false) => {
4
+ const [isOpen, setIsOpen] = useState(initialState);
5
+ const open = useCallback(() => {
6
+ setIsOpen(true);
7
+ }, []);
8
+ const close = useCallback(() => {
9
+ setIsOpen(false);
10
+ }, []);
11
+ const toggle = useCallback(() => {
12
+ setIsOpen(prevIsOpen => !prevIsOpen);
13
+ }, []);
14
+ return {
15
+ close,
16
+ isClosed: !isOpen,
17
+ isOpen,
18
+ open,
19
+ setIsOpen,
20
+ toggle,
21
+ };
22
+ };
23
+
24
+ export { useDisclosure };
@@ -0,0 +1,36 @@
1
+ import { useRef, useEffect } from 'react';
2
+
3
+ function useEnableMobileZoom({ isEnabled }) {
4
+ const metaRef = useRef(null);
5
+ useEffect(() => {
6
+ if (typeof document === 'undefined')
7
+ return;
8
+ const meta = document.querySelector('meta[name="viewport"]');
9
+ if (meta) {
10
+ metaRef.current = meta.outerHTML;
11
+ }
12
+ return () => {
13
+ if (typeof document === 'undefined' || !metaRef.current)
14
+ return;
15
+ const meta = document.querySelector('meta[name="viewport"]');
16
+ if (meta) {
17
+ meta.outerHTML = metaRef.current;
18
+ }
19
+ else {
20
+ document.head.outerHTML += metaRef.current;
21
+ }
22
+ };
23
+ }, []);
24
+ useEffect(() => {
25
+ if (typeof document === 'undefined' || !metaRef.current)
26
+ return;
27
+ const meta = document.querySelector('meta[name="viewport"]');
28
+ if (!meta)
29
+ return;
30
+ meta.outerHTML = isEnabled
31
+ ? '<meta name="viewport" content="width=device-width, initial-scale=1" />'
32
+ : metaRef.current;
33
+ }, [isEnabled]);
34
+ }
35
+
36
+ export { useEnableMobileZoom };
@@ -0,0 +1,66 @@
1
+ import { useState, useRef, useEffect } from 'react';
2
+
3
+ function useIntersectionObserver({ isDisabled, observables, onIntersectingChange, }) {
4
+ const [isIntersecting, setIntersecting] = useState(false);
5
+ const state = useRef([]);
6
+ function disconnectObservers() {
7
+ state.current.forEach(entry => entry.observer.disconnect());
8
+ state.current = [];
9
+ }
10
+ function createObserverEntry(observable) {
11
+ if (typeof IntersectionObserver === 'undefined' || !observable.ref.current)
12
+ return;
13
+ const result = {
14
+ isIntersecting: false,
15
+ observable,
16
+ observer: new IntersectionObserver(entries => {
17
+ result.isIntersecting = entries.some(entry => entry.isIntersecting);
18
+ const isCurrentlyAnyIntersecting = state.current.some(entry => entry.isIntersecting);
19
+ setIntersecting(isCurrentlyAnyIntersecting);
20
+ if (isCurrentlyAnyIntersecting !== isIntersecting) {
21
+ onIntersectingChange?.(isCurrentlyAnyIntersecting);
22
+ }
23
+ }, {
24
+ rootMargin: '0px',
25
+ threshold: 0,
26
+ ...observable.options,
27
+ }),
28
+ };
29
+ result.observer.observe(observable.ref.current);
30
+ return result;
31
+ }
32
+ useEffect(() => {
33
+ if (isDisabled)
34
+ return disconnectObservers();
35
+ if (state.current.length === 0) {
36
+ if (observables.length === 0)
37
+ return;
38
+ state.current = observables.map(createObserverEntry).filter(Boolean);
39
+ }
40
+ else {
41
+ // Find all new observables
42
+ observables.forEach(observable => {
43
+ if (!state.current.some(entry => entry.observable === observable)) {
44
+ const entry = createObserverEntry(observable);
45
+ if (entry)
46
+ state.current.push(entry);
47
+ }
48
+ });
49
+ // Find all removed observables
50
+ const removedEntries = state.current.find(entry => {
51
+ return !observables.includes(entry.observable);
52
+ });
53
+ removedEntries?.observer.disconnect();
54
+ state.current = state.current.filter(entry => {
55
+ return observables.includes(entry.observable);
56
+ });
57
+ }
58
+ return () => {
59
+ disconnectObservers();
60
+ };
61
+ // eslint-disable-next-line react-hooks/exhaustive-deps
62
+ }, [observables, isDisabled]);
63
+ return { isIntersecting };
64
+ }
65
+
66
+ export { useIntersectionObserver };
@@ -0,0 +1,19 @@
1
+ import { useCallback, useState, useEffect } from 'react';
2
+ import { getCurrentBreakpoints } from '../utils/breakpoints.js';
3
+
4
+ function useIsBreakpoint(breakpoint) {
5
+ const checkIsMatch = useCallback(() => getCurrentBreakpoints()[breakpoint], [breakpoint]);
6
+ const [isMatch, setIsMatch] = useState(checkIsMatch());
7
+ const handleResize = useCallback(() => setIsMatch(checkIsMatch()), [checkIsMatch]);
8
+ useEffect(() => {
9
+ if (typeof window === 'undefined')
10
+ return;
11
+ window.addEventListener('resize', handleResize);
12
+ return () => {
13
+ window?.removeEventListener('resize', handleResize);
14
+ };
15
+ }, [handleResize]);
16
+ return isMatch;
17
+ }
18
+
19
+ export { useIsBreakpoint };
@@ -0,0 +1,19 @@
1
+ import { useState } from 'react';
2
+
3
+ function useLocalStorage(key, initialState) {
4
+ const storedValue = localStorage?.getItem(key);
5
+ const [internalValue, setInternalValue] = useState(storedValue ? JSON.parse(storedValue) : initialState);
6
+ function setValue(value) {
7
+ const valueToStore = value instanceof Function ? value(internalValue) : value;
8
+ if (valueToStore === undefined) {
9
+ localStorage?.removeItem(key);
10
+ }
11
+ else {
12
+ setInternalValue(valueToStore);
13
+ localStorage?.setItem(key, JSON.stringify(valueToStore));
14
+ }
15
+ }
16
+ return [internalValue, setValue];
17
+ }
18
+
19
+ export { useLocalStorage };
@@ -1,4 +1,4 @@
1
- export declare function useResizeObserver(resizeCallback: (target: Element, size: DOMRectReadOnly, position: DOMRectReadOnly | undefined) => void): {
2
- ref: <T extends HTMLElement>(el: T | null) => void;
1
+ export declare function useResizeObserver<T extends HTMLElement>(resizeCallback: (target: T, size: DOMRectReadOnly, position: DOMRectReadOnly | undefined) => void): {
2
+ ref: (el: T | null) => void;
3
3
  size: DOMRectReadOnly | undefined;
4
4
  };
@@ -0,0 +1,30 @@
1
+ import { useRef } from 'react';
2
+
3
+ function useResizeObserver(resizeCallback) {
4
+ let size;
5
+ function onResize(entries, _observer) {
6
+ const entry = entries[0];
7
+ const position = entry?.target.getClientRects()[0];
8
+ size = entry?.contentRect;
9
+ const target = entry?.target;
10
+ if (!size || !target)
11
+ return;
12
+ resizeCallback(target, size, position);
13
+ }
14
+ const resizeObserver = useRef(typeof ResizeObserver === 'undefined'
15
+ ? undefined
16
+ : new ResizeObserver(onResize));
17
+ const ref = useRef(null);
18
+ return {
19
+ ref: (el) => {
20
+ ref.current = el;
21
+ resizeObserver.current?.disconnect();
22
+ if (!ref.current)
23
+ return;
24
+ resizeObserver.current?.observe(ref.current);
25
+ },
26
+ size,
27
+ };
28
+ }
29
+
30
+ export { useResizeObserver };
@@ -0,0 +1,11 @@
1
+ import { useEffect } from 'react';
2
+
3
+ const useScrollLock = (lock) => {
4
+ useEffect(() => {
5
+ if (typeof document === 'undefined')
6
+ return;
7
+ document.body.style.overflow = lock ? 'hidden' : 'auto';
8
+ }, [lock]);
9
+ };
10
+
11
+ export { useScrollLock };
@@ -0,0 +1,19 @@
1
+ const scrollToTop = (scrollOptions) => {
2
+ window?.scrollTo({
3
+ behavior: scrollOptions?.behavior || 'smooth',
4
+ top: 0,
5
+ });
6
+ };
7
+ const useScrollTo = (ref, scrollOptions) => () => {
8
+ if (!ref.current)
9
+ return;
10
+ const rect = ref.current.getBoundingClientRect();
11
+ const scrollPadding = scrollOptions?.scrollPadding || 12;
12
+ const scrollY = (window?.scrollY || 0) + rect.top - scrollPadding;
13
+ window?.scrollTo({
14
+ behavior: scrollOptions?.behavior || 'smooth',
15
+ top: scrollY,
16
+ });
17
+ };
18
+
19
+ export { scrollToTop, useScrollTo };
@@ -0,0 +1,19 @@
1
+ import { useState } from 'react';
2
+
3
+ function useSessionStorage(key, initialState) {
4
+ const storedValue = sessionStorage?.getItem(key);
5
+ const [internalValue, setInternalValue] = useState(storedValue ? JSON.parse(storedValue) : initialState);
6
+ function setValue(value) {
7
+ const valueToStore = value instanceof Function ? value(internalValue) : value;
8
+ if (valueToStore === undefined) {
9
+ sessionStorage?.removeItem(key);
10
+ }
11
+ else {
12
+ setInternalValue(valueToStore);
13
+ sessionStorage?.setItem(key, JSON.stringify(valueToStore));
14
+ }
15
+ }
16
+ return [internalValue, setValue];
17
+ }
18
+
19
+ export { useSessionStorage };
@@ -0,0 +1 @@
1
+ export declare function useWatchCssProperty(property: string): string | undefined;
@@ -0,0 +1,29 @@
1
+ import { useState, useEffect } from 'react';
2
+
3
+ function useWatchCssProperty(property) {
4
+ const [value, setValue] = useState(document?.body
5
+ ? getComputedStyle?.(document.body).getPropertyValue(property)
6
+ : undefined);
7
+ useEffect(() => {
8
+ if (typeof MutationObserver === 'undefined' ||
9
+ typeof document === 'undefined')
10
+ return;
11
+ const mutationObserver = new MutationObserver(() => {
12
+ if (typeof document === 'undefined')
13
+ return;
14
+ const propertyValue = getComputedStyle?.(document.body).getPropertyValue(property);
15
+ setValue(propertyValue);
16
+ });
17
+ mutationObserver.observe(document.body, {
18
+ attributes: true,
19
+ childList: false,
20
+ subtree: true,
21
+ });
22
+ return () => {
23
+ mutationObserver.disconnect();
24
+ };
25
+ }, [property]);
26
+ return value;
27
+ }
28
+
29
+ export { useWatchCssProperty };
@@ -0,0 +1,18 @@
1
+ const announcementTypes = ['promo', 'service'];
2
+ const announcementSubTypes = [
3
+ 'sales',
4
+ 'news',
5
+ 'critical',
6
+ 'informative',
7
+ 'notice',
8
+ 'event',
9
+ 'new_product_introduction',
10
+ ];
11
+ function isAnnouncementType(type) {
12
+ return announcementTypes.includes(type);
13
+ }
14
+ function isAnnouncementSubtype(subtype) {
15
+ return announcementSubTypes.includes(subtype);
16
+ }
17
+
18
+ export { announcementSubTypes, announcementTypes, isAnnouncementSubtype, isAnnouncementType };