@shopify/shop-minis-react 0.0.3 → 0.0.4
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/commerce/product-card.js +297 -0
- package/dist/components/commerce/product-card.js.map +1 -0
- package/dist/components/commerce/product-link.js +2 -2
- package/dist/components/commerce/product-link.js.map +1 -1
- package/dist/components/ui/alert-dialog.js +1 -1
- package/dist/components/ui/alert-dialog.js.map +1 -1
- package/dist/components/ui/button.js +24 -20
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/carousel.js +2 -2
- package/dist/components/ui/carousel.js.map +1 -1
- package/dist/index.js +188 -176
- package/dist/index.js.map +1 -1
- package/dist/lib/formatMoney.js +15 -0
- package/dist/lib/formatMoney.js.map +1 -0
- package/package.json +1 -1
- package/src/components/commerce/product-card.tsx +427 -0
- package/src/components/commerce/product-link.tsx +2 -2
- package/src/components/index.ts +1 -0
- package/src/components/ui/alert-dialog.tsx +1 -1
- package/src/components/ui/button.tsx +17 -11
- package/src/components/ui/carousel.tsx +2 -2
- package/src/dev.tsx +175 -17
- package/src/index.css +143 -62
- package/src/lib/formatMoney.ts +21 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.js","sources":["../../../src/components/ui/carousel.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\n\nimport useEmblaCarousel, {type UseEmblaCarouselType} from 'embla-carousel-react'\nimport {ArrowLeft, ArrowRight} from 'lucide-react'\n\nimport {cn} from '../../lib/utils'\n\nimport {Button} from './button'\n\ntype CarouselApi = UseEmblaCarouselType[1]\ntype UseCarouselParameters = Parameters<typeof useEmblaCarousel>\ntype CarouselOptions = UseCarouselParameters[0]\ntype CarouselPlugin = UseCarouselParameters[1]\n\ninterface CarouselProps {\n opts?: CarouselOptions\n plugins?: CarouselPlugin\n orientation?: 'horizontal' | 'vertical'\n setApi?: (api: CarouselApi) => void\n}\n\ntype CarouselContextProps = {\n carouselRef: ReturnType<typeof useEmblaCarousel>[0]\n api: ReturnType<typeof useEmblaCarousel>[1]\n scrollPrev: () => void\n scrollNext: () => void\n canScrollPrev: boolean\n canScrollNext: boolean\n} & CarouselProps\n\nconst CarouselContext = React.createContext<CarouselContextProps | null>(null)\n\nfunction useCarousel() {\n const context = React.useContext(CarouselContext)\n\n if (!context) {\n throw new Error('useCarousel must be used within a <Carousel />')\n }\n\n return context\n}\n\nfunction Carousel({\n orientation = 'horizontal',\n opts,\n setApi,\n plugins,\n className,\n children,\n ...props\n}: React.ComponentProps<'div'> & CarouselProps) {\n const [carouselRef, api] = useEmblaCarousel(\n {\n ...opts,\n axis: orientation === 'horizontal' ? 'x' : 'y',\n },\n plugins\n )\n const [canScrollPrev, setCanScrollPrev] = React.useState(false)\n const [canScrollNext, setCanScrollNext] = React.useState(false)\n\n const onSelect = React.useCallback((api: CarouselApi) => {\n if (!api) return\n setCanScrollPrev(api.canScrollPrev())\n setCanScrollNext(api.canScrollNext())\n }, [])\n\n const scrollPrev = React.useCallback(() => {\n api?.scrollPrev()\n }, [api])\n\n const scrollNext = React.useCallback(() => {\n api?.scrollNext()\n }, [api])\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'ArrowLeft') {\n event.preventDefault()\n scrollPrev()\n } else if (event.key === 'ArrowRight') {\n event.preventDefault()\n scrollNext()\n }\n },\n [scrollPrev, scrollNext]\n )\n\n React.useEffect(() => {\n if (!api || !setApi) return\n setApi(api)\n }, [api, setApi])\n\n React.useEffect(() => {\n if (!api) return\n onSelect(api)\n api.on('reInit', onSelect)\n api.on('select', onSelect)\n\n return () => {\n api?.off('select', onSelect)\n }\n }, [api, onSelect])\n\n return (\n <CarouselContext.Provider\n value={{\n carouselRef,\n api,\n opts,\n orientation:\n orientation || (opts?.axis === 'y' ? 'vertical' : 'horizontal'),\n scrollPrev,\n scrollNext,\n canScrollPrev,\n canScrollNext,\n }}\n >\n <div\n onKeyDownCapture={handleKeyDown}\n className={cn('relative', className)}\n role=\"region\"\n aria-roledescription=\"carousel\"\n data-slot=\"carousel\"\n {...props}\n >\n {children}\n </div>\n </CarouselContext.Provider>\n )\n}\n\nfunction CarouselContent({className, ...props}: React.ComponentProps<'div'>) {\n const {carouselRef, orientation} = useCarousel()\n\n return (\n <div\n ref={carouselRef}\n className=\"overflow-hidden\"\n data-slot=\"carousel-content\"\n >\n <div\n className={cn(\n 'flex',\n orientation === 'horizontal' ? '-ml-4' : '-mt-4 flex-col',\n className\n )}\n {...props}\n />\n </div>\n )\n}\n\nfunction CarouselItem({className, ...props}: React.ComponentProps<'div'>) {\n const {orientation} = useCarousel()\n\n return (\n <div\n role=\"group\"\n aria-roledescription=\"slide\"\n data-slot=\"carousel-item\"\n className={cn(\n 'min-w-0 shrink-0 grow-0 basis-full',\n orientation === 'horizontal' ? 'pl-4' : 'pt-4',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CarouselPrevious({\n className,\n variant = '
|
|
1
|
+
{"version":3,"file":"carousel.js","sources":["../../../src/components/ui/carousel.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\n\nimport useEmblaCarousel, {type UseEmblaCarouselType} from 'embla-carousel-react'\nimport {ArrowLeft, ArrowRight} from 'lucide-react'\n\nimport {cn} from '../../lib/utils'\n\nimport {Button} from './button'\n\ntype CarouselApi = UseEmblaCarouselType[1]\ntype UseCarouselParameters = Parameters<typeof useEmblaCarousel>\ntype CarouselOptions = UseCarouselParameters[0]\ntype CarouselPlugin = UseCarouselParameters[1]\n\ninterface CarouselProps {\n opts?: CarouselOptions\n plugins?: CarouselPlugin\n orientation?: 'horizontal' | 'vertical'\n setApi?: (api: CarouselApi) => void\n}\n\ntype CarouselContextProps = {\n carouselRef: ReturnType<typeof useEmblaCarousel>[0]\n api: ReturnType<typeof useEmblaCarousel>[1]\n scrollPrev: () => void\n scrollNext: () => void\n canScrollPrev: boolean\n canScrollNext: boolean\n} & CarouselProps\n\nconst CarouselContext = React.createContext<CarouselContextProps | null>(null)\n\nfunction useCarousel() {\n const context = React.useContext(CarouselContext)\n\n if (!context) {\n throw new Error('useCarousel must be used within a <Carousel />')\n }\n\n return context\n}\n\nfunction Carousel({\n orientation = 'horizontal',\n opts,\n setApi,\n plugins,\n className,\n children,\n ...props\n}: React.ComponentProps<'div'> & CarouselProps) {\n const [carouselRef, api] = useEmblaCarousel(\n {\n ...opts,\n axis: orientation === 'horizontal' ? 'x' : 'y',\n },\n plugins\n )\n const [canScrollPrev, setCanScrollPrev] = React.useState(false)\n const [canScrollNext, setCanScrollNext] = React.useState(false)\n\n const onSelect = React.useCallback((api: CarouselApi) => {\n if (!api) return\n setCanScrollPrev(api.canScrollPrev())\n setCanScrollNext(api.canScrollNext())\n }, [])\n\n const scrollPrev = React.useCallback(() => {\n api?.scrollPrev()\n }, [api])\n\n const scrollNext = React.useCallback(() => {\n api?.scrollNext()\n }, [api])\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'ArrowLeft') {\n event.preventDefault()\n scrollPrev()\n } else if (event.key === 'ArrowRight') {\n event.preventDefault()\n scrollNext()\n }\n },\n [scrollPrev, scrollNext]\n )\n\n React.useEffect(() => {\n if (!api || !setApi) return\n setApi(api)\n }, [api, setApi])\n\n React.useEffect(() => {\n if (!api) return\n onSelect(api)\n api.on('reInit', onSelect)\n api.on('select', onSelect)\n\n return () => {\n api?.off('select', onSelect)\n }\n }, [api, onSelect])\n\n return (\n <CarouselContext.Provider\n value={{\n carouselRef,\n api,\n opts,\n orientation:\n orientation || (opts?.axis === 'y' ? 'vertical' : 'horizontal'),\n scrollPrev,\n scrollNext,\n canScrollPrev,\n canScrollNext,\n }}\n >\n <div\n onKeyDownCapture={handleKeyDown}\n className={cn('relative', className)}\n role=\"region\"\n aria-roledescription=\"carousel\"\n data-slot=\"carousel\"\n {...props}\n >\n {children}\n </div>\n </CarouselContext.Provider>\n )\n}\n\nfunction CarouselContent({className, ...props}: React.ComponentProps<'div'>) {\n const {carouselRef, orientation} = useCarousel()\n\n return (\n <div\n ref={carouselRef}\n className=\"overflow-hidden\"\n data-slot=\"carousel-content\"\n >\n <div\n className={cn(\n 'flex',\n orientation === 'horizontal' ? '-ml-4' : '-mt-4 flex-col',\n className\n )}\n {...props}\n />\n </div>\n )\n}\n\nfunction CarouselItem({className, ...props}: React.ComponentProps<'div'>) {\n const {orientation} = useCarousel()\n\n return (\n <div\n role=\"group\"\n aria-roledescription=\"slide\"\n data-slot=\"carousel-item\"\n className={cn(\n 'min-w-0 shrink-0 grow-0 basis-full',\n orientation === 'horizontal' ? 'pl-4' : 'pt-4',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CarouselPrevious({\n className,\n variant = 'outlined',\n size = 'icon',\n ...props\n}: React.ComponentProps<typeof Button>) {\n const {orientation, scrollPrev, canScrollPrev} = useCarousel()\n\n return (\n <Button\n data-slot=\"carousel-previous\"\n variant={variant}\n size={size}\n className={cn(\n 'absolute size-8 rounded-full',\n orientation === 'horizontal'\n ? 'top-1/2 -left-12 -translate-y-1/2'\n : '-top-12 left-1/2 -translate-x-1/2 rotate-90',\n className\n )}\n disabled={!canScrollPrev}\n onClick={scrollPrev}\n {...props}\n >\n <ArrowLeft />\n <span className=\"sr-only\">Previous slide</span>\n </Button>\n )\n}\n\nfunction CarouselNext({\n className,\n variant = 'outlined',\n size = 'icon',\n ...props\n}: React.ComponentProps<typeof Button>) {\n const {orientation, scrollNext, canScrollNext} = useCarousel()\n\n return (\n <Button\n data-slot=\"carousel-next\"\n variant={variant}\n size={size}\n className={cn(\n 'absolute size-8 rounded-full',\n orientation === 'horizontal'\n ? 'top-1/2 -right-12 -translate-y-1/2'\n : '-bottom-12 left-1/2 -translate-x-1/2 rotate-90',\n className\n )}\n disabled={!canScrollNext}\n onClick={scrollNext}\n {...props}\n >\n <ArrowRight />\n <span className=\"sr-only\">Next slide</span>\n </Button>\n )\n}\n\nexport {\n type CarouselApi,\n Carousel,\n CarouselContent,\n CarouselItem,\n CarouselPrevious,\n CarouselNext,\n}\n"],"names":["CarouselContext","React","useCarousel","context","Carousel","orientation","opts","setApi","plugins","className","children","props","carouselRef","api","useEmblaCarousel","canScrollPrev","setCanScrollPrev","canScrollNext","setCanScrollNext","onSelect","scrollPrev","scrollNext","handleKeyDown","event","jsx","cn","CarouselContent","CarouselItem","CarouselPrevious","variant","size","jsxs","Button","ArrowLeft","CarouselNext","ArrowRight"],"mappings":";;;;;;;AAgCA,MAAMA,IAAkBC,EAAM,cAA2C,IAAI;AAE7E,SAASC,IAAc;AACf,QAAAC,IAAUF,EAAM,WAAWD,CAAe;AAEhD,MAAI,CAACG;AACG,UAAA,IAAI,MAAM,gDAAgD;AAG3D,SAAAA;AACT;AAEA,SAASC,EAAS;AAAA,EAChB,aAAAC,IAAc;AAAA,EACd,MAAAC;AAAA,EACA,QAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACL,GAAgD;AACxC,QAAA,CAACC,GAAaC,CAAG,IAAIC;AAAA,IACzB;AAAA,MACE,GAAGR;AAAA,MACH,MAAMD,MAAgB,eAAe,MAAM;AAAA,IAC7C;AAAA,IACAG;AAAA,EACF,GACM,CAACO,GAAeC,CAAgB,IAAIf,EAAM,SAAS,EAAK,GACxD,CAACgB,GAAeC,CAAgB,IAAIjB,EAAM,SAAS,EAAK,GAExDkB,IAAWlB,EAAM,YAAY,CAACY,MAAqB;AACvD,IAAKA,MACYA,EAAAA,EAAI,eAAe,GACnBA,EAAAA,EAAI,eAAe;AAAA,EACtC,GAAG,EAAE,GAECO,IAAanB,EAAM,YAAY,MAAM;AACzC,IAAAY,GAAK,WAAW;AAAA,EAAA,GACf,CAACA,CAAG,CAAC,GAEFQ,IAAapB,EAAM,YAAY,MAAM;AACzC,IAAAY,GAAK,WAAW;AAAA,EAAA,GACf,CAACA,CAAG,CAAC,GAEFS,IAAgBrB,EAAM;AAAA,IAC1B,CAAC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;AAAA,EACV,MAAAC,IAAO;AAAA,EACP,GAAGnB;AACL,GAAwC;AACtC,QAAM,EAAC,aAAAN,GAAa,YAAAgB,GAAY,eAAAJ,EAAA,IAAiBf,EAAY;AAG3D,SAAA,gBAAA6B;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,aAAU;AAAA,MACV,SAAAH;AAAA,MACA,MAAAC;AAAA,MACA,WAAWL;AAAA,QACT;AAAA,QACApB,MAAgB,eACZ,uCACA;AAAA,QACJI;AAAA,MACF;AAAA,MACA,UAAU,CAACQ;AAAA,MACX,SAASI;AAAA,MACR,GAAGV;AAAA,MAEJ,UAAA;AAAA,QAAA,gBAAAa,EAACW,GAAW,EAAA;AAAA,QACX,gBAAAX,EAAA,QAAA,EAAK,WAAU,WAAU,UAAU,aAAA,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACtC;AAEJ;"}
|
package/dist/index.js
CHANGED
|
@@ -1,179 +1,191 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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 {
|
|
1
|
+
import { ProductCard as e, ProductCardBadge as t, ProductCardCurrentPrice as a, ProductCardFavoriteButton as i, ProductCardImage as l, ProductCardImageContainer as n, ProductCardInfo as c, ProductCardOriginalPrice as u, ProductCardPrice as d, ProductCardRoot as p, ProductCardTitle as s } from "./components/commerce/product-card.js";
|
|
2
|
+
import { ProductLink as f, ProductLinkActions as x, ProductLinkCurrentPrice as g, ProductLinkDiscountPrice as C, ProductLinkImage as P, ProductLinkInfo as D, ProductLinkOriginalPrice as S, ProductLinkPrice as A, ProductLinkRating as T, ProductLinkRoot as L, ProductLinkTitle as h } from "./components/commerce/product-link.js";
|
|
3
|
+
import { Accordion as w, AccordionContent as I, AccordionItem as b, AccordionTrigger as v } from "./components/ui/accordion.js";
|
|
4
|
+
import { Alert as F, AlertDescription as B, AlertTitle as y } from "./components/ui/alert.js";
|
|
5
|
+
import { AlertDialog as H, AlertDialogAction as O, AlertDialogCancel as G, AlertDialogContent as M, AlertDialogDescription as N, AlertDialogFooter as U, AlertDialogHeader as V, AlertDialogOverlay as z, AlertDialogPortal as j, AlertDialogTitle as q, AlertDialogTrigger as J } from "./components/ui/alert-dialog.js";
|
|
6
|
+
import { Avatar as Q, AvatarFallback as W, AvatarImage as X } from "./components/ui/avatar.js";
|
|
7
|
+
import { Badge as Z, badgeVariants as _ } from "./components/ui/badge.js";
|
|
8
|
+
import { Button as rr, buttonVariants as or } from "./components/ui/button.js";
|
|
9
|
+
import { Card as tr, CardAction as ar, CardContent as ir, CardDescription as lr, CardFooter as nr, CardHeader as cr, CardTitle as ur } from "./components/ui/card.js";
|
|
10
|
+
import { Carousel as pr, CarouselContent as sr, CarouselItem as mr, CarouselNext as fr, CarouselPrevious as xr } from "./components/ui/carousel.js";
|
|
11
|
+
import { Checkbox as Cr } from "./components/ui/checkbox.js";
|
|
12
|
+
import { Dialog as Dr, DialogClose as Sr, DialogContent as Ar, DialogDescription as Tr, DialogFooter as Lr, DialogHeader as hr, DialogOverlay as kr, DialogPortal as wr, DialogTitle as Ir, DialogTrigger as br } from "./components/ui/dialog.js";
|
|
13
|
+
import { Drawer as Rr, DrawerClose as Fr, DrawerContent as Br, DrawerDescription as yr, DrawerFooter as Er, DrawerHeader as Hr, DrawerOverlay as Or, DrawerPortal as Gr, DrawerTitle as Mr, DrawerTrigger as Nr } from "./components/ui/drawer.js";
|
|
14
|
+
import { Icon as Vr } from "./components/ui/icon.js";
|
|
15
|
+
import { Input as jr } from "./components/ui/input.js";
|
|
16
|
+
import { Label as Jr } from "./components/ui/label.js";
|
|
17
|
+
import { Progress as Qr } from "./components/ui/progress.js";
|
|
18
|
+
import { RadioGroup as Xr, RadioGroupItem as Yr } from "./components/ui/radio-group.js";
|
|
19
|
+
import { ResizableHandle as _r, ResizablePanel as $r, ResizablePanelGroup as ro } from "./components/ui/resizable.js";
|
|
20
|
+
import { ScrollArea as eo, ScrollBar as to } from "./components/ui/scroll-area.js";
|
|
21
|
+
import { Select as io, SelectContent as lo, SelectGroup as no, SelectItem as co, SelectLabel as uo, SelectScrollDownButton as po, SelectScrollUpButton as so, SelectSeparator as mo, SelectTrigger as fo, SelectValue as xo } from "./components/ui/select.js";
|
|
22
|
+
import { Separator as Co } from "./components/ui/separator.js";
|
|
23
|
+
import { Sheet as Do, SheetClose as So, SheetContent as Ao, SheetDescription as To, SheetFooter as Lo, SheetHeader as ho, SheetTitle as ko, SheetTrigger as wo } from "./components/ui/sheet.js";
|
|
24
|
+
import { Toaster as bo } from "./components/ui/sonner.js";
|
|
25
|
+
import { Touchable as Ro, touchableVariants as Fo } from "./components/ui/touchable.js";
|
|
26
|
+
import { useSavedProductsActions as yo } from "./hooks/user/useSavedProductsActions.js";
|
|
27
|
+
import { useFollowedShopsActions as Ho } from "./hooks/user/useFollowedShopsActions.js";
|
|
28
|
+
import { useCurrentUser as Go } from "./hooks/user/useCurrentUser.js";
|
|
29
|
+
import { useOrders as No } from "./hooks/user/useOrders.js";
|
|
30
|
+
import { useBuyerAttributes as Vo } from "./hooks/user/useBuyerAttributes.js";
|
|
31
|
+
import { useProductListActions as jo } from "./hooks/product/useProductListActions.js";
|
|
32
|
+
import { useProductLists as Jo } from "./hooks/product/useProductLists.js";
|
|
33
|
+
import { useProductList as Qo } from "./hooks/product/useProductList.js";
|
|
34
|
+
import { useRecommendedProducts as Xo } from "./hooks/product/useRecommendedProducts.js";
|
|
35
|
+
import { usePopularProducts as Zo } from "./hooks/product/usePopularProducts.js";
|
|
36
|
+
import { useAsyncStorage as $o } from "./hooks/storage/useAsyncStorage.js";
|
|
37
|
+
import { useSecureStorage as oe } from "./hooks/storage/useSecureStorage.js";
|
|
38
|
+
import { useImageUpload as te } from "./hooks/storage/useImageUpload.js";
|
|
39
|
+
import { useShopNavigation as ie } from "./hooks/navigation/useShopNavigation.js";
|
|
40
|
+
import { useCloseMini as ne } from "./hooks/navigation/useCloseMini.js";
|
|
41
|
+
import { useShopCartActions as ue } from "./hooks/shop/useShopCartActions.js";
|
|
42
|
+
import { useRecommendedShops as pe } from "./hooks/shop/useRecommendedShops.js";
|
|
43
|
+
import { useErrorToast as me } from "./hooks/util/useErrorToast.js";
|
|
44
|
+
import { useErrorScreen as xe } from "./hooks/util/useErrorScreen.js";
|
|
45
|
+
import { MiniEntityNotFoundError as Ce, MiniError as Pe, MiniNetworkError as De, formatError as Se } from "./utils/errors.js";
|
|
46
|
+
import { parseUrl as Te } from "./utils/parseUrl.js";
|
|
47
|
+
import { Consent as he, ConsentStatus as ke, CurrencyCode as we, Gender as Ie } from "./types/minisSDK.generated.d.js";
|
|
47
48
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
t as
|
|
116
|
-
a as
|
|
117
|
-
i as
|
|
118
|
-
l as
|
|
119
|
-
n as
|
|
120
|
-
c as
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
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
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
49
|
+
w as Accordion,
|
|
50
|
+
I as AccordionContent,
|
|
51
|
+
b as AccordionItem,
|
|
52
|
+
v as AccordionTrigger,
|
|
53
|
+
F as Alert,
|
|
54
|
+
B as AlertDescription,
|
|
55
|
+
H as AlertDialog,
|
|
56
|
+
O as AlertDialogAction,
|
|
57
|
+
G as AlertDialogCancel,
|
|
58
|
+
M as AlertDialogContent,
|
|
59
|
+
N as AlertDialogDescription,
|
|
60
|
+
U as AlertDialogFooter,
|
|
61
|
+
V as AlertDialogHeader,
|
|
62
|
+
z as AlertDialogOverlay,
|
|
63
|
+
j as AlertDialogPortal,
|
|
64
|
+
q as AlertDialogTitle,
|
|
65
|
+
J as AlertDialogTrigger,
|
|
66
|
+
y as AlertTitle,
|
|
67
|
+
Q as Avatar,
|
|
68
|
+
W as AvatarFallback,
|
|
69
|
+
X as AvatarImage,
|
|
70
|
+
Z as Badge,
|
|
71
|
+
rr as Button,
|
|
72
|
+
tr as Card,
|
|
73
|
+
ar as CardAction,
|
|
74
|
+
ir as CardContent,
|
|
75
|
+
lr as CardDescription,
|
|
76
|
+
nr as CardFooter,
|
|
77
|
+
cr as CardHeader,
|
|
78
|
+
ur as CardTitle,
|
|
79
|
+
pr as Carousel,
|
|
80
|
+
sr as CarouselContent,
|
|
81
|
+
mr as CarouselItem,
|
|
82
|
+
fr as CarouselNext,
|
|
83
|
+
xr as CarouselPrevious,
|
|
84
|
+
Cr as Checkbox,
|
|
85
|
+
he as Consent,
|
|
86
|
+
ke as ConsentStatus,
|
|
87
|
+
we as CurrencyCode,
|
|
88
|
+
Dr as Dialog,
|
|
89
|
+
Sr as DialogClose,
|
|
90
|
+
Ar as DialogContent,
|
|
91
|
+
Tr as DialogDescription,
|
|
92
|
+
Lr as DialogFooter,
|
|
93
|
+
hr as DialogHeader,
|
|
94
|
+
kr as DialogOverlay,
|
|
95
|
+
wr as DialogPortal,
|
|
96
|
+
Ir as DialogTitle,
|
|
97
|
+
br as DialogTrigger,
|
|
98
|
+
Rr as Drawer,
|
|
99
|
+
Fr as DrawerClose,
|
|
100
|
+
Br as DrawerContent,
|
|
101
|
+
yr as DrawerDescription,
|
|
102
|
+
Er as DrawerFooter,
|
|
103
|
+
Hr as DrawerHeader,
|
|
104
|
+
Or as DrawerOverlay,
|
|
105
|
+
Gr as DrawerPortal,
|
|
106
|
+
Mr as DrawerTitle,
|
|
107
|
+
Nr as DrawerTrigger,
|
|
108
|
+
Ie as Gender,
|
|
109
|
+
Vr as Icon,
|
|
110
|
+
jr as Input,
|
|
111
|
+
Jr as Label,
|
|
112
|
+
Ce as MiniEntityNotFoundError,
|
|
113
|
+
Pe as MiniError,
|
|
114
|
+
De as MiniNetworkError,
|
|
115
|
+
e as ProductCard,
|
|
116
|
+
t as ProductCardBadge,
|
|
117
|
+
a as ProductCardCurrentPrice,
|
|
118
|
+
i as ProductCardFavoriteButton,
|
|
119
|
+
l as ProductCardImage,
|
|
120
|
+
n as ProductCardImageContainer,
|
|
121
|
+
c as ProductCardInfo,
|
|
122
|
+
u as ProductCardOriginalPrice,
|
|
123
|
+
d as ProductCardPrice,
|
|
124
|
+
p as ProductCardRoot,
|
|
125
|
+
s as ProductCardTitle,
|
|
126
|
+
f as ProductLink,
|
|
127
|
+
x as ProductLinkActions,
|
|
128
|
+
g as ProductLinkCurrentPrice,
|
|
129
|
+
C as ProductLinkDiscountPrice,
|
|
130
|
+
P as ProductLinkImage,
|
|
131
|
+
D as ProductLinkInfo,
|
|
132
|
+
S as ProductLinkOriginalPrice,
|
|
133
|
+
A as ProductLinkPrice,
|
|
134
|
+
T as ProductLinkRating,
|
|
135
|
+
L as ProductLinkRoot,
|
|
136
|
+
h as ProductLinkTitle,
|
|
137
|
+
Qr as Progress,
|
|
138
|
+
Xr as RadioGroup,
|
|
139
|
+
Yr as RadioGroupItem,
|
|
140
|
+
_r as ResizableHandle,
|
|
141
|
+
$r as ResizablePanel,
|
|
142
|
+
ro as ResizablePanelGroup,
|
|
143
|
+
eo as ScrollArea,
|
|
144
|
+
to as ScrollBar,
|
|
145
|
+
io as Select,
|
|
146
|
+
lo as SelectContent,
|
|
147
|
+
no as SelectGroup,
|
|
148
|
+
co as SelectItem,
|
|
149
|
+
uo as SelectLabel,
|
|
150
|
+
po as SelectScrollDownButton,
|
|
151
|
+
so as SelectScrollUpButton,
|
|
152
|
+
mo as SelectSeparator,
|
|
153
|
+
fo as SelectTrigger,
|
|
154
|
+
xo as SelectValue,
|
|
155
|
+
Co as Separator,
|
|
156
|
+
Do as Sheet,
|
|
157
|
+
So as SheetClose,
|
|
158
|
+
Ao as SheetContent,
|
|
159
|
+
To as SheetDescription,
|
|
160
|
+
Lo as SheetFooter,
|
|
161
|
+
ho as SheetHeader,
|
|
162
|
+
ko as SheetTitle,
|
|
163
|
+
wo as SheetTrigger,
|
|
164
|
+
bo as Toaster,
|
|
165
|
+
Ro as Touchable,
|
|
166
|
+
_ as badgeVariants,
|
|
167
|
+
or as buttonVariants,
|
|
168
|
+
Se as formatError,
|
|
169
|
+
Te as parseUrl,
|
|
170
|
+
Fo as touchableVariants,
|
|
171
|
+
$o as useAsyncStorage,
|
|
172
|
+
Vo as useBuyerAttributes,
|
|
173
|
+
ne as useCloseMini,
|
|
174
|
+
Go as useCurrentUser,
|
|
175
|
+
xe as useErrorScreen,
|
|
176
|
+
me as useErrorToast,
|
|
177
|
+
Ho as useFollowedShopsActions,
|
|
178
|
+
te as useImageUpload,
|
|
179
|
+
No as useOrders,
|
|
180
|
+
Zo as usePopularProducts,
|
|
181
|
+
Qo as useProductList,
|
|
182
|
+
jo as useProductListActions,
|
|
183
|
+
Jo as useProductLists,
|
|
184
|
+
Xo as useRecommendedProducts,
|
|
185
|
+
pe as useRecommendedShops,
|
|
186
|
+
yo as useSavedProductsActions,
|
|
187
|
+
oe as useSecureStorage,
|
|
188
|
+
ue as useShopCartActions,
|
|
189
|
+
ie as useShopNavigation
|
|
178
190
|
};
|
|
179
191
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
function t(e, r) {
|
|
2
|
+
try {
|
|
3
|
+
const n = r === "USD" ? "en-US" : navigator.language || "en-US";
|
|
4
|
+
return new Intl.NumberFormat(n, {
|
|
5
|
+
style: "currency",
|
|
6
|
+
currency: r
|
|
7
|
+
}).format(Number(e));
|
|
8
|
+
} catch (n) {
|
|
9
|
+
return console.warn(`Invalid currency code: ${r}`, n), `${r} ${e}`;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
t as formatMoney
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=formatMoney.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatMoney.js","sources":["../../src/lib/formatMoney.ts"],"sourcesContent":["/**\n * Formats money amount with appropriate currency symbol\n * Uses browser's Intl.NumberFormat for consistent currency formatting\n */\nexport function formatMoney(amount: string, currencyCode: string): string {\n try {\n // Use en-US specifically for USD to get $ instead of US$\n // For other currencies, use browser locale but fallback to en-US\n const locale =\n currencyCode === 'USD' ? 'en-US' : navigator.language || 'en-US'\n\n return new Intl.NumberFormat(locale, {\n style: 'currency',\n currency: currencyCode,\n }).format(Number(amount))\n } catch (error) {\n // Fallback if currency code is invalid or not supported\n console.warn(`Invalid currency code: ${currencyCode}`, error)\n return `${currencyCode} ${amount}`\n }\n}\n"],"names":["formatMoney","amount","currencyCode","locale","error"],"mappings":"AAIgB,SAAAA,EAAYC,GAAgBC,GAA8B;AACpE,MAAA;AAGF,UAAMC,IACJD,MAAiB,QAAQ,UAAU,UAAU,YAAY;AAEpD,WAAA,IAAI,KAAK,aAAaC,GAAQ;AAAA,MACnC,OAAO;AAAA,MACP,UAAUD;AAAA,IACX,CAAA,EAAE,OAAO,OAAOD,CAAM,CAAC;AAAA,WACjBG,GAAO;AAEd,mBAAQ,KAAK,0BAA0BF,CAAY,IAAIE,CAAK,GACrD,GAAGF,CAAY,IAAID,CAAM;AAAA,EAAA;AAEpC;"}
|