@rebuy/rebuy-hydrogen 3.0.0-beta.10 → 3.0.0-beta.11
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 +196 -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.map +1 -1
- package/dist/components/AddToCartBtn/types.d.ts +1 -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 +42 -0
- package/dist/components/ProductCard/types.d.ts.map +1 -1
- package/dist/components/ProductCarousel/ProductCarousel.d.ts +16 -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/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/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 +16 -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/context/RebuyConfigContext.d.ts +21 -0
- package/dist/context/RebuyConfigContext.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/hooks/useRebuyTheme.d.ts +21 -0
- package/dist/hooks/useRebuyTheme.d.ts.map +1 -0
- package/dist/index.css +588 -31
- package/dist/index.css.map +4 -4
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1669 -425
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +1656 -413
- 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 +21 -4
- package/dist/providers/types.d.ts.map +1 -1
- package/dist/rebuy-rebuy-hydrogen-3.0.0-beta.11.tgz +0 -0
- package/dist/types/rebuyCustom.d.ts +52 -17
- package/dist/types/rebuyCustom.d.ts.map +1 -1
- package/dist/types/widgets.d.ts +5 -4
- package/dist/types/widgets.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/csp.d.ts +16 -0
- package/dist/utils/csp.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.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/BundleSelection.d.ts.map +1 -1
- package/dist/widgets/RebuyDynamicBundleProducts/Select.d.ts.map +1 -1
- 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 +335 -0
- package/dist/widgets/RebuyWidget/types.d.ts.map +1 -0
- package/package.json +3 -2
package/dist/index.mjs.map
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
|
-
"sources": ["../src/providers/RebuyHydrogenContextProvider.tsx", "../src/context/
|
4
|
-
"sourcesContent": ["import * as Utilities from '@rebuy/rebuy/utilities';\nimport { Await, useLocation } from '@remix-run/react';\nimport type { CartReturn } from '@shopify/hydrogen';\nimport { useEffect, useMemo, useState } from 'react';\nimport { RebuyContext } from '~/context/RebuyContext';\nimport type { RebuyHydrogenContextProviderProps, RebuyHydrogenProps } from '~/providers/types';\nimport { type RebuyConfig } from '~/types/rebuyCustom';\nimport { createContextParameters } from '~/utils/createContextParameters';\nimport { getRebuyConfig } from '~/utils/getRebuyConfig';\n\nconst RebuyHydrogenContext = ({\n apiKey,\n cartAttributes,\n cartCost,\n cartId,\n cartLines,\n cartNote,\n cartQuantity,\n children,\n publicStoreDomain,\n shop,\n}: RebuyHydrogenProps) => {\n const [rebuyConfig, setRebuyConfig] = useState<RebuyConfig | null>(null);\n const location = useLocation();\n const queryObject = Utilities.queryStringToObject(location.search);\n const windowUrl = `${shop}${location.pathname}${location.search}`;\n\n // Initialization\n useEffect(() => {\n const initConfig = async () => {\n const config = await getRebuyConfig(publicStoreDomain);\n setRebuyConfig(config);\n };\n\n if (!rebuyConfig?.shop) {\n initConfig();\n }\n }, [rebuyConfig]);\n\n const contextParameters = useMemo(\n () =>\n createContextParameters({\n cacheKey: rebuyConfig?.shop?.cache_key,\n cartAttributes,\n cartId,\n cartLines,\n cartLinesLength: cartLines?.length,\n cartNote: cartNote as string,\n cartSubtotal: cartCost,\n cartTotalQuantity: cartQuantity,\n isHydrogenReact: false,\n queryObject,\n windowUrl,\n }),\n [rebuyConfig, windowUrl, queryObject, cartAttributes, cartCost, cartId, cartLines, cartQuantity, cartNote]\n );\n\n // Static reference (JSON) + memoization\n // ^ prevent re-rendering children when context params are unchanged\n const contextParametersJSON = JSON.stringify(contextParameters);\n const contextValue = useMemo(\n () => ({ contextParameters: JSON.parse(contextParametersJSON) }),\n [contextParametersJSON]\n );\n\n return <RebuyContext.Provider value={contextValue}>{children}</RebuyContext.Provider>;\n};\n\nexport const RebuyHydrogenContextProvider = ({\n apiKey,\n cart,\n children,\n publicStoreDomain,\n shop,\n}: RebuyHydrogenContextProviderProps) => {\n return (\n <Await resolve={cart}>\n {(resolvedCart) => {\n const cart = resolvedCart as CartReturn;\n\n return (\n <RebuyHydrogenContext\n apiKey={apiKey}\n cartAttributes={cart?.attributes}\n cartCost={cart?.cost?.subtotalAmount?.amount}\n cartId={cart?.id}\n cartLines={cart?.lines?.nodes}\n cartNote={cart?.note}\n cartQuantity={cart?.totalQuantity}\n publicStoreDomain={publicStoreDomain}\n shop={shop}\n >\n {children}\n </RebuyHydrogenContext>\n );\n }}\n </Await>\n );\n};\n", "import { createContext } from 'react';\n\nimport { type ContextParameters } from '~/types/rebuyCustom';\n\nexport type RebuyContextType = {\n contextParameters: ContextParameters;\n};\n\nexport const RebuyContext = createContext<RebuyContextType | null>(null);\n", "import * as Utilities from '@rebuy/rebuy/utilities';\n\nimport type { Attribute } from '@shopify/hydrogen-react/storefront-api-types';\nimport type { CartContext, CartItem, ContextParameters, RebuyContextProps } from '~/types/rebuyCustom';\n\nimport { getEncodedAttributes } from '~/utils/getEncodedAttributes';\n\nexport const createContextParameters = ({\n cacheKey,\n cartAttributes,\n cartId,\n cartLines,\n cartLinesLength,\n cartNote,\n cartSubtotal,\n cartTotalQuantity,\n isHydrogenReact,\n queryObject,\n windowUrl,\n}: RebuyContextProps) => {\n const contextParameters: ContextParameters = {\n cache_key: cacheKey,\n cart_count: 0,\n cart_item_count: 0,\n cart_line_count: 0,\n cart_subtotal: 0,\n isHydrogenReact,\n time: '',\n url: windowUrl,\n };\n\n const cartContext: CartContext = {\n attributes: '',\n item_count: 0,\n items: [],\n line_count: 0,\n note: '',\n subtotal: 0,\n token: '',\n };\n\n if (Object.prototype.hasOwnProperty.call(queryObject, 'time')) {\n contextParameters.time = queryObject.time;\n }\n\n // Set Cart: token\n if (cartId) {\n cartContext.token = Utilities.getIdFromGraphUrl(cartId, 'Cart');\n contextParameters.cart_token = Utilities.getIdFromGraphUrl(cartId, 'Cart');\n }\n\n // Set Cart: subtotal\n if (cartSubtotal) {\n cartContext.subtotal = Utilities.amountToCents(parseFloat(cartSubtotal));\n contextParameters.cart_subtotal = Utilities.amountToCents(parseFloat(cartSubtotal));\n }\n\n // Set Cart: line count\n if (cartLinesLength) {\n const totalLines = cartLinesLength;\n cartContext.line_count = totalLines;\n contextParameters.cart_count = totalLines;\n contextParameters.cart_line_count = totalLines;\n }\n\n // Set Cart: item count\n if (cartTotalQuantity) {\n cartContext.item_count = cartTotalQuantity;\n contextParameters.cart_item_count = cartTotalQuantity;\n }\n\n if (cartLines) {\n cartContext.items = [];\n\n for (const cartItem of cartLines) {\n const item: CartItem = {\n attributes: [],\n product_id: '',\n properties: '',\n quantity: cartItem?.quantity,\n variant_id: '',\n };\n\n if (cartItem?.merchandise?.product?.id) {\n item.product_id = Utilities.getIdFromGraphUrl(cartItem.merchandise.product.id, 'Product');\n }\n\n if (cartItem?.merchandise?.id) {\n item.variant_id = Utilities.getIdFromGraphUrl(cartItem.merchandise.id, 'ProductVariant');\n }\n\n if (cartItem?.attributes?.length) {\n const validAttributes = cartItem.attributes.filter(\n (attr: Attribute) =>\n attr !== undefined && typeof attr.key === 'string' && typeof attr.value === 'string'\n );\n item.properties = getEncodedAttributes(validAttributes);\n }\n cartContext.items.push(item);\n }\n }\n\n // Set Cart: attributes\n if (cartAttributes) {\n const validAttributes = cartAttributes.filter(\n (attr): attr is Attribute =>\n attr !== undefined && typeof attr.key === 'string' && typeof attr.value === 'string'\n );\n cartContext.attributes = getEncodedAttributes(validAttributes);\n }\n\n // Set Cart: notes\n if (cartNote) {\n cartContext.note = cartNote;\n }\n\n // Set cart\n contextParameters.cart = cartContext;\n\n return contextParameters;\n};\n", "import type { Attribute } from '@shopify/hydrogen-react/storefront-api-types';\n\nexport const getEncodedAttributes = (attributes: Attribute[]) =>\n encodeURIComponent(\n JSON.stringify(attributes.reduce((merged, { key, value }) => ({ ...merged, [key]: value }), {}))\n );\n", "import { RebuyClient } from '@rebuy/rebuy';\nimport type { RebuyConfig, RebuyResponse } from '~/types/rebuyCustom';\n\nexport const getRebuyConfig = async (storeDomain: string): Promise<RebuyConfig> => {\n try {\n const request = {\n parameters: { shop: storeDomain },\n url: `/api/v1/user/config`,\n };\n\n const { data: rebuy, ...response } = (await new RebuyClient(undefined, undefined, storeDomain).getShieldedAsset(\n request.url,\n request.parameters\n )) as RebuyResponse;\n\n if (!rebuy?.shop) {\n throw new Error('Rebuy configuration is not properly set up - missing shop', { cause: response });\n }\n\n return rebuy;\n } catch (error: unknown) {\n const err = error as Error;\n console.warn('Error fetching Rebuy shop config');\n console.error(err, err.cause);\n throw err;\n }\n};\n", "import * as Utilities from '@rebuy/rebuy/utilities';\nimport { useLocation } from '@remix-run/react';\nimport { CartProvider, ShopifyProvider, useCart } from '@shopify/hydrogen-react';\nimport type { Attribute } from '@shopify/hydrogen-react/storefront-api-types';\nimport { useEffect, useMemo, useState } from 'react';\n\nimport { RebuyContext } from '~/context/RebuyContext';\nimport type { RebuyHydrogenReactContextProviderProps, RebuyHydrogenReactProps } from '~/providers/types';\nimport { CART_FRAGMENT } from '~/queries/cart.queries';\nimport type { RebuyConfig } from '~/types/rebuyCustom';\nimport { createContextParameters } from '~/utils/createContextParameters';\nimport { getRebuyConfig } from '~/utils/getRebuyConfig';\n\nconst PUBLIC_PRIMARY_DOMAIN = import.meta.env.PUBLIC_PRIMARY_DOMAIN;\nconst PUBLIC_REBUY_API_KEY = import.meta.env.PUBLIC_REBUY_API_KEY;\nconst PUBLIC_STORE_DOMAIN = import.meta.env.PUBLIC_STORE_DOMAIN;\nconst PUBLIC_STOREFRONT_ID = import.meta.env.PUBLIC_STOREFRONT_ID;\nconst PUBLIC_STOREFRONT_API_TOKEN = import.meta.env.PUBLIC_STOREFRONT_API_TOKEN || '';\n\nconst RebuyHydrogenReactContext = ({ children }: RebuyHydrogenReactProps) => {\n const [rebuyConfig, setRebuyConfig] = useState<RebuyConfig | null>(null);\n const location = useLocation();\n const queryObject = Utilities.queryStringToObject(location.search);\n const windowUrl = `${PUBLIC_PRIMARY_DOMAIN}${location.pathname}${location.search}`;\n\n // This is the cart object from Hydrogen-React\n const cart = useCart();\n\n // Initialization\n useEffect(() => {\n const initConfig = async () => {\n const config = await getRebuyConfig(PUBLIC_STORE_DOMAIN);\n setRebuyConfig(config);\n };\n\n if (!rebuyConfig?.shop) {\n initConfig();\n }\n }, [rebuyConfig, PUBLIC_STORE_DOMAIN]);\n\n const contextParameters = useMemo(\n () =>\n createContextParameters({\n cacheKey: rebuyConfig?.shop?.cache_key,\n cartAttributes: cart?.attributes as Attribute[],\n cartId: cart?.id,\n cartLines: cart?.lines,\n cartLinesLength: cart?.lines?.length,\n cartSubtotal: cart?.cost?.subtotalAmount?.amount,\n cartTotalQuantity: cart?.totalQuantity,\n isHydrogenReact: true,\n queryObject,\n windowUrl,\n }),\n [rebuyConfig, windowUrl, queryObject, cart]\n );\n\n // Static reference (JSON) + memoization\n // ^ prevent re-rendering children when context params are unchanged\n const contextParametersJSON = JSON.stringify(contextParameters);\n const contextValue = useMemo(\n () => ({ contextParameters: JSON.parse(contextParametersJSON) }),\n [contextParametersJSON]\n );\n\n return <RebuyContext.Provider value={contextValue}>{children}</RebuyContext.Provider>;\n};\n\nexport const RebuyHydrogenReactContextProvider = ({\n cartFragment = CART_FRAGMENT,\n children,\n countryIsoCode = 'US',\n customerAccessToken = '',\n data,\n languageIsoCode = 'EN',\n numCartLines,\n onAttributesUpdate,\n onAttributesUpdateComplete,\n onBuyerIdentityUpdate,\n onBuyerIdentityUpdateComplete,\n onCreate,\n onCreateComplete,\n onDiscountCodesUpdate,\n onDiscountCodesUpdateComplete,\n onLineAdd,\n onLineAddComplete,\n onLineRemove,\n onLineRemoveComplete,\n onLineUpdate,\n onLineUpdateComplete,\n onNoteUpdate,\n onNoteUpdateComplete,\n storefrontApiVersion = '2025-01',\n}: RebuyHydrogenReactContextProviderProps) => {\n const adapted = {\n onAttributesUpdate: onAttributesUpdate ? () => onAttributesUpdate() : undefined,\n onAttributesUpdateComplete: onAttributesUpdateComplete ? () => onAttributesUpdateComplete() : undefined,\n onBuyerIdentityUpdate: onBuyerIdentityUpdate ? () => onBuyerIdentityUpdate() : undefined,\n onBuyerIdentityUpdateComplete: onBuyerIdentityUpdateComplete\n ? () => onBuyerIdentityUpdateComplete()\n : undefined,\n onCreate: onCreate ? () => onCreate() : undefined,\n onCreateComplete: onCreateComplete ? () => onCreateComplete() : undefined,\n onDiscountCodesUpdate: onDiscountCodesUpdate ? () => onDiscountCodesUpdate() : undefined,\n onDiscountCodesUpdateComplete: onDiscountCodesUpdateComplete\n ? () => onDiscountCodesUpdateComplete()\n : undefined,\n onLineAdd: onLineAdd ? () => onLineAdd() : undefined,\n onLineAddComplete: onLineAddComplete ? () => onLineAddComplete() : undefined,\n onLineRemove: onLineRemove ? () => onLineRemove() : undefined,\n onLineRemoveComplete: onLineRemoveComplete ? () => onLineRemoveComplete() : undefined,\n onLineUpdate: onLineUpdate ? () => onLineUpdate() : undefined,\n onLineUpdateComplete: onLineUpdateComplete ? () => onLineUpdateComplete() : undefined,\n onNoteUpdate: onNoteUpdate ? () => onNoteUpdate() : undefined,\n onNoteUpdateComplete: onNoteUpdateComplete ? () => onNoteUpdateComplete() : undefined,\n };\n\n return (\n <ShopifyProvider\n countryIsoCode={countryIsoCode}\n languageIsoCode={languageIsoCode}\n storeDomain={PUBLIC_STORE_DOMAIN}\n storefrontApiVersion={storefrontApiVersion}\n storefrontId={PUBLIC_STOREFRONT_ID}\n storefrontToken={PUBLIC_STOREFRONT_API_TOKEN}\n >\n <CartProvider\n cartFragment={cartFragment}\n countryCode={countryIsoCode}\n customerAccessToken={customerAccessToken}\n data={data}\n languageCode={languageIsoCode}\n numCartLines={numCartLines}\n onAttributesUpdate={adapted.onAttributesUpdate}\n onAttributesUpdateComplete={adapted.onAttributesUpdateComplete}\n onBuyerIdentityUpdate={adapted.onBuyerIdentityUpdate}\n onBuyerIdentityUpdateComplete={adapted.onBuyerIdentityUpdateComplete}\n onCreate={adapted.onCreate}\n onCreateComplete={adapted.onCreateComplete}\n onDiscountCodesUpdate={adapted.onDiscountCodesUpdate}\n onDiscountCodesUpdateComplete={adapted.onDiscountCodesUpdateComplete}\n onLineAdd={adapted.onLineAdd}\n onLineAddComplete={adapted.onLineAddComplete}\n onLineRemove={adapted.onLineRemove}\n onLineRemoveComplete={adapted.onLineRemoveComplete}\n onLineUpdate={adapted.onLineUpdate}\n onLineUpdateComplete={adapted.onLineUpdateComplete}\n onNoteUpdate={adapted.onNoteUpdate}\n onNoteUpdateComplete={adapted.onNoteUpdateComplete}\n >\n <RebuyHydrogenReactContext>{children}</RebuyHydrogenReactContext>\n </CartProvider>\n </ShopifyProvider>\n );\n};\n", "export const OPTION_FRAGMENT = `#graphql\n fragment OptionFragment on ProductOption {\n id\n name\n optionValues {\n id\n name\n swatch {\n color\n image {\n mediaContentType\n previewImage {\n height\n id\n url\n width\n altText\n }\n id\n alt\n }\n }\n }\n }\n`;\n/*\n * STOREFRONT API QUERIES -----------------------------------------------------\n */\n\n// Docs: https://shopify.dev/docs/api/storefront/latest/objects/Cart\n\nexport const CART_LINE_FRAGMENT = `#graphql\n fragment CartLineFragment on CartLine {\n id\n quantity\n cost {\n amountPerQuantity {\n amount\n currencyCode\n }\n compareAtAmountPerQuantity {\n amount\n currencyCode\n }\n totalAmount {\n amount\n currencyCode\n }\n subtotalAmount {\n amount\n currencyCode\n }\n }\n attributes {\n key\n value\n }\n discountAllocations {\n discountedAmount {\n amount\n currencyCode\n }\n ... on CartAutomaticDiscountAllocation {\n __typename\n discountedAmount {\n amount\n currencyCode\n }\n title\n }\n ... on CartCodeDiscountAllocation {\n __typename\n code\n discountedAmount {\n amount\n currencyCode\n }\n }\n ... on CartCustomDiscountAllocation {\n __typename\n discountedAmount {\n amount\n currencyCode\n }\n title\n }\n }\n merchandise {\n ... on ProductVariant {\n availableForSale\n id\n sku\n title\n compareAtPrice {\n amount\n currencyCode\n }\n image {\n altText\n height\n id\n url\n width\n }\n price {\n amount\n currencyCode\n }\n product {\n handle\n id\n productType\n tags\n title\n vendor\n collections(first: 10) {\n nodes {\n handle\n }\n }\n options {\n ...OptionFragment\n }\n images(first: 20) {\n nodes {\n altText\n height\n id\n url\n width\n }\n }\n }\n selectedOptions {\n name\n value\n }\n }\n }\n }\n` as const;\n\nexport const CART_LINE_COMPONENT_FRAGMENT = `#graphql\n fragment CartLineComponentFragment on ComponentizableCartLine {\n id\n quantity\n cost {\n amountPerQuantity {\n amount\n currencyCode\n }\n compareAtAmountPerQuantity {\n amount\n currencyCode\n }\n totalAmount {\n amount\n currencyCode\n }\n subtotalAmount {\n amount\n currencyCode\n }\n }\n attributes {\n key\n value\n }\n discountAllocations {\n discountedAmount {\n amount\n currencyCode\n }\n ... on CartAutomaticDiscountAllocation {\n __typename\n discountedAmount {\n amount\n currencyCode\n }\n title\n }\n ... on CartCodeDiscountAllocation {\n __typename\n code\n discountedAmount {\n amount\n currencyCode\n }\n }\n ... on CartCustomDiscountAllocation {\n __typename\n discountedAmount {\n amount\n currencyCode\n }\n title\n }\n }\n merchandise {\n ... on ProductVariant {\n availableForSale\n id\n sku\n title\n compareAtPrice {\n amount\n currencyCode\n }\n image {\n altText\n height\n id\n url\n width\n }\n price {\n amount\n currencyCode\n }\n product {\n handle\n id\n productType\n tags\n title\n vendor\n collections(first: 10) {\n nodes {\n handle\n }\n }\n options {\n id\n name\n optionValues {\n id\n name\n swatch {\n color\n image {\n mediaContentType\n previewImage {\n height\n id\n url\n width\n altText\n }\n id\n alt\n }\n }\n }\n }\n images(first: 20) {\n nodes {\n altText\n height\n id\n url\n width\n }\n }\n }\n selectedOptions {\n name\n value\n }\n }\n }\n lineComponents {\n id\n quantity\n cost {\n amountPerQuantity {\n amount\n currencyCode\n }\n compareAtAmountPerQuantity {\n amount\n currencyCode\n }\n totalAmount {\n amount\n currencyCode\n }\n subtotalAmount {\n amount\n currencyCode\n }\n }\n attributes {\n key\n value\n }\n discountAllocations {\n discountedAmount {\n amount\n currencyCode\n }\n ... on CartAutomaticDiscountAllocation {\n __typename\n discountedAmount {\n amount\n currencyCode\n }\n title\n }\n ... on CartCodeDiscountAllocation {\n __typename\n code\n discountedAmount {\n amount\n currencyCode\n }\n }\n ... on CartCustomDiscountAllocation {\n __typename\n discountedAmount {\n amount\n currencyCode\n }\n title\n }\n }\n merchandise {\n ... on ProductVariant {\n availableForSale\n id\n sku\n title\n compareAtPrice {\n amount\n currencyCode\n }\n image {\n altText\n height\n id\n url\n width\n }\n price {\n amount\n currencyCode\n }\n product {\n handle\n id\n productType\n tags\n title\n vendor\n collections(first: 10) {\n nodes {\n handle\n }\n }\n options {\n ...OptionFragment\n }\n images(first: 20) {\n nodes {\n altText\n height\n id\n url\n width\n }\n }\n }\n selectedOptions {\n name\n value\n }\n }\n }\n }\n }\n` as const;\n\nexport const CART_FRAGMENT = `#graphql\n fragment CartFragment on Cart {\n id\n checkoutUrl\n createdAt\n totalQuantity\n note\n updatedAt\n __typename\n buyerIdentity {\n countryCode\n customer {\n id\n email\n firstName\n lastName\n displayName\n }\n email\n phone\n }\n attributes {\n key\n value\n }\n cost {\n subtotalAmount {\n amount\n currencyCode\n }\n totalAmount {\n amount\n currencyCode\n }\n }\n discountAllocations {\n discountedAmount {\n amount\n currencyCode\n }\n ... on CartAutomaticDiscountAllocation {\n __typename\n discountedAmount {\n amount\n currencyCode\n }\n title\n }\n ... on CartCodeDiscountAllocation {\n __typename\n code\n discountedAmount {\n amount\n currencyCode\n }\n }\n ... on CartCustomDiscountAllocation {\n __typename\n discountedAmount {\n amount\n currencyCode\n }\n title\n }\n }\n discountCodes {\n applicable\n code\n }\n lines(first: $numCartLines) {\n edges {\n node {\n ...CartLineComponentFragment\n }\n }\n edges {\n node {\n ...CartLineFragment\n }\n }\n }\n }\n ${CART_LINE_FRAGMENT}\n ${CART_LINE_COMPONENT_FRAGMENT}\n ${OPTION_FRAGMENT}\n` as const;\n", "import { RebuyClient } from '@rebuy/rebuy';\nimport * as Utilities from '@rebuy/rebuy/utilities';\nimport { flattenConnection } from '@shopify/hydrogen';\nimport React, { type ComponentType, useContext, useEffect, useMemo, useState } from 'react';\n\nimport { RebuyContext } from '~/context/RebuyContext';\nimport type { RebuyProduct, RebuyWidgetContainerProps, RebuyWidgetMetadata } from '~/types/rebuyCustom';\n\ntype RebuyWidgetContainerComponent = {\n (props: RebuyWidgetContainerProps): JSX.Element;\n} & ComponentType<RebuyWidgetContainerProps>;\n\nconst RebuyWidgetContainerBase = ({ children, ...props }: RebuyWidgetContainerProps) => {\n const { apiKey, collection, collectionId, dataSource, limit, options, product, productId, variant, variantId } =\n props;\n\n const contextParameters = useContext(RebuyContext);\n\n const [Rebuy, setRebuy] = useState<RebuyClient | null>(null);\n const [initialized, setInitialized] = useState(false);\n const shopifyProductId = product?.id ?? productId ?? null;\n const shopifyVariantId = variant?.id ?? variantId ?? null;\n const shopifyCollectionId = collection?.id ?? collectionId ?? null;\n const [products, setProducts] = useState<RebuyProduct[]>([]);\n const [metadata, setMetadata] = useState<RebuyWidgetMetadata>();\n\n // Initialize Rebuy API client\n useEffect(() => {\n if (!Rebuy) {\n const client = new RebuyClient(apiKey);\n client.setContextParameters(\n contextParameters as Record<string, unknown> // TODO: fix this type when @rebuy/rebuy is moved to typescript\n );\n\n if (options) {\n client.setDefaultParameters(options as Record<string, unknown>); // TODO: fix this type when @rebuy/rebuy is moved to typescript\n }\n\n setRebuy(client);\n setInitialized(true);\n }\n }, [apiKey, Rebuy, contextParameters, options]);\n\n useEffect(() => {\n if (!Rebuy) return;\n\n Rebuy.setContextParameters(\n contextParameters as Record<string, unknown> // TODO: fix this type when @rebuy/rebuy is moved to typescript\n );\n }, [Rebuy, contextParameters]);\n\n // Memoize request object on prop changes (e.g. product)\n const request = useMemo(() => {\n const request = {\n endpoint: dataSource || '/api/v1/products/recommended',\n params: {} as Record<string, string | number>, // Keeping this object generic to allow for custom endpoints\n };\n\n if (shopifyProductId) {\n request.params.shopify_product_ids = Utilities.getIdFromGraphUrl(shopifyProductId, 'Product');\n }\n\n if (shopifyProductId) {\n request.params.shopify_product_ids = Utilities.getIdFromGraphUrl(shopifyProductId, 'Product');\n }\n\n if (shopifyVariantId) {\n request.params.shopify_variant_ids = Utilities.getIdFromGraphUrl(shopifyVariantId, 'ProductVariant');\n }\n\n if (shopifyCollectionId) {\n request.params.shopify_collection_ids = Utilities.getIdFromGraphUrl(shopifyCollectionId, 'Collection');\n }\n\n if (limit) {\n request.params.limit = limit;\n }\n\n return request;\n }, [dataSource, shopifyProductId, shopifyVariantId, shopifyCollectionId, limit]);\n\n // Update product recommendations on cart or request change\n useEffect(() => {\n let isMounted = true;\n\n if (!Rebuy || !initialized) return;\n\n const fetchData = async () => {\n const { data, metadata } = (await Rebuy.getStorefrontData(request.endpoint, request.params)) as {\n data: RebuyProduct[];\n metadata: RebuyWidgetMetadata;\n };\n\n // Set state only if mounted\n if (isMounted) {\n setProducts(\n Array.isArray(data)\n ? data.map((product) => ({\n ...product,\n variants: {\n nodes: product.variants ? flattenConnection(product.variants) : [],\n },\n }))\n : []\n );\n setMetadata(metadata);\n }\n };\n\n fetchData();\n\n // Unmounted?\n return () => {\n isMounted = false;\n };\n }, [Rebuy, initialized, request]);\n\n const childrenWithProps = (props: RebuyWidgetContainerProps) =>\n React.Children.map(children, (child) =>\n React.isValidElement(child) ? React.cloneElement(child, props) : child\n );\n\n const childProps = {\n ...props,\n isHydrogenReact: contextParameters?.contextParameters?.isHydrogenReact,\n key: product?.id,\n metadata,\n products,\n };\n\n return childrenWithProps(childProps);\n};\n\nexport const RebuyWidgetContainer = RebuyWidgetContainerBase as RebuyWidgetContainerComponent;\n", "import { Link } from '@remix-run/react';\nimport { Image } from '@shopify/hydrogen';\nimport { useState } from 'react';\n\nimport { AddToCartBtn } from '~/components/AddToCartBtn';\nimport type { ProductCardProps } from '~/components/ProductCard/types';\n\nimport { RebuyProductPrice } from '~/components/ProductPrice/ProductPrice';\nimport { Title } from '~/components/Title';\nimport { VariantSelect } from '~/components/VariantSelect';\nimport type { RebuyProduct } from '~/types/rebuyCustom';\nimport styles from './ProductCard.module.css';\n\nexport const ProductCard = ({\n addToCartBtnText,\n addToCartCallback,\n isHydrogenReact,\n product,\n productCardTitleLevel,\n}: ProductCardProps) => {\n const [selectedVariant, setSelectedVariant] = useState(product.variants.nodes[0]);\n\n const { image } = selectedVariant;\n const handleSelectedVariant = (product: RebuyProduct, variant_id: string) => {\n const updatedVariant = product.variants.nodes.find((variant) => variant.id === variant_id);\n\n if (updatedVariant) {\n setSelectedVariant(updatedVariant);\n }\n };\n\n return (\n <div className={styles.container}>\n <div>\n <Link to={`/products/${product.handle}`}>\n <Image\n alt={image?.altText ?? `Picture of ${product.title}`}\n data={image}\n sizes=\"(max-width: 320px) 280px, (max-width: 768px) 720px, 1440px\"\n />\n </Link>\n <div className={styles.productInfo}>\n <Link to={`/products/${product.handle}`}>\n <Title level={productCardTitleLevel} text={product.title} />\n </Link>\n <RebuyProductPrice selectedVariant={selectedVariant} />\n <VariantSelect handleSelectedVariant={handleSelectedVariant} product={product} />\n </div>\n </div>\n <AddToCartBtn\n addToCartBtnText={addToCartBtnText}\n addToCartCallback={addToCartCallback}\n isHydrogenReact={isHydrogenReact}\n selectedVariants={[selectedVariant]}\n />\n </div>\n );\n};\n", "import { type FetcherWithComponents } from '@remix-run/react';\nimport { CartForm, Money } from '@shopify/hydrogen';\n\nimport type { btnProps } from '~/components/AddToCartBtn/types';\nimport styles from './AddToCartBtn.module.css';\n\nexport const HydrogenAddToCartBtn = ({\n addToCartBtnText,\n addToCartCallback,\n disabled,\n linesToAdd,\n moneyData,\n}: btnProps) => {\n return (\n <CartForm\n action={CartForm.ACTIONS.LinesAdd}\n inputs={{\n lines: linesToAdd,\n }}\n route=\"/cart\"\n >\n {(fetcher: FetcherWithComponents<unknown>) => (\n <>\n <button\n className={styles.button}\n disabled={disabled || fetcher.state !== 'idle'}\n onClick={addToCartCallback}\n type=\"submit\"\n >\n {addToCartBtnText}\n {moneyData && (\n <>\n <span> | </span>\n <Money data={moneyData} withoutTrailingZeros />\n </>\n )}\n </button>\n </>\n )}\n </CartForm>\n );\n};\n", "/* stylelint-disable selector-class-pattern */\n\n/* TODO: Update classes to BEM naming convention (rb-{block}__{element}--{modifier}) */\n\n.button {\n padding: 8px 16px;\n border-radius: 4px;\n font-size: 16px;\n color: #fff;\n background-color: #000;\n border: none;\n cursor: pointer;\n width: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n}\n\n.button:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.button:hover {\n background-color: #333;\n}\n", "import { Money, useCart } from '@shopify/hydrogen-react';\n\nimport type { btnProps } from '~/components/AddToCartBtn/types';\nimport styles from './AddToCartBtn.module.css';\n\nexport const HydrogenReactAddToCartBtn = ({\n addToCartBtnText,\n addToCartCallback,\n disabled,\n linesToAdd,\n moneyData,\n}: btnProps) => {\n const { linesAdd } = useCart();\n const handleAddToCart = () => {\n linesAdd(linesToAdd);\n addToCartCallback?.();\n };\n\n return (\n <button className={styles.button} disabled={disabled} onClick={handleAddToCart} type=\"button\">\n {addToCartBtnText}\n {moneyData && (\n <>\n <span> | </span>\n <Money data={moneyData} withoutTrailingZeros />\n </>\n )}\n </button>\n );\n};\n", "import type { AddToCartBtnProps } from '~/components/AddToCartBtn/types';\nimport { HydrogenAddToCartBtn } from './HydrogenAddToCartBtn';\nimport { HydrogenReactAddToCartBtn } from './HydrogenReactAddToCartBtn';\n\nexport const AddToCartBtn = ({\n addToCartBtnText,\n addToCartCallback,\n disabled,\n isHydrogenReact,\n moneyData,\n selectedVariants,\n}: AddToCartBtnProps) => {\n const linesToAdd = selectedVariants.map((variant) => ({\n attributes: [\n { key: '_source', value: 'Rebuy' },\n { key: '_attribution', value: 'Rebuy Product Recommendations' },\n ],\n merchandiseId: variant.id,\n quantity: 1,\n selectedVariant: variant,\n }));\n\n if (isHydrogenReact) {\n return (\n <HydrogenReactAddToCartBtn\n addToCartBtnText={addToCartBtnText}\n addToCartCallback={addToCartCallback}\n disabled={disabled}\n linesToAdd={linesToAdd}\n moneyData={moneyData}\n />\n );\n }\n\n return (\n <HydrogenAddToCartBtn\n addToCartBtnText={addToCartBtnText}\n addToCartCallback={addToCartCallback}\n disabled={disabled}\n linesToAdd={linesToAdd}\n moneyData={moneyData}\n />\n );\n};\n", "import { Money } from '@shopify/hydrogen';\n\nimport type { MoneyV2 } from '@shopify/hydrogen-react/storefront-api-types';\nimport type { RebuyProductVariant } from '~/types/rebuyCustom';\nimport styles from './ProductPrice.module.css';\n\nexport const RebuyProductPrice = ({ selectedVariant }: { selectedVariant: RebuyProductVariant }) => {\n if (!selectedVariant) return null;\n const { compareAtPriceV2: compareAtPrice, priceV2: price } = selectedVariant;\n\n const isDiscounted = (price: MoneyV2 | null, compareAtPrice: MoneyV2 | null) =>\n Number(compareAtPrice?.amount) > Number(price?.amount);\n\n const CompareAtPrice = ({ data: compareAtPrice }: { data: MoneyV2 | null }) => {\n return (\n compareAtPrice && (\n <Money as=\"span\" className={styles.compareAtPrice} data={compareAtPrice} withoutTrailingZeros />\n )\n );\n };\n\n return (\n price && (\n <div className={styles.priceContainer}>\n <Money data={price} withoutTrailingZeros />\n {compareAtPrice && isDiscounted(price, compareAtPrice) && <CompareAtPrice data={compareAtPrice} />}\n </div>\n )\n );\n};\n", "/* stylelint-disable selector-class-pattern */\n\n/* TODO: Update classes to BEM naming convention (rb-{block}__{element}--{modifier}) */\n\n.priceContainer {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n\n.compareAtPrice {\n opacity: 0.5;\n}\n", "import type { TitleProps } from '~/components/Title/types';\n\nexport const Title = ({ level, style, text }: TitleProps) => {\n switch (level) {\n case 'h1':\n return <h1 style={style}>{text}</h1>;\n default:\n case 'h2':\n return <h2 style={style}>{text}</h2>;\n case 'h3':\n return <h3 style={style}>{text}</h3>;\n case 'h4':\n return <h4 style={style}>{text}</h4>;\n case 'h5':\n return <h5 style={style}>{text}</h5>;\n case 'h6':\n return <h6 style={style}>{text}</h6>;\n }\n};\n", "/* stylelint-disable selector-class-pattern */\n\n/* TODO: Update classes to BEM naming convention (rb-{block}__{element}--{modifier}) */\n\n.select {\n width: 100%;\n padding: 8px;\n border: 1px solid #ccc;\n border-radius: 4px;\n font-size: 16px;\n color: #333;\n background-color: #fff;\n}\n", "import type { VariantSelectProps } from '~/components/VariantSelect/types';\nimport type { RebuyProduct } from '~/types/rebuyCustom';\nimport styles from './VariantSelect.module.css';\n\nexport const VariantSelect = ({ handleSelectedVariant, product }: VariantSelectProps) => {\n const getOptionsLabel = (product: RebuyProduct) => {\n const options = product.variants.nodes[0].selectedOptions;\n const optionsFromKeys = options ? Object.keys(options[0]) : [];\n const optionsFromValues = options ? options.map((option) => option.name) : [];\n const useValues = optionsFromKeys.every((key) => ['name', 'value'].includes(key));\n\n // Return delimited label for available option(s) e.g. Color / Size, Scent, etc\n return (useValues ? optionsFromValues : optionsFromKeys).join(' / ');\n };\n\n return (\n product?.variants.nodes.length > 1 && (\n <div>\n <select\n aria-label=\"select variant\"\n className={styles.select}\n onChange={(e) => handleSelectedVariant(product, e.target.value)}\n >\n <optgroup label={getOptionsLabel(product)}>\n {product.variants.nodes.map(({ id, title }) => (\n <option key={id + '-variant'} value={id}>\n {title}\n </option>\n ))}\n </optgroup>\n </select>\n </div>\n )\n );\n};\n", "/* stylelint-disable selector-class-pattern */\n\n/* TODO: Update classes to BEM naming convention (rb-{block}__{element}--{modifier}) */\n\n.container {\n display: flex;\n flex-direction: column;\n gap: 24px;\n max-width: 256px;\n height: 100%;\n justify-content: space-between;\n}\n\n.productInfo {\n display: grid;\n gap: 4px;\n align-items: start;\n}\n", "import { ProductCardTitleLevel } from '~/types/common';\n\n// Convert the string header level to enum\nexport const getTitleLevel = (level: string, decreaseLevel: boolean = false): ProductCardTitleLevel => {\n switch (level) {\n case 'h1':\n if (decreaseLevel) {\n return ProductCardTitleLevel.H2;\n }\n\n return ProductCardTitleLevel.H1;\n case 'h2':\n if (decreaseLevel) {\n return ProductCardTitleLevel.H3;\n }\n\n return ProductCardTitleLevel.H2;\n case 'h3':\n if (decreaseLevel) {\n return ProductCardTitleLevel.H4;\n }\n\n return ProductCardTitleLevel.H3;\n case 'h4':\n if (decreaseLevel) {\n return ProductCardTitleLevel.H5;\n }\n\n return ProductCardTitleLevel.H4;\n case 'h5':\n if (decreaseLevel) {\n return ProductCardTitleLevel.H6;\n }\n\n return ProductCardTitleLevel.H5;\n case 'h6':\n if (decreaseLevel) {\n return ProductCardTitleLevel.H6;\n }\n\n return ProductCardTitleLevel.H6;\n default:\n return ProductCardTitleLevel.H2;\n }\n};\n", "/* stylelint-disable */\n\n.container {\n padding: 2rem 1rem;\n margin: 1rem 0;\n background-color: #f0f4f8;\n border-radius: 1rem;\n\n @media (width >= 768px) {\n padding: 4rem;\n }\n}\n\n.productGrid {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));\n gap: 2rem;\n list-style: none;\n padding: 0;\n margin: 0;\n\n @media (width >= 768px) {\n grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));\n }\n}\n\n.productItem {\n width: 100%;\n}\n", "import { ProductCard } from '~/components/ProductCard';\nimport { Title } from '~/components/Title';\nimport { getTitleLevel } from '~/hooks/titleLevel';\nimport type { RebuyCompleteTheLookProps } from './types';\nimport styles from '~/widgets/RebuyCompleteTheLook/RebuyCompleteTheLook.module.css';\n\n// Component implementation\nexport const RebuyCompleteTheLook = (props: RebuyCompleteTheLookProps) => {\n const {\n addToCartBtnText = 'Add to cart',\n addToCartCallback,\n customTitle = `These pair with ${props.product?.title}`,\n customTitleLevel = 'h2',\n customTitleStyle,\n products = [],\n } = props;\n\n if (products.length === 0) {\n console.log('RebuyCompleteTheLook: No products found');\n\n return null;\n }\n\n return (\n <section className={styles.container}>\n <Title level={getTitleLevel(customTitleLevel)} style={customTitleStyle} text={customTitle} />\n <ul className={styles.productGrid}>\n {products.map((product) => (\n <li className={styles.productItem} key={product.id}>\n <ProductCard\n addToCartBtnText={addToCartBtnText}\n addToCartCallback={addToCartCallback}\n isHydrogenReact={props.isHydrogenReact}\n product={product}\n productCardTitleLevel={getTitleLevel(customTitleLevel, true)}\n />\n </li>\n ))}\n </ul>\n </section>\n );\n};\n", "import { useCallback, useEffect, useState } from 'react';\n\nimport { AddToCartBtn } from '~/components/AddToCartBtn';\nimport { Title } from '~/components/Title';\nimport { getTitleLevel } from '~/hooks/titleLevel';\nimport { convertToRebuyProduct } from '~/utils/convertToRebuyProduct';\nimport { BundleImages } from '~/widgets/RebuyDynamicBundleProducts/BundleImages';\nimport { BundleSelection } from '~/widgets/RebuyDynamicBundleProducts/BundleSelection';\nimport type { BundleProduct, RebuyDynamicBundleProductsProps } from '~/widgets/RebuyDynamicBundleProducts/types';\nimport { BundlePrice } from './BundlePrice';\nimport styles from './RebuyDynamicBundleProducts.module.css';\n\nexport const RebuyDynamicBundleProducts = (props: RebuyDynamicBundleProductsProps) => {\n const {\n addToCartBtnText = 'Add to cart',\n addToCartCallback,\n customTitle = `These pair with ${props.product?.title}`,\n customTitleLevel = 'h2',\n customTitleStyle,\n isHydrogenReact,\n product,\n products = [],\n } = props;\n const [bundleProducts, setBundleProducts] = useState<BundleProduct[]>([]);\n\n // Initializiation\n useEffect(() => {\n const mainProduct: BundleProduct = convertToRebuyProduct(isHydrogenReact || false, product);\n\n const formattedProducts = products.map((product) => {\n return {\n ...product,\n selected: true,\n selectedVariant: product.variants.nodes[0],\n };\n });\n\n setBundleProducts([mainProduct, ...formattedProducts]);\n }, [product, products, isHydrogenReact]);\n\n const onToggleBundleItem = useCallback(\n (product: BundleProduct) => {\n product.selected = !product.selected;\n\n setBundleProducts([...bundleProducts]);\n },\n [bundleProducts]\n );\n\n const onSelectVariant = useCallback(\n (product: BundleProduct, variant_id: string) => {\n const variant = product.variants.nodes.find(({ id }) => id === variant_id);\n\n if (variant) {\n product.selectedVariant = variant;\n product.selected = variant.availableForSale || false;\n\n setBundleProducts([...bundleProducts]);\n }\n },\n [bundleProducts]\n );\n\n if (products.length === 0) {\n console.log('RebuyDynamicBundleProducts: No products found');\n\n return null;\n }\n\n return (\n <section className={styles.container}>\n <Title level={getTitleLevel(customTitleLevel)} style={customTitleStyle} text={customTitle} />\n <div className={styles.bundleContainer}>\n <BundleImages products={bundleProducts} />\n <BundlePrice products={bundleProducts} />\n\n <div className={styles.addCartBtnContainer}>\n <AddToCartBtn\n addToCartBtnText={addToCartBtnText}\n addToCartCallback={addToCartCallback}\n disabled={bundleProducts.filter((product) => product.selected).length === 0}\n isHydrogenReact={isHydrogenReact}\n selectedVariants={bundleProducts\n .filter((product) => product.selected)\n .map((product) => {\n return product.selectedVariant;\n })}\n />\n </div>\n\n <BundleSelection\n onSelectVariant={onSelectVariant}\n onToggleBundleItem={onToggleBundleItem}\n products={bundleProducts}\n />\n </div>\n </section>\n );\n};\n", "import type { RebuyProductVariant } from '~/types/rebuyCustom';\nimport type { HydrogenProduct } from '~/types/shopify';\n\nexport const convertToRebuyProduct = (isHydrogenReact: boolean, product?: HydrogenProduct) => {\n const mainProductVariants: RebuyProductVariant[] = isHydrogenReact\n ? product?.variants?.nodes?.map((variant) => {\n return {\n ...variant,\n };\n }) || []\n : product?.adjacentVariants.map((variant) => {\n return {\n availableForSale: variant.availableForSale,\n compareAtPriceV2: {\n amount: variant.compareAtPrice?.amount || '',\n currencyCode: variant.compareAtPrice?.currencyCode || 'USD',\n },\n id: variant.id,\n image: {\n altText: variant.image?.altText || '',\n height: variant.image?.height || 100,\n id: variant.image?.id || '',\n url: variant.image?.url || '',\n width: variant.image?.width || 100,\n },\n priceV2: {\n amount: variant.price.amount || '',\n currencyCode: variant.price.currencyCode || 'USD',\n },\n product: {\n handle: product.handle,\n id: product.id,\n title: product.title,\n vendor: product.vendor,\n },\n selectedOptions: variant.selectedOptions,\n sku: variant.sku || '',\n title: variant.title || '',\n };\n }) || [];\n\n return isHydrogenReact\n ? {\n collections: {\n nodes:\n product?.collections.nodes.map((collection) => {\n return {\n handle: collection.handle,\n };\n }) || [],\n },\n compareAtPriceRange: {\n maxVariantCompareAtPrice: null,\n minVariantCompareAtPrice: null,\n },\n description: product?.description || '',\n descriptionHtml: product?.descriptionHtml || '',\n featuredImage: {\n altText: product?.featuredImage?.altText || '',\n height: product?.featuredImage?.height || 100,\n id: product?.featuredImage?.id || '',\n url: product?.featuredImage?.url || '',\n width: product?.featuredImage?.width || 100,\n },\n handle: product?.handle || '',\n id: product?.id || '',\n images: [{ altText: '', height: 100, id: '', url: '', width: 100 }],\n media: [],\n metafields: [],\n options: [],\n priceRange: product?.priceRange || {\n maxVariantPrice: { amount: '0', currencyCode: 'USD' },\n minVariantPrice: { amount: '0', currencyCode: 'USD' },\n },\n selected: true,\n selectedOptions:\n product?.selectedVariant?.selectedOptions?.reduce((acc, option) => {\n return { ...acc, [option.name]: option.value };\n }, {}) || {},\n selectedSellingPlan: {},\n selectedSellingPlanAllocation: {},\n selectedVariant: {\n availableForSale: product?.selectedVariant?.availableForSale || false,\n compareAtPriceV2: {\n amount: product?.selectedVariant?.compareAtPrice?.amount || '',\n currencyCode: product?.selectedVariant?.compareAtPrice?.currencyCode || 'USD',\n },\n id: product?.selectedVariant?.id || '',\n image: {\n altText: product?.selectedVariant?.image?.altText || '',\n height: product?.selectedVariant?.image?.height || 100,\n id: product?.selectedVariant?.image?.id || '',\n url: product?.selectedVariant?.image?.url || '',\n width: product?.selectedVariant?.image?.width || 100,\n },\n priceV2: {\n amount: product?.selectedVariant?.price.amount || '',\n currencyCode: product?.selectedVariant?.price.currencyCode || 'USD',\n },\n product: {\n handle: product?.handle || '',\n id: product?.id || '',\n title: product?.title || '',\n vendor: product?.vendor || '',\n },\n selectedOptions: product?.selectedVariant?.selectedOptions || [],\n sku: product?.selectedVariant?.sku || '',\n title: product?.selectedVariant?.title || '',\n },\n sellingPlanGroups: [],\n seo: {\n description: product?.seo?.description || '',\n title: product?.seo?.title || '',\n },\n title: product?.title || '',\n variants: {\n nodes: mainProductVariants,\n },\n vendor: product?.vendor || '',\n }\n : {\n collections: {\n nodes: [],\n },\n compareAtPriceRange: {\n maxVariantCompareAtPrice: null,\n minVariantCompareAtPrice: null,\n },\n description: product?.description || '',\n descriptionHtml: product?.descriptionHtml || '',\n featuredImage: {\n altText: product?.selectedOrFirstAvailableVariant?.image?.altText || '',\n height: product?.selectedOrFirstAvailableVariant?.image?.height || 100,\n id: product?.selectedOrFirstAvailableVariant?.image?.id || '',\n url: product?.selectedOrFirstAvailableVariant?.image?.url || '',\n width: product?.selectedOrFirstAvailableVariant?.image?.width || 100,\n },\n handle: product?.handle || '',\n id: product?.id || '',\n images: [\n {\n altText: product?.selectedOrFirstAvailableVariant?.image?.altText || '',\n height: product?.selectedOrFirstAvailableVariant?.image?.height || 100,\n id: product?.selectedOrFirstAvailableVariant?.image?.id || '',\n url: product?.selectedOrFirstAvailableVariant?.image?.url || '',\n width: product?.selectedOrFirstAvailableVariant?.image?.width || 100,\n },\n ],\n media: [],\n metafields: [],\n options: [],\n priceRange: product?.priceRange || {\n maxVariantPrice: { amount: '0', currencyCode: 'USD' },\n minVariantPrice: { amount: '0', currencyCode: 'USD' },\n },\n selected: true,\n selectedOptions:\n product?.selectedOrFirstAvailableVariant?.selectedOptions?.reduce((acc, option) => {\n return { ...acc, [option.name]: option.value };\n }, {}) || {},\n selectedSellingPlan: {},\n selectedSellingPlanAllocation: {},\n selectedVariant: {\n availableForSale: product?.selectedOrFirstAvailableVariant?.availableForSale || false,\n compareAtPriceV2: {\n amount: product?.selectedOrFirstAvailableVariant?.compareAtPrice?.amount || '',\n currencyCode: product?.selectedOrFirstAvailableVariant?.compareAtPrice?.currencyCode || 'USD',\n },\n id: product?.selectedOrFirstAvailableVariant?.id || '',\n image: {\n altText: product?.selectedOrFirstAvailableVariant?.image?.altText || '',\n height: product?.selectedOrFirstAvailableVariant?.image?.height || 100,\n id: product?.selectedOrFirstAvailableVariant?.image?.id || '',\n url: product?.selectedOrFirstAvailableVariant?.image?.url || '',\n width: product?.selectedOrFirstAvailableVariant?.image?.width || 100,\n },\n priceV2: {\n amount: product?.selectedOrFirstAvailableVariant?.price.amount || '',\n currencyCode: product?.selectedOrFirstAvailableVariant?.price.currencyCode || 'USD',\n },\n product: {\n handle: product?.handle || '',\n id: product?.id || '',\n title: product?.title || '',\n vendor: product?.vendor || '',\n },\n selectedOptions: product?.selectedOrFirstAvailableVariant?.selectedOptions || [],\n sku: product?.selectedOrFirstAvailableVariant?.sku || '',\n title: product?.selectedOrFirstAvailableVariant?.title || '',\n },\n sellingPlanGroups: [],\n seo: {\n description: null,\n title: null,\n },\n title: product?.title || '',\n variants: {\n nodes: [\n {\n availableForSale: product?.selectedOrFirstAvailableVariant?.availableForSale || false,\n compareAtPriceV2: {\n amount: product?.selectedOrFirstAvailableVariant?.compareAtPrice?.amount || '',\n currencyCode:\n product?.selectedOrFirstAvailableVariant?.compareAtPrice?.currencyCode || 'USD',\n },\n id: product?.selectedOrFirstAvailableVariant?.id || '',\n image: {\n altText: product?.selectedOrFirstAvailableVariant?.image?.altText || '',\n height: product?.selectedOrFirstAvailableVariant?.image?.height || 100,\n id: product?.selectedOrFirstAvailableVariant?.image?.id || '',\n url: product?.selectedOrFirstAvailableVariant?.image?.url || '',\n width: product?.selectedOrFirstAvailableVariant?.image?.width || 100,\n },\n priceV2: {\n amount: product?.selectedOrFirstAvailableVariant?.price.amount || '',\n currencyCode: product?.selectedOrFirstAvailableVariant?.price.currencyCode || 'USD',\n },\n product: {\n handle: product?.handle || '',\n id: product?.id || '',\n title: product?.title || '',\n vendor: product?.vendor || '',\n },\n selectedOptions: product?.selectedOrFirstAvailableVariant?.selectedOptions || [],\n sku: product?.selectedOrFirstAvailableVariant?.sku || '',\n title: product?.selectedOrFirstAvailableVariant?.title || '',\n },\n ...mainProductVariants,\n ],\n },\n vendor: product?.vendor || '',\n };\n};\n", "import { Link } from '@remix-run/react';\nimport { Image } from '@shopify/hydrogen';\nimport { Fragment } from 'react';\n\nimport type { BundleProduct } from '~/widgets/RebuyDynamicBundleProducts/types';\nimport styles from '~/widgets/RebuyDynamicBundleProducts/RebuyDynamicBundleProducts.module.css';\n\nexport const BundleImages = ({ products }: { products: BundleProduct[] }) => {\n const selected = products.filter((product) => product.selected);\n\n return (\n <ul className={styles.bundleImages}>\n {products.map((product, index) => {\n const image = product.selectedVariant?.image;\n const productImage = image ? (\n <Image\n alt={image.altText || `Picture of ${product.title}`}\n className={styles.bundleImage}\n data={image}\n height={80}\n title={product.title}\n width={80}\n />\n ) : (\n // No image defined\n product.title\n );\n // Hide delimiter for first selected item\n const showDelimiter = selected[0]?.id !== product.id;\n\n return (\n <Fragment key={product.id + '-BundleImages-' + index}>\n {product.selected && (\n <>\n {showDelimiter && (\n <li className={styles.bundleImageDelimiter}>\n <span>+</span>\n </li>\n )}\n <li className=\"flex items-center\">\n {product.default ? (\n // Already on product page\n productImage\n ) : (\n // Link to product\n <Link title={product.title} to={`/products/${product.handle}`}>\n {productImage}\n </Link>\n )}\n </li>\n </>\n )}\n </Fragment>\n );\n })}\n </ul>\n );\n};\n", "/* stylelint-disable selector-class-pattern */\n\n/* TODO: Update classes to BEM naming convention (rb-{block}__{element}--{modifier}) */\n\n/* RebuyDynamicBundleProducts.tsx */\n.container {\n padding: 32px 16px;\n background-color: #f0f4f8;\n border-radius: 16px;\n max-width: 768px;\n margin: 16px 0;\n\n @media (width >= 768px) {\n padding: 64px;\n }\n}\n\n.addCartBtnContainer {\n display: flex;\n justify-content: center;\n}\n\n.addCartBtnContainer form {\n width: 100%;\n}\n\n.bundleContainer {\n display: flex;\n flex-direction: column;\n gap: 16px;\n margin-bottom: 16px;\n}\n\n/* Select.tsx */\n.select {\n width: 100%;\n padding: 8px;\n border: 1px solid #ccc;\n border-radius: 4px;\n font-size: 16px;\n color: #333;\n background-color: #fff;\n\n @media (width >= 768px) {\n width: 60%;\n }\n}\n\n/* BundleSelection.tsx */\n.bundleItemRowContainer {\n margin-bottom: 16px;\n}\n\n.unselected {\n opacity: 0.5;\n}\n\n.bundleItemRow {\n display: flex;\n flex-direction: row;\n gap: 8px;\n align-items: start;\n}\n\n.bundleItemInput {\n flex-grow: 1;\n}\n\n.bundleItemLabel {\n display: flex;\n flex-direction: row;\n gap: 8px;\n cursor: pointer;\n margin-bottom: 8px;\n}\n\n/* BundleImages.tsx */\n.bundleImages {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n margin-bottom: 16px;\n justify-content: center;\n}\n\n.bundleImage {\n animation: fade-in 0.5s ease-in;\n}\n\n@keyframes fade-in {\n from {\n opacity: 0;\n }\n\n to {\n opacity: 1;\n }\n}\n\n.bundleImageDelimiter {\n display: flex;\n align-items: center;\n}\n\n.bundleImageDelimiter span {\n font-weight: 600;\n}\n\n.compareAtPrice {\n text-decoration: line-through;\n opacity: 0.5;\n}\n", "import type { BundleProduct, BundleSelectProps } from '~/widgets/RebuyDynamicBundleProducts/types';\nimport styles from '~/widgets/RebuyDynamicBundleProducts/RebuyDynamicBundleProducts.module.css';\n\nexport const Select = ({ onSelectVariant, product }: BundleSelectProps) => {\n const getOptionsLabel = (product: BundleProduct) => {\n const options = product.variants.nodes[0].selectedOptions;\n const optionsFromKeys = options ? Object.keys(options[0]) : [];\n const optionsFromValues = options ? options.map((option) => option.name) : [];\n const useValues = optionsFromKeys.every((key) => ['name', 'value'].includes(key));\n\n // Return delimited label for available option(s) e.g. Color / Size, Scent, etc\n return (useValues ? optionsFromValues : optionsFromKeys).join(' / ');\n };\n\n return (\n product && (\n <select\n aria-label=\"select variant\"\n className={styles.select}\n onChange={(e) => onSelectVariant(product, e.target.value)}\n value={product.selectedVariant.id}\n >\n <optgroup label={getOptionsLabel(product)}>\n {product.variants.nodes.map(({ id, title }) => (\n <option key={id + '-BundleVariant'} value={id}>\n {title}\n </option>\n ))}\n </optgroup>\n </select>\n )\n );\n};\n", "import { RebuyProductPrice } from '~/components/ProductPrice';\nimport { Select } from '~/widgets/RebuyDynamicBundleProducts/Select';\nimport type { BundleSelectionProps } from '~/widgets/RebuyDynamicBundleProducts/types';\nimport styles from '~/widgets/RebuyDynamicBundleProducts/RebuyDynamicBundleProducts.module.css';\n\nexport const BundleSelection = ({ onSelectVariant, onToggleBundleItem, products }: BundleSelectionProps) => {\n return (\n <ul>\n {products.map((product, index) => {\n const { availableForSale } = product.selectedVariant;\n const isOutOfStock = !availableForSale;\n\n return (\n <li\n className={`${styles.bundleItemRowContainer} ${!product.selected && styles.unselected}`}\n key={product.id + '-BundleSelection' + index}\n >\n <div className={styles.bundleItemRow}>\n <input\n checked={product.selected && availableForSale}\n className=\"mt-1 rounded-sm accent-black cursor-pointer\"\n disabled={isOutOfStock}\n id={`${product.id}-toggle`}\n onChange={() => onToggleBundleItem(product)}\n type=\"checkbox\"\n value={product.id}\n />\n <div className={styles.bundleItemInput}>\n <label className={styles.bundleItemLabel} htmlFor={`${product.id}-toggle`}>\n {isOutOfStock && <b>SOLD OUT</b>}\n {product.default && <b>This item:</b>}\n {product.title}\n\n <RebuyProductPrice selectedVariant={product.selectedVariant} />\n </label>\n\n {product.variants.nodes.length > 1 && (\n <Select onSelectVariant={onSelectVariant} product={product} />\n )}\n </div>\n </div>\n </li>\n );\n })}\n </ul>\n );\n};\n", "import { Money } from '@shopify/hydrogen';\n\nimport type { CurrencyCode, MoneyV2 } from '@shopify/hydrogen-react/storefront-api-types';\nimport type { BundleProduct } from '~/widgets/RebuyDynamicBundleProducts/types';\nimport styles from './RebuyDynamicBundleProducts.module.css';\n\nexport const BundlePrice = ({ products }: { products: BundleProduct[] }) => {\n const isDisabled = products.filter((product) => product.selected).length < 1;\n\n const totalBundlePrice = () => {\n let total = 0;\n let currencyCode = 'USD' as CurrencyCode;\n\n for (const product of products) {\n if (product.selected && product.selectedVariant) {\n const { priceV2: price } = product.selectedVariant;\n\n total += Number(price?.amount);\n currencyCode = (price?.currencyCode || 'USD') as CurrencyCode;\n }\n }\n\n return {\n amount: String(total),\n currencyCode,\n };\n };\n\n const totalBundleCompareAtPrice = () => {\n let compareAtTotal = 0;\n let currencyCode = 'USD' as CurrencyCode;\n\n for (const product of products) {\n if (product.selected && product.selectedVariant) {\n const { compareAtPriceV2: compareAtPrice, priceV2: price } = product.selectedVariant;\n\n currencyCode = (price?.currencyCode || 'USD') as CurrencyCode;\n compareAtTotal += Number((compareAtPrice || price)?.amount);\n }\n }\n\n return {\n amount: String(compareAtTotal),\n currencyCode,\n };\n };\n const isDiscounted = (\n price: { amount: string; currencyCode: string } | null,\n compareAtPrice: { amount: string; currencyCode: string } | null\n ) => Number(compareAtPrice?.amount) > Number(price?.amount);\n\n const price = totalBundlePrice();\n const compareAtPrice = totalBundleCompareAtPrice();\n\n const CompareAtPrice = ({ data: compareAtPrice }: { data: MoneyV2 | null }) => {\n return (\n compareAtPrice && (\n <Money as=\"span\" className={styles.compareAtPrice} data={compareAtPrice} withoutTrailingZeros />\n )\n );\n };\n\n return (\n products.length > 0 && (\n <div className=\"flex items-center flex-col\">\n {!isDisabled && (\n <p className=\"flex items-center gap-2 mb-2\">\n <span>Total Price:</span>\n <Money as=\"span\" data={price} withoutTrailingZeros />\n {isDiscounted(price, compareAtPrice) && <CompareAtPrice data={compareAtPrice} />}\n </p>\n )}\n </div>\n )\n );\n};\n", "import { Money } from '@shopify/hydrogen-react';\nimport type { CurrencyCode, MoneyV2 } from '@shopify/hydrogen-react/storefront-api-types';\nimport { useCallback, useEffect, useState } from 'react';\n\nimport { AddToCartBtn } from '~/components/AddToCartBtn';\nimport { Title } from '~/components/Title';\nimport { getTitleLevel } from '~/hooks/titleLevel';\nimport type { RebuyProduct } from '~/types/rebuyCustom';\nimport { convertToRebuyProduct } from '~/utils/convertToRebuyProduct';\nimport type { RebuyProductAddOnProps } from '~/widgets/RebuyProductAddOns/types';\nimport { RebuyProductAddOnCard } from './RebuyProductAddOnCard';\nimport styles from './RebuyProductAddOns.module.css';\n\nexport const RebuyProductAddOns = (props: RebuyProductAddOnProps) => {\n const {\n addToCartCallback,\n customTitle = `These pair with ${props.product?.title}`,\n customTitleLevel = 'h2',\n customTitleStyle,\n includeMainProduct = false,\n isHydrogenReact,\n learnMoreText = 'Learn more',\n outOfStockText = 'Out of stock',\n product,\n products = [],\n addToCartBtnText = 'Add to cart',\n subtotalText = 'Add-ons Subtotal: ',\n withProductText = `With ${product?.title}: `,\n } = props;\n\n const [addedItems, setAddedItems] = useState<RebuyProduct[]>(products);\n\n const [subtotalWithProduct, setSubtotalWithProduct] = useState<MoneyV2>();\n const [subtotalWithOutProduct, setSubtotalWithOutProduct] = useState<MoneyV2>();\n\n useEffect(() => {\n let initialTotal = 0;\n let currencyCode = 'USD' as CurrencyCode;\n\n products.map((product) => {\n product.selectedVariant = product.variants.nodes[0];\n product.selected = true;\n\n if (product.selectedVariant?.priceV2) {\n initialTotal += Number(product.selectedVariant.priceV2.amount);\n currencyCode = (product.selectedVariant.priceV2.currencyCode || 'USD') as CurrencyCode;\n }\n });\n\n setSubtotalWithProduct({\n amount: String(initialTotal),\n currencyCode,\n });\n\n setSubtotalWithOutProduct({\n amount: String(\n initialTotal -\n Number(\n isHydrogenReact\n ? product?.selectedVariant?.price.amount\n : product?.selectedOrFirstAvailableVariant?.price.amount\n )\n ),\n currencyCode,\n });\n setAddedItems(products);\n\n if (includeMainProduct) {\n setAddedItems([convertToRebuyProduct(isHydrogenReact || false, product), ...products]);\n } else {\n setAddedItems(products);\n }\n }, [products, product, isHydrogenReact, includeMainProduct]);\n\n const handleChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>, product: RebuyProduct) => {\n const newProducts = [...products];\n const productIndex = newProducts.findIndex((p) => p.id === product.id);\n\n if (productIndex !== -1) {\n newProducts[productIndex] = {\n ...newProducts[productIndex],\n selected: event.target.checked,\n };\n\n product.selected = event.target.checked;\n\n if (event.target.checked) {\n setAddedItems((prev) => [...prev, product]);\n } else {\n setAddedItems((prev) => prev.filter((item) => item.id !== product.id));\n }\n }\n },\n [products]\n );\n\n useEffect(() => {\n let total = 0;\n let currencyCode = 'USD' as CurrencyCode;\n\n addedItems.forEach((item) => {\n if (item.selected && item.selectedVariant?.priceV2) {\n total += Number(item.selectedVariant.priceV2.amount);\n currencyCode = (item.selectedVariant.priceV2.currencyCode || 'USD') as CurrencyCode;\n }\n });\n\n setSubtotalWithProduct({\n amount: String(total),\n currencyCode,\n });\n\n setSubtotalWithOutProduct({\n amount: String(\n total -\n Number(\n isHydrogenReact\n ? product?.selectedVariant?.price.amount\n : product?.selectedOrFirstAvailableVariant?.price.amount\n )\n ),\n currencyCode,\n });\n }, [addedItems, product, isHydrogenReact]);\n\n if (products.length === 0) {\n console.log('RebuyProductAddOns: No products found');\n\n return null;\n }\n\n return (\n <div className={styles.container}>\n <Title level={getTitleLevel(customTitleLevel)} style={customTitleStyle} text={customTitle} />\n <ul className={styles.productAddOnsList}>\n {products.map((product) => (\n <li key={product.id}>\n <RebuyProductAddOnCard\n handleChange={handleChange}\n learnMoreText={learnMoreText}\n outOfStockText={outOfStockText}\n product={product}\n titleLevel={getTitleLevel(customTitleLevel, true)}\n />\n </li>\n ))}\n </ul>\n <div className={styles.productAddOnsFooter}>\n <div className={styles.moneyContainer}>\n {subtotalText}\n {subtotalWithOutProduct && <Money data={subtotalWithOutProduct} withoutTrailingZeros />}\n </div>\n {includeMainProduct && (\n <div className={styles.moneyContainer}>\n {withProductText}\n {subtotalWithProduct && <Money data={subtotalWithProduct} withoutTrailingZeros />}\n </div>\n )}\n <div className={styles.addCartBtnContainer}>\n {includeMainProduct ? (\n <AddToCartBtn\n addToCartBtnText={addToCartBtnText}\n addToCartCallback={addToCartCallback}\n disabled={addedItems.length === 0}\n isHydrogenReact={isHydrogenReact}\n moneyData={subtotalWithProduct}\n selectedVariants={addedItems.map((item) => item.selectedVariant)}\n />\n ) : (\n <AddToCartBtn\n addToCartBtnText={addToCartBtnText}\n addToCartCallback={addToCartCallback}\n disabled={addedItems.length === 0}\n isHydrogenReact={isHydrogenReact}\n moneyData={subtotalWithOutProduct}\n selectedVariants={addedItems.map((item) => item.selectedVariant)}\n />\n )}\n </div>\n </div>\n </div>\n );\n};\n", "import { Link } from '@remix-run/react';\nimport { Image } from '@shopify/hydrogen';\n\nimport { RebuyProductPrice } from '~/components/ProductPrice';\nimport { Title } from '~/components/Title';\nimport type { RebuyProductAddOnCardProps } from './types';\nimport styles from './RebuyProductAddOns.module.css';\n\nexport const RebuyProductAddOnCard = ({\n handleChange,\n learnMoreText,\n outOfStockText,\n product,\n titleLevel,\n}: RebuyProductAddOnCardProps) => {\n const { availableForSale, image } = product.selectedVariant || {};\n\n return (\n <label className={styles.addOnCard} htmlFor={product.id}>\n <div className={styles.addOnCardContent}>\n <input\n checked={Boolean(product.selected)}\n className={styles.addOnCardInput}\n disabled={!product.variants.nodes[0].availableForSale}\n id={product.id}\n name={product.title}\n onChange={(event) => handleChange(event, product)}\n type=\"checkbox\"\n value=\"\"\n />\n <div className={styles.addOnCardContentImage}>\n {image && (\n <Image\n alt={image.altText || `Picture of ${product.title}`}\n data={image}\n height={150}\n width={300}\n />\n )}\n </div>\n\n <div className={styles.addOnCardTextContent}>\n {!availableForSale && <p className={styles.addOnCardOutOfStock}>{outOfStockText}</p>}\n\n <Title level={titleLevel} text={product.title} />\n\n <RebuyProductPrice selectedVariant={product.selectedVariant} />\n <Link className={styles.addOnCardLearnMore} to={`/products/${product.handle}`}>\n {learnMoreText}\n </Link>\n </div>\n </div>\n </label>\n );\n};\n", "/* stylelint-disable selector-class-pattern */\n\n/* TODO: Update classes to BEM naming convention (rb-{block}__{element}--{modifier}) */\n.container {\n display: flex;\n flex-direction: column;\n gap: 10px;\n margin: 16px 0;\n background-color: #f0f4f8;\n border-radius: 16px;\n padding: 32px 16px;\n\n @media (width >= 768px) {\n padding: 64px;\n }\n}\n\n.productAddOnsList {\n display: grid;\n grid-template-columns: repeat(1, minmax(0, 1fr));\n gap: 8px;\n\n @media (width >= 768px) {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n }\n\n @media (width >= 1024px) {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n }\n}\n\n.addOnCard {\n cursor: pointer;\n\n &:hover {\n opacity: 0.8;\n }\n}\n\n.addOnCardContent {\n display: flex;\n gap: 8px;\n flex-direction: column;\n position: relative;\n padding: 16px;\n border-radius: 8px;\n border: 2px solid #e2e5ea;\n background-color: #fff;\n}\n\n.addOnCardInput {\n position: absolute;\n top: 10px;\n right: 10px;\n z-index: 1;\n appearance: none;\n border-radius: 50%;\n width: 24px;\n height: 24px;\n background-color: #f0f0f0;\n border: 1px solid #ddd;\n cursor: pointer;\n transition: all 0.2s ease-in-out;\n}\n\n.addOnCardInput:checked {\n background-color: #4a7dff;\n border-color: #4a7dff;\n}\n\n.addOnCardInput:checked::after {\n content: \"\";\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%) rotate(45deg);\n width: 5px;\n height: 10px;\n border: solid white;\n border-width: 0 2px 2px 0;\n margin-top: -1px;\n}\n\n.addOnCardContentImage {\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n margin: 0 auto;\n position: relative;\n}\n\n.addOnCardOutOfStock {\n border-radius: 4px;\n background-color: #e2e5ea;\n font-size: 12px;\n}\n\n.addOnCardTextContent {\n display: flex;\n flex-direction: column;\n}\n\n.addOnCardLearnMore {\n text-decoration: underline;\n color: gray;\n font-size: 14px;\n}\n\n.addCartBtnContainer {\n display: flex;\n justify-content: center;\n padding-top: 16px;\n}\n\n.addCartBtnContainer form {\n width: 100%;\n}\n\n.moneyContainer {\n display: flex;\n align-items: center;\n gap: 8px;\n justify-content: center;\n}\n", "/* stylelint-disable selector-class-pattern */\n\n/* TODO: Update classes to BEM naming convention (rb-{block}__{element}--{modifier}) */\n.container {\n padding: 32px 16px;\n background-color: #f0f4f8;\n border-radius: 16px;\n margin: 16px 0;\n\n @media (width >= 768px) {\n padding: 64px;\n }\n}\n\n.productGrid {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));\n gap: 32px;\n list-style: none;\n}\n", "import { ProductCard } from '~/components/ProductCard';\nimport { Title } from '~/components/Title';\nimport { getTitleLevel } from '~/hooks/titleLevel';\nimport type { RebuyProductRecommendationsProps } from './types';\nimport styles from './RebuyProductRecommendations.module.css';\n\nexport const RebuyProductRecommendations = (props: RebuyProductRecommendationsProps) => {\n const {\n addToCartBtnText = 'Add to cart',\n addToCartCallback,\n customTitle = `These pair with ${props.product?.title}`,\n customTitleLevel = 'h2',\n customTitleStyle,\n products = [],\n } = props;\n\n if (products.length === 0) {\n console.log('RebuyProductRecommendations: No products found');\n\n return null;\n }\n\n return (\n <section className={styles.container}>\n <Title level={getTitleLevel(customTitleLevel)} style={customTitleStyle} text={customTitle} />\n <ul className={styles.productGrid}>\n {products.map((product) => (\n <li className={styles.productItem} key={product.id}>\n <ProductCard\n addToCartBtnText={addToCartBtnText}\n addToCartCallback={addToCartCallback}\n isHydrogenReact={props.isHydrogenReact}\n product={product}\n productCardTitleLevel={getTitleLevel(customTitleLevel, true)}\n />\n </li>\n ))}\n </ul>\n </section>\n );\n};\n"],
|
5
|
-
"mappings": ";AAAA,YAAYA,gBAAe;AAC3B,SAAS,OAAO,mBAAmB;AAEnC,SAAS,WAAW,SAAS,gBAAgB;;;ACH7C,SAAS,qBAAqB;AAQvB,IAAM,eAAe,cAAuC,IAAI;;;ACRvE,YAAY,eAAe;;;ACEpB,IAAM,uBAAuB,CAAC,eACjC;AAAA,EACI,KAAK,UAAU,WAAW,OAAO,CAAC,QAAQ,EAAE,KAAK,MAAM,OAAO,EAAE,GAAG,QAAQ,CAAC,GAAG,GAAG,MAAM,IAAI,CAAC,CAAC,CAAC;AACnG;;;ADEG,IAAM,0BAA0B,CAAC;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ,MAAyB;AACrB,QAAM,oBAAuC;AAAA,IACzC,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,iBAAiB;AAAA,IACjB,iBAAiB;AAAA,IACjB,eAAe;AAAA,IACf;AAAA,IACA,MAAM;AAAA,IACN,KAAK;AAAA,EACT;AAEA,QAAM,cAA2B;AAAA,IAC7B,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,OAAO,CAAC;AAAA,IACR,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,UAAU;AAAA,IACV,OAAO;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G,WAAW,oCAAO,aACjB,mBAAS,IAAI,CAAC,YACX,gBAAAA,MAAC,QAAG,WAAW,oCAAO,aAClB,0BAAAA;AAAA,MAAC;AAAA;AAAA,QACG;AAAA,QACA;AAAA,QACA,iBAAiB,MAAM;AAAA,QACvB;AAAA,QACA,uBAAuB,cAAc,kBAAkB,IAAI;AAAA;AAAA,IAC/D,KAPoC,QAAQ,EAQhD,CACH,GACL;AAAA,KACJ;AAER;",
|
6
|
-
"names": ["Utilities", "
|
3
|
+
"sources": ["../src/providers/RebuyHydrogenContextProvider.tsx", "../src/context/RebuyConfigContext.tsx", "../src/utils/getRebuyConfig.ts", "../src/context/RebuyContext.tsx", "../src/utils/createContextParameters.ts", "../src/utils/getEncodedAttributes.ts", "../src/providers/RebuyHydrogenReactContextProvider.tsx", "../src/queries/cart.queries.ts", "../src/widgetContainer/RebuyWidgetContainer.tsx", "../src/components/ProductCard/defaultSettings.ts", "../src/components/ProductCard/ProductCard.tsx", "../src/components/AddToCartBtn/HydrogenAddToCartBtn.tsx", "../src/components/AddToCartBtn/AddToCartBtn.module.css", "../src/components/AddToCartBtn/HydrogenReactAddToCartBtn.tsx", "../src/components/AddToCartBtn/AddToCartBtn.tsx", "../src/components/ProductPrice/ProductPrice.tsx", "../src/components/ProductPrice/ProductPrice.module.css", "../src/components/QuantityInput/QuantityInput.tsx", "../src/components/QuantityInput/QuantityInput.module.css", "../src/components/Title/Title.tsx", "../src/components/Title/Title.module.css", "../src/components/VariantSelect/VariantSelect.tsx", "../src/components/VariantSelect/VariantSelect.module.css", "../src/components/ProductCard/ProductCard.module.css", "../src/hooks/titleLevel.tsx", "../src/widgets/RebuyCompleteTheLook/RebuyCompleteTheLook.module.css", "../src/widgets/RebuyCompleteTheLook/RebuyCompleteTheLook.tsx", "../src/widgets/RebuyDynamicBundleProducts/RebuyDynamicBundleProducts.tsx", "../src/utils/convertToRebuyProduct.tsx", "../src/widgets/RebuyDynamicBundleProducts/BundleImages.tsx", "../src/widgets/RebuyDynamicBundleProducts/RebuyDynamicBundleProducts.module.css", "../src/widgets/RebuyDynamicBundleProducts/Select.tsx", "../src/widgets/RebuyDynamicBundleProducts/BundleSelection.tsx", "../src/widgets/RebuyDynamicBundleProducts/BundlePrice.tsx", "../src/widgets/RebuyProductAddOns/RebuyProductAddOns.tsx", "../src/widgets/RebuyProductAddOns/RebuyProductAddOnCard.tsx", "../src/widgets/RebuyProductAddOns/RebuyProductAddOns.module.css", "../src/widgets/RebuyProductRecommendations/RebuyProductRecommendations.module.css", "../src/widgets/RebuyProductRecommendations/RebuyProductRecommendations.tsx", "../src/widgets/RebuyWidget/RebuyWidget.tsx", "../src/assets/Close.tsx", "../src/hooks/useBreakpoint.ts", "../src/hooks/usePopupTrigger.tsx", "../src/components/ProductCarousel/ProductCarousel.tsx", "../src/components/ProductCarousel/ProductCarousel.module.css", "../src/components/Timer/Timer.tsx", "../src/components/Timer/Timer.module.css", "../src/widgets/RebuyWidget/RebuyWidget.module.css", "../src/widgets/RebuyWidget/WidgetContent.tsx", "../src/hooks/useRebuyTheme.ts", "../src/constants/api.ts", "../src/utils/csp.ts", "../src/utils/theme.ts"],
|
4
|
+
"sourcesContent": ["import * as Utilities from '@rebuy/rebuy/utilities';\nimport { Await, useLocation } from '@remix-run/react';\nimport type { Cart as HydrogenStorefrontApiCart } from '@shopify/hydrogen/storefront-api-types';\nimport { useMemo } from 'react';\nimport { RebuyConfigProvider, useRebuyConfig } from '~/context/RebuyConfigContext';\nimport { RebuyContext, type RebuyContextType } from '~/context/RebuyContext';\nimport type { RebuyHydrogenContextProps, RebuyHydrogenContextProviderProps } from '~/providers/types';\nimport { createContextParameters } from '~/utils/createContextParameters';\n\nconst RebuyHydrogenContext = ({ children, shop, sourceHydrogenCart }: RebuyHydrogenContextProps) => {\n const {\n fetchError: configFetchError,\n loadingStatus: configLoadingStatus,\n rebuyConfig,\n shopDomain: configShopDomain,\n } = useRebuyConfig();\n\n const location = useLocation();\n const queryObject = Utilities.queryStringToObject(location.search);\n const windowUrl = `${shop}${location.pathname}${location.search}`;\n\n // --- Context Parameters Memoization ---\n const contextParameters = useMemo(\n () =>\n createContextParameters({\n cacheKey: rebuyConfig?.shop?.cache_key,\n isHydrogenReact: false,\n queryObject,\n sourceHydrogenCart,\n windowUrl,\n }),\n [rebuyConfig?.shop?.cache_key, windowUrl, queryObject, sourceHydrogenCart]\n );\n\n const defaultContextValue = useMemo(() => null as unknown as RebuyContextType, []);\n const contextValue = useMemo(\n () => (configLoadingStatus === 'success' && rebuyConfig ? { contextParameters } : defaultContextValue),\n [configLoadingStatus, rebuyConfig, contextParameters, defaultContextValue]\n );\n\n return (\n <RebuyContext.Provider value={contextValue}>\n {configLoadingStatus === 'success' && rebuyConfig ? (\n children\n ) : configLoadingStatus === 'error' ? (\n <>\n {(() => {\n console.error(\n `[Rebuy Provider] Failed to load Rebuy configuration for ${configShopDomain}. Rebuy features unavailable. Error:`,\n configFetchError instanceof Error ? configFetchError.message : configFetchError\n );\n\n return null;\n })()}\n {children}\n </>\n ) : null}\n </RebuyContext.Provider>\n );\n};\n\n// --- Outer Provider (RebuyHydrogenContextProvider) ---\nexport const RebuyHydrogenContextProvider = ({\n cart,\n children,\n overrideApiKey,\n publicStoreDomain,\n shop,\n}: RebuyHydrogenContextProviderProps) => {\n if (!publicStoreDomain || !shop) {\n console.warn('[Rebuy Provider Wrapper] Waiting for \"publicStoreDomain\" and \"shop\" props.');\n\n return <>{children}</>;\n }\n\n return (\n <Await resolve={cart}>\n {(resolvedCart) => {\n const hydrogenCartFromRemix = resolvedCart as HydrogenStorefrontApiCart | null;\n\n return (\n <RebuyConfigProvider initialShopDomain={publicStoreDomain} overrideApiKey={overrideApiKey}>\n <RebuyHydrogenContext shop={shop} sourceHydrogenCart={hydrogenCartFromRemix}>\n {children}\n </RebuyHydrogenContext>\n </RebuyConfigProvider>\n );\n }}\n </Await>\n );\n};\n", "import { createContext, useContext, useEffect, useMemo, useRef, useState, type ReactNode } from 'react';\nimport type { RebuyConfig } from '~/types/rebuyCustom';\nimport { getRebuyConfig } from '~/utils/getRebuyConfig';\n\nexport type RebuyConfigLoadingStatus = 'idle' | 'loading' | 'success' | 'error';\n\nexport type RebuyConfigContextType = {\n apiKey: string | null;\n fetchError: Error | string | null;\n fetchRebuyConfig: (domain: string) => Promise<void>;\n loadingStatus: RebuyConfigLoadingStatus;\n rebuyConfig: RebuyConfig | null;\n shopDomain: string | null;\n};\n\nconst RebuyConfigContext = createContext<RebuyConfigContextType | undefined>(undefined);\n\nexport type RebuyConfigProviderProps = {\n children: ReactNode;\n /** The Shopify store domain (e.g., example-brand.myshopify.com) used to fetch the config. */\n initialShopDomain?: string;\n /** Optional API key to override environment variable or config-derived one. */\n overrideApiKey?: string;\n};\n\nexport const RebuyConfigProvider = ({ children, initialShopDomain, overrideApiKey }: RebuyConfigProviderProps) => {\n const [rebuyConfig, setRebuyConfig] = useState<RebuyConfig | null>(null);\n const [apiKey, setApiKey] = useState<string | null>(overrideApiKey || null);\n const [loadingStatus, setLoadingStatus] = useState<RebuyConfigLoadingStatus>('idle');\n const [fetchError, setFetchError] = useState<Error | string | null>(null);\n const [currentShopDomain, setCurrentShopDomain] = useState<string | null>(initialShopDomain || null);\n const isMounted = useRef(true);\n\n const fetchRebuyConfig = async (domainToFetch: string) => {\n if (!domainToFetch) {\n console.warn('[RebuyConfigProvider] No shop domain provided to fetchRebuyConfig.');\n setLoadingStatus('error');\n setFetchError('Shop domain is required to fetch Rebuy config.');\n\n return;\n }\n\n setCurrentShopDomain(domainToFetch);\n setLoadingStatus('loading');\n setFetchError(null);\n\n try {\n const config = await getRebuyConfig(domainToFetch);\n\n if (isMounted.current) {\n setRebuyConfig(config);\n // Prioritize overrideApiKey, then env var, then config's api_key\n setApiKey(overrideApiKey || config?.shop?.api_key || null);\n setLoadingStatus('success');\n }\n } catch (error: unknown) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n console.error('[RebuyConfigProvider] Error fetching Rebuy config:', errorMessage, error);\n\n if (isMounted.current) {\n setFetchError(error instanceof Error ? error : errorMessage);\n setLoadingStatus('error');\n setRebuyConfig(null); // Clear previous config on error\n // Do not clear apiKey if it was from override or env, it might still be valid for some uses\n // If apiKey was solely from a previous config, it might be stale.\n // Consider if apiKey should be reset here if not from override/env.\n // For now, let's keep it simple: only update from new config if successful.\n }\n }\n };\n\n useEffect(() => {\n isMounted.current = true;\n\n if (initialShopDomain && loadingStatus === 'idle') {\n // Fetch on mount if domain provided and not already fetching/fetched\n fetchRebuyConfig(initialShopDomain);\n }\n\n return () => {\n isMounted.current = false;\n };\n // Rerun if initialShopDomain changes and we haven't started fetching yet.\n }, [initialShopDomain]);\n\n const contextValue = useMemo(\n () => ({\n apiKey,\n fetchError,\n fetchRebuyConfig,\n loadingStatus,\n rebuyConfig,\n shopDomain: currentShopDomain,\n }),\n [rebuyConfig, apiKey, loadingStatus, fetchError, currentShopDomain]\n );\n\n return <RebuyConfigContext.Provider value={contextValue}>{children}</RebuyConfigContext.Provider>;\n};\n\nexport const useRebuyConfig = (): RebuyConfigContextType => {\n const context = useContext(RebuyConfigContext);\n\n if (context === undefined) {\n throw new Error('useRebuyConfig must be used within a RebuyConfigProvider');\n }\n\n return context;\n};\n", "import { RebuyClient } from '@rebuy/rebuy';\nimport type { RebuyConfig, RebuyResponse } from '~/types/rebuyCustom';\n\nexport const getRebuyConfig = async (storeDomain: string): Promise<RebuyConfig> => {\n try {\n const request = {\n parameters: { shop: storeDomain },\n url: `/api/v1/user/config`,\n };\n\n const { data: rebuy, ...response } = (await new RebuyClient(undefined, undefined, storeDomain).getShieldedAsset(\n request.url,\n request.parameters\n )) as RebuyResponse;\n\n if (!rebuy?.shop) {\n throw new Error('Rebuy configuration is not properly set up - missing shop', { cause: response });\n }\n\n return rebuy;\n } catch (error: unknown) {\n const err = error as Error;\n console.warn('Error fetching Rebuy shop config');\n console.error(err, err.cause);\n throw err;\n }\n};\n", "import { createContext } from 'react';\n\nimport { type ContextParameters } from '~/types/rebuyCustom';\n\nexport type RebuyContextType = {\n contextParameters: ContextParameters;\n};\n\nexport const RebuyContext = createContext<RebuyContextType | null>(null);\n", "import * as Utilities from '@rebuy/rebuy/utilities';\nimport type {\n Attribute,\n BaseCartLineConnection,\n CartAutomaticDiscountAllocation,\n CartCodeDiscountAllocation,\n CartCustomDiscountAllocation,\n CartDeliveryGroupConnection,\n CartDiscountCode,\n CartLine,\n ComponentizableCartLine,\n CurrencyCode,\n CartBuyerIdentity as HydrogenCartBuyerIdentity,\n CartCost as HydrogenCartCost,\n MoneyV2 as HydrogenMoneyV2,\n PageInfo as HydrogenPageInfo,\n Cart as HydrogenStorefrontApiCart,\n Metafield,\n} from '@shopify/hydrogen/storefront-api-types';\nimport type { CartContext, CartItem, ContextParameters, RebuyContextProps } from '~/types/rebuyCustom';\nimport { getEncodedAttributes } from '~/utils/getEncodedAttributes';\n\n/* Helper to create a default MoneyV2 object */\nconst defaultMoney = (currencyCode: CurrencyCode = 'USD' as CurrencyCode): HydrogenMoneyV2 => ({\n __typename: 'MoneyV2',\n amount: '0.0',\n currencyCode,\n});\n\n/* Helper to create default PageInfo */\nconst defaultPageInfo = (): HydrogenPageInfo => ({\n __typename: 'PageInfo',\n endCursor: null,\n hasNextPage: false,\n hasPreviousPage: false,\n startCursor: null,\n});\n\n/* Helper for default BuyerIdentity */\nconst defaultBuyerIdentity = (): HydrogenCartBuyerIdentity => ({\n __typename: 'CartBuyerIdentity',\n countryCode: null,\n customer: null,\n deliveryAddressPreferences: [],\n email: null,\n phone: null,\n // preferences and purchasingCompany are not on the official type\n});\n\nexport const createContextParameters = ({\n cacheKey,\n /* Legacy props */\n cartAttributes: legacyCartAttributes,\n cartCost: legacyCartCost,\n cartId: legacyCartId,\n cartLines: legacyCartLines,\n cartLinesLength: legacyCartLinesLength,\n cartNote: legacyCartNote,\n cartSubtotal: legacyCartSubtotal,\n cartTotalQuantity: legacyCartTotalQuantity,\n checkoutUrl: legacyCheckoutUrl,\n discountCodes: legacyDiscountCodes,\n /* Modern props */\n hydrogenReactCartActions,\n hydrogenReactCartError,\n hydrogenReactCartStatus,\n isHydrogenReact,\n /* H-React specific */\n queryObject,\n sourceHydrogenCart,\n windowUrl,\n}: RebuyContextProps): ContextParameters => {\n let solidifiedHydrogenCart: HydrogenStorefrontApiCart | null = null;\n const sourceCartCurrency = (sourceHydrogenCart?.cost?.totalAmount?.currencyCode ?? 'USD') as CurrencyCode;\n\n if (sourceHydrogenCart && sourceHydrogenCart.id) {\n const builtCart: Partial<HydrogenStorefrontApiCart> = {\n __typename: 'Cart',\n appliedGiftCards: sourceHydrogenCart.appliedGiftCards ?? [],\n attributes: sourceHydrogenCart.attributes ?? [],\n buyerIdentity: (sourceHydrogenCart.buyerIdentity as HydrogenCartBuyerIdentity) ?? defaultBuyerIdentity(),\n checkoutUrl: sourceHydrogenCart.checkoutUrl ?? '',\n cost: (sourceHydrogenCart.cost as HydrogenCartCost) ?? {\n __typename: 'CartCost',\n checkoutChargeAmount: defaultMoney(sourceCartCurrency),\n subtotalAmount: defaultMoney(sourceCartCurrency),\n subtotalAmountEstimated: false,\n totalAmount: defaultMoney(sourceCartCurrency),\n totalAmountEstimated: false,\n totalDutyAmount: null,\n totalDutyAmountEstimated: false,\n totalTaxAmount: null,\n totalTaxAmountEstimated: false,\n },\n createdAt: sourceHydrogenCart.createdAt ?? new Date().toISOString(),\n deliveryGroups: (sourceHydrogenCart.deliveryGroups as CartDeliveryGroupConnection) ?? {\n __typename: 'CartDeliveryGroupConnection',\n edges: [],\n nodes: [],\n pageInfo: defaultPageInfo(),\n },\n discountAllocations: (sourceHydrogenCart.discountAllocations ?? []) as (\n | CartAutomaticDiscountAllocation\n | CartCodeDiscountAllocation\n | CartCustomDiscountAllocation\n )[],\n discountCodes: (sourceHydrogenCart.discountCodes as CartDiscountCode[]) ?? [],\n id: sourceHydrogenCart.id,\n lines: (sourceHydrogenCart.lines as BaseCartLineConnection) ?? {\n __typename: 'BaseCartLineConnection',\n edges: [],\n nodes: [],\n pageInfo: defaultPageInfo(),\n },\n metafields: (sourceHydrogenCart.metafields ?? []) as Metafield[],\n note: sourceHydrogenCart.note ?? null,\n totalQuantity: sourceHydrogenCart.totalQuantity ?? 0,\n updatedAt: sourceHydrogenCart.updatedAt ?? new Date().toISOString(),\n };\n solidifiedHydrogenCart = builtCart as HydrogenStorefrontApiCart;\n }\n\n let numericCartToken: string | undefined;\n let cartSubtotalInCents: number = 0;\n let linesForCounts: (CartLine | ComponentizableCartLine)[] = [];\n let totalQuantity: number = 0;\n let lineCount: number = 0;\n let legacyNote: string | null = null;\n let legacyAttributes: Attribute[] = [];\n let legacyCheckoutUrlValue: string | undefined;\n let legacyDiscountCodesValue: CartDiscountCode[] = [];\n let legacyCartCostValue: RebuyContextProps['cartCost'] | undefined;\n let legacyCartIdValue: string | undefined;\n\n if (solidifiedHydrogenCart) {\n numericCartToken = Utilities.getIdFromGraphUrl(solidifiedHydrogenCart.id, 'Cart') as string;\n cartSubtotalInCents = solidifiedHydrogenCart.cost?.subtotalAmount?.amount\n ? Utilities.amountToCents(parseFloat(solidifiedHydrogenCart.cost.subtotalAmount.amount))\n : 0;\n\n linesForCounts =\n (solidifiedHydrogenCart.lines.nodes?.length ?? 0) > 0\n ? (solidifiedHydrogenCart.lines.nodes as (CartLine | ComponentizableCartLine)[])\n : ((solidifiedHydrogenCart.lines.edges?.map((e) => e.node) as (CartLine | ComponentizableCartLine)[]) ??\n []);\n\n totalQuantity = solidifiedHydrogenCart.totalQuantity;\n lineCount = linesForCounts.length;\n legacyNote = solidifiedHydrogenCart.note ?? null;\n legacyAttributes = [...solidifiedHydrogenCart.attributes];\n legacyCheckoutUrlValue = solidifiedHydrogenCart.checkoutUrl;\n legacyDiscountCodesValue = [...solidifiedHydrogenCart.discountCodes];\n legacyCartCostValue = solidifiedHydrogenCart.cost;\n legacyCartIdValue = solidifiedHydrogenCart.id;\n } else {\n numericCartToken = legacyCartId ? (Utilities.getIdFromGraphUrl(legacyCartId, 'Cart') as string) : undefined;\n const subtotalString = legacyCartCost?.subtotalAmount?.amount ?? legacyCartSubtotal;\n cartSubtotalInCents = subtotalString ? Utilities.amountToCents(parseFloat(subtotalString)) : 0;\n linesForCounts = Array.isArray(legacyCartLines)\n ? ([...legacyCartLines] as (CartLine | ComponentizableCartLine)[])\n : [];\n totalQuantity = legacyCartTotalQuantity ?? linesForCounts.reduce((sum, line) => sum + (line?.quantity ?? 0), 0);\n lineCount = legacyCartLinesLength ?? linesForCounts.length;\n legacyNote = legacyCartNote ?? null;\n legacyAttributes = legacyCartAttributes ? [...legacyCartAttributes] : [];\n legacyCheckoutUrlValue = legacyCheckoutUrl;\n legacyDiscountCodesValue = legacyDiscountCodes ? [...legacyDiscountCodes] : [];\n legacyCartCostValue = legacyCartCost;\n legacyCartIdValue = legacyCartId;\n }\n\n const contextParametersOutput: ContextParameters = {\n cacheKey: cacheKey,\n cart: undefined,\n cartAttributes: legacyAttributes,\n cartCost: legacyCartCostValue,\n cartCount: totalQuantity,\n cartId: legacyCartIdValue,\n\n cartItemCount: totalQuantity,\n cartLineCount: lineCount,\n cartLines: linesForCounts as CartLine[],\n cartNote: legacyNote,\n cartSubtotal: cartSubtotalInCents,\n cartToken: numericCartToken,\n checkoutUrl: legacyCheckoutUrlValue,\n\n discountCodes: legacyDiscountCodesValue,\n\n hydrogenCart: solidifiedHydrogenCart,\n hydrogenReactCartActions,\n hydrogenReactCartError,\n\n hydrogenReactCartStatus,\n isHydrogenReact,\n time: queryObject.time ?? '',\n\n url: windowUrl,\n };\n\n const cartContext: CartContext = {\n attributes: '',\n item_count: totalQuantity,\n items: [],\n line_count: lineCount,\n note: legacyNote ?? '',\n subtotal: cartSubtotalInCents,\n token: numericCartToken ?? '',\n };\n\n if (legacyAttributes.length > 0) {\n const validAttributes = legacyAttributes.filter(\n (attr): attr is { key: string; value: string } =>\n typeof attr.key === 'string' && typeof attr.value === 'string'\n );\n cartContext.attributes = getEncodedAttributes(validAttributes);\n }\n\n if (linesForCounts.length > 0) {\n cartContext.items = linesForCounts.map((line): CartItem => {\n const item: CartItem = {\n attributes: line.attributes ? [...line.attributes] : [],\n product_id: line.merchandise?.product?.id\n ? (Utilities.getIdFromGraphUrl(line.merchandise.product.id, 'Product') as string)\n : '',\n properties: '',\n quantity: line.quantity,\n variant_id: line.merchandise?.id\n ? (Utilities.getIdFromGraphUrl(line.merchandise.id, 'ProductVariant') as string)\n : '',\n };\n\n if (line.attributes?.length) {\n const validLineAttributes = line.attributes.filter(\n (attr): attr is { key: string; value: string } =>\n typeof attr.key === 'string' && typeof attr.value === 'string'\n );\n item.properties = getEncodedAttributes(validLineAttributes);\n }\n\n return item;\n });\n }\n\n // Create a new object with all properties from contextParametersOutput\n // but with cart property set to cartContext\n return {\n ...contextParametersOutput,\n cart: cartContext,\n };\n};\n", "import type { Attribute } from '@shopify/hydrogen-react/storefront-api-types';\n\nexport const getEncodedAttributes = (attributes: Attribute[]) =>\n encodeURIComponent(\n JSON.stringify(attributes.reduce((merged, { key, value }) => ({ ...merged, [key]: value }), {}))\n );\n", "/* eslint-disable jsdoc/require-param */\nimport * as Utilities from '@rebuy/rebuy/utilities';\nimport { useLocation } from '@remix-run/react';\nimport { CartProvider, ShopifyProvider, useCart } from '@shopify/hydrogen-react';\nimport { useMemo } from 'react';\nimport { RebuyConfigProvider, useRebuyConfig } from '~/context/RebuyConfigContext';\nimport { RebuyContext, type RebuyContextType } from '~/context/RebuyContext';\nimport type { RebuyHydrogenReactContextProviderProps, RebuyHydrogenReactProps } from '~/providers/types';\nimport { CART_FRAGMENT } from '~/queries/cart.queries';\nimport type { HydrogenReactCartActions, RebuyContextProps } from '~/types/rebuyCustom';\nimport { createContextParameters } from '~/utils/createContextParameters';\n\n/**\n * Internal component handling Rebuy configuration fetching,\n * context setup for Hydrogen React environments.\n */\nconst RebuyHydrogenReactContext = ({ children, publicPrimaryDomian }: RebuyHydrogenReactProps) => {\n const { loadingStatus: configLoadingStatus, rebuyConfig } = useRebuyConfig();\n\n const location = useLocation();\n const queryObject = Utilities.queryStringToObject(location.search);\n const windowUrl = publicPrimaryDomian ? `${publicPrimaryDomian}${location.pathname}${location.search}` : '';\n\n // ---- Hydrogen React Cart Integration ----\n const {\n cartAttributesUpdate,\n cartCreate,\n discountCodesUpdate,\n error: hydrogenReactCartError,\n linesAdd,\n linesRemove,\n linesUpdate,\n noteUpdate,\n status: hydrogenReactCartStatus,\n ...hydrogenReactCartData\n } = useCart();\n\n const hydrogenReactCartActions: HydrogenReactCartActions | undefined = useMemo(\n () => ({\n cartAttributesUpdate,\n cartCreate,\n discountCodesUpdate,\n linesAdd,\n linesRemove,\n linesUpdate,\n noteUpdate,\n }),\n [cartAttributesUpdate, cartCreate, discountCodesUpdate, linesAdd, linesRemove, linesUpdate, noteUpdate]\n );\n // ---- End Hydrogen React Cart Integration ----\n\n // --- Context Parameters Memoization ---\n const contextParameters = useMemo(() => {\n const propsForParamCreation: RebuyContextProps = {\n cacheKey: rebuyConfig?.shop?.cache_key,\n hydrogenReactCartActions,\n hydrogenReactCartError,\n hydrogenReactCartStatus,\n isHydrogenReact: true,\n queryObject,\n sourceHydrogenCart: hydrogenReactCartData as any, // eslint-disable-line @typescript-eslint/no-explicit-any\n windowUrl,\n };\n\n return createContextParameters(propsForParamCreation);\n }, [\n rebuyConfig?.shop?.cache_key,\n windowUrl,\n queryObject,\n hydrogenReactCartData,\n hydrogenReactCartActions,\n hydrogenReactCartStatus,\n hydrogenReactCartError,\n ]);\n\n const defaultContextValue = useMemo(() => ({ contextParameters: {} }) as RebuyContextType, []);\n const rebuyContextValue = useMemo(\n () => (configLoadingStatus === 'success' && rebuyConfig ? { contextParameters } : defaultContextValue),\n [configLoadingStatus, rebuyConfig, contextParameters, defaultContextValue]\n );\n\n // --- Render Logic: Provide Context ---\n return (\n <RebuyContext.Provider value={rebuyContextValue}>\n {configLoadingStatus === 'success' && rebuyConfig ? (\n children\n ) : configLoadingStatus === 'error' ? (\n <>{children}</>\n ) : null}\n </RebuyContext.Provider>\n );\n};\n\n/**\n * Outer provider component responsible for setting up ShopifyProvider,\n * CartProvider (from @shopify/hydrogen-react), and wrapping the application\n * with the RebuyHydrogenReactContext.\n */\nexport const RebuyHydrogenReactContextProvider = ({\n // --- Rebuy Specific Props ---\n cartFragment = CART_FRAGMENT,\n\n // --- ShopifyProvider Props ---\n children,\n countryIsoCode = 'US',\n customerAccessToken = '',\n data,\n languageIsoCode = 'EN',\n numCartLines,\n onAttributesUpdate,\n\n // --- CartProvider Props ---\n onAttributesUpdateComplete,\n onBuyerIdentityUpdate,\n onBuyerIdentityUpdateComplete,\n onCreate,\n // --- CartProvider Callbacks (adapted) ---\n onCreateComplete,\n onDiscountCodesUpdate,\n onDiscountCodesUpdateComplete,\n onLineAdd,\n onLineAddComplete,\n onLineRemove,\n onLineRemoveComplete,\n onLineUpdate,\n onLineUpdateComplete,\n onNoteUpdate,\n onNoteUpdateComplete,\n overrideApiKey,\n publicPrimaryDomian = '',\n publicStoreDomain = '',\n publicStorefrontApiToken = '',\n publicStorefrontId = '',\n storefrontApiVersion = '2024-07',\n}: RebuyHydrogenReactContextProviderProps) => {\n // Adapt callbacks to prevent errors if undefined\n const adaptedCallbacks = useMemo(\n () => ({\n onAttributesUpdate: onAttributesUpdate ? () => onAttributesUpdate() : undefined,\n onAttributesUpdateComplete: onAttributesUpdateComplete ? () => onAttributesUpdateComplete() : undefined,\n onBuyerIdentityUpdate: onBuyerIdentityUpdate ? () => onBuyerIdentityUpdate() : undefined,\n onBuyerIdentityUpdateComplete: onBuyerIdentityUpdateComplete\n ? () => onBuyerIdentityUpdateComplete()\n : undefined,\n onCreate: onCreate ? () => onCreate() : undefined,\n onCreateComplete: onCreateComplete ? () => onCreateComplete() : undefined,\n onDiscountCodesUpdate: onDiscountCodesUpdate ? () => onDiscountCodesUpdate() : undefined,\n onDiscountCodesUpdateComplete: onDiscountCodesUpdateComplete\n ? () => onDiscountCodesUpdateComplete()\n : undefined,\n onLineAdd: onLineAdd ? () => onLineAdd() : undefined,\n onLineAddComplete: onLineAddComplete ? () => onLineAddComplete() : undefined,\n onLineRemove: onLineRemove ? () => onLineRemove() : undefined,\n onLineRemoveComplete: onLineRemoveComplete ? () => onLineRemoveComplete() : undefined,\n onLineUpdate: onLineUpdate ? () => onLineUpdate() : undefined,\n onLineUpdateComplete: onLineUpdateComplete ? () => onLineUpdateComplete() : undefined,\n onNoteUpdate: onNoteUpdate ? () => onNoteUpdate() : undefined,\n onNoteUpdateComplete: onNoteUpdateComplete ? () => onNoteUpdateComplete() : undefined,\n }),\n [\n onAttributesUpdate,\n onAttributesUpdateComplete,\n onBuyerIdentityUpdate,\n onBuyerIdentityUpdateComplete,\n onCreate,\n onCreateComplete,\n onDiscountCodesUpdate,\n onDiscountCodesUpdateComplete,\n onLineAdd,\n onLineAddComplete,\n onLineRemove,\n onLineRemoveComplete,\n onLineUpdate,\n onLineUpdateComplete,\n onNoteUpdate,\n onNoteUpdateComplete,\n ]\n );\n\n // Ensure required Shopify Provider environment variables are set\n if (!publicStoreDomain || !publicStorefrontApiToken) {\n console.error(\n '[Rebuy React Provider] Critical environment variables publicStoreDomain or publicStorefrontApiToken are missing. ShopifyProvider and CartProvider may not function correctly.'\n );\n\n return <>{children}</>;\n }\n\n return (\n <ShopifyProvider\n countryIsoCode={countryIsoCode}\n languageIsoCode={languageIsoCode}\n storeDomain={publicStoreDomain}\n storefrontApiVersion={storefrontApiVersion}\n storefrontId={publicStorefrontId}\n storefrontToken={publicStorefrontApiToken}\n >\n <CartProvider\n cartFragment={cartFragment}\n countryCode={countryIsoCode}\n customerAccessToken={customerAccessToken}\n data={data}\n languageCode={languageIsoCode}\n numCartLines={numCartLines}\n {...adaptedCallbacks}\n >\n <RebuyConfigProvider initialShopDomain={publicStoreDomain} overrideApiKey={overrideApiKey}>\n <RebuyHydrogenReactContext publicPrimaryDomian={publicPrimaryDomian}>\n {children}\n </RebuyHydrogenReactContext>\n </RebuyConfigProvider>\n </CartProvider>\n </ShopifyProvider>\n );\n};\n", "export const OPTION_FRAGMENT = `#graphql\n fragment OptionFragment on ProductOption {\n id\n name\n optionValues {\n id\n name\n swatch {\n color\n image {\n mediaContentType\n previewImage {\n height\n id\n url\n width\n altText\n }\n id\n alt\n }\n }\n }\n }\n`;\n/*\n * STOREFRONT API QUERIES -----------------------------------------------------\n */\n\n// Docs: https://shopify.dev/docs/api/storefront/latest/objects/Cart\n\nexport const CART_LINE_FRAGMENT = `#graphql\n fragment CartLineFragment on CartLine {\n id\n quantity\n cost {\n amountPerQuantity {\n amount\n currencyCode\n }\n compareAtAmountPerQuantity {\n amount\n currencyCode\n }\n totalAmount {\n amount\n currencyCode\n }\n subtotalAmount {\n amount\n currencyCode\n }\n }\n attributes {\n key\n value\n }\n discountAllocations {\n discountedAmount {\n amount\n currencyCode\n }\n ... on CartAutomaticDiscountAllocation {\n __typename\n discountedAmount {\n amount\n currencyCode\n }\n title\n }\n ... on CartCodeDiscountAllocation {\n __typename\n code\n discountedAmount {\n amount\n currencyCode\n }\n }\n ... on CartCustomDiscountAllocation {\n __typename\n discountedAmount {\n amount\n currencyCode\n }\n title\n }\n }\n merchandise {\n ... on ProductVariant {\n availableForSale\n id\n sku\n title\n compareAtPrice {\n amount\n currencyCode\n }\n image {\n altText\n height\n id\n url\n width\n }\n price {\n amount\n currencyCode\n }\n product {\n handle\n id\n productType\n tags\n title\n vendor\n collections(first: 10) {\n nodes {\n handle\n }\n }\n options {\n ...OptionFragment\n }\n images(first: 20) {\n nodes {\n altText\n height\n id\n url\n width\n }\n }\n }\n selectedOptions {\n name\n value\n }\n }\n }\n }\n` as const;\n\nexport const CART_LINE_COMPONENT_FRAGMENT = `#graphql\n fragment CartLineComponentFragment on ComponentizableCartLine {\n id\n quantity\n cost {\n amountPerQuantity {\n amount\n currencyCode\n }\n compareAtAmountPerQuantity {\n amount\n currencyCode\n }\n totalAmount {\n amount\n currencyCode\n }\n subtotalAmount {\n amount\n currencyCode\n }\n }\n attributes {\n key\n value\n }\n discountAllocations {\n discountedAmount {\n amount\n currencyCode\n }\n ... on CartAutomaticDiscountAllocation {\n __typename\n discountedAmount {\n amount\n currencyCode\n }\n title\n }\n ... on CartCodeDiscountAllocation {\n __typename\n code\n discountedAmount {\n amount\n currencyCode\n }\n }\n ... on CartCustomDiscountAllocation {\n __typename\n discountedAmount {\n amount\n currencyCode\n }\n title\n }\n }\n merchandise {\n ... on ProductVariant {\n availableForSale\n id\n sku\n title\n compareAtPrice {\n amount\n currencyCode\n }\n image {\n altText\n height\n id\n url\n width\n }\n price {\n amount\n currencyCode\n }\n product {\n handle\n id\n productType\n tags\n title\n vendor\n collections(first: 10) {\n nodes {\n handle\n }\n }\n options {\n id\n name\n optionValues {\n id\n name\n swatch {\n color\n image {\n mediaContentType\n previewImage {\n height\n id\n url\n width\n altText\n }\n id\n alt\n }\n }\n }\n }\n images(first: 20) {\n nodes {\n altText\n height\n id\n url\n width\n }\n }\n }\n selectedOptions {\n name\n value\n }\n }\n }\n lineComponents {\n id\n quantity\n cost {\n amountPerQuantity {\n amount\n currencyCode\n }\n compareAtAmountPerQuantity {\n amount\n currencyCode\n }\n totalAmount {\n amount\n currencyCode\n }\n subtotalAmount {\n amount\n currencyCode\n }\n }\n attributes {\n key\n value\n }\n discountAllocations {\n discountedAmount {\n amount\n currencyCode\n }\n ... on CartAutomaticDiscountAllocation {\n __typename\n discountedAmount {\n amount\n currencyCode\n }\n title\n }\n ... on CartCodeDiscountAllocation {\n __typename\n code\n discountedAmount {\n amount\n currencyCode\n }\n }\n ... on CartCustomDiscountAllocation {\n __typename\n discountedAmount {\n amount\n currencyCode\n }\n title\n }\n }\n merchandise {\n ... on ProductVariant {\n availableForSale\n id\n sku\n title\n compareAtPrice {\n amount\n currencyCode\n }\n image {\n altText\n height\n id\n url\n width\n }\n price {\n amount\n currencyCode\n }\n product {\n handle\n id\n productType\n tags\n title\n vendor\n collections(first: 10) {\n nodes {\n handle\n }\n }\n options {\n ...OptionFragment\n }\n images(first: 20) {\n nodes {\n altText\n height\n id\n url\n width\n }\n }\n }\n selectedOptions {\n name\n value\n }\n }\n }\n }\n }\n` as const;\n\nexport const CART_FRAGMENT = `#graphql\n fragment CartFragment on Cart {\n id\n checkoutUrl\n createdAt\n totalQuantity\n note\n updatedAt\n __typename\n buyerIdentity {\n countryCode\n customer {\n id\n email\n firstName\n lastName\n displayName\n }\n email\n phone\n }\n attributes {\n key\n value\n }\n cost {\n subtotalAmount {\n amount\n currencyCode\n }\n totalAmount {\n amount\n currencyCode\n }\n }\n discountAllocations {\n discountedAmount {\n amount\n currencyCode\n }\n ... on CartAutomaticDiscountAllocation {\n __typename\n discountedAmount {\n amount\n currencyCode\n }\n title\n }\n ... on CartCodeDiscountAllocation {\n __typename\n code\n discountedAmount {\n amount\n currencyCode\n }\n }\n ... on CartCustomDiscountAllocation {\n __typename\n discountedAmount {\n amount\n currencyCode\n }\n title\n }\n }\n discountCodes {\n applicable\n code\n }\n lines(first: $numCartLines) {\n edges {\n node {\n ...CartLineComponentFragment\n }\n }\n edges {\n node {\n ...CartLineFragment\n }\n }\n }\n }\n ${CART_LINE_FRAGMENT}\n ${CART_LINE_COMPONENT_FRAGMENT}\n ${OPTION_FRAGMENT}\n` as const;\n", "import { RebuyClient } from '@rebuy/rebuy';\nimport * as Utilities from '@rebuy/rebuy/utilities';\nimport { flattenConnection } from '@shopify/hydrogen';\nimport React, { type ComponentType, useEffect, useMemo, useState } from 'react';\n\nimport { useRebuyConfig } from '~/context/RebuyConfigContext';\nimport type { RebuyProduct, RebuyWidgetContainerProps, RebuyWidgetMetadata } from '~/types/rebuyCustom';\n\ntype RebuyWidgetContainerComponent = {\n (props: RebuyWidgetContainerProps): JSX.Element;\n} & ComponentType<RebuyWidgetContainerProps>;\n\nconst RebuyWidgetContainerBase = ({ children, ...props }: RebuyWidgetContainerProps) => {\n const { apiKey, collection, collectionId, dataSource, limit, options, product, productId, variant, variantId } =\n props;\n\n const { apiKey: apiKeyFromContext, loadingStatus: configLoadingStatus, rebuyConfig } = useRebuyConfig();\n\n const [rebuyApiClient, setRebuyApiClient] = useState<RebuyClient | null>(null);\n const [initialized, setInitialized] = useState(false);\n const shopifyProductId = product?.id ?? productId ?? null;\n const shopifyVariantId = variant?.id ?? variantId ?? null;\n const shopifyCollectionId = collection?.id ?? collectionId ?? null;\n const [products, setProducts] = useState<RebuyProduct[]>([]);\n const [metadata, setMetadata] = useState<RebuyWidgetMetadata>();\n\n // Initialize Rebuy API client\n useEffect(() => {\n if (!rebuyApiClient && apiKeyFromContext && configLoadingStatus === 'success') {\n const client = new RebuyClient(apiKeyFromContext);\n\n if (options) {\n client.setDefaultParameters(options as Record<string, unknown>); // TODO: fix this type when @rebuy/rebuy is moved to typescript\n }\n\n setRebuyApiClient(client);\n setInitialized(true);\n }\n }, [apiKeyFromContext, rebuyApiClient, configLoadingStatus, options]);\n\n // Memoize request object on prop changes (e.g. product)\n const request = useMemo(() => {\n const req = {\n endpoint: dataSource || '/api/v1/products/recommended',\n params: {} as Record<string, string | number>, // Keeping this object generic to allow for custom endpoints\n };\n\n if (shopifyProductId) {\n req.params.shopify_product_ids = Utilities.getIdFromGraphUrl(shopifyProductId, 'Product') ?? '';\n }\n\n if (shopifyVariantId) {\n req.params.shopify_variant_ids = Utilities.getIdFromGraphUrl(shopifyVariantId, 'ProductVariant') ?? '';\n }\n\n if (shopifyCollectionId) {\n req.params.shopify_collection_ids = Utilities.getIdFromGraphUrl(shopifyCollectionId, 'Collection') ?? '';\n }\n\n if (limit) {\n req.params.limit = limit;\n }\n\n return req;\n }, [dataSource, shopifyProductId, shopifyVariantId, shopifyCollectionId, limit]);\n\n // Update product recommendations on cart or request change\n useEffect(() => {\n let isMounted = true;\n\n if (!rebuyApiClient || !initialized || configLoadingStatus !== 'success') return;\n\n const fetchData = async () => {\n const { data, metadata } = (await rebuyApiClient.getStorefrontData(request.endpoint, request.params)) as {\n data: RebuyProduct[];\n metadata: RebuyWidgetMetadata;\n };\n\n if (isMounted) {\n setProducts(\n Array.isArray(data)\n ? data.map((product) => ({\n ...product,\n variants: {\n nodes: product.variants ? flattenConnection(product.variants) : [],\n },\n }))\n : []\n );\n setMetadata(metadata);\n }\n };\n\n fetchData();\n\n return () => {\n isMounted = false;\n };\n }, [rebuyApiClient, initialized, request, configLoadingStatus]);\n\n const childrenWithProps = (currentProps: RebuyWidgetContainerProps) =>\n React.Children.map(children, (child) =>\n React.isValidElement(child) ? React.cloneElement(child, currentProps) : child\n );\n\n const childProps = {\n ...props,\n cacheKey: rebuyConfig?.shop?.cache_key,\n key: product?.id,\n metadata,\n products,\n };\n\n if (configLoadingStatus !== 'success' || !rebuyApiClient) {\n return null;\n }\n\n return childrenWithProps(childProps as RebuyWidgetContainerProps);\n};\n\nexport const RebuyWidgetContainer = RebuyWidgetContainerBase as RebuyWidgetContainerComponent;\n", "import type { ProductCardSettings } from './types';\n\nexport const defaultProductCardSettings: ProductCardSettings = {\n layoutStyle: 'grid',\n productOptions: {\n hide_out_of_stock_variants: false,\n match_variant: false,\n match_variant_out_of_stock: false,\n show_product_description: 'hide',\n show_subscription_options: 'always',\n show_variant_options: 'always',\n show_variant_title: 'show',\n show_variants_as_products: false,\n variant_display_limit: 'product_limit',\n },\n quantityInput: {\n default_quantity: 1,\n enabled: true,\n max_value: 11,\n min_value: 1,\n },\n settingsDiscount: {\n amount: 0,\n bundle_protection: {\n allowed_removals: 0,\n disable_atc_on_incomplete: false,\n enabled: false,\n },\n discount_protection: {\n enabled: false,\n minimum_items_to_get_discount: 2,\n },\n discounted_by: 'other',\n discounted_from: 'original_price',\n message: '',\n quantity: 1,\n show_saving_amount: false,\n type: 'none',\n },\n variantSelector: 'select',\n};\n", "import { Link } from '@remix-run/react';\nimport { Image } from '@shopify/hydrogen';\nimport { useState } from 'react';\n\nimport { AddToCartBtn } from '~/components/AddToCartBtn';\nimport { defaultProductCardSettings } from '~/components/ProductCard/defaultSettings';\nimport type { ProductCardProps } from '~/components/ProductCard/types';\nimport { RebuyProductPrice } from '~/components/ProductPrice/ProductPrice';\nimport { QuantityInput } from '~/components/QuantityInput';\nimport { Title } from '~/components/Title';\nimport { VariantSelect } from '~/components/VariantSelect';\nimport type { RebuyProduct } from '~/types/rebuyCustom';\nimport styles from './ProductCard.module.css';\n\nexport const ProductCard = ({\n addToCartBtnText,\n addToCartCallback,\n isHydrogenReact,\n isInPopup,\n onPopupDismiss,\n product,\n productCardTitleLevel,\n settings = defaultProductCardSettings,\n}: ProductCardProps) => {\n const [selectedVariant, setSelectedVariant] = useState(product.variants.nodes[0]);\n const [selectedQuantity, setSelectedQuantity] = useState<number>(settings?.quantityInput?.default_quantity || 1);\n\n const displayImage = selectedVariant.image || product.featuredImage;\n const handleSelectedVariant = (product: RebuyProduct, variant_id: string) => {\n const updatedVariant = product.variants.nodes.find((variant) => variant.id === variant_id);\n\n if (updatedVariant) {\n setSelectedVariant(updatedVariant);\n }\n };\n\n const handleSelectedQuantity = (quantity: number) => {\n setSelectedQuantity(quantity);\n };\n\n const handleLinkClick = () => {\n if (isInPopup && onPopupDismiss) {\n onPopupDismiss();\n }\n };\n\n const showVariantTitle =\n settings?.productOptions?.show_variant_title && selectedVariant.title.toLowerCase() !== 'default title';\n const showReviews = product.reviews && product?.reviews?.review_count && product?.reviews?.review_count > 0;\n const productReviewsRating = product.reviews?.star_rating;\n const showProductDescription =\n settings?.productOptions?.show_product_description === 'show' &&\n product.description !== '' &&\n product.description !== null;\n const showVariantSelect =\n product?.variants.nodes.length > 1 &&\n (settings?.productOptions?.show_variant_options === 'default' ||\n settings?.productOptions?.show_variant_options === 'always');\n const showQuantityInput =\n settings?.quantityInput?.enabled &&\n settings?.quantityInput?.max_value !== null &&\n settings?.quantityInput?.min_value !== null;\n\n const cardLayout = settings?.layoutStyle || 'grid';\n\n return (\n <div className={styles['rebuy-product-card__container']}>\n <div className={styles['rebuy-product-card']} data-layout={cardLayout}>\n <div>\n <Link\n aria-label={`View ${product.title}`}\n className={styles['rebuy-product-card__media-link']}\n onClick={handleLinkClick}\n rel=\"nofollow\"\n to={`/products/${product.handle}`}\n >\n <Image\n alt={displayImage?.altText ?? `Picture of ${product.title}`}\n className={styles['rebuy-product-card__image']}\n data={displayImage}\n sizes=\"(max-width: 320px) 280px, (max-width: 768px) 720px, 1440px\"\n />\n </Link>\n </div>\n <div className={styles['rebuy-product-card__info']}>\n <div className={styles['rebuy-product-card__content']}>\n <div className={styles['rebuy-product-card__header']}>\n <p className={styles['rebuy-product-card__vendor']}>{product.vendor}</p>\n <Link\n aria-label={`View ${product.title}`}\n className={styles['rebuy-product-card__title-link']}\n onClick={handleLinkClick}\n rel=\"nofollow\"\n to={`/products/${product.handle}`}\n >\n <Title\n className={styles['rebuy-product-card__title']}\n level={productCardTitleLevel}\n text={product.title}\n />\n </Link>\n {showVariantTitle && (\n <div className={styles['rebuy-product-card__variant-title']}>\n {selectedVariant.title}\n </div>\n )}\n </div>\n\n <RebuyProductPrice\n selectedVariant={selectedVariant}\n settingsDiscount={settings?.settingsDiscount}\n />\n\n {showReviews && (\n <div aria-label=\"product star rating\" className={styles['rebuy-product-card__review']}>\n <span className={styles['rebuy-product-card__star-rating']}>\n {productReviewsRating && (\n <span className={styles['rebuy-product-card__star-rating-value']}>\n {productReviewsRating} stars out of 5 stars\n </span>\n )}\n\n <span className={styles['rebuy-product-card__star-rating-background']}></span>\n <span\n className={styles['rebuy-product-card__star-rating-foreground']}\n style={\n productReviewsRating\n ? { width: (productReviewsRating / 5) * 100 + '%' }\n : {}\n }\n >\n {product.reviews && productReviewsRating && (\n <>\n <span\n className={styles['rebuy-product-card__review-count-parenthesis']}\n >\n (\n </span>\n <span className={styles['rebuy-product-card__review-count-number']}>\n {productReviewsRating\n .toString()\n .replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',')}\n </span>\n <span className={styles['rebuy-product-card__review-count-label']}>\n Reviews\n </span>\n <span\n className={styles['rebuy-product-card__review-count-parenthesis']}\n >\n )\n </span>\n </>\n )}\n </span>\n </span>\n <span className={styles['rebuy-product-card__review-count']}>\n {productReviewsRating}\n </span>\n </div>\n )}\n {showProductDescription && (\n <div className={styles['rebuy-product-card__description']}>\n <p>{product.description}</p>\n </div>\n )}\n </div>\n\n <div className={styles['rebuy-product-card__actions']}>\n {showVariantSelect && (\n <div\n className={styles['rebuy-product-card__actions-variant-select']}\n data-layout={cardLayout}\n >\n <VariantSelect\n handleSelectedVariant={handleSelectedVariant}\n product={product}\n selectedId={selectedVariant.id}\n style={settings?.variantSelector}\n />\n </div>\n )}\n {showQuantityInput && (\n <div className={styles['rebuy-product-card__actions-quantity']}>\n <QuantityInput\n defaultQuantity={settings?.quantityInput?.default_quantity}\n handleSelectedQuantity={handleSelectedQuantity}\n maxValue={settings?.quantityInput?.max_value}\n minValue={settings?.quantityInput?.min_value}\n />\n </div>\n )}\n <div className={styles['rebuy-product-card__actions-button']}>\n <AddToCartBtn\n addToCartBtnText={addToCartBtnText}\n addToCartCallback={addToCartCallback}\n isHydrogenReact={isHydrogenReact}\n quantity={selectedQuantity}\n selectedVariants={[selectedVariant]}\n />\n </div>\n </div>\n </div>\n </div>\n {showVariantSelect && (\n <div className={styles['rebuy-product-card__variant-select']} data-layout={cardLayout}>\n <VariantSelect\n handleSelectedVariant={handleSelectedVariant}\n product={product}\n selectedId={selectedVariant.id}\n style={settings?.variantSelector}\n />\n </div>\n )}\n </div>\n );\n};\n", "import { type FetcherWithComponents } from '@remix-run/react';\nimport { CartForm, Money } from '@shopify/hydrogen';\n\nimport type { btnProps } from '~/components/AddToCartBtn/types';\nimport styles from './AddToCartBtn.module.css';\n\nexport const HydrogenAddToCartBtn = ({\n addToCartBtnText,\n addToCartCallback,\n disabled,\n linesToAdd,\n moneyData,\n}: btnProps) => {\n return (\n <div className={styles['rebuy-cart-button__container']}>\n <CartForm\n action={CartForm.ACTIONS.LinesAdd}\n inputs={{\n lines: linesToAdd,\n }}\n route=\"/cart\"\n >\n {(fetcher: FetcherWithComponents<unknown>) => (\n <>\n <button\n className={styles['rebuy-cart-button']}\n disabled={disabled || fetcher.state !== 'idle'}\n onClick={addToCartCallback}\n type=\"submit\"\n >\n {addToCartBtnText}\n {moneyData && (\n <>\n <span> | </span>\n <Money data={moneyData} withoutTrailingZeros />\n </>\n )}\n </button>\n </>\n )}\n </CartForm>\n </div>\n );\n};\n", "/* stylelint-disable selector-class-pattern */\n\n.rebuy-cart-button {\n padding: var(--rb-spacing-unit-2x, 8px) var(--rb-spacing-unit-4x, 16px);\n border-radius: var(--rb-border-radius-button, 4px);\n font-size: var(--rb-font-size-large, 16px);\n font-weight: var(--rb-font-weight-medium);\n line-height: var(--rb-line-height-normal);\n color: var(--rb-color-button-primary-text, #fff);\n background-color: var(--rb-color-button-primary-background, #000);\n border: none;\n border-width: var(--rb-border-width-button);\n border-style: solid;\n border-color: var(--rb-color-button-primary-border);\n cursor: pointer;\n width: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: var(--rb-spacing-unit-2x, 8px);\n text-align: center;\n transition:\n background-color 0.2s ease,\n border-color 0.2s ease,\n color 0.2s ease,\n box-shadow 0.2s ease,\n opacity 0.2s ease;\n}\n\n.rebuy-cart-button:hover {\n background-color: var(--rb-color-button-primary-background-hover, #333);\n border-color: var(--rb-color-button-primary-border-hover, var(--rb-color-button-primary-border));\n color: var(--rb-color-button-primary-text-hover, var(--rb-color-button-primary-text, #fff));\n}\n\n.rebuy-cart-button:focus {\n outline: none;\n background-color: var(--rb-color-button-primary-background-focus, var(--rb-color-button-primary-background, #000));\n border-color: var(--rb-color-button-primary-border-focus, var(--rb-color-button-primary-border));\n color: var(--rb-color-button-primary-text-focus, var(--rb-color-button-primary-text, #fff));\n box-shadow: 0 0 0 var(--rb-focus-ring-width, 3px) var(--rb-color-focus-ring-alpha-25, rgb(0 123 255 / 25%));\n}\n\n.rebuy-cart-button:active {\n background-color: var(--rb-color-button-primary-background-active, var(--rb-color-button-primary-background, #000));\n border-color: var(--rb-color-button-primary-border-active, var(--rb-color-button-primary-border));\n color: var(--rb-color-button-primary-text-active, var(--rb-color-button-primary-text, #fff));\n}\n\n.rebuy-cart-button:disabled {\n opacity: var(--rb-opacity-disabled, 0.5);\n cursor: not-allowed;\n}\n\n.rebuy-cart-button__container form {\n max-width: 100%;\n}\n", "import { Money, useCart } from '@shopify/hydrogen-react';\n\nimport type { btnProps } from '~/components/AddToCartBtn/types';\nimport styles from './AddToCartBtn.module.css';\n\nexport const HydrogenReactAddToCartBtn = ({\n addToCartBtnText,\n addToCartCallback,\n disabled,\n linesToAdd,\n moneyData,\n}: btnProps) => {\n const { linesAdd } = useCart();\n const handleAddToCart = () => {\n linesAdd(linesToAdd);\n addToCartCallback?.();\n };\n\n return (\n <button className={styles['rebuy-cart-button']} disabled={disabled} onClick={handleAddToCart} type=\"button\">\n {addToCartBtnText}\n {moneyData && (\n <>\n <span> | </span>\n <Money data={moneyData} withoutTrailingZeros />\n </>\n )}\n </button>\n );\n};\n", "import type { AddToCartBtnProps } from '~/components/AddToCartBtn/types';\nimport { HydrogenAddToCartBtn } from './HydrogenAddToCartBtn';\nimport { HydrogenReactAddToCartBtn } from './HydrogenReactAddToCartBtn';\n\nexport const AddToCartBtn = ({\n addToCartBtnText,\n addToCartCallback,\n disabled,\n isHydrogenReact,\n moneyData,\n quantity,\n selectedVariants,\n}: AddToCartBtnProps) => {\n const linesToAdd = selectedVariants.map((variant) => ({\n attributes: [\n { key: '_source', value: 'Rebuy' },\n { key: '_attribution', value: 'Rebuy Product Recommendations' },\n ],\n merchandiseId: variant.id,\n quantity: quantity || 1,\n selectedVariant: variant,\n }));\n\n if (isHydrogenReact) {\n return (\n <HydrogenReactAddToCartBtn\n addToCartBtnText={addToCartBtnText}\n addToCartCallback={addToCartCallback}\n disabled={disabled}\n linesToAdd={linesToAdd}\n moneyData={moneyData}\n />\n );\n }\n\n return (\n <HydrogenAddToCartBtn\n addToCartBtnText={addToCartBtnText}\n addToCartCallback={addToCartCallback}\n disabled={disabled}\n linesToAdd={linesToAdd}\n moneyData={moneyData}\n />\n );\n};\n", "import { Money } from '@shopify/hydrogen';\n\nimport type { MoneyV2 } from '@shopify/hydrogen-react/storefront-api-types';\nimport type { ProductPriceProps } from './types';\nimport styles from './ProductPrice.module.css';\n\n// TODO: Add support for settingsDiscount\nexport const RebuyProductPrice = ({ selectedVariant, settingsDiscount }: ProductPriceProps) => {\n if (!selectedVariant) return null;\n const { compareAtPriceV2: compareAtPrice, priceV2: price } = selectedVariant;\n\n const isDiscounted = (price: MoneyV2 | null, compareAtPrice: MoneyV2 | null) =>\n Number(compareAtPrice?.amount) > Number(price?.amount);\n\n const currentPriceIsOnSale = compareAtPrice && isDiscounted(price, compareAtPrice);\n\n const CompareAtPrice = ({ data: compareAtPriceData }: { data: MoneyV2 | null }) => {\n return (\n compareAtPriceData && (\n <Money\n as=\"span\"\n className={styles['rebuy-product-price__compare-at']}\n data={compareAtPriceData}\n withoutTrailingZeros\n />\n )\n );\n };\n\n return (\n price && (\n <div className={styles['rebuy-product-price']}>\n <Money\n as=\"span\"\n className={`${styles['rebuy-product-price__current']} ${currentPriceIsOnSale ? styles['rebuy-product-price__current--sale'] : ''}`}\n data={price}\n withoutTrailingZeros\n />\n {currentPriceIsOnSale && <CompareAtPrice data={compareAtPrice} />}\n </div>\n )\n );\n};\n", ".rebuy-product-price {\n display: flex;\n align-items: baseline;\n gap: var(--rb-spacing-unit-2x, 0.5em);\n font-size: var(--rb-font-size-medium, 1em);\n line-height: var(--rb-line-height-normal, 1);\n color: var(--rb-color-text-price-default, #333);\n}\n\n.rebuy-product-price__current {\n font-weight: var(--rb-font-weight-medium, 500);\n color: var(--rb-color-text-price-default, #333);\n}\n\n.rebuy-product-price__current--sale {\n color: var(--rb-color-text-price-sale, #f00);\n}\n\n.rebuy-product-price__compare-at {\n color: var(--rb-color-text-price-compare-at, #666);\n text-decoration: line-through;\n font-size: var(--rb-font-size-small, 0.875em);\n}\n", "import { useState } from 'react';\nimport type { QuantityInputProps } from './types';\nimport styles from './QuantityInput.module.css';\n\nexport const QuantityInput = ({\n defaultQuantity = 1,\n handleSelectedQuantity,\n maxValue = 10,\n minValue = 1,\n}: QuantityInputProps) => {\n const [quantity, setQuantity] = useState<number>(defaultQuantity);\n\n const handleChange = (event: React.ChangeEvent<HTMLSelectElement>) => {\n const newValue = parseInt(event.target.value, 10);\n setQuantity(newValue);\n\n // Call the callback with new value\n if (handleSelectedQuantity) {\n handleSelectedQuantity(newValue);\n }\n };\n\n // Generate array of quantity options from minValue to maxValue\n const quantityOptions = Array.from({ length: maxValue - minValue + 1 }, (_, i) => minValue + i);\n\n return (\n <div className={styles['rebuy-quantity__container']}>\n <select\n aria-label=\"Product quantity\"\n className={styles['rebuy-quantity__select']}\n onChange={handleChange}\n value={quantity}\n >\n {quantityOptions.map((value) => (\n <option key={`quantity-${value}`} value={value}>\n {value}\n </option>\n ))}\n </select>\n </div>\n );\n};\n", ".rebuy-quantity__container {\n display: flex;\n align-items: center;\n justify-content: center;\n margin: var(--rb-spacing-unit-1x, 4px) 0;\n}\n\n.rebuy-quantity__select {\n width: 100%;\n padding: 8px;\n border: 1px solid #ccc;\n border-radius: 4px;\n font-size: 16px;\n color: #333;\n background-color: #fff;\n appearance: auto;\n}\n", "import clsx from 'clsx';\nimport type { TitleProps } from '~/components/Title/types';\nimport styles from './Title.module.css';\n\nexport const Title = ({ className, level, style, text }: TitleProps) => {\n const combinedClassName = clsx(styles['rebuy-title'], className);\n\n switch (level) {\n case 'h1':\n return (\n <h1 className={combinedClassName} style={style}>\n {text}\n </h1>\n );\n default:\n case 'h2':\n return (\n <h2 className={combinedClassName} style={style}>\n {text}\n </h2>\n );\n case 'h3':\n return (\n <h3 className={combinedClassName} style={style}>\n {text}\n </h3>\n );\n case 'h4':\n return (\n <h4 className={combinedClassName} style={style}>\n {text}\n </h4>\n );\n case 'h5':\n return (\n <h5 className={combinedClassName} style={style}>\n {text}\n </h5>\n );\n case 'h6':\n return (\n <h6 className={combinedClassName} style={style}>\n {text}\n </h6>\n );\n }\n};\n", ".rebuy-title {\n font-family: var(--rb-font-family-base);\n font-weight: var(--rb-font-weight-bold);\n line-height: var(--rb-line-height-tight);\n color: var(--rb-color-text-default);\n margin: 0;\n padding: 0;\n}\n", "import clsx from 'clsx';\nimport { useEffect, useState } from 'react';\nimport type { VariantSelectProps } from '~/components/VariantSelect/types';\nimport type { RebuyProduct } from '~/types/rebuyCustom';\nimport styles from './VariantSelect.module.css';\n\nexport const VariantSelect = ({ handleSelectedVariant, product, selectedId, style = 'select' }: VariantSelectProps) => {\n const [selectedVariantId, setSelectedVariantId] = useState(selectedId || product.variants.nodes[0]?.id);\n\n useEffect(() => {\n if (selectedId && selectedId !== selectedVariantId) {\n setSelectedVariantId(selectedId);\n }\n }, [selectedId, selectedVariantId]);\n\n const getOptionsLabel = (currentProduct: RebuyProduct) => {\n const firstVariantOptions = currentProduct.variants.nodes[0]?.selectedOptions;\n\n if (!firstVariantOptions || firstVariantOptions.length === 0) {\n return 'Options';\n }\n\n return firstVariantOptions.map((option) => option.name).join(' / ');\n };\n\n const handleLocalVariantChange = (variantId: string) => {\n setSelectedVariantId(variantId);\n handleSelectedVariant(product, variantId);\n };\n\n if (!product?.variants?.nodes || product.variants.nodes.length <= 1) {\n return null;\n }\n\n return (\n <div className={styles['rebuy-variant__container']}>\n {style === 'select' ? (\n <select\n aria-label=\"Select variant\"\n className={styles['rebuy-variant__select']}\n onChange={(e) => handleLocalVariantChange(e.target.value)}\n value={selectedVariantId}\n >\n <optgroup\n className={styles['rebuy-variant__select-optgroup-label']}\n label={getOptionsLabel(product)}\n >\n {product.variants.nodes.map(({ id, title }) => (\n <option\n className={styles['rebuy-variant__select-option']}\n key={`${id}-variant-option`}\n value={id}\n >\n {title}\n </option>\n ))}\n </optgroup>\n </select>\n ) : (\n <div className={styles['rebuy-variant__buttons']}>\n {product.variants.nodes.map(({ id, title }) => (\n <button\n aria-pressed={id === selectedVariantId}\n className={clsx(\n styles['rebuy-variant__button'],\n id === selectedVariantId && styles['rebuy-variant__button--selected']\n )}\n key={`${id}-variant-button`}\n onClick={() => handleLocalVariantChange(id)}\n type=\"button\"\n >\n {title}\n </button>\n ))}\n </div>\n )}\n </div>\n );\n};\n", ".rebuy-variant__container {\n position: relative;\n}\n\n.rebuy-variant__select {\n width: 100%;\n padding: var(--rb-spacing-unit-2x) var(--rb-spacing-unit-5x) var(--rb-spacing-unit-2x) var(--rb-spacing-unit-3x);\n height: var(--rb-size-input-height-medium);\n border: var(--rb-border-width-input) solid var(--rb-color-border-input-default);\n border-radius: var(--rb-border-radius-input);\n font-size: var(--rb-font-size-medium);\n color: var(--rb-color-text-input);\n background-color: var(--rb-color-background-input);\n cursor: pointer;\n transition:\n border-color 0.2s ease,\n box-shadow 0.2s ease;\n}\n\n.rebuy-variant__select:hover {\n border-color: var(--rb-color-border-input-hover, var(--rb-color-border-input-focus));\n}\n\n.rebuy-variant__select:focus {\n outline: none;\n border-color: var(--rb-color-border-input-focus);\n box-shadow: 0 0 0 var(--rb-focus-ring-width) var(--rb-color-focus-ring-alpha-25);\n}\n\n.rebuy-variant__select:disabled {\n color: var(--rb-color-text-disabled);\n background-color: var(--rb-color-background-disabled);\n border-color: var(--rb-color-border-disabled);\n cursor: not-allowed;\n opacity: var(--rb-opacity-disabled);\n}\n\n.rebuy-variant__select-optgroup-label {\n font-style: italic;\n color: var(--rb-color-text-muted);\n}\n\n.rebuy-variant__select-option {\n color: var(--rb-color-text-input);\n background-color: var(--rb-color-background-input);\n}\n\n.rebuy-variant__buttons {\n display: flex;\n flex-flow: row wrap;\n gap: 0.5em;\n}\n\n.rebuy-variant__button {\n padding: 8px 16px;\n border-radius: 4px;\n font-size: 16px;\n color: #000;\n background-color: transparent;\n border: 1px solid #ccc;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n min-width: 80px;\n}\n\n.rebuy-variant__button:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.rebuy-variant__button:hover {\n background-color: #f5f5f5;\n}\n\n.rebuy-variant__button--selected {\n background-color: #f0f0f0;\n border-color: #999;\n}\n", "/* stylelint-disable selector-class-pattern */\n\n/* Base Container */\n.rebuy-product-card__container {\n height: 100%;\n background-color: var(--rb-color-background-surface-primary, transparent);\n border-width: var(--rb-border-width-thin, 1px);\n border-style: solid;\n border-color: var(--rb-color-border-default, #f0f4f8);\n border-radius: var(--rb-border-radius-card, 1em);\n padding: var(--rb-spacing-unit-3x, 1em);\n overflow: hidden;\n}\n\n/* Main Card Element */\n.rebuy-product-card {\n display: flex;\n height: 100%;\n gap: var(--rb-spacing-unit-2x, 1em);\n}\n\n/* Content block */\n.rebuy-product-card__content {\n display: flex;\n flex-direction: column;\n gap: var(--rb-spacing-unit-1x, 0.5em);\n}\n\n/* Header */\n.rebuy-product-card__header {\n width: 100%;\n}\n\n/* Grid Layout */\n.rebuy-product-card[data-layout='grid'] {\n flex-direction: column;\n justify-content: space-between;\n max-width: 256px;\n}\n\n.rebuy-product-card[data-layout='grid'] > div:first-child {\n width: 100%;\n}\n\n.rebuy-product-card[data-layout='grid'] .rebuy-product-card__info {\n display: flex;\n flex-direction: column;\n gap: var(--rb-spacing-unit-1x, 0.5em);\n width: 100%;\n align-items: start;\n}\n\n.rebuy-product-card[data-layout='grid'] .rebuy-product-card__content {\n flex: 1;\n}\n\n/* List Layout */\n.rebuy-product-card[data-layout='list'] {\n flex-direction: row;\n align-items: flex-start;\n}\n\n.rebuy-product-card[data-layout='list'] > div:first-child {\n flex: 0 0 40%;\n max-width: 40%;\n}\n\n.rebuy-product-card[data-layout='list'] .rebuy-product-card__info {\n flex: 1;\n padding-left: var(--rb-spacing-unit-3x, 1em);\n display: flex;\n flex-direction: column;\n gap: var(--rb-spacing-unit-1x, 0.5em);\n}\n\n.rebuy-product-card[data-layout='list'] .rebuy-product-card__content {\n flex: 1;\n}\n\n/* Line Layout */\n.rebuy-product-card[data-layout='line'] {\n flex-direction: row;\n align-items: center;\n}\n\n.rebuy-product-card[data-layout='line'] > div:first-child {\n flex: 0 0 25%;\n max-width: 25%;\n}\n\n.rebuy-product-card[data-layout='line'] .rebuy-product-card__info {\n flex: 1;\n display: flex;\n flex-direction: row;\n align-items: center;\n padding-left: var(--rb-spacing-unit-3x, 1em);\n gap: var(--rb-spacing-unit-2x, 1em);\n}\n\n.rebuy-product-card[data-layout='line'] .rebuy-product-card__content {\n flex: 1;\n margin-right: var(--rb-spacing-unit-3x, 1.5em);\n}\n\n/* Actions area */\n.rebuy-product-card__actions {\n width: 100%;\n margin-top: var(--rb-spacing-unit-3x, 1rem);\n display: flex;\n flex-direction: column;\n gap: var(--rb-spacing-unit-1x, 0.5em);\n}\n\n.rebuy-product-card[data-layout='line'] .rebuy-product-card__actions {\n flex: 0 0 auto;\n margin-top: 0;\n align-items: center;\n}\n\n/* Media Link */\n.rebuy-product-card__media-link {\n display: block;\n text-decoration: none;\n border-radius: var(--rb-border-radius-medium, 0.5em);\n overflow: hidden;\n}\n\n.rebuy-product-card[data-layout='grid'] .rebuy-product-card__media-link {\n margin-bottom: var(--rb-spacing-unit-3x, 1em);\n}\n\n.rebuy-product-card[data-layout='list'] .rebuy-product-card__media-link,\n.rebuy-product-card[data-layout='line'] .rebuy-product-card__media-link {\n margin-bottom: 0;\n}\n\n/* Image */\n.rebuy-product-card__image {\n display: block;\n width: 100%;\n height: auto;\n object-fit: cover;\n border-radius: var(--rb-border-radius-medium, 0.5em);\n transition: transform 0.3s ease-out;\n}\n\n@media (width >= 576px) {\n .rebuy-product-card__image {\n max-width: 400px;\n margin-left: auto;\n margin-right: auto;\n }\n}\n\n.rebuy-product-card__media-link:hover .rebuy-product-card__image,\n.rebuy-product-card__media-link:focus .rebuy-product-card__image {\n transform: scale(1.05);\n}\n\n/* Title */\n.rebuy-product-card__title {\n margin: 0;\n}\n\n/* Title Link */\n.rebuy-product-card__title-link {\n text-decoration: none;\n color: var(--rb-color-text-product-title, var(--rb-color-text-default, #000));\n}\n\n.rebuy-product-card__title-link:hover,\n.rebuy-product-card__title-link:focus {\n color: var(--rb-color-text-link-hover, #000);\n text-decoration: underline;\n}\n\n/* Variant select handling */\n.rebuy-product-card__actions-variant-select {\n width: 100%;\n}\n\n/* Hide variant select in line layout */\n.rebuy-product-card__actions-variant-select[data-layout='line'] {\n display: none;\n}\n\n/* Base variant select */\n.rebuy-product-card__variant-select {\n /* Base styles handled by attribute selectors below */\n}\n\n/* Hide variant select in grid/list layouts */\n.rebuy-product-card__variant-select[data-layout='grid'],\n.rebuy-product-card__variant-select[data-layout='list'] {\n display: none;\n}\n\n/* Show variant select in line layout */\n.rebuy-product-card__variant-select[data-layout='line'] {\n margin-top: var(--rb-spacing-unit-2x, 1em);\n}\n\n.rebuy-product-card__actions-quantity,\n.rebuy-product-card__actions-button {\n width: 100%;\n}\n\n/* Vendor */\n.rebuy-product-card__vendor {\n font-size: var(--rb-font-size-small, 0.875em);\n color: var(--rb-color-text-muted, #6b7280);\n}\n\n/* Variant Title */\n.rebuy-product-card__variant-title {\n font-size: var(--rb-font-size-small, 0.875em);\n color: var(--rb-color-text-muted-variant, #666);\n margin-bottom: var(--rb-spacing-unit-half, 0.25em);\n}\n\n/* Product review styles */\n.rebuy-product-card__review {\n display: flex;\n align-items: center;\n margin: var(--rb-spacing-unit-1x, 0.5em) 0;\n}\n\n.rebuy-product-card__star-rating {\n position: relative;\n display: inline-block;\n}\n\n.rebuy-product-card__star-rating-value {\n position: absolute;\n left: -9999px;\n width: 1px;\n height: 1px;\n overflow: hidden;\n}\n\n.rebuy-product-card__star-rating-background {\n display: inline-block;\n width: 80px;\n height: 16px;\n background-image: url(\"data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 0L10.3 5.2H16L11.1 8.5L12.8 14L8 10.5L3.2 14L4.9 8.5L0 5.2H5.7L8 0Z' fill='%23e0e0e0'/%3E%3C/svg%3E\");\n background-repeat: repeat-x;\n background-size: 16px;\n}\n\n.rebuy-product-card__star-rating-foreground {\n position: absolute;\n top: 0;\n left: 0;\n display: inline-block;\n height: 16px;\n background-image: url(\"data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 0L10.3 5.2H16L11.1 8.5L12.8 14L8 10.5L3.2 14L4.9 8.5L0 5.2H5.7L8 0Z' fill='%23FFD700'/%3E%3C/svg%3E\");\n background-repeat: repeat-x;\n background-size: 16px;\n}\n\n.rebuy-product-card__review-count {\n margin-left: var(--rb-spacing-unit-1x, 0.5em);\n font-size: var(--rb-font-size-small, 0.875em);\n color: var(--rb-color-text-muted-review, #666);\n}\n\n.rebuy-product-card__review-count-parenthesis,\n.rebuy-product-card__review-count-number,\n.rebuy-product-card__review-count-label {\n font-size: var(--rb-font-size-extra-small, 0.75em);\n color: var(--rb-color-text-muted-review, #666);\n}\n\n/* Product Description */\n.rebuy-product-card__description {\n font-size: var(--rb-font-size-small, 0.875em);\n line-height: var(--rb-line-height-base, 1.4);\n color: var(--rb-color-text-body, #333);\n margin-top: var(--rb-spacing-unit-1x, 0.5em);\n}\n", "import { ProductCardTitleLevel } from '~/types/common';\n\n// Convert the string header level to enum\nexport const getTitleLevel = (level: string, decreaseLevel: boolean = false): ProductCardTitleLevel => {\n switch (level) {\n case 'h1':\n if (decreaseLevel) {\n return ProductCardTitleLevel.H2;\n }\n\n return ProductCardTitleLevel.H1;\n case 'h2':\n if (decreaseLevel) {\n return ProductCardTitleLevel.H3;\n }\n\n return ProductCardTitleLevel.H2;\n case 'h3':\n if (decreaseLevel) {\n return ProductCardTitleLevel.H4;\n }\n\n return ProductCardTitleLevel.H3;\n case 'h4':\n if (decreaseLevel) {\n return ProductCardTitleLevel.H5;\n }\n\n return ProductCardTitleLevel.H4;\n case 'h5':\n if (decreaseLevel) {\n return ProductCardTitleLevel.H6;\n }\n\n return ProductCardTitleLevel.H5;\n case 'h6':\n if (decreaseLevel) {\n return ProductCardTitleLevel.H6;\n }\n\n return ProductCardTitleLevel.H6;\n default:\n return ProductCardTitleLevel.H2;\n }\n};\n", "/* stylelint-disable */\n\n.container {\n padding: 2rem 1em;\n margin: 1em 0;\n background-color: #f0f4f8;\n border-radius: 1em;\n\n @media (width >= 768px) {\n padding: 4em;\n }\n}\n\n.productGrid {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));\n gap: 2em;\n list-style: none;\n padding: 0;\n margin: 0;\n\n @media (width >= 768px) {\n grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));\n }\n}\n\n.productItem {\n width: 100%;\n}\n", "import { ProductCard } from '~/components/ProductCard';\nimport { Title } from '~/components/Title';\nimport { getTitleLevel } from '~/hooks/titleLevel';\nimport type { RebuyCompleteTheLookProps } from './types';\n\nimport styles from './RebuyCompleteTheLook.module.css';\n\n// Component implementation\nexport const RebuyCompleteTheLook = (props: RebuyCompleteTheLookProps) => {\n const {\n addToCartBtnText = 'Add to cart',\n addToCartCallback,\n customTitle = `These pair with ${props.product?.title}`,\n customTitleLevel = 'h2',\n customTitleStyle,\n products = [],\n } = props;\n\n if (products.length === 0) {\n console.log('RebuyCompleteTheLook: No products found');\n\n return null;\n }\n\n return (\n <section className={styles.container}>\n <Title level={getTitleLevel(customTitleLevel)} style={customTitleStyle} text={customTitle} />\n <ul className={styles.productGrid}>\n {products.map((product) => (\n <li className={styles.productItem} key={product.id}>\n <ProductCard\n addToCartBtnText={addToCartBtnText}\n addToCartCallback={addToCartCallback}\n isHydrogenReact={props.isHydrogenReact}\n product={product}\n productCardTitleLevel={getTitleLevel(customTitleLevel, true)}\n />\n </li>\n ))}\n </ul>\n </section>\n );\n};\n", "import { useCallback, useEffect, useState } from 'react';\n\nimport { AddToCartBtn } from '~/components/AddToCartBtn';\nimport { Title } from '~/components/Title';\nimport { getTitleLevel } from '~/hooks/titleLevel';\nimport { convertToRebuyProduct } from '~/utils/convertToRebuyProduct';\nimport { BundleImages } from '~/widgets/RebuyDynamicBundleProducts/BundleImages';\nimport { BundleSelection } from '~/widgets/RebuyDynamicBundleProducts/BundleSelection';\nimport type { BundleProduct, RebuyDynamicBundleProductsProps } from '~/widgets/RebuyDynamicBundleProducts/types';\nimport { BundlePrice } from './BundlePrice';\nimport styles from './RebuyDynamicBundleProducts.module.css';\n\nexport const RebuyDynamicBundleProducts = (props: RebuyDynamicBundleProductsProps) => {\n const {\n addToCartBtnText = 'Add to cart',\n addToCartCallback,\n customTitle = `These pair with ${props.product?.title}`,\n customTitleLevel = 'h2',\n customTitleStyle,\n isHydrogenReact,\n product,\n products = [],\n } = props;\n const [bundleProducts, setBundleProducts] = useState<BundleProduct[]>([]);\n\n // Initializiation\n useEffect(() => {\n const mainProduct: BundleProduct = convertToRebuyProduct(isHydrogenReact || false, product);\n\n const formattedProducts = products.map((product) => {\n return {\n ...product,\n selected: true,\n selectedVariant: product.variants.nodes[0],\n };\n });\n\n setBundleProducts([mainProduct, ...formattedProducts]);\n }, [product, products, isHydrogenReact]);\n\n const onToggleBundleItem = useCallback(\n (product: BundleProduct) => {\n product.selected = !product.selected;\n\n setBundleProducts([...bundleProducts]);\n },\n [bundleProducts]\n );\n\n const onSelectVariant = useCallback(\n (product: BundleProduct, variant_id: string) => {\n const variant = product.variants.nodes.find(({ id }) => id === variant_id);\n\n if (variant) {\n product.selectedVariant = variant;\n product.selected = variant.availableForSale || false;\n\n setBundleProducts([...bundleProducts]);\n }\n },\n [bundleProducts]\n );\n\n if (products.length === 0) {\n console.log('RebuyDynamicBundleProducts: No products found');\n\n return null;\n }\n\n return (\n <section className={styles.container}>\n <Title level={getTitleLevel(customTitleLevel)} style={customTitleStyle} text={customTitle} />\n <div className={styles.bundleContainer}>\n <BundleImages products={bundleProducts} />\n <BundlePrice products={bundleProducts} />\n\n <div className={styles.addCartBtnContainer}>\n <AddToCartBtn\n addToCartBtnText={addToCartBtnText}\n addToCartCallback={addToCartCallback}\n disabled={bundleProducts.filter((product) => product.selected).length === 0}\n isHydrogenReact={isHydrogenReact}\n selectedVariants={bundleProducts\n .filter((product) => product.selected)\n .map((product) => {\n return product.selectedVariant;\n })}\n />\n </div>\n\n <BundleSelection\n onSelectVariant={onSelectVariant}\n onToggleBundleItem={onToggleBundleItem}\n products={bundleProducts}\n />\n </div>\n </section>\n );\n};\n", "import type { RebuyProductVariant } from '~/types/rebuyCustom';\nimport type { HydrogenProduct } from '~/types/shopify';\n\nexport const convertToRebuyProduct = (isHydrogenReact: boolean, product?: HydrogenProduct) => {\n const mainProductVariants: RebuyProductVariant[] = isHydrogenReact\n ? product?.variants?.nodes?.map((variant) => {\n return {\n ...variant,\n };\n }) || []\n : product?.adjacentVariants.map((variant) => {\n return {\n availableForSale: variant.availableForSale,\n compareAtPriceV2: {\n amount: variant.compareAtPrice?.amount || '',\n currencyCode: variant.compareAtPrice?.currencyCode || 'USD',\n },\n id: variant.id,\n image: {\n altText: variant.image?.altText || '',\n height: variant.image?.height || 100,\n id: variant.image?.id || '',\n url: variant.image?.url || '',\n width: variant.image?.width || 100,\n },\n priceV2: {\n amount: variant.price.amount || '',\n currencyCode: variant.price.currencyCode || 'USD',\n },\n product: {\n handle: product.handle,\n id: product.id,\n title: product.title,\n vendor: product.vendor,\n },\n selectedOptions: variant.selectedOptions,\n sku: variant.sku || '',\n title: variant.title || '',\n };\n }) || [];\n\n return isHydrogenReact\n ? {\n collections: {\n nodes:\n product?.collections.nodes.map((collection) => {\n return {\n handle: collection.handle,\n };\n }) || [],\n },\n compareAtPriceRange: {\n maxVariantCompareAtPrice: null,\n minVariantCompareAtPrice: null,\n },\n description: product?.description || '',\n descriptionHtml: product?.descriptionHtml || '',\n featuredImage: {\n altText: product?.featuredImage?.altText || '',\n height: product?.featuredImage?.height || 100,\n id: product?.featuredImage?.id || '',\n url: product?.featuredImage?.url || '',\n width: product?.featuredImage?.width || 100,\n },\n handle: product?.handle || '',\n id: product?.id || '',\n images: [{ altText: '', height: 100, id: '', url: '', width: 100 }],\n media: [],\n metafields: [],\n options: [],\n priceRange: product?.priceRange || {\n maxVariantPrice: { amount: '0', currencyCode: 'USD' },\n minVariantPrice: { amount: '0', currencyCode: 'USD' },\n },\n selected: true,\n selectedOptions:\n product?.selectedVariant?.selectedOptions?.reduce((acc, option) => {\n return { ...acc, [option.name]: option.value };\n }, {}) || {},\n selectedSellingPlan: {},\n selectedSellingPlanAllocation: {},\n selectedVariant: {\n availableForSale: product?.selectedVariant?.availableForSale || false,\n compareAtPriceV2: {\n amount: product?.selectedVariant?.compareAtPrice?.amount || '',\n currencyCode: product?.selectedVariant?.compareAtPrice?.currencyCode || 'USD',\n },\n id: product?.selectedVariant?.id || '',\n image: {\n altText: product?.selectedVariant?.image?.altText || '',\n height: product?.selectedVariant?.image?.height || 100,\n id: product?.selectedVariant?.image?.id || '',\n url: product?.selectedVariant?.image?.url || '',\n width: product?.selectedVariant?.image?.width || 100,\n },\n priceV2: {\n amount: product?.selectedVariant?.price.amount || '',\n currencyCode: product?.selectedVariant?.price.currencyCode || 'USD',\n },\n product: {\n handle: product?.handle || '',\n id: product?.id || '',\n title: product?.title || '',\n vendor: product?.vendor || '',\n },\n selectedOptions: product?.selectedVariant?.selectedOptions || [],\n sku: product?.selectedVariant?.sku || '',\n title: product?.selectedVariant?.title || '',\n },\n sellingPlanGroups: [],\n seo: {\n description: product?.seo?.description || '',\n title: product?.seo?.title || '',\n },\n title: product?.title || '',\n variants: {\n nodes: mainProductVariants,\n },\n vendor: product?.vendor || '',\n }\n : {\n collections: {\n nodes: [],\n },\n compareAtPriceRange: {\n maxVariantCompareAtPrice: null,\n minVariantCompareAtPrice: null,\n },\n description: product?.description || '',\n descriptionHtml: product?.descriptionHtml || '',\n featuredImage: {\n altText: product?.selectedOrFirstAvailableVariant?.image?.altText || '',\n height: product?.selectedOrFirstAvailableVariant?.image?.height || 100,\n id: product?.selectedOrFirstAvailableVariant?.image?.id || '',\n url: product?.selectedOrFirstAvailableVariant?.image?.url || '',\n width: product?.selectedOrFirstAvailableVariant?.image?.width || 100,\n },\n handle: product?.handle || '',\n id: product?.id || '',\n images: [\n {\n altText: product?.selectedOrFirstAvailableVariant?.image?.altText || '',\n height: product?.selectedOrFirstAvailableVariant?.image?.height || 100,\n id: product?.selectedOrFirstAvailableVariant?.image?.id || '',\n url: product?.selectedOrFirstAvailableVariant?.image?.url || '',\n width: product?.selectedOrFirstAvailableVariant?.image?.width || 100,\n },\n ],\n media: [],\n metafields: [],\n options: [],\n priceRange: product?.priceRange || {\n maxVariantPrice: { amount: '0', currencyCode: 'USD' },\n minVariantPrice: { amount: '0', currencyCode: 'USD' },\n },\n selected: true,\n selectedOptions:\n product?.selectedOrFirstAvailableVariant?.selectedOptions?.reduce((acc, option) => {\n return { ...acc, [option.name]: option.value };\n }, {}) || {},\n selectedSellingPlan: {},\n selectedSellingPlanAllocation: {},\n selectedVariant: {\n availableForSale: product?.selectedOrFirstAvailableVariant?.availableForSale || false,\n compareAtPriceV2: {\n amount: product?.selectedOrFirstAvailableVariant?.compareAtPrice?.amount || '',\n currencyCode: product?.selectedOrFirstAvailableVariant?.compareAtPrice?.currencyCode || 'USD',\n },\n id: product?.selectedOrFirstAvailableVariant?.id || '',\n image: {\n altText: product?.selectedOrFirstAvailableVariant?.image?.altText || '',\n height: product?.selectedOrFirstAvailableVariant?.image?.height || 100,\n id: product?.selectedOrFirstAvailableVariant?.image?.id || '',\n url: product?.selectedOrFirstAvailableVariant?.image?.url || '',\n width: product?.selectedOrFirstAvailableVariant?.image?.width || 100,\n },\n priceV2: {\n amount: product?.selectedOrFirstAvailableVariant?.price.amount || '',\n currencyCode: product?.selectedOrFirstAvailableVariant?.price.currencyCode || 'USD',\n },\n product: {\n handle: product?.handle || '',\n id: product?.id || '',\n title: product?.title || '',\n vendor: product?.vendor || '',\n },\n selectedOptions: product?.selectedOrFirstAvailableVariant?.selectedOptions || [],\n sku: product?.selectedOrFirstAvailableVariant?.sku || '',\n title: product?.selectedOrFirstAvailableVariant?.title || '',\n },\n sellingPlanGroups: [],\n seo: {\n description: null,\n title: null,\n },\n title: product?.title || '',\n variants: {\n nodes: [\n {\n availableForSale: product?.selectedOrFirstAvailableVariant?.availableForSale || false,\n compareAtPriceV2: {\n amount: product?.selectedOrFirstAvailableVariant?.compareAtPrice?.amount || '',\n currencyCode:\n product?.selectedOrFirstAvailableVariant?.compareAtPrice?.currencyCode || 'USD',\n },\n id: product?.selectedOrFirstAvailableVariant?.id || '',\n image: {\n altText: product?.selectedOrFirstAvailableVariant?.image?.altText || '',\n height: product?.selectedOrFirstAvailableVariant?.image?.height || 100,\n id: product?.selectedOrFirstAvailableVariant?.image?.id || '',\n url: product?.selectedOrFirstAvailableVariant?.image?.url || '',\n width: product?.selectedOrFirstAvailableVariant?.image?.width || 100,\n },\n priceV2: {\n amount: product?.selectedOrFirstAvailableVariant?.price.amount || '',\n currencyCode: product?.selectedOrFirstAvailableVariant?.price.currencyCode || 'USD',\n },\n product: {\n handle: product?.handle || '',\n id: product?.id || '',\n title: product?.title || '',\n vendor: product?.vendor || '',\n },\n selectedOptions: product?.selectedOrFirstAvailableVariant?.selectedOptions || [],\n sku: product?.selectedOrFirstAvailableVariant?.sku || '',\n title: product?.selectedOrFirstAvailableVariant?.title || '',\n },\n ...mainProductVariants,\n ],\n },\n vendor: product?.vendor || '',\n };\n};\n", "import { Link } from '@remix-run/react';\nimport { Image } from '@shopify/hydrogen';\nimport { Fragment } from 'react';\n\nimport type { BundleProduct } from '~/widgets/RebuyDynamicBundleProducts/types';\n\nimport styles from './RebuyDynamicBundleProducts.module.css';\n\nexport const BundleImages = ({ products }: { products: BundleProduct[] }) => {\n const selected = products.filter((product) => product.selected);\n\n return (\n <ul className={styles.bundleImages}>\n {products.map((product, index) => {\n const image = product.selectedVariant?.image;\n const productImage = image ? (\n <Image\n alt={image.altText || `Picture of ${product.title}`}\n className={styles.bundleImage}\n data={image}\n height={80}\n title={product.title}\n width={80}\n />\n ) : (\n // No image defined\n product.title\n );\n // Hide delimiter for first selected item\n const showDelimiter = selected[0]?.id !== product.id;\n\n return (\n <Fragment key={product.id + '-BundleImages-' + index}>\n {product.selected && (\n <>\n {showDelimiter && (\n <li className={styles.bundleImageDelimiter}>\n <span>+</span>\n </li>\n )}\n <li className=\"flex items-center\">\n {product.default ? (\n // Already on product page\n productImage\n ) : (\n // Link to product\n <Link title={product.title} to={`/products/${product.handle}`}>\n {productImage}\n </Link>\n )}\n </li>\n </>\n )}\n </Fragment>\n );\n })}\n </ul>\n );\n};\n", "/* stylelint-disable selector-class-pattern */\n\n/* TODO: Update classes to BEM naming convention (rebuy-{block}__{element}--{modifier}) */\n\n/* RebuyDynamicBundleProducts.tsx */\n.container {\n padding: 32px 16px;\n background-color: #f0f4f8;\n border-radius: 16px;\n max-width: 768px;\n margin: 16px 0;\n\n @media (width >= 768px) {\n padding: 64px;\n }\n}\n\n.addCartBtnContainer {\n display: flex;\n justify-content: center;\n}\n\n.addCartBtnContainer form {\n width: 100%;\n}\n\n.bundleContainer {\n display: flex;\n flex-direction: column;\n gap: 16px;\n margin-bottom: 16px;\n}\n\n/* Select.tsx */\n.select {\n width: 100%;\n padding: 8px;\n border: 1px solid #ccc;\n border-radius: 4px;\n font-size: 16px;\n color: #333;\n background-color: #fff;\n\n @media (width >= 768px) {\n width: 60%;\n }\n}\n\n/* BundleSelection.tsx */\n.bundleItemRowContainer {\n margin-bottom: 16px;\n}\n\n.unselected {\n opacity: 0.5;\n}\n\n.bundleItemRow {\n display: flex;\n flex-direction: row;\n gap: 8px;\n align-items: start;\n}\n\n.bundleItemInput {\n flex-grow: 1;\n}\n\n.bundleItemLabel {\n display: flex;\n flex-direction: row;\n gap: 8px;\n cursor: pointer;\n margin-bottom: 8px;\n}\n\n/* BundleImages.tsx */\n.bundleImages {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n margin-bottom: 16px;\n justify-content: center;\n}\n\n.bundleImage {\n animation: fade-in 0.5s ease-in;\n}\n\n@keyframes fade-in {\n from {\n opacity: 0;\n }\n\n to {\n opacity: 1;\n }\n}\n\n.bundleImageDelimiter {\n display: flex;\n align-items: center;\n}\n\n.bundleImageDelimiter span {\n font-weight: 600;\n}\n\n.compareAtPrice {\n text-decoration: line-through;\n opacity: 0.5;\n}\n", "import type { BundleProduct, BundleSelectProps } from '~/widgets/RebuyDynamicBundleProducts/types';\n\nimport styles from './RebuyDynamicBundleProducts.module.css';\n\nexport const Select = ({ onSelectVariant, product }: BundleSelectProps) => {\n const getOptionsLabel = (product: BundleProduct) => {\n const options = product.variants.nodes[0].selectedOptions;\n const optionsFromKeys = options ? Object.keys(options[0]) : [];\n const optionsFromValues = options ? options.map((option) => option.name) : [];\n const useValues = optionsFromKeys.every((key) => ['name', 'value'].includes(key));\n\n // Return delimited label for available option(s) e.g. Color / Size, Scent, etc\n return (useValues ? optionsFromValues : optionsFromKeys).join(' / ');\n };\n\n return (\n product && (\n <select\n aria-label=\"select variant\"\n className={styles.select}\n onChange={(e) => onSelectVariant(product, e.target.value)}\n value={product.selectedVariant.id}\n >\n <optgroup label={getOptionsLabel(product)}>\n {product.variants.nodes.map(({ id, title }) => (\n <option key={id + '-BundleVariant'} value={id}>\n {title}\n </option>\n ))}\n </optgroup>\n </select>\n )\n );\n};\n", "import { RebuyProductPrice } from '~/components/ProductPrice';\nimport { Select } from '~/widgets/RebuyDynamicBundleProducts/Select';\nimport type { BundleSelectionProps } from '~/widgets/RebuyDynamicBundleProducts/types';\n\nimport styles from './RebuyDynamicBundleProducts.module.css';\n\nexport const BundleSelection = ({ onSelectVariant, onToggleBundleItem, products }: BundleSelectionProps) => {\n return (\n <ul>\n {products.map((product, index) => {\n const { availableForSale } = product.selectedVariant;\n const isOutOfStock = !availableForSale;\n\n return (\n <li\n className={`${styles.bundleItemRowContainer} ${!product.selected && styles.unselected}`}\n key={product.id + '-BundleSelection' + index}\n >\n <div className={styles.bundleItemRow}>\n <input\n checked={product.selected && availableForSale}\n className=\"mt-1 rounded-sm accent-black cursor-pointer\"\n disabled={isOutOfStock}\n id={`${product.id}-toggle`}\n onChange={() => onToggleBundleItem(product)}\n type=\"checkbox\"\n value={product.id}\n />\n <div className={styles.bundleItemInput}>\n <label className={styles.bundleItemLabel} htmlFor={`${product.id}-toggle`}>\n {isOutOfStock && <b>SOLD OUT</b>}\n {product.default && <b>This item:</b>}\n {product.title}\n\n <RebuyProductPrice selectedVariant={product.selectedVariant} />\n </label>\n\n {product.variants.nodes.length > 1 && (\n <Select onSelectVariant={onSelectVariant} product={product} />\n )}\n </div>\n </div>\n </li>\n );\n })}\n </ul>\n );\n};\n", "import { Money } from '@shopify/hydrogen';\n\nimport type { CurrencyCode, MoneyV2 } from '@shopify/hydrogen-react/storefront-api-types';\nimport type { BundleProduct } from '~/widgets/RebuyDynamicBundleProducts/types';\nimport styles from './RebuyDynamicBundleProducts.module.css';\n\nexport const BundlePrice = ({ products }: { products: BundleProduct[] }) => {\n const isDisabled = products.filter((product) => product.selected).length < 1;\n\n const totalBundlePrice = () => {\n let total = 0;\n let currencyCode = 'USD' as CurrencyCode;\n\n for (const product of products) {\n if (product.selected && product.selectedVariant) {\n const { priceV2: price } = product.selectedVariant;\n\n total += Number(price?.amount);\n currencyCode = (price?.currencyCode || 'USD') as CurrencyCode;\n }\n }\n\n return {\n amount: String(total),\n currencyCode,\n };\n };\n\n const totalBundleCompareAtPrice = () => {\n let compareAtTotal = 0;\n let currencyCode = 'USD' as CurrencyCode;\n\n for (const product of products) {\n if (product.selected && product.selectedVariant) {\n const { compareAtPriceV2: compareAtPrice, priceV2: price } = product.selectedVariant;\n\n currencyCode = (price?.currencyCode || 'USD') as CurrencyCode;\n compareAtTotal += Number((compareAtPrice || price)?.amount);\n }\n }\n\n return {\n amount: String(compareAtTotal),\n currencyCode,\n };\n };\n const isDiscounted = (\n price: { amount: string; currencyCode: string } | null,\n compareAtPrice: { amount: string; currencyCode: string } | null\n ) => Number(compareAtPrice?.amount) > Number(price?.amount);\n\n const price = totalBundlePrice();\n const compareAtPrice = totalBundleCompareAtPrice();\n\n const CompareAtPrice = ({ data: compareAtPrice }: { data: MoneyV2 | null }) => {\n return (\n compareAtPrice && (\n <Money as=\"span\" className={styles.compareAtPrice} data={compareAtPrice} withoutTrailingZeros />\n )\n );\n };\n\n return (\n products.length > 0 && (\n <div className=\"flex items-center flex-col\">\n {!isDisabled && (\n <p className=\"flex items-center gap-2 mb-2\">\n <span>Total Price:</span>\n <Money as=\"span\" data={price} withoutTrailingZeros />\n {isDiscounted(price, compareAtPrice) && <CompareAtPrice data={compareAtPrice} />}\n </p>\n )}\n </div>\n )\n );\n};\n", "import { Money } from '@shopify/hydrogen-react';\nimport type { CurrencyCode, MoneyV2 } from '@shopify/hydrogen-react/storefront-api-types';\nimport { useCallback, useEffect, useState } from 'react';\n\nimport { AddToCartBtn } from '~/components/AddToCartBtn';\nimport { Title } from '~/components/Title';\nimport { getTitleLevel } from '~/hooks/titleLevel';\nimport type { RebuyProduct } from '~/types/rebuyCustom';\nimport { convertToRebuyProduct } from '~/utils/convertToRebuyProduct';\nimport type { RebuyProductAddOnProps } from '~/widgets/RebuyProductAddOns/types';\nimport { RebuyProductAddOnCard } from './RebuyProductAddOnCard';\nimport styles from './RebuyProductAddOns.module.css';\n\nexport const RebuyProductAddOns = (props: RebuyProductAddOnProps) => {\n const {\n addToCartCallback,\n customTitle = `These pair with ${props.product?.title}`,\n customTitleLevel = 'h2',\n customTitleStyle,\n includeMainProduct = false,\n isHydrogenReact,\n learnMoreText = 'Learn more',\n outOfStockText = 'Out of stock',\n product,\n products = [],\n addToCartBtnText = 'Add to cart',\n subtotalText = 'Add-ons Subtotal: ',\n withProductText = `With ${product?.title}: `,\n } = props;\n\n const [addedItems, setAddedItems] = useState<RebuyProduct[]>(products);\n\n const [subtotalWithProduct, setSubtotalWithProduct] = useState<MoneyV2>();\n const [subtotalWithOutProduct, setSubtotalWithOutProduct] = useState<MoneyV2>();\n\n useEffect(() => {\n let initialTotal = 0;\n let currencyCode = 'USD' as CurrencyCode;\n\n products.map((product) => {\n product.selectedVariant = product.variants.nodes[0];\n product.selected = true;\n\n if (product.selectedVariant?.priceV2) {\n initialTotal += Number(product.selectedVariant.priceV2.amount);\n currencyCode = (product.selectedVariant.priceV2.currencyCode || 'USD') as CurrencyCode;\n }\n });\n\n setSubtotalWithProduct({\n amount: String(initialTotal),\n currencyCode,\n });\n\n setSubtotalWithOutProduct({\n amount: String(\n initialTotal -\n Number(\n isHydrogenReact\n ? product?.selectedVariant?.price.amount\n : product?.selectedOrFirstAvailableVariant?.price.amount\n )\n ),\n currencyCode,\n });\n setAddedItems(products);\n\n if (includeMainProduct) {\n setAddedItems([convertToRebuyProduct(isHydrogenReact || false, product), ...products]);\n } else {\n setAddedItems(products);\n }\n }, [products, product, isHydrogenReact, includeMainProduct]);\n\n const handleChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>, product: RebuyProduct) => {\n const newProducts = [...products];\n const productIndex = newProducts.findIndex((p) => p.id === product.id);\n\n if (productIndex !== -1) {\n newProducts[productIndex] = {\n ...newProducts[productIndex],\n selected: event.target.checked,\n };\n\n product.selected = event.target.checked;\n\n if (event.target.checked) {\n setAddedItems((prev) => [...prev, product]);\n } else {\n setAddedItems((prev) => prev.filter((item) => item.id !== product.id));\n }\n }\n },\n [products]\n );\n\n useEffect(() => {\n let total = 0;\n let currencyCode = 'USD' as CurrencyCode;\n\n addedItems.forEach((item) => {\n if (item.selected && item.selectedVariant?.priceV2) {\n total += Number(item.selectedVariant.priceV2.amount);\n currencyCode = (item.selectedVariant.priceV2.currencyCode || 'USD') as CurrencyCode;\n }\n });\n\n setSubtotalWithProduct({\n amount: String(total),\n currencyCode,\n });\n\n setSubtotalWithOutProduct({\n amount: String(\n total -\n Number(\n isHydrogenReact\n ? product?.selectedVariant?.price.amount\n : product?.selectedOrFirstAvailableVariant?.price.amount\n )\n ),\n currencyCode,\n });\n }, [addedItems, product, isHydrogenReact]);\n\n if (products.length === 0) {\n console.log('RebuyProductAddOns: No products found');\n\n return null;\n }\n\n return (\n <div className={styles.container}>\n <Title level={getTitleLevel(customTitleLevel)} style={customTitleStyle} text={customTitle} />\n <ul className={styles.productAddOnsList}>\n {products.map((product) => (\n <li key={product.id}>\n <RebuyProductAddOnCard\n handleChange={handleChange}\n learnMoreText={learnMoreText}\n outOfStockText={outOfStockText}\n product={product}\n titleLevel={getTitleLevel(customTitleLevel, true)}\n />\n </li>\n ))}\n </ul>\n <div className={styles.productAddOnsFooter}>\n <div className={styles.moneyContainer}>\n {subtotalText}\n {subtotalWithOutProduct && <Money data={subtotalWithOutProduct} withoutTrailingZeros />}\n </div>\n {includeMainProduct && (\n <div className={styles.moneyContainer}>\n {withProductText}\n {subtotalWithProduct && <Money data={subtotalWithProduct} withoutTrailingZeros />}\n </div>\n )}\n <div className={styles.addCartBtnContainer}>\n {includeMainProduct ? (\n <AddToCartBtn\n addToCartBtnText={addToCartBtnText}\n addToCartCallback={addToCartCallback}\n disabled={addedItems.length === 0}\n isHydrogenReact={isHydrogenReact}\n moneyData={subtotalWithProduct}\n selectedVariants={addedItems.map((item) => item.selectedVariant)}\n />\n ) : (\n <AddToCartBtn\n addToCartBtnText={addToCartBtnText}\n addToCartCallback={addToCartCallback}\n disabled={addedItems.length === 0}\n isHydrogenReact={isHydrogenReact}\n moneyData={subtotalWithOutProduct}\n selectedVariants={addedItems.map((item) => item.selectedVariant)}\n />\n )}\n </div>\n </div>\n </div>\n );\n};\n", "import { Link } from '@remix-run/react';\nimport { Image } from '@shopify/hydrogen';\n\nimport { RebuyProductPrice } from '~/components/ProductPrice';\nimport { Title } from '~/components/Title';\nimport type { RebuyProductAddOnCardProps } from './types';\nimport styles from './RebuyProductAddOns.module.css';\n\nexport const RebuyProductAddOnCard = ({\n handleChange,\n learnMoreText,\n outOfStockText,\n product,\n titleLevel,\n}: RebuyProductAddOnCardProps) => {\n const { availableForSale, image } = product.selectedVariant || {};\n\n return (\n <label className={styles.addOnCard} htmlFor={product.id}>\n <div className={styles.addOnCardContent}>\n <input\n checked={Boolean(product.selected)}\n className={styles.addOnCardInput}\n disabled={!product.variants.nodes[0].availableForSale}\n id={product.id}\n name={product.title}\n onChange={(event) => handleChange(event, product)}\n type=\"checkbox\"\n value=\"\"\n />\n <div className={styles.addOnCardContentImage}>\n {image && (\n <Image\n alt={image.altText || `Picture of ${product.title}`}\n data={image}\n height={150}\n width={300}\n />\n )}\n </div>\n\n <div className={styles.addOnCardTextContent}>\n {!availableForSale && <p className={styles.addOnCardOutOfStock}>{outOfStockText}</p>}\n\n <Title level={titleLevel} text={product.title} />\n\n <RebuyProductPrice selectedVariant={product.selectedVariant} />\n <Link className={styles.addOnCardLearnMore} to={`/products/${product.handle}`}>\n {learnMoreText}\n </Link>\n </div>\n </div>\n </label>\n );\n};\n", "/* stylelint-disable selector-class-pattern */\n\n/* TODO: Update classes to BEM naming convention (rebuy-{block}__{element}--{modifier}) */\n.container {\n display: flex;\n flex-direction: column;\n gap: 10px;\n margin: 16px 0;\n background-color: #f0f4f8;\n border-radius: 16px;\n padding: 32px 16px;\n\n @media (width >= 768px) {\n padding: 64px;\n }\n}\n\n.productAddOnsList {\n display: grid;\n grid-template-columns: repeat(1, minmax(0, 1fr));\n gap: 8px;\n\n @media (width >= 768px) {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n }\n\n @media (width >= 1024px) {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n }\n}\n\n.addOnCard {\n cursor: pointer;\n\n &:hover {\n opacity: 0.8;\n }\n}\n\n.addOnCardContent {\n display: flex;\n gap: 8px;\n flex-direction: column;\n position: relative;\n padding: 16px;\n border-radius: 8px;\n border: 2px solid #e2e5ea;\n background-color: #fff;\n}\n\n.addOnCardInput {\n position: absolute;\n top: 10px;\n right: 10px;\n z-index: 1;\n appearance: none;\n border-radius: 50%;\n width: 24px;\n height: 24px;\n background-color: #f0f0f0;\n border: 1px solid #ddd;\n cursor: pointer;\n transition: all 0.2s ease-in-out;\n}\n\n.addOnCardInput:checked {\n background-color: #4a7dff;\n border-color: #4a7dff;\n}\n\n.addOnCardInput:checked::after {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%) rotate(45deg);\n width: 5px;\n height: 10px;\n border: solid white;\n border-width: 0 2px 2px 0;\n margin-top: -1px;\n}\n\n.addOnCardContentImage {\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n margin: 0 auto;\n position: relative;\n}\n\n.addOnCardOutOfStock {\n border-radius: 4px;\n background-color: #e2e5ea;\n font-size: 12px;\n}\n\n.addOnCardTextContent {\n display: flex;\n flex-direction: column;\n}\n\n.addOnCardLearnMore {\n text-decoration: underline;\n color: gray;\n font-size: 14px;\n}\n\n.addCartBtnContainer {\n display: flex;\n justify-content: center;\n padding-top: 16px;\n}\n\n.addCartBtnContainer form {\n width: 100%;\n}\n\n.moneyContainer {\n display: flex;\n align-items: center;\n gap: 8px;\n justify-content: center;\n}\n", "/* stylelint-disable selector-class-pattern */\n\n/* TODO: Update classes to BEM naming convention (rebuy-{block}__{element}--{modifier}) */\n.container {\n padding: 32px 16px;\n background-color: #f0f4f8;\n border-radius: 16px;\n margin: 16px 0;\n\n @media (width >= 768px) {\n padding: 64px;\n }\n}\n\n.productGrid {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));\n gap: 32px;\n list-style: none;\n}\n", "import { ProductCard } from '~/components/ProductCard';\nimport { Title } from '~/components/Title';\nimport { getTitleLevel } from '~/hooks/titleLevel';\nimport type { RebuyProductRecommendationsProps } from './types';\nimport styles from './RebuyProductRecommendations.module.css';\n\nexport const RebuyProductRecommendations = (props: RebuyProductRecommendationsProps) => {\n const {\n addToCartBtnText = 'Add to cart',\n addToCartCallback,\n customTitle = `These pair with ${props.product?.title}`,\n customTitleLevel = 'h2',\n customTitleStyle,\n products = [],\n } = props;\n\n if (products.length === 0) {\n console.log('RebuyProductRecommendations: No products found');\n\n return null;\n }\n\n return (\n <section className={styles.container}>\n <Title level={getTitleLevel(customTitleLevel)} style={customTitleStyle} text={customTitle} />\n <ul className={styles.productGrid}>\n {products.map((product) => (\n <li className={styles.productItem} key={product.id}>\n <ProductCard\n addToCartBtnText={addToCartBtnText}\n addToCartCallback={addToCartCallback}\n isHydrogenReact={props.isHydrogenReact}\n product={product}\n productCardTitleLevel={getTitleLevel(customTitleLevel, true)}\n />\n </li>\n ))}\n </ul>\n </section>\n );\n};\n", "import { RebuyClient } from '@rebuy/rebuy';\nimport * as Utilities from '@rebuy/rebuy/utilities';\nimport { flattenConnection } from '@shopify/hydrogen';\nimport { useContext, useEffect, useMemo, useRef, useState } from 'react';\nimport { Close } from '~/assets/Close';\nimport { useRebuyConfig } from '~/context/RebuyConfigContext';\nimport { RebuyContext } from '~/context/RebuyContext';\nimport { useBreakpoint } from '~/hooks/useBreakpoint';\nimport { usePopupTrigger } from '~/hooks/usePopupTrigger';\nimport type { RebuyProduct } from '~/types/rebuyCustom';\nimport type { RebuyWidgetProps, WidgetSettings } from './types';\nimport { WidgetContent } from './WidgetContent';\n\nimport styles from './RebuyWidget.module.css';\n\nexport const RebuyWidget = (props: RebuyWidgetProps) => {\n const {\n addToCartCallback,\n customTitleLevel = 'h2',\n isHydrogenReact,\n popupTriggerId,\n product,\n productId,\n variant,\n variantId,\n widgetId,\n } = props;\n\n // Get API key and config from the new config context\n const { apiKey: apiKeyFromConfig, loadingStatus: configLoadingStatus, rebuyConfig } = useRebuyConfig();\n\n const [settings, setSettings] = useState<WidgetSettings | null>(null);\n const [loadingSettings, setLoadingSettings] = useState<boolean>(true);\n const [error, setError] = useState<string | null>(null);\n const [showPopup, setShowPopup] = useState<boolean>(false);\n const [popupShownOnce, setPopupShownOnce] = useState<boolean>(false);\n const popupRef = useRef<HTMLDivElement>(null);\n const [Rebuy, setRebuy] = useState<RebuyClient | null>(null);\n\n // Get general context parameters (for things like cart data, customer info, etc.)\n const rebuyGeneralContext = useContext(RebuyContext);\n const generalContextParams = rebuyGeneralContext?.contextParameters;\n\n // Cache key should primarily come from rebuyConfig, with fallback to general context\n const mainCacheKey = rebuyConfig?.shop?.cache_key;\n const generalContextCacheKey = generalContextParams?.cacheKey;\n const cacheKeyToUse = mainCacheKey || generalContextCacheKey || '';\n\n const [initialized, setInitialized] = useState(false);\n const shopifyProductId = product?.id ?? productId ?? null;\n const shopifyVariantId = variant?.id ?? variantId ?? null;\n const [products, setProducts] = useState<RebuyProduct[]>([]);\n\n // Get current breakpoint to check if widget should be displayed\n const currentBreakpoint = useBreakpoint(settings);\n\n // Check if layout style is \"none\" for current breakpoint\n const shouldHideWidget = settings?.layout?.[currentBreakpoint]?.style === 'none';\n\n // Use the custom hook for popup triggers\n usePopupTrigger(settings, popupTriggerId, widgetId, popupShownOnce, showPopup, setShowPopup, setPopupShownOnce);\n\n // Initialize Rebuy API client\n useEffect(() => {\n if (!Rebuy && apiKeyFromConfig && configLoadingStatus === 'success') {\n const client = new RebuyClient(apiKeyFromConfig);\n\n // Set general context parameters if available\n if (generalContextParams) {\n client.setContextParameters(generalContextParams as Record<string, unknown>);\n }\n\n setRebuy(client);\n setInitialized(true);\n }\n }, [Rebuy, apiKeyFromConfig, configLoadingStatus, generalContextParams]);\n\n // Update context parameters whenever they change\n useEffect(() => {\n if (!Rebuy || !generalContextParams) return;\n\n Rebuy.setContextParameters(generalContextParams as Record<string, unknown>);\n }, [Rebuy, generalContextParams]);\n\n // Fetch widget settings\n useEffect(() => {\n // Don't proceed if config is still loading\n if (configLoadingStatus === 'loading') {\n return;\n }\n\n if (!widgetId || !Rebuy || configLoadingStatus !== 'success') {\n if (!widgetId && !loadingSettings && configLoadingStatus === 'idle') {\n setError('Widget ID is missing.');\n } else if (!loadingSettings && configLoadingStatus === 'error') {\n setError('Rebuy configuration failed to load.');\n } else if (!loadingSettings && apiKeyFromConfig && !Rebuy) {\n setError('Rebuy client not initialized.');\n } else if (!apiKeyFromConfig && !loadingSettings && configLoadingStatus === 'success') {\n setError('Rebuy API Key is missing.');\n }\n\n if (!loadingSettings) setLoadingSettings(false);\n\n return;\n }\n\n const fetchSettings = async () => {\n setLoadingSettings(true);\n setError(null);\n try {\n const settingsParams: Record<string, unknown> = { id: widgetId };\n\n if (cacheKeyToUse) {\n settingsParams.cache_key = cacheKeyToUse;\n }\n\n const settingsResponse = (await Rebuy.getShieldedAsset('/api/v1/widgets/settings', settingsParams)) as {\n data: WidgetSettings;\n };\n const fetchedWidgetSettings = settingsResponse?.data;\n\n if (\n !fetchedWidgetSettings ||\n typeof fetchedWidgetSettings.endpoint !== 'string' ||\n fetchedWidgetSettings.endpoint.trim() === ''\n ) {\n throw new Error('Received invalid settings data: endpoint is missing or invalid.');\n }\n setSettings({\n ...fetchedWidgetSettings,\n hide_quantity_selector: fetchedWidgetSettings.hide_quantity_selector ?? false,\n } as WidgetSettings);\n } catch (e) {\n console.error(`[RebuyCrossSell] Error fetching widget settings for ID ${widgetId}:`, e);\n setError(e instanceof Error ? e.message : 'Failed to load widget configuration.');\n setSettings(null);\n } finally {\n setLoadingSettings(false);\n }\n };\n fetchSettings();\n }, [widgetId, Rebuy, configLoadingStatus, apiKeyFromConfig, cacheKeyToUse]);\n\n // Memoize request object on prop changes (e.g. product)\n const request = useMemo(() => {\n const request = {\n endpoint: settings?.endpoint || '/api/v1/products/recommended',\n params: {} as Record<string, string | number>, // Keeping this object generic to allow for custom endpoints\n };\n\n if (shopifyProductId) {\n request.params.shopify_product_ids = Utilities.getIdFromGraphUrl(shopifyProductId, 'Product');\n }\n\n if (shopifyVariantId) {\n request.params.shopify_variant_ids = Utilities.getIdFromGraphUrl(shopifyVariantId, 'ProductVariant');\n }\n\n if (settings?.limit) {\n request.params.limit = settings.limit;\n }\n\n return request;\n }, [settings, shopifyProductId, shopifyVariantId]);\n\n // Update product recommendations on cart or request change\n useEffect(() => {\n let isMounted = true;\n\n if (!Rebuy || !initialized || !settings || configLoadingStatus !== 'success') return;\n\n const fetchData = async () => {\n try {\n // Copy params to avoid mutation\n const params: Record<string, unknown> = { ...request.params };\n\n // Ensure we have the cache key\n if (cacheKeyToUse) {\n params.cache_key = cacheKeyToUse;\n }\n\n // Add a uuid for cache busting\n params.uuid = crypto.randomUUID?.() || Math.random().toString(36).substring(2);\n\n // Make sure API key is included\n if (apiKeyFromConfig) {\n params.key = apiKeyFromConfig;\n }\n\n // Fix endpoint if needed\n let endpointToUse = request.endpoint;\n\n if (endpointToUse && endpointToUse.startsWith('/') && !endpointToUse.startsWith('/api/v1/')) {\n if (endpointToUse.startsWith('/custom') || endpointToUse.startsWith('/rules')) {\n endpointToUse = `/api/v1${endpointToUse}`;\n }\n }\n\n const { data } = (await Rebuy.getStorefrontData(endpointToUse, params)) as {\n data: RebuyProduct[];\n };\n\n // Set state only if component is still mounted\n if (isMounted) {\n setProducts(\n Array.isArray(data)\n ? data.map((product) => ({\n ...product,\n variants: {\n nodes: product.variants ? flattenConnection(product.variants) : [],\n },\n }))\n : []\n );\n }\n } catch (e) {\n console.error(`Error fetching products for widget ID ${widgetId}:`, e);\n\n if (isMounted) {\n setProducts([]);\n setError(e instanceof Error ? e.message : 'Failed to load products.');\n }\n }\n };\n\n fetchData();\n\n return () => {\n isMounted = false;\n };\n }, [\n Rebuy,\n initialized,\n request,\n generalContextParams,\n widgetId,\n settings,\n configLoadingStatus,\n apiKeyFromConfig,\n cacheKeyToUse,\n ]);\n\n // Handle click outside popup to close\n useEffect(() => {\n if (!showPopup) return;\n\n const handleClickOutside = (event: MouseEvent) => {\n if (popupRef.current && !popupRef.current.contains(event.target as Node)) {\n setShowPopup(false);\n }\n };\n\n document.addEventListener('mousedown', handleClickOutside);\n\n return () => {\n document.removeEventListener('mousedown', handleClickOutside);\n };\n }, [showPopup]);\n\n const closePopup = () => {\n setShowPopup(false);\n };\n\n // Don't render anything if config is still loading\n if (configLoadingStatus === 'loading') {\n return null;\n }\n\n // Don't render if config failed to load\n if (configLoadingStatus === 'error') {\n console.error('Rebuy configuration failed to load');\n\n return null;\n }\n\n if (products?.length === 0 && settings && !loadingSettings) {\n console.log('No products to render for widgetId:', widgetId);\n\n return null;\n }\n\n if (error) {\n console.error('Error:', error);\n\n return null;\n }\n\n // If layout style is \"none\" for current breakpoint, don't render anything\n if (settings && !loadingSettings && shouldHideWidget) {\n return null;\n }\n\n return (\n <>\n {products && settings && !loadingSettings && (\n <div className={`${styles['rebuy-widget__container']}`} id={`rebuy-widget-${widgetId}`}>\n {settings?.display_type === 'popup' &&\n (settings.popup_trigger !== 'add_to_cart' ||\n (settings.popup_trigger === 'add_to_cart' && popupTriggerId)) ? (\n <div>\n {showPopup && (\n <div className={styles['rebuy-widget__popup-overlay']}>\n <div className={styles['rebuy-widget__popup-content']} ref={popupRef}>\n <div className={styles['rebuy-widget__content']}>\n <button\n aria-label=\"close modal\"\n className={styles['rebuy-widget__modal-close']}\n onClick={closePopup}\n >\n <Close />\n </button>\n <WidgetContent\n addToCartCallback={() => {\n addToCartCallback?.();\n // Set timeout is required: Do not touch\n setTimeout(() => {\n closePopup();\n }, 0);\n }}\n customTitleLevel={customTitleLevel}\n isHydrogenReact={isHydrogenReact}\n isInPopup={settings?.display_type === 'popup'}\n onDismiss={closePopup}\n products={products}\n settings={settings}\n />\n </div>\n </div>\n </div>\n )}\n </div>\n ) : (\n <div className={styles['rebuy-widget__content']}>\n <WidgetContent\n addToCartCallback={addToCartCallback}\n customTitleLevel={customTitleLevel}\n isHydrogenReact={isHydrogenReact}\n isInPopup={settings?.display_type === 'popup'}\n products={products}\n settings={settings}\n />\n </div>\n )}\n </div>\n )}\n </>\n );\n};\n", "export const Close = () => {\n return (\n <svg height=\"1em\" viewBox=\"0 0 352 512\" width=\"1em\">\n <path d=\"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.19 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.19 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z\" />\n </svg>\n );\n};\n", "import { useEffect, useState } from 'react';\nimport type { WidgetSettings } from '~/widgets/RebuyWidget/types';\n\ntype Breakpoint = 'small' | 'medium' | 'large';\n\nexport const useBreakpoint = (settings: WidgetSettings | null): Breakpoint => {\n const [breakpoint, setBreakpoint] = useState<Breakpoint>('medium');\n\n useEffect(() => {\n if (!settings?.breakpoints) return;\n\n const handleResize = () => {\n const width = window.innerWidth;\n\n if (width <= settings.breakpoints.medium.max) {\n if (width >= settings.breakpoints.medium.min) {\n setBreakpoint('medium');\n } else {\n setBreakpoint('small');\n }\n } else {\n setBreakpoint('large');\n }\n };\n\n // Set initial breakpoint\n handleResize();\n\n // Debounce configuration\n const debounceDelay = 150; // ms\n let timeoutId: ReturnType<typeof setTimeout>;\n\n // Debounced resize handler\n const debouncedHandleResize = () => {\n clearTimeout(timeoutId);\n timeoutId = setTimeout(handleResize, debounceDelay);\n };\n\n // Add resize listener with debounce\n window.addEventListener('resize', debouncedHandleResize);\n\n // Clean up\n return () => {\n window.removeEventListener('resize', debouncedHandleResize);\n clearTimeout(timeoutId);\n };\n }, [settings]);\n\n return breakpoint;\n};\n", "import { useCallback, useEffect } from 'react';\nimport type { WidgetSettings } from '~/widgets/RebuyWidget/types';\n\nexport const usePopupTrigger = (\n settings: WidgetSettings | null,\n popupTriggerId: string | undefined,\n widgetId: string,\n popupShownOnce: boolean,\n showPopup: boolean,\n setShowPopup: (show: boolean) => void,\n setPopupShownOnce: (shown: boolean) => void\n) => {\n const delayInMs = settings?.display_type === 'popup' ? (settings?.popup_delay || 0) * 1000 : 0;\n const popupTrigger = settings?.popup_trigger;\n\n const showPopupWithDelay = useCallback(() => {\n if (!settings || settings.display_type !== 'popup') return;\n\n setTimeout(() => {\n setShowPopup(true);\n setPopupShownOnce(true);\n }, delayInMs);\n }, [delayInMs, setShowPopup, setPopupShownOnce, settings]);\n\n // Handle load trigger\n useEffect(() => {\n if (!settings || settings.display_type !== 'popup' || popupTrigger !== 'load' || popupShownOnce) return;\n\n const timer = setTimeout(() => {\n setShowPopup(true);\n setPopupShownOnce(true);\n }, delayInMs);\n\n return () => clearTimeout(timer);\n }, [popupTrigger, popupShownOnce, delayInMs, setShowPopup, setPopupShownOnce, settings]);\n\n // Handle add_to_cart trigger\n useEffect(() => {\n if (!settings || settings.display_type !== 'popup' || popupTrigger !== 'add_to_cart' || !popupTriggerId) return;\n\n const selector = `#${popupTriggerId}`;\n const handleCartAdd = () => {\n if (!showPopup) {\n showPopupWithDelay();\n }\n };\n\n // Setup a mutation observer to watch for the element if it's not immediately available\n const observer = new MutationObserver(() => {\n const elements = document.querySelectorAll(selector);\n\n if (elements.length) {\n elements.forEach((el) => {\n el.addEventListener('click', handleCartAdd);\n });\n observer.disconnect();\n }\n });\n\n // First check if element already exists\n const elements = document.querySelectorAll(selector);\n\n if (elements.length) {\n elements.forEach((el) => {\n el.addEventListener('click', handleCartAdd);\n });\n } else {\n // If not, start observing\n observer.observe(document.body, { childList: true, subtree: true });\n }\n\n return () => {\n observer.disconnect();\n document.querySelectorAll(selector).forEach((el) => {\n el.removeEventListener('click', handleCartAdd);\n });\n };\n }, [popupTrigger, popupTriggerId, showPopup, showPopupWithDelay, settings]);\n\n // Handle form submit trigger\n useEffect(() => {\n if (!settings || settings.display_type !== 'popup' || popupTrigger !== 'submit') return;\n\n const selector = 'form';\n const handleSubmit = () => {\n showPopupWithDelay();\n };\n\n const forms = document.querySelectorAll(selector);\n forms.forEach((form) => {\n form.addEventListener('submit', handleSubmit);\n });\n\n return () => {\n forms.forEach((form) => {\n form.removeEventListener('submit', handleSubmit);\n });\n };\n }, [popupTrigger, showPopupWithDelay, settings]);\n\n // Handle exit intent trigger\n useEffect(() => {\n if (!settings || settings.display_type !== 'popup' || popupTrigger !== 'exit') return;\n\n const handleExitIntent = (e: MouseEvent) => {\n if (e.clientY <= 0 && !popupShownOnce) {\n showPopupWithDelay();\n }\n };\n\n const handleVisibilityChange = () => {\n if (document.visibilityState === 'hidden' && !popupShownOnce) {\n const shouldShowOnFocus = true;\n localStorage.setItem(`rebuy-popup-pending-${widgetId}`, shouldShowOnFocus.toString());\n } else if (document.visibilityState === 'visible') {\n const pendingPopup = localStorage.getItem(`rebuy-popup-pending-${widgetId}`);\n\n if (pendingPopup === 'true' && !popupShownOnce) {\n showPopupWithDelay();\n localStorage.removeItem(`rebuy-popup-pending-${widgetId}`);\n }\n }\n };\n\n document.addEventListener('mouseleave', handleExitIntent);\n document.addEventListener('visibilitychange', handleVisibilityChange);\n\n // Check visibility state on mount\n if (document.visibilityState === 'visible') {\n const pendingPopup = localStorage.getItem(`rebuy-popup-pending-${widgetId}`);\n\n if (pendingPopup === 'true' && !popupShownOnce) {\n showPopupWithDelay();\n localStorage.removeItem(`rebuy-popup-pending-${widgetId}`);\n }\n }\n\n return () => {\n document.removeEventListener('mouseleave', handleExitIntent);\n document.removeEventListener('visibilitychange', handleVisibilityChange);\n };\n }, [popupTrigger, popupShownOnce, showPopupWithDelay, widgetId, settings]);\n};\n", "import { useEffect, useState } from 'react';\nimport { ProductCard } from '~/components/ProductCard';\nimport type { ProductCardSettings } from '~/components/ProductCard/types';\nimport type { ProductCardTitleLevel } from '~/types/common';\nimport type { RebuyProduct } from '~/types/rebuyCustom';\nimport styles from './ProductCarousel.module.css';\n\ntype ProductCarouselProps = {\n addToCartBtnText?: string;\n addToCartCallback?: () => void;\n columns: number;\n isHydrogenReact?: boolean;\n productCardTitleLevel: ProductCardTitleLevel;\n products: RebuyProduct[];\n settings: ProductCardSettings;\n showPagination?: boolean;\n};\n\nexport const ProductCarousel = ({\n addToCartBtnText,\n addToCartCallback,\n columns,\n isHydrogenReact,\n productCardTitleLevel,\n products,\n settings,\n showPagination = true,\n}: ProductCarouselProps) => {\n const [currentSlide, setCurrentSlide] = useState(0);\n const [totalSlides, setTotalSlides] = useState(0);\n const [repeatedProducts, setRepeatedProducts] = useState<RebuyProduct[]>([]);\n\n // Create an array of repeated products to ensure all slides are fully populated\n useEffect(() => {\n if (products.length === 0) {\n setRepeatedProducts([]);\n\n return;\n }\n\n const productsNeeded = Math.ceil(products.length / columns) * columns;\n let repeated: RebuyProduct[] = [...products];\n\n while (repeated.length < productsNeeded) {\n const remaining = productsNeeded - repeated.length;\n repeated = [...repeated, ...products.slice(0, remaining)];\n }\n\n setRepeatedProducts(repeated);\n }, [products, columns]);\n\n // Calculate total number of slides based on repeated products and columns\n useEffect(() => {\n if (repeatedProducts.length && columns) {\n setTotalSlides(Math.ceil(repeatedProducts.length / columns));\n }\n }, [repeatedProducts.length, columns]);\n\n const nextSlide = () => {\n setCurrentSlide((prev) => (prev + 1) % totalSlides);\n };\n\n const prevSlide = () => {\n setCurrentSlide((prev) => (prev - 1 + totalSlides) % totalSlides);\n };\n\n const goToSlide = (slideIndex: number) => {\n setCurrentSlide(slideIndex);\n };\n\n // Group products into slides based on column count\n const slides = [];\n for (let i = 0; i < repeatedProducts.length; i += columns) {\n slides.push(repeatedProducts.slice(i, i + columns));\n }\n\n return (\n <div className={styles['rebuy-carousel']}>\n <div\n className={styles['rebuy-carousel__container']}\n style={{ transform: `translateX(-${currentSlide * 100}%)` }}\n >\n {slides.map((slideProducts, index) => (\n <div className={styles['rebuy-carousel__slide']} key={index}>\n <div className={styles['rebuy-carousel__grid']} data-columns={columns}>\n {slideProducts.map((product, productIndex) => (\n <ProductCard\n addToCartBtnText={addToCartBtnText}\n addToCartCallback={addToCartCallback}\n isHydrogenReact={isHydrogenReact}\n key={`${product.id}-${index}-${productIndex}`}\n product={product}\n productCardTitleLevel={productCardTitleLevel}\n settings={settings}\n />\n ))}\n </div>\n </div>\n ))}\n </div>\n\n {totalSlides > 1 && (\n <div className={styles['rebuy-carousel__controls']}>\n <button className={styles['rebuy-carousel__prev']} onClick={prevSlide} type=\"button\">\n \u2190\n </button>\n <button className={styles['rebuy-carousel__next']} onClick={nextSlide} type=\"button\">\n \u2192\n </button>\n </div>\n )}\n\n {showPagination && totalSlides > 1 && (\n <div className={styles['rebuy-carousel__pagination']}>\n {Array.from({ length: totalSlides }).map((_, index) => (\n <button\n className={styles['rebuy-carousel__dot']}\n data-active={index === currentSlide ? 'true' : 'false'}\n key={index}\n onClick={() => goToSlide(index)}\n type=\"button\"\n />\n ))}\n </div>\n )}\n </div>\n );\n};\n", "/* Carousel Styling */\n.rebuy-carousel {\n position: relative;\n overflow: hidden;\n width: 100%;\n}\n\n.rebuy-carousel__container {\n display: flex;\n transition: transform 0.3s ease;\n}\n\n.rebuy-carousel__slide {\n flex: 0 0 100%;\n}\n\n.rebuy-carousel__controls {\n display: flex;\n justify-content: center;\n gap: 1em;\n margin-top: 1em;\n}\n\n.rebuy-carousel__prev,\n.rebuy-carousel__next {\n background-color: #f5f5f5;\n border: none;\n border-radius: 50%;\n width: 2.5em;\n height: 2.5em;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n color: #333;\n font-size: 1.2em;\n}\n\n.rebuy-carousel__prev:hover,\n.rebuy-carousel__next:hover {\n background-color: #e0e0e0;\n}\n\n.rebuy-carousel__pagination {\n display: flex;\n justify-content: center;\n gap: 0.5em;\n margin-top: 1em;\n}\n\n.rebuy-carousel__dot {\n width: 0.75em;\n height: 0.75em;\n border-radius: 50%;\n background-color: #ccc;\n cursor: pointer;\n border: none;\n padding: 0;\n}\n\n.rebuy-carousel__dot[data-active='true'] {\n background-color: #333;\n}\n\n/* Hide empty carousel */\n.rebuy-carousel:empty {\n display: none;\n}\n\n/* Need to include these for the grid inside carousel slides */\n.rebuy-carousel__grid {\n display: flex;\n flex-wrap: wrap;\n gap: 1.5em;\n width: 100%;\n}\n\n.rebuy-carousel__grid[data-columns='1'] > div {\n flex: 0 0 100%;\n}\n\n.rebuy-carousel__grid[data-columns='2'] > div {\n flex: 0 0 calc(50% - 0.75em);\n}\n\n.rebuy-carousel__grid[data-columns='3'] > div {\n flex: 0 0 calc(33.33% - 1em);\n}\n\n.rebuy-carousel__grid[data-columns='4'] > div {\n flex: 0 0 calc(25% - 1.125em);\n}\n\n.rebuy-carousel__grid[data-columns='5'] > div {\n flex: 0 0 calc(20% - 1.2em);\n}\n\n.rebuy-carousel__grid[data-columns='6'] > div {\n flex: 0 0 calc(16.66% - 1.25em);\n}\n", "import { useCallback, useEffect, useState } from 'react';\nimport type { TimerProps } from './types';\nimport styles from './Timer.module.css';\n\nexport const Timer = ({ action, durationMinutes, durationSeconds, isPopup = false, onDismiss, title }: TimerProps) => {\n // Calculate total seconds from minutes and seconds\n const initialTotalSeconds = (durationMinutes || 0) * 60 + (durationSeconds || 0);\n const [totalSeconds, setTotalSeconds] = useState(initialTotalSeconds);\n const [timerActive, setTimerActive] = useState(true);\n\n // Format remaining time into minutes and seconds\n const minutes = Math.floor(totalSeconds / 60);\n const seconds = totalSeconds % 60;\n\n const formattedMinutes = String(minutes).padStart(2, '0');\n const formattedSeconds = String(seconds).padStart(2, '0');\n\n // Handle the action when the timer ends\n const handleTimerEnd = useCallback(() => {\n setTimerActive(false);\n\n switch (action) {\n case 'dismiss':\n if (isPopup && onDismiss) {\n onDismiss();\n }\n break;\n case 'checkout':\n window.location.href = '/checkout';\n break;\n case 'cart':\n window.location.href = '/cart';\n break;\n case 'stop':\n default:\n // Just stop the timer, which we've already done\n break;\n }\n }, [action, isPopup, onDismiss]);\n\n useEffect(() => {\n // Only proceed if the timer is active\n if (!timerActive) return;\n\n // Create interval to count down\n const interval = setInterval(() => {\n setTotalSeconds((prevSeconds: number) => {\n // If we're at zero, clear the interval and handle the timer action\n if (prevSeconds <= 0) {\n clearInterval(interval);\n handleTimerEnd();\n\n return 0;\n }\n\n return prevSeconds - 1;\n });\n }, 1000);\n\n // Clean up the interval\n return () => clearInterval(interval);\n }, [timerActive, handleTimerEnd]);\n\n const isUrgent = totalSeconds < 10;\n\n return (\n <div className={styles['rebuy-timer__container']}>\n <p className={styles['rebuy-timer__text']}>\n <span className={styles['rebuy-timer__title']}>{title}</span>\n <span\n className={`${styles['rebuy-timer__display']} ${isUrgent ? styles['rebuy-timer__display--urgent'] : ''}`}\n >\n <span className={styles['rebuy-timer__minutes']}>{formattedMinutes}</span>\n <span className={styles['rebuy-timer__separator']}>:</span>\n <span className={styles['rebuy-timer__seconds']}>{formattedSeconds}</span>\n </span>\n </p>\n </div>\n );\n};\n", ".rebuy-timer__container {\n margin: 0 auto;\n padding: 10px;\n background-color: #f8f8f8;\n border-radius: 4px;\n width: 80%;\n}\n\n.rebuy-timer__text {\n font-size: 16px;\n display: flex;\n gap: 0.5em;\n justify-content: center;\n align-items: center;\n margin: 0 auto;\n flex-wrap: wrap;\n text-align: center;\n}\n\n.rebuy-timer__title {\n font-weight: 500;\n}\n\n.rebuy-timer__display {\n font-weight: 700;\n font-size: 18px;\n font-family: monospace;\n color: #d9534f;\n white-space: nowrap;\n}\n\n/* BEM modifier for urgent state instead of data attribute */\n.rebuy-timer__display--urgent {\n animation: pulse 1s infinite;\n}\n\n.rebuy-timer__minutes,\n.rebuy-timer__seconds {\n display: inline-block;\n min-width: 24px;\n text-align: center;\n}\n\n.rebuy-timer__separator {\n margin: 0 2px;\n}\n\n/* Animation for when timer is getting close to zero (less than 10 seconds) */\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n\n 50% {\n opacity: 0.5;\n }\n\n 100% {\n opacity: 1;\n }\n}\n\n/* Media query for small screens */\n@media (width <= 576px) {\n .rebuy-timer__text {\n flex-direction: column;\n gap: 0.25em;\n }\n\n .rebuy-timer__display {\n margin-top: 0.25em;\n }\n}\n", ".rebuy-widget__container {\n width: 100%;\n}\n\n.rebuy-widget__popup-overlay {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgb(0 0 0 / 50%);\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 9999;\n}\n\n.rebuy-widget__popup-content {\n background-color: white;\n border-radius: 8px;\n max-width: 90%;\n max-height: 90vh;\n overflow-y: auto;\n position: relative;\n box-shadow: 0 4px 20px rgb(0 0 0 / 15%);\n}\n\n.rebuy-widget__content {\n padding: 2em;\n}\n\n.rebuy-widget__inner-content {\n display: flex;\n flex-direction: column;\n gap: 0.5em;\n}\n\n.rebuy-widget__description {\n text-align: center;\n}\n\n.rebuy-widget__modal-close {\n position: absolute;\n top: 1em;\n right: 1em;\n background: transparent;\n border: none;\n font-size: 1.5em;\n cursor: pointer;\n z-index: 1;\n color: #333;\n width: 2em;\n height: 2em;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n}\n\n.rebuy-widget__modal-close:hover {\n background-color: rgb(0 0 0 / 5%);\n}\n\n/* Responsive layout styles */\n.rebuy-widget__product-grid {\n display: flex;\n flex-wrap: wrap;\n gap: 1.5em;\n width: 100%;\n}\n\n/* Grid column layouts */\n.rebuy-widget__product-grid[data-columns='1'] > div {\n flex: 0 0 100%;\n}\n\n.rebuy-widget__product-grid[data-columns='2'] > div {\n flex: 0 0 calc(50% - 0.75em);\n}\n\n.rebuy-widget__product-grid[data-columns='3'] > div {\n flex: 0 0 calc(33.33% - 1em);\n}\n\n.rebuy-widget__product-grid[data-columns='4'] > div {\n flex: 0 0 calc(25% - 1.125em);\n}\n\n.rebuy-widget__product-grid[data-columns='5'] > div {\n flex: 0 0 calc(20% - 1.2em);\n}\n\n.rebuy-widget__product-grid[data-columns='6'] > div {\n flex: 0 0 calc(16.66% - 1.25em);\n}\n\n/* Hide empty sections */\n.rebuy-widget__product-grid:empty {\n display: none;\n}\n", "import { ProductCard } from '~/components/ProductCard';\nimport type { ProductCardSettings } from '~/components/ProductCard/types';\nimport { ProductCarousel } from '~/components/ProductCarousel';\nimport { Timer } from '~/components/Timer';\nimport { Title } from '~/components/Title';\nimport { getTitleLevel } from '~/hooks/titleLevel';\nimport { useBreakpoint } from '~/hooks/useBreakpoint';\nimport type { RebuyProduct } from '~/types/rebuyCustom';\nimport type { WidgetContentProps } from '~/widgets/RebuyWidget/types';\nimport styles from './RebuyWidget.module.css';\n\nexport const WidgetContent = ({\n addToCartCallback,\n customTitleLevel,\n isHydrogenReact,\n isInPopup,\n onDismiss,\n products,\n settings,\n}: WidgetContentProps) => {\n const currentBreakpoint = useBreakpoint(settings);\n const hasTimer =\n settings &&\n settings.timer.enabled &&\n settings.language.timer_title !== '' &&\n (settings.timer.duration_minutes !== null || settings.timer.duration_seconds !== null);\n const hasSuperTitle = settings?.language.super_title !== '';\n const hasPrimaryTitle = settings?.language.title !== '';\n const hasDescription = settings?.language.description !== '';\n\n // Get layout settings based on current breakpoint\n const layoutSettings = settings?.layout?.[currentBreakpoint];\n const isCarousel = layoutSettings?.carousel || false;\n const columns = layoutSettings?.columns || 1;\n const showPagination = layoutSettings?.show_paginations || false;\n\n const productCardSettings: ProductCardSettings = {\n layoutStyle: layoutSettings?.style,\n productOptions: settings?.product_options,\n quantityInput: settings?.quantity_inputs,\n settingsDiscount: settings?.discount,\n variantSelector: settings?.view_options.variant_selector,\n };\n\n // Determine the correct title level for product cards\n const productCardTitleLevel = hasSuperTitle\n ? getTitleLevel(getTitleLevel(customTitleLevel, true), true)\n : getTitleLevel(customTitleLevel, true);\n\n // Render product listing based on layout style and carousel settings\n const renderProducts = () => {\n if (!products || products.length === 0) {\n return null;\n }\n\n if (isCarousel) {\n return (\n <ProductCarousel\n addToCartBtnText={settings?.language.add_to_cart}\n addToCartCallback={addToCartCallback}\n columns={columns}\n isHydrogenReact={isHydrogenReact}\n productCardTitleLevel={productCardTitleLevel}\n products={products}\n settings={productCardSettings}\n showPagination={showPagination}\n />\n );\n }\n\n return (\n <div className={styles['rebuy-widget__product-grid']} data-columns={columns} role=\"list\" tabIndex={0}>\n {products.map((product: RebuyProduct) => (\n <div key={product.id}>\n <ProductCard\n addToCartBtnText={settings?.language.add_to_cart}\n addToCartCallback={addToCartCallback}\n isHydrogenReact={isHydrogenReact}\n isInPopup={isInPopup}\n onPopupDismiss={onDismiss}\n product={product}\n productCardTitleLevel={productCardTitleLevel}\n settings={productCardSettings}\n />\n </div>\n ))}\n </div>\n );\n };\n\n return (\n <div className={styles['rebuy-widget__inner-content']}>\n {hasTimer && (\n <Timer\n action={settings?.timer.action}\n durationMinutes={settings?.timer.duration_minutes}\n durationSeconds={settings?.timer.duration_seconds}\n isPopup={settings?.display_type === 'popup'}\n onDismiss={onDismiss}\n title={settings?.language.timer_title}\n />\n )}\n {hasSuperTitle && (\n <Title\n level={getTitleLevel(customTitleLevel)}\n style={{ marginBottom: '0', textAlign: 'center' }}\n text={settings.language.super_title}\n />\n )}\n {hasPrimaryTitle && (\n <Title\n level={getTitleLevel(customTitleLevel, hasSuperTitle ? true : false)}\n style={{ textAlign: 'center' }}\n text={settings.language.title}\n />\n )}\n {hasDescription && <p className={styles['rebuy-widget__description']}>{settings.language.description}</p>}\n\n {renderProducts()}\n </div>\n );\n};\n", "import { useMemo } from 'react';\nimport { REBUY_THEME_STYLES_BASE_URL } from '~/constants/api';\nimport { useRebuyConfig } from '~/context/RebuyConfigContext';\n\nexport type RebuyThemeLinkOptions = {\n /**\n * Override the API key from the RebuyConfigContext.\n * Useful if you need to specify a different key for styles\n * than the one used for general API calls.\n */\n overrideApiKey?: string;\n};\n\n/**\n * A hook that returns an array of link objects for the Rebuy theme stylesheet,\n * suitable for Remix's links function. It attempts to use the API key from\n * the RebuyConfigContext.\n *\n * @param {RebuyThemeLinkOptions} options - Optional override for apiKey.\n * @returns {Array<{ href: string; rel: string }>} An array containing the link object, or an empty array if prerequisites are not met.\n */\nexport const useRebuyTheme = (options: RebuyThemeLinkOptions = {}) => {\n const { apiKey: contextApiKey, loadingStatus: configLoadingStatus, rebuyConfig } = useRebuyConfig();\n\n const linkObject = useMemo(() => {\n // Do not attempt to generate link if config is still loading or has failed,\n // unless an overrideApiKey is provided (allowing manual configuration).\n if (configLoadingStatus === 'loading' && !options.overrideApiKey) {\n return [];\n }\n\n if (configLoadingStatus === 'error' && !options.overrideApiKey && !contextApiKey) {\n console.warn(\n '[useRebuyTheme] Rebuy config failed to load and no overrideApiKey provided. Cannot generate theme styles link.'\n );\n\n return [];\n }\n\n const effectiveApiKey = options.overrideApiKey || contextApiKey;\n\n if (!effectiveApiKey) {\n if (configLoadingStatus === 'success' || options.overrideApiKey) {\n // Only warn if we expected an API key\n console.warn(\n '[useRebuyTheme] API key is missing. Provide it via RebuyConfigProvider or options.overrideApiKey. Stylesheet will not be loaded.'\n );\n }\n\n return [];\n }\n\n // TODO: use rebuy client to generate domain and possibly include api key\n const stylesheetUrl = `${REBUY_THEME_STYLES_BASE_URL}?key=${effectiveApiKey}`;\n\n return [{ href: stylesheetUrl, rel: 'stylesheet' }];\n }, [rebuyConfig, contextApiKey, configLoadingStatus, options.overrideApiKey]);\n\n return linkObject;\n};\n", "export const REBUY_THEME_STYLES_BASE_URL = 'https://rebuyengine.com/api/v1/theme-styles';\n", "// src/utils/csp.ts\n\nconst REBUY_STYLE_SRC_DOMAIN = 'https://rebuyengine.com';\n// If Rebuy ever needs to make API calls from the client for other things, add those domains too:\n// const REBUY_CONNECT_SRC_DOMAIN = \"https://api.rebuyengine.com\"; // Example\n\ntype CspOptions = {\n /** Add sources for Rebuy client-side API calls. Defaults to false. */\n connectSrc?: boolean;\n /** Add sources for Rebuy stylesheets. Defaults to true. */\n styleSrc?: boolean;\n};\n\n/**\n * Modifies a Headers object or a CSP string to include necessary Rebuy domains.\n *\n * @param {Headers | string} existing - The existing Headers object or CSP string.\n * @param {CspOptions} options - Configuration for which Rebuy sources to add.\n * @returns {Headers | string} The modified Headers object or CSP string.\n */\nexport const updateRebuyCsp = <T extends Headers | string>(existing: T, options: CspOptions = {}): T => {\n const { styleSrc = true /* , connectSrc = false */ } = options;\n\n let currentCspString: string;\n const isHeadersObject = existing instanceof Headers;\n\n if (isHeadersObject) {\n currentCspString = (existing as Headers).get('Content-Security-Policy') || '';\n } else {\n currentCspString = existing as string;\n }\n\n const cspParts = currentCspString\n .split(';')\n .map((part) => part.trim())\n .filter((part) => part);\n\n const updateDirective = (directiveName: string, domainToAdd: string) => {\n const directiveIndex = cspParts.findIndex((part) => part.toLowerCase().startsWith(directiveName.toLowerCase()));\n\n if (directiveIndex !== -1) {\n const currentDirective = cspParts[directiveIndex];\n const values = currentDirective.substring(directiveName.length).trim().split(' ');\n\n if (!values.includes(domainToAdd)) {\n values.push(domainToAdd);\n }\n cspParts[directiveIndex] = `${directiveName} ${values.join(' ')}`;\n } else {\n // If directive doesn't exist, add it.\n // Consider a base set of defaults like 'self' if adding a new directive.\n // For simplicity here, we just add the domain. User might need to add 'self'.\n cspParts.push(`${directiveName} ${domainToAdd}`);\n }\n };\n\n if (styleSrc) {\n updateDirective('style-src', REBUY_STYLE_SRC_DOMAIN);\n\n // If style-src-elem is not present, style-src is the fallback.\n // If style-src-elem IS present, we should update it too.\n if (cspParts.some((part) => part.toLowerCase().startsWith('style-src-elem'))) {\n updateDirective('style-src-elem', REBUY_STYLE_SRC_DOMAIN);\n }\n }\n\n // Example for future use if Rebuy needs client-side API calls\n // if (connectSrc) {\n // updateDirective(\"connect-src\", REBUY_CONNECT_SRC_DOMAIN);\n // }\n\n const newCspString = cspParts.join('; ');\n\n if (isHeadersObject) {\n (existing as Headers).set('Content-Security-Policy', newCspString);\n\n return existing;\n }\n\n return newCspString as T;\n};\n", "import { REBUY_THEME_STYLES_BASE_URL } from '~/constants/api';\n\n/**\n * Generates a link object for the Rebuy theme stylesheet.\n * Suitable for Remix's static `links` export.\n *\n * Requires API key to be passed directly or available as an environment variable\n * that this function can access (if it were running in a Node.js server environment\n * where process.env is available before React rendering).\n * For Remix, it's best to pass the apiKey explicitly if it's not a universally available env var.\n *\n * @param {object} options - The options for the Rebuy theme stylesheet link.\n * @param {string} options.apiKey - The API key for the Rebuy theme stylesheet.\n * @returns {Array<{ href: string; rel: string }>}\n */\nexport const getRebuyThemeStylesLink = (options: { apiKey: string }): { href: string; rel: string }[] => {\n const { apiKey } = options;\n\n if (!apiKey) {\n // This function is often called in a context where React isn't fully set up (like Remix links)\n // so console.warn might be the best side effect.\n console.warn('[getRebuyThemeStylesLink] API key is missing. Stylesheet link will not be generated.');\n\n return [];\n }\n\n // TODO: use rebuy client to generate domain\n const stylesheetUrl = `${REBUY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AK,GAAG,CAAC;AAAA,IACnE,OAAO;AAIH,eAAS,KAAK,GAAG,aAAa,IAAI,WAAW,EAAE;AAAA,IACnD;AAAA,EACJ;AAEA,MAAI,UAAU;AACV,oBAAgB,aAAa,sBAAsB;AAInD,QAAI,SAAS,KAAK,CAAC,SAAS,KAAK,YAAY,EAAE,WAAW,gBAAgB,CAAC,GAAG;AAC1E,sBAAgB,kBAAkB,sBAAsB;AAAA,IAC5D;AAAA,EACJ;AAOA,QAAM,eAAe,SAAS,KAAK,IAAI;AAEvC,MAAI,iBAAiB;AACjB,IAAC,SAAqB,IAAI,2BAA2B,YAAY;AAEjE,WAAO;AAAA,EACX;AAEA,SAAO;AACX;;;ACjEO,IAAM,0BAA0B,CAAC,YAAiE;AACrG,QAAM,EAAE,OAAO,IAAI;AAEnB,MAAI,CAAC,QAAQ;AAGT,YAAQ,KAAK,sFAAsF;AAEnG,WAAO,CAAC;AAAA,EACZ;AAGA,QAAM,gBAAgB,GAAG,2BAA2B,QAAQ,MAAM;AAElE,SAAO,CAAC,EAAE,MAAM,eAAe,KAAK,aAAa,CAAC;AACtD;",
|
6
|
+
"names": ["Utilities", "useMemo", "createContext", "jsx", "useMemo", "Utilities", "useLocation", "useMemo", "Fragment", "jsx", "useLocation", "useMemo", "RebuyClient", "Utilities", "useEffect", "useMemo", "useState", "useState", "useEffect", "RebuyClient", "useMemo", "metadata", "product", "useState", "rebuy-cart-button", "rebuy-cart-button__container", "Fragment", "jsx", "jsxs", "Money", "useCart", "Fragment", "jsx", "jsxs", "useCart", "Money", "jsx", "Money", "rebuy-product-price", "rebuy-product-price__current", "rebuy-product-price__current--sale", "rebuy-product-price__compare-at", "jsx", "jsxs", "price", "compareAtPrice", "Money", "useState", "rebuy-quantity__container", "rebuy-quantity__select", "jsx", "useState", "rebuy-title", "jsx", "clsx", "useEffect", "useState", "rebuy-variant__container", "rebuy-variant__select", "rebuy-variant__select-optgroup-label", "rebuy-variant__select-option", "rebuy-variant__buttons", "rebuy-variant__button", "rebuy-variant__button--selected", "jsx", "useState", "useEffect", "clsx", "rebuy-product-card__container", "rebuy-product-card", "rebuy-product-card__content", "rebuy-product-card__header", "rebuy-product-card__info", "rebuy-product-card__actions", "rebuy-product-card__media-link", "rebuy-product-card__image", "rebuy-product-card__title", "rebuy-product-card__title-link", "rebuy-product-card__actions-variant-select", "rebuy-product-card__variant-select", "rebuy-product-card__actions-quantity", "rebuy-product-card__actions-button", "rebuy-product-card__vendor", "rebuy-product-card__variant-title", "rebuy-product-card__review", "rebuy-product-card__star-rating", "rebuy-product-card__star-rating-value", "rebuy-product-card__star-rating-background", "rebuy-product-card__star-rating-foreground", "rebuy-product-card__review-count", "rebuy-product-card__review-count-parenthesis", "rebuy-product-card__review-count-number", "rebuy-product-card__review-count-label", "rebuy-product-card__description", "Fragment", "jsx", "jsxs", "useState", "product", "container", "productGrid", "productItem", "jsx", "jsxs", "useEffect", "useState", "Link", "Image", "Fragment", "container", "addCartBtnContainer", "bundleContainer", "select", "bundleItemRowContainer", "unselected", "bundleItemRow", "bundleItemInput", "bundleItemLabel", "bundleImages", "bundleImage", "fade-in", "bundleImageDelimiter", "compareAtPrice", "Fragment", "jsx", "jsxs", "Image", "Link", "jsx", "product", "jsx", "jsxs", "Money", "jsx", "jsxs", "price", "compareAtPrice", "Money", "jsx", "jsxs", "useState", "useEffect", "product", "Money", "useCallback", "useEffect", "useState", "Link", "Image", "container", "productAddOnsList", "addOnCard", "addOnCardContent", "addOnCardInput", "addOnCardContentImage", "addOnCardOutOfStock", "addOnCardTextContent", "addOnCardLearnMore", "addCartBtnContainer", "moneyContainer", "jsx", "jsxs", "Image", "Link", "jsx", "jsxs", "useState", "useEffect", "product", "useCallback", "Money", "container", "productGrid", "jsx", "jsxs", "RebuyClient", "Utilities", "flattenConnection", "useContext", "useEffect", "useMemo", "useRef", "useState", "jsx", "useEffect", "useState", "useCallback", "useEffect", "elements", "useEffect", "useState", "rebuy-carousel", "rebuy-carousel__container", "rebuy-carousel__slide", "rebuy-carousel__controls", "rebuy-carousel__prev", "rebuy-carousel__next", "rebuy-carousel__pagination", "rebuy-carousel__dot", "rebuy-carousel__grid", "jsx", "jsxs", "useState", "useEffect", "useCallback", "useEffect", "useState", "rebuy-timer__container", "rebuy-timer__text", "rebuy-timer__title", "rebuy-timer__display", "rebuy-timer__display--urgent", "pulse", "rebuy-timer__minutes", "rebuy-timer__seconds", "rebuy-timer__separator", "jsx", "jsxs", "useState", "useCallback", "useEffect", "rebuy-widget__container", "rebuy-widget__popup-overlay", "rebuy-widget__popup-content", "rebuy-widget__content", "rebuy-widget__inner-content", "rebuy-widget__description", "rebuy-widget__modal-close", "rebuy-widget__product-grid", "jsx", "jsxs", "Fragment", "jsx", "jsxs", "useState", "useRef", "useContext", "useEffect", "RebuyClient", "useMemo", "request", "product", "flattenConnection", "useMemo", "useMemo"]
|
7
7
|
}
|