@shopify/shop-minis-react 0.0.18 → 0.0.20

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 (120) hide show
  1. package/dist/_virtual/index2.js +2 -3
  2. package/dist/_virtual/index2.js.map +1 -1
  3. package/dist/_virtual/index3.js +3 -2
  4. package/dist/_virtual/index3.js.map +1 -1
  5. package/dist/components/MinisContainer.js +13 -11
  6. package/dist/components/MinisContainer.js.map +1 -1
  7. package/dist/components/atoms/alert-dialog.js +41 -0
  8. package/dist/components/atoms/alert-dialog.js.map +1 -0
  9. package/dist/components/atoms/list.js +52 -0
  10. package/dist/components/atoms/list.js.map +1 -0
  11. package/dist/components/atoms/pagination.js +10 -0
  12. package/dist/components/atoms/pagination.js.map +1 -0
  13. package/dist/components/atoms/thumbhash-image.js +54 -0
  14. package/dist/components/atoms/thumbhash-image.js.map +1 -0
  15. package/dist/components/atoms/tracking-pixel.js +32 -0
  16. package/dist/components/atoms/tracking-pixel.js.map +1 -0
  17. package/dist/components/commerce/merchant-card-skeleton.js +29 -0
  18. package/dist/components/commerce/merchant-card-skeleton.js.map +1 -0
  19. package/dist/components/commerce/merchant-card.js +28 -22
  20. package/dist/components/commerce/merchant-card.js.map +1 -1
  21. package/dist/components/commerce/product-card-skeleton.js +20 -0
  22. package/dist/components/commerce/product-card-skeleton.js.map +1 -0
  23. package/dist/components/commerce/product-card.js +105 -78
  24. package/dist/components/commerce/product-card.js.map +1 -1
  25. package/dist/components/navigation/transition-container.js +8 -0
  26. package/dist/components/navigation/transition-container.js.map +1 -0
  27. package/dist/components/navigation/transition-link.js +27 -0
  28. package/dist/components/navigation/transition-link.js.map +1 -0
  29. package/dist/components/ui/skeleton.js +16 -0
  30. package/dist/components/ui/skeleton.js.map +1 -0
  31. package/dist/hooks/navigation/useNavigateWithTransition.js +43 -0
  32. package/dist/hooks/navigation/useNavigateWithTransition.js.map +1 -0
  33. package/dist/hooks/navigation/useViewTransitions.js +45 -0
  34. package/dist/hooks/navigation/useViewTransitions.js.map +1 -0
  35. package/dist/index.js +217 -196
  36. package/dist/index.js.map +1 -1
  37. package/dist/internal/useShopActions.js.map +1 -1
  38. package/dist/internal/useShopActionsDataFetching.js +26 -26
  39. package/dist/internal/useShopActionsDataFetching.js.map +1 -1
  40. package/dist/internal/useShopActionsPaginatedDataFetching.js.map +1 -1
  41. package/dist/mocks.js +267 -0
  42. package/dist/mocks.js.map +1 -0
  43. package/dist/shop-minis-react/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +8 -0
  44. package/dist/shop-minis-react/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js.map +1 -0
  45. package/dist/shop-minis-react/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/extends.js +13 -0
  46. package/dist/shop-minis-react/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/extends.js.map +1 -0
  47. package/dist/shop-minis-react/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +8 -0
  48. package/dist/shop-minis-react/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js.map +1 -0
  49. package/dist/shop-minis-react/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +9 -0
  50. package/dist/shop-minis-react/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js.map +1 -0
  51. package/dist/shop-minis-react/node_modules/.pnpm/@radix-ui_react-use-is-hydrated@0.1.0_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +1 -1
  52. package/dist/shop-minis-react/node_modules/.pnpm/js-base64@3.7.7/node_modules/js-base64/base64.js +21 -0
  53. package/dist/shop-minis-react/node_modules/.pnpm/js-base64@3.7.7/node_modules/js-base64/base64.js.map +1 -0
  54. package/dist/shop-minis-react/node_modules/.pnpm/memoize-one@5.2.1/node_modules/memoize-one/dist/memoize-one.esm.js +28 -0
  55. package/dist/shop-minis-react/node_modules/.pnpm/memoize-one@5.2.1/node_modules/memoize-one/dist/memoize-one.esm.js.map +1 -0
  56. package/dist/shop-minis-react/node_modules/.pnpm/querystringify@2.2.0/node_modules/querystringify/index.js +1 -1
  57. package/dist/shop-minis-react/node_modules/.pnpm/react-intersection-observer@9.16.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/react-intersection-observer/dist/index.js +135 -0
  58. package/dist/shop-minis-react/node_modules/.pnpm/react-intersection-observer@9.16.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/react-intersection-observer/dist/index.js.map +1 -0
  59. package/dist/shop-minis-react/node_modules/.pnpm/react-router@7.7.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/react-router/dist/development/chunk-EF7DTUVF.js +1298 -0
  60. package/dist/shop-minis-react/node_modules/.pnpm/react-router@7.7.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/react-router/dist/development/chunk-EF7DTUVF.js.map +1 -0
  61. package/dist/shop-minis-react/node_modules/.pnpm/react-window@1.8.11_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/react-window/dist/index.esm.js +375 -0
  62. package/dist/shop-minis-react/node_modules/.pnpm/react-window@1.8.11_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/react-window/dist/index.esm.js.map +1 -0
  63. package/dist/shop-minis-react/node_modules/.pnpm/thumbhash@0.1.1/node_modules/thumbhash/thumbhash.js +145 -0
  64. package/dist/shop-minis-react/node_modules/.pnpm/thumbhash@0.1.1/node_modules/thumbhash/thumbhash.js.map +1 -0
  65. package/dist/shop-minis-react.css +1 -0
  66. package/dist/types/index.js +10 -0
  67. package/dist/types/index.js.map +1 -0
  68. package/dist/utils/image.js +15 -0
  69. package/dist/utils/image.js.map +1 -0
  70. package/package.json +18 -3
  71. package/src/components/MinisContainer.tsx +4 -1
  72. package/src/components/atoms/alert-dialog.tsx +67 -0
  73. package/src/components/atoms/list.tsx +101 -0
  74. package/src/components/atoms/pagination.tsx +19 -0
  75. package/src/components/atoms/thumbhash-image.tsx +66 -0
  76. package/src/components/atoms/tracking-pixel.tsx +40 -0
  77. package/src/components/commerce/merchant-card-skeleton.tsx +31 -0
  78. package/src/components/commerce/merchant-card.tsx +5 -2
  79. package/src/components/commerce/product-card-skeleton.tsx +30 -0
  80. package/src/components/commerce/product-card.tsx +49 -8
  81. package/src/components/index.ts +9 -0
  82. package/src/components/navigation/transition-container.tsx +7 -0
  83. package/src/components/navigation/transition-link.tsx +48 -0
  84. package/src/components/ui/skeleton.tsx +13 -0
  85. package/src/hooks/index.ts +1 -0
  86. package/src/hooks/navigation/useNavigateWithTransition.ts +62 -0
  87. package/src/hooks/navigation/useViewTransitions.ts +79 -0
  88. package/src/index.css +2 -0
  89. package/src/internal/useShopActions.ts +1 -1
  90. package/src/internal/useShopActionsDataFetching.ts +6 -7
  91. package/src/internal/useShopActionsPaginatedDataFetching.ts +3 -6
  92. package/src/mocks.ts +27 -9
  93. package/src/stories/Accordion.stories.tsx +124 -0
  94. package/src/stories/Alert.stories.tsx +38 -0
  95. package/src/stories/AlertDialog.stories.tsx +48 -0
  96. package/src/stories/Avatar.stories.tsx +29 -0
  97. package/src/stories/Badge.stories.tsx +46 -0
  98. package/src/stories/Button.stories.tsx +81 -0
  99. package/src/stories/Card.stories.tsx +40 -0
  100. package/src/stories/Checkbox.stories.tsx +44 -0
  101. package/src/stories/FavoriteButton.stories.tsx +58 -0
  102. package/src/stories/IconButton.stories.tsx +68 -0
  103. package/src/stories/Input.stories.tsx +44 -0
  104. package/src/stories/Label.stories.tsx +19 -0
  105. package/src/stories/List.stories.tsx +68 -0
  106. package/src/stories/MerchantCard.stories.tsx +55 -0
  107. package/src/stories/ProductCard.stories.tsx +85 -0
  108. package/src/stories/ProductLink.stories.tsx +46 -0
  109. package/src/stories/Progress.stories.tsx +30 -0
  110. package/src/stories/RadioGroup.stories.tsx +51 -0
  111. package/src/stories/Select.stories.tsx +85 -0
  112. package/src/stories/Skeleton.stories.tsx +19 -0
  113. package/src/stories/Toaster.stories.tsx +46 -0
  114. package/src/stories/Touchable.stories.tsx +40 -0
  115. package/src/styles/animations.css +90 -0
  116. package/src/styles/globals.css +8 -0
  117. package/src/styles/theme.css +1 -1
  118. package/src/styles/utilities.css +22 -0
  119. package/src/types/index.ts +7 -1
  120. package/src/utils/image.ts +18 -0
