@shopify/shop-minis-react 0.6.1 → 0.7.1

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.
@@ -0,0 +1,23 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ function n({
3
+ position: i,
4
+ children: t
5
+ }) {
6
+ return /* @__PURE__ */ e(
7
+ "div",
8
+ {
9
+ style: {
10
+ position: "fixed",
11
+ left: 0,
12
+ right: 0,
13
+ [i]: 0,
14
+ viewTransitionName: `minis-fixed-${i}`
15
+ },
16
+ children: t
17
+ }
18
+ );
19
+ }
20
+ export {
21
+ n as StaticArea
22
+ };
23
+ //# sourceMappingURL=static-area.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"static-area.js","sources":["../../../src/components/atoms/static-area.tsx"],"sourcesContent":["export interface StaticAreaDocProps {\n /** Position of the fixed area on screen - either pinned to top or bottom */\n position: 'top' | 'bottom'\n /** Static area content */\n children?: React.ReactNode\n}\n\nexport function StaticArea({\n position,\n children,\n}: {\n position: 'top' | 'bottom'\n children: React.ReactNode\n}) {\n return (\n <div\n style={{\n position: 'fixed',\n left: 0,\n right: 0,\n [position]: 0,\n viewTransitionName: `minis-fixed-${position}`,\n }}\n >\n {children}\n </div>\n )\n}\n"],"names":["StaticArea","position","children","jsx"],"mappings":";AAOO,SAASA,EAAW;AAAA,EACzB,UAAAC;AAAA,EACA,UAAAC;AACF,GAGG;AAEC,SAAA,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,OAAO;AAAA,QACL,UAAU;AAAA,QACV,MAAM;AAAA,QACN,OAAO;AAAA,QACP,CAACF,CAAQ,GAAG;AAAA,QACZ,oBAAoB,eAAeA,CAAQ;AAAA,MAC7C;AAAA,MAEC,UAAAC;AAAA,IAAA;AAAA,EACH;AAEJ;"}
@@ -1,22 +1,24 @@
1
1
  import { useHandleAction as t } from "../../internal/useHandleAction.js";
2
2
  import { useShopActions as c } from "../../internal/useShopActions.js";
