@shopify/shop-minis-react 0.0.0-snapshot.20251224113248 → 0.0.0-snapshot.20260107140531

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/index.js CHANGED
@@ -1,126 +1,121 @@
1
1
  import { DATA_NAVIGATION_TYPE_ATTRIBUTE as o, NAVIGATION_TYPES as t } from "./types/index.js";
2
- import { MinisContainer as p } from "./components/MinisContainer.js";
3
- import { AddToCartButton as i } from "./components/commerce/add-to-cart.js";
2
+ import { MinisContainer as i } from "./components/MinisContainer.js";
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 l, 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";
5
+ import { ProductCard as u, ProductCardBadge as f, ProductCardContainer as x, ProductCardFavoriteButton as d, ProductCardImage as c, 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
- import { MerchantCard as I, MerchantCardContainer as R, MerchantCardHeader as M, MerchantCardInfo as E, MerchantCardName as v, MerchantCardRating as w } from "./components/commerce/merchant-card.js";
8
- import { ProductCardSkeleton as F } from "./components/commerce/product-card-skeleton.js";
7
+ import { MerchantCard as I, MerchantCardContainer as R, MerchantCardHeader as E, MerchantCardInfo as M, MerchantCardName as w, MerchantCardRating as B } from "./components/commerce/merchant-card.js";
8
+ import { ProductCardSkeleton as v } from "./components/commerce/product-card-skeleton.js";
9
9
  import { MerchantCardSkeleton as L } from "./components/commerce/merchant-card-skeleton.js";
10
- import { QuantitySelector as k } from "./components/commerce/quantity-selector.js";
11
- import { Search as y, SearchInput as _, SearchProvider as G, SearchResultsList as O } from "./components/commerce/search.js";
10
+ import { QuantitySelector as N } from "./components/commerce/quantity-selector.js";
11
+ import { Search as _, SearchInput as y, SearchProvider as G, SearchResultsList as O } 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";
14
- import { MinisRouter as Q } from "./components/navigation/minis-router.js";
15
- import { TransitionLink as K } from "./components/navigation/transition-link.js";
14
+ import { MinisRouter as q } from "./components/navigation/minis-router.js";
15
+ import { TransitionLink as Q } from "./components/navigation/transition-link.js";
16
16
  import { Button as j } from "./components/atoms/button.js";
17
17
  import { IconButton as X } from "./components/atoms/icon-button.js";
18
18
  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
- import { AlertDialogAtom as nr } from "./components/atoms/alert-dialog.js";
21
+ import { AlertDialogAtom as pr } from "./components/atoms/alert-dialog.js";
22
22
  import { List as mr } from "./components/atoms/list.js";
23
- import { VideoPlayer as ur } from "./components/atoms/video-player.js";
23
+ import { VideoPlayer as lr } from "./components/atoms/video-player.js";
24
24
  import { TextInput as fr } from "./components/atoms/text-input.js";
25
- import { ContentWrapper as cr } from "./components/atoms/content-wrapper.js";
25
+ import { ContentWrapper as dr } from "./components/atoms/content-wrapper.js";
26
26
  import { ProductVariantPrice as Cr } from "./components/atoms/product-variant-price.js";
27
27
  import { Accordion as Sr, AccordionContent as Ar, AccordionItem as Dr, 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 Er, AlertDialogAction as vr, AlertDialogCancel as wr, AlertDialogContent as Br, AlertDialogDescription as Fr, AlertDialogFooter as Ur, AlertDialogHeader as Lr, AlertDialogOverlay as br, AlertDialogPortal as kr, AlertDialogTitle as Nr, AlertDialogTrigger as yr } from "./components/ui/alert-dialog.js";
29
+ import { AlertDialog as Mr, AlertDialogAction as wr, AlertDialogCancel as Br, AlertDialogContent as Fr, AlertDialogDescription as vr, AlertDialogFooter as Ur, AlertDialogHeader as Lr, AlertDialogOverlay as br, AlertDialogPortal as Nr, AlertDialogTitle as kr, AlertDialogTrigger as _r } from "./components/ui/alert-dialog.js";
30
30
  import { Avatar as Gr, AvatarFallback as Or, AvatarImage as Hr } from "./components/ui/avatar.js";
31
31
  import { Badge as zr, badgeVariants as Wr } from "./components/ui/badge.js";
32
- import { Card as Qr, CardAction as qr, CardContent as Kr, CardDescription as Zr, CardFooter as jr, CardHeader as Jr, CardTitle as Xr } from "./components/ui/card.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
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 ne } from "./components/ui/checkbox.js";
35
- import { Dialog as me, DialogClose as se, DialogContent as ue, DialogDescription as le, 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 Ae, DrawerClose as De, DrawerContent as Pe, DrawerDescription as Te, DrawerFooter as he, DrawerHeader as Ie, DrawerOverlay as Re, DrawerPortal as Me, DrawerTitle as Ee, DrawerTrigger as ve } from "./components/ui/drawer.js";
37
- import { Input as Be } from "./components/ui/input.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 de, DialogPortal as ce, DialogTitle as Ce, DialogTrigger as ge } from "./components/ui/dialog.js";
36
+ import { Drawer as Ae, DrawerClose as De, DrawerContent as Pe, DrawerDescription as Te, DrawerFooter as he, DrawerHeader as Ie, DrawerOverlay as Re, DrawerPortal as Ee, DrawerTitle as Me, DrawerTrigger as we } from "./components/ui/drawer.js";
37
+ import { Input as Fe } from "./components/ui/input.js";
38
38
  import { Label as Ue } from "./components/ui/label.js";
39
39
  import { Progress as be } from "./components/ui/progress.js";
40
- import { RadioGroup as Ne, RadioGroupItem as ye } from "./components/ui/radio-group.js";
40
+ import { RadioGroup as ke, RadioGroupItem as _e } from "./components/ui/radio-group.js";
41
41
  import { ResizableHandle as Ge, ResizablePanel as Oe, ResizablePanelGroup as He } from "./components/ui/resizable.js";
42
42
  import { ScrollArea as ze, ScrollBar as We } from "./components/ui/scroll-area.js";
