@se-faststore/components 0.0.0-stage → 0.12.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 (514) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +129 -2
  3. package/dist/b2b/SeActionHubBulletinBoard/index.d.ts +2 -0
  4. package/dist/b2b/SeActionHubBulletinBoard/index.d.ts.map +1 -0
  5. package/dist/b2b/SeActionHubBulletinBoard/index.js +18 -0
  6. package/dist/b2b/SeActionHubBulletinBoard/index.js.map +1 -0
  7. package/dist/b2b/SeActionHubBulletinBoard/types.d.ts +24 -0
  8. package/dist/b2b/SeActionHubBulletinBoard/types.d.ts.map +1 -0
  9. package/dist/b2b/SeActionHubBulletinBoard/types.js +3 -0
  10. package/dist/b2b/SeActionHubBulletinBoard/types.js.map +1 -0
  11. package/dist/b2b/SeAddToPurchaseList/addToPurchaseListUtils.d.ts +24 -0
  12. package/dist/b2b/SeAddToPurchaseList/addToPurchaseListUtils.d.ts.map +1 -0
  13. package/dist/b2b/SeAddToPurchaseList/addToPurchaseListUtils.js +28 -0
  14. package/dist/b2b/SeAddToPurchaseList/addToPurchaseListUtils.js.map +1 -0
  15. package/dist/b2b/SeAddToPurchaseList/index.d.ts +3 -0
  16. package/dist/b2b/SeAddToPurchaseList/index.d.ts.map +1 -0
  17. package/dist/b2b/SeAddToPurchaseList/index.js +19 -0
  18. package/dist/b2b/SeAddToPurchaseList/index.js.map +1 -0
  19. package/dist/b2b/SeAddToPurchaseList/useAddToPurchaseList.d.ts +29 -0
  20. package/dist/b2b/SeAddToPurchaseList/useAddToPurchaseList.d.ts.map +1 -0
  21. package/dist/b2b/SeAddToPurchaseList/useAddToPurchaseList.js +86 -0
  22. package/dist/b2b/SeAddToPurchaseList/useAddToPurchaseList.js.map +1 -0
  23. package/dist/b2b/SeAddressSelector/index.d.ts +2 -0
  24. package/dist/b2b/SeAddressSelector/index.d.ts.map +1 -0
  25. package/dist/b2b/SeAddressSelector/index.js +18 -0
  26. package/dist/b2b/SeAddressSelector/index.js.map +1 -0
  27. package/dist/b2b/SeAddressSelector/useAddressSelector.d.ts +34 -0
  28. package/dist/b2b/SeAddressSelector/useAddressSelector.d.ts.map +1 -0
  29. package/dist/b2b/SeAddressSelector/useAddressSelector.js +127 -0
  30. package/dist/b2b/SeAddressSelector/useAddressSelector.js.map +1 -0
  31. package/dist/b2b/SeCategoryBanners/index.d.ts +2 -0
  32. package/dist/b2b/SeCategoryBanners/index.d.ts.map +1 -0
  33. package/dist/b2b/SeCategoryBanners/index.js +18 -0
  34. package/dist/b2b/SeCategoryBanners/index.js.map +1 -0
  35. package/dist/b2b/SeCategoryBanners/types.d.ts +9 -0
  36. package/dist/b2b/SeCategoryBanners/types.d.ts.map +1 -0
  37. package/dist/b2b/SeCategoryBanners/types.js +3 -0
  38. package/dist/b2b/SeCategoryBanners/types.js.map +1 -0
  39. package/dist/b2b/SeCheckStockAndPricing/checkStockAndPricingUtils.d.ts +114 -0
  40. package/dist/b2b/SeCheckStockAndPricing/checkStockAndPricingUtils.d.ts.map +1 -0
  41. package/dist/b2b/SeCheckStockAndPricing/checkStockAndPricingUtils.js +85 -0
  42. package/dist/b2b/SeCheckStockAndPricing/checkStockAndPricingUtils.js.map +1 -0
  43. package/dist/b2b/SeCheckStockAndPricing/index.d.ts +4 -0
  44. package/dist/b2b/SeCheckStockAndPricing/index.d.ts.map +1 -0
  45. package/dist/b2b/SeCheckStockAndPricing/index.js +20 -0
  46. package/dist/b2b/SeCheckStockAndPricing/index.js.map +1 -0
  47. package/dist/b2b/SeCheckStockAndPricing/stockCsv.d.ts +22 -0
  48. package/dist/b2b/SeCheckStockAndPricing/stockCsv.d.ts.map +1 -0
  49. package/dist/b2b/SeCheckStockAndPricing/stockCsv.js +79 -0
  50. package/dist/b2b/SeCheckStockAndPricing/stockCsv.js.map +1 -0
  51. package/dist/b2b/SeCheckStockAndPricing/useCheckStockAndPricing.d.ts +54 -0
  52. package/dist/b2b/SeCheckStockAndPricing/useCheckStockAndPricing.d.ts.map +1 -0
  53. package/dist/b2b/SeCheckStockAndPricing/useCheckStockAndPricing.js +209 -0
  54. package/dist/b2b/SeCheckStockAndPricing/useCheckStockAndPricing.js.map +1 -0
  55. package/dist/b2b/SeCustomCrossSellingShelf/index.d.ts +2 -0
  56. package/dist/b2b/SeCustomCrossSellingShelf/index.d.ts.map +1 -0
  57. package/dist/b2b/SeCustomCrossSellingShelf/index.js +18 -0
  58. package/dist/b2b/SeCustomCrossSellingShelf/index.js.map +1 -0
  59. package/dist/b2b/SeCustomCrossSellingShelf/useCrossSellingShelfOverride.d.ts +19 -0
  60. package/dist/b2b/SeCustomCrossSellingShelf/useCrossSellingShelfOverride.d.ts.map +1 -0
  61. package/dist/b2b/SeCustomCrossSellingShelf/useCrossSellingShelfOverride.js +21 -0
  62. package/dist/b2b/SeCustomCrossSellingShelf/useCrossSellingShelfOverride.js.map +1 -0
  63. package/dist/b2b/SeCustomProductCard/index.d.ts +3 -0
  64. package/dist/b2b/SeCustomProductCard/index.d.ts.map +1 -0
  65. package/dist/b2b/SeCustomProductCard/index.js +19 -0
  66. package/dist/b2b/SeCustomProductCard/index.js.map +1 -0
  67. package/dist/b2b/SeCustomProductCard/types.d.ts +30 -0
  68. package/dist/b2b/SeCustomProductCard/types.d.ts.map +1 -0
  69. package/dist/b2b/SeCustomProductCard/types.js +3 -0
  70. package/dist/b2b/SeCustomProductCard/types.js.map +1 -0
  71. package/dist/b2b/SeCustomProductCard/useB2bProductCard.d.ts +21 -0
  72. package/dist/b2b/SeCustomProductCard/useB2bProductCard.d.ts.map +1 -0
  73. package/dist/b2b/SeCustomProductCard/useB2bProductCard.js +33 -0
  74. package/dist/b2b/SeCustomProductCard/useB2bProductCard.js.map +1 -0
  75. package/dist/b2b/SeCustomShelfProduct/index.d.ts +3 -0
  76. package/dist/b2b/SeCustomShelfProduct/index.d.ts.map +1 -0
  77. package/dist/b2b/SeCustomShelfProduct/index.js +19 -0
  78. package/dist/b2b/SeCustomShelfProduct/index.js.map +1 -0
  79. package/dist/b2b/SeCustomShelfProduct/types.d.ts +6 -0
  80. package/dist/b2b/SeCustomShelfProduct/types.d.ts.map +1 -0
  81. package/dist/b2b/SeCustomShelfProduct/types.js +3 -0
  82. package/dist/b2b/SeCustomShelfProduct/types.js.map +1 -0
  83. package/dist/b2b/SeCustomShelfProduct/useB2bShelfProducts.d.ts +15 -0
  84. package/dist/b2b/SeCustomShelfProduct/useB2bShelfProducts.d.ts.map +1 -0
  85. package/dist/b2b/SeCustomShelfProduct/useB2bShelfProducts.js +19 -0
  86. package/dist/b2b/SeCustomShelfProduct/useB2bShelfProducts.js.map +1 -0
  87. package/dist/b2b/SeDashboards/index.d.ts +2 -0
  88. package/dist/b2b/SeDashboards/index.d.ts.map +1 -0
  89. package/dist/b2b/SeDashboards/index.js +18 -0
  90. package/dist/b2b/SeDashboards/index.js.map +1 -0
  91. package/dist/b2b/SeDashboards/useDashboards.d.ts +51 -0
  92. package/dist/b2b/SeDashboards/useDashboards.d.ts.map +1 -0
  93. package/dist/b2b/SeDashboards/useDashboards.js +172 -0
  94. package/dist/b2b/SeDashboards/useDashboards.js.map +1 -0
  95. package/dist/b2b/SeFooterB2B/index.d.ts +3 -0
  96. package/dist/b2b/SeFooterB2B/index.d.ts.map +1 -0
  97. package/dist/b2b/SeFooterB2B/index.js +19 -0
  98. package/dist/b2b/SeFooterB2B/index.js.map +1 -0
  99. package/dist/b2b/SeFooterB2B/types.d.ts +39 -0
  100. package/dist/b2b/SeFooterB2B/types.d.ts.map +1 -0
  101. package/dist/b2b/SeFooterB2B/types.js +3 -0
  102. package/dist/b2b/SeFooterB2B/types.js.map +1 -0
  103. package/dist/b2b/SeFooterB2B/useNewsletterSubscription.d.ts +16 -0
  104. package/dist/b2b/SeFooterB2B/useNewsletterSubscription.d.ts.map +1 -0
  105. package/dist/b2b/SeFooterB2B/useNewsletterSubscription.js +34 -0
  106. package/dist/b2b/SeFooterB2B/useNewsletterSubscription.js.map +1 -0
  107. package/dist/b2b/SeProductGalleryB2B/index.d.ts +2 -0
  108. package/dist/b2b/SeProductGalleryB2B/index.d.ts.map +1 -0
  109. package/dist/b2b/SeProductGalleryB2B/index.js +18 -0
  110. package/dist/b2b/SeProductGalleryB2B/index.js.map +1 -0
  111. package/dist/b2b/SeProductGalleryB2B/useProductGalleryB2B.d.ts +123 -0
  112. package/dist/b2b/SeProductGalleryB2B/useProductGalleryB2B.d.ts.map +1 -0
  113. package/dist/b2b/SeProductGalleryB2B/useProductGalleryB2B.js +159 -0
  114. package/dist/b2b/SeProductGalleryB2B/useProductGalleryB2B.js.map +1 -0
  115. package/dist/b2b/SePurchaseLists/index.d.ts +3 -0
  116. package/dist/b2b/SePurchaseLists/index.d.ts.map +1 -0
  117. package/dist/b2b/SePurchaseLists/index.js +19 -0
  118. package/dist/b2b/SePurchaseLists/index.js.map +1 -0
  119. package/dist/b2b/SePurchaseLists/purchaseListsUtils.d.ts +103 -0
  120. package/dist/b2b/SePurchaseLists/purchaseListsUtils.d.ts.map +1 -0
  121. package/dist/b2b/SePurchaseLists/purchaseListsUtils.js +69 -0
  122. package/dist/b2b/SePurchaseLists/purchaseListsUtils.js.map +1 -0
  123. package/dist/b2b/SePurchaseLists/usePurchaseLists.d.ts +57 -0
  124. package/dist/b2b/SePurchaseLists/usePurchaseLists.d.ts.map +1 -0
  125. package/dist/b2b/SePurchaseLists/usePurchaseLists.js +292 -0
  126. package/dist/b2b/SePurchaseLists/usePurchaseLists.js.map +1 -0
  127. package/dist/b2b/SeRecentOrdersSpendOverview/index.d.ts +3 -0
  128. package/dist/b2b/SeRecentOrdersSpendOverview/index.d.ts.map +1 -0
  129. package/dist/b2b/SeRecentOrdersSpendOverview/index.js +19 -0
  130. package/dist/b2b/SeRecentOrdersSpendOverview/index.js.map +1 -0
  131. package/dist/b2b/SeRecentOrdersSpendOverview/recentOrdersSpendOverviewUtils.d.ts +58 -0
  132. package/dist/b2b/SeRecentOrdersSpendOverview/recentOrdersSpendOverviewUtils.d.ts.map +1 -0
  133. package/dist/b2b/SeRecentOrdersSpendOverview/recentOrdersSpendOverviewUtils.js +133 -0
  134. package/dist/b2b/SeRecentOrdersSpendOverview/recentOrdersSpendOverviewUtils.js.map +1 -0
  135. package/dist/b2b/SeRecentOrdersSpendOverview/useRecentOrdersSpendOverview.d.ts +21 -0
  136. package/dist/b2b/SeRecentOrdersSpendOverview/useRecentOrdersSpendOverview.d.ts.map +1 -0
  137. package/dist/b2b/SeRecentOrdersSpendOverview/useRecentOrdersSpendOverview.js +134 -0
  138. package/dist/b2b/SeRecentOrdersSpendOverview/useRecentOrdersSpendOverview.js.map +1 -0
  139. package/dist/b2b/SeRequestToBuy/index.d.ts +2 -0
  140. package/dist/b2b/SeRequestToBuy/index.d.ts.map +1 -0
  141. package/dist/b2b/SeRequestToBuy/index.js +18 -0
  142. package/dist/b2b/SeRequestToBuy/index.js.map +1 -0
  143. package/dist/b2b/SeRequestToBuy/useRequestToBuyForm.d.ts +23 -0
  144. package/dist/b2b/SeRequestToBuy/useRequestToBuyForm.d.ts.map +1 -0
  145. package/dist/b2b/SeRequestToBuy/useRequestToBuyForm.js +64 -0
  146. package/dist/b2b/SeRequestToBuy/useRequestToBuyForm.js.map +1 -0
  147. package/dist/b2b/SeWelcomeBackMessage/index.d.ts +2 -0
  148. package/dist/b2b/SeWelcomeBackMessage/index.d.ts.map +1 -0
  149. package/dist/b2b/SeWelcomeBackMessage/index.js +18 -0
  150. package/dist/b2b/SeWelcomeBackMessage/index.js.map +1 -0
  151. package/dist/b2b/SeWelcomeBackMessage/useB2bSession.d.ts +11 -0
  152. package/dist/b2b/SeWelcomeBackMessage/useB2bSession.d.ts.map +1 -0
  153. package/dist/b2b/SeWelcomeBackMessage/useB2bSession.js +15 -0
  154. package/dist/b2b/SeWelcomeBackMessage/useB2bSession.js.map +1 -0
  155. package/dist/b2b/index.d.ts +15 -0
  156. package/dist/b2b/index.d.ts.map +1 -0
  157. package/dist/b2b/index.js +31 -0
  158. package/dist/b2b/index.js.map +1 -0
  159. package/dist/b2c/SeAssemblySet/assemblySetUtils.d.ts +41 -0
  160. package/dist/b2c/SeAssemblySet/assemblySetUtils.d.ts.map +1 -0
  161. package/dist/b2c/SeAssemblySet/assemblySetUtils.js +57 -0
  162. package/dist/b2c/SeAssemblySet/assemblySetUtils.js.map +1 -0
  163. package/dist/b2c/SeAssemblySet/index.d.ts +4 -0
  164. package/dist/b2c/SeAssemblySet/index.d.ts.map +1 -0
  165. package/dist/b2c/SeAssemblySet/index.js +20 -0
  166. package/dist/b2c/SeAssemblySet/index.js.map +1 -0
  167. package/dist/b2c/SeAssemblySet/types.d.ts +52 -0
  168. package/dist/b2c/SeAssemblySet/types.d.ts.map +1 -0
  169. package/dist/b2c/SeAssemblySet/types.js +3 -0
  170. package/dist/b2c/SeAssemblySet/types.js.map +1 -0
  171. package/dist/b2c/SeAssemblySet/useAssemblySet.d.ts +38 -0
  172. package/dist/b2c/SeAssemblySet/useAssemblySet.d.ts.map +1 -0
  173. package/dist/b2c/SeAssemblySet/useAssemblySet.js +134 -0
  174. package/dist/b2c/SeAssemblySet/useAssemblySet.js.map +1 -0
  175. package/dist/b2c/SeBanner/buildResponsiveImage.d.ts +18 -0
  176. package/dist/b2c/SeBanner/buildResponsiveImage.d.ts.map +1 -0
  177. package/dist/b2c/SeBanner/buildResponsiveImage.js +32 -0
  178. package/dist/b2c/SeBanner/buildResponsiveImage.js.map +1 -0
  179. package/dist/b2c/SeBanner/getImageUrl.d.ts +3 -0
  180. package/dist/b2c/SeBanner/getImageUrl.d.ts.map +1 -0
  181. package/dist/b2c/SeBanner/getImageUrl.js +7 -0
  182. package/dist/b2c/SeBanner/getImageUrl.js.map +1 -0
  183. package/dist/b2c/SeBanner/index.d.ts +8 -0
  184. package/dist/b2c/SeBanner/index.d.ts.map +1 -0
  185. package/dist/b2c/SeBanner/index.js +24 -0
  186. package/dist/b2c/SeBanner/index.js.map +1 -0
  187. package/dist/b2c/SeBanner/types.d.ts +34 -0
  188. package/dist/b2c/SeBanner/types.d.ts.map +1 -0
  189. package/dist/b2c/SeBanner/types.js +27 -0
  190. package/dist/b2c/SeBanner/types.js.map +1 -0
  191. package/dist/b2c/SeBanner/useBannerContext.d.ts +4 -0
  192. package/dist/b2c/SeBanner/useBannerContext.d.ts.map +1 -0
  193. package/dist/b2c/SeBanner/useBannerContext.js +14 -0
  194. package/dist/b2c/SeBanner/useBannerContext.js.map +1 -0
  195. package/dist/b2c/SeBanner/useBannerStyles.d.ts +21 -0
  196. package/dist/b2c/SeBanner/useBannerStyles.d.ts.map +1 -0
  197. package/dist/b2c/SeBanner/useBannerStyles.js +87 -0
  198. package/dist/b2c/SeBanner/useBannerStyles.js.map +1 -0
  199. package/dist/b2c/SeBanner/useIsMobile.d.ts +4 -0
  200. package/dist/b2c/SeBanner/useIsMobile.d.ts.map +1 -0
  201. package/dist/b2c/SeBanner/useIsMobile.js +23 -0
  202. package/dist/b2c/SeBanner/useIsMobile.js.map +1 -0
  203. package/dist/b2c/SeBanner/useSanitizedHtml.d.ts +13 -0
  204. package/dist/b2c/SeBanner/useSanitizedHtml.d.ts.map +1 -0
  205. package/dist/b2c/SeBanner/useSanitizedHtml.js +45 -0
  206. package/dist/b2c/SeBanner/useSanitizedHtml.js.map +1 -0
  207. package/dist/b2c/SeBannerCarousel/index.d.ts +5 -0
  208. package/dist/b2c/SeBannerCarousel/index.d.ts.map +1 -0
  209. package/dist/b2c/SeBannerCarousel/index.js +21 -0
  210. package/dist/b2c/SeBannerCarousel/index.js.map +1 -0
  211. package/dist/b2c/SeBannerCarousel/types.d.ts +17 -0
  212. package/dist/b2c/SeBannerCarousel/types.d.ts.map +1 -0
  213. package/dist/b2c/SeBannerCarousel/types.js +3 -0
  214. package/dist/b2c/SeBannerCarousel/types.js.map +1 -0
  215. package/dist/b2c/SeBannerCarousel/useCarousel.d.ts +30 -0
  216. package/dist/b2c/SeBannerCarousel/useCarousel.d.ts.map +1 -0
  217. package/dist/b2c/SeBannerCarousel/useCarousel.js +53 -0
  218. package/dist/b2c/SeBannerCarousel/useCarousel.js.map +1 -0
  219. package/dist/b2c/SeBannerCarousel/useCarouselContext.d.ts +4 -0
  220. package/dist/b2c/SeBannerCarousel/useCarouselContext.d.ts.map +1 -0
  221. package/dist/b2c/SeBannerCarousel/useCarouselContext.js +14 -0
  222. package/dist/b2c/SeBannerCarousel/useCarouselContext.js.map +1 -0
  223. package/dist/b2c/SeBannerCarousel/useSwipeNavigation.d.ts +19 -0
  224. package/dist/b2c/SeBannerCarousel/useSwipeNavigation.d.ts.map +1 -0
  225. package/dist/b2c/SeBannerCarousel/useSwipeNavigation.js +37 -0
  226. package/dist/b2c/SeBannerCarousel/useSwipeNavigation.js.map +1 -0
  227. package/dist/b2c/SeCardsCarousel/index.d.ts +3 -0
  228. package/dist/b2c/SeCardsCarousel/index.d.ts.map +1 -0
  229. package/dist/b2c/SeCardsCarousel/index.js +19 -0
  230. package/dist/b2c/SeCardsCarousel/index.js.map +1 -0
  231. package/dist/b2c/SeCardsCarousel/types.d.ts +8 -0
  232. package/dist/b2c/SeCardsCarousel/types.d.ts.map +1 -0
  233. package/dist/b2c/SeCardsCarousel/types.js +3 -0
  234. package/dist/b2c/SeCardsCarousel/types.js.map +1 -0
  235. package/dist/b2c/SeCardsCarousel/useCardsCarouselLayout.d.ts +10 -0
  236. package/dist/b2c/SeCardsCarousel/useCardsCarouselLayout.d.ts.map +1 -0
  237. package/dist/b2c/SeCardsCarousel/useCardsCarouselLayout.js +13 -0
  238. package/dist/b2c/SeCardsCarousel/useCardsCarouselLayout.js.map +1 -0
  239. package/dist/b2c/SeEditorialSplit/index.d.ts +2 -0
  240. package/dist/b2c/SeEditorialSplit/index.d.ts.map +1 -0
  241. package/dist/b2c/SeEditorialSplit/index.js +18 -0
  242. package/dist/b2c/SeEditorialSplit/index.js.map +1 -0
  243. package/dist/b2c/SeEditorialSplit/types.d.ts +13 -0
  244. package/dist/b2c/SeEditorialSplit/types.d.ts.map +1 -0
  245. package/dist/b2c/SeEditorialSplit/types.js +3 -0
  246. package/dist/b2c/SeEditorialSplit/types.js.map +1 -0
  247. package/dist/b2c/SeFooter/index.d.ts +3 -0
  248. package/dist/b2c/SeFooter/index.d.ts.map +1 -0
  249. package/dist/b2c/SeFooter/index.js +19 -0
  250. package/dist/b2c/SeFooter/index.js.map +1 -0
  251. package/dist/b2c/SeFooter/types.d.ts +52 -0
  252. package/dist/b2c/SeFooter/types.d.ts.map +1 -0
  253. package/dist/b2c/SeFooter/types.js +3 -0
  254. package/dist/b2c/SeFooter/types.js.map +1 -0
  255. package/dist/b2c/SeFooter/utils.d.ts +6 -0
  256. package/dist/b2c/SeFooter/utils.d.ts.map +1 -0
  257. package/dist/b2c/SeFooter/utils.js +11 -0
  258. package/dist/b2c/SeFooter/utils.js.map +1 -0
  259. package/dist/b2c/SeGridContent/index.d.ts +2 -0
  260. package/dist/b2c/SeGridContent/index.d.ts.map +1 -0
  261. package/dist/b2c/SeGridContent/index.js +18 -0
  262. package/dist/b2c/SeGridContent/index.js.map +1 -0
  263. package/dist/b2c/SeGridContent/types.d.ts +20 -0
  264. package/dist/b2c/SeGridContent/types.d.ts.map +1 -0
  265. package/dist/b2c/SeGridContent/types.js +3 -0
  266. package/dist/b2c/SeGridContent/types.js.map +1 -0
  267. package/dist/b2c/SeHeader/index.d.ts +2 -0
  268. package/dist/b2c/SeHeader/index.d.ts.map +1 -0
  269. package/dist/b2c/SeHeader/index.js +18 -0
  270. package/dist/b2c/SeHeader/index.js.map +1 -0
  271. package/dist/b2c/SeHeader/types.d.ts +35 -0
  272. package/dist/b2c/SeHeader/types.d.ts.map +1 -0
  273. package/dist/b2c/SeHeader/types.js +3 -0
  274. package/dist/b2c/SeHeader/types.js.map +1 -0
  275. package/dist/b2c/SeHeroSection/index.d.ts +2 -0
  276. package/dist/b2c/SeHeroSection/index.d.ts.map +1 -0
  277. package/dist/b2c/SeHeroSection/index.js +18 -0
  278. package/dist/b2c/SeHeroSection/index.js.map +1 -0
  279. package/dist/b2c/SeHeroSection/types.d.ts +10 -0
  280. package/dist/b2c/SeHeroSection/types.d.ts.map +1 -0
  281. package/dist/b2c/SeHeroSection/types.js +3 -0
  282. package/dist/b2c/SeHeroSection/types.js.map +1 -0
  283. package/dist/b2c/SeImageTiles/index.d.ts +2 -0
  284. package/dist/b2c/SeImageTiles/index.d.ts.map +1 -0
  285. package/dist/b2c/SeImageTiles/index.js +18 -0
  286. package/dist/b2c/SeImageTiles/index.js.map +1 -0
  287. package/dist/b2c/SeImageTiles/types.d.ts +13 -0
  288. package/dist/b2c/SeImageTiles/types.d.ts.map +1 -0
  289. package/dist/b2c/SeImageTiles/types.js +3 -0
  290. package/dist/b2c/SeImageTiles/types.js.map +1 -0
  291. package/dist/b2c/SeLearnMoreSection/index.d.ts +2 -0
  292. package/dist/b2c/SeLearnMoreSection/index.d.ts.map +1 -0
  293. package/dist/b2c/SeLearnMoreSection/index.js +18 -0
  294. package/dist/b2c/SeLearnMoreSection/index.js.map +1 -0
  295. package/dist/b2c/SeLearnMoreSection/types.d.ts +10 -0
  296. package/dist/b2c/SeLearnMoreSection/types.d.ts.map +1 -0
  297. package/dist/b2c/SeLearnMoreSection/types.js +3 -0
  298. package/dist/b2c/SeLearnMoreSection/types.js.map +1 -0
  299. package/dist/b2c/SeMegaMenu/index.d.ts +6 -0
  300. package/dist/b2c/SeMegaMenu/index.d.ts.map +1 -0
  301. package/dist/b2c/SeMegaMenu/index.js +22 -0
  302. package/dist/b2c/SeMegaMenu/index.js.map +1 -0
  303. package/dist/b2c/SeMegaMenu/types.d.ts +27 -0
  304. package/dist/b2c/SeMegaMenu/types.d.ts.map +1 -0
  305. package/dist/b2c/SeMegaMenu/types.js +3 -0
  306. package/dist/b2c/SeMegaMenu/types.js.map +1 -0
  307. package/dist/b2c/SeMegaMenu/useCloseMenuOnEscape.d.ts +6 -0
  308. package/dist/b2c/SeMegaMenu/useCloseMenuOnEscape.d.ts.map +1 -0
  309. package/dist/b2c/SeMegaMenu/useCloseMenuOnEscape.js +21 -0
  310. package/dist/b2c/SeMegaMenu/useCloseMenuOnEscape.js.map +1 -0
  311. package/dist/b2c/SeMegaMenu/useMegaMenuHoverState.d.ts +15 -0
  312. package/dist/b2c/SeMegaMenu/useMegaMenuHoverState.d.ts.map +1 -0
  313. package/dist/b2c/SeMegaMenu/useMegaMenuHoverState.js +21 -0
  314. package/dist/b2c/SeMegaMenu/useMegaMenuHoverState.js.map +1 -0
  315. package/dist/b2c/SeMegaMenu/useMegaMenuMobileNavigation.d.ts +29 -0
  316. package/dist/b2c/SeMegaMenu/useMegaMenuMobileNavigation.d.ts.map +1 -0
  317. package/dist/b2c/SeMegaMenu/useMegaMenuMobileNavigation.js +71 -0
  318. package/dist/b2c/SeMegaMenu/useMegaMenuMobileNavigation.js.map +1 -0
  319. package/dist/b2c/SeMegaMenu/useNavbarHamburgerTrigger.d.ts +12 -0
  320. package/dist/b2c/SeMegaMenu/useNavbarHamburgerTrigger.d.ts.map +1 -0
  321. package/dist/b2c/SeMegaMenu/useNavbarHamburgerTrigger.js +29 -0
  322. package/dist/b2c/SeMegaMenu/useNavbarHamburgerTrigger.js.map +1 -0
  323. package/dist/b2c/SeProductCardWithButton/index.d.ts +3 -0
  324. package/dist/b2c/SeProductCardWithButton/index.d.ts.map +1 -0
  325. package/dist/b2c/SeProductCardWithButton/index.js +19 -0
  326. package/dist/b2c/SeProductCardWithButton/index.js.map +1 -0
  327. package/dist/b2c/SeProductCardWithButton/types.d.ts +20 -0
  328. package/dist/b2c/SeProductCardWithButton/types.d.ts.map +1 -0
  329. package/dist/b2c/SeProductCardWithButton/types.js +3 -0
  330. package/dist/b2c/SeProductCardWithButton/types.js.map +1 -0
  331. package/dist/b2c/SeProductCardWithButton/useFormattedPrice.d.ts +13 -0
  332. package/dist/b2c/SeProductCardWithButton/useFormattedPrice.d.ts.map +1 -0
  333. package/dist/b2c/SeProductCardWithButton/useFormattedPrice.js +25 -0
  334. package/dist/b2c/SeProductCardWithButton/useFormattedPrice.js.map +1 -0
  335. package/dist/b2c/SeProductImageGrid/index.d.ts +2 -0
  336. package/dist/b2c/SeProductImageGrid/index.d.ts.map +1 -0
  337. package/dist/b2c/SeProductImageGrid/index.js +18 -0
  338. package/dist/b2c/SeProductImageGrid/index.js.map +1 -0
  339. package/dist/b2c/SeProductImageGrid/types.d.ts +15 -0
  340. package/dist/b2c/SeProductImageGrid/types.d.ts.map +1 -0
  341. package/dist/b2c/SeProductImageGrid/types.js +3 -0
  342. package/dist/b2c/SeProductImageGrid/types.js.map +1 -0
  343. package/dist/b2c/SeProductListing/index.d.ts +3 -0
  344. package/dist/b2c/SeProductListing/index.d.ts.map +1 -0
  345. package/dist/b2c/SeProductListing/index.js +19 -0
  346. package/dist/b2c/SeProductListing/index.js.map +1 -0
  347. package/dist/b2c/SeProductListing/types.d.ts +40 -0
  348. package/dist/b2c/SeProductListing/types.d.ts.map +1 -0
  349. package/dist/b2c/SeProductListing/types.js +3 -0
  350. package/dist/b2c/SeProductListing/types.js.map +1 -0
  351. package/dist/b2c/SeProductListing/useSeProductListing.d.ts +8 -0
  352. package/dist/b2c/SeProductListing/useSeProductListing.d.ts.map +1 -0
  353. package/dist/b2c/SeProductListing/useSeProductListing.js +27 -0
  354. package/dist/b2c/SeProductListing/useSeProductListing.js.map +1 -0
  355. package/dist/b2c/SeProductReviews/index.d.ts +3 -0
  356. package/dist/b2c/SeProductReviews/index.d.ts.map +1 -0
  357. package/dist/b2c/SeProductReviews/index.js +19 -0
  358. package/dist/b2c/SeProductReviews/index.js.map +1 -0
  359. package/dist/b2c/SeProductReviews/types.d.ts +30 -0
  360. package/dist/b2c/SeProductReviews/types.d.ts.map +1 -0
  361. package/dist/b2c/SeProductReviews/types.js +3 -0
  362. package/dist/b2c/SeProductReviews/types.js.map +1 -0
  363. package/dist/b2c/SeProductReviews/useSeProductReviews.d.ts +9 -0
  364. package/dist/b2c/SeProductReviews/useSeProductReviews.d.ts.map +1 -0
  365. package/dist/b2c/SeProductReviews/useSeProductReviews.js +34 -0
  366. package/dist/b2c/SeProductReviews/useSeProductReviews.js.map +1 -0
  367. package/dist/b2c/SeValuePropCards/index.d.ts +3 -0
  368. package/dist/b2c/SeValuePropCards/index.d.ts.map +1 -0
  369. package/dist/b2c/SeValuePropCards/index.js +19 -0
  370. package/dist/b2c/SeValuePropCards/index.js.map +1 -0
  371. package/dist/b2c/SeValuePropCards/types.d.ts +26 -0
  372. package/dist/b2c/SeValuePropCards/types.d.ts.map +1 -0
  373. package/dist/b2c/SeValuePropCards/types.js +3 -0
  374. package/dist/b2c/SeValuePropCards/types.js.map +1 -0
  375. package/dist/b2c/SeValuePropCards/useSeValuePropCardsFilter.d.ts +8 -0
  376. package/dist/b2c/SeValuePropCards/useSeValuePropCardsFilter.d.ts.map +1 -0
  377. package/dist/b2c/SeValuePropCards/useSeValuePropCardsFilter.js +36 -0
  378. package/dist/b2c/SeValuePropCards/useSeValuePropCardsFilter.js.map +1 -0
  379. package/dist/b2c/SeVideoHero/index.d.ts +4 -0
  380. package/dist/b2c/SeVideoHero/index.d.ts.map +1 -0
  381. package/dist/b2c/SeVideoHero/index.js +20 -0
  382. package/dist/b2c/SeVideoHero/index.js.map +1 -0
  383. package/dist/b2c/SeVideoHero/types.d.ts +19 -0
  384. package/dist/b2c/SeVideoHero/types.d.ts.map +1 -0
  385. package/dist/b2c/SeVideoHero/types.js +3 -0
  386. package/dist/b2c/SeVideoHero/types.js.map +1 -0
  387. package/dist/b2c/SeVideoHero/useSeVideoHeroPlayback.d.ts +40 -0
  388. package/dist/b2c/SeVideoHero/useSeVideoHeroPlayback.d.ts.map +1 -0
  389. package/dist/b2c/SeVideoHero/useSeVideoHeroPlayback.js +135 -0
  390. package/dist/b2c/SeVideoHero/useSeVideoHeroPlayback.js.map +1 -0
  391. package/dist/b2c/SeVideoHero/videoSource.d.ts +25 -0
  392. package/dist/b2c/SeVideoHero/videoSource.d.ts.map +1 -0
  393. package/dist/b2c/SeVideoHero/videoSource.js +78 -0
  394. package/dist/b2c/SeVideoHero/videoSource.js.map +1 -0
  395. package/dist/b2c/index.d.ts +19 -0
  396. package/dist/b2c/index.d.ts.map +1 -0
  397. package/dist/b2c/index.js +35 -0
  398. package/dist/b2c/index.js.map +1 -0
  399. package/dist/b2c/shared/filterItemsWithImage.d.ts +8 -0
  400. package/dist/b2c/shared/filterItemsWithImage.d.ts.map +1 -0
  401. package/dist/b2c/shared/filterItemsWithImage.js +11 -0
  402. package/dist/b2c/shared/filterItemsWithImage.js.map +1 -0
  403. package/dist/b2c/shared/index.d.ts +2 -0
  404. package/dist/b2c/shared/index.d.ts.map +1 -0
  405. package/dist/b2c/shared/index.js +18 -0
  406. package/dist/b2c/shared/index.js.map +1 -0
  407. package/dist/index.d.ts +2 -0
  408. package/dist/index.d.ts.map +1 -0
  409. package/dist/index.js +18 -0
  410. package/dist/index.js.map +1 -0
  411. package/package.json +82 -3
  412. package/src/b2b/SeActionHubBulletinBoard/index.ts +1 -0
  413. package/src/b2b/SeActionHubBulletinBoard/types.ts +27 -0
  414. package/src/b2b/SeAddToPurchaseList/addToPurchaseListUtils.ts +40 -0
  415. package/src/b2b/SeAddToPurchaseList/index.ts +2 -0
  416. package/src/b2b/SeAddToPurchaseList/useAddToPurchaseList.ts +130 -0
  417. package/src/b2b/SeAddressSelector/index.ts +1 -0
  418. package/src/b2b/SeAddressSelector/useAddressSelector.ts +157 -0
  419. package/src/b2b/SeCategoryBanners/index.ts +1 -0
  420. package/src/b2b/SeCategoryBanners/types.ts +8 -0
  421. package/src/b2b/SeCheckStockAndPricing/checkStockAndPricingUtils.ts +126 -0
  422. package/src/b2b/SeCheckStockAndPricing/index.ts +3 -0
  423. package/src/b2b/SeCheckStockAndPricing/stockCsv.ts +77 -0
  424. package/src/b2b/SeCheckStockAndPricing/useCheckStockAndPricing.ts +272 -0
  425. package/src/b2b/SeCustomCrossSellingShelf/index.ts +1 -0
  426. package/src/b2b/SeCustomCrossSellingShelf/useCrossSellingShelfOverride.ts +25 -0
  427. package/src/b2b/SeCustomProductCard/index.ts +2 -0
  428. package/src/b2b/SeCustomProductCard/types.ts +16 -0
  429. package/src/b2b/SeCustomProductCard/useB2bProductCard.ts +53 -0
  430. package/src/b2b/SeCustomShelfProduct/index.ts +2 -0
  431. package/src/b2b/SeCustomShelfProduct/types.ts +14 -0
  432. package/src/b2b/SeCustomShelfProduct/useB2bShelfProducts.ts +31 -0
  433. package/src/b2b/SeDashboards/index.ts +1 -0
  434. package/src/b2b/SeDashboards/useDashboards.ts +211 -0
  435. package/src/b2b/SeFooterB2B/index.ts +2 -0
  436. package/src/b2b/SeFooterB2B/types.ts +42 -0
  437. package/src/b2b/SeFooterB2B/useNewsletterSubscription.ts +41 -0
  438. package/src/b2b/SeProductGalleryB2B/index.ts +1 -0
  439. package/src/b2b/SeProductGalleryB2B/useProductGalleryB2B.ts +217 -0
  440. package/src/b2b/SePurchaseLists/index.ts +2 -0
  441. package/src/b2b/SePurchaseLists/purchaseListsUtils.ts +106 -0
  442. package/src/b2b/SePurchaseLists/usePurchaseLists.ts +401 -0
  443. package/src/b2b/SeRecentOrdersSpendOverview/index.ts +2 -0
  444. package/src/b2b/SeRecentOrdersSpendOverview/recentOrdersSpendOverviewUtils.ts +162 -0
  445. package/src/b2b/SeRecentOrdersSpendOverview/useRecentOrdersSpendOverview.ts +159 -0
  446. package/src/b2b/SeRequestToBuy/index.ts +1 -0
  447. package/src/b2b/SeRequestToBuy/useRequestToBuyForm.ts +96 -0
  448. package/src/b2b/SeWelcomeBackMessage/index.ts +1 -0
  449. package/src/b2b/SeWelcomeBackMessage/useB2bSession.ts +16 -0
  450. package/src/b2b/index.ts +14 -0
  451. package/src/b2c/SeAssemblySet/assemblySetUtils.ts +67 -0
  452. package/src/b2c/SeAssemblySet/index.ts +3 -0
  453. package/src/b2c/SeAssemblySet/types.ts +51 -0
  454. package/src/b2c/SeAssemblySet/useAssemblySet.ts +198 -0
  455. package/src/b2c/SeBanner/buildResponsiveImage.ts +44 -0
  456. package/src/b2c/SeBanner/getImageUrl.ts +9 -0
  457. package/src/b2c/SeBanner/index.ts +7 -0
  458. package/src/b2c/SeBanner/types.ts +40 -0
  459. package/src/b2c/SeBanner/useBannerContext.ts +12 -0
  460. package/src/b2c/SeBanner/useBannerStyles.ts +120 -0
  461. package/src/b2c/SeBanner/useIsMobile.ts +24 -0
  462. package/src/b2c/SeBanner/useSanitizedHtml.ts +49 -0
  463. package/src/b2c/SeBannerCarousel/index.ts +4 -0
  464. package/src/b2c/SeBannerCarousel/types.ts +17 -0
  465. package/src/b2c/SeBannerCarousel/useCarousel.ts +83 -0
  466. package/src/b2c/SeBannerCarousel/useCarouselContext.ts +12 -0
  467. package/src/b2c/SeBannerCarousel/useSwipeNavigation.ts +54 -0
  468. package/src/b2c/SeCardsCarousel/index.ts +2 -0
  469. package/src/b2c/SeCardsCarousel/types.ts +7 -0
  470. package/src/b2c/SeCardsCarousel/useCardsCarouselLayout.ts +9 -0
  471. package/src/b2c/SeEditorialSplit/index.ts +1 -0
  472. package/src/b2c/SeEditorialSplit/types.ts +15 -0
  473. package/src/b2c/SeFooter/index.ts +2 -0
  474. package/src/b2c/SeFooter/types.ts +54 -0
  475. package/src/b2c/SeFooter/utils.ts +10 -0
  476. package/src/b2c/SeGridContent/index.ts +1 -0
  477. package/src/b2c/SeGridContent/types.ts +22 -0
  478. package/src/b2c/SeHeader/index.ts +1 -0
  479. package/src/b2c/SeHeader/types.ts +40 -0
  480. package/src/b2c/SeHeroSection/index.ts +1 -0
  481. package/src/b2c/SeHeroSection/types.ts +10 -0
  482. package/src/b2c/SeImageTiles/index.ts +1 -0
  483. package/src/b2c/SeImageTiles/types.ts +15 -0
  484. package/src/b2c/SeLearnMoreSection/index.ts +1 -0
  485. package/src/b2c/SeLearnMoreSection/types.ts +10 -0
  486. package/src/b2c/SeMegaMenu/index.ts +5 -0
  487. package/src/b2c/SeMegaMenu/types.ts +31 -0
  488. package/src/b2c/SeMegaMenu/useCloseMenuOnEscape.ts +18 -0
  489. package/src/b2c/SeMegaMenu/useMegaMenuHoverState.ts +29 -0
  490. package/src/b2c/SeMegaMenu/useMegaMenuMobileNavigation.ts +96 -0
  491. package/src/b2c/SeMegaMenu/useNavbarHamburgerTrigger.ts +29 -0
  492. package/src/b2c/SeProductCardWithButton/index.ts +2 -0
  493. package/src/b2c/SeProductCardWithButton/types.ts +21 -0
  494. package/src/b2c/SeProductCardWithButton/useFormattedPrice.ts +31 -0
  495. package/src/b2c/SeProductImageGrid/index.ts +1 -0
  496. package/src/b2c/SeProductImageGrid/types.ts +15 -0
  497. package/src/b2c/SeProductListing/index.ts +2 -0
  498. package/src/b2c/SeProductListing/types.ts +44 -0
  499. package/src/b2c/SeProductListing/useSeProductListing.ts +26 -0
  500. package/src/b2c/SeProductReviews/index.ts +2 -0
  501. package/src/b2c/SeProductReviews/types.ts +34 -0
  502. package/src/b2c/SeProductReviews/useSeProductReviews.ts +52 -0
  503. package/src/b2c/SeValuePropCards/index.ts +2 -0
  504. package/src/b2c/SeValuePropCards/types.ts +27 -0
  505. package/src/b2c/SeValuePropCards/useSeValuePropCardsFilter.ts +44 -0
  506. package/src/b2c/SeVideoHero/index.ts +3 -0
  507. package/src/b2c/SeVideoHero/types.ts +22 -0
  508. package/src/b2c/SeVideoHero/useSeVideoHeroPlayback.ts +159 -0
  509. package/src/b2c/SeVideoHero/videoSource.ts +88 -0
  510. package/src/b2c/index.ts +18 -0
  511. package/src/b2c/shared/filterItemsWithImage.ts +9 -0
  512. package/src/b2c/shared/index.ts +1 -0
  513. package/src/global.d.ts +74 -0
  514. package/src/index.ts +1 -0
