@shopify/shop-minis-react 0.2.7 → 0.3.0
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/_virtual/index4.js +2 -2
- package/dist/_virtual/index5.js +2 -3
- package/dist/_virtual/index5.js.map +1 -1
- package/dist/_virtual/index6.js +3 -2
- package/dist/_virtual/index6.js.map +1 -1
- package/dist/components/MinisContainer.js +10 -10
- package/dist/components/MinisContainer.js.map +1 -1
- package/dist/components/atoms/product-variant-price.js +36 -43
- package/dist/components/atoms/product-variant-price.js.map +1 -1
- package/dist/components/commerce/add-to-cart.js +70 -53
- package/dist/components/commerce/add-to-cart.js.map +1 -1
- package/dist/components/commerce/buy-now.js +75 -0
- package/dist/components/commerce/buy-now.js.map +1 -0
- package/dist/components/commerce/product-card.js +16 -17
- package/dist/components/commerce/product-card.js.map +1 -1
- package/dist/index.js +230 -230
- package/dist/{hooks/shop → internal}/useShopCartActions.js +2 -2
- package/dist/internal/useShopCartActions.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/index.js +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/mpd-parser@1.3.1/node_modules/mpd-parser/dist/mpd-parser.es.js +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/querystringify@2.2.0/node_modules/querystringify/index.js +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/simple-swizzle@0.2.2/node_modules/simple-swizzle/index.js +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.1.0/node_modules/use-sync-external-store/shim/index.js +1 -1
- package/generated-hook-maps/hook-actions-map.json +0 -4
- package/package.json +2 -2
- package/src/components/MinisContainer.tsx +5 -3
- package/src/components/atoms/product-variant-price.tsx +1 -5
- package/src/components/commerce/add-to-cart.test.tsx +218 -3
- package/src/components/commerce/add-to-cart.tsx +40 -16
- package/src/components/commerce/buy-now.test.tsx +272 -0
- package/src/components/commerce/buy-now.tsx +108 -0
- package/src/components/commerce/product-card.tsx +5 -6
- package/src/components/index.ts +1 -0
- package/src/hooks/index.ts +0 -1
- package/src/{hooks/shop → internal}/useShopCartActions.ts +2 -2
- package/src/stories/AddToCart.stories.tsx +75 -10
- package/src/stories/ProductVariantPrice.stories.tsx +1 -4
- package/dist/hooks/shop/useShopCartActions.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-card.js","sources":["../../../src/components/commerce/product-card.tsx"],"sourcesContent":["import * as React from 'react'\nimport {useCallback, useContext, useMemo, useState} from 'react'\n\nimport {type Product, type ProductVariant} from '@shopify/shop-minis-platform'\n\nimport {useShopNavigation} from '../../hooks/navigation/useShopNavigation'\nimport {useSavedProductsActions} from '../../hooks/user/useSavedProductsActions'\nimport {formatMoney} from '../../lib/formatMoney'\nimport {cn} from '../../lib/utils'\nimport {Image} from '../atoms/image'\nimport {ProductVariantPrice} from '../atoms/product-variant-price'\nimport {Touchable} from '../atoms/touchable'\nimport {Badge} from '../ui/badge'\n\nimport {FavoriteButton} from './favorite-button'\n\n// Context definition\ninterface ProductCardContextValue {\n // Core data\n product: Product\n selectedProductVariant?: ProductVariant\n\n // UI configuration\n variant: 'default' | 'priceOverlay' | 'compact'\n touchable: boolean\n badgeText?: string\n badgeVariant?: 'primary' | 'secondary' | 'destructive' | 'outline' | 'none'\n\n // State\n isFavorited: boolean\n isFavoriteButtonDisabled: boolean\n\n // Actions\n onClick: () => void\n onFavoriteToggle: () => void\n}\n\nconst ProductCardContext = React.createContext<\n ProductCardContextValue | undefined\n>(undefined)\n\nfunction useProductCardContext() {\n const context = useContext(ProductCardContext)\n if (!context) {\n throw new Error(\n 'ProductCard components must be used within a ProductCard provider'\n )\n }\n return context\n}\n\n// Primitive components (building blocks)\nfunction ProductCardContainer({\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n const {touchable, onClick} = useProductCardContext()\n\n const content = (\n <div\n className={cn(\n 'relative w-full overflow-hidden rounded-xl border-0',\n className\n )}\n {...props}\n />\n )\n\n if (touchable && onClick) {\n return (\n <Touchable\n onClick={onClick}\n whileTap={{opacity: 0.7}}\n transition={{\n opacity: {type: 'tween', duration: 0.08, ease: 'easeInOut'},\n }}\n >\n {content}\n </Touchable>\n )\n }\n\n return content\n}\n\nfunction ProductCardImageContainer({\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n const {variant} = useProductCardContext()\n\n return (\n <div\n data-slot=\"product-card-image-container\"\n className={cn(\n // Ensure the product image is stretched to the full size of the container (can't use width/height: 100% because of flex)\n 'flex justify-stretch items-stretch',\n 'relative overflow-hidden rounded-xl border border-gray-200',\n 'w-full aspect-square',\n variant === 'compact' ? 'min-h-[104px]' : 'min-h-[134px]',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction ProductCardImage({className, ...props}: React.ComponentProps<'img'>) {\n const {product, selectedProductVariant} = useProductCardContext()\n\n // Derive display image locally\n const displayImage = selectedProductVariant?.image || product.featuredImage\n const src = displayImage?.url\n const alt = displayImage?.altText || product.title\n const thumbhash = product.featuredImage?.thumbhash\n\n const renderImageElement = useCallback(\n (src: string) => {\n const imageElement = thumbhash ? (\n <Image\n data-slot=\"product-card-image\"\n src={src}\n alt={alt}\n aspectRatio={1}\n thumbhash={thumbhash}\n className={cn('size-full object-cover', className)}\n {...props}\n />\n ) : (\n <img\n data-slot=\"product-card-image\"\n src={src}\n alt={alt}\n className={cn('size-full', className)}\n {...props}\n />\n )\n\n return imageElement\n },\n [alt, className, props, thumbhash]\n )\n\n return (\n <div className=\"bg-gray-100 flex items-center justify-center size-full\">\n {src ? (\n renderImageElement(src)\n ) : (\n <div className=\"text-gray-400 text-sm w-full text-center\">No Image</div>\n )}\n </div>\n )\n}\n\nfunction ProductCardBadge({\n className,\n position = 'bottom-left',\n variant,\n children,\n ...props\n}: React.ComponentProps<typeof Badge> & {\n position?: 'top-left' | 'bottom-left'\n}) {\n const {badgeText, badgeVariant} = useProductCardContext()\n // If no children provided, use badgeText from context\n const content = children || badgeText\n\n if (!content) return null\n\n return (\n <div\n className={cn(\n 'absolute z-10',\n position === 'top-left' ? 'top-3 left-3' : 'bottom-2 left-2'\n )}\n >\n <Badge\n variant={variant ?? badgeVariant ?? 'none'}\n className={cn(\n !badgeVariant &&\n !variant &&\n 'bg-black/50 text-white border-transparent',\n 'rounded',\n className\n )}\n {...props}\n >\n {content}\n </Badge>\n </div>\n )\n}\n\nfunction ProductCardFavoriteButton({\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n const {isFavorited, isFavoriteButtonDisabled, onFavoriteToggle} =\n useProductCardContext()\n if (isFavoriteButtonDisabled) return null\n\n return (\n <div className={cn('absolute bottom-3 right-3 z-10', className)} {...props}>\n <FavoriteButton onClick={onFavoriteToggle} filled={isFavorited} />\n </div>\n )\n}\n\nfunction ProductCardInfo({className, ...props}: React.ComponentProps<'div'>) {\n const {variant} = useProductCardContext()\n if (variant !== 'default') {\n return null\n }\n\n return (\n <div\n data-slot=\"product-card-info\"\n className={cn('px-1 pt-2 pb-0 space-y-1', className)}\n {...props}\n />\n )\n}\n\nfunction ProductCardTitle({\n className,\n children,\n ...props\n}: React.ComponentProps<'h3'>) {\n const {product} = useProductCardContext()\n return (\n <h3\n data-slot=\"product-card-title\"\n className={cn(\n 'text-sm font-medium leading-tight text-gray-900',\n 'truncate overflow-hidden whitespace-nowrap text-ellipsis',\n className\n )}\n {...props}\n >\n {children || product.title}\n </h3>\n )\n}\n\nfunction ProductCardPrice({className}: {className?: string}) {\n const {product, selectedProductVariant} = useProductCardContext()\n\n // Derive price data locally\n const displayPrice = selectedProductVariant?.price || product?.price\n const displayCompareAtPrice =\n selectedProductVariant?.compareAtPrice || product?.compareAtPrice\n\n return (\n <ProductVariantPrice\n amount={displayPrice?.amount || ''}\n currencyCode={displayPrice?.currencyCode || ''}\n compareAtPriceAmount={displayCompareAtPrice?.amount}\n compareAtPriceCurrencyCode={displayCompareAtPrice?.currencyCode}\n className={className}\n />\n )\n}\n\n// Special PriceOverlayBadge for price overlay variant\nfunction ProductCardPriceOverlayBadge() {\n const {product, selectedProductVariant, variant} = useProductCardContext()\n if (variant !== 'priceOverlay') return null\n const displayPrice = selectedProductVariant?.price || product.price\n const currencyCode = displayPrice?.currencyCode\n const amount = displayPrice?.amount\n\n if (!currencyCode || !amount) return null\n return (\n <ProductCardBadge position=\"top-left\">\n {formatMoney(amount, currencyCode)}\n </ProductCardBadge>\n )\n}\n\nexport interface ProductCardProps {\n /** The product to display in the card */\n product: Product\n /** Optional selected variant of the product to show specific variant data */\n selectedProductVariant?: ProductVariant\n /** Visual style variant of the card */\n variant?: 'default' | 'priceOverlay' | 'compact'\n /** Whether the card can be clicked/tapped to navigate to product details */\n touchable?: boolean\n /** Optional text to display in a badge on the card */\n badgeText?: string\n /** Visual style variant for the badge */\n badgeVariant?: 'primary' | 'secondary' | 'destructive' | 'outline' | 'none'\n /** Callback fired when the product is clicked */\n onProductClick?: () => void\n /** Callback fired when the favorite button is toggled */\n onFavoriteToggled?: (isFavorited: boolean) => void\n /** Custom layout via children */\n children?: React.ReactNode\n /** Whether the favorite button is disabled */\n favoriteButtonDisabled?: boolean\n}\n\nfunction ProductCard({\n product,\n selectedProductVariant,\n variant = 'default',\n touchable = true,\n badgeText,\n badgeVariant,\n onProductClick,\n onFavoriteToggled,\n children,\n favoriteButtonDisabled = false,\n}: ProductCardProps) {\n const {navigateToProduct} = useShopNavigation()\n const {saveProduct, unsaveProduct} = useSavedProductsActions()\n\n // Local state for optimistic UI updates\n const [isFavoritedLocal, setIsFavoritedLocal] = useState(product.isFavorited)\n\n const handleClick = useCallback(() => {\n if (!touchable) return\n\n onProductClick?.()\n\n navigateToProduct({\n productId: product.id,\n })\n }, [navigateToProduct, product.id, touchable, onProductClick])\n\n const handleFavoriteClick = useCallback(async () => {\n const previousState = isFavoritedLocal\n\n // Optimistic update\n setIsFavoritedLocal(!previousState)\n onFavoriteToggled?.(!previousState)\n\n try {\n if (previousState) {\n await unsaveProduct({\n productId: product.id,\n shopId: product.shop.id,\n productVariantId:\n selectedProductVariant?.id || product.defaultVariantId,\n })\n } else {\n await saveProduct({\n productId: product.id,\n shopId: product.shop.id,\n productVariantId:\n selectedProductVariant?.id || product.defaultVariantId,\n })\n }\n } catch (error) {\n // Revert optimistic update on error\n setIsFavoritedLocal(previousState)\n onFavoriteToggled?.(previousState)\n }\n }, [\n isFavoritedLocal,\n product.id,\n product.shop.id,\n product.defaultVariantId,\n selectedProductVariant?.id,\n saveProduct,\n unsaveProduct,\n onFavoriteToggled,\n ])\n\n const contextValue = useMemo<ProductCardContextValue>(\n () => ({\n // Core data\n product,\n selectedProductVariant,\n\n // UI configuration\n variant,\n touchable,\n badgeText,\n badgeVariant,\n\n // State\n isFavorited: isFavoritedLocal,\n isFavoriteButtonDisabled: favoriteButtonDisabled,\n // Actions\n onClick: handleClick,\n onFavoriteToggle: handleFavoriteClick,\n }),\n [\n product,\n selectedProductVariant,\n variant,\n touchable,\n badgeText,\n badgeVariant,\n isFavoritedLocal,\n handleClick,\n handleFavoriteClick,\n favoriteButtonDisabled,\n ]\n )\n\n return (\n <ProductCardContext.Provider value={contextValue}>\n {children ?? (\n <ProductCardContainer>\n <ProductCardImageContainer>\n <ProductCardImage />\n {variant === 'priceOverlay' && <ProductCardPriceOverlayBadge />}\n <ProductCardBadge />\n <ProductCardFavoriteButton />\n </ProductCardImageContainer>\n {variant === 'default' && (\n <ProductCardInfo>\n <ProductCardTitle />\n <ProductCardPrice />\n </ProductCardInfo>\n )}\n </ProductCardContainer>\n )}\n </ProductCardContext.Provider>\n )\n}\n\nexport {\n ProductCard,\n ProductCardContainer,\n ProductCardImageContainer,\n ProductCardImage,\n ProductCardBadge,\n ProductCardFavoriteButton,\n ProductCardInfo,\n ProductCardTitle,\n ProductCardPrice,\n}\n"],"names":["ProductCardContext","React","useProductCardContext","context","useContext","ProductCardContainer","className","props","touchable","onClick","content","jsx","cn","Touchable","ProductCardImageContainer","variant","ProductCardImage","product","selectedProductVariant","displayImage","src","alt","thumbhash","renderImageElement","useCallback","Image","ProductCardBadge","position","children","badgeText","badgeVariant","Badge","ProductCardFavoriteButton","isFavorited","isFavoriteButtonDisabled","onFavoriteToggle","FavoriteButton","ProductCardInfo","ProductCardTitle","ProductCardPrice","displayPrice","displayCompareAtPrice","ProductVariantPrice","ProductCardPriceOverlayBadge","currencyCode","amount","formatMoney","ProductCard","onProductClick","onFavoriteToggled","favoriteButtonDisabled","navigateToProduct","useShopNavigation","saveProduct","unsaveProduct","useSavedProductsActions","isFavoritedLocal","setIsFavoritedLocal","useState","handleClick","handleFavoriteClick","previousState","contextValue","useMemo","jsxs"],"mappings":";;;;;;;;;;;;AAqCA,MAAMA,IAAqBC,EAAM,cAE/B,MAAS;AAEX,SAASC,IAAwB;AACzB,QAAAC,IAAUC,EAAWJ,CAAkB;AAC7C,MAAI,CAACG;AACH,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAEK,SAAAA;AACT;AAGA,SAASE,EAAqB;AAAA,EAC5B,WAAAC;AAAA,EACA,GAAGC;AACL,GAAgC;AAC9B,QAAM,EAAC,WAAAC,GAAW,SAAAC,EAAO,IAAIP,EAAsB,GAE7CQ,IACJ,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACT;AAAA,QACAN;AAAA,MACF;AAAA,MACC,GAAGC;AAAA,IAAA;AAAA,EACN;AAGF,SAAIC,KAAaC,IAEb,gBAAAE;AAAA,IAACE;AAAA,IAAA;AAAA,MACC,SAAAJ;AAAA,MACA,UAAU,EAAC,SAAS,IAAG;AAAA,MACvB,YAAY;AAAA,QACV,SAAS,EAAC,MAAM,SAAS,UAAU,MAAM,MAAM,YAAW;AAAA,MAC5D;AAAA,MAEC,UAAAC;AAAA,IAAA;AAAA,EACH,IAIGA;AACT;AAEA,SAASI,EAA0B;AAAA,EACjC,WAAAR;AAAA,EACA,GAAGC;AACL,GAAgC;AACxB,QAAA,EAAC,SAAAQ,EAAO,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E3C;AAAA,MACAC;AAAA,MACAH;AAAA,MACAP;AAAA,MACAqB;AAAA,MACAC;AAAA,MACA0B;AAAA,MACAG;AAAA,MACAC;AAAA,MACAV;AAAA,IAAA;AAAA,EAEJ;AAGE,SAAA,gBAAAvC,EAACX,EAAmB,UAAnB,EAA4B,OAAO8D,GACjC,UAAAlC,uBACEvB,GACC,EAAA,UAAA;AAAA,IAAA,gBAAA2D,EAAClD,GACC,EAAA,UAAA;AAAA,MAAA,gBAAAH,EAACK,GAAiB,EAAA;AAAA,MACjBD,MAAY,kBAAkB,gBAAAJ,EAACgC,GAA6B,CAAA,CAAA;AAAA,wBAC5DjB,GAAiB,EAAA;AAAA,wBACjBM,GAA0B,CAAA,CAAA;AAAA,IAAA,GAC7B;AAAA,IACCjB,MAAY,aACX,gBAAAiD,EAAC3B,GACC,EAAA,UAAA;AAAA,MAAA,gBAAA1B,EAAC2B,GAAiB,EAAA;AAAA,wBACjBC,GAAiB,CAAA,CAAA;AAAA,IAAA,EACpB,CAAA;AAAA,EAAA,EAAA,CAEJ,EAEJ,CAAA;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"product-card.js","sources":["../../../src/components/commerce/product-card.tsx"],"sourcesContent":["import * as React from 'react'\nimport {useCallback, useContext, useMemo, useState} from 'react'\n\nimport {type Product, type ProductVariant} from '@shopify/shop-minis-platform'\n\nimport {useShopNavigation} from '../../hooks/navigation/useShopNavigation'\nimport {useSavedProductsActions} from '../../hooks/user/useSavedProductsActions'\nimport {formatMoney} from '../../lib/formatMoney'\nimport {cn} from '../../lib/utils'\nimport {Image} from '../atoms/image'\nimport {ProductVariantPrice} from '../atoms/product-variant-price'\nimport {Touchable} from '../atoms/touchable'\nimport {Badge} from '../ui/badge'\n\nimport {FavoriteButton} from './favorite-button'\n\n// Context definition\ninterface ProductCardContextValue {\n // Core data\n product: Product\n selectedProductVariant?: ProductVariant\n\n // UI configuration\n variant: 'default' | 'priceOverlay' | 'compact'\n touchable: boolean\n badgeText?: string\n badgeVariant?: 'primary' | 'secondary' | 'destructive' | 'outline' | 'none'\n\n // State\n isFavorited: boolean\n isFavoriteButtonDisabled: boolean\n\n // Actions\n onClick: () => void\n onFavoriteToggle: () => void\n}\n\nconst ProductCardContext = React.createContext<\n ProductCardContextValue | undefined\n>(undefined)\n\nfunction useProductCardContext() {\n const context = useContext(ProductCardContext)\n if (!context) {\n throw new Error(\n 'ProductCard components must be used within a ProductCard provider'\n )\n }\n return context\n}\n\n// Primitive components (building blocks)\nfunction ProductCardContainer({\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n const {touchable, onClick} = useProductCardContext()\n\n const content = (\n <div\n className={cn(\n 'relative size-full overflow-hidden rounded-xl border-0',\n className\n )}\n {...props}\n />\n )\n\n if (touchable && onClick) {\n return (\n <Touchable\n onClick={onClick}\n whileTap={{opacity: 0.7}}\n transition={{\n opacity: {type: 'tween', duration: 0.08, ease: 'easeInOut'},\n }}\n >\n {content}\n </Touchable>\n )\n }\n\n return content\n}\n\nfunction ProductCardImageContainer({\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n const {variant} = useProductCardContext()\n\n return (\n <div\n data-slot=\"product-card-image-container\"\n className={cn(\n 'relative overflow-hidden rounded-xl border border-gray-200',\n 'aspect-square',\n variant === 'compact' ? 'min-h-[104px]' : 'min-h-[134px]',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction ProductCardImage({className, ...props}: React.ComponentProps<'img'>) {\n const {product, selectedProductVariant} = useProductCardContext()\n\n // Derive display image locally\n const displayImage = selectedProductVariant?.image || product.featuredImage\n const src = displayImage?.url\n const alt = displayImage?.altText || product.title\n const thumbhash = product.featuredImage?.thumbhash\n\n const renderImageElement = useCallback(\n (src: string) => {\n const imageElement = thumbhash ? (\n <Image\n data-slot=\"product-card-image\"\n src={src}\n alt={alt}\n aspectRatio={1}\n thumbhash={thumbhash}\n objectFit=\"cover\"\n className={cn('size-full', className)}\n {...props}\n />\n ) : (\n <img\n data-slot=\"product-card-image\"\n src={src}\n alt={alt}\n className={cn('size-full object-cover', className)}\n {...props}\n />\n )\n\n return imageElement\n },\n [alt, className, props, thumbhash]\n )\n\n return (\n <div className=\"bg-gray-100 flex items-center justify-center size-full\">\n {src ? (\n renderImageElement(src)\n ) : (\n <div className=\"text-gray-400 text-sm w-full text-center\">No Image</div>\n )}\n </div>\n )\n}\n\nfunction ProductCardBadge({\n className,\n position = 'bottom-left',\n variant,\n children,\n ...props\n}: React.ComponentProps<typeof Badge> & {\n position?: 'top-left' | 'bottom-left'\n}) {\n const {badgeText, badgeVariant} = useProductCardContext()\n // If no children provided, use badgeText from context\n const content = children || badgeText\n\n if (!content) return null\n\n return (\n <div\n className={cn(\n 'absolute z-10',\n position === 'top-left' ? 'top-3 left-3' : 'bottom-2 left-2'\n )}\n >\n <Badge\n variant={variant ?? badgeVariant ?? 'none'}\n className={cn(\n !badgeVariant &&\n !variant &&\n 'bg-black/50 text-white border-transparent',\n 'rounded',\n className\n )}\n {...props}\n >\n {content}\n </Badge>\n </div>\n )\n}\n\nfunction ProductCardFavoriteButton({\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n const {isFavorited, isFavoriteButtonDisabled, onFavoriteToggle} =\n useProductCardContext()\n if (isFavoriteButtonDisabled) return null\n\n return (\n <div className={cn('absolute bottom-3 right-3 z-10', className)} {...props}>\n <FavoriteButton onClick={onFavoriteToggle} filled={isFavorited} />\n </div>\n )\n}\n\nfunction ProductCardInfo({className, ...props}: React.ComponentProps<'div'>) {\n const {variant} = useProductCardContext()\n if (variant !== 'default') {\n return null\n }\n\n return (\n <div\n data-slot=\"product-card-info\"\n className={cn('px-1 pt-2 pb-0 space-y-1', className)}\n {...props}\n />\n )\n}\n\nfunction ProductCardTitle({\n className,\n children,\n ...props\n}: React.ComponentProps<'h3'>) {\n const {product} = useProductCardContext()\n return (\n <h3\n data-slot=\"product-card-title\"\n className={cn(\n 'text-sm font-medium leading-tight text-gray-900',\n 'truncate overflow-hidden whitespace-nowrap text-ellipsis',\n className\n )}\n {...props}\n >\n {children || product.title}\n </h3>\n )\n}\n\nfunction ProductCardPrice({className}: {className?: string}) {\n const {product, selectedProductVariant} = useProductCardContext()\n\n // Derive price data locally\n const displayPrice = selectedProductVariant?.price || product?.price\n const displayCompareAtPrice =\n selectedProductVariant?.compareAtPrice || product?.compareAtPrice\n\n return (\n <ProductVariantPrice\n amount={displayPrice?.amount || ''}\n currencyCode={displayPrice?.currencyCode || ''}\n compareAtPriceAmount={displayCompareAtPrice?.amount}\n compareAtPriceCurrencyCode={displayCompareAtPrice?.currencyCode}\n className={className}\n />\n )\n}\n\n// Special PriceOverlayBadge for price overlay variant\nfunction ProductCardPriceOverlayBadge() {\n const {product, selectedProductVariant, variant} = useProductCardContext()\n if (variant !== 'priceOverlay') return null\n const displayPrice = selectedProductVariant?.price || product.price\n const currencyCode = displayPrice?.currencyCode\n const amount = displayPrice?.amount\n\n if (!currencyCode || !amount) return null\n return (\n <ProductCardBadge position=\"top-left\">\n {formatMoney(amount, currencyCode)}\n </ProductCardBadge>\n )\n}\n\nexport interface ProductCardProps {\n /** The product to display in the card */\n product: Product\n /** Optional selected variant of the product to show specific variant data */\n selectedProductVariant?: ProductVariant\n /** Visual style variant of the card */\n variant?: 'default' | 'priceOverlay' | 'compact'\n /** Whether the card can be clicked/tapped to navigate to product details */\n touchable?: boolean\n /** Optional text to display in a badge on the card */\n badgeText?: string\n /** Visual style variant for the badge */\n badgeVariant?: 'primary' | 'secondary' | 'destructive' | 'outline' | 'none'\n /** Callback fired when the product is clicked */\n onProductClick?: () => void\n /** Callback fired when the favorite button is toggled */\n onFavoriteToggled?: (isFavorited: boolean) => void\n /** Custom layout via children */\n children?: React.ReactNode\n /** Whether the favorite button is disabled */\n favoriteButtonDisabled?: boolean\n}\n\nfunction ProductCard({\n product,\n selectedProductVariant,\n variant = 'default',\n touchable = true,\n badgeText,\n badgeVariant,\n onProductClick,\n onFavoriteToggled,\n children,\n favoriteButtonDisabled = false,\n}: ProductCardProps) {\n const {navigateToProduct} = useShopNavigation()\n const {saveProduct, unsaveProduct} = useSavedProductsActions()\n\n // Local state for optimistic UI updates\n const [isFavoritedLocal, setIsFavoritedLocal] = useState(product.isFavorited)\n\n const handleClick = useCallback(() => {\n if (!touchable) return\n\n onProductClick?.()\n\n navigateToProduct({\n productId: product.id,\n })\n }, [navigateToProduct, product.id, touchable, onProductClick])\n\n const handleFavoriteClick = useCallback(async () => {\n const previousState = isFavoritedLocal\n\n // Optimistic update\n setIsFavoritedLocal(!previousState)\n onFavoriteToggled?.(!previousState)\n\n try {\n if (previousState) {\n await unsaveProduct({\n productId: product.id,\n shopId: product.shop.id,\n productVariantId:\n selectedProductVariant?.id || product.defaultVariantId,\n })\n } else {\n await saveProduct({\n productId: product.id,\n shopId: product.shop.id,\n productVariantId:\n selectedProductVariant?.id || product.defaultVariantId,\n })\n }\n } catch (error) {\n // Revert optimistic update on error\n setIsFavoritedLocal(previousState)\n onFavoriteToggled?.(previousState)\n }\n }, [\n isFavoritedLocal,\n product.id,\n product.shop.id,\n product.defaultVariantId,\n selectedProductVariant?.id,\n saveProduct,\n unsaveProduct,\n onFavoriteToggled,\n ])\n\n const contextValue = useMemo<ProductCardContextValue>(\n () => ({\n // Core data\n product,\n selectedProductVariant,\n\n // UI configuration\n variant,\n touchable,\n badgeText,\n badgeVariant,\n\n // State\n isFavorited: isFavoritedLocal,\n isFavoriteButtonDisabled: favoriteButtonDisabled,\n // Actions\n onClick: handleClick,\n onFavoriteToggle: handleFavoriteClick,\n }),\n [\n product,\n selectedProductVariant,\n variant,\n touchable,\n badgeText,\n badgeVariant,\n isFavoritedLocal,\n handleClick,\n handleFavoriteClick,\n favoriteButtonDisabled,\n ]\n )\n\n return (\n <ProductCardContext.Provider value={contextValue}>\n {children ?? (\n <ProductCardContainer>\n <ProductCardImageContainer>\n <ProductCardImage />\n {variant === 'priceOverlay' && <ProductCardPriceOverlayBadge />}\n <ProductCardBadge />\n <ProductCardFavoriteButton />\n </ProductCardImageContainer>\n {variant === 'default' && (\n <ProductCardInfo>\n <ProductCardTitle />\n <ProductCardPrice />\n </ProductCardInfo>\n )}\n </ProductCardContainer>\n )}\n </ProductCardContext.Provider>\n )\n}\n\nexport {\n ProductCard,\n ProductCardContainer,\n ProductCardImageContainer,\n ProductCardImage,\n ProductCardBadge,\n ProductCardFavoriteButton,\n ProductCardInfo,\n ProductCardTitle,\n ProductCardPrice,\n}\n"],"names":["ProductCardContext","React","useProductCardContext","context","useContext","ProductCardContainer","className","props","touchable","onClick","content","jsx","cn","Touchable","ProductCardImageContainer","variant","ProductCardImage","product","selectedProductVariant","displayImage","src","alt","thumbhash","renderImageElement","useCallback","Image","ProductCardBadge","position","children","badgeText","badgeVariant","Badge","ProductCardFavoriteButton","isFavorited","isFavoriteButtonDisabled","onFavoriteToggle","FavoriteButton","ProductCardInfo","ProductCardTitle","ProductCardPrice","displayPrice","displayCompareAtPrice","ProductVariantPrice","ProductCardPriceOverlayBadge","currencyCode","amount","formatMoney","ProductCard","onProductClick","onFavoriteToggled","favoriteButtonDisabled","navigateToProduct","useShopNavigation","saveProduct","unsaveProduct","useSavedProductsActions","isFavoritedLocal","setIsFavoritedLocal","useState","handleClick","handleFavoriteClick","previousState","contextValue","useMemo","jsxs"],"mappings":";;;;;;;;;;;;AAqCA,MAAMA,IAAqBC,EAAM,cAE/B,MAAS;AAEX,SAASC,IAAwB;AACzB,QAAAC,IAAUC,EAAWJ,CAAkB;AAC7C,MAAI,CAACG;AACH,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAEK,SAAAA;AACT;AAGA,SAASE,EAAqB;AAAA,EAC5B,WAAAC;AAAA,EACA,GAAGC;AACL,GAAgC;AAC9B,QAAM,EAAC,WAAAC,GAAW,SAAAC,EAAO,IAAIP,EAAsB,GAE7CQ,IACJ,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACT;AAAA,QACAN;AAAA,MACF;AAAA,MACC,GAAGC;AAAA,IAAA;AAAA,EACN;AA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A,IACRC,GAAwB;AAAA,IACxBmC;AAAA,IACAC;AAAA,IACAL;AAAA,EAAA,CACD,GAEKa,IAAeC;AAAA,IACnB,OAAO;AAAA;AAAA,MAEL,SAAA9C;AAAA,MACA,wBAAAC;AAAA;AAAA,MAGA,SAAAH;AAAA,MACA,WAAAP;AAAA,MACA,WAAAqB;AAAA,MACA,cAAAC;AAAA;AAAA,MAGA,aAAa0B;AAAA,MACb,0BAA0BN;AAAA;AAAA,MAE1B,SAASS;AAAA,MACT,kBAAkBC;AAAA,IAAA;AAAA,IAEpB;AAAA,MACE3C;AAAA,MACAC;AAAA,MACAH;AAAA,MACAP;AAAA,MACAqB;AAAA,MACAC;AAAA,MACA0B;AAAA,MACAG;AAAA,MACAC;AAAA,MACAV;AAAA,IAAA;AAAA,EAEJ;AAGE,SAAA,gBAAAvC,EAACX,EAAmB,UAAnB,EAA4B,OAAO8D,GACjC,UAAAlC,uBACEvB,GACC,EAAA,UAAA;AAAA,IAAA,gBAAA2D,EAAClD,GACC,EAAA,UAAA;AAAA,MAAA,gBAAAH,EAACK,GAAiB,EAAA;AAAA,MACjBD,MAAY,kBAAkB,gBAAAJ,EAACgC,GAA6B,CAAA,CAAA;AAAA,wBAC5DjB,GAAiB,EAAA;AAAA,wBACjBM,GAA0B,CAAA,CAAA;AAAA,IAAA,GAC7B;AAAA,IACCjB,MAAY,aACX,gBAAAiD,EAAC3B,GACC,EAAA,UAAA;AAAA,MAAA,gBAAA1B,EAAC2B,GAAiB,EAAA;AAAA,wBACjBC,GAAiB,CAAA,CAAA;AAAA,IAAA,EACpB,CAAA;AAAA,EAAA,EAAA,CAEJ,EAEJ,CAAA;AAEJ;"}
|
package/dist/index.js
CHANGED
|
@@ -1,88 +1,88 @@
|
|
|
1
1
|
import { DATA_NAVIGATION_TYPE_ATTRIBUTE as o, NAVIGATION_TYPES as t } from "./types/index.js";
|
|
2
2
|
import { MinisContainer as i } from "./components/MinisContainer.js";
|
|
3
3
|
import { AddToCartButton as n } from "./components/commerce/add-to-cart.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
62
|
-
import {
|
|
63
|
-
import {
|
|
64
|
-
import {
|
|
65
|
-
import {
|
|
66
|
-
import {
|
|
67
|
-
import {
|
|
68
|
-
import {
|
|
69
|
-
import {
|
|
70
|
-
import {
|
|
71
|
-
import {
|
|
72
|
-
import {
|
|
73
|
-
import {
|
|
74
|
-
import {
|
|
75
|
-
import {
|
|
4
|
+
import { BuyNowButton as s } from "./components/commerce/buy-now.js";
|
|
5
|
+
import { ProductCard as u, ProductCardBadge as f, ProductCardContainer as x, ProductCardFavoriteButton as c, ProductCardImage as d, ProductCardImageContainer as C, ProductCardInfo as g, ProductCardPrice as S, ProductCardTitle as D } from "./components/commerce/product-card.js";
|
|
6
|
+
import { ProductLink as P } from "./components/commerce/product-link.js";
|
|
7
|
+
import { MerchantCard as T, MerchantCardContainer as I, MerchantCardHeader as M, MerchantCardInfo as R, MerchantCardName as w, MerchantCardRating as v } from "./components/commerce/merchant-card.js";
|
|
8
|
+
import { ProductCardSkeleton as F } from "./components/commerce/product-card-skeleton.js";
|
|
9
|
+
import { MerchantCardSkeleton as b } from "./components/commerce/merchant-card-skeleton.js";
|
|
10
|
+
import { QuantitySelector as E } from "./components/commerce/quantity-selector.js";
|
|
11
|
+
import { Search as N, SearchInput as y, SearchProvider as O, SearchResultsList as G } from "./components/commerce/search.js";
|
|
12
|
+
import { FavoriteButton as V } from "./components/commerce/favorite-button.js";
|
|
13
|
+
import { ImageContentWrapper as _ } from "./components/content/image-content-wrapper.js";
|
|
14
|
+
import { MinisRouter as Y } from "./components/navigation/minis-router.js";
|
|
15
|
+
import { TransitionLink as K } from "./components/navigation/transition-link.js";
|
|
16
|
+
import { Button as j } from "./components/atoms/button.js";
|
|
17
|
+
import { IconButton as X } from "./components/atoms/icon-button.js";
|
|
18
|
+
import { Image as $ } from "./components/atoms/image.js";
|
|
19
|
+
import { Touchable as er } from "./components/atoms/touchable.js";
|
|
20
|
+
import { LongPressDetector as tr } from "./components/atoms/long-press-detector.js";
|
|
21
|
+
import { AlertDialogAtom as ir } from "./components/atoms/alert-dialog.js";
|
|
22
|
+
import { List as nr } from "./components/atoms/list.js";
|
|
23
|
+
import { VideoPlayer as sr } from "./components/atoms/video-player.js";
|
|
24
|
+
import { TextInput as ur } from "./components/atoms/text-input.js";
|
|
25
|
+
import { ContentWrapper as xr } from "./components/atoms/content-wrapper.js";
|
|
26
|
+
import { Accordion as dr, AccordionContent as Cr, AccordionItem as gr, AccordionTrigger as Sr } from "./components/ui/accordion.js";
|
|
27
|
+
import { Alert as Ar, AlertDescription as Pr, AlertTitle as hr } from "./components/ui/alert.js";
|
|
28
|
+
import { AlertDialog as Ir, AlertDialogAction as Mr, AlertDialogCancel as Rr, AlertDialogContent as wr, AlertDialogDescription as vr, AlertDialogFooter as Br, AlertDialogHeader as Fr, AlertDialogOverlay as Ur, AlertDialogPortal as br, AlertDialogTitle as kr, AlertDialogTrigger as Er } from "./components/ui/alert-dialog.js";
|
|
29
|
+
import { Avatar as Nr, AvatarFallback as yr, AvatarImage as Or } from "./components/ui/avatar.js";
|
|
30
|
+
import { Badge as Hr, badgeVariants as Vr } from "./components/ui/badge.js";
|
|
31
|
+
import { Card as _r, CardAction as Wr, CardContent as Yr, CardDescription as qr, CardFooter as Kr, CardHeader as Qr, CardTitle as jr } from "./components/ui/card.js";
|
|
32
|
+
import { Carousel as Xr, CarouselContent as Zr, CarouselItem as $r, CarouselNext as re, CarouselPrevious as ee } from "./components/ui/carousel.js";
|
|
33
|
+
import { Checkbox as te } from "./components/ui/checkbox.js";
|
|
34
|
+
import { Dialog as ie, DialogClose as pe, DialogContent as ne, DialogDescription as me, DialogFooter as se, DialogHeader as le, DialogOverlay as ue, DialogPortal as fe, DialogTitle as xe, DialogTrigger as ce } from "./components/ui/dialog.js";
|
|
35
|
+
import { Drawer as Ce, DrawerClose as ge, DrawerContent as Se, DrawerDescription as De, DrawerFooter as Ae, DrawerHeader as Pe, DrawerOverlay as he, DrawerPortal as Te, DrawerTitle as Ie, DrawerTrigger as Me } from "./components/ui/drawer.js";
|
|
36
|
+
import { Input as we } from "./components/ui/input.js";
|
|
37
|
+
import { Label as Be } from "./components/ui/label.js";
|
|
38
|
+
import { Progress as Ue } from "./components/ui/progress.js";
|
|
39
|
+
import { RadioGroup as ke, RadioGroupItem as Ee } from "./components/ui/radio-group.js";
|
|
40
|
+
import { ResizableHandle as Ne, ResizablePanel as ye, ResizablePanelGroup as Oe } from "./components/ui/resizable.js";
|
|
41
|
+
import { ScrollArea as He, ScrollBar as Ve } from "./components/ui/scroll-area.js";
|
|
42
|
+
import { Select as _e, SelectContent as We, SelectGroup as Ye, SelectItem as qe, SelectLabel as Ke, SelectScrollDownButton as Qe, SelectScrollUpButton as je, SelectSeparator as Je, SelectTrigger as Xe, SelectValue as Ze } from "./components/ui/select.js";
|
|
43
|
+
import { Separator as ro } from "./components/ui/separator.js";
|
|
44
|
+
import { Sheet as oo, SheetClose as to, SheetContent as ao, SheetDescription as io, SheetFooter as po, SheetHeader as no, SheetTitle as mo, SheetTrigger as so } from "./components/ui/sheet.js";
|
|
45
|
+
import { Toaster as uo } from "./components/ui/sonner.js";
|
|
46
|
+
import { Skeleton as xo } from "./components/ui/skeleton.js";
|
|
47
|
+
import { useRecentProducts as Co } from "./hooks/user/useRecentProducts.js";
|
|
48
|
+
import { useRecentShops as So } from "./hooks/user/useRecentShops.js";
|
|
49
|
+
import { useSavedProducts as Ao } from "./hooks/user/useSavedProducts.js";
|
|
50
|
+
import { useSavedProductsActions as ho } from "./hooks/user/useSavedProductsActions.js";
|
|
51
|
+
import { useFollowedShops as Io } from "./hooks/user/useFollowedShops.js";
|
|
52
|
+
import { useFollowedShopsActions as Ro } from "./hooks/user/useFollowedShopsActions.js";
|
|
53
|
+
import { useCurrentUser as vo } from "./hooks/user/useCurrentUser.js";
|
|
54
|
+
import { useOrders as Fo } from "./hooks/user/useOrders.js";
|
|
55
|
+
import { useBuyerAttributes as bo } from "./hooks/user/useBuyerAttributes.js";
|
|
56
|
+
import { useGenerateUserToken as Eo } from "./hooks/user/useGenerateUserToken.js";
|
|
57
|
+
import { useProductListActions as No } from "./hooks/product/useProductListActions.js";
|
|
58
|
+
import { useProductLists as Oo } from "./hooks/product/useProductLists.js";
|
|
59
|
+
import { useProductList as Ho } from "./hooks/product/useProductList.js";
|
|
60
|
+
import { useProduct as zo } from "./hooks/product/useProduct.js";
|
|
61
|
+
import { useProducts as Wo } from "./hooks/product/useProducts.js";
|
|
62
|
+
import { useProductVariants as qo } from "./hooks/product/useProductVariants.js";
|
|
63
|
+
import { useProductMedia as Qo } from "./hooks/product/useProductMedia.js";
|
|
64
|
+
import { useProductSearch as Jo } from "./hooks/product/useProductSearch.js";
|
|
65
|
+
import { useRecommendedProducts as Zo } from "./hooks/product/useRecommendedProducts.js";
|
|
66
|
+
import { usePopularProducts as rt } from "./hooks/product/usePopularProducts.js";
|
|
67
|
+
import { useCuratedProducts as ot } from "./hooks/product/useCuratedProducts.js";
|
|
68
|
+
import { useAsyncStorage as at } from "./hooks/storage/useAsyncStorage.js";
|
|
69
|
+
import { useSecureStorage as pt } from "./hooks/storage/useSecureStorage.js";
|
|
70
|
+
import { useImageUpload as mt } from "./hooks/storage/useImageUpload.js";
|
|
71
|
+
import { useShopNavigation as lt } from "./hooks/navigation/useShopNavigation.js";
|
|
72
|
+
import { useCloseMini as ft } from "./hooks/navigation/useCloseMini.js";
|
|
73
|
+
import { useDeeplink as ct } from "./hooks/navigation/useDeeplink.js";
|
|
74
|
+
import { useNavigateWithTransition as Ct } from "./hooks/navigation/useNavigateWithTransition.js";
|
|
75
|
+
import { useShop as St } from "./hooks/shop/useShop.js";
|
|
76
76
|
import { useRecommendedShops as At } from "./hooks/shop/useRecommendedShops.js";
|
|
77
77
|
import { useCreateImageContent as ht } from "./hooks/content/useCreateImageContent.js";
|
|
78
78
|
import { useErrorToast as It } from "./hooks/util/useErrorToast.js";
|
|
79
79
|
import { useErrorScreen as Rt } from "./hooks/util/useErrorScreen.js";
|
|
80
|
-
import { useShare as
|
|
80
|
+
import { useShare as vt } from "./hooks/util/useShare.js";
|
|
81
81
|
import { useImagePicker as Ft } from "./hooks/util/useImagePicker.js";
|
|
82
82
|
import { useKeyboardAvoidingView as bt } from "./hooks/util/useKeyboardAvoidingView.js";
|
|
83
83
|
import { useRequestPermissions as Et } from "./hooks/util/useRequestPermissions.js";
|
|
84
84
|
import { useOnMiniFocus as Nt } from "./hooks/events/useOnMiniFocus.js";
|
|
85
|
-
import { useOnMiniBlur as
|
|
85
|
+
import { useOnMiniBlur as Ot } from "./hooks/events/useOnMiniBlur.js";
|
|
86
86
|
import { useOnMiniClose as Ht } from "./hooks/events/useOnMiniClose.js";
|
|
87
87
|
import { useOnAppStateChange as zt } from "./hooks/events/useOnAppStateChange.js";
|
|
88
88
|
import { MiniEntityNotFoundError as Wt, MiniError as Yt, MiniNetworkError as qt, formatError as Kt } from "./utils/errors.js";
|
|
@@ -93,142 +93,143 @@ import { UserState as pa, UserTokenGenerateUserErrorCode as na } from "./shop-mi
|
|
|
93
93
|
import { ContentCreateUserErrorCode as sa, MinisContentStatus as la } from "./shop-minis-platform/src/types/content.js";
|
|
94
94
|
import { Social as fa } from "./shop-minis-platform/src/types/share.js";
|
|
95
95
|
export {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
dr as Accordion,
|
|
97
|
+
Cr as AccordionContent,
|
|
98
|
+
gr as AccordionItem,
|
|
99
|
+
Sr as AccordionTrigger,
|
|
100
100
|
n as AddToCartButton,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
jr as
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
ee as
|
|
101
|
+
Ar as Alert,
|
|
102
|
+
Pr as AlertDescription,
|
|
103
|
+
Ir as AlertDialog,
|
|
104
|
+
Mr as AlertDialogAction,
|
|
105
|
+
ir as AlertDialogAtom,
|
|
106
|
+
Rr as AlertDialogCancel,
|
|
107
|
+
wr as AlertDialogContent,
|
|
108
|
+
vr as AlertDialogDescription,
|
|
109
|
+
Br as AlertDialogFooter,
|
|
110
|
+
Fr as AlertDialogHeader,
|
|
111
|
+
Ur as AlertDialogOverlay,
|
|
112
|
+
br as AlertDialogPortal,
|
|
113
|
+
kr as AlertDialogTitle,
|
|
114
|
+
Er as AlertDialogTrigger,
|
|
115
|
+
hr as AlertTitle,
|
|
116
|
+
Nr as Avatar,
|
|
117
|
+
yr as AvatarFallback,
|
|
118
|
+
Or as AvatarImage,
|
|
119
|
+
Hr as Badge,
|
|
120
|
+
j as Button,
|
|
121
|
+
s as BuyNowButton,
|
|
122
|
+
_r as Card,
|
|
123
|
+
Wr as CardAction,
|
|
124
|
+
Yr as CardContent,
|
|
125
|
+
qr as CardDescription,
|
|
126
|
+
Kr as CardFooter,
|
|
127
|
+
Qr as CardHeader,
|
|
128
|
+
jr as CardTitle,
|
|
129
|
+
Xr as Carousel,
|
|
130
|
+
Zr as CarouselContent,
|
|
131
|
+
$r as CarouselItem,
|
|
132
|
+
re as CarouselNext,
|
|
133
|
+
ee as CarouselPrevious,
|
|
134
|
+
te as Checkbox,
|
|
134
135
|
sa as ContentCreateUserErrorCode,
|
|
135
|
-
|
|
136
|
+
xr as ContentWrapper,
|
|
136
137
|
o as DATA_NAVIGATION_TYPE_ATTRIBUTE,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
138
|
+
ie as Dialog,
|
|
139
|
+
pe as DialogClose,
|
|
140
|
+
ne as DialogContent,
|
|
141
|
+
me as DialogDescription,
|
|
142
|
+
se as DialogFooter,
|
|
143
|
+
le as DialogHeader,
|
|
144
|
+
ue as DialogOverlay,
|
|
145
|
+
fe as DialogPortal,
|
|
146
|
+
xe as DialogTitle,
|
|
147
|
+
ce as DialogTrigger,
|
|
148
|
+
Ce as Drawer,
|
|
149
|
+
ge as DrawerClose,
|
|
150
|
+
Se as DrawerContent,
|
|
151
|
+
De as DrawerDescription,
|
|
152
|
+
Ae as DrawerFooter,
|
|
153
|
+
Pe as DrawerHeader,
|
|
154
|
+
he as DrawerOverlay,
|
|
155
|
+
Te as DrawerPortal,
|
|
156
|
+
Ie as DrawerTitle,
|
|
157
|
+
Me as DrawerTrigger,
|
|
158
|
+
V as FavoriteButton,
|
|
159
|
+
X as IconButton,
|
|
160
|
+
$ as Image,
|
|
161
|
+
_ as ImageContentWrapper,
|
|
162
|
+
we as Input,
|
|
163
|
+
Be as Label,
|
|
164
|
+
nr as List,
|
|
165
|
+
tr as LongPressDetector,
|
|
166
|
+
T as MerchantCard,
|
|
167
|
+
I as MerchantCardContainer,
|
|
168
|
+
M as MerchantCardHeader,
|
|
169
|
+
R as MerchantCardInfo,
|
|
170
|
+
w as MerchantCardName,
|
|
171
|
+
v as MerchantCardRating,
|
|
172
|
+
b as MerchantCardSkeleton,
|
|
172
173
|
Wt as MiniEntityNotFoundError,
|
|
173
174
|
Yt as MiniError,
|
|
174
175
|
qt as MiniNetworkError,
|
|
175
176
|
i as MinisContainer,
|
|
176
177
|
la as MinisContentStatus,
|
|
177
|
-
|
|
178
|
+
Y as MinisRouter,
|
|
178
179
|
t as NAVIGATION_TYPES,
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
180
|
+
u as ProductCard,
|
|
181
|
+
f as ProductCardBadge,
|
|
182
|
+
x as ProductCardContainer,
|
|
183
|
+
c as ProductCardFavoriteButton,
|
|
184
|
+
d as ProductCardImage,
|
|
185
|
+
C as ProductCardImageContainer,
|
|
186
|
+
g as ProductCardInfo,
|
|
187
|
+
S as ProductCardPrice,
|
|
188
|
+
F as ProductCardSkeleton,
|
|
189
|
+
D as ProductCardTitle,
|
|
190
|
+
P as ProductLink,
|
|
191
|
+
Ue as Progress,
|
|
192
|
+
E as QuantitySelector,
|
|
193
|
+
ke as RadioGroup,
|
|
194
|
+
Ee as RadioGroupItem,
|
|
195
|
+
Ne as ResizableHandle,
|
|
196
|
+
ye as ResizablePanel,
|
|
197
|
+
Oe as ResizablePanelGroup,
|
|
198
|
+
He as ScrollArea,
|
|
199
|
+
Ve as ScrollBar,
|
|
200
|
+
N as Search,
|
|
201
|
+
y as SearchInput,
|
|
202
|
+
O as SearchProvider,
|
|
203
|
+
G as SearchResultsList,
|
|
204
|
+
_e as Select,
|
|
205
|
+
We as SelectContent,
|
|
206
|
+
Ye as SelectGroup,
|
|
207
|
+
qe as SelectItem,
|
|
208
|
+
Ke as SelectLabel,
|
|
209
|
+
Qe as SelectScrollDownButton,
|
|
210
|
+
je as SelectScrollUpButton,
|
|
211
|
+
Je as SelectSeparator,
|
|
212
|
+
Xe as SelectTrigger,
|
|
213
|
+
Ze as SelectValue,
|
|
214
|
+
ro as Separator,
|
|
215
|
+
oo as Sheet,
|
|
216
|
+
to as SheetClose,
|
|
217
|
+
ao as SheetContent,
|
|
218
|
+
io as SheetDescription,
|
|
219
|
+
po as SheetFooter,
|
|
220
|
+
no as SheetHeader,
|
|
221
|
+
mo as SheetTitle,
|
|
222
|
+
so as SheetTrigger,
|
|
223
|
+
xo as Skeleton,
|
|
223
224
|
fa as Social,
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
225
|
+
ur as TextInput,
|
|
226
|
+
uo as Toaster,
|
|
227
|
+
er as Touchable,
|
|
228
|
+
K as TransitionLink,
|
|
228
229
|
pa as UserState,
|
|
229
230
|
na as UserTokenGenerateUserErrorCode,
|
|
230
|
-
|
|
231
|
-
|
|
231
|
+
sr as VideoPlayer,
|
|
232
|
+
Vr as badgeVariants,
|
|
232
233
|
jt as extractBrandTheme,
|
|
233
234
|
oa as fileToDataUri,
|
|
234
235
|
Kt as formatError,
|
|
@@ -238,47 +239,46 @@ export {
|
|
|
238
239
|
aa as getThumbhashDataURL,
|
|
239
240
|
Zt as normalizeRating,
|
|
240
241
|
ra as parseUrl,
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
242
|
+
at as useAsyncStorage,
|
|
243
|
+
bo as useBuyerAttributes,
|
|
244
|
+
ft as useCloseMini,
|
|
244
245
|
ht as useCreateImageContent,
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
246
|
+
ot as useCuratedProducts,
|
|
247
|
+
vo as useCurrentUser,
|
|
248
|
+
ct as useDeeplink,
|
|
248
249
|
Rt as useErrorScreen,
|
|
249
250
|
It as useErrorToast,
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
251
|
+
Io as useFollowedShops,
|
|
252
|
+
Ro as useFollowedShopsActions,
|
|
253
|
+
Eo as useGenerateUserToken,
|
|
253
254
|
Ft as useImagePicker,
|
|
254
|
-
|
|
255
|
+
mt as useImageUpload,
|
|
255
256
|
bt as useKeyboardAvoidingView,
|
|
256
|
-
|
|
257
|
+
Ct as useNavigateWithTransition,
|
|
257
258
|
zt as useOnAppStateChange,
|
|
258
|
-
|
|
259
|
+
Ot as useOnMiniBlur,
|
|
259
260
|
Ht as useOnMiniClose,
|
|
260
261
|
Nt as useOnMiniFocus,
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
262
|
+
Fo as useOrders,
|
|
263
|
+
rt as usePopularProducts,
|
|
264
|
+
zo as useProduct,
|
|
265
|
+
Ho as useProductList,
|
|
266
|
+
No as useProductListActions,
|
|
267
|
+
Oo as useProductLists,
|
|
268
|
+
Qo as useProductMedia,
|
|
269
|
+
Jo as useProductSearch,
|
|
270
|
+
qo as useProductVariants,
|
|
271
|
+
Wo as useProducts,
|
|
272
|
+
Co as useRecentProducts,
|
|
273
|
+
So as useRecentShops,
|
|
274
|
+
Zo as useRecommendedProducts,
|
|
274
275
|
At as useRecommendedShops,
|
|
275
276
|
Et as useRequestPermissions,
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
mt as useShopNavigation
|
|
277
|
+
Ao as useSavedProducts,
|
|
278
|
+
ho as useSavedProductsActions,
|
|
279
|
+
pt as useSecureStorage,
|
|
280
|
+
vt as useShare,
|
|
281
|
+
St as useShop,
|
|
282
|
+
lt as useShopNavigation
|
|
283
283
|
};
|
|
284
284
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useHandleAction as o } from "
|
|
2
|
-
import { useShopActions as u } from "
|
|
1
|
+
import { useHandleAction as o } from "./useHandleAction.js";
|
|
2
|
+
import { useShopActions as u } from "./useShopActions.js";
|
|
3
3
|
const n = () => {
|
|
4
4
|
const { addToCart: t, buyProduct: r } = u();
|
|
5
5
|
return {
|