@shopify/shop-minis-react 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/dist/components/MinisContainer.js +11 -10
  2. package/dist/components/MinisContainer.js.map +1 -1
  3. package/dist/components/atoms/content-wrapper.js.map +1 -1
  4. package/dist/components/atoms/video-player.js +28 -26
  5. package/dist/components/atoms/video-player.js.map +1 -1
  6. package/dist/components/commerce/product-card.js +106 -79
  7. package/dist/components/commerce/product-card.js.map +1 -1
  8. package/dist/components/commerce/product-link.js +124 -137
  9. package/dist/components/commerce/product-link.js.map +1 -1
  10. package/dist/components/commerce/search.js +20 -20
  11. package/dist/components/commerce/search.js.map +1 -1
  12. package/dist/components/ui/sonner.js +3 -1
  13. package/dist/components/ui/sonner.js.map +1 -1
  14. package/dist/hooks/content/useContent.js +12 -18
  15. package/dist/hooks/content/useContent.js.map +1 -1
  16. package/dist/hooks/navigation/useNavigateWithTransition.js +10 -11
  17. package/dist/hooks/navigation/useNavigateWithTransition.js.map +1 -1
  18. package/dist/hooks/product/useCuratedProducts.js +9 -11
  19. package/dist/hooks/product/useCuratedProducts.js.map +1 -1
  20. package/dist/hooks/product/usePopularProducts.js +9 -11
  21. package/dist/hooks/product/usePopularProducts.js.map +1 -1
  22. package/dist/hooks/product/useProduct.js +11 -17
  23. package/dist/hooks/product/useProduct.js.map +1 -1
  24. package/dist/hooks/product/useProductList.js +10 -21
  25. package/dist/hooks/product/useProductList.js.map +1 -1
  26. package/dist/hooks/product/useProductLists.js +11 -13
  27. package/dist/hooks/product/useProductLists.js.map +1 -1
  28. package/dist/hooks/product/useProductMedia.js +12 -18
  29. package/dist/hooks/product/useProductMedia.js.map +1 -1
  30. package/dist/hooks/product/useProductSearch.js +34 -27
  31. package/dist/hooks/product/useProductSearch.js.map +1 -1
  32. package/dist/hooks/product/useProductVariants.js +11 -14
  33. package/dist/hooks/product/useProductVariants.js.map +1 -1
  34. package/dist/hooks/product/useProducts.js +12 -11
  35. package/dist/hooks/product/useProducts.js.map +1 -1
  36. package/dist/hooks/product/useRecommendedProducts.js +11 -13
  37. package/dist/hooks/product/useRecommendedProducts.js.map +1 -1
  38. package/dist/hooks/shop/useRecommendedShops.js +11 -13
  39. package/dist/hooks/shop/useRecommendedShops.js.map +1 -1
  40. package/dist/hooks/shop/useShop.js +12 -11
  41. package/dist/hooks/shop/useShop.js.map +1 -1
  42. package/dist/hooks/user/useBuyerAttributes.js +8 -10
  43. package/dist/hooks/user/useBuyerAttributes.js.map +1 -1
  44. package/dist/hooks/user/useCurrentUser.js +7 -9
  45. package/dist/hooks/user/useCurrentUser.js.map +1 -1
  46. package/dist/hooks/user/useFollowedShops.js +11 -14
  47. package/dist/hooks/user/useFollowedShops.js.map +1 -1
  48. package/dist/hooks/user/useOrders.js +7 -9
  49. package/dist/hooks/user/useOrders.js.map +1 -1
  50. package/dist/hooks/user/useRecentProducts.js +11 -13
  51. package/dist/hooks/user/useRecentProducts.js.map +1 -1
  52. package/dist/hooks/user/useRecentShops.js +10 -13
  53. package/dist/hooks/user/useRecentShops.js.map +1 -1
  54. package/dist/hooks/user/useSavedProducts.js +10 -13
  55. package/dist/hooks/user/useSavedProducts.js.map +1 -1
  56. package/dist/index.js +269 -264
  57. package/dist/index.js.map +1 -1
  58. package/dist/internal/components/product-review-stars.js +78 -0
  59. package/dist/internal/components/product-review-stars.js.map +1 -0
  60. package/dist/internal/reactQuery/MinisQueryProvider.js +11 -0
  61. package/dist/internal/reactQuery/MinisQueryProvider.js.map +1 -0
  62. package/dist/internal/reactQuery/queryClient.js +33 -0
  63. package/dist/internal/reactQuery/queryClient.js.map +1 -0
  64. package/dist/internal/reactQuery/useShopActionInfiniteQuery.js +52 -0
  65. package/dist/internal/reactQuery/useShopActionInfiniteQuery.js.map +1 -0
  66. package/dist/internal/reactQuery/useShopActionQuery.js +37 -0
  67. package/dist/internal/reactQuery/useShopActionQuery.js.map +1 -0
  68. package/dist/mocks.js +178 -107
  69. package/dist/mocks.js.map +1 -1
  70. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/focusManager.js +45 -0
  71. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/focusManager.js.map +1 -0
  72. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.js +89 -0
  73. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.js.map +1 -0
  74. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/infiniteQueryObserver.js +55 -0
  75. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/infiniteQueryObserver.js.map +1 -0
  76. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/mutation.js +198 -0
  77. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/mutation.js.map +1 -0
  78. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/mutationCache.js +99 -0
  79. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/mutationCache.js.map +1 -0
  80. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/notifyManager.js +67 -0
  81. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/notifyManager.js.map +1 -0
  82. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/onlineManager.js +39 -0
  83. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/onlineManager.js.map +1 -0
  84. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/query.js +299 -0
  85. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/query.js.map +1 -0
  86. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/queryCache.js +80 -0
  87. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/queryCache.js.map +1 -0
  88. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/queryClient.js +215 -0
  89. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/queryClient.js.map +1 -0
  90. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/queryObserver.js +300 -0
  91. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/queryObserver.js.map +1 -0
  92. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/removable.js +25 -0
  93. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/removable.js.map +1 -0
  94. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/retryer.js +76 -0
  95. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/retryer.js.map +1 -0
  96. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/subscribable.js +21 -0
  97. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/subscribable.js.map +1 -0
  98. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/thenable.js +26 -0
  99. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/thenable.js.map +1 -0
  100. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/utils.js +176 -0
  101. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/utils.js.map +1 -0
  102. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js +7 -0
  103. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js.map +1 -0
  104. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js +17 -0
  105. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js.map +1 -0
  106. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js +19 -0
  107. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js.map +1 -0
  108. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js +21 -0
  109. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js.map +1 -0
  110. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/suspense.js +18 -0
  111. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/suspense.js.map +1 -0
  112. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js +64 -0
  113. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js.map +1 -0
  114. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/useInfiniteQuery.js +13 -0
  115. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/useInfiniteQuery.js.map +1 -0
  116. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/useQuery.js +9 -0
  117. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/useQuery.js.map +1 -0
  118. package/dist/shop-minis-react/node_modules/.pnpm/lucide-react@0.513.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/star-half.js +21 -0
  119. package/dist/shop-minis-react/node_modules/.pnpm/lucide-react@0.513.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/star-half.js.map +1 -0
  120. package/dist/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 +4 -4
  121. package/dist/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.map +1 -1
  122. package/package.json +2 -7
  123. package/src/components/MinisContainer.tsx +6 -3
  124. package/src/components/atoms/content-wrapper.tsx +1 -1
  125. package/src/components/atoms/video-player.tsx +7 -0
  126. package/src/components/commerce/product-card.test.tsx +135 -0
  127. package/src/components/commerce/product-card.tsx +39 -5
  128. package/src/components/commerce/product-link.test.tsx +15 -3
  129. package/src/components/commerce/product-link.tsx +9 -25
  130. package/src/components/commerce/search.tsx +2 -2
  131. package/src/components/index.ts +1 -0
  132. package/src/components/ui/sonner.tsx +2 -2
  133. package/src/hooks/content/useContent.ts +6 -17
  134. package/src/hooks/navigation/useNavigateWithTransition.test.ts +46 -7
  135. package/src/hooks/navigation/useNavigateWithTransition.ts +4 -1
  136. package/src/hooks/product/useCuratedProducts.ts +4 -6
  137. package/src/hooks/product/usePopularProducts.ts +4 -6
  138. package/src/hooks/product/useProduct.ts +6 -17
  139. package/src/hooks/product/useProductList.ts +4 -19
  140. package/src/hooks/product/useProductLists.ts +4 -6
  141. package/src/hooks/product/useProductMedia.ts +6 -17
  142. package/src/hooks/product/useProductSearch.ts +19 -15
  143. package/src/hooks/product/useProductVariants.ts +5 -13
  144. package/src/hooks/product/useProducts.ts +8 -12
  145. package/src/hooks/product/useRecommendedProducts.ts +4 -6
  146. package/src/hooks/shop/useRecommendedShops.ts +4 -6
  147. package/src/hooks/shop/useShop.ts +8 -12
  148. package/src/hooks/user/useBuyerAttributes.ts +4 -6
  149. package/src/hooks/user/useCurrentUser.ts +4 -6
  150. package/src/hooks/user/useFollowedShops.ts +5 -13
  151. package/src/hooks/user/useOrders.ts +4 -6
  152. package/src/hooks/user/useRecentProducts.ts +4 -6
  153. package/src/hooks/user/useRecentShops.ts +5 -13
  154. package/src/hooks/user/useSavedProducts.ts +5 -13
  155. package/src/internal/components/product-review-stars.test.tsx +90 -0
  156. package/src/internal/components/product-review-stars.tsx +113 -0
  157. package/src/internal/reactQuery/MinisQueryProvider.test.tsx +38 -0
  158. package/src/internal/reactQuery/MinisQueryProvider.tsx +16 -0
  159. package/src/internal/reactQuery/index.ts +8 -0
  160. package/src/internal/reactQuery/queryClient.test.tsx +91 -0
  161. package/src/internal/reactQuery/queryClient.ts +43 -0
  162. package/src/internal/reactQuery/useShopActionInfiniteQuery.test.tsx +357 -0
  163. package/src/internal/reactQuery/useShopActionInfiniteQuery.ts +129 -0
  164. package/src/internal/reactQuery/useShopActionQuery.test.tsx +184 -0
  165. package/src/internal/reactQuery/useShopActionQuery.ts +74 -0
  166. package/src/mocks.ts +10 -2
  167. package/src/providers/ImagePickerProvider.test.tsx +3 -9
  168. package/dist/internal/useShopActionsDataFetching.js +0 -79
  169. package/dist/internal/useShopActionsDataFetching.js.map +0 -1
  170. package/dist/internal/useShopActionsPaginatedDataFetching.js +0 -96
  171. package/dist/internal/useShopActionsPaginatedDataFetching.js.map +0 -1
  172. package/src/hooks/product/useProductSearch.test.ts +0 -470
  173. package/src/internal/useShopActionsDataFetching.test.ts +0 -465
  174. package/src/internal/useShopActionsDataFetching.ts +0 -150
  175. package/src/internal/useShopActionsPaginatedDataFetching.ts +0 -188
  176. package/src/stories/Accordion.stories.tsx +0 -124
  177. package/src/stories/AddToCart.stories.tsx +0 -251
  178. package/src/stories/Alert.stories.tsx +0 -38
  179. package/src/stories/AlertDialog.stories.tsx +0 -48
  180. package/src/stories/Avatar.stories.tsx +0 -29
  181. package/src/stories/Badge.stories.tsx +0 -46
  182. package/src/stories/Button.stories.tsx +0 -81
  183. package/src/stories/Card.stories.tsx +0 -40
  184. package/src/stories/Checkbox.stories.tsx +0 -44
  185. package/src/stories/FavoriteButton.stories.tsx +0 -58
  186. package/src/stories/IconButton.stories.tsx +0 -68
  187. package/src/stories/ImageContentWrapper.stories.tsx +0 -65
  188. package/src/stories/Input.stories.tsx +0 -44
  189. package/src/stories/Label.stories.tsx +0 -19
  190. package/src/stories/List.stories.tsx +0 -64
  191. package/src/stories/MerchantCard.stories.tsx +0 -127
  192. package/src/stories/ProductCard.stories.tsx +0 -92
  193. package/src/stories/ProductLink.stories.tsx +0 -46
  194. package/src/stories/ProductVariantPrice.stories.tsx +0 -70
  195. package/src/stories/Progress.stories.tsx +0 -30
  196. package/src/stories/PullToRefreshList.stories.tsx +0 -122
  197. package/src/stories/QuantitySelector.stories.tsx +0 -78
  198. package/src/stories/RadioGroup.stories.tsx +0 -51
  199. package/src/stories/Search.stories.tsx +0 -37
  200. package/src/stories/Select.stories.tsx +0 -85
  201. package/src/stories/Skeleton.stories.tsx +0 -19
  202. package/src/stories/TextInput.stories.tsx +0 -26
  203. package/src/stories/Toaster.stories.tsx +0 -46
  204. package/src/stories/Touchable.stories.tsx +0 -40
  205. package/src/stories/VideoPlayer.stories.tsx +0 -129
