@shopify/shop-minis-react 0.0.0-snapshot.20251222174301 → 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.
Files changed (34) hide show
  1. package/dist/index.js +120 -135
  2. package/dist/index.js.map +1 -1
  3. package/eslint/config.cjs +1 -0
  4. package/eslint/index.cjs +2 -0
  5. package/eslint/rules/no-javascript-files.cjs +44 -0
  6. package/package.json +2 -2
  7. package/src/hooks/index.ts +0 -3
  8. package/dist/hooks/intents/useBarcodeScanner.js +0 -10
  9. package/dist/hooks/intents/useBarcodeScanner.js.map +0 -1
  10. package/dist/hooks/intents/useContentShare.js +0 -10
  11. package/dist/hooks/intents/useContentShare.js.map +0 -1
  12. package/dist/hooks/intents/useImageCapture.js +0 -10
  13. package/dist/hooks/intents/useImageCapture.js.map +0 -1
  14. package/dist/hooks/intents/useLocationSelection.js +0 -10
  15. package/dist/hooks/intents/useLocationSelection.js.map +0 -1
  16. package/dist/hooks/intents/usePaymentRequest.js +0 -10
  17. package/dist/hooks/intents/usePaymentRequest.js.map +0 -1
  18. package/dist/hooks/intents/useProductSelection.js +0 -10
  19. package/dist/hooks/intents/useProductSelection.js.map +0 -1
  20. package/dist/internal/useHandleIntent.js +0 -26
  21. package/dist/internal/useHandleIntent.js.map +0 -1
  22. package/dist/internal/useShopIntents.js +0 -7
  23. package/dist/internal/useShopIntents.js.map +0 -1
  24. package/dist/shop-minis-platform/src/intents/shared.js +0 -19
  25. package/dist/shop-minis-platform/src/intents/shared.js.map +0 -1
  26. package/src/hooks/intents/index.ts +0 -42
  27. package/src/hooks/intents/useBarcodeScanner.ts +0 -43
  28. package/src/hooks/intents/useContentShare.ts +0 -47
  29. package/src/hooks/intents/useImageCapture.ts +0 -45
  30. package/src/hooks/intents/useLocationSelection.ts +0 -45
  31. package/src/hooks/intents/usePaymentRequest.ts +0 -47
  32. package/src/hooks/intents/useProductSelection.ts +0 -45
  33. package/src/internal/useHandleIntent.ts +0 -101
  34. package/src/internal/useShopIntents.ts +0 -13
package/dist/index.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import { DATA_NAVIGATION_TYPE_ATTRIBUTE as o, NAVIGATION_TYPES as t } from "./types/index.js";
2
- import { MinisContainer as n } from "./components/MinisContainer.js";
3
- import { AddToCartButton as m } 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 B, MerchantCardInfo as E, MerchantCardName as M, MerchantCardRating as w } from "./components/commerce/merchant-card.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
8
  import { ProductCardSkeleton as v } from "./components/commerce/product-card-skeleton.js";
9
- import { MerchantCardSkeleton as U } from "./components/commerce/merchant-card-skeleton.js";
9
+ import { MerchantCardSkeleton as L } from "./components/commerce/merchant-card-skeleton.js";
10
10
  import { QuantitySelector as N } from "./components/commerce/quantity-selector.js";
11
- import { Search as y, SearchInput as _, SearchProvider as G, SearchResultsList as O } from "./components/commerce/search.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
14
  import { MinisRouter as q } from "./components/navigation/minis-router.js";
@@ -19,42 +19,42 @@ import { Image as rr } from "./components/atoms/image.js";
19
19
  import { Touchable as or } from "./components/atoms/touchable.js";
20
20
  import { LongPressDetector as ar } from "./components/atoms/long-press-detector.js";
21
21
  import { AlertDialogAtom as pr } from "./components/atoms/alert-dialog.js";
22
- import { List as ir } from "./components/atoms/list.js";
23
- import { VideoPlayer as ur } from "./components/atoms/video-player.js";
22
+ import { List as mr } from "./components/atoms/list.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 Mr, AlertDialogCancel as wr, AlertDialogContent as Fr, AlertDialogDescription as vr, AlertDialogFooter as Lr, AlertDialogHeader as Ur, AlertDialogOverlay as br, AlertDialogPortal as Nr, AlertDialogTitle as kr, 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
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
- import { Dialog as ie, 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 Be, DrawerTitle as Ee, DrawerTrigger as Me } from "./components/ui/drawer.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
37
  import { Input as Fe } from "./components/ui/input.js";
38
- import { Label as Le } from "./components/ui/label.js";
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 ke, 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
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 no, SheetClose as po, SheetContent as mo, SheetDescription as io, 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";
52
+ import { useSavedProductsActions as Mo } from "./hooks/user/useSavedProductsActions.js";
53
+ import { useFollowedShops as Bo } from "./hooks/user/useFollowedShops.js";
54
54
  import { useFollowedShopsActions as vo } from "./hooks/user/useFollowedShopsActions.js";
55
- import { useCurrentUser as Uo } from "./hooks/user/useCurrentUser.js";
55
+ import { useCurrentUser as Lo } from "./hooks/user/useCurrentUser.js";
56
56
  import { useOrders as No } from "./hooks/user/useOrders.js";