@@ -0,0 +1,40 @@
1
+ /** One SKU to save to a purchase list. */
2
+ export type AddToPurchaseListProduct = { skuId: string; quantity: number }
3
+
4
+ export type AddToPurchaseListVisibility = 'private' | 'organization'
5
+
6
+ /** A list the buyer can add items to: their own, or one their organization shares with them. */
7
+ export type AddToPurchaseListOption = {
8
+ documentId: string
9
+ name: string
10
+ visibility: AddToPurchaseListVisibility
11
+ ownerEmail: string
12
+ isOwner: boolean
13
+ items: AddToPurchaseListProduct[]
14
+ }
15
+
16
+ export type AddToPurchaseListError = 'UNAUTHENTICATED' | 'INVALID' | 'NOT_FOUND' | 'FORBIDDEN' | 'CONFLICT' | 'FAILED'
17
+
18
+ /** The text a buyer sees for each error code the resolvers send back. */
19
+ export const ADD_TO_PURCHASE_LIST_ERROR_MESSAGES: Record<AddToPurchaseListError, string> = {
20
+ UNAUTHENTICATED: 'Your session expired. Sign in again to save items to a purchase list.',
21
+ INVALID: 'Please check the name and quantities and try again.',
22
+ NOT_FOUND: 'That purchase list no longer exists.',
23
+ FORBIDDEN: "You can't add items to that list.",
24
+ CONFLICT: 'You already have a purchase list with that name.',
25
+ FAILED: 'Something went wrong. Please try again.',
26
+ }
27
+
28
+ /**
29
+ * What gets sent: whole positive quantities only, one entry per SKU (repeated SKUs summed) --
30
+ * the resolvers answer INVALID to anything else, which would fail the whole request.
31
+ */
32
+ export function purchaseListItemsFrom(products: AddToPurchaseListProduct[]): AddToPurchaseListProduct[] {
33
+ const quantities = new Map<string, number>()
34
+ for (const { skuId, quantity } of products) {
35
+ const units = Math.floor(Number.isFinite(quantity) ? quantity : 0)
36
+ if (!skuId || units <= 0) continue
37
+ quantities.set(skuId, (quantities.get(skuId) ?? 0) + units)
38
+ }
39
+ return [...quantities].map(([skuId, quantity]) => ({ skuId, quantity }))
40
+ }
@@ -0,0 +1,2 @@
1
+ export * from './useAddToPurchaseList'
2
+ export * from './addToPurchaseListUtils'
@@ -0,0 +1,130 @@
1
+ import { useCallback, useMemo, useRef, useState } from 'react'
2
+ import { usePDP } from '@faststore/core'
3
+ import { gql } from '@faststore/core/api'
4
+ import { useLazyQuery_unstable, useSession_unstable } from '@faststore/core/experimental'
5
+ import {
6
+ SE_ADD_TO_PURCHASE_LIST_ADD_ITEMS_MUTATION,
7
+ SE_ADD_TO_PURCHASE_LIST_CREATE_MUTATION,
8
+ SE_ADD_TO_PURCHASE_LIST_LISTS_QUERY,
9
+ } from '@se-faststore/resolvers/b2b'
10
+ import {
11
+ purchaseListItemsFrom,
12
+ type AddToPurchaseListError,
13
+ type AddToPurchaseListOption,
14
+ type AddToPurchaseListProduct,
15
+ type AddToPurchaseListVisibility,
16
+ } from './addToPurchaseListUtils'
17
+
18
+ const ADD_TO_PURCHASE_LIST_LISTS_QUERY = gql(SE_ADD_TO_PURCHASE_LIST_LISTS_QUERY)
19
+ const ADD_TO_PURCHASE_LIST_ADD_ITEMS_MUTATION = gql(SE_ADD_TO_PURCHASE_LIST_ADD_ITEMS_MUTATION)
20
+ const ADD_TO_PURCHASE_LIST_CREATE_MUTATION = gql(SE_ADD_TO_PURCHASE_LIST_CREATE_MUTATION)
21
+
22
+ type Result = { ok: boolean; error?: AddToPurchaseListError | null; list?: AddToPurchaseListOption | null }
23
+ type Session = { person?: { id?: string } | null }
24
+
25
+ export type AddToPurchaseListOutcome =
26
+ | { ok: true; list: AddToPurchaseListOption }
27
+ | { ok: false; error: AddToPurchaseListError }
28
+
29
+ /** The latest value behind a stable ref (FastStore's lazy `execute` changes every render). */
30
+ function useLatest<T>(value: T) {
31
+ const ref = useRef(value)
32
+ ref.current = value
33
+ return ref
34
+ }
35
+
36
+ /** One lazy operation whose single root field holds a `SePurchaseListResult`. */
37
+ function useListMutation<V>(query: unknown, field: string) {
38
+ const [execute] = useLazyQuery_unstable<Record<string, Result | null>, V>(query, {} as V)
39
+ const ref = useLatest(execute)
40
+ return useCallback(
41
+ async (variables: V): Promise<AddToPurchaseListOutcome> => {
42
+ try {
43
+ const response: Record<string, Result | null> | null | undefined = await ref.current(variables)
44
+ const result = response?.[field]
45
+ if (result?.ok && result.list) return { ok: true, list: result.list }
46
+ return { ok: false, error: result?.error ?? 'FAILED' }
47
+ } catch {
48
+ return { ok: false, error: 'FAILED' }
49
+ }
50
+ },
51
+ [ref, field],
52
+ )
53
+ }
54
+
55
+ /**
56
+ * Saves `products` to one of the buyer's purchase lists, or to a new one. The lists are only
57
+ * fetched by `load` (when the picker opens), not on mount: the button sits on every PDP, and
58
+ * most visits never open it.
59
+ */
60
+ export function useAddToPurchaseList(products: AddToPurchaseListProduct[]) {
61
+ const session = useSession_unstable() as Session
62
+ const isLoggedIn = Boolean(session?.person)
63
+ const items = useMemo(() => purchaseListItemsFrom(products), [products])
64
+ const [lists, setLists] = useState<AddToPurchaseListOption[]>([])
65
+ const [state, setState] = useState<'idle' | 'loading' | 'ready' | 'error'>('idle')
66
+
67
+ const [fetchLists] = useLazyQuery_unstable<{ sePurchaseLists?: AddToPurchaseListOption[] | null }, Record<string, never>>(
68
+ ADD_TO_PURCHASE_LIST_LISTS_QUERY,
69
+ {},
70
+ )
71
+ const fetchRef = useLatest(fetchLists)
72
+ const addItemsMutation = useListMutation<{ documentId: string; items: AddToPurchaseListProduct[] }>(
73
+ ADD_TO_PURCHASE_LIST_ADD_ITEMS_MUTATION,
74
+ 'sePurchaseListAddItems',
75
+ )
76
+ const createMutation = useListMutation<{
77
+ name: string
78
+ visibility: AddToPurchaseListVisibility
79
+ items: AddToPurchaseListProduct[]
80
+ }>(ADD_TO_PURCHASE_LIST_CREATE_MUTATION, 'sePurchaseListCreate')
81
+
82
+ const load = useCallback(async () => {
83
+ setState('loading')
84
+ try {
85
+ const response: { sePurchaseLists?: AddToPurchaseListOption[] | null } | null | undefined = await fetchRef.current({})
86
+ setLists(response?.sePurchaseLists ?? [])
87
+ setState('ready')
88
+ } catch {
89
+ setState('error')
90
+ }
91
+ }, [fetchRef])
92
+
93
+ const remember = useCallback((outcome: AddToPurchaseListOutcome) => {
94
+ if (!outcome.ok) return outcome
95
+ const updated = outcome.list
96
+ setLists((current) =>
97
+ current.some((list) => list.documentId === updated.documentId)
98
+ ? current.map((list) => (list.documentId === updated.documentId ? updated : list))
99
+ : [...current, updated],
100
+ )
101
+ return outcome
102
+ }, [])
103
+
104
+ const addTo = useCallback(
105
+ async (documentId: string): Promise<AddToPurchaseListOutcome> =>
106
+ items.length === 0 ? { ok: false, error: 'INVALID' } : remember(await addItemsMutation({ documentId, items })),
107
+ [items, addItemsMutation, remember],
108
+ )
109
+
110
+ const createWith = useCallback(
111
+ async (name: string, visibility: AddToPurchaseListVisibility): Promise<AddToPurchaseListOutcome> =>
112
+ items.length === 0 ? { ok: false, error: 'INVALID' } : remember(await createMutation({ name, visibility, items })),
113
+ [items, createMutation, remember],
114
+ )
115
+
116
+ return { isLoggedIn, items, lists, state, load, addTo, createWith }
117
+ }
118
+
119
+ type PdpContext = { data?: { product?: { sku?: string | null } | null } | null } | null | undefined
120
+
121
+ /**
122
+ * The PDP's current SKU (the variant the shopper has selected), as the one product to save. Empty
123
+ * outside a PDP. Reads FastStore's page context, which only the store's own @faststore/core
124
+ * provides -- fine here: this component is source-copied into the store anyway.
125
+ */
126
+ export function usePdpPurchaseListProducts(quantity = 1): AddToPurchaseListProduct[] {
127
+ const context = usePDP() as PdpContext
128
+ const skuId = context?.data?.product?.sku ?? ''
129
+ return useMemo(() => (skuId ? [{ skuId, quantity }] : []), [skuId, quantity])
130
+ }
@@ -0,0 +1 @@
1
+ export * from './useAddressSelector'
@@ -0,0 +1,157 @@
1
+ import { useCallback, useEffect, useRef, useState } from 'react'
2
+ import { gql } from '@faststore/core/api'
3
+ import { sessionStore_unstable, useLazyQuery_unstable, useSession_unstable } from '@faststore/core/experimental'
4
+ import { SE_SHOPPER_ADDRESSES_QUERY } from '@se-faststore/resolvers/b2b'
5
+
6
+ const SHOPPER_ADDRESSES_QUERY = gql(SE_SHOPPER_ADDRESSES_QUERY)
7
+
8
+ const CACHE_KEY = 'seShopperAddressesCache'
9
+ const CACHE_MAX_AGE = 30 * 60 * 1000
10
+
11
+ export type ShopperAddress = {
12
+ id: string
13
+ addressType: string | null
14
+ isActive: boolean | null
15
+ country: string | null
16
+ state: string | null
17
+ city: string | null
18
+ neighborhood: string | null
19
+ street: string | null
20
+ postalCode: string | null
21
+ }
22
+
23
+ export type ShopperAddresses = { defaultAddressId: string | null; addresses: ShopperAddress[] }
24
+
25
+ type ShopperAddressesResponse = { seShopperAddresses?: ShopperAddresses | null }
26
+
27
+ type Session = Record<string, unknown> & {
28
+ postalCode?: string | null
29
+ isValidating?: boolean
30
+ b2b?: { userEmail?: string; unitId?: string; customerId?: string } | null
31
+ }
32
+
33
+ /** "Neighborhood, City, ST 12345" — whichever parts the address has. */
34
+ export function formatShopperAddress(address: ShopperAddress): string {
35
+ const place = [address.neighborhood, address.city].filter(Boolean).join(', ')
36
+ const region = [address.state, address.postalCode].filter(Boolean).join(' ')
37
+ return [place, region].filter(Boolean).join(', ')
38
+ }
39
+
40
+ type CacheEntry = { data: ShopperAddresses; timestamp: number; userEmail: string }
41
+
42
+ function readCache(userEmail: string): ShopperAddresses | undefined {
43
+ try {
44
+ const raw = window.localStorage.getItem(CACHE_KEY)
45
+ if (!raw) return undefined
46
+ const entry = JSON.parse(raw) as CacheEntry
47
+ if (entry.userEmail !== userEmail || Date.now() - entry.timestamp > CACHE_MAX_AGE) return undefined
48
+ return entry.data
49
+ } catch {
50
+ return undefined
51
+ }
52
+ }
53
+
54
+ function writeCache(userEmail: string, data: ShopperAddresses): void {
55
+ try {
56
+ window.localStorage.setItem(CACHE_KEY, JSON.stringify({ data, timestamp: Date.now(), userEmail } as CacheEntry))
57
+ } catch {
58
+ // Storage full or disabled: the selector still works, it just refetches next time.
59
+ }
60
+ }
61
+
62
+ /**
63
+ * Points FastStore's session (and so regionalization: prices, availability, shipping) at
64
+ * `address`. Mirrors the kit's `submitAddress`, minus the session's transient `isValidating`.
65
+ */
66
+ function applyAddressToSession(session: Session, address: ShopperAddress): void {
67
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars -- dropped on purpose, see above
68
+ const { isValidating, ...current } = session
69
+ sessionStore_unstable.set({
70
+ ...current,
71
+ country: address.country ?? current.country,
72
+ addressType: address.addressType ?? current.addressType,
73
+ city: address.city ?? current.city,
74
+ postalCode: address.postalCode ?? current.postalCode,
75
+ } as Parameters<typeof sessionStore_unstable.set>[0])
76
+ }
77
+
78
+ /**
79
+ * The B2B shopper's saved addresses and which one the session ships to, plus `select` to switch.
80
+ *
81
+ * Replaces the kit's `RegionalizationB2B` + `AddressSelector` pair: on first load, a session
82
+ * with no postal code yet is pointed at the shopper's default shipping address (what the kit's
83
+ * navbar used to do on every page).
84
+ */
85
+ export function useAddressSelector() {
86
+ const session = useSession_unstable() as Session
87
+ const userEmail = session?.b2b?.userEmail
88
+ const [data, setData] = useState<ShopperAddresses | undefined>()
89
+ const [selectedId, setSelectedId] = useState<string | undefined>()
90
+ const [fetchAddresses] = useLazyQuery_unstable<ShopperAddressesResponse, Record<string, never>>(SHOPPER_ADDRESSES_QUERY, {})
91
+ // FastStore's real lazy `execute` (and the session object) change identity every render; read
92
+ // them through refs instead of listing them as effect dependencies (see useRecentOrdersSpendOverview.ts).
93
+ const fetchRef = useRef(fetchAddresses)
94
+ fetchRef.current = fetchAddresses
95
+ const sessionRef = useRef(session)
96
+ sessionRef.current = session
97
+
98
+ useEffect(() => {
99
+ if (!userEmail) return
100
+ let cancelled = false
101
+
102
+ const applyData = (next: ShopperAddresses) => {
103
+ setData(next)
104
+ const current = sessionRef.current
105
+ if (!current.postalCode && next.defaultAddressId) {
106
+ const fallback = next.addresses.find((address) => address.id === next.defaultAddressId)
107
+ if (fallback) applyAddressToSession(current, fallback)
108
+ }
109
+ }
110
+
111
+ const cached = readCache(userEmail)
112
+ if (cached) {
113
+ applyData(cached)
114
+ return
115
+ }
116
+
117
+ fetchRef
118
+ .current({})
119
+ .then((result: ShopperAddressesResponse | null | undefined) => {
120
+ if (cancelled || !result?.seShopperAddresses) return
121
+ writeCache(userEmail, result.seShopperAddresses)
122
+ applyData(result.seShopperAddresses)
123
+ })
124
+ .catch(() => {
125
+ // Nothing to show; the component renders only its "add address" link.
126
+ })
127
+
128
+ return () => {
129
+ cancelled = true
130
+ }
131
+ }, [userEmail])
132
+
133
+ const addresses = data?.addresses ?? []
134
+ const current =
135
+ addresses.find((address) => address.id === selectedId) ??
136
+ addresses.find((address) => address.postalCode && address.postalCode === session?.postalCode)
137
+
138
+ const select = useCallback(
139
+ (addressId: string) => {
140
+ const address = addresses.find((candidate) => candidate.id === addressId)
141
+ if (!address || address.id === current?.id) return
142
+ setSelectedId(address.id)
143
+ applyAddressToSession(sessionRef.current, address)
144
+ },
145
+ [addresses, current?.id],
146
+ )
147
+
148
+ return {
149
+ isB2b: Boolean(userEmail),
150
+ unitId: session?.b2b?.unitId,
151
+ customerId: session?.b2b?.customerId,
152
+ loaded: data !== undefined,
153
+ addresses,
154
+ current,
155
+ select,
156
+ }
157
+ }
@@ -0,0 +1 @@
1
+ export * from './types'
@@ -0,0 +1,8 @@
1
+ export type CategoryBanner = {
2
+ title?: string
3
+ text?: string
4
+ linkText?: string
5
+ url?: string
6
+ /** Background image URL (CMS media gallery). */
7
+ banner?: string
8
+ }
@@ -0,0 +1,126 @@
1
+ export type StockSku = {
2
+ itemId: string
3
+ name: string
4
+ ean?: string | null
5
+ referenceCode?: string | null
6
+ unitMultiplier?: number | null
7
+ imageUrl?: string | null
8
+ imageAlt?: string | null
9
+ variations: Array<{ name: string; values: string[] }>
10
+ sellerId?: string | null
11
+ price?: number | null
12
+ listPrice?: number | null
13
+ availableQuantity: number
14
+ }
15
+
16
+ /** A `SeSkuSearch` result product: the native fields the cart needs plus `seSkus`. */
17
+ export type StockProduct = {
18
+ slug: string
19
+ brand?: { name?: string | null } | null
20
+ isVariantOf: { name: string; productGroupID: string }
21
+ additionalProperty?: Array<{ propertyID?: string | null; name: string }> | null
22
+ seSkus?: StockSku[] | null
23
+ }
24
+
25
+ export type StockStatus = 'In Stock' | 'Low Stock' | 'Out of Stock'
26
+
27
+ export type StockAvailability = {
28
+ status: StockStatus
29
+ /** Null when the simulation only said whether the SKU is available, not how many units. */
30
+ quantity: number | null
31
+ }
32
+
33
+ export type StockRow = {
34
+ product: StockProduct
35
+ sku: StockSku
36
+ quantity: number
37
+ /** Undefined while the simulation is running; null when it failed. */
38
+ availability?: StockAvailability | null
39
+ }
40
+
41
+ export type StockMoneyFormat = { locale: string; currency: string }
42
+
43
+ export function formatStockMoney(value: number, { locale, currency }: StockMoneyFormat): string {
44
+ return value.toLocaleString(locale, { style: 'currency', currency, currencyDisplay: 'narrowSymbol' })
45
+ }
46
+
47
+ /**
48
+ * Maps a simulation result to a buyer-facing status. `lowStockThreshold` units or more is
49
+ * "In Stock" (the kit used 50); with no unit count, VTEX's own "available" means in stock.
50
+ */
51
+ export function stockStatus(
52
+ result: { availability?: string | null; availableQuantity?: number | null },
53
+ lowStockThreshold: number,
54
+ ): StockAvailability {
55
+ if (typeof result.availableQuantity === 'number') {
56
+ const quantity = result.availableQuantity
57
+ return {
58
+ status: quantity <= 0 ? 'Out of Stock' : quantity >= lowStockThreshold ? 'In Stock' : 'Low Stock',
59
+ quantity,
60
+ }
61
+ }
62
+ return { status: result.availability === 'available' ? 'In Stock' : 'Out of Stock', quantity: null }
63
+ }
64
+
65
+ /** SKUs of `products` whose reference code contains `term` (case-insensitive), or whose id is `term`. */
66
+ export function matchSkus(products: StockProduct[], term: string): Array<{ product: StockProduct; sku: StockSku }> {
67
+ const needle = term.trim().toLowerCase()
68
+ if (!needle) return []
69
+ return products.flatMap((product) =>
70
+ (product.seSkus ?? [])
71
+ .filter((sku) => sku.referenceCode?.toLowerCase().includes(needle) || sku.itemId === term.trim())
72
+ .map((sku) => ({ product, sku })),
73
+ )
74
+ }
75
+
76
+ /** The SKU whose reference code is exactly `refId` (CSV import), case-insensitive. */
77
+ export function findSkuByRefId(products: StockProduct[], refId: string) {
78
+ const needle = refId.trim().toLowerCase()
79
+ for (const product of products) {
80
+ const sku = product.seSkus?.find((candidate) => candidate.referenceCode?.toLowerCase() === needle)
81
+ if (sku) return { product, sku }
82
+ }
83
+ return undefined
84
+ }
85
+
86
+ /** FastStore PDP URL of one SKU: `/{product-slug}-{skuId}/p` (search slugs end in the product's own SKU id). */
87
+ export function skuHref(product: StockProduct, sku: StockSku): string {
88
+ return `/${product.slug.replace(/-\d+$/, '')}-${sku.itemId}/p`
89
+ }
90
+
91
+ /** A cart item in the shape FastStore's `useBuyButton` expects. */
92
+ export function toCartItem({ product, sku, quantity }: StockRow) {
93
+ const price = sku.price ?? 0
94
+ return {
95
+ id: sku.itemId,
96
+ quantity,
97
+ price,
98
+ priceWithTaxes: price,
99
+ listPrice: sku.listPrice ?? price,
100
+ listPriceWithTaxes: sku.listPrice ?? price,
101
+ seller: { identifier: sku.sellerId ?? '1' },
102
+ itemOffered: {
103
+ sku: sku.itemId,
104
+ name: sku.name,
105
+ gtin: sku.ean ?? '',
106
+ image: sku.imageUrl ? [{ url: sku.imageUrl, alternateName: sku.imageAlt ?? sku.name }] : [],
107
+ brand: { name: product.brand?.name ?? '' },
108
+ isVariantOf: {
109
+ name: product.isVariantOf.name,
110
+ productGroupID: product.isVariantOf.productGroupID,
111
+ skuVariants: {
112
+ activeVariations: Object.fromEntries(sku.variations.map((variation) => [variation.name, variation.values[0]])),
113
+ slugsMap: null,
114
+ availableVariations: null,
115
+ },
116
+ },
117
+ additionalProperty: sku.variations.map((variation) => ({
118
+ name: variation.name,
119
+ propertyID: product.additionalProperty?.find((property) => property.name === variation.name)?.propertyID ?? '',
120
+ value: variation.values[0],
121
+ valueReference: 'SPECIFICATION',
122
+ })),
123
+ unitMultiplier: sku.unitMultiplier ?? 1,
124
+ },
125
+ }
126
+ }
@@ -0,0 +1,3 @@
1
+ export * from './useCheckStockAndPricing'
2
+ export * from './checkStockAndPricingUtils'
3
+ export * from './stockCsv'
@@ -0,0 +1,77 @@
1
+ export type StockCsvRow = { line: number; refId: string; quantity: number }
2
+ export type StockCsvError = { line: number; refId: string; message: string }
3
+
4
+ /** Splits one CSV line on `delimiter`, honoring double-quoted fields ("a, b" and "" escapes). */
5
+ function splitCsvLine(line: string, delimiter: string): string[] {
6
+ const fields: string[] = []
7
+ let field = ''
8
+ let quoted = false
9
+
10
+ for (let i = 0; i < line.length; i++) {
11
+ const char = line[i]
12
+ if (quoted) {
13
+ if (char === '"' && line[i + 1] === '"') {
14
+ field += '"'
15
+ i++
16
+ } else if (char === '"') {
17
+ quoted = false
18
+ } else {
19
+ field += char
20
+ }
21
+ } else if (char === '"') {
22
+ quoted = true
23
+ } else if (char === delimiter) {
24
+ fields.push(field)
25
+ field = ''
26
+ } else {
27
+ field += char
28
+ }
29
+ }
30
+ fields.push(field)
31
+ return fields.map((value) => value.trim())
32
+ }
33
+
34
+ /**
35
+ * Parses a `refId,quantity` CSV (header row required, any column order, extra columns ignored;
36
+ * `;` works too, as Excel writes in many locales). Quantity defaults to 1. Replaces the kit's
37
+ * papaparse dependency, which every store installing this component would have had to add.
38
+ */
39
+ export function parseStockCsv(text: string): { rows: StockCsvRow[]; errors: StockCsvError[] } {
40
+ const lines = text.replace(/^\uFEFF/, '').split(/\r?\n/)
41
+ const headerLine = lines[0] ?? ''
42
+ const delimiter = (headerLine.match(/;/g)?.length ?? 0) > (headerLine.match(/,/g)?.length ?? 0) ? ';' : ','
43
+ const headers = splitCsvLine(headerLine, delimiter).map((header) => header.toLowerCase())
44
+ const refIndex = headers.findIndex((header) => header === 'refid' || header === 'ref id' || header === 'reference')
45
+ const quantityIndex = headers.findIndex((header) => header === 'quantity' || header === 'qty')
46
+
47
+ if (refIndex === -1) {
48
+ return { rows: [], errors: [{ line: 1, refId: '', message: 'Missing "refId" column' }] }
49
+ }
50
+
51
+ const rows: StockCsvRow[] = []
52
+ const errors: StockCsvError[] = []
53
+
54
+ lines.slice(1).forEach((line, index) => {
55
+ if (!line.trim()) return
56
+ const lineNumber = index + 2
57
+ const fields = splitCsvLine(line, delimiter)
58
+ const refId = fields[refIndex] ?? ''
59
+ const rawQuantity = quantityIndex === -1 ? '' : (fields[quantityIndex] ?? '')
60
+ const quantity = rawQuantity === '' ? 1 : Number(rawQuantity)
61
+
62
+ if (!refId) {
63
+ errors.push({ line: lineNumber, refId: '', message: 'Missing refId' })
64
+ } else if (!Number.isInteger(quantity) || quantity < 1) {
65
+ errors.push({ line: lineNumber, refId, message: 'Invalid quantity' })
66
+ } else {
67
+ rows.push({ line: lineNumber, refId, quantity })
68
+ }
69
+ })
70
+
71
+ return { rows, errors }
72
+ }
73
+
74
+ /** A starter file for the import, built in the browser (the kit linked to a file on Google Drive). */
75
+ export function stockCsvTemplateHref(): string {
76
+ return `data:text/csv;charset=utf-8,${encodeURIComponent('refId,quantity\nREF-0001,10\nREF-0002,5\n')}`
77
+ }