@rebuy/rebuy-hydrogen 3.0.0-beta.2 → 3.0.0-beta.20

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 (307) hide show
  1. package/README.md +988 -16
  2. package/dist/assets/Close.d.ts +2 -0
  3. package/dist/assets/Close.d.ts.map +1 -0
  4. package/dist/components/AddToCartBtn/AddToCartBtn.d.ts +1 -1
  5. package/dist/components/AddToCartBtn/AddToCartBtn.d.ts.map +1 -1
  6. package/dist/components/AddToCartBtn/HydrogenAddToCartBtn.d.ts +1 -1
  7. package/dist/components/AddToCartBtn/HydrogenAddToCartBtn.d.ts.map +1 -1
  8. package/dist/components/AddToCartBtn/HydrogenReactAddToCartBtn.d.ts +1 -1
  9. package/dist/components/AddToCartBtn/HydrogenReactAddToCartBtn.d.ts.map +1 -1
  10. package/dist/components/AddToCartBtn/types.d.ts +5 -0
  11. package/dist/components/AddToCartBtn/types.d.ts.map +1 -1
  12. package/dist/components/ProductCard/ProductCard.d.ts +1 -1
  13. package/dist/components/ProductCard/ProductCard.d.ts.map +1 -1
  14. package/dist/components/ProductCard/defaultSettings.d.ts +3 -0
  15. package/dist/components/ProductCard/defaultSettings.d.ts.map +1 -0
  16. package/dist/components/ProductCard/index.d.ts +1 -0
  17. package/dist/components/ProductCard/index.d.ts.map +1 -1
  18. package/dist/components/ProductCard/types.d.ts +46 -0
  19. package/dist/components/ProductCard/types.d.ts.map +1 -1
  20. package/dist/components/ProductCarousel/ProductCarousel.d.ts +3 -0
  21. package/dist/components/ProductCarousel/ProductCarousel.d.ts.map +1 -0
  22. package/dist/components/ProductCarousel/index.d.ts +2 -0
  23. package/dist/components/ProductCarousel/index.d.ts.map +1 -0
  24. package/dist/components/ProductCarousel/types.d.ts +18 -0
  25. package/dist/components/ProductCarousel/types.d.ts.map +1 -0
  26. package/dist/components/ProductPrice/ProductPrice.d.ts +2 -4
  27. package/dist/components/ProductPrice/ProductPrice.d.ts.map +1 -1
  28. package/dist/components/ProductPrice/types.d.ts +23 -0
  29. package/dist/components/ProductPrice/types.d.ts.map +1 -0
  30. package/dist/components/QuantityInput/QuantityInput.d.ts +3 -0
  31. package/dist/components/QuantityInput/QuantityInput.d.ts.map +1 -0
  32. package/dist/components/QuantityInput/index.d.ts +3 -0
  33. package/dist/components/QuantityInput/index.d.ts.map +1 -0
  34. package/dist/components/QuantityInput/types.d.ts +7 -0
  35. package/dist/components/QuantityInput/types.d.ts.map +1 -0
  36. package/dist/components/RebuyLink/RebuyLink.d.ts +3 -0
  37. package/dist/components/RebuyLink/RebuyLink.d.ts.map +1 -0
  38. package/dist/components/RebuyLink/index.d.ts +2 -0
  39. package/dist/components/RebuyLink/index.d.ts.map +1 -0
  40. package/dist/components/RebuyLink/types.d.ts +10 -0
  41. package/dist/components/RebuyLink/types.d.ts.map +1 -0
  42. package/dist/components/Timer/Timer.d.ts +3 -0
  43. package/dist/components/Timer/Timer.d.ts.map +1 -0
  44. package/dist/components/Timer/index.d.ts +3 -0
  45. package/dist/components/Timer/index.d.ts.map +1 -0
  46. package/dist/components/Timer/types.d.ts +20 -0
  47. package/dist/components/Timer/types.d.ts.map +1 -0
  48. package/dist/components/Title/Title.d.ts +1 -1
  49. package/dist/components/Title/Title.d.ts.map +1 -1
  50. package/dist/components/Title/types.d.ts +1 -0
  51. package/dist/components/Title/types.d.ts.map +1 -1
  52. package/dist/components/VariantSelect/VariantSelect.d.ts +1 -1
  53. package/dist/components/VariantSelect/VariantSelect.d.ts.map +1 -1
  54. package/dist/components/VariantSelect/types.d.ts +2 -0
  55. package/dist/components/VariantSelect/types.d.ts.map +1 -1
  56. package/dist/constants/api.d.ts +2 -0
  57. package/dist/constants/api.d.ts.map +1 -0
  58. package/dist/constants/debug.d.ts +28 -0
  59. package/dist/constants/debug.d.ts.map +1 -0
  60. package/dist/context/RebuyConfigContext.d.ts +23 -0
  61. package/dist/context/RebuyConfigContext.d.ts.map +1 -0
  62. package/dist/context/RebuyWidgetContext.d.ts +7 -0
  63. package/dist/context/RebuyWidgetContext.d.ts.map +1 -0
  64. package/dist/hooks/titleLevel.d.ts.map +1 -1
  65. package/dist/hooks/useBFCacheReset.d.ts +7 -0
  66. package/dist/hooks/useBFCacheReset.d.ts.map +1 -0
  67. package/dist/hooks/useBreakpoint.d.ts +5 -0
  68. package/dist/hooks/useBreakpoint.d.ts.map +1 -0
  69. package/dist/hooks/usePopupTrigger.d.ts +3 -0
  70. package/dist/hooks/usePopupTrigger.d.ts.map +1 -0
  71. package/dist/index.css +2680 -99
  72. package/dist/index.css.map +4 -4
  73. package/dist/index.d.ts +9 -0
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/index.js +9756 -1461
  76. package/dist/index.js.map +4 -4
  77. package/dist/index.mjs +9768 -1482
  78. package/dist/index.mjs.map +4 -4
  79. package/dist/providers/RebuyHydrogenContextProvider.d.ts +1 -1
  80. package/dist/providers/RebuyHydrogenContextProvider.d.ts.map +1 -1
  81. package/dist/providers/RebuyHydrogenReactContextProvider.d.ts +6 -1
  82. package/dist/providers/RebuyHydrogenReactContextProvider.d.ts.map +1 -1
  83. package/dist/providers/types.d.ts +29 -14
  84. package/dist/providers/types.d.ts.map +1 -1
  85. package/dist/queries/cart.queries.d.ts +4 -4
  86. package/dist/queries/cart.queries.d.ts.map +1 -1
  87. package/dist/smart-cart/RebuySmartCart.d.ts +10 -0
  88. package/dist/smart-cart/RebuySmartCart.d.ts.map +1 -0
  89. package/dist/smart-cart/components/AnnouncementBar/AnnouncementBar.d.ts +10 -0
  90. package/dist/smart-cart/components/AnnouncementBar/AnnouncementBar.d.ts.map +1 -0
  91. package/dist/smart-cart/components/CartItem/CartItem.d.ts +7 -0
  92. package/dist/smart-cart/components/CartItem/CartItem.d.ts.map +1 -0
  93. package/dist/smart-cart/components/CartItemList/CartItemList.d.ts +10 -0
  94. package/dist/smart-cart/components/CartItemList/CartItemList.d.ts.map +1 -0
  95. package/dist/smart-cart/components/CartNoteInput/CartNoteInput.d.ts +10 -0
  96. package/dist/smart-cart/components/CartNoteInput/CartNoteInput.d.ts.map +1 -0
  97. package/dist/smart-cart/components/CartSubtotal/CartSubtotal.d.ts +11 -0
  98. package/dist/smart-cart/components/CartSubtotal/CartSubtotal.d.ts.map +1 -0
  99. package/dist/smart-cart/components/CartTitleBar/CartTitleBar.d.ts +7 -0
  100. package/dist/smart-cart/components/CartTitleBar/CartTitleBar.d.ts.map +1 -0
  101. package/dist/smart-cart/components/CheckoutArea/CheckoutArea.d.ts +10 -0
  102. package/dist/smart-cart/components/CheckoutArea/CheckoutArea.d.ts.map +1 -0
  103. package/dist/smart-cart/components/CrossSell/CrossSell.d.ts +10 -0
  104. package/dist/smart-cart/components/CrossSell/CrossSell.d.ts.map +1 -0
  105. package/dist/smart-cart/components/CustomCode/CustomCodeBlock.d.ts +21 -0
  106. package/dist/smart-cart/components/CustomCode/CustomCodeBlock.d.ts.map +1 -0
  107. package/dist/smart-cart/components/DebugPanel/DebugPanel.d.ts +13 -0
  108. package/dist/smart-cart/components/DebugPanel/DebugPanel.d.ts.map +1 -0
  109. package/dist/smart-cart/components/DebugPanel/index.d.ts +11 -0
  110. package/dist/smart-cart/components/DebugPanel/index.d.ts.map +1 -0
  111. package/dist/smart-cart/components/DiscountCodeInput/DiscountCodeInput.d.ts +10 -0
  112. package/dist/smart-cart/components/DiscountCodeInput/DiscountCodeInput.d.ts.map +1 -0
  113. package/dist/smart-cart/components/EmptyCart/EmptyCart.d.ts +3 -0
  114. package/dist/smart-cart/components/EmptyCart/EmptyCart.d.ts.map +1 -0
  115. package/dist/smart-cart/components/LoginButton/LoginButton.d.ts +3 -0
  116. package/dist/smart-cart/components/LoginButton/LoginButton.d.ts.map +1 -0
  117. package/dist/smart-cart/components/ScreenReaderText/ScreenReaderText.d.ts +8 -0
  118. package/dist/smart-cart/components/ScreenReaderText/ScreenReaderText.d.ts.map +1 -0
  119. package/dist/smart-cart/components/SmartCartApp/SmartCartApp.d.ts +20 -0
  120. package/dist/smart-cart/components/SmartCartApp/SmartCartApp.d.ts.map +1 -0
  121. package/dist/smart-cart/components/SmartCartContainer/SmartCartContainer.d.ts +8 -0
  122. package/dist/smart-cart/components/SmartCartContainer/SmartCartContainer.d.ts.map +1 -0
  123. package/dist/smart-cart/components/TieredProgressBar/Icons.d.ts +5 -0
  124. package/dist/smart-cart/components/TieredProgressBar/Icons.d.ts.map +1 -0
  125. package/dist/smart-cart/components/TieredProgressBar/TPBGiftItem.d.ts +21 -0
  126. package/dist/smart-cart/components/TieredProgressBar/TPBGiftItem.d.ts.map +1 -0
  127. package/dist/smart-cart/components/TieredProgressBar/TieredProgressBar.d.ts +11 -0
  128. package/dist/smart-cart/components/TieredProgressBar/TieredProgressBar.d.ts.map +1 -0
  129. package/dist/smart-cart/components/TieredProgressBar/progressBarUtils.d.ts +173 -0
  130. package/dist/smart-cart/components/TieredProgressBar/progressBarUtils.d.ts.map +1 -0
  131. package/dist/smart-cart/components/TieredProgressBar/types.d.ts +261 -0
  132. package/dist/smart-cart/components/TieredProgressBar/types.d.ts.map +1 -0
  133. package/dist/smart-cart/components/_Layouts/AnchorSlot.d.ts +13 -0
  134. package/dist/smart-cart/components/_Layouts/AnchorSlot.d.ts.map +1 -0
  135. package/dist/smart-cart/components/_Layouts/DoubleColumnLayout.d.ts +9 -0
  136. package/dist/smart-cart/components/_Layouts/DoubleColumnLayout.d.ts.map +1 -0
  137. package/dist/smart-cart/components/_Layouts/SingleColumnLayout.d.ts +8 -0
  138. package/dist/smart-cart/components/_Layouts/SingleColumnLayout.d.ts.map +1 -0
  139. package/dist/smart-cart/components/componentRegistry.d.ts +3 -0
  140. package/dist/smart-cart/components/componentRegistry.d.ts.map +1 -0
  141. package/dist/smart-cart/constants.d.ts +58 -0
  142. package/dist/smart-cart/constants.d.ts.map +1 -0
  143. package/dist/smart-cart/context/SmartCartContext.d.ts +62 -0
  144. package/dist/smart-cart/context/SmartCartContext.d.ts.map +1 -0
  145. package/dist/smart-cart/context/StorefrontCartContext.d.ts +32 -0
  146. package/dist/smart-cart/context/StorefrontCartContext.d.ts.map +1 -0
  147. package/dist/smart-cart/hooks/useCartItemFeatures.d.ts +84 -0
  148. package/dist/smart-cart/hooks/useCartItemFeatures.d.ts.map +1 -0
  149. package/dist/smart-cart/hooks/useDiscountManager.d.ts +28 -0
  150. package/dist/smart-cart/hooks/useDiscountManager.d.ts.map +1 -0
  151. package/dist/smart-cart/hooks/useGeolocation.d.ts +12 -0
  152. package/dist/smart-cart/hooks/useGeolocation.d.ts.map +1 -0
  153. package/dist/smart-cart/hooks/useIsScrolled.d.ts +14 -0
  154. package/dist/smart-cart/hooks/useIsScrolled.d.ts.map +1 -0
  155. package/dist/smart-cart/hooks/useSmartCartApps.d.ts +17 -0
  156. package/dist/smart-cart/hooks/useSmartCartApps.d.ts.map +1 -0
  157. package/dist/smart-cart/store/tieredProgressBarStore.d.ts +76 -0
  158. package/dist/smart-cart/store/tieredProgressBarStore.d.ts.map +1 -0
  159. package/dist/smart-cart/types/rebuy-storefront-cart.d.ts +142 -0
  160. package/dist/smart-cart/types/rebuy-storefront-cart.d.ts.map +1 -0
  161. package/dist/smart-cart/types/rebuy.d.ts +15 -0
  162. package/dist/smart-cart/types/rebuy.d.ts.map +1 -0
  163. package/dist/smart-cart/types/shop.d.ts +26 -0
  164. package/dist/smart-cart/types/shop.d.ts.map +1 -0
  165. package/dist/smart-cart/types/smart-cart-app.d.ts +103 -0
  166. package/dist/smart-cart/types/smart-cart-app.d.ts.map +1 -0
  167. package/dist/smart-cart/types/smart-cart-component.d.ts +1350 -0
  168. package/dist/smart-cart/types/smart-cart-component.d.ts.map +1 -0
  169. package/dist/smart-cart/types/smart-cart.d.ts +82 -0
  170. package/dist/smart-cart/types/smart-cart.d.ts.map +1 -0
  171. package/dist/smart-cart/utils/cartItemUtils.d.ts +292 -0
  172. package/dist/smart-cart/utils/cartItemUtils.d.ts.map +1 -0
  173. package/dist/smart-cart/utils/debugLog.d.ts +77 -0
  174. package/dist/smart-cart/utils/debugLog.d.ts.map +1 -0
  175. package/dist/smart-cart/utils/debugStyles.d.ts +3342 -0
  176. package/dist/smart-cart/utils/debugStyles.d.ts.map +1 -0
  177. package/dist/smart-cart/utils/executeScriptsInContainer.d.ts +14 -0
  178. package/dist/smart-cart/utils/executeScriptsInContainer.d.ts.map +1 -0
  179. package/dist/smart-cart/utils/imageUtils.d.ts +2 -0
  180. package/dist/smart-cart/utils/imageUtils.d.ts.map +1 -0
  181. package/dist/smart-cart/utils/mapHydrogenCartToStorefrontCartData.d.ts +14 -0
  182. package/dist/smart-cart/utils/mapHydrogenCartToStorefrontCartData.d.ts.map +1 -0
  183. package/dist/smart-cart/utils/moneyUtils.d.ts +24 -0
  184. package/dist/smart-cart/utils/moneyUtils.d.ts.map +1 -0
  185. package/dist/smart-cart/utils/safeJsonParse.d.ts +2 -0
  186. package/dist/smart-cart/utils/safeJsonParse.d.ts.map +1 -0
  187. package/dist/types/common.d.ts +16 -0
  188. package/dist/types/common.d.ts.map +1 -1
  189. package/dist/types/rebuyCustom.d.ts +133 -17
  190. package/dist/types/rebuyCustom.d.ts.map +1 -1
  191. package/dist/types/shopify.d.ts +1 -2
  192. package/dist/types/shopify.d.ts.map +1 -1
  193. package/dist/types/widgets.d.ts +20078 -7
  194. package/dist/types/widgets.d.ts.map +1 -1
  195. package/dist/utils/convertToRebuyProduct.d.ts.map +1 -1
  196. package/dist/utils/createContextParameters.d.ts +1 -1
  197. package/dist/utils/createContextParameters.d.ts.map +1 -1
  198. package/dist/utils/filterContextUtils.d.ts +3 -0
  199. package/dist/utils/filterContextUtils.d.ts.map +1 -0
  200. package/dist/utils/getEncodedAttributes.d.ts.map +1 -1
  201. package/dist/utils/getRebuyConfig.d.ts +1 -1
  202. package/dist/utils/getRebuyConfig.d.ts.map +1 -1
  203. package/dist/utils/nonceManager.d.ts +10 -0
  204. package/dist/utils/nonceManager.d.ts.map +1 -0
  205. package/dist/utils/theme.d.ts +20 -0
  206. package/dist/utils/theme.d.ts.map +1 -0
  207. package/dist/widgetContainer/RebuyWidgetContainer.d.ts +1 -1
  208. package/dist/widgetContainer/RebuyWidgetContainer.d.ts.map +1 -1
  209. package/dist/widgets/RebuyCompleteTheLook/RebuyCompleteTheLook.d.ts.map +1 -1
  210. package/dist/widgets/RebuyDynamicBundleProducts/BundleImages.d.ts.map +1 -1
  211. package/dist/widgets/RebuyDynamicBundleProducts/BundlePrice.d.ts.map +1 -1
  212. package/dist/widgets/RebuyDynamicBundleProducts/BundleSelection.d.ts +1 -1
  213. package/dist/widgets/RebuyDynamicBundleProducts/BundleSelection.d.ts.map +1 -1
  214. package/dist/widgets/RebuyDynamicBundleProducts/RebuyDynamicBundleProducts.d.ts.map +1 -1
  215. package/dist/widgets/RebuyDynamicBundleProducts/Select.d.ts.map +1 -1
  216. package/dist/widgets/RebuyGiftWithPurchase/RebuyGiftWithPurchase.d.ts +11 -0
  217. package/dist/widgets/RebuyGiftWithPurchase/RebuyGiftWithPurchase.d.ts.map +1 -0
  218. package/dist/widgets/RebuyGiftWithPurchase/index.d.ts +3 -0
  219. package/dist/widgets/RebuyGiftWithPurchase/index.d.ts.map +1 -0
  220. package/dist/widgets/RebuyGiftWithPurchase/store/giftWithPurchaseStore.d.ts +31 -0
  221. package/dist/widgets/RebuyGiftWithPurchase/store/giftWithPurchaseStore.d.ts.map +1 -0
  222. package/dist/widgets/RebuyGiftWithPurchase/types.d.ts +12 -0
  223. package/dist/widgets/RebuyGiftWithPurchase/types.d.ts.map +1 -0
  224. package/dist/widgets/RebuyGiftWithPurchase/utils.d.ts +35 -0
  225. package/dist/widgets/RebuyGiftWithPurchase/utils.d.ts.map +1 -0
  226. package/dist/widgets/RebuyProductAddOns/RebuyProductAddOnCard.d.ts.map +1 -1
  227. package/dist/widgets/RebuyProductAddOns/RebuyProductAddOns.d.ts.map +1 -1
  228. package/dist/widgets/RebuyProductAddOns/types.d.ts.map +1 -1
  229. package/dist/widgets/RebuyProductRecommendations/RebuyProductRecommendations.d.ts.map +1 -1
  230. package/dist/widgets/RebuyProductViewed/RebuyProductViewed.d.ts +3 -0
  231. package/dist/widgets/RebuyProductViewed/RebuyProductViewed.d.ts.map +1 -0
  232. package/dist/widgets/RebuyProductViewed/index.d.ts +2 -0
  233. package/dist/widgets/RebuyProductViewed/index.d.ts.map +1 -0
  234. package/dist/widgets/RebuyProductViewed/types.d.ts +8 -0
  235. package/dist/widgets/RebuyProductViewed/types.d.ts.map +1 -0
  236. package/dist/widgets/RebuyRecentlyViewedProducts/RebuyRecentlyViewedProducts.d.ts +3 -0
  237. package/dist/widgets/RebuyRecentlyViewedProducts/RebuyRecentlyViewedProducts.d.ts.map +1 -0
  238. package/dist/widgets/RebuyRecentlyViewedProducts/index.d.ts +2 -0
  239. package/dist/widgets/RebuyRecentlyViewedProducts/index.d.ts.map +1 -0
  240. package/dist/widgets/RebuyRecentlyViewedProducts/types.d.ts +11 -0
  241. package/dist/widgets/RebuyRecentlyViewedProducts/types.d.ts.map +1 -0
  242. package/dist/widgets/RebuyWidget/RebuyWidget.d.ts +3 -0
  243. package/dist/widgets/RebuyWidget/RebuyWidget.d.ts.map +1 -0
  244. package/dist/widgets/RebuyWidget/WidgetContent.d.ts +3 -0
  245. package/dist/widgets/RebuyWidget/WidgetContent.d.ts.map +1 -0
  246. package/dist/widgets/RebuyWidget/index.d.ts +2 -0
  247. package/dist/widgets/RebuyWidget/index.d.ts.map +1 -0
  248. package/dist/widgets/RebuyWidget/types.d.ts +28 -0
  249. package/dist/widgets/RebuyWidget/types.d.ts.map +1 -0
  250. package/dist/zustandStores/productViewed.d.ts +9 -0
  251. package/dist/zustandStores/productViewed.d.ts.map +1 -0
  252. package/package.json +57 -41
  253. package/dist/types/rebuySmartCart.d.ts +0 -184
  254. package/dist/types/rebuySmartCart.d.ts.map +0 -1
  255. package/src/components/AddToCartBtn/AddToCartBtn.tsx +0 -45
  256. package/src/components/AddToCartBtn/HydrogenAddToCartBtn.tsx +0 -43
  257. package/src/components/AddToCartBtn/HydrogenReactAddToCartBtn.tsx +0 -35
  258. package/src/components/AddToCartBtn/index.ts +0 -1
  259. package/src/components/AddToCartBtn/types.ts +0 -27
  260. package/src/components/ProductCard/ProductCard.tsx +0 -70
  261. package/src/components/ProductCard/index.ts +0 -1
  262. package/src/components/ProductCard/types.ts +0 -10
  263. package/src/components/ProductPrice/ProductPrice.tsx +0 -49
  264. package/src/components/ProductPrice/index.ts +0 -1
  265. package/src/components/Title/Title.tsx +0 -19
  266. package/src/components/Title/index.ts +0 -1
  267. package/src/components/Title/types.ts +0 -7
  268. package/src/components/VariantSelect/VariantSelect.tsx +0 -45
  269. package/src/components/VariantSelect/index.ts +0 -1
  270. package/src/components/VariantSelect/types.ts +0 -6
  271. package/src/context/RebuyContext.tsx +0 -9
  272. package/src/hooks/titleLevel.tsx +0 -42
  273. package/src/index.ts +0 -7
  274. package/src/providers/RebuyHydrogenContextProvider.tsx +0 -112
  275. package/src/providers/RebuyHydrogenReactContextProvider.tsx +0 -192
  276. package/src/providers/types.ts +0 -58
  277. package/src/queries/cart.queries.ts +0 -467
  278. package/src/types/common.ts +0 -8
  279. package/src/types/css.d.ts +0 -11
  280. package/src/types/env.d.ts +0 -12
  281. package/src/types/rebuy.d.ts +0 -31
  282. package/src/types/rebuyCustom.ts +0 -263
  283. package/src/types/rebuySmartCart.ts +0 -188
  284. package/src/types/shopify.ts +0 -142
  285. package/src/types/widgets.ts +0 -29
  286. package/src/utils/convertToRebuyProduct.tsx +0 -319
  287. package/src/utils/createContextParameters.ts +0 -142
  288. package/src/utils/getEncodedAttributes.ts +0 -11
  289. package/src/utils/getRebuyConfig.ts +0 -31
  290. package/src/widgetContainer/RebuyWidgetContainer.tsx +0 -183
  291. package/src/widgets/RebuyCompleteTheLook/RebuyCompleteTheLook.tsx +0 -50
  292. package/src/widgets/RebuyCompleteTheLook/index.ts +0 -1
  293. package/src/widgets/RebuyCompleteTheLook/types.ts +0 -5
  294. package/src/widgets/RebuyDynamicBundleProducts/BundleImages.tsx +0 -62
  295. package/src/widgets/RebuyDynamicBundleProducts/BundlePrice.tsx +0 -93
  296. package/src/widgets/RebuyDynamicBundleProducts/BundleSelection.tsx +0 -65
  297. package/src/widgets/RebuyDynamicBundleProducts/RebuyDynamicBundleProducts.tsx +0 -118
  298. package/src/widgets/RebuyDynamicBundleProducts/Select.tsx +0 -41
  299. package/src/widgets/RebuyDynamicBundleProducts/index.ts +0 -1
  300. package/src/widgets/RebuyDynamicBundleProducts/types.ts +0 -23
  301. package/src/widgets/RebuyProductAddOns/RebuyProductAddOnCard.tsx +0 -66
  302. package/src/widgets/RebuyProductAddOns/RebuyProductAddOns.tsx +0 -218
  303. package/src/widgets/RebuyProductAddOns/index.ts +0 -1
  304. package/src/widgets/RebuyProductAddOns/types.ts +0 -24
  305. package/src/widgets/RebuyProductRecommendations/RebuyProductRecommendations.tsx +0 -50
  306. package/src/widgets/RebuyProductRecommendations/index.ts +0 -1
  307. package/src/widgets/RebuyProductRecommendations/types.ts +0 -5
