@shopify/shop-minis-react 0.0.20 → 0.0.21

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.
@@ -1 +1 @@
1
- {"version":3,"file":"useImageUpload.js","sources":["../../../src/hooks/storage/useImageUpload.ts"],"sourcesContent":["import {useCallback} from 'react'\n\nimport {useShopActions} from '../../internal/useShopActions'\nimport {UploadTarget} from '../../types'\n\nexport interface UploadImageParams {\n /**\n * The MIME type of the image.\n */\n mimeType: string\n /**\n * The size of the image in bytes.\n */\n fileSize: number\n /**\n * The URI of the image to upload.\n */\n uri: string\n}\n\nexport interface UploadedImage {\n /**\n * The ID of the uploaded image.\n */\n id: string\n /**\n * The URL of the uploaded image.\n */\n imageUrl?: string\n /**\n * The resource URL of the uploaded image.\n */\n resourceUrl?: string\n}\n\ninterface UseImageUploadReturns {\n /**\n * Upload an image attached to the current user.\n */\n uploadImage: (params: UploadImageParams[]) => Promise<UploadedImage[]>\n}\n\nconst uploadFileToGCS = async (\n image: UploadImageParams,\n target: UploadTarget\n) => {\n const formData = new FormData()\n target.parameters.forEach(({name, value}) => {\n formData.append(name, value)\n })\n // Append the actual file data last\n formData.append('file', new Blob([image.uri], {type: image.mimeType}))\n\n const uploadResponse = await fetch(target.url, {\n method: 'POST',\n body: formData,\n })\n\n if (!uploadResponse.ok) {\n console.error('Failed to upload image', {\n response: await uploadResponse.text(),\n })\n return {error: 'Failed to upload image'}\n }\n\n return {}\n}\n\nexport const useImageUpload = (): UseImageUploadReturns => {\n const {createImageUploadLink, completeImageUpload} = useShopActions()\n\n const uploadImage = useCallback(\n async (params: UploadImageParams[]) => {\n if (params.length > 1) {\n throw new Error('Multiple image upload is not supported yet')\n }\n\n const links = await createImageUploadLink({\n input: params.map(image => ({\n mimeType: image.mimeType,\n fileSize: image.fileSize,\n })),\n })\n\n if (!links.ok) {\n throw new Error(links.error.message)\n }\n\n // Upload single file to GCS\n // TODO: Upload multiple files to GCS\n const {error: uploadError} = await uploadFileToGCS(\n params[0],\n links?.data?.targets?.[0]!\n )\n\n if (uploadError) {\n throw new Error(uploadError)\n }\n\n // 10 second polling for image upload\n let count = 0\n while (count < 30) {\n const result = await completeImageUpload({\n resourceUrls:\n links?.data?.targets?.map(target => target.resourceUrl) || [],\n })\n\n if (!result.ok) {\n throw new Error(result.error.message)\n }\n\n // TODO: Add support for multiple files\n if (result.data?.files?.[0]?.fileStatus === 'READY') {\n return [\n {\n id: result.data.files[0].id,\n imageUrl: result.data.files[0].image?.url,\n resourceUrl: links?.data?.targets?.[0]?.resourceUrl,\n },\n ]\n }\n\n await new Promise(resolve => setTimeout(resolve, 1000))\n count++\n }\n\n throw new Error('Image upload completion timed out')\n },\n [createImageUploadLink, completeImageUpload]\n )\n\n return {\n uploadImage,\n }\n}\n"],"names":["uploadFileToGCS","image","target","formData","name","value","uploadResponse","useImageUpload","createImageUploadLink","completeImageUpload","useShopActions","useCallback","params","links","uploadError","count","result","resolve"],"mappings":";;AA0CA,MAAMA,IAAkB,OACtBC,GACAC,MACG;AACG,QAAAC,IAAW,IAAI,SAAS;AAC9B,EAAAD,EAAO,WAAW,QAAQ,CAAC,EAAC,MAAAE,GAAM,OAAAC,QAAW;AAClC,IAAAF,EAAA,OAAOC,GAAMC,CAAK;AAAA,EAAA,CAC5B,GAEDF,EAAS,OAAO,QAAQ,IAAI,KAAK,CAACF,EAAM,GAAG,GAAG,EAAC,MAAMA,EAAM,SAAS,CAAA,CAAC;AAErE,QAAMK,IAAiB,MAAM,MAAMJ,EAAO,KAAK;AAAA,IAC7C,QAAQ;AAAA,IACR,MAAMC;AAAA,EAAA,CACP;AAEG,SAACG,EAAe,KAOb,CAAC,KANN,QAAQ,MAAM,0BAA0B;AAAA,IACtC,UAAU,MAAMA,EAAe,KAAK;AAAA,EAAA,CACrC,GACM,EAAC,OAAO,yBAAwB;AAI3C,GAEaC,IAAiB,MAA6B;AACzD,QAAM,EAAC,uBAAAC,GAAuB,qBAAAC,EAAmB,IAAIC,EAAe;AA8D7D,SAAA;AAAA,IACL,aA7DkBC;AAAA,MAClB,OAAOC,MAAgC;AACjC,YAAAA,EAAO,SAAS;AACZ,gBAAA,IAAI,MAAM,4CAA4C;AAGxD,cAAAC,IAAQ,MAAML,EAAsB;AAAA,UACxC,OAAOI,EAAO,IAAI,CAAUX,OAAA;AAAA,YAC1B,UAAUA,EAAM;AAAA,YAChB,UAAUA,EAAM;AAAA,UAAA,EAChB;AAAA,QAAA,CACH;AAEG,YAAA,CAACY,EAAM;AACT,gBAAM,IAAI,MAAMA,EAAM,MAAM,OAAO;AAKrC,cAAM,EAAC,OAAOC,EAAW,IAAI,MAAMd;AAAA,UACjCY,EAAO,CAAC;AAAA,UACRC,GAAO,MAAM,UAAU,CAAC;AAAA,QAC1B;AAEA,YAAIC;AACI,gBAAA,IAAI,MAAMA,CAAW;AAI7B,YAAIC,IAAQ;AACZ,eAAOA,IAAQ,MAAI;AACX,gBAAAC,IAAS,MAAMP,EAAoB;AAAA,YACvC,cACEI,GAAO,MAAM,SAAS,IAAI,CAAUX,MAAAA,EAAO,WAAW,KAAK,CAAA;AAAA,UAAC,CAC/D;AAEG,cAAA,CAACc,EAAO;AACV,kBAAM,IAAI,MAAMA,EAAO,MAAM,OAAO;AAItC,cAAIA,EAAO,MAAM,QAAQ,CAAC,GAAG,eAAe;AACnC,mBAAA;AAAA,cACL;AAAA,gBACE,IAAIA,EAAO,KAAK,MAAM,CAAC,EAAE;AAAA,gBACzB,UAAUA,EAAO,KAAK,MAAM,CAAC,EAAE,OAAO;AAAA,gBACtC,aAAaH,GAAO,MAAM,UAAU,CAAC,GAAG;AAAA,cAAA;AAAA,YAE5C;AAGF,gBAAM,IAAI,QAAQ,CAAAI,MAAW,WAAWA,GAAS,GAAI,CAAC,GACtDF;AAAA,QAAA;AAGI,cAAA,IAAI,MAAM,mCAAmC;AAAA,MACrD;AAAA,MACA,CAACP,GAAuBC,CAAmB;AAAA,IAC7C;AAAA,EAIA;AACF;"}
1
+ {"version":3,"file":"useImageUpload.js","sources":["../../../src/hooks/storage/useImageUpload.ts"],"sourcesContent":["import {useCallback} from 'react'\n\nimport {useShopActions} from '../../internal/useShopActions'\n\nimport type {UploadTarget} from '@shopify/shop-minis-platform/actions'\n\nexport interface UploadImageParams {\n /**\n * The MIME type of the image.\n */\n mimeType: string\n /**\n * The size of the image in bytes.\n */\n fileSize: number\n /**\n * The URI of the image to upload.\n */\n uri: string\n}\n\nexport interface UploadedImage {\n /**\n * The ID of the uploaded image.\n */\n id: string\n /**\n * The URL of the uploaded image.\n */\n imageUrl?: string\n /**\n * The resource URL of the uploaded image.\n */\n resourceUrl?: string\n}\n\ninterface UseImageUploadReturns {\n /**\n * Upload an image attached to the current user.\n */\n uploadImage: (params: UploadImageParams[]) => Promise<UploadedImage[]>\n}\n\nconst uploadFileToGCS = async (\n image: UploadImageParams,\n target: UploadTarget\n) => {\n const formData = new FormData()\n target.parameters.forEach(({name, value}: {name: string; value: string}) => {\n formData.append(name, value)\n })\n // Append the actual file data last\n formData.append('file', new Blob([image.uri], {type: image.mimeType}))\n\n const uploadResponse = await fetch(target.url, {\n method: 'POST',\n body: formData,\n })\n\n if (!uploadResponse.ok) {\n console.error('Failed to upload image', {\n response: await uploadResponse.text(),\n })\n return {error: 'Failed to upload image'}\n }\n\n return {}\n}\n\nexport const useImageUpload = (): UseImageUploadReturns => {\n const {createImageUploadLink, completeImageUpload} = useShopActions()\n\n const uploadImage = useCallback(\n async (params: UploadImageParams[]) => {\n if (params.length > 1) {\n throw new Error('Multiple image upload is not supported yet')\n }\n\n const links = await createImageUploadLink({\n input: params.map(image => ({\n mimeType: image.mimeType,\n fileSize: image.fileSize,\n })),\n })\n\n if (!links.ok) {\n throw new Error(links.error.message)\n }\n\n // Upload single file to GCS\n // TODO: Upload multiple files to GCS\n const {error: uploadError} = await uploadFileToGCS(\n params[0],\n links?.data?.targets?.[0]!\n )\n\n if (uploadError) {\n throw new Error(uploadError)\n }\n\n // 10 second polling for image upload\n let count = 0\n while (count < 30) {\n const result = await completeImageUpload({\n resourceUrls:\n links?.data?.targets?.map(target => target.resourceUrl) || [],\n })\n\n if (!result.ok) {\n throw new Error(result.error.message)\n }\n\n // TODO: Add support for multiple files\n if (result.data?.files?.[0]?.fileStatus === 'READY') {\n return [\n {\n id: result.data.files[0].id,\n imageUrl: result.data.files[0].image?.url,\n resourceUrl: links?.data?.targets?.[0]?.resourceUrl,\n },\n ]\n }\n\n await new Promise(resolve => setTimeout(resolve, 1000))\n count++\n }\n\n throw new Error('Image upload completion timed out')\n },\n [createImageUploadLink, completeImageUpload]\n )\n\n return {\n uploadImage,\n }\n}\n"],"names":["uploadFileToGCS","image","target","formData","name","value","uploadResponse","useImageUpload","createImageUploadLink","completeImageUpload","useShopActions","useCallback","params","links","uploadError","count","result","resolve"],"mappings":";;AA2CA,MAAMA,IAAkB,OACtBC,GACAC,MACG;AACG,QAAAC,IAAW,IAAI,SAAS;AAC9B,EAAAD,EAAO,WAAW,QAAQ,CAAC,EAAC,MAAAE,GAAM,OAAAC,QAA0C;AACjE,IAAAF,EAAA,OAAOC,GAAMC,CAAK;AAAA,EAAA,CAC5B,GAEDF,EAAS,OAAO,QAAQ,IAAI,KAAK,CAACF,EAAM,GAAG,GAAG,EAAC,MAAMA,EAAM,SAAS,CAAA,CAAC;AAErE,QAAMK,IAAiB,MAAM,MAAMJ,EAAO,KAAK;AAAA,IAC7C,QAAQ;AAAA,IACR,MAAMC;AAAA,EAAA,CACP;AAEG,SAACG,EAAe,KAOb,CAAC,KANN,QAAQ,MAAM,0BAA0B;AAAA,IACtC,UAAU,MAAMA,EAAe,KAAK;AAAA,EAAA,CACrC,GACM,EAAC,OAAO,yBAAwB;AAI3C,GAEaC,IAAiB,MAA6B;AACzD,QAAM,EAAC,uBAAAC,GAAuB,qBAAAC,EAAmB,IAAIC,EAAe;AA8D7D,SAAA;AAAA,IACL,aA7DkBC;AAAA,MAClB,OAAOC,MAAgC;AACjC,YAAAA,EAAO,SAAS;AACZ,gBAAA,IAAI,MAAM,4CAA4C;AAGxD,cAAAC,IAAQ,MAAML,EAAsB;AAAA,UACxC,OAAOI,EAAO,IAAI,CAAUX,OAAA;AAAA,YAC1B,UAAUA,EAAM;AAAA,YAChB,UAAUA,EAAM;AAAA,UAAA,EAChB;AAAA,QAAA,CACH;AAEG,YAAA,CAACY,EAAM;AACT,gBAAM,IAAI,MAAMA,EAAM,MAAM,OAAO;AAKrC,cAAM,EAAC,OAAOC,EAAW,IAAI,MAAMd;AAAA,UACjCY,EAAO,CAAC;AAAA,UACRC,GAAO,MAAM,UAAU,CAAC;AAAA,QAC1B;AAEA,YAAIC;AACI,gBAAA,IAAI,MAAMA,CAAW;AAI7B,YAAIC,IAAQ;AACZ,eAAOA,IAAQ,MAAI;AACX,gBAAAC,IAAS,MAAMP,EAAoB;AAAA,YACvC,cACEI,GAAO,MAAM,SAAS,IAAI,CAAUX,MAAAA,EAAO,WAAW,KAAK,CAAA;AAAA,UAAC,CAC/D;AAEG,cAAA,CAACc,EAAO;AACV,kBAAM,IAAI,MAAMA,EAAO,MAAM,OAAO;AAItC,cAAIA,EAAO,MAAM,QAAQ,CAAC,GAAG,eAAe;AACnC,mBAAA;AAAA,cACL;AAAA,gBACE,IAAIA,EAAO,KAAK,MAAM,CAAC,EAAE;AAAA,gBACzB,UAAUA,EAAO,KAAK,MAAM,CAAC,EAAE,OAAO;AAAA,gBACtC,aAAaH,GAAO,MAAM,UAAU,CAAC,GAAG;AAAA,cAAA;AAAA,YAE5C;AAGF,gBAAM,IAAI,QAAQ,CAAAI,MAAW,WAAWA,GAAS,GAAI,CAAC,GACtDF;AAAA,QAAA;AAGI,cAAA,IAAI,MAAM,mCAAmC;AAAA,MACrD;AAAA,MACA,CAACP,GAAuBC,CAAmB;AAAA,IAC7C;AAAA,EAIA;AACF;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useErrorScreen.js","sources":["../../../src/hooks/util/useErrorScreen.ts"],"sourcesContent":["import {useShopActions} from '../../internal/useShopActions'\nimport {ShopActions} from '../../types'\n\ninterface UseErrorScreenReturns {\n /**\n * Show an error screen with the given error message.\n */\n showErrorScreen: ShopActions['showErrorScreen']\n}\n\nexport const useErrorScreen = (): UseErrorScreenReturns => {\n const {showErrorScreen} = useShopActions()\n\n return {showErrorScreen}\n}\n"],"names":["useErrorScreen","showErrorScreen","useShopActions"],"mappings":";AAUO,MAAMA,IAAiB,MAA6B;AACnD,QAAA,EAAC,iBAAAC,EAAe,IAAIC,EAAe;AAEzC,SAAO,EAAC,iBAAAD,EAAe;AACzB;"}
1
+ {"version":3,"file":"useErrorScreen.js","sources":["../../../src/hooks/util/useErrorScreen.ts"],"sourcesContent":["import {ShopActions} from '@shopify/shop-minis-platform/actions'\n\nimport {useShopActions} from '../../internal/useShopActions'\n\ninterface UseErrorScreenReturns {\n /**\n * Show an error screen with the given error message.\n */\n showErrorScreen: ShopActions['showErrorScreen']\n}\n\nexport const useErrorScreen = (): UseErrorScreenReturns => {\n const {showErrorScreen} = useShopActions()\n\n return {showErrorScreen}\n}\n"],"names":["useErrorScreen","showErrorScreen","useShopActions"],"mappings":";AAWO,MAAMA,IAAiB,MAA6B;AACnD,QAAA,EAAC,iBAAAC,EAAe,IAAIC,EAAe;AAEzC,SAAO,EAAC,iBAAAD,EAAe;AACzB;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useErrorToast.js","sources":["../../../src/hooks/util/useErrorToast.ts"],"sourcesContent":["import {useShopActions} from '../../internal/useShopActions'\nimport {ShopActions} from '../../types'\n\ninterface UseErrorToastReturns {\n /**\n * Show an error toast with the given error message.\n */\n showErrorToast: ShopActions['showErrorToast']\n}\n\nexport const useErrorToast = (): UseErrorToastReturns => {\n const {showErrorToast} = useShopActions()\n\n return {showErrorToast}\n}\n"],"names":["useErrorToast","showErrorToast","useShopActions"],"mappings":";AAUO,MAAMA,IAAgB,MAA4B;AACjD,QAAA,EAAC,gBAAAC,EAAc,IAAIC,EAAe;AAExC,SAAO,EAAC,gBAAAD,EAAc;AACxB;"}
1
+ {"version":3,"file":"useErrorToast.js","sources":["../../../src/hooks/util/useErrorToast.ts"],"sourcesContent":["import {ShopActions} from '@shopify/shop-minis-platform/actions'\n\nimport {useShopActions} from '../../internal/useShopActions'\n\ninterface UseErrorToastReturns {\n /**\n * Show an error toast with the given error message.\n */\n showErrorToast: ShopActions['showErrorToast']\n}\n\nexport const useErrorToast = (): UseErrorToastReturns => {\n const {showErrorToast} = useShopActions()\n\n return {showErrorToast}\n}\n"],"names":["useErrorToast","showErrorToast","useShopActions"],"mappings":";AAWO,MAAMA,IAAgB,MAA4B;AACjD,QAAA,EAAC,gBAAAC,EAAc,IAAIC,EAAe;AAExC,SAAO,EAAC,gBAAAD,EAAc;AACxB;"}
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import { ProductCard as p } from "./components/commerce/product-card.js";
4
4
  import { ProductLink as m } from "./components/commerce/product-link.js";
