@se-faststore/components 0.0.0-stage → 0.12.1

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 +93 -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,272 @@
1
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
2
+ import { gql } from '@faststore/core/api'
3
+ import { useBuyButton_unstable, useLazyQuery_unstable, useSession_unstable } from '@faststore/core/experimental'
4
+ import { SE_SKU_AVAILABILITY_QUERY, SE_SKU_SEARCH_QUERY } from '@se-faststore/resolvers/b2b'
5
+ import {
6
+ findSkuByRefId,
7
+ formatStockMoney,
8
+ matchSkus,
9
+ stockStatus,
10
+ toCartItem,
11
+ type StockMoneyFormat,
12
+ type StockProduct,
13
+ type StockRow,
14
+ type StockSku,
15
+ } from './checkStockAndPricingUtils'
16
+ import { parseStockCsv, type StockCsvError } from './stockCsv'
17
+
18
+ const SKU_SEARCH_QUERY = gql(SE_SKU_SEARCH_QUERY)
19
+ const SKU_AVAILABILITY_QUERY = gql(SE_SKU_AVAILABILITY_QUERY)
20
+
21
+ const SEARCH_RESULTS = 10
22
+ const MIN_SEARCH_LENGTH = 3
23
+ const SEARCH_DEBOUNCE = 300
24
+ const IMPORT_CONCURRENCY = 4
25
+
26
+ type SearchResponse = { search?: { products?: { edges?: Array<{ node: StockProduct }> } } | null }
27
+ type AvailabilityResponse = {
28
+ seSkuAvailability?: Array<{ id: string; availability?: string | null; availableQuantity?: number | null }> | null
29
+ }
30
+ type AvailabilityVariables = { items: Array<{ id: string; seller: string }>; country: string; postalCode?: string | null }
31
+
32
+ type Session = {
33
+ person?: { id?: string } | null
34
+ country?: string
35
+ postalCode?: string | null
36
+ locale?: string
37
+ currency?: { code?: string }
38
+ }
39
+
40
+ export type StockImportReport = {
41
+ found: Array<{ line: number; refId: string; quantity: number; product: StockProduct; sku: StockSku }>
42
+ errors: StockCsvError[]
43
+ }
44
+
45
+ /** The latest value behind a stable ref (FastStore's lazy `execute` changes every render). */
46
+ function useLatest<T>(value: T) {
47
+ const ref = useRef(value)
48
+ ref.current = value
49
+ return ref
50
+ }
51
+
52
+ /** Runs `task` over `items` with at most `limit` in flight. */
53
+ async function mapWithConcurrency<T, R>(items: T[], limit: number, task: (item: T) => Promise<R>): Promise<R[]> {
54
+ const results: R[] = new Array(items.length)
55
+ let next = 0
56
+ const workers = Array.from({ length: Math.min(limit, items.length) }, async () => {
57
+ while (next < items.length) {
58
+ const index = next++
59
+ results[index] = await task(items[index] as T)
60
+ }
61
+ })
62
+ await Promise.all(workers)
63
+ return results
64
+ }
65
+
66
+ /**
67
+ * The "check stock and pricing" worksheet: SKUs added by reference-code search or CSV import,
68
+ * each with its session price and live stock (cart simulation), quantities, totals, and one
69
+ * add-to-cart for all of it.
70
+ *
71
+ * Replaces the kit's queue of chained effects (one search and one simulation per row, in
72
+ * series) with plain async calls: an import searches a few reference codes at a time and
73
+ * simulates every new SKU in one request.
74
+ */
75
+ export function useCheckStockAndPricing({ lowStockThreshold = 50 }: { lowStockThreshold?: number } = {}) {
76
+ const session = useSession_unstable() as Session
77
+ const money: StockMoneyFormat = { locale: session?.locale ?? 'en-US', currency: session?.currency?.code ?? 'USD' }
78
+ const [rows, setRows] = useState<StockRow[]>([])
79
+
80
+ const [searchExecute] = useLazyQuery_unstable<SearchResponse, { term: string; first: number }>(SKU_SEARCH_QUERY, {
81
+ term: '',
82
+ first: SEARCH_RESULTS,
83
+ })
84
+ const [availabilityExecute] = useLazyQuery_unstable<AvailabilityResponse, AvailabilityVariables>(
85
+ SKU_AVAILABILITY_QUERY,
86
+ { items: [], country: '' },
87
+ )
88
+ const rowsRef = useLatest(rows)
89
+ const searchRef = useLatest(searchExecute)
90
+ const availabilityRef = useLatest(availabilityExecute)
91
+ const sessionRef = useLatest(session)
92
+
93
+ const searchProducts = useCallback(
94
+ async (term: string): Promise<StockProduct[]> => {
95
+ const result: SearchResponse | null | undefined = await searchRef.current({ term, first: SEARCH_RESULTS })
96
+ return result?.search?.products?.edges?.map((edge) => edge.node) ?? []
97
+ },
98
+ [searchRef],
99
+ )
100
+
101
+ /** Simulates every given SKU in one request and stores the result on its row. */
102
+ const checkAvailability = useCallback(
103
+ async (skus: StockSku[]) => {
104
+ const items = skus.filter((sku) => sku.sellerId).map((sku) => ({ id: sku.itemId, seller: sku.sellerId as string }))
105
+ const ids = new Set(skus.map((sku) => sku.itemId))
106
+ // Rows are added before their stock is known; once it is, cap the quantity to it (an
107
+ // out-of-stock SKU drops to 0 instead of silently counting toward the total).
108
+ const settle = (byId: Map<string, StockRow['availability']>) =>
109
+ setRows((current) =>
110
+ current.map((row) => {
111
+ if (!ids.has(row.sku.itemId)) return row
112
+ const availability = byId.get(row.sku.itemId) ?? null
113
+ const max = availability?.quantity ?? (availability?.status === 'Out of Stock' ? 0 : row.quantity)
114
+ return { ...row, availability, quantity: Math.min(row.quantity, max) }
115
+ }),
116
+ )
117
+
118
+ const { country, postalCode } = sessionRef.current
119
+ if (items.length === 0 || !country) {
120
+ settle(new Map())
121
+ return
122
+ }
123
+
124
+ try {
125
+ const result: AvailabilityResponse | null | undefined = await availabilityRef.current({ items, country, postalCode })
126
+ settle(
127
+ new Map(
128
+ (result?.seSkuAvailability ?? []).map((entry) => [entry.id, stockStatus(entry, lowStockThreshold)] as const),
129
+ ),
130
+ )
131
+ } catch {
132
+ settle(new Map())
133
+ }
134
+ },
135
+ [availabilityRef, sessionRef, lowStockThreshold],
136
+ )
137
+
138
+ /** Adds SKUs (or raises the quantity of ones already listed), then checks stock for the new ones. */
139
+ const addSkus = useCallback(
140
+ (entries: Array<{ product: StockProduct; sku: StockSku; quantity: number }>) => {
141
+ // Decided from the rows as last rendered, not inside the updater below: React may run an
142
+ // updater later (during the next render), so it can't be relied on to report what it added.
143
+ const listed = new Set(rowsRef.current.map((row) => row.sku.itemId))
144
+ const added = new Map<string, StockSku>()
145
+ for (const entry of entries) if (!listed.has(entry.sku.itemId)) added.set(entry.sku.itemId, entry.sku)
146
+
147
+ setRows((current) => {
148
+ const next = [...current]
149
+ for (const entry of entries) {
150
+ const existing = next.findIndex((row) => row.sku.itemId === entry.sku.itemId)
151
+ if (existing === -1) {
152
+ next.push({ product: entry.product, sku: entry.sku, quantity: entry.quantity })
153
+ } else {
154
+ const row = next[existing] as StockRow
155
+ next[existing] = { ...row, quantity: row.quantity + entry.quantity }
156
+ }
157
+ }
158
+ return next
159
+ })
160
+ if (added.size > 0) void checkAvailability([...added.values()])
161
+ },
162
+ [checkAvailability, rowsRef],
163
+ )
164
+
165
+ const setQuantity = useCallback((itemId: string, quantity: number) => {
166
+ setRows((current) =>
167
+ current.map((row) => {
168
+ if (row.sku.itemId !== itemId) return row
169
+ const max = row.availability?.quantity ?? Number.POSITIVE_INFINITY
170
+ const clamped = Math.max(0, Math.min(Number.isFinite(quantity) ? Math.floor(quantity) : 0, max))
171
+ return { ...row, quantity: clamped }
172
+ }),
173
+ )
174
+ }, [])
175
+
176
+ const remove = useCallback((itemId: string) => {
177
+ setRows((current) => current.filter((row) => row.sku.itemId !== itemId))
178
+ }, [])
179
+
180
+ const clear = useCallback(() => setRows([]), [])
181
+
182
+ /** Resolves every CSV row to a SKU by exact reference code; nothing is added until `confirmImport`. */
183
+ const importCsv = useCallback(
184
+ async (text: string): Promise<StockImportReport> => {
185
+ const { rows: csvRows, errors } = parseStockCsv(text)
186
+ const lookups = await mapWithConcurrency(csvRows, IMPORT_CONCURRENCY, async (row) => {
187
+ try {
188
+ return { row, match: findSkuByRefId(await searchProducts(row.refId), row.refId) }
189
+ } catch {
190
+ return { row, match: undefined }
191
+ }
192
+ })
193
+
194
+ const report: StockImportReport = { found: [], errors: [...errors] }
195
+ for (const { row, match } of lookups) {
196
+ if (match) report.found.push({ ...row, ...match })
197
+ else report.errors.push({ line: row.line, refId: row.refId, message: 'SKU not found' })
198
+ }
199
+ report.errors.sort((a, b) => a.line - b.line)
200
+ return report
201
+ },
202
+ [searchProducts],
203
+ )
204
+
205
+ const confirmImport = useCallback(
206
+ (report: StockImportReport) => addSkus(report.found.map(({ product, sku, quantity }) => ({ product, sku, quantity }))),
207
+ [addSkus],
208
+ )
209
+
210
+ const purchasable = rows.filter((row) => row.quantity > 0 && typeof row.sku.price === 'number' && row.sku.sellerId)
211
+ const cartItems = useMemo(() => purchasable.map(toCartItem), [purchasable])
212
+ // `as never`: matches the store's generated CartItem shape, built field by field in toCartItem.
213
+ const buyButton = useBuyButton_unstable(cartItems as never)
214
+ const totalItems = purchasable.reduce((sum, row) => sum + row.quantity, 0)
215
+ const totalValue = purchasable.reduce((sum, row) => sum + row.quantity * (row.sku.price ?? 0), 0)
216
+
217
+ return {
218
+ isLoggedIn: Boolean(session?.person),
219
+ money,
220
+ rows,
221
+ searchProducts,
222
+ addSkus,
223
+ setQuantity,
224
+ remove,
225
+ clear,
226
+ importCsv,
227
+ confirmImport,
228
+ totalItems,
229
+ total: formatStockMoney(totalValue, money),
230
+ addAllToCart: (event: { preventDefault(): void }) => {
231
+ buyButton.onClick(event)
232
+ setRows([])
233
+ },
234
+ }
235
+ }
236
+
237
+ /** Debounced reference-code search for the worksheet's search box (three characters minimum). */
238
+ export function useStockSkuSearch(searchProducts: (term: string) => Promise<StockProduct[]>, term: string) {
239
+ const [results, setResults] = useState<Array<{ product: StockProduct; sku: StockSku }>>([])
240
+ const [searching, setSearching] = useState(false)
241
+
242
+ useEffect(() => {
243
+ const trimmed = term.trim()
244
+ if (trimmed.length < MIN_SEARCH_LENGTH) {
245
+ setResults([])
246
+ setSearching(false)
247
+ return
248
+ }
249
+
250
+ let cancelled = false
251
+ setSearching(true)
252
+ const timer = setTimeout(() => {
253
+ searchProducts(trimmed)
254
+ .then((products) => {
255
+ if (!cancelled) setResults(matchSkus(products, trimmed))
256
+ })
257
+ .catch(() => {
258
+ if (!cancelled) setResults([])
259
+ })
260
+ .finally(() => {
261
+ if (!cancelled) setSearching(false)
262
+ })
263
+ }, SEARCH_DEBOUNCE)
264
+
265
+ return () => {
266
+ cancelled = true
267
+ clearTimeout(timer)
268
+ }
269
+ }, [term, searchProducts])
270
+
271
+ return { results, searching, minLength: MIN_SEARCH_LENGTH }
272
+ }
@@ -0,0 +1 @@
1
+ export * from './useCrossSellingShelfOverride'
@@ -0,0 +1,25 @@
1
+ import { useMemo, type ReactElement } from 'react'
2
+ import { CrossSellingShelfSection, getOverriddenSection } from '@faststore/core'
3
+ import type { SeProductSummary } from '../SeCustomProductCard/types'
4
+
5
+ export type CrossSellingProductCard = (props: { product: SeProductSummary; index: number }) => ReactElement | null
6
+
7
+ /**
8
+ * FastStore's native `CrossSellingShelf` section (it reads the PDP context and queries "who
9
+ * bought/saw also..." itself) with only its product card swapped out. Memoized so the section
10
+ * isn't re-created — and its data re-fetched — on every render; pass a stable (module-level)
11
+ * `ProductCard`.
12
+ */
13
+ export function useCrossSellingShelfOverride(ProductCard: CrossSellingProductCard, className?: string) {
14
+ return useMemo(
15
+ () =>
16
+ getOverriddenSection({
17
+ Section: CrossSellingShelfSection,
18
+ className,
19
+ components: {
20
+ __experimentalProductCard: { Component: ProductCard },
21
+ },
22
+ }),
23
+ [ProductCard, className],
24
+ )
25
+ }
@@ -0,0 +1,2 @@
1
+ export * from './types'
2
+ export * from './useB2bProductCard'
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The subset of FastStore's `ProductSummary_product` fragment (what `useProductsQuery` and the
3
+ * native shelves hand to a product card) that the B2B card actually reads. Typed locally because
4
+ * the real generated type only exists inside a consuming FastStore project's codegen output.
5
+ */
6
+ export type SeProductSummary = {
7
+ id: string
8
+ slug: string
9
+ sku: string
10
+ name: string
11
+ gtin?: string
12
+ brand?: { name?: string }
13
+ isVariantOf: { productGroupID: string; name: string }
14
+ image?: Array<{ url?: string; alternateName?: string }>
15
+ offers: { offers: Array<{ price: number; listPrice?: number }> }
16
+ }
@@ -0,0 +1,53 @@
1
+ import {
2
+ useFormattedPrice_unstable,
3
+ useProductLink_unstable,
4
+ useSession_unstable,
5
+ } from '@faststore/core/experimental'
6
+ import type { SeProductSummary } from './types'
7
+
8
+ export type B2bProductCard = {
9
+ name: string
10
+ imageUrl?: string
11
+ imageAlt: string
12
+ href: string
13
+ onClick: () => void
14
+ /** Prices are login-gated: only signed-in shoppers see them. */
15
+ isLoggedIn: boolean
16
+ /** Formatted with the session's own locale/currency. Equal when there's one price only. */
17
+ minPrice: string
18
+ maxPrice: string
19
+ hasPriceRange: boolean
20
+ }
21
+
22
+ /**
23
+ * Derives what the login-gated B2B product card shows. Ported from the kit's
24
+ * `CustomProductCard`, which hardcoded `en-US`/`USD` through its own `formatPrice`; this formats
25
+ * through FastStore's `useFormattedPrice_unstable` so it follows the session currency instead.
26
+ */
27
+ export function useB2bProductCard(product: SeProductSummary, index = 0): B2bProductCard {
28
+ const { person } = useSession_unstable()
29
+ const { href, onClick } = useProductLink_unstable({ product, selectedOffer: 0, index })
30
+
31
+ const prices = (product.offers?.offers ?? []).map((offer) => offer.price).filter((price) => price > 0)
32
+ const min = prices.length ? Math.min(...prices) : 0
33
+ const max = prices.length ? Math.max(...prices) : 0
34
+
35
+ // Both hooks always run (fixed hook order), even when the range collapses to one price.
36
+ const minPrice = useFormattedPrice_unstable(min)
37
+ const maxPrice = useFormattedPrice_unstable(max)
38
+
39
+ const image = product.image?.[0]
40
+ const name = product.isVariantOf?.name ?? product.name
41
+
42
+ return {
43
+ name,
44
+ imageUrl: image?.url?.trim() || undefined,
45
+ imageAlt: image?.alternateName || name,
46
+ href,
47
+ onClick,
48
+ isLoggedIn: Boolean(person),
49
+ minPrice,
50
+ maxPrice,
51
+ hasPriceRange: min !== max,
52
+ }
53
+ }
@@ -0,0 +1,2 @@
1
+ export * from './types'
2
+ export * from './useB2bShelfProducts'
@@ -0,0 +1,14 @@
1
+ export type SeShelfSort =
2
+ | 'score_desc'
3
+ | 'price_desc'
4
+ | 'price_asc'
5
+ | 'orders_desc'
6
+ | 'name_asc'
7
+ | 'name_desc'
8
+ | 'release_desc'
9
+ | 'discount_desc'
10
+
11
+ export type SeShelfFacet = {
12
+ key: string
13
+ value: string
14
+ }
@@ -0,0 +1,31 @@
1
+ import { useProductsQuery } from '@faststore/core'
2
+ import type { SeProductSummary } from '../SeCustomProductCard/types'
3
+ import type { SeShelfFacet, SeShelfSort } from './types'
4
+
5
+ export type B2bShelfQuery = {
6
+ numberOfItems?: number
7
+ sort?: SeShelfSort
8
+ term?: string
9
+ selectedFacets?: SeShelfFacet[]
10
+ }
11
+
12
+ /**
13
+ * Products for a B2B shelf through FastStore's own `useProductsQuery` — a native query, so
14
+ * there's no custom GraphQL here and no copy-paste distribution needed. Facets missing a key or
15
+ * value are dropped (a half-filled CMS row would otherwise be sent as an empty facet).
16
+ */
17
+ export function useB2bShelfProducts({
18
+ numberOfItems = 10,
19
+ sort = 'score_desc',
20
+ term = '',
21
+ selectedFacets = [],
22
+ }: B2bShelfQuery): SeProductSummary[] {
23
+ const data = useProductsQuery({
24
+ first: numberOfItems,
25
+ term,
26
+ sort,
27
+ selectedFacets: selectedFacets.filter((facet) => facet?.key && facet?.value),
28
+ })
29
+
30
+ return (data?.search?.products?.edges ?? []).map((edge) => edge.node as SeProductSummary)
31
+ }
@@ -0,0 +1 @@
1
+ export * from './useDashboards'
@@ -0,0 +1,211 @@
1
+ import { useEffect, useRef, useState } from 'react'
2
+ import { gql } from '@faststore/core/api'
3
+ import { useLazyQuery_unstable, useSession_unstable } from '@faststore/core/experimental'
4
+ import { SE_DASHBOARD_SUMMARY_QUERY, SE_LOW_STOCK_ITEMS_QUERY } from '@se-faststore/resolvers/b2b'
5
+
6
+ const DASHBOARD_SUMMARY_QUERY = gql(SE_DASHBOARD_SUMMARY_QUERY)
7
+ const LOW_STOCK_ITEMS_QUERY = gql(SE_LOW_STOCK_ITEMS_QUERY)
8
+
9
+ const CACHE_MAX_AGE = 3 * 60 * 60 * 1000
10
+ const SUMMARY_CACHE_KEY = 'seDashboardSummaryCache'
11
+ const LOW_STOCK_CACHE_KEY = 'seLowStockCache'
12
+
13
+ /** The low-stock service answers null while it's still computing. */
14
+ const LOW_STOCK_MAX_RETRIES = 5
15
+ const LOW_STOCK_RETRY_DELAY = 1500
16
+
17
+ export type DashboardBudget = { id: string; balance: { amount: number; remaining: number } }
18
+
19
+ export type DashboardSummary = {
20
+ openOrders: number | null
21
+ pendingApproval: number | null
22
+ /** Percentage of the unit's active budgets still unspent, 0–100; null when unknown. */
23
+ budgetRemainingPercent: number | null
24
+ }
25
+
26
+ export type LowStockItem = {
27
+ total: number
28
+ sku: { id: string; name: string; imageUrl: string | null; detailUrl: string | null }
29
+ }
30
+
31
+ export type LowStockItems = { lowStockCount: number; minimumStock: number; stockBySku: LowStockItem[] }
32
+
33
+ export type DashboardLoadState = 'loading' | 'ready' | 'error'
34
+
35
+ type SummaryResponse = {
36
+ seOpenOrdersCount?: number | null
37
+ seOrdersPendingApprovalCount?: number | null
38
+ seBudgets?: DashboardBudget[] | null
39
+ }
40
+
41
+ type LowStockResponse = { seLowStockItems?: LowStockItems | null }
42
+
43
+ type SessionWithB2b = {
44
+ b2b?: { userEmail?: string; unitId?: string; customerId?: string } | null
45
+ }
46
+
47
+ /** The B2B session fields the dashboard tiles need; all undefined outside a B2B session. */
48
+ export function useDashboardsSession() {
49
+ const b2b = (useSession_unstable() as SessionWithB2b)?.b2b
50
+ return { userEmail: b2b?.userEmail, unitId: b2b?.unitId, customerId: b2b?.customerId }
51
+ }
52
+
53
+ /** Sum of every active budget's remaining balance over their total, as a 0–100 percentage. */
54
+ export function budgetRemainingPercent(budgets: DashboardBudget[] | null | undefined): number | null {
55
+ if (!budgets) return null
56
+ const totals = budgets.reduce(
57
+ (acc, { balance }) => ({ amount: acc.amount + balance.amount, remaining: acc.remaining + balance.remaining }),
58
+ { amount: 0, remaining: 0 },
59
+ )
60
+ if (totals.amount <= 0) return 0
61
+ return Math.max(0, Math.min(100, (totals.remaining / totals.amount) * 100))
62
+ }
63
+
64
+ /** "37%" or "37.25%". */
65
+ export function formatPercent(value: number): string {
66
+ return `${value % 1 === 0 ? value : value.toFixed(2)}%`
67
+ }
68
+
69
+ /**
70
+ * Low-stock SKUs point at the IO app's `detailUrl` (`/{slug}/p`); FastStore PDPs are
71
+ * `/{slug}-{skuId}/p`.
72
+ */
73
+ export function lowStockProductHref({ sku }: LowStockItem): string | undefined {
74
+ return sku.detailUrl ? sku.detailUrl.replace(/\/p$/, `-${sku.id}/p`) : undefined
75
+ }
76
+
77
+ type CacheEntry<T> = { data: T; timestamp: number; userEmail: string }
78
+
79
+ function readCache<T>(key: string, userEmail: string): T | undefined {
80
+ try {
81
+ const raw = window.localStorage.getItem(key)
82
+ if (!raw) return undefined
83
+ const entry = JSON.parse(raw) as CacheEntry<T>
84
+ if (entry.userEmail !== userEmail || Date.now() - entry.timestamp > CACHE_MAX_AGE) return undefined
85
+ return entry.data
86
+ } catch {
87
+ return undefined
88
+ }
89
+ }
90
+
91
+ function writeCache<T>(key: string, userEmail: string, data: T): void {
92
+ try {
93
+ window.localStorage.setItem(key, JSON.stringify({ data, timestamp: Date.now(), userEmail } as CacheEntry<T>))
94
+ } catch {
95
+ // Storage full or disabled: the tiles still work, they just refetch next time.
96
+ }
97
+ }
98
+
99
+ /**
100
+ * The latest `execute` behind a stable ref: FastStore's real `useLazyQuery_unstable` returns a
101
+ * new one every render, so it can't be an effect dependency (see useRecentOrdersSpendOverview.ts).
102
+ */
103
+ function useLatest<T>(value: T) {
104
+ const ref = useRef(value)
105
+ ref.current = value
106
+ return ref
107
+ }
108
+
109
+ /** Open / pending-approval order counts and budget usage, cached per shopper for three hours. */
110
+ export function useDashboardSummary(userEmail: string | undefined, unitId: string | undefined) {
111
+ const [summary, setSummary] = useState<DashboardSummary | undefined>()
112
+ const [fetchSummary] = useLazyQuery_unstable<SummaryResponse, { unitId: string }>(DASHBOARD_SUMMARY_QUERY, {
113
+ unitId: unitId ?? '',
114
+ })
115
+ const fetchSummaryRef = useLatest(fetchSummary)
116
+
117
+ useEffect(() => {
118
+ if (!userEmail || !unitId) return
119
+ let cancelled = false
120
+
121
+ const cached = readCache<DashboardSummary>(SUMMARY_CACHE_KEY, userEmail)
122
+ if (cached) {
123
+ setSummary(cached)
124
+ return
125
+ }
126
+
127
+ fetchSummaryRef
128
+ .current({ unitId })
129
+ .then((result: SummaryResponse | null | undefined) => {
130
+ if (cancelled) return
131
+ const next: DashboardSummary = {
132
+ openOrders: result?.seOpenOrdersCount ?? null,
133
+ pendingApproval: result?.seOrdersPendingApprovalCount ?? null,
134
+ budgetRemainingPercent: budgetRemainingPercent(result?.seBudgets),
135
+ }
136
+ // Don't pin a total failure in the cache for three hours.
137
+ if (next.openOrders !== null || next.pendingApproval !== null || next.budgetRemainingPercent !== null) {
138
+ writeCache(SUMMARY_CACHE_KEY, userEmail, next)
139
+ }
140
+ setSummary(next)
141
+ })
142
+ .catch(() => {
143
+ if (!cancelled) setSummary({ openOrders: null, pendingApproval: null, budgetRemainingPercent: null })
144
+ })
145
+
146
+ return () => {
147
+ cancelled = true
148
+ }
149
+ }, [userEmail, unitId, fetchSummaryRef])
150
+
151
+ return summary
152
+ }
153
+
154
+ /** SKUs under the minimum-stock threshold, cached per shopper; retried while the service is still computing. */
155
+ export function useLowStockItems(userEmail: string | undefined) {
156
+ const [items, setItems] = useState<LowStockItems | undefined>()
157
+ const [state, setState] = useState<DashboardLoadState>('loading')
158
+ const retries = useRef(0)
159
+ const [fetchLowStock] = useLazyQuery_unstable<LowStockResponse, Record<string, never>>(
160
+ LOW_STOCK_ITEMS_QUERY,
161
+ {},
162
+ )
163
+ const fetchLowStockRef = useLatest(fetchLowStock)
164
+
165
+ useEffect(() => {
166
+ if (!userEmail) return
167
+ let cancelled = false
168
+ let retryTimer: ReturnType<typeof setTimeout> | undefined
169
+
170
+ const cached = readCache<LowStockItems>(LOW_STOCK_CACHE_KEY, userEmail)
171
+ if (cached) {
172
+ setItems(cached)
173
+ setState('ready')
174
+ return
175
+ }
176
+
177
+ const load = () => {
178
+ fetchLowStockRef
179
+ .current({})
180
+ .then((result: LowStockResponse | null | undefined) => {
181
+ if (cancelled) return
182
+ const lowStock = result?.seLowStockItems
183
+ if (!lowStock) {
184
+ if (retries.current >= LOW_STOCK_MAX_RETRIES) {
185
+ setState('error')
186
+ return
187
+ }
188
+ retries.current += 1
189
+ retryTimer = setTimeout(load, LOW_STOCK_RETRY_DELAY)
190
+ return
191
+ }
192
+ retries.current = 0
193
+ writeCache(LOW_STOCK_CACHE_KEY, userEmail, lowStock)
194
+ setItems(lowStock)
195
+ setState('ready')
196
+ })
197
+ .catch(() => {
198
+ if (!cancelled) setState('error')
199
+ })
200
+ }
201
+
202
+ load()
203
+
204
+ return () => {
205
+ cancelled = true
206
+ if (retryTimer) clearTimeout(retryTimer)
207
+ }
208
+ }, [userEmail, fetchLowStockRef])
209
+
210
+ return { items, state }
211
+ }
@@ -0,0 +1,2 @@
1
+ export * from './types'
2
+ export * from './useNewsletterSubscription'
@@ -0,0 +1,42 @@
1
+ export type FooterB2BLink = {
2
+ text?: string
3
+ url?: string
4
+ newTab?: boolean
5
+ }
6
+
7
+ export type FooterB2BColumn = {
8
+ title?: string
9
+ links?: FooterB2BLink[]
10
+ }
11
+
12
+ export type FooterB2BNewsletter = {
13
+ title?: string
14
+ text?: string
15
+ placeholder?: string
16
+ /** Button label. */
17
+ submitLabel?: string
18
+ successMessage?: string
19
+ errorMessage?: string
20
+ }
21
+
22
+ export type FooterB2BSocialLink = {
23
+ /** Icon image URL (CMS media gallery). */
24
+ icon?: string
25
+ alt?: string
26
+ url?: string
27
+ }
28
+
29
+ export type FooterB2BBottomBar = {
30
+ logo?: {
31
+ src?: string
32
+ alt?: string
33
+ link?: {
34
+ url?: string
35
+ title?: string
36
+ }
37
+ }
38
+ contactCopyright?: {
39
+ contact?: string
40
+ copyright?: string
41
+ }
42
+ }