package/dist/index.js CHANGED
@@ -1,199 +1,220 @@
1
- import { MinisContainer as o } from "./components/MinisContainer.js";
2
- import { ProductCard as a } from "./components/commerce/product-card.js";
3
- import { ProductLink as i } from "./components/commerce/product-link.js";
4
- import { MerchantCard as s, MerchantCardPrimitive as m } from "./components/commerce/merchant-card.js";
5
- import { Button as n } from "./components/atoms/button.js";
6
- import { FavoriteButton as x } from "./components/atoms/favorite-button.js";
7
- import { IconButton as d } from "./components/atoms/icon-button.js";
8
- import { Touchable as S } from "./components/atoms/touchable.js";
9
- import { Accordion as C, AccordionContent as A, AccordionItem as P, AccordionTrigger as h } from "./components/ui/accordion.js";
10
- import { Alert as w, AlertDescription as v, AlertTitle as F } from "./components/ui/alert.js";
11
- import { AlertDialog as I, AlertDialogAction as R, AlertDialogCancel as M, AlertDialogContent as B, AlertDialogDescription as E, AlertDialogFooter as k, AlertDialogHeader as y, AlertDialogOverlay as H, AlertDialogPortal as L, AlertDialogTitle as G, AlertDialogTrigger as N } from "./components/ui/alert-dialog.js";
12
- import { Avatar as U, AvatarFallback as z, AvatarImage as V } from "./components/ui/avatar.js";
13
- import { Card as q, CardAction as J, CardContent as K, CardDescription as Q, CardFooter as W, CardHeader as X, CardTitle as Y } from "./components/ui/card.js";
14
- import { Carousel as _, CarouselContent as $, CarouselItem as rr, CarouselNext as er, CarouselPrevious as or } from "./components/ui/carousel.js";
15
- import { Checkbox as ar } from "./components/ui/checkbox.js";
16
- import { Dialog as ir, DialogClose as pr, DialogContent as sr, DialogDescription as mr, DialogFooter as ur, DialogHeader as nr, DialogOverlay as cr, DialogPortal as xr, DialogTitle as fr, DialogTrigger as dr } from "./components/ui/dialog.js";
17
- import { Drawer as Sr, DrawerClose as Dr, DrawerContent as Cr, DrawerDescription as Ar, DrawerFooter as Pr, DrawerHeader as hr, DrawerOverlay as Tr, DrawerPortal as wr, DrawerTitle as vr, DrawerTrigger as Fr } from "./components/ui/drawer.js";
18
- import { Input as Ir } from "./components/ui/input.js";
19
- import { Label as Mr } from "./components/ui/label.js";
20
- import { Progress as Er } from "./components/ui/progress.js";
21
- import { RadioGroup as yr, RadioGroupItem as Hr } from "./components/ui/radio-group.js";
22
- import { ResizableHandle as Gr, ResizablePanel as Nr, ResizablePanelGroup as Or } from "./components/ui/resizable.js";
23
- import { ScrollArea as zr, ScrollBar as Vr } from "./components/ui/scroll-area.js";
24
- import { Select as qr, SelectContent as Jr, SelectGroup as Kr, SelectItem as Qr, SelectLabel as Wr, SelectScrollDownButton as Xr, SelectScrollUpButton as Yr, SelectSeparator as Zr, SelectTrigger as _r, SelectValue as $r } from "./components/ui/select.js";
25
- import { Separator as ee } from "./components/ui/separator.js";
26
- import { Sheet as te, SheetClose as ae, SheetContent as le, SheetDescription as ie, SheetFooter as pe, SheetHeader as se, SheetTitle as me, SheetTrigger as ue } from "./components/ui/sheet.js";
27
- import { Toaster as ce } from "./components/ui/sonner.js";
28
- import { useRecentProducts as fe } from "./hooks/user/useRecentProducts.js";
29
- import { useRecentShops as ge } from "./hooks/user/useRecentShops.js";
30
- import { useSavedProducts as De } from "./hooks/user/useSavedProducts.js";
31
- import { useSavedProductsActions as Ae } from "./hooks/user/useSavedProductsActions.js";
32
- import { useFollowedShops as he } from "./hooks/user/useFollowedShops.js";
33
- import { useFollowedShopsActions as we } from "./hooks/user/useFollowedShopsActions.js";
34
- import { useCurrentUser as Fe } from "./hooks/user/useCurrentUser.js";
35
- import { useOrders as Ie } from "./hooks/user/useOrders.js";
36
- import { useBuyerAttributes as Me } from "./hooks/user/useBuyerAttributes.js";
37
- import { useProductListActions as Ee } from "./hooks/product/useProductListActions.js";
38
- import { useProductLists as ye } from "./hooks/product/useProductLists.js";
39
- import { useProductList as Le } from "./hooks/product/useProductList.js";
40
- import { useProduct as Ne } from "./hooks/product/useProduct.js";
41
- import { useProducts as Ue } from "./hooks/product/useProducts.js";
42
- import { useProductVariants as Ve } from "./hooks/product/useProductVariants.js";
43
- import { useProductMedia as qe } from "./hooks/product/useProductMedia.js";
44
- import { useProductSearch as Ke } from "./hooks/product/useProductSearch.js";
45
- import { useRecommendedProducts as We } from "./hooks/product/useRecommendedProducts.js";
46
- import { usePopularProducts as Ye } from "./hooks/product/usePopularProducts.js";
47
- import { useCuratedProducts as _e } from "./hooks/product/useCuratedProducts.js";
48
- import { useAsyncStorage as ro } from "./hooks/storage/useAsyncStorage.js";
49
- import { useSecureStorage as oo } from "./hooks/storage/useSecureStorage.js";
50
- import { useImageUpload as ao } from "./hooks/storage/useImageUpload.js";
51
- import { useShopNavigation as io } from "./hooks/navigation/useShopNavigation.js";
52
- import { useCloseMini as so } from "./hooks/navigation/useCloseMini.js";
53
- import { useDeeplink as uo } from "./hooks/navigation/useDeeplink.js";
54
- import { useShop as co } from "./hooks/shop/useShop.js";
55
- import { useShopCartActions as fo } from "./hooks/shop/useShopCartActions.js";
56
- import { useRecommendedShops as So } from "./hooks/shop/useRecommendedShops.js";
57
- import { useErrorToast as Co } from "./hooks/util/useErrorToast.js";
58
- import { useErrorScreen as Po } from "./hooks/util/useErrorScreen.js";
59
- import { useShare as To } from "./hooks/util/useShare.js";
60
- import { useImagePicker as vo } from "./hooks/util/useImagePicker.js";
61
- import { MiniEntityNotFoundError as bo, MiniError as Io, MiniNetworkError as Ro, formatError as Mo } from "./utils/errors.js";
62
- import { parseUrl as Eo } from "./utils/parseUrl.js";
63
- import { Consent as yo, ConsentStatus as Ho } from "./shop-minis-platform/src/types/permissions.js";
1
+ import { DATA_NAVIGATION_TYPE_ATTRIBUTE as o, NAVIGATION_TYPES as t } from "./types/index.js";
2
+ import { MinisContainer as i } from "./components/MinisContainer.js";
3
+ import { ProductCard as p } from "./components/commerce/product-card.js";
4
+ import { ProductLink as m } from "./components/commerce/product-link.js";
5
+ import { MerchantCard as u, MerchantCardPrimitive as x } from "./components/commerce/merchant-card.js";
6
+ import { ProductCardSkeleton as c } from "./components/commerce/product-card-skeleton.js";
7
+ import { MerchantCardSkeleton as S } from "./components/commerce/merchant-card-skeleton.js";
8
+ import { TransitionContainer as D } from "./components/navigation/transition-container.js";
9
+ import { TransitionLink as C } from "./components/navigation/transition-link.js";
10
+ import { Button as T } from "./components/atoms/button.js";
11
+ import { FavoriteButton as I } from "./components/atoms/favorite-button.js";
12
+ import { IconButton as v } from "./components/atoms/icon-button.js";
13
+ import { ThumbhashImage as k } from "./components/atoms/thumbhash-image.js";
14
+ import { Touchable as F } from "./components/atoms/touchable.js";
15
+ import { AlertDialogAtom as M } from "./components/atoms/alert-dialog.js";
16
+ import { List as B } from "./components/atoms/list.js";
17
+ import { Accordion as y, AccordionContent as G, AccordionItem as H, AccordionTrigger as O } from "./components/ui/accordion.js";
18
+ import { Alert as V, AlertDescription as _, AlertTitle as z } from "./components/ui/alert.js";
19
+ import { AlertDialog as W, AlertDialogAction as j, AlertDialogCancel as q, AlertDialogContent as J, AlertDialogDescription as K, AlertDialogFooter as Q, AlertDialogHeader as X, AlertDialogOverlay as Z, AlertDialogPortal as $, AlertDialogTitle as rr, AlertDialogTrigger as er } from "./components/ui/alert-dialog.js";
20
+ import { Avatar as tr, AvatarFallback as ar, AvatarImage as ir } from "./components/ui/avatar.js";
21
+ import { Card as pr, CardAction as sr, CardContent as mr, CardDescription as nr, CardFooter as ur, CardHeader as xr, CardTitle as fr } from "./components/ui/card.js";
22
+ import { Carousel as dr, CarouselContent as Sr, CarouselItem as gr, CarouselNext as Dr, CarouselPrevious as Ar } from "./components/ui/carousel.js";
23
+ import { Checkbox as Pr } from "./components/ui/checkbox.js";
24
+ import { Dialog as hr, DialogClose as Ir, DialogContent as wr, DialogDescription as vr, DialogFooter as br, DialogHeader as kr, DialogOverlay as Er, DialogPortal as Fr, DialogTitle as Rr, DialogTrigger as Mr } from "./components/ui/dialog.js";
25
+ import { Drawer as Br, DrawerClose as Lr, DrawerContent as yr, DrawerDescription as Gr, DrawerFooter as Hr, DrawerHeader as Or, DrawerOverlay as Ur, DrawerPortal as Vr, DrawerTitle as _r, DrawerTrigger as zr } from "./components/ui/drawer.js";
26
+ import { Input as Wr } from "./components/ui/input.js";
27
+ import { Label as qr } from "./components/ui/label.js";
28
+ import { Progress as Kr } from "./components/ui/progress.js";
29
+ import { RadioGroup as Xr, RadioGroupItem as Zr } from "./components/ui/radio-group.js";
30
+ import { ResizableHandle as re, ResizablePanel as ee, ResizablePanelGroup as oe } from "./components/ui/resizable.js";
31
+ import { ScrollArea as ae, ScrollBar as ie } from "./components/ui/scroll-area.js";
32
+ import { Select as pe, SelectContent as se, SelectGroup as me, SelectItem as ne, SelectLabel as ue, SelectScrollDownButton as xe, SelectScrollUpButton as fe, SelectSeparator as ce, SelectTrigger as de, SelectValue as Se } from "./components/ui/select.js";
33
+ import { Separator as De } from "./components/ui/separator.js";
34
+ import { Sheet as Ce, SheetClose as Pe, SheetContent as Te, SheetDescription as he, SheetFooter as Ie, SheetHeader as we, SheetTitle as ve, SheetTrigger as be } from "./components/ui/sheet.js";
35
+ import { Toaster as Ee } from "./components/ui/sonner.js";
36
+ import { Skeleton as Re } from "./components/ui/skeleton.js";
37
+ import { useRecentProducts as Ne } from "./hooks/user/useRecentProducts.js";
38
+ import { useRecentShops as Le } from "./hooks/user/useRecentShops.js";
39
+ import { useSavedProducts as Ge } from "./hooks/user/useSavedProducts.js";
40
+ import { useSavedProductsActions as Oe } from "./hooks/user/useSavedProductsActions.js";
41
+ import { useFollowedShops as Ve } from "./hooks/user/useFollowedShops.js";
42
+ import { useFollowedShopsActions as ze } from "./hooks/user/useFollowedShopsActions.js";
43
+ import { useCurrentUser as We } from "./hooks/user/useCurrentUser.js";
44
+ import { useOrders as qe } from "./hooks/user/useOrders.js";
45
+ import { useBuyerAttributes as Ke } from "./hooks/user/useBuyerAttributes.js";
46
+ import { useProductListActions as Xe } from "./hooks/product/useProductListActions.js";
47
+ import { useProductLists as $e } from "./hooks/product/useProductLists.js";
48
+ import { useProductList as eo } from "./hooks/product/useProductList.js";
49
+ import { useProduct as to } from "./hooks/product/useProduct.js";
50
+ import { useProducts as io } from "./hooks/product/useProducts.js";
51
+ import { useProductVariants as po } from "./hooks/product/useProductVariants.js";
52
+ import { useProductMedia as mo } from "./hooks/product/useProductMedia.js";
53
+ import { useProductSearch as uo } from "./hooks/product/useProductSearch.js";
54
+ import { useRecommendedProducts as fo } from "./hooks/product/useRecommendedProducts.js";
55
+ import { usePopularProducts as So } from "./hooks/product/usePopularProducts.js";
56
+ import { useCuratedProducts as Do } from "./hooks/product/useCuratedProducts.js";
57
+ import { useAsyncStorage as Co } from "./hooks/storage/useAsyncStorage.js";
58
+ import { useSecureStorage as To } from "./hooks/storage/useSecureStorage.js";
59
+ import { useImageUpload as Io } from "./hooks/storage/useImageUpload.js";
60
+ import { useShopNavigation as vo } from "./hooks/navigation/useShopNavigation.js";
61
+ import { useCloseMini as ko } from "./hooks/navigation/useCloseMini.js";
62
+ import { useDeeplink as Fo } from "./hooks/navigation/useDeeplink.js";
63
+ import { useNavigateWithTransition as Mo } from "./hooks/navigation/useNavigateWithTransition.js";
64
+ import { useShop as Bo } from "./hooks/shop/useShop.js";
65
+ import { useShopCartActions as yo } from "./hooks/shop/useShopCartActions.js";
66
+ import { useRecommendedShops as Ho } from "./hooks/shop/useRecommendedShops.js";
67
+ import { useErrorToast as Uo } from "./hooks/util/useErrorToast.js";
68
+ import { useErrorScreen as _o } from "./hooks/util/useErrorScreen.js";
69
+ import { useShare as Yo } from "./hooks/util/useShare.js";
70
+ import { useImagePicker as jo } from "./hooks/util/useImagePicker.js";
71
+ import { MiniEntityNotFoundError as Jo, MiniError as Ko, MiniNetworkError as Qo, formatError as Xo } from "./utils/errors.js";
72
+ import { parseUrl as $o } from "./utils/parseUrl.js";
73
+ import { Consent as et, ConsentStatus as ot } from "./shop-minis-platform/src/types/permissions.js";
64
74
  export {
65
- C as Accordion,
66
- A as AccordionContent,
67
- P as AccordionItem,
68
- h as AccordionTrigger,
69
- w as Alert,
70
- v as AlertDescription,
71
- I as AlertDialog,
72
- R as AlertDialogAction,
73
- M as AlertDialogCancel,
74
- B as AlertDialogContent,
75
- E as AlertDialogDescription,
76
- k as AlertDialogFooter,
77
- y as AlertDialogHeader,
78
- H as AlertDialogOverlay,
79
- L as AlertDialogPortal,
80
- G as AlertDialogTitle,
81
- N as AlertDialogTrigger,
82
- F as AlertTitle,
83
- U as Avatar,
84
- z as AvatarFallback,
85
- V as AvatarImage,
86
- n as Button,
87
- q as Card,
88
- J as CardAction,
89
- K as CardContent,
90
- Q as CardDescription,
91
- W as CardFooter,
92
- X as CardHeader,
93
- Y as CardTitle,
94
- _ as Carousel,
95
- $ as CarouselContent,
96
- rr as CarouselItem,
97
- er as CarouselNext,
98
- or as CarouselPrevious,
99
- ar as Checkbox,
100
- yo as Consent,
101
- Ho as ConsentStatus,
102
- ir as Dialog,
103
- pr as DialogClose,
104
- sr as DialogContent,
105
- mr as DialogDescription,
106
- ur as DialogFooter,
107
- nr as DialogHeader,
108
- cr as DialogOverlay,
109
- xr as DialogPortal,
110
- fr as DialogTitle,
111
- dr as DialogTrigger,
112
- Sr as Drawer,
113
- Dr as DrawerClose,
114
- Cr as DrawerContent,
115
- Ar as DrawerDescription,
116
- Pr as DrawerFooter,
117
- hr as DrawerHeader,
118
- Tr as DrawerOverlay,
119
- wr as DrawerPortal,
120
- vr as DrawerTitle,
121
- Fr as DrawerTrigger,
122
- x as FavoriteButton,
123
- d as IconButton,
124
- Ir as Input,
125
- Mr as Label,
126
- s as MerchantCard,
127
- m as MerchantCardPrimitive,
128
- bo as MiniEntityNotFoundError,
129
- Io as MiniError,
130
- Ro as MiniNetworkError,
131
- o as MinisContainer,
132
- a as ProductCard,
133
- i as ProductLink,
134
- Er as Progress,
135
- yr as RadioGroup,
136
- Hr as RadioGroupItem,
137
- Gr as ResizableHandle,
138
- Nr as ResizablePanel,
139
- Or as ResizablePanelGroup,
140
- zr as ScrollArea,
141
- Vr as ScrollBar,
142
- qr as Select,
143
- Jr as SelectContent,
144
- Kr as SelectGroup,
145
- Qr as SelectItem,
146
- Wr as SelectLabel,
147
- Xr as SelectScrollDownButton,
148
- Yr as SelectScrollUpButton,
149
- Zr as SelectSeparator,
150
- _r as SelectTrigger,
151
- $r as SelectValue,
152
- ee as Separator,
153
- te as Sheet,
154
- ae as SheetClose,
155
- le as SheetContent,
156
- ie as SheetDescription,
157
- pe as SheetFooter,
158
- se as SheetHeader,
159
- me as SheetTitle,
160
- ue as SheetTrigger,
161
- ce as Toaster,
162
- S as Touchable,
163
- Mo as formatError,
164
- Eo as parseUrl,
165
- ro as useAsyncStorage,
166
- Me as useBuyerAttributes,
167
- so as useCloseMini,
168
- _e as useCuratedProducts,
169
- Fe as useCurrentUser,
170
- uo as useDeeplink,
171
- Po as useErrorScreen,
172
- Co as useErrorToast,
173
- he as useFollowedShops,
174
- we as useFollowedShopsActions,
175
- vo as useImagePicker,
176
- ao as useImageUpload,
177
- Ie as useOrders,
178
- Ye as usePopularProducts,
179
- Ne as useProduct,
180
- Le as useProductList,
181
- Ee as useProductListActions,
182
- ye as useProductLists,
183
- qe as useProductMedia,
184
- Ke as useProductSearch,
185
- Ve as useProductVariants,
186
- Ue as useProducts,
187
- fe as useRecentProducts,
188
- ge as useRecentShops,
189
- We as useRecommendedProducts,
190
- So as useRecommendedShops,
191
- De as useSavedProducts,
192
- Ae as useSavedProductsActions,
193
- oo as useSecureStorage,
194
- To as useShare,
195
- co as useShop,
196
- fo as useShopCartActions,
197
- io as useShopNavigation
75
+ y as Accordion,
76
+ G as AccordionContent,
77
+ H as AccordionItem,
78
+ O as AccordionTrigger,
79
+ V as Alert,
80
+ _ as AlertDescription,
81
+ W as AlertDialog,
82
+ j as AlertDialogAction,
83
+ M as AlertDialogAtom,
84
+ q as AlertDialogCancel,
85
+ J as AlertDialogContent,
86
+ K as AlertDialogDescription,
87
+ Q as AlertDialogFooter,
88
+ X as AlertDialogHeader,
89
+ Z as AlertDialogOverlay,
90
+ $ as AlertDialogPortal,
91
+ rr as AlertDialogTitle,
92
+ er as AlertDialogTrigger,
93
+ z as AlertTitle,
94
+ tr as Avatar,
95
+ ar as AvatarFallback,
96
+ ir as AvatarImage,
97
+ T as Button,
98
+ pr as Card,
99
+ sr as CardAction,
100
+ mr as CardContent,
101
+ nr as CardDescription,
102
+ ur as CardFooter,
103
+ xr as CardHeader,
104
+ fr as CardTitle,
105
+ dr as Carousel,
106
+ Sr as CarouselContent,
107
+ gr as CarouselItem,
108
+ Dr as CarouselNext,
109
+ Ar as CarouselPrevious,
110
+ Pr as Checkbox,
111
+ et as Consent,
112
+ ot as ConsentStatus,
113
+ o as DATA_NAVIGATION_TYPE_ATTRIBUTE,
114
+ hr as Dialog,
115
+ Ir as DialogClose,
116
+ wr as DialogContent,
117
+ vr as DialogDescription,
118
+ br as DialogFooter,
119
+ kr as DialogHeader,
120
+ Er as DialogOverlay,
121
+ Fr as DialogPortal,
122
+ Rr as DialogTitle,
123
+ Mr as DialogTrigger,
124
+ Br as Drawer,
125
+ Lr as DrawerClose,
126
+ yr as DrawerContent,
127
+ Gr as DrawerDescription,
128
+ Hr as DrawerFooter,
129
+ Or as DrawerHeader,
130
+ Ur as DrawerOverlay,
131
+ Vr as DrawerPortal,
132
+ _r as DrawerTitle,
133
+ zr as DrawerTrigger,
134
+ I as FavoriteButton,
135
+ v as IconButton,
136
+ Wr as Input,
137
+ qr as Label,
138
+ B as List,
139
+ u as MerchantCard,
140
+ x as MerchantCardPrimitive,
141
+ S as MerchantCardSkeleton,
142
+ Jo as MiniEntityNotFoundError,
143
+ Ko as MiniError,
144
+ Qo as MiniNetworkError,
145
+ i as MinisContainer,
146
+ t as NAVIGATION_TYPES,
147
+ p as ProductCard,
148
+ c as ProductCardSkeleton,
149
+ m as ProductLink,
150
+ Kr as Progress,
151
+ Xr as RadioGroup,
152
+ Zr as RadioGroupItem,
153
+ re as ResizableHandle,
154
+ ee as ResizablePanel,
155
+ oe as ResizablePanelGroup,
156
+ ae as ScrollArea,
157
+ ie as ScrollBar,
158
+ pe as Select,
159
+ se as SelectContent,
160
+ me as SelectGroup,
161
+ ne as SelectItem,
162
+ ue as SelectLabel,
163
+ xe as SelectScrollDownButton,
164
+ fe as SelectScrollUpButton,
165
+ ce as SelectSeparator,
166
+ de as SelectTrigger,
167
+ Se as SelectValue,
168
+ De as Separator,
169
+ Ce as Sheet,
170
+ Pe as SheetClose,
171
+ Te as SheetContent,
172
+ he as SheetDescription,
173
+ Ie as SheetFooter,
174
+ we as SheetHeader,
175
+ ve as SheetTitle,
176
+ be as SheetTrigger,
177
+ Re as Skeleton,
178
+ k as ThumbhashImage,
179
+ Ee as Toaster,
180
+ F as Touchable,
181
+ D as TransitionContainer,
182
+ C as TransitionLink,
183
+ Xo as formatError,
184
+ $o as parseUrl,
185
+ Co as useAsyncStorage,
186
+ Ke as useBuyerAttributes,
187
+ ko as useCloseMini,
188
+ Do as useCuratedProducts,
189
+ We as useCurrentUser,
190
+ Fo as useDeeplink,
191
+ _o as useErrorScreen,
192
+ Uo as useErrorToast,
193
+ Ve as useFollowedShops,
194
+ ze as useFollowedShopsActions,
195
+ jo as useImagePicker,
196
+ Io as useImageUpload,
197
+ Mo as useNavigateWithTransition,
198
+ qe as useOrders,
199
+ So as usePopularProducts,
200
+ to as useProduct,
201
+ eo as useProductList,
202
+ Xe as useProductListActions,
203
+ $e as useProductLists,
204
+ mo as useProductMedia,
205
+ uo as useProductSearch,
206
+ po as useProductVariants,
207
+ io as useProducts,
208
+ Ne as useRecentProducts,
209
+ Le as useRecentShops,
210
+ fo as useRecommendedProducts,
211
+ Ho as useRecommendedShops,
212
+ Ge as useSavedProducts,
213
+ Oe as useSavedProductsActions,
214
+ To as useSecureStorage,
215
+ Yo as useShare,
216
+ Bo as useShop,
217
+ yo as useShopCartActions,
218
+ vo as useShopNavigation
198
219
  };