5
5
  import { MerchantCard as u, MerchantCardPrimitive as x } from "./components/commerce/merchant-card.js";
6
6
  import { ProductCardSkeleton as c } from "./components/commerce/product-card-skeleton.js";
7
- import { MerchantCardSkeleton as S } from "./components/commerce/merchant-card-skeleton.js";
7
+ import { MerchantCardSkeleton as g } from "./components/commerce/merchant-card-skeleton.js";
8
8
  import { TransitionContainer as D } from "./components/navigation/transition-container.js";
9
9
  import { TransitionLink as C } from "./components/navigation/transition-link.js";
10
10
  import { Button as T } from "./components/atoms/button.js";
@@ -12,65 +12,66 @@ import { FavoriteButton as I } from "./components/atoms/favorite-button.js";
12
12
  import { IconButton as v } from "./components/atoms/icon-button.js";
13
13
  import { ThumbhashImage as k } from "./components/atoms/thumbhash-image.js";
14
14
  import { Touchable as F } from "./components/atoms/touchable.js";
15
- import { AlertDialogAtom as M } from "./components/atoms/alert-dialog.js";
16
- import { List as B } from "./components/atoms/list.js";
15
+ import { AlertDialogAtom as B } from "./components/atoms/alert-dialog.js";
16
+ import { List as N } from "./components/atoms/list.js";
17
17
  import { Accordion as y, AccordionContent as G, AccordionItem as H, AccordionTrigger as O } from "./components/ui/accordion.js";