package/package.json CHANGED
@@ -1,35 +1,36 @@
1
1
  {
2
2
  "name": "@rebuy/rebuy-hydrogen",
3
+ "version": "3.0.0-beta.20",
3
4
  "description": "This is the default library for Rebuy + Shopify Hydrogen",
4
- "version": "3.0.0-beta.2",
5
5
  "license": "MIT",
6
6
  "author": "Rebuy, Inc.",
7
+ "type": "module",
7
8
  "main": "./dist/index.js",
8
9
  "module": "./dist/index.mjs",
9
10
  "types": "./dist/index.d.ts",
10
- "type": "module",
11
- "publishConfig": {
12
- "access": "public"
13
- },
14
11
  "files": [
15
12
  "dist",
16
- "README.md",
17
- "**/*.d.ts",
18
- "**/*.ts",
19
- "**/*.tsx"
13
+ "README.md"
20
14
  ],
21
15
  "scripts": {
22
- "clean": "rm -rf dist",
23
- "build:types": "tsc --emitDeclarationOnly --outDir dist",
24
- "build:code": "node esbuild.config.mjs",
25
16
  "build": "npm run clean && npm run build:types && npm run build:code",
17
+ "build:code": "node esbuild.config.mjs",
18
+ "build:types": "tsc --emitDeclarationOnly --outDir dist",
26
19
  "build:watch": "npm run clean && npm run build:types && node esbuild.config.mjs --watch",
27
- "format": "npm run lint -- --fix",
28
- "lint": "eslint . --ext .js,.jsx,.json",
20
+ "check-types": "tsc --noEmit",
21
+ "clean": "rm -rf dist",
22
+ "deploy": "npm run build && npx semantic-release --debug --no-ci",
23
+ "deploy:dryrun": "npm run deploy -- --dry-run",
24
+ "dev": "npm run clean && concurrently \"npm run types:watch\" \"npm run build:watch\"",
25
+ "format": "npm run lint -- --fix && npm run lint:css -- --fix",
26
+ "lint": "eslint --ext .js,.jsx,.json,.mjs,.ts,.tsx ./src",
27
+ "lint:css": "stylelint './src/**/*.{css,scss}'",
28
+ "lint:css-skip-warn": "npm run lint:css -- --quiet",
29
+ "lint:skip-warn": "npm run lint -- --quiet",
29
30
  "prepare": "husky install",
31
+ "sort-package": "sort-package-json",
30
32
  "test": "echo \"Error: no test specified\" && exit 1",
31
- "types:watch": "tsc --emitDeclarationOnly --outDir dist --watch",
32
- "dev": "npm run clean && concurrently \"npm run types:watch\" \"npm run build:watch\""
33
+ "types:watch": "tsc --emitDeclarationOnly --outDir dist --watch"
33
34
  },
34
35
  "config": {
35
36
  "commitizen": {
@@ -39,25 +40,27 @@
39
40
  "config": ".cz-config.cjs"
40
41
  }
41
42
  },
42
- "repository": {
43
- "type": "git",
44
- "url": "git+ssh://git@bitbucket.org/rebuyengine/npm-rebuy-hydrogen.git"
45
- },
46
- "bugs": {
47
- "url": "https://bitbucket.org/rebuyengine/npm-rebuy-hydrogen/issues"
43
+ "dependencies": {
44
+ "@rebuy/rebuy": "^2.0.2",
45
+ "clsx": "^2.1.1",
46
+ "dompurify": "^3.2.5",
47
+ "lodash-es": "^4.17.21",
48
+ "zod": "^3.24.4",
49
+ "zustand": "^5.0.4"
48
50
  },
49
- "homepage": "https://bitbucket.org/rebuyengine/npm-rebuy-hydrogen#readme",
50
51
  "devDependencies": {
51
52
  "@commitlint/cli": "^19.8.0",
52
53
  "@commitlint/config-conventional": "^19.8.0",
53
54
  "@semantic-release/changelog": "^6.0.3",
54
55
  "@semantic-release/commit-analyzer": "^13.0.1",
55
- "@semantic-release/git": "^10.0.1",
56
- "@semantic-release/npm": "^12.0.1",
56
+ "@semantic-release/exec": "^7.1.0",
57
57
  "@semantic-release/release-notes-generator": "^14.0.3",
58
- "@shopify/hydrogen": ">=2025.0.1",
59
- "@shopify/hydrogen-react": ">=2025.0.1",
60
- "@types/react": "^18.0.0",
58
+ "@shopify/hydrogen": ">=2025.5.0",
59
+ "@shopify/hydrogen-react": ">=2025.4.0",
60
+ "@types/dompurify": "^3.0.5",
61
+ "@types/lodash-es": "^4.17.12",
62
+ "@types/react": "^18.3.3",
63
+ "@types/react-dom": "^18.3.7",
61
64
  "@types/three": "^0.175.0",
62
65
  "@typescript-eslint/eslint-plugin": "^8.26.1",
63
66
  "@typescript-eslint/parser": "^8.26.1",
@@ -66,35 +69,48 @@
66
69
  "cz-conventional-changelog": "^3.3.0",
67
70
  "cz-customizable": "^7.4.0",
68
71
  "esbuild": "0.25.2",
72
+ "esbuild-plugin-css-modules": "^0.3.0",
69
73
  "eslint": "^8.57.0",
70
74
  "eslint-config-prettier": "^10.1.1",
75
+ "eslint-import-resolver-typescript": "^4.3.4",
71
76
  "eslint-plugin-import": "^2.31.0",
77
+ "eslint-plugin-jsdoc": "^50.2.4",
72
78
  "eslint-plugin-json": "^4.0.1",
73
79
  "eslint-plugin-prettier": "^5.2.3",
74
80
  "eslint-plugin-react": "^7.37.4",
75
- "eslint-plugin-react-hooks": "^5.2.0",
81
+ "eslint-plugin-react-hooks": "^4.6.2",
76
82
  "eslint-plugin-sort-destructure-keys": "^2.0.0",
77
83
  "eslint-plugin-sort-keys": "^2.3.5",
78
84
  "eslint-plugin-typescript-sort-keys": "^3.3.0",
85
+ "eslint-plugin-unused-imports": "^4.1.4",
79
86
  "husky": "^9.1.7",
80
87
  "lint-staged": "^15.5.0",
81
88
  "prettier": "^3.5.2",
82
- "react": "^18.0.0",
89
+ "react": "^18.3.1",
90
+ "react-dom": "^18.3.1",
91
+ "react-router": "7.6.0",
92
+ "react-router-dom": "7.6.0",
83
93
  "semantic-release": "^24.2.3",
94
+ "sort-package-json": "^2.10.0",
95
+ "stylelint": "^16.19.1",
96
+ "stylelint-config-css-modules": "^4.4.0",
97
+ "stylelint-config-standard": "^36.0.1",
84
98
  "typescript": "^5.8.2"
85
99
  },
86
- "dependencies": {
87
- "@rebuy/rebuy": "^1.5.1"
88
- },
89
100
  "peerDependencies": {
90
- "@remix-run/react": ">=2.10.0",
91
- "@shopify/hydrogen": ">=2025.0.1",
92
- "@shopify/hydrogen-react": ">=2025.0.1"
101
+ "@shopify/hydrogen": ">=2025.5.0",
102
+ "@shopify/hydrogen-react": ">=2025.4.0",
103
+ "react": "^18.3.1",
104
+ "react-dom": "^18.3.1",
105
+ "react-router": "7.6.0",
106
+ "react-router-dom": "7.6.0"
93
107
  },
94
- "lint-staged": {
95
- "**/*.{js,jsx,json}": [
96
- "npm run format",
97
- "prettier --write"
98
- ]
108
+ "peerDependenciesMeta": {
109
+ "@shopify/hydrogen-react": {
110
+ "optional": true
111
+ }
112
+ },
113
+ "publishConfig": {
114
+ "access": "public"
99
115
  }
100
116
  }
@@ -1,184 +0,0 @@
1
- export type ProgressBarTier = {
2
- id: number;
3
- minimum: number | null;
4
- presentment_currencies: {
5
- enabled: boolean;
6
- };
7
- product_amount_reached_label: boolean;
8
- product_amount_reached_label_text: string;
9
- product_amount_remaining_label: boolean;
10
- product_amount_remaining_label_text: string;
11
- products: unknown[];
12
- type: string;
13
- };
14
- export type ProgressBar = {
15
- country_codes: string[];
16
- exclude_discount: boolean;
17
- free_shipping_enabled: boolean;
18
- free_shipping_on_all_products: boolean;
19
- free_shipping_on_subscription: boolean;
20
- geolocation_enabled: boolean;
21
- id: number;
22
- layout: string;
23
- name: string;
24
- tiers: ProgressBarTier[];
25
- };
26
- export type SmartCartLanguage = {
27
- bmsm_discount_message: string;
28
- bmsm_discount_success: string;
29
- cart_title: string;
30
- checking_out_label: string;
31
- checkout_label: string;
32
- continue_shopping_label: string;
33
- discount_button_label: string;
34
- discount_code_label: string;
35
- discount_invalid_message: string;
36
- discount_label: string;
37
- empty_cart: string;
38
- free_shipping_helper: string;
39
- free_shipping_reached: string;
40
- free_shipping_remaining: string;
41
- notes_label: string;
42
- notes_placeholder: string;
43
- notes_remaining_characters: string;
44
- subtotal_plural_text: string;
45
- subtotal_singular_text: string;
46
- view_cart_label: string;
47
- view_cart_working_label: string;
48
- };
49
- export type SmartCartComponent = {
50
- always_visible?: boolean;
51
- hidden?: boolean;
52
- id: string;
53
- settings?: unknown;
54
- static?: boolean;
55
- title: string;
56
- type: string;
57
- };
58
- export type SmartCartAnchor = {
59
- components: string[];
60
- id: string;
61
- title: string;
62
- };
63
- export type SmartCart = {
64
- accelerated_checkout: {
65
- enabled: boolean;
66
- };
67
- accessibility: {
68
- heading: string;
69
- };
70
- anchorData: {
71
- anchorOrder: string[];
72
- anchors: {
73
- [key: string]: SmartCartAnchor;
74
- };
75
- components: {
76
- [key: string]: SmartCartComponent;
77
- };
78
- };
79
- announcement_bar: {
80
- enabled: boolean;
81
- messages: string[];
82
- };
83
- apps: unknown[];
84
- attribution_tracking_disabled: boolean;
85
- buy_more_save_more: {
86
- discount_products: unknown[];
87
- discount_type: string;
88
- display_type: string;
89
- enabled: boolean;
90
- language: {
91
- bmsm_discount_message: string;
92
- bmsm_discount_success: string;
93
- };
94
- tiers: {
95
- discount: number;
96
- quantity: number;
97
- }[];
98
- };
99
- callbacks: {
100
- [key: string]: {
101
- enabled: boolean;
102
- function: string;
103
- };
104
- };
105
- cart_page_checkout_override: {
106
- enabled: boolean;
107
- };
108
- checkout_button: {
109
- enabled: boolean;
110
- routing: string;
111
- routing_link: string;
112
- };
113
- continue_shopping_button: {
114
- enabled: boolean;
115
- };
116
- cross_sells: string[];
117
- custom_css: string;
118
- disable_cart_page: boolean;
119
- discount: {
120
- enabled: boolean;
121
- use_message_only: boolean;
122
- };
123
- enable_product_metafields: boolean;
124
- has_legacy_shipping: boolean;
125
- installments: {
126
- enabled: boolean;
127
- payment_count: number;
128
- provider: string;
129
- terms_url: string;
130
- };
131
- integrations: {
132
- code: string;
133
- enabled: boolean;
134
- };
135
- language: SmartCartLanguage;
136
- layout: string;
137
- name: string;
138
- notes: {
139
- enabled: boolean;
140
- limit_characters: boolean;
141
- max_length: number;
142
- };
143
- pre_purchase: {
144
- enabled: boolean;
145
- id: string;
146
- };
147
- preview_mode: boolean;
148
- product_form_redirect: string;
149
- progress_bar: {
150
- bars: ProgressBar[];
151
- enabled: boolean;
152
- };
153
- selectors: {
154
- cart_subtotal: string;
155
- item_count: string;
156
- };
157
- shop_pay: {
158
- enabled: boolean;
159
- };
160
- switch_to_subscription: {
161
- disable_downgrade: boolean;
162
- enabled: boolean;
163
- language: {
164
- downgrading_label: string;
165
- onetime_option_group_label: string;
166
- onetime_option_label: string;
167
- subscription_option_group_label: string;
168
- subscription_option_label: string;
169
- upgrade_to_subscription_default_frequency: string;
170
- upgrade_to_subscription_label: string;
171
- upgrade_to_subscription_without_discount_label: string;
172
- upgrading_label: string;
173
- };
174
- };
175
- terms: {
176
- disclaimer: string;
177
- enabled: boolean;
178
- };
179
- version: number;
180
- view_cart_button: {
181
- enabled: boolean;
182
- };
183
- };
184
- //# sourceMappingURL=rebuySmartCart.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rebuySmartCart.d.ts","sourceRoot":"","sources":["../../src/types/rebuySmartCart.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,sBAAsB,EAAE;QACpB,OAAO,EAAE,OAAO,CAAC;KACpB,CAAC;IACF,4BAA4B,EAAE,OAAO,CAAC;IACtC,iCAAiC,EAAE,MAAM,CAAC;IAC1C,8BAA8B,EAAE,OAAO,CAAC;IACxC,mCAAmC,EAAE,MAAM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qB,EAAE,MAAM,CAAC;IAC9B,YAAY,EAAE;QACV,IAAI,EAAE,WAAW,EAAE,CAAC;QACpB,OAAO,EAAE,OAAO,CAAC;KACpB,CAAC;IACF,SAAS,EAAE;QACP,aAAa,EAAE,MAAM,CAAC;QACtB,UAAU,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,QAAQ,EAAE;QACN,OAAO,EAAE,OAAO,CAAC;KACpB,CAAC;IACF,sBAAsB,EAAE;QACpB,iBAAiB,EAAE,OAAO,CAAC;QAC3B,OAAO,EAAE,OAAO,CAAC;QACjB,QAAQ,EAAE;YACN,iBAAiB,EAAE,MAAM,CAAC;YAC1B,0BAA0B,EAAE,MAAM,CAAC;YACnC,oBAAoB,EAAE,MAAM,CAAC;YAC7B,+BAA+B,EAAE,MAAM,CAAC;YACxC,yBAAyB,EAAE,MAAM,CAAC;YAClC,yCAAyC,EAAE,MAAM,CAAC;YAClD,6BAA6B,EAAE,MAAM,CAAC;YACtC,8CAA8C,EAAE,MAAM,CAAC;YACvD,eAAe,EAAE,MAAM,CAAC;SAC3B,CAAC;KACL,CAAC;IACF,KAAK,EAAE;QACH,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,OAAO,CAAC;KACpB,CAAC;IACF,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE;QACd,OAAO,EAAE,OAAO,CAAC;KACpB,CAAC;CACL,CAAC"}
@@ -1,45 +0,0 @@
1
- import { HydrogenAddToCartBtn } from './HydrogenAddToCartBtn';
2
- import { HydrogenReactAddToCartBtn } from './HydrogenReactAddToCartBtn';
3
-
4
- import type { AddToCartBtnProps } from '~/components/AddToCartBtn/types';
5
-
6
- export const AddToCartBtn = ({
7
- addToCartBtnText,
8
- addToCartCallback,
9
- disabled,
10
- isHydrogenReact,
11
- moneyData,
12
- selectedVariants,
13
- }: AddToCartBtnProps) => {
14
- const linesToAdd = selectedVariants.map((variant) => ({
15
- attributes: [
16
- { key: '_source', value: 'Rebuy' },
17
- { key: '_attribution', value: 'Rebuy Product Recommendations' },
18
- ],
19
- merchandiseId: variant.id,
20
- quantity: 1,
21
- selectedVariant: variant,
22
- }));
23
-
24
- if (isHydrogenReact) {
25
- return (
26
- <HydrogenReactAddToCartBtn
27
- addToCartBtnText={addToCartBtnText}
28
- addToCartCallback={addToCartCallback}
29
- disabled={disabled}
30
- linesToAdd={linesToAdd}
31
- moneyData={moneyData}
32
- />
33
- );
34
- }
35
-
36
- return (
37
- <HydrogenAddToCartBtn
38
- addToCartBtnText={addToCartBtnText}
39
- addToCartCallback={addToCartCallback}
40
- disabled={disabled}
41
- linesToAdd={linesToAdd}
42
- moneyData={moneyData}
43
- />
44
- );
45
- };
@@ -1,43 +0,0 @@
1
- import { type FetcherWithComponents } from '@remix-run/react';
2
- import { CartForm, Money } from '@shopify/hydrogen';
3
-
4
- import styles from './AddToCartBtn.module.css';
5
-
6
- import type { btnProps } from '~/components/AddToCartBtn/types';
7
-
8
- export const HydrogenAddToCartBtn = ({
9
- addToCartBtnText,
10
- addToCartCallback,
11
- disabled,
12
- linesToAdd,
13
- moneyData,
14
- }: btnProps) => {
15
- return (
16
- <CartForm
17
- action={CartForm.ACTIONS.LinesAdd}
18
- inputs={{
19
- lines: linesToAdd,
20
- }}
21
- route="/cart"
22
- >
23
- {(fetcher: FetcherWithComponents<unknown>) => (
24
- <>
25
- <button
26
- className={styles.button}
27
- disabled={disabled || fetcher.state !== 'idle'}
28
- onClick={addToCartCallback}
29
- type="submit"
30
- >
31
- {addToCartBtnText}
32
- {moneyData && (
33
- <>
34
- <span> | </span>
35
- <Money data={moneyData} withoutTrailingZeros />
36
- </>
37
- )}
38
- </button>
39
- </>
40
- )}
41
- </CartForm>
42
- );
43
- };
@@ -1,35 +0,0 @@
1
- import { Money, useCart } from '@shopify/hydrogen-react';
2
-
3
- import styles from './AddToCartBtn.module.css';
4
-
5
- import type { btnProps } from '~/components/AddToCartBtn/types';
6
-
7
- export const HydrogenReactAddToCartBtn = ({
8
- addToCartBtnText,
9
- addToCartCallback,
10
- disabled,
11
- linesToAdd,
12
- moneyData,
13
- }: btnProps) => {
14
- const { linesAdd } = useCart();
15
- const handleAddToCart = () => {
16
- linesAdd(linesToAdd);
17
- addToCartCallback?.();
18
- };
19
- return (
20
- <button
21
- className={styles.button}
22
- disabled={disabled}
23
- onClick={handleAddToCart}
24
- type="button"
25
- >
26
- {addToCartBtnText}
27
- {moneyData && (
28
- <>
29
- <span> | </span>
30
- <Money data={moneyData} withoutTrailingZeros />
31
- </>
32
- )}
33
- </button>
34
- );
35
- };
@@ -1 +0,0 @@
1
- export * from './AddToCartBtn';
@@ -1,27 +0,0 @@
1
- import type { MoneyV2 } from '@shopify/hydrogen-react/storefront-api-types';
2
- import type { RebuyProductVariant } from '~/types/rebuyCustom';
3
-
4
- export type btnProps = {
5
- addToCartBtnText?: string;
6
- addToCartCallback?: () => void;
7
- disabled?: boolean;
8
- linesToAdd: {
9
- attributes: {
10
- key: string;
11
- value: string;
12
- }[];
13
- merchandiseId: string;
14
- quantity: number;
15
- selectedVariant: unknown;
16
- }[];
17
- moneyData?: MoneyV2;
18
- };
19
-
20
- export type AddToCartBtnProps = {
21
- addToCartBtnText?: string;
22
- addToCartCallback?: () => void;
23
- disabled?: boolean;
24
- isHydrogenReact?: boolean;
25
- moneyData?: MoneyV2;
26
- selectedVariants: RebuyProductVariant[];
27
- };
@@ -1,70 +0,0 @@
1
- import { Link } from '@remix-run/react';
2
- import { Image } from '@shopify/hydrogen';
3
- import { useState } from 'react';
4
-
5
- import styles from './ProductCard.module.css';
6
-
7
- import type { ProductCardProps } from '~/components/ProductCard/types';
8
- import type { RebuyProduct } from '~/types/rebuyCustom';
9
-
10
- import { AddToCartBtn } from '~/components/AddToCartBtn';
11
- import { RebuyProductPrice } from '~/components/ProductPrice/ProductPrice';
12
- import { Title } from '~/components/Title';
13
- import { VariantSelect } from '~/components/VariantSelect';
14
-
15
- export const ProductCard = ({
16
- addToCartBtnText,
17
- addToCartCallback,
18
- isHydrogenReact,
19
- product,
20
- productCardTitleLevel,
21
- }: ProductCardProps) => {
22
- const [selectedVariant, setSelectedVariant] = useState(
23
- product.variants.nodes[0]
24
- );
25
-
26
- const { image } = selectedVariant;
27
- const handleSelectedVariant = (
28
- product: RebuyProduct,
29
- variant_id: string
30
- ) => {
31
- const updatedVariant = product.variants.nodes.find(
32
- (variant) => variant.id === variant_id
33
- );
34
- if (updatedVariant) {
35
- setSelectedVariant(updatedVariant);
36
- }
37
- };
38
- return (
39
- <div className={styles.container}>
40
- <div>
41
- <Link to={`/products/${product.handle}`}>
42
- <Image
43
- alt={image?.altText ?? `Picture of ${product.title}`}
44
- data={image}
45
- sizes="(max-width: 320px) 280px, (max-width: 768px) 720px, 1440px"
46
- />
47
- </Link>
48
- <div className={styles.productInfo}>
49
- <Link to={`/products/${product.handle}`}>
50
- <Title
51
- level={productCardTitleLevel}
52
- text={product.title}
53
- />
54
- </Link>
55
- <RebuyProductPrice selectedVariant={selectedVariant} />
56
- <VariantSelect
57
- handleSelectedVariant={handleSelectedVariant}
58
- product={product}
59
- />
60
- </div>
61
- </div>
62
- <AddToCartBtn
63
- addToCartBtnText={addToCartBtnText}
64
- addToCartCallback={addToCartCallback}
65
- isHydrogenReact={isHydrogenReact}
66
- selectedVariants={[selectedVariant]}
67
- />
68
- </div>
69
- );
70
- };
@@ -1 +0,0 @@
1
- export * from './ProductCard';
@@ -1,10 +0,0 @@
1
- import type { ProductCardTitleLevel } from '~/types/common';
2
- import type { RebuyProduct } from '~/types/rebuyCustom';
3
-
4
- export type ProductCardProps = {
5
- addToCartBtnText?: string;
6
- addToCartCallback?: () => void; // to allow for custom add to cart logic/opening the cart drawer
7
- isHydrogenReact?: boolean;
8
- product: RebuyProduct;
9
- productCardTitleLevel: ProductCardTitleLevel;
10
- };
@@ -1,49 +0,0 @@
1
- import { Money } from '@shopify/hydrogen';
2
-
3
- import styles from './ProductPrice.module.css';
4
-
5
- import type { MoneyV2 } from '@shopify/hydrogen-react/storefront-api-types';
6
- import type { RebuyProductVariant } from '~/types/rebuyCustom';
7
-
8
- export const RebuyProductPrice = ({
9
- selectedVariant,
10
- }: {
11
- selectedVariant: RebuyProductVariant;
12
- }) => {
13
- if (!selectedVariant) return null;
14
- const { compareAtPriceV2: compareAtPrice, priceV2: price } =
15
- selectedVariant;
16
-
17
- const isDiscounted = (
18
- price: MoneyV2 | null,
19
- compareAtPrice: MoneyV2 | null
20
- ) => Number(compareAtPrice?.amount) > Number(price?.amount);
21
-
22
- const CompareAtPrice = ({
23
- data: compareAtPrice,
24
- }: {
25
- data: MoneyV2 | null;
26
- }) => {
27
- return (
28
- compareAtPrice && (
29
- <Money
30
- as="span"
31
- className={styles.compareAtPrice}
32
- data={compareAtPrice}
33
- withoutTrailingZeros
34
- />
35
- )
36
- );
37
- };
38
-
39
- return (
40
- price && (
41
- <div className={styles.priceContainer}>
42
- <Money data={price} withoutTrailingZeros />
43
- {compareAtPrice && isDiscounted(price, compareAtPrice) && (
44
- <CompareAtPrice data={compareAtPrice} />
45
- )}
46
- </div>
47
- )
48
- );
49
- };
@@ -1 +0,0 @@
1
- export * from './ProductPrice';
@@ -1,19 +0,0 @@
1
- import type { TitleProps } from '~/components/Title/types';
2
-
3
- export const Title = ({ level, style, text }: TitleProps) => {
4
- switch (level) {
5
- case 'h1':
6
- return <h1 style={style}>{text}</h1>;
7
- default:
8
- case 'h2':
9
- return <h2 style={style}>{text}</h2>;
10
- case 'h3':
11
- return <h3 style={style}>{text}</h3>;
12
- case 'h4':
13
- return <h4 style={style}>{text}</h4>;
14
- case 'h5':
15
- return <h5 style={style}>{text}</h5>;
16
- case 'h6':
17
- return <h6 style={style}>{text}</h6>;
18
- }
19
- };
@@ -1 +0,0 @@
1
- export * from './Title';
@@ -1,7 +0,0 @@
1
- import type { ProductCardTitleLevel } from '~/types/common';
2
-
3
- export type TitleProps = {
4
- level: ProductCardTitleLevel;
5
- style?: React.CSSProperties;
6
- text: string;
7
- };