@@ -1,11 +1,11 @@
1
1
  import { jsx as e, jsxs as g } from "react/jsx-runtime";
2
- import { useState as C, useCallback as y, createContext as k, useContext as P } from "react";
2
+ import { useState as C, useCallback as v, createContext as k, useContext as P } from "react";
3
3
  import { useProductSearch as I } from "../../hooks/product/useProductSearch.js";
4
4
  import { cn as p } from "../../lib/utils.js";
5
5
  import { IconButton as L } from "../atoms/icon-button.js";
6
6
  import { List as j } from "../atoms/list.js";
7
7
  import { Input as Q } from "../ui/input.js";
8
- import { ProductLink as v } from "./product-link.js";
8
+ import { ProductLink as y } from "./product-link.js";
9
9
  import { ProductLinkSkeleton as m } from "./product-link-skeleton.js";
10
10
  import q from "../../shop-minis-react/node_modules/.pnpm/lucide-react@0.513.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/search.js";
11
11
  import z from "../../shop-minis-react/node_modules/.pnpm/lucide-react@0.513.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/x.js";
@@ -17,11 +17,11 @@ function N() {
17
17
  return r;
18
18
  }
19
19
  function M({ initialQuery: r = "", children: c }) {
20
- const [o, i] = C(r), { products: n, loading: t, error: a, fetchMore: l, hasNextPage: d, isTyping: s } = I({
20
+ const [o, s] = C(r), { products: n, loading: t, error: a, fetchMore: l, hasNextPage: d, isTyping: i } = I({
21
21
  query: o,
22
22
  fetchPolicy: "network-only"
23
- }), u = y((f) => {
24
- i(f);
23
+ }), u = v((f) => {
24
+ s(f);
25
25
  }, []), h = {
26
26
  query: o,
27
27
  setQuery: u,
@@ -30,7 +30,7 @@ function M({ initialQuery: r = "", children: c }) {
30
30
  error: a,
31
31
  fetchMore: l,
32
32
  hasNextPage: d,
33
- isTyping: s
33
+ isTyping: i
34
34
  };
35
35
  return /* @__PURE__ */ e(S.Provider, { value: h, children: c });
36
36
  }
@@ -39,7 +39,7 @@ function A({
39
39
  className: c,
40
40
  inputProps: o
41
41
  }) {
42
- const { query: i, setQuery: n } = N(), t = y(
42
+ const { query: s, setQuery: n } = N(), t = v(
43
43
  (a) => {
44
44
  n(a.target.value), o?.onChange?.(a);
45
45
  },
@@ -62,7 +62,7 @@ function A({
62
62
  type: "search",
63
63
  role: "searchbox",
64
64
  autoComplete: "off",
65
- value: i,
65
+ value: s,
66
66
  "data-testid": "search-input",
67
67
  ...o,
68
68
  className: p(
@@ -71,7 +71,7 @@ function A({
71
71
  )
72
72
  }
73
73
  ) }),
74
- /* @__PURE__ */ e("div", { className: "relative flex items-center", children: i === "" ? null : /* @__PURE__ */ e(
74
+ /* @__PURE__ */ e("div", { className: "relative flex items-center", children: s === "" ? null : /* @__PURE__ */ e(
75
75
  L,
76
76
  {
77
77
  Icon: z,
@@ -88,9 +88,9 @@ function E({
88
88
  height: r = window.innerHeight,
89
89
  renderItem: c,
90
90
  initialStateComponent: o,
91
- showScrollbar: i
91
+ showScrollbar: s
92
92
  }) {
93
- const { query: n, products: t, loading: a, fetchMore: l, hasNextPage: d, isTyping: s } = N(), u = (x, w) => c ? c(x, w) : /* @__PURE__ */ e("div", { className: "p-2", children: /* @__PURE__ */ e(v, { product: x, hideFavoriteAction: !0 }, x.id) }), h = n.trim().length === 0, f = (!t || t.length === 0) && (a || s), b = (!t || t.length === 0) && !a;
93
+ const { query: n, products: t, loading: a, fetchMore: l, hasNextPage: d, isTyping: i } = N(), u = (x, w) => c ? c(x, w) : /* @__PURE__ */ e("div", { className: "p-2", children: /* @__PURE__ */ e(y, { product: x, hideFavoriteAction: !0 }, x.id) }), h = n.trim().length === 0, f = (!t || t.length === 0) && (a || i), b = (!t || t.length === 0) && !a;
94
94
  return h ? o || /* @__PURE__ */ e("div", { className: "flex items-center justify-center h-32 text-gray-500", children: "Start typing to search for products" }) : f ? /* @__PURE__ */ g("div", { className: "flex flex-col px-4 py-4", children: [
95
95
  /* @__PURE__ */ e(m, { className: "mb-4" }),
96
96
  /* @__PURE__ */ e(m, { className: "mb-4" }),
@@ -103,7 +103,7 @@ function E({
103
103
  height: r,
104
104
  renderItem: u,
105
105
  fetchMore: d ? l : void 0,
106
- showScrollbar: i
106
+ showScrollbar: s
107
107
  }
108
108
  );
109
109
  }
@@ -111,28 +111,28 @@ function J({
111
111
  initialQuery: r,
112
112
  placeholder: c,
113
113
  inputProps: o,
114
- height: i,
114
+ height: s,
115
115
  className: n,
116
116
  renderItem: t,
117
117
  itemHeight: a,
118
118
  onProductClick: l
119
119
  }) {
120
- const d = (s, u) => t ? t(s, u) : /* @__PURE__ */ e("div", { className: "p-2", children: /* @__PURE__ */ e(
121
- v,
120
+ const d = (i, u) => t ? t(i, u) : /* @__PURE__ */ e("div", { className: "p-2", children: /* @__PURE__ */ e(
121
+ y,
122
122
  {
123
- product: s,
123
+ product: i,
124
124
  hideFavoriteAction: !0,
125
125
  onClick: l
126
126
  },
127
- s.id
127
+ i.id
128
128
  ) });
129
- return /* @__PURE__ */ e(M, { initialQuery: r, children: /* @__PURE__ */ g("div", { className: p("flex flex-col ", n), children: [
130
- /* @__PURE__ */ e("div", { className: "fixed top-0 left-0 right-0 p-4 w-full z-20 bg-background", children: /* @__PURE__ */ e(A, { placeholder: c, inputProps: o }) }),
129
+ return /* @__PURE__ */ e(M, { initialQuery: r, children: /* @__PURE__ */ g("div", { className: p("flex flex-col relative", n), children: [
130
+ /* @__PURE__ */ e("div", { className: "absolute top-0 left-0 right-0 p-4 w-full z-20 bg-background", children: /* @__PURE__ */ e(A, { placeholder: c, inputProps: o }) }),
131
131
  /* @__PURE__ */ e("div", { className: "h-14" }),
132
132
  /* @__PURE__ */ e(
133
133
  E,
134
134
  {
135
- height: i,
135
+ height: s,
136
136
  renderItem: d,
137
137
  itemHeight: a,
138
138
  showScrollbar: !0
@@ -1 +1 @@
1
- {"version":3,"file":"search.js","sources":["../../../src/components/commerce/search.tsx"],"sourcesContent":["import * as React from 'react'\nimport {createContext, useContext, useState, useCallback} from 'react'\n\nimport {SearchIcon, X} from 'lucide-react'\n\nimport {useProductSearch} from '../../hooks/product/useProductSearch'\nimport {cn} from '../../lib/utils'\nimport {type Product} from '../../types'\nimport {IconButton} from '../atoms/icon-button'\nimport {List} from '../atoms/list'\nimport {Input} from '../ui/input'\n\nimport {ProductLink} from './product-link'\nimport {ProductLinkSkeleton} from './product-link-skeleton'\n\ninterface SearchContextValue {\n query: string\n setQuery: (query: string) => void\n products: Product[] | null\n loading: boolean\n error: Error | null\n fetchMore?: () => Promise<void>\n hasNextPage: boolean\n isTyping: boolean\n}\n\nconst SearchContext = createContext<SearchContextValue | null>(null)\n\nfunction useSearchContext() {\n const context = useContext(SearchContext)\n if (!context) {\n throw new Error('useSearchContext must be used within a SearchProvider')\n }\n return context\n}\n\nexport interface SearchProviderProps {\n initialQuery?: string\n children: React.ReactNode\n}\n\nfunction SearchProvider({initialQuery = '', children}: SearchProviderProps) {\n const [query, setQueryState] = useState(initialQuery)\n\n const {products, loading, error, fetchMore, hasNextPage, isTyping} =\n useProductSearch({\n query,\n fetchPolicy: 'network-only',\n })\n\n const setQuery = useCallback((newQuery: string) => {\n setQueryState(newQuery)\n }, [])\n\n const contextValue: SearchContextValue = {\n query,\n setQuery,\n products,\n loading,\n error,\n fetchMore,\n hasNextPage,\n isTyping,\n }\n\n return (\n <SearchContext.Provider value={contextValue}>\n {children}\n </SearchContext.Provider>\n )\n}\n\nexport interface SearchInputProps {\n placeholder?: string\n className?: string\n inputProps?: React.ComponentProps<'input'>\n}\n\nfunction SearchInput({\n placeholder = 'Search products...',\n className,\n inputProps,\n}: SearchInputProps) {\n const {query, setQuery} = useSearchContext()\n\n const handleQueryChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n setQuery(event.target.value)\n inputProps?.onChange?.(event)\n },\n [inputProps, setQuery]\n )\n\n return (\n <div className=\"relative flex flex-1 items-center rounded-full pl-4 pr-2 py-1 bg-gray-100\">\n <div className=\"relative flex items-center\">\n <SearchIcon\n size={18}\n className={cn('text-accent-foreground opacity-60')}\n />\n </div>\n <div className=\"relative flex-1 flex items-center mx-2\">\n <Input\n name=\"search\"\n onChange={handleQueryChange}\n placeholder={placeholder}\n type=\"search\"\n role=\"searchbox\"\n autoComplete=\"off\"\n value={query}\n data-testid=\"search-input\"\n {...inputProps}\n className={cn(\n `w-full flex overflow-hidden rounded-radius-28 border-none shadow-none py-4 px-0 text-text placeholder:text-text placeholder:opacity-60`,\n className\n )}\n />\n </div>\n <div className=\"relative flex items-center\">\n {query === '' ? null : (\n <IconButton\n Icon={X}\n size=\"sm\"\n filled={false}\n iconStyles=\"\"\n onClick={() => setQuery('')}\n buttonStyles=\"flex items-center rounded-radius-max bg-[var(--grayscale-l20)]\"\n />\n )}\n </div>\n </div>\n )\n}\n\nexport interface SearchResultsListProps {\n renderItem?: (product: Product, index: number) => React.ReactNode\n height?: number\n itemHeight?: number\n initialStateComponent?: React.JSX.Element\n showScrollbar?: boolean\n overscanCount?: number\n}\n\nfunction SearchResultsList({\n height = window.innerHeight,\n renderItem,\n initialStateComponent,\n showScrollbar,\n}: SearchResultsListProps) {\n const {query, products, loading, fetchMore, hasNextPage, isTyping} =\n useSearchContext()\n\n const _renderItem = (product: Product, index: number) => {\n if (renderItem) {\n return renderItem(product, index)\n }\n\n return (\n <div className=\"p-2\">\n <ProductLink key={product.id} product={product} hideFavoriteAction />\n </div>\n )\n }\n\n const shouldShowStartingState = query.trim().length === 0\n const shouldShowLoading =\n (!products || products.length === 0) && (loading || isTyping)\n const shouldShowEmptyState = (!products || products.length === 0) && !loading\n\n if (shouldShowStartingState) {\n return (\n initialStateComponent || (\n <div className=\"flex items-center justify-center h-32 text-gray-500\">\n Start typing to search for products\n </div>\n )\n )\n }\n\n if (shouldShowLoading) {\n return (\n <div className=\"flex flex-col px-4 py-4\">\n <ProductLinkSkeleton className=\"mb-4\" />\n <ProductLinkSkeleton className=\"mb-4\" />\n <ProductLinkSkeleton className=\"mb-4\" />\n <ProductLinkSkeleton className=\"mb-4\" />\n </div>\n )\n }\n\n if (shouldShowEmptyState) {\n return (\n <div className=\"flex items-center justify-center h-32 text-gray-500\">\n {`No products found for \"${query}\"`}\n </div>\n )\n }\n\n return (\n <List\n items={products || []}\n height={height}\n renderItem={_renderItem}\n fetchMore={hasNextPage ? fetchMore : undefined}\n showScrollbar={showScrollbar}\n />\n )\n}\n\ninterface SearchProviderPropsWithoutChildren\n extends Omit<SearchProviderProps, 'children'> {}\nexport interface SearchResultsProps\n extends SearchProviderPropsWithoutChildren,\n SearchInputProps,\n SearchResultsListProps {\n showSearchInput?: boolean\n onProductClick?: (product: Product) => void\n}\n\nfunction Search({\n initialQuery,\n placeholder,\n inputProps,\n height,\n className,\n renderItem,\n itemHeight,\n onProductClick,\n}: SearchResultsProps) {\n const _renderItem = (product: Product, index: number) => {\n if (renderItem) {\n return renderItem(product, index)\n }\n\n return (\n <div className=\"p-2\">\n <ProductLink\n key={product.id}\n product={product}\n hideFavoriteAction\n onClick={onProductClick}\n />\n </div>\n )\n }\n\n return (\n <SearchProvider initialQuery={initialQuery}>\n <div className={cn('flex flex-col ', className)}>\n <div className=\"fixed top-0 left-0 right-0 p-4 w-full z-20 bg-background\">\n <SearchInput placeholder={placeholder} inputProps={inputProps} />\n </div>\n <div className=\"h-14\" />\n <SearchResultsList\n height={height}\n renderItem={_renderItem}\n itemHeight={itemHeight}\n showScrollbar\n />\n </div>\n </SearchProvider>\n )\n}\n\nexport {SearchProvider, SearchInput, SearchResultsList, Search}\n"],"names":["SearchContext","createContext","useSearchContext","context","useContext","SearchProvider","initialQuery","children","query","setQueryState","useState","products","loading","error","fetchMore","hasNextPage","isTyping","useProductSearch","setQuery","useCallback","newQuery","contextValue","SearchInput","placeholder","className","inputProps","handleQueryChange","event","jsxs","jsx","SearchIcon","cn","Input","IconButton","X","SearchResultsList","height","renderItem","initialStateComponent","showScrollbar","_renderItem","product","index","ProductLink","shouldShowStartingState","shouldShowLoading","shouldShowEmptyState","ProductLinkSkeleton","List","Search","itemHeight","onProductClick"],"mappings":";;;;;;;;;;;AA0BA,MAAMA,IAAgBC,EAAyC,IAAI;AAEnE,SAASC,IAAmB;AACpB,QAAAC,IAAUC,EAAWJ,CAAa;AACxC,MAAI,CAACG;AACG,UAAA,IAAI,MAAM,uDAAuD;AAElE,SAAAA;AACT;AAOA,SAASE,EAAe,EAAC,cAAAC,IAAe,IAAI,UAAAC,KAAgC;AAC1E,QAAM,CAACC,GAAOC,CAAa,IAAIC,EAASJ,CAAY,GAE9C,EAAC,UAAAK,GAAU,SAAAC,GAAS,OAAAC,GAAO,WAAAC,GAAW,aAAAC,GAAa,UAAAC,MACvDC,EAAiB;AAAA,IACf,OAAAT;AAAA,IACA,aAAa;AAAA,EAAA,CACd,GAEGU,IAAWC,EAAY,CAACC,MAAqB;AACjD,IAAAX,EAAcW,CAAQ;AAAA,EACxB,GAAG,EAAE,GAECC,IAAmC;AAAA,IACvC,OAAAb;AAAA,IACA,UAAAU;AAAA,IACA,UAAAP;AAAA,IACA,SAAAC;AAAA,IACA,OAAAC;AAAA,IACA,WAAAC;AAAA,IACA,aAAAC;AAAA,IACA,UAAAC;AAAA,EACF;AAEA,2BACGhB,EAAc,UAAd,EAAuB,OAAOqB,GAC5B,UAA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AAiB;AAAA,EACA,YAAAE;AAAA,EACA,QAAAW;AAAA,EACA,WAAAZ;AAAA,EACA,YAAAa;AAAA,EACA,YAAAa;AAAA,EACA,gBAAAC;AACF,GAAuB;AACf,QAAAX,IAAc,CAACC,GAAkBC,MACjCL,IACKA,EAAWI,GAASC,CAAK,IAIhC,gBAAAb,EAAC,OAAI,EAAA,WAAU,OACb,UAAA,gBAAAA;AAAA,IAACc;AAAA,IAAA;AAAA,MAEC,SAAAF;AAAA,MACA,oBAAkB;AAAA,MAClB,SAASU;AAAA,IAAA;AAAA,IAHJV,EAAQ;AAAA,EAAA,GAKjB;AAKF,SAAA,gBAAAZ,EAACxB,KAAe,cAAAC,GACd,UAAA,gBAAAsB,EAAC,SAAI,WAAWG,EAAG,kBAAkBP,CAAS,GAC5C,UAAA;AAAA,IAAA,gBAAAK,EAAC,SAAI,WAAU,4DACb,4BAACP,GAAY,EAAA,aAAAC,GAA0B,YAAAE,GAAwB,EACjE,CAAA;AAAA,IACA,gBAAAI,EAAC,OAAI,EAAA,WAAU,OAAO,CAAA;AAAA,IACtB,gBAAAA;AAAA,MAACM;AAAA,MAAA;AAAA,QACC,QAAAC;AAAA,QACA,YAAYI;AAAA,QACZ,YAAAU;AAAA,QACA,eAAa;AAAA,MAAA;AAAA,IAAA;AAAA,EACf,EAAA,CACF,EACF,CAAA;AAEJ;"}
1
+ {"version":3,"file":"search.js","sources":["../../../src/components/commerce/search.tsx"],"sourcesContent":["import * as React from 'react'\nimport {createContext, useContext, useState, useCallback} from 'react'\n\nimport {SearchIcon, X} from 'lucide-react'\n\nimport {useProductSearch} from '../../hooks/product/useProductSearch'\nimport {cn} from '../../lib/utils'\nimport {type Product} from '../../types'\nimport {IconButton} from '../atoms/icon-button'\nimport {List} from '../atoms/list'\nimport {Input} from '../ui/input'\n\nimport {ProductLink} from './product-link'\nimport {ProductLinkSkeleton} from './product-link-skeleton'\n\ninterface SearchContextValue {\n query: string\n setQuery: (query: string) => void\n products: Product[] | null\n loading: boolean\n error: Error | null\n fetchMore?: () => Promise<void>\n hasNextPage: boolean\n isTyping: boolean\n}\n\nconst SearchContext = createContext<SearchContextValue | null>(null)\n\nfunction useSearchContext() {\n const context = useContext(SearchContext)\n if (!context) {\n throw new Error('useSearchContext must be used within a SearchProvider')\n }\n return context\n}\n\nexport interface SearchProviderProps {\n initialQuery?: string\n children: React.ReactNode\n}\n\nfunction SearchProvider({initialQuery = '', children}: SearchProviderProps) {\n const [query, setQueryState] = useState(initialQuery)\n\n const {products, loading, error, fetchMore, hasNextPage, isTyping} =\n useProductSearch({\n query,\n fetchPolicy: 'network-only',\n })\n\n const setQuery = useCallback((newQuery: string) => {\n setQueryState(newQuery)\n }, [])\n\n const contextValue: SearchContextValue = {\n query,\n setQuery,\n products,\n loading,\n error,\n fetchMore,\n hasNextPage,\n isTyping,\n }\n\n return (\n <SearchContext.Provider value={contextValue}>\n {children}\n </SearchContext.Provider>\n )\n}\n\nexport interface SearchInputProps {\n placeholder?: string\n className?: string\n inputProps?: React.ComponentProps<'input'>\n}\n\nfunction SearchInput({\n placeholder = 'Search products...',\n className,\n inputProps,\n}: SearchInputProps) {\n const {query, setQuery} = useSearchContext()\n\n const handleQueryChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n setQuery(event.target.value)\n inputProps?.onChange?.(event)\n },\n [inputProps, setQuery]\n )\n\n return (\n <div className=\"relative flex flex-1 items-center rounded-full pl-4 pr-2 py-1 bg-gray-100\">\n <div className=\"relative flex items-center\">\n <SearchIcon\n size={18}\n className={cn('text-accent-foreground opacity-60')}\n />\n </div>\n <div className=\"relative flex-1 flex items-center mx-2\">\n <Input\n name=\"search\"\n onChange={handleQueryChange}\n placeholder={placeholder}\n type=\"search\"\n role=\"searchbox\"\n autoComplete=\"off\"\n value={query}\n data-testid=\"search-input\"\n {...inputProps}\n className={cn(\n `w-full flex overflow-hidden rounded-radius-28 border-none shadow-none py-4 px-0 text-text placeholder:text-text placeholder:opacity-60`,\n className\n )}\n />\n </div>\n <div className=\"relative flex items-center\">\n {query === '' ? null : (\n <IconButton\n Icon={X}\n size=\"sm\"\n filled={false}\n iconStyles=\"\"\n onClick={() => setQuery('')}\n buttonStyles=\"flex items-center rounded-radius-max bg-[var(--grayscale-l20)]\"\n />\n )}\n </div>\n </div>\n )\n}\n\nexport interface SearchResultsListProps {\n renderItem?: (product: Product, index: number) => React.ReactNode\n height?: number\n itemHeight?: number\n initialStateComponent?: React.JSX.Element\n showScrollbar?: boolean\n overscanCount?: number\n}\n\nfunction SearchResultsList({\n height = window.innerHeight,\n renderItem,\n initialStateComponent,\n showScrollbar,\n}: SearchResultsListProps) {\n const {query, products, loading, fetchMore, hasNextPage, isTyping} =\n useSearchContext()\n\n const _renderItem = (product: Product, index: number) => {\n if (renderItem) {\n return renderItem(product, index)\n }\n\n return (\n <div className=\"p-2\">\n <ProductLink key={product.id} product={product} hideFavoriteAction />\n </div>\n )\n }\n\n const shouldShowStartingState = query.trim().length === 0\n const shouldShowLoading =\n (!products || products.length === 0) && (loading || isTyping)\n const shouldShowEmptyState = (!products || products.length === 0) && !loading\n\n if (shouldShowStartingState) {\n return (\n initialStateComponent || (\n <div className=\"flex items-center justify-center h-32 text-gray-500\">\n Start typing to search for products\n </div>\n )\n )\n }\n\n if (shouldShowLoading) {\n return (\n <div className=\"flex flex-col px-4 py-4\">\n <ProductLinkSkeleton className=\"mb-4\" />\n <ProductLinkSkeleton className=\"mb-4\" />\n <ProductLinkSkeleton className=\"mb-4\" />\n <ProductLinkSkeleton className=\"mb-4\" />\n </div>\n )\n }\n\n if (shouldShowEmptyState) {\n return (\n <div className=\"flex items-center justify-center h-32 text-gray-500\">\n {`No products found for \"${query}\"`}\n </div>\n )\n }\n\n return (\n <List\n items={products || []}\n height={height}\n renderItem={_renderItem}\n fetchMore={hasNextPage ? fetchMore : undefined}\n showScrollbar={showScrollbar}\n />\n )\n}\n\ninterface SearchProviderPropsWithoutChildren\n extends Omit<SearchProviderProps, 'children'> {}\nexport interface SearchResultsProps\n extends SearchProviderPropsWithoutChildren,\n SearchInputProps,\n SearchResultsListProps {\n showSearchInput?: boolean\n onProductClick?: (product: Product) => void\n}\n\nfunction Search({\n initialQuery,\n placeholder,\n inputProps,\n height,\n className,\n renderItem,\n itemHeight,\n onProductClick,\n}: SearchResultsProps) {\n const _renderItem = (product: Product, index: number) => {\n if (renderItem) {\n return renderItem(product, index)\n }\n\n return (\n <div className=\"p-2\">\n <ProductLink\n key={product.id}\n product={product}\n hideFavoriteAction\n onClick={onProductClick}\n />\n </div>\n )\n }\n\n return (\n <SearchProvider initialQuery={initialQuery}>\n <div className={cn('flex flex-col relative', className)}>\n <div className=\"absolute top-0 left-0 right-0 p-4 w-full z-20 bg-background\">\n <SearchInput placeholder={placeholder} inputProps={inputProps} />\n </div>\n <div className=\"h-14\" />\n <SearchResultsList\n height={height}\n renderItem={_renderItem}\n itemHeight={itemHeight}\n showScrollbar\n />\n </div>\n </SearchProvider>\n )\n}\n\nexport {SearchProvider, SearchInput, SearchResultsList, Search}\n"],"names":["SearchContext","createContext","useSearchContext","context","useContext","SearchProvider","initialQuery","children","query","setQueryState","useState","products","loading","error","fetchMore","hasNextPage","isTyping","useProductSearch","setQuery","useCallback","newQuery","contextValue","SearchInput","placeholder","className","inputProps","handleQueryChange","event","jsxs","jsx","SearchIcon","cn","Input","IconButton","X","SearchResultsList","height","renderItem","initialStateComponent","showScrollbar","_renderItem","product","index","ProductLink","shouldShowStartingState","shouldShowLoading","shouldShowEmptyState","ProductLinkSkeleton","List","Search","itemHeight","onProductClick"],"mappings":";;;;;;;;;;;AA0BA,MAAMA,IAAgBC,EAAyC,IAAI;AAEnE,SAASC,IAAmB;AACpB,QAAAC,IAAUC,EAAWJ,CAAa;AACxC,MAAI,CAACG;AACG,UAAA,IAAI,MAAM,uDAAuD;AAElE,SAAAA;AACT;AAOA,SAASE,EAAe,EAAC,cAAAC,IAAe,IAAI,UAAAC,KAAgC;AAC1E,QAAM,CAACC,GAAOC,CAAa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Z,YAAAU;AAAA,QACA,eAAa;AAAA,MAAA;AAAA,IAAA;AAAA,EACf,EAAA,CACF,EACF,CAAA;AAEJ;"}
@@ -1,6 +1,7 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
2
  import { useTheme as t } from "../../shop-minis-react/node_modules/.pnpm/next-themes@0.4.6_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/next-themes/dist/index.js";
3
3
  import { Toaster as s } 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";
4
+ import { toast as v } 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";
4
5
  const n = ({ ...r }) => {
5
6
  const { theme: o = "system" } = t();
6
7
  return /* @__PURE__ */ e(
@@ -18,6 +19,7 @@ const n = ({ ...r }) => {
18
19
  );
19
20
  };
20
21
  export {
21
- n as Toaster
22
+ n as Toaster,
23
+ v as toast
22
24
  };
23
25
  //# sourceMappingURL=sonner.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sonner.js","sources":["../../../src/components/ui/sonner.tsx"],"sourcesContent":["import {useTheme} from 'next-themes'\nimport {Toaster as Sonner, ToasterProps} from 'sonner'\n\nconst Toaster = ({...props}: ToasterProps) => {\n const {theme = 'system'} = useTheme()\n\n return (\n <Sonner\n theme={theme as ToasterProps['theme']}\n className=\"toaster group\"\n style={\n {\n '--normal-bg': 'var(--popover)',\n '--normal-text': 'var(--popover-foreground)',\n '--normal-border': 'var(--border)',\n } as React.CSSProperties\n }\n {...props}\n />\n )\n}\n\nexport {Toaster}\n"],"names":["Toaster","props","theme","useTheme","jsx","Sonner"],"mappings":";;;AAGA,MAAMA,IAAU,CAAC,EAAC,GAAGC,QAAyB;AAC5C,QAAM,EAAC,OAAAC,IAAQ,SAAQ,IAAIC,EAAS;AAGlC,SAAA,gBAAAC;AAAA,IAACC;AAAAA,IAAA;AAAA,MACC,OAAAH;AAAA,MACA,WAAU;AAAA,MACV,OACE;AAAA,QACE,eAAe;AAAA,QACf,iBAAiB;AAAA,QACjB,mBAAmB;AAAA,MACrB;AAAA,MAED,GAAGD;AAAA,IAAA;AAAA,EACN;AAEJ;"}
1
+ {"version":3,"file":"sonner.js","sources":["../../../src/components/ui/sonner.tsx"],"sourcesContent":["import {useTheme} from 'next-themes'\nimport {Toaster as Sonner, ToasterProps, toast} from 'sonner'\n\nconst Toaster = ({...props}: ToasterProps) => {\n const {theme = 'system'} = useTheme()\n\n return (\n <Sonner\n theme={theme as ToasterProps['theme']}\n className=\"toaster group\"\n style={\n {\n '--normal-bg': 'var(--popover)',\n '--normal-text': 'var(--popover-foreground)',\n '--normal-border': 'var(--border)',\n } as React.CSSProperties\n }\n {...props}\n />\n )\n}\n\nexport {Toaster, toast}\n"],"names":["Toaster","props","theme","useTheme","jsx","Sonner"],"mappings":";;;;AAGA,MAAMA,IAAU,CAAC,EAAC,GAAGC,QAAyB;AAC5C,QAAM,EAAC,OAAAC,IAAQ,SAAQ,IAAIC,EAAS;AAGlC,SAAA,gBAAAC;AAAA,IAACC;AAAAA,IAAA;AAAA,MACC,OAAAH;AAAA,MACA,WAAU;AAAA,MACV,OACE;AAAA,QACE,eAAe;AAAA,QACf,iBAAiB;AAAA,QACjB,mBAAmB;AAAA,MACrB;AAAA,MAED,GAAGD;AAAA,IAAA;AAAA,EACN;AAEJ;"}
@@ -1,24 +1,18 @@
1
- import { useMemo as m } from "react";
2
- import { useShopActions as u } from "../../internal/useShopActions.js";
3
- import { useShopActionsDataFetching as a } from "../../internal/useShopActionsDataFetching.js";
4
- const l = (o) => {
5
- const { getContent: e } = u(), { identifiers: n, skip: s = !1, ...r } = o, { data: t, ...i } = a(
6
- e,
7
- {
8
- identifiers: n,
9
- ...r
10
- },
11
- {
12
- skip: s,
13
- hook: "useContent"
14
- }
15
- ), c = m(() => t ?? null, [t]);
1
+ import { useShopActions as i } from "../../internal/useShopActions.js";
2
+ import { useShopActionQuery as p } from "../../internal/reactQuery/useShopActionQuery.js";
3
+ const u = (e) => {
4
+ const { getContent: n } = i(), { identifiers: t, skip: s = !1, ...o } = e, { data: r, ...c } = p(
5
+ ["content", t, o],
6
+ n,
7
+ { identifiers: t, ...o },
8
+ { skip: s }
9
+ );
16
10
  return {
17
- ...i,
18
- content: c
11
+ ...c,
12
+ content: r
19
13
  };
20
14
  };
21
15
  export {
22
- l as useContent
16
+ u as useContent
23
17
  };
24
18
  //# sourceMappingURL=useContent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useContent.js","sources":["../../../src/hooks/content/useContent.ts"],"sourcesContent":["import {useMemo} from 'react'\n\nimport {useShopActions} from '../../internal/useShopActions'\nimport {useShopActionsDataFetching} from '../../internal/useShopActionsDataFetching'\nimport {\n Content,\n ContentIdentifierInput,\n DataHookOptionsBase,\n DataHookReturnsBase,\n} from '../../types'\n\nexport interface UseContentParams extends DataHookOptionsBase {\n /**\n * The identifiers of the content to fetch.\n */\n identifiers: ContentIdentifierInput | ContentIdentifierInput[]\n}\n\ninterface UseContentReturns extends DataHookReturnsBase {\n /**\n * The content returned from the query.\n */\n content: Content[] | null\n}\n\nexport const useContent = (params: UseContentParams): UseContentReturns => {\n const {getContent} = useShopActions()\n const {identifiers, skip = false, ...restParams} = params\n\n const {data, ...rest} = useShopActionsDataFetching(\n getContent,\n {\n identifiers,\n ...restParams,\n },\n {\n skip,\n hook: 'useContent',\n }\n )\n\n const content = useMemo(() => {\n return data ?? null\n }, [data])\n\n return {\n ...rest,\n content,\n }\n}\n"],"names":["useContent","params","getContent","useShopActions","identifiers","skip","restParams","data","rest","useShopActionsDataFetching","content","useMemo"],"mappings":";;;AAyBa,MAAAA,IAAa,CAACC,MAAgD;AACnE,QAAA,EAAC,YAAAC,EAAU,IAAIC,EAAe,GAC9B,EAAC,aAAAC,GAAa,MAAAC,IAAO,IAAO,GAAGC,EAAc,IAAAL,GAE7C,EAAC,MAAAM,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtBP;AAAA,IACA;AAAA,MACE,aAAAE;AAAA,MACA,GAAGE;AAAA,IACL;AAAA,IACA;AAAA,MACE,MAAAD;AAAA,MACA,MAAM;AAAA,IAAA;AAAA,EAEV,GAEMK,IAAUC,EAAQ,MACfJ,KAAQ,MACd,CAACA,CAAI,CAAC;AAEF,SAAA;AAAA,IACL,GAAGC;AAAA,IACH,SAAAE;AAAA,EACF;AACF;"}
1
+ {"version":3,"file":"useContent.js","sources":["../../../src/hooks/content/useContent.ts"],"sourcesContent":["import {useShopActionQuery} from '../../internal/reactQuery'\nimport {useShopActions} from '../../internal/useShopActions'\nimport {\n Content,\n ContentIdentifierInput,\n DataHookOptionsBase,\n DataHookReturnsBase,\n} from '../../types'\n\nexport interface UseContentParams extends DataHookOptionsBase {\n /**\n * The identifiers of the content to fetch.\n */\n identifiers: ContentIdentifierInput | ContentIdentifierInput[]\n}\n\ninterface UseContentReturns extends DataHookReturnsBase {\n /**\n * The content returned from the query.\n */\n content: Content[] | null\n}\n\nexport const useContent = (params: UseContentParams): UseContentReturns => {\n const {getContent} = useShopActions()\n const {identifiers, skip = false, ...restParams} = params\n\n const {data, ...rest} = useShopActionQuery(\n ['content', identifiers, restParams],\n getContent,\n {identifiers, ...restParams},\n {skip}\n )\n\n return {\n ...rest,\n content: data,\n }\n}\n"],"names":["useContent","params","getContent","useShopActions","identifiers","skip","restParams","data","rest","useShopActionQuery"],"mappings":";;AAuBa,MAAAA,IAAa,CAACC,MAAgD;AACnE,QAAA,EAAC,YAAAC,EAAU,IAAIC,EAAe,GAC9B,EAAC,aAAAC,GAAa,MAAAC,IAAO,IAAO,GAAGC,EAAc,IAAAL,GAE7C,EAAC,MAAAM,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtB,CAAC,WAAWL,GAAaE,CAAU;AAAA,IACnCJ;AAAA,IACA,EAAC,aAAAE,GAAa,GAAGE,EAAU;AAAA,IAC3B,EAAC,MAAAD,EAAI;AAAA,EACP;AAEO,SAAA;AAAA,IACL,GAAGG;AAAA,IACH,SAASD;AAAA,EACX;AACF;"}
@@ -1,8 +1,8 @@
1
1
  import { useNavigate as c, useLocation as u } from "../../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";
2
2
  import { DATA_NAVIGATION_TYPE_ATTRIBUTE as r } from "../../types/index.js";
3
- function l() {
3
+ function d() {
4
4
  const e = c(), o = u();
5
- return (t, i) => {
5
+ return (t, n) => {
6
6
  if (typeof t == "number") {
7
7
  if (document.startViewTransition)
8
8
  document.startViewTransition(() => {
@@ -11,8 +11,8 @@ function l() {
11
11
  document.documentElement.removeAttribute(
12
12
  r
13
13
  );
14
- }).catch((n) => {
15
- console.error("View transition error:", n);
14
+ }).catch((i) => {
15
+ console.error("View transition error:", i);
16
16
  });
17
17
  else
18
18
  return e(t);
@@ -22,22 +22,21 @@ function l() {
22
22
  if (document.startViewTransition)
23
23
  document.startViewTransition(() => {
24
24
  e(t, {
25
- preventScrollReset: !0,
26
25
  replace: a,
27
- ...i
28
- });
26
+ ...n
27
+ }), n?.preventScrollReset !== !0 && window.scrollTo(0, 0);
29
28
  }).finished.then(() => {
30
29
  document.documentElement.removeAttribute(
31
30
  r
32
31
  );
33
- }).catch((n) => {
34
- console.error("View transition error:", n);
32
+ }).catch((i) => {
33
+ console.error("View transition error:", i);
35
34
  });
36
35
  else
37
- return e(t, i);
36
+ return e(t, n);
38
37
  };
39
38
  }
40
39
  export {
41
- l as useNavigateWithTransition
40
+ d as useNavigateWithTransition
42
41
  };
43
42
  //# sourceMappingURL=useNavigateWithTransition.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useNavigateWithTransition.js","sources":["../../../src/hooks/navigation/useNavigateWithTransition.ts"],"sourcesContent":["import {useLocation, useNavigate, NavigateOptions} from 'react-router'\n\nimport {DATA_NAVIGATION_TYPE_ATTRIBUTE} from '../../types'\n\ntype UseNavigateWithTransitionReturns = (\n to: string | number,\n options?: NavigateOptions\n) => void | Promise<void>\n\nexport function useNavigateWithTransition(): UseNavigateWithTransitionReturns {\n const navigate = useNavigate()\n const location = useLocation()\n\n const transitionNavigate = (\n to: string | number,\n options?: NavigateOptions\n ) => {\n if (typeof to === 'number') {\n // Delta navigation - no options parameter\n if (document.startViewTransition) {\n const transition = document.startViewTransition(() => {\n navigate(to)\n })\n\n transition.finished\n .then(() => {\n document.documentElement.removeAttribute(\n DATA_NAVIGATION_TYPE_ATTRIBUTE\n )\n })\n .catch(error => {\n console.error('View transition error:', error)\n })\n } else {\n return navigate(to)\n }\n return\n }\n\n const isSameRoute = to === location.pathname\n\n // Path navigation - with options\n if (document.startViewTransition) {\n const transition = document.startViewTransition(() => {\n navigate(to, {\n preventScrollReset: true,\n replace: isSameRoute,\n ...options,\n })\n })\n\n transition.finished\n .then(() => {\n document.documentElement.removeAttribute(\n DATA_NAVIGATION_TYPE_ATTRIBUTE\n )\n })\n .catch(error => {\n console.error('View transition error:', error)\n })\n } else {\n return navigate(to, options)\n }\n }\n\n return transitionNavigate\n}\n"],"names":["useNavigateWithTransition","navigate","useNavigate","location","useLocation","to","options","DATA_NAVIGATION_TYPE_ATTRIBUTE","error","isSameRoute"],"mappings":";;AASO,SAASA,IAA8D;AAC5E,QAAMC,IAAWC,EAAY,GACvBC,IAAWC,EAAY;AAsDtB,SApDoB,CACzBC,GACAC,MACG;AACC,QAAA,OAAOD,KAAO,UAAU;AAE1B,UAAI,SAAS;AAKA,QAJQ,SAAS,oBAAoB,MAAM;AACpD,UAAAJ,EAASI,CAAE;AAAA,QAAA,CACZ,EAEU,SACR,KAAK,MAAM;AACV,mBAAS,gBAAgB;AAAA,YACvBE;AAAA,UACF;AAAA,QAAA,CACD,EACA,MAAM,CAASC,MAAA;AACN,kBAAA,MAAM,0BAA0BA,CAAK;AAAA,QAAA,CAC9C;AAAA;AAEH,eAAOP,EAASI,CAAE;AAEpB;AAAA,IAAA;AAGI,UAAAI,IAAcJ,MAAOF,EAAS;AAGpC,QAAI,SAAS;AASA,MARQ,SAAS,oBAAoB,MAAM;AACpD,QAAAF,EAASI,GAAI;AAAA,UACX,oBAAoB;AAAA,UACpB,SAASI;AAAA,UACT,GAAGH;AAAA,QAAA,CACJ;AAAA,MAAA,CACF,EAEU,SACR,KAAK,MAAM;AACV,iBAAS,gBAAgB;AAAA,UACvBC;AAAA,QACF;AAAA,MAAA,CACD,EACA,MAAM,CAASC,MAAA;AACN,gBAAA,MAAM,0BAA0BA,CAAK;AAAA,MAAA,CAC9C;AAAA;AAEI,aAAAP,EAASI,GAAIC,CAAO;AAAA,EAE/B;AAGF;"}
1
+ {"version":3,"file":"useNavigateWithTransition.js","sources":["../../../src/hooks/navigation/useNavigateWithTransition.ts"],"sourcesContent":["import {useLocation, useNavigate, NavigateOptions} from 'react-router'\n\nimport {DATA_NAVIGATION_TYPE_ATTRIBUTE} from '../../types'\n\ntype UseNavigateWithTransitionReturns = (\n to: string | number,\n options?: NavigateOptions\n) => void | Promise<void>\n\nexport function useNavigateWithTransition(): UseNavigateWithTransitionReturns {\n const navigate = useNavigate()\n const location = useLocation()\n\n const transitionNavigate = (\n to: string | number,\n options?: NavigateOptions\n ) => {\n if (typeof to === 'number') {\n // Delta navigation - no options parameter\n if (document.startViewTransition) {\n const transition = document.startViewTransition(() => {\n navigate(to)\n })\n\n transition.finished\n .then(() => {\n document.documentElement.removeAttribute(\n DATA_NAVIGATION_TYPE_ATTRIBUTE\n )\n })\n .catch(error => {\n console.error('View transition error:', error)\n })\n } else {\n return navigate(to)\n }\n return\n }\n\n const isSameRoute = to === location.pathname\n\n // Path navigation - with options\n if (document.startViewTransition) {\n const transition = document.startViewTransition(() => {\n navigate(to, {\n replace: isSameRoute,\n ...options,\n })\n\n if (options?.preventScrollReset !== true) {\n window.scrollTo(0, 0)\n }\n })\n\n transition.finished\n .then(() => {\n document.documentElement.removeAttribute(\n DATA_NAVIGATION_TYPE_ATTRIBUTE\n )\n })\n .catch(error => {\n console.error('View transition error:', error)\n })\n } else {\n return navigate(to, options)\n }\n }\n\n return transitionNavigate\n}\n"],"names":["useNavigateWithTransition","navigate","useNavigate","location","useLocation","to","options","DATA_NAVIGATION_TYPE_ATTRIBUTE","error","isSameRoute"],"mappings":";;AASO,SAASA,IAA8D;AAC5E,QAAMC,IAAWC,EAAY,GACvBC,IAAWC,EAAY;AAyDtB,SAvDoB,CACzBC,GACAC,MACG;AACC,QAAA,OAAOD,KAAO,UAAU;AAE1B,UAAI,SAAS;AAKA,QAJQ,SAAS,oBAAoB,MAAM;AACpD,UAAAJ,EAASI,CAAE;AAAA,QAAA,CACZ,EAEU,SACR,KAAK,MAAM;AACV,mBAAS,gBAAgB;AAAA,YACvBE;AAAA,UACF;AAAA,QAAA,CACD,EACA,MAAM,CAASC,MAAA;AACN,kBAAA,MAAM,0BAA0BA,CAAK;AAAA,QAAA,CAC9C;AAAA;AAEH,eAAOP,EAASI,CAAE;AAEpB;AAAA,IAAA;AAGI,UAAAI,IAAcJ,MAAOF,EAAS;AAGpC,QAAI,SAAS;AAYA,MAXQ,SAAS,oBAAoB,MAAM;AACpD,QAAAF,EAASI,GAAI;AAAA,UACX,SAASI;AAAA,UACT,GAAGH;AAAA,QAAA,CACJ,GAEGA,GAAS,uBAAuB,MAC3B,OAAA,SAAS,GAAG,CAAC;AAAA,MACtB,CACD,EAEU,SACR,KAAK,MAAM;AACV,iBAAS,gBAAgB;AAAA,UACvBC;AAAA,QACF;AAAA,MAAA,CACD,EACA,MAAM,CAASC,MAAA;AACN,gBAAA,MAAM,0BAA0BA,CAAK;AAAA,MAAA,CAC9C;AAAA;AAEI,aAAAP,EAASI,GAAIC,CAAO;AAAA,EAE/B;AAGF;"}
@@ -1,20 +1,18 @@
1
1
  import { useShopActions as u } from "../../internal/useShopActions.js";
2
- import { useShopActionsPaginatedDataFetching as a } from "../../internal/useShopActionsPaginatedDataFetching.js";
3
- const i = (t) => {
4
- const { getCuratedProducts: o } = u(), { skip: s, ...r } = t ?? {}, { data: e, ...c } = a(
5
- o,
2
+ import { useShopActionInfiniteQuery as n } from "../../internal/reactQuery/useShopActionInfiniteQuery.js";
3
+ const p = (o) => {
4
+ const { getCuratedProducts: r } = u(), { skip: s, ...t } = o ?? {}, { data: c, ...e } = n(
5
+ ["curatedProducts", t],
6
6
  r,
7
- {
8
- skip: s,
9
- hook: "useCuratedProducts"
10
- }
7
+ t,
8
+ { skip: s }
11
9
  );
12
10
  return {
13
- ...c,
14
- products: e
11
+ ...e,
12
+ products: c
15
13
  };
16
14
  };
17
15
  export {
18
- i as useCuratedProducts
16
+ p as useCuratedProducts
19
17
  };
20
18
  //# sourceMappingURL=useCuratedProducts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCuratedProducts.js","sources":["../../../src/hooks/product/useCuratedProducts.ts"],"sourcesContent":["import {useShopActions} from '../../internal/useShopActions'\nimport {useShopActionsPaginatedDataFetching} from '../../internal/useShopActionsPaginatedDataFetching'\nimport {\n Product,\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n} from '../../types'\n\ninterface UseCuratedProductsParams extends PaginatedDataHookOptionsBase {\n handle: string\n requiredTags?: string[]\n anyOfTags?: string[]\n}\n\ninterface UseCuratedProductsReturns extends PaginatedDataHookReturnsBase {\n products: Product[] | null\n}\n\n/**\n * @param options - The options for the query\n */\nexport const useCuratedProducts = (\n params: UseCuratedProductsParams\n): UseCuratedProductsReturns => {\n const {getCuratedProducts} = useShopActions()\n const {skip, ...shopActionParams} = params ?? {}\n\n const {data, ...rest} = useShopActionsPaginatedDataFetching(\n getCuratedProducts,\n shopActionParams,\n {\n skip,\n hook: 'useCuratedProducts',\n }\n )\n\n return {\n ...rest,\n products: data,\n }\n}\n"],"names":["useCuratedProducts","params","getCuratedProducts","useShopActions","skip","shopActionParams","data","rest","useShopActionsPaginatedDataFetching"],"mappings":";;AAqBa,MAAAA,IAAqB,CAChCC,MAC8B;AACxB,QAAA,EAAC,oBAAAC,EAAkB,IAAIC,EAAe,GACtC,EAAC,MAAAC,GAAM,GAAGC,EAAgB,IAAIJ,KAAU,CAAC,GAEzC,EAAC,MAAAK,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtBN;AAAA,IACAG;AAAA,IACA;AAAA,MACE,MAAAD;AAAA,MACA,MAAM;AAAA,IAAA;AAAA,EAEV;AAEO,SAAA;AAAA,IACL,GAAGG;AAAA,IACH,UAAUD;AAAA,EACZ;AACF;"}
1
+ {"version":3,"file":"useCuratedProducts.js","sources":["../../../src/hooks/product/useCuratedProducts.ts"],"sourcesContent":["import {useShopActionInfiniteQuery} from '../../internal/reactQuery'\nimport {useShopActions} from '../../internal/useShopActions'\nimport {\n Product,\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n} from '../../types'\n\ninterface UseCuratedProductsParams extends PaginatedDataHookOptionsBase {\n handle: string\n requiredTags?: string[]\n anyOfTags?: string[]\n}\n\ninterface UseCuratedProductsReturns extends PaginatedDataHookReturnsBase {\n products: Product[] | null\n}\n\n/**\n * @param options - The options for the query\n */\nexport const useCuratedProducts = (\n params: UseCuratedProductsParams\n): UseCuratedProductsReturns => {\n const {getCuratedProducts} = useShopActions()\n const {skip, ...shopActionParams} = params ?? {}\n\n const {data, ...rest} = useShopActionInfiniteQuery(\n ['curatedProducts', shopActionParams],\n getCuratedProducts,\n shopActionParams,\n {skip}\n )\n\n return {\n ...rest,\n products: data,\n }\n}\n"],"names":["useCuratedProducts","params","getCuratedProducts","useShopActions","skip","shopActionParams","data","rest","useShopActionInfiniteQuery"],"mappings":";;AAqBa,MAAAA,IAAqB,CAChCC,MAC8B;AACxB,QAAA,EAAC,oBAAAC,EAAkB,IAAIC,EAAe,GACtC,EAAC,MAAAC,GAAM,GAAGC,EAAgB,IAAIJ,KAAU,CAAC,GAEzC,EAAC,MAAAK,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtB,CAAC,mBAAmBH,CAAgB;AAAA,IACpCH;AAAA,IACAG;AAAA,IACA,EAAC,MAAAD,EAAI;AAAA,EACP;AAEO,SAAA;AAAA,IACL,GAAGG;AAAA,IACH,UAAUD;AAAA,EACZ;AACF;"}
@@ -1,20 +1,18 @@
1
- import { useShopActions as a } from "../../internal/useShopActions.js";
2
- import { useShopActionsPaginatedDataFetching as p } from "../../internal/useShopActionsPaginatedDataFetching.js";
3
- const i = (o) => {
4
- const { getPopularProducts: t } = a(), { skip: s, ...r } = o ?? {}, { data: c, ...u } = p(
5
- t,
1
+ import { useShopActions as c } from "../../internal/useShopActions.js";
2
+ import { useShopActionInfiniteQuery as n } from "../../internal/reactQuery/useShopActionInfiniteQuery.js";
3
+ const a = (t) => {
4
+ const { getPopularProducts: r } = c(), { skip: s, ...o } = t ?? {}, { data: p, ...u } = n(
5
+ ["popularProducts", o],
6
6
  r,
7
- {
8
- skip: s,
9
- hook: "usePopularProducts"
10
- }
7
+ o,
8
+ { skip: s }
11
9
  );
12
10
  return {
13
11
  ...u,
14
- products: c
12
+ products: p
15
13
  };
16
14
  };
17
15
  export {
18
- i as usePopularProducts
16
+ a as usePopularProducts
19
17
  };
20
18
  //# sourceMappingURL=usePopularProducts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"usePopularProducts.js","sources":["../../../src/hooks/product/usePopularProducts.ts"],"sourcesContent":["import {useShopActions} from '../../internal/useShopActions'\nimport {useShopActionsPaginatedDataFetching} from '../../internal/useShopActionsPaginatedDataFetching'\nimport {\n Product,\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n} from '../../types'\n\ninterface UsePopularProductsParams extends PaginatedDataHookOptionsBase {}\n\ninterface UsePopularProductsReturns extends PaginatedDataHookReturnsBase {\n products: Product[] | null\n}\n\n/**\n * @param options - The options for the query\n */\nexport const usePopularProducts = (\n params?: UsePopularProductsParams\n): UsePopularProductsReturns => {\n const {getPopularProducts} = useShopActions()\n const {skip, ...shopActionParams} = params ?? {}\n\n const {data, ...rest} = useShopActionsPaginatedDataFetching(\n getPopularProducts,\n shopActionParams,\n {\n skip,\n hook: 'usePopularProducts',\n }\n )\n\n return {\n ...rest,\n products: data,\n }\n}\n"],"names":["usePopularProducts","params","getPopularProducts","useShopActions","skip","shopActionParams","data","rest","useShopActionsPaginatedDataFetching"],"mappings":";;AAiBa,MAAAA,IAAqB,CAChCC,MAC8B;AACxB,QAAA,EAAC,oBAAAC,EAAkB,IAAIC,EAAe,GACtC,EAAC,MAAAC,GAAM,GAAGC,EAAgB,IAAIJ,KAAU,CAAC,GAEzC,EAAC,MAAAK,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtBN;AAAA,IACAG;AAAA,IACA;AAAA,MACE,MAAAD;AAAA,MACA,MAAM;AAAA,IAAA;AAAA,EAEV;AAEO,SAAA;AAAA,IACL,GAAGG;AAAA,IACH,UAAUD;AAAA,EACZ;AACF;"}
1
+ {"version":3,"file":"usePopularProducts.js","sources":["../../../src/hooks/product/usePopularProducts.ts"],"sourcesContent":["import {useShopActionInfiniteQuery} from '../../internal/reactQuery'\nimport {useShopActions} from '../../internal/useShopActions'\nimport {\n Product,\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n} from '../../types'\n\ninterface UsePopularProductsParams extends PaginatedDataHookOptionsBase {}\n\ninterface UsePopularProductsReturns extends PaginatedDataHookReturnsBase {\n products: Product[] | null\n}\n\n/**\n * @param options - The options for the query\n */\nexport const usePopularProducts = (\n params?: UsePopularProductsParams\n): UsePopularProductsReturns => {\n const {getPopularProducts} = useShopActions()\n const {skip, ...shopActionParams} = params ?? {}\n\n const {data, ...rest} = useShopActionInfiniteQuery(\n ['popularProducts', shopActionParams],\n getPopularProducts,\n shopActionParams,\n {skip}\n )\n\n return {\n ...rest,\n products: data,\n }\n}\n"],"names":["usePopularProducts","params","getPopularProducts","useShopActions","skip","shopActionParams","data","rest","useShopActionInfiniteQuery"],"mappings":";;AAiBa,MAAAA,IAAqB,CAChCC,MAC8B;AACxB,QAAA,EAAC,oBAAAC,EAAkB,IAAIC,EAAe,GACtC,EAAC,MAAAC,GAAM,GAAGC,EAAgB,IAAIJ,KAAU,CAAC,GAEzC,EAAC,MAAAK,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtB,CAAC,mBAAmBH,CAAgB;AAAA,IACpCH;AAAA,IACAG;AAAA,IACA,EAAC,MAAAD,EAAI;AAAA,EACP;AAEO,SAAA;AAAA,IACL,GAAGG;AAAA,IACH,UAAUD;AAAA,EACZ;AACF;"}
@@ -1,24 +1,18 @@
1
- import { useMemo as i } from "react";
2
- import { useShopActions as m } from "../../internal/useShopActions.js";
3
- import { useShopActionsDataFetching as p } from "../../internal/useShopActionsDataFetching.js";
4
- const h = (t) => {
5
- const { getProduct: r } = m(), { id: s, skip: e = !1, ...c } = t, { data: o, ...u } = p(
6
- r,
7
- {
8
- id: s,
9
- ...c
10
- },
11
- {
12
- skip: e,
13
- hook: "useProduct"
14
- }
15
- ), n = i(() => o ?? null, [o]);
1
+ import { useShopActions as p } from "../../internal/useShopActions.js";
2
+ import { useShopActionQuery as n } from "../../internal/reactQuery/useShopActionQuery.js";
3
+ const a = (r) => {
4
+ const { getProduct: s } = p(), { id: t, skip: c = !1, ...o } = r, { data: e, ...u } = n(
5
+ ["product", t, o],
6
+ s,
7
+ { id: t, ...o },
8
+ { skip: c }
9
+ );
16
10
  return {
17
11
  ...u,
18
- product: n
12
+ product: e
19
13
  };
20
14
  };
21
15
  export {
22
- h as useProduct
16
+ a as useProduct
23
17
  };
24
18
  //# sourceMappingURL=useProduct.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useProduct.js","sources":["../../../src/hooks/product/useProduct.ts"],"sourcesContent":["import {useMemo} from 'react'\n\nimport {useShopActions} from '../../internal/useShopActions'\nimport {useShopActionsDataFetching} from '../../internal/useShopActionsDataFetching'\nimport {DataHookOptionsBase, DataHookReturnsBase, Product} from '../../types'\n\nexport interface UseProductParams extends DataHookOptionsBase {\n /**\n * The product ID to fetch.\n */\n id: string\n}\n\ninterface UseProductReturns extends DataHookReturnsBase {\n /**\n * The product returned from the query.\n */\n product: Product | null\n}\n\nexport const useProduct = (params: UseProductParams): UseProductReturns => {\n const {getProduct} = useShopActions()\n const {id, skip = false, ...restParams} = params\n\n const {data, ...rest} = useShopActionsDataFetching(\n getProduct,\n {\n id,\n ...restParams,\n },\n {\n skip,\n hook: 'useProduct',\n }\n )\n\n const product = useMemo(() => {\n return data ?? null\n }, [data])\n\n return {\n ...rest,\n product,\n }\n}\n"],"names":["useProduct","params","getProduct","useShopActions","id","skip","restParams","data","rest","useShopActionsDataFetching","product","useMemo"],"mappings":";;;AAoBa,MAAAA,IAAa,CAACC,MAAgD;AACnE,QAAA,EAAC,YAAAC,EAAU,IAAIC,EAAe,GAC9B,EAAC,IAAAC,GAAI,MAAAC,IAAO,IAAO,GAAGC,EAAc,IAAAL,GAEpC,EAAC,MAAAM,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtBP;AAAA,IACA;AAAA,MACE,IAAAE;AAAA,MACA,GAAGE;AAAA,IACL;AAAA,IACA;AAAA,MACE,MAAAD;AAAA,MACA,MAAM;AAAA,IAAA;AAAA,EAEV,GAEMK,IAAUC,EAAQ,MACfJ,KAAQ,MACd,CAACA,CAAI,CAAC;AAEF,SAAA;AAAA,IACL,GAAGC;AAAA,IACH,SAAAE;AAAA,EACF;AACF;"}
1
+ {"version":3,"file":"useProduct.js","sources":["../../../src/hooks/product/useProduct.ts"],"sourcesContent":["import {useShopActionQuery} from '../../internal/reactQuery'\nimport {useShopActions} from '../../internal/useShopActions'\nimport {DataHookOptionsBase, DataHookReturnsBase, Product} from '../../types'\n\nexport interface UseProductParams extends DataHookOptionsBase {\n /**\n * The product ID to fetch.\n */\n id: string\n}\n\ninterface UseProductReturns extends DataHookReturnsBase {\n /**\n * The product returned from the query.\n */\n product: Product | null\n}\n\nexport const useProduct = (params: UseProductParams): UseProductReturns => {\n const {getProduct} = useShopActions()\n const {id, skip = false, ...restParams} = params\n\n const {data, ...rest} = useShopActionQuery(\n ['product', id, restParams],\n getProduct,\n {id, ...restParams},\n {skip}\n )\n\n return {\n ...rest,\n product: data,\n }\n}\n"],"names":["useProduct","params","getProduct","useShopActions","id","skip","restParams","data","rest","useShopActionQuery"],"mappings":";;AAkBa,MAAAA,IAAa,CAACC,MAAgD;AACnE,QAAA,EAAC,YAAAC,EAAU,IAAIC,EAAe,GAC9B,EAAC,IAAAC,GAAI,MAAAC,IAAO,IAAO,GAAGC,EAAc,IAAAL,GAEpC,EAAC,MAAAM,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtB,CAAC,WAAWL,GAAIE,CAAU;AAAA,IAC1BJ;AAAA,IACA,EAAC,IAAAE,GAAI,GAAGE,EAAU;AAAA,IAClB,EAAC,MAAAD,EAAI;AAAA,EACP;AAEO,SAAA;AAAA,IACL,GAAGG;AAAA,IACH,SAASD;AAAA,EACX;AACF;"}
@@ -1,29 +1,18 @@
1
- import { useCallback as e } from "react";
2
- import { useShopActions as a } from "../../internal/useShopActions.js";
3
- import { useShopActionsPaginatedDataFetching as d } from "../../internal/useShopActionsPaginatedDataFetching.js";
4
- import { MiniEntityNotFoundError as m } from "../../utils/errors.js";
5
- const l = (t) => {
6
- const { getProductList: o } = a(), { skip: s, ...r } = t ?? {}, i = e((u) => {
7
- if (u === null)
8
- throw new m({
9
- hook: "useProductList",
10
- message: "Product list not found"
11
- });
12
- }, []), { data: n, ...c } = d(
13
- o,
14
- r,
15
- {
16
- skip: s,
17
- hook: "useProductList",
18
- validator: i
19
- }
1
+ import { useShopActions as n } from "../../internal/useShopActions.js";
2
+ import { useShopActionInfiniteQuery as e } from "../../internal/reactQuery/useShopActionInfiniteQuery.js";
3
+ const d = (o) => {
4
+ const { getProductList: s } = n(), { skip: r, ...t } = o ?? {}, { data: i, ...c } = e(
5
+ ["productList", t],
6
+ s,
7
+ t,
8
+ { skip: r }
20
9
  );
21
10
  return {
22
11
  ...c,
23
- productList: n
12
+ productList: i
24
13
  };
25
14
  };
26
15
  export {
27
- l as useProductList
16
+ d as useProductList
28
17
  };
29
18
  //# sourceMappingURL=useProductList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useProductList.js","sources":["../../../src/hooks/product/useProductList.ts"],"sourcesContent":["import {useCallback} from 'react'\n\nimport {useShopActions} from '../../internal/useShopActions'\nimport {useShopActionsPaginatedDataFetching} from '../../internal/useShopActionsPaginatedDataFetching'\nimport {\n ProductList,\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n} from '../../types'\nimport {MiniEntityNotFoundError} from '../../utils/errors'\n\ninterface UseProductListParams extends PaginatedDataHookOptionsBase {\n /**\n * The GID of the product list. E.g. `gid://shopapp/ProductList/123`.\n */\n id?: string\n /**\n * The public ID of the product list.\n */\n publicId?: string\n}\n\ninterface UseProductListResult extends PaginatedDataHookReturnsBase {\n productList: ProductList | null\n}\n\nexport const useProductList = (\n params?: UseProductListParams\n): UseProductListResult => {\n const {getProductList} = useShopActions()\n const {skip, ...shopActionParams} = params ?? {}\n\n const validator = useCallback((data: ProductList | null) => {\n if (data === null) {\n throw new MiniEntityNotFoundError({\n hook: 'useProductList',\n message: 'Product list not found',\n })\n }\n }, [])\n\n const {data, ...rest} = useShopActionsPaginatedDataFetching(\n getProductList,\n shopActionParams,\n {\n skip,\n hook: 'useProductList',\n validator,\n }\n )\n\n return {\n ...rest,\n productList: data,\n }\n}\n"],"names":["useProductList","params","getProductList","useShopActions","skip","shopActionParams","validator","useCallback","data","MiniEntityNotFoundError","rest","useShopActionsPaginatedDataFetching"],"mappings":";;;;AA0Ba,MAAAA,IAAiB,CAC5BC,MACyB;AACnB,QAAA,EAAC,gBAAAC,EAAc,IAAIC,EAAe,GAClC,EAAC,MAAAC,GAAM,GAAGC,EAAgB,IAAIJ,KAAU,CAAC,GAEzCK,IAAYC,EAAY,CAACC,MAA6B;AAC1D,QAAIA,MAAS;AACX,YAAM,IAAIC,EAAwB;AAAA,QAChC,MAAM;AAAA,QACN,SAAS;AAAA,MAAA,CACV;AAAA,EAEL,GAAG,EAAE,GAEC,EAAC,MAAAD,GAAM,GAAGE,EAAA,IAAQC;AAAA,IACtBT;AAAA,IACAG;AAAA,IACA;AAAA,MACE,MAAAD;AAAA,MACA,MAAM;AAAA,MACN,WAAAE;AAAA,IAAA;AAAA,EAEJ;AAEO,SAAA;AAAA,IACL,GAAGI;AAAA,IACH,aAAaF;AAAA,EACf;AACF;"}
1
+ {"version":3,"file":"useProductList.js","sources":["../../../src/hooks/product/useProductList.ts"],"sourcesContent":["import {useShopActionInfiniteQuery} from '../../internal/reactQuery'\nimport {useShopActions} from '../../internal/useShopActions'\nimport {\n ProductList,\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n} from '../../types'\n\ninterface UseProductListParams extends PaginatedDataHookOptionsBase {\n /**\n * The GID of the product list. E.g. `gid://shopapp/ProductList/123`.\n */\n id?: string\n /**\n * The public ID of the product list.\n */\n publicId?: string\n}\n\ninterface UseProductListResult extends PaginatedDataHookReturnsBase {\n productList: ProductList | null\n}\n\nexport const useProductList = (\n params?: UseProductListParams\n): UseProductListResult => {\n const {getProductList} = useShopActions()\n const {skip, ...shopActionParams} = params ?? {}\n\n const {data, ...rest} = useShopActionInfiniteQuery(\n ['productList', shopActionParams],\n getProductList,\n shopActionParams,\n {skip}\n )\n\n return {\n ...rest,\n productList: data,\n }\n}\n"],"names":["useProductList","params","getProductList","useShopActions","skip","shopActionParams","data","rest","useShopActionInfiniteQuery"],"mappings":";;AAuBa,MAAAA,IAAiB,CAC5BC,MACyB;AACnB,QAAA,EAAC,gBAAAC,EAAc,IAAIC,EAAe,GAClC,EAAC,MAAAC,GAAM,GAAGC,EAAgB,IAAIJ,KAAU,CAAC,GAEzC,EAAC,MAAAK,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtB,CAAC,eAAeH,CAAgB;AAAA,IAChCH;AAAA,IACAG;AAAA,IACA,EAAC,MAAAD,EAAI;AAAA,EACP;AAEO,SAAA;AAAA,IACL,GAAGG;AAAA,IACH,aAAaD;AAAA,EACf;AACF;"}
@@ -1,20 +1,18 @@
1
- import { useShopActions as e } from "../../internal/useShopActions.js";
2
- import { useShopActionsPaginatedDataFetching as n } from "../../internal/useShopActionsPaginatedDataFetching.js";
3
- const p = (t) => {
4
- const { getProductLists: s } = e(), { skip: o, ...r } = t ?? {}, { data: c, ...i } = n(
5
- s,
6
- r,
7
- {
8
- skip: o,
9
- hook: "useProductLists"
10
- }
1
+ import { useShopActions as n } from "../../internal/useShopActions.js";
2
+ import { useShopActionInfiniteQuery as e } from "../../internal/reactQuery/useShopActionInfiniteQuery.js";
3
+ const d = (s) => {
4
+ const { getProductLists: o } = n(), { skip: r, ...t } = s ?? {}, { data: i, ...c } = e(
5
+ ["productLists", t],
6
+ o,
7
+ t,
8
+ { skip: r }
11
9
  );
12
10
  return {
13
- ...i,
14
- productLists: c
11
+ ...c,
12
+ productLists: i
15
13
  };
16
14
  };
17
15
  export {
18
- p as useProductLists
16
+ d as useProductLists
19
17
  };
20
18
  //# sourceMappingURL=useProductLists.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useProductLists.js","sources":["../../../src/hooks/product/useProductLists.ts"],"sourcesContent":["import {useShopActions} from '../../internal/useShopActions'\nimport {useShopActionsPaginatedDataFetching} from '../../internal/useShopActionsPaginatedDataFetching'\nimport {\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n ProductList,\n} from '../../types'\n\ninterface UseProductListsParams extends PaginatedDataHookOptionsBase {\n /**\n * The number of products to fetch per product list.\n */\n itemsFirst?: number\n}\n\ninterface UseProductListsResult extends PaginatedDataHookReturnsBase {\n productLists: ProductList[] | null\n}\n\nexport const useProductLists = (\n params?: UseProductListsParams\n): UseProductListsResult => {\n const {getProductLists} = useShopActions()\n const {skip, ...shopActionParams} = params ?? {}\n\n const {data, ...rest} = useShopActionsPaginatedDataFetching(\n getProductLists,\n shopActionParams,\n {\n skip,\n hook: 'useProductLists',\n }\n )\n\n return {\n ...rest,\n productLists: data,\n }\n}\n"],"names":["useProductLists","params","getProductLists","useShopActions","skip","shopActionParams","data","rest","useShopActionsPaginatedDataFetching"],"mappings":";;AAmBa,MAAAA,IAAkB,CAC7BC,MAC0B;AACpB,QAAA,EAAC,iBAAAC,EAAe,IAAIC,EAAe,GACnC,EAAC,MAAAC,GAAM,GAAGC,EAAgB,IAAIJ,KAAU,CAAC,GAEzC,EAAC,MAAAK,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtBN;AAAA,IACAG;AAAA,IACA;AAAA,MACE,MAAAD;AAAA,MACA,MAAM;AAAA,IAAA;AAAA,EAEV;AAEO,SAAA;AAAA,IACL,GAAGG;AAAA,IACH,cAAcD;AAAA,EAChB;AACF;"}
1
+ {"version":3,"file":"useProductLists.js","sources":["../../../src/hooks/product/useProductLists.ts"],"sourcesContent":["import {useShopActionInfiniteQuery} from '../../internal/reactQuery'\nimport {useShopActions} from '../../internal/useShopActions'\nimport {\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n ProductList,\n} from '../../types'\n\ninterface UseProductListsParams extends PaginatedDataHookOptionsBase {\n /**\n * The number of products to fetch per product list.\n */\n itemsFirst?: number\n}\n\ninterface UseProductListsResult extends PaginatedDataHookReturnsBase {\n productLists: ProductList[] | null\n}\n\nexport const useProductLists = (\n params?: UseProductListsParams\n): UseProductListsResult => {\n const {getProductLists} = useShopActions()\n const {skip, ...shopActionParams} = params ?? {}\n\n const {data, ...rest} = useShopActionInfiniteQuery(\n ['productLists', shopActionParams],\n getProductLists,\n shopActionParams,\n {skip}\n )\n\n return {\n ...rest,\n productLists: data,\n }\n}\n"],"names":["useProductLists","params","getProductLists","useShopActions","skip","shopActionParams","data","rest","useShopActionInfiniteQuery"],"mappings":";;AAmBa,MAAAA,IAAkB,CAC7BC,MAC0B;AACpB,QAAA,EAAC,iBAAAC,EAAe,IAAIC,EAAe,GACnC,EAAC,MAAAC,GAAM,GAAGC,EAAgB,IAAIJ,KAAU,CAAC,GAEzC,EAAC,MAAAK,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtB,CAAC,gBAAgBH,CAAgB;AAAA,IACjCH;AAAA,IACAG;AAAA,IACA,EAAC,MAAAD,EAAI;AAAA,EACP;AAEO,SAAA;AAAA,IACL,GAAGG;AAAA,IACH,cAAcD;AAAA,EAChB;AACF;"}
@@ -1,24 +1,18 @@
1
- import { useMemo as c } from "react";
2
- import { useShopActions as u } from "../../internal/useShopActions.js";
3
- import { useShopActionsPaginatedDataFetching as d } from "../../internal/useShopActionsPaginatedDataFetching.js";
4
- const f = (o) => {
5
- const { getProductMedia: e } = u(), { id: r, skip: s = !1, ...a } = o, { data: t, ...i } = d(
6
- e,
7
- {
8
- id: r,
9
- ...a
10
- },
11
- {
12
- skip: s,
13
- hook: "useProductMedia"
14
- }
15
- ), n = c(() => t ?? null, [t]);
1
+ import { useShopActions as c } from "../../internal/useShopActions.js";
2
+ import { useShopActionInfiniteQuery as d } from "../../internal/reactQuery/useShopActionInfiniteQuery.js";
3
+ const p = (e) => {
4
+ const { getProductMedia: r } = c(), { id: t, skip: s = !1, ...o } = e, { data: i, ...a } = d(
5
+ ["productMedia", t, o],
6
+ r,
7
+ { id: t, ...o },
8
+ { skip: s }
9
+ );
16
10
  return {
17
- ...i,
18
- media: n
11
+ ...a,
12
+ media: i
19
13
  };
20
14
  };
21
15
  export {
22
- f as useProductMedia
16
+ p as useProductMedia
23
17
  };
24
18
  //# sourceMappingURL=useProductMedia.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useProductMedia.js","sources":["../../../src/hooks/product/useProductMedia.ts"],"sourcesContent":["import {useMemo} from 'react'\n\nimport {useShopActions} from '../../internal/useShopActions'\nimport {useShopActionsPaginatedDataFetching} from '../../internal/useShopActionsPaginatedDataFetching'\nimport {\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n ProductMedia,\n} from '../../types'\n\nexport interface UseProductMediaParams extends PaginatedDataHookOptionsBase {\n /**\n * The product ID to fetch media for.\n */\n id: string\n}\n\ninterface UseProductMediaReturns extends PaginatedDataHookReturnsBase {\n /**\n * The product media returned from the query.\n */\n media: ProductMedia[] | null\n}\n\nexport const useProductMedia = (\n params: UseProductMediaParams\n): UseProductMediaReturns => {\n const {getProductMedia} = useShopActions()\n const {id, skip = false, ...restParams} = params\n\n const {data, ...rest} = useShopActionsPaginatedDataFetching(\n getProductMedia,\n {\n id,\n ...restParams,\n },\n {\n skip,\n hook: 'useProductMedia',\n }\n )\n\n const media = useMemo(() => {\n return data ?? null\n }, [data])\n\n return {\n ...rest,\n media,\n }\n}\n"],"names":["useProductMedia","params","getProductMedia","useShopActions","id","skip","restParams","data","rest","useShopActionsPaginatedDataFetching","media","useMemo"],"mappings":";;;AAwBa,MAAAA,IAAkB,CAC7BC,MAC2B;AACrB,QAAA,EAAC,iBAAAC,EAAe,IAAIC,EAAe,GACnC,EAAC,IAAAC,GAAI,MAAAC,IAAO,IAAO,GAAGC,EAAc,IAAAL,GAEpC,EAAC,MAAAM,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtBP;AAAA,IACA;AAAA,MACE,IAAAE;AAAA,MACA,GAAGE;AAAA,IACL;AAAA,IACA;AAAA,MACE,MAAAD;AAAA,MACA,MAAM;AAAA,IAAA;AAAA,EAEV,GAEMK,IAAQC,EAAQ,MACbJ,KAAQ,MACd,CAACA,CAAI,CAAC;AAEF,SAAA;AAAA,IACL,GAAGC;AAAA,IACH,OAAAE;AAAA,EACF;AACF;"}
1
+ {"version":3,"file":"useProductMedia.js","sources":["../../../src/hooks/product/useProductMedia.ts"],"sourcesContent":["import {useShopActionInfiniteQuery} from '../../internal/reactQuery'\nimport {useShopActions} from '../../internal/useShopActions'\nimport {\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n ProductMedia,\n} from '../../types'\n\nexport interface UseProductMediaParams extends PaginatedDataHookOptionsBase {\n /**\n * The product ID to fetch media for.\n */\n id: string\n}\n\ninterface UseProductMediaReturns extends PaginatedDataHookReturnsBase {\n /**\n * The product media returned from the query.\n */\n media: ProductMedia[] | null\n}\n\nexport const useProductMedia = (\n params: UseProductMediaParams\n): UseProductMediaReturns => {\n const {getProductMedia} = useShopActions()\n const {id, skip = false, ...restParams} = params\n\n const {data, ...rest} = useShopActionInfiniteQuery(\n ['productMedia', id, restParams],\n getProductMedia,\n {id, ...restParams},\n {skip}\n )\n\n return {\n ...rest,\n media: data,\n }\n}\n"],"names":["useProductMedia","params","getProductMedia","useShopActions","id","skip","restParams","data","rest","useShopActionInfiniteQuery"],"mappings":";;AAsBa,MAAAA,IAAkB,CAC7BC,MAC2B;AACrB,QAAA,EAAC,iBAAAC,EAAe,IAAIC,EAAe,GACnC,EAAC,IAAAC,GAAI,MAAAC,IAAO,IAAO,GAAGC,EAAc,IAAAL,GAEpC,EAAC,MAAAM,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtB,CAAC,gBAAgBL,GAAIE,CAAU;AAAA,IAC/BJ;AAAA,IACA,EAAC,IAAAE,GAAI,GAAGE,EAAU;AAAA,IAClB,EAAC,MAAAD,EAAI;AAAA,EACP;AAEO,SAAA;AAAA,IACL,GAAGG;AAAA,IACH,OAAOD;AAAA,EACT;AACF;"}