@shopify/shop-minis-react 0.3.4 → 0.4.1

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 (185) hide show
  1. package/dist/_virtual/index3.js +2 -5
  2. package/dist/_virtual/index3.js.map +1 -1
  3. package/dist/_virtual/index4.js +5 -2
  4. package/dist/_virtual/index4.js.map +1 -1
  5. package/dist/components/MinisContainer.js +11 -10
  6. package/dist/components/MinisContainer.js.map +1 -1
  7. package/dist/hooks/content/useContent.js +12 -18
  8. package/dist/hooks/content/useContent.js.map +1 -1
  9. package/dist/hooks/product/useCuratedProducts.js +9 -11
  10. package/dist/hooks/product/useCuratedProducts.js.map +1 -1
  11. package/dist/hooks/product/usePopularProducts.js +9 -11
  12. package/dist/hooks/product/usePopularProducts.js.map +1 -1
  13. package/dist/hooks/product/useProduct.js +11 -17
  14. package/dist/hooks/product/useProduct.js.map +1 -1
  15. package/dist/hooks/product/useProductList.js +10 -21
  16. package/dist/hooks/product/useProductList.js.map +1 -1
  17. package/dist/hooks/product/useProductLists.js +11 -13
  18. package/dist/hooks/product/useProductLists.js.map +1 -1
  19. package/dist/hooks/product/useProductMedia.js +12 -18
  20. package/dist/hooks/product/useProductMedia.js.map +1 -1
  21. package/dist/hooks/product/useProductSearch.js +34 -27
  22. package/dist/hooks/product/useProductSearch.js.map +1 -1
  23. package/dist/hooks/product/useProductVariants.js +11 -14
  24. package/dist/hooks/product/useProductVariants.js.map +1 -1
  25. package/dist/hooks/product/useProducts.js +12 -11
  26. package/dist/hooks/product/useProducts.js.map +1 -1
  27. package/dist/hooks/product/useRecommendedProducts.js +11 -13
  28. package/dist/hooks/product/useRecommendedProducts.js.map +1 -1
  29. package/dist/hooks/shop/useRecommendedShops.js +11 -13
  30. package/dist/hooks/shop/useRecommendedShops.js.map +1 -1
  31. package/dist/hooks/shop/useShop.js +12 -11
  32. package/dist/hooks/shop/useShop.js.map +1 -1
  33. package/dist/hooks/user/useBuyerAttributes.js +8 -10
  34. package/dist/hooks/user/useBuyerAttributes.js.map +1 -1
  35. package/dist/hooks/user/useCurrentUser.js +7 -9
  36. package/dist/hooks/user/useCurrentUser.js.map +1 -1
  37. package/dist/hooks/user/useFollowedShops.js +11 -14
  38. package/dist/hooks/user/useFollowedShops.js.map +1 -1
  39. package/dist/hooks/user/useOrders.js +7 -9
  40. package/dist/hooks/user/useOrders.js.map +1 -1
  41. package/dist/hooks/user/useRecentProducts.js +11 -13
  42. package/dist/hooks/user/useRecentProducts.js.map +1 -1
  43. package/dist/hooks/user/useRecentShops.js +10 -13
  44. package/dist/hooks/user/useRecentShops.js.map +1 -1
  45. package/dist/hooks/user/useSavedProducts.js +10 -13
  46. package/dist/hooks/user/useSavedProducts.js.map +1 -1
  47. package/dist/hooks/util/useImagePicker.js +13 -6
  48. package/dist/hooks/util/useImagePicker.js.map +1 -1
  49. package/dist/internal/reactQuery/MinisQueryProvider.js +11 -0
  50. package/dist/internal/reactQuery/MinisQueryProvider.js.map +1 -0
  51. package/dist/internal/reactQuery/queryClient.js +33 -0
  52. package/dist/internal/reactQuery/queryClient.js.map +1 -0
  53. package/dist/internal/reactQuery/useShopActionInfiniteQuery.js +52 -0
  54. package/dist/internal/reactQuery/useShopActionInfiniteQuery.js.map +1 -0
  55. package/dist/internal/reactQuery/useShopActionQuery.js +37 -0
  56. package/dist/internal/reactQuery/useShopActionQuery.js.map +1 -0
  57. package/dist/internal/utils/resizeImage.js +61 -0
  58. package/dist/internal/utils/resizeImage.js.map +1 -0
  59. package/dist/providers/ImagePickerProvider.js +123 -102
  60. package/dist/providers/ImagePickerProvider.js.map +1 -1
  61. 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
  62. 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
  63. 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
  64. 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
  65. 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
  66. 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
  67. 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
  68. 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
  69. 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
  70. 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
  71. 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
  72. 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
  73. 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
  74. 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
  75. 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
  76. 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
  77. 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
  78. 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
  79. 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
  80. 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
  81. 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
  82. 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
  83. 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
  84. 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
  85. 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
  86. 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
  87. 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
  88. 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
  89. 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
  90. 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
  91. 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
  92. 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
  93. 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
  94. 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
  95. 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
  96. 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
  97. 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
  98. 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
  99. 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
  100. 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
  101. 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
  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/suspense.js.map +1 -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/useBaseQuery.js +64 -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/useBaseQuery.js.map +1 -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/useInfiniteQuery.js +13 -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/useInfiniteQuery.js.map +1 -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/useQuery.js +9 -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/useQuery.js.map +1 -0
  109. package/dist/shop-minis-react/node_modules/.pnpm/querystringify@2.2.0/node_modules/querystringify/index.js +1 -1
  110. package/dist/shop-minis-react/node_modules/.pnpm/video.js@8.23.3/node_modules/video.js/dist/video.es.js +1 -1
  111. package/package.json +2 -7
  112. package/src/components/MinisContainer.tsx +6 -3
  113. package/src/hooks/content/useContent.ts +6 -17
  114. package/src/hooks/product/useCuratedProducts.ts +4 -6
  115. package/src/hooks/product/usePopularProducts.ts +4 -6
  116. package/src/hooks/product/useProduct.ts +6 -17
  117. package/src/hooks/product/useProductList.ts +4 -19
  118. package/src/hooks/product/useProductLists.ts +4 -6
  119. package/src/hooks/product/useProductMedia.ts +6 -17
  120. package/src/hooks/product/useProductSearch.ts +19 -15
  121. package/src/hooks/product/useProductVariants.ts +5 -13
  122. package/src/hooks/product/useProducts.ts +8 -12
  123. package/src/hooks/product/useRecommendedProducts.ts +4 -6
  124. package/src/hooks/shop/useRecommendedShops.ts +4 -6
  125. package/src/hooks/shop/useShop.ts +8 -12
  126. package/src/hooks/user/useBuyerAttributes.ts +4 -6
  127. package/src/hooks/user/useCurrentUser.ts +4 -6
  128. package/src/hooks/user/useFollowedShops.ts +5 -13
  129. package/src/hooks/user/useOrders.ts +4 -6
  130. package/src/hooks/user/useRecentProducts.ts +4 -6
  131. package/src/hooks/user/useRecentShops.ts +5 -13
  132. package/src/hooks/user/useSavedProducts.ts +5 -13
  133. package/src/hooks/util/useImagePicker.test.tsx +193 -0
  134. package/src/hooks/util/useImagePicker.ts +24 -5
  135. package/src/internal/reactQuery/MinisQueryProvider.test.tsx +38 -0
  136. package/src/internal/reactQuery/MinisQueryProvider.tsx +16 -0
  137. package/src/internal/reactQuery/index.ts +8 -0
  138. package/src/internal/reactQuery/queryClient.test.tsx +91 -0
  139. package/src/internal/reactQuery/queryClient.ts +43 -0
  140. package/src/internal/reactQuery/useShopActionInfiniteQuery.test.tsx +357 -0
  141. package/src/internal/reactQuery/useShopActionInfiniteQuery.ts +129 -0
  142. package/src/internal/reactQuery/useShopActionQuery.test.tsx +184 -0
  143. package/src/internal/reactQuery/useShopActionQuery.ts +74 -0
  144. package/src/internal/utils/resizeImage.test.ts +314 -0
  145. package/src/internal/utils/resizeImage.ts +108 -0
  146. package/src/providers/ImagePickerProvider.test.tsx +32 -1
  147. package/src/providers/ImagePickerProvider.tsx +108 -65
  148. package/dist/internal/useShopActionsDataFetching.js +0 -79
  149. package/dist/internal/useShopActionsDataFetching.js.map +0 -1
  150. package/dist/internal/useShopActionsPaginatedDataFetching.js +0 -96
  151. package/dist/internal/useShopActionsPaginatedDataFetching.js.map +0 -1
  152. package/src/hooks/product/useProductSearch.test.ts +0 -470
  153. package/src/internal/useShopActionsDataFetching.test.ts +0 -465
  154. package/src/internal/useShopActionsDataFetching.ts +0 -150
  155. package/src/internal/useShopActionsPaginatedDataFetching.ts +0 -188
  156. package/src/stories/Accordion.stories.tsx +0 -124
  157. package/src/stories/AddToCart.stories.tsx +0 -251
  158. package/src/stories/Alert.stories.tsx +0 -38
  159. package/src/stories/AlertDialog.stories.tsx +0 -48
  160. package/src/stories/Avatar.stories.tsx +0 -29
  161. package/src/stories/Badge.stories.tsx +0 -46
  162. package/src/stories/Button.stories.tsx +0 -81
  163. package/src/stories/Card.stories.tsx +0 -40
  164. package/src/stories/Checkbox.stories.tsx +0 -44
  165. package/src/stories/FavoriteButton.stories.tsx +0 -58
  166. package/src/stories/IconButton.stories.tsx +0 -68
  167. package/src/stories/ImageContentWrapper.stories.tsx +0 -65
  168. package/src/stories/Input.stories.tsx +0 -44
  169. package/src/stories/Label.stories.tsx +0 -19
  170. package/src/stories/List.stories.tsx +0 -64
  171. package/src/stories/MerchantCard.stories.tsx +0 -127
  172. package/src/stories/ProductCard.stories.tsx +0 -92
  173. package/src/stories/ProductLink.stories.tsx +0 -46
  174. package/src/stories/ProductVariantPrice.stories.tsx +0 -70
  175. package/src/stories/Progress.stories.tsx +0 -30
  176. package/src/stories/PullToRefreshList.stories.tsx +0 -122
  177. package/src/stories/QuantitySelector.stories.tsx +0 -78
  178. package/src/stories/RadioGroup.stories.tsx +0 -51
  179. package/src/stories/Search.stories.tsx +0 -37
  180. package/src/stories/Select.stories.tsx +0 -85
  181. package/src/stories/Skeleton.stories.tsx +0 -19
  182. package/src/stories/TextInput.stories.tsx +0 -26
  183. package/src/stories/Toaster.stories.tsx +0 -46
  184. package/src/stories/Touchable.stories.tsx +0 -40
  185. package/src/stories/VideoPlayer.stories.tsx +0 -129
