@shopify/shop-minis-react 0.0.1 → 0.0.2

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 (241) hide show
  1. package/README.md +110 -90
  2. package/dist/_virtual/_commonjsHelpers.js +9 -0
  3. package/dist/_virtual/_commonjsHelpers.js.map +1 -0
  4. package/dist/_virtual/index.js +8 -0
  5. package/dist/_virtual/index.js.map +1 -0
  6. package/dist/_virtual/index2.js +5 -0
  7. package/dist/_virtual/index2.js.map +1 -0
  8. package/dist/components/ui/alert-dialog.js +141 -0
  9. package/dist/components/ui/alert-dialog.js.map +1 -0
  10. package/dist/components/ui/button.js +50 -0
  11. package/dist/components/ui/button.js.map +1 -0
  12. package/dist/components/ui/card.js +91 -0
  13. package/dist/components/ui/card.js.map +1 -0
  14. package/dist/components/ui/sonner.js +23 -0
  15. package/dist/components/ui/sonner.js.map +1 -0
  16. package/dist/hooks/navigation/useCloseMini.js +12 -0
  17. package/dist/hooks/navigation/useCloseMini.js.map +1 -0
  18. package/dist/hooks/navigation/useShopNavigation.js +20 -0
  19. package/dist/hooks/navigation/useShopNavigation.js.map +1 -0
  20. package/dist/hooks/product/usePopularProducts.js +20 -0
  21. package/dist/hooks/product/usePopularProducts.js.map +1 -0
  22. package/dist/hooks/product/useProductList.js +29 -0
  23. package/dist/hooks/product/useProductList.js.map +1 -0
  24. package/dist/hooks/product/useProductListActions.js +22 -0
  25. package/dist/hooks/product/useProductListActions.js.map +1 -0
  26. package/dist/hooks/product/useProductLists.js +20 -0
  27. package/dist/hooks/product/useProductLists.js.map +1 -0
  28. package/dist/hooks/product/useRecommendedProducts.js +20 -0
  29. package/dist/hooks/product/useRecommendedProducts.js.map +1 -0
  30. package/dist/hooks/shop/useRecommendedShops.js +21 -0
  31. package/dist/hooks/shop/useRecommendedShops.js.map +1 -0
  32. package/dist/hooks/shop/useShopCartActions.js +13 -0
  33. package/dist/hooks/shop/useShopCartActions.js.map +1 -0
  34. package/dist/hooks/storage/useAsyncStorage.js +22 -0
  35. package/dist/hooks/storage/useAsyncStorage.js.map +1 -0
  36. package/dist/hooks/storage/useImageUpload.js +62 -0
  37. package/dist/hooks/storage/useImageUpload.js.map +1 -0
  38. package/dist/hooks/storage/useSecureStorage.js +14 -0
  39. package/dist/hooks/storage/useSecureStorage.js.map +1 -0
  40. package/dist/hooks/user/useBuyerAttributes.js +20 -0
  41. package/dist/hooks/user/useBuyerAttributes.js.map +1 -0
  42. package/dist/hooks/user/useCurrentUser.js +20 -0
  43. package/dist/hooks/user/useCurrentUser.js.map +1 -0
  44. package/dist/hooks/user/useFollowedShopsActions.js +13 -0
  45. package/dist/hooks/user/useFollowedShopsActions.js.map +1 -0
  46. package/dist/hooks/user/useOrders.js +20 -0
  47. package/dist/hooks/user/useOrders.js.map +1 -0
  48. package/dist/hooks/user/useSavedProductsActions.js +13 -0
  49. package/dist/hooks/user/useSavedProductsActions.js.map +1 -0
  50. package/dist/hooks/util/useErrorScreen.js +9 -0
  51. package/dist/hooks/util/useErrorScreen.js.map +1 -0
  52. package/dist/hooks/util/useErrorToast.js +9 -0
  53. package/dist/hooks/util/useErrorToast.js.map +1 -0
  54. package/dist/index.js +78 -0
  55. package/dist/index.js.map +1 -0
  56. package/dist/internal/useHandleAction.js +13 -0
  57. package/dist/internal/useHandleAction.js.map +1 -0
  58. package/dist/internal/useShopActions.js +7 -0
  59. package/dist/internal/useShopActions.js.map +1 -0
  60. package/dist/internal/useShopActionsDataFetching.js +79 -0
  61. package/dist/internal/useShopActionsDataFetching.js.map +1 -0
  62. package/dist/internal/useShopActionsPaginatedDataFetching.js +96 -0
  63. package/dist/internal/useShopActionsPaginatedDataFetching.js.map +1 -0
  64. package/dist/lib/utils.js +9 -0
  65. package/dist/lib/utils.js.map +1 -0
  66. package/dist/node_modules/.pnpm/@radix-ui_primitive@1.1.2/node_modules/@radix-ui/primitive/dist/index.js +10 -0
  67. package/dist/node_modules/.pnpm/@radix-ui_primitive@1.1.2/node_modules/@radix-ui/primitive/dist/index.js.map +1 -0
  68. package/dist/node_modules/.pnpm/@radix-ui_react-alert-dialog@1.1.14_@types_react-dom@19.1.6_@types_react@19.1.6__@types_react_5smkpul3xqqoqjowwwfk226yey/node_modules/@radix-ui/react-alert-dialog/dist/index.js +127 -0
  69. package/dist/node_modules/.pnpm/@radix-ui_react-alert-dialog@1.1.14_@types_react-dom@19.1.6_@types_react@19.1.6__@types_react_5smkpul3xqqoqjowwwfk226yey/node_modules/@radix-ui/react-alert-dialog/dist/index.js.map +1 -0
  70. package/dist/node_modules/.pnpm/@radix-ui_react-compose-refs@1.1.2_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-compose-refs/dist/index.js +30 -0
  71. package/dist/node_modules/.pnpm/@radix-ui_react-compose-refs@1.1.2_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-compose-refs/dist/index.js.map +1 -0
  72. package/dist/node_modules/.pnpm/@radix-ui_react-context@1.1.2_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-context/dist/index.js +69 -0
  73. package/dist/node_modules/.pnpm/@radix-ui_react-context@1.1.2_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-context/dist/index.js.map +1 -0
  74. package/dist/node_modules/.pnpm/@radix-ui_react-dialog@1.1.14_@types_react-dom@19.1.6_@types_react@19.1.6__@types_react@19.1._sjczexpvrqz6fttoobpwnns2oa/node_modules/@radix-ui/react-dialog/dist/index.js +259 -0
  75. package/dist/node_modules/.pnpm/@radix-ui_react-dialog@1.1.14_@types_react-dom@19.1.6_@types_react@19.1.6__@types_react@19.1._sjczexpvrqz6fttoobpwnns2oa/node_modules/@radix-ui/react-dialog/dist/index.js.map +1 -0
  76. package/dist/node_modules/.pnpm/@radix-ui_react-dismissable-layer@1.1.10_@types_react-dom@19.1.6_@types_react@19.1.6__@types__ipor64qsap4jnr6m7nflv4q5v4/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +128 -0
  77. package/dist/node_modules/.pnpm/@radix-ui_react-dismissable-layer@1.1.10_@types_react-dom@19.1.6_@types_react@19.1.6__@types__ipor64qsap4jnr6m7nflv4q5v4/node_modules/@radix-ui/react-dismissable-layer/dist/index.js.map +1 -0
  78. package/dist/node_modules/.pnpm/@radix-ui_react-focus-guards@1.1.2_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-focus-guards/dist/index.js +18 -0
  79. package/dist/node_modules/.pnpm/@radix-ui_react-focus-guards@1.1.2_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-focus-guards/dist/index.js.map +1 -0
  80. package/dist/node_modules/.pnpm/@radix-ui_react-focus-scope@1.1.7_@types_react-dom@19.1.6_@types_react@19.1.6__@types_react@1_zpdtvgogfsfavk62phevpdv4fu/node_modules/@radix-ui/react-focus-scope/dist/index.js +137 -0
  81. package/dist/node_modules/.pnpm/@radix-ui_react-focus-scope@1.1.7_@types_react-dom@19.1.6_@types_react@19.1.6__@types_react@1_zpdtvgogfsfavk62phevpdv4fu/node_modules/@radix-ui/react-focus-scope/dist/index.js.map +1 -0
  82. package/dist/node_modules/.pnpm/@radix-ui_react-id@1.1.1_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-id/dist/index.js +14 -0
  83. package/dist/node_modules/.pnpm/@radix-ui_react-id@1.1.1_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-id/dist/index.js.map +1 -0
  84. package/dist/node_modules/.pnpm/@radix-ui_react-portal@1.1.9_@types_react-dom@19.1.6_@types_react@19.1.6__@types_react@19.1.6_sr45arufxpp6hzdn2l7kcrtvqe/node_modules/@radix-ui/react-portal/dist/index.js +16 -0
  85. package/dist/node_modules/.pnpm/@radix-ui_react-portal@1.1.9_@types_react-dom@19.1.6_@types_react@19.1.6__@types_react@19.1.6_sr45arufxpp6hzdn2l7kcrtvqe/node_modules/@radix-ui/react-portal/dist/index.js.map +1 -0
  86. package/dist/node_modules/.pnpm/@radix-ui_react-presence@1.1.4_@types_react-dom@19.1.6_@types_react@19.1.6__@types_react@19.1_5ga5lr7i6zouk7rhd63vbsmjyu/node_modules/@radix-ui/react-presence/dist/index.js +71 -0
  87. package/dist/node_modules/.pnpm/@radix-ui_react-presence@1.1.4_@types_react-dom@19.1.6_@types_react@19.1.6__@types_react@19.1_5ga5lr7i6zouk7rhd63vbsmjyu/node_modules/@radix-ui/react-presence/dist/index.js.map +1 -0
  88. package/dist/node_modules/.pnpm/@radix-ui_react-primitive@2.1.3_@types_react-dom@19.1.6_@types_react@19.1.6__@types_react@19._5iu4xtybujtep4zwi6jviky6tu/node_modules/@radix-ui/react-primitive/dist/index.js +37 -0
  89. package/dist/node_modules/.pnpm/@radix-ui_react-primitive@2.1.3_@types_react-dom@19.1.6_@types_react@19.1.6__@types_react@19._5iu4xtybujtep4zwi6jviky6tu/node_modules/@radix-ui/react-primitive/dist/index.js.map +1 -0
  90. package/dist/node_modules/.pnpm/@radix-ui_react-slot@1.2.3_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-slot/dist/index.js +59 -0
  91. package/dist/node_modules/.pnpm/@radix-ui_react-slot@1.2.3_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-slot/dist/index.js.map +1 -0
  92. package/dist/node_modules/.pnpm/@radix-ui_react-use-callback-ref@1.1.1_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +11 -0
  93. package/dist/node_modules/.pnpm/@radix-ui_react-use-callback-ref@1.1.1_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-use-callback-ref/dist/index.js.map +1 -0
  94. package/dist/node_modules/.pnpm/@radix-ui_react-use-controllable-state@1.2.2_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +53 -0
  95. package/dist/node_modules/.pnpm/@radix-ui_react-use-controllable-state@1.2.2_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-use-controllable-state/dist/index.js.map +1 -0
  96. package/dist/node_modules/.pnpm/@radix-ui_react-use-escape-keydown@1.1.1_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +15 -0
  97. package/dist/node_modules/.pnpm/@radix-ui_react-use-escape-keydown@1.1.1_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js.map +1 -0
  98. package/dist/node_modules/.pnpm/@radix-ui_react-use-layout-effect@1.1.1_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +7 -0
  99. package/dist/node_modules/.pnpm/@radix-ui_react-use-layout-effect@1.1.1_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-use-layout-effect/dist/index.js.map +1 -0
  100. package/dist/node_modules/.pnpm/aria-hidden@1.2.6/node_modules/aria-hidden/dist/es2015/index.js +53 -0
  101. package/dist/node_modules/.pnpm/aria-hidden@1.2.6/node_modules/aria-hidden/dist/es2015/index.js.map +1 -0
  102. package/dist/node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js +36 -0
  103. package/dist/node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js.map +1 -0
  104. package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.js +18 -0
  105. package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.js.map +1 -0
  106. package/dist/node_modules/.pnpm/get-nonce@1.0.1/node_modules/get-nonce/dist/es2015/index.js +8 -0
  107. package/dist/node_modules/.pnpm/get-nonce@1.0.1/node_modules/get-nonce/dist/es2015/index.js.map +1 -0
  108. package/dist/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 +34 -0
  109. package/dist/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.map +1 -0
  110. package/dist/node_modules/.pnpm/querystringify@2.2.0/node_modules/querystringify/index.js +44 -0
  111. package/dist/node_modules/.pnpm/querystringify@2.2.0/node_modules/querystringify/index.js.map +1 -0
  112. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll-bar/dist/es2015/component.js +72 -0
  113. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll-bar/dist/es2015/component.js.map +1 -0
  114. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +8 -0
  115. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll-bar/dist/es2015/constants.js.map +1 -0
  116. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +26 -0
  117. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll-bar/dist/es2015/utils.js.map +1 -0
  118. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll/dist/es2015/Combination.js +12 -0
  119. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll/dist/es2015/Combination.js.map +1 -0
  120. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +113 -0
  121. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll/dist/es2015/SideEffect.js.map +1 -0
  122. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll/dist/es2015/UI.js +32 -0
  123. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll/dist/es2015/UI.js.map +1 -0
  124. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +17 -0
  125. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js.map +1 -0
  126. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +69 -0
  127. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll/dist/es2015/handleScroll.js.map +1 -0
  128. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll/dist/es2015/medium.js +6 -0
  129. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll/dist/es2015/medium.js.map +1 -0
  130. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll/dist/es2015/sidecar.js +8 -0
  131. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll/dist/es2015/sidecar.js.map +1 -0
  132. package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.1.6_react@19.1.0/node_modules/react-style-singleton/dist/es2015/component.js +12 -0
  133. package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.1.6_react@19.1.0/node_modules/react-style-singleton/dist/es2015/component.js.map +1 -0
  134. package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.1.6_react@19.1.0/node_modules/react-style-singleton/dist/es2015/hook.js +16 -0
  135. package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.1.6_react@19.1.0/node_modules/react-style-singleton/dist/es2015/hook.js.map +1 -0
  136. package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.1.6_react@19.1.0/node_modules/react-style-singleton/dist/es2015/singleton.js +31 -0
  137. package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.1.6_react@19.1.0/node_modules/react-style-singleton/dist/es2015/singleton.js.map +1 -0
  138. package/dist/node_modules/.pnpm/requires-port@1.0.0/node_modules/requires-port/index.js +25 -0
  139. package/dist/node_modules/.pnpm/requires-port@1.0.0/node_modules/requires-port/index.js.map +1 -0
  140. package/dist/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 +743 -0
  141. package/dist/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 -0
  142. package/dist/node_modules/.pnpm/tailwind-merge@2.6.0/node_modules/tailwind-merge/dist/bundle-mjs.js +2265 -0
  143. package/dist/node_modules/.pnpm/tailwind-merge@2.6.0/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -0
  144. package/dist/node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.js +28 -0
  145. package/dist/node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.js.map +1 -0
  146. package/dist/node_modules/.pnpm/url-parse@1.5.10/node_modules/url-parse/index.js +133 -0
  147. package/dist/node_modules/.pnpm/url-parse@1.5.10/node_modules/url-parse/index.js.map +1 -0
  148. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.1.6_react@19.1.0/node_modules/use-callback-ref/dist/es2015/assignRef.js +7 -0
  149. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.1.6_react@19.1.0/node_modules/use-callback-ref/dist/es2015/assignRef.js.map +1 -0
  150. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.1.6_react@19.1.0/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +27 -0
  151. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.1.6_react@19.1.0/node_modules/use-callback-ref/dist/es2015/useMergeRef.js.map +1 -0
  152. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.1.6_react@19.1.0/node_modules/use-callback-ref/dist/es2015/useRef.js +26 -0
  153. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.1.6_react@19.1.0/node_modules/use-callback-ref/dist/es2015/useRef.js.map +1 -0
  154. package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.1.6_react@19.1.0/node_modules/use-sidecar/dist/es2015/exports.js +19 -0
  155. package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.1.6_react@19.1.0/node_modules/use-sidecar/dist/es2015/exports.js.map +1 -0
  156. package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.1.6_react@19.1.0/node_modules/use-sidecar/dist/es2015/medium.js +68 -0
  157. package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.1.6_react@19.1.0/node_modules/use-sidecar/dist/es2015/medium.js.map +1 -0
  158. package/dist/types/minisSDK.generated.d.js +18 -0
  159. package/dist/types/minisSDK.generated.d.js.map +1 -0
  160. package/dist/utils/errors.js +39 -0
  161. package/dist/utils/errors.js.map +1 -0
  162. package/dist/utils/parseUrl.js +8 -0
  163. package/dist/utils/parseUrl.js.map +1 -0
  164. package/package.json +29 -14
  165. package/src/components/index.ts +4 -7
  166. package/src/components/ui/alert-dialog.tsx +151 -0
  167. package/src/components/ui/button.tsx +60 -0
  168. package/src/components/ui/card.tsx +92 -0
  169. package/src/components/ui/sonner.tsx +23 -0
  170. package/src/dev.tsx +116 -38
  171. package/src/hooks/index.ts +31 -5
  172. package/src/hooks/navigation/useCloseMini.doc.ts +32 -0
  173. package/src/hooks/navigation/useCloseMini.example.tsx +7 -0
  174. package/src/hooks/navigation/useCloseMini.ts +17 -0
  175. package/src/hooks/navigation/useShopNavigation.doc.ts +32 -0
  176. package/src/hooks/navigation/useShopNavigation.example.tsx +29 -0
  177. package/src/hooks/navigation/useShopNavigation.ts +41 -0
  178. package/src/hooks/product/usePopularProducts.ts +37 -0
  179. package/src/hooks/product/useProductList.doc.ts +32 -0
  180. package/src/hooks/product/useProductList.example.tsx +9 -0
  181. package/src/hooks/product/useProductList.ts +56 -0
  182. package/src/hooks/product/useProductListActions.doc.ts +32 -0
  183. package/src/hooks/product/useProductListActions.example.tsx +57 -0
  184. package/src/hooks/product/useProductListActions.ts +51 -0
  185. package/src/hooks/product/useProductLists.doc.ts +32 -0
  186. package/src/hooks/product/useProductLists.example.tsx +9 -0
  187. package/src/hooks/product/useProductLists.ts +39 -0
  188. package/src/hooks/product/useRecommendedProducts.doc.ts +32 -0
  189. package/src/hooks/product/useRecommendedProducts.example.tsx +7 -0
  190. package/src/hooks/product/useRecommendedProducts.ts +37 -0
  191. package/src/hooks/shop/useRecommendedShops.doc.ts +32 -0
  192. package/src/hooks/shop/useRecommendedShops.example.tsx +7 -0
  193. package/src/hooks/shop/useRecommendedShops.ts +43 -0
  194. package/src/hooks/shop/useShopCartActions.doc.ts +32 -0
  195. package/src/hooks/shop/useShopCartActions.example.tsx +28 -0
  196. package/src/hooks/shop/useShopCartActions.ts +23 -0
  197. package/src/hooks/storage/useAsyncStorage.doc.ts +32 -0
  198. package/src/hooks/storage/useAsyncStorage.example.tsx +30 -0
  199. package/src/hooks/storage/useAsyncStorage.ts +48 -0
  200. package/src/hooks/storage/useImageUpload.doc.ts +32 -0
  201. package/src/hooks/storage/useImageUpload.example.tsx +20 -0
  202. package/src/hooks/storage/useImageUpload.ts +135 -0
  203. package/src/hooks/storage/useSecureStorage.doc.ts +32 -0
  204. package/src/hooks/storage/useSecureStorage.example.tsx +23 -0
  205. package/src/hooks/storage/useSecureStorage.ts +28 -0
  206. package/src/hooks/user/useBuyerAttributes.doc.ts +32 -0
  207. package/src/hooks/user/useBuyerAttributes.example.tsx +14 -0
  208. package/src/hooks/user/useBuyerAttributes.ts +34 -0
  209. package/src/hooks/user/useCurrentUser.doc.ts +31 -0
  210. package/src/hooks/user/useCurrentUser.example.tsx +7 -0
  211. package/src/hooks/user/useCurrentUser.ts +37 -0
  212. package/src/hooks/user/useFollowedShopsActions.doc.ts +32 -0
  213. package/src/hooks/user/useFollowedShopsActions.example.tsx +18 -0
  214. package/src/hooks/user/useFollowedShopsActions.ts +23 -0
  215. package/src/hooks/user/useOrders.doc.ts +32 -0
  216. package/src/hooks/user/useOrders.example.tsx +7 -0
  217. package/src/hooks/user/useOrders.ts +32 -0
  218. package/src/hooks/user/useSavedProductsActions.doc.ts +32 -0
  219. package/src/hooks/user/useSavedProductsActions.example.tsx +30 -0
  220. package/src/hooks/user/useSavedProductsActions.ts +23 -0
  221. package/src/hooks/util/useErrorScreen.doc.ts +32 -0
  222. package/src/hooks/util/useErrorScreen.example.tsx +16 -0
  223. package/src/hooks/util/useErrorScreen.ts +15 -0
  224. package/src/hooks/util/useErrorToast.doc.ts +32 -0
  225. package/src/hooks/util/useErrorToast.example.tsx +15 -0
  226. package/src/hooks/util/useErrorToast.ts +15 -0
  227. package/src/index.css +120 -2
  228. package/src/internal/useHandleAction.ts +24 -0
  229. package/src/internal/useShopActions.ts +5 -0
  230. package/src/internal/useShopActionsDataFetching.ts +153 -0
  231. package/src/internal/useShopActionsPaginatedDataFetching.ts +193 -0
  232. package/src/lib/utils.ts +9 -0
  233. package/src/types/index.ts +2 -0
  234. package/src/types/minisSDK.generated.d.ts +2 -74
  235. package/src/utils/errors.ts +86 -0
  236. package/src/utils/index.ts +2 -11
  237. package/src/utils/parseUrl.ts +5 -0
  238. package/tailwind.config.js +3 -0
  239. package/src/components/HelloWorld/HelloWorld.tsx +0 -43
  240. package/src/components/HelloWorld/index.ts +0 -2
  241. package/src/tailwind-theme.css +0 -39
