@shopify/shop-minis-react 0.4.16 → 0.4.17
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/dist/components/atoms/alert-dialog.js.map +1 -1
- package/dist/components/atoms/button.js.map +1 -1
- package/dist/components/atoms/icon-button.js.map +1 -1
- package/dist/components/atoms/image.js +65 -51
- package/dist/components/atoms/image.js.map +1 -1
- package/dist/components/atoms/list.js.map +1 -1
- package/dist/components/atoms/text-input.js.map +1 -1
- package/dist/components/atoms/touchable.js.map +1 -1
- package/dist/components/atoms/video-player.js +1 -1
- package/dist/components/atoms/video-player.js.map +1 -1
- package/dist/components/commerce/add-to-cart.js.map +1 -1
- package/dist/components/commerce/buy-now.js.map +1 -1
- package/dist/components/commerce/favorite-button.js +1 -4
- package/dist/components/commerce/favorite-button.js.map +1 -1
- package/dist/components/commerce/merchant-card.js.map +1 -1
- package/dist/components/commerce/product-link.js.map +1 -1
- package/dist/components/commerce/quantity-selector.js.map +1 -1
- package/dist/components/content/image-content-wrapper.js.map +1 -1
- package/dist/components/navigation/minis-router.js.map +1 -1
- package/dist/components/navigation/transition-link.js.map +1 -1
- package/dist/components/ui/alert.js.map +1 -1
- package/dist/components/ui/badge.js.map +1 -1
- package/dist/components/ui/input.js.map +1 -1
- package/dist/index.js +75 -73
- package/dist/utils/image.js +44 -24
- package/dist/utils/image.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/alert-dialog.tsx +3 -3
- package/src/components/atoms/button.tsx +22 -0
- package/src/components/atoms/icon-button.tsx +16 -8
- package/src/components/atoms/image.test.tsx +27 -13
- package/src/components/atoms/image.tsx +41 -8
- package/src/components/atoms/list.tsx +25 -2
- package/src/components/atoms/text-input.tsx +3 -1
- package/src/components/atoms/touchable.tsx +15 -4
- package/src/components/atoms/video-player.tsx +16 -6
- package/src/components/commerce/add-to-cart.tsx +7 -11
- package/src/components/commerce/buy-now.tsx +7 -10
- package/src/components/commerce/favorite-button.tsx +6 -5
- package/src/components/commerce/merchant-card.tsx +4 -0
- package/src/components/commerce/product-link.tsx +15 -0
- package/src/components/commerce/quantity-selector.tsx +6 -1
- package/src/components/content/image-content-wrapper.tsx +16 -1
- package/src/components/navigation/minis-router.tsx +2 -2
- package/src/components/navigation/transition-link.tsx +11 -1
- package/src/components/ui/alert.tsx +7 -0
- package/src/components/ui/badge.tsx +9 -0
- package/src/components/ui/input.tsx +15 -0
- package/src/utils/image.ts +38 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-link.js","sources":["../../../src/components/commerce/product-link.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport {type Product} from '@shopify/shop-minis-platform'\nimport {cva, type VariantProps} from 'class-variance-authority'\nimport {Slot as SlotPrimitive} from 'radix-ui'\n\nimport {useShopNavigation} from '../../hooks/navigation/useShopNavigation'\nimport {useSavedProductsActions} from '../../hooks/user/useSavedProductsActions'\nimport {ProductReviewStars} from '../../internal/components/product-review-stars'\nimport {cn} from '../../lib/utils'\nimport {formatMoney} from '../../utils/formatMoney'\nimport {Touchable} from '../atoms/touchable'\nimport {Card, CardContent, CardAction} from '../ui/card'\n\nimport {FavoriteButton} from './favorite-button'\n\nconst productLinkVariants = cva('', {\n variants: {\n layout: {\n horizontal: 'w-full !flex-row items-center gap-3 px-4 py-3',\n vertical: 'flex-col',\n },\n discount: {\n none: '',\n small: '',\n large: '',\n },\n },\n defaultVariants: {\n layout: 'horizontal',\n discount: 'none',\n },\n})\n\n// Primitive components (building blocks)\nexport interface ProductLinkRootProps\n extends React.ComponentProps<typeof Card>,\n VariantProps<typeof productLinkVariants> {\n layout?: 'horizontal' | 'vertical'\n asChild?: boolean\n onPress?: () => void\n}\n\nfunction ProductLinkRoot({\n className,\n layout,\n discount,\n asChild = false,\n onPress,\n ...props\n}: ProductLinkRootProps) {\n const Comp = asChild ? SlotPrimitive.Root : Card\n\n return (\n <Touchable\n onClick={onPress}\n whileTap={{opacity: 0.7}}\n transition={{\n opacity: {type: 'tween', duration: 0.08, ease: 'easeInOut'},\n }}\n >\n <Comp\n className={cn(\n productLinkVariants({layout, discount}),\n 'border-0 bg-white rounded-xl shadow-lg shadow-black/10',\n className\n )}\n {...props}\n />\n </Touchable>\n )\n}\n\nfunction ProductLinkImage({\n className,\n layout = 'horizontal',\n ...props\n}: React.ComponentProps<'div'> & {layout?: 'horizontal' | 'vertical'}) {\n return (\n <div\n data-slot=\"product-link-image\"\n className={cn(\n 'overflow-hidden rounded-md bg-muted',\n layout === 'horizontal'\n ? 'h-16 w-16 flex-shrink-0'\n : 'aspect-square w-full',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction ProductLinkInfo({\n className,\n layout = 'horizontal',\n ...props\n}: React.ComponentProps<typeof CardContent> & {\n layout?: 'horizontal' | 'vertical'\n}) {\n return (\n <CardContent\n className={cn(\n layout === 'horizontal'\n ? 'flex-1 min-w-0 space-y-1 px-0 py-0'\n : 'space-y-2',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction ProductLinkTitle({\n className,\n children,\n ...props\n}: React.ComponentProps<'h3'>) {\n return (\n <h3\n data-slot=\"product-link-title\"\n className={cn(\n 'text-sm font-medium leading-tight text-gray-900 truncate overflow-hidden whitespace-nowrap text-ellipsis',\n className\n )}\n {...props}\n >\n {children}\n </h3>\n )\n}\n\nfunction ProductLinkPrice({className, ...props}: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"product-link-price\"\n className={cn('flex items-center gap-2', className)}\n {...props}\n />\n )\n}\n\nfunction ProductLinkCurrentPrice({\n className,\n ...props\n}: React.ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"product-link-current-price\"\n className={cn('text-sm font-semibold text-gray-900', className)}\n {...props}\n />\n )\n}\n\nfunction ProductLinkOriginalPrice({\n className,\n ...props\n}: React.ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"product-link-original-price\"\n className={cn('text-sm text-gray-500 line-through', className)}\n {...props}\n />\n )\n}\n\nfunction ProductLinkDiscountPrice({\n className,\n ...props\n}: React.ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"product-link-discount-price\"\n className={cn('text-sm font-semibold text-red-600', className)}\n {...props}\n />\n )\n}\n\nfunction ProductLinkRating({className, ...props}: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"product-link-rating\"\n className={cn('', className)}\n {...props}\n />\n )\n}\n\nfunction ProductLinkActions({\n className,\n hideFavoriteAction = false,\n onPress,\n filled = false,\n customAction,\n ...props\n}: React.ComponentProps<typeof CardAction> & {\n hideFavoriteAction?: boolean\n onPress?: () => void\n filled?: boolean\n customAction?: React.ReactNode\n}) {\n const favoriteAction = hideFavoriteAction ? null : (\n <FavoriteButton filled={filled} onClick={onPress} />\n )\n\n return (\n <CardAction\n className={cn('flex-shrink-0 self-center px-0 py-0', className)}\n {...props}\n >\n <Touchable\n stopPropagation\n onClick={onPress}\n whileTap={{opacity: 0.7, scale: 0.95}}\n transition={{\n opacity: {type: 'tween', duration: 0.08, ease: 'easeInOut'},\n scale: {type: 'tween', duration: 0.08, ease: 'easeInOut'},\n }}\n >\n {customAction ? <>{customAction}</> : favoriteAction}\n </Touchable>\n </CardAction>\n )\n}\n\nexport type ProductLinkProps = {\n product: Product\n hideFavoriteAction?: boolean\n onClick?: (product: Product) => void\n reviewsDisabled?: boolean\n} & (\n | {\n customAction?: never\n onCustomActionClick?: never\n }\n | {\n customAction: React.ReactNode\n onCustomActionClick: () => void\n }\n)\n\n// Composed ProductLink component\nfunction ProductLink({\n product,\n hideFavoriteAction = false,\n onClick,\n customAction,\n onCustomActionClick,\n reviewsDisabled = false,\n}: ProductLinkProps) {\n const {navigateToProduct} = useShopNavigation()\n const {saveProduct, unsaveProduct} = useSavedProductsActions()\n\n const {\n id,\n title,\n featuredImage,\n reviewAnalytics,\n price,\n compareAtPrice,\n isFavorited,\n selectedVariant,\n defaultVariantId,\n shop,\n } = product\n\n // Local state for optimistic UI updates\n const [isFavoritedLocal, setIsFavoritedLocal] = React.useState(isFavorited)\n\n const averageRating = reviewAnalytics?.averageRating\n const reviewCount = reviewAnalytics?.reviewCount\n const amount = price?.amount\n ? formatMoney(price?.amount, price?.currencyCode)\n : undefined\n const imageUrl = featuredImage?.url\n const imageAltText = featuredImage?.altText || title\n const compareAtPriceAmount = compareAtPrice?.amount\n ? formatMoney(compareAtPrice?.amount, compareAtPrice?.currencyCode)\n : undefined\n const hasDiscount = compareAtPriceAmount && compareAtPriceAmount !== amount\n\n const handlePress = React.useCallback(() => {\n navigateToProduct({\n productId: id,\n })\n onClick?.(product)\n }, [navigateToProduct, id, onClick, product])\n\n const handleActionPress = React.useCallback(async () => {\n if (customAction || onCustomActionClick) {\n onCustomActionClick?.()\n return\n }\n\n const previousState = isFavoritedLocal\n\n // Optimistic update\n setIsFavoritedLocal(!previousState)\n\n try {\n if (previousState) {\n await unsaveProduct({\n productId: id,\n shopId: shop.id,\n productVariantId: selectedVariant?.id || defaultVariantId,\n })\n } else {\n await saveProduct({\n productId: id,\n shopId: shop.id,\n productVariantId: selectedVariant?.id || defaultVariantId,\n })\n }\n } catch (error) {\n // Revert optimistic update on error\n setIsFavoritedLocal(previousState)\n }\n }, [\n customAction,\n onCustomActionClick,\n isFavoritedLocal,\n unsaveProduct,\n id,\n shop.id,\n selectedVariant?.id,\n defaultVariantId,\n saveProduct,\n ])\n\n return (\n <ProductLinkRoot\n layout=\"horizontal\"\n discount={hasDiscount ? 'small' : 'none'}\n onPress={handlePress}\n >\n <ProductLinkImage layout=\"horizontal\">\n {imageUrl ? (\n <img\n src={imageUrl}\n alt={imageAltText}\n className=\"h-full w-full object-cover\"\n />\n ) : (\n <div className=\"h-full w-full bg-muted flex items-center justify-center text-muted-foreground text-xs\">\n No Image\n </div>\n )}\n </ProductLinkImage>\n\n <ProductLinkInfo layout=\"horizontal\">\n <ProductLinkTitle>{title}</ProductLinkTitle>\n\n {averageRating && !reviewsDisabled ? (\n <ProductLinkRating>\n <ProductReviewStars\n averageRating={averageRating}\n reviewCount={reviewCount}\n />\n </ProductLinkRating>\n ) : null}\n\n <ProductLinkPrice>\n {hasDiscount ? (\n <>\n <ProductLinkDiscountPrice>{amount}</ProductLinkDiscountPrice>\n <ProductLinkOriginalPrice>\n {compareAtPriceAmount}\n </ProductLinkOriginalPrice>\n </>\n ) : (\n <ProductLinkCurrentPrice>{amount}</ProductLinkCurrentPrice>\n )}\n </ProductLinkPrice>\n </ProductLinkInfo>\n\n <ProductLinkActions\n filled={isFavoritedLocal}\n onPress={handleActionPress}\n customAction={customAction}\n hideFavoriteAction={hideFavoriteAction}\n />\n </ProductLinkRoot>\n )\n}\n\nexport {ProductLink}\n"],"names":["productLinkVariants","cva","ProductLinkRoot","className","layout","discount","asChild","onPress","props","jsx","Touchable","SlotPrimitive.Root","Card","cn","ProductLinkImage","ProductLinkInfo","CardContent","ProductLinkTitle","children","ProductLinkPrice","ProductLinkCurrentPrice","ProductLinkOriginalPrice","ProductLinkDiscountPrice","ProductLinkRating","ProductLinkActions","hideFavoriteAction","filled","customAction","favoriteAction","FavoriteButton","CardAction","Fragment","ProductLink","product","onClick","onCustomActionClick","reviewsDisabled","navigateToProduct","useShopNavigation","saveProduct","unsaveProduct","useSavedProductsActions","id","title","featuredImage","reviewAnalytics","price","compareAtPrice","isFavorited","selectedVariant","defaultVariantId","shop","isFavoritedLocal","setIsFavoritedLocal","React","averageRating","reviewCount","amount","formatMoney","imageUrl","imageAltText","compareAtPriceAmount","hasDiscount","handlePress","handleActionPress","previousState","jsxs","ProductReviewStars"],"mappings":";;;;;;;;;;;;AAgBA,MAAMA,IAAsBC,EAAI,IAAI;AAAA,EAClC,UAAU;AAAA,IACR,QAAQ;AAAA,MACN,YAAY;AAAA,MACZ,UAAU;AAAA,IACZ;AAAA,IACA,UAAU;AAAA,MACR,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,IAAA;AAAA,EAEX;AAAA,EACA,iBAAiB;AAAA,IACf,QAAQ;AAAA,IACR,UAAU;AAAA,EAAA;AAEd,CAAC;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MAClC,SAASC;AAAA,MAET,UAAA;AAAA,QAAC,gBAAAtD,EAAAK,GAAA,EAAiB,QAAO,cACtB,UACC6C,IAAA,gBAAAlD;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,KAAKkD;AAAA,YACL,KAAKC;AAAA,YACL,WAAU;AAAA,UAAA;AAAA,QAAA,IAGX,gBAAAnD,EAAA,OAAA,EAAI,WAAU,yFAAwF,qBAEvG,CAAA,GAEJ;AAAA,QAEA,gBAAAyD,EAACnD,GAAgB,EAAA,QAAO,cACtB,UAAA;AAAA,UAAA,gBAAAN,EAACQ,KAAkB,UAAM0B,EAAA,CAAA;AAAA,UAExBY,KAAiB,CAACnB,IACjB,gBAAA3B,EAACc,IACC,EAAA,UAAA,gBAAAd;AAAA,YAAC0D;AAAA,YAAA;AAAA,cACC,eAAAZ;AAAA,cACA,aAAAC;AAAA,YAAA;AAAA,aAEJ,IACE;AAAA,UAEJ,gBAAA/C,EAACU,GACE,EAAA,UAAA2C,IAEG,gBAAAI,EAAAnC,GAAA,EAAA,UAAA;AAAA,YAAA,gBAAAtB,EAACa,MAA0B,UAAOmC,EAAA,CAAA;AAAA,YAClC,gBAAAhD,EAACY,MACE,UACHwC,EAAA,CAAA;AAAA,UAAA,EACF,CAAA,IAEA,gBAAApD,EAACW,GAAyB,EAAA,UAAAqC,EAAA,CAAO,EAErC,CAAA;AAAA,QAAA,GACF;AAAA,QAEA,gBAAAhD;AAAA,UAACe;AAAA,UAAA;AAAA,YACC,QAAQ4B;AAAA,YACR,SAASY;AAAA,YACT,cAAArC;AAAA,YACA,oBAAAF;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"product-link.js","sources":["../../../src/components/commerce/product-link.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport {type Product} from '@shopify/shop-minis-platform'\nimport {cva, type VariantProps} from 'class-variance-authority'\nimport {Slot as SlotPrimitive} from 'radix-ui'\n\nimport {useShopNavigation} from '../../hooks/navigation/useShopNavigation'\nimport {useSavedProductsActions} from '../../hooks/user/useSavedProductsActions'\nimport {ProductReviewStars} from '../../internal/components/product-review-stars'\nimport {cn} from '../../lib/utils'\nimport {formatMoney} from '../../utils/formatMoney'\nimport {Touchable} from '../atoms/touchable'\nimport {Card, CardContent, CardAction} from '../ui/card'\n\nimport {FavoriteButton} from './favorite-button'\n\nconst productLinkVariants = cva('', {\n variants: {\n layout: {\n horizontal: 'w-full !flex-row items-center gap-3 px-4 py-3',\n vertical: 'flex-col',\n },\n discount: {\n none: '',\n small: '',\n large: '',\n },\n },\n defaultVariants: {\n layout: 'horizontal',\n discount: 'none',\n },\n})\n\n// Primitive components (building blocks)\nexport interface ProductLinkRootProps\n extends React.ComponentProps<typeof Card>,\n VariantProps<typeof productLinkVariants> {\n layout?: 'horizontal' | 'vertical'\n asChild?: boolean\n onPress?: () => void\n}\n\nfunction ProductLinkRoot({\n className,\n layout,\n discount,\n asChild = false,\n onPress,\n ...props\n}: ProductLinkRootProps) {\n const Comp = asChild ? SlotPrimitive.Root : Card\n\n return (\n <Touchable\n onClick={onPress}\n whileTap={{opacity: 0.7}}\n transition={{\n opacity: {type: 'tween', duration: 0.08, ease: 'easeInOut'},\n }}\n >\n <Comp\n className={cn(\n productLinkVariants({layout, discount}),\n 'border-0 bg-white rounded-xl shadow-lg shadow-black/10',\n className\n )}\n {...props}\n />\n </Touchable>\n )\n}\n\nfunction ProductLinkImage({\n className,\n layout = 'horizontal',\n ...props\n}: React.ComponentProps<'div'> & {layout?: 'horizontal' | 'vertical'}) {\n return (\n <div\n data-slot=\"product-link-image\"\n className={cn(\n 'overflow-hidden rounded-md bg-muted',\n layout === 'horizontal'\n ? 'h-16 w-16 flex-shrink-0'\n : 'aspect-square w-full',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction ProductLinkInfo({\n className,\n layout = 'horizontal',\n ...props\n}: React.ComponentProps<typeof CardContent> & {\n layout?: 'horizontal' | 'vertical'\n}) {\n return (\n <CardContent\n className={cn(\n layout === 'horizontal'\n ? 'flex-1 min-w-0 space-y-1 px-0 py-0'\n : 'space-y-2',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction ProductLinkTitle({\n className,\n children,\n ...props\n}: React.ComponentProps<'h3'>) {\n return (\n <h3\n data-slot=\"product-link-title\"\n className={cn(\n 'text-sm font-medium leading-tight text-gray-900 truncate overflow-hidden whitespace-nowrap text-ellipsis',\n className\n )}\n {...props}\n >\n {children}\n </h3>\n )\n}\n\nfunction ProductLinkPrice({className, ...props}: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"product-link-price\"\n className={cn('flex items-center gap-2', className)}\n {...props}\n />\n )\n}\n\nfunction ProductLinkCurrentPrice({\n className,\n ...props\n}: React.ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"product-link-current-price\"\n className={cn('text-sm font-semibold text-gray-900', className)}\n {...props}\n />\n )\n}\n\nfunction ProductLinkOriginalPrice({\n className,\n ...props\n}: React.ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"product-link-original-price\"\n className={cn('text-sm text-gray-500 line-through', className)}\n {...props}\n />\n )\n}\n\nfunction ProductLinkDiscountPrice({\n className,\n ...props\n}: React.ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"product-link-discount-price\"\n className={cn('text-sm font-semibold text-red-600', className)}\n {...props}\n />\n )\n}\n\nfunction ProductLinkRating({className, ...props}: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"product-link-rating\"\n className={cn('', className)}\n {...props}\n />\n )\n}\n\nfunction ProductLinkActions({\n className,\n hideFavoriteAction = false,\n onPress,\n filled = false,\n customAction,\n ...props\n}: React.ComponentProps<typeof CardAction> & {\n hideFavoriteAction?: boolean\n onPress?: () => void\n filled?: boolean\n customAction?: React.ReactNode\n}) {\n const favoriteAction = hideFavoriteAction ? null : (\n <FavoriteButton filled={filled} onClick={onPress} />\n )\n\n return (\n <CardAction\n className={cn('flex-shrink-0 self-center px-0 py-0', className)}\n {...props}\n >\n <Touchable\n stopPropagation\n onClick={onPress}\n whileTap={{opacity: 0.7, scale: 0.95}}\n transition={{\n opacity: {type: 'tween', duration: 0.08, ease: 'easeInOut'},\n scale: {type: 'tween', duration: 0.08, ease: 'easeInOut'},\n }}\n >\n {customAction ? <>{customAction}</> : favoriteAction}\n </Touchable>\n </CardAction>\n )\n}\n\nexport interface ProductLinkDocProps {\n /** The product to display */\n product: Product\n /** Hide the favorite/save button */\n hideFavoriteAction?: boolean\n /** Callback when the product link is clicked */\n onClick?: (product: Product) => void\n /** Hide the review stars */\n reviewsDisabled?: boolean\n /** Custom action element to replace the favorite button. Must be provided with `onCustomActionClick`. */\n customAction?: React.ReactNode\n /** Callback when the custom action is clicked. Must be provided with `customAction`. */\n onCustomActionClick?: () => void\n}\n\nexport type ProductLinkProps = {\n product: Product\n hideFavoriteAction?: boolean\n onClick?: (product: Product) => void\n reviewsDisabled?: boolean\n} & (\n | {\n customAction?: never\n onCustomActionClick?: never\n }\n | {\n customAction: React.ReactNode\n onCustomActionClick: () => void\n }\n)\n\n// Composed ProductLink component\nfunction ProductLink({\n product,\n hideFavoriteAction = false,\n onClick,\n customAction,\n onCustomActionClick,\n reviewsDisabled = false,\n}: ProductLinkProps) {\n const {navigateToProduct} = useShopNavigation()\n const {saveProduct, unsaveProduct} = useSavedProductsActions()\n\n const {\n id,\n title,\n featuredImage,\n reviewAnalytics,\n price,\n compareAtPrice,\n isFavorited,\n selectedVariant,\n defaultVariantId,\n shop,\n } = product\n\n // Local state for optimistic UI updates\n const [isFavoritedLocal, setIsFavoritedLocal] = React.useState(isFavorited)\n\n const averageRating = reviewAnalytics?.averageRating\n const reviewCount = reviewAnalytics?.reviewCount\n const amount = price?.amount\n ? formatMoney(price?.amount, price?.currencyCode)\n : undefined\n const imageUrl = featuredImage?.url\n const imageAltText = featuredImage?.altText || title\n const compareAtPriceAmount = compareAtPrice?.amount\n ? formatMoney(compareAtPrice?.amount, compareAtPrice?.currencyCode)\n : undefined\n const hasDiscount = compareAtPriceAmount && compareAtPriceAmount !== amount\n\n const handlePress = React.useCallback(() => {\n navigateToProduct({\n productId: id,\n })\n onClick?.(product)\n }, [navigateToProduct, id, onClick, product])\n\n const handleActionPress = React.useCallback(async () => {\n if (customAction || onCustomActionClick) {\n onCustomActionClick?.()\n return\n }\n\n const previousState = isFavoritedLocal\n\n // Optimistic update\n setIsFavoritedLocal(!previousState)\n\n try {\n if (previousState) {\n await unsaveProduct({\n productId: id,\n shopId: shop.id,\n productVariantId: selectedVariant?.id || defaultVariantId,\n })\n } else {\n await saveProduct({\n productId: id,\n shopId: shop.id,\n productVariantId: selectedVariant?.id || defaultVariantId,\n })\n }\n } catch (error) {\n // Revert optimistic update on error\n setIsFavoritedLocal(previousState)\n }\n }, [\n customAction,\n onCustomActionClick,\n isFavoritedLocal,\n unsaveProduct,\n id,\n shop.id,\n selectedVariant?.id,\n defaultVariantId,\n saveProduct,\n ])\n\n return (\n <ProductLinkRoot\n layout=\"horizontal\"\n discount={hasDiscount ? 'small' : 'none'}\n onPress={handlePress}\n >\n <ProductLinkImage layout=\"horizontal\">\n {imageUrl ? (\n <img\n src={imageUrl}\n alt={imageAltText}\n className=\"h-full w-full object-cover\"\n />\n ) : (\n <div className=\"h-full w-full bg-muted flex items-center justify-center text-muted-foreground text-xs\">\n No Image\n </div>\n )}\n </ProductLinkImage>\n\n <ProductLinkInfo layout=\"horizontal\">\n <ProductLinkTitle>{title}</ProductLinkTitle>\n\n {averageRating && !reviewsDisabled ? (\n <ProductLinkRating>\n <ProductReviewStars\n averageRating={averageRating}\n reviewCount={reviewCount}\n />\n </ProductLinkRating>\n ) : null}\n\n <ProductLinkPrice>\n {hasDiscount ? (\n <>\n <ProductLinkDiscountPrice>{amount}</ProductLinkDiscountPrice>\n <ProductLinkOriginalPrice>\n {compareAtPriceAmount}\n </ProductLinkOriginalPrice>\n </>\n ) : (\n <ProductLinkCurrentPrice>{amount}</ProductLinkCurrentPrice>\n )}\n </ProductLinkPrice>\n </ProductLinkInfo>\n\n <ProductLinkActions\n filled={isFavoritedLocal}\n onPress={handleActionPress}\n customAction={customAction}\n hideFavoriteAction={hideFavoriteAction}\n />\n </ProductLinkRoot>\n )\n}\n\nexport {ProductLink}\n"],"names":["productLinkVariants","cva","ProductLinkRoot","className","layout","discount","asChild","onPress","props","jsx","Touchable","SlotPrimitive.Root","Card","cn","ProductLinkImage","ProductLinkInfo","CardContent","ProductLinkTitle","children","ProductLinkPrice","ProductLinkCurrentPrice","ProductLinkOriginalPrice","ProductLinkDiscountPrice","ProductLinkRating","ProductLinkActions","hideFavoriteAction","filled","customAction","favoriteAction","FavoriteButton","CardAction","Fragment","ProductLink","product","onClick","onCustomActionClick","reviewsDisabled","navigateToProduct","useShopNavigation","saveProduct","unsaveProduct","useSavedProductsActions","id","title","featuredImage","reviewAnalytics","price","compareAtPrice","isFavorited","selectedVariant","defaultVariantId","shop","isFavoritedLocal","setIsFavoritedLocal","React","averageRating","reviewCount","amount","formatMoney","imageUrl","imageAltText","compareAtPriceAmount","hasDiscount","handlePress","handleActionPress","previousState","jsxs","ProductReviewStars"],"mappings":";;;;;;;;;;;;AAgBA,MAAMA,IAAsBC,EAAI,IAAI;AAAA,EAClC,UAAU;AAAA,IACR,QAAQ;AAAA,MACN,YAAY;AAAA,MACZ,UAAU;AAAA,IACZ;AAAA,IACA,UAAU;AAAA,MACR,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,IAAA;AAAA,EAEX;AAAA,EACA,iBAAiB;AAAA,IACf,QAAQ;AAAA,IACR,UAAU;AAAA,EAAA;AAEd,CAAC;AAWD,SAASC,EAAgB;AAAA,EACvB,WAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,SAAAC;AAAA,EACA,GAAGC;AACL,GAAyB;AAIrB,SAAA,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,SAASH;AAAA,MACT,UAA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EAAA,OAAA,EAAI,WAAU,yFAAwF,qBAEvG,CAAA,GAEJ;AAAA,QAEA,gBAAAyD,EAACnD,GAAgB,EAAA,QAAO,cACtB,UAAA;AAAA,UAAA,gBAAAN,EAACQ,KAAkB,UAAM0B,EAAA,CAAA;AAAA,UAExBY,KAAiB,CAACnB,IACjB,gBAAA3B,EAACc,IACC,EAAA,UAAA,gBAAAd;AAAA,YAAC0D;AAAA,YAAA;AAAA,cACC,eAAAZ;AAAA,cACA,aAAAC;AAAA,YAAA;AAAA,aAEJ,IACE;AAAA,UAEJ,gBAAA/C,EAACU,GACE,EAAA,UAAA2C,IAEG,gBAAAI,EAAAnC,GAAA,EAAA,UAAA;AAAA,YAAA,gBAAAtB,EAACa,MAA0B,UAAOmC,EAAA,CAAA;AAAA,YAClC,gBAAAhD,EAACY,MACE,UACHwC,EAAA,CAAA;AAAA,UAAA,EACF,CAAA,IAEA,gBAAApD,EAACW,GAAyB,EAAA,UAAAqC,EAAA,CAAO,EAErC,CAAA;AAAA,QAAA,GACF;AAAA,QAEA,gBAAAhD;AAAA,UAACe;AAAA,UAAA;AAAA,YACC,QAAQ4B;AAAA,YACR,SAASY;AAAA,YACT,cAAArC;AAAA,YACA,oBAAAF;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quantity-selector.js","sources":["../../../src/components/commerce/quantity-selector.tsx"],"sourcesContent":["import {useCallback, useEffect, useState} from 'react'\n\nimport {Minus, Plus} from 'lucide-react'\n\nimport {cn} from '../../lib/utils'\nimport {IconButton} from '../atoms/icon-button'\n\
|
|
1
|
+
{"version":3,"file":"quantity-selector.js","sources":["../../../src/components/commerce/quantity-selector.tsx"],"sourcesContent":["import {useCallback, useEffect, useState} from 'react'\n\nimport {Minus, Plus} from 'lucide-react'\n\nimport {cn} from '../../lib/utils'\nimport {IconButton} from '../atoms/icon-button'\n\nexport interface QuantitySelectorProps {\n /** Current quantity value */\n quantity: number\n /** Callback when quantity changes */\n onQuantityChange: (quantity: number) => void\n /** Maximum allowed quantity */\n maxQuantity: number\n /** Minimum allowed quantity (default: 1) */\n minQuantity?: number\n /** Whether the selector is disabled */\n disabled?: boolean\n}\n\nexport const QuantitySelector = ({\n quantity: _quantity,\n onQuantityChange,\n maxQuantity,\n minQuantity = 1,\n disabled = false,\n}: QuantitySelectorProps) => {\n const [quantity, setQuantity] = useState(_quantity)\n\n useEffect(() => {\n setQuantity(_quantity)\n }, [_quantity])\n\n useEffect(() => {\n onQuantityChange(quantity)\n }, [quantity, onQuantityChange])\n\n const incrementDisabled = disabled || quantity >= maxQuantity\n const decrementDisabled = disabled || quantity <= minQuantity\n\n const incrementQuantity = useCallback(() => {\n if (incrementDisabled) return\n const newQuantity = quantity + 1 > maxQuantity ? quantity : quantity + 1\n setQuantity(newQuantity)\n }, [incrementDisabled, quantity, maxQuantity])\n\n const decrementQuantity = useCallback(() => {\n if (decrementDisabled) return\n const newQuantity = quantity - 1 < minQuantity ? quantity : quantity - 1\n setQuantity(newQuantity)\n }, [decrementDisabled, quantity, minQuantity])\n\n return (\n <>\n <div\n data-testid=\"QuantitySelector\"\n className={cn('inline-flex w-auto bg-tertiary rounded-[8px]')}\n >\n <div\n className={cn(\n 'flex h-space-32 items-center self-center overflow-hidden rounded-radius-8 bg-bg-fill-secondary',\n `p-space-8`\n )}\n >\n <IconButton\n Icon={Minus}\n onClick={decrementQuantity}\n buttonStyles=\"transition bg-transparent\"\n filled={false}\n size=\"sm\"\n iconStyles={cn(\n decrementDisabled ? 'text-background' : 'text-foreground',\n 'stroke-3'\n )}\n />\n\n <div className={cn('grow', `w-[20px]`)}>\n <span className=\"flex items-center justify-center w-full h-full font-medium text-[10px]\">\n {quantity}\n </span>\n </div>\n <IconButton\n Icon={Plus}\n onClick={incrementQuantity}\n buttonStyles=\"transition bg-transparent\"\n filled={false}\n size=\"sm\"\n iconStyles={cn(\n incrementDisabled ? 'text-background' : 'text-secondary',\n 'stroke-3'\n )}\n />\n </div>\n </div>\n </>\n )\n}\n"],"names":["QuantitySelector","_quantity","onQuantityChange","maxQuantity","minQuantity","disabled","quantity","setQuantity","useState","useEffect","incrementDisabled","decrementDisabled","incrementQuantity","useCallback","newQuantity","decrementQuantity","jsx","Fragment","cn","jsxs","IconButton","Minus","Plus"],"mappings":";;;;;;AAoBO,MAAMA,IAAmB,CAAC;AAAA,EAC/B,UAAUC;AAAA,EACV,kBAAAC;AAAA,EACA,aAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,UAAAC,IAAW;AACb,MAA6B;AAC3B,QAAM,CAACC,GAAUC,CAAW,IAAIC,EAASP,CAAS;AAElD,EAAAQ,EAAU,MAAM;AACd,IAAAF,EAAYN,CAAS;AAAA,EAAA,GACpB,CAACA,CAAS,CAAC,GAEdQ,EAAU,MAAM;AACd,IAAAP,EAAiBI,CAAQ;AAAA,EAAA,GACxB,CAACA,GAAUJ,CAAgB,CAAC;AAEzB,QAAAQ,IAAoBL,KAAYC,KAAYH,GAC5CQ,IAAoBN,KAAYC,KAAYF,GAE5CQ,IAAoBC,EAAY,MAAM;AAC1C,QAAIH,EAAmB;AACvB,UAAMI,IAAcR,IAAW,IAAIH,IAAcG,IAAWA,IAAW;AACvE,IAAAC,EAAYO,CAAW;AAAA,EACtB,GAAA,CAACJ,GAAmBJ,GAAUH,CAAW,CAAC,GAEvCY,IAAoBF,EAAY,MAAM;AAC1C,QAAIF,EAAmB;AACvB,UAAMG,IAAcR,IAAW,IAAIF,IAAcE,IAAWA,IAAW;AACvE,IAAAC,EAAYO,CAAW;AAAA,EACtB,GAAA,CAACH,GAAmBL,GAAUF,CAAW,CAAC;AAE7C,SAEI,gBAAAY,EAAAC,GAAA,EAAA,UAAA,gBAAAD;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,eAAY;AAAA,MACZ,WAAWE,EAAG,8CAA8C;AAAA,MAE5D,UAAA,gBAAAC;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAWD;AAAA,YACT;AAAA,YACA;AAAA,UACF;AAAA,UAEA,UAAA;AAAA,YAAA,gBAAAF;AAAA,cAACI;AAAA,cAAA;AAAA,gBACC,MAAMC;AAAA,gBACN,SAASN;AAAA,gBACT,cAAa;AAAA,gBACb,QAAQ;AAAA,gBACR,MAAK;AAAA,gBACL,YAAYG;AAAA,kBACVP,IAAoB,oBAAoB;AAAA,kBACxC;AAAA,gBAAA;AAAA,cACF;AAAA,YACF;AAAA,YAEC,gBAAAK,EAAA,OAAA,EAAI,WAAWE,EAAG,QAAQ,UAAU,GACnC,UAAA,gBAAAF,EAAC,QAAK,EAAA,WAAU,0EACb,UAAAV,EACH,CAAA,GACF;AAAA,YACA,gBAAAU;AAAA,cAACI;AAAA,cAAA;AAAA,gBACC,MAAME;AAAA,gBACN,SAASV;AAAA,gBACT,cAAa;AAAA,gBACb,QAAQ;AAAA,gBACR,MAAK;AAAA,gBACL,YAAYM;AAAA,kBACVR,IAAoB,oBAAoB;AAAA,kBACxC;AAAA,gBAAA;AAAA,cACF;AAAA,YAAA;AAAA,UACF;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EAAA,GAEJ;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-content-wrapper.js","sources":["../../../src/components/content/image-content-wrapper.tsx"],"sourcesContent":["import {ContentWrapper} from '../atoms/content-wrapper'\nimport {Image} from '../atoms/image'\n\
|
|
1
|
+
{"version":3,"file":"image-content-wrapper.js","sources":["../../../src/components/content/image-content-wrapper.tsx"],"sourcesContent":["import {ContentWrapper} from '../atoms/content-wrapper'\nimport {Image} from '../atoms/image'\n\nexport interface ImageContentWrapperDocProps {\n /** The public ID of the uploaded image (use this OR externalId) */\n publicId?: string\n /** The external ID of the uploaded image (use this OR publicId) */\n externalId?: string\n /** Callback when the image loads */\n onLoad?: () => void\n /** Image width */\n width?: number\n /** Image height */\n height?: number\n /** Loading placeholder */\n Loader?: React.ReactNode | string\n}\n\nexport type ImageContentWrapperProps = (\n | {publicId: string; externalId?: never}\n | {externalId: string; publicId?: never}\n) & {\n onLoad?: () => void\n width?: number\n height?: number\n className?: string\n Loader?: React.ReactNode | string\n}\n\nexport function ImageContentWrapper({\n onLoad,\n width,\n height,\n className,\n publicId,\n externalId,\n Loader,\n}: ImageContentWrapperProps) {\n return (\n <ContentWrapper {...(externalId ? {externalId} : {publicId: publicId!})}>\n {({content, loading}) => {\n if (loading) return Loader ? <>{Loader}</> : null\n\n const aspectRatio =\n content?.image?.width && content?.image?.height\n ? content.image.width / content.image.height\n : undefined\n\n return (\n <Image\n src={content?.image?.url}\n thumbhash={content?.image?.thumbhash}\n width={width}\n height={height}\n alt={content?.title}\n onLoad={onLoad}\n className={className}\n aspectRatio={aspectRatio}\n />\n )\n }}\n </ContentWrapper>\n )\n}\n"],"names":["ImageContentWrapper","onLoad","width","height","className","publicId","externalId","Loader","jsx","ContentWrapper","content","loading","Fragment","aspectRatio","Image"],"mappings":";;;AA6BO,SAASA,EAAoB;AAAA,EAClC,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AAAA,EACA,QAAAC;AACF,GAA6B;AAC3B,SACG,gBAAAC,EAAAC,GAAA,EAAgB,GAAIH,IAAa,EAAC,YAAAA,EAAU,IAAI,EAAC,UAAAD,EAC/C,GAAA,UAAA,CAAC,EAAC,SAAAK,GAAS,SAAAC,QAAa;AACvB,QAAIA,EAAS,QAAOJ,IAAS,gBAAAC,EAAAI,GAAA,EAAG,YAAO,CAAA,IAAM;AAE7C,UAAMC,IACJH,GAAS,OAAO,SAASA,GAAS,OAAO,SACrCA,EAAQ,MAAM,QAAQA,EAAQ,MAAM,SACpC;AAGJ,WAAA,gBAAAF;AAAA,MAACM;AAAA,MAAA;AAAA,QACC,KAAKJ,GAAS,OAAO;AAAA,QACrB,WAAWA,GAAS,OAAO;AAAA,QAC3B,OAAAR;AAAA,QACA,QAAAC;AAAA,QACA,KAAKO,GAAS;AAAA,QACd,QAAAT;AAAA,QACA,WAAAG;AAAA,QACA,aAAAS;AAAA,MAAA;AAAA,IACF;AAAA,EAAA,GAGN;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"minis-router.js","sources":["../../../src/components/navigation/minis-router.tsx"],"sourcesContent":["import {BrowserRouter, BrowserRouterProps} from 'react-router'\n\nimport {TransitionContainer} from './transition-container'\n\
|
|
1
|
+
{"version":3,"file":"minis-router.js","sources":["../../../src/components/navigation/minis-router.tsx"],"sourcesContent":["import {BrowserRouter, BrowserRouterProps} from 'react-router'\n\nimport {TransitionContainer} from './transition-container'\n\nexport interface MinisRouterProps extends BrowserRouterProps {\n viewTransitions?: boolean\n}\n\nexport function MinisRouter({\n children,\n viewTransitions = false,\n ...props\n}: MinisRouterProps) {\n if (viewTransitions) {\n return (\n <BrowserRouter {...props}>\n <TransitionContainer>{children}</TransitionContainer>\n </BrowserRouter>\n )\n }\n\n return <BrowserRouter {...props}>{children}</BrowserRouter>\n}\n"],"names":["MinisRouter","children","viewTransitions","props","BrowserRouter","jsx","TransitionContainer"],"mappings":";;;AAQO,SAASA,EAAY;AAAA,EAC1B,UAAAC;AAAA,EACA,iBAAAC,IAAkB;AAAA,EAClB,GAAGC;AACL,GAAqB;AACnB,SAAID,sBAECE,GAAe,EAAA,GAAGD,GACjB,UAAC,gBAAAE,EAAAC,GAAA,EAAqB,UAAAL,EAAS,CAAA,GACjC,IAII,gBAAAI,EAAAD,GAAA,EAAe,GAAGD,GAAQ,UAAAF,EAAS,CAAA;AAC7C;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transition-link.js","sources":["../../../src/components/navigation/transition-link.tsx"],"sourcesContent":["import {forwardRef, AnchorHTMLAttributes} from 'react'\n\nimport {useHref} from 'react-router'\n\nimport {useNavigateWithTransition} from '../../hooks/navigation/useNavigateWithTransition'\n\
|
|
1
|
+
{"version":3,"file":"transition-link.js","sources":["../../../src/components/navigation/transition-link.tsx"],"sourcesContent":["import {forwardRef, AnchorHTMLAttributes} from 'react'\n\nimport {useHref} from 'react-router'\n\nimport {useNavigateWithTransition} from '../../hooks/navigation/useNavigateWithTransition'\n\nexport interface TransitionLinkDocProps {\n /** The target path to navigate to */\n to: string\n /** Click handler called before navigation */\n onClick?: React.MouseEventHandler<HTMLAnchorElement>\n /** Content to render inside the link */\n children?: React.ReactNode\n}\n\nexport interface TransitionLinkProps\n extends AnchorHTMLAttributes<HTMLAnchorElement> {\n to: string\n}\n\nconst ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\\/\\/)/i\n\nexport const TransitionLink = forwardRef<\n HTMLAnchorElement,\n TransitionLinkProps\n>(({onClick, to, children, ...props}, forwardedRef) => {\n const transitionNavigate = useNavigateWithTransition()\n\n const isAbsolute = typeof to === 'string' && ABSOLUTE_URL_REGEX.test(to)\n\n if (isAbsolute) {\n console.warn(\n `TransitionLink: absolute URLs are not supported. Please update to a valid relative path.`\n )\n }\n\n const href = useHref(to)\n\n const handleClick = (event: React.MouseEvent<HTMLAnchorElement>) => {\n if (onClick) onClick(event)\n\n if (!event.defaultPrevented) {\n event.preventDefault()\n transitionNavigate(to)\n }\n }\n\n return (\n <a\n {...props}\n onClick={handleClick}\n href={isAbsolute ? undefined : href}\n ref={forwardedRef}\n >\n {children}\n </a>\n )\n})\n"],"names":["ABSOLUTE_URL_REGEX","TransitionLink","forwardRef","onClick","to","children","props","forwardedRef","transitionNavigate","useNavigateWithTransition","isAbsolute","href","useHref","jsx","event"],"mappings":";;;;AAoBA,MAAMA,IAAqB,iCAEdC,IAAiBC,EAG5B,CAAC,EAAC,SAAAC,GAAS,IAAAC,GAAI,UAAAC,GAAU,GAAGC,EAAK,GAAGC,MAAiB;AACrD,QAAMC,IAAqBC,EAA0B,GAE/CC,IAAa,OAAON,KAAO,YAAYJ,EAAmB,KAAKI,CAAE;AAEvE,EAAIM,KACM,QAAA;AAAA,IACN;AAAA,EACF;AAGI,QAAAC,IAAOC,EAAQR,CAAE;AAYrB,SAAA,gBAAAS;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAGP;AAAA,MACJ,SAZgB,CAACQ,MAA+C;AAC9D,QAAAX,OAAiBW,CAAK,GAErBA,EAAM,qBACTA,EAAM,eAAe,GACrBN,EAAmBJ,CAAE;AAAA,MAEzB;AAAA,MAMI,MAAMM,IAAa,SAAYC;AAAA,MAC/B,KAAKJ;AAAA,MAEJ,UAAAF;AAAA,IAAA;AAAA,EACH;AAEJ,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.js","sources":["../../../src/components/ui/alert.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport {cva, type VariantProps} from 'class-variance-authority'\n\nimport {cn} from '../../lib/utils'\n\nconst alertVariants = cva(\n 'relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current',\n {\n variants: {\n variant: {\n default: 'bg-card text-card-foreground',\n destructive:\n 'text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n }\n)\n\nfunction Alert({\n className,\n variant,\n ...props\n}: React.ComponentProps<'div'> & VariantProps<typeof alertVariants>) {\n return (\n <div\n data-slot=\"alert\"\n role=\"alert\"\n className={cn(alertVariants({variant}), className)}\n {...props}\n />\n )\n}\n\nfunction AlertTitle({className, ...props}: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"alert-title\"\n className={cn(\n 'col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction AlertDescription({className, ...props}: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"alert-description\"\n className={cn(\n 'text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed',\n className\n )}\n {...props}\n />\n )\n}\n\nexport {Alert, AlertTitle, AlertDescription}\n"],"names":["alertVariants","cva","Alert","className","variant","props","jsx","cn","AlertTitle","AlertDescription"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"alert.js","sources":["../../../src/components/ui/alert.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport {cva, type VariantProps} from 'class-variance-authority'\n\nimport {cn} from '../../lib/utils'\n\nexport interface AlertDocProps {\n /** Visual style variant */\n variant?: 'default' | 'destructive'\n /** Content to render inside */\n children?: React.ReactNode\n}\n\nconst alertVariants = cva(\n 'relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current',\n {\n variants: {\n variant: {\n default: 'bg-card text-card-foreground',\n destructive:\n 'text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n }\n)\n\nfunction Alert({\n className,\n variant,\n ...props\n}: React.ComponentProps<'div'> & VariantProps<typeof alertVariants>) {\n return (\n <div\n data-slot=\"alert\"\n role=\"alert\"\n className={cn(alertVariants({variant}), className)}\n {...props}\n />\n )\n}\n\nfunction AlertTitle({className, ...props}: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"alert-title\"\n className={cn(\n 'col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction AlertDescription({className, ...props}: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"alert-description\"\n className={cn(\n 'text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed',\n className\n )}\n {...props}\n />\n )\n}\n\nexport {Alert, AlertTitle, AlertDescription}\n"],"names":["alertVariants","cva","Alert","className","variant","props","jsx","cn","AlertTitle","AlertDescription"],"mappings":";;;AAaA,MAAMA,IAAgBC;AAAA,EACpB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,aACE;AAAA,MAAA;AAAA,IAEN;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,IAAA;AAAA,EACX;AAEJ;AAEA,SAASC,EAAM;AAAA,EACb,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,GAAGC;AACL,GAAqE;AAEjE,SAAA,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,aAAU;AAAA,MACV,MAAK;AAAA,MACL,WAAWC,EAAGP,EAAc,EAAC,SAAAI,EAAQ,CAAA,GAAGD,CAAS;AAAA,MAChD,GAAGE;AAAA,IAAA;AAAA,EACN;AAEJ;AAEA,SAASG,EAAW,EAAC,WAAAL,GAAW,GAAGE,KAAqC;AAEpE,SAAA,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,aAAU;AAAA,MACV,WAAWC;AAAA,QACT;AAAA,QACAJ;AAAA,MACF;AAAA,MACC,GAAGE;AAAA,IAAA;AAAA,EACN;AAEJ;AAEA,SAASI,EAAiB,EAAC,WAAAN,GAAW,GAAGE,KAAqC;AAE1E,SAAA,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,aAAU;AAAA,MACV,WAAWC;AAAA,QACT;AAAA,QACAJ;AAAA,MACF;AAAA,MACC,GAAGE;AAAA,IAAA;AAAA,EACN;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.js","sources":["../../../src/components/ui/badge.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport {cva, type VariantProps} from 'class-variance-authority'\nimport {Slot as SlotPrimitive} from 'radix-ui'\n\nimport {cn} from '../../lib/utils'\n\nconst badgeVariants = cva(\n 'inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none transition-[color,box-shadow] overflow-hidden',\n {\n variants: {\n variant: {\n primary: 'border-transparent bg-primary text-primary-foreground',\n secondary: 'border-transparent bg-secondary text-secondary-foreground',\n destructive:\n 'border-transparent bg-destructive text-white dark:bg-destructive/60',\n outline: 'bg-white text-foreground',\n none: '', // Allows custom classes\n },\n },\n defaultVariants: {\n variant: 'primary',\n },\n }\n)\n\nfunction Badge({\n className,\n variant,\n asChild = false,\n ...props\n}: React.ComponentProps<'span'> &\n VariantProps<typeof badgeVariants> & {asChild?: boolean}) {\n const Comp = asChild ? SlotPrimitive.Slot : 'span'\n\n return (\n <Comp\n data-slot=\"badge\"\n className={cn(badgeVariants({variant}), className)}\n {...props}\n />\n )\n}\n\nexport {Badge, badgeVariants}\n"],"names":["badgeVariants","cva","Badge","className","variant","asChild","props","jsx","SlotPrimitive.Slot","cn"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"badge.js","sources":["../../../src/components/ui/badge.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport {cva, type VariantProps} from 'class-variance-authority'\nimport {Slot as SlotPrimitive} from 'radix-ui'\n\nimport {cn} from '../../lib/utils'\n\nexport interface BadgeDocProps {\n /** Visual style variant */\n variant?: 'primary' | 'secondary' | 'destructive' | 'outline' | 'none'\n /** Render as child element instead of span */\n asChild?: boolean\n /** Content to render inside */\n children?: React.ReactNode\n}\n\nconst badgeVariants = cva(\n 'inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none transition-[color,box-shadow] overflow-hidden',\n {\n variants: {\n variant: {\n primary: 'border-transparent bg-primary text-primary-foreground',\n secondary: 'border-transparent bg-secondary text-secondary-foreground',\n destructive:\n 'border-transparent bg-destructive text-white dark:bg-destructive/60',\n outline: 'bg-white text-foreground',\n none: '', // Allows custom classes\n },\n },\n defaultVariants: {\n variant: 'primary',\n },\n }\n)\n\nfunction Badge({\n className,\n variant,\n asChild = false,\n ...props\n}: React.ComponentProps<'span'> &\n VariantProps<typeof badgeVariants> & {asChild?: boolean}) {\n const Comp = asChild ? SlotPrimitive.Slot : 'span'\n\n return (\n <Comp\n data-slot=\"badge\"\n className={cn(badgeVariants({variant}), className)}\n {...props}\n />\n )\n}\n\nexport {Badge, badgeVariants}\n"],"names":["badgeVariants","cva","Badge","className","variant","asChild","props","jsx","SlotPrimitive.Slot","cn"],"mappings":";;;;AAgBA,MAAMA,IAAgBC;AAAA,EACpB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,WAAW;AAAA,QACX,aACE;AAAA,QACF,SAAS;AAAA,QACT,MAAM;AAAA;AAAA,MAAA;AAAA,IAEV;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,IAAA;AAAA,EACX;AAEJ;AAEA,SAASC,EAAM;AAAA,EACb,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,GAAGC;AACL,GAC4D;AAIxD,SAAA,gBAAAC;AAAA,IAHWF,IAAUG,IAAqB;AAAA,IAGzC;AAAA,MACC,aAAU;AAAA,MACV,WAAWC,EAAGT,EAAc,EAAC,SAAAI,EAAQ,CAAA,GAAGD,CAAS;AAAA,MAChD,GAAGG;AAAA,IAAA;AAAA,EACN;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","sources":["../../../src/components/ui/input.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport {cn} from '../../lib/utils'\n\n// using the default ref doesn't seem to set the parent's ref object when mounted\n// Since this is a shadCN component, we need to make sure to add back the innerRef prop,\n// whenever the component is updated.\nfunction Input({\n innerRef,\n className,\n type,\n ...props\n}: React.ComponentProps<'input'> & {innerRef?: React.Ref<HTMLInputElement>}) {\n return (\n <input\n ref={innerRef}\n type={type}\n data-slot=\"input\"\n className={cn(\n 'file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',\n 'focus:outline-none focus:ring-0 focus-visible:ring-0 focus-visible:outline-none',\n 'aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive',\n className\n )}\n {...props}\n />\n )\n}\n\nexport {Input}\n"],"names":["Input","innerRef","className","type","props","jsx","cn"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"input.js","sources":["../../../src/components/ui/input.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport {cn} from '../../lib/utils'\n\nexport interface InputDocProps {\n /** Ref to the input element (use instead of ref) */\n innerRef?: React.Ref<HTMLInputElement>\n /** Input type (text, email, password, etc.) */\n type?: string\n /** Placeholder text */\n placeholder?: string\n /** Current value */\n value?: string\n /** Change handler */\n onChange?: React.ChangeEventHandler<HTMLInputElement>\n /** Whether the input is disabled */\n disabled?: boolean\n}\n\n// using the default ref doesn't seem to set the parent's ref object when mounted\n// Since this is a shadCN component, we need to make sure to add back the innerRef prop,\n// whenever the component is updated.\nfunction Input({\n innerRef,\n className,\n type,\n ...props\n}: React.ComponentProps<'input'> & {innerRef?: React.Ref<HTMLInputElement>}) {\n return (\n <input\n ref={innerRef}\n type={type}\n data-slot=\"input\"\n className={cn(\n 'file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',\n 'focus:outline-none focus:ring-0 focus-visible:ring-0 focus-visible:outline-none',\n 'aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive',\n className\n )}\n {...props}\n />\n )\n}\n\nexport {Input}\n"],"names":["Input","innerRef","className","type","props","jsx","cn"],"mappings":";;AAsBA,SAASA,EAAM;AAAA,EACb,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAAC;AAAA,EACA,GAAGC;AACL,GAA6E;AAEzE,SAAA,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAKJ;AAAA,MACL,MAAAE;AAAA,MACA,aAAU;AAAA,MACV,WAAWG;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACAJ;AAAA,MACF;AAAA,MACC,GAAGE;AAAA,IAAA;AAAA,EACN;AAEJ;"}
|
package/dist/index.js
CHANGED
|
@@ -2,12 +2,12 @@ import { DATA_NAVIGATION_TYPE_ATTRIBUTE as o, NAVIGATION_TYPES as t } from "./ty
|
|
|
2
2
|
import { MinisContainer as i } from "./components/MinisContainer.js";
|
|
3
3
|
import { AddToCartButton as n } from "./components/commerce/add-to-cart.js";
|
|
4
4
|
import { BuyNowButton as s } from "./components/commerce/buy-now.js";
|
|
5
|
-
import { ProductCard as u, ProductCardBadge as f, ProductCardContainer as x, ProductCardFavoriteButton as
|
|
5
|
+
import { ProductCard as u, ProductCardBadge as f, ProductCardContainer as x, ProductCardFavoriteButton as d, ProductCardImage as c, ProductCardImageContainer as C, ProductCardInfo as g, ProductCardPrice as S, ProductCardReviewStars as A, ProductCardTitle as D } from "./components/commerce/product-card.js";
|
|
6
6
|
import { ProductLink as T } from "./components/commerce/product-link.js";
|
|
7
|
-
import { MerchantCard as I, MerchantCardContainer as
|
|
8
|
-
import { ProductCardSkeleton as
|
|
7
|
+
import { MerchantCard as I, MerchantCardContainer as R, MerchantCardHeader as E, MerchantCardInfo as M, MerchantCardName as w, MerchantCardRating as B } from "./components/commerce/merchant-card.js";
|
|
8
|
+
import { ProductCardSkeleton as v } from "./components/commerce/product-card-skeleton.js";
|
|
9
9
|
import { MerchantCardSkeleton as L } from "./components/commerce/merchant-card-skeleton.js";
|
|
10
|
-
import { QuantitySelector as
|
|
10
|
+
import { QuantitySelector as N } from "./components/commerce/quantity-selector.js";
|
|
11
11
|
import { Search as _, SearchInput as y, SearchProvider as G, SearchResultsList as O } from "./components/commerce/search.js";
|
|
12
12
|
import { FavoriteButton as V } from "./components/commerce/favorite-button.js";
|
|
13
13
|
import { ImageContentWrapper as W } from "./components/content/image-content-wrapper.js";
|
|
@@ -22,21 +22,21 @@ import { AlertDialogAtom as pr } from "./components/atoms/alert-dialog.js";
|
|
|
22
22
|
import { List as mr } from "./components/atoms/list.js";
|
|
23
23
|
import { VideoPlayer as lr } from "./components/atoms/video-player.js";
|
|
24
24
|
import { TextInput as fr } from "./components/atoms/text-input.js";
|
|
25
|
-
import { ContentWrapper as
|
|
25
|
+
import { ContentWrapper as dr } from "./components/atoms/content-wrapper.js";
|
|
26
26
|
import { ProductVariantPrice as Cr } from "./components/atoms/product-variant-price.js";
|
|
27
27
|
import { Accordion as Sr, AccordionContent as Ar, AccordionItem as Dr, AccordionTrigger as Pr } from "./components/ui/accordion.js";
|
|
28
|
-
import { Alert as hr, AlertDescription as Ir, AlertTitle as
|
|
29
|
-
import { AlertDialog as
|
|
28
|
+
import { Alert as hr, AlertDescription as Ir, AlertTitle as Rr } from "./components/ui/alert.js";
|
|
29
|
+
import { AlertDialog as Mr, AlertDialogAction as wr, AlertDialogCancel as Br, AlertDialogContent as Fr, AlertDialogDescription as vr, AlertDialogFooter as Ur, AlertDialogHeader as Lr, AlertDialogOverlay as br, AlertDialogPortal as Nr, AlertDialogTitle as kr, AlertDialogTrigger as _r } from "./components/ui/alert-dialog.js";
|
|
30
30
|
import { Avatar as Gr, AvatarFallback as Or, AvatarImage as Hr } from "./components/ui/avatar.js";
|
|
31
31
|
import { Badge as zr, badgeVariants as Wr } from "./components/ui/badge.js";
|
|
32
32
|
import { Card as qr, CardAction as Kr, CardContent as Qr, CardDescription as Zr, CardFooter as jr, CardHeader as Jr, CardTitle as Xr } from "./components/ui/card.js";
|
|
33
33
|
import { Carousel as re, CarouselContent as ee, CarouselItem as oe, CarouselNext as te, CarouselPrevious as ae } from "./components/ui/carousel.js";
|
|
34
34
|
import { Checkbox as pe } from "./components/ui/checkbox.js";
|
|
35
|
-
import { Dialog as me, DialogClose as se, DialogContent as le, DialogDescription as ue, DialogFooter as fe, DialogHeader as xe, DialogOverlay as
|
|
36
|
-
import { Drawer as Ae, DrawerClose as De, DrawerContent as Pe, DrawerDescription as Te, DrawerFooter as he, DrawerHeader as Ie, DrawerOverlay as
|
|
37
|
-
import { Input as
|
|
35
|
+
import { Dialog as me, DialogClose as se, DialogContent as le, DialogDescription as ue, DialogFooter as fe, DialogHeader as xe, DialogOverlay as de, DialogPortal as ce, DialogTitle as Ce, DialogTrigger as ge } from "./components/ui/dialog.js";
|
|
36
|
+
import { Drawer as Ae, DrawerClose as De, DrawerContent as Pe, DrawerDescription as Te, DrawerFooter as he, DrawerHeader as Ie, DrawerOverlay as Re, DrawerPortal as Ee, DrawerTitle as Me, DrawerTrigger as we } from "./components/ui/drawer.js";
|
|
37
|
+
import { Input as Fe } from "./components/ui/input.js";
|
|
38
38
|
import { Label as Ue } from "./components/ui/label.js";
|
|
39
|
-
import { Progress as
|
|
39
|
+
import { Progress as be } from "./components/ui/progress.js";
|
|
40
40
|
import { RadioGroup as ke, RadioGroupItem as _e } from "./components/ui/radio-group.js";
|
|
41
41
|
import { ResizableHandle as Ge, ResizablePanel as Oe, ResizablePanelGroup as He } from "./components/ui/resizable.js";
|
|
42
42
|
import { ScrollArea as ze, ScrollBar as We } from "./components/ui/scroll-area.js";
|
|
@@ -48,12 +48,12 @@ import { toast as go } from "./shop-minis-react/node_modules/.pnpm/sonner@2.0.5_
|
|
|
48
48
|
import { Skeleton as Ao } from "./components/ui/skeleton.js";
|
|
49
49
|
import { useRecentProducts as Po } from "./hooks/user/useRecentProducts.js";
|
|
50
50
|
import { useRecentShops as ho } from "./hooks/user/useRecentShops.js";
|
|
51
|
-
import { useSavedProducts as
|
|
52
|
-
import { useSavedProductsActions as
|
|
53
|
-
import { useFollowedShops as
|
|
54
|
-
import { useFollowedShopsActions as
|
|
51
|
+
import { useSavedProducts as Ro } from "./hooks/user/useSavedProducts.js";
|
|
52
|
+
import { useSavedProductsActions as Mo } from "./hooks/user/useSavedProductsActions.js";
|
|
53
|
+
import { useFollowedShops as Bo } from "./hooks/user/useFollowedShops.js";
|
|
54
|
+
import { useFollowedShopsActions as vo } from "./hooks/user/useFollowedShopsActions.js";
|
|
55
55
|
import { useCurrentUser as Lo } from "./hooks/user/useCurrentUser.js";
|
|
56
|
-
import { useOrders as
|
|
56
|
+
import { useOrders as No } from "./hooks/user/useOrders.js";
|
|
57
57
|
import { useBuyerAttributes as _o } from "./hooks/user/useBuyerAttributes.js";
|
|
58
58
|
import { useGenerateUserToken as Go } from "./hooks/user/useGenerateUserToken.js";
|
|
59
59
|
import { useProductListActions as Ho } from "./hooks/product/useProductListActions.js";
|
|
@@ -70,17 +70,17 @@ import { useCuratedProducts as nt } from "./hooks/product/useCuratedProducts.js"
|
|
|
70
70
|
import { useAsyncStorage as st } from "./hooks/storage/useAsyncStorage.js";
|
|
71
71
|
import { useSecureStorage as ut } from "./hooks/storage/useSecureStorage.js";
|
|
72
72
|
import { useImageUpload as xt } from "./hooks/storage/useImageUpload.js";
|
|
73
|
-
import { useShopNavigation as
|
|
73
|
+
import { useShopNavigation as ct } from "./hooks/navigation/useShopNavigation.js";
|
|
74
74
|
import { useCloseMini as gt } from "./hooks/navigation/useCloseMini.js";
|
|
75
75
|
import { useDeeplink as At } from "./hooks/navigation/useDeeplink.js";
|
|
76
76
|
import { useNavigateWithTransition as Pt } from "./hooks/navigation/useNavigateWithTransition.js";
|
|
77
77
|
import { useShop as ht } from "./hooks/shop/useShop.js";
|
|
78
|
-
import { useRecommendedShops as
|
|
79
|
-
import { useCreateImageContent as
|
|
80
|
-
import { useErrorToast as
|
|
81
|
-
import { useErrorScreen as
|
|
78
|
+
import { useRecommendedShops as Rt } from "./hooks/shop/useRecommendedShops.js";
|
|
79
|
+
import { useCreateImageContent as Mt } from "./hooks/content/useCreateImageContent.js";
|
|
80
|
+
import { useErrorToast as Bt } from "./hooks/util/useErrorToast.js";
|
|
81
|
+
import { useErrorScreen as vt } from "./hooks/util/useErrorScreen.js";
|
|
82
82
|
import { useShare as Lt } from "./hooks/util/useShare.js";
|
|
83
|
-
import { useImagePicker as
|
|
83
|
+
import { useImagePicker as Nt } from "./hooks/util/useImagePicker.js";
|
|
84
84
|
import { useKeyboardAvoidingView as _t } from "./hooks/util/useKeyboardAvoidingView.js";
|
|
85
85
|
import { useRequestPermissions as Gt } from "./hooks/util/useRequestPermissions.js";
|
|
86
86
|
import { useOnMiniFocus as Ht } from "./hooks/events/useOnMiniFocus.js";
|
|
@@ -90,12 +90,12 @@ import { useOnAppStateChange as Kt } from "./hooks/events/useOnAppStateChange.js
|
|
|
90
90
|
import { MiniEntityNotFoundError as Zt, MiniError as jt, MiniNetworkError as Jt, formatError as Xt } from "./utils/errors.js";
|
|
91
91
|
import { extractBrandTheme as ra, formatReviewCount as ea, getFeaturedImages as oa, normalizeRating as ta } from "./utils/merchant-card.js";
|
|
92
92
|
import { parseUrl as ia } from "./utils/parseUrl.js";
|
|
93
|
-
import {
|
|
94
|
-
import { formatMoney as
|
|
95
|
-
import { UserState as
|
|
96
|
-
import { ContentCreateUserErrorCode as
|
|
97
|
-
import { Social as
|
|
98
|
-
import { DATA_FETCHING_DEFAULT_FETCH_POLICY as
|
|
93
|
+
import { dataURLToBlob as na, fileToDataUri as ma, getResizedImageUrl as sa, getThumbhashBlobURL as la, getThumbhashDataURL as ua } from "./utils/image.js";
|
|
94
|
+
import { formatMoney as xa } from "./utils/formatMoney.js";
|
|
95
|
+
import { UserState as ca, UserTokenGenerateUserErrorCode as Ca } from "./shop-minis-platform/src/types/user.js";
|
|
96
|
+
import { ContentCreateUserErrorCode as Sa, MinisContentStatus as Aa } from "./shop-minis-platform/src/types/content.js";
|
|
97
|
+
import { Social as Pa } from "./shop-minis-platform/src/types/share.js";
|
|
98
|
+
import { DATA_FETCHING_DEFAULT_FETCH_POLICY as ha, DATA_FETCHING_DEFAULT_PAGE_SIZE as Ia } from "./shop-minis-platform/src/constants.js";
|
|
99
99
|
export {
|
|
100
100
|
Sr as Accordion,
|
|
101
101
|
Ar as AccordionContent,
|
|
@@ -104,19 +104,19 @@ export {
|
|
|
104
104
|
n as AddToCartButton,
|
|
105
105
|
hr as Alert,
|
|
106
106
|
Ir as AlertDescription,
|
|
107
|
-
|
|
107
|
+
Mr as AlertDialog,
|
|
108
108
|
wr as AlertDialogAction,
|
|
109
109
|
pr as AlertDialogAtom,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
Br as AlertDialogCancel,
|
|
111
|
+
Fr as AlertDialogContent,
|
|
112
|
+
vr as AlertDialogDescription,
|
|
113
113
|
Ur as AlertDialogFooter,
|
|
114
114
|
Lr as AlertDialogHeader,
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
br as AlertDialogOverlay,
|
|
116
|
+
Nr as AlertDialogPortal,
|
|
117
117
|
kr as AlertDialogTitle,
|
|
118
118
|
_r as AlertDialogTrigger,
|
|
119
|
-
|
|
119
|
+
Rr as AlertTitle,
|
|
120
120
|
Gr as Avatar,
|
|
121
121
|
Or as AvatarFallback,
|
|
122
122
|
Hr as AvatarImage,
|
|
@@ -136,10 +136,10 @@ export {
|
|
|
136
136
|
te as CarouselNext,
|
|
137
137
|
ae as CarouselPrevious,
|
|
138
138
|
pe as Checkbox,
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
139
|
+
Sa as ContentCreateUserErrorCode,
|
|
140
|
+
dr as ContentWrapper,
|
|
141
|
+
ha as DATA_FETCHING_DEFAULT_FETCH_POLICY,
|
|
142
|
+
Ia as DATA_FETCHING_DEFAULT_PAGE_SIZE,
|
|
143
143
|
o as DATA_NAVIGATION_TYPE_ATTRIBUTE,
|
|
144
144
|
me as Dialog,
|
|
145
145
|
se as DialogClose,
|
|
@@ -147,8 +147,8 @@ export {
|
|
|
147
147
|
ue as DialogDescription,
|
|
148
148
|
fe as DialogFooter,
|
|
149
149
|
xe as DialogHeader,
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
de as DialogOverlay,
|
|
151
|
+
ce as DialogPortal,
|
|
152
152
|
Ce as DialogTitle,
|
|
153
153
|
ge as DialogTrigger,
|
|
154
154
|
Ae as Drawer,
|
|
@@ -157,47 +157,47 @@ export {
|
|
|
157
157
|
Te as DrawerDescription,
|
|
158
158
|
he as DrawerFooter,
|
|
159
159
|
Ie as DrawerHeader,
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
160
|
+
Re as DrawerOverlay,
|
|
161
|
+
Ee as DrawerPortal,
|
|
162
|
+
Me as DrawerTitle,
|
|
163
163
|
we as DrawerTrigger,
|
|
164
164
|
V as FavoriteButton,
|
|
165
165
|
X as IconButton,
|
|
166
166
|
rr as Image,
|
|
167
167
|
W as ImageContentWrapper,
|
|
168
|
-
|
|
168
|
+
Fe as Input,
|
|
169
169
|
Ue as Label,
|
|
170
170
|
mr as List,
|
|
171
171
|
ar as LongPressDetector,
|
|
172
172
|
I as MerchantCard,
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
173
|
+
R as MerchantCardContainer,
|
|
174
|
+
E as MerchantCardHeader,
|
|
175
|
+
M as MerchantCardInfo,
|
|
176
176
|
w as MerchantCardName,
|
|
177
|
-
|
|
177
|
+
B as MerchantCardRating,
|
|
178
178
|
L as MerchantCardSkeleton,
|
|
179
179
|
Zt as MiniEntityNotFoundError,
|
|
180
180
|
jt as MiniError,
|
|
181
181
|
Jt as MiniNetworkError,
|
|
182
182
|
i as MinisContainer,
|
|
183
|
-
|
|
183
|
+
Aa as MinisContentStatus,
|
|
184
184
|
q as MinisRouter,
|
|
185
185
|
t as NAVIGATION_TYPES,
|
|
186
186
|
u as ProductCard,
|
|
187
187
|
f as ProductCardBadge,
|
|
188
188
|
x as ProductCardContainer,
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
d as ProductCardFavoriteButton,
|
|
190
|
+
c as ProductCardImage,
|
|
191
191
|
C as ProductCardImageContainer,
|
|
192
192
|
g as ProductCardInfo,
|
|
193
193
|
S as ProductCardPrice,
|
|
194
194
|
A as ProductCardReviewStars,
|
|
195
|
-
|
|
195
|
+
v as ProductCardSkeleton,
|
|
196
196
|
D as ProductCardTitle,
|
|
197
197
|
T as ProductLink,
|
|
198
198
|
Cr as ProductVariantPrice,
|
|
199
|
-
|
|
200
|
-
|
|
199
|
+
be as Progress,
|
|
200
|
+
N as QuantitySelector,
|
|
201
201
|
ke as RadioGroup,
|
|
202
202
|
_e as RadioGroupItem,
|
|
203
203
|
Ge as ResizableHandle,
|
|
@@ -229,39 +229,41 @@ export {
|
|
|
229
229
|
uo as SheetTitle,
|
|
230
230
|
fo as SheetTrigger,
|
|
231
231
|
Ao as Skeleton,
|
|
232
|
-
|
|
232
|
+
Pa as Social,
|
|
233
233
|
fr as TextInput,
|
|
234
234
|
co as Toaster,
|
|
235
235
|
or as Touchable,
|
|
236
236
|
Q as TransitionLink,
|
|
237
|
-
|
|
238
|
-
|
|
237
|
+
ca as UserState,
|
|
238
|
+
Ca as UserTokenGenerateUserErrorCode,
|
|
239
239
|
lr as VideoPlayer,
|
|
240
240
|
Wr as badgeVariants,
|
|
241
|
+
na as dataURLToBlob,
|
|
241
242
|
ra as extractBrandTheme,
|
|
242
|
-
|
|
243
|
+
ma as fileToDataUri,
|
|
243
244
|
Xt as formatError,
|
|
244
|
-
|
|
245
|
+
xa as formatMoney,
|
|
245
246
|
ea as formatReviewCount,
|
|
246
247
|
oa as getFeaturedImages,
|
|
247
|
-
|
|
248
|
-
|
|
248
|
+
sa as getResizedImageUrl,
|
|
249
|
+
la as getThumbhashBlobURL,
|
|
250
|
+
ua as getThumbhashDataURL,
|
|
249
251
|
ta as normalizeRating,
|
|
250
252
|
ia as parseUrl,
|
|
251
253
|
go as toast,
|
|
252
254
|
st as useAsyncStorage,
|
|
253
255
|
_o as useBuyerAttributes,
|
|
254
256
|
gt as useCloseMini,
|
|
255
|
-
|
|
257
|
+
Mt as useCreateImageContent,
|
|
256
258
|
nt as useCuratedProducts,
|
|
257
259
|
Lo as useCurrentUser,
|
|
258
260
|
At as useDeeplink,
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
261
|
+
vt as useErrorScreen,
|
|
262
|
+
Bt as useErrorToast,
|
|
263
|
+
Bo as useFollowedShops,
|
|
264
|
+
vo as useFollowedShopsActions,
|
|
263
265
|
Go as useGenerateUserToken,
|
|
264
|
-
|
|
266
|
+
Nt as useImagePicker,
|
|
265
267
|
xt as useImageUpload,
|
|
266
268
|
_t as useKeyboardAvoidingView,
|
|
267
269
|
Pt as useNavigateWithTransition,
|
|
@@ -269,7 +271,7 @@ export {
|
|
|
269
271
|
zt as useOnMiniBlur,
|
|
270
272
|
Yt as useOnMiniClose,
|
|
271
273
|
Ht as useOnMiniFocus,
|
|
272
|
-
|
|
274
|
+
No as useOrders,
|
|
273
275
|
it as usePopularProducts,
|
|
274
276
|
Ko as useProduct,
|
|
275
277
|
Yo as useProductList,
|
|
@@ -282,13 +284,13 @@ export {
|
|
|
282
284
|
Po as useRecentProducts,
|
|
283
285
|
ho as useRecentShops,
|
|
284
286
|
tt as useRecommendedProducts,
|
|
285
|
-
|
|
287
|
+
Rt as useRecommendedShops,
|
|
286
288
|
Gt as useRequestPermissions,
|
|
287
|
-
|
|
288
|
-
|
|
289
|
+
Ro as useSavedProducts,
|
|
290
|
+
Mo as useSavedProductsActions,
|
|
289
291
|
ut as useSecureStorage,
|
|
290
292
|
Lt as useShare,
|
|
291
293
|
ht as useShop,
|
|
292
|
-
|
|
294
|
+
ct as useShopNavigation
|
|
293
295
|
};
|
|
294
296
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/image.js
CHANGED
|
@@ -1,22 +1,40 @@
|
|
|
1
|
-
import { toUint8Array as
|
|
2
|
-
import { thumbHashToDataURL as
|
|
3
|
-
function
|
|
1
|
+
import { toUint8Array as l } from "../shop-minis-react/node_modules/.pnpm/js-base64@3.7.7/node_modules/js-base64/base64.js";
|
|
2
|
+
import { thumbHashToDataURL as h } from "../shop-minis-react/node_modules/.pnpm/thumbhash@0.1.1/node_modules/thumbhash/thumbhash.js";
|
|
3
|
+
function d(t) {
|
|
4
4
|
if (t)
|
|
5
5
|
try {
|
|
6
|
-
const e =
|
|
7
|
-
return
|
|
6
|
+
const e = l(t);
|
|
7
|
+
return h(e);
|
|
8
8
|
} catch (e) {
|
|
9
9
|
console.warn("Failed to decode thumbhash to data URL", e);
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
function m(t) {
|
|
14
|
+
const [e, r] = t.split(","), n = e.match(/:(.*?);/), c = n ? n[1] : "image/png", a = atob(r), s = new Uint8Array(a.length);
|
|
15
|
+
for (let o = 0; o < a.length; o++)
|
|
16
|
+
s[o] = a.charCodeAt(o);
|
|
17
|
+
return new Blob([s], { type: c });
|
|
18
|
+
}
|
|
19
|
+
function R(t) {
|
|
20
|
+
if (t)
|
|
21
|
+
try {
|
|
22
|
+
const e = d(t);
|
|
23
|
+
if (!e) return;
|
|
24
|
+
const r = m(e);
|
|
25
|
+
return URL.createObjectURL(r);
|
|
26
|
+
} catch (e) {
|
|
27
|
+
console.warn("Failed to create thumbhash blob URL", e);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function w(t) {
|
|
32
|
+
return new Promise((e, r) => {
|
|
33
|
+
const n = new FileReader();
|
|
34
|
+
n.onloadend = () => e(n.result), n.onerror = r, n.readAsDataURL(t);
|
|
17
35
|
});
|
|
18
36
|
}
|
|
19
|
-
const
|
|
37
|
+
const i = {
|
|
20
38
|
xxsUrl: 32,
|
|
21
39
|
xsUrl: 64,
|
|
22
40
|
sUrl: 128,
|
|
@@ -26,27 +44,29 @@ const o = {
|
|
|
26
44
|
mUrl: 640,
|
|
27
45
|
lUrl: 1080,
|
|
28
46
|
xlUrl: 2048
|
|
29
|
-
},
|
|
47
|
+
}, u = 0.05, U = Object.entries(i).sort(
|
|
30
48
|
([, t], [, e]) => t - e
|
|
31
|
-
),
|
|
32
|
-
for (const [e,
|
|
33
|
-
const
|
|
34
|
-
if (t <=
|
|
49
|
+
), f = (t) => {
|
|
50
|
+
for (const [e, r] of U) {
|
|
51
|
+
const n = r + r * u;
|
|
52
|
+
if (t <= n) return e;
|
|
35
53
|
}
|
|
36
54
|
return "xlUrl";
|
|
37
|
-
},
|
|
38
|
-
const
|
|
39
|
-
return `${t}${
|
|
40
|
-
},
|
|
55
|
+
}, b = (t, e) => {
|
|
56
|
+
const n = new RegExp(/\?+/g).test(t) ? "&" : "?";
|
|
57
|
+
return `${t}${n}width=${e}`;
|
|
58
|
+
}, y = (t) => {
|
|
41
59
|
if (!t) return "";
|
|
42
60
|
if (!t.startsWith("https://cdn.shopify.com"))
|
|
43
61
|
return t;
|
|
44
|
-
const e = window.innerWidth ?? screen.width,
|
|
45
|
-
return
|
|
62
|
+
const e = window.innerWidth ?? screen.width, r = f(e);
|
|
63
|
+
return b(t, i[r]);
|
|
46
64
|
};
|
|
47
65
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
66
|
+
m as dataURLToBlob,
|
|
67
|
+
w as fileToDataUri,
|
|
68
|
+
y as getResizedImageUrl,
|
|
69
|
+
R as getThumbhashBlobURL,
|
|
70
|
+
d as getThumbhashDataURL
|
|
51
71
|
};
|
|
52
72
|
//# sourceMappingURL=image.js.map
|