@@ -1,17 +1,18 @@
1
- import { useMemo as n } from "react";
2
- import { useShopActions as m } from "../../internal/useShopActions.js";
3
- import { useShopActionsDataFetching as p } from "../../internal/useShopActionsDataFetching.js";
4
- const f = (t) => {
5
- const { getProducts: s } = m(), { skip: r = !1, ...e } = t, { data: o, ...c } = p(s, e, {
6
- skip: r,
7
- hook: "useProducts"
8
- }), u = n(() => o ?? null, [o]);
1
+ import { useShopActions as u } from "../../internal/useShopActions.js";
2
+ import { useShopActionQuery as p } from "../../internal/reactQuery/useShopActionQuery.js";
3
+ const d = (o) => {
4
+ const { getProducts: s } = u(), { skip: r = !1, ...t } = o, { data: c, ...e } = p(
5
+ ["products", t],
6
+ s,
7
+ t,
8
+ { skip: r }
9
+ );
9
10
  return {
10
- ...c,
11
- products: u
11
+ ...e,
12
+ products: c
12
13
  };
13
14
  };
14
15
  export {
15
- f as useProducts
16
+ d as useProducts
16
17
  };
17
18
  //# sourceMappingURL=useProducts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useProducts.js","sources":["../../../src/hooks/product/useProducts.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 UseProductsParams extends DataHookOptionsBase {\n /**\n * The product IDs to fetch.\n */\n ids: string[]\n}\n\ninterface UseProductsReturns extends DataHookReturnsBase {\n /**\n * The products returned from the query.\n */\n products: Product[] | null\n}\n\nexport const useProducts = (params: UseProductsParams): UseProductsReturns => {\n const {getProducts} = useShopActions()\n const {skip = false, ...restParams} = params\n\n const {data, ...rest} = useShopActionsDataFetching(getProducts, restParams, {\n skip,\n hook: 'useProducts',\n })\n\n const products = useMemo(() => {\n return data ?? null\n }, [data])\n\n return {\n ...rest,\n products,\n }\n}\n"],"names":["useProducts","params","getProducts","useShopActions","skip","restParams","data","rest","useShopActionsDataFetching","products","useMemo"],"mappings":";;;AAoBa,MAAAA,IAAc,CAACC,MAAkD;AACtE,QAAA,EAAC,aAAAC,EAAW,IAAIC,EAAe,GAC/B,EAAC,MAAAC,IAAO,IAAO,GAAGC,EAAc,IAAAJ,GAEhC,EAAC,MAAAK,GAAM,GAAGC,EAAQ,IAAAC,EAA2BN,GAAaG,GAAY;AAAA,IAC1E,MAAAD;AAAA,IACA,MAAM;AAAA,EAAA,CACP,GAEKK,IAAWC,EAAQ,MAChBJ,KAAQ,MACd,CAACA,CAAI,CAAC;AAEF,SAAA;AAAA,IACL,GAAGC;AAAA,IACH,UAAAE;AAAA,EACF;AACF;"}
1
+ {"version":3,"file":"useProducts.js","sources":["../../../src/hooks/product/useProducts.ts"],"sourcesContent":["import {useShopActionQuery} from '../../internal/reactQuery'\nimport {useShopActions} from '../../internal/useShopActions'\nimport {DataHookOptionsBase, DataHookReturnsBase, Product} from '../../types'\n\nexport interface UseProductsParams extends DataHookOptionsBase {\n /**\n * The product IDs to fetch.\n */\n ids: string[]\n}\n\ninterface UseProductsReturns extends DataHookReturnsBase {\n /**\n * The products returned from the query.\n */\n products: Product[] | null\n}\n\nexport const useProducts = (params: UseProductsParams): UseProductsReturns => {\n const {getProducts} = useShopActions()\n const {skip = false, ...restParams} = params\n\n const {data, ...rest} = useShopActionQuery(\n ['products', restParams],\n getProducts,\n restParams,\n {skip}\n )\n\n return {\n ...rest,\n products: data,\n }\n}\n"],"names":["useProducts","params","getProducts","useShopActions","skip","restParams","data","rest","useShopActionQuery"],"mappings":";;AAkBa,MAAAA,IAAc,CAACC,MAAkD;AACtE,QAAA,EAAC,aAAAC,EAAW,IAAIC,EAAe,GAC/B,EAAC,MAAAC,IAAO,IAAO,GAAGC,EAAc,IAAAJ,GAEhC,EAAC,MAAAK,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtB,CAAC,YAAYH,CAAU;AAAA,IACvBH;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 r } from "../../internal/useShopActions.js";
2
- import { useShopActionsPaginatedDataFetching as d } from "../../internal/useShopActionsPaginatedDataFetching.js";
3
- const a = (o) => {
4
- const { getRecommendedProducts: t } = r(), { skip: e, ...s } = o ?? {}, { data: c, ...n } = d(
5
- t,
6
- s,
7
- {
8
- skip: e,
9
- hook: "useRecommendedProducts"
10
- }
1
+ import { useShopActions as n } from "../../internal/useShopActions.js";
2
+ import { useShopActionInfiniteQuery as d } from "../../internal/reactQuery/useShopActionInfiniteQuery.js";
3
+ const i = (t) => {
4
+ const { getRecommendedProducts: e } = n(), { skip: s, ...o } = t ?? {}, { data: r, ...c } = d(
5
+ ["recommendedProducts", o],
6
+ e,
7
+ o,
8
+ { skip: s }
11
9
  );
12
10
  return {
13
- ...n,
14
- products: c
11
+ ...c,
12
+ products: r
15
13
  };
16
14
  };
17
15
  export {
18
- a as useRecommendedProducts
16
+ i as useRecommendedProducts
19
17
  };
20
18
  //# sourceMappingURL=useRecommendedProducts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useRecommendedProducts.js","sources":["../../../src/hooks/product/useRecommendedProducts.ts"],"sourcesContent":["import {useShopActions} from '../../internal/useShopActions'\nimport {useShopActionsPaginatedDataFetching} from '../../internal/useShopActionsPaginatedDataFetching'\nimport {\n Product,\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n} from '../../types'\n\ninterface UseRecommendedProductsParams extends PaginatedDataHookOptionsBase {}\n\ninterface UseRecommendedProductsReturns extends PaginatedDataHookReturnsBase {\n products: Product[] | null\n}\n\n/**\n * @param options - The options for the query\n */\nexport const useRecommendedProducts = (\n params?: UseRecommendedProductsParams\n): UseRecommendedProductsReturns => {\n const {getRecommendedProducts} = useShopActions()\n const {skip, ...shopActionParams} = params ?? {}\n\n const {data, ...rest} = useShopActionsPaginatedDataFetching(\n getRecommendedProducts,\n shopActionParams,\n {\n skip,\n hook: 'useRecommendedProducts',\n }\n )\n\n return {\n ...rest,\n products: data,\n }\n}\n"],"names":["useRecommendedProducts","params","getRecommendedProducts","useShopActions","skip","shopActionParams","data","rest","useShopActionsPaginatedDataFetching"],"mappings":";;AAiBa,MAAAA,IAAyB,CACpCC,MACkC;AAC5B,QAAA,EAAC,wBAAAC,EAAsB,IAAIC,EAAe,GAC1C,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":"useRecommendedProducts.js","sources":["../../../src/hooks/product/useRecommendedProducts.ts"],"sourcesContent":["import {useShopActionInfiniteQuery} from '../../internal/reactQuery'\nimport {useShopActions} from '../../internal/useShopActions'\nimport {\n Product,\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n} from '../../types'\n\ninterface UseRecommendedProductsParams extends PaginatedDataHookOptionsBase {}\n\ninterface UseRecommendedProductsReturns extends PaginatedDataHookReturnsBase {\n products: Product[] | null\n}\n\n/**\n * @param options - The options for the query\n */\nexport const useRecommendedProducts = (\n params?: UseRecommendedProductsParams\n): UseRecommendedProductsReturns => {\n const {getRecommendedProducts} = useShopActions()\n const {skip, ...shopActionParams} = params ?? {}\n\n const {data, ...rest} = useShopActionInfiniteQuery(\n ['recommendedProducts', shopActionParams],\n getRecommendedProducts,\n shopActionParams,\n {skip}\n )\n\n return {\n ...rest,\n products: data,\n }\n}\n"],"names":["useRecommendedProducts","params","getRecommendedProducts","useShopActions","skip","shopActionParams","data","rest","useShopActionInfiniteQuery"],"mappings":";;AAiBa,MAAAA,IAAyB,CACpCC,MACkC;AAC5B,QAAA,EAAC,wBAAAC,EAAsB,IAAIC,EAAe,GAC1C,EAAC,MAAAC,GAAM,GAAGC,EAAgB,IAAIJ,KAAU,CAAC,GAEzC,EAAC,MAAAK,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtB,CAAC,uBAAuBH,CAAgB;AAAA,IACxCH;AAAA,IACAG;AAAA,IACA,EAAC,MAAAD,EAAI;AAAA,EACP;AAEO,SAAA;AAAA,IACL,GAAGG;AAAA,IACH,UAAUD;AAAA,EACZ;AACF;"}
@@ -1,21 +1,19 @@
1
- import { useMemo as p } from "react";
2
- import { useShopActions as c } from "../../internal/useShopActions.js";
3
- import { useShopActionsPaginatedDataFetching as i } from "../../internal/useShopActionsPaginatedDataFetching.js";
4
- const f = (s) => {
5
- const { getRecommendedShops: t } = c(), { skip: n, ...r } = s || {}, { data: o, ...m } = i(
1
+ import { useMemo as c } from "react";
2
+ import { useShopActions as i } from "../../internal/useShopActions.js";
3
+ import { useShopActionInfiniteQuery as u } from "../../internal/reactQuery/useShopActionInfiniteQuery.js";
4
+ const h = (r) => {
5
+ const { getRecommendedShops: t } = i(), { skip: n, ...e } = r || {}, { data: o, ...m } = u(
6
+ ["recommendedShops", e],
6
7
  t,
7
- r,
8
- {
9
- skip: n,
10
- hook: "useRecommendedShops"
11
- }
12
- ), a = p(() => o ? Array.from(new Map(o.map((e) => [e.id, e])).values()) : null, [o]);
8
+ e,
9
+ { skip: n }
10
+ ), p = c(() => o ? Array.from(new Map(o.map((s) => [s.id, s])).values()) : null, [o]);
13
11
  return {
14
12
  ...m,
15
- shops: a
13
+ shops: p
16
14
  };
17
15
  };
18
16
  export {
19
- f as useRecommendedShops
17
+ h as useRecommendedShops
20
18
  };
21
19
  //# sourceMappingURL=useRecommendedShops.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useRecommendedShops.js","sources":["../../../src/hooks/shop/useRecommendedShops.ts"],"sourcesContent":["import {useMemo} from 'react'\n\nimport {useShopActions} from '../../internal/useShopActions'\nimport {useShopActionsPaginatedDataFetching} from '../../internal/useShopActionsPaginatedDataFetching'\nimport {\n Shop,\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n} from '../../types'\n\ninterface UseRecommendedShopsParams extends PaginatedDataHookOptionsBase {}\n\ninterface UseRecommendedShopsReturns extends PaginatedDataHookReturnsBase {\n shops: Shop[] | null\n}\n\nexport const useRecommendedShops = (\n params?: UseRecommendedShopsParams\n): UseRecommendedShopsReturns => {\n const {getRecommendedShops} = useShopActions()\n\n const {skip, ...shopActionParamsToPass} = params || {}\n\n const {data, ...rest} = useShopActionsPaginatedDataFetching(\n getRecommendedShops,\n shopActionParamsToPass,\n {\n skip,\n hook: 'useRecommendedShops',\n }\n )\n\n const shops = useMemo(() => {\n if (!data) return null\n\n return Array.from(new Map(data.map(shop => [shop.id, shop])).values())\n }, [data])\n\n return {\n ...rest,\n shops,\n }\n}\n"],"names":["useRecommendedShops","params","getRecommendedShops","useShopActions","skip","shopActionParamsToPass","data","rest","useShopActionsPaginatedDataFetching","shops","useMemo","shop"],"mappings":";;;AAgBa,MAAAA,IAAsB,CACjCC,MAC+B;AACzB,QAAA,EAAC,qBAAAC,EAAmB,IAAIC,EAAe,GAEvC,EAAC,MAAAC,GAAM,GAAGC,EAAsB,IAAIJ,KAAU,CAAC,GAE/C,EAAC,MAAAK,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtBN;AAAA,IACAG;AAAA,IACA;AAAA,MACE,MAAAD;AAAA,MACA,MAAM;AAAA,IAAA;AAAA,EAEV,GAEMK,IAAQC,EAAQ,MACfJ,IAEE,MAAM,KAAK,IAAI,IAAIA,EAAK,IAAI,CAAAK,MAAQ,CAACA,EAAK,IAAIA,CAAI,CAAC,CAAC,EAAE,QAAQ,IAFnD,MAGjB,CAACL,CAAI,CAAC;AAEF,SAAA;AAAA,IACL,GAAGC;AAAA,IACH,OAAAE;AAAA,EACF;AACF;"}
1
+ {"version":3,"file":"useRecommendedShops.js","sources":["../../../src/hooks/shop/useRecommendedShops.ts"],"sourcesContent":["import {useMemo} from 'react'\n\nimport {useShopActionInfiniteQuery} from '../../internal/reactQuery'\nimport {useShopActions} from '../../internal/useShopActions'\nimport {\n Shop,\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n} from '../../types'\n\ninterface UseRecommendedShopsParams extends PaginatedDataHookOptionsBase {}\n\ninterface UseRecommendedShopsReturns extends PaginatedDataHookReturnsBase {\n shops: Shop[] | null\n}\n\nexport const useRecommendedShops = (\n params?: UseRecommendedShopsParams\n): UseRecommendedShopsReturns => {\n const {getRecommendedShops} = useShopActions()\n\n const {skip, ...shopActionParamsToPass} = params || {}\n\n const {data, ...rest} = useShopActionInfiniteQuery(\n ['recommendedShops', shopActionParamsToPass],\n getRecommendedShops,\n shopActionParamsToPass,\n {skip}\n )\n\n const shops = useMemo(() => {\n if (!data) return null\n\n return Array.from(new Map(data.map(shop => [shop.id, shop])).values())\n }, [data])\n\n return {\n ...rest,\n shops,\n }\n}\n"],"names":["useRecommendedShops","params","getRecommendedShops","useShopActions","skip","shopActionParamsToPass","data","rest","useShopActionInfiniteQuery","shops","useMemo","shop"],"mappings":";;;AAgBa,MAAAA,IAAsB,CACjCC,MAC+B;AACzB,QAAA,EAAC,qBAAAC,EAAmB,IAAIC,EAAe,GAEvC,EAAC,MAAAC,GAAM,GAAGC,EAAsB,IAAIJ,KAAU,CAAC,GAE/C,EAAC,MAAAK,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtB,CAAC,oBAAoBH,CAAsB;AAAA,IAC3CH;AAAA,IACAG;AAAA,IACA,EAAC,MAAAD,EAAI;AAAA,EACP,GAEMK,IAAQC,EAAQ,MACfJ,IAEE,MAAM,KAAK,IAAI,IAAIA,EAAK,IAAI,CAAAK,MAAQ,CAACA,EAAK,IAAIA,CAAI,CAAC,CAAC,EAAE,QAAQ,IAFnD,MAGjB,CAACL,CAAI,CAAC;AAEF,SAAA;AAAA,IACL,GAAGC;AAAA,IACH,OAAAE;AAAA,EACF;AACF;"}
@@ -1,17 +1,18 @@
1
- import { useMemo as c } from "react";
2
- import { useShopActions as h } from "../../internal/useShopActions.js";
3
- import { useShopActionsDataFetching as m } from "../../internal/useShopActionsDataFetching.js";
4
- const S = (t) => {
5
- const { getShop: s } = h(), { skip: e = !1, ...r } = t, { data: o, ...n } = m(s, r, {
6
- skip: e,
7
- hook: "useShop"
8
- }), p = c(() => o ?? null, [o]);
1
+ import { useShopActions as n } from "../../internal/useShopActions.js";
2
+ import { useShopActionQuery as c } from "../../internal/reactQuery/useShopActionQuery.js";
3
+ const i = (s) => {
4
+ const { getShop: t } = n(), { skip: r = !1, ...o } = s, { data: e, ...p } = c(
5
+ ["shop", o],
6
+ t,
7
+ o,
8
+ { skip: r }
9
+ );
9
10
  return {
10
- ...n,
11
- shop: p
11
+ ...p,
12
+ shop: e
12
13
  };
13
14
  };
14
15
  export {
15
- S as useShop
16
+ i as useShop
16
17
  };
17
18
  //# sourceMappingURL=useShop.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useShop.js","sources":["../../../src/hooks/shop/useShop.ts"],"sourcesContent":["import {useMemo} from 'react'\n\nimport {useShopActions} from '../../internal/useShopActions'\nimport {useShopActionsDataFetching} from '../../internal/useShopActionsDataFetching'\nimport {DataHookOptionsBase, DataHookReturnsBase, Shop} from '../../types'\n\nexport interface UseShopParams extends DataHookOptionsBase {\n /**\n * The shop ID to fetch.\n */\n id: string\n}\n\ninterface UseShopReturns extends DataHookReturnsBase {\n /**\n * The shop returned from the query.\n */\n shop: Shop | null\n}\n\nexport const useShop = (params: UseShopParams): UseShopReturns => {\n const {getShop} = useShopActions()\n const {skip = false, ...restParams} = params\n\n const {data, ...rest} = useShopActionsDataFetching(getShop, restParams, {\n skip,\n hook: 'useShop',\n })\n\n const shop = useMemo(() => {\n return data ?? null\n }, [data])\n\n return {\n ...rest,\n shop,\n }\n}\n"],"names":["useShop","params","getShop","useShopActions","skip","restParams","data","rest","useShopActionsDataFetching","shop","useMemo"],"mappings":";;;AAoBa,MAAAA,IAAU,CAACC,MAA0C;AAC1D,QAAA,EAAC,SAAAC,EAAO,IAAIC,EAAe,GAC3B,EAAC,MAAAC,IAAO,IAAO,GAAGC,EAAc,IAAAJ,GAEhC,EAAC,MAAAK,GAAM,GAAGC,EAAQ,IAAAC,EAA2BN,GAASG,GAAY;AAAA,IACtE,MAAAD;AAAA,IACA,MAAM;AAAA,EAAA,CACP,GAEKK,IAAOC,EAAQ,MACZJ,KAAQ,MACd,CAACA,CAAI,CAAC;AAEF,SAAA;AAAA,IACL,GAAGC;AAAA,IACH,MAAAE;AAAA,EACF;AACF;"}
1
+ {"version":3,"file":"useShop.js","sources":["../../../src/hooks/shop/useShop.ts"],"sourcesContent":["import {useShopActionQuery} from '../../internal/reactQuery'\nimport {useShopActions} from '../../internal/useShopActions'\nimport {DataHookOptionsBase, DataHookReturnsBase, Shop} from '../../types'\n\nexport interface UseShopParams extends DataHookOptionsBase {\n /**\n * The shop ID to fetch.\n */\n id: string\n}\n\ninterface UseShopReturns extends DataHookReturnsBase {\n /**\n * The shop returned from the query.\n */\n shop: Shop | null\n}\n\nexport const useShop = (params: UseShopParams): UseShopReturns => {\n const {getShop} = useShopActions()\n const {skip = false, ...restParams} = params\n\n const {data, ...rest} = useShopActionQuery(\n ['shop', restParams],\n getShop,\n restParams,\n {skip}\n )\n\n return {\n ...rest,\n shop: data,\n }\n}\n"],"names":["useShop","params","getShop","useShopActions","skip","restParams","data","rest","useShopActionQuery"],"mappings":";;AAkBa,MAAAA,IAAU,CAACC,MAA0C;AAC1D,QAAA,EAAC,SAAAC,EAAO,IAAIC,EAAe,GAC3B,EAAC,MAAAC,IAAO,IAAO,GAAGC,EAAc,IAAAJ,GAEhC,EAAC,MAAAK,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtB,CAAC,QAAQH,CAAU;AAAA,IACnBH;AAAA,IACAG;AAAA,IACA,EAAC,MAAAD,EAAI;AAAA,EACP;AAEO,SAAA;AAAA,IACL,GAAGG;AAAA,IACH,MAAMD;AAAA,EACR;AACF;"}
@@ -1,17 +1,15 @@
1
1
  import { useShopActions as i } from "../../internal/useShopActions.js";
2
- import { useShopActionsDataFetching as n } from "../../internal/useShopActionsDataFetching.js";
3
- const A = (t) => {
4
- const { skip: s, ...e } = t || {}, { getBuyerAttributes: o } = i(), { data: r, ...u } = n(
5
- o,
6
- e,
7
- {
8
- skip: s,
9
- hook: "useBuyerAttributes"
10
- }
2
+ import { useShopActionQuery as n } from "../../internal/reactQuery/useShopActionQuery.js";
3
+ const A = (r) => {
4
+ const { skip: e, ...t } = r || {}, { getBuyerAttributes: s } = i(), { data: o, ...u } = n(
5
+ ["buyerAttributes", t],
6
+ s,
7
+ t,
8
+ { skip: e }
11
9
  );
12
10
  return {
13
11
  ...u,
14
- buyerAttributes: r
12
+ buyerAttributes: o
15
13
  };
16
14
  };
17
15
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"useBuyerAttributes.js","sources":["../../../src/hooks/user/useBuyerAttributes.ts"],"sourcesContent":["import {useShopActions} from '../../internal/useShopActions'\nimport {useShopActionsDataFetching} from '../../internal/useShopActionsDataFetching'\nimport {\n DataHookOptionsBase,\n DataHookReturnsBase,\n BuyerAttributes,\n} from '../../types'\n\nexport interface UseBuyerAttributesParams extends DataHookOptionsBase {}\n\nexport interface UseBuyerAttributesReturns extends DataHookReturnsBase {\n buyerAttributes: BuyerAttributes | null\n}\n\nexport const useBuyerAttributes = (\n params?: UseBuyerAttributesParams\n): UseBuyerAttributesReturns => {\n const {skip, ...shopActionParams} = params || {}\n const {getBuyerAttributes} = useShopActions()\n\n const {data, ...rest} = useShopActionsDataFetching(\n getBuyerAttributes,\n shopActionParams,\n {\n skip,\n hook: 'useBuyerAttributes',\n }\n )\n\n return {\n ...rest,\n buyerAttributes: data,\n }\n}\n"],"names":["useBuyerAttributes","params","skip","shopActionParams","getBuyerAttributes","useShopActions","data","rest","useShopActionsDataFetching"],"mappings":";;AAca,MAAAA,IAAqB,CAChCC,MAC8B;AAC9B,QAAM,EAAC,MAAAC,GAAM,GAAGC,EAAgB,IAAIF,KAAU,CAAC,GACzC,EAAC,oBAAAG,EAAkB,IAAIC,EAAe,GAEtC,EAAC,MAAAC,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtBJ;AAAA,IACAD;AAAA,IACA;AAAA,MACE,MAAAD;AAAA,MACA,MAAM;AAAA,IAAA;AAAA,EAEV;AAEO,SAAA;AAAA,IACL,GAAGK;AAAA,IACH,iBAAiBD;AAAA,EACnB;AACF;"}
1
+ {"version":3,"file":"useBuyerAttributes.js","sources":["../../../src/hooks/user/useBuyerAttributes.ts"],"sourcesContent":["import {useShopActionQuery} from '../../internal/reactQuery'\nimport {useShopActions} from '../../internal/useShopActions'\nimport {\n DataHookOptionsBase,\n DataHookReturnsBase,\n BuyerAttributes,\n} from '../../types'\n\nexport interface UseBuyerAttributesParams extends DataHookOptionsBase {}\n\nexport interface UseBuyerAttributesReturns extends DataHookReturnsBase {\n buyerAttributes: BuyerAttributes | null\n}\n\nexport const useBuyerAttributes = (\n params?: UseBuyerAttributesParams\n): UseBuyerAttributesReturns => {\n const {skip, ...shopActionParams} = params || {}\n const {getBuyerAttributes} = useShopActions()\n\n const {data, ...rest} = useShopActionQuery(\n ['buyerAttributes', shopActionParams],\n getBuyerAttributes,\n shopActionParams,\n {skip}\n )\n\n return {\n ...rest,\n buyerAttributes: data,\n }\n}\n"],"names":["useBuyerAttributes","params","skip","shopActionParams","getBuyerAttributes","useShopActions","data","rest","useShopActionQuery"],"mappings":";;AAca,MAAAA,IAAqB,CAChCC,MAC8B;AAC9B,QAAM,EAAC,MAAAC,GAAM,GAAGC,EAAgB,IAAIF,KAAU,CAAC,GACzC,EAAC,oBAAAG,EAAkB,IAAIC,EAAe,GAEtC,EAAC,MAAAC,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtB,CAAC,mBAAmBL,CAAgB;AAAA,IACpCC;AAAA,IACAD;AAAA,IACA,EAAC,MAAAD,EAAI;AAAA,EACP;AAEO,SAAA;AAAA,IACL,GAAGK;AAAA,IACH,iBAAiBD;AAAA,EACnB;AACF;"}
@@ -1,13 +1,11 @@
1
1
  import { useShopActions as c } from "../../internal/useShopActions.js";
2
- import { useShopActionsDataFetching as u } from "../../internal/useShopActionsDataFetching.js";
3
- const a = (r) => {
4
- const { skip: t, ...s } = r || {}, { getCurrentUser: e } = c(), { data: o, ...n } = u(
5
- e,
2
+ import { useShopActionQuery as u } from "../../internal/reactQuery/useShopActionQuery.js";
3
+ const m = (t) => {
4
+ const { skip: e, ...r } = t || {}, { getCurrentUser: s } = c(), { data: o, ...n } = u(
5
+ ["currentUser", r],
6
6
  s,
7
- {
8
- skip: t,
9
- hook: "useCurrentUser"
10
- }
7
+ r,
8
+ { skip: e }
11
9
  );
12
10
  return {
13
11
  ...n,
@@ -15,6 +13,6 @@ const a = (r) => {
15
13
  };
16
14
  };
17
15
  export {
18
- a as useCurrentUser
16
+ m as useCurrentUser
19
17
  };
20
18
  //# sourceMappingURL=useCurrentUser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCurrentUser.js","sources":["../../../src/hooks/user/useCurrentUser.ts"],"sourcesContent":["import {useShopActions} from '../../internal/useShopActions'\nimport {useShopActionsDataFetching} from '../../internal/useShopActionsDataFetching'\nimport {\n DataHookOptionsBase,\n DataHookReturnsBase,\n UserProfile,\n} from '../../types'\n\nexport interface UseCurrentUserParams extends DataHookOptionsBase {}\n\nexport interface UseCurrentUserReturns extends DataHookReturnsBase {\n /**\n * The current user logged into Shop.\n */\n currentUser: UserProfile | null\n}\n\n/**\n * Hook to fetch the current user's profile.\n */\nexport const useCurrentUser = (\n params?: UseCurrentUserParams\n): UseCurrentUserReturns => {\n const {skip, ...shopActionParams} = params || {}\n const {getCurrentUser} = useShopActions()\n\n const {data, ...rest} = useShopActionsDataFetching(\n getCurrentUser,\n shopActionParams,\n {\n skip,\n hook: 'useCurrentUser',\n }\n )\n\n return {\n ...rest,\n currentUser: data,\n }\n}\n"],"names":["useCurrentUser","params","skip","shopActionParams","getCurrentUser","useShopActions","data","rest","useShopActionsDataFetching"],"mappings":";;AAoBa,MAAAA,IAAiB,CAC5BC,MAC0B;AAC1B,QAAM,EAAC,MAAAC,GAAM,GAAGC,EAAgB,IAAIF,KAAU,CAAC,GACzC,EAAC,gBAAAG,EAAc,IAAIC,EAAe,GAElC,EAAC,MAAAC,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtBJ;AAAA,IACAD;AAAA,IACA;AAAA,MACE,MAAAD;AAAA,MACA,MAAM;AAAA,IAAA;AAAA,EAEV;AAEO,SAAA;AAAA,IACL,GAAGK;AAAA,IACH,aAAaD;AAAA,EACf;AACF;"}
1
+ {"version":3,"file":"useCurrentUser.js","sources":["../../../src/hooks/user/useCurrentUser.ts"],"sourcesContent":["import {useShopActionQuery} from '../../internal/reactQuery'\nimport {useShopActions} from '../../internal/useShopActions'\nimport {\n DataHookOptionsBase,\n DataHookReturnsBase,\n UserProfile,\n} from '../../types'\n\nexport interface UseCurrentUserParams extends DataHookOptionsBase {}\n\nexport interface UseCurrentUserReturns extends DataHookReturnsBase {\n /**\n * The current user logged into Shop.\n */\n currentUser: UserProfile | null\n}\n\n/**\n * Hook to fetch the current user's profile.\n */\nexport const useCurrentUser = (\n params?: UseCurrentUserParams\n): UseCurrentUserReturns => {\n const {skip, ...shopActionParams} = params || {}\n const {getCurrentUser} = useShopActions()\n\n const {data, ...rest} = useShopActionQuery(\n ['currentUser', shopActionParams],\n getCurrentUser,\n shopActionParams,\n {skip}\n )\n\n return {\n ...rest,\n currentUser: data,\n }\n}\n"],"names":["useCurrentUser","params","skip","shopActionParams","getCurrentUser","useShopActions","data","rest","useShopActionQuery"],"mappings":";;AAoBa,MAAAA,IAAiB,CAC5BC,MAC0B;AAC1B,QAAM,EAAC,MAAAC,GAAM,GAAGC,EAAgB,IAAIF,KAAU,CAAC,GACzC,EAAC,gBAAAG,EAAc,IAAIC,EAAe,GAElC,EAAC,MAAAC,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtB,CAAC,eAAeL,CAAgB;AAAA,IAChCC;AAAA,IACAD;AAAA,IACA,EAAC,MAAAD,EAAI;AAAA,EACP;AAEO,SAAA;AAAA,IACL,GAAGK;AAAA,IACH,aAAaD;AAAA,EACf;AACF;"}
@@ -1,21 +1,18 @@
1
- import { useMemo as a } from "react";
2
- import { useShopActions as l } from "../../internal/useShopActions.js";
3
- import { useShopActionsPaginatedDataFetching as c } from "../../internal/useShopActionsPaginatedDataFetching.js";
4
- const u = (s) => {
5
- const { getFollowedShops: t } = l(), { skip: e = !1, ...r } = s ?? {}, { data: o, ...n } = c(
1
+ import { useShopActions as n } from "../../internal/useShopActions.js";
2
+ import { useShopActionInfiniteQuery as i } from "../../internal/reactQuery/useShopActionInfiniteQuery.js";
3
+ const h = (s) => {
4
+ const { getFollowedShops: t } = n(), { skip: e = !1, ...o } = s ?? {}, { data: r, ...p } = i(
5
+ ["followedShops", o],
6
6
  t,
7
- r,
8
- {
9
- skip: e,
10
- hook: "useFollowedShops"
11
- }
12
- ), p = a(() => o ?? null, [o]);
7
+ o,
8
+ { skip: e }
9
+ );
13
10
  return {
14
- ...n,
15
- shops: p
11
+ ...p,
12
+ shops: r
16
13
  };
17
14
  };
18
15
  export {
19
- u as useFollowedShops
16
+ h as useFollowedShops
20
17
  };
21
18
  //# sourceMappingURL=useFollowedShops.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useFollowedShops.js","sources":["../../../src/hooks/user/useFollowedShops.ts"],"sourcesContent":["import {useMemo} from 'react'\n\nimport {useShopActions} from '../../internal/useShopActions'\nimport {useShopActionsPaginatedDataFetching} from '../../internal/useShopActionsPaginatedDataFetching'\nimport {\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n Shop,\n} from '../../types'\n\nexport interface UseFollowedShopsParams extends PaginatedDataHookOptionsBase {}\n\ninterface UseFollowedShopsReturns extends PaginatedDataHookReturnsBase {\n /**\n * The followed shops returned from the query.\n */\n shops: Shop[] | null\n}\n\nexport const useFollowedShops = (\n params?: UseFollowedShopsParams\n): UseFollowedShopsReturns => {\n const {getFollowedShops} = useShopActions()\n const {skip = false, ...restParams} = params ?? {}\n\n const {data, ...rest} = useShopActionsPaginatedDataFetching(\n getFollowedShops,\n restParams,\n {\n skip,\n hook: 'useFollowedShops',\n }\n )\n\n const shops = useMemo(() => {\n return data ?? null\n }, [data])\n\n return {\n ...rest,\n shops,\n }\n}\n"],"names":["useFollowedShops","params","getFollowedShops","useShopActions","skip","restParams","data","rest","useShopActionsPaginatedDataFetching","shops","useMemo"],"mappings":";;;AAmBa,MAAAA,IAAmB,CAC9BC,MAC4B;AACtB,QAAA,EAAC,kBAAAC,EAAgB,IAAIC,EAAe,GACpC,EAAC,MAAAC,IAAO,IAAO,GAAGC,EAAU,IAAIJ,KAAU,CAAC,GAE3C,EAAC,MAAAK,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtBN;AAAA,IACAG;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":"useFollowedShops.js","sources":["../../../src/hooks/user/useFollowedShops.ts"],"sourcesContent":["import {useShopActionInfiniteQuery} from '../../internal/reactQuery'\nimport {useShopActions} from '../../internal/useShopActions'\nimport {\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n Shop,\n} from '../../types'\n\nexport interface UseFollowedShopsParams extends PaginatedDataHookOptionsBase {}\n\ninterface UseFollowedShopsReturns extends PaginatedDataHookReturnsBase {\n /**\n * The followed shops returned from the query.\n */\n shops: Shop[] | null\n}\n\nexport const useFollowedShops = (\n params?: UseFollowedShopsParams\n): UseFollowedShopsReturns => {\n const {getFollowedShops} = useShopActions()\n const {skip = false, ...restParams} = params ?? {}\n\n const {data, ...rest} = useShopActionInfiniteQuery(\n ['followedShops', restParams],\n getFollowedShops,\n restParams,\n {skip}\n )\n\n return {\n ...rest,\n shops: data,\n }\n}\n"],"names":["useFollowedShops","params","getFollowedShops","useShopActions","skip","restParams","data","rest","useShopActionInfiniteQuery"],"mappings":";;AAiBa,MAAAA,IAAmB,CAC9BC,MAC4B;AACtB,QAAA,EAAC,kBAAAC,EAAgB,IAAIC,EAAe,GACpC,EAAC,MAAAC,IAAO,IAAO,GAAGC,EAAU,IAAIJ,KAAU,CAAC,GAE3C,EAAC,MAAAK,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtB,CAAC,iBAAiBH,CAAU;AAAA,IAC5BH;AAAA,IACAG;AAAA,IACA,EAAC,MAAAD,EAAI;AAAA,EACP;AAEO,SAAA;AAAA,IACL,GAAGG;AAAA,IACH,OAAOD;AAAA,EACT;AACF;"}
@@ -1,13 +1,11 @@
1
- import { useShopActions as a } from "../../internal/useShopActions.js";
2
- import { useShopActionsPaginatedDataFetching as c } from "../../internal/useShopActionsPaginatedDataFetching.js";
3
- const d = (o) => {
4
- const { skip: s, ...r } = o || {}, { getOrders: t } = a(), { data: e, ...n } = c(
1
+ import { useShopActions as i } from "../../internal/useShopActions.js";
2
+ import { useShopActionInfiniteQuery as c } from "../../internal/reactQuery/useShopActionInfiniteQuery.js";
3
+ const m = (o) => {
4
+ const { skip: s, ...r } = o || {}, { getOrders: t } = i(), { data: e, ...n } = c(
5
+ ["orders", r],
5
6
  t,
6
7
  r,
7
- {
8
- skip: s,
9
- hook: "useOrders"
10
- }
8
+ { skip: s }
11
9
  );
12
10
  return {
13
11
  ...n,
@@ -15,6 +13,6 @@ const d = (o) => {
15
13
  };
16
14
  };
17
15
  export {
18
- d as useOrders
16
+ m as useOrders
19
17
  };
20
18
  //# sourceMappingURL=useOrders.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useOrders.js","sources":["../../../src/hooks/user/useOrders.ts"],"sourcesContent":["import {useShopActions} from '../../internal/useShopActions'\nimport {useShopActionsPaginatedDataFetching} from '../../internal/useShopActionsPaginatedDataFetching'\nimport {\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n Order,\n} from '../../types'\n\nexport interface UseOrdersParams extends PaginatedDataHookOptionsBase {}\n\nexport interface UseOrdersReturns extends PaginatedDataHookReturnsBase {\n orders: Order[] | null\n}\n\nexport const useOrders = (params?: UseOrdersParams): UseOrdersReturns => {\n const {skip, ...shopActionParams} = params || {}\n const {getOrders} = useShopActions()\n\n const {data, ...rest} = useShopActionsPaginatedDataFetching(\n getOrders,\n shopActionParams,\n {\n skip,\n hook: 'useOrders',\n }\n )\n\n return {\n ...rest,\n orders: data,\n }\n}\n"],"names":["useOrders","params","skip","shopActionParams","getOrders","useShopActions","data","rest","useShopActionsPaginatedDataFetching"],"mappings":";;AAca,MAAAA,IAAY,CAACC,MAA+C;AACvE,QAAM,EAAC,MAAAC,GAAM,GAAGC,EAAgB,IAAIF,KAAU,CAAC,GACzC,EAAC,WAAAG,EAAS,IAAIC,EAAe,GAE7B,EAAC,MAAAC,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtBJ;AAAA,IACAD;AAAA,IACA;AAAA,MACE,MAAAD;AAAA,MACA,MAAM;AAAA,IAAA;AAAA,EAEV;AAEO,SAAA;AAAA,IACL,GAAGK;AAAA,IACH,QAAQD;AAAA,EACV;AACF;"}
1
+ {"version":3,"file":"useOrders.js","sources":["../../../src/hooks/user/useOrders.ts"],"sourcesContent":["import {useShopActionInfiniteQuery} from '../../internal/reactQuery'\nimport {useShopActions} from '../../internal/useShopActions'\nimport {\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n Order,\n} from '../../types'\n\nexport interface UseOrdersParams extends PaginatedDataHookOptionsBase {}\n\nexport interface UseOrdersReturns extends PaginatedDataHookReturnsBase {\n orders: Order[] | null\n}\n\nexport const useOrders = (params?: UseOrdersParams): UseOrdersReturns => {\n const {skip, ...shopActionParams} = params || {}\n const {getOrders} = useShopActions()\n\n const {data, ...rest} = useShopActionInfiniteQuery(\n ['orders', shopActionParams],\n getOrders,\n shopActionParams,\n {skip}\n )\n\n return {\n ...rest,\n orders: data,\n }\n}\n"],"names":["useOrders","params","skip","shopActionParams","getOrders","useShopActions","data","rest","useShopActionInfiniteQuery"],"mappings":";;AAca,MAAAA,IAAY,CAACC,MAA+C;AACvE,QAAM,EAAC,MAAAC,GAAM,GAAGC,EAAgB,IAAIF,KAAU,CAAC,GACzC,EAAC,WAAAG,EAAS,IAAIC,EAAe,GAE7B,EAAC,MAAAC,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtB,CAAC,UAAUL,CAAgB;AAAA,IAC3BC;AAAA,IACAD;AAAA,IACA,EAAC,MAAAD,EAAI;AAAA,EACP;AAEO,SAAA;AAAA,IACL,GAAGK;AAAA,IACH,QAAQD;AAAA,EACV;AACF;"}
@@ -1,21 +1,19 @@
1
1
  import { useMemo as u } from "react";
2
2
  import { useShopActions as i } from "../../internal/useShopActions.js";
3
- import { useShopActionsPaginatedDataFetching as p } from "../../internal/useShopActionsPaginatedDataFetching.js";
4
- const h = (o) => {
5
- const { getRecentProducts: s } = i(), { skip: e, ...r } = o ?? {}, { data: t, ...c } = p(
6
- s,
7
- r,
8
- {
9
- skip: e,
10
- hook: "useRecentProducts"
11
- }
12
- ), n = u(() => t ?? null, [t]);
3
+ import { useShopActionInfiniteQuery as p } from "../../internal/reactQuery/useShopActionInfiniteQuery.js";
4
+ const f = (r) => {
5
+ const { getRecentProducts: e } = i(), { skip: s, ...t } = r ?? {}, { data: o, ...n } = p(
6
+ ["recentProducts", t],
7
+ e,
8
+ t,
9
+ { skip: s }
10
+ ), c = u(() => o ?? null, [o]);
13
11
  return {
14
- ...c,
15
- products: n
12
+ ...n,
13
+ products: c
16
14
  };
17
15
  };
18
16
  export {
19
- h as useRecentProducts
17
+ f as useRecentProducts
20
18
  };
21
19
  //# sourceMappingURL=useRecentProducts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useRecentProducts.js","sources":["../../../src/hooks/user/useRecentProducts.ts"],"sourcesContent":["import {useMemo} from 'react'\n\nimport {useShopActions} from '../../internal/useShopActions'\nimport {useShopActionsPaginatedDataFetching} from '../../internal/useShopActionsPaginatedDataFetching'\nimport {\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n Product,\n} from '../../types'\n\nexport interface UseRecentProductsParams extends PaginatedDataHookOptionsBase {\n includeSensitive?: boolean\n}\n\nexport interface UseRecentProductsReturns extends PaginatedDataHookReturnsBase {\n products: Product[] | null\n}\n\n/**\n * Hook to fetch recently viewed products.\n * @param params - Options for the hook.\n */\nexport const useRecentProducts = (\n params?: UseRecentProductsParams\n): UseRecentProductsReturns => {\n const {getRecentProducts} = useShopActions()\n const {skip, ...shopActionParams} = params ?? {}\n\n const {data, ...rest} = useShopActionsPaginatedDataFetching(\n getRecentProducts,\n shopActionParams,\n {\n skip,\n hook: 'useRecentProducts',\n }\n )\n\n const products = useMemo(() => {\n return data ?? null\n }, [data])\n\n return {\n ...rest,\n products,\n }\n}\n"],"names":["useRecentProducts","params","getRecentProducts","useShopActions","skip","shopActionParams","data","rest","useShopActionsPaginatedDataFetching","products","useMemo"],"mappings":";;;AAsBa,MAAAA,IAAoB,CAC/BC,MAC6B;AACvB,QAAA,EAAC,mBAAAC,EAAiB,IAAIC,EAAe,GACrC,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,GAEMK,IAAWC,EAAQ,MAChBJ,KAAQ,MACd,CAACA,CAAI,CAAC;AAEF,SAAA;AAAA,IACL,GAAGC;AAAA,IACH,UAAAE;AAAA,EACF;AACF;"}
1
+ {"version":3,"file":"useRecentProducts.js","sources":["../../../src/hooks/user/useRecentProducts.ts"],"sourcesContent":["import {useMemo} from 'react'\n\nimport {useShopActionInfiniteQuery} from '../../internal/reactQuery'\nimport {useShopActions} from '../../internal/useShopActions'\nimport {\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n Product,\n} from '../../types'\n\nexport interface UseRecentProductsParams extends PaginatedDataHookOptionsBase {\n includeSensitive?: boolean\n}\n\nexport interface UseRecentProductsReturns extends PaginatedDataHookReturnsBase {\n products: Product[] | null\n}\n\n/**\n * Hook to fetch recently viewed products.\n * @param params - Options for the hook.\n */\nexport const useRecentProducts = (\n params?: UseRecentProductsParams\n): UseRecentProductsReturns => {\n const {getRecentProducts} = useShopActions()\n const {skip, ...shopActionParams} = params ?? {}\n\n const {data, ...rest} = useShopActionInfiniteQuery(\n ['recentProducts', shopActionParams],\n getRecentProducts,\n shopActionParams,\n {skip}\n )\n\n const products = useMemo(() => {\n return data ?? null\n }, [data])\n\n return {\n ...rest,\n products,\n }\n}\n"],"names":["useRecentProducts","params","getRecentProducts","useShopActions","skip","shopActionParams","data","rest","useShopActionInfiniteQuery","products","useMemo"],"mappings":";;;AAsBa,MAAAA,IAAoB,CAC/BC,MAC6B;AACvB,QAAA,EAAC,mBAAAC,EAAiB,IAAIC,EAAe,GACrC,EAAC,MAAAC,GAAM,GAAGC,EAAgB,IAAIJ,KAAU,CAAC,GAEzC,EAAC,MAAAK,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtB,CAAC,kBAAkBH,CAAgB;AAAA,IACnCH;AAAA,IACAG;AAAA,IACA,EAAC,MAAAD,EAAI;AAAA,EACP,GAEMK,IAAWC,EAAQ,MAChBJ,KAAQ,MACd,CAACA,CAAI,CAAC;AAEF,SAAA;AAAA,IACL,GAAGC;AAAA,IACH,UAAAE;AAAA,EACF;AACF;"}
@@ -1,21 +1,18 @@
1
- import { useMemo as p } from "react";
2
- import { useShopActions as a } from "../../internal/useShopActions.js";
3
- import { useShopActionsPaginatedDataFetching as h } from "../../internal/useShopActionsPaginatedDataFetching.js";
4
- const S = (t) => {
5
- const { getRecentShops: s } = a(), { skip: e = !1, ...n } = t ?? {}, { data: o, ...r } = h(
1
+ import { useShopActions as p } from "../../internal/useShopActions.js";
2
+ import { useShopActionInfiniteQuery as c } from "../../internal/reactQuery/useShopActionInfiniteQuery.js";
3
+ const a = (t) => {
4
+ const { getRecentShops: e } = p(), { skip: o = !1, ...s } = t ?? {}, { data: n, ...r } = c(
5
+ ["recentShops", s],
6
+ e,
6
7
  s,
7
- n,
8
- {
9
- skip: e,
10
- hook: "useRecentShops"
11
- }
12
- ), c = p(() => o ?? null, [o]);
8
+ { skip: o }
9
+ );
13
10
  return {
14
11
  ...r,
15
- shops: c
12
+ shops: n
16
13
  };
17
14
  };
18
15
  export {
19
- S as useRecentShops
16
+ a as useRecentShops
20
17
  };
21
18
  //# sourceMappingURL=useRecentShops.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useRecentShops.js","sources":["../../../src/hooks/user/useRecentShops.ts"],"sourcesContent":["import {useMemo} from 'react'\n\nimport {useShopActions} from '../../internal/useShopActions'\nimport {useShopActionsPaginatedDataFetching} from '../../internal/useShopActionsPaginatedDataFetching'\nimport {\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n Shop,\n} from '../../types'\n\nexport interface UseRecentShopsParams extends PaginatedDataHookOptionsBase {}\n\ninterface UseRecentShopsReturns extends PaginatedDataHookReturnsBase {\n /**\n * The recent shops returned from the query.\n */\n shops: Shop[] | null\n}\n\nexport const useRecentShops = (\n params?: UseRecentShopsParams\n): UseRecentShopsReturns => {\n const {getRecentShops} = useShopActions()\n const {skip = false, ...restParams} = params ?? {}\n\n const {data, ...rest} = useShopActionsPaginatedDataFetching(\n getRecentShops,\n restParams,\n {\n skip,\n hook: 'useRecentShops',\n }\n )\n\n const shops = useMemo(() => {\n return data ?? null\n }, [data])\n\n return {\n ...rest,\n shops,\n }\n}\n"],"names":["useRecentShops","params","getRecentShops","useShopActions","skip","restParams","data","rest","useShopActionsPaginatedDataFetching","shops","useMemo"],"mappings":";;;AAmBa,MAAAA,IAAiB,CAC5BC,MAC0B;AACpB,QAAA,EAAC,gBAAAC,EAAc,IAAIC,EAAe,GAClC,EAAC,MAAAC,IAAO,IAAO,GAAGC,EAAU,IAAIJ,KAAU,CAAC,GAE3C,EAAC,MAAAK,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtBN;AAAA,IACAG;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":"useRecentShops.js","sources":["../../../src/hooks/user/useRecentShops.ts"],"sourcesContent":["import {useShopActionInfiniteQuery} from '../../internal/reactQuery'\nimport {useShopActions} from '../../internal/useShopActions'\nimport {\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n Shop,\n} from '../../types'\n\nexport interface UseRecentShopsParams extends PaginatedDataHookOptionsBase {}\n\ninterface UseRecentShopsReturns extends PaginatedDataHookReturnsBase {\n /**\n * The recent shops returned from the query.\n */\n shops: Shop[] | null\n}\n\nexport const useRecentShops = (\n params?: UseRecentShopsParams\n): UseRecentShopsReturns => {\n const {getRecentShops} = useShopActions()\n const {skip = false, ...restParams} = params ?? {}\n\n const {data, ...rest} = useShopActionInfiniteQuery(\n ['recentShops', restParams],\n getRecentShops,\n restParams,\n {skip}\n )\n\n return {\n ...rest,\n shops: data,\n }\n}\n"],"names":["useRecentShops","params","getRecentShops","useShopActions","skip","restParams","data","rest","useShopActionInfiniteQuery"],"mappings":";;AAiBa,MAAAA,IAAiB,CAC5BC,MAC0B;AACpB,QAAA,EAAC,gBAAAC,EAAc,IAAIC,EAAe,GAClC,EAAC,MAAAC,IAAO,IAAO,GAAGC,EAAU,IAAIJ,KAAU,CAAC,GAE3C,EAAC,MAAAK,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtB,CAAC,eAAeH,CAAU;AAAA,IAC1BH;AAAA,IACAG;AAAA,IACA,EAAC,MAAAD,EAAI;AAAA,EACP;AAEO,SAAA;AAAA,IACL,GAAGG;AAAA,IACH,OAAOD;AAAA,EACT;AACF;"}
@@ -1,21 +1,18 @@
1
- import { useMemo as u } from "react";
2
- import { useShopActions as a } from "../../internal/useShopActions.js";
3
- import { useShopActionsPaginatedDataFetching as d } from "../../internal/useShopActionsPaginatedDataFetching.js";
4
- const h = (t) => {
5
- const { getSavedProducts: s } = a(), { skip: r, ...e } = t ?? {}, { data: o, ...c } = d(
1
+ import { useShopActions as n } from "../../internal/useShopActions.js";
2
+ import { useShopActionInfiniteQuery as u } from "../../internal/reactQuery/useShopActionInfiniteQuery.js";
3
+ const p = (t) => {
4
+ const { getSavedProducts: s } = n(), { skip: r, ...o } = t ?? {}, { data: e, ...c } = u(
5
+ ["savedProducts", o],
6
6
  s,
7
- e,
8
- {
9
- skip: r,
10
- hook: "useSavedProducts"
11
- }
12
- ), n = u(() => o ?? null, [o]);
7
+ o,
8
+ { skip: r }
9
+ );
13
10
  return {
14
11
  ...c,
15
- products: n
12
+ products: e
16
13
  };
17
14
  };
18
15
  export {
19
- h as useSavedProducts
16
+ p as useSavedProducts
20
17
  };
21
18
  //# sourceMappingURL=useSavedProducts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSavedProducts.js","sources":["../../../src/hooks/user/useSavedProducts.ts"],"sourcesContent":["import {useMemo} from 'react'\n\nimport {useShopActions} from '../../internal/useShopActions'\nimport {useShopActionsPaginatedDataFetching} from '../../internal/useShopActionsPaginatedDataFetching'\nimport {\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n Product,\n} from '../../types'\n\nexport interface UseSavedProductsParams extends PaginatedDataHookOptionsBase {\n includeSensitive?: boolean\n}\n\nexport interface UseSavedProductsReturns extends PaginatedDataHookReturnsBase {\n products: Product[] | null\n}\n\n/**\n * Hook to fetch saved (favorited) products.\n * @param params - Options for the hook.\n */\nexport const useSavedProducts = (\n params?: UseSavedProductsParams\n): UseSavedProductsReturns => {\n const {getSavedProducts} = useShopActions()\n const {skip, ...shopActionParams} = params ?? {}\n\n const {data, ...rest} = useShopActionsPaginatedDataFetching(\n getSavedProducts,\n shopActionParams,\n {\n skip,\n hook: 'useSavedProducts',\n }\n )\n\n const products = useMemo(() => {\n return data ?? null\n }, [data])\n\n return {\n ...rest,\n products,\n }\n}\n"],"names":["useSavedProducts","params","getSavedProducts","useShopActions","skip","shopActionParams","data","rest","useShopActionsPaginatedDataFetching","products","useMemo"],"mappings":";;;AAsBa,MAAAA,IAAmB,CAC9BC,MAC4B;AACtB,QAAA,EAAC,kBAAAC,EAAgB,IAAIC,EAAe,GACpC,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,GAEMK,IAAWC,EAAQ,MAChBJ,KAAQ,MACd,CAACA,CAAI,CAAC;AAEF,SAAA;AAAA,IACL,GAAGC;AAAA,IACH,UAAAE;AAAA,EACF;AACF;"}
1
+ {"version":3,"file":"useSavedProducts.js","sources":["../../../src/hooks/user/useSavedProducts.ts"],"sourcesContent":["import {useShopActionInfiniteQuery} from '../../internal/reactQuery'\nimport {useShopActions} from '../../internal/useShopActions'\nimport {\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n Product,\n} from '../../types'\n\nexport interface UseSavedProductsParams extends PaginatedDataHookOptionsBase {\n includeSensitive?: boolean\n}\n\nexport interface UseSavedProductsReturns extends PaginatedDataHookReturnsBase {\n products: Product[] | null\n}\n\n/**\n * Hook to fetch saved (favorited) products.\n * @param params - Options for the hook.\n */\nexport const useSavedProducts = (\n params?: UseSavedProductsParams\n): UseSavedProductsReturns => {\n const {getSavedProducts} = useShopActions()\n const {skip, ...shopActionParams} = params ?? {}\n\n const {data, ...rest} = useShopActionInfiniteQuery(\n ['savedProducts', shopActionParams],\n getSavedProducts,\n shopActionParams,\n {skip}\n )\n\n return {\n ...rest,\n products: data,\n }\n}\n"],"names":["useSavedProducts","params","getSavedProducts","useShopActions","skip","shopActionParams","data","rest","useShopActionInfiniteQuery"],"mappings":";;AAoBa,MAAAA,IAAmB,CAC9BC,MAC4B;AACtB,QAAA,EAAC,kBAAAC,EAAgB,IAAIC,EAAe,GACpC,EAAC,MAAAC,GAAM,GAAGC,EAAgB,IAAIJ,KAAU,CAAC,GAEzC,EAAC,MAAAK,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtB,CAAC,iBAAiBH,CAAgB;AAAA,IAClCH;AAAA,IACAG;AAAA,IACA,EAAC,MAAAD,EAAI;AAAA,EACP;AAEO,SAAA;AAAA,IACL,GAAGG;AAAA,IACH,UAAUD;AAAA,EACZ;AACF;"}
@@ -1,12 +1,19 @@
1
- import { useImagePickerContext as o } from "../../providers/ImagePickerProvider.js";
2
- function t() {
3
- const { openCamera: e, openGallery: r } = o();
1
+ import { useCallback as o } from "react";
2
+ import { useImagePickerContext as c } from "../../providers/ImagePickerProvider.js";
3
+ function u() {
4
+ const { openCamera: t, openGallery: n } = c(), i = o(
5
+ async ({ cameraFacing: e, quality: a, customQuality: r } = {}) => await t({ cameraFacing: e, quality: a, customQuality: r }),
6
+ [t]
7
+ ), l = o(
8
+ async ({ quality: e, customQuality: a } = {}) => await n({ quality: e, customQuality: a }),
9
+ [n]
10
+ );
4
11
  return {
5
- openCamera: e,
6
- openGallery: r
12
+ openCamera: i,
13
+ openGallery: l
7
14
  };
8
15
  }
9
16
  export {
10
- t as useImagePicker
17
+ u as useImagePicker
11
18
  };
12
19
  //# sourceMappingURL=useImagePicker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useImagePicker.js","sources":["../../../src/hooks/util/useImagePicker.ts"],"sourcesContent":["import {\n CameraFacing,\n useImagePickerContext,\n} from '../../providers/ImagePickerProvider'\n\ninterface UseImagePickerReturns {\n /**\n * Opens the camera to take a photo.\n */\n openCamera: (cameraFacing?: CameraFacing) => Promise<File>\n /**\n * Opens the gallery to select an image.\n */\n openGallery: () => Promise<File>\n}\n\nexport function useImagePicker(): UseImagePickerReturns {\n const {openCamera, openGallery} = useImagePickerContext()\n\n return {\n openCamera,\n openGallery,\n }\n}\n"],"names":["useImagePicker","openCamera","openGallery","useImagePickerContext"],"mappings":";AAgBO,SAASA,IAAwC;AACtD,QAAM,EAAC,YAAAC,GAAY,aAAAC,EAAW,IAAIC,EAAsB;AAEjD,SAAA;AAAA,IACL,YAAAF;AAAA,IACA,aAAAC;AAAA,EACF;AACF;"}
1
+ {"version":3,"file":"useImagePicker.js","sources":["../../../src/hooks/util/useImagePicker.ts"],"sourcesContent":["import {useCallback} from 'react'\n\nimport {\n useImagePickerContext,\n OpenCameraParams,\n OpenGalleryParams,\n} from '../../providers/ImagePickerProvider'\n\ninterface UseImagePickerReturns {\n /**\n * Opens the camera to take a photo.\n */\n openCamera: (params?: OpenCameraParams) => Promise<File>\n /**\n * Opens the gallery to select an image.\n */\n openGallery: (params?: OpenGalleryParams) => Promise<File>\n}\n\nexport function useImagePicker(): UseImagePickerReturns {\n const {openCamera, openGallery} = useImagePickerContext()\n\n const openCameraWithQuality = useCallback(\n async ({cameraFacing, quality, customQuality}: OpenCameraParams = {}) => {\n const file = await openCamera({cameraFacing, quality, customQuality})\n return file\n },\n [openCamera]\n )\n\n const openGalleryWithQuality = useCallback(\n async ({quality, customQuality}: OpenGalleryParams = {}) => {\n const file = await openGallery({quality, customQuality})\n return file\n },\n [openGallery]\n )\n\n return {\n openCamera: openCameraWithQuality,\n openGallery: openGalleryWithQuality,\n }\n}\n"],"names":["useImagePicker","openCamera","openGallery","useImagePickerContext","openCameraWithQuality","useCallback","cameraFacing","quality","customQuality","openGalleryWithQuality"],"mappings":";;AAmBO,SAASA,IAAwC;AACtD,QAAM,EAAC,YAAAC,GAAY,aAAAC,EAAW,IAAIC,EAAsB,GAElDC,IAAwBC;AAAA,IAC5B,OAAO,EAAC,cAAAC,GAAc,SAAAC,GAAS,eAAAC,EAAa,IAAsB,CAAA,MACnD,MAAMP,EAAW,EAAC,cAAAK,GAAc,SAAAC,GAAS,eAAAC,GAAc;AAAA,IAGtE,CAACP,CAAU;AAAA,EACb,GAEMQ,IAAyBJ;AAAA,IAC7B,OAAO,EAAC,SAAAE,GAAS,eAAAC,EAAa,IAAuB,OACtC,MAAMN,EAAY,EAAC,SAAAK,GAAS,eAAAC,GAAc;AAAA,IAGzD,CAACN,CAAW;AAAA,EACd;AAEO,SAAA;AAAA,IACL,YAAYE;AAAA,IACZ,aAAaK;AAAA,EACf;AACF;"}
@@ -0,0 +1,11 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { useMemo as o } from "react";
3
+ import { createShopMinisQueryClient as t, ShopMinisQueryClientContext as n } from "./queryClient.js";
4
+ function s({ children: r }) {
5
+ const e = o(() => t(), []);
6
+ return /* @__PURE__ */ i(n.Provider, { value: e, children: r });
7
+ }
8
+ export {
9
+ s as MinisQueryProvider
10
+ };
11
+ //# sourceMappingURL=MinisQueryProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MinisQueryProvider.js","sources":["../../../src/internal/reactQuery/MinisQueryProvider.tsx"],"sourcesContent":["import React, {useMemo} from 'react'\n\nimport {\n createShopMinisQueryClient,\n ShopMinisQueryClientContext,\n} from './queryClient'\n\nexport function MinisQueryProvider({children}: {children: React.ReactNode}) {\n const queryClient = useMemo(() => createShopMinisQueryClient(), [])\n\n return (\n <ShopMinisQueryClientContext.Provider value={queryClient}>\n {children}\n </ShopMinisQueryClientContext.Provider>\n )\n}\n"],"names":["MinisQueryProvider","children","queryClient","useMemo","createShopMinisQueryClient","ShopMinisQueryClientContext"],"mappings":";;;AAOgB,SAAAA,EAAmB,EAAC,UAAAC,KAAwC;AAC1E,QAAMC,IAAcC,EAAQ,MAAMC,EAA2B,GAAG,CAAA,CAAE;AAElE,2BACGC,EAA4B,UAA5B,EAAqC,OAAOH,GAC1C,UAAAD,GACH;AAEJ;"}
@@ -0,0 +1,33 @@
1
+ import { createContext as t, useContext as n } from "react";
2
+ import { QueryClient as i } from "../../shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/queryClient.js";
3
+ const r = t(
4
+ null
5
+ );
6
+ function u() {
7
+ const e = n(r);
8
+ if (!e)
9
+ throw new Error(
10
+ "Shop Minis hooks must be used within <MinisContainer> or <MinisQueryProvider>. Wrap your component tree with one of these providers."
11
+ );
12
+ return e;
13
+ }
14
+ function c() {
15
+ return new i({
16
+ defaultOptions: {
17
+ queries: {
18
+ staleTime: 0,
19
+ // Data is immediately stale
20
+ gcTime: 0,
21
+ // Don't keep in cache after component unmounts
22
+ retry: 1,
23
+ refetchOnWindowFocus: !1
24
+ }
25
+ }
26
+ });
27
+ }
28
+ export {
29
+ r as ShopMinisQueryClientContext,
30
+ c as createShopMinisQueryClient,
31
+ u as useShopMinisQueryClient
32
+ };
33
+ //# sourceMappingURL=queryClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queryClient.js","sources":["../../../src/internal/reactQuery/queryClient.ts"],"sourcesContent":["import {createContext, useContext} from 'react'\n\nimport {QueryClient} from '@tanstack/react-query'\n\n/**\n * Custom QueryClient context for Shop Minis SDK\n * This ensures our SDK always uses its own QueryClient,\n * even if the parent app has their own QueryClientProvider\n */\nexport const ShopMinisQueryClientContext = createContext<QueryClient | null>(\n null\n)\n\nexport function useShopMinisQueryClient(): QueryClient {\n const client = useContext(ShopMinisQueryClientContext)\n if (!client) {\n throw new Error(\n 'Shop Minis hooks must be used within <MinisContainer> or <MinisQueryProvider>. ' +\n 'Wrap your component tree with one of these providers.'\n )\n }\n return client\n}\n\n/**\n * Create a QueryClient instance for Shop Minis SDK\n * Isolated from any parent app's QueryClient\n *\n * Caching is disabled by default since Apollo provides the cache layer.\n * React Query only provides request deduplication and state management.\n */\nexport function createShopMinisQueryClient() {\n return new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 0, // Data is immediately stale\n gcTime: 0, // Don't keep in cache after component unmounts\n retry: 1,\n refetchOnWindowFocus: false,\n },\n },\n })\n}\n"],"names":["ShopMinisQueryClientContext","createContext","useShopMinisQueryClient","client","useContext","createShopMinisQueryClient","QueryClient"],"mappings":";;AASO,MAAMA,IAA8BC;AAAA,EACzC;AACF;AAEO,SAASC,IAAuC;AAC/C,QAAAC,IAASC,EAAWJ,CAA2B;AACrD,MAAI,CAACG;AACH,UAAM,IAAI;AAAA,MACR;AAAA,IAEF;AAEK,SAAAA;AACT;AASO,SAASE,IAA6B;AAC3C,SAAO,IAAIC,EAAY;AAAA,IACrB,gBAAgB;AAAA,MACd,SAAS;AAAA,QACP,WAAW;AAAA;AAAA,QACX,QAAQ;AAAA;AAAA,QACR,OAAO;AAAA,QACP,sBAAsB;AAAA,MAAA;AAAA,IACxB;AAAA,EACF,CACD;AACH;"}