18
18
  import { Alert as V, AlertDescription as _, AlertTitle as z } from "./components/ui/alert.js";
19
19
  import { AlertDialog as W, AlertDialogAction as j, AlertDialogCancel as q, AlertDialogContent as J, AlertDialogDescription as K, AlertDialogFooter as Q, AlertDialogHeader as X, AlertDialogOverlay as Z, AlertDialogPortal as $, AlertDialogTitle as rr, AlertDialogTrigger as er } from "./components/ui/alert-dialog.js";
20
20
  import { Avatar as tr, AvatarFallback as ar, AvatarImage as ir } from "./components/ui/avatar.js";
21
- import { Card as pr, CardAction as sr, CardContent as mr, CardDescription as nr, CardFooter as ur, CardHeader as xr, CardTitle as fr } from "./components/ui/card.js";
22
- import { Carousel as dr, CarouselContent as Sr, CarouselItem as gr, CarouselNext as Dr, CarouselPrevious as Ar } from "./components/ui/carousel.js";
23
- import { Checkbox as Pr } from "./components/ui/checkbox.js";
24
- import { Dialog as hr, DialogClose as Ir, DialogContent as wr, DialogDescription as vr, DialogFooter as br, DialogHeader as kr, DialogOverlay as Er, DialogPortal as Fr, DialogTitle as Rr, DialogTrigger as Mr } from "./components/ui/dialog.js";
25
- import { Drawer as Br, DrawerClose as Lr, DrawerContent as yr, DrawerDescription as Gr, DrawerFooter as Hr, DrawerHeader as Or, DrawerOverlay as Ur, DrawerPortal as Vr, DrawerTitle as _r, DrawerTrigger as zr } from "./components/ui/drawer.js";
26
- import { Input as Wr } from "./components/ui/input.js";
27
- import { Label as qr } from "./components/ui/label.js";
28
- import { Progress as Kr } from "./components/ui/progress.js";
29
- import { RadioGroup as Xr, RadioGroupItem as Zr } from "./components/ui/radio-group.js";
30
- import { ResizableHandle as re, ResizablePanel as ee, ResizablePanelGroup as oe } from "./components/ui/resizable.js";
31
- import { ScrollArea as ae, ScrollBar as ie } from "./components/ui/scroll-area.js";
32
- import { Select as pe, SelectContent as se, SelectGroup as me, SelectItem as ne, SelectLabel as ue, SelectScrollDownButton as xe, SelectScrollUpButton as fe, SelectSeparator as ce, SelectTrigger as de, SelectValue as Se } from "./components/ui/select.js";
33
- import { Separator as De } from "./components/ui/separator.js";
34
- import { Sheet as Ce, SheetClose as Pe, SheetContent as Te, SheetDescription as he, SheetFooter as Ie, SheetHeader as we, SheetTitle as ve, SheetTrigger as be } from "./components/ui/sheet.js";
35
- import { Toaster as Ee } from "./components/ui/sonner.js";
36
- import { Skeleton as Re } from "./components/ui/skeleton.js";
37
- import { useRecentProducts as Ne } from "./hooks/user/useRecentProducts.js";
38
- import { useRecentShops as Le } from "./hooks/user/useRecentShops.js";
39
- import { useSavedProducts as Ge } from "./hooks/user/useSavedProducts.js";
40
- import { useSavedProductsActions as Oe } from "./hooks/user/useSavedProductsActions.js";
41
- import { useFollowedShops as Ve } from "./hooks/user/useFollowedShops.js";
42
- import { useFollowedShopsActions as ze } from "./hooks/user/useFollowedShopsActions.js";
43
- import { useCurrentUser as We } from "./hooks/user/useCurrentUser.js";
44
- import { useOrders as qe } from "./hooks/user/useOrders.js";
45
- import { useBuyerAttributes as Ke } from "./hooks/user/useBuyerAttributes.js";
46
- import { useProductListActions as Xe } from "./hooks/product/useProductListActions.js";
47
- import { useProductLists as $e } from "./hooks/product/useProductLists.js";
48
- import { useProductList as eo } from "./hooks/product/useProductList.js";
49
- import { useProduct as to } from "./hooks/product/useProduct.js";
50
- import { useProducts as io } from "./hooks/product/useProducts.js";
51
- import { useProductVariants as po } from "./hooks/product/useProductVariants.js";
52
- import { useProductMedia as mo } from "./hooks/product/useProductMedia.js";
53
- import { useProductSearch as uo } from "./hooks/product/useProductSearch.js";
54
- import { useRecommendedProducts as fo } from "./hooks/product/useRecommendedProducts.js";
55
- import { usePopularProducts as So } from "./hooks/product/usePopularProducts.js";
56
- import { useCuratedProducts as Do } from "./hooks/product/useCuratedProducts.js";
57
- import { useAsyncStorage as Co } from "./hooks/storage/useAsyncStorage.js";
58
- import { useSecureStorage as To } from "./hooks/storage/useSecureStorage.js";
59
- import { useImageUpload as Io } from "./hooks/storage/useImageUpload.js";
60
- import { useShopNavigation as vo } from "./hooks/navigation/useShopNavigation.js";
61
- import { useCloseMini as ko } from "./hooks/navigation/useCloseMini.js";
62
- import { useDeeplink as Fo } from "./hooks/navigation/useDeeplink.js";
63
- import { useNavigateWithTransition as Mo } from "./hooks/navigation/useNavigateWithTransition.js";
64
- import { useShop as Bo } from "./hooks/shop/useShop.js";
65
- import { useShopCartActions as yo } from "./hooks/shop/useShopCartActions.js";
66
- import { useRecommendedShops as Ho } from "./hooks/shop/useRecommendedShops.js";
67
- import { useErrorToast as Uo } from "./hooks/util/useErrorToast.js";
68
- import { useErrorScreen as _o } from "./hooks/util/useErrorScreen.js";
69
- import { useShare as Yo } from "./hooks/util/useShare.js";
70
- import { useImagePicker as jo } from "./hooks/util/useImagePicker.js";
71
- import { MiniEntityNotFoundError as Jo, MiniError as Ko, MiniNetworkError as Qo, formatError as Xo } from "./utils/errors.js";
72
- import { parseUrl as $o } from "./utils/parseUrl.js";
73
- import { Consent as et, ConsentStatus as ot } from "./shop-minis-platform/src/types/permissions.js";
21
+ import { Badge as pr, badgeVariants as sr } from "./components/ui/badge.js";
22
+ import { Card as nr, CardAction as ur, CardContent as xr, CardDescription as fr, CardFooter as cr, CardHeader as dr, CardTitle as gr } from "./components/ui/card.js";
23
+ import { Carousel as Dr, CarouselContent as Ar, CarouselItem as Cr, CarouselNext as Pr, CarouselPrevious as Tr } from "./components/ui/carousel.js";
24
+ import { Checkbox as Ir } from "./components/ui/checkbox.js";
25
+ import { Dialog as vr, DialogClose as br, DialogContent as kr, DialogDescription as Er, DialogFooter as Fr, DialogHeader as Rr, DialogOverlay as Br, DialogPortal as Mr, DialogTitle as Nr, DialogTrigger as Lr } from "./components/ui/dialog.js";
26
+ import { Drawer as Gr, DrawerClose as Hr, DrawerContent as Or, DrawerDescription as Ur, DrawerFooter as Vr, DrawerHeader as _r, DrawerOverlay as zr, DrawerPortal as Yr, DrawerTitle as Wr, DrawerTrigger as jr } from "./components/ui/drawer.js";
27
+ import { Input as Jr } from "./components/ui/input.js";
28
+ import { Label as Qr } from "./components/ui/label.js";
29
+ import { Progress as Zr } from "./components/ui/progress.js";
30
+ import { RadioGroup as re, RadioGroupItem as ee } from "./components/ui/radio-group.js";
31
+ import { ResizableHandle as te, ResizablePanel as ae, ResizablePanelGroup as ie } from "./components/ui/resizable.js";
32
+ import { ScrollArea as pe, ScrollBar as se } from "./components/ui/scroll-area.js";
33
+ import { Select as ne, SelectContent as ue, SelectGroup as xe, SelectItem as fe, SelectLabel as ce, SelectScrollDownButton as de, SelectScrollUpButton as ge, SelectSeparator as Se, SelectTrigger as De, SelectValue as Ae } from "./components/ui/select.js";
34
+ import { Separator as Pe } from "./components/ui/separator.js";
35
+ import { Sheet as he, SheetClose as Ie, SheetContent as we, SheetDescription as ve, SheetFooter as be, SheetHeader as ke, SheetTitle as Ee, SheetTrigger as Fe } from "./components/ui/sheet.js";
36
+ import { Toaster as Be } from "./components/ui/sonner.js";
37
+ import { Skeleton as Ne } from "./components/ui/skeleton.js";
38
+ import { useRecentProducts as ye } from "./hooks/user/useRecentProducts.js";
39
+ import { useRecentShops as He } from "./hooks/user/useRecentShops.js";
40
+ import { useSavedProducts as Ue } from "./hooks/user/useSavedProducts.js";
41
+ import { useSavedProductsActions as _e } from "./hooks/user/useSavedProductsActions.js";
42
+ import { useFollowedShops as Ye } from "./hooks/user/useFollowedShops.js";
43
+ import { useFollowedShopsActions as je } from "./hooks/user/useFollowedShopsActions.js";
44
+ import { useCurrentUser as Je } from "./hooks/user/useCurrentUser.js";
45
+ import { useOrders as Qe } from "./hooks/user/useOrders.js";
46
+ import { useBuyerAttributes as Ze } from "./hooks/user/useBuyerAttributes.js";
47
+ import { useProductListActions as ro } from "./hooks/product/useProductListActions.js";
48
+ import { useProductLists as oo } from "./hooks/product/useProductLists.js";
49
+ import { useProductList as ao } from "./hooks/product/useProductList.js";
50
+ import { useProduct as lo } from "./hooks/product/useProduct.js";
51
+ import { useProducts as so } from "./hooks/product/useProducts.js";
52
+ import { useProductVariants as no } from "./hooks/product/useProductVariants.js";
53
+ import { useProductMedia as xo } from "./hooks/product/useProductMedia.js";
54
+ import { useProductSearch as co } from "./hooks/product/useProductSearch.js";
55
+ import { useRecommendedProducts as So } from "./hooks/product/useRecommendedProducts.js";
56
+ import { usePopularProducts as Ao } from "./hooks/product/usePopularProducts.js";
57
+ import { useCuratedProducts as Po } from "./hooks/product/useCuratedProducts.js";
58
+ import { useAsyncStorage as ho } from "./hooks/storage/useAsyncStorage.js";
59
+ import { useSecureStorage as wo } from "./hooks/storage/useSecureStorage.js";
60
+ import { useImageUpload as bo } from "./hooks/storage/useImageUpload.js";
61
+ import { useShopNavigation as Eo } from "./hooks/navigation/useShopNavigation.js";
62
+ import { useCloseMini as Ro } from "./hooks/navigation/useCloseMini.js";
63
+ import { useDeeplink as Mo } from "./hooks/navigation/useDeeplink.js";
64
+ import { useNavigateWithTransition as Lo } from "./hooks/navigation/useNavigateWithTransition.js";
65
+ import { useShop as Go } from "./hooks/shop/useShop.js";
66
+ import { useShopCartActions as Oo } from "./hooks/shop/useShopCartActions.js";
67
+ import { useRecommendedShops as Vo } from "./hooks/shop/useRecommendedShops.js";
68
+ import { useErrorToast as zo } from "./hooks/util/useErrorToast.js";
69
+ import { useErrorScreen as Wo } from "./hooks/util/useErrorScreen.js";
70
+ import { useShare as qo } from "./hooks/util/useShare.js";
71
+ import { useImagePicker as Ko } from "./hooks/util/useImagePicker.js";
72
+ import { MiniEntityNotFoundError as Xo, MiniError as Zo, MiniNetworkError as $o, formatError as rt } from "./utils/errors.js";
73
+ import { parseUrl as ot } from "./utils/parseUrl.js";
74
+ import { Consent as at, ConsentStatus as it } from "./shop-minis-platform/src/types/permissions.js";
74
75
  export {
75
76
  y as Accordion,
76
77
  G as AccordionContent,
@@ -80,7 +81,7 @@ export {
80
81
  _ as AlertDescription,
81
82
  W as AlertDialog,
82
83
  j as AlertDialogAction,
83
- M as AlertDialogAtom,
84
+ B as AlertDialogAtom,
84
85
  q as AlertDialogCancel,
85
86
  J as AlertDialogContent,
86
87
  K as AlertDialogDescription,
@@ -94,127 +95,129 @@ export {
94
95
  tr as Avatar,
95
96
  ar as AvatarFallback,
96
97
  ir as AvatarImage,
98
+ pr as Badge,
97
99
  T as Button,
98
- pr as Card,
99
- sr as CardAction,
100
- mr as CardContent,
101
- nr as CardDescription,
102
- ur as CardFooter,
103
- xr as CardHeader,
104
- fr as CardTitle,
105
- dr as Carousel,
106
- Sr as CarouselContent,
107
- gr as CarouselItem,
108
- Dr as CarouselNext,
109
- Ar as CarouselPrevious,
110
- Pr as Checkbox,
111
- et as Consent,
112
- ot as ConsentStatus,
100
+ nr as Card,
101
+ ur as CardAction,
102
+ xr as CardContent,
103
+ fr as CardDescription,
104
+ cr as CardFooter,
105
+ dr as CardHeader,
106
+ gr as CardTitle,
107
+ Dr as Carousel,
108
+ Ar as CarouselContent,
109
+ Cr as CarouselItem,
110
+ Pr as CarouselNext,
111
+ Tr as CarouselPrevious,
112
+ Ir as Checkbox,
113
+ at as Consent,
114
+ it as ConsentStatus,
113
115
  o as DATA_NAVIGATION_TYPE_ATTRIBUTE,
114
- hr as Dialog,
115
- Ir as DialogClose,
116
- wr as DialogContent,
117
- vr as DialogDescription,
118
- br as DialogFooter,
119
- kr as DialogHeader,
120
- Er as DialogOverlay,
121
- Fr as DialogPortal,
122
- Rr as DialogTitle,
123
- Mr as DialogTrigger,
124
- Br as Drawer,
125
- Lr as DrawerClose,
126
- yr as DrawerContent,
127
- Gr as DrawerDescription,
128
- Hr as DrawerFooter,
129
- Or as DrawerHeader,
130
- Ur as DrawerOverlay,
131
- Vr as DrawerPortal,
132
- _r as DrawerTitle,
133
- zr as DrawerTrigger,
116
+ vr as Dialog,
117
+ br as DialogClose,
118
+ kr as DialogContent,
119
+ Er as DialogDescription,
120
+ Fr as DialogFooter,
121
+ Rr as DialogHeader,
122
+ Br as DialogOverlay,
123
+ Mr as DialogPortal,
124
+ Nr as DialogTitle,
125
+ Lr as DialogTrigger,
126
+ Gr as Drawer,
127
+ Hr as DrawerClose,
128
+ Or as DrawerContent,
129
+ Ur as DrawerDescription,
130
+ Vr as DrawerFooter,
131
+ _r as DrawerHeader,
132
+ zr as DrawerOverlay,
133
+ Yr as DrawerPortal,
134
+ Wr as DrawerTitle,
135
+ jr as DrawerTrigger,
134
136
  I as FavoriteButton,
135
137
  v as IconButton,
136
- Wr as Input,
137
- qr as Label,
138
- B as List,
138
+ Jr as Input,
139
+ Qr as Label,
140
+ N as List,
139
141
  u as MerchantCard,
140
142
  x as MerchantCardPrimitive,
141
- S as MerchantCardSkeleton,
142
- Jo as MiniEntityNotFoundError,
143
- Ko as MiniError,
144
- Qo as MiniNetworkError,
143
+ g as MerchantCardSkeleton,
144
+ Xo as MiniEntityNotFoundError,
145
+ Zo as MiniError,
146
+ $o as MiniNetworkError,
145
147
  i as MinisContainer,
146
148
  t as NAVIGATION_TYPES,
147
149
  p as ProductCard,
148
150
  c as ProductCardSkeleton,
149
151
  m as ProductLink,
150
- Kr as Progress,
151
- Xr as RadioGroup,
152
- Zr as RadioGroupItem,
153
- re as ResizableHandle,
154
- ee as ResizablePanel,
155
- oe as ResizablePanelGroup,
156
- ae as ScrollArea,
157
- ie as ScrollBar,
158
- pe as Select,
159
- se as SelectContent,
160
- me as SelectGroup,
161
- ne as SelectItem,
162
- ue as SelectLabel,
163
- xe as SelectScrollDownButton,
164
- fe as SelectScrollUpButton,
165
- ce as SelectSeparator,
166
- de as SelectTrigger,
167
- Se as SelectValue,
168
- De as Separator,
169
- Ce as Sheet,
170
- Pe as SheetClose,
171
- Te as SheetContent,
172
- he as SheetDescription,
173
- Ie as SheetFooter,
174
- we as SheetHeader,
175
- ve as SheetTitle,
176
- be as SheetTrigger,
177
- Re as Skeleton,
152
+ Zr as Progress,
153
+ re as RadioGroup,
154
+ ee as RadioGroupItem,
155
+ te as ResizableHandle,
156
+ ae as ResizablePanel,
157
+ ie as ResizablePanelGroup,
158
+ pe as ScrollArea,
159
+ se as ScrollBar,
160
+ ne as Select,
161
+ ue as SelectContent,
162
+ xe as SelectGroup,
163
+ fe as SelectItem,
164
+ ce as SelectLabel,
165
+ de as SelectScrollDownButton,
166
+ ge as SelectScrollUpButton,
167
+ Se as SelectSeparator,
168
+ De as SelectTrigger,
169
+ Ae as SelectValue,
170
+ Pe as Separator,
171
+ he as Sheet,
172
+ Ie as SheetClose,
173
+ we as SheetContent,
174
+ ve as SheetDescription,
175
+ be as SheetFooter,
176
+ ke as SheetHeader,
177
+ Ee as SheetTitle,
178
+ Fe as SheetTrigger,
179
+ Ne as Skeleton,
178
180
  k as ThumbhashImage,
179
- Ee as Toaster,
181
+ Be as Toaster,
180
182
  F as Touchable,
181
183
  D as TransitionContainer,
182
184
  C as TransitionLink,
183
- Xo as formatError,
184
- $o as parseUrl,
185
- Co as useAsyncStorage,
186
- Ke as useBuyerAttributes,
187
- ko as useCloseMini,
188
- Do as useCuratedProducts,
189
- We as useCurrentUser,
190
- Fo as useDeeplink,
191
- _o as useErrorScreen,
192
- Uo as useErrorToast,
193
- Ve as useFollowedShops,
194
- ze as useFollowedShopsActions,
195
- jo as useImagePicker,
196
- Io as useImageUpload,
197
- Mo as useNavigateWithTransition,
198
- qe as useOrders,
199
- So as usePopularProducts,
200
- to as useProduct,
201
- eo as useProductList,
202
- Xe as useProductListActions,
203
- $e as useProductLists,
204
- mo as useProductMedia,
205
- uo as useProductSearch,
206
- po as useProductVariants,
207
- io as useProducts,
208
- Ne as useRecentProducts,
209
- Le as useRecentShops,
210
- fo as useRecommendedProducts,
211
- Ho as useRecommendedShops,
212
- Ge as useSavedProducts,
213
- Oe as useSavedProductsActions,
214
- To as useSecureStorage,
215
- Yo as useShare,
216
- Bo as useShop,
217
- yo as useShopCartActions,
218
- vo as useShopNavigation
185
+ sr as badgeVariants,
186
+ rt as formatError,
187
+ ot as parseUrl,
188
+ ho as useAsyncStorage,
189
+ Ze as useBuyerAttributes,
190
+ Ro as useCloseMini,
191
+ Po as useCuratedProducts,
192
+ Je as useCurrentUser,
193
+ Mo as useDeeplink,
194
+ Wo as useErrorScreen,
195
+ zo as useErrorToast,
196
+ Ye as useFollowedShops,
197
+ je as useFollowedShopsActions,
198
+ Ko as useImagePicker,
199
+ bo as useImageUpload,
200
+ Lo as useNavigateWithTransition,
201
+ Qe as useOrders,
202
+ Ao as usePopularProducts,
203
+ lo as useProduct,
204
+ ao as useProductList,
205
+ ro as useProductListActions,
206
+ oo as useProductLists,
207
+ xo as useProductMedia,
208
+ co as useProductSearch,
209
+ no as useProductVariants,
210
+ so as useProducts,
211
+ ye as useRecentProducts,
212
+ He as useRecentShops,
213
+ So as useRecommendedProducts,
214
+ Vo as useRecommendedShops,
215
+ Ue as useSavedProducts,
216
+ _e as useSavedProductsActions,
217
+ wo as useSecureStorage,
218
+ qo as useShare,
219
+ Go as useShop,
220
+ Oo as useShopCartActions,
221
+ Eo as useShopNavigation
219
222
  };
220
223
  //# 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shopify/shop-minis-react",
3
3
  "license": "SEE LICENSE IN LICENSE.txt",
4
- "version": "0.0.20",
4
+ "version": "0.0.21",
5
5
  "sideEffects": false,
6
6
  "type": "module",
7
7
  "engines": {
@@ -106,7 +106,7 @@
106
106
  "clean": "rm -rf dist",
107
107
  "storybook": "storybook dev -p 6006",
108
108
  "build-storybook": "storybook build",
109
- "lint": "eslint . --format codeframe --cache --max-warnings=0",
109
+ "lint": "eslint . --format codeframe --cache",
110
110
  "lint:fix": "eslint . --format codeframe --cache --fix"
111
111
  }
112
112
  }
@@ -21,6 +21,7 @@ export * from './ui/accordion'
21
21
  export * from './ui/alert'
22
22
  export * from './ui/alert-dialog'
23
23
  export * from './ui/avatar'
24
+ export * from './ui/badge'
24
25
  export * from './ui/card'
25
26
  export * from './ui/carousel'
26
27
  export * from './ui/checkbox'
@@ -3,5 +3,5 @@ import {useCloseMini, Button} from '@shopify/shop-minis-react'
3
3
  export function Example() {
4
4
  const {closeMini} = useCloseMini()
5
5
 
6
- return <Button onPress={closeMini} text="Close Mini" />
6
+ return <Button onClick={closeMini}>Close Mini</Button>
7
7
  }
@@ -7,23 +7,26 @@ export default function MyComponent() {
7
7
  return (
8
8
  <>
9
9
  <Button
10
- onPress={() =>
10
+ onClick={() =>
11
11
  navigateToProduct({productId: 'gid://shopify/Product/123'})
12
12
  }
13
- text="View Product"
14
- />
13
+ >
14
+ View Product
15
+ </Button>
15
16
  <Button
16
- onPress={() =>
17
+ onClick={() =>
17
18
  navigateToShop({
18
19
  shopId: 'gid://shopify/Shop/123',
19
20
  })
20
21
  }
21
- text="Go to Shop"
22
- />
22
+ >
23
+ Go to Shop
24
+ </Button>
23
25
  <Button
24
- onPress={() => navigateToOrder({orderId: 'gid://shopify/Order/123'})}
25
- text="View Order"
26
- />
26
+ onClick={() => navigateToOrder({orderId: 'gid://shopify/Order/123'})}
27
+ >
28
+ View Order
29
+ </Button>
27
30
  </>
28
31
  )
29
32
  }
@@ -11,25 +11,26 @@ export default function MyComponent() {
11
11
 
12
12
  return (
13
13
  <>
14
+ <Button onClick={() => addProductList({name: 'My product list'})}>
15
+ Add product list
16
+ </Button>
14
17
  <Button
15
- onPress={() => addProductList({name: 'My product list'})}
16
- text="Add product list"
17
- />
18
+ onClick={() => removeProductList({id: 'gid://shopapp/ProductList/123'})}
19
+ >
20
+ Remove product list
21
+ </Button>
18
22
  <Button
19
- onPress={() => removeProductList({id: 'gid://shopapp/ProductList/123'})}
20
- text="Remove product list"
21
- />
22
- <Button
23
- onPress={() =>
23
+ onClick={() =>
24
24
  renameProductList({
25
25
  id: 'gid://shopapp/ProductList/123',
26
26
  name: 'My renamed product list',
27
27
  })
28
28
  }
29
- text="Rename product list"
30
- />
29
+ >
30
+ Rename product list
31
+ </Button>
31
32
  <Button
32
- onPress={() =>
33
+ onClick={() =>
33
34
  addProductListItem({
34
35
  shopId: 'gid://shopify/Shop/42',
35
36
  productId: 'gid://shopify/Product/123',
@@ -38,10 +39,11 @@ export default function MyComponent() {
38
39
  publicListId: 'abc123',
39
40
  })
40
41
  }
41
- text="Add product to list"
42
- />
42
+ >
43
+ Add product to list
44
+ </Button>
43
45
  <Button
44
- onPress={() =>
46
+ onClick={() =>
45
47
  removeProductListItem({
46
48
  shopId: 'gid://shopify/Shop/42',
47
49
  productId: 'gid://shopify/Product/123',
@@ -50,8 +52,9 @@ export default function MyComponent() {
50
52
  publicListId: 'abc123',
51
53
  })
52
54
  }
53
- text="Remove product from list"
54
- />
55
+ >
56
+ Remove product from list
57
+ </Button>
55
58
  </>
56
59
  )
57
60
  }
@@ -21,8 +21,8 @@ export default function MyComponent() {
21
21
 
22
22
  return (
23
23
  <>
24
- <Button text="Add to cart" onPress={handleAddToCart} />
25
- <Button text="Buy now" onPress={handleBuyNow} />
24
+ <Button onClick={handleAddToCart}>Add to cart</Button>
25
+ <Button onClick={handleBuyNow}>Buy now</Button>
26
26
  </>
27
27
  )
28
28
  }
@@ -16,5 +16,5 @@ export default function MyComponent() {
16
16
  console.log('Uploaded image:', result[0])
17
17
  }, [uploadImage])
18
18
 
19
- return <Button onPress={handleUpload} text="Upload image" />
19
+ return <Button onClick={handleUpload}>Upload image</Button>
20
20
  }
@@ -1,7 +1,8 @@
1
1
  import {useCallback} from 'react'
2
2
 
3
3
  import {useShopActions} from '../../internal/useShopActions'
4
- import {UploadTarget} from '../../types'
4
+
5
+ import type {UploadTarget} from '@shopify/shop-minis-platform/actions'
5
6
 
6
7
  export interface UploadImageParams {
7
8
  /**
@@ -45,7 +46,7 @@ const uploadFileToGCS = async (
45
46
  target: UploadTarget
46
47
  ) => {
47
48
  const formData = new FormData()
48
- target.parameters.forEach(({name, value}) => {
49
+ target.parameters.forEach(({name, value}: {name: string; value: string}) => {
49
50
  formData.append(name, value)
50
51
  })
51
52
  // Append the actual file data last
@@ -5,14 +5,12 @@ export default function MyComponent() {
5
5
 
6
6
  return (
7
7
  <>
8
- <Button
9
- onPress={() => followShop({shopId: 'gid://shopify/Shop/123'})}
10
- text="Follow shop"
11
- />
12
- <Button
13
- onPress={() => unfollowShop({shopId: 'gid://shopify/Shop/123'})}
14
- text="Unfollow shop"
15
- />
8
+ <Button onClick={() => followShop({shopId: 'gid://shopify/Shop/123'})}>
9
+ Follow shop
10
+ </Button>
11
+ <Button onClick={() => unfollowShop({shopId: 'gid://shopify/Shop/123'})}>
12
+ Unfollow shop
13
+ </Button>
16
14
  </>
17
15
  )
18
16
  }
@@ -6,25 +6,27 @@ export default function MyComponent() {
6
6
  return (
7
7
  <>
8
8
  <Button
9
- onPress={() =>
9
+ onClick={() =>
10
10
  saveProduct({
11
11
  productId: 'gid://shopify/Product/123',
12
12
  productVariantId: 'gid://shopify/ProductVariant/456',
13
13
  shopId: 'gid://shopify/Shop/42',
14
14
  })
15
15
  }
16
- text="Save product"
17
- />
16
+ >
17
+ Save product
18
+ </Button>
18
19
  <Button
19
- onPress={() =>
20
+ onClick={() =>
20
21
  unsaveProduct({
21
22
  productId: 'gid://shopify/Product/123',
22
23
  productVariantId: 'gid://shopify/ProductVariant/456',
23
24
  shopId: 'gid://shopify/Shop/42',
24
25
  })
25
26
  }
26
- text="Unsave product"
27
- />
27
+ >
28
+ Unsave product
29
+ </Button>
28
30
  </>
29
31
  )
30
32
  }
@@ -8,9 +8,8 @@ export default function MyComponent() {
8
8
  const handleError = useCallback(() => {
9
9
  showErrorScreen({
10
10
  message: 'Something went wrong',
11
- title: 'Error',
12
11
  })
13
12
  }, [showErrorScreen])
14
13
 
15
- return <Button onPress={handleError} text="Show error screen" />
14
+ return <Button onClick={handleError}>Show error screen</Button>
16
15
  }
@@ -1,5 +1,6 @@
1
+ import {ShopActions} from '@shopify/shop-minis-platform/actions'
2
+
1
3
  import {useShopActions} from '../../internal/useShopActions'
2
- import {ShopActions} from '../../types'
3
4
 
4
5
  interface UseErrorScreenReturns {
5
6
  /**
@@ -11,5 +11,5 @@ export default function MyComponent() {
11
11
  })
12
12
  }, [showErrorToast])
13
13
 
14
- return <Button onPress={handleError} text="Show error toast" />
14
+ return <Button onClick={handleError}>Show error toast</Button>
15
15
  }
@@ -1,5 +1,6 @@
1
+ import {ShopActions} from '@shopify/shop-minis-platform/actions'
2
+
1
3
  import {useShopActions} from '../../internal/useShopActions'
2
- import {ShopActions} from '../../types'
3
4
 
4
5
  interface UseErrorToastReturns {
5
6
  /**
@@ -1,9 +1,7 @@
1
1
  import React, {useState} from 'react'
2
2
 
3
- import {Camera, Image} from 'lucide-react'
4
-
3
+ import {Button} from '../../components/atoms/button'
5
4
  import {Alert, AlertDescription, AlertTitle} from '../../components/ui/alert'
6
- import {Button} from '../../components/ui/button'
7
5
  import {
8
6
  Card,
9
7
  CardContent,
@@ -16,14 +14,12 @@ import {useImagePicker} from './useImagePicker'
16
14
  export const UseImagePickerExample = () => {
17
15
  const [selectedImage, setSelectedImage] = useState<string | null>(null)
18
16
  const [error, setError] = useState<string | null>(null)
19
- const {openCamera, openGallery, ImagePickerInputs} = useImagePicker({
20
- cameraFacing: 'user',
21
- })
17
+ const {openCamera, openGallery} = useImagePicker()
22
18
 
23
19
  const handleCameraCapture = async () => {
24
20
  try {
25
21
  setError(null)
26
- const file = await openCamera()
22
+ const file = await openCamera('front')
27
23
  const url = URL.createObjectURL(file)
28
24
  setSelectedImage(url)
29
25
  } catch (err) {
@@ -48,16 +44,12 @@ export const UseImagePickerExample = () => {
48
44
  <CardTitle>Image Picker Example</CardTitle>
49
45
  </CardHeader>
50
46
  <CardContent className="space-y-4">
51
- <ImagePickerInputs />
52
-
53
47
  <div className="flex gap-2">
54
- <Button onClick={handleCameraCapture} variant="primary">
55
- <Camera className="mr-2 h-4 w-4" />
48
+ <Button onClick={handleCameraCapture} variant="default">
56
49
  Open Camera
57
50
  </Button>
58
51
 
59
52
  <Button onClick={handleGallerySelect} variant="secondary">
60
- <Image className="mr-2 h-4 w-4" />
61
53
  Open Gallery
62
54
  </Button>
63
55
  </div>