@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
@@ -0,0 +1,32 @@
1
+ import { type FC, type ReactNode } from 'react';
2
+ import type { CartContextValue, StorefrontCartConstructor, StorefrontCartData } from '~/smart-cart/types/rebuy-storefront-cart';
3
+ /**
4
+ * Hook to access the Storefront Cart context.
5
+ * Provides cart data, loading state, error state, and methods to interact with the cart.
6
+ * Requires the specific StorefrontCart implementation to be injected via CartProvider.
7
+ *
8
+ * @throws Will throw an error if used outside of a `CartProvider`.
9
+ *
10
+ * @returns {CartContextValue} The cart context value.
11
+ */
12
+ export declare const useStorefrontCart: () => CartContextValue;
13
+ type CartProviderBaseProps = {
14
+ /** Optional: Storefront API version (defaults might be handled by implementation). */
15
+ apiVersion?: string;
16
+ /** The actual StorefrontCart class implementation to use. */
17
+ cartImplementation: StorefrontCartConstructor;
18
+ /** The children to render inside the CartProvider. */
19
+ children?: ReactNode;
20
+ /** Optional: Initial cart data to avoid fetching on load. */
21
+ initialCartData?: StorefrontCartData | null;
22
+ /** Optional: An existing Shopify Cart ID to initialize with. */
23
+ initialCartId?: string | null;
24
+ /** The Shopify store domain (e.g., 'your-store.myshopify.com'). */
25
+ shopifyDomain: string;
26
+ /** The Shopify Storefront API access token. */
27
+ storefrontAccessToken: string;
28
+ };
29
+ export type CartProviderProps = CartProviderBaseProps;
30
+ export declare const CartProvider: FC<CartProviderProps>;
31
+ export {};
32
+ //# sourceMappingURL=StorefrontCartContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StorefrontCartContext.d.ts","sourceRoot":"","sources":["../../../src/smart-cart/context/StorefrontCartContext.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAwE,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAKtH,OAAO,KAAK,EACR,gBAAgB,EAIhB,yBAAyB,EACzB,kBAAkB,EAIrB,MAAM,0CAA0C,CAAC;AASlD;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,QAAO,gBAQpC,CAAC;AAKF,KAAK,qBAAqB,GAAG;IACzB,sFAAsF;IACtF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6DAA6D;IAC7D,kBAAkB,EAAE,yBAAyB,CAAC;IAC9C,sDAAsD;IACtD,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,6DAA6D;IAC7D,eAAe,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAC5C,gEAAgE;IAChE,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,mEAAmE;IACnE,aAAa,EAAE,MAAM,CAAC;IACtB,+CAA+C;IAC/C,qBAAqB,EAAE,MAAM,CAAC;CACjC,CAAC;AAGF,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,CAAC;AAEtD,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CA2nB9C,CAAC"}
@@ -0,0 +1,84 @@
1
+ import type { AttributeInput as HRAttributeInput } from '@shopify/hydrogen-react/storefront-api-types';
2
+ import type { StorefrontAttribute, StorefrontCartLine } from '~/smart-cart/types/rebuy-storefront-cart';
3
+ import type { BuyMoreSaveMoreTier as BmsmTier, SmartCartConfig } from '~/smart-cart/types/smart-cart';
4
+ export declare const mapCartAttributes: (attributes?: StorefrontAttribute[] | null) => HRAttributeInput[];
5
+ type UseCartItemFeaturesProps = {
6
+ config: SmartCartConfig | null;
7
+ line: StorefrontCartLine;
8
+ };
9
+ export type UpdateLinePayload = {
10
+ attributes?: HRAttributeInput[];
11
+ lineId: string;
12
+ quantity?: number;
13
+ sellingPlanId?: string | null;
14
+ };
15
+ export type RemoveLinePayload = {
16
+ lineId: string;
17
+ };
18
+ export declare const useCartItemFeatures: ({ config, line }: UseCartItemFeaturesProps) => {
19
+ actions: {
20
+ prepareAdjustBMSMQuantity: (tierQuantity: number) => UpdateLinePayload | null;
21
+ prepareDecreaseQuantity: () => UpdateLinePayload | RemoveLinePayload;
22
+ prepareIncreaseQuantity: () => UpdateLinePayload;
23
+ prepareRemoveItem: () => RemoveLinePayload;
24
+ prepareSubscriptionSwitch: (targetSellingPlanId: string | null) => UpdateLinePayload;
25
+ toggleBundle: () => void;
26
+ };
27
+ bmsm: {
28
+ dynamicText: string;
29
+ getButtonText: (tier: BmsmTier) => string;
30
+ isButtonMode: boolean;
31
+ isEnabledAndApplicable: boolean;
32
+ nextApplicableTiers: BmsmTier[];
33
+ };
34
+ bundle: {
35
+ isBundleParent: boolean;
36
+ itemCount: number;
37
+ showToggle: boolean;
38
+ };
39
+ isBundleExpanded: boolean;
40
+ meta: {
41
+ ariaLabel: string;
42
+ attributeCssClasses: string;
43
+ baseCssClasses: string;
44
+ imageAltText: string;
45
+ imageUrl: string;
46
+ itemUrl: string;
47
+ linkLabel: string;
48
+ productTitle: string;
49
+ tagCssClasses: string;
50
+ variantTitle: string | null;
51
+ };
52
+ pricing: {
53
+ compareAtDisplayPrice: string | null;
54
+ displayPrice: string;
55
+ hasDiscount: boolean;
56
+ };
57
+ properties: {
58
+ deliveryFrequency: string | null;
59
+ hasVisibleProperties: boolean;
60
+ visibleProperties: import("@shopify/hydrogen/storefront-api-types").Attribute[];
61
+ };
62
+ shouldHideQuantitySelector: boolean;
63
+ sts: {
64
+ availableFrequencies: {
65
+ adjustments: import("~/smart-cart/types/rebuy-storefront-cart").StorefrontSellingPlanPriceAdjustment[] | null;
66
+ id: string;
67
+ name: string;
68
+ }[];
69
+ canDowngrade: boolean;
70
+ getDowngradingLabel: () => string;
71
+ getGroupLabel: () => string;
72
+ getLoadingLabel: (direction?: "upgrading" | "downgrading" | null) => string;
73
+ getOneTimeGroupLabel: () => string;
74
+ getOneTimeLabel: () => string;
75
+ getOptionLabel: (frequencyId: string) => string;
76
+ getUpgradeButtonLabel: () => string;
77
+ getUpgradingLabel: () => string;
78
+ isCurrentlySubscription: boolean;
79
+ isEnabledAndApplicable: boolean;
80
+ };
81
+ };
82
+ export type UseCartItemFeaturesReturn = ReturnType<typeof useCartItemFeatures>;
83
+ export {};
84
+ //# sourceMappingURL=useCartItemFeatures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCartItemFeatures.d.ts","sourceRoot":"","sources":["../../../src/smart-cart/hooks/useCartItemFeatures.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,IAAI,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAKvG,OAAO,KAAK,EACR,mBAAmB,EACnB,kBAAkB,EAErB,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EACR,mBAAmB,IAAI,QAAQ,EAC/B,eAAe,EAElB,MAAM,+BAA+B,CAAC;AAkCvC,eAAO,MAAM,iBAAiB,GAAI,aAAa,mBAAmB,EAAE,GAAG,IAAI,KAAG,gBAAgB,EAS7F,CAAC;AAEF,KAAK,wBAAwB,GAAG;IAC5B,MAAM,EAAE,eAAe,GAAG,IAAI,CAAC;IAC/B,IAAI,EAAE,kBAAkB,CAAC;CAC5B,CAAC;AAGF,MAAM,MAAM,iBAAiB,GAAG;IAC5B,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC,CAAC;AACF,MAAM,MAAM,iBAAiB,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,kBAAkB,wBAAwB;;kDA+NvD,MAAM,KAAG,iBAAiB,GAAG,IAAI;uCA5EJ,iBAAiB,GAAG,iBAAiB;uCAuCrC,iBAAiB;iCA8BvB,iBAAiB;yDAmCjC,MAAM,GAAG,IAAI,KAAG,iBAAiB;;;;;8BAuEzB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sCA+CA,WAAW,GAAG,aAAa,GAAG,IAAI;;;sCAgClC,MAAM;;;;;;CAwEnD,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
@@ -0,0 +1,28 @@
1
+ export type ApplyCodesPayload = {
2
+ codes: string[];
3
+ };
4
+ /**
5
+ * Manages discount code state and interactions for the Smart Cart (Storefront API ONLY).
6
+ */
7
+ export declare const useDiscountManager: () => {
8
+ appliedCodes: string[];
9
+ error: string | null;
10
+ isProcessing: boolean;
11
+ prepareApplyCode: (code: string) => ApplyCodesPayload | null;
12
+ prepareRemoveAllCodes: () => ApplyCodesPayload;
13
+ prepareRemoveCode: (codeToRemove: string) => ApplyCodesPayload;
14
+ processActionResult: (resultCart: (import("@shopify/hydrogen/storefront-api-types").Cart | null) | null | undefined, attemptedCode?: string) => void;
15
+ setCurrentError: import("react").Dispatch<import("react").SetStateAction<string | null>>;
16
+ setIsProcessing: import("react").Dispatch<import("react").SetStateAction<boolean>>;
17
+ settings: {
18
+ language: {
19
+ discount_button_label: string;
20
+ discount_code_label: string;
21
+ discount_invalid_message: string;
22
+ };
23
+ use_message_only: boolean;
24
+ use_storefront_api: boolean;
25
+ } | null;
26
+ };
27
+ export type UseDiscountManagerReturn = ReturnType<typeof useDiscountManager>;
28
+ //# sourceMappingURL=useDiscountManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDiscountManager.d.ts","sourceRoot":"","sources":["../../../src/smart-cart/hooks/useDiscountManager.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,iBAAiB,GAAG;IAAE,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAIpD;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;6BA+BhB,MAAM,KAAG,iBAAiB,GAAG,IAAI;iCAqBE,iBAAiB;sCAT5C,MAAM,KAAG,iBAAiB;sCAiBJ,iEAAkB,IAAI,GAAG,SAAS,kBAAkB,MAAM;;;;;;;;;;;;CAsCtG,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ export type GeolocationData = {
2
+ [key: string]: unknown;
3
+ country_code: string;
4
+ };
5
+ export type UseGeolocationResult = {
6
+ data: GeolocationData | null;
7
+ error: Error | null;
8
+ fetchGeolocation: () => Promise<GeolocationData | null>;
9
+ loading: boolean;
10
+ };
11
+ export declare const useGeolocation: (autoFetch?: boolean) => UseGeolocationResult;
12
+ //# sourceMappingURL=useGeolocation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useGeolocation.d.ts","sourceRoot":"","sources":["../../../src/smart-cart/hooks/useGeolocation.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,eAAe,GAAG;IAI1B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAEvB,YAAY,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IAC/B,IAAI,EAAE,eAAe,GAAG,IAAI,CAAC;IAC7B,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,gBAAgB,EAAE,MAAM,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;IACxD,OAAO,EAAE,OAAO,CAAC;CACpB,CAAC;AAGF,eAAO,MAAM,cAAc,GAAI,mBAAiB,KAAG,oBA8BlD,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Custom hook to detect if a scrollable element has been scrolled down
3
+ *
4
+ * @param {RefObject<HTMLElement>} scrollElementRef - Ref to the scrollable element
5
+ * @returns {boolean} - boolean indicating if the element has been scrolled (scrollTop > 0)
6
+ *
7
+ * @example
8
+ * const scrollElementRef = useRef<HTMLDivElement>(null);
9
+ * const isScrolled = useIsScrolled(scrollElementRef);
10
+ *
11
+ * return <div ref={scrollElementRef}>{isScrolled ? 'Scrolled' : 'Not scrolled'}</div>;
12
+ */
13
+ export declare const useIsScrolled: (scrollElementRef: React.RefObject<HTMLElement>) => boolean;
14
+ //# sourceMappingURL=useIsScrolled.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIsScrolled.d.ts","sourceRoot":"","sources":["../../../src/smart-cart/hooks/useIsScrolled.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,GAAI,kBAAkB,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,YAwB3E,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { type EnrichedSmartCartApp } from '~/smart-cart/types/smart-cart-app';
2
+ type UseSmartCartAppsResult = {
3
+ enrichedApps: Map<number, EnrichedSmartCartApp>;
4
+ error: string | null;
5
+ isLoading: boolean;
6
+ };
7
+ /**
8
+ * Hook to fetch, enrich, and manage Smart Cart App data.
9
+ * Fetches data from the Rebuy `/smart_cart/apps` endpoint based on the
10
+ * configured apps in the Smart Cart settings. Handles variable substitution.
11
+ * Uses Zod to validate individual app data structures from the API.
12
+ *
13
+ * @returns {UseSmartCartAppsResult} Object containing enriched apps, loading state, and any fatal errors
14
+ */
15
+ export declare const useSmartCartApps: () => UseSmartCartAppsResult;
16
+ export {};
17
+ //# sourceMappingURL=useSmartCartApps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSmartCartApps.d.ts","sourceRoot":"","sources":["../../../src/smart-cart/hooks/useSmartCartApps.ts"],"names":[],"mappings":"AAKA,OAAO,EAGH,KAAK,oBAAoB,EAI5B,MAAM,mCAAmC,CAAC;AAI3C,KAAK,sBAAsB,GAAG;IAC1B,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IAChD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;CACtB,CAAC;AAYF;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,QAAO,sBAqOnC,CAAC"}
@@ -0,0 +1,76 @@
1
+ import type { CartLineInput as HRCartLineInput } from '@shopify/hydrogen-react/storefront-api-types';
2
+ import { type TieredProgressBar, type TieredProgressBarFetchedProductData, type TieredProgressBarQualifiedGiftState, type TieredProgressBarSettings } from '~/smart-cart/components/TieredProgressBar/types';
3
+ import type { StorefrontCartData } from '~/smart-cart/types/rebuy-storefront-cart';
4
+ export type TieredProgressBarStoreState = {
5
+ _addItemsImpl: ((items: HRCartLineInput[]) => void) | null;
6
+ _lastFetchedBarId: string | null;
7
+ _removeItemsImpl: ((lineIds: string[]) => void) | null;
8
+ _shopifyDomain: string;
9
+ _storefrontAccessToken: string;
10
+ activeBarConfig: TieredProgressBar | null;
11
+ cartData: StorefrontCartData | null;
12
+ cartSyncError: string | null;
13
+ cartSyncStatus: 'idle' | 'syncing' | 'success' | 'error' | 'awaiting_cart_update';
14
+ currentSubtotal: number;
15
+ declinedGiftMap: Record<string, boolean>;
16
+ fetchedProductMap: Map<number, TieredProgressBarFetchedProductData>;
17
+ giftStates: Map<string, TieredProgressBarQualifiedGiftState>;
18
+ hasFreeShippingOnSubscription: boolean;
19
+ initializationStatus: 'idle' | 'pending' | 'complete';
20
+ isCartReady: boolean;
21
+ isManuallyDisabled: boolean;
22
+ lastErrorTimestamp: number;
23
+ productFetchError: string | null;
24
+ productFetchStatus: 'idle' | 'loading' | 'success' | 'error';
25
+ settings: TieredProgressBarSettings | null;
26
+ userActionError: {
27
+ message: string;
28
+ tierId: string;
29
+ } | null;
30
+ userActionStatus: 'idle' | 'pending' | 'error';
31
+ };
32
+ export type TieredProgressBarStoreActions = {
33
+ /** Clears any active user action error. */
34
+ clearUserActionError: () => void;
35
+ /** Manually disables the progress bar. */
36
+ disableBar: () => void;
37
+ /** Manually enables the progress bar if it was disabled. */
38
+ enableBar: () => void;
39
+ /** Fetches product data for gift tiers from Shopify Storefront API. Caches results in session storage. */
40
+ fetchProducts: () => Promise<void>;
41
+ /**
42
+ * Handles user action to add or re-add a gift (if previously declined).
43
+ * For single-variant gifts, adds to cart. For multi-variant, undeclines and shows selector.
44
+ */
45
+ handleAddOrReAddGift: (tierId: string) => void;
46
+ /**
47
+ * Handles user action to remove a gift from the cart and mark it as declined for the current tier.
48
+ */
49
+ handleRemoveGift: (tierId: string) => void;
50
+ /**
51
+ * Handles user selection of a gift variant.
52
+ * Adds the selected variant to the cart and removes any existing gift from the same tier.
53
+ */
54
+ handleSelectVariant: (tierId: string, variantGid: string) => void;
55
+ /** Initializes the store with settings and Shopify connection details. */
56
+ init: (settings: TieredProgressBarSettings, shopifyDomain: string, storefrontAccessToken: string) => Promise<void>;
57
+ /**
58
+ * Recalculates derived state based on current cart data, settings, and fetched products.
59
+ * This includes subtotal, tier statuses, gift states, etc.
60
+ * Typically called internally after cart updates or product fetches.
61
+ */
62
+ recalculateState: () => void;
63
+ /** Sets the cart data and readiness state, usually called when the main cart context updates. */
64
+ setCartData: (cartData: StorefrontCartData | null, isCartReady: boolean) => void;
65
+ /** Sets the internal submit functions for cart actions. */
66
+ setSubmitFunctions: (addItemsImpl: (items: HRCartLineInput[]) => void, removeItemsImpl: (lineIds: string[]) => void) => void;
67
+ /**
68
+ * Synchronizes gifts in the cart with the calculated qualified gifts.
69
+ * Automatically adds/removes gift items based on tier reachability and availability.
70
+ */
71
+ syncCartGifts: () => Promise<void>;
72
+ };
73
+ export type TieredProgressBarStore = TieredProgressBarStoreState & TieredProgressBarStoreActions;
74
+ export declare const useTieredProgressBarStore: import("zustand").UseBoundStore<import("zustand").StoreApi<TieredProgressBarStore>>;
75
+ export type SelectedTieredProgressBarStore = Pick<TieredProgressBarStoreState, 'activeBarConfig' | 'currentSubtotal' | 'giftStates' | 'isCartReady' | 'productFetchStatus' | 'cartSyncStatus' | 'userActionStatus' | 'productFetchError' | 'cartSyncError' | 'userActionError' | 'isManuallyDisabled' | 'hasFreeShippingOnSubscription' | 'declinedGiftMap' | 'initializationStatus' | '_lastFetchedBarId' | 'fetchedProductMap'>;
76
+ //# sourceMappingURL=tieredProgressBarStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tieredProgressBarStore.d.ts","sourceRoot":"","sources":["../../../src/smart-cart/store/tieredProgressBarStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,IAAI,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAcrG,OAAO,EAEH,KAAK,iBAAiB,EAEtB,KAAK,mCAAmC,EACxC,KAAK,mCAAmC,EACxC,KAAK,yBAAyB,EAEjC,MAAM,iDAAiD,CAAC;AAEzD,OAAO,KAAK,EAAuB,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAKxG,MAAM,MAAM,2BAA2B,GAAG;IACtC,aAAa,EAAE,CAAC,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IAC3D,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,gBAAgB,EAAE,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IACvD,cAAc,EAAE,MAAM,CAAC;IACvB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,eAAe,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC1C,QAA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Line, ComponentizableCartLine, Attribute as HydrogenAttribute, AttributeInput as HydrogenAttributeInput, Cart as HydrogenCart, CartBuyerIdentity as HydrogenCartBuyerIdentity, CartDiscountCode as HydrogenCartDiscountCode, CartLine as HydrogenCartLine, CartLineInput as HydrogenCartLineInput, CartLineUpdateInput as HydrogenCartLineUpdateInput, Customer as HydrogenCustomer, Image as HydrogenImage, MoneyV2 as HydrogenMoneyV2, Product as HydrogenProduct, ProductOption as HydrogenProductOption, ProductVariant as HydrogenProductVariant, SelectedOption as HydrogenSelectedOption, SellingPlan as HydrogenSellingPlan, SellingPlanFixedAmountPriceAdjustment as HydrogenSellingPlanFixedAmountPriceAdjustment, SellingPlanFixedPriceAdjustment as HydrogenSellingPlanFixedPriceAdjustment, SellingPlanGroup as HydrogenSellingPlanGroup, SellingPlanGroupOption as HydrogenSellingPlanGroupOption, SellingPlanPercentagePriceAdjustment as HydrogenSellingPlanPercentagePriceAdjustment, SellingPlanPriceAdjustment as HydrogenSellingPlanPriceAdjustment, SellingPlanPriceAdjustmentValue as HydrogenSellingPlanPriceAdjustmentValue } from '@shopify/hydrogen/storefront-api-types';
2
+ /** Represents the Shopify Money type */
3
+ export type StorefrontMoney = HydrogenMoneyV2;
4
+ /** Represents the Shopify Image type */
5
+ export type StorefrontImage = HydrogenImage;
6
+ /** Represents a generic Attribute */
7
+ export type StorefrontAttribute = HydrogenAttribute;
8
+ /** Represents a generic Attribute Input */
9
+ export type StorefrontAttributeInput = HydrogenAttributeInput;
10
+ /** Represents a fixed amount discounted from the original variant price. */
11
+ export type SellingPlanFixedAmountPriceAdjustment = HydrogenSellingPlanFixedAmountPriceAdjustment;
12
+ /** Represents a fixed price for the variant when purchased with the selling plan. */
13
+ export type SellingPlanFixedPriceAdjustment = HydrogenSellingPlanFixedPriceAdjustment;
14
+ /** Represents a percentage amount discounted from the original variant price. */
15
+ export type SellingPlanPercentagePriceAdjustment = HydrogenSellingPlanPercentagePriceAdjustment;
16
+ /** Possible types for a selling plan's price adjustment value. */
17
+ export type SellingPlanPriceAdjustmentValue = HydrogenSellingPlanPriceAdjustmentValue;
18
+ /** Represents a Selling Plan Price Adjustment */
19
+ export type StorefrontSellingPlanPriceAdjustment = HydrogenSellingPlanPriceAdjustment;
20
+ /** Represents a Selling Plan node */
21
+ export type StorefrontSellingPlan = HydrogenSellingPlan;
22
+ /** Represents a Selling Plan Group Option */
23
+ export type StorefrontSellingPlanGroupOption = HydrogenSellingPlanGroupOption;
24
+ /** Represents a Selling Plan Group node */
25
+ export type StorefrontSellingPlanGroup = HydrogenSellingPlanGroup;
26
+ /** Represents a selected option for a Product Variant */
27
+ export type StorefrontSelectedOption = HydrogenSelectedOption;
28
+ /** Represents a basic Product Option */
29
+ export type StorefrontProductOption = HydrogenProductOption;
30
+ /** Automatic Discount Allocation */
31
+ export type StorefrontAutomaticDiscountAllocation = CartAutomaticDiscountAllocation;
32
+ /** Code Discount Allocation */
33
+ export type StorefrontCodeDiscountAllocation = CartCodeDiscountAllocation;
34
+ /** Custom Discount Allocation */
35
+ export type StorefrontCustomDiscountAllocation = CartCustomDiscountAllocation;
36
+ /** Represents a discount allocation */
37
+ export type StorefrontTypedDiscountAllocation = StorefrontAutomaticDiscountAllocation | StorefrontCodeDiscountAllocation | StorefrontCustomDiscountAllocation;
38
+ /** Represents an applied Discount Code */
39
+ export type StorefrontDiscountCode = HydrogenCartDiscountCode;
40
+ /** Represents the Customer associated with the cart */
41
+ export type StorefrontCustomer = HydrogenCustomer;
42
+ /** Represents the Buyer Identity associated with the cart */
43
+ export type StorefrontBuyerIdentity = HydrogenCartBuyerIdentity;
44
+ export type StorefrontCartOptions = {
45
+ apiVersion?: string;
46
+ cart?: StorefrontCartData | null;
47
+ cartId?: string | null;
48
+ };
49
+ /** Represents the structure of the cart data */
50
+ export type StorefrontCartData = HydrogenCart;
51
+ export type StorefrontCartChangeEvent = {
52
+ cart: StorefrontCartData;
53
+ previous: StorefrontCartData | null;
54
+ };
55
+ export type StorefrontCartLine = HydrogenCartLine;
56
+ export type AnyCartLine = CartLine | ComponentizableCartLine;
57
+ export type StorefrontProductVariant = HydrogenProductVariant;
58
+ export type StorefrontProduct = HydrogenProduct;
59
+ /** Input for adding an item to the cart */
60
+ export type StorefrontCartItemInput = HydrogenCartLineInput;
61
+ /** Input for updating a line item in the cart */
62
+ export type StorefrontCartLineUpdateInput = HydrogenCartLineUpdateInput;
63
+ export type IStorefrontCart = {
64
+ addItem(variantId: string, quantity?: number, properties?: StorefrontAttribute[]): Promise<StorefrontCartData>;
65
+ addItems(items: StorefrontCartItemInput[]): Promise<StorefrontCartData>;
66
+ applyDiscountCodes(codes: string[]): Promise<StorefrontCartData>;
67
+ readonly cart: StorefrontCartData | null;
68
+ readonly cartId: string | null;
69
+ checkout(): void;
70
+ createCart(): Promise<StorefrontCartData>;
71
+ destroy(): void;
72
+ events: {
73
+ off(event: string, callback: (data: StorefrontCartData) => void): void;
74
+ off(event: 'cart:change', callback: (data: StorefrontCartChangeEvent) => void): void;
75
+ on(event: string, callback: (data: StorefrontCartData) => void): void;
76
+ on(event: 'cart:change', callback: (data: StorefrontCartChangeEvent) => void): void;
77
+ };
78
+ getCart(): Promise<StorefrontCartData | null>;
79
+ getCartSubtotal(): number;
80
+ getItemCount(): number;
81
+ removeItem(item: string | StorefrontCartLine): Promise<StorefrontCartData>;
82
+ removeItems(items: (string | StorefrontCartLine)[]): Promise<StorefrontCartData>;
83
+ setCart(cartData: StorefrontCartData): StorefrontCartData;
84
+ setCartId(cartId: string): Promise<StorefrontCartData>;
85
+ swapItems(itemsToAdd: StorefrontCartItemInput[], itemsToRemove: string[]): Promise<StorefrontCartData>;
86
+ switchAllToOneTime(): Promise<StorefrontCartData>;
87
+ switchAllToSubscription(sellingPlan?: string | number): Promise<StorefrontCartData>;
88
+ switchItemToOneTime(item: StorefrontCartLine): Promise<StorefrontCartData>;
89
+ switchItemToSubscription(item: StorefrontCartLine, sellingPlan?: string | number): Promise<StorefrontCartData>;
90
+ updateCartAttributes(attributes: StorefrontAttribute[]): Promise<StorefrontCartData>;
91
+ updateCartNote: (note: string | null) => Promise<StorefrontCartData>;
92
+ updateItem(item: string | StorefrontCartLine, updates?: Partial<StorefrontCartLineUpdateInput>): Promise<StorefrontCartData>;
93
+ updateItems(updates: StorefrontCartLineUpdateInput[]): Promise<StorefrontCartData>;
94
+ };
95
+ export type StorefrontCartConstructor = {
96
+ new (shopifyDomain: string, storefrontAccessToken: string, options?: StorefrontCartOptions): IStorefrontCart;
97
+ };
98
+ export type CartContextValue = {
99
+ /** Adds a single item to the cart. */
100
+ addItem: (variantId: string, quantity?: number, properties?: StorefrontAttribute[]) => Promise<StorefrontCartData | null>;
101
+ /** Adds multiple items to the cart. */
102
+ addItems: (items: StorefrontCartItemInput[]) => Promise<StorefrontCartData | null>;
103
+ /** Applies one or more discount codes to the cart. */
104
+ applyDiscountCodes: (codes: string[]) => Promise<StorefrontCartData | null>;
105
+ /** The current state of the cart data. Null if no cart exists or module not found. */
106
+ cartData: StorefrontCartData | null;
107
+ /** The raw instance of the StorefrontCart class. Use with caution, prefer helper methods. Null if module not found or during init. */
108
+ cartInstance: IStorefrontCart | null;
109
+ /** Redirects the user to the Shopify checkout URL. */
110
+ checkout: () => void;
111
+ /** Error message if initialization failed (e.g., module not found). */
112
+ error: string | null;
113
+ /** Returns the current cart subtotal amount as a string. */
114
+ getCartSubtotal: () => string;
115
+ /** Returns the total number of items in the cart. */
116
+ getItemCount: () => number;
117
+ /** Indicates if the cart is currently being initialized or updated. */
118
+ isLoading: boolean;
119
+ /** Removes a single item from the cart by its line ID. */
120
+ removeItem: (lineId: string) => Promise<StorefrontCartData | null>;
121
+ /** Removes multiple items from the cart by their line IDs. */
122
+ removeItems: (lineIds: string[]) => Promise<StorefrontCartData | null>;
123
+ /** Swaps items in the cart (adds new, removes old). */
124
+ swapItems: (itemsToAdd: StorefrontCartItemInput[], itemsToRemove: string[]) => Promise<StorefrontCartData | null>;
125
+ /** Switches all items in the cart back to one-time purchases. */
126
+ switchAllToOneTime: () => Promise<StorefrontCartData | null>;
127
+ /** Switches all applicable items in the cart to a subscription. */
128
+ switchAllToSubscription: (sellingPlanId?: string) => Promise<StorefrontCartData | null>;
129
+ /** Switches a specific cart line item back to a one-time purchase with optional attributes. */
130
+ switchItemToOneTime: (lineId: string, attributes?: StorefrontAttribute[]) => Promise<StorefrontCartData | null>;
131
+ /** Switches a specific cart line item to a subscription with optional attributes. */
132
+ switchItemToSubscription: (lineId: string, sellingPlanId?: string, attributes?: StorefrontAttribute[]) => Promise<StorefrontCartData | null>;
133
+ /** Updates the cart attributes. */
134
+ updateCartAttributes: (attributes: StorefrontAttribute[]) => Promise<StorefrontCartData | null>;
135
+ /** Updates the note on the cart. Pass an empty string ('') or null to clear. */
136
+ updateCartNote: (note: string | null) => Promise<StorefrontCartData | null>;
137
+ /** Updates a single item in the cart. Requires lineId. */
138
+ updateItem: (lineId: string, updates: Partial<Omit<StorefrontCartLineUpdateInput, 'id'>>) => Promise<StorefrontCartData | null>;
139
+ /** Updates multiple items in the cart. */
140
+ updateItems: (updates: StorefrontCartLineUpdateInput[]) => Promise<StorefrontCartData | null>;
141
+ };
142
+ //# sourceMappingURL=rebuy-storefront-cart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rebuy-storefront-cart.d.ts","sourceRoot":"","sources":["../../../src/smart-cart/types/rebuy-storefront-cart.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACR,+BAA+B,EAC/B,0BAA0B,EAC1B,4BAA4B,EAC5B,QAAQ,EACR,uBAAuB,EACvB,SAAS,IAAI,iBAAiB,EAC9B,cAAc,IAAI,sBAAsB,EACxC,IAAI,IAAI,YAAY,EACpB,iBAAiB,IAAI,yBAAyB,EAC9C,gBAAgB,IAAI,wBAAwB,EAC5C,QAAQ,IAAI,gBAAgB,EAC5B,aAAa,IAAI,qBAAqB,EACtC,mBAAmB,IAAI,2BAA2B,EAClD,QAAQ,IAAI,gBAAgB,EAC5B,KAAK,IAAI,a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jE,kBAAkB,EAAE,MAAM,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC;IAC7D,mEAAmE;IACnE,uBAAuB,EAAE,CAAC,aAAa,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC;IACxF,+FAA+F;IAC/F,mBAAmB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,mBAAmB,EAAE,KAAK,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC;IAChH,qFAAqF;IACrF,wBAAwB,EAAE,CACtB,MAAM,EAAE,MAAM,EACd,aAAa,CAAC,EAAE,MAAM,EACtB,UAAU,CAAC,EAAE,mBAAmB,EAAE,KACjC,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC;IACxC,mCAAmC;IACnC,oBAAoB,EAAE,CAAC,UAAU,EAAE,mBAAmB,EAAE,KAAK,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC;IAChG,gFAAgF;IAChF,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,KAAK,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC;IAC5E,0DAA0D;IAC1D,UAAU,EAAE,CACR,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,6BAA6B,EAAE,IAAI,CAAC,CAAC,KAC1D,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC;IACxC,0CAA0C;IAC1C,WAAW,EAAE,CAAC,OAAO,EAAE,6BAA6B,EAAE,KAAK,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC;CACjG,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { IStorefrontCart } from '~/smart-cart/types/rebuy-storefront-cart';
2
+ import type { Shop } from '~/smart-cart/types/shop';
3
+ import type { SmartCartConfig } from '~/smart-cart/types/smart-cart';
4
+ /**
5
+ * The payload fetched from /api/v1/user/config
6
+ */
7
+ export type RebuyShopConfigData = {
8
+ shop?: Shop;
9
+ smart_cart?: SmartCartConfig;
10
+ smart_flows?: unknown[];
11
+ };
12
+ export type RebuyHeadless = {
13
+ StorefrontCart?: IStorefrontCart;
14
+ };
15
+ //# sourceMappingURL=rebuy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rebuy.d.ts","sourceRoot":"","sources":["../../../src/smart-cart/types/rebuy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAErE;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAC9B,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAExB,cAAc,CAAC,EAAE,eAAe,CAAC;CACpC,CAAC"}
@@ -0,0 +1,26 @@
1
+ export type Shop = {
2
+ active_experiments?: object[];
3
+ api_key: string;
4
+ cache_key: string;
5
+ carousel: string;
6
+ currency: string;
7
+ currency_symbol: string;
8
+ domain: string;
9
+ enabled_presentment_currencies: string[];
10
+ has_smart_search_enabled: boolean;
11
+ id: string;
12
+ integrations: {
13
+ [key: string]: boolean;
14
+ };
15
+ money_format: string;
16
+ myshopify_domain: string;
17
+ primary_locale: string;
18
+ product_groups_enabled: string;
19
+ recharge_custom_domain: string | null;
20
+ selling_plans_enabled: boolean;
21
+ shop_id: number;
22
+ shop_name: string;
23
+ shopify_selling_plans_enabled: boolean;
24
+ storefront_access_token?: string | null;
25
+ };
26
+ //# sourceMappingURL=shop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shop.d.ts","sourceRoot":"","sources":["../../../src/smart-cart/types/shop.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,IAAI,GAAG;IACf,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,8BAA8B,EAAE,MAAM,EAAE,CAAC;IACzC,wBAAwB,EAAE,OAAO,CAAC;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACzC,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,6BAA6B,EAAE,OAAO,CAAC;IACvC,uBAAuB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3C,CAAC"}
@@ -0,0 +1,103 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Smart Cart App shape from the {cached.rebuyengine.com}/api/v1/smart_cart/apps endpoint.
4
+ * Used to enrich the Smart Cart App data for customers on the storefront
5
+ *
6
+ * @see https://bitbucket.org/abovemarket/rebuyengine.com/src/main/application/libraries/Cache/SmartCartApps.php#application/libraries/Cache/SmartCartApps.php-88
7
+ */
8
+ export declare const smartCartAppFromCachedEndpointSchema: z.ZodObject<{
9
+ id: z.ZodNumber;
10
+ name: z.ZodString;
11
+ script: z.ZodString;
12
+ script_variable_json: z.ZodNullable<z.ZodString>;
13
+ }, "strip", z.ZodTypeAny, {
14
+ id: number;
15
+ name: string;
16
+ script: string;
17
+ script_variable_json: string | null;
18
+ }, {
19
+ id: number;
20
+ name: string;
21
+ script: string;
22
+ script_variable_json: string | null;
23
+ }>;
24
+ /**
25
+ * Array of Smart Cart Apps fetched from the {cached.rebuyengine.com}/api/v1/smart_cart/apps endpoint.
26
+ */
27
+ export declare const smartCartAppsFromCachedEndpointSchema: z.ZodArray<z.ZodObject<{
28
+ id: z.ZodNumber;
29
+ name: z.ZodString;
30
+ script: z.ZodString;
31
+ script_variable_json: z.ZodNullable<z.ZodString>;
32
+ }, "strip", z.ZodTypeAny, {
33
+ id: number;
34
+ name: string;
35
+ script: string;
36
+ script_variable_json: string | null;
37
+ }, {
38
+ id: number;
39
+ name: string;
40
+ script: string;
41
+ script_variable_json: string | null;
42
+ }>, "many">;
43
+ /**
44
+ * Smart Cart App Merchant Config Schema (stored in the Smart Cart's settings.apps array)
45
+ * Data sampling from the smart_cart_apps DB table.
46
+ *
47
+ * @see https://bitbucket.org/abovemarket/rebuy-core-ci4/src/main/src/Models/SmartCart/SmartCartV2s.php#src/Models/SmartCart/SmartCartV2s.php-111
48
+ */
49
+ export declare const smartCartAppMerchantConfigSchema: z.ZodObject<{
50
+ enabled: z.ZodBoolean;
51
+ partner_app_id: z.ZodNumber;
52
+ /** @deprecated - not used for anything in V2 */
53
+ show_in_empty_cart: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
54
+ user_inputs: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
55
+ }, "strip", z.ZodTypeAny, {
56
+ enabled: boolean;
57
+ partner_app_id: number;
58
+ user_inputs: Record<string, string> | null;
59
+ show_in_empty_cart?: boolean | null | undefined;
60
+ }, {
61
+ enabled: boolean;
62
+ partner_app_id: number;
63
+ user_inputs: Record<string, string> | null;
64
+ show_in_empty_cart?: boolean | null | undefined;
65
+ }>;
66
+ export type NormalizedAppConfig = {
67
+ enabled: boolean;
68
+ id: number;
69
+ user_inputs?: Record<string, string> | null;
70
+ };
71
+ /**
72
+ * Base properties common to all app entries.
73
+ */
74
+ export type BaseSmartCartApp = {
75
+ id: number;
76
+ user_inputs?: Record<string, string> | null;
77
+ };
78
+ /**
79
+ * Type for enabled apps that includes all required API data.
80
+ */
81
+ export type EnabledSmartCartApp = BaseSmartCartApp & z.infer<typeof smartCartAppFromCachedEndpointSchema> & {
82
+ enabled: true;
83
+ };
84
+ /**
85
+ * Type for disabled apps that doesn't require API data.
86
+ */
87
+ export type DisabledSmartCartApp = BaseSmartCartApp & {
88
+ enabled: false;
89
+ };
90
+ /**
91
+ * Union type for all possible app states.
92
+ * Can be used with type guards: if (app.enabled) { ... }
93
+ */
94
+ export type EnrichedSmartCartApp = EnabledSmartCartApp | DisabledSmartCartApp;
95
+ /**
96
+ * Smart Cart App From Cached Endpoint (cached.rebuyengine.com/api/v1/smart_cart/apps)
97
+ */
98
+ export type SmartCartAppFromCachedEndpoint = z.infer<typeof smartCartAppFromCachedEndpointSchema>;
99
+ /**
100
+ * Smart Cart App Merchant-defined configuration (stored in the Smart Cart's settings.apps array)
101
+ */
102
+ export type SmartCartAppMerchantConfig = z.infer<typeof smartCartAppMerchantConfigSchema>;
103
+ //# sourceMappingURL=smart-cart-app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smart-cart-app.d.ts","sourceRoot":"","sources":["../../../src/smart-cart/types/smart-cart-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;GAKG;AACH,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;EAK/C,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;WAAgD,CAAC;AAEnG;;;;;GAKG;AACH,eAAO,MAAM,gCAAgC;;;IAGzC,gDAAgD;;;;;;;;;;;;;EAGlD,CAAC;AAGH,MAAM,MAAM,mBAAmB,GAAG;IAC9B,OAAO,EAAE,OAAO,CAAC;I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