@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.
- package/README.md +988 -16
- package/dist/assets/Close.d.ts +2 -0
- package/dist/assets/Close.d.ts.map +1 -0
- package/dist/components/AddToCartBtn/AddToCartBtn.d.ts +1 -1
- package/dist/components/AddToCartBtn/AddToCartBtn.d.ts.map +1 -1
- package/dist/components/AddToCartBtn/HydrogenAddToCartBtn.d.ts +1 -1
- package/dist/components/AddToCartBtn/HydrogenAddToCartBtn.d.ts.map +1 -1
- package/dist/components/AddToCartBtn/HydrogenReactAddToCartBtn.d.ts +1 -1
- package/dist/components/AddToCartBtn/HydrogenReactAddToCartBtn.d.ts.map +1 -1
- package/dist/components/AddToCartBtn/types.d.ts +5 -0
- package/dist/components/AddToCartBtn/types.d.ts.map +1 -1
- package/dist/components/ProductCard/ProductCard.d.ts +1 -1
- package/dist/components/ProductCard/ProductCard.d.ts.map +1 -1
- package/dist/components/ProductCard/defaultSettings.d.ts +3 -0
- package/dist/components/ProductCard/defaultSettings.d.ts.map +1 -0
- package/dist/components/ProductCard/index.d.ts +1 -0
- package/dist/components/ProductCard/index.d.ts.map +1 -1
- package/dist/components/ProductCard/types.d.ts +46 -0
- package/dist/components/ProductCard/types.d.ts.map +1 -1
- package/dist/components/ProductCarousel/ProductCarousel.d.ts +3 -0
- package/dist/components/ProductCarousel/ProductCarousel.d.ts.map +1 -0
- package/dist/components/ProductCarousel/index.d.ts +2 -0
- package/dist/components/ProductCarousel/index.d.ts.map +1 -0
- package/dist/components/ProductCarousel/types.d.ts +18 -0
- package/dist/components/ProductCarousel/types.d.ts.map +1 -0
- package/dist/components/ProductPrice/ProductPrice.d.ts +2 -4
- package/dist/components/ProductPrice/ProductPrice.d.ts.map +1 -1
- package/dist/components/ProductPrice/types.d.ts +23 -0
- package/dist/components/ProductPrice/types.d.ts.map +1 -0
- package/dist/components/QuantityInput/QuantityInput.d.ts +3 -0
- package/dist/components/QuantityInput/QuantityInput.d.ts.map +1 -0
- package/dist/components/QuantityInput/index.d.ts +3 -0
- package/dist/components/QuantityInput/index.d.ts.map +1 -0
- package/dist/components/QuantityInput/types.d.ts +7 -0
- package/dist/components/QuantityInput/types.d.ts.map +1 -0
- package/dist/components/RebuyLink/RebuyLink.d.ts +3 -0
- package/dist/components/RebuyLink/RebuyLink.d.ts.map +1 -0
- package/dist/components/RebuyLink/index.d.ts +2 -0
- package/dist/components/RebuyLink/index.d.ts.map +1 -0
- package/dist/components/RebuyLink/types.d.ts +10 -0
- package/dist/components/RebuyLink/types.d.ts.map +1 -0
- package/dist/components/Timer/Timer.d.ts +3 -0
- package/dist/components/Timer/Timer.d.ts.map +1 -0
- package/dist/components/Timer/index.d.ts +3 -0
- package/dist/components/Timer/index.d.ts.map +1 -0
- package/dist/components/Timer/types.d.ts +20 -0
- package/dist/components/Timer/types.d.ts.map +1 -0
- package/dist/components/Title/Title.d.ts +1 -1
- package/dist/components/Title/Title.d.ts.map +1 -1
- package/dist/components/Title/types.d.ts +1 -0
- package/dist/components/Title/types.d.ts.map +1 -1
- package/dist/components/VariantSelect/VariantSelect.d.ts +1 -1
- package/dist/components/VariantSelect/VariantSelect.d.ts.map +1 -1
- package/dist/components/VariantSelect/types.d.ts +2 -0
- package/dist/components/VariantSelect/types.d.ts.map +1 -1
- package/dist/constants/api.d.ts +2 -0
- package/dist/constants/api.d.ts.map +1 -0
- package/dist/constants/debug.d.ts +28 -0
- package/dist/constants/debug.d.ts.map +1 -0
- package/dist/context/RebuyConfigContext.d.ts +23 -0
- package/dist/context/RebuyConfigContext.d.ts.map +1 -0
- package/dist/context/RebuyWidgetContext.d.ts +7 -0
- package/dist/context/RebuyWidgetContext.d.ts.map +1 -0
- package/dist/hooks/titleLevel.d.ts.map +1 -1
- package/dist/hooks/useBFCacheReset.d.ts +7 -0
- package/dist/hooks/useBFCacheReset.d.ts.map +1 -0
- package/dist/hooks/useBreakpoint.d.ts +5 -0
- package/dist/hooks/useBreakpoint.d.ts.map +1 -0
- package/dist/hooks/usePopupTrigger.d.ts +3 -0
- package/dist/hooks/usePopupTrigger.d.ts.map +1 -0
- package/dist/index.css +2680 -99
- package/dist/index.css.map +4 -4
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9756 -1461
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +9768 -1482
- package/dist/index.mjs.map +4 -4
- package/dist/providers/RebuyHydrogenContextProvider.d.ts +1 -1
- package/dist/providers/RebuyHydrogenContextProvider.d.ts.map +1 -1
- package/dist/providers/RebuyHydrogenReactContextProvider.d.ts +6 -1
- package/dist/providers/RebuyHydrogenReactContextProvider.d.ts.map +1 -1
- package/dist/providers/types.d.ts +29 -14
- package/dist/providers/types.d.ts.map +1 -1
- package/dist/queries/cart.queries.d.ts +4 -4
- package/dist/queries/cart.queries.d.ts.map +1 -1
- package/dist/smart-cart/RebuySmartCart.d.ts +10 -0
- package/dist/smart-cart/RebuySmartCart.d.ts.map +1 -0
- package/dist/smart-cart/components/AnnouncementBar/AnnouncementBar.d.ts +10 -0
- package/dist/smart-cart/components/AnnouncementBar/AnnouncementBar.d.ts.map +1 -0
- package/dist/smart-cart/components/CartItem/CartItem.d.ts +7 -0
- package/dist/smart-cart/components/CartItem/CartItem.d.ts.map +1 -0
- package/dist/smart-cart/components/CartItemList/CartItemList.d.ts +10 -0
- package/dist/smart-cart/components/CartItemList/CartItemList.d.ts.map +1 -0
- package/dist/smart-cart/components/CartNoteInput/CartNoteInput.d.ts +10 -0
- package/dist/smart-cart/components/CartNoteInput/CartNoteInput.d.ts.map +1 -0
- package/dist/smart-cart/components/CartSubtotal/CartSubtotal.d.ts +11 -0
- package/dist/smart-cart/components/CartSubtotal/CartSubtotal.d.ts.map +1 -0
- package/dist/smart-cart/components/CartTitleBar/CartTitleBar.d.ts +7 -0
- package/dist/smart-cart/components/CartTitleBar/CartTitleBar.d.ts.map +1 -0
- package/dist/smart-cart/components/CheckoutArea/CheckoutArea.d.ts +10 -0
- package/dist/smart-cart/components/CheckoutArea/CheckoutArea.d.ts.map +1 -0
- package/dist/smart-cart/components/CrossSell/CrossSell.d.ts +10 -0
- package/dist/smart-cart/components/CrossSell/CrossSell.d.ts.map +1 -0
- package/dist/smart-cart/components/CustomCode/CustomCodeBlock.d.ts +21 -0
- package/dist/smart-cart/components/CustomCode/CustomCodeBlock.d.ts.map +1 -0
- package/dist/smart-cart/components/DebugPanel/DebugPanel.d.ts +13 -0
- package/dist/smart-cart/components/DebugPanel/DebugPanel.d.ts.map +1 -0
- package/dist/smart-cart/components/DebugPanel/index.d.ts +11 -0
- package/dist/smart-cart/components/DebugPanel/index.d.ts.map +1 -0
- package/dist/smart-cart/components/DiscountCodeInput/DiscountCodeInput.d.ts +10 -0
- package/dist/smart-cart/components/DiscountCodeInput/DiscountCodeInput.d.ts.map +1 -0
- package/dist/smart-cart/components/EmptyCart/EmptyCart.d.ts +3 -0
- package/dist/smart-cart/components/EmptyCart/EmptyCart.d.ts.map +1 -0
- package/dist/smart-cart/components/LoginButton/LoginButton.d.ts +3 -0
- package/dist/smart-cart/components/LoginButton/LoginButton.d.ts.map +1 -0
- package/dist/smart-cart/components/ScreenReaderText/ScreenReaderText.d.ts +8 -0
- package/dist/smart-cart/components/ScreenReaderText/ScreenReaderText.d.ts.map +1 -0
- package/dist/smart-cart/components/SmartCartApp/SmartCartApp.d.ts +20 -0
- package/dist/smart-cart/components/SmartCartApp/SmartCartApp.d.ts.map +1 -0
- package/dist/smart-cart/components/SmartCartContainer/SmartCartContainer.d.ts +8 -0
- package/dist/smart-cart/components/SmartCartContainer/SmartCartContainer.d.ts.map +1 -0
- package/dist/smart-cart/components/TieredProgressBar/Icons.d.ts +5 -0
- package/dist/smart-cart/components/TieredProgressBar/Icons.d.ts.map +1 -0
- package/dist/smart-cart/components/TieredProgressBar/TPBGiftItem.d.ts +21 -0
- package/dist/smart-cart/components/TieredProgressBar/TPBGiftItem.d.ts.map +1 -0
- package/dist/smart-cart/components/TieredProgressBar/TieredProgressBar.d.ts +11 -0
- package/dist/smart-cart/components/TieredProgressBar/TieredProgressBar.d.ts.map +1 -0
- package/dist/smart-cart/components/TieredProgressBar/progressBarUtils.d.ts +173 -0
- package/dist/smart-cart/components/TieredProgressBar/progressBarUtils.d.ts.map +1 -0
- package/dist/smart-cart/components/TieredProgressBar/types.d.ts +261 -0
- package/dist/smart-cart/components/TieredProgressBar/types.d.ts.map +1 -0
- package/dist/smart-cart/components/_Layouts/AnchorSlot.d.ts +13 -0
- package/dist/smart-cart/components/_Layouts/AnchorSlot.d.ts.map +1 -0
- package/dist/smart-cart/components/_Layouts/DoubleColumnLayout.d.ts +9 -0
- package/dist/smart-cart/components/_Layouts/DoubleColumnLayout.d.ts.map +1 -0
- package/dist/smart-cart/components/_Layouts/SingleColumnLayout.d.ts +8 -0
- package/dist/smart-cart/components/_Layouts/SingleColumnLayout.d.ts.map +1 -0
- package/dist/smart-cart/components/componentRegistry.d.ts +3 -0
- package/dist/smart-cart/components/componentRegistry.d.ts.map +1 -0
- package/dist/smart-cart/constants.d.ts +58 -0
- package/dist/smart-cart/constants.d.ts.map +1 -0
- package/dist/smart-cart/context/SmartCartContext.d.ts +62 -0
- package/dist/smart-cart/context/SmartCartContext.d.ts.map +1 -0
- package/dist/smart-cart/context/StorefrontCartContext.d.ts +32 -0
- package/dist/smart-cart/context/StorefrontCartContext.d.ts.map +1 -0
- package/dist/smart-cart/hooks/useCartItemFeatures.d.ts +84 -0
- package/dist/smart-cart/hooks/useCartItemFeatures.d.ts.map +1 -0
- package/dist/smart-cart/hooks/useDiscountManager.d.ts +28 -0
- package/dist/smart-cart/hooks/useDiscountManager.d.ts.map +1 -0
- package/dist/smart-cart/hooks/useGeolocation.d.ts +12 -0
- package/dist/smart-cart/hooks/useGeolocation.d.ts.map +1 -0
- package/dist/smart-cart/hooks/useIsScrolled.d.ts +14 -0
- package/dist/smart-cart/hooks/useIsScrolled.d.ts.map +1 -0
- package/dist/smart-cart/hooks/useSmartCartApps.d.ts +17 -0
- package/dist/smart-cart/hooks/useSmartCartApps.d.ts.map +1 -0
- package/dist/smart-cart/store/tieredProgressBarStore.d.ts +76 -0
- package/dist/smart-cart/store/tieredProgressBarStore.d.ts.map +1 -0
- package/dist/smart-cart/types/rebuy-storefront-cart.d.ts +142 -0
- package/dist/smart-cart/types/rebuy-storefront-cart.d.ts.map +1 -0
- package/dist/smart-cart/types/rebuy.d.ts +15 -0
- package/dist/smart-cart/types/rebuy.d.ts.map +1 -0
- package/dist/smart-cart/types/shop.d.ts +26 -0
- package/dist/smart-cart/types/shop.d.ts.map +1 -0
- package/dist/smart-cart/types/smart-cart-app.d.ts +103 -0
- package/dist/smart-cart/types/smart-cart-app.d.ts.map +1 -0
- package/dist/smart-cart/types/smart-cart-component.d.ts +1350 -0
- package/dist/smart-cart/types/smart-cart-component.d.ts.map +1 -0
- package/dist/smart-cart/types/smart-cart.d.ts +82 -0
- package/dist/smart-cart/types/smart-cart.d.ts.map +1 -0
- package/dist/smart-cart/utils/cartItemUtils.d.ts +292 -0
- package/dist/smart-cart/utils/cartItemUtils.d.ts.map +1 -0
- package/dist/smart-cart/utils/debugLog.d.ts +77 -0
- package/dist/smart-cart/utils/debugLog.d.ts.map +1 -0
- package/dist/smart-cart/utils/debugStyles.d.ts +3342 -0
- package/dist/smart-cart/utils/debugStyles.d.ts.map +1 -0
- package/dist/smart-cart/utils/executeScriptsInContainer.d.ts +14 -0
- package/dist/smart-cart/utils/executeScriptsInContainer.d.ts.map +1 -0
- package/dist/smart-cart/utils/imageUtils.d.ts +2 -0
- package/dist/smart-cart/utils/imageUtils.d.ts.map +1 -0
- package/dist/smart-cart/utils/mapHydrogenCartToStorefrontCartData.d.ts +14 -0
- package/dist/smart-cart/utils/mapHydrogenCartToStorefrontCartData.d.ts.map +1 -0
- package/dist/smart-cart/utils/moneyUtils.d.ts +24 -0
- package/dist/smart-cart/utils/moneyUtils.d.ts.map +1 -0
- package/dist/smart-cart/utils/safeJsonParse.d.ts +2 -0
- package/dist/smart-cart/utils/safeJsonParse.d.ts.map +1 -0
- package/dist/types/common.d.ts +16 -0
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/rebuyCustom.d.ts +133 -17
- package/dist/types/rebuyCustom.d.ts.map +1 -1
- package/dist/types/shopify.d.ts +1 -2
- package/dist/types/shopify.d.ts.map +1 -1
- package/dist/types/widgets.d.ts +20078 -7
- package/dist/types/widgets.d.ts.map +1 -1
- package/dist/utils/convertToRebuyProduct.d.ts.map +1 -1
- package/dist/utils/createContextParameters.d.ts +1 -1
- package/dist/utils/createContextParameters.d.ts.map +1 -1
- package/dist/utils/filterContextUtils.d.ts +3 -0
- package/dist/utils/filterContextUtils.d.ts.map +1 -0
- package/dist/utils/getEncodedAttributes.d.ts.map +1 -1
- package/dist/utils/getRebuyConfig.d.ts +1 -1
- package/dist/utils/getRebuyConfig.d.ts.map +1 -1
- package/dist/utils/nonceManager.d.ts +10 -0
- package/dist/utils/nonceManager.d.ts.map +1 -0
- package/dist/utils/theme.d.ts +20 -0
- package/dist/utils/theme.d.ts.map +1 -0
- package/dist/widgetContainer/RebuyWidgetContainer.d.ts +1 -1
- package/dist/widgetContainer/RebuyWidgetContainer.d.ts.map +1 -1
- package/dist/widgets/RebuyCompleteTheLook/RebuyCompleteTheLook.d.ts.map +1 -1
- package/dist/widgets/RebuyDynamicBundleProducts/BundleImages.d.ts.map +1 -1
- package/dist/widgets/RebuyDynamicBundleProducts/BundlePrice.d.ts.map +1 -1
- package/dist/widgets/RebuyDynamicBundleProducts/BundleSelection.d.ts +1 -1
- package/dist/widgets/RebuyDynamicBundleProducts/BundleSelection.d.ts.map +1 -1
- package/dist/widgets/RebuyDynamicBundleProducts/RebuyDynamicBundleProducts.d.ts.map +1 -1
- package/dist/widgets/RebuyDynamicBundleProducts/Select.d.ts.map +1 -1
- package/dist/widgets/RebuyGiftWithPurchase/RebuyGiftWithPurchase.d.ts +11 -0
- package/dist/widgets/RebuyGiftWithPurchase/RebuyGiftWithPurchase.d.ts.map +1 -0
- package/dist/widgets/RebuyGiftWithPurchase/index.d.ts +3 -0
- package/dist/widgets/RebuyGiftWithPurchase/index.d.ts.map +1 -0
- package/dist/widgets/RebuyGiftWithPurchase/store/giftWithPurchaseStore.d.ts +31 -0
- package/dist/widgets/RebuyGiftWithPurchase/store/giftWithPurchaseStore.d.ts.map +1 -0
- package/dist/widgets/RebuyGiftWithPurchase/types.d.ts +12 -0
- package/dist/widgets/RebuyGiftWithPurchase/types.d.ts.map +1 -0
- package/dist/widgets/RebuyGiftWithPurchase/utils.d.ts +35 -0
- package/dist/widgets/RebuyGiftWithPurchase/utils.d.ts.map +1 -0
- package/dist/widgets/RebuyProductAddOns/RebuyProductAddOnCard.d.ts.map +1 -1
- package/dist/widgets/RebuyProductAddOns/RebuyProductAddOns.d.ts.map +1 -1
- package/dist/widgets/RebuyProductAddOns/types.d.ts.map +1 -1
- package/dist/widgets/RebuyProductRecommendations/RebuyProductRecommendations.d.ts.map +1 -1
- package/dist/widgets/RebuyProductViewed/RebuyProductViewed.d.ts +3 -0
- package/dist/widgets/RebuyProductViewed/RebuyProductViewed.d.ts.map +1 -0
- package/dist/widgets/RebuyProductViewed/index.d.ts +2 -0
- package/dist/widgets/RebuyProductViewed/index.d.ts.map +1 -0
- package/dist/widgets/RebuyProductViewed/types.d.ts +8 -0
- package/dist/widgets/RebuyProductViewed/types.d.ts.map +1 -0
- package/dist/widgets/RebuyRecentlyViewedProducts/RebuyRecentlyViewedProducts.d.ts +3 -0
- package/dist/widgets/RebuyRecentlyViewedProducts/RebuyRecentlyViewedProducts.d.ts.map +1 -0
- package/dist/widgets/RebuyRecentlyViewedProducts/index.d.ts +2 -0
- package/dist/widgets/RebuyRecentlyViewedProducts/index.d.ts.map +1 -0
- package/dist/widgets/RebuyRecentlyViewedProducts/types.d.ts +11 -0
- package/dist/widgets/RebuyRecentlyViewedProducts/types.d.ts.map +1 -0
- package/dist/widgets/RebuyWidget/RebuyWidget.d.ts +3 -0
- package/dist/widgets/RebuyWidget/RebuyWidget.d.ts.map +1 -0
- package/dist/widgets/RebuyWidget/WidgetContent.d.ts +3 -0
- package/dist/widgets/RebuyWidget/WidgetContent.d.ts.map +1 -0
- package/dist/widgets/RebuyWidget/index.d.ts +2 -0
- package/dist/widgets/RebuyWidget/index.d.ts.map +1 -0
- package/dist/widgets/RebuyWidget/types.d.ts +28 -0
- package/dist/widgets/RebuyWidget/types.d.ts.map +1 -0
- package/dist/zustandStores/productViewed.d.ts +9 -0
- package/dist/zustandStores/productViewed.d.ts.map +1 -0
- package/package.json +57 -41
- package/dist/types/rebuySmartCart.d.ts +0 -184
- package/dist/types/rebuySmartCart.d.ts.map +0 -1
- package/src/components/AddToCartBtn/AddToCartBtn.tsx +0 -45
- package/src/components/AddToCartBtn/HydrogenAddToCartBtn.tsx +0 -43
- package/src/components/AddToCartBtn/HydrogenReactAddToCartBtn.tsx +0 -35
- package/src/components/AddToCartBtn/index.ts +0 -1
- package/src/components/AddToCartBtn/types.ts +0 -27
- package/src/components/ProductCard/ProductCard.tsx +0 -70
- package/src/components/ProductCard/index.ts +0 -1
- package/src/components/ProductCard/types.ts +0 -10
- package/src/components/ProductPrice/ProductPrice.tsx +0 -49
- package/src/components/ProductPrice/index.ts +0 -1
- package/src/components/Title/Title.tsx +0 -19
- package/src/components/Title/index.ts +0 -1
- package/src/components/Title/types.ts +0 -7
- package/src/components/VariantSelect/VariantSelect.tsx +0 -45
- package/src/components/VariantSelect/index.ts +0 -1
- package/src/components/VariantSelect/types.ts +0 -6
- package/src/context/RebuyContext.tsx +0 -9
- package/src/hooks/titleLevel.tsx +0 -42
- package/src/index.ts +0 -7
- package/src/providers/RebuyHydrogenContextProvider.tsx +0 -112
- package/src/providers/RebuyHydrogenReactContextProvider.tsx +0 -192
- package/src/providers/types.ts +0 -58
- package/src/queries/cart.queries.ts +0 -467
- package/src/types/common.ts +0 -8
- package/src/types/css.d.ts +0 -11
- package/src/types/env.d.ts +0 -12
- package/src/types/rebuy.d.ts +0 -31
- package/src/types/rebuyCustom.ts +0 -263
- package/src/types/rebuySmartCart.ts +0 -188
- package/src/types/shopify.ts +0 -142
- package/src/types/widgets.ts +0 -29
- package/src/utils/convertToRebuyProduct.tsx +0 -319
- package/src/utils/createContextParameters.ts +0 -142
- package/src/utils/getEncodedAttributes.ts +0 -11
- package/src/utils/getRebuyConfig.ts +0 -31
- package/src/widgetContainer/RebuyWidgetContainer.tsx +0 -183
- package/src/widgets/RebuyCompleteTheLook/RebuyCompleteTheLook.tsx +0 -50
- package/src/widgets/RebuyCompleteTheLook/index.ts +0 -1
- package/src/widgets/RebuyCompleteTheLook/types.ts +0 -5
- package/src/widgets/RebuyDynamicBundleProducts/BundleImages.tsx +0 -62
- package/src/widgets/RebuyDynamicBundleProducts/BundlePrice.tsx +0 -93
- package/src/widgets/RebuyDynamicBundleProducts/BundleSelection.tsx +0 -65
- package/src/widgets/RebuyDynamicBundleProducts/RebuyDynamicBundleProducts.tsx +0 -118
- package/src/widgets/RebuyDynamicBundleProducts/Select.tsx +0 -41
- package/src/widgets/RebuyDynamicBundleProducts/index.ts +0 -1
- package/src/widgets/RebuyDynamicBundleProducts/types.ts +0 -23
- package/src/widgets/RebuyProductAddOns/RebuyProductAddOnCard.tsx +0 -66
- package/src/widgets/RebuyProductAddOns/RebuyProductAddOns.tsx +0 -218
- package/src/widgets/RebuyProductAddOns/index.ts +0 -1
- package/src/widgets/RebuyProductAddOns/types.ts +0 -24
- package/src/widgets/RebuyProductRecommendations/RebuyProductRecommendations.tsx +0 -50
- package/src/widgets/RebuyProductRecommendations/index.ts +0 -1
- package/src/widgets/RebuyProductRecommendations/types.ts +0 -5
@@ -1,45 +0,0 @@
|
|
1
|
-
import styles from './VariantSelect.module.css';
|
2
|
-
|
3
|
-
import type { VariantSelectProps } from '~/components/VariantSelect/types';
|
4
|
-
import type { RebuyProduct } from '~/types/rebuyCustom';
|
5
|
-
|
6
|
-
export const VariantSelect = ({
|
7
|
-
handleSelectedVariant,
|
8
|
-
product,
|
9
|
-
}: VariantSelectProps) => {
|
10
|
-
const getOptionsLabel = (product: RebuyProduct) => {
|
11
|
-
const options = product.variants.nodes[0].selectedOptions;
|
12
|
-
const optionsFromKeys = options ? Object.keys(options[0]) : [];
|
13
|
-
const optionsFromValues = options
|
14
|
-
? options.map((option) => option.name)
|
15
|
-
: [];
|
16
|
-
const useValues = optionsFromKeys.every((key) =>
|
17
|
-
['name', 'value'].includes(key)
|
18
|
-
);
|
19
|
-
|
20
|
-
// Return delimited label for available option(s) e.g. Color / Size, Scent, etc
|
21
|
-
return (useValues ? optionsFromValues : optionsFromKeys).join(' / ');
|
22
|
-
};
|
23
|
-
|
24
|
-
return (
|
25
|
-
product?.variants.nodes.length > 1 && (
|
26
|
-
<div>
|
27
|
-
<select
|
28
|
-
aria-label="select variant"
|
29
|
-
className={styles.select}
|
30
|
-
onChange={(e) =>
|
31
|
-
handleSelectedVariant(product, e.target.value)
|
32
|
-
}
|
33
|
-
>
|
34
|
-
<optgroup label={getOptionsLabel(product)}>
|
35
|
-
{product.variants.nodes.map(({ id, title }) => (
|
36
|
-
<option key={id + '-variant'} value={id}>
|
37
|
-
{title}
|
38
|
-
</option>
|
39
|
-
))}
|
40
|
-
</optgroup>
|
41
|
-
</select>
|
42
|
-
</div>
|
43
|
-
)
|
44
|
-
);
|
45
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
export * from './VariantSelect';
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import { createContext } from 'react';
|
2
|
-
|
3
|
-
import { type ContextParameters } from '~/types/rebuyCustom';
|
4
|
-
|
5
|
-
export type RebuyContextType = {
|
6
|
-
contextParameters: ContextParameters;
|
7
|
-
};
|
8
|
-
|
9
|
-
export const RebuyContext = createContext<RebuyContextType | null>(null);
|
package/src/hooks/titleLevel.tsx
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
import { ProductCardTitleLevel } from '~/types/common';
|
2
|
-
|
3
|
-
// Convert the string header level to enum
|
4
|
-
export const getTitleLevel = (
|
5
|
-
level: string,
|
6
|
-
decreaseLevel: boolean = false
|
7
|
-
): ProductCardTitleLevel => {
|
8
|
-
switch (level) {
|
9
|
-
case 'h1':
|
10
|
-
if (decreaseLevel) {
|
11
|
-
return ProductCardTitleLevel.H2;
|
12
|
-
}
|
13
|
-
return ProductCardTitleLevel.H1;
|
14
|
-
case 'h2':
|
15
|
-
if (decreaseLevel) {
|
16
|
-
return ProductCardTitleLevel.H3;
|
17
|
-
}
|
18
|
-
return ProductCardTitleLevel.H2;
|
19
|
-
case 'h3':
|
20
|
-
if (decreaseLevel) {
|
21
|
-
return ProductCardTitleLevel.H4;
|
22
|
-
}
|
23
|
-
return ProductCardTitleLevel.H3;
|
24
|
-
case 'h4':
|
25
|
-
if (decreaseLevel) {
|
26
|
-
return ProductCardTitleLevel.H5;
|
27
|
-
}
|
28
|
-
return ProductCardTitleLevel.H4;
|
29
|
-
case 'h5':
|
30
|
-
if (decreaseLevel) {
|
31
|
-
return ProductCardTitleLevel.H6;
|
32
|
-
}
|
33
|
-
return ProductCardTitleLevel.H5;
|
34
|
-
case 'h6':
|
35
|
-
if (decreaseLevel) {
|
36
|
-
return ProductCardTitleLevel.H6;
|
37
|
-
}
|
38
|
-
return ProductCardTitleLevel.H6;
|
39
|
-
default:
|
40
|
-
return ProductCardTitleLevel.H2;
|
41
|
-
}
|
42
|
-
};
|
package/src/index.ts
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
export * from './providers/RebuyHydrogenContextProvider';
|
2
|
-
export * from './providers/RebuyHydrogenReactContextProvider';
|
3
|
-
export * from './widgetContainer/RebuyWidgetContainer';
|
4
|
-
export * from './widgets/RebuyCompleteTheLook';
|
5
|
-
export * from './widgets/RebuyDynamicBundleProducts';
|
6
|
-
export * from './widgets/RebuyProductAddOns';
|
7
|
-
export * from './widgets/RebuyProductRecommendations';
|
@@ -1,112 +0,0 @@
|
|
1
|
-
import * as Utilities from '@rebuy/rebuy/utilities';
|
2
|
-
import { Await, useLocation } from '@remix-run/react';
|
3
|
-
import { useEffect, useMemo, useState } from 'react';
|
4
|
-
|
5
|
-
import type { CartReturn } from '@shopify/hydrogen';
|
6
|
-
import type {
|
7
|
-
RebuyHydrogenContextProviderProps,
|
8
|
-
RebuyHydrogenProps,
|
9
|
-
} from '~/providers/types';
|
10
|
-
|
11
|
-
import { RebuyContext } from '~/context/RebuyContext';
|
12
|
-
import { RebuyConfig } from '~/types/rebuyCustom';
|
13
|
-
import { createContextParameters } from '~/utils/createContextParameters';
|
14
|
-
import { getRebuyConfig } from '~/utils/getRebuyConfig';
|
15
|
-
|
16
|
-
const RebuyHydrogenContext = ({
|
17
|
-
cartAttributes,
|
18
|
-
cartCost,
|
19
|
-
cartId,
|
20
|
-
cartLines,
|
21
|
-
cartNote,
|
22
|
-
cartQuantity,
|
23
|
-
children,
|
24
|
-
}: RebuyHydrogenProps) => {
|
25
|
-
const primaryDomain = import.meta.env.PRIMARY_DOMAIN;
|
26
|
-
const rebuyKey = import.meta.env.PUBLIC_REBUY_API_KEY;
|
27
|
-
const storeDomain = import.meta.env.PUBLIC_STORE_DOMAIN;
|
28
|
-
|
29
|
-
const [rebuyConfig, setRebuyConfig] = useState<RebuyConfig | null>(null);
|
30
|
-
const location = useLocation();
|
31
|
-
const queryObject = Utilities.queryStringToObject(location.search);
|
32
|
-
const windowUrl = `${primaryDomain}${location.pathname}${location.search}`;
|
33
|
-
|
34
|
-
// Initialization
|
35
|
-
useEffect(() => {
|
36
|
-
const initConfig = async () => {
|
37
|
-
const config = await getRebuyConfig(rebuyKey, storeDomain);
|
38
|
-
setRebuyConfig(config);
|
39
|
-
};
|
40
|
-
|
41
|
-
if (!rebuyConfig?.shop) {
|
42
|
-
initConfig();
|
43
|
-
}
|
44
|
-
}, [rebuyConfig, rebuyKey, storeDomain]);
|
45
|
-
|
46
|
-
const contextParameters = useMemo(
|
47
|
-
() =>
|
48
|
-
createContextParameters({
|
49
|
-
cacheKey: rebuyConfig?.shop?.cache_key,
|
50
|
-
cartAttributes,
|
51
|
-
cartId,
|
52
|
-
cartLines,
|
53
|
-
cartLinesLength: cartLines?.length,
|
54
|
-
cartNote: cartNote as string,
|
55
|
-
cartSubtotal: cartCost,
|
56
|
-
cartTotalQuantity: cartQuantity,
|
57
|
-
isHydrogenReact: false,
|
58
|
-
queryObject,
|
59
|
-
windowUrl,
|
60
|
-
}),
|
61
|
-
[
|
62
|
-
rebuyConfig,
|
63
|
-
windowUrl,
|
64
|
-
queryObject,
|
65
|
-
cartAttributes,
|
66
|
-
cartCost,
|
67
|
-
cartId,
|
68
|
-
cartLines,
|
69
|
-
cartQuantity,
|
70
|
-
cartNote,
|
71
|
-
]
|
72
|
-
);
|
73
|
-
|
74
|
-
// Static reference (JSON) + memoization
|
75
|
-
// ^ prevent re-rendering children when context params are unchanged
|
76
|
-
const contextParametersJSON = JSON.stringify(contextParameters);
|
77
|
-
const contextValue = useMemo(
|
78
|
-
() => ({ contextParameters: JSON.parse(contextParametersJSON) }),
|
79
|
-
[contextParametersJSON]
|
80
|
-
);
|
81
|
-
|
82
|
-
return (
|
83
|
-
<RebuyContext.Provider value={contextValue}>
|
84
|
-
{children}
|
85
|
-
</RebuyContext.Provider>
|
86
|
-
);
|
87
|
-
};
|
88
|
-
|
89
|
-
export const RebuyHydrogenContextProvider = ({
|
90
|
-
cart,
|
91
|
-
children,
|
92
|
-
}: RebuyHydrogenContextProviderProps) => {
|
93
|
-
return (
|
94
|
-
<Await resolve={cart}>
|
95
|
-
{(resolvedCart) => {
|
96
|
-
const cart = resolvedCart as CartReturn;
|
97
|
-
return (
|
98
|
-
<RebuyHydrogenContext
|
99
|
-
cartAttributes={cart?.attributes}
|
100
|
-
cartCost={cart?.cost?.subtotalAmount?.amount}
|
101
|
-
cartId={cart?.id}
|
102
|
-
cartLines={cart?.lines?.nodes}
|
103
|
-
cartNote={cart?.note}
|
104
|
-
cartQuantity={cart?.totalQuantity}
|
105
|
-
>
|
106
|
-
{children}
|
107
|
-
</RebuyHydrogenContext>
|
108
|
-
);
|
109
|
-
}}
|
110
|
-
</Await>
|
111
|
-
);
|
112
|
-
};
|
@@ -1,192 +0,0 @@
|
|
1
|
-
import * as Utilities from '@rebuy/rebuy/utilities';
|
2
|
-
import { useLocation } from '@remix-run/react';
|
3
|
-
import {
|
4
|
-
CartProvider,
|
5
|
-
ShopifyProvider,
|
6
|
-
useCart,
|
7
|
-
} from '@shopify/hydrogen-react';
|
8
|
-
import { useEffect, useMemo, useState } from 'react';
|
9
|
-
|
10
|
-
import type { Attribute } from '@shopify/hydrogen-react/storefront-api-types';
|
11
|
-
import type {
|
12
|
-
RebuyHydrogenReactContextProviderProps,
|
13
|
-
RebuyHydrogenReactProps,
|
14
|
-
} from '~/providers/types';
|
15
|
-
import type { RebuyConfig } from '~/types/rebuyCustom';
|
16
|
-
|
17
|
-
import { RebuyContext } from '~/context/RebuyContext';
|
18
|
-
import { CART_FRAGMENT } from '~/queries/cart.queries';
|
19
|
-
import { createContextParameters } from '~/utils/createContextParameters';
|
20
|
-
import { getRebuyConfig } from '~/utils/getRebuyConfig';
|
21
|
-
|
22
|
-
const RebuyHydrogenReactContext = ({ children }: RebuyHydrogenReactProps) => {
|
23
|
-
const primaryDomain = import.meta.env.PRIMARY_DOMAIN;
|
24
|
-
const rebuyKey = import.meta.env.PUBLIC_REBUY_API_KEY;
|
25
|
-
const storeDomain = import.meta.env.PUBLIC_STORE_DOMAIN;
|
26
|
-
|
27
|
-
const [rebuyConfig, setRebuyConfig] = useState<RebuyConfig | null>(null);
|
28
|
-
const location = useLocation();
|
29
|
-
const queryObject = Utilities.queryStringToObject(location.search);
|
30
|
-
const windowUrl = `${primaryDomain}${location.pathname}${location.search}`;
|
31
|
-
|
32
|
-
// This is the cart object from Hydrogen-React
|
33
|
-
const cart = useCart();
|
34
|
-
|
35
|
-
// Initialization
|
36
|
-
useEffect(() => {
|
37
|
-
const initConfig = async () => {
|
38
|
-
const config = await getRebuyConfig(rebuyKey, storeDomain);
|
39
|
-
setRebuyConfig(config);
|
40
|
-
};
|
41
|
-
|
42
|
-
if (!rebuyConfig?.shop) {
|
43
|
-
initConfig();
|
44
|
-
}
|
45
|
-
}, [rebuyConfig, rebuyKey, storeDomain]);
|
46
|
-
|
47
|
-
const contextParameters = useMemo(
|
48
|
-
() =>
|
49
|
-
createContextParameters({
|
50
|
-
cacheKey: rebuyConfig?.shop?.cache_key,
|
51
|
-
cartAttributes: cart?.attributes as Attribute[],
|
52
|
-
cartId: cart?.id,
|
53
|
-
cartLines: cart?.lines,
|
54
|
-
cartLinesLength: cart?.lines?.length,
|
55
|
-
cartSubtotal: cart?.cost?.subtotalAmount?.amount,
|
56
|
-
cartTotalQuantity: cart?.totalQuantity,
|
57
|
-
isHydrogenReact: true,
|
58
|
-
queryObject,
|
59
|
-
windowUrl,
|
60
|
-
}),
|
61
|
-
[rebuyConfig, windowUrl, queryObject, cart]
|
62
|
-
);
|
63
|
-
|
64
|
-
// Static reference (JSON) + memoization
|
65
|
-
// ^ prevent re-rendering children when context params are unchanged
|
66
|
-
const contextParametersJSON = JSON.stringify(contextParameters);
|
67
|
-
const contextValue = useMemo(
|
68
|
-
() => ({ contextParameters: JSON.parse(contextParametersJSON) }),
|
69
|
-
[contextParametersJSON]
|
70
|
-
);
|
71
|
-
|
72
|
-
return (
|
73
|
-
<RebuyContext.Provider value={contextValue}>
|
74
|
-
{children}
|
75
|
-
</RebuyContext.Provider>
|
76
|
-
);
|
77
|
-
};
|
78
|
-
|
79
|
-
export const RebuyHydrogenReactContextProvider = ({
|
80
|
-
cartFragment = CART_FRAGMENT,
|
81
|
-
children,
|
82
|
-
countryIsoCode = 'US',
|
83
|
-
customerAccessToken = '',
|
84
|
-
data,
|
85
|
-
languageIsoCode = 'EN',
|
86
|
-
numCartLines,
|
87
|
-
onAttributesUpdate,
|
88
|
-
onAttributesUpdateComplete,
|
89
|
-
onBuyerIdentityUpdate,
|
90
|
-
onBuyerIdentityUpdateComplete,
|
91
|
-
onCreate,
|
92
|
-
onCreateComplete,
|
93
|
-
onDiscountCodesUpdate,
|
94
|
-
onDiscountCodesUpdateComplete,
|
95
|
-
onLineAdd,
|
96
|
-
onLineAddComplete,
|
97
|
-
onLineRemove,
|
98
|
-
onLineRemoveComplete,
|
99
|
-
onLineUpdate,
|
100
|
-
onLineUpdateComplete,
|
101
|
-
onNoteUpdate,
|
102
|
-
onNoteUpdateComplete,
|
103
|
-
storefrontApiVersion = '2025-01',
|
104
|
-
}: RebuyHydrogenReactContextProviderProps) => {
|
105
|
-
const publicStoreDomain = import.meta.env.PUBLIC_STORE_DOMAIN;
|
106
|
-
const storefrontId = import.meta.env.PUBLIC_STOREFRONT_ID;
|
107
|
-
const storefrontToken = import.meta.env.PUBLIC_STOREFRONT_API_TOKEN || '';
|
108
|
-
const adapted = {
|
109
|
-
onAttributesUpdate: onAttributesUpdate
|
110
|
-
? () => onAttributesUpdate()
|
111
|
-
: undefined,
|
112
|
-
onAttributesUpdateComplete: onAttributesUpdateComplete
|
113
|
-
? () => onAttributesUpdateComplete()
|
114
|
-
: undefined,
|
115
|
-
onBuyerIdentityUpdate: onBuyerIdentityUpdate
|
116
|
-
? () => onBuyerIdentityUpdate()
|
117
|
-
: undefined,
|
118
|
-
onBuyerIdentityUpdateComplete: onBuyerIdentityUpdateComplete
|
119
|
-
? () => onBuyerIdentityUpdateComplete()
|
120
|
-
: undefined,
|
121
|
-
onCreate: onCreate ? () => onCreate() : undefined,
|
122
|
-
onCreateComplete: onCreateComplete
|
123
|
-
? () => onCreateComplete()
|
124
|
-
: undefined,
|
125
|
-
onDiscountCodesUpdate: onDiscountCodesUpdate
|
126
|
-
? () => onDiscountCodesUpdate()
|
127
|
-
: undefined,
|
128
|
-
onDiscountCodesUpdateComplete: onDiscountCodesUpdateComplete
|
129
|
-
? () => onDiscountCodesUpdateComplete()
|
130
|
-
: undefined,
|
131
|
-
onLineAdd: onLineAdd ? () => onLineAdd() : undefined,
|
132
|
-
onLineAddComplete: onLineAddComplete
|
133
|
-
? () => onLineAddComplete()
|
134
|
-
: undefined,
|
135
|
-
onLineRemove: onLineRemove ? () => onLineRemove() : undefined,
|
136
|
-
onLineRemoveComplete: onLineRemoveComplete
|
137
|
-
? () => onLineRemoveComplete()
|
138
|
-
: undefined,
|
139
|
-
onLineUpdate: onLineUpdate ? () => onLineUpdate() : undefined,
|
140
|
-
onLineUpdateComplete: onLineUpdateComplete
|
141
|
-
? () => onLineUpdateComplete()
|
142
|
-
: undefined,
|
143
|
-
onNoteUpdate: onNoteUpdate ? () => onNoteUpdate() : undefined,
|
144
|
-
onNoteUpdateComplete: onNoteUpdateComplete
|
145
|
-
? () => onNoteUpdateComplete()
|
146
|
-
: undefined,
|
147
|
-
};
|
148
|
-
|
149
|
-
return (
|
150
|
-
<ShopifyProvider
|
151
|
-
countryIsoCode={countryIsoCode}
|
152
|
-
languageIsoCode={languageIsoCode}
|
153
|
-
storeDomain={publicStoreDomain}
|
154
|
-
storefrontApiVersion={storefrontApiVersion}
|
155
|
-
storefrontId={storefrontId}
|
156
|
-
storefrontToken={storefrontToken}
|
157
|
-
>
|
158
|
-
<CartProvider
|
159
|
-
cartFragment={cartFragment}
|
160
|
-
countryCode={countryIsoCode}
|
161
|
-
customerAccessToken={customerAccessToken}
|
162
|
-
data={data}
|
163
|
-
languageCode={languageIsoCode}
|
164
|
-
numCartLines={numCartLines}
|
165
|
-
onAttributesUpdate={adapted.onAttributesUpdate}
|
166
|
-
onAttributesUpdateComplete={adapted.onAttributesUpdateComplete}
|
167
|
-
onBuyerIdentityUpdate={adapted.onBuyerIdentityUpdate}
|
168
|
-
onBuyerIdentityUpdateComplete={
|
169
|
-
adapted.onBuyerIdentityUpdateComplete
|
170
|
-
}
|
171
|
-
onCreate={adapted.onCreate}
|
172
|
-
onCreateComplete={adapted.onCreateComplete}
|
173
|
-
onDiscountCodesUpdate={adapted.onDiscountCodesUpdate}
|
174
|
-
onDiscountCodesUpdateComplete={
|
175
|
-
adapted.onDiscountCodesUpdateComplete
|
176
|
-
}
|
177
|
-
onLineAdd={adapted.onLineAdd}
|
178
|
-
onLineAddComplete={adapted.onLineAddComplete}
|
179
|
-
onLineRemove={adapted.onLineRemove}
|
180
|
-
onLineRemoveComplete={adapted.onLineRemoveComplete}
|
181
|
-
onLineUpdate={adapted.onLineUpdate}
|
182
|
-
onLineUpdateComplete={adapted.onLineUpdateComplete}
|
183
|
-
onNoteUpdate={adapted.onNoteUpdate}
|
184
|
-
onNoteUpdateComplete={adapted.onNoteUpdateComplete}
|
185
|
-
>
|
186
|
-
<RebuyHydrogenReactContext>
|
187
|
-
{children}
|
188
|
-
</RebuyHydrogenReactContext>
|
189
|
-
</CartProvider>
|
190
|
-
</ShopifyProvider>
|
191
|
-
);
|
192
|
-
};
|
package/src/providers/types.ts
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
import { PartialDeep } from 'type-fest';
|
2
|
-
|
3
|
-
import type { CartReturn } from '@shopify/hydrogen';
|
4
|
-
import type {
|
5
|
-
Attribute,
|
6
|
-
Cart,
|
7
|
-
CartLine,
|
8
|
-
ComponentizableCartLine,
|
9
|
-
CountryCode,
|
10
|
-
LanguageCode,
|
11
|
-
Maybe,
|
12
|
-
} from '@shopify/hydrogen-react/storefront-api-types';
|
13
|
-
|
14
|
-
export type RebuyHydrogenContextProviderProps = {
|
15
|
-
cart: CartReturn;
|
16
|
-
children: React.ReactNode;
|
17
|
-
};
|
18
|
-
|
19
|
-
export type RebuyHydrogenProps = {
|
20
|
-
cartAttributes?: Attribute[];
|
21
|
-
cartCost?: string;
|
22
|
-
cartId?: string;
|
23
|
-
cartLines?: (CartLine | ComponentizableCartLine)[];
|
24
|
-
cartNote?: Maybe<string>;
|
25
|
-
cartQuantity?: number;
|
26
|
-
children: React.ReactNode;
|
27
|
-
};
|
28
|
-
|
29
|
-
export type RebuyHydrogenReactProps = {
|
30
|
-
children: React.ReactNode;
|
31
|
-
};
|
32
|
-
|
33
|
-
export type RebuyHydrogenReactContextProviderProps = {
|
34
|
-
cartFragment?: string;
|
35
|
-
children: React.ReactNode;
|
36
|
-
countryIsoCode?: CountryCode;
|
37
|
-
customerAccessToken?: string;
|
38
|
-
data?: PartialDeep<Cart, { recurseIntoArrays: true }>;
|
39
|
-
languageIsoCode?: LanguageCode;
|
40
|
-
numCartLines?: number;
|
41
|
-
onAttributesUpdate?: () => void;
|
42
|
-
onAttributesUpdateComplete?: () => void;
|
43
|
-
onBuyerIdentityUpdate?: () => void;
|
44
|
-
onBuyerIdentityUpdateComplete?: () => void;
|
45
|
-
onCreate?: () => void;
|
46
|
-
onCreateComplete?: () => void;
|
47
|
-
onDiscountCodesUpdate?: () => void;
|
48
|
-
onDiscountCodesUpdateComplete?: () => void;
|
49
|
-
onLineAdd?: () => void;
|
50
|
-
onLineAddComplete?: () => void;
|
51
|
-
onLineRemove?: () => void;
|
52
|
-
onLineRemoveComplete?: () => void;
|
53
|
-
onLineUpdate?: () => void;
|
54
|
-
onLineUpdateComplete?: () => void;
|
55
|
-
onNoteUpdate?: () => void;
|
56
|
-
onNoteUpdateComplete?: () => void;
|
57
|
-
storefrontApiVersion?: string;
|
58
|
-
};
|