3
- const m = () => {
3
+ const L = () => {
4
4
  const {
5
5
  addProductList: o,
6
- removeProductList: r,
7
- renameProductList: e,
8
- addProductListItem: d,
9
- removeProductListItem: s
6
+ removeProductList: i,
7
+ renameProductList: r,
8
+ setProductListVisibility: e,
9
+ addProductListItem: s,
10
+ removeProductListItem: d
10
11
  } = c();
11
12
  return {
12
13
  addProductList: t(o),
13
- removeProductList: t(r),
14
- renameProductList: t(e),
15
- addProductListItem: t(d),
16
- removeProductListItem: t(s)
14
+ removeProductList: t(i),
15
+ renameProductList: t(r),
16
+ setProductListVisibility: t(e),
17
+ addProductListItem: t(s),
18
+ removeProductListItem: t(d)
17
19
  };
18
20
  };
19
21
  export {
20
- m as useProductListActions
22
+ L as useProductListActions
21
23
  };
22
24
  //# sourceMappingURL=useProductListActions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useProductListActions.js","sources":["../../../src/hooks/product/useProductListActions.ts"],"sourcesContent":["import {\n AddProductListParams,\n RemoveProductListParams,\n RenameProductListParams,\n AddProductListItemParams,\n RemoveProductListItemParams,\n} from '@shopify/shop-minis-platform/actions'\n\nimport {useHandleAction} from '../../internal/useHandleAction'\nimport {useShopActions} from '../../internal/useShopActions'\nimport {ProductList} from '../../types'\n\ninterface UseProductListActionsReturns {\n /**\n * Add a product list\n */\n addProductList: (params: AddProductListParams) => Promise<ProductList>\n /**\n * Remove a product list\n */\n removeProductList: (params: RemoveProductListParams) => Promise<void>\n /**\n * Rename a product list\n */\n renameProductList: (params: RenameProductListParams) => Promise<ProductList>\n /**\n * Add a product to a product list\n */\n addProductListItem: (params: AddProductListItemParams) => Promise<void>\n /**\n * Remove a product from a product list\n */\n removeProductListItem: (params: RemoveProductListItemParams) => Promise<void>\n}\n\nexport const useProductListActions = (): UseProductListActionsReturns => {\n const {\n addProductList,\n removeProductList,\n renameProductList,\n addProductListItem,\n removeProductListItem,\n } = useShopActions()\n\n return {\n addProductList: useHandleAction(addProductList),\n removeProductList: useHandleAction(removeProductList),\n renameProductList: useHandleAction(renameProductList),\n addProductListItem: useHandleAction(addProductListItem),\n removeProductListItem: useHandleAction(removeProductListItem),\n }\n}\n"],"names":["useProductListActions","addProductList","removeProductList","renameProductList","addProductListItem","removeProductListItem","useShopActions","useHandleAction"],"mappings":";;AAmCO,MAAMA,IAAwB,MAAoC;AACjE,QAAA;AAAA,IACJ,gBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,uBAAAC;AAAA,MACEC,EAAe;AAEZ,SAAA;AAAA,IACL,gBAAgBC,EAAgBN,CAAc;AAAA,IAC9C,mBAAmBM,EAAgBL,CAAiB;AAAA,IACpD,mBAAmBK,EAAgBJ,CAAiB;AAAA,IACpD,oBAAoBI,EAAgBH,CAAkB;AAAA,IACtD,uBAAuBG,EAAgBF,CAAqB;AAAA,EAC9D;AACF;"}
1
+ {"version":3,"file":"useProductListActions.js","sources":["../../../src/hooks/product/useProductListActions.ts"],"sourcesContent":["import {\n AddProductListParams,\n RemoveProductListParams,\n RenameProductListParams,\n SetProductListVisibilityParams,\n AddProductListItemParams,\n RemoveProductListItemParams,\n} from '@shopify/shop-minis-platform/actions'\n\nimport {useHandleAction} from '../../internal/useHandleAction'\nimport {useShopActions} from '../../internal/useShopActions'\nimport {ProductList} from '../../types'\n\ninterface UseProductListActionsReturns {\n /**\n * Add a product list\n */\n addProductList: (params: AddProductListParams) => Promise<ProductList>\n /**\n * Remove a product list\n */\n removeProductList: (params: RemoveProductListParams) => Promise<void>\n /**\n * Rename a product list\n */\n renameProductList: (params: RenameProductListParams) => Promise<ProductList>\n /**\n * Set the visibility (privacy status) of a product list\n */\n setProductListVisibility: (\n params: SetProductListVisibilityParams\n ) => Promise<ProductList>\n /**\n * Add a product to a product list\n */\n addProductListItem: (params: AddProductListItemParams) => Promise<void>\n /**\n * Remove a product from a product list\n */\n removeProductListItem: (params: RemoveProductListItemParams) => Promise<void>\n}\n\nexport const useProductListActions = (): UseProductListActionsReturns => {\n const {\n addProductList,\n removeProductList,\n renameProductList,\n setProductListVisibility,\n addProductListItem,\n removeProductListItem,\n } = useShopActions()\n\n return {\n addProductList: useHandleAction(addProductList),\n removeProductList: useHandleAction(removeProductList),\n renameProductList: useHandleAction(renameProductList),\n setProductListVisibility: useHandleAction(setProductListVisibility),\n addProductListItem: useHandleAction(addProductListItem),\n removeProductListItem: useHandleAction(removeProductListItem),\n }\n}\n"],"names":["useProductListActions","addProductList","removeProductList","renameProductList","setProductListVisibility","addProductListItem","removeProductListItem","useShopActions","useHandleAction"],"mappings":";;AA0CO,MAAMA,IAAwB,MAAoC;AACjE,QAAA;AAAA,IACJ,gBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,uBAAAC;AAAA,MACEC,EAAe;AAEZ,SAAA;AAAA,IACL,gBAAgBC,EAAgBP,CAAc;AAAA,IAC9C,mBAAmBO,EAAgBN,CAAiB;AAAA,IACpD,mBAAmBM,EAAgBL,CAAiB;AAAA,IACpD,0BAA0BK,EAAgBJ,CAAwB;AAAA,IAClE,oBAAoBI,EAAgBH,CAAkB;AAAA,IACtD,uBAAuBG,EAAgBF,CAAqB;AAAA,EAC9D;AACF;"}
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
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
- import { AddToCartButton as n } from "./components/commerce/add-to-cart.js";
3
+ import { AddToCartButton as m } from "./components/commerce/add-to-cart.js";
4
4
  import { BuyNowButton as s } from "./components/commerce/buy-now.js";
5
- import { ProductCard as u, ProductCardBadge as f, ProductCardContainer as x, ProductCardFavoriteButton as c, ProductCardImage as d, ProductCardImageContainer as C, ProductCardInfo as g, ProductCardPrice as S, ProductCardReviewStars as D, ProductCardTitle as A } from "./components/commerce/product-card.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, ProductCardReviewStars as A, ProductCardTitle as D } from "./components/commerce/product-card.js";
6
6
  import { ProductLink as T } from "./components/commerce/product-link.js";
7
7
  import { MerchantCard as I, MerchantCardContainer as R, MerchantCardHeader as v, MerchantCardInfo as w, MerchantCardName as B, MerchantCardRating as E } from "./components/commerce/merchant-card.js";
8
8
  import { ProductCardSkeleton as F } from "./components/commerce/product-card-skeleton.js";
@@ -19,157 +19,158 @@ import { Image as rr } from "./components/atoms/image.js";
19
19
  import { Touchable as or } from "./components/atoms/touchable.js";
20
20
  import { LongPressDetector as ar } from "./components/atoms/long-press-detector.js";
21
21
  import { AlertDialogAtom as pr } from "./components/atoms/alert-dialog.js";
22
- import { List as mr } from "./components/atoms/list.js";
22
+ import { List as nr } from "./components/atoms/list.js";
23
23
  import { VideoPlayer as lr } from "./components/atoms/video-player.js";
24
24
  import { TextInput as fr } from "./components/atoms/text-input.js";
25
25
  import { ContentWrapper as cr } from "./components/atoms/content-wrapper.js";
26
26
  import { ProductVariantPrice as Cr } from "./components/atoms/product-variant-price.js";
27
- import { Accordion as Sr, AccordionContent as Dr, AccordionItem as Ar, AccordionTrigger as Pr } from "./components/ui/accordion.js";
28
- import { Alert as hr, AlertDescription as Ir, AlertTitle as Rr } from "./components/ui/alert.js";
29
- import { AlertDialog as wr, AlertDialogAction as Br, AlertDialogCancel as Er, AlertDialogContent as Mr, AlertDialogDescription as Fr, AlertDialogFooter as Ur, AlertDialogHeader as br, AlertDialogOverlay as Lr, AlertDialogPortal as kr, AlertDialogTitle as Nr, AlertDialogTrigger as Or } from "./components/ui/alert-dialog.js";
30
- import { Avatar as yr, AvatarFallback as Gr, AvatarImage as Hr } from "./components/ui/avatar.js";
31
- import { Badge as zr, badgeVariants as Wr } from "./components/ui/badge.js";
32
- import { Card as qr, CardAction as Kr, CardContent as Qr, CardDescription as Zr, CardFooter as jr, CardHeader as Jr, CardTitle as Xr } from "./components/ui/card.js";
33
- import { Carousel as re, CarouselContent as ee, CarouselItem as oe, CarouselNext as te, CarouselPrevious as ae } from "./components/ui/carousel.js";
34
- import { Checkbox as pe } from "./components/ui/checkbox.js";
35
- import { Dialog as me, DialogClose as se, DialogContent as le, DialogDescription as ue, DialogFooter as fe, DialogHeader as xe, DialogOverlay as ce, DialogPortal as de, DialogTitle as Ce, DialogTrigger as ge } from "./components/ui/dialog.js";
36
- import { Drawer as De, DrawerClose as Ae, DrawerContent as Pe, DrawerDescription as Te, DrawerFooter as he, DrawerHeader as Ie, DrawerOverlay as Re, DrawerPortal as ve, DrawerTitle as we, DrawerTrigger as Be } from "./components/ui/drawer.js";
37
- import { Input as Me } from "./components/ui/input.js";
38
- import { Label as Ue } from "./components/ui/label.js";
39
- import { Progress as Le } from "./components/ui/progress.js";
40
- import { RadioGroup as Ne, RadioGroupItem as Oe } from "./components/ui/radio-group.js";
41
- import { ResizableHandle as ye, ResizablePanel as Ge, ResizablePanelGroup as He } from "./components/ui/resizable.js";
42
- import { ScrollArea as ze, ScrollBar as We } from "./components/ui/scroll-area.js";
43
- import { Select as qe, SelectContent as Ke, SelectGroup as Qe, SelectItem as Ze, SelectLabel as je, SelectScrollDownButton as Je, SelectScrollUpButton as Xe, SelectSeparator as $e, SelectTrigger as ro, SelectValue as eo } from "./components/ui/select.js";
44
- import { Separator as to } from "./components/ui/separator.js";
45
- import { Sheet as io, SheetClose as po, SheetContent as no, SheetDescription as mo, SheetFooter as so, SheetHeader as lo, SheetTitle as uo, SheetTrigger as fo } from "./components/ui/sheet.js";
46
- import { Toaster as co } from "./components/ui/sonner.js";
47
- import { toast as go } from "./shop-minis-react/node_modules/.pnpm/sonner@2.0.5_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/sonner/dist/index.js";
48
- import { Skeleton as Do } from "./components/ui/skeleton.js";
49
- import { useRecentProducts as Po } from "./hooks/user/useRecentProducts.js";
50
- import { useRecentShops as ho } from "./hooks/user/useRecentShops.js";
51
- import { useSavedProducts as Ro } from "./hooks/user/useSavedProducts.js";
52
- import { useSavedProductsActions as wo } from "./hooks/user/useSavedProductsActions.js";
53
- import { useFollowedShops as Eo } from "./hooks/user/useFollowedShops.js";
54
- import { useFollowedShopsActions as Fo } from "./hooks/user/useFollowedShopsActions.js";
55
- import { useCurrentUser as bo } from "./hooks/user/useCurrentUser.js";
56
- import { useOrders as ko } from "./hooks/user/useOrders.js";
57
- import { useBuyerAttributes as Oo } from "./hooks/user/useBuyerAttributes.js";
58
- import { useGenerateUserToken as yo } from "./hooks/user/useGenerateUserToken.js";
59
- import { useProductListActions as Ho } from "./hooks/product/useProductListActions.js";
60
- import { useProductLists as zo } from "./hooks/product/useProductLists.js";
61
- import { useProductList as Yo } from "./hooks/product/useProductList.js";
62
- import { useProduct as Ko } from "./hooks/product/useProduct.js";
63
- import { useProducts as Zo } from "./hooks/product/useProducts.js";
64
- import { useProductVariants as Jo } from "./hooks/product/useProductVariants.js";
65
- import { useProductMedia as $o } from "./hooks/product/useProductMedia.js";
66
- import { useProductReviews as et } from "./hooks/product/useProductReviews.js";
67
- import { useProductSearch as tt } from "./hooks/product/useProductSearch.js";
68
- import { useRecommendedProducts as it } from "./hooks/product/useRecommendedProducts.js";
69
- import { usePopularProducts as nt } from "./hooks/product/usePopularProducts.js";
70
- import { useAsyncStorage as st } from "./hooks/storage/useAsyncStorage.js";
71
- import { useSecureStorage as ut } from "./hooks/storage/useSecureStorage.js";
72
- import { useImageUpload as xt } from "./hooks/storage/useImageUpload.js";
73
- import { useShopNavigation as dt } from "./hooks/navigation/useShopNavigation.js";
74
- import { useCloseMini as gt } from "./hooks/navigation/useCloseMini.js";
75
- import { useDeeplink as Dt } from "./hooks/navigation/useDeeplink.js";
76
- import { useNavigateWithTransition as Pt } from "./hooks/navigation/useNavigateWithTransition.js";
77
- import { useShop as ht } from "./hooks/shop/useShop.js";
78
- import { useRecommendedShops as Rt } from "./hooks/shop/useRecommendedShops.js";
79
- import { useCreateImageContent as wt } from "./hooks/content/useCreateImageContent.js";
80
- import { useErrorToast as Et } from "./hooks/util/useErrorToast.js";
81
- import { useErrorScreen as Ft } from "./hooks/util/useErrorScreen.js";
82
- import { useShare as bt } from "./hooks/util/useShare.js";
83
- import { useImagePicker as kt } from "./hooks/util/useImagePicker.js";
84
- import { useKeyboardAvoidingView as Ot } from "./hooks/util/useKeyboardAvoidingView.js";
85
- import { useRequestPermissions as yt } from "./hooks/util/useRequestPermissions.js";
86
- import { useOnMiniFocus as Ht } from "./hooks/events/useOnMiniFocus.js";
87
- import { useOnMiniBlur as zt } from "./hooks/events/useOnMiniBlur.js";
88
- import { useOnMiniClose as Yt } from "./hooks/events/useOnMiniClose.js";
89
- import { useOnAppStateChange as Kt } from "./hooks/events/useOnAppStateChange.js";
90
- import { useOnNavigateBack as Zt } from "./hooks/events/useOnNavigateBack.js";
91
- import { buildDeeplinkUrl as Jt } from "./utils/buildDeeplinkUrl.js";
92
- import { MiniEntityNotFoundError as $t, MiniError as ra, MiniNetworkError as ea, formatError as oa } from "./utils/errors.js";
93
- import { extractBrandTheme as aa, formatReviewCount as ia, getFeaturedImages as pa, normalizeRating as na } from "./utils/merchant-card.js";
94
- import { parseUrl as sa } from "./utils/parseUrl.js";
95
- import { dataURLToBlob as ua, fileToDataUri as fa, getResizedImageUrl as xa, getThumbhashBlobURL as ca, getThumbhashDataURL as da } from "./utils/image.js";
96
- import { formatMoney as ga } from "./utils/formatMoney.js";
97
- import { UserState as Da, UserTokenGenerateUserErrorCode as Aa } from "./shop-minis-platform/src/types/user.js";
98
- import { ContentCreateUserErrorCode as Ta, MinisContentStatus as ha } from "./shop-minis-platform/src/types/content.js";
99
- import { Social as Ra } from "./shop-minis-platform/src/types/share.js";
100
- import { DATA_FETCHING_DEFAULT_FETCH_POLICY as wa, DATA_FETCHING_DEFAULT_PAGE_SIZE as Ba } from "./shop-minis-platform/src/constants.js";
27
+ import { StaticArea as Sr } from "./components/atoms/static-area.js";
28
+ import { Accordion as Dr, AccordionContent as Pr, AccordionItem as Tr, AccordionTrigger as hr } from "./components/ui/accordion.js";
29
+ import { Alert as Rr, AlertDescription as vr, AlertTitle as wr } from "./components/ui/alert.js";
30
+ import { AlertDialog as Er, AlertDialogAction as Mr, AlertDialogCancel as Fr, AlertDialogContent as Ur, AlertDialogDescription as br, AlertDialogFooter as Lr, AlertDialogHeader as kr, AlertDialogOverlay as Nr, AlertDialogPortal as Or, AlertDialogTitle as _r, AlertDialogTrigger as yr } from "./components/ui/alert-dialog.js";
31
+ import { Avatar as Hr, AvatarFallback as Vr, AvatarImage as zr } from "./components/ui/avatar.js";
32
+ import { Badge as Yr, badgeVariants as qr } from "./components/ui/badge.js";
33
+ import { Card as Qr, CardAction as Zr, CardContent as jr, CardDescription as Jr, CardFooter as Xr, CardHeader as $r, CardTitle as re } from "./components/ui/card.js";
34
+ import { Carousel as oe, CarouselContent as te, CarouselItem as ae, CarouselNext as ie, CarouselPrevious as pe } from "./components/ui/carousel.js";
35
+ import { Checkbox as ne } from "./components/ui/checkbox.js";
36
+ import { Dialog as le, DialogClose as ue, DialogContent as fe, DialogDescription as xe, DialogFooter as ce, DialogHeader as de, DialogOverlay as Ce, DialogPortal as ge, DialogTitle as Se, DialogTrigger as Ae } from "./components/ui/dialog.js";
37
+ import { Drawer as Pe, DrawerClose as Te, DrawerContent as he, DrawerDescription as Ie, DrawerFooter as Re, DrawerHeader as ve, DrawerOverlay as we, DrawerPortal as Be, DrawerTitle as Ee, DrawerTrigger as Me } from "./components/ui/drawer.js";
38
+ import { Input as Ue } from "./components/ui/input.js";
39
+ import { Label as Le } from "./components/ui/label.js";
40
+ import { Progress as Ne } from "./components/ui/progress.js";
41
+ import { RadioGroup as _e, RadioGroupItem as ye } from "./components/ui/radio-group.js";
42
+ import { ResizableHandle as He, ResizablePanel as Ve, ResizablePanelGroup as ze } from "./components/ui/resizable.js";
43
+ import { ScrollArea as Ye, ScrollBar as qe } from "./components/ui/scroll-area.js";
44
+ import { Select as Qe, SelectContent as Ze, SelectGroup as je, SelectItem as Je, SelectLabel as Xe, SelectScrollDownButton as $e, SelectScrollUpButton as ro, SelectSeparator as eo, SelectTrigger as oo, SelectValue as to } from "./components/ui/select.js";
45
+ import { Separator as io } from "./components/ui/separator.js";
46
+ import { Sheet as mo, SheetClose as no, SheetContent as so, SheetDescription as lo, SheetFooter as uo, SheetHeader as fo, SheetTitle as xo, SheetTrigger as co } from "./components/ui/sheet.js";
47
+ import { Toaster as go } from "./components/ui/sonner.js";
48
+ import { toast as Ao } from "./shop-minis-react/node_modules/.pnpm/sonner@2.0.5_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/sonner/dist/index.js";
49
+ import { Skeleton as Po } from "./components/ui/skeleton.js";
50
+ import { useRecentProducts as ho } from "./hooks/user/useRecentProducts.js";
51
+ import { useRecentShops as Ro } from "./hooks/user/useRecentShops.js";
52
+ import { useSavedProducts as wo } from "./hooks/user/useSavedProducts.js";
53
+ import { useSavedProductsActions as Eo } from "./hooks/user/useSavedProductsActions.js";
54
+ import { useFollowedShops as Fo } from "./hooks/user/useFollowedShops.js";
55
+ import { useFollowedShopsActions as bo } from "./hooks/user/useFollowedShopsActions.js";
56
+ import { useCurrentUser as ko } from "./hooks/user/useCurrentUser.js";
57
+ import { useOrders as Oo } from "./hooks/user/useOrders.js";
58
+ import { useBuyerAttributes as yo } from "./hooks/user/useBuyerAttributes.js";
59
+ import { useGenerateUserToken as Ho } from "./hooks/user/useGenerateUserToken.js";
60
+ import { useProductListActions as zo } from "./hooks/product/useProductListActions.js";
61
+ import { useProductLists as Yo } from "./hooks/product/useProductLists.js";
62
+ import { useProductList as Ko } from "./hooks/product/useProductList.js";
63
+ import { useProduct as Zo } from "./hooks/product/useProduct.js";
64
+ import { useProducts as Jo } from "./hooks/product/useProducts.js";
65
+ import { useProductVariants as $o } from "./hooks/product/useProductVariants.js";
66
+ import { useProductMedia as et } from "./hooks/product/useProductMedia.js";
67
+ import { useProductReviews as tt } from "./hooks/product/useProductReviews.js";
68
+ import { useProductSearch as it } from "./hooks/product/useProductSearch.js";
69
+ import { useRecommendedProducts as mt } from "./hooks/product/useRecommendedProducts.js";
70
+ import { usePopularProducts as st } from "./hooks/product/usePopularProducts.js";
71
+ import { useAsyncStorage as ut } from "./hooks/storage/useAsyncStorage.js";
72
+ import { useSecureStorage as xt } from "./hooks/storage/useSecureStorage.js";
73
+ import { useImageUpload as dt } from "./hooks/storage/useImageUpload.js";
74
+ import { useShopNavigation as gt } from "./hooks/navigation/useShopNavigation.js";
75
+ import { useCloseMini as At } from "./hooks/navigation/useCloseMini.js";
76
+ import { useDeeplink as Pt } from "./hooks/navigation/useDeeplink.js";
77
+ import { useNavigateWithTransition as ht } from "./hooks/navigation/useNavigateWithTransition.js";
78
+ import { useShop as Rt } from "./hooks/shop/useShop.js";
79
+ import { useRecommendedShops as wt } from "./hooks/shop/useRecommendedShops.js";
80
+ import { useCreateImageContent as Et } from "./hooks/content/useCreateImageContent.js";
81
+ import { useErrorToast as Ft } from "./hooks/util/useErrorToast.js";
82
+ import { useErrorScreen as bt } from "./hooks/util/useErrorScreen.js";
83
+ import { useShare as kt } from "./hooks/util/useShare.js";
84
+ import { useImagePicker as Ot } from "./hooks/util/useImagePicker.js";
85
+ import { useKeyboardAvoidingView as yt } from "./hooks/util/useKeyboardAvoidingView.js";
86
+ import { useRequestPermissions as Ht } from "./hooks/util/useRequestPermissions.js";
87
+ import { useOnMiniFocus as zt } from "./hooks/events/useOnMiniFocus.js";
88
+ import { useOnMiniBlur as Yt } from "./hooks/events/useOnMiniBlur.js";
89
+ import { useOnMiniClose as Kt } from "./hooks/events/useOnMiniClose.js";
90
+ import { useOnAppStateChange as Zt } from "./hooks/events/useOnAppStateChange.js";
91
+ import { useOnNavigateBack as Jt } from "./hooks/events/useOnNavigateBack.js";
92
+ import { buildDeeplinkUrl as $t } from "./utils/buildDeeplinkUrl.js";
93
+ import { MiniEntityNotFoundError as ea, MiniError as oa, MiniNetworkError as ta, formatError as aa } from "./utils/errors.js";
94
+ import { extractBrandTheme as pa, formatReviewCount as ma, getFeaturedImages as na, normalizeRating as sa } from "./utils/merchant-card.js";
95
+ import { parseUrl as ua } from "./utils/parseUrl.js";
96
+ import { dataURLToBlob as xa, fileToDataUri as ca, getResizedImageUrl as da, getThumbhashBlobURL as Ca, getThumbhashDataURL as ga } from "./utils/image.js";
97
+ import { formatMoney as Aa } from "./utils/formatMoney.js";
98
+ import { UserState as Pa, UserTokenGenerateUserErrorCode as Ta } from "./shop-minis-platform/src/types/user.js";
99
+ import { ContentCreateUserErrorCode as Ia, MinisContentStatus as Ra } from "./shop-minis-platform/src/types/content.js";
100
+ import { Social as wa } from "./shop-minis-platform/src/types/share.js";
101
+ import { DATA_FETCHING_DEFAULT_FETCH_POLICY as Ea, DATA_FETCHING_DEFAULT_PAGE_SIZE as Ma } from "./shop-minis-platform/src/constants.js";
101
102
  export {
102
- Sr as Accordion,
103
- Dr as AccordionContent,
104
- Ar as AccordionItem,
105
- Pr as AccordionTrigger,
106
- n as AddToCartButton,
107
- hr as Alert,
108
- Ir as AlertDescription,
109
- wr as AlertDialog,
110
- Br as AlertDialogAction,
103
+ Dr as Accordion,
104
+ Pr as AccordionContent,
105
+ Tr as AccordionItem,
106
+ hr as AccordionTrigger,
107
+ m as AddToCartButton,
108
+ Rr as Alert,
109
+ vr as AlertDescription,
110
+ Er as AlertDialog,
111
+ Mr as AlertDialogAction,
111
112
  pr as AlertDialogAtom,
112
- Er as AlertDialogCancel,
113
- Mr as AlertDialogContent,
114
- Fr as AlertDialogDescription,
115
- Ur as AlertDialogFooter,
116
- br as AlertDialogHeader,
117
- Lr as AlertDialogOverlay,
118
- kr as AlertDialogPortal,
119
- Nr as AlertDialogTitle,
120
- Or as AlertDialogTrigger,
121
- Rr as AlertTitle,
122
- yr as Avatar,
123
- Gr as AvatarFallback,
124
- Hr as AvatarImage,
125
- zr as Badge,
113
+ Fr as AlertDialogCancel,
114
+ Ur as AlertDialogContent,
115
+ br as AlertDialogDescription,
116
+ Lr as AlertDialogFooter,
117
+ kr as AlertDialogHeader,
118
+ Nr as AlertDialogOverlay,
119
+ Or as AlertDialogPortal,
120
+ _r as AlertDialogTitle,
121
+ yr as AlertDialogTrigger,
122
+ wr as AlertTitle,
123
+ Hr as Avatar,
124
+ Vr as AvatarFallback,
125
+ zr as AvatarImage,
126
+ Yr as Badge,
126
127
  j as Button,
127
128
  s as BuyNowButton,
128
- qr as Card,
129
- Kr as CardAction,
130
- Qr as CardContent,
131
- Zr as CardDescription,
132
- jr as CardFooter,
133
- Jr as CardHeader,
134
- Xr as CardTitle,
135
- re as Carousel,
136
- ee as CarouselContent,
137
- oe as CarouselItem,
138
- te as CarouselNext,
139
- ae as CarouselPrevious,
140
- pe as Checkbox,
141
- Ta as ContentCreateUserErrorCode,
129
+ Qr as Card,
130
+ Zr as CardAction,
131
+ jr as CardContent,
132
+ Jr as CardDescription,
133
+ Xr as CardFooter,
134
+ $r as CardHeader,
135
+ re as CardTitle,
136
+ oe as Carousel,
137
+ te as CarouselContent,
138
+ ae as CarouselItem,
139
+ ie as CarouselNext,
140
+ pe as CarouselPrevious,
141
+ ne as Checkbox,
142
+ Ia as ContentCreateUserErrorCode,
142
143
  cr as ContentWrapper,
143
- wa as DATA_FETCHING_DEFAULT_FETCH_POLICY,
144
- Ba as DATA_FETCHING_DEFAULT_PAGE_SIZE,
144
+ Ea as DATA_FETCHING_DEFAULT_FETCH_POLICY,
145
+ Ma as DATA_FETCHING_DEFAULT_PAGE_SIZE,
145
146
  o as DATA_NAVIGATION_TYPE_ATTRIBUTE,
146
- me as Dialog,
147
- se as DialogClose,
148
- le as DialogContent,
149
- ue as DialogDescription,
150
- fe as DialogFooter,
151
- xe as DialogHeader,
152
- ce as DialogOverlay,
153
- de as DialogPortal,
154
- Ce as DialogTitle,
155
- ge as DialogTrigger,
156
- De as Drawer,
157
- Ae as DrawerClose,
158
- Pe as DrawerContent,
159
- Te as DrawerDescription,
160
- he as DrawerFooter,
161
- Ie as DrawerHeader,
162
- Re as DrawerOverlay,
163
- ve as DrawerPortal,
164
- we as DrawerTitle,
165
- Be as DrawerTrigger,
147
+ le as Dialog,
148
+ ue as DialogClose,
149
+ fe as DialogContent,
150
+ xe as DialogDescription,
151
+ ce as DialogFooter,
152
+ de as DialogHeader,
153
+ Ce as DialogOverlay,
154
+ ge as DialogPortal,
155
+ Se as DialogTitle,
156
+ Ae as DialogTrigger,
157
+ Pe as Drawer,
158
+ Te as DrawerClose,
159
+ he as DrawerContent,
160
+ Ie as DrawerDescription,
161
+ Re as DrawerFooter,
162
+ ve as DrawerHeader,
163
+ we as DrawerOverlay,
164
+ Be as DrawerPortal,
165
+ Ee as DrawerTitle,
166
+ Me as DrawerTrigger,
166
167
  V as FavoriteButton,
167
168
  X as IconButton,
168
169
  rr as Image,
169
170
  W as ImageContentWrapper,
170
- Me as Input,
171
- Ue as Label,
172
- mr as List,
171
+ Ue as Input,
172
+ Le as Label,
173
+ nr as List,
173
174
  ar as LongPressDetector,
174
175
  I as MerchantCard,
175
176
  R as MerchantCardContainer,
@@ -178,11 +179,11 @@ export {
178
179
  B as MerchantCardName,
179
180
  E as MerchantCardRating,
180
181
  b as MerchantCardSkeleton,
181
- $t as MiniEntityNotFoundError,
182
- ra as MiniError,
183
- ea as MiniNetworkError,
182
+ ea as MiniEntityNotFoundError,
183
+ oa as MiniError,
184
+ ta as MiniNetworkError,
184
185
  i as MinisContainer,
185
- ha as MinisContentStatus,
186
+ Ra as MinisContentStatus,
186
187
  q as MinisRouter,
187
188
  t as NAVIGATION_TYPES,
188
189
  u as ProductCard,
@@ -193,108 +194,109 @@ export {
193
194
  C as ProductCardImageContainer,
194
195
  g as ProductCardInfo,
195
196
  S as ProductCardPrice,
196
- D as ProductCardReviewStars,
197
+ A as ProductCardReviewStars,
197
198
  F as ProductCardSkeleton,
198
- A as ProductCardTitle,
199
+ D as ProductCardTitle,
199
200
  T as ProductLink,
200
201
  Cr as ProductVariantPrice,
201
- Le as Progress,
202
+ Ne as Progress,
202
203
  k as QuantitySelector,
203
- Ne as RadioGroup,
204
- Oe as RadioGroupItem,
205
- ye as ResizableHandle,
206
- Ge as ResizablePanel,
207
- He as ResizablePanelGroup,
208
- ze as ScrollArea,
209
- We as ScrollBar,
204
+ _e as RadioGroup,
205
+ ye as RadioGroupItem,
206
+ He as ResizableHandle,
207
+ Ve as ResizablePanel,
208
+ ze as ResizablePanelGroup,
209
+ Ye as ScrollArea,
210
+ qe as ScrollBar,
210
211
  O as Search,
211
212
  _ as SearchInput,
212
213
  y as SearchProvider,
213
214
  G as SearchResultsList,
214
- qe as Select,
215
- Ke as SelectContent,
216
- Qe as SelectGroup,
217
- Ze as SelectItem,
218
- je as SelectLabel,
219
- Je as SelectScrollDownButton,
220
- Xe as SelectScrollUpButton,
221
- $e as SelectSeparator,
222
- ro as SelectTrigger,
223
- eo as SelectValue,
224
- to as Separator,
225
- io as Sheet,
226
- po as SheetClose,
227
- no as SheetContent,
228
- mo as SheetDescription,
229
- so as SheetFooter,
230
- lo as SheetHeader,
231
- uo as SheetTitle,
232
- fo as SheetTrigger,
233
- Do as Skeleton,
234
- Ra as Social,
215
+ Qe as Select,
216
+ Ze as SelectContent,
217
+ je as SelectGroup,
218
+ Je as SelectItem,
219
+ Xe as SelectLabel,
220
+ $e as SelectScrollDownButton,
221
+ ro as SelectScrollUpButton,
222
+ eo as SelectSeparator,
223
+ oo as SelectTrigger,
224
+ to as SelectValue,
225
+ io as Separator,
226
+ mo as Sheet,
227
+ no as SheetClose,
228
+ so as SheetContent,
229
+ lo as SheetDescription,
230
+ uo as SheetFooter,
231
+ fo as SheetHeader,
232
+ xo as SheetTitle,
233
+ co as SheetTrigger,
234
+ Po as Skeleton,
235
+ wa as Social,
236
+ Sr as StaticArea,
235
237
  fr as TextInput,
236
- co as Toaster,
238
+ go as Toaster,
237
239
  or as Touchable,
238
240
  Q as TransitionLink,
239
- Da as UserState,
240
- Aa as UserTokenGenerateUserErrorCode,
241
+ Pa as UserState,
242
+ Ta as UserTokenGenerateUserErrorCode,
241
243
  lr as VideoPlayer,
242
- Wr as badgeVariants,
243
- Jt as buildDeeplinkUrl,
244
- ua as dataURLToBlob,
245
- aa as extractBrandTheme,
246
- fa as fileToDataUri,
247
- oa as formatError,
248
- ga as formatMoney,
249
- ia as formatReviewCount,
250
- pa as getFeaturedImages,
251
- xa as getResizedImageUrl,
252
- ca as getThumbhashBlobURL,
253
- da as getThumbhashDataURL,
254
- na as normalizeRating,
255
- sa as parseUrl,
256
- go as toast,
257
- st as useAsyncStorage,
258
- Oo as useBuyerAttributes,
259
- gt as useCloseMini,
260
- wt as useCreateImageContent,
261
- bo as useCurrentUser,
262
- Dt as useDeeplink,
263
- Ft as useErrorScreen,
264
- Et as useErrorToast,
265
- Eo as useFollowedShops,
266
- Fo as useFollowedShopsActions,
267
- yo as useGenerateUserToken,
268
- kt as useImagePicker,
269
- xt as useImageUpload,
270
- Ot as useKeyboardAvoidingView,
271
- Pt as useNavigateWithTransition,
272
- Kt as useOnAppStateChange,
273
- zt as useOnMiniBlur,
274
- Yt as useOnMiniClose,
275
- Ht as useOnMiniFocus,
276
- Zt as useOnNavigateBack,
277
- ko as useOrders,
278
- nt as usePopularProducts,
279
- Ko as useProduct,
280
- Yo as useProductList,
281
- Ho as useProductListActions,
282
- zo as useProductLists,
283
- $o as useProductMedia,
284
- et as useProductReviews,
285
- tt as useProductSearch,
286
- Jo as useProductVariants,
287
- Zo as useProducts,
288
- Po as useRecentProducts,
289
- ho as useRecentShops,
290
- it as useRecommendedProducts,
291
- Rt as useRecommendedShops,
292
- yt as useRequestPermissions,
293
- Ro as useSavedProducts,
294
- wo as useSavedProductsActions,
295
- ut as useSecureStorage,
296
- bt as useShare,
297
- ht as useShop,
298
- dt as useShopNavigation
244
+ qr as badgeVariants,
245
+ $t as buildDeeplinkUrl,
246
+ xa as dataURLToBlob,
247
+ pa as extractBrandTheme,
248
+ ca as fileToDataUri,
249
+ aa as formatError,
250
+ Aa as formatMoney,
251
+ ma as formatReviewCount,
252
+ na as getFeaturedImages,
253
+ da as getResizedImageUrl,
254
+ Ca as getThumbhashBlobURL,
255
+ ga as getThumbhashDataURL,
256
+ sa as normalizeRating,
257
+ ua as parseUrl,
258
+ Ao as toast,
259
+ ut as useAsyncStorage,
260
+ yo as useBuyerAttributes,
261
+ At as useCloseMini,
262
+ Et as useCreateImageContent,
263
+ ko as useCurrentUser,
264
+ Pt as useDeeplink,
265
+ bt as useErrorScreen,
266
+ Ft as useErrorToast,
267
+ Fo as useFollowedShops,
268
+ bo as useFollowedShopsActions,
269
+ Ho as useGenerateUserToken,
270
+ Ot as useImagePicker,
271
+ dt as useImageUpload,
272
+ yt as useKeyboardAvoidingView,
273
+ ht as useNavigateWithTransition,
274
+ Zt as useOnAppStateChange,
275
+ Yt as useOnMiniBlur,
276
+ Kt as useOnMiniClose,
277
+ zt as useOnMiniFocus,
278
+ Jt as useOnNavigateBack,
279
+ Oo as useOrders,
280
+ st as usePopularProducts,
281
+ Zo as useProduct,
282
+ Ko as useProductList,
283
+ zo as useProductListActions,
284
+ Yo as useProductLists,
285
+ et as useProductMedia,
286
+ tt as useProductReviews,
287
+ it as useProductSearch,
288
+ $o as useProductVariants,
289
+ Jo as useProducts,
290
+ ho as useRecentProducts,
291
+ Ro as useRecentShops,
292
+ mt as useRecommendedProducts,
293
+ wt as useRecommendedShops,
294
+ Ht as useRequestPermissions,
295
+ wo as useSavedProducts,
296
+ Eo as useSavedProductsActions,
297
+ xt as useSecureStorage,
298
+ kt as useShare,
299
+ Rt as useShop,
300
+ gt as useShopNavigation
299
301
  };
300
302
  //# 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/dist/mocks.js CHANGED
@@ -10,17 +10,17 @@ const u = [
10
10
  for (let t = 0; t < o.length; t++)
11
11
  r = (r << 5) - r + o.charCodeAt(t), r |= 0;
12
12
  return Math.abs(r);
13
- }, e = (o, r, t = "99.99", d) => {
13
+ }, e = (o, r, t = "99.99", n) => {
14
14
  const s = P(o) % u.length, c = u[s];
15
15
  return {
16
16
  id: o,
17
17
  title: r,
18
18
  price: { amount: t, currencyCode: "USD" },
19
- ...d && {
20
- compareAtPrice: { amount: d, currencyCode: "USD" }
19
+ ...n && {
20
+ compareAtPrice: { amount: n, currencyCode: "USD" }
21
21
  },
22
22
  reviewAnalytics: { averageRating: 4.5, reviewCount: 10 },
23
- shop: n("shop1", "Mock Shop"),
23
+ shop: i("shop1", "Mock Shop"),
24
24
  defaultVariantId: `variant-${o}`,
25
25
  isFavorited: !1,
26
26
  featuredImage: {
@@ -37,13 +37,13 @@ const u = [
37
37
  merchantReply: null,
38
38
  merchantRepliedAt: null,
39
39
  ...r
40
- }), n = (o, r, t) => {
41
- const d = t?.themeType || "none", s = t?.withBrandSettings || d !== "none", c = t?.featuredImagesLimit || 3, p = Array.from({ length: c }, (C, m) => ({
40
+ }), i = (o, r, t) => {
41
+ const n = t?.themeType || "none", s = t?.withBrandSettings || n !== "none", c = t?.featuredImagesLimit || 3, p = Array.from({ length: c }, (C, m) => ({
42
42
  url: `https://picsum.photos/400/400?random=${o}-${m}`,
43
43
  sensitive: !1,
44
44
  altText: `${r} featured image ${m + 1}`
45
45
  })), g = () => {
46
- switch (d) {
46
+ switch (n) {
47
47
  case "coverImage":
48
48
  return {
49
49
  primary: t?.primaryColor,
@@ -74,7 +74,7 @@ const u = [
74
74
  };
75
75
  }
76
76
  }, h = () => {
77
- if (d === "coverImage" || t?.coverImageUrl)
77
+ if (n === "coverImage" || t?.coverImageUrl)
78
78
  return {
79
79
  id: `header-theme-${o}`,
80
80
  coverImage: {
@@ -83,7 +83,7 @@ const u = [
83
83
  sensitive: !1,
84
84
  thumbhash: "k9oGHQRnh493V4dIeHeXh4h3iIeI"
85
85
  },
86
- wordmark: t?.wordmarkUrl || d === "coverImage" ? {
86
+ wordmark: t?.wordmarkUrl || n === "coverImage" ? {
87
87
  url: t?.wordmarkUrl || "https://merrypeople.com/cdn/shop/files/Transparent_Background_1.png?v=1696465429&width=1024",
88
88
  altText: `${r} wordmark`,
89
89
  sensitive: !1
@@ -126,10 +126,11 @@ const u = [
126
126
  }, a = (o = !1) => ({
127
127
  hasNextPage: o,
128
128
  endCursor: o ? "cursor123" : null
129
- }), i = (o, r, t = []) => ({
129
+ }), d = (o, r, t = []) => ({
130
130
  id: o,
131
131
  publicId: `public-${o}`,
132
132
  name: r,
133
+ privacyStatus: "PRIVATE",
133
134
  products: t
134
135
  });
135
136
  function f(o, r) {
@@ -221,20 +222,21 @@ function w() {
221
222
  reportContentImpression: void 0,
222
223
  getProductLists: {
223
224
  data: [
224
- i("list-1", "Wishlist"),
225
- i("list-2", "Favorites")
225
+ d("list-1", "Wishlist"),
226
+ d("list-2", "Favorites")
226
227
  ],
227
228
  pageInfo: a()
228
229
  },
229
230
  getProductList: {
230
- data: i("list-1", "Wishlist", [
231
+ data: d("list-1", "Wishlist", [
231
232
  e("prod-1", "Sample Product")
232
233
  ]),
233
234
  pageInfo: a()
234
235
  },
235
- addProductList: i("list-3", "New List"),
236
+ addProductList: d("list-3", "New List"),
236
237
  removeProductList: void 0,
237
- renameProductList: i("list-1", "Updated Wishlist"),
238
+ renameProductList: d("list-1", "Updated Wishlist"),
239
+ setProductListVisibility: d("list-1", "Wishlist"),
238
240
  addProductListItem: void 0,
239
241
  removeProductListItem: void 0,
240
242
  getRecommendedProducts: {
@@ -253,11 +255,11 @@ function w() {
253
255
  },
254
256
  getRecommendedShops: {
255
257
  data: [
256
- n("shop-1", "Amazing Store"),
257
- n("shop-2", "Best Deals Shop"),
258
- n("shop-3", "Great Products"),
259
- n("shop-4", "Top Brands"),
260
- n("shop-5", "Exclusive Offers")
258
+ i("shop-1", "Amazing Store"),
259
+ i("shop-2", "Best Deals Shop"),
260
+ i("shop-3", "Great Products"),
261
+ i("shop-4", "Top Brands"),
262
+ i("shop-5", "Exclusive Offers")
261
263
  ],
262
264
  pageInfo: a()
263
265
  },
@@ -284,7 +286,7 @@ function w() {
284
286
  product: null
285
287
  }
286
288
  ],
287
- shop: n("shop-1", "Sample Shop")
289
+ shop: i("shop-1", "Sample Shop")
288
290
  }
289
291
  ],
290
292
  pageInfo: a()
@@ -400,21 +402,21 @@ function w() {
400
402
  pageInfo: a()
401
403
  },
402
404
  getShop: {
403
- data: n("shop-1", "Sample Shop", { featuredImagesLimit: 4 })
405
+ data: i("shop-1", "Sample Shop", { featuredImagesLimit: 4 })
404
406
  },
405
407
  getRecentShops: {
406
408
  data: [
407
- n("recent-shop-1", "Recent Shop 1"),
408
- n("recent-shop-2", "Recent Shop 2"),
409
- n("recent-shop-3", "Recent Shop 3")
409
+ i("recent-shop-1", "Recent Shop 1"),
410
+ i("recent-shop-2", "Recent Shop 2"),
411
+ i("recent-shop-3", "Recent Shop 3")
410
412
  ],
411
413
  pageInfo: a()
412
414
  },
413
415
  getFollowedShops: {
414
416
  data: [
415
- n("followed-shop-1", "Followed Shop 1"),
416
- n("followed-shop-2", "Followed Shop 2"),
417
- n("followed-shop-3", "Followed Shop 3")
417
+ i("followed-shop-1", "Followed Shop 1"),
418
+ i("followed-shop-2", "Followed Shop 2"),
419
+ i("followed-shop-3", "Followed Shop 3")
418
420
  ],
419
421
  pageInfo: a()
420
422
  },
@@ -486,7 +488,7 @@ const y = () => {
486
488
  export {
487
489
  e as createProduct,
488
490
  l as createProductReview,
489
- n as createShop,
491
+ i as createShop,
490
492
  A as injectMocks,
491
493
  w as makeMockActions
492
494
  };
package/dist/mocks.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mocks.js","sources":["../src/mocks.ts"],"sourcesContent":["import {\n Product,\n ProductReview,\n Gender,\n UserState,\n MinisContentStatus,\n} from '@shopify/shop-minis-platform'\nimport {ShopActions} from '@shopify/shop-minis-platform/actions'\n\nconst SAMPLE_IMAGE_NAMES = [\n 'garnished.jpeg',\n 'bath.jpeg',\n 'teapot.jpg',\n 'shoes.jpeg',\n]\n\n// Simple hash function to get a deterministic index from a string\nconst hashString = (str: string): number => {\n let hash = 0\n for (let i = 0; i < str.length; i++) {\n hash = (hash << 5) - hash + str.charCodeAt(i)\n hash |= 0\n }\n return Math.abs(hash)\n}\n\n// Helper functions for common data structures\nexport const createProduct = (\n id: string,\n title: string,\n price = '99.99',\n compareAtPrice?: string\n): Product => {\n const imageIndex = hashString(id) % SAMPLE_IMAGE_NAMES.length\n const imageName = SAMPLE_IMAGE_NAMES[imageIndex]\n\n return {\n id,\n title,\n price: {amount: price, currencyCode: 'USD'},\n ...(compareAtPrice && {\n compareAtPrice: {amount: compareAtPrice, currencyCode: 'USD'},\n }),\n reviewAnalytics: {averageRating: 4.5, reviewCount: 10},\n shop: createShop('shop1', 'Mock Shop'),\n defaultVariantId: `variant-${id}`,\n isFavorited: false,\n featuredImage: {\n url: `https://cdn.shopify.com/static/sample-images/${imageName}`,\n altText: title,\n },\n }\n}\n\nexport const createProductReview = (\n id: string,\n overrides: Partial<ProductReview> = {}\n): ProductReview => {\n return {\n id,\n rating: 5,\n title: 'Great product',\n body: 'Loved it. Would buy again.',\n submittedAt: new Date().toISOString(),\n merchantReply: null,\n merchantRepliedAt: null,\n ...overrides,\n }\n}\n\nexport const createShop = (\n id: string,\n name: string,\n options?: {\n themeType?: 'coverImage' | 'brandColor' | 'logoColor' | 'none'\n withBrandSettings?: boolean\n primaryColor?: string\n logoDominantColor?: string\n logoAverageColor?: string\n coverDominantColor?: string\n wordmarkUrl?: string\n coverImageUrl?: string\n featuredImagesLimit?: number\n }\n) => {\n // Determine theme configuration\n const themeType = options?.themeType || 'none'\n const shouldHaveBrandSettings =\n options?.withBrandSettings || themeType !== 'none'\n\n // Generate featured images\n const featuredImagesCount = options?.featuredImagesLimit || 3\n const featuredImages = Array.from({length: featuredImagesCount}, (_, i) => ({\n url: `https://picsum.photos/400/400?random=${id}-${i}`,\n sensitive: false,\n altText: `${name} featured image ${i + 1}`,\n }))\n\n // Configure colors based on theme type\n const getThemeColors = () => {\n switch (themeType) {\n case 'coverImage':\n return {\n primary: options?.primaryColor,\n logoDominant: options?.logoDominantColor,\n logoAverage: options?.logoAverageColor,\n coverDominant: options?.coverDominantColor || '#FF6B35',\n }\n case 'brandColor':\n return {\n primary: options?.primaryColor || '#27AE60',\n logoDominant: options?.logoDominantColor,\n logoAverage: options?.logoAverageColor,\n coverDominant: options?.coverDominantColor,\n }\n case 'logoColor':\n return {\n primary: options?.primaryColor,\n logoDominant: options?.logoDominantColor || '#E74C3C',\n logoAverage: options?.logoAverageColor,\n coverDominant: options?.coverDominantColor,\n }\n default:\n return {\n primary: options?.primaryColor,\n logoDominant: options?.logoDominantColor,\n logoAverage: options?.logoAverageColor,\n coverDominant: options?.coverDominantColor,\n }\n }\n }\n\n // Configure header theme\n const createHeaderTheme = () => {\n if (themeType === 'coverImage' || options?.coverImageUrl) {\n return {\n id: `header-theme-${id}`,\n coverImage: {\n url:\n options?.coverImageUrl ||\n 'https://images.unsplash.com/photo-1441986300917-64674bd600d8?w=800&h=400&fit=crop',\n altText: `${name} cover image`,\n sensitive: false,\n thumbhash: 'k9oGHQRnh493V4dIeHeXh4h3iIeI',\n },\n wordmark:\n options?.wordmarkUrl || themeType === 'coverImage'\n ? {\n url:\n options?.wordmarkUrl ||\n 'https://merrypeople.com/cdn/shop/files/Transparent_Background_1.png?v=1696465429&width=1024',\n altText: `${name} wordmark`,\n sensitive: false,\n }\n : undefined,\n }\n }\n\n if (options?.wordmarkUrl) {\n return {\n id: `header-theme-${id}`,\n wordmark: {\n url: options.wordmarkUrl,\n altText: `${name} wordmark`,\n sensitive: false,\n },\n }\n }\n\n return undefined\n }\n\n return {\n id,\n name,\n primaryDomain: {\n url: `https://${name.toLowerCase().replace(/\\s+/g, '-')}.com`,\n },\n reviewAnalytics: {averageRating: 4.3, reviewCount: 50},\n visualTheme: {\n id: `visual-theme-${id}`,\n featuredImages,\n logoImage: {\n url: `https://picsum.photos/100/100?random=${id}`,\n sensitive: false,\n },\n brandSettings: shouldHaveBrandSettings\n ? {\n id: `brand-settings-${id}`,\n colors: {\n id: `colors-${id}`,\n ...getThemeColors(),\n },\n headerTheme: createHeaderTheme(),\n }\n : undefined,\n },\n }\n}\n\nconst createPagination = (hasNext = false) => ({\n hasNextPage: hasNext,\n endCursor: hasNext ? 'cursor123' : null,\n})\n\nconst createProductList = (id: string, name: string, products: any[] = []) => ({\n id,\n publicId: `public-${id}`,\n name,\n products,\n})\n\n// Helper type to extract the data type from a ShopAction\ntype ShopActionDataType<T> = T extends (\n ...args: any[]\n) => Promise<{ok: true; data: infer R} | {ok: false; error: any}>\n ? R\n : never\n\n// Use window._mockLogs instead of console.log so logs aren't stripped in production builds\n// This allows e2e tests to verify mock actions are being called\nexport interface MockLog {\n action: string\n params?: unknown\n}\n\ndeclare global {\n interface Window {\n _mockLogs?: MockLog[]\n }\n}\n\nfunction logMockAction(action: string, params?: unknown) {\n window._mockLogs = window._mockLogs || []\n window._mockLogs.push({action, params})\n}\n\nfunction makeMockMethod<K extends keyof ShopActions>(\n key: K,\n result: ShopActionDataType<ShopActions[K]>\n): ShopActions[K] {\n return ((params: Parameters<ShopActions[K]>[0]) => {\n logMockAction(String(key), params)\n return Promise.resolve({\n ok: true as const,\n data: result,\n mocked: true,\n })\n }) as ShopActions[K]\n}\n\nexport function makeMockActions(): ShopActions {\n const results: {\n [K in keyof ShopActions]: ShopActionDataType<ShopActions[K]>\n } = {\n translateContentUp: undefined,\n translateContentDown: undefined,\n followShop: true,\n unfollowShop: false,\n favorite: undefined,\n unfavorite: undefined,\n getShopAppInformation: {\n appVersion: '1.0.0',\n buildNumber: '12345',\n buildId: 'dev-build-123',\n },\n productRecommendationImpression: undefined,\n productRecommendationClick: undefined,\n closeMini: undefined,\n getAccountInformation: {\n status: 'available',\n value: 'user@example.com',\n },\n getCurrentUser: {\n data: {\n displayName: 'John Doe',\n avatarImage: {url: 'https://example.com/avatar.jpg'},\n },\n },\n createOrderAttribution: undefined,\n addToCart: undefined,\n buyProduct: undefined,\n buyProducts: undefined,\n showErrorScreen: undefined,\n showErrorToast: undefined,\n getDeeplinkPaths: {\n matchers: ['/products', '/collections', '/cart'],\n },\n navigateToDeeplink: undefined,\n navigateToShop: undefined,\n navigateToProduct: undefined,\n navigateToOrder: undefined,\n navigateToCheckout: undefined,\n createImageUploadLink: {\n // This action is mocked in the actual hook. See `useImageUpload` for more details.\n targets: [\n {\n url: 'https://example.com/upload',\n resourceUrl: 'https://example.com/resource',\n parameters: [{name: 'key', value: 'upload-123'}],\n },\n ],\n },\n completeImageUpload: {\n files: [\n {\n id: 'file-123',\n fileStatus: 'READY',\n image: {\n url: 'https://example.com/image.jpg',\n },\n },\n ],\n },\n getPersistedItem: null,\n setPersistedItem: undefined,\n removePersistedItem: undefined,\n getAllPersistedKeys: ['key1', 'key2', 'key3'],\n clearPersistedItems: undefined,\n getInternalPersistedItem: null,\n setInternalPersistedItem: undefined,\n removeInternalPersistedItem: undefined,\n getAllInternalPersistedKeys: ['internal-key1', 'internal-key2'],\n clearInternalPersistedItems: undefined,\n getSecret: 'secret-value',\n setSecret: undefined,\n removeSecret: undefined,\n reportInteraction: undefined,\n reportImpression: undefined,\n reportContentImpression: undefined,\n getProductLists: {\n data: [\n createProductList('list-1', 'Wishlist'),\n createProductList('list-2', 'Favorites'),\n ],\n pageInfo: createPagination(),\n },\n getProductList: {\n data: createProductList('list-1', 'Wishlist', [\n createProduct('prod-1', 'Sample Product'),\n ]),\n pageInfo: createPagination(),\n },\n addProductList: createProductList('list-3', 'New List'),\n removeProductList: undefined,\n renameProductList: createProductList('list-1', 'Updated Wishlist'),\n addProductListItem: undefined,\n removeProductListItem: undefined,\n getRecommendedProducts: {\n data: [\n createProduct('rec-1', 'Recommended Product 1', '79.99'),\n createProduct('rec-2', 'Recommended Product 2', '129.99'),\n createProduct('rec-3', 'Recommended Product 3', '129.99'),\n createProduct('rec-4', 'Recommended Product 4', '29.99'),\n createProduct('rec-5', 'Recommended Product 5', '39.99'),\n createProduct('rec-6', 'Recommended Product 6', '49.99'),\n createProduct('rec-7', 'Recommended Product 7', '59.99'),\n createProduct('rec-8', 'Recommended Product 8', '69.99'),\n createProduct('rec-9', 'Recommended Product 9', '129.99'),\n ],\n pageInfo: createPagination(),\n },\n getRecommendedShops: {\n data: [\n createShop('shop-1', 'Amazing Store'),\n createShop('shop-2', 'Best Deals Shop'),\n createShop('shop-3', 'Great Products'),\n createShop('shop-4', 'Top Brands'),\n createShop('shop-5', 'Exclusive Offers'),\n ],\n pageInfo: createPagination(),\n },\n searchProductsByShop: {\n data: [\n createProduct('search-1', 'Search Result 1', '59.99'),\n createProduct('search-2', 'Search Result 2', '89.99'),\n createProduct('search-3', 'Search Result 3', '119.99'),\n createProduct('search-4', 'Search Result 4', '149.99'),\n createProduct('search-5', 'Search Result 5', '179.99'),\n ],\n pageInfo: createPagination(),\n },\n getOrders: {\n data: [\n {\n id: 'order-1',\n name: '#1001',\n lineItems: [\n {\n productTitle: 'Sample Product',\n variantTitle: 'Medium',\n quantity: 2,\n product: null,\n },\n ],\n shop: createShop('shop-1', 'Sample Shop'),\n },\n ],\n pageInfo: createPagination(),\n },\n getBuyerAttributes: {\n data: {\n genderAffinity: 'NEUTRAL' as Gender,\n categoryAffinities: [\n {id: 'cat1', name: 'Electronics'},\n {id: 'cat2', name: 'Clothing'},\n ],\n },\n },\n showFeedbackSheet: undefined,\n getPopularProducts: {\n data: [\n createProduct('pop-1', 'The Hero Snowboard', '702.95'),\n createProduct('pop-2', 'Snow Jacket', '605.95', '702.00'),\n createProduct('pop-3', 'Winter Gloves', '89.95'),\n createProduct('pop-4', 'Summer Gloves', '89.95'),\n createProduct('pop-5', 'Spring Gloves', '89.95'),\n createProduct('pop-6', 'Playstation 5', '499.95'),\n createProduct('pop-7', 'Xbox Series X', '499.95'),\n createProduct('pop-8', 'Nintendo Switch', '299.95'),\n createProduct('pop-9', 'Playstation 4', '299.95'),\n createProduct('pop-10', 'Nintendo 3DS', '89.95'),\n ],\n pageInfo: createPagination(),\n },\n share: {\n message: 'Shared!',\n success: true,\n },\n shareSingle: {\n message: 'Shared!',\n success: true,\n },\n getSavedProducts: {\n data: [\n createProduct('saved-1', 'Saved Product 1', '49.99'),\n createProduct('saved-2', 'Saved Product 2', '59.99'),\n createProduct('saved-3', 'Saved Product 3', '69.99'),\n createProduct('saved-4', 'Saved Product 4', '79.99'),\n createProduct('saved-5', 'Saved Product 5', '89.99'),\n ],\n pageInfo: createPagination(),\n },\n getRecentProducts: {\n data: [\n createProduct('recent-1', 'Recent Product 1', '59.99'),\n createProduct('recent-2', 'Recent Product 2', '69.99'),\n createProduct('recent-3', 'Recent Product 3', '79.99'),\n createProduct('recent-4', 'Recent Product 4', '89.99'),\n createProduct('recent-5', 'Recent Product 5', '99.99'),\n ],\n pageInfo: createPagination(),\n },\n getProductSearch: {\n data: [\n createProduct('search-1', 'Search Product 1', '39.99'),\n createProduct('search-2', 'Search Product 2', '19.99'),\n createProduct('search-3', 'Search Product 3', '29.99'),\n createProduct('search-4', 'Search Product 4', '49.99'),\n createProduct('search-5', 'Search Product 5', '9.99'),\n ],\n pageInfo: createPagination(),\n },\n getProducts: {\n data: [\n createProduct('prod-1', 'Product 1', '9.99'),\n createProduct('prod-2', 'Product 2', '19.99'),\n createProduct('prod-3', 'Product 3', '29.99'),\n createProduct('prod-4', 'Product 4', '39.99'),\n createProduct('prod-5', 'Product 5', '49.99'),\n ],\n },\n getProduct: {data: createProduct('prod-1', 'Sample Product')},\n getProductVariants: {\n data: [\n {\n id: 'variant-1',\n title: 'Variant 1',\n isFavorited: false,\n image: {url: 'https://example.com/variant-1.jpg'},\n price: {amount: '19.99', currencyCode: 'USD'},\n compareAtPrice: {amount: '29.99', currencyCode: 'USD'},\n },\n ],\n pageInfo: createPagination(),\n },\n getProductMedia: {\n data: [\n {\n id: 'media-1',\n image: {url: 'https://example.com/media-1.jpg'},\n mediaContentType: 'IMAGE',\n alt: 'Sample product image',\n },\n ],\n pageInfo: createPagination(),\n },\n getProductReviews: {\n data: [\n createProductReview('review-1'),\n createProductReview('review-2', {rating: 4, title: 'Pretty good'}),\n createProductReview('review-3', {\n rating: 3,\n title: 'Okay',\n merchantReply: 'Thanks for the feedback!',\n merchantRepliedAt: new Date().toISOString(),\n }),\n ],\n pageInfo: createPagination(),\n },\n getShop: {\n data: createShop('shop-1', 'Sample Shop', {featuredImagesLimit: 4}),\n },\n getRecentShops: {\n data: [\n createShop('recent-shop-1', 'Recent Shop 1'),\n createShop('recent-shop-2', 'Recent Shop 2'),\n createShop('recent-shop-3', 'Recent Shop 3'),\n ],\n pageInfo: createPagination(),\n },\n getFollowedShops: {\n data: [\n createShop('followed-shop-1', 'Followed Shop 1'),\n createShop('followed-shop-2', 'Followed Shop 2'),\n createShop('followed-shop-3', 'Followed Shop 3'),\n ],\n pageInfo: createPagination(),\n },\n previewProductInAr: undefined,\n createContent: {\n data: {\n publicId: 'content-123',\n externalId: null,\n image: {\n id: 'img-123',\n url: 'https://cdn.shopify.com/s/files/1/0633/6574/2742/files/Namnlosdesign-47.png?v=1740438079',\n width: 800,\n height: 600,\n },\n title: 'Mock Content',\n description: 'This is a mock content item',\n visibility: ['DISCOVERABLE'],\n shareableUrl: 'https://example.com/content/123',\n products: null,\n },\n },\n getContent: {\n data: [\n {\n publicId: 'content-123',\n image: {\n id: 'img-123',\n url: 'https://cdn.shopify.com/s/files/1/0633/6574/2742/files/Namnlosdesign-47.png?v=1740438079',\n width: 800,\n height: 600,\n },\n title: 'Mock Content',\n visibility: ['DISCOVERABLE'],\n status: MinisContentStatus.READY,\n },\n ],\n },\n generateUserToken: {\n data: {\n token: 'user-token-123',\n expiresAt: '2025-01-01',\n userState: UserState.VERIFIED,\n },\n },\n navigateToCart: undefined,\n requestPermission: {\n granted: true,\n },\n reportError: undefined,\n reportFetch: undefined,\n } as const\n\n const mock: Partial<ShopActions> = {}\n for (const key in results) {\n if (Object.prototype.hasOwnProperty.call(results, key)) {\n // @ts-expect-error: dynamic assignment is safe due to exhaustive mapping\n mock[key] = makeMockMethod(\n key as keyof ShopActions,\n results[key as keyof typeof results]\n )\n }\n }\n return mock as ShopActions\n}\n\n// Detect if running on a mobile device\nconst isMobile = (): boolean => {\n const userAgent = navigator.userAgent.toLowerCase()\n const isIOS = /iphone|ipad|ipod/.test(userAgent)\n const isAndroid = /android/.test(userAgent)\n\n return isIOS || isAndroid\n}\n\nexport const injectMocks = ({force}: {force?: boolean} = {}) => {\n // Only inject mocks if we aren't on a mobile device or we force it\n if (isMobile() && !force) {\n return\n }\n\n if (!window.minisSDK) {\n window.minisSDK = makeMockActions()\n window.minisParams = {\n handle: 'mock-handle',\n initialUrl: '/',\n platform: 'web',\n }\n }\n}\n"],"names":["SAMPLE_IMAGE_NAMES","hashString","str","hash","i","createProduct","id","title","price","compareAtPrice","imageIndex","imageName","createShop","createProductReview","overrides","name","options","themeType","shouldHaveBrandSettings","featuredImagesCount","featuredImages","_","getThemeColors","createHeaderTheme","createPagination","hasNext","createProductList","products","logMockAction","action","params","makeMockMethod","key","result","makeMockActions","results","MinisContentStatus","UserState","mock","isMobile","userAgent","isIOS","isAndroid","injectMocks","force"],"mappings":";;AASA,MAAMA,IAAqB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAGMC,IAAa,CAACC,MAAwB;AAC1C,MAAIC,IAAO;AACX,WAASC,IAAI,GAAGA,IAAIF,EAAI,QAAQE;AAC9B,IAAAD,KAAQA,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;AACT;AAGA,MAAMC,IAAW,MAAe;AACxB,QAAAC,IAAY,UAAU,UAAU,YAAY,GAC5CC,IAAQ,mBAAmB,KAAKD,CAAS,GACzCE,IAAY,UAAU,KAAKF,CAAS;AAE1C,SAAOC,KAASC;AAClB,GAEaC,IAAc,CAAC,EAAC,OAAAC,EAAK,IAAuB,OAAO;AAE1D,EAAAL,EAAA,KAAc,CAACK,KAId,OAAO,aACV,OAAO,WAAWV,EAAgB,GAClC,OAAO,cAAc;AAAA,IACnB,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ;AAEJ;"}
1
+ {"version":3,"file":"mocks.js","sources":["../src/mocks.ts"],"sourcesContent":["import {\n Product,\n ProductReview,\n Gender,\n UserState,\n MinisContentStatus,\n} from '@shopify/shop-minis-platform'\nimport {ShopActions} from '@shopify/shop-minis-platform/actions'\n\nconst SAMPLE_IMAGE_NAMES = [\n 'garnished.jpeg',\n 'bath.jpeg',\n 'teapot.jpg',\n 'shoes.jpeg',\n]\n\n// Simple hash function to get a deterministic index from a string\nconst hashString = (str: string): number => {\n let hash = 0\n for (let i = 0; i < str.length; i++) {\n hash = (hash << 5) - hash + str.charCodeAt(i)\n hash |= 0\n }\n return Math.abs(hash)\n}\n\n// Helper functions for common data structures\nexport const createProduct = (\n id: string,\n title: string,\n price = '99.99',\n compareAtPrice?: string\n): Product => {\n const imageIndex = hashString(id) % SAMPLE_IMAGE_NAMES.length\n const imageName = SAMPLE_IMAGE_NAMES[imageIndex]\n\n return {\n id,\n title,\n price: {amount: price, currencyCode: 'USD'},\n ...(compareAtPrice && {\n compareAtPrice: {amount: compareAtPrice, currencyCode: 'USD'},\n }),\n reviewAnalytics: {averageRating: 4.5, reviewCount: 10},\n shop: createShop('shop1', 'Mock Shop'),\n defaultVariantId: `variant-${id}`,\n isFavorited: false,\n featuredImage: {\n url: `https://cdn.shopify.com/static/sample-images/${imageName}`,\n altText: title,\n },\n }\n}\n\nexport const createProductReview = (\n id: string,\n overrides: Partial<ProductReview> = {}\n): ProductReview => {\n return {\n id,\n rating: 5,\n title: 'Great product',\n body: 'Loved it. Would buy again.',\n submittedAt: new Date().toISOString(),\n merchantReply: null,\n merchantRepliedAt: null,\n ...overrides,\n }\n}\n\nexport const createShop = (\n id: string,\n name: string,\n options?: {\n themeType?: 'coverImage' | 'brandColor' | 'logoColor' | 'none'\n withBrandSettings?: boolean\n primaryColor?: string\n logoDominantColor?: string\n logoAverageColor?: string\n coverDominantColor?: string\n wordmarkUrl?: string\n coverImageUrl?: string\n featuredImagesLimit?: number\n }\n) => {\n // Determine theme configuration\n const themeType = options?.themeType || 'none'\n const shouldHaveBrandSettings =\n options?.withBrandSettings || themeType !== 'none'\n\n // Generate featured images\n const featuredImagesCount = options?.featuredImagesLimit || 3\n const featuredImages = Array.from({length: featuredImagesCount}, (_, i) => ({\n url: `https://picsum.photos/400/400?random=${id}-${i}`,\n sensitive: false,\n altText: `${name} featured image ${i + 1}`,\n }))\n\n // Configure colors based on theme type\n const getThemeColors = () => {\n switch (themeType) {\n case 'coverImage':\n return {\n primary: options?.primaryColor,\n logoDominant: options?.logoDominantColor,\n logoAverage: options?.logoAverageColor,\n coverDominant: options?.coverDominantColor || '#FF6B35',\n }\n case 'brandColor':\n return {\n primary: options?.primaryColor || '#27AE60',\n logoDominant: options?.logoDominantColor,\n logoAverage: options?.logoAverageColor,\n coverDominant: options?.coverDominantColor,\n }\n case 'logoColor':\n return {\n primary: options?.primaryColor,\n logoDominant: options?.logoDominantColor || '#E74C3C',\n logoAverage: options?.logoAverageColor,\n coverDominant: options?.coverDominantColor,\n }\n default:\n return {\n primary: options?.primaryColor,\n logoDominant: options?.logoDominantColor,\n logoAverage: options?.logoAverageColor,\n coverDominant: options?.coverDominantColor,\n }\n }\n }\n\n // Configure header theme\n const createHeaderTheme = () => {\n if (themeType === 'coverImage' || options?.coverImageUrl) {\n return {\n id: `header-theme-${id}`,\n coverImage: {\n url:\n options?.coverImageUrl ||\n 'https://images.unsplash.com/photo-1441986300917-64674bd600d8?w=800&h=400&fit=crop',\n altText: `${name} cover image`,\n sensitive: false,\n thumbhash: 'k9oGHQRnh493V4dIeHeXh4h3iIeI',\n },\n wordmark:\n options?.wordmarkUrl || themeType === 'coverImage'\n ? {\n url:\n options?.wordmarkUrl ||\n 'https://merrypeople.com/cdn/shop/files/Transparent_Background_1.png?v=1696465429&width=1024',\n altText: `${name} wordmark`,\n sensitive: false,\n }\n : undefined,\n }\n }\n\n if (options?.wordmarkUrl) {\n return {\n id: `header-theme-${id}`,\n wordmark: {\n url: options.wordmarkUrl,\n altText: `${name} wordmark`,\n sensitive: false,\n },\n }\n }\n\n return undefined\n }\n\n return {\n id,\n name,\n primaryDomain: {\n url: `https://${name.toLowerCase().replace(/\\s+/g, '-')}.com`,\n },\n reviewAnalytics: {averageRating: 4.3, reviewCount: 50},\n visualTheme: {\n id: `visual-theme-${id}`,\n featuredImages,\n logoImage: {\n url: `https://picsum.photos/100/100?random=${id}`,\n sensitive: false,\n },\n brandSettings: shouldHaveBrandSettings\n ? {\n id: `brand-settings-${id}`,\n colors: {\n id: `colors-${id}`,\n ...getThemeColors(),\n },\n headerTheme: createHeaderTheme(),\n }\n : undefined,\n },\n }\n}\n\nconst createPagination = (hasNext = false) => ({\n hasNextPage: hasNext,\n endCursor: hasNext ? 'cursor123' : null,\n})\n\nconst createProductList = (id: string, name: string, products: any[] = []) => ({\n id,\n publicId: `public-${id}`,\n name,\n privacyStatus: 'PRIVATE' as const,\n products,\n})\n\n// Helper type to extract the data type from a ShopAction\ntype ShopActionDataType<T> = T extends (\n ...args: any[]\n) => Promise<{ok: true; data: infer R} | {ok: false; error: any}>\n ? R\n : never\n\n// Use window._mockLogs instead of console.log so logs aren't stripped in production builds\n// This allows e2e tests to verify mock actions are being called\nexport interface MockLog {\n action: string\n params?: unknown\n}\n\ndeclare global {\n interface Window {\n _mockLogs?: MockLog[]\n }\n}\n\nfunction logMockAction(action: string, params?: unknown) {\n window._mockLogs = window._mockLogs || []\n window._mockLogs.push({action, params})\n}\n\nfunction makeMockMethod<K extends keyof ShopActions>(\n key: K,\n result: ShopActionDataType<ShopActions[K]>\n): ShopActions[K] {\n return ((params: Parameters<ShopActions[K]>[0]) => {\n logMockAction(String(key), params)\n return Promise.resolve({\n ok: true as const,\n data: result,\n mocked: true,\n })\n }) as ShopActions[K]\n}\n\nexport function makeMockActions(): ShopActions {\n const results: {\n [K in keyof ShopActions]: ShopActionDataType<ShopActions[K]>\n } = {\n translateContentUp: undefined,\n translateContentDown: undefined,\n followShop: true,\n unfollowShop: false,\n favorite: undefined,\n unfavorite: undefined,\n getShopAppInformation: {\n appVersion: '1.0.0',\n buildNumber: '12345',\n buildId: 'dev-build-123',\n },\n productRecommendationImpression: undefined,\n productRecommendationClick: undefined,\n closeMini: undefined,\n getAccountInformation: {\n status: 'available',\n value: 'user@example.com',\n },\n getCurrentUser: {\n data: {\n displayName: 'John Doe',\n avatarImage: {url: 'https://example.com/avatar.jpg'},\n },\n },\n createOrderAttribution: undefined,\n addToCart: undefined,\n buyProduct: undefined,\n buyProducts: undefined,\n showErrorScreen: undefined,\n showErrorToast: undefined,\n getDeeplinkPaths: {\n matchers: ['/products', '/collections', '/cart'],\n },\n navigateToDeeplink: undefined,\n navigateToShop: undefined,\n navigateToProduct: undefined,\n navigateToOrder: undefined,\n navigateToCheckout: undefined,\n createImageUploadLink: {\n // This action is mocked in the actual hook. See `useImageUpload` for more details.\n targets: [\n {\n url: 'https://example.com/upload',\n resourceUrl: 'https://example.com/resource',\n parameters: [{name: 'key', value: 'upload-123'}],\n },\n ],\n },\n completeImageUpload: {\n files: [\n {\n id: 'file-123',\n fileStatus: 'READY',\n image: {\n url: 'https://example.com/image.jpg',\n },\n },\n ],\n },\n getPersistedItem: null,\n setPersistedItem: undefined,\n removePersistedItem: undefined,\n getAllPersistedKeys: ['key1', 'key2', 'key3'],\n clearPersistedItems: undefined,\n getInternalPersistedItem: null,\n setInternalPersistedItem: undefined,\n removeInternalPersistedItem: undefined,\n getAllInternalPersistedKeys: ['internal-key1', 'internal-key2'],\n clearInternalPersistedItems: undefined,\n getSecret: 'secret-value',\n setSecret: undefined,\n removeSecret: undefined,\n reportInteraction: undefined,\n reportImpression: undefined,\n reportContentImpression: undefined,\n getProductLists: {\n data: [\n createProductList('list-1', 'Wishlist'),\n createProductList('list-2', 'Favorites'),\n ],\n pageInfo: createPagination(),\n },\n getProductList: {\n data: createProductList('list-1', 'Wishlist', [\n createProduct('prod-1', 'Sample Product'),\n ]),\n pageInfo: createPagination(),\n },\n addProductList: createProductList('list-3', 'New List'),\n removeProductList: undefined,\n renameProductList: createProductList('list-1', 'Updated Wishlist'),\n setProductListVisibility: createProductList('list-1', 'Wishlist'),\n addProductListItem: undefined,\n removeProductListItem: undefined,\n getRecommendedProducts: {\n data: [\n createProduct('rec-1', 'Recommended Product 1', '79.99'),\n createProduct('rec-2', 'Recommended Product 2', '129.99'),\n createProduct('rec-3', 'Recommended Product 3', '129.99'),\n createProduct('rec-4', 'Recommended Product 4', '29.99'),\n createProduct('rec-5', 'Recommended Product 5', '39.99'),\n createProduct('rec-6', 'Recommended Product 6', '49.99'),\n createProduct('rec-7', 'Recommended Product 7', '59.99'),\n createProduct('rec-8', 'Recommended Product 8', '69.99'),\n createProduct('rec-9', 'Recommended Product 9', '129.99'),\n ],\n pageInfo: createPagination(),\n },\n getRecommendedShops: {\n data: [\n createShop('shop-1', 'Amazing Store'),\n createShop('shop-2', 'Best Deals Shop'),\n createShop('shop-3', 'Great Products'),\n createShop('shop-4', 'Top Brands'),\n createShop('shop-5', 'Exclusive Offers'),\n ],\n pageInfo: createPagination(),\n },\n searchProductsByShop: {\n data: [\n createProduct('search-1', 'Search Result 1', '59.99'),\n createProduct('search-2', 'Search Result 2', '89.99'),\n createProduct('search-3', 'Search Result 3', '119.99'),\n createProduct('search-4', 'Search Result 4', '149.99'),\n createProduct('search-5', 'Search Result 5', '179.99'),\n ],\n pageInfo: createPagination(),\n },\n getOrders: {\n data: [\n {\n id: 'order-1',\n name: '#1001',\n lineItems: [\n {\n productTitle: 'Sample Product',\n variantTitle: 'Medium',\n quantity: 2,\n product: null,\n },\n ],\n shop: createShop('shop-1', 'Sample Shop'),\n },\n ],\n pageInfo: createPagination(),\n },\n getBuyerAttributes: {\n data: {\n genderAffinity: 'NEUTRAL' as Gender,\n categoryAffinities: [\n {id: 'cat1', name: 'Electronics'},\n {id: 'cat2', name: 'Clothing'},\n ],\n },\n },\n showFeedbackSheet: undefined,\n getPopularProducts: {\n data: [\n createProduct('pop-1', 'The Hero Snowboard', '702.95'),\n createProduct('pop-2', 'Snow Jacket', '605.95', '702.00'),\n createProduct('pop-3', 'Winter Gloves', '89.95'),\n createProduct('pop-4', 'Summer Gloves', '89.95'),\n createProduct('pop-5', 'Spring Gloves', '89.95'),\n createProduct('pop-6', 'Playstation 5', '499.95'),\n createProduct('pop-7', 'Xbox Series X', '499.95'),\n createProduct('pop-8', 'Nintendo Switch', '299.95'),\n createProduct('pop-9', 'Playstation 4', '299.95'),\n createProduct('pop-10', 'Nintendo 3DS', '89.95'),\n ],\n pageInfo: createPagination(),\n },\n share: {\n message: 'Shared!',\n success: true,\n },\n shareSingle: {\n message: 'Shared!',\n success: true,\n },\n getSavedProducts: {\n data: [\n createProduct('saved-1', 'Saved Product 1', '49.99'),\n createProduct('saved-2', 'Saved Product 2', '59.99'),\n createProduct('saved-3', 'Saved Product 3', '69.99'),\n createProduct('saved-4', 'Saved Product 4', '79.99'),\n createProduct('saved-5', 'Saved Product 5', '89.99'),\n ],\n pageInfo: createPagination(),\n },\n getRecentProducts: {\n data: [\n createProduct('recent-1', 'Recent Product 1', '59.99'),\n createProduct('recent-2', 'Recent Product 2', '69.99'),\n createProduct('recent-3', 'Recent Product 3', '79.99'),\n createProduct('recent-4', 'Recent Product 4', '89.99'),\n createProduct('recent-5', 'Recent Product 5', '99.99'),\n ],\n pageInfo: createPagination(),\n },\n getProductSearch: {\n data: [\n createProduct('search-1', 'Search Product 1', '39.99'),\n createProduct('search-2', 'Search Product 2', '19.99'),\n createProduct('search-3', 'Search Product 3', '29.99'),\n createProduct('search-4', 'Search Product 4', '49.99'),\n createProduct('search-5', 'Search Product 5', '9.99'),\n ],\n pageInfo: createPagination(),\n },\n getProducts: {\n data: [\n createProduct('prod-1', 'Product 1', '9.99'),\n createProduct('prod-2', 'Product 2', '19.99'),\n createProduct('prod-3', 'Product 3', '29.99'),\n createProduct('prod-4', 'Product 4', '39.99'),\n createProduct('prod-5', 'Product 5', '49.99'),\n ],\n },\n getProduct: {data: createProduct('prod-1', 'Sample Product')},\n getProductVariants: {\n data: [\n {\n id: 'variant-1',\n title: 'Variant 1',\n isFavorited: false,\n image: {url: 'https://example.com/variant-1.jpg'},\n price: {amount: '19.99', currencyCode: 'USD'},\n compareAtPrice: {amount: '29.99', currencyCode: 'USD'},\n },\n ],\n pageInfo: createPagination(),\n },\n getProductMedia: {\n data: [\n {\n id: 'media-1',\n image: {url: 'https://example.com/media-1.jpg'},\n mediaContentType: 'IMAGE',\n alt: 'Sample product image',\n },\n ],\n pageInfo: createPagination(),\n },\n getProductReviews: {\n data: [\n createProductReview('review-1'),\n createProductReview('review-2', {rating: 4, title: 'Pretty good'}),\n createProductReview('review-3', {\n rating: 3,\n title: 'Okay',\n merchantReply: 'Thanks for the feedback!',\n merchantRepliedAt: new Date().toISOString(),\n }),\n ],\n pageInfo: createPagination(),\n },\n getShop: {\n data: createShop('shop-1', 'Sample Shop', {featuredImagesLimit: 4}),\n },\n getRecentShops: {\n data: [\n createShop('recent-shop-1', 'Recent Shop 1'),\n createShop('recent-shop-2', 'Recent Shop 2'),\n createShop('recent-shop-3', 'Recent Shop 3'),\n ],\n pageInfo: createPagination(),\n },\n getFollowedShops: {\n data: [\n createShop('followed-shop-1', 'Followed Shop 1'),\n createShop('followed-shop-2', 'Followed Shop 2'),\n createShop('followed-shop-3', 'Followed Shop 3'),\n ],\n pageInfo: createPagination(),\n },\n previewProductInAr: undefined,\n createContent: {\n data: {\n publicId: 'content-123',\n externalId: null,\n image: {\n id: 'img-123',\n url: 'https://cdn.shopify.com/s/files/1/0633/6574/2742/files/Namnlosdesign-47.png?v=1740438079',\n width: 800,\n height: 600,\n },\n title: 'Mock Content',\n description: 'This is a mock content item',\n visibility: ['DISCOVERABLE'],\n shareableUrl: 'https://example.com/content/123',\n products: null,\n },\n },\n getContent: {\n data: [\n {\n publicId: 'content-123',\n image: {\n id: 'img-123',\n url: 'https://cdn.shopify.com/s/files/1/0633/6574/2742/files/Namnlosdesign-47.png?v=1740438079',\n width: 800,\n height: 600,\n },\n title: 'Mock Content',\n visibility: ['DISCOVERABLE'],\n status: MinisContentStatus.READY,\n },\n ],\n },\n generateUserToken: {\n data: {\n token: 'user-token-123',\n expiresAt: '2025-01-01',\n userState: UserState.VERIFIED,\n },\n },\n navigateToCart: undefined,\n requestPermission: {\n granted: true,\n },\n reportError: undefined,\n reportFetch: undefined,\n } as const\n\n const mock: Partial<ShopActions> = {}\n for (const key in results) {\n if (Object.prototype.hasOwnProperty.call(results, key)) {\n // @ts-expect-error: dynamic assignment is safe due to exhaustive mapping\n mock[key] = makeMockMethod(\n key as keyof ShopActions,\n results[key as keyof typeof results]\n )\n }\n }\n return mock as ShopActions\n}\n\n// Detect if running on a mobile device\nconst isMobile = (): boolean => {\n const userAgent = navigator.userAgent.toLowerCase()\n const isIOS = /iphone|ipad|ipod/.test(userAgent)\n const isAndroid = /android/.test(userAgent)\n\n return isIOS || isAndroid\n}\n\nexport const injectMocks = ({force}: {force?: boolean} = {}) => {\n // Only inject mocks if we aren't on a mobile device or we force it\n if (isMobile() && !force) {\n return\n }\n\n if (!window.minisSDK) {\n window.minisSDK = makeMockActions()\n window.minisParams = {\n handle: 'mock-handle',\n initialUrl: '/',\n platform: 'web',\n }\n }\n}\n"],"names":["SAMPLE_IMAGE_NAMES","hashString","str","hash","i","createProduct","id","title","price","compareAtPrice","imageIndex","imageName","createShop","createProductReview","overrides","name","options","themeType","shouldHaveBrandSettings","featuredImagesCount","featuredImages","_","getThemeColors","createHeaderTheme","createPagination","hasNext","createProductList","products","logMockAction","action","params","makeMockMethod","key","result","makeMockActions","results","MinisContentStatus","UserState","mock","isMobile","userAgent","isIOS","isAndroid","injectMocks","force"],"mappings":";;AASA,MAAMA,IAAqB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAGMC,IAAa,CAACC,MAAwB;AAC1C,MAAIC,IAAO;AACX,WAASC,IAAI,GAAGA,IAAIF,EAAI,QAAQE;AAC9B,IAAAD,KAAQA,KAAQ,KAAKA,IAAOD,EAAI,WAAWE,CAAC,GACpCD,KAAA;AAEH,SAAA,KAAK,IAAIA,CAAI;AACtB,GAGaE,IAAgB,CAC3BC,GACAC,GACAC,IAAQ,SACRC,MACY;AACZ,QAAMC,IAAaT,EAAWK,CAAE,IAAIN,EAAmB,QACjDW,IAAYX,EAAmBU,CAAU;AAExC,SAAA;AAAA,IACL,IAAAJ;AAAA,IACA,OAAAC;AAAA,IACA,OAAO,EAAC,QAAQC,GAAO,cAAc,MAAK;AAAA,IAC1C,GAAIC,KAAkB;AAAA,MACpB,gBAAgB,EAAC,QAAQA,GAAgB,cAAc,MAAK;AAAA,IAC9D;AAAA,IACA,iBAAiB,EAAC,eAAe,KAAK,aAAa,GAAE;AAAA,IACrD,MAAMG,EAAW,SAAS,WAAW;AAAA,IACrC,kBAAkB,WAAWN,CAAE;AAAA,IAC/B,aAAa;AAAA,IACb,eAAe;AAAA,MACb,KAAK,gDAAgDK,CAAS;AAAA,MAC9D,SAASJ;AAAA,IAAA;AAAA,EAEb;AACF,GAEaM,IAAsB,CACjCP,GACAQ,IAAoC,QAE7B;AAAA,EACL,IAAAR;AAAA,EACA,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,MAAM;AAAA,EACN,cAAa,oBAAI,KAAK,GAAE,YAAY;AAAA,EACpC,eAAe;AAAA,EACf,mBAAmB;AAAA,EACnB,GAAGQ;AACL,IAGWF,IAAa,CACx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mBAAmB;AAAA,MACjB,MAAM;AAAA,QACJ,OAAO;AAAA,QACP,WAAW;AAAA,QACX,WAAWC,EAAU;AAAA,MAAA;AAAA,IAEzB;AAAA,IACA,gBAAgB;AAAA,IAChB,mBAAmB;AAAA,MACjB,SAAS;AAAA,IACX;AAAA,IACA,aAAa;AAAA,IACb,aAAa;AAAA,EACf,GAEMC,IAA6B,CAAC;AACpC,aAAWN,KAAOG;AAChB,IAAI,OAAO,UAAU,eAAe,KAAKA,GAASH,CAAG,MAEnDM,EAAKN,CAAG,IAAID;AAAA,MACVC;AAAA,MACAG,EAAQH,CAA2B;AAAA,IACrC;AAGG,SAAAM;AACT;AAGA,MAAMC,IAAW,MAAe;AACxB,QAAAC,IAAY,UAAU,UAAU,YAAY,GAC5CC,IAAQ,mBAAmB,KAAKD,CAAS,GACzCE,IAAY,UAAU,KAAKF,CAAS;AAE1C,SAAOC,KAASC;AAClB,GAEaC,IAAc,CAAC,EAAC,OAAAC,EAAK,IAAuB,OAAO;AAE1D,EAAAL,EAAA,KAAc,CAACK,KAId,OAAO,aACV,OAAO,WAAWV,EAAgB,GAClC,OAAO,cAAc;AAAA,IACnB,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ;AAEJ;"}
@@ -61,6 +61,7 @@
61
61
  "ADD_PRODUCT_LIST",
62
62
  "REMOVE_PRODUCT_LIST",
63
63
  "RENAME_PRODUCT_LIST",
64
+ "SET_PRODUCT_LIST_VISIBILITY",
64
65
  "ADD_PRODUCT_LIST_ITEM",
65
66
  "REMOVE_PRODUCT_LIST_ITEM"
66
67
  ],
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.6.1",
4
+ "version": "0.7.1",
5
5
  "sideEffects": false,
6
6
  "type": "module",
7
7
  "engines": {
@@ -46,7 +46,7 @@
46
46
  "typescript": ">=5.0.0"
47
47
  },
48
48
  "dependencies": {
49
- "@shopify/shop-minis-platform": "0.9.0",
49
+ "@shopify/shop-minis-platform": "0.10.0",
50
50
  "@tailwindcss/vite": "4.1.8",
51
51
  "@tanstack/react-query": "5.86.0",
52
52
  "@types/color": "3.0.6",
@@ -0,0 +1,28 @@
1
+ export interface StaticAreaDocProps {
2
+ /** Position of the fixed area on screen - either pinned to top or bottom */
3
+ position: 'top' | 'bottom'
4
+ /** Static area content */
5
+ children?: React.ReactNode
6
+ }
7
+
8
+ export function StaticArea({
9
+ position,
10
+ children,
11
+ }: {
12
+ position: 'top' | 'bottom'
13
+ children: React.ReactNode
14
+ }) {
15
+ return (
16
+ <div
17
+ style={{
18
+ position: 'fixed',
19
+ left: 0,
20
+ right: 0,
21
+ [position]: 0,
22
+ viewTransitionName: `minis-fixed-${position}`,
23
+ }}
24
+ >
25
+ {children}
26
+ </div>
27
+ )
28
+ }
@@ -27,6 +27,7 @@ export * from './atoms/video-player'
27
27
  export * from './atoms/text-input'
28
28
  export * from './atoms/content-wrapper'
29
29
  export * from './atoms/product-variant-price'
30
+ export * from './atoms/static-area'
30
31
 
31
32
  export * from './ui/accordion'
32
33
  export * from './ui/alert'
@@ -0,0 +1,107 @@
1
+ import {renderHook} from '@testing-library/react'
2
+ import {describe, expect, it, vi, beforeEach} from 'vitest'
3
+
4
+ import {useShopActions} from '../../internal/useShopActions'
5
+
6
+ import {useProductListActions} from './useProductListActions'
7
+
8
+ // Mock the internal hooks
9
+ vi.mock('../../internal/useShopActions', () => ({
10
+ useShopActions: vi.fn(),
11
+ }))
12
+
13
+ vi.mock('../../internal/useHandleAction', () => ({
14
+ useHandleAction: vi.fn((action: any) => action),
15
+ }))
16
+
17
+ describe('useProductListActions', () => {
18
+ const mockAddProductList = vi.fn()
19
+ const mockRemoveProductList = vi.fn()
20
+ const mockRenameProductList = vi.fn()
21
+ const mockSetProductListVisibility = vi.fn()
22
+ const mockAddProductListItem = vi.fn()
23
+ const mockRemoveProductListItem = vi.fn()
24
+
25
+ beforeEach(() => {
26
+ vi.clearAllMocks()
27
+ ;(useShopActions as ReturnType<typeof vi.fn>).mockReturnValue({
28
+ addProductList: mockAddProductList,
29
+ removeProductList: mockRemoveProductList,
30
+ renameProductList: mockRenameProductList,
31
+ setProductListVisibility: mockSetProductListVisibility,
32
+ addProductListItem: mockAddProductListItem,
33
+ removeProductListItem: mockRemoveProductListItem,
34
+ })
35
+ })
36
+
37
+ it('should expose all product list actions', () => {
38
+ const {result} = renderHook(() => useProductListActions())
39
+
40
+ expect(result.current).toHaveProperty('addProductList')
41
+ expect(result.current).toHaveProperty('removeProductList')
42
+ expect(result.current).toHaveProperty('renameProductList')
43
+ expect(result.current).toHaveProperty('setProductListVisibility')
44
+ expect(result.current).toHaveProperty('addProductListItem')
45
+ expect(result.current).toHaveProperty('removeProductListItem')
46
+ })
47
+
48
+ it('should expose setProductListVisibility action', () => {
49
+ const {result} = renderHook(() => useProductListActions())
50
+
51
+ expect(result.current.setProductListVisibility).toBe(
52
+ mockSetProductListVisibility
53
+ )
54
+ })
55
+
56
+ describe('addProductList', () => {
57
+ it('should call addProductList with privacyStatus', async () => {
58
+ mockAddProductList.mockResolvedValue({
59
+ id: 'gid://shopapp/ProductList/123',
60
+ publicId: 'public-123',
61
+ name: 'Test List',
62
+ privacyStatus: 'PUBLIC',
63
+ products: [],
64
+ })
65
+
66
+ const {result} = renderHook(() => useProductListActions())
67
+
68
+ const response = await result.current.addProductList({
69
+ name: 'Test List',
70
+ privacyStatus: 'PUBLIC',
71
+ })
72
+
73
+ expect(mockAddProductList).toHaveBeenCalledWith({
74
+ name: 'Test List',
75
+ privacyStatus: 'PUBLIC',
76
+ })
77
+ expect(response.privacyStatus).toBe('PUBLIC')
78
+ })
79
+ })
80
+
81
+ describe('setProductListVisibility', () => {
82
+ it('should call setProductListVisibility with params', async () => {
83
+ mockSetProductListVisibility.mockResolvedValue({
84
+ id: 'gid://shopapp/ProductList/123',
85
+ publicId: 'public-123',
86
+ name: 'Test List',
87
+ privacyStatus: 'PUBLIC',
88
+ products: [],
89
+ })
90
+
91
+ const {result} = renderHook(() => useProductListActions())
92
+
93
+ const response = await result.current.setProductListVisibility({
94
+ id: 'gid://shopapp/ProductList/123',
95
+ name: 'Test List',
96
+ privacyStatus: 'PUBLIC',
97
+ })
98
+
99
+ expect(mockSetProductListVisibility).toHaveBeenCalledWith({
100
+ id: 'gid://shopapp/ProductList/123',
101
+ name: 'Test List',
102
+ privacyStatus: 'PUBLIC',
103
+ })
104
+ expect(response.privacyStatus).toBe('PUBLIC')
105
+ })
106
+ })
107
+ })
@@ -2,6 +2,7 @@ import {
2
2
  AddProductListParams,
3
3
  RemoveProductListParams,
4
4
  RenameProductListParams,
5
+ SetProductListVisibilityParams,
5
6
  AddProductListItemParams,
6
7
  RemoveProductListItemParams,
7
8
  } from '@shopify/shop-minis-platform/actions'
@@ -23,6 +24,12 @@ interface UseProductListActionsReturns {
23
24
  * Rename a product list
24
25
  */
25
26
  renameProductList: (params: RenameProductListParams) => Promise<ProductList>
27
+ /**
28
+ * Set the visibility (privacy status) of a product list
29
+ */
30
+ setProductListVisibility: (
31
+ params: SetProductListVisibilityParams
32
+ ) => Promise<ProductList>
26
33
  /**
27
34
  * Add a product to a product list
28
35
  */
@@ -38,6 +45,7 @@ export const useProductListActions = (): UseProductListActionsReturns => {
38
45
  addProductList,
39
46
  removeProductList,
40
47
  renameProductList,
48
+ setProductListVisibility,
41
49
  addProductListItem,
42
50
  removeProductListItem,
43
51
  } = useShopActions()
@@ -46,6 +54,7 @@ export const useProductListActions = (): UseProductListActionsReturns => {
46
54
  addProductList: useHandleAction(addProductList),
47
55
  removeProductList: useHandleAction(removeProductList),
48
56
  renameProductList: useHandleAction(renameProductList),
57
+ setProductListVisibility: useHandleAction(setProductListVisibility),
49
58
  addProductListItem: useHandleAction(addProductListItem),
50
59
  removeProductListItem: useHandleAction(removeProductListItem),
51
60
  }
package/src/mocks.ts CHANGED
@@ -207,6 +207,7 @@ const createProductList = (id: string, name: string, products: any[] = []) => ({
207
207
  id,
208
208
  publicId: `public-${id}`,
209
209
  name,
210
+ privacyStatus: 'PRIVATE' as const,
210
211
  products,
211
212
  })
212
213
 
@@ -344,6 +345,7 @@ export function makeMockActions(): ShopActions {
344
345
  addProductList: createProductList('list-3', 'New List'),
345
346
  removeProductList: undefined,
346
347
  renameProductList: createProductList('list-1', 'Updated Wishlist'),
348
+ setProductListVisibility: createProductList('list-1', 'Wishlist'),
347
349
  addProductListItem: undefined,
348
350
  removeProductListItem: undefined,
349
351
  getRecommendedProducts: {
@@ -141,4 +141,16 @@
141
141
  animation: 0 !important;
142
142
  opacity: 0 !important;
143
143
  }
144
+
145
+ /* Fixed elements that persist across view transitions */
146
+ ::view-transition-group(minis-fixed-top),
147
+ ::view-transition-old(minis-fixed-top),
148
+ ::view-transition-new(minis-fixed-top),
149
+ ::view-transition-group(minis-fixed-bottom),
150
+ ::view-transition-old(minis-fixed-bottom),
151
+ ::view-transition-new(minis-fixed-bottom) {
152
+ animation: none !important;
153
+ }
144
154
  }
155
+
156
+