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

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 (44) hide show
  1. package/dist/hooks/intents/useInvokeIntentAction.js +10 -0
  2. package/dist/hooks/intents/useInvokeIntentAction.js.map +1 -0
  3. package/dist/hooks/intents/useQueryIntents.js +10 -0
  4. package/dist/hooks/intents/useQueryIntents.js.map +1 -0
  5. package/dist/hooks/intents/useSelectProduct.js +21 -0
  6. package/dist/hooks/intents/useSelectProduct.js.map +1 -0
  7. package/dist/index.js +127 -133
  8. package/dist/index.js.map +1 -1
  9. package/dist/mocks.js +42 -7
  10. package/dist/mocks.js.map +1 -1
  11. package/dist/shop-minis-platform/src/actions/scopes.js +36 -0
  12. package/dist/shop-minis-platform/src/actions/scopes.js.map +1 -0
  13. package/package.json +2 -2
  14. package/src/hooks/intents/index.ts +21 -25
  15. package/src/hooks/intents/useInvokeIntentAction.ts +12 -0
  16. package/src/hooks/intents/useQueryIntents.ts +25 -0
  17. package/src/hooks/intents/useSelectProduct.ts +48 -0
  18. package/src/mocks.ts +35 -0
  19. package/dist/hooks/intents/useBarcodeScanner.js +0 -10
  20. package/dist/hooks/intents/useBarcodeScanner.js.map +0 -1
  21. package/dist/hooks/intents/useContentShare.js +0 -10
  22. package/dist/hooks/intents/useContentShare.js.map +0 -1
  23. package/dist/hooks/intents/useImageCapture.js +0 -10
  24. package/dist/hooks/intents/useImageCapture.js.map +0 -1
  25. package/dist/hooks/intents/useLocationSelection.js +0 -10
  26. package/dist/hooks/intents/useLocationSelection.js.map +0 -1
  27. package/dist/hooks/intents/usePaymentRequest.js +0 -10
  28. package/dist/hooks/intents/usePaymentRequest.js.map +0 -1
  29. package/dist/hooks/intents/useProductSelection.js +0 -10
  30. package/dist/hooks/intents/useProductSelection.js.map +0 -1
  31. package/dist/internal/useHandleIntent.js +0 -26
  32. package/dist/internal/useHandleIntent.js.map +0 -1
  33. package/dist/internal/useShopIntents.js +0 -7
  34. package/dist/internal/useShopIntents.js.map +0 -1
  35. package/dist/shop-minis-platform/src/intents/shared.js +0 -19
  36. package/dist/shop-minis-platform/src/intents/shared.js.map +0 -1
  37. package/src/hooks/intents/useBarcodeScanner.ts +0 -43
  38. package/src/hooks/intents/useContentShare.ts +0 -47
  39. package/src/hooks/intents/useImageCapture.ts +0 -45
  40. package/src/hooks/intents/useLocationSelection.ts +0 -45
  41. package/src/hooks/intents/usePaymentRequest.ts +0 -47
  42. package/src/hooks/intents/useProductSelection.ts +0 -45
  43. package/src/internal/useHandleIntent.ts +0 -101
  44. package/src/internal/useShopIntents.ts +0 -13
@@ -0,0 +1,10 @@
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
@@ -0,0 +1 @@
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;"}
@@ -0,0 +1,10 @@
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
@@ -0,0 +1 @@
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;"}
@@ -0,0 +1,21 @@
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
@@ -0,0 +1 @@
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;"}
package/dist/index.js CHANGED
@@ -1,48 +1,48 @@
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 p } from "./components/MinisContainer.js";
3
+ import { AddToCartButton as i } from "./components/commerce/add-to-cart.js";
4
4
  import { BuyNowButton as s } from "./components/commerce/buy-now.js";
5
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";
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";
8
- import { ProductCardSkeleton as v } from "./components/commerce/product-card-skeleton.js";
9
- import { MerchantCardSkeleton as U } from "./components/commerce/merchant-card-skeleton.js";
10
- import { QuantitySelector as N } from "./components/commerce/quantity-selector.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";
9
+ import { MerchantCardSkeleton as L } from "./components/commerce/merchant-card-skeleton.js";
10
+ import { QuantitySelector as k } from "./components/commerce/quantity-selector.js";
11
11
  import { Search as y, SearchInput as _, 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 Q } from "./components/navigation/transition-link.js";