199
220
  //# 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useShopActions.js","sources":["../../src/internal/useShopActions.ts"],"sourcesContent":["import {ShopActions} from '../types'\n\nexport function useShopActions(): ShopActions {\n return window.minisSDK\n}\n"],"names":["useShopActions"],"mappings":"AAEO,SAASA,IAA8B;AAC5C,SAAO,OAAO;AAChB;"}
1
+ {"version":3,"file":"useShopActions.js","sources":["../../src/internal/useShopActions.ts"],"sourcesContent":["import {ShopActions} from '@shopify/shop-minis-platform/actions'\n\nexport function useShopActions(): ShopActions {\n return window.minisSDK\n}\n"],"names":["useShopActions"],"mappings":"AAEO,SAASA,IAA8B;AAC5C,SAAO,OAAO;AAChB;"}
@@ -1,38 +1,38 @@
1
1
  import { useState as b, useCallback as u, useMemo as v, useEffect as M } from "react";
2
2
  import { MiniError as P, formatError as V } from "../utils/errors.js";
3
- const A = (d, c, f) => {
4
- const [o, n] = b({
3
+ const A = (c, d, f) => {
4
+ const [n, l] = b({
5
5
  data: null,
6
6
  loading: !0,
7
7
  error: null
8
8
  }), h = f?.skip === !0, { validator: g, hook: t } = f, w = u(
9
- (l) => {
9
+ (s) => {
10
10
  try {
11
- return g?.(l), null;
12
- } catch (s) {
13
- return s ?? new P({
11
+ return g?.(s), null;
12
+ } catch (e) {
13
+ return e instanceof Error ? e : new P({
14
14
  hook: t,
15
15
  message: "Validation failed"
16
16
  });
17
17
  }
18
18
  },
19
19
  [g, t]
20
- ), y = v(() => c, [JSON.stringify(c)]), a = u(
21
- async (l, {
22
- setLoading: s = !0,
20
+ ), y = v(() => d, [JSON.stringify(d)]), a = u(
21
+ async (s, {
22
+ setLoading: e = !0,
23
23
  setError: p = !0,
24
- resetOnError: m = !0,
24
+ resetOnError: E = !0,
25
25
  throwOnError: O = !0
26
26
  } = {}) => {
27
- let E = null, i = null;
28
- n((r) => ({
27
+ let m = null, i = null;
28
+ l((r) => ({
29
29
  ...r,
30
- loading: s ? !0 : r.loading
30
+ loading: e ? !0 : r.loading
31
31
  }));
32
32
  try {
33
- const r = await d({ ...y, ...l });
33
+ const r = await c({ ...y, ...s });
34
34
  if (r.ok)
35
- i = w(r.data.data), n((S) => ({
35
+ i = w(r.data.data), l((S) => ({
36
36
  ...S,
37
37
  data: r.data.data,
38
38
  loading: !1,
@@ -41,17 +41,17 @@ const A = (d, c, f) => {
41
41
  else
42
42
  throw r.error;
43
43
  } catch (r) {
44
- E = V({ hook: t }, r);
44
+ m = V({ hook: t }, r);
45
45
  }
46
- const e = i || E;
47
- if (e && (p || m) && n((r) => ({
48
- data: m ? null : r.data,
46
+ const o = i || m;
47
+ if (o && (p || E) && l((r) => ({
48
+ data: E ? null : r.data,
49
49
  loading: !1,
50
- error: e
51
- })), e && O)
52
- throw e;
50
+ error: o
51
+ })), o && O)
52
+ throw o;
53
53
  },
54
- [d, y, t, w]
54
+ [c, y, t, w]
55
55
  ), k = u(async () => {
56
56
  await a({ fetchPolicy: "network-only" }, {
57
57
  setLoading: !1,
@@ -67,9 +67,9 @@ const A = (d, c, f) => {
67
67
  }
68
68
  );
69
69
  }, [a, h]), {
70
- data: o.data,
71
- loading: o.loading,
72
- error: o.error,
70
+ data: n.data,
71
+ loading: n.loading,
72
+ error: n.error,
73
73
  refetch: k
74
74
  };
75
75
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useShopActionsDataFetching.js","sources":["../../src/internal/useShopActionsDataFetching.ts"],"sourcesContent":["import {useCallback, useEffect, useMemo, useState} from 'react'\n\nimport {ShopActionResult} from '@shopify/shop-minis-platform/actions'\n\nimport {DataHookFetchPolicy, DataHookReturnsBase} from '../types'\nimport {formatError, MiniError} from '../utils/errors'\n\nexport interface ShopActionsDataFetchingResult<R> extends DataHookReturnsBase {\n data: R | null\n}\n\nexport const useShopActionsDataFetching = <\n S = unknown,\n P extends {fetchPolicy?: DataHookFetchPolicy} = {\n fetchPolicy?: DataHookFetchPolicy\n },\n>(\n action: (params: P) => Promise<ShopActionResult<{data: S}>>,\n params: P,\n options: {\n skip?: boolean\n hook?: string\n validator?: (data: S) => void\n }\n): ShopActionsDataFetchingResult<S> => {\n const [state, setState] = useState<{\n data: S | null\n loading: boolean\n error: Error | null\n }>({\n data: null,\n loading: true,\n error: null,\n })\n\n const skip = options?.skip === true\n const {validator, hook} = options\n const runValidator = useCallback(\n (dataToValidate: S) => {\n try {\n validator?.(dataToValidate)\n return null\n } catch (err) {\n return (\n err ??\n new MiniError({\n hook,\n message: 'Validation failed',\n })\n )\n }\n },\n [validator, hook]\n )\n\n // Params object is recreated on every render, so we need to memoize it.\n // We don't know what's inside the params object, but we can stringify it.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const stableParams = useMemo(() => params, [JSON.stringify(params)])\n\n // There's a lot of complexity here because each type of fetch has different side effects if we are trying to\n // stay close to how Apollo client works. eg:\n // - Initial fetch: set loading, set error, set data, reset on error (don't throw)\n // - change params fetch: set loading, set error, set data, reset on error (don't throw)\n // - refetch fetch: don't set loading, set error, update data, leave data as is was on error (also throw)\n // - fetchMore fetch: don't set loading, don't set error, update data, leave data as is was on error (also throw)\n const fetch = useCallback(\n async (\n extraParams?: Partial<P>,\n {\n setLoading = true,\n setError = true,\n resetOnError = true,\n throwOnError = true,\n }: {\n setLoading?: boolean\n setError?: boolean\n resetOnError?: boolean\n throwOnError?: boolean\n } = {}\n ) => {\n let queryError: Error | null = null\n let validationError: Error | null = null\n\n setState(curState => ({\n ...curState,\n loading: setLoading ? true : curState.loading,\n }))\n\n try {\n const result = await action({...stableParams, ...extraParams})\n\n if (result.ok) {\n validationError = runValidator(result.data.data)\n\n setState(curState => ({\n ...curState,\n data: result.data.data,\n loading: false,\n error: validationError ?? null,\n }))\n } else {\n throw result.error\n }\n } catch (err) {\n queryError = formatError({hook}, err)\n }\n\n const error = validationError || queryError\n\n if (error && (setError || resetOnError)) {\n setState(curState => ({\n data: resetOnError ? null : curState.data,\n loading: false,\n error,\n }))\n }\n\n if (error && throwOnError) {\n throw error\n }\n },\n [action, stableParams, hook, runValidator]\n )\n\n const refetch = useCallback(async () => {\n await fetch({fetchPolicy: 'network-only'} as Partial<P>, {\n setLoading: false,\n resetOnError: false,\n throwOnError: true,\n })\n }, [fetch])\n\n useEffect(() => {\n if (skip) return\n\n fetch(\n {},\n {\n throwOnError: false,\n }\n )\n }, [fetch, skip])\n\n return {\n data: state.data,\n loading: state.loading,\n error: state.error,\n refetch,\n }\n}\n"],"names":["useShopActionsDataFetching","action","params","options","state","setState","useState","skip","validator","hook","runValidator","useCallback","dataToValidate","err","MiniError","stableParams","useMemo","fetch","extraParams","setLoading","setError","resetOnError","throwOnError","queryError","validationError","curState","result","formatError","error","refetch","useEffect"],"mappings":";;AAWO,MAAMA,IAA6B,CAMxCC,GACAC,GACAC,MAKqC;AACrC,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAIvB;AAAA,IACD,MAAM;AAAA,IACN,SAAS;AAAA,IACT,OAAO;AAAA,EAAA,CACR,GAEKC,IAAOJ,GAAS,SAAS,IACzB,EAAC,WAAAK,GAAW,MAAAC,EAAA,IAAQN,GACpBO,IAAeC;AAAA,IACnB,CAACC,MAAsB;AACjB,UAAA;AACF,eAAAJ,IAAYI,CAA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AEMmB,IAAUlB,EAAY,YAAY;AACtC,UAAMM,EAAM,EAAC,aAAa,kBAA+B;AAAA,MACvD,YAAY;AAAA,MACZ,cAAc;AAAA,MACd,cAAc;AAAA,IAAA,CACf;AAAA,EAAA,GACA,CAACA,CAAK,CAAC;AAEV,SAAAa,EAAU,MAAM;AACd,IAAIvB,KAEJU;AAAA,MACE,CAAC;AAAA,MACD;AAAA,QACE,cAAc;AAAA,MAAA;AAAA,IAElB;AAAA,EAAA,GACC,CAACA,GAAOV,CAAI,CAAC,GAET;AAAA,IACL,MAAMH,EAAM;AAAA,IACZ,SAASA,EAAM;AAAA,IACf,OAAOA,EAAM;AAAA,IACb,SAAAyB;AAAA,EACF;AACF;"}
1
+ {"version":3,"file":"useShopActionsDataFetching.js","sources":["../../src/internal/useShopActionsDataFetching.ts"],"sourcesContent":["import {useCallback, useEffect, useMemo, useState} from 'react'\n\nimport {ShopActionResult} from '@shopify/shop-minis-platform/actions'\n\nimport {DataHookFetchPolicy, DataHookReturnsBase} from '../types'\nimport {formatError, MiniError} from '../utils/errors'\n\nexport interface ShopActionsDataFetchingResult<R> extends DataHookReturnsBase {\n data: R | null\n}\n\nexport const useShopActionsDataFetching = <\n S = unknown,\n P extends {fetchPolicy?: DataHookFetchPolicy} = {\n fetchPolicy?: DataHookFetchPolicy\n },\n>(\n action: (params: P) => Promise<ShopActionResult<{data: S}>>,\n params: P,\n options: {\n skip?: boolean\n hook?: string\n validator?: (data: S) => void\n }\n): ShopActionsDataFetchingResult<S> => {\n const [state, setState] = useState<{\n data: S | null\n loading: boolean\n error: Error | null\n }>({\n data: null,\n loading: true,\n error: null,\n })\n\n const skip = options?.skip === true\n const {validator, hook} = options\n const runValidator = useCallback(\n (dataToValidate: S) => {\n try {\n validator?.(dataToValidate)\n return null\n } catch (err) {\n if (err instanceof Error) return err\n\n return new MiniError({\n hook,\n message: 'Validation failed',\n })\n }\n },\n [validator, hook]\n )\n\n // Params object is recreated on every render, so we need to memoize it.\n // We don't know what's inside the params object, but we can stringify it.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const stableParams = useMemo(() => params, [JSON.stringify(params)])\n\n // There's a lot of complexity here because each type of fetch has different side effects if we are trying to\n // stay close to how Apollo client works. eg:\n // - Initial fetch: set loading, set error, set data, reset on error (don't throw)\n // - change params fetch: set loading, set error, set data, reset on error (don't throw)\n // - refetch fetch: don't set loading, set error, update data, leave data as is was on error (also throw)\n // - fetchMore fetch: don't set loading, don't set error, update data, leave data as is was on error (also throw)\n const fetch = useCallback(\n async (\n extraParams?: Partial<P>,\n {\n setLoading = true,\n setError = true,\n resetOnError = true,\n throwOnError = true,\n }: {\n setLoading?: boolean\n setError?: boolean\n resetOnError?: boolean\n throwOnError?: boolean\n } = {}\n ) => {\n let queryError: Error | null = null\n let validationError: Error | null = null\n\n setState(curState => ({\n ...curState,\n loading: setLoading ? true : curState.loading,\n }))\n\n try {\n const result = await action({...stableParams, ...extraParams})\n\n if (result.ok) {\n validationError = runValidator(result.data.data)\n\n setState(curState => ({\n ...curState,\n data: result.data.data,\n loading: false,\n error: validationError ?? null,\n }))\n } else {\n throw result.error\n }\n } catch (err) {\n queryError = formatError({hook}, err)\n }\n\n const error = validationError || queryError\n\n if (error && (setError || resetOnError)) {\n setState(curState => ({\n data: resetOnError ? null : curState.data,\n loading: false,\n error,\n }))\n }\n\n if (error && throwOnError) {\n throw error\n }\n },\n [action, stableParams, hook, runValidator]\n )\n\n const refetch = useCallback(async () => {\n await fetch({fetchPolicy: 'network-only'} as Partial<P>, {\n setLoading: false,\n resetOnError: false,\n throwOnError: true,\n })\n }, [fetch])\n\n useEffect(() => {\n if (skip) return\n\n fetch(\n {},\n {\n throwOnError: false,\n }\n )\n }, [fetch, skip])\n\n return {\n data: state.data,\n loading: state.loading,\n error: state.error,\n refetch,\n }\n}\n"],"names":["useShopActionsDataFetching","action","params","options","state","setState","useState","skip","validator","hook","runValidator","useCallback","dataToValidate","err","MiniError","stableParams","useMemo","fetch","extraParams","setLoading","setError","resetOnError","throwOnError","queryError","validationError","curState","result","formatError","error","refetch","useEffect"],"mappings":";;AAWO,MAAMA,IAA6B,CAMxCC,GACAC,GACAC,MAKqC;AACrC,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAIvB;AAAA,IACD,MAAM;AAAA,IACN,SAAS;AAAA,IACT,OAAO;AAAA,EAAA,CACR,GAEKC,IAAOJ,GAAS,SAAS,IACzB,EAAC,WAAAK,GAAW,MAAAC,EAAA,IAAQN,GACpBO,IAAeC;AAAA,IACnB,CAACC,MAAsB;AACjB,UAAA;AACF,eAAAJ,IAAYI,CAAc,GACnB;AAAA,eACAC,GAAK;AACR,eAAAA,aAAe,QAAcA,IAE1B,IAAIC,EAAU;AAAA,UACnB,MAAAL;AAAA,UACA,SAAS;AAAA,QAAA,CACV;AAAA,MAAA;AAAA,IAEL;AAAA,IACA,CAACD,GAAWC,CAAI;AAAA,EAClB,GAKMM,IAAeC,EAAQ,MAAMd,GAAQ,CAAC,KAAK,UAAUA,CAAM,CAAC,CAAC,GAQ7De,IAAQN;AAAA,IACZ,OACEO,GACA;AAAA,MACE,YAAAC,IAAa;AAAA,MACb,UAAAC,IAAW;AAAA,MACX,cAAAC,IAAe;AAAA,MACf,cAAAC,IAAe;AAAA,IACjB,IAKI,OACD;AACH,UAAIC,IAA2B,MAC3BC,IAAgC;AAEpC,MAAAnB,EAAS,CAAaoB,OAAA;AAAA,QACpB,GAAGA;AAAA,QACH,SAASN,IAAa,KAAOM,EAAS;AAAA,MAAA,EACtC;AAEE,UAAA;AACI,cAAAC,IAAS,MAAMzB,EAAO,EAAC,GAAGc,GAAc,GAAGG,GAAY;AAE7D,YAAIQ,EAAO;AACS,UAAAF,IAAAd,EAAagB,EAAO,KAAK,IAAI,GAE/CrB,EAAS,CAAaoB,OAAA;AAAA,YACpB,GAAGA;AAAA,YACH,MAAMC,EAAO,KAAK;AAAA,YAClB,SAAS;AAAA,YACT,OAAOF,KAAmB;AAAA,UAAA,EAC1B;AAAA;AAEF,gBAAME,EAAO;AAAA,eAERb,GAAK;AACZ,QAAAU,IAAaI,EAAY,EAAC,MAAAlB,EAAI,GAAGI,CAAG;AAAA,MAAA;AAGtC,YAAMe,IAAQJ,KAAmBD;AAUjC,UARIK,MAAUR,KAAYC,MACxBhB,EAAS,CAAaoB,OAAA;AAAA,QACpB,MAAMJ,IAAe,OAAOI,EAAS;AAAA,QACrC,SAAS;AAAA,QACT,OAAAG;AAAA,MAAA,EACA,GAGAA,KAASN;AACL,cAAAM;AAAA,IAEV;AAAA,IACA,CAAC3B,GAAQc,GAAcN,GAAMC,CAAY;AAAA,EAC3C,GAEMmB,IAAUlB,EAAY,YAAY;AACtC,UAAMM,EAAM,EAAC,aAAa,kBAA+B;AAAA,MACvD,YAAY;AAAA,MACZ,cAAc;AAAA,MACd,cAAc;AAAA,IAAA,CACf;AAAA,EAAA,GACA,CAACA,CAAK,CAAC;AAEV,SAAAa,EAAU,MAAM;AACd,IAAIvB,KAEJU;AAAA,MACE,CAAC;AAAA,MACD;AAAA,QACE,cAAc;AAAA,MAAA;AAAA,IAElB;AAAA,EAAA,GACC,CAACA,GAAOV,CAAI,CAAC,GAET;AAAA,IACL,MAAMH,EAAM;AAAA,IACZ,SAASA,EAAM;AAAA,IACf,OAAOA,EAAM;AAAA,IACb,SAAAyB;AAAA,EACF;AACF;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useShopActionsPaginatedDataFetching.js","sources":["../../src/internal/useShopActionsPaginatedDataFetching.ts"],"sourcesContent":["import {useCallback, useEffect, useMemo, useState} from 'react'\n\nimport {\n DataHookFetchPolicy,\n PaginatedDataHookReturnsBase,\n PaginationInfo,\n ShopAction,\n} from '../types'\nimport {formatError, MiniError} from '../utils/errors'\n\nexport interface ShopActionsDataFetchingResult<S>\n extends PaginatedDataHookReturnsBase {\n data: S | null\n}\n\nexport const useShopActionsPaginatedDataFetching = <\n S = unknown,\n P extends {after?: string; fetchPolicy?: DataHookFetchPolicy} = {\n after?: undefined\n fetchPolicy?: DataHookFetchPolicy\n },\n>(\n action: ShopAction<P, {data: S; pageInfo: PaginationInfo}>,\n params: P,\n options: {\n skip?: boolean\n hook?: string\n validator?: (data: S) => void\n }\n): ShopActionsDataFetchingResult<S> => {\n const [state, setState] = useState<{\n data: S | null\n pageInfo: PaginationInfo\n loading: boolean\n error: Error | null\n }>({\n data: null,\n pageInfo: {hasNextPage: false, endCursor: null},\n loading: false,\n error: null,\n })\n\n const skip = options?.skip === true\n const {validator, hook} = options\n const runValidator = useCallback(\n (dataToValidate: S): Error | null => {\n try {\n validator?.(dataToValidate)\n return null\n } catch (err) {\n if (err instanceof Error) return err\n\n return new MiniError({\n hook,\n message: 'Validation failed',\n })\n }\n },\n [validator, hook]\n )\n\n // Params object is recreated on every render, so we need to memoize it.\n // We don't know what's inside the params object, but we can stringify it.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const stableParams = useMemo(() => params, [JSON.stringify(params)])\n\n // There's a lot of complexity here because each type of fetch has different side effects if we are trying to\n // stay close to how Apollo client works. eg:\n // - Initial fetch: set loading, set error, set data, reset on error (don't throw)\n // - change params fetch: set loading, set error, set data, reset on error (don't throw)\n // - refetch fetch: don't set loading, set error, update data, leave data as is was on error (also throw)\n // - fetchMore fetch: don't set loading, don't set error, update data, leave data as is was on error (also throw)\n const fetch = useCallback(\n async (\n extraParams?: Partial<P>,\n {\n setLoading = true,\n setError = true,\n resetOnError = true,\n throwOnError = true,\n appendData = false,\n }: {\n setLoading?: boolean\n setError?: boolean\n resetOnError?: boolean\n throwOnError?: boolean\n appendData?: boolean\n } = {}\n ) => {\n let queryError: Error | null = null\n let validationError: Error | null = null\n\n setState(curState => ({\n ...curState,\n loading: setLoading ? true : curState.loading,\n }))\n\n try {\n const result = await action({...stableParams, ...extraParams})\n\n if (result.ok) {\n validationError = runValidator(result.data.data)\n\n setState(curState => {\n let newData = result.data.data\n\n if (\n appendData &&\n curState.data &&\n Array.isArray(curState.data) &&\n Array.isArray(result.data.data)\n ) {\n newData = [...curState.data, ...result.data.data] as S\n }\n\n return {\n ...curState,\n data: newData,\n pageInfo: result.data.pageInfo,\n loading: false,\n error: validationError ?? null,\n }\n })\n } else {\n throw result.error\n }\n } catch (err) {\n console.log('caught 1', err)\n queryError = formatError({hook}, err)\n }\n\n const error = validationError || queryError\n\n if (error && (setError || resetOnError)) {\n setState(curState => ({\n data: resetOnError ? null : curState.data,\n pageInfo: resetOnError\n ? {hasNextPage: false, endCursor: null}\n : curState.pageInfo,\n loading: false,\n error,\n }))\n }\n\n if (error && throwOnError) {\n throw error\n }\n },\n [action, stableParams, hook, runValidator]\n )\n\n const refetch = useCallback(async () => {\n await fetch({fetchPolicy: 'network-only'} as Partial<P>, {\n setLoading: false,\n resetOnError: false,\n throwOnError: true,\n })\n }, [fetch])\n\n const fetchMore = useCallback(async () => {\n if (!state.pageInfo.hasNextPage || !state.pageInfo.endCursor) return\n\n await fetch({after: state.pageInfo.endCursor} as Partial<P>, {\n setLoading: false,\n setError: false,\n resetOnError: false,\n throwOnError: true,\n appendData: true,\n })\n }, [state.pageInfo.hasNextPage, state.pageInfo.endCursor, fetch])\n\n useEffect(() => {\n if (skip) return\n\n fetch(\n {},\n {\n throwOnError: false,\n }\n )\n }, [fetch, skip])\n\n return {\n data: state.data,\n loading: state.loading,\n error: state.error,\n hasNextPage: state.pageInfo.hasNextPage,\n refetch,\n fetchMore,\n }\n}\n"],"names":["useShopActionsPaginatedDataFetching","action","params","options","state","setState","useState","skip","validator","hook","runValidator","useCallback","dataToValidate","err","MiniError","stableParams","useMemo","fetch","extraParams","setLoading","setError","resetOnError","throwOnError","appendData","queryError","validationError","curState","result","newData","formatError","error","refetch","fetchMore","useEffect"],"mappings":";;AAeO,MAAMA,IAAsC,CAOjDC,GACAC,GACAC,MAKqC;AACrC,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAKvB;AAAA,IACD,MAAM;AAAA,IACN,UAAU,EAAC,aAAa,IAAO,WAAW,KAAI;AAAA,IAC9C,SAAS;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M;AAAA,IACf,OAAOA,EAAM;AAAA,IACb,aAAaA,EAAM,SAAS;AAAA,IAC5B,SAAA2B;AAAA,IACA,WAAAC;AAAA,EACF;AACF;"}
1
+ {"version":3,"file":"useShopActionsPaginatedDataFetching.js","sources":["../../src/internal/useShopActionsPaginatedDataFetching.ts"],"sourcesContent":["import {useCallback, useEffect, useMemo, useState} from 'react'\n\nimport {ShopAction, PaginationInfo} from '@shopify/shop-minis-platform/actions'\n\nimport {DataHookFetchPolicy, PaginatedDataHookReturnsBase} from '../types'\nimport {formatError, MiniError} from '../utils/errors'\n\nexport interface ShopActionsDataFetchingResult<S>\n extends PaginatedDataHookReturnsBase {\n data: S | null\n}\n\nexport const useShopActionsPaginatedDataFetching = <\n S = unknown,\n P extends {after?: string; fetchPolicy?: DataHookFetchPolicy} = {\n after?: undefined\n fetchPolicy?: DataHookFetchPolicy\n },\n>(\n action: ShopAction<P, {data: S; pageInfo: PaginationInfo}>,\n params: P,\n options: {\n skip?: boolean\n hook?: string\n validator?: (data: S) => void\n }\n): ShopActionsDataFetchingResult<S> => {\n const [state, setState] = useState<{\n data: S | null\n pageInfo: PaginationInfo\n loading: boolean\n error: Error | null\n }>({\n data: null,\n pageInfo: {hasNextPage: false, endCursor: null},\n loading: false,\n error: null,\n })\n\n const skip = options?.skip === true\n const {validator, hook} = options\n const runValidator = useCallback(\n (dataToValidate: S): Error | null => {\n try {\n validator?.(dataToValidate)\n return null\n } catch (err) {\n if (err instanceof Error) return err\n\n return new MiniError({\n hook,\n message: 'Validation failed',\n })\n }\n },\n [validator, hook]\n )\n\n // Params object is recreated on every render, so we need to memoize it.\n // We don't know what's inside the params object, but we can stringify it.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const stableParams = useMemo(() => params, [JSON.stringify(params)])\n\n // There's a lot of complexity here because each type of fetch has different side effects if we are trying to\n // stay close to how Apollo client works. eg:\n // - Initial fetch: set loading, set error, set data, reset on error (don't throw)\n // - change params fetch: set loading, set error, set data, reset on error (don't throw)\n // - refetch fetch: don't set loading, set error, update data, leave data as is was on error (also throw)\n // - fetchMore fetch: don't set loading, don't set error, update data, leave data as is was on error (also throw)\n const fetch = useCallback(\n async (\n extraParams?: Partial<P>,\n {\n setLoading = true,\n setError = true,\n resetOnError = true,\n throwOnError = true,\n appendData = false,\n }: {\n setLoading?: boolean\n setError?: boolean\n resetOnError?: boolean\n throwOnError?: boolean\n appendData?: boolean\n } = {}\n ) => {\n let queryError: Error | null = null\n let validationError: Error | null = null\n\n setState(curState => ({\n ...curState,\n loading: setLoading ? true : curState.loading,\n }))\n\n try {\n const result = await action({...stableParams, ...extraParams})\n\n if (result.ok) {\n validationError = runValidator(result.data.data)\n\n setState(curState => {\n let newData = result.data.data\n\n if (\n appendData &&\n curState.data &&\n Array.isArray(curState.data) &&\n Array.isArray(result.data.data)\n ) {\n newData = [...curState.data, ...result.data.data] as S\n }\n\n return {\n ...curState,\n data: newData,\n pageInfo: result.data.pageInfo,\n loading: false,\n error: validationError ?? null,\n }\n })\n } else {\n throw result.error\n }\n } catch (err) {\n console.log('caught 1', err)\n queryError = formatError({hook}, err)\n }\n\n const error = validationError || queryError\n\n if (error && (setError || resetOnError)) {\n setState(curState => ({\n data: resetOnError ? null : curState.data,\n pageInfo: resetOnError\n ? {hasNextPage: false, endCursor: null}\n : curState.pageInfo,\n loading: false,\n error,\n }))\n }\n\n if (error && throwOnError) {\n throw error\n }\n },\n [action, stableParams, hook, runValidator]\n )\n\n const refetch = useCallback(async () => {\n await fetch({fetchPolicy: 'network-only'} as Partial<P>, {\n setLoading: false,\n resetOnError: false,\n throwOnError: true,\n })\n }, [fetch])\n\n const fetchMore = useCallback(async () => {\n if (!state.pageInfo.hasNextPage || !state.pageInfo.endCursor) return\n\n await fetch({after: state.pageInfo.endCursor} as Partial<P>, {\n setLoading: false,\n setError: false,\n resetOnError: false,\n throwOnError: true,\n appendData: true,\n })\n }, [state.pageInfo.hasNextPage, state.pageInfo.endCursor, fetch])\n\n useEffect(() => {\n if (skip) return\n\n fetch(\n {},\n {\n throwOnError: false,\n }\n )\n }, [fetch, skip])\n\n return {\n data: state.data,\n loading: state.loading,\n error: state.error,\n hasNextPage: state.pageInfo.hasNextPage,\n refetch,\n fetchMore,\n }\n}\n"],"names":["useShopActionsPaginatedDataFetching","action","params","options","state","setState","useState","skip","validator","hook","runValidator","useCallback","dataToValidate","err","MiniError","stableParams","useMemo","fetch","extraParams","setLoading","setError","resetOnError","throwOnError","appendData","queryError","validationError","curState","result","newData","formatError","error","refetch","fetchMore","useEffect"],"mappings":";;AAYO,MAAMA,IAAsC,CAOjDC,GACAC,GACAC,MAKqC;AACrC,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAKvB;AAAA,IACD,MAAM;AAAA,IACN,UAAU,EAAC,aAAa,IAAO,WAAW,KAAI;AAAA,IAC9C,SAAS;AAAA,IACT,OAAO;AAAA,EAAA,CACR,GAEKC,IAAOJ,GAAS,SAAS,IACzB,EAAC,WAAAK,GAAW,MAAAC,EAAA,IAAQN,GACpBO,IAAeC;AAAA,IACnB,CAACC,MAAoC;AAC/B,UAAA;AACF,eAAAJ,IAAYI,CAAc,GACnB;AAAA,eACAC,GAAK;AACR,eAAAA,aAAe,QAAcA,IAE1B,IAAIC,EAAU;AAAA,UACnB,MAAAL;AAAA,UACA,SAAS;AAAA,QAAA,CACV;AAAA,MAAA;AAAA,IAEL;AAAA,IACA,CAACD,GAAWC,CAAI;AAAA,EAClB,GAKMM,IAAeC,EAAQ,MAAMd,GAAQ,CAAC,KAAK,UAAUA,CAAM,CAAC,CAAC,GAQ7De,IAAQN;AAAA,IACZ,OACEO,GACA;AAAA,MACE,YAAAC,IAAa;AAAA,MACb,UAAAC,IAAW;AAAA,MACX,cAAAC,IAAe;AAAA,MACf,cAAAC,IAAe;AAAA,MACf,YAAAC,IAAa;AAAA,IACf,IAMI,OACD;AACH,UAAIC,IAA2B,MAC3BC,IAAgC;AAEpC,MAAApB,EAAS,CAAaqB,OAAA;AAAA,QACpB,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