57
- import { useBuyerAttributes as yo } from "./hooks/user/useBuyerAttributes.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";
@@ -65,64 +65,57 @@ 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 nt } from "./hooks/product/usePopularProducts.js";
69
- import { useCuratedProducts as mt } 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 { useProductSelection as wt } from "./hooks/intents/useProductSelection.js";
81
- import { useImageCapture as vt } from "./hooks/intents/useImageCapture.js";
82
- import { useContentShare as Ut } from "./hooks/intents/useContentShare.js";
83
- import { useLocationSelection as Nt } from "./hooks/intents/useLocationSelection.js";
84
- import { useBarcodeScanner as yt } from "./hooks/intents/useBarcodeScanner.js";
85
- import { usePaymentRequest as Gt } from "./hooks/intents/usePaymentRequest.js";
86
- import { useErrorToast as Ht } from "./hooks/util/useErrorToast.js";
87
- import { useErrorScreen as zt } from "./hooks/util/useErrorScreen.js";
88
- import { useShare as Yt } from "./hooks/util/useShare.js";
89
- import { useImagePicker as Kt } from "./hooks/util/useImagePicker.js";
90
- import { useKeyboardAvoidingView as Zt } from "./hooks/util/useKeyboardAvoidingView.js";
91
- import { useRequestPermissions as Jt } from "./hooks/util/useRequestPermissions.js";
92
- import { useOnMiniFocus as $t } from "./hooks/events/useOnMiniFocus.js";
93
- import { useOnMiniBlur as ea } from "./hooks/events/useOnMiniBlur.js";
94
- import { useOnMiniClose as ta } from "./hooks/events/useOnMiniClose.js";
95
- import { useOnAppStateChange as na } from "./hooks/events/useOnAppStateChange.js";
96
- import { MiniEntityNotFoundError as ma, MiniError as ia, MiniNetworkError as sa, formatError as ua } from "./utils/errors.js";
97
- import { extractBrandTheme as fa, formatReviewCount as xa, getFeaturedImages as ca, normalizeRating as da } from "./utils/merchant-card.js";
98
- import { parseUrl as ga } from "./utils/parseUrl.js";
99
- import { dataURLToBlob as Aa, fileToDataUri as Da, getResizedImageUrl as Pa, getThumbhashBlobURL as Ta, getThumbhashDataURL as ha } from "./utils/image.js";
100
- import { formatMoney as Ra } from "./utils/formatMoney.js";
101
- import { UserState as Ea, UserTokenGenerateUserErrorCode as Ma } from "./shop-minis-platform/src/types/user.js";
102
- import { ContentCreateUserErrorCode as Fa, MinisContentStatus as va } from "./shop-minis-platform/src/types/content.js";
103
- import { Social as Ua } from "./shop-minis-platform/src/types/share.js";
104
- import { DATA_FETCHING_DEFAULT_FETCH_POLICY as Na, DATA_FETCHING_DEFAULT_PAGE_SIZE as ka } from "./shop-minis-platform/src/constants.js";
105
- import { IntentResultCode as _a, handleIntentResult as Ga } from "./shop-minis-platform/src/intents/shared.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";
106
99
  export {
107
100
  Sr as Accordion,
108
101
  Ar as AccordionContent,
109
102
  Dr as AccordionItem,
110
103
  Pr as AccordionTrigger,
111
- m as AddToCartButton,
104
+ n as AddToCartButton,
112
105
  hr as Alert,
113
106
  Ir as AlertDescription,
114
- Er as AlertDialog,
115
- Mr as AlertDialogAction,
107
+ Mr as AlertDialog,
108
+ wr as AlertDialogAction,
116
109
  pr as AlertDialogAtom,
117
- wr as AlertDialogCancel,
110
+ Br as AlertDialogCancel,
118
111
  Fr as AlertDialogContent,
119
112
  vr as AlertDialogDescription,
120
- Lr as AlertDialogFooter,
121
- Ur as AlertDialogHeader,
113
+ Ur as AlertDialogFooter,
114
+ Lr as AlertDialogHeader,
122
115
  br as AlertDialogOverlay,
123
116
  Nr as AlertDialogPortal,
124
117
  kr as AlertDialogTitle,
125
- yr as AlertDialogTrigger,
118
+ _r as AlertDialogTrigger,
126
119
  Rr as AlertTitle,
127
120
  Gr as Avatar,
128
121
  Or as AvatarFallback,
@@ -143,19 +136,19 @@ export {
143
136
  te as CarouselNext,
144
137
  ae as CarouselPrevious,
145
138
  pe as Checkbox,
146
- Fa as ContentCreateUserErrorCode,
147
- cr as ContentWrapper,
148
- Na as DATA_FETCHING_DEFAULT_FETCH_POLICY,
149
- ka as DATA_FETCHING_DEFAULT_PAGE_SIZE,
139
+ Sa as ContentCreateUserErrorCode,
140
+ dr as ContentWrapper,
141
+ ha as DATA_FETCHING_DEFAULT_FETCH_POLICY,
142
+ Ia as DATA_FETCHING_DEFAULT_PAGE_SIZE,
150
143
  o as DATA_NAVIGATION_TYPE_ATTRIBUTE,
151
- ie as Dialog,
144
+ me as Dialog,
152
145
  se as DialogClose,
153
- ue as DialogContent,
154
- le as DialogDescription,
146
+ le as DialogContent,
147
+ ue as DialogDescription,
155
148
  fe as DialogFooter,
156
149
  xe as DialogHeader,
157
- ce as DialogOverlay,
158
- de as DialogPortal,
150
+ de as DialogOverlay,
151
+ ce as DialogPortal,
159
152
  Ce as DialogTitle,
160
153
  ge as DialogTrigger,
161
154
  Ae as Drawer,
@@ -165,37 +158,36 @@ export {
165
158
  he as DrawerFooter,
166
159
  Ie as DrawerHeader,
167
160
  Re as DrawerOverlay,
168
- Be as DrawerPortal,
169
- Ee as DrawerTitle,
170
- Me as DrawerTrigger,
161
+ Ee as DrawerPortal,
162
+ Me as DrawerTitle,
163
+ we as DrawerTrigger,
171
164
  V as FavoriteButton,
172
165
  X as IconButton,
173
166
  rr as Image,
174
167
  W as ImageContentWrapper,
175
168
  Fe as Input,
176
- _a as IntentResultCode,
177
- Le as Label,
178
- ir as List,
169
+ Ue as Label,
170
+ mr as List,
179
171
  ar as LongPressDetector,
180
172
  I as MerchantCard,
181
173
  R as MerchantCardContainer,
182
- B as MerchantCardHeader,
183
- E as MerchantCardInfo,
184
- M as MerchantCardName,
185
- w as MerchantCardRating,
186
- U as MerchantCardSkeleton,
187
- ma as MiniEntityNotFoundError,
188
- ia as MiniError,
189
- sa as MiniNetworkError,
190
- n as MinisContainer,
191
- va as MinisContentStatus,
174
+ E as MerchantCardHeader,
175
+ M as MerchantCardInfo,
176
+ w as MerchantCardName,
177
+ B as MerchantCardRating,
178
+ L as MerchantCardSkeleton,
179
+ Zt as MiniEntityNotFoundError,
180
+ jt as MiniError,
181
+ Jt as MiniNetworkError,
182
+ i as MinisContainer,
183
+ Aa as MinisContentStatus,
192
184
  q as MinisRouter,
193
185
  t as NAVIGATION_TYPES,
194
- l as ProductCard,
186
+ u as ProductCard,
195
187
  f as ProductCardBadge,
196
188
  x as ProductCardContainer,
197
- c as ProductCardFavoriteButton,
198
- d as ProductCardImage,
189
+ d as ProductCardFavoriteButton,
190
+ c as ProductCardImage,
199
191
  C as ProductCardImageContainer,
200
192
  g as ProductCardInfo,
201
193
  S as ProductCardPrice,
@@ -207,14 +199,14 @@ export {
207
199
  be as Progress,
208
200
  N as QuantitySelector,
209
201
  ke as RadioGroup,
210
- ye as RadioGroupItem,
202
+ _e as RadioGroupItem,
211
203
  Ge as ResizableHandle,
212
204
  Oe as ResizablePanel,
213
205
  He as ResizablePanelGroup,
214
206
  ze as ScrollArea,
215
207
  We as ScrollBar,
216
- y as Search,
217
- _ as SearchInput,
208
+ _ as Search,
209
+ y as SearchInput,
218
210
  G as SearchProvider,
219
211
  O as SearchResultsList,
220
212
  qe as Select,
@@ -228,84 +220,77 @@ export {
228
220
  ro as SelectTrigger,
229
221
  eo as SelectValue,
230
222
  to as Separator,
231
- no as Sheet,
223
+ io as Sheet,
232
224
  po as SheetClose,
233
- mo as SheetContent,
234
- io as SheetDescription,
225
+ no as SheetContent,
226
+ mo as SheetDescription,
235
227
  so as SheetFooter,
236
- uo as SheetHeader,
237
- lo as SheetTitle,
228
+ lo as SheetHeader,
229
+ uo as SheetTitle,
238
230
  fo as SheetTrigger,
239
231
  Ao as Skeleton,
240
- Ua as Social,
232
+ Pa as Social,
241
233
  fr as TextInput,
242
234
  co as Toaster,
243
235
  or as Touchable,
244
236
  Q as TransitionLink,
245
- Ea as UserState,
246
- Ma as UserTokenGenerateUserErrorCode,
247
- ur as VideoPlayer,
237
+ ca as UserState,
238
+ Ca as UserTokenGenerateUserErrorCode,
239
+ lr as VideoPlayer,
248
240
  Wr as badgeVariants,
249
- Aa as dataURLToBlob,
250
- fa as extractBrandTheme,
251
- Da as fileToDataUri,
252
- ua as formatError,
253
- Ra as formatMoney,
254
- xa as formatReviewCount,
255
- ca as getFeaturedImages,
256
- Pa as getResizedImageUrl,
257
- Ta as getThumbhashBlobURL,
258
- ha as getThumbhashDataURL,
259
- Ga as handleIntentResult,
260
- da as normalizeRating,
261
- ga 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,
262
253
  go as toast,
263
254
  st as useAsyncStorage,
264
- yt as useBarcodeScanner,
265
- yo as useBuyerAttributes,
255
+ _o as useBuyerAttributes,
266
256
  gt as useCloseMini,
267
- Ut as useContentShare,
268
- Et as useCreateImageContent,
269
- mt as useCuratedProducts,
270
- Uo as useCurrentUser,
257
+ Mt as useCreateImageContent,
258
+ nt as useCuratedProducts,
259
+ Lo as useCurrentUser,
271
260
  At as useDeeplink,
272
- zt as useErrorScreen,
273
- Ht as useErrorToast,
274
- wo as useFollowedShops,
261
+ vt as useErrorScreen,
262
+ Bt as useErrorToast,
263
+ Bo as useFollowedShops,
275
264
  vo as useFollowedShopsActions,
276
265
  Go as useGenerateUserToken,
277
- vt as useImageCapture,
278
- Kt as useImagePicker,
266
+ Nt as useImagePicker,
279
267
  xt as useImageUpload,
280
- Zt as useKeyboardAvoidingView,
281
- Nt as useLocationSelection,
268
+ _t as useKeyboardAvoidingView,
282
269
  Pt as useNavigateWithTransition,
283
- na as useOnAppStateChange,
284
- ea as useOnMiniBlur,
285
- ta as useOnMiniClose,
286
- $t as useOnMiniFocus,
270
+ Kt as useOnAppStateChange,
271
+ zt as useOnMiniBlur,
272
+ Yt as useOnMiniClose,
273
+ Ht as useOnMiniFocus,
287
274
  No as useOrders,
288
- Gt as usePaymentRequest,
289
- nt as usePopularProducts,
275
+ it as usePopularProducts,
290
276
  Ko as useProduct,
291
277
  Yo as useProductList,
292
278
  Ho as useProductListActions,
293
279
  zo as useProductLists,
294
280
  $o as useProductMedia,
295
281
  et as useProductSearch,
296
- wt as useProductSelection,
297
282
  Jo as useProductVariants,
298
283
  Zo as useProducts,
299
284
  Po as useRecentProducts,
300
285
  ho as useRecentShops,
301
286
  tt as useRecommendedProducts,
302
287
  Rt as useRecommendedShops,
303
- Jt as useRequestPermissions,
288
+ Gt as useRequestPermissions,
304
289
  Ro as useSavedProducts,
305
- Eo as useSavedProductsActions,
306
- lt as useSecureStorage,
307
- Yt as useShare,
290
+ Mo as useSavedProductsActions,
291
+ ut as useSecureStorage,
292
+ Lt as useShare,
308
293
  ht as useShop,
309
- dt as useShopNavigation
294
+ ct as useShopNavigation
310
295
  };
311
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/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.20251222174301",
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.20251222174301",
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'
@@ -1,10 +0,0 @@
1
- import { useHandleIntent as t } from "../../internal/useHandleIntent.js";
2
- import { useShopIntents as o } from "../../internal/useShopIntents.js";
3
- const c = (n) => {
4
- const e = o();
5
- return t(e.scanBarcode, n);
6
- };
7
- export {
8
- c as useBarcodeScanner
9
- };
10
- //# sourceMappingURL=useBarcodeScanner.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useBarcodeScanner.js","sources":["../../../src/hooks/intents/useBarcodeScanner.ts"],"sourcesContent":["import {\n useHandleIntent,\n HandleIntentOptions,\n} from '../../internal/useHandleIntent'\nimport {useShopIntents} from '../../internal/useShopIntents'\n\nimport type {\n ScanBarcodeIntentParams,\n ScanBarcodeIntentResult,\n} from '@shopify/shop-minis-platform'\n\n/**\n * Hook to scan barcodes or QR codes\n *\n * This intent opens the camera to scan barcodes or QR codes.\n *\n * @example\n * const scanBarcode = useBarcodeScanner({\n * onCancel: () => console.log('User cancelled'),\n * })\n *\n * const result = await scanBarcode({\n * types: ['qr', 'ean13'],\n * instruction: 'Scan product barcode'\n * })\n *\n * if (result) {\n * console.log('Scanned:', result.barcodes)\n * }\n */\nexport const useBarcodeScanner = (\n options?: HandleIntentOptions<ScanBarcodeIntentResult>\n) => {\n const intents = useShopIntents()\n return useHandleIntent(intents.scanBarcode, options)\n}\n\n/**\n * Type helper for the barcode scanner function\n */\nexport type BarcodeScannerFunction = (\n params: ScanBarcodeIntentParams\n) => Promise<ScanBarcodeIntentResult | void>\n"],"names":["useBarcodeScanner","options","intents","useShopIntents","useHandleIntent"],"mappings":";;AA8Ba,MAAAA,IAAoB,CAC/BC,MACG;AACH,QAAMC,IAAUC,EAAe;AACxB,SAAAC,EAAgBF,EAAQ,aAAaD,CAAO;AACrD;"}
@@ -1,10 +0,0 @@
1
- import { useHandleIntent as e } from "../../internal/useHandleIntent.js";
2
- import { useShopIntents as o } from "../../internal/useShopIntents.js";
3
- const m = (t) => {
4
- const n = o();
5
- return e(n.shareContent, t);
6
- };
7
- export {
8
- m as useContentShare
9
- };
10
- //# sourceMappingURL=useContentShare.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useContentShare.js","sources":["../../../src/hooks/intents/useContentShare.ts"],"sourcesContent":["import {\n useHandleIntent,\n HandleIntentOptions,\n} from '../../internal/useHandleIntent'\nimport {useShopIntents} from '../../internal/useShopIntents'\n\nimport type {\n ShareContentIntentParams,\n ShareContentIntentResult,\n} from '@shopify/shop-minis-platform'\n\n/**\n * Hook to share content via the Shop app's native share sheet\n *\n * This intent opens the native share sheet to let the user\n * share content to various platforms.\n *\n * @example\n * const shareContent = useContentShare({\n * onCancel: () => console.log('User cancelled sharing'),\n * })\n *\n * const result = await shareContent({\n * type: 'product',\n * content: {\n * title: 'Check out this product!',\n * url: 'https://shop.app/products/123'\n * }\n * })\n *\n * if (result?.shared) {\n * console.log('Content shared to:', result.platform)\n * }\n */\nexport const useContentShare = (\n options?: HandleIntentOptions<ShareContentIntentResult>\n) => {\n const intents = useShopIntents()\n return useHandleIntent(intents.shareContent, options)\n}\n\n/**\n * Type helper for the content share function\n */\nexport type ContentShareFunction = (\n params: ShareContentIntentParams\n) => Promise<ShareContentIntentResult | void>\n"],"names":["useContentShare","options","intents","useShopIntents","useHandleIntent"],"mappings":";;AAkCa,MAAAA,IAAkB,CAC7BC,MACG;AACH,QAAMC,IAAUC,EAAe;AACxB,SAAAC,EAAgBF,EAAQ,cAAcD,CAAO;AACtD;"}
@@ -1,10 +0,0 @@
1
- import { useHandleIntent as n } from "../../internal/useHandleIntent.js";
2
- import { useShopIntents as r } from "../../internal/useShopIntents.js";
3
- const m = (t) => {
4
- const e = r();
5
- return n(e.captureImage, t);
6
- };
7
- export {
8
- m as useImageCapture
9
- };
10
- //# sourceMappingURL=useImageCapture.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useImageCapture.js","sources":["../../../src/hooks/intents/useImageCapture.ts"],"sourcesContent":["import {\n useHandleIntent,\n HandleIntentOptions,\n} from '../../internal/useHandleIntent'\nimport {useShopIntents} from '../../internal/useShopIntents'\n\nimport type {\n CaptureImageIntentParams,\n CaptureImageIntentResult,\n} from '@shopify/shop-minis-platform'\n\n/**\n * Hook to request user to capture or select images\n *\n * This intent opens the camera or photo gallery to let the user\n * capture or select one or more images.\n *\n * @example\n * const captureImage = useImageCapture({\n * onCancel: () => console.log('User cancelled'),\n * })\n *\n * const result = await captureImage({\n * source: 'camera',\n * quality: 0.8,\n * maxWidth: 1920\n * })\n *\n * if (result) {\n * console.log('Captured images:', result.images)\n * }\n */\nexport const useImageCapture = (\n options?: HandleIntentOptions<CaptureImageIntentResult>\n) => {\n const intents = useShopIntents()\n return useHandleIntent(intents.captureImage, options)\n}\n\n/**\n * Type helper for the image capture function\n */\nexport type ImageCaptureFunction = (\n params: CaptureImageIntentParams\n) => Promise<CaptureImageIntentResult | void>\n"],"names":["useImageCapture","options","intents","useShopIntents","useHandleIntent"],"mappings":";;AAgCa,MAAAA,IAAkB,CAC7BC,MACG;AACH,QAAMC,IAAUC,EAAe;AACxB,SAAAC,EAAgBF,EAAQ,cAAcD,CAAO;AACtD;"}
@@ -1,10 +0,0 @@
1
- import { useHandleIntent as n } from "../../internal/useHandleIntent.js";
2
- import { useShopIntents as o } from "../../internal/useShopIntents.js";
3
- const c = (t) => {
4
- const e = o();
5
- return n(e.selectLocation, t);
6
- };
7
- export {
8
- c as useLocationSelection
9
- };
10
- //# sourceMappingURL=useLocationSelection.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useLocationSelection.js","sources":["../../../src/hooks/intents/useLocationSelection.ts"],"sourcesContent":["import {\n useHandleIntent,\n HandleIntentOptions,\n} from '../../internal/useHandleIntent'\nimport {useShopIntents} from '../../internal/useShopIntents'\n\nimport type {\n SelectLocationIntentParams,\n SelectLocationIntentResult,\n} from '@shopify/shop-minis-platform'\n\n/**\n * Hook to request user to select a location\n *\n * This intent shows a map interface where the user can select\n * a location and optionally get address information.\n *\n * @example\n * const selectLocation = useLocationSelection({\n * onCancel: () => console.log('User cancelled'),\n * })\n *\n * const result = await selectLocation({\n * title: 'Select delivery location',\n * locationType: 'address'\n * })\n *\n * if (result) {\n * console.log('Selected location:', result.coordinates)\n * console.log('Address:', result.address?.formattedAddress)\n * }\n */\nexport const useLocationSelection = (\n options?: HandleIntentOptions<SelectLocationIntentResult>\n) => {\n const intents = useShopIntents()\n return useHandleIntent(intents.selectLocation, options)\n}\n\n/**\n * Type helper for the location selection function\n */\nexport type LocationSelectionFunction = (\n params: SelectLocationIntentParams\n) => Promise<SelectLocationIntentResult | void>\n"],"names":["useLocationSelection","options","intents","useShopIntents","useHandleIntent"],"mappings":";;AAgCa,MAAAA,IAAuB,CAClCC,MACG;AACH,QAAMC,IAAUC,EAAe;AACxB,SAAAC,EAAgBF,EAAQ,gBAAgBD,CAAO;AACxD;"}
@@ -1,10 +0,0 @@
1
- import { useHandleIntent as n } from "../../internal/useHandleIntent.js";
2
- import { useShopIntents as s } from "../../internal/useShopIntents.js";
3
- const m = (t) => {
4
- const e = s();
5
- return n(e.requestPayment, t);
6
- };
7
- export {
8
- m as usePaymentRequest
9
- };
10
- //# sourceMappingURL=usePaymentRequest.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"usePaymentRequest.js","sources":["../../../src/hooks/intents/usePaymentRequest.ts"],"sourcesContent":["import {\n useHandleIntent,\n HandleIntentOptions,\n} from '../../internal/useHandleIntent'\nimport {useShopIntents} from '../../internal/useShopIntents'\n\nimport type {\n RequestPaymentIntentParams,\n RequestPaymentIntentResult,\n} from '@shopify/shop-minis-platform'\n\n/**\n * Hook to request payment from user\n *\n * This intent opens the Shop app's payment flow to process a payment.\n *\n * **Note:** This intent requires special permissions and may have rate limits.\n *\n * @example\n * const requestPayment = usePaymentRequest({\n * onCancel: () => console.log('User cancelled payment'),\n * onError: (error) => console.error('Payment failed:', error)\n * })\n *\n * const result = await requestPayment({\n * amount: 999, // $9.99 in cents\n * currency: 'USD',\n * description: 'Premium subscription'\n * })\n *\n * if (result) {\n * console.log('Payment successful:', result.transactionId)\n * }\n */\nexport const usePaymentRequest = (\n options?: HandleIntentOptions<RequestPaymentIntentResult>\n) => {\n const intents = useShopIntents()\n return useHandleIntent(intents.requestPayment, options)\n}\n\n/**\n * Type helper for the payment request function\n */\nexport type PaymentRequestFunction = (\n params: RequestPaymentIntentParams\n) => Promise<RequestPaymentIntentResult | void>\n"],"names":["usePaymentRequest","options","intents","useShopIntents","useHandleIntent"],"mappings":";;AAkCa,MAAAA,IAAoB,CAC/BC,MACG;AACH,QAAMC,IAAUC,EAAe;AACxB,SAAAC,EAAgBF,EAAQ,gBAAgBD,CAAO;AACxD;"}
@@ -1,10 +0,0 @@
1
- import { useHandleIntent as n } from "../../internal/useHandleIntent.js";
2
- import { useShopIntents as o } from "../../internal/useShopIntents.js";
3
- const c = (t) => {
4
- const e = o();
5
- return n(e.selectProduct, t);
6
- };
7
- export {
8
- c as useProductSelection
9
- };
10
- //# sourceMappingURL=useProductSelection.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useProductSelection.js","sources":["../../../src/hooks/intents/useProductSelection.ts"],"sourcesContent":["import {\n useHandleIntent,\n HandleIntentOptions,\n} from '../../internal/useHandleIntent'\nimport {useShopIntents} from '../../internal/useShopIntents'\n\nimport type {\n SelectProductIntentParams,\n SelectProductIntentResult,\n} from '@shopify/shop-minis-platform'\n\n/**\n * Hook to request user to select products\n *\n * This intent shows a product selection screen where the user can browse\n * and select one or more products from the Shop catalog.\n *\n * @example\n * const selectProducts = useProductSelection({\n * onCancel: () => console.log('User cancelled'),\n * })\n *\n * const result = await selectProducts({\n * multiSelect: true,\n * maxSelections: 5,\n * title: 'Choose your favorites'\n * })\n *\n * if (result) {\n * console.log('Selected products:', result.products)\n * }\n */\nexport const useProductSelection = (\n options?: HandleIntentOptions<SelectProductIntentResult>\n) => {\n const intents = useShopIntents()\n return useHandleIntent(intents.selectProduct, options)\n}\n\n/**\n * Type helper for the product selection function\n */\nexport type ProductSelectionFunction = (\n params: SelectProductIntentParams\n) => Promise<SelectProductIntentResult | void>\n"],"names":["useProductSelection","options","intents","useShopIntents","useHandleIntent"],"mappings":";;AAgCa,MAAAA,IAAsB,CACjCC,MACG;AACH,QAAMC,IAAUC,EAAe;AACxB,SAAAC,EAAgBF,EAAQ,eAAeD,CAAO;AACvD;"}
@@ -1,26 +0,0 @@
1
- import { useCallback as s } from "react";
2
- import { IntentResultCode as t } from "../shop-minis-platform/src/intents/shared.js";
3
- const c = (n, r) => s(
4
- async (...a) => {
5
- const e = await n(...a);
6
- switch (e.resultCode) {
7
- case t.SUCCESS:
8
- return e.data;
9
- case t.CANCELLED:
10
- return r?.onCancel ? r.onCancel() : void 0;
11
- case t.FAILED:
12
- if (r?.onError)
13
- return r.onError(e.error);
14
- throw new Error(e.error?.message || "Intent failed");
15
- default: {
16
- const o = e.resultCode;
17
- throw new Error(`Unhandled result code: ${o}`);
18
- }
19
- }
20
- },
21
- [n, r]
22
- );
23
- export {
24
- c as useHandleIntent
25
- };
26
- //# sourceMappingURL=useHandleIntent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useHandleIntent.js","sources":["../../src/internal/useHandleIntent.ts"],"sourcesContent":["import {useCallback} from 'react'\n\nimport {IntentResultCode} from '@shopify/shop-minis-platform'\n\nimport type {ShopIntentResult} from '@shopify/shop-minis-platform'\n\n/**\n * Options for handling intent results\n */\nexport interface HandleIntentOptions<T> {\n /**\n * Handler called when user cancels the intent\n * If not provided, cancellation is treated as a no-op (returns undefined)\n */\n onCancel?: () => T | void\n /**\n * Handler called when intent fails\n * If not provided, throws the error\n */\n onError?: (error: {message: string; code?: string}) => T | void\n}\n\n/**\n * Wrapper to handle intent results\n *\n * Unlike actions which can reject, intents ALWAYS resolve with a result code.\n * This hook provides a cleaner API for handling intent results:\n *\n * - SUCCESS: Returns the data\n * - CANCELLED: Calls onCancel or returns undefined\n * - FAILED: Calls onError or throws the error\n *\n * @example\n * const selectProduct = useHandleIntent(intents.selectProduct, {\n * onCancel: () => console.log('User cancelled'),\n * onError: (error) => console.error('Selection failed:', error)\n * })\n *\n * const result = await selectProduct({multiSelect: true})\n * // result is the data, or undefined if cancelled\n */\nexport const useHandleIntent = <T, Args extends unknown[]>(\n intent: (...args: Args) => Promise<ShopIntentResult<T>>,\n options?: HandleIntentOptions<T>\n) => {\n return useCallback(\n async (...args: Args): Promise<T | void> => {\n const result = await intent(...args)\n\n switch (result.resultCode) {\n case IntentResultCode.SUCCESS:\n return result.data!\n\n case IntentResultCode.CANCELLED:\n if (options?.onCancel) {\n return options.onCancel()\n }\n return undefined\n\n case IntentResultCode.FAILED:\n if (options?.onError) {\n return options.onError(result.error!)\n }\n\n throw new Error(result.error?.message || 'Intent failed')\n\n default: {\n // Exhaustiveness check\n const _exhaustive: never = result.resultCode\n throw new Error(`Unhandled result code: ${_exhaustive}`)\n }\n }\n },\n [intent, options]\n )\n}\n\n/**\n * Alternative: Manual result handling without throwing\n *\n * Use this when you want to handle all result codes explicitly\n * without throwing errors.\n *\n * @example\n * const selectProduct = useHandleIntentManual(intents.selectProduct)\n *\n * const result = await selectProduct({multiSelect: true})\n * if (result.resultCode === 'SUCCESS') {\n * console.log(result.data)\n * }\n */\nexport const useHandleIntentManual = <T, Args extends unknown[]>(\n intent: (...args: Args) => Promise<ShopIntentResult<T>>\n) => {\n return useCallback(\n (...args: Args) => {\n return intent(...args)\n },\n [intent]\n )\n}\n"],"names":["useHandleIntent","intent","options","useCallback","args","result","IntentResultCode","_exhaustive"],"mappings":";;AAyCa,MAAAA,IAAkB,CAC7BC,GACAC,MAEOC;AAAA,EACL,UAAUC,MAAkC;AAC1C,UAAMC,IAAS,MAAMJ,EAAO,GAAGG,CAAI;AAEnC,YAAQC,EAAO,YAAY;AAAA,MACzB,KAAKC,EAAiB;AACpB,eAAOD,EAAO;AAAA,MAEhB,KAAKC,EAAiB;AACpB,eAAIJ,GAAS,WACJA,EAAQ,SAAS,IAEnB;AAAA,MAET,KAAKI,EAAiB;AACpB,YAAIJ,GAAS;AACJ,iBAAAA,EAAQ,QAAQG,EAAO,KAAM;AAGtC,cAAM,IAAI,MAAMA,EAAO,OAAO,WAAW,eAAe;AAAA,MAE1D,SAAS;AAEP,cAAME,IAAqBF,EAAO;AAClC,cAAM,IAAI,MAAM,0BAA0BE,CAAW,EAAE;AAAA,MAAA;AAAA,IACzD;AAAA,EAEJ;AAAA,EACA,CAACN,GAAQC,CAAO;AAClB;"}
@@ -1,7 +0,0 @@
1
- function n() {
2
- return window.minisIntents;
3
- }
4
- export {
5
- n as useShopIntents
6
- };
7
- //# sourceMappingURL=useShopIntents.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useShopIntents.js","sources":["../../src/internal/useShopIntents.ts"],"sourcesContent":["import type {ShopIntents} from '@shopify/shop-minis-platform'\n\n/**\n * Internal hook to access Shop Intents\n *\n * This provides direct access to window.minisIntents\n * Use specific intent hooks (like useProductSelection) instead of this hook directly\n *\n * @internal\n */\nexport function useShopIntents(): ShopIntents {\n return window.minisIntents\n}\n"],"names":["useShopIntents"],"mappings":"AAUO,SAASA,IAA8B;AAC5C,SAAO,OAAO;AAChB;"}
@@ -1,19 +0,0 @@
1
- var e = /* @__PURE__ */ ((E) => (E.SUCCESS = "SUCCESS", E.CANCELLED = "CANCELLED", E.FAILED = "FAILED", E))(e || {});
2
- function L(E, C) {
3
- switch (E.resultCode) {
4
- case "SUCCESS":
5
- return C.SUCCESS(E.data);
6
- case "CANCELLED":
7
- return C.CANCELLED();
8
- case "FAILED":
9
- return C.FAILED(E.error);
10
- default:
11
- const r = E.resultCode;
12
- throw new Error(`Unhandled result code: ${r}`);
13
- }
14
- }
15
- export {
16
- e as IntentResultCode,
17
- L as handleIntentResult
18
- };
19
- //# sourceMappingURL=shared.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shared.js","sources":["../../../../../shop-minis-platform/src/intents/shared.ts"],"sourcesContent":["/**\n * Shared types for the Shop Minis Intent system\n *\n * Intents allow Minis to trigger interactive flows in the parent Shop app\n * (or other Minis in the future) and receive structured responses.\n */\n\n/**\n * Intent result codes, similar to Android's Activity result codes\n */\nexport enum IntentResultCode {\n /**\n * The intent completed successfully\n */\n SUCCESS = 'SUCCESS',\n\n /**\n * The intent was cancelled by the user\n * (e.g., user closed the modal, pressed back button)\n */\n CANCELLED = 'CANCELLED',\n\n /**\n * The intent failed due to an error\n */\n FAILED = 'FAILED',\n}\n\n/**\n * Common wrapper for all intent responses\n *\n * @template T - The type of the intent-specific response data\n */\nexport interface ShopIntentResult<T = void> {\n /**\n * Result code indicating success, cancellation, or failure\n */\n resultCode: IntentResultCode\n\n /**\n * Intent-specific response data\n * Only present when resultCode is SUCCESS\n */\n data?: T\n\n /**\n * Error information\n * Only present when resultCode is FAILED\n */\n error?: {\n /** Human-readable error message */\n message: string\n /** Optional error code for programmatic handling */\n code?: string\n }\n}\n\n/**\n * Generic type representing any intent handler\n *\n * @template P - The params type for the intent\n * @template R - The result data type for the intent\n *\n * Unlike actions which can reject, intents always resolve with a\n * ShopIntentResult that contains the result code and optional data/error\n */\nexport type ShopIntent<P, R> = (\n params: P\n) => Promise<ShopIntentResult<R>>\n\n/**\n * Utility type to convert SNAKE_CASE to camelCase\n * Example: 'SELECT_PRODUCT' -> 'selectProduct'\n */\nexport type SnakeToCamelCase<S extends string> =\n S extends `${infer Head}_${infer Tail}`\n ? `${Lowercase<Head>}${Capitalize<SnakeToCamelCase<Tail>>}`\n : Lowercase<S>\n\n/**\n * Helper type to ensure intent result codes are handled exhaustively\n */\nexport type IntentResultHandler<T, R> = {\n [IntentResultCode.SUCCESS]: (data: T) => R\n [IntentResultCode.CANCELLED]: () => R\n [IntentResultCode.FAILED]: (error: {message: string; code?: string}) => R\n}\n\n/**\n * Helper function to handle intent results in a type-safe way\n *\n * @example\n * const result = await minisIntents.selectProduct({...});\n * const products = handleIntentResult(result, {\n * SUCCESS: (data) => data.products,\n * CANCELLED: () => [],\n * FAILED: (error) => { console.error(error); return []; }\n * });\n */\nexport function handleIntentResult<T, R>(\n result: ShopIntentResult<T>,\n handlers: IntentResultHandler<T, R>\n): R {\n switch (result.resultCode) {\n case IntentResultCode.SUCCESS:\n return handlers[IntentResultCode.SUCCESS](result.data!)\n case IntentResultCode.CANCELLED:\n return handlers[IntentResultCode.CANCELLED]()\n case IntentResultCode.FAILED:\n return handlers[IntentResultCode.FAILED](result.error!)\n default:\n // Exhaustiveness check\n const _exhaustive: never = result.resultCode\n throw new Error(`Unhandled result code: ${_exhaustive}`)\n }\n}\n\n"],"names":["IntentResultCode","handleIntentResult","result","handlers","_exhaustive"],"mappings":"AAUY,IAAAA,sBAAAA,OAIVA,EAAA,UAAU,WAMVA,EAAA,YAAY,aAKZA,EAAA,SAAS,UAfCA,IAAAA,KAAA,CAAA,CAAA;AAyFI,SAAAC,EACdC,GACAC,GACG;AACH,UAAQD,EAAO,YAAY;AAAA,IACzB,KAAK;AACH,aAAOC,EAAS,QAA0BD,EAAO,IAAK;AAAA,IACxD,KAAK;AACI,aAAAC,EAAS,UAA4B;AAAA,IAC9C,KAAK;AACH,aAAOA,EAAS,OAAyBD,EAAO,KAAM;AAAA,IACxD;AAEE,YAAME,IAAqBF,EAAO;AAClC,YAAM,IAAI,MAAM,0BAA0BE,CAAW,EAAE;AAAA,EAAA;AAE7D;"}
@@ -1,42 +0,0 @@
1
- /**
2
- * Shop Intents Hooks
3
- *
4
- * React hooks for triggering interactive flows in the Shop app.
5
- * Each hook wraps an intent and provides a clean API for handling results.
6
- *
7
- * @example
8
- * import { useProductSelection } from '@shopify/shop-minis-react'
9
- *
10
- * const MyComponent = () => {
11
- * const selectProducts = useProductSelection({
12
- * onCancel: () => console.log('User cancelled')
13
- * })
14
- *
15
- * const handleSelect = async () => {
16
- * const result = await selectProducts({ multiSelect: true })
17
- * if (result) {
18
- * console.log('Selected:', result.products)
19
- * }
20
- * }
21
- *
22
- * return <button onClick={handleSelect}>Select Products</button>
23
- * }
24
- */
25
-
26
- export {useProductSelection} from './useProductSelection'
27
- export type {ProductSelectionFunction} from './useProductSelection'
28
-
29
- export {useImageCapture} from './useImageCapture'
30
- export type {ImageCaptureFunction} from './useImageCapture'
31
-
32
- export {useContentShare} from './useContentShare'
33
- export type {ContentShareFunction} from './useContentShare'
34
-
35
- export {useLocationSelection} from './useLocationSelection'
36
- export type {LocationSelectionFunction} from './useLocationSelection'
37
-
38
- export {useBarcodeScanner} from './useBarcodeScanner'
39
- export type {BarcodeScannerFunction} from './useBarcodeScanner'
40
-
41
- export {usePaymentRequest} from './usePaymentRequest'
42
- export type {PaymentRequestFunction} from './usePaymentRequest'
@@ -1,43 +0,0 @@
1
- import {
2
- useHandleIntent,
3
- HandleIntentOptions,
4
- } from '../../internal/useHandleIntent'
5
- import {useShopIntents} from '../../internal/useShopIntents'
6
-
7
- import type {
8
- ScanBarcodeIntentParams,
9
- ScanBarcodeIntentResult,
10
- } from '@shopify/shop-minis-platform'
11
-
12
- /**
13
- * Hook to scan barcodes or QR codes
14
- *
15
- * This intent opens the camera to scan barcodes or QR codes.
16
- *
17
- * @example
18
- * const scanBarcode = useBarcodeScanner({
19
- * onCancel: () => console.log('User cancelled'),
20
- * })
21
- *
22
- * const result = await scanBarcode({
23
- * types: ['qr', 'ean13'],
24
- * instruction: 'Scan product barcode'
25
- * })
26
- *
27
- * if (result) {
28
- * console.log('Scanned:', result.barcodes)
29
- * }
30
- */
31
- export const useBarcodeScanner = (
32
- options?: HandleIntentOptions<ScanBarcodeIntentResult>
33
- ) => {
34
- const intents = useShopIntents()
35
- return useHandleIntent(intents.scanBarcode, options)
36
- }
37
-
38
- /**
39
- * Type helper for the barcode scanner function
40
- */
41
- export type BarcodeScannerFunction = (
42
- params: ScanBarcodeIntentParams
43
- ) => Promise<ScanBarcodeIntentResult | void>
@@ -1,47 +0,0 @@
1
- import {
2
- useHandleIntent,
3
- HandleIntentOptions,
4
- } from '../../internal/useHandleIntent'
5
- import {useShopIntents} from '../../internal/useShopIntents'
6
-
7
- import type {
8
- ShareContentIntentParams,
9
- ShareContentIntentResult,
10
- } from '@shopify/shop-minis-platform'
11
-
12
- /**
13
- * Hook to share content via the Shop app's native share sheet
14
- *
15
- * This intent opens the native share sheet to let the user
16
- * share content to various platforms.
17
- *
18
- * @example
19
- * const shareContent = useContentShare({
20
- * onCancel: () => console.log('User cancelled sharing'),
21
- * })
22
- *
23
- * const result = await shareContent({
24
- * type: 'product',
25
- * content: {
26
- * title: 'Check out this product!',
27
- * url: 'https://shop.app/products/123'
28
- * }
29
- * })
30
- *
31
- * if (result?.shared) {
32
- * console.log('Content shared to:', result.platform)
33
- * }
34
- */
35
- export const useContentShare = (
36
- options?: HandleIntentOptions<ShareContentIntentResult>
37
- ) => {
38
- const intents = useShopIntents()
39
- return useHandleIntent(intents.shareContent, options)
40
- }
41
-
42
- /**
43
- * Type helper for the content share function
44
- */
45
- export type ContentShareFunction = (
46
- params: ShareContentIntentParams
47
- ) => Promise<ShareContentIntentResult | void>
@@ -1,45 +0,0 @@
1
- import {
2
- useHandleIntent,
3
- HandleIntentOptions,
4
- } from '../../internal/useHandleIntent'
5
- import {useShopIntents} from '../../internal/useShopIntents'
6
-
7
- import type {
8
- CaptureImageIntentParams,
9
- CaptureImageIntentResult,
10
- } from '@shopify/shop-minis-platform'
11
-
12
- /**
13
- * Hook to request user to capture or select images
14
- *
15
- * This intent opens the camera or photo gallery to let the user
16
- * capture or select one or more images.
17
- *
18
- * @example
19
- * const captureImage = useImageCapture({
20
- * onCancel: () => console.log('User cancelled'),
21
- * })
22
- *
23
- * const result = await captureImage({
24
- * source: 'camera',
25
- * quality: 0.8,
26
- * maxWidth: 1920
27
- * })
28
- *
29
- * if (result) {
30
- * console.log('Captured images:', result.images)
31
- * }
32
- */
33
- export const useImageCapture = (
34
- options?: HandleIntentOptions<CaptureImageIntentResult>
35
- ) => {
36
- const intents = useShopIntents()
37
- return useHandleIntent(intents.captureImage, options)
38
- }
39
-
40
- /**
41
- * Type helper for the image capture function
42
- */
43
- export type ImageCaptureFunction = (
44
- params: CaptureImageIntentParams
45
- ) => Promise<CaptureImageIntentResult | void>
@@ -1,45 +0,0 @@
1
- import {
2
- useHandleIntent,
3
- HandleIntentOptions,
4
- } from '../../internal/useHandleIntent'
5
- import {useShopIntents} from '../../internal/useShopIntents'
6
-
7
- import type {
8
- SelectLocationIntentParams,
9
- SelectLocationIntentResult,
10
- } from '@shopify/shop-minis-platform'
11
-
12
- /**
13
- * Hook to request user to select a location
14
- *
15
- * This intent shows a map interface where the user can select
16
- * a location and optionally get address information.
17
- *
18
- * @example
19
- * const selectLocation = useLocationSelection({
20
- * onCancel: () => console.log('User cancelled'),
21
- * })
22
- *
23
- * const result = await selectLocation({
24
- * title: 'Select delivery location',
25
- * locationType: 'address'
26
- * })
27
- *
28
- * if (result) {
29
- * console.log('Selected location:', result.coordinates)
30
- * console.log('Address:', result.address?.formattedAddress)
31
- * }
32
- */
33
- export const useLocationSelection = (
34
- options?: HandleIntentOptions<SelectLocationIntentResult>
35
- ) => {
36
- const intents = useShopIntents()
37
- return useHandleIntent(intents.selectLocation, options)
38
- }
39
-
40
- /**
41
- * Type helper for the location selection function
42
- */
43
- export type LocationSelectionFunction = (
44
- params: SelectLocationIntentParams
45
- ) => Promise<SelectLocationIntentResult | void>
@@ -1,47 +0,0 @@
1
- import {
2
- useHandleIntent,
3
- HandleIntentOptions,
4
- } from '../../internal/useHandleIntent'
5
- import {useShopIntents} from '../../internal/useShopIntents'
6
-
7
- import type {
8
- RequestPaymentIntentParams,
9
- RequestPaymentIntentResult,
10
- } from '@shopify/shop-minis-platform'
11
-
12
- /**
13
- * Hook to request payment from user
14
- *
15
- * This intent opens the Shop app's payment flow to process a payment.
16
- *
17
- * **Note:** This intent requires special permissions and may have rate limits.
18
- *
19
- * @example
20
- * const requestPayment = usePaymentRequest({
21
- * onCancel: () => console.log('User cancelled payment'),
22
- * onError: (error) => console.error('Payment failed:', error)
23
- * })
24
- *
25
- * const result = await requestPayment({
26
- * amount: 999, // $9.99 in cents
27
- * currency: 'USD',
28
- * description: 'Premium subscription'
29
- * })
30
- *
31
- * if (result) {
32
- * console.log('Payment successful:', result.transactionId)
33
- * }
34
- */
35
- export const usePaymentRequest = (
36
- options?: HandleIntentOptions<RequestPaymentIntentResult>
37
- ) => {
38
- const intents = useShopIntents()
39
- return useHandleIntent(intents.requestPayment, options)
40
- }
41
-
42
- /**
43
- * Type helper for the payment request function
44
- */
45
- export type PaymentRequestFunction = (
46
- params: RequestPaymentIntentParams
47
- ) => Promise<RequestPaymentIntentResult | void>
@@ -1,45 +0,0 @@
1
- import {
2
- useHandleIntent,
3
- HandleIntentOptions,
4
- } from '../../internal/useHandleIntent'
5
- import {useShopIntents} from '../../internal/useShopIntents'
6
-
7
- import type {
8
- SelectProductIntentParams,
9
- SelectProductIntentResult,
10
- } from '@shopify/shop-minis-platform'
11
-
12
- /**
13
- * Hook to request user to select products
14
- *
15
- * This intent shows a product selection screen where the user can browse
16
- * and select one or more products from the Shop catalog.
17
- *
18
- * @example
19
- * const selectProducts = useProductSelection({
20
- * onCancel: () => console.log('User cancelled'),
21
- * })
22
- *
23
- * const result = await selectProducts({
24
- * multiSelect: true,
25
- * maxSelections: 5,
26
- * title: 'Choose your favorites'
27
- * })
28
- *
29
- * if (result) {
30
- * console.log('Selected products:', result.products)
31
- * }
32
- */
33
- export const useProductSelection = (
34
- options?: HandleIntentOptions<SelectProductIntentResult>
35
- ) => {
36
- const intents = useShopIntents()
37
- return useHandleIntent(intents.selectProduct, options)
38
- }
39
-
40
- /**
41
- * Type helper for the product selection function
42
- */
43
- export type ProductSelectionFunction = (
44
- params: SelectProductIntentParams
45
- ) => Promise<SelectProductIntentResult | void>
@@ -1,101 +0,0 @@
1
- import {useCallback} from 'react'
2
-
3
- import {IntentResultCode} from '@shopify/shop-minis-platform'
4
-
5
- import type {ShopIntentResult} from '@shopify/shop-minis-platform'
6
-
7
- /**
8
- * Options for handling intent results
9
- */
10
- export interface HandleIntentOptions<T> {
11
- /**
12
- * Handler called when user cancels the intent
13
- * If not provided, cancellation is treated as a no-op (returns undefined)
14
- */
15
- onCancel?: () => T | void
16
- /**
17
- * Handler called when intent fails
18
- * If not provided, throws the error
19
- */
20
- onError?: (error: {message: string; code?: string}) => T | void
21
- }
22
-
23
- /**
24
- * Wrapper to handle intent results
25
- *
26
- * Unlike actions which can reject, intents ALWAYS resolve with a result code.
27
- * This hook provides a cleaner API for handling intent results:
28
- *
29
- * - SUCCESS: Returns the data
30
- * - CANCELLED: Calls onCancel or returns undefined
31
- * - FAILED: Calls onError or throws the error
32
- *
33
- * @example
34
- * const selectProduct = useHandleIntent(intents.selectProduct, {
35
- * onCancel: () => console.log('User cancelled'),
36
- * onError: (error) => console.error('Selection failed:', error)
37
- * })
38
- *
39
- * const result = await selectProduct({multiSelect: true})
40
- * // result is the data, or undefined if cancelled
41
- */
42
- export const useHandleIntent = <T, Args extends unknown[]>(
43
- intent: (...args: Args) => Promise<ShopIntentResult<T>>,
44
- options?: HandleIntentOptions<T>
45
- ) => {
46
- return useCallback(
47
- async (...args: Args): Promise<T | void> => {
48
- const result = await intent(...args)
49
-
50
- switch (result.resultCode) {
51
- case IntentResultCode.SUCCESS:
52
- return result.data!
53
-
54
- case IntentResultCode.CANCELLED:
55
- if (options?.onCancel) {
56
- return options.onCancel()
57
- }
58
- return undefined
59
-
60
- case IntentResultCode.FAILED:
61
- if (options?.onError) {
62
- return options.onError(result.error!)
63
- }
64
-
65
- throw new Error(result.error?.message || 'Intent failed')
66
-
67
- default: {
68
- // Exhaustiveness check
69
- const _exhaustive: never = result.resultCode
70
- throw new Error(`Unhandled result code: ${_exhaustive}`)
71
- }
72
- }
73
- },
74
- [intent, options]
75
- )
76
- }
77
-
78
- /**
79
- * Alternative: Manual result handling without throwing
80
- *
81
- * Use this when you want to handle all result codes explicitly
82
- * without throwing errors.
83
- *
84
- * @example
85
- * const selectProduct = useHandleIntentManual(intents.selectProduct)
86
- *
87
- * const result = await selectProduct({multiSelect: true})
88
- * if (result.resultCode === 'SUCCESS') {
89
- * console.log(result.data)
90
- * }
91
- */
92
- export const useHandleIntentManual = <T, Args extends unknown[]>(
93
- intent: (...args: Args) => Promise<ShopIntentResult<T>>
94
- ) => {
95
- return useCallback(
96
- (...args: Args) => {
97
- return intent(...args)
98
- },
99
- [intent]
100
- )
101
- }
@@ -1,13 +0,0 @@
1
- import type {ShopIntents} from '@shopify/shop-minis-platform'
2
-
3
- /**
4
- * Internal hook to access Shop Intents
5
- *
6
- * This provides direct access to window.minisIntents
7
- * Use specific intent hooks (like useProductSelection) instead of this hook directly
8
- *
9
- * @internal
10
- */
11
- export function useShopIntents(): ShopIntents {
12
- return window.minisIntents
13
- }