@@ -0,0 +1,60 @@
1
+ import * as React from 'react'
2
+
3
+ import {Slot} from '@radix-ui/react-slot'
4
+ import {cva, type VariantProps} from 'class-variance-authority'
5
+
6
+ import {cn} from '../../lib/utils'
7
+
8
+ const buttonVariants = cva(
9
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
10
+ {
11
+ variants: {
12
+ variant: {
13
+ default:
14
+ 'bg-primary text-primary-foreground shadow-xs hover:bg-primary/90',
15
+ destructive:
16
+ 'bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60',
17
+ outline:
18
+ 'border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50',
19
+ secondary:
20
+ 'bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80',
21
+ ghost:
22
+ 'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',
23
+ link: 'text-primary underline-offset-4 hover:underline',
24
+ },
25
+ size: {
26
+ default: 'h-9 px-4 py-2 has-[>svg]:px-3',
27
+ sm: 'h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5',
28
+ lg: 'h-10 rounded-md px-6 has-[>svg]:px-4',
29
+ icon: 'size-9',
30
+ },
31
+ },
32
+ defaultVariants: {
33
+ variant: 'default',
34
+ size: 'default',
35
+ },
36
+ }
37
+ )
38
+
39
+ function Button({
40
+ className,
41
+ variant,
42
+ size,
43
+ asChild = false,
44
+ ...props
45
+ }: React.ComponentProps<'button'> &
46
+ VariantProps<typeof buttonVariants> & {
47
+ asChild?: boolean
48
+ }) {
49
+ const Comp = asChild ? Slot : 'button'
50
+
51
+ return (
52
+ <Comp
53
+ data-slot="button"
54
+ className={cn(buttonVariants({variant, size, className}))}
55
+ {...props}
56
+ />
57
+ )
58
+ }
59
+
60
+ export {Button, buttonVariants}
@@ -0,0 +1,92 @@
1
+ import * as React from 'react'
2
+
3
+ import {cn} from '../../lib/utils'
4
+
5
+ function Card({className, ...props}: React.ComponentProps<'div'>) {
6
+ return (
7
+ <div
8
+ data-slot="card"
9
+ className={cn(
10
+ 'bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm',
11
+ className
12
+ )}
13
+ {...props}
14
+ />
15
+ )
16
+ }
17
+
18
+ function CardHeader({className, ...props}: React.ComponentProps<'div'>) {
19
+ return (
20
+ <div
21
+ data-slot="card-header"
22
+ className={cn(
23
+ '@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6',
24
+ className
25
+ )}
26
+ {...props}
27
+ />
28
+ )
29
+ }
30
+
31
+ function CardTitle({className, ...props}: React.ComponentProps<'div'>) {
32
+ return (
33
+ <div
34
+ data-slot="card-title"
35
+ className={cn('leading-none font-semibold', className)}
36
+ {...props}
37
+ />
38
+ )
39
+ }
40
+
41
+ function CardDescription({className, ...props}: React.ComponentProps<'div'>) {
42
+ return (
43
+ <div
44
+ data-slot="card-description"
45
+ className={cn('text-muted-foreground text-sm', className)}
46
+ {...props}
47
+ />
48
+ )
49
+ }
50
+
51
+ function CardAction({className, ...props}: React.ComponentProps<'div'>) {
52
+ return (
53
+ <div
54
+ data-slot="card-action"
55
+ className={cn(
56
+ 'col-start-2 row-span-2 row-start-1 self-start justify-self-end',
57
+ className
58
+ )}
59
+ {...props}
60
+ />
61
+ )
62
+ }
63
+
64
+ function CardContent({className, ...props}: React.ComponentProps<'div'>) {
65
+ return (
66
+ <div
67
+ data-slot="card-content"
68
+ className={cn('px-6', className)}
69
+ {...props}
70
+ />
71
+ )
72
+ }
73
+
74
+ function CardFooter({className, ...props}: React.ComponentProps<'div'>) {
75
+ return (
76
+ <div
77
+ data-slot="card-footer"
78
+ className={cn('flex items-center px-6 [.border-t]:pt-6', className)}
79
+ {...props}
80
+ />
81
+ )
82
+ }
83
+
84
+ export {
85
+ Card,
86
+ CardHeader,
87
+ CardFooter,
88
+ CardTitle,
89
+ CardAction,
90
+ CardDescription,
91
+ CardContent,
92
+ }
@@ -0,0 +1,23 @@
1
+ import {useTheme} from 'next-themes'
2
+ import {Toaster as Sonner, ToasterProps} from 'sonner'
3
+
4
+ const Toaster = ({...props}: ToasterProps) => {
5
+ const {theme = 'system'} = useTheme()
6
+
7
+ return (
8
+ <Sonner
9
+ theme={theme as ToasterProps['theme']}
10
+ className="toaster group"
11
+ style={
12
+ {
13
+ '--normal-bg': 'var(--popover)',
14
+ '--normal-text': 'var(--popover-foreground)',
15
+ '--normal-border': 'var(--border)',
16
+ } as React.CSSProperties
17
+ }
18
+ {...props}
19
+ />
20
+ )
21
+ }
22
+
23
+ export {Toaster}
package/src/dev.tsx CHANGED
@@ -1,57 +1,135 @@
1
- import React from 'react'
1
+ import React, {useState} from 'react'
2
2
 