14
+ import { MinisRouter as Q } from "./components/navigation/minis-router.js";
15
+ import { TransitionLink as K } 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 pr } from "./components/atoms/alert-dialog.js";
22
- import { List as ir } from "./components/atoms/list.js";
21
+ import { AlertDialogAtom as nr } from "./components/atoms/alert-dialog.js";
22
+ import { List as mr } from "./components/atoms/list.js";
23
23
  import { VideoPlayer as ur } from "./components/atoms/video-player.js";
24
24
  import { TextInput as fr } from "./components/atoms/text-input.js";
25
25
  import { ContentWrapper as cr } from "./components/atoms/content-wrapper.js";
26
26
  import { ProductVariantPrice as Cr } from "./components/atoms/product-variant-price.js";
27
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 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";
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 Kr, CardContent as Qr, CardDescription as Zr, CardFooter as jr, CardHeader as Jr, CardTitle as Xr } from "./components/ui/card.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";
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 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";
37
- import { Input as Fe } from "./components/ui/input.js";
38
- import { Label as Le } from "./components/ui/label.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";
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 Ne, RadioGroupItem as ye } 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 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";
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";
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 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";
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";
@@ -51,22 +51,22 @@ import { useRecentShops as ho } from "./hooks/user/useRecentShops.js";
51
51
  import { useSavedProducts as Ro } from "./hooks/user/useSavedProducts.js";
52
52
  import { useSavedProductsActions as Eo } from "./hooks/user/useSavedProductsActions.js";
53
53
  import { useFollowedShops as wo } from "./hooks/user/useFollowedShops.js";
54
- import { useFollowedShopsActions as vo } from "./hooks/user/useFollowedShopsActions.js";
55
- import { useCurrentUser as Uo } from "./hooks/user/useCurrentUser.js";
56
- import { useOrders as No } from "./hooks/user/useOrders.js";
54
+ import { useFollowedShopsActions as Fo } from "./hooks/user/useFollowedShopsActions.js";
55
+ import { useCurrentUser as Lo } from "./hooks/user/useCurrentUser.js";
56
+ import { useOrders as ko } from "./hooks/user/useOrders.js";
57
57
  import { useBuyerAttributes as yo } 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 Ko } from "./hooks/product/useProduct.js";
62
+ import { useProduct as qo } 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 nt } from "./hooks/product/usePopularProducts.js";
69
- import { useCuratedProducts as mt } from "./hooks/product/useCuratedProducts.js";
68
+ import { usePopularProducts as pt } from "./hooks/product/usePopularProducts.js";
69
+ import { useCuratedProducts as it } from "./hooks/product/useCuratedProducts.js";
70
70
  import { useAsyncStorage as st } from "./hooks/storage/useAsyncStorage.js";
71
71
  import { useSecureStorage as lt } from "./hooks/storage/useSecureStorage.js";
72
72
  import { useImageUpload as xt } from "./hooks/storage/useImageUpload.js";
@@ -77,51 +77,49 @@ import { useNavigateWithTransition as Pt } from "./hooks/navigation/useNavigateW
77
77
  import { useShop as ht } from "./hooks/shop/useShop.js";
78
78
  import { useRecommendedShops as Rt } from "./hooks/shop/useRecommendedShops.js";
