@shopify/shop-minis-react 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/index4.js +2 -2
- package/dist/_virtual/index5.js +2 -3
- package/dist/_virtual/index5.js.map +1 -1
- package/dist/_virtual/index6.js +3 -2
- package/dist/_virtual/index6.js.map +1 -1
- package/dist/hooks/product/useProductListActions.js +12 -10
- package/dist/hooks/product/useProductListActions.js.map +1 -1
- package/dist/index.js +67 -65
- package/dist/index.js.map +1 -1
- package/dist/mocks.js +31 -29
- package/dist/mocks.js.map +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/index.js +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/mpd-parser@1.3.1/node_modules/mpd-parser/dist/mpd-parser.es.js +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/querystringify@2.2.0/node_modules/querystringify/index.js +1 -1
- package/dist/utils/buildDeeplinkUrl.js +10 -0
- package/dist/utils/buildDeeplinkUrl.js.map +1 -0
- package/generated-hook-maps/hook-actions-map.json +1 -0
- package/package.json +2 -2
- package/src/hooks/product/useProductListActions.test.ts +107 -0
- package/src/hooks/product/useProductListActions.ts +9 -0
- package/src/mocks.ts +2 -0
- package/src/utils/buildDeeplinkUrl.ts +19 -0
- package/src/utils/index.ts +1 -0
package/dist/_virtual/index4.js
CHANGED
package/dist/_virtual/index5.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index5.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index5.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/_virtual/index6.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index6.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -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
|
|
3
|
+
const L = () => {
|
|
4
4
|
const {
|
|
5
5
|
addProductList: o,
|
|
6
|
-
removeProductList:
|
|
7
|
-
renameProductList:
|
|
8
|
-
|
|
9
|
-
|
|
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(
|
|
14
|
-
renameProductList: t(
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
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":";;
|
|
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
|
@@ -2,12 +2,12 @@ import { DATA_NAVIGATION_TYPE_ATTRIBUTE as o, NAVIGATION_TYPES as t } from "./ty
|
|
|
2
2
|
import { MinisContainer as i } from "./components/MinisContainer.js";
|
|
3
3
|
import { AddToCartButton as n } from "./components/commerce/add-to-cart.js";
|
|
4
4
|
import { BuyNowButton as s } from "./components/commerce/buy-now.js";
|
|
5
|
-
import { ProductCard as u, ProductCardBadge as f, ProductCardContainer as x, ProductCardFavoriteButton as c, ProductCardImage as d, ProductCardImageContainer as C, ProductCardInfo as g, ProductCardPrice as S, ProductCardReviewStars as
|
|
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";
|
|
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";
|
|
9
|
-
import { MerchantCardSkeleton as
|
|
10
|
-
import { QuantitySelector as
|
|
9
|
+
import { MerchantCardSkeleton as b } from "./components/commerce/merchant-card-skeleton.js";
|
|
10
|
+
import { QuantitySelector as k } from "./components/commerce/quantity-selector.js";
|
|
11
11
|
import { Search as O, SearchInput as _, SearchProvider as y, SearchResultsList as G } from "./components/commerce/search.js";
|
|
12
12
|
import { FavoriteButton as V } from "./components/commerce/favorite-button.js";
|
|
13
13
|
import { ImageContentWrapper as W } from "./components/content/image-content-wrapper.js";
|
|
@@ -24,20 +24,20 @@ 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
|
|
27
|
+
import { Accordion as Sr, AccordionContent as Dr, AccordionItem as Ar, AccordionTrigger as Pr } from "./components/ui/accordion.js";
|
|
28
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
|
|
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
30
|
import { Avatar as yr, AvatarFallback as Gr, AvatarImage as Hr } from "./components/ui/avatar.js";
|
|
31
31
|
import { Badge as zr, badgeVariants as Wr } from "./components/ui/badge.js";
|
|
32
32
|
import { Card as qr, CardAction as Kr, CardContent as Qr, CardDescription as Zr, CardFooter as jr, CardHeader as Jr, CardTitle as Xr } from "./components/ui/card.js";
|
|
33
33
|
import { Carousel as re, CarouselContent as ee, CarouselItem as oe, CarouselNext as te, CarouselPrevious as ae } from "./components/ui/carousel.js";
|
|
34
34
|
import { Checkbox as pe } from "./components/ui/checkbox.js";
|
|
35
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
|
|
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
37
|
import { Input as Me } from "./components/ui/input.js";
|
|
38
38
|
import { Label as Ue } from "./components/ui/label.js";
|
|
39
|
-
import { Progress as
|
|
40
|
-
import { RadioGroup as
|
|
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
41
|
import { ResizableHandle as ye, ResizablePanel as Ge, ResizablePanelGroup as He } from "./components/ui/resizable.js";
|
|
42
42
|
import { ScrollArea as ze, ScrollBar as We } from "./components/ui/scroll-area.js";
|
|
43
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";
|
|
@@ -45,15 +45,15 @@ import { Separator as to } from "./components/ui/separator.js";
|
|
|
45
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
46
|
import { Toaster as co } from "./components/ui/sonner.js";
|
|
47
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
|
|
48
|
+
import { Skeleton as Do } from "./components/ui/skeleton.js";
|
|
49
49
|
import { useRecentProducts as Po } from "./hooks/user/useRecentProducts.js";
|
|
50
50
|
import { useRecentShops as ho } from "./hooks/user/useRecentShops.js";
|
|
51
51
|
import { useSavedProducts as Ro } from "./hooks/user/useSavedProducts.js";
|
|
52
52
|
import { useSavedProductsActions as wo } from "./hooks/user/useSavedProductsActions.js";
|
|
53
53
|
import { useFollowedShops as Eo } from "./hooks/user/useFollowedShops.js";
|
|
54
54
|
import { useFollowedShopsActions as Fo } from "./hooks/user/useFollowedShopsActions.js";
|
|
55
|
-
import { useCurrentUser as
|
|
56
|
-
import { useOrders as
|
|
55
|
+
import { useCurrentUser as bo } from "./hooks/user/useCurrentUser.js";
|
|
56
|
+
import { useOrders as ko } from "./hooks/user/useOrders.js";
|
|
57
57
|
import { useBuyerAttributes as Oo } from "./hooks/user/useBuyerAttributes.js";
|
|
58
58
|
import { useGenerateUserToken as yo } from "./hooks/user/useGenerateUserToken.js";
|
|
59
59
|
import { useProductListActions as Ho } from "./hooks/product/useProductListActions.js";
|
|
@@ -72,15 +72,15 @@ import { useSecureStorage as ut } from "./hooks/storage/useSecureStorage.js";
|
|
|
72
72
|
import { useImageUpload as xt } from "./hooks/storage/useImageUpload.js";
|
|
73
73
|
import { useShopNavigation as dt } from "./hooks/navigation/useShopNavigation.js";
|
|
74
74
|
import { useCloseMini as gt } from "./hooks/navigation/useCloseMini.js";
|
|
75
|
-
import { useDeeplink as
|
|
75
|
+
import { useDeeplink as Dt } from "./hooks/navigation/useDeeplink.js";
|
|
76
76
|
import { useNavigateWithTransition as Pt } from "./hooks/navigation/useNavigateWithTransition.js";
|
|
77
77
|
import { useShop as ht } from "./hooks/shop/useShop.js";
|
|
78
78
|
import { useRecommendedShops as Rt } from "./hooks/shop/useRecommendedShops.js";
|
|
79
79
|
import { useCreateImageContent as wt } from "./hooks/content/useCreateImageContent.js";
|
|
80
80
|
import { useErrorToast as Et } from "./hooks/util/useErrorToast.js";
|
|
81
81
|
import { useErrorScreen as Ft } from "./hooks/util/useErrorScreen.js";
|
|
82
|
-
import { useShare as
|
|
83
|
-
import { useImagePicker as
|
|
82
|
+
import { useShare as bt } from "./hooks/util/useShare.js";
|
|
83
|
+
import { useImagePicker as kt } from "./hooks/util/useImagePicker.js";
|
|
84
84
|
import { useKeyboardAvoidingView as Ot } from "./hooks/util/useKeyboardAvoidingView.js";
|
|
85
85
|
import { useRequestPermissions as yt } from "./hooks/util/useRequestPermissions.js";
|
|
86
86
|
import { useOnMiniFocus as Ht } from "./hooks/events/useOnMiniFocus.js";
|
|
@@ -88,19 +88,20 @@ import { useOnMiniBlur as zt } from "./hooks/events/useOnMiniBlur.js";
|
|
|
88
88
|
import { useOnMiniClose as Yt } from "./hooks/events/useOnMiniClose.js";
|
|
89
89
|
import { useOnAppStateChange as Kt } from "./hooks/events/useOnAppStateChange.js";
|
|
90
90
|
import { useOnNavigateBack as Zt } from "./hooks/events/useOnNavigateBack.js";
|
|
91
|
-
import {
|
|
92
|
-
import {
|
|
93
|
-
import {
|
|
94
|
-
import {
|
|
95
|
-
import {
|
|
96
|
-
import {
|
|
97
|
-
import {
|
|
98
|
-
import {
|
|
99
|
-
import {
|
|
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";
|
|
100
101
|
export {
|
|
101
102
|
Sr as Accordion,
|
|
102
|
-
|
|
103
|
-
|
|
103
|
+
Dr as AccordionContent,
|
|
104
|
+
Ar as AccordionItem,
|
|
104
105
|
Pr as AccordionTrigger,
|
|
105
106
|
n as AddToCartButton,
|
|
106
107
|
hr as Alert,
|
|
@@ -112,10 +113,10 @@ export {
|
|
|
112
113
|
Mr as AlertDialogContent,
|
|
113
114
|
Fr as AlertDialogDescription,
|
|
114
115
|
Ur as AlertDialogFooter,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
br as AlertDialogHeader,
|
|
117
|
+
Lr as AlertDialogOverlay,
|
|
118
|
+
kr as AlertDialogPortal,
|
|
119
|
+
Nr as AlertDialogTitle,
|
|
119
120
|
Or as AlertDialogTrigger,
|
|
120
121
|
Rr as AlertTitle,
|
|
121
122
|
yr as Avatar,
|
|
@@ -137,10 +138,10 @@ export {
|
|
|
137
138
|
te as CarouselNext,
|
|
138
139
|
ae as CarouselPrevious,
|
|
139
140
|
pe as Checkbox,
|
|
140
|
-
|
|
141
|
+
Ta as ContentCreateUserErrorCode,
|
|
141
142
|
cr as ContentWrapper,
|
|
142
|
-
|
|
143
|
-
|
|
143
|
+
wa as DATA_FETCHING_DEFAULT_FETCH_POLICY,
|
|
144
|
+
Ba as DATA_FETCHING_DEFAULT_PAGE_SIZE,
|
|
144
145
|
o as DATA_NAVIGATION_TYPE_ATTRIBUTE,
|
|
145
146
|
me as Dialog,
|
|
146
147
|
se as DialogClose,
|
|
@@ -152,8 +153,8 @@ export {
|
|
|
152
153
|
de as DialogPortal,
|
|
153
154
|
Ce as DialogTitle,
|
|
154
155
|
ge as DialogTrigger,
|
|
155
|
-
|
|
156
|
-
|
|
156
|
+
De as Drawer,
|
|
157
|
+
Ae as DrawerClose,
|
|
157
158
|
Pe as DrawerContent,
|
|
158
159
|
Te as DrawerDescription,
|
|
159
160
|
he as DrawerFooter,
|
|
@@ -176,12 +177,12 @@ export {
|
|
|
176
177
|
w as MerchantCardInfo,
|
|
177
178
|
B as MerchantCardName,
|
|
178
179
|
E as MerchantCardRating,
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
180
|
+
b as MerchantCardSkeleton,
|
|
181
|
+
$t as MiniEntityNotFoundError,
|
|
182
|
+
ra as MiniError,
|
|
183
|
+
ea as MiniNetworkError,
|
|
183
184
|
i as MinisContainer,
|
|
184
|
-
|
|
185
|
+
ha as MinisContentStatus,
|
|
185
186
|
q as MinisRouter,
|
|
186
187
|
t as NAVIGATION_TYPES,
|
|
187
188
|
u as ProductCard,
|
|
@@ -192,14 +193,14 @@ export {
|
|
|
192
193
|
C as ProductCardImageContainer,
|
|
193
194
|
g as ProductCardInfo,
|
|
194
195
|
S as ProductCardPrice,
|
|
195
|
-
|
|
196
|
+
D as ProductCardReviewStars,
|
|
196
197
|
F as ProductCardSkeleton,
|
|
197
|
-
|
|
198
|
+
A as ProductCardTitle,
|
|
198
199
|
T as ProductLink,
|
|
199
200
|
Cr as ProductVariantPrice,
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
201
|
+
Le as Progress,
|
|
202
|
+
k as QuantitySelector,
|
|
203
|
+
Ne as RadioGroup,
|
|
203
204
|
Oe as RadioGroupItem,
|
|
204
205
|
ye as ResizableHandle,
|
|
205
206
|
Ge as ResizablePanel,
|
|
@@ -229,41 +230,42 @@ export {
|
|
|
229
230
|
lo as SheetHeader,
|
|
230
231
|
uo as SheetTitle,
|
|
231
232
|
fo as SheetTrigger,
|
|
232
|
-
|
|
233
|
-
|
|
233
|
+
Do as Skeleton,
|
|
234
|
+
Ra as Social,
|
|
234
235
|
fr as TextInput,
|
|
235
236
|
co as Toaster,
|
|
236
237
|
or as Touchable,
|
|
237
238
|
Q as TransitionLink,
|
|
238
|
-
|
|
239
|
-
|
|
239
|
+
Da as UserState,
|
|
240
|
+
Aa as UserTokenGenerateUserErrorCode,
|
|
240
241
|
lr as VideoPlayer,
|
|
241
242
|
Wr as badgeVariants,
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
na as
|
|
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,
|
|
254
256
|
go as toast,
|
|
255
257
|
st as useAsyncStorage,
|
|
256
258
|
Oo as useBuyerAttributes,
|
|
257
259
|
gt as useCloseMini,
|
|
258
260
|
wt as useCreateImageContent,
|
|
259
|
-
|
|
260
|
-
|
|
261
|
+
bo as useCurrentUser,
|
|
262
|
+
Dt as useDeeplink,
|
|
261
263
|
Ft as useErrorScreen,
|
|
262
264
|
Et as useErrorToast,
|
|
263
265
|
Eo as useFollowedShops,
|
|
264
266
|
Fo as useFollowedShopsActions,
|
|
265
267
|
yo as useGenerateUserToken,
|
|
266
|
-
|
|
268
|
+
kt as useImagePicker,
|
|
267
269
|
xt as useImageUpload,
|
|
268
270
|
Ot as useKeyboardAvoidingView,
|
|
269
271
|
Pt as useNavigateWithTransition,
|
|
@@ -272,7 +274,7 @@ export {
|
|
|
272
274
|
Yt as useOnMiniClose,
|
|
273
275
|
Ht as useOnMiniFocus,
|
|
274
276
|
Zt as useOnNavigateBack,
|
|
275
|
-
|
|
277
|
+
ko as useOrders,
|
|
276
278
|
nt as usePopularProducts,
|
|
277
279
|
Ko as useProduct,
|
|
278
280
|
Yo as useProductList,
|
|
@@ -291,7 +293,7 @@ export {
|
|
|
291
293
|
Ro as useSavedProducts,
|
|
292
294
|
wo as useSavedProductsActions,
|
|
293
295
|
ut as useSecureStorage,
|
|
294
|
-
|
|
296
|
+
bt as useShare,
|
|
295
297
|
ht as useShop,
|
|
296
298
|
dt as useShopNavigation
|
|
297
299
|
};
|
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",
|
|
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
|
-
...
|
|
20
|
-
compareAtPrice: { amount:
|
|
19
|
+
...n && {
|
|
20
|
+
compareAtPrice: { amount: n, currencyCode: "USD" }
|
|
21
21
|
},
|
|
22
22
|
reviewAnalytics: { averageRating: 4.5, reviewCount: 10 },
|
|
23
|
-
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
|
-
}),
|
|
41
|
-
const
|
|
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 (
|
|
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 (
|
|
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 ||
|
|
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
|
-
}),
|
|
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
|
-
|
|
225
|
-
|
|
225
|
+
d("list-1", "Wishlist"),
|
|
226
|
+
d("list-2", "Favorites")
|
|
226
227
|
],
|
|
227
228
|
pageInfo: a()
|
|
228
229
|
},
|
|
229
230
|
getProductList: {
|
|
230
|
-
data:
|
|
231
|
+
data: d("list-1", "Wishlist", [
|
|
231
232
|
e("prod-1", "Sample Product")
|
|
232
233
|
]),
|
|
233
234
|
pageInfo: a()
|
|
234
235
|
},
|
|
235
|
-
addProductList:
|
|
236
|
+
addProductList: d("list-3", "New List"),
|
|
236
237
|
removeProductList: void 0,
|
|
237
|
-
renameProductList:
|
|
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
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
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:
|
|
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:
|
|
405
|
+
data: i("shop-1", "Sample Shop", { featuredImagesLimit: 4 })
|
|
404
406
|
},
|
|
405
407
|
getRecentShops: {
|
|
406
408
|
data: [
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
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
|
-
|
|
416
|
-
|
|
417
|
-
|
|
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
|
-
|
|
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","is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AAA,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;"}
|
|
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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UACV,OAAO;AAAA,YACL,IAAI;AAAA,YACJ,KAAK;AAAA,YACL,OAAO;AAAA,YACP,QAAQ;AAAA,UACV;AAAA,UACA,OAAO;AAAA,UACP,YAAY,CAAC,cAAc;AAAA,UAC3B,QAAQY,EAAmB;AAAA,QAAA;AAAA,MAC7B;AAAA,IAEJ;AAAA,IACA,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;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __module as q } from "../../../../../../../../_virtual/
|
|
1
|
+
import { __module as q } from "../../../../../../../../_virtual/index5.js";
|
|
2
2
|
import { __require as F } from "../../../../../global@4.4.0/node_modules/global/window.js";
|
|
3
3
|
import { __require as N } from "../../../../../@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/extends.js";
|
|
4
4
|
import { __require as J } from "../../../../../is-function@1.0.2/node_modules/is-function/index.js";
|
|
@@ -2,7 +2,7 @@ import L from "../../../../@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-ut
|
|
|
2
2
|
import T from "../../../../../../../_virtual/window.js";
|
|
3
3
|
import { forEachMediaGroup as Z } from "../../../../@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/media-groups.js";
|
|
4
4
|
import J from "../../../../@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/decode-b64-to-uint8-array.js";
|
|
5
|
-
import { l as Q } from "../../../../../../../_virtual/
|
|
5
|
+
import { l as Q } from "../../../../../../../_virtual/index6.js";
|
|
6
6
|
/*! @name mpd-parser @version 1.3.1 @license Apache-2.0 */
|
|
7
7
|
const w = (e) => !!e && typeof e == "object", E = (...e) => e.reduce((n, t) => (typeof t != "object" || Object.keys(t).forEach((r) => {
|
|
8
8
|
Array.isArray(n[r]) && Array.isArray(t[r]) ? n[r] = n[r].concat(t[r]) : w(n[r]) && w(t[r]) ? n[r] = E(n[r], t[r]) : n[r] = t[r];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildDeeplinkUrl.js","sources":["../../src/utils/buildDeeplinkUrl.ts"],"sourcesContent":["/**\n * Builds a deeplink URL for a Shop Mini.\n *\n * @param path - The path within the mini (should start with '/').\n * @returns The full deeplink URL. Structure: https://shop.app/mini/{handle}{path}\n *\n * @example\n * buildDeeplinkUrl('/products/123')\n * // Returns: 'https://shop.app/mini/my-mini/products/123'\n */\nexport function buildDeeplinkUrl(path: string): string {\n const {handle} = window.minisParams\n\n if (!handle) {\n throw new Error('Mini handle is not set')\n }\n\n return `https://shop.app/mini/${handle}${path}`\n}\n"],"names":["buildDeeplinkUrl","path","handle"],"mappings":"AAUO,SAASA,EAAiBC,GAAsB;AAC/C,QAAA,EAAC,QAAAC,MAAU,OAAO;AAExB,MAAI,CAACA;AACG,UAAA,IAAI,MAAM,wBAAwB;AAGnC,SAAA,yBAAyBA,CAAM,GAAGD,CAAI;AAC/C;"}
|
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.
|
|
4
|
+
"version": "0.7.0",
|
|
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.
|
|
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,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: {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds a deeplink URL for a Shop Mini.
|
|
3
|
+
*
|
|
4
|
+
* @param path - The path within the mini (should start with '/').
|
|
5
|
+
* @returns The full deeplink URL. Structure: https://shop.app/mini/{handle}{path}
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* buildDeeplinkUrl('/products/123')
|
|
9
|
+
* // Returns: 'https://shop.app/mini/my-mini/products/123'
|
|
10
|
+
*/
|
|
11
|
+
export function buildDeeplinkUrl(path: string): string {
|
|
12
|
+
const {handle} = window.minisParams
|
|
13
|
+
|
|
14
|
+
if (!handle) {
|
|
15
|
+
throw new Error('Mini handle is not set')
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return `https://shop.app/mini/${handle}${path}`
|
|
19
|
+
}
|
package/src/utils/index.ts
CHANGED