3
3
  import ReactDOM from 'react-dom/client'
4
+ import {toast} from 'sonner'
4
5
 
5
- import {HelloWorld} from './components'
6
6
  import './index.css'
7
+ import {
8
+ AlertDialog,
9
+ AlertDialogAction,
10
+ AlertDialogCancel,
11
+ AlertDialogContent,
12
+ AlertDialogDescription,
13
+ AlertDialogFooter,
14
+ AlertDialogHeader,
15
+ AlertDialogTitle,
16
+ AlertDialogTrigger,
17
+ } from './components/ui/alert-dialog'
18
+ import {Button} from './components/ui/button'
19
+ import {
20
+ Card,
21
+ CardHeader,
22
+ CardTitle,
23
+ CardDescription,
24
+ CardContent,
25
+ CardAction,
26
+ CardFooter,
27
+ } from './components/ui/card'
28
+ import {Toaster} from './components/ui/sonner'
7
29
 
8
30
  function App() {
31
+ const [alertOpen, setAlertOpen] = useState(false)
32
+
9
33
  return (
10
34
  <div className="min-h-screen bg-gray-50 flex items-center justify-center p-8">
11
- <div className="space-y-8">
35
+ <div className="space-y-8 w-full max-w-4xl">
12
36
  <div className="text-center">
13
37
  <h1 className="text-3xl font-bold text-gray-900 mb-8">
14
38
  Shop Minis React Components
15
39
  </h1>
16
40
  </div>
17
41
 
18
- <div className="space-y-4">
19
- <h2 className="text-xl font-semibold text-gray-800">
20
- HelloWorld Component
21
- </h2>
22
-
23
- <div className="space-y-4">
24
- <>
25
- <p className="text-sm text-gray-600 mb-2">Default:</p>
26
- <HelloWorld />
27
- </>
28
-
29
- <>
30
- <p className="text-sm text-gray-600 mb-2">With custom name:</p>
31
- <HelloWorld name="Shop Minis" />
32
- </>
33
-
34
- <>
35
- <p className="text-sm text-gray-600 mb-2">Different sizes:</p>
36
- <div className="space-x-4">
37
- <HelloWorld name="Small" size="sm" />
38
- <HelloWorld name="Medium" size="md" />
39
- <HelloWorld name="Large" size="lg" />
40
- </div>
41
- </>
42
-
43
- <>
44
- <p className="text-sm text-gray-600 mb-2">With custom content:</p>
45
- <HelloWorld>
46
- <span role="img" aria-label="Party Popper">
47
- 🎉
48
- </span>{' '}
49
- Custom Content!
50
- </HelloWorld>
51
- </>
42
+ {/* Button Examples */}
43
+ <section className="space-y-4">
44
+ <h2 className="text-2xl font-semibold">Button</h2>
45
+ <div className="flex flex-wrap gap-4">
46
+ <Button>Default Button</Button>
47
+ <Button variant="destructive">Destructive</Button>
48
+ <Button variant="outline">Outline</Button>
49
+ <Button variant="secondary">Secondary</Button>
50
+ <Button variant="ghost">Ghost</Button>
51
+ <Button variant="link">Link</Button>
52
+ <Button size="sm">Small</Button>
53
+ <Button size="lg">Large</Button>
52
54
  </div>
53
- </div>
55
+ </section>
56
+
57
+ {/* Card Example */}
58
+ <section className="space-y-4">
59
+ <h2 className="text-2xl font-semibold">Card</h2>
60
+ <Card className="w-full max-w-md">
61
+ <CardHeader>
62
+ <CardTitle>Card Title</CardTitle>
63
+ <CardDescription>
64
+ This is a card description that explains what the card contains.
65
+ </CardDescription>
66
+ <CardAction>
67
+ <Button size="sm" variant="outline">
68
+ Action
69
+ </Button>
70
+ </CardAction>
71
+ </CardHeader>
72
+ <CardContent>
73
+ <p>
74
+ This is the main content of the card. You can put any content
75
+ here.
76
+ </p>
77
+ </CardContent>
78
+ <CardFooter>
79
+ <Button className="w-full">Footer Button</Button>
80
+ </CardFooter>
81
+ </Card>
82
+ </section>
83
+
84
+ {/* AlertDialog Example */}
85
+ <section className="space-y-4">
86
+ <h2 className="text-2xl font-semibold">Alert Dialog</h2>
87
+ <AlertDialog open={alertOpen} onOpenChange={setAlertOpen}>
88
+ <AlertDialogTrigger asChild>
89
+ <Button variant="outline">Show Alert Dialog</Button>
90
+ </AlertDialogTrigger>
91
+ <AlertDialogContent>
92
+ <AlertDialogHeader>
93
+ <AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
94
+ <AlertDialogDescription>
95
+ This action cannot be undone. This will permanently delete
96
+ your account and remove your data from our servers.
97
+ </AlertDialogDescription>
98
+ </AlertDialogHeader>
99
+ <AlertDialogFooter>
100
+ <AlertDialogCancel>Cancel</AlertDialogCancel>
101
+ <AlertDialogAction
102
+ onClick={() => toast.success('Action confirmed!')}
103
+ >
104
+ Continue
105
+ </AlertDialogAction>
106
+ </AlertDialogFooter>
107
+ </AlertDialogContent>
108
+ </AlertDialog>
109
+ </section>
110
+
111
+ {/* Toaster Example */}
112
+ <section className="space-y-4">
113
+ <h2 className="text-2xl font-semibold">Toaster (Sonner)</h2>
114
+ <div className="flex gap-4">
115
+ <Button onClick={() => toast.success('Success toast!')}>
116
+ Success Toast
117
+ </Button>
118
+ <Button onClick={() => toast.error('Error toast!')}>
119
+ Error Toast
120
+ </Button>
121
+ <Button onClick={() => toast('Default toast!')}>
122
+ Default Toast
123
+ </Button>
124
+ <Button onClick={() => toast.info('Info toast!')}>
125
+ Info Toast
126
+ </Button>
127
+ </div>
128
+ </section>
54
129
  </div>
130
+
131
+ {/* Toaster component for displaying notifications */}
132
+ <Toaster />
55
133
  </div>
56
134
  )
57
135
  }