79
79
  import { useCreateImageContent as 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";
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";
106
103
  export {
107
104
  Sr as Accordion,
108
105
  Ar as AccordionContent,
109
106
  Dr as AccordionItem,
110
107
  Pr as AccordionTrigger,
111
- m as AddToCartButton,
108
+ Ua as ActionToScopesMapping,
109
+ i as AddToCartButton,
112
110
  hr as Alert,
113
111
  Ir as AlertDescription,
114
112
  Er as AlertDialog,
115
- Mr as AlertDialogAction,
116
- pr as AlertDialogAtom,
113
+ vr as AlertDialogAction,
114
+ nr as AlertDialogAtom,
117
115
  wr as AlertDialogCancel,
118
- Fr as AlertDialogContent,
119
- vr as AlertDialogDescription,
120
- Lr as AlertDialogFooter,
121
- Ur as AlertDialogHeader,
116
+ Br as AlertDialogContent,
117
+ Fr as AlertDialogDescription,
118
+ Ur as AlertDialogFooter,
119
+ Lr as AlertDialogHeader,
122
120
  br as AlertDialogOverlay,
123
- Nr as AlertDialogPortal,
124
- kr as AlertDialogTitle,
121
+ kr as AlertDialogPortal,
122
+ Nr as AlertDialogTitle,
125
123
  yr as AlertDialogTrigger,
126
124
  Rr as AlertTitle,
127
125
  Gr as Avatar,
@@ -130,9 +128,9 @@ export {
130
128
  zr as Badge,
131
129
  j as Button,
132
130
  s as BuyNowButton,
133
- qr as Card,
134
- Kr as CardAction,
135
- Qr as CardContent,
131
+ Qr as Card,
132
+ qr as CardAction,
133
+ Kr as CardContent,
136
134
  Zr as CardDescription,
137
135
  jr as CardFooter,
138
136
  Jr as CardHeader,
@@ -142,13 +140,13 @@ export {
142
140
  oe as CarouselItem,
143
141
  te as CarouselNext,
144
142
  ae as CarouselPrevious,
145
- pe as Checkbox,
146
- Fa as ContentCreateUserErrorCode,
143
+ ne as Checkbox,
144
+ Ia as ContentCreateUserErrorCode,
147
145
  cr as ContentWrapper,
148
- Na as DATA_FETCHING_DEFAULT_FETCH_POLICY,
149
- ka as DATA_FETCHING_DEFAULT_PAGE_SIZE,
146
+ wa as DATA_FETCHING_DEFAULT_FETCH_POLICY,
147
+ Ba as DATA_FETCHING_DEFAULT_PAGE_SIZE,
150
148
  o as DATA_NAVIGATION_TYPE_ATTRIBUTE,
151
- ie as Dialog,
149
+ me as Dialog,
152
150
  se as DialogClose,
153
151
  ue as DialogContent,
154
152
  le as DialogDescription,
@@ -165,31 +163,30 @@ export {
165
163
  he as DrawerFooter,
166
164
  Ie as DrawerHeader,
167
165
  Re as DrawerOverlay,
168
- Be as DrawerPortal,
166
+ Me as DrawerPortal,
169
167
  Ee as DrawerTitle,
170
- Me as DrawerTrigger,
168
+ ve as DrawerTrigger,
171
169
  V as FavoriteButton,
172
170
  X as IconButton,
173
171
  rr as Image,
174
172
  W as ImageContentWrapper,
175
- Fe as Input,
176
- _a as IntentResultCode,
177
- Le as Label,
178
- ir as List,
173
+ Be as Input,
174
+ Ue as Label,
175
+ mr as List,
179
176
  ar as LongPressDetector,
180
177
  I as MerchantCard,
181
178
  R as MerchantCardContainer,
182
- B as MerchantCardHeader,
179
+ M as MerchantCardHeader,
183
180
  E as MerchantCardInfo,
184
- M as MerchantCardName,
181
+ v as MerchantCardName,
185
182
  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,
192
- q as MinisRouter,
183
+ 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,
193
190
  t as NAVIGATION_TYPES,
194
191
  l as ProductCard,
195
192
  f as ProductCardBadge,
@@ -200,26 +197,27 @@ export {
200
197
  g as ProductCardInfo,
201
198
  S as ProductCardPrice,
202
199
  A as ProductCardReviewStars,
203
- v as ProductCardSkeleton,
200
+ F as ProductCardSkeleton,
204
201
  D as ProductCardTitle,
205
202
  T as ProductLink,
206
203
  Cr as ProductVariantPrice,
207
204
  be as Progress,
208
- N as QuantitySelector,
209
- ke as RadioGroup,
205
+ k as QuantitySelector,
206
+ Ne as RadioGroup,
210
207
  ye as RadioGroupItem,
211
208
  Ge as ResizableHandle,
212
209
  Oe as ResizablePanel,
213
210
  He as ResizablePanelGroup,
211
+ La as Scope,
214
212
  ze as ScrollArea,
215
213
  We as ScrollBar,
216
214
  y as Search,
217
215
  _ as SearchInput,
218
216
  G as SearchProvider,
219
217
  O as SearchResultsList,
220
- qe as Select,
221
- Ke as SelectContent,
222
- Qe as SelectGroup,
218
+ Qe as Select,
219
+ qe as SelectContent,
220
+ Ke as SelectGroup,
223
221
  Ze as SelectItem,
224
222
  je as SelectLabel,
225
223
  Je as SelectScrollDownButton,
@@ -228,83 +226,79 @@ export {
228
226
  ro as SelectTrigger,
229
227
  eo as SelectValue,
230
228
  to as Separator,
231
- no as Sheet,
232
- po as SheetClose,
233
- mo as SheetContent,
234
- io as SheetDescription,
229
+ po as Sheet,
230
+ no as SheetClose,
231
+ io as SheetContent,
232
+ mo as SheetDescription,
235
233
  so as SheetFooter,
236
234
  uo as SheetHeader,
237
235
  lo as SheetTitle,
238
236
  fo as SheetTrigger,
239
237
  Ao as Skeleton,
240
- Ua as Social,
238
+ Ea as Social,
241
239
  fr as TextInput,
242
240
  co as Toaster,
243
241
  or as Touchable,
244
- Q as TransitionLink,
245
- Ea as UserState,
246
- Ma as UserTokenGenerateUserErrorCode,
242
+ K as TransitionLink,
243
+ Pa as UserState,
244
+ Ta as UserTokenGenerateUserErrorCode,
247
245
  ur as VideoPlayer,
248
246
  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,
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,
262
259
  go as toast,
263
260
  st as useAsyncStorage,
264
- yt as useBarcodeScanner,
265
261
  yo as useBuyerAttributes,
266
262
  gt as useCloseMini,
267
- Ut as useContentShare,
268
263
  Et as useCreateImageContent,
269
- mt as useCuratedProducts,
270
- Uo as useCurrentUser,
264
+ it as useCuratedProducts,
265
+ Lo as useCurrentUser,
271
266
  At as useDeeplink,
272
- zt as useErrorScreen,
273
- Ht as useErrorToast,
267
+ yt as useErrorScreen,
268
+ kt as useErrorToast,
274
269
  wo as useFollowedShops,
275
- vo as useFollowedShopsActions,
270
+ Fo as useFollowedShopsActions,
276
271
  Go as useGenerateUserToken,
277
- vt as useImageCapture,
278
- Kt as useImagePicker,
272
+ Ht as useImagePicker,
279
273
  xt as useImageUpload,
280
- Zt as useKeyboardAvoidingView,
281
- Nt as useLocationSelection,
274
+ Ft as useInvokeIntentAction,
275
+ zt as useKeyboardAvoidingView,
282
276
  Pt as useNavigateWithTransition,
283
- na as useOnAppStateChange,
284
- ea as useOnMiniBlur,
285
- ta as useOnMiniClose,
286
- $t as useOnMiniFocus,
287
- No as useOrders,
288
- Gt as usePaymentRequest,
289
- nt as usePopularProducts,
290
- Ko as useProduct,
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,
291
284
  Yo as useProductList,
292
285
  Ho as useProductListActions,
293
286
  zo as useProductLists,
294
287
  $o as useProductMedia,
295
288
  et as useProductSearch,
296
- wt as useProductSelection,
297
289
  Jo as useProductVariants,
298
290
  Zo as useProducts,
291
+ wt as useQueryIntents,
299
292
  Po as useRecentProducts,
300
293
  ho as useRecentShops,
301
294
  tt as useRecommendedProducts,
302
295
  Rt as useRecommendedShops,
303
- Jt as useRequestPermissions,
296
+ Yt as useRequestPermissions,
304
297
  Ro as useSavedProducts,
305
298
  Eo as useSavedProductsActions,
306
299
  lt as useSecureStorage,
307
- Yt as useShare,
300
+ Lt as useSelectProduct,
301
+ Gt as useShare,
308
302
  ht as useShop,
309
303
  dt as useShopNavigation
310
304
  };
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
- ], P = (o) => {
8
+ ], S = (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 = P(o) % m.length, c = m[i];
14
+ const i = S(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 S(o, r) {
126
+ function P(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) => (S(String(o), t), Promise.resolve({
130
+ return (t) => (P(String(o), t), Promise.resolve({
131
131
  ok: !0,
132
132
  data: r,
133
133
  mocked: !0
@@ -449,7 +449,42 @@ function I() {
449
449
  granted: !0
450
450
  },
451
451
  reportError: void 0,
452
- reportFetch: 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
+ }
453
488
  }, r = {};
454
489
  for (const t in o)
455
490
  Object.prototype.hasOwnProperty.call(o, t) && (r[t] = f(
@@ -458,11 +493,11 @@ function I() {
458
493
  ));
459
494
  return r;
460
495
  }
461
- const w = () => {
496
+ const y = () => {
462
497
  const o = navigator.userAgent.toLowerCase(), r = /iphone|ipad|ipod/.test(o), t = /android/.test(o);
463
498
  return r || t;
464
499
  }, A = ({ force: o } = {}) => {
465
- w() && !o || window.minisSDK || (window.minisSDK = I(), window.minisParams = {
500
+ y() && !o || window.minisSDK || (window.minisSDK = I(), window.minisParams = {
466
501
  handle: "mock-handle",
467
502
  initialUrl: "/",
468
503
  platform: "web"