@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,20 @@
1
+ import { useHandleAction as o } from "../../internal/useHandleAction.js";
2
+ import { useShopActions as i } from "../../internal/useShopActions.js";
3
+ const v = () => {
4
+ const {
5
+ navigateToProduct: t,
6
+ navigateToShop: a,
7
+ navigateToOrder: e,
8
+ navigateToCheckout: n
9
+ } = i();
10
+ return {
11
+ navigateToProduct: o(t),
12
+ navigateToShop: o(a),
13
+ navigateToOrder: o(e),
14
+ navigateToCheckout: o(n)
15
+ };
16
+ };
17
+ export {
18
+ v as useShopNavigation
19
+ };
20
+ //# sourceMappingURL=useShopNavigation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useShopNavigation.js","sources":["../../../src/hooks/navigation/useShopNavigation.ts"],"sourcesContent":["import {useHandleAction} from '../../internal/useHandleAction'\nimport {useShopActions} from '../../internal/useShopActions'\nimport {\n NavigateToCheckoutParams,\n NavigateToOrderParams,\n NavigateToProductParams,\n NavigateToShopParams,\n} from '../../types'\n\ninterface UseShopNavigationReturns {\n /**\n * Navigates to a product.\n */\n navigateToProduct: (params: NavigateToProductParams) => Promise<void>\n /**\n * Navigates to a shop.\n */\n navigateToShop: (params: NavigateToShopParams) => Promise<void>\n /**\n * Navigates to an order.\n */\n navigateToOrder: (params: NavigateToOrderParams) => Promise<void>\n\n navigateToCheckout: (params: NavigateToCheckoutParams) => Promise<void>\n}\n\nexport const useShopNavigation = (): UseShopNavigationReturns => {\n const {\n navigateToProduct,\n navigateToShop,\n navigateToOrder,\n navigateToCheckout,\n } = useShopActions()\n\n return {\n navigateToProduct: useHandleAction(navigateToProduct),\n navigateToShop: useHandleAction(navigateToShop),\n navigateToOrder: useHandleAction(navigateToOrder),\n navigateToCheckout: useHandleAction(navigateToCheckout),\n }\n}\n"],"names":["useShopNavigation","navigateToProduct","navigateToShop","navigateToOrder","navigateToCheckout","useShopActions","useHandleAction"],"mappings":";;AA0BO,MAAMA,IAAoB,MAAgC;AACzD,QAAA;AAAA,IACJ,mBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,oBAAAC;AAAA,MACEC,EAAe;AAEZ,SAAA;AAAA,IACL,mBAAmBC,EAAgBL,CAAiB;AAAA,IACpD,gBAAgBK,EAAgBJ,CAAc;AAAA,IAC9C,iBAAiBI,EAAgBH,CAAe;AAAA,IAChD,oBAAoBG,EAAgBF,CAAkB;AAAA,EACxD;AACF;"}
@@ -0,0 +1,20 @@
1
+ import { useShopActions as a } from "../../internal/useShopActions.js";
2
+ import { useShopActionsPaginatedDataFetching as p } from "../../internal/useShopActionsPaginatedDataFetching.js";
3
+ const i = (o) => {
4
+ const { getPopularProducts: t } = a(), { skip: s, ...r } = o ?? {}, { data: c, ...u } = p(
5
+ t,
6
+ r,
7
+ {
8
+ skip: s,
9
+ hook: "usePopularProducts"
10
+ }
11
+ );
12
+ return {
13
+ ...u,
14
+ products: c
15
+ };
16
+ };
17
+ export {
18
+ i as usePopularProducts
19
+ };
20
+ //# sourceMappingURL=usePopularProducts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePopularProducts.js","sources":["../../../src/hooks/product/usePopularProducts.ts"],"sourcesContent":["import {useShopActions} from '../../internal/useShopActions'\nimport {useShopActionsPaginatedDataFetching} from '../../internal/useShopActionsPaginatedDataFetching'\nimport {\n Product,\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n} from '../../types'\n\ninterface UsePopularProductsParams extends PaginatedDataHookOptionsBase {}\n\ninterface UsePopularProductsReturns extends PaginatedDataHookReturnsBase {\n products: Product[] | null\n}\n\n/**\n * @param options - The options for the query\n */\nexport const usePopularProducts = (\n params?: UsePopularProductsParams\n): UsePopularProductsReturns => {\n const {getPopularProducts} = useShopActions()\n const {skip, ...shopActionParams} = params ?? {}\n\n const {data, ...rest} = useShopActionsPaginatedDataFetching(\n getPopularProducts,\n shopActionParams,\n {\n skip,\n hook: 'usePopularProducts',\n }\n )\n\n return {\n ...rest,\n products: data,\n }\n}\n"],"names":["usePopularProducts","params","getPopularProducts","useShopActions","skip","shopActionParams","data","rest","useShopActionsPaginatedDataFetching"],"mappings":";;AAiBa,MAAAA,IAAqB,CAChCC,MAC8B;AACxB,QAAA,EAAC,oBAAAC,EAAkB,IAAIC,EAAe,GACtC,EAAC,MAAAC,GAAM,GAAGC,EAAgB,IAAIJ,KAAU,CAAC,GAEzC,EAAC,MAAAK,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtBN;AAAA,IACAG;AAAA,IACA;AAAA,MACE,MAAAD;AAAA,MACA,MAAM;AAAA,IAAA;AAAA,EAEV;AAEO,SAAA;AAAA,IACL,GAAGG;AAAA,IACH,UAAUD;AAAA,EACZ;AACF;"}
@@ -0,0 +1,29 @@
1
+ import { useCallback as e } from "react";
2
+ import { useShopActions as a } from "../../internal/useShopActions.js";
3
+ import { useShopActionsPaginatedDataFetching as d } from "../../internal/useShopActionsPaginatedDataFetching.js";
4
+ import { MiniEntityNotFoundError as m } from "../../utils/errors.js";
5
+ const l = (t) => {
6
+ const { getProductList: o } = a(), { skip: s, ...r } = t ?? {}, i = e((u) => {
7
+ if (u === null)
8
+ throw new m({
9
+ hook: "useProductList",
10
+ message: "Product list not found"
11
+ });
12
+ }, []), { data: n, ...c } = d(
13
+ o,
14
+ r,
15
+ {
16
+ skip: s,
17
+ hook: "useProductList",
18
+ validator: i
19
+ }
20
+ );
21
+ return {
22
+ ...c,
23
+ productList: n
24
+ };
25
+ };
26
+ export {
27
+ l as useProductList
28
+ };
29
+ //# sourceMappingURL=useProductList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useProductList.js","sources":["../../../src/hooks/product/useProductList.ts"],"sourcesContent":["import {useCallback} from 'react'\n\nimport {useShopActions} from '../../internal/useShopActions'\nimport {useShopActionsPaginatedDataFetching} from '../../internal/useShopActionsPaginatedDataFetching'\nimport {\n ProductList,\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n} from '../../types'\nimport {MiniEntityNotFoundError} from '../../utils/errors'\n\ninterface UseProductListParams extends PaginatedDataHookOptionsBase {\n /**\n * The GID of the product list. E.g. `gid://shopapp/ProductList/123`.\n */\n id?: string\n /**\n * The public ID of the product list.\n */\n publicId?: string\n}\n\ninterface UseProductListResult extends PaginatedDataHookReturnsBase {\n productList: ProductList | null\n}\n\nexport const useProductList = (\n params?: UseProductListParams\n): UseProductListResult => {\n const {getProductList} = useShopActions()\n const {skip, ...shopActionParams} = params ?? {}\n\n const validator = useCallback((data: ProductList | null) => {\n if (data === null) {\n throw new MiniEntityNotFoundError({\n hook: 'useProductList',\n message: 'Product list not found',\n })\n }\n }, [])\n\n const {data, ...rest} = useShopActionsPaginatedDataFetching(\n getProductList,\n shopActionParams,\n {\n skip,\n hook: 'useProductList',\n validator,\n }\n )\n\n return {\n ...rest,\n productList: data,\n }\n}\n"],"names":["useProductList","params","getProductList","useShopActions","skip","shopActionParams","validator","useCallback","data","MiniEntityNotFoundError","rest","useShopActionsPaginatedDataFetching"],"mappings":";;;;AA0Ba,MAAAA,IAAiB,CAC5BC,MACyB;AACnB,QAAA,EAAC,gBAAAC,EAAc,IAAIC,EAAe,GAClC,EAAC,MAAAC,GAAM,GAAGC,EAAgB,IAAIJ,KAAU,CAAC,GAEzCK,IAAYC,EAAY,CAACC,MAA6B;AAC1D,QAAIA,MAAS;AACX,YAAM,IAAIC,EAAwB;AAAA,QAChC,MAAM;AAAA,QACN,SAAS;AAAA,MAAA,CACV;AAAA,EAEL,GAAG,EAAE,GAEC,EAAC,MAAAD,GAAM,GAAGE,EAAA,IAAQC;AAAA,IACtBT;AAAA,IACAG;AAAA,IACA;AAAA,MACE,MAAAD;AAAA,MACA,MAAM;AAAA,MACN,WAAAE;AAAA,IAAA;AAAA,EAEJ;AAEO,SAAA;AAAA,IACL,GAAGI;AAAA,IACH,aAAaF;AAAA,EACf;AACF;"}
@@ -0,0 +1,22 @@
1
+ import { useHandleAction as t } from "../../internal/useHandleAction.js";
2
+ import { useShopActions as c } from "../../internal/useShopActions.js";
3
+ const m = () => {
4
+ const {
5
+ addProductList: o,
6
+ removeProductList: r,
7
+ renameProductList: e,
8
+ addProductListItem: d,
9
+ removeProductListItem: s
10
+ } = c();
11
+ return {
12
+ addProductList: t(o),
13
+ removeProductList: t(r),
14
+ renameProductList: t(e),
15
+ addProductListItem: t(d),
16
+ removeProductListItem: t(s)
17
+ };
18
+ };
19
+ export {
20
+ m as useProductListActions
21
+ };
22
+ //# sourceMappingURL=useProductListActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useProductListActions.js","sources":["../../../src/hooks/product/useProductListActions.ts"],"sourcesContent":["import {useHandleAction} from '../../internal/useHandleAction'\nimport {useShopActions} from '../../internal/useShopActions'\nimport {\n AddProductListParams,\n RemoveProductListParams,\n RenameProductListParams,\n AddProductListItemParams,\n RemoveProductListItemParams,\n ProductList,\n} from '../../types'\n\ninterface UseProductListActionsReturns {\n /**\n * Add a product list\n */\n addProductList: (params: AddProductListParams) => Promise<ProductList>\n /**\n * Remove a product list\n */\n removeProductList: (params: RemoveProductListParams) => Promise<void>\n /**\n * Rename a product list\n */\n renameProductList: (params: RenameProductListParams) => Promise<ProductList>\n /**\n * Add a product to a product list\n */\n addProductListItem: (params: AddProductListItemParams) => Promise<void>\n /**\n * Remove a product from a product list\n */\n removeProductListItem: (params: RemoveProductListItemParams) => Promise<void>\n}\n\nexport const useProductListActions = (): UseProductListActionsReturns => {\n const {\n addProductList,\n removeProductList,\n renameProductList,\n addProductListItem,\n removeProductListItem,\n } = useShopActions()\n\n return {\n addProductList: useHandleAction(addProductList),\n removeProductList: useHandleAction(removeProductList),\n renameProductList: useHandleAction(renameProductList),\n addProductListItem: useHandleAction(addProductListItem),\n removeProductListItem: useHandleAction(removeProductListItem),\n }\n}\n"],"names":["useProductListActions","addProductList","removeProductList","renameProductList","addProductListItem","removeProductListItem","useShopActions","useHandleAction"],"mappings":";;AAkCO,MAAMA,IAAwB,MAAoC;AACjE,QAAA;AAAA,IACJ,gBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,uBAAAC;AAAA,MACEC,EAAe;AAEZ,SAAA;AAAA,IACL,gBAAgBC,EAAgBN,CAAc;AAAA,IAC9C,mBAAmBM,EAAgBL,CAAiB;AAAA,IACpD,mBAAmBK,EAAgBJ,CAAiB;AAAA,IACpD,oBAAoBI,EAAgBH,CAAkB;AAAA,IACtD,uBAAuBG,EAAgBF,CAAqB;AAAA,EAC9D;AACF;"}
@@ -0,0 +1,20 @@
1
+ import { useShopActions as e } from "../../internal/useShopActions.js";
2
+ import { useShopActionsPaginatedDataFetching as n } from "../../internal/useShopActionsPaginatedDataFetching.js";
3
+ const p = (t) => {
4
+ const { getProductLists: s } = e(), { skip: o, ...r } = t ?? {}, { data: c, ...i } = n(
5
+ s,
6
+ r,
7
+ {
8
+ skip: o,
9
+ hook: "useProductLists"
10
+ }
11
+ );
12
+ return {
13
+ ...i,
14
+ productLists: c
15
+ };
16
+ };
17
+ export {
18
+ p as useProductLists
19
+ };
20
+ //# sourceMappingURL=useProductLists.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useProductLists.js","sources":["../../../src/hooks/product/useProductLists.ts"],"sourcesContent":["import {useShopActions} from '../../internal/useShopActions'\nimport {useShopActionsPaginatedDataFetching} from '../../internal/useShopActionsPaginatedDataFetching'\nimport {\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n ProductList,\n} from '../../types'\n\ninterface UseProductListsParams extends PaginatedDataHookOptionsBase {\n /**\n * The number of products to fetch per product list.\n */\n itemsFirst?: number\n}\n\ninterface UseProductListsResult extends PaginatedDataHookReturnsBase {\n productLists: ProductList[] | null\n}\n\nexport const useProductLists = (\n params?: UseProductListsParams\n): UseProductListsResult => {\n const {getProductLists} = useShopActions()\n const {skip, ...shopActionParams} = params ?? {}\n\n const {data, ...rest} = useShopActionsPaginatedDataFetching(\n getProductLists,\n shopActionParams,\n {\n skip,\n hook: 'useProductLists',\n }\n )\n\n return {\n ...rest,\n productLists: data,\n }\n}\n"],"names":["useProductLists","params","getProductLists","useShopActions","skip","shopActionParams","data","rest","useShopActionsPaginatedDataFetching"],"mappings":";;AAmBa,MAAAA,IAAkB,CAC7BC,MAC0B;AACpB,QAAA,EAAC,iBAAAC,EAAe,IAAIC,EAAe,GACnC,EAAC,MAAAC,GAAM,GAAGC,EAAgB,IAAIJ,KAAU,CAAC,GAEzC,EAAC,MAAAK,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtBN;AAAA,IACAG;AAAA,IACA;AAAA,MACE,MAAAD;AAAA,MACA,MAAM;AAAA,IAAA;AAAA,EAEV;AAEO,SAAA;AAAA,IACL,GAAGG;AAAA,IACH,cAAcD;AAAA,EAChB;AACF;"}
@@ -0,0 +1,20 @@
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
+ }
11
+ );
12
+ return {
13
+ ...n,
14
+ products: c
15
+ };
16
+ };
17
+ export {
18
+ a as useRecommendedProducts
19
+ };
20
+ //# sourceMappingURL=useRecommendedProducts.js.map
@@ -0,0 +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;"}
@@ -0,0 +1,21 @@
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(
6
+ 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]);
13
+ return {
14
+ ...m,
15
+ shops: a
16
+ };
17
+ };
18
+ export {
19
+ f as useRecommendedShops
20
+ };
21
+ //# sourceMappingURL=useRecommendedShops.js.map
@@ -0,0 +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;"}
@@ -0,0 +1,13 @@
1
+ import { useHandleAction as o } from "../../internal/useHandleAction.js";
2
+ import { useShopActions as u } from "../../internal/useShopActions.js";
3
+ const n = () => {
4
+ const { addToCart: t, buyProduct: r } = u();
5
+ return {
6
+ addToCart: o(t),
7
+ buyProduct: o(r)
8
+ };
9
+ };
10
+ export {
11
+ n as useShopCartActions
12
+ };
13
+ //# sourceMappingURL=useShopCartActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useShopCartActions.js","sources":["../../../src/hooks/shop/useShopCartActions.ts"],"sourcesContent":["import {useHandleAction} from '../../internal/useHandleAction'\nimport {useShopActions} from '../../internal/useShopActions'\nimport {AddToCartParams, BuyProductParams} from '../../types'\n\ninterface UseShopCartActionsReturns {\n /**\n * Add a product to the cart\n */\n addToCart: (params: AddToCartParams) => Promise<void>\n /**\n * Buy a product directly\n */\n buyProduct: (params: BuyProductParams) => Promise<void>\n}\n\nexport const useShopCartActions = (): UseShopCartActionsReturns => {\n const {addToCart, buyProduct} = useShopActions()\n\n return {\n addToCart: useHandleAction(addToCart),\n buyProduct: useHandleAction(buyProduct),\n }\n}\n"],"names":["useShopCartActions","addToCart","buyProduct","useShopActions","useHandleAction"],"mappings":";;AAeO,MAAMA,IAAqB,MAAiC;AACjE,QAAM,EAAC,WAAAC,GAAW,YAAAC,EAAU,IAAIC,EAAe;AAExC,SAAA;AAAA,IACL,WAAWC,EAAgBH,CAAS;AAAA,IACpC,YAAYG,EAAgBF,CAAU;AAAA,EACxC;AACF;"}
@@ -0,0 +1,22 @@
1
+ import { useHandleAction as e } from "../../internal/useHandleAction.js";
2
+ import { useShopActions as i } from "../../internal/useShopActions.js";
3
+ function l() {
4
+ const {
5
+ getPersistedItem: t,
6
+ setPersistedItem: s,
7
+ removePersistedItem: r,
8
+ getAllPersistedKeys: m,
9
+ clearPersistedItems: o
10
+ } = i();
11
+ return {
12
+ getItem: e(t),
13
+ setItem: e(s),
14
+ removeItem: e(r),
15
+ getAllKeys: e(m),
16
+ clear: e(o)
17
+ };
18
+ }
19
+ export {
20
+ l as useAsyncStorage
21
+ };
22
+ //# sourceMappingURL=useAsyncStorage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAsyncStorage.js","sources":["../../../src/hooks/storage/useAsyncStorage.ts"],"sourcesContent":["import {useHandleAction} from '../../internal/useHandleAction'\nimport {useShopActions} from '../../internal/useShopActions'\nimport {\n GetAsyncStorageItemParams,\n SetAsyncStorageItemParams,\n RemoveAsyncStorageItemParams,\n} from '../../types'\n\ninterface UseAsyncStorageReturns {\n /**\n * Get an item from the async storage.\n */\n getItem: (params: GetAsyncStorageItemParams) => Promise<string | null>\n /**\n * Set an item in the async storage.\n */\n setItem: (params: SetAsyncStorageItemParams) => Promise<void>\n /**\n * Remove an item from the async storage.\n */\n removeItem: (params: RemoveAsyncStorageItemParams) => Promise<void>\n /**\n * Get all keys in the async storage.\n */\n getAllKeys: () => Promise<string[]>\n /**\n * Clear all items from the async storage.\n */\n clear: () => Promise<void>\n}\n\nexport function useAsyncStorage(): UseAsyncStorageReturns {\n const {\n getPersistedItem,\n setPersistedItem,\n removePersistedItem,\n getAllPersistedKeys,\n clearPersistedItems,\n } = useShopActions()\n\n return {\n getItem: useHandleAction(getPersistedItem),\n setItem: useHandleAction(setPersistedItem),\n removeItem: useHandleAction(removePersistedItem),\n getAllKeys: useHandleAction(getAllPersistedKeys),\n clear: useHandleAction(clearPersistedItems),\n }\n}\n"],"names":["useAsyncStorage","getPersistedItem","setPersistedItem","removePersistedItem","getAllPersistedKeys","clearPersistedItems","useShopActions","useHandleAction"],"mappings":";;AA+BO,SAASA,IAA0C;AAClD,QAAA;AAAA,IACJ,kBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,qBAAAC;AAAA,MACEC,EAAe;AAEZ,SAAA;AAAA,IACL,SAASC,EAAgBN,CAAgB;AAAA,IACzC,SAASM,EAAgBL,CAAgB;AAAA,IACzC,YAAYK,EAAgBJ,CAAmB;AAAA,IAC/C,YAAYI,EAAgBH,CAAmB;AAAA,IAC/C,OAAOG,EAAgBF,CAAmB;AAAA,EAC5C;AACF;"}
@@ -0,0 +1,62 @@
1
+ import { useCallback as p } from "react";
2
+ import { useShopActions as u } from "../../internal/useShopActions.js";
3
+ const m = async (t, a) => {
4
+ const i = new FormData();
5
+ a.parameters.forEach(({ name: r, value: l }) => {
6
+ i.append(r, l);
7
+ }), i.append("file", new Blob([t.uri], { type: t.mimeType }));
8
+ const o = await fetch(a.url, {
9
+ method: "POST",
10
+ body: i
11
+ });
12
+ return o.ok ? {} : (console.error("Failed to upload image", {
13
+ response: await o.text()
14
+ }), { error: "Failed to upload image" });
15
+ }, w = () => {
16
+ const { createImageUploadLink: t, completeImageUpload: a } = u();
17
+ return {
18
+ uploadImage: p(
19
+ async (o) => {
20
+ if (o.length > 1)
21
+ throw new Error("Multiple image upload is not supported yet");
22
+ const r = await t({
23
+ input: o.map((e) => ({
24
+ mimeType: e.mimeType,
25
+ fileSize: e.fileSize
26
+ }))
27
+ });
28
+ if (!r.ok)
29
+ throw new Error(r.error.message);
30
+ const { error: l } = await m(
31
+ o[0],
32
+ r?.data?.targets?.[0]
33
+ );
34
+ if (l)
35
+ throw new Error(l);
36
+ let n = 0;
37
+ for (; n < 30; ) {
38
+ const e = await a({
39
+ resourceUrls: r?.data?.targets?.map((s) => s.resourceUrl) || []
40
+ });
41
+ if (!e.ok)
42
+ throw new Error(e.error.message);
43
+ if (e.data?.files?.[0]?.fileStatus === "READY")
44
+ return [
45
+ {
46
+ id: e.data.files[0].id,
47
+ imageUrl: e.data.files[0].image?.url,
48
+ resourceUrl: r?.data?.targets?.[0]?.resourceUrl
49
+ }
50
+ ];
51
+ await new Promise((s) => setTimeout(s, 1e3)), n++;
52
+ }
53
+ throw new Error("Image upload completion timed out");
54
+ },
55
+ [t, a]
56
+ )
57
+ };
58
+ };
59
+ export {
60
+ w as useImageUpload
61
+ };
62
+ //# sourceMappingURL=useImageUpload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useImageUpload.js","sources":["../../../src/hooks/storage/useImageUpload.ts"],"sourcesContent":["import {useCallback} from 'react'\n\nimport {useShopActions} from '../../internal/useShopActions'\nimport {UploadTarget} from '../../types'\n\nexport interface UploadImageParams {\n /**\n * The MIME type of the image.\n */\n mimeType: string\n /**\n * The size of the image in bytes.\n */\n fileSize: number\n /**\n * The URI of the image to upload.\n */\n uri: string\n}\n\nexport interface UploadedImage {\n /**\n * The ID of the uploaded image.\n */\n id: string\n /**\n * The URL of the uploaded image.\n */\n imageUrl?: string\n /**\n * The resource URL of the uploaded image.\n */\n resourceUrl?: string\n}\n\ninterface UseImageUploadReturns {\n /**\n * Upload an image attached to the current user.\n */\n uploadImage: (params: UploadImageParams[]) => Promise<UploadedImage[]>\n}\n\nconst uploadFileToGCS = async (\n image: UploadImageParams,\n target: UploadTarget\n) => {\n const formData = new FormData()\n target.parameters.forEach(({name, value}) => {\n formData.append(name, value)\n })\n // Append the actual file data last\n formData.append('file', new Blob([image.uri], {type: image.mimeType}))\n\n const uploadResponse = await fetch(target.url, {\n method: 'POST',\n body: formData,\n })\n\n if (!uploadResponse.ok) {\n console.error('Failed to upload image', {\n response: await uploadResponse.text(),\n })\n return {error: 'Failed to upload image'}\n }\n\n return {}\n}\n\nexport const useImageUpload = (): UseImageUploadReturns => {\n const {createImageUploadLink, completeImageUpload} = useShopActions()\n\n const uploadImage = useCallback(\n async (params: UploadImageParams[]) => {\n if (params.length > 1) {\n throw new Error('Multiple image upload is not supported yet')\n }\n\n const links = await createImageUploadLink({\n input: params.map(image => ({\n mimeType: image.mimeType,\n fileSize: image.fileSize,\n })),\n })\n\n if (!links.ok) {\n throw new Error(links.error.message)\n }\n\n // Upload single file to GCS\n // TODO: Upload multiple files to GCS\n const {error: uploadError} = await uploadFileToGCS(\n params[0],\n links?.data?.targets?.[0]!\n )\n\n if (uploadError) {\n throw new Error(uploadError)\n }\n\n // 10 second polling for image upload\n let count = 0\n while (count < 30) {\n const result = await completeImageUpload({\n resourceUrls:\n links?.data?.targets?.map(target => target.resourceUrl) || [],\n })\n\n if (!result.ok) {\n throw new Error(result.error.message)\n }\n\n // TODO: Add support for multiple files\n if (result.data?.files?.[0]?.fileStatus === 'READY') {\n return [\n {\n id: result.data.files[0].id,\n imageUrl: result.data.files[0].image?.url,\n resourceUrl: links?.data?.targets?.[0]?.resourceUrl,\n },\n ]\n }\n\n await new Promise(resolve => setTimeout(resolve, 1000))\n count++\n }\n\n throw new Error('Image upload completion timed out')\n },\n [createImageUploadLink, completeImageUpload]\n )\n\n return {\n uploadImage,\n }\n}\n"],"names":["uploadFileToGCS","image","target","formData","name","value","uploadResponse","useImageUpload","createImageUploadLink","completeImageUpload","useShopActions","useCallback","params","links","uploadError","count","result","resolve"],"mappings":";;AA0CA,MAAMA,IAAkB,OACtBC,GACAC,MACG;AACG,QAAAC,IAAW,IAAI,SAAS;AAC9B,EAAAD,EAAO,WAAW,QAAQ,CAAC,EAAC,MAAAE,GAAM,OAAAC,QAAW;AAClC,IAAAF,EAAA,OAAOC,GAAMC,CAAK;AAAA,EAAA,CAC5B,GAEDF,EAAS,OAAO,QAAQ,IAAI,KAAK,CAACF,EAAM,GAAG,GAAG,EAAC,MAAMA,EAAM,SAAS,CAAA,CAAC;AAErE,QAAMK,IAAiB,MAAM,MAAMJ,EAAO,KAAK;AAAA,IAC7C,QAAQ;AAAA,IACR,MAAMC;AAAA,EAAA,CACP;AAEG,SAACG,EAAe,KAOb,CAAC,KANN,QAAQ,MAAM,0BAA0B;AAAA,IACtC,UAAU,MAAMA,EAAe,KAAK;AAAA,EAAA,CACrC,GACM,EAAC,OAAO,yBAAwB;AAI3C,GAEaC,IAAiB,MAA6B;AACzD,QAAM,EAAC,uBAAAC,GAAuB,qBAAAC,EAAmB,IAAIC,EAAe;AA8D7D,SAAA;AAAA,IACL,aA7DkBC;AAAA,MAClB,OAAOC,MAAgC;AACjC,YAAAA,EAAO,SAAS;AACZ,gBAAA,IAAI,MAAM,4CAA4C;AAGxD,cAAAC,IAAQ,MAAML,EAAsB;AAAA,UACxC,OAAOI,EAAO,IAAI,CAAUX,OAAA;AAAA,YAC1B,UAAUA,EAAM;AAAA,YAChB,UAAUA,EAAM;AAAA,UAAA,EAChB;AAAA,QAAA,CACH;AAEG,YAAA,CAACY,EAAM;AACT,gBAAM,IAAI,MAAMA,EAAM,MAAM,OAAO;AAKrC,cAAM,EAAC,OAAOC,EAAW,IAAI,MAAMd;AAAA,UACjCY,EAAO,CAAC;AAAA,UACRC,GAAO,MAAM,UAAU,CAAC;AAAA,QAC1B;AAEA,YAAIC;AACI,gBAAA,IAAI,MAAMA,CAAW;AAI7B,YAAIC,IAAQ;AACZ,eAAOA,IAAQ,MAAI;AACX,gBAAAC,IAAS,MAAMP,EAAoB;AAAA,YACvC,cACEI,GAAO,MAAM,SAAS,IAAI,CAAUX,MAAAA,EAAO,WAAW,KAAK,CAAA;AAAA,UAAC,CAC/D;AAEG,cAAA,CAACc,EAAO;AACV,kBAAM,IAAI,MAAMA,EAAO,MAAM,OAAO;AAItC,cAAIA,EAAO,MAAM,QAAQ,CAAC,GAAG,eAAe;AACnC,mBAAA;AAAA,cACL;AAAA,gBACE,IAAIA,EAAO,KAAK,MAAM,CAAC,EAAE;AAAA,gBACzB,UAAUA,EAAO,KAAK,MAAM,CAAC,EAAE,OAAO;AAAA,gBACtC,aAAaH,GAAO,MAAM,UAAU,CAAC,GAAG;AAAA,cAAA;AAAA,YAE5C;AAGF,gBAAM,IAAI,QAAQ,CAAAI,MAAW,WAAWA,GAAS,GAAI,CAAC,GACtDF;AAAA,QAAA;AAGI,cAAA,IAAI,MAAM,mCAAmC;AAAA,MACrD;AAAA,MACA,CAACP,GAAuBC,CAAmB;AAAA,IAC7C;AAAA,EAIA;AACF;"}
@@ -0,0 +1,14 @@
1
+ import { useHandleAction as e } from "../../internal/useHandleAction.js";
2
+ import { useShopActions as c } from "../../internal/useShopActions.js";
3
+ function s() {
4
+ const { getSecret: t, setSecret: r, removeSecret: o } = c();
5
+ return {
6
+ getSecret: e(t),
7
+ setSecret: e(r),
8
+ removeSecret: e(o)
9
+ };
10
+ }
11
+ export {
12
+ s as useSecureStorage
13
+ };
14
+ //# sourceMappingURL=useSecureStorage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSecureStorage.js","sources":["../../../src/hooks/storage/useSecureStorage.ts"],"sourcesContent":["import {useHandleAction} from '../../internal/useHandleAction'\nimport {useShopActions} from '../../internal/useShopActions'\nimport {SetSecretParams} from '../../types'\n\ninterface UseSecureStorageReturns {\n /**\n * Get the secret from the secure storage.\n */\n getSecret: () => Promise<string | null>\n /**\n * Set a secret in the secure storage.\n */\n setSecret: (params: SetSecretParams) => Promise<void>\n /**\n * Remove the secret from the secure storage.\n */\n removeSecret: () => Promise<void>\n}\n\nexport function useSecureStorage(): UseSecureStorageReturns {\n const {getSecret, setSecret, removeSecret} = useShopActions()\n\n return {\n getSecret: useHandleAction(getSecret),\n setSecret: useHandleAction(setSecret),\n removeSecret: useHandleAction(removeSecret),\n }\n}\n"],"names":["useSecureStorage","getSecret","setSecret","removeSecret","useShopActions","useHandleAction"],"mappings":";;AAmBO,SAASA,IAA4C;AAC1D,QAAM,EAAC,WAAAC,GAAW,WAAAC,GAAW,cAAAC,EAAA,IAAgBC,EAAe;AAErD,SAAA;AAAA,IACL,WAAWC,EAAgBJ,CAAS;AAAA,IACpC,WAAWI,EAAgBH,CAAS;AAAA,IACpC,cAAcG,EAAgBF,CAAY;AAAA,EAC5C;AACF;"}
@@ -0,0 +1,20 @@
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
+ }
11
+ );
12
+ return {
13
+ ...u,
14
+ buyerAttributes: r
15
+ };
16
+ };
17
+ export {
18
+ A as useBuyerAttributes
19
+ };
20
+ //# sourceMappingURL=useBuyerAttributes.js.map
@@ -0,0 +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;"}
@@ -0,0 +1,20 @@
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,
6
+ s,
7
+ {
8
+ skip: t,
9
+ hook: "useCurrentUser"
10
+ }
11
+ );
12
+ return {
13
+ ...n,
14
+ currentUser: o
15
+ };
16
+ };
17
+ export {
18
+ a as useCurrentUser
19
+ };
20
+ //# sourceMappingURL=useCurrentUser.js.map
@@ -0,0 +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 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":";;AAiBa,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;"}
@@ -0,0 +1,13 @@
1
+ import { useHandleAction as o } from "../../internal/useHandleAction.js";
2
+ import { useShopActions as p } from "../../internal/useShopActions.js";
3
+ const e = () => {
4
+ const { followShop: l, unfollowShop: n } = p();
5
+ return {
6
+ followShop: o(l),
7
+ unfollowShop: o(n)
8
+ };
9
+ };
10
+ export {
11
+ e as useFollowedShopsActions
12
+ };
13
+ //# sourceMappingURL=useFollowedShopsActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFollowedShopsActions.js","sources":["../../../src/hooks/user/useFollowedShopsActions.ts"],"sourcesContent":["import {useHandleAction} from '../../internal/useHandleAction'\nimport {useShopActions} from '../../internal/useShopActions'\nimport {FollowShopParams, UnfollowShopParams} from '../../types'\n\ninterface UseFollowedShopsActionsReturns {\n /**\n * Follow a shop.\n */\n followShop: (params: FollowShopParams) => Promise<boolean>\n /**\n * Unfollow a shop.\n */\n unfollowShop: (params: UnfollowShopParams) => Promise<boolean>\n}\n\nexport const useFollowedShopsActions = (): UseFollowedShopsActionsReturns => {\n const {followShop, unfollowShop} = useShopActions()\n\n return {\n followShop: useHandleAction(followShop),\n unfollowShop: useHandleAction(unfollowShop),\n }\n}\n"],"names":["useFollowedShopsActions","followShop","unfollowShop","useShopActions","useHandleAction"],"mappings":";;AAeO,MAAMA,IAA0B,MAAsC;AAC3E,QAAM,EAAC,YAAAC,GAAY,cAAAC,EAAY,IAAIC,EAAe;AAE3C,SAAA;AAAA,IACL,YAAYC,EAAgBH,CAAU;AAAA,IACtC,cAAcG,EAAgBF,CAAY;AAAA,EAC5C;AACF;"}
@@ -0,0 +1,20 @@
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(
5
+ t,
6
+ r,
7
+ {
8
+ skip: s,
9
+ hook: "useOrders"
10
+ }
11
+ );
12
+ return {
13
+ ...n,
14
+ orders: e
15
+ };
16
+ };
17
+ export {
18
+ d as useOrders
19
+ };
20
+ //# sourceMappingURL=useOrders.js.map
@@ -0,0 +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;"}
@@ -0,0 +1,13 @@
1
+ import { useHandleAction as o } from "../../internal/useHandleAction.js";
2
+ import { useShopActions as e } from "../../internal/useShopActions.js";
3
+ const u = () => {
4
+ const { favorite: t, unfavorite: r } = e();
5
+ return {
6
+ saveProduct: o(t),
7
+ unsaveProduct: o(r)
8
+ };
9
+ };
10
+ export {
11
+ u as useSavedProductsActions
12
+ };
13
+ //# sourceMappingURL=useSavedProductsActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSavedProductsActions.js","sources":["../../../src/hooks/user/useSavedProductsActions.ts"],"sourcesContent":["import {useHandleAction} from '../../internal/useHandleAction'\nimport {useShopActions} from '../../internal/useShopActions'\nimport {FavoriteParams, UnfavoriteParams} from '../../types'\n\ninterface UseSavedProductsActionsReturns {\n /**\n * Save a product.\n */\n saveProduct: (params: FavoriteParams) => Promise<void>\n /**\n * Unsave a product.\n */\n unsaveProduct: (params: UnfavoriteParams) => Promise<void>\n}\n\nexport const useSavedProductsActions = (): UseSavedProductsActionsReturns => {\n const {favorite, unfavorite} = useShopActions()\n\n return {\n saveProduct: useHandleAction(favorite),\n unsaveProduct: useHandleAction(unfavorite),\n }\n}\n"],"names":["useSavedProductsActions","favorite","unfavorite","useShopActions","useHandleAction"],"mappings":";;AAeO,MAAMA,IAA0B,MAAsC;AAC3E,QAAM,EAAC,UAAAC,GAAU,YAAAC,EAAU,IAAIC,EAAe;AAEvC,SAAA;AAAA,IACL,aAAaC,EAAgBH,CAAQ;AAAA,IACrC,eAAeG,EAAgBF,CAAU;AAAA,EAC3C;AACF;"}
@@ -0,0 +1,9 @@
1
+ import { useShopActions as o } from "../../internal/useShopActions.js";
2
+ const n = () => {
3
+ const { showErrorScreen: r } = o();
4
+ return { showErrorScreen: r };
5
+ };
6
+ export {
7
+ n as useErrorScreen
8
+ };
9
+ //# sourceMappingURL=useErrorScreen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useErrorScreen.js","sources":["../../../src/hooks/util/useErrorScreen.ts"],"sourcesContent":["import {useShopActions} from '../../internal/useShopActions'\nimport {ShopActions} from '../../types'\n\ninterface UseErrorScreenReturns {\n /**\n * Show an error screen with the given error message.\n */\n showErrorScreen: ShopActions['showErrorScreen']\n}\n\nexport const useErrorScreen = (): UseErrorScreenReturns => {\n const {showErrorScreen} = useShopActions()\n\n return {showErrorScreen}\n}\n"],"names":["useErrorScreen","showErrorScreen","useShopActions"],"mappings":";AAUO,MAAMA,IAAiB,MAA6B;AACnD,QAAA,EAAC,iBAAAC,EAAe,IAAIC,EAAe;AAEzC,SAAO,EAAC,iBAAAD,EAAe;AACzB;"}
@@ -0,0 +1,9 @@
1
+ import { useShopActions as r } from "../../internal/useShopActions.js";
2
+ const t = () => {
3
+ const { showErrorToast: o } = r();
4
+ return { showErrorToast: o };
5
+ };
6
+ export {
7
+ t as useErrorToast
8
+ };
9
+ //# sourceMappingURL=useErrorToast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useErrorToast.js","sources":["../../../src/hooks/util/useErrorToast.ts"],"sourcesContent":["import {useShopActions} from '../../internal/useShopActions'\nimport {ShopActions} from '../../types'\n\ninterface UseErrorToastReturns {\n /**\n * Show an error toast with the given error message.\n */\n showErrorToast: ShopActions['showErrorToast']\n}\n\nexport const useErrorToast = (): UseErrorToastReturns => {\n const {showErrorToast} = useShopActions()\n\n return {showErrorToast}\n}\n"],"names":["useErrorToast","showErrorToast","useShopActions"],"mappings":";AAUO,MAAMA,IAAgB,MAA4B;AACjD,QAAA,EAAC,gBAAAC,EAAc,IAAIC,EAAe;AAExC,SAAO,EAAC,gBAAAD,EAAc;AACxB;"}
package/dist/index.js ADDED
@@ -0,0 +1,78 @@
1
+ import { Button as e, buttonVariants as t } from "./components/ui/button.js";
2
+ import { Card as i, CardAction as a, CardContent as p, CardDescription as u, CardFooter as n, CardHeader as l, CardTitle as m } from "./components/ui/card.js";
3
+ import { AlertDialog as d, AlertDialogAction as x, AlertDialogCancel as c, AlertDialogContent as A, AlertDialogDescription as g, AlertDialogFooter as C, AlertDialogHeader as D, AlertDialogOverlay as S, AlertDialogPortal as P, AlertDialogTitle as E, AlertDialogTrigger as y } from "./components/ui/alert-dialog.js";
4
+ import { Toaster as h } from "./components/ui/sonner.js";
5
+ import { useSavedProductsActions as M } from "./hooks/user/useSavedProductsActions.js";
6
+ import { useFollowedShopsActions as L } from "./hooks/user/useFollowedShopsActions.js";
7
+ import { useCurrentUser as U } from "./hooks/user/useCurrentUser.js";
8
+ import { useOrders as w } from "./hooks/user/useOrders.js";
9
+ import { useBuyerAttributes as H } from "./hooks/user/useBuyerAttributes.js";
10
+ import { useProductListActions as R } from "./hooks/product/useProductListActions.js";
11
+ import { useProductLists as G } from "./hooks/product/useProductLists.js";
12
+ import { useProductList as V } from "./hooks/product/useProductList.js";
13
+ import { useRecommendedProducts as q } from "./hooks/product/useRecommendedProducts.js";
14
+ import { usePopularProducts as J } from "./hooks/product/usePopularProducts.js";
15
+ import { useAsyncStorage as Q } from "./hooks/storage/useAsyncStorage.js";
16
+ import { useSecureStorage as X } from "./hooks/storage/useSecureStorage.js";
17
+ import { useImageUpload as Z } from "./hooks/storage/useImageUpload.js";
18
+ import { useShopNavigation as $ } from "./hooks/navigation/useShopNavigation.js";
19
+ import { useCloseMini as or } from "./hooks/navigation/useCloseMini.js";
20
+ import { useShopCartActions as tr } from "./hooks/shop/useShopCartActions.js";
21
+ import { useRecommendedShops as ir } from "./hooks/shop/useRecommendedShops.js";
22
+ import { useErrorToast as pr } from "./hooks/util/useErrorToast.js";
23
+ import { useErrorScreen as nr } from "./hooks/util/useErrorScreen.js";
24
+ import { MiniEntityNotFoundError as mr, MiniError as fr, MiniNetworkError as dr, formatError as xr } from "./utils/errors.js";
25
+ import { parseUrl as Ar } from "./utils/parseUrl.js";
26
+ import { Consent as Cr, ConsentStatus as Dr, CurrencyCode as Sr, Gender as Pr } from "./types/minisSDK.generated.d.js";
27
+ export {
28
+ d as AlertDialog,
29
+ x as AlertDialogAction,
30
+ c as AlertDialogCancel,
31
+ A as AlertDialogContent,
32
+ g as AlertDialogDescription,
33
+ C as AlertDialogFooter,
34
+ D as AlertDialogHeader,
35
+ S as AlertDialogOverlay,
36
+ P as AlertDialogPortal,
37
+ E as AlertDialogTitle,
38
+ y as AlertDialogTrigger,
39
+ e as Button,
40
+ i as Card,
41
+ a as CardAction,
42
+ p as CardContent,
43
+ u as CardDescription,
44
+ n as CardFooter,
45
+ l as CardHeader,
46
+ m as CardTitle,
47
+ Cr as Consent,
48
+ Dr as ConsentStatus,
49
+ Sr as CurrencyCode,
50
+ Pr as Gender,
51
+ mr as MiniEntityNotFoundError,
52
+ fr as MiniError,
53
+ dr as MiniNetworkError,
54
+ h as Toaster,
55
+ t as buttonVariants,
56
+ xr as formatError,
57
+ Ar as parseUrl,
58
+ Q as useAsyncStorage,
59
+ H as useBuyerAttributes,
60
+ or as useCloseMini,
61
+ U as useCurrentUser,
62
+ nr as useErrorScreen,
63
+ pr as useErrorToast,
64
+ L as useFollowedShopsActions,
65
+ Z as useImageUpload,
66
+ w as useOrders,
67
+ J as usePopularProducts,
68
+ V as useProductList,
69
+ R as useProductListActions,
70
+ G as useProductLists,
71
+ q as useRecommendedProducts,
72
+ ir as useRecommendedShops,
73
+ M as useSavedProductsActions,
74
+ X as useSecureStorage,
75
+ tr as useShopCartActions,
76
+ $ as useShopNavigation
77
+ };
78
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,13 @@
1
+ import { useCallback as t } from "react";
2
+ const a = (e) => t(
3
+ (...o) => e(...o).then((r) => {
4
+ if (r.ok)
5
+ return r.data;
6
+ throw r.error;
7
+ }),
8
+ [e]
9
+ );
10
+ export {
11
+ a as useHandleAction
12
+ };
13
+ //# sourceMappingURL=useHandleAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useHandleAction.js","sources":["../../src/internal/useHandleAction.ts"],"sourcesContent":["import {useCallback} from 'react'\n\nimport {ShopActionResult} from '../types'\n\n// Wrapper to handle shop action results as regular promises (Reject on error)\nexport const useHandleAction = <T, Args extends unknown[]>(\n action: (...args: Args) => Promise<ShopActionResult<T>>\n) => {\n // TODO Add when report interaction is implemented for web\n // const reportInteraction = useReportInteraction()\n\n return useCallback(\n (...args: Args) => {\n return action(...args).then(result => {\n if (result.ok) {\n return result.data\n }\n\n throw result.error\n })\n },\n [action]\n )\n}\n"],"names":["useHandleAction","action","useCallback","args","result"],"mappings":";AAKa,MAAAA,IAAkB,CAC7BC,MAKOC;AAAA,EACL,IAAIC,MACKF,EAAO,GAAGE,CAAI,EAAE,KAAK,CAAUC,MAAA;AACpC,QAAIA,EAAO;AACT,aAAOA,EAAO;AAGhB,UAAMA,EAAO;AAAA,EAAA,CACd;AAAA,EAEH,CAACH,CAAM;AACT;"}
@@ -0,0 +1,7 @@
1
+ function n() {
2
+ return window.minisSDK;
3
+ }
4
+ export {
5
+ n as useShopActions
6
+ };
7
+ //# sourceMappingURL=useShopActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useShopActions.js","sources":["../../src/internal/useShopActions.ts"],"sourcesContent":["import {ShopActions} from '../types'\n\nexport function useShopActions(): ShopActions {\n return window.minisSDK\n}\n"],"names":["useShopActions"],"mappings":"AAEO,SAASA,IAA8B;AAC5C,SAAO,OAAO;AAChB;"}