@@ -1,6 +1,32 @@
1
- // Export all hooks here
2
- // Example: export { useShopMini } from './useShopMini';
3
- // Example: export { useTheme } from './useTheme';
1
+ // - User Hooks
2
+ export * from './user/useSavedProductsActions'
3
+ export * from './user/useFollowedShopsActions'
4
+ export * from './user/useCurrentUser'
5
+ export * from './user/useOrders'
6
+ export * from './user/useBuyerAttributes'
4
7
 
5
- // This file will be populated as hooks are added
6
- export {}
8
+ // - Product Hooks
9
+ export * from './product/useProductListActions'
10
+ export * from './product/useProductLists'
11
+ export * from './product/useProductList'
12
+ export * from './product/useRecommendedProducts'
13
+ export * from './product/usePopularProducts'
14
+
15
+ // - Storage Hooks
16
+ export * from './storage/useAsyncStorage'
17
+ export * from './storage/useSecureStorage'
18
+ export * from './storage/useImageUpload'
19
+
20
+ // - Navigation Hooks
21
+ export * from './navigation/useShopNavigation'
22
+ export * from './navigation/useCloseMini'
23
+
24
+ // - Shop Hooks
25
+ export * from './shop/useShopCartActions'
26
+ export * from './shop/useRecommendedShops'
27
+
28
+ // - Content Hooks
29
+
30
+ // - Utility Hooks
31
+ export * from './util/useErrorToast'
32
+ export * from './util/useErrorScreen'
@@ -0,0 +1,32 @@
1
+ import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs'
2
+
3
+ const data: ReferenceEntityTemplateSchema = {
4
+ name: 'useCloseMini',
5
+ category: 'hooks',
6
+ subCategory: 'navigation',
7
+ isVisualComponent: false,
8
+ related: [],
9
+ description:
10
+ 'The `useCloseMini` hook returns a function to close the Mini viewer.',
11
+ type: 'hook',
12
+ defaultExample: {
13
+ codeblock: {
14
+ tabs: [
15
+ {
16
+ code: './useCloseMini.example.tsx',
17
+ language: 'tsx',
18
+ },
19
+ ],
20
+ title: 'Example code',
21
+ },
22
+ },
23
+ definitions: [
24
+ {
25
+ title: '',
26
+ type: 'UseCloseMiniGeneratedType',
27
+ description: '',
28
+ },
29
+ ],
30
+ }
31
+
32
+ export default data
@@ -0,0 +1,7 @@
1
+ import {useCloseMini, Button} from '@shopify/shop-minis-react'
2
+
3
+ export function Example() {
4
+ const {closeMini} = useCloseMini()
5
+
6
+ return <Button onPress={closeMini} text="Close Mini" />
7
+ }
@@ -0,0 +1,17 @@
1
+ import {useHandleAction} from '../../internal/useHandleAction'
2
+ import {useShopActions} from '../../internal/useShopActions'
3
+
4
+ interface UseCloseMiniReturns {
5
+ /**
6
+ * Closes the Mini viewer.
7
+ */
8
+ closeMini: () => void
9
+ }
10
+
11
+ export const useCloseMini = (): UseCloseMiniReturns => {
12
+ const {closeMini} = useShopActions()
13
+
14
+ return {
15
+ closeMini: useHandleAction(closeMini),
16
+ }
17
+ }
@@ -0,0 +1,32 @@
1
+ import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs'
2
+
3
+ const data: ReferenceEntityTemplateSchema = {
4
+ name: 'useShopNavigation',
5
+ category: 'hooks',
6
+ subCategory: 'navigation',
7
+ isVisualComponent: false,
8
+ related: [],
9
+ description:
10
+ 'The `useShopNavigation` hook provides functions to navigate to different parts of the Shop app.',
11
+ type: 'hook',
12
+ defaultExample: {
13
+ codeblock: {
14
+ tabs: [
15
+ {
16
+ code: './useShopNavigation.example.tsx',
17
+ language: 'tsx',
18
+ },
19
+ ],
20
+ title: 'Example code',
21
+ },
22
+ },
23
+ definitions: [
24
+ {
25
+ title: '',
26
+ type: 'UseShopNavigationGeneratedType',
27
+ description: '',
28
+ },
29
+ ],
30
+ }
31
+
32
+ export default data
@@ -0,0 +1,29 @@
1
+ import {useShopNavigation, Button} from '@shopify/shop-minis-react'
2
+
3
+ export default function MyComponent() {
4
+ const {navigateToProduct, navigateToShop, navigateToOrder} =
5
+ useShopNavigation()
6
+
7
+ return (
8
+ <>
9
+ <Button
10
+ onPress={() =>
11
+ navigateToProduct({productId: 'gid://shopify/Product/123'})
12
+ }
13
+ text="View Product"
14
+ />
15
+ <Button
16
+ onPress={() =>
17
+ navigateToShop({
18
+ shopId: 'gid://shopify/Shop/123',
19
+ })
20
+ }
21
+ text="Go to Shop"
22
+ />
23
+ <Button
24
+ onPress={() => navigateToOrder({orderId: 'gid://shopify/Order/123'})}
25
+ text="View Order"
26
+ />
27
+ </>
28
+ )
29
+ }
@@ -0,0 +1,41 @@
1
+ import {useHandleAction} from '../../internal/useHandleAction'
2
+ import {useShopActions} from '../../internal/useShopActions'
3
+ import {
4
+ NavigateToCheckoutParams,
5
+ NavigateToOrderParams,
6
+ NavigateToProductParams,
7
+ NavigateToShopParams,
8
+ } from '../../types'
9
+
10
+ interface UseShopNavigationReturns {
11
+ /**
12
+ * Navigates to a product.
13
+ */
14
+ navigateToProduct: (params: NavigateToProductParams) => Promise<void>
15
+ /**
16
+ * Navigates to a shop.
17
+ */
18
+ navigateToShop: (params: NavigateToShopParams) => Promise<void>
19
+ /**
20
+ * Navigates to an order.
21
+ */
22
+ navigateToOrder: (params: NavigateToOrderParams) => Promise<void>
23
+
24
+ navigateToCheckout: (params: NavigateToCheckoutParams) => Promise<void>
25
+ }
26
+
27
+ export const useShopNavigation = (): UseShopNavigationReturns => {
28
+ const {
29
+ navigateToProduct,
30
+ navigateToShop,
31
+ navigateToOrder,
32
+ navigateToCheckout,
33
+ } = useShopActions()
34
+
35
+ return {
36
+ navigateToProduct: useHandleAction(navigateToProduct),
37
+ navigateToShop: useHandleAction(navigateToShop),
38
+ navigateToOrder: useHandleAction(navigateToOrder),
39
+ navigateToCheckout: useHandleAction(navigateToCheckout),
40
+ }
41
+ }
@@ -0,0 +1,37 @@
1
+ import {useShopActions} from '../../internal/useShopActions'
2
+ import {useShopActionsPaginatedDataFetching} from '../../internal/useShopActionsPaginatedDataFetching'
3
+ import {
4
+ Product,
5
+ PaginatedDataHookOptionsBase,
6
+ PaginatedDataHookReturnsBase,
7
+ } from '../../types'
8
+
9
+ interface UsePopularProductsParams extends PaginatedDataHookOptionsBase {}
10
+
11
+ interface UsePopularProductsReturns extends PaginatedDataHookReturnsBase {
12
+ products: Product[] | null
13
+ }
14
+
15
+ /**
16
+ * @param options - The options for the query
17
+ */
18
+ export const usePopularProducts = (
19
+ params?: UsePopularProductsParams
20
+ ): UsePopularProductsReturns => {
21
+ const {getPopularProducts} = useShopActions()
22
+ const {skip, ...shopActionParams} = params ?? {}
23
+
24
+ const {data, ...rest} = useShopActionsPaginatedDataFetching(
25
+ getPopularProducts,
26
+ shopActionParams,
27
+ {
28
+ skip,
29
+ hook: 'usePopularProducts',
30
+ }
31
+ )
32
+
33
+ return {
34
+ ...rest,
35
+ products: data,
36
+ }
37
+ }
@@ -0,0 +1,32 @@
1
+ import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs'
2
+
3
+ const data: ReferenceEntityTemplateSchema = {
4
+ name: 'useProductList',
5
+ category: 'hooks',
6
+ subCategory: 'product',
7
+ isVisualComponent: false,
8
+ related: [],
9
+ description:
10
+ 'The `useProductList` hook enables fetching a list of products saved by the user.',
11
+ type: 'hook',
12
+ defaultExample: {
13
+ codeblock: {
14
+ tabs: [
15
+ {
16
+ code: './useProductList.example.tsx',
17
+ language: 'tsx',
18
+ },
19
+ ],
20
+ title: 'Example code',
21
+ },
22
+ },
23
+ definitions: [
24
+ {
25
+ title: '',
26
+ type: 'UseProductListGeneratedType',
27
+ description: '',
28
+ },
29
+ ],
30
+ }
31
+
32
+ export default data
@@ -0,0 +1,9 @@
1
+ import {useProductList} from '@shopify/shop-minis-react'
2
+
3
+ export default function MyComponent() {
4
+ const {productList, loading, error} = useProductList({
5
+ id: 'gid://shopapp/ProductList/123',
6
+ })
7
+
8
+ console.log({productList, loading, error})
9
+ }