43
- import { Select as Qe, SelectContent as qe, SelectGroup as Ke, 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";
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
44
  import { Separator as to } from "./components/ui/separator.js";
45
- import { Sheet as po, SheetClose as no, SheetContent as io, SheetDescription as mo, SheetFooter as so, SheetHeader as uo, SheetTitle as lo, SheetTrigger as fo } from "./components/ui/sheet.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
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
48
  import { Skeleton as Ao } 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
- import { useSavedProductsActions as Eo } from "./hooks/user/useSavedProductsActions.js";
53
- import { useFollowedShops as wo } from "./hooks/user/useFollowedShops.js";
54
- import { useFollowedShopsActions as Fo } from "./hooks/user/useFollowedShopsActions.js";
52
+ import { useSavedProductsActions as Mo } from "./hooks/user/useSavedProductsActions.js";
53
+ import { useFollowedShops as Bo } from "./hooks/user/useFollowedShops.js";
54
+ import { useFollowedShopsActions as vo } from "./hooks/user/useFollowedShopsActions.js";
55
55
  import { useCurrentUser as Lo } from "./hooks/user/useCurrentUser.js";
56
- import { useOrders as ko } from "./hooks/user/useOrders.js";
57
- import { useBuyerAttributes as yo } from "./hooks/user/useBuyerAttributes.js";
56
+ import { useOrders as No } from "./hooks/user/useOrders.js";
57
+ import { useBuyerAttributes as _o } from "./hooks/user/useBuyerAttributes.js";
58
58
  import { useGenerateUserToken as Go } from "./hooks/user/useGenerateUserToken.js";
59
59
  import { useProductListActions as Ho } from "./hooks/product/useProductListActions.js";
60
60
  import { useProductLists as zo } from "./hooks/product/useProductLists.js";
61
61
  import { useProductList as Yo } from "./hooks/product/useProductList.js";
62
- import { useProduct as qo } from "./hooks/product/useProduct.js";
62
+ import { useProduct as Ko } from "./hooks/product/useProduct.js";
63
63
  import { useProducts as Zo } from "./hooks/product/useProducts.js";
64
64
  import { useProductVariants as Jo } from "./hooks/product/useProductVariants.js";
65
65
  import { useProductMedia as $o } from "./hooks/product/useProductMedia.js";
66
66
  import { useProductSearch as et } from "./hooks/product/useProductSearch.js";
67
67
  import { useRecommendedProducts as tt } from "./hooks/product/useRecommendedProducts.js";
68
- import { usePopularProducts as pt } from "./hooks/product/usePopularProducts.js";
69
- import { useCuratedProducts as it } from "./hooks/product/useCuratedProducts.js";
68
+ import { usePopularProducts as it } from "./hooks/product/usePopularProducts.js";
69
+ import { useCuratedProducts as nt } from "./hooks/product/useCuratedProducts.js";
70
70
  import { useAsyncStorage as st } from "./hooks/storage/useAsyncStorage.js";
71
- import { useSecureStorage as lt } from "./hooks/storage/useSecureStorage.js";
71
+ import { useSecureStorage as ut } from "./hooks/storage/useSecureStorage.js";
72
72
  import { useImageUpload as xt } from "./hooks/storage/useImageUpload.js";
73
- import { useShopNavigation as dt } from "./hooks/navigation/useShopNavigation.js";
73
+ import { useShopNavigation as ct } from "./hooks/navigation/useShopNavigation.js";
74
74
  import { useCloseMini as gt } from "./hooks/navigation/useCloseMini.js";
75
75
  import { useDeeplink as At } 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
- import { useCreateImageContent as Et } from "./hooks/content/useCreateImageContent.js";
80
- import { useQueryIntents as wt } from "./hooks/intents/useQueryIntents.js";
81
- import { useInvokeIntentAction as Ft } from "./hooks/intents/useInvokeIntentAction.js";
82
- import { useSelectProduct as Lt } from "./hooks/intents/useSelectProduct.js";
83
- import { useErrorToast as kt } from "./hooks/util/useErrorToast.js";
84
- import { useErrorScreen as yt } from "./hooks/util/useErrorScreen.js";
85
- import { useShare as Gt } from "./hooks/util/useShare.js";
86
- import { useImagePicker as Ht } from "./hooks/util/useImagePicker.js";
87
- import { useKeyboardAvoidingView as zt } from "./hooks/util/useKeyboardAvoidingView.js";
88
- import { useRequestPermissions as Yt } from "./hooks/util/useRequestPermissions.js";
89
- import { useOnMiniFocus as qt } from "./hooks/events/useOnMiniFocus.js";
90
- import { useOnMiniBlur as Zt } from "./hooks/events/useOnMiniBlur.js";
91
- import { useOnMiniClose as Jt } from "./hooks/events/useOnMiniClose.js";
92
- import { useOnAppStateChange as $t } from "./hooks/events/useOnAppStateChange.js";
93
- import { MiniEntityNotFoundError as ea, MiniError as oa, MiniNetworkError as ta, formatError as aa } from "./utils/errors.js";
94
- import { extractBrandTheme as na, formatReviewCount as ia, getFeaturedImages as ma, normalizeRating as sa } from "./utils/merchant-card.js";
95
- import { parseUrl as la } 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 Ea } from "./shop-minis-platform/src/types/share.js";
101
- import { DATA_FETCHING_DEFAULT_FETCH_POLICY as wa, DATA_FETCHING_DEFAULT_PAGE_SIZE as Ba } from "./shop-minis-platform/src/constants.js";
102
- import { ActionToScopesMapping as Ua, Scope as La } from "./shop-minis-platform/src/actions/scopes.js";
79
+ import { useCreateImageContent as Mt } from "./hooks/content/useCreateImageContent.js";
80
+ import { useErrorToast as Bt } from "./hooks/util/useErrorToast.js";
81
+ import { useErrorScreen as vt } from "./hooks/util/useErrorScreen.js";
82
+ import { useShare as Lt } from "./hooks/util/useShare.js";
83
+ import { useImagePicker as Nt } from "./hooks/util/useImagePicker.js";
84
+ import { useKeyboardAvoidingView as _t } from "./hooks/util/useKeyboardAvoidingView.js";
85
+ import { useRequestPermissions as Gt } 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 { MiniEntityNotFoundError as Zt, MiniError as jt, MiniNetworkError as Jt, formatError as Xt } from "./utils/errors.js";
91
+ import { extractBrandTheme as ra, formatReviewCount as ea, getFeaturedImages as oa, normalizeRating as ta } from "./utils/merchant-card.js";
92
+ import { parseUrl as ia } from "./utils/parseUrl.js";
93
+ import { dataURLToBlob as na, fileToDataUri as ma, getResizedImageUrl as sa, getThumbhashBlobURL as la, getThumbhashDataURL as ua } from "./utils/image.js";
94
+ import { formatMoney as xa } from "./utils/formatMoney.js";
95
+ import { UserState as ca, UserTokenGenerateUserErrorCode as Ca } from "./shop-minis-platform/src/types/user.js";
96
+ import { ContentCreateUserErrorCode as Sa, MinisContentStatus as Aa } from "./shop-minis-platform/src/types/content.js";
97
+ import { Social as Pa } from "./shop-minis-platform/src/types/share.js";
98
+ import { DATA_FETCHING_DEFAULT_FETCH_POLICY as ha, DATA_FETCHING_DEFAULT_PAGE_SIZE as Ia } from "./shop-minis-platform/src/constants.js";
103
99
  export {
104
100
  Sr as Accordion,
105
101
  Ar as AccordionContent,
106
102
  Dr as AccordionItem,
107
103
  Pr as AccordionTrigger,
108
- Ua as ActionToScopesMapping,
109
- i as AddToCartButton,
104
+ n as AddToCartButton,
110
105
  hr as Alert,
111
106
  Ir as AlertDescription,
112
- Er as AlertDialog,
113
- vr as AlertDialogAction,
114
- nr as AlertDialogAtom,
115
- wr as AlertDialogCancel,
116
- Br as AlertDialogContent,
117
- Fr as AlertDialogDescription,
107
+ Mr as AlertDialog,
108
+ wr as AlertDialogAction,
109
+ pr as AlertDialogAtom,
110
+ Br as AlertDialogCancel,
111
+ Fr as AlertDialogContent,
112
+ vr as AlertDialogDescription,
118
113
  Ur as AlertDialogFooter,
119
114
  Lr as AlertDialogHeader,
120
115
  br as AlertDialogOverlay,
121
- kr as AlertDialogPortal,
122
- Nr as AlertDialogTitle,
123
- yr as AlertDialogTrigger,
116
+ Nr as AlertDialogPortal,
117
+ kr as AlertDialogTitle,
118
+ _r as AlertDialogTrigger,
124
119
  Rr as AlertTitle,
125
120
  Gr as Avatar,
126
121
  Or as AvatarFallback,
@@ -128,9 +123,9 @@ export {
128
123
  zr as Badge,
129
124
  j as Button,
130
125
  s as BuyNowButton,
131
- Qr as Card,
132
- qr as CardAction,
133
- Kr as CardContent,
126
+ qr as Card,
127
+ Kr as CardAction,
128
+ Qr as CardContent,
134
129
  Zr as CardDescription,
135
130
  jr as CardFooter,
136
131
  Jr as CardHeader,
@@ -140,20 +135,20 @@ export {
140
135
  oe as CarouselItem,
141
136
  te as CarouselNext,
142
137
  ae as CarouselPrevious,
143
- ne as Checkbox,
144
- Ia as ContentCreateUserErrorCode,
145
- cr as ContentWrapper,
146
- wa as DATA_FETCHING_DEFAULT_FETCH_POLICY,
147
- Ba as DATA_FETCHING_DEFAULT_PAGE_SIZE,
138
+ pe as Checkbox,
139
+ Sa as ContentCreateUserErrorCode,
140
+ dr as ContentWrapper,
141
+ ha as DATA_FETCHING_DEFAULT_FETCH_POLICY,
142
+ Ia as DATA_FETCHING_DEFAULT_PAGE_SIZE,
148
143
  o as DATA_NAVIGATION_TYPE_ATTRIBUTE,
149
144
  me as Dialog,
150
145
  se as DialogClose,
151
- ue as DialogContent,
152
- le as DialogDescription,
146
+ le as DialogContent,
147
+ ue as DialogDescription,
153
148
  fe as DialogFooter,
154
149
  xe as DialogHeader,
155
- ce as DialogOverlay,
156
- de as DialogPortal,
150
+ de as DialogOverlay,
151
+ ce as DialogPortal,
157
152
  Ce as DialogTitle,
158
153
  ge as DialogTrigger,
159
154
  Ae as Drawer,
@@ -163,61 +158,60 @@ export {
163
158
  he as DrawerFooter,
164
159
  Ie as DrawerHeader,
165
160
  Re as DrawerOverlay,
166
- Me as DrawerPortal,
167
- Ee as DrawerTitle,
168
- ve as DrawerTrigger,
161
+ Ee as DrawerPortal,
162
+ Me as DrawerTitle,
163
+ we as DrawerTrigger,
169
164
  V as FavoriteButton,
170
165
  X as IconButton,
171
166
  rr as Image,
172
167
  W as ImageContentWrapper,
173
- Be as Input,
168
+ Fe as Input,
174
169
  Ue as Label,
175
170
  mr as List,
176
171
  ar as LongPressDetector,
177
172
  I as MerchantCard,
178
173
  R as MerchantCardContainer,
179
- M as MerchantCardHeader,
180
- E as MerchantCardInfo,
181
- v as MerchantCardName,
182
- w as MerchantCardRating,
174
+ E as MerchantCardHeader,
175
+ M as MerchantCardInfo,
176
+ w as MerchantCardName,
177
+ B as MerchantCardRating,
183
178
  L as MerchantCardSkeleton,
184
- ea as MiniEntityNotFoundError,
185
- oa as MiniError,
186
- ta as MiniNetworkError,
187
- p as MinisContainer,
188
- Ra as MinisContentStatus,
189
- Q as MinisRouter,
179
+ Zt as MiniEntityNotFoundError,
180
+ jt as MiniError,
181
+ Jt as MiniNetworkError,
182
+ i as MinisContainer,
183
+ Aa as MinisContentStatus,
184
+ q as MinisRouter,
190
185
  t as NAVIGATION_TYPES,
191
- l as ProductCard,
186
+ u as ProductCard,
192
187
  f as ProductCardBadge,
193
188
  x as ProductCardContainer,
194
- c as ProductCardFavoriteButton,
195
- d as ProductCardImage,
189
+ d as ProductCardFavoriteButton,
190
+ c as ProductCardImage,
196
191
  C as ProductCardImageContainer,
197
192
  g as ProductCardInfo,
198
193
  S as ProductCardPrice,
199
194
  A as ProductCardReviewStars,
200
- F as ProductCardSkeleton,
195
+ v as ProductCardSkeleton,
201
196
  D as ProductCardTitle,
202
197
  T as ProductLink,
203
198
  Cr as ProductVariantPrice,
204
199
  be as Progress,
205
- k as QuantitySelector,
206
- Ne as RadioGroup,
207
- ye as RadioGroupItem,
200
+ N as QuantitySelector,
201
+ ke as RadioGroup,
202
+ _e as RadioGroupItem,
208
203
  Ge as ResizableHandle,
209
204
  Oe as ResizablePanel,
210
205
  He as ResizablePanelGroup,
211
- La as Scope,
212
206
  ze as ScrollArea,
213
207
  We as ScrollBar,
214
- y as Search,
215
- _ as SearchInput,
208
+ _ as Search,
209
+ y as SearchInput,
216
210
  G as SearchProvider,
217
211
  O as SearchResultsList,
218
- Qe as Select,
219
- qe as SelectContent,
220
- Ke as SelectGroup,
212
+ qe as Select,
213
+ Ke as SelectContent,
214
+ Qe as SelectGroup,
221
215
  Ze as SelectItem,
222
216
  je as SelectLabel,
223
217
  Je as SelectScrollDownButton,
@@ -226,61 +220,60 @@ export {
226
220
  ro as SelectTrigger,
227
221
  eo as SelectValue,
228
222
  to as Separator,
229
- po as Sheet,
230
- no as SheetClose,
231
- io as SheetContent,
223
+ io as Sheet,
224
+ po as SheetClose,
225
+ no as SheetContent,
232
226
  mo as SheetDescription,
233
227
  so as SheetFooter,
234
- uo as SheetHeader,
235
- lo as SheetTitle,
228
+ lo as SheetHeader,
229
+ uo as SheetTitle,
236
230
  fo as SheetTrigger,
237
231
  Ao as Skeleton,
238
- Ea as Social,
232
+ Pa as Social,
239
233
  fr as TextInput,
240
234
  co as Toaster,
241
235
  or as Touchable,
242
- K as TransitionLink,
243
- Pa as UserState,
244
- Ta as UserTokenGenerateUserErrorCode,
245
- ur as VideoPlayer,
236
+ Q as TransitionLink,
237
+ ca as UserState,
238
+ Ca as UserTokenGenerateUserErrorCode,
239
+ lr as VideoPlayer,
246
240
  Wr as badgeVariants,
247
- xa as dataURLToBlob,
248
- na as extractBrandTheme,
249
- ca as fileToDataUri,
250
- aa as formatError,
251
- Aa as formatMoney,
252
- ia as formatReviewCount,
253
- ma as getFeaturedImages,
254
- da as getResizedImageUrl,
255
- Ca as getThumbhashBlobURL,
256
- ga as getThumbhashDataURL,
257
- sa as normalizeRating,
258
- la as parseUrl,
241
+ na as dataURLToBlob,
242
+ ra as extractBrandTheme,
243
+ ma as fileToDataUri,
244
+ Xt as formatError,
245
+ xa as formatMoney,
246
+ ea as formatReviewCount,
247
+ oa as getFeaturedImages,
248
+ sa as getResizedImageUrl,
249
+ la as getThumbhashBlobURL,
250
+ ua as getThumbhashDataURL,
251
+ ta as normalizeRating,
252
+ ia as parseUrl,
259
253
  go as toast,
260
254
  st as useAsyncStorage,
261
- yo as useBuyerAttributes,
255
+ _o as useBuyerAttributes,
262
256
  gt as useCloseMini,
263
- Et as useCreateImageContent,
264
- it as useCuratedProducts,
257
+ Mt as useCreateImageContent,
258
+ nt as useCuratedProducts,
265
259
  Lo as useCurrentUser,
266
260
  At as useDeeplink,
267
- yt as useErrorScreen,
268
- kt as useErrorToast,
269
- wo as useFollowedShops,
270
- Fo as useFollowedShopsActions,
261
+ vt as useErrorScreen,
262
+ Bt as useErrorToast,
263
+ Bo as useFollowedShops,
264
+ vo as useFollowedShopsActions,
271
265
  Go as useGenerateUserToken,
272
- Ht as useImagePicker,
266
+ Nt as useImagePicker,
273
267
  xt as useImageUpload,
274
- Ft as useInvokeIntentAction,
275
- zt as useKeyboardAvoidingView,
268
+ _t as useKeyboardAvoidingView,
276
269
  Pt as useNavigateWithTransition,
277
- $t as useOnAppStateChange,
278
- Zt as useOnMiniBlur,
279
- Jt as useOnMiniClose,
280
- qt as useOnMiniFocus,
281
- ko as useOrders,
282
- pt as usePopularProducts,
283
- qo as useProduct,
270
+ Kt as useOnAppStateChange,
271
+ zt as useOnMiniBlur,
272
+ Yt as useOnMiniClose,
273
+ Ht as useOnMiniFocus,
274
+ No as useOrders,
275
+ it as usePopularProducts,
276
+ Ko as useProduct,
284
277
  Yo as useProductList,
285
278
  Ho as useProductListActions,
286
279
  zo as useProductLists,
@@ -288,18 +281,16 @@ export {
288
281
  et as useProductSearch,
289
282
  Jo as useProductVariants,
290
283
  Zo as useProducts,
291
- wt as useQueryIntents,
292
284
  Po as useRecentProducts,
293
285
  ho as useRecentShops,
294
286
  tt as useRecommendedProducts,
295
287
  Rt as useRecommendedShops,
296
- Yt as useRequestPermissions,
288
+ Gt as useRequestPermissions,
297
289
  Ro as useSavedProducts,
298
- Eo as useSavedProductsActions,
299
- lt as useSecureStorage,
300
- Lt as useSelectProduct,
301
- Gt as useShare,
290
+ Mo as useSavedProductsActions,
291
+ ut as useSecureStorage,
292
+ Lt as useShare,
302
293
  ht as useShop,
303
- dt as useShopNavigation
294
+ ct as useShopNavigation
304
295
  };
305
296
  //# 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
@@ -5,13 +5,13 @@ const m = [
5
5
  "bath.jpeg",
6
6
  "teapot.jpg",
7
7
  "shoes.jpeg"
8
- ], S = (o) => {
8
+ ], P = (o) => {
9
9
  let r = 0;
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
13
  }, e = (o, r, t = "99.99", n) => {
14
- const i = S(o) % m.length, c = m[i];
14
+ const i = P(o) % m.length, c = m[i];
15
15
  return {
16
16
  id: o,
17
17
  title: r,
@@ -123,11 +123,11 @@ const m = [
123
123
  name: r,
124
124
  products: t
125
125
  });
126
- function P(o, r) {
126
+ function S(o, r) {
127
127
  window._mockLogs = window._mockLogs || [], window._mockLogs.push({ action: o, params: r });
128
128
  }
129
129
  function f(o, r) {
130
- return (t) => (P(String(o), t), Promise.resolve({
130
+ return (t) => (S(String(o), t), Promise.resolve({
131
131
  ok: !0,
132
132
  data: r,
133
133
  mocked: !0
@@ -449,42 +449,7 @@ function I() {
449
449
  granted: !0
450
450
  },
451
451
  reportError: void 0,
452
- reportFetch: void 0,
453
- queryIntents: {
454
- intents: [
455
- {
456
- intentType: "select:shopify/Product",
457
- provider: "shop",
458
- providerName: "Shop",
459
- displayName: "Select Products",
460
- description: "Let user select products from catalog",
461
- category: "commerce",
462
- version: "1.0.0",
463
- inputSchema: {
464
- type: "object",
465
- properties: {
466
- multiSelect: { type: "boolean", default: !1 },
467
- maxSelections: { type: "number", minimum: 1 }
468
- }
469
- },
470
- outputSchema: {
471
- type: "object",
472
- properties: {
473
- type: { const: "product" },
474
- ids: { type: "array", items: { type: "string" } }
475
- },
476
- required: ["type", "ids"]
477
- }
478
- }
479
- ]
480
- },
481
- invokeIntent: {
482
- resultCode: "SUCCESS",
483
- output: {
484
- type: "product",
485
- ids: ["mock-product-1", "mock-product-2"]
486
- }
487
- }
452
+ reportFetch: void 0
488
453
  }, r = {};
489
454
  for (const t in o)
490
455
  Object.prototype.hasOwnProperty.call(o, t) && (r[t] = f(
@@ -493,11 +458,11 @@ function I() {
493
458
  ));
494
459
  return r;
495
460
  }
496
- const y = () => {
461
+ const w = () => {
497
462
  const o = navigator.userAgent.toLowerCase(), r = /iphone|ipad|ipod/.test(o), t = /android/.test(o);
498
463
  return r || t;
499
464
  }, A = ({ force: o } = {}) => {
500
- y() && !o || window.minisSDK || (window.minisSDK = I(), window.minisParams = {
465
+ w() && !o || window.minisSDK || (window.minisSDK = I(), window.minisParams = {
501
466
  handle: "mock-handle",
502
467
  initialUrl: "/",
503
468
  platform: "web"
package/dist/mocks.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mocks.js","sources":["../src/mocks.ts"],"sourcesContent":["import {\n Product,\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 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 getCuratedProducts: {\n data: [\n createProduct('cur-1', 'Curated Product 1', '79.99'),\n createProduct('cur-2', 'Curated Product 2', '129.99'),\n ],\n pageInfo: createPagination(),\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 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 queryIntents: {\n intents: [\n {\n intentType: 'select:shopify/Product',\n provider: 'shop',\n providerName: 'Shop',\n displayName: 'Select Products',\n description: 'Let user select products from catalog',\n category: 'commerce',\n version: '1.0.0',\n inputSchema: {\n type: 'object',\n properties: {\n multiSelect: {type: 'boolean', default: false},\n maxSelections: {type: 'number', minimum: 1},\n },\n },\n outputSchema: {\n type: 'object',\n properties: {\n type: {const: 'product'},\n ids: {type: 'array', items: {type: 'string'}},\n },\n required: ['type', 'ids'],\n },\n },\n ],\n },\n invokeIntent: {\n resultCode: 'SUCCESS',\n output: {\n type: 'product',\n ids: ['mock-product-1', 'mock-product-2'],\n },\n },\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","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":";;AAQA,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,k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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 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 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 getCuratedProducts: {\n data: [\n createProduct('cur-1', 'Curated Product 1', '79.99'),\n createProduct('cur-2', 'Curated Product 2', '129.99'),\n ],\n pageInfo: createPagination(),\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 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","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":";;AAQA,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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QACd,UAAU;AAAA,MAAA;AAAA,IAEd;AAAA,IACA,YAAY;AAAA,MACV,MAAM;AAAA,QACJ;AAAA,UACE,UAAU;AAAA,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;"}
package/eslint/config.cjs CHANGED
@@ -42,6 +42,7 @@ module.exports = {
42
42
  'shop-minis/no-env-without-fallback': 'error',
43
43
  'shop-minis/no-hardcoded-asset-paths': 'error',
44
44
  'shop-minis/no-internal-imports': 'error',
45
+ 'shop-minis/no-javascript-files': 'error',
45
46
  'shop-minis/no-secrets': ['error'],
46
47
  'shop-minis/prefer-sdk-components': 'warn',
47
48
  'shop-minis/prefer-sdk-hooks': 'warn',
package/eslint/index.cjs CHANGED
@@ -8,6 +8,7 @@ const noDynamicAssetPaths = require('./rules/no-dynamic-asset-paths.cjs')
8
8
  const noEnvWithoutFallback = require('./rules/no-env-without-fallback.cjs')
9
9
  const noHardcodedAssetPaths = require('./rules/no-hardcoded-asset-paths.cjs')
10
10
  const noInternalImports = require('./rules/no-internal-imports.cjs')
11
+ const noJavaScriptFiles = require('./rules/no-javascript-files.cjs')
11
12
  const noSecrets = require('./rules/no-secrets.cjs')
12
13
  const preferSdkComponents = require('./rules/prefer-sdk-components.cjs')
13
14
  const preferSdkHooks = require('./rules/prefer-sdk-hooks.cjs')
@@ -19,6 +20,7 @@ module.exports = {
19
20
  'no-env-without-fallback': noEnvWithoutFallback,
20
21
  'no-hardcoded-asset-paths': noHardcodedAssetPaths,
21
22
  'no-internal-imports': noInternalImports,
23
+ 'no-javascript-files': noJavaScriptFiles,
22
24
  'no-secrets': noSecrets,
23
25
  'prefer-sdk-components': preferSdkComponents,
24
26
  'prefer-sdk-hooks': preferSdkHooks,
@@ -0,0 +1,44 @@
1
+ /**
2
+ * ESLint rule to disallow JavaScript files in Shop Minis projects
3
+ * @fileoverview Require TypeScript files (.ts/.tsx) instead of JavaScript (.js/.jsx)
4
+ */
5
+
6
+ module.exports = {
7
+ meta: {
8
+ type: 'problem',
9
+ docs: {
10
+ description: 'Disallow JavaScript files - use TypeScript instead',
11
+ category: 'Best Practices',
12
+ recommended: true,
13
+ },
14
+ messages: {
15
+ noJavaScriptFiles:
16
+ 'JavaScript files (.js/.jsx) are not allowed in Shop Minis projects. Please rename this file to use TypeScript (.ts/.tsx) instead.',
17
+ },
18
+ schema: [],
19
+ },
20
+
21
+ create(context) {
22
+ const filename = context.filename || context.getFilename()
23
+
24
+ // Skip config files in the root directory
25
+ if (
26
+ filename.endsWith('eslint.config.js') ||
27
+ filename.endsWith('vite.config.js') ||
28
+ filename.endsWith('tailwind.config.js')
29
+ ) {
30
+ return {}
31
+ }
32
+
33
+ return {
34
+ Program(node) {
35
+ if (filename.endsWith('.js') || filename.endsWith('.jsx')) {
36
+ context.report({
37
+ node,
38
+ messageId: 'noJavaScriptFiles',
39
+ })
40
+ }
41
+ },
42
+ }
43
+ },
44
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shopify/shop-minis-react",
3
3
  "license": "SEE LICENSE IN LICENSE.txt",
4
- "version": "0.0.0-snapshot.20251224113248",
4
+ "version": "0.0.0-snapshot.20260107140531",
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.0.0-snapshot.20251224113248",
49
+ "@shopify/shop-minis-platform": "0.0.0-snapshot.20260107140531",
50
50
  "@tailwindcss/vite": "4.1.8",
51
51
  "@tanstack/react-query": "5.86.0",
52
52
  "@types/color": "3.0.6",
@@ -41,9 +41,6 @@ export * from './shop/useRecommendedShops'
41
41
  // - Content Hooks
42
42
  export * from './content/useCreateImageContent'
43
43
 
44
- // - Intent Hooks
45
- export * from './intents'
46
-
47
44
  // - Utility Hooks
48
45
  export * from './util/useErrorToast'
49
46
  export * from './util/useErrorScreen'
package/src/mocks.ts CHANGED
@@ -551,41 +551,6 @@ export function makeMockActions(): ShopActions {
551
551
  },
552
552
  reportError: undefined,
553
553
  reportFetch: undefined,
554
- queryIntents: {
555
- intents: [
556
- {
557
- intentType: 'select:shopify/Product',
558
- provider: 'shop',
559
- providerName: 'Shop',
560
- displayName: 'Select Products',
561
- description: 'Let user select products from catalog',
562
- category: 'commerce',
563
- version: '1.0.0',
564
- inputSchema: {
565
- type: 'object',
566
- properties: {
567
- multiSelect: {type: 'boolean', default: false},
568
- maxSelections: {type: 'number', minimum: 1},
569
- },
570
- },
571
- outputSchema: {
572
- type: 'object',
573
- properties: {
574
- type: {const: 'product'},
575
- ids: {type: 'array', items: {type: 'string'}},
576
- },
577
- required: ['type', 'ids'],
578
- },
579
- },
580
- ],
581
- },
582
- invokeIntent: {
583
- resultCode: 'SUCCESS',
584
- output: {
585
- type: 'product',
586
- ids: ['mock-product-1', 'mock-product-2'],
587
- },
588
- },
589
554
  } as const
590
555
 
591
556
  const mock: Partial<ShopActions> = {}
@@ -1,10 +0,0 @@
1
- import { useHandleAction as o } from "../../internal/useHandleAction.js";
2
- import { useShopActions as t } from "../../internal/useShopActions.js";
3
- const r = () => {
4
- const n = t();
5
- return o(n.invokeIntent);
6
- };
7
- export {
8
- r as useInvokeIntentAction
9
- };
10
- //# sourceMappingURL=useInvokeIntentAction.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useInvokeIntentAction.js","sources":["../../../src/hooks/intents/useInvokeIntentAction.ts"],"sourcesContent":["import {useHandleAction} from '../../internal/useHandleAction'\nimport {useShopActions} from '../../internal/useShopActions'\n\n/**\n * Hook to invoke an intent\n *\n * Unified API for invoking intents.\n */\nexport const useInvokeIntentAction = () => {\n const actions = useShopActions()\n return useHandleAction(actions.invokeIntent)\n}\n"],"names":["useInvokeIntentAction","actions","useShopActions","useHandleAction"],"mappings":";;AAQO,MAAMA,IAAwB,MAAM;AACzC,QAAMC,IAAUC,EAAe;AACxB,SAAAC,EAAgBF,EAAQ,YAAY;AAC7C;"}
@@ -1,10 +0,0 @@
1
- import { useHandleAction as n } from "../../internal/useHandleAction.js";
2
- import { useShopActions as o } from "../../internal/useShopActions.js";
3
- const s = () => {
4
- const t = o();
5
- return n(t.queryIntents);
6
- };
7
- export {
8
- s as useQueryIntents
9
- };
10
- //# sourceMappingURL=useQueryIntents.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useQueryIntents.js","sources":["../../../src/hooks/intents/useQueryIntents.ts"],"sourcesContent":["import {useHandleAction} from '../../internal/useHandleAction'\nimport {useShopActions} from '../../internal/useShopActions'\n\n/**\n * Hook to query available intents\n *\n * Returns intents that match the query criteria.\n * Works for both first-party Shop intents and third-party Mini intents.\n *\n * @example\n * const queryIntents = useQueryIntents()\n *\n * // Get all intents\n * const allIntents = await queryIntents()\n *\n * // Filter by category\n * const mediaIntents = await queryIntents({category: 'media'})\n *\n * // Search\n * const results = await queryIntents({search: 'product'})\n */\nexport const useQueryIntents = () => {\n const actions = useShopActions()\n return useHandleAction(actions.queryIntents)\n}\n"],"names":["useQueryIntents","actions","useShopActions","useHandleAction"],"mappings":";;AAqBO,MAAMA,IAAkB,MAAM;AACnC,QAAMC,IAAUC,EAAe;AACxB,SAAAC,EAAgBF,EAAQ,YAAY;AAC7C;"}
@@ -1,21 +0,0 @@
1
- import { useCallback as r } from "react";
2
- import { useInvokeIntentAction as n } from "./useInvokeIntentAction.js";
3
- const c = () => {
4
- const t = n();
5
- return r(
6
- async (o) => {
7
- const e = await t({
8
- provider: "shop",
9
- intentType: "select:shopify/Product",
10
- input: o
11
- });
12
- if (e.resultCode === "SUCCESS")
13
- return e.output;
14
- },
15
- [t]
16
- );
17
- };
18
- export {
19
- c as useSelectProduct
20
- };
21
- //# sourceMappingURL=useSelectProduct.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useSelectProduct.js","sources":["../../../src/hooks/intents/useSelectProduct.ts"],"sourcesContent":["import {useCallback} from 'react'\n\nimport {useInvokeIntentAction} from './useInvokeIntentAction'\n\n/**\n * Convenience hook for selecting products\n *\n * Wraps the unified invokeIntent action with product-specific defaults.\n *\n * @example\n * const selectProduct = useSelectProduct()\n *\n * const result = await selectProduct({\n * multiSelect: true,\n * maxSelections: 5\n * })\n *\n * if (result) {\n * console.log('Selected IDs:', result.ids)\n * }\n */\nexport const useSelectProduct = () => {\n const invokeIntent = useInvokeIntentAction()\n\n return useCallback(\n async (input: {\n multiSelect?: boolean\n maxSelections?: number\n title?: string\n subtitle?: string\n shopId?: string\n categories?: string[]\n }) => {\n const result = await invokeIntent({\n provider: 'shop',\n intentType: 'select:shopify/Product',\n input,\n })\n\n if (result.resultCode === 'SUCCESS') {\n return result.output as {type: 'product'; ids: string[]}\n }\n\n return undefined\n },\n [invokeIntent]\n )\n}\n"],"names":["useSelectProduct","invokeIntent","useInvokeIntentAction","useCallback","input","result"],"mappings":";;AAqBO,MAAMA,IAAmB,MAAM;AACpC,QAAMC,IAAeC,EAAsB;AAEpC,SAAAC;AAAA,IACL,OAAOC,MAOD;AACE,YAAAC,IAAS,MAAMJ,EAAa;AAAA,QAChC,UAAU;AAAA,QACV,YAAY;AAAA,QACZ,OAAAG;AAAA,MAAA,CACD;AAEG,UAAAC,EAAO,eAAe;AACxB,eAAOA,EAAO;AAAA,IAIlB;AAAA,IACA,CAACJ,CAAY;AAAA,EACf;AACF;"}
@@ -1,36 +0,0 @@
1
- var E = /* @__PURE__ */ ((_) => (_.OPENID = "openid", _.USER_SETTINGS_READ = "user_settings:read", _.PROFILE = "profile", _.PRODUCTS_RECENT_READ = "products:recent:read", _.PRODUCTS_RECOMMENDATIONS_READ = "products:recommendations:read", _.SHOPS_RECENT_READ = "shops:recent:read", _.SHOPS_FOLLOWS = "shops:follows", _.SHOPS_FOLLOWS_READ = "shops:follows:read", _.SHOPS_FOLLOWS_WRITE = "shops:follows:write", _.SHOPS_RECOMMENDATIONS_READ = "shops:recommendations:read", _.ORDERS = "orders", _.PRODUCT_LIST = "product_list", _.PRODUCT_LIST_READ = "product_list:read", _.PRODUCT_LIST_WRITE = "product_list:write", _.PRODUCT_LIST_ITEM_WRITE = "product_list_item:write", _))(E || {});
2
- const r = {
3
- // User
4
- GENERATE_USER_TOKEN: "openid",
5
- GET_ACCOUNT_INFORMATION: "profile",
6
- GET_BUYER_ATTRIBUTES: "profile",
7
- GET_CURRENT_USER: "user_settings:read",
8
- // Shops
9
- GET_FOLLOWED_SHOPS: "shops:follows:read",
10
- GET_RECENT_SHOPS: "shops:recent:read",
11
- GET_RECOMMENDED_SHOPS: "shops:recommendations:read",
12
- FOLLOW_SHOP: "shops:follows:write",
13
- UNFOLLOW_SHOP: "shops:follows:write",
14
- // Products
15
- GET_RECENT_PRODUCTS: "products:recent:read",
16
- GET_RECOMMENDED_PRODUCTS: "products:recommendations:read",
17
- // Orders
18
- GET_ORDERS: "orders",
19
- // Product lists
20
- ADD_PRODUCT_LIST: "product_list:write",
21
- ADD_PRODUCT_LIST_ITEM: "product_list_item:write",
22
- FAVORITE: "product_list:write",
23
- UNFAVORITE: "product_list:write",
24
- REMOVE_PRODUCT_LIST: "product_list:write",
25
- REMOVE_PRODUCT_LIST_ITEM: "product_list_item:write",
26
- RENAME_PRODUCT_LIST: "product_list:write",
27
- GET_SAVED_PRODUCTS: "product_list:read",
28
- GET_PRODUCT_LIST: "product_list:read",
29
- GET_PRODUCT_LISTS: "product_list:read"
30
- /* PRODUCT_LIST_READ */
31
- };
32
- export {
33
- r as ActionToScopesMapping,
34
- E as Scope
35
- };
36
- //# sourceMappingURL=scopes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scopes.js","sources":["../../../../../shop-minis-platform/src/actions/scopes.ts"],"sourcesContent":["import {ShopActionEvents} from '@shopify/shop-minis-platform/actions'\n\n// This enum should always match `MiniScopeEnum` in `shop-types`\n/* eslint-disable @shopify/typescript/prefer-pascal-case-enums */\nexport enum Scope {\n // User\n OPENID = 'openid',\n USER_SETTINGS_READ = 'user_settings:read',\n PROFILE = 'profile',\n\n // Products\n PRODUCTS_RECENT_READ = 'products:recent:read',\n PRODUCTS_RECOMMENDATIONS_READ = 'products:recommendations:read',\n\n // Shops\n SHOPS_RECENT_READ = 'shops:recent:read',\n SHOPS_FOLLOWS = 'shops:follows',\n SHOPS_FOLLOWS_READ = 'shops:follows:read',\n SHOPS_FOLLOWS_WRITE = 'shops:follows:write',\n SHOPS_RECOMMENDATIONS_READ = 'shops:recommendations:read',\n\n // Orders\n ORDERS = 'orders',\n\n // Product lists\n PRODUCT_LIST = 'product_list',\n PRODUCT_LIST_READ = 'product_list:read',\n PRODUCT_LIST_WRITE = 'product_list:write',\n PRODUCT_LIST_ITEM_WRITE = 'product_list_item:write',\n}\n/* eslint-enable @shopify/typescript/prefer-pascal-case-enums */\n\nexport const ActionToScopesMapping: {\n [key in keyof ShopActionEvents]?: Scope\n} = {\n // User\n GENERATE_USER_TOKEN: Scope.OPENID,\n GET_ACCOUNT_INFORMATION: Scope.PROFILE,\n GET_BUYER_ATTRIBUTES: Scope.PROFILE,\n GET_CURRENT_USER: Scope.USER_SETTINGS_READ,\n\n // Shops\n GET_FOLLOWED_SHOPS: Scope.SHOPS_FOLLOWS_READ,\n GET_RECENT_SHOPS: Scope.SHOPS_RECENT_READ,\n GET_RECOMMENDED_SHOPS: Scope.SHOPS_RECOMMENDATIONS_READ,\n FOLLOW_SHOP: Scope.SHOPS_FOLLOWS_WRITE,\n UNFOLLOW_SHOP: Scope.SHOPS_FOLLOWS_WRITE,\n\n // Products\n GET_RECENT_PRODUCTS: Scope.PRODUCTS_RECENT_READ,\n GET_RECOMMENDED_PRODUCTS: Scope.PRODUCTS_RECOMMENDATIONS_READ,\n\n // Orders\n GET_ORDERS: Scope.ORDERS,\n\n // Product lists\n ADD_PRODUCT_LIST: Scope.PRODUCT_LIST_WRITE,\n ADD_PRODUCT_LIST_ITEM: Scope.PRODUCT_LIST_ITEM_WRITE,\n FAVORITE: Scope.PRODUCT_LIST_WRITE,\n UNFAVORITE: Scope.PRODUCT_LIST_WRITE,\n REMOVE_PRODUCT_LIST: Scope.PRODUCT_LIST_WRITE,\n REMOVE_PRODUCT_LIST_ITEM: Scope.PRODUCT_LIST_ITEM_WRITE,\n RENAME_PRODUCT_LIST: Scope.PRODUCT_LIST_WRITE,\n GET_SAVED_PRODUCTS: Scope.PRODUCT_LIST_READ,\n GET_PRODUCT_LIST: Scope.PRODUCT_LIST_READ,\n GET_PRODUCT_LISTS: Scope.PRODUCT_LIST_READ,\n} as const\n"],"names":["Scope","ActionToScopesMapping"],"mappings":"AAIY,IAAAA,sBAAAA,OAEVA,EAAA,SAAS,UACTA,EAAA,qBAAqB,sBACrBA,EAAA,UAAU,WAGVA,EAAA,uBAAuB,wBACvBA,EAAA,gCAAgC,iCAGhCA,EAAA,oBAAoB,qBACpBA,EAAA,gBAAgB,iBAChBA,EAAA,qBAAqB,sBACrBA,EAAA,sBAAsB,uBACtBA,EAAA,6BAA6B,8BAG7BA,EAAA,SAAS,UAGTA,EAAA,eAAe,gBACfA,EAAA,oBAAoB,qBACpBA,EAAA,qBAAqB,sBACrBA,EAAA,0BAA0B,2BAxBhBA,IAAAA,KAAA,CAAA,CAAA;AA4BL,MAAMC,IAET;AAAA;AAAA,EAEF,qBAAqB;AAAA,EACrB,yBAAyB;AAAA,EACzB,sBAAsB;AAAA,EACtB,kBAAkB;AAAA;AAAA,EAGlB,oBAAoB;AAAA,EACpB,kBAAkB;AAAA,EAClB,uBAAuB;AAAA,EACvB,aAAa;AAAA,EACb,eAAe;AAAA;AAAA,EAGf,qBAAqB;AAAA,EACrB,0BAA0B;AAAA;AAAA,EAG1B,YAAY;AAAA;AAAA,EAGZ,kBAAkB;AAAA,EAClB,uBAAuB;AAAA,EACvB,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,qBAAqB;AAAA,EACrB,0BAA0B;AAAA,EAC1B,qBAAqB;AAAA,EACrB,oBAAoB;AAAA,EACpB,kBAAkB;AAAA,EAClB,mBAAmB;AAAA;AACrB;"}
@@ -1,38 +0,0 @@
1
- /**
2
- * Shop Intents Hooks
3
- *
4
- * React hooks for discovering and invoking intents.
5
- *
6
- * @example
7
- * import { useQueryIntents, useInvokeIntentAction } from '@shopify/shop-minis-react'
8
- *
9
- * const MyComponent = () => {
10
- * const queryIntents = useQueryIntents()
11
- * const invokeIntent = useInvokeIntentAction()
12
- *
13
- * const handleSelect = async () => {
14
- * // Query available intents
15
- * const intents = await queryIntents({category: 'commerce'})
16
- *
17
- * // Invoke intent
18
- * const result = await invokeIntent({
19
- * provider: 'shop',
20
- * intentType: 'select:shopify/Product',
21
- * input: {multiSelect: true}
22
- * })
23
- *
24
- * if (result.resultCode === 'SUCCESS') {
25
- * console.log('Selected:', result.output.ids)
26
- * }
27
- * }
28
- *
29
- * return <button onClick={handleSelect}>Select Products</button>
30
- * }
31
- */
32
-
33
- // Core intent actions
34
- export {useQueryIntents} from './useQueryIntents'
35
- export {useInvokeIntentAction} from './useInvokeIntentAction'
36
-
37
- // Convenience hooks (wrap invokeIntent with specific intent types)
38
- export {useSelectProduct} from './useSelectProduct'
@@ -1,12 +0,0 @@
1
- import {useHandleAction} from '../../internal/useHandleAction'
2
- import {useShopActions} from '../../internal/useShopActions'
3
-
4
- /**
5
- * Hook to invoke an intent
6
- *
7
- * Unified API for invoking intents.
8
- */
9
- export const useInvokeIntentAction = () => {
10
- const actions = useShopActions()
11
- return useHandleAction(actions.invokeIntent)
12
- }
@@ -1,25 +0,0 @@
1
- import {useHandleAction} from '../../internal/useHandleAction'
2
- import {useShopActions} from '../../internal/useShopActions'
3
-
4
- /**
5
- * Hook to query available intents
6
- *
7
- * Returns intents that match the query criteria.
8
- * Works for both first-party Shop intents and third-party Mini intents.
9
- *
10
- * @example
11
- * const queryIntents = useQueryIntents()
12
- *
13
- * // Get all intents
14
- * const allIntents = await queryIntents()
15
- *
16
- * // Filter by category
17
- * const mediaIntents = await queryIntents({category: 'media'})
18
- *
19
- * // Search
20
- * const results = await queryIntents({search: 'product'})
21
- */
22
- export const useQueryIntents = () => {
23
- const actions = useShopActions()
24
- return useHandleAction(actions.queryIntents)
25
- }
@@ -1,48 +0,0 @@
1
- import {useCallback} from 'react'
2
-
3
- import {useInvokeIntentAction} from './useInvokeIntentAction'
4
-
5
- /**
6
- * Convenience hook for selecting products
7
- *
8
- * Wraps the unified invokeIntent action with product-specific defaults.
9
- *
10
- * @example
11
- * const selectProduct = useSelectProduct()
12
- *
13
- * const result = await selectProduct({
14
- * multiSelect: true,
15
- * maxSelections: 5
16
- * })
17
- *
18
- * if (result) {
19
- * console.log('Selected IDs:', result.ids)
20
- * }
21
- */
22
- export const useSelectProduct = () => {
23
- const invokeIntent = useInvokeIntentAction()
24
-
25
- return useCallback(
26
- async (input: {
27
- multiSelect?: boolean
28
- maxSelections?: number
29
- title?: string
30
- subtitle?: string
31
- shopId?: string
32
- categories?: string[]
33
- }) => {
34
- const result = await invokeIntent({
35
- provider: 'shop',
36
- intentType: 'select:shopify/Product',
37
- input,
38
- })
39
-
40
- if (result.resultCode === 'SUCCESS') {
41
- return result.output as {type: 'product'; ids: string[]}
42
- }
43
-
44
- return undefined
45
- },
46
- [invokeIntent]
47
- )
48
- }