@shopify/shop-minis-react 0.0.21 → 0.0.22

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 (210) hide show
  1. package/dist/_virtual/___vite-browser-external.js +7 -0
  2. package/dist/_virtual/___vite-browser-external.js.map +1 -0
  3. package/dist/_virtual/__vite-browser-external.js +5 -0
  4. package/dist/_virtual/__vite-browser-external.js.map +1 -0
  5. package/dist/_virtual/_commonjsHelpers.js +24 -4
  6. package/dist/_virtual/_commonjsHelpers.js.map +1 -1
  7. package/dist/_virtual/browser-index.js +8 -0
  8. package/dist/_virtual/browser-index.js.map +1 -0
  9. package/dist/_virtual/browser-index2.js +5 -0
  10. package/dist/_virtual/browser-index2.js.map +1 -0
  11. package/dist/_virtual/clock.js +6 -0
  12. package/dist/_virtual/clock.js.map +1 -0
  13. package/dist/_virtual/conventions.js +5 -0
  14. package/dist/_virtual/conventions.js.map +1 -0
  15. package/dist/_virtual/document.js +8 -0
  16. package/dist/_virtual/document.js.map +1 -0
  17. package/dist/_virtual/dom-parser.js +5 -0
  18. package/dist/_virtual/dom-parser.js.map +1 -0
  19. package/dist/_virtual/dom.js +5 -0
  20. package/dist/_virtual/dom.js.map +1 -0
  21. package/dist/_virtual/entities.js +5 -0
  22. package/dist/_virtual/entities.js.map +1 -0
  23. package/dist/_virtual/extends.js +5 -0
  24. package/dist/_virtual/extends.js.map +1 -0
  25. package/dist/_virtual/index10.js +5 -0
  26. package/dist/_virtual/index10.js.map +1 -0
  27. package/dist/_virtual/index11.js +5 -0
  28. package/dist/_virtual/index11.js.map +1 -0
  29. package/dist/_virtual/index2.js +5 -2
  30. package/dist/_virtual/index2.js.map +1 -1
  31. package/dist/_virtual/index3.js +5 -3
  32. package/dist/_virtual/index3.js.map +1 -1
  33. package/dist/_virtual/index5.js +6 -0
  34. package/dist/_virtual/index5.js.map +1 -0
  35. package/dist/_virtual/index6.js +6 -0
  36. package/dist/_virtual/index6.js.map +1 -0
  37. package/dist/_virtual/index7.js +5 -0
  38. package/dist/_virtual/index7.js.map +1 -0
  39. package/dist/_virtual/index8.js +5 -0
  40. package/dist/_virtual/index8.js.map +1 -0
  41. package/dist/_virtual/index9.js +5 -0
  42. package/dist/_virtual/index9.js.map +1 -0
  43. package/dist/_virtual/parse-sidx.js +8 -0
  44. package/dist/_virtual/parse-sidx.js.map +1 -0
  45. package/dist/_virtual/sax.js +5 -0
  46. package/dist/_virtual/sax.js.map +1 -0
  47. package/dist/_virtual/window.js +8 -0
  48. package/dist/_virtual/window.js.map +1 -0
  49. package/dist/components/atoms/video-player.js +121 -0
  50. package/dist/components/atoms/video-player.js.map +1 -0
  51. package/dist/components/commerce/merchant-card.js +236 -106
  52. package/dist/components/commerce/merchant-card.js.map +1 -1
  53. package/dist/index.js +199 -192
  54. package/dist/index.js.map +1 -1
  55. package/dist/mocks.js +114 -87
  56. package/dist/mocks.js.map +1 -1
  57. package/dist/shop-minis-react/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/extends.js +20 -0
  58. package/dist/shop-minis-react/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/extends.js.map +1 -0
  59. package/dist/shop-minis-react/node_modules/.pnpm/@radix-ui_react-use-is-hydrated@0.1.0_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +1 -1
  60. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/byte-helpers.js +79 -0
  61. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/byte-helpers.js.map +1 -0
  62. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/codecs.js +102 -0
  63. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/codecs.js.map +1 -0
  64. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/containers.js +149 -0
  65. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/containers.js.map +1 -0
  66. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/decode-b64-to-uint8-array.js +13 -0
  67. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/decode-b64-to-uint8-array.js.map +1 -0
  68. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/ebml-helpers.js +77 -0
  69. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/ebml-helpers.js.map +1 -0
  70. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/id3-helpers.js +15 -0
  71. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/id3-helpers.js.map +1 -0
  72. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/media-groups.js +13 -0
  73. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/media-groups.js.map +1 -0
  74. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/media-types.js +7 -0
  75. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/media-types.js.map +1 -0
  76. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/mp4-helpers.js +31 -0
  77. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/mp4-helpers.js.map +1 -0
  78. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/nal-helpers.js +39 -0
  79. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/nal-helpers.js.map +1 -0
  80. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/resolve-url.js +14 -0
  81. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/resolve-url.js.map +1 -0
  82. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/stream.js +33 -0
  83. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/stream.js.map +1 -0
  84. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/http-handler.js +42 -0
  85. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/http-handler.js.map +1 -0
  86. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/index.js +169 -0
  87. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/index.js.map +1 -0
  88. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/interceptors.js +75 -0
  89. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/interceptors.js.map +1 -0
  90. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/retry.js +70 -0
  91. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/retry.js.map +1 -0
  92. package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/conventions.js +124 -0
  93. package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/conventions.js.map +1 -0
  94. package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/dom-parser.js +151 -0
  95. package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/dom-parser.js.map +1 -0
  96. package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/dom.js +993 -0
  97. package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/dom.js.map +1 -0
  98. package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/entities.js +2146 -0
  99. package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/entities.js.map +1 -0
  100. package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/index.js +14 -0
  101. package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/index.js.map +1 -0
  102. package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/sax.js +346 -0
  103. package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/sax.js.map +1 -0
  104. package/dist/shop-minis-react/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js +308 -0
  105. package/dist/shop-minis-react/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js.map +1 -0
  106. package/dist/shop-minis-react/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/index.js +41 -0
  107. package/dist/shop-minis-react/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/index.js.map +1 -0
  108. package/dist/shop-minis-react/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/route.js +53 -0
  109. package/dist/shop-minis-react/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/route.js.map +1 -0
  110. package/dist/shop-minis-react/node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js +157 -0
  111. package/dist/shop-minis-react/node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js.map +1 -0
  112. package/dist/shop-minis-react/node_modules/.pnpm/color-string@1.9.1/node_modules/color-string/index.js +103 -0
  113. package/dist/shop-minis-react/node_modules/.pnpm/color-string@1.9.1/node_modules/color-string/index.js.map +1 -0
  114. package/dist/shop-minis-react/node_modules/.pnpm/color@4.2.3/node_modules/color/index.js +269 -0
  115. package/dist/shop-minis-react/node_modules/.pnpm/color@4.2.3/node_modules/color/index.js.map +1 -0
  116. package/dist/shop-minis-react/node_modules/.pnpm/global@4.4.0/node_modules/global/document.js +13 -0
  117. package/dist/shop-minis-react/node_modules/.pnpm/global@4.4.0/node_modules/global/document.js.map +1 -0
  118. package/dist/shop-minis-react/node_modules/.pnpm/global@4.4.0/node_modules/global/window.js +12 -0
  119. package/dist/shop-minis-react/node_modules/.pnpm/global@4.4.0/node_modules/global/window.js.map +1 -0
  120. package/dist/shop-minis-react/node_modules/.pnpm/is-arrayish@0.3.2/node_modules/is-arrayish/index.js +10 -0
  121. package/dist/shop-minis-react/node_modules/.pnpm/is-arrayish@0.3.2/node_modules/is-arrayish/index.js.map +1 -0
  122. package/dist/shop-minis-react/node_modules/.pnpm/is-function@1.0.2/node_modules/is-function/index.js +18 -0
  123. package/dist/shop-minis-react/node_modules/.pnpm/is-function@1.0.2/node_modules/is-function/index.js.map +1 -0
  124. package/dist/shop-minis-react/node_modules/.pnpm/m3u8-parser@7.2.0/node_modules/m3u8-parser/dist/m3u8-parser.es.js +855 -0
  125. package/dist/shop-minis-react/node_modules/.pnpm/m3u8-parser@7.2.0/node_modules/m3u8-parser/dist/m3u8-parser.es.js.map +1 -0
  126. package/dist/shop-minis-react/node_modules/.pnpm/mpd-parser@1.3.1/node_modules/mpd-parser/dist/mpd-parser.es.js +1102 -0
  127. package/dist/shop-minis-react/node_modules/.pnpm/mpd-parser@1.3.1/node_modules/mpd-parser/dist/mpd-parser.es.js.map +1 -0
  128. package/dist/shop-minis-react/node_modules/.pnpm/mux.js@7.1.0/node_modules/mux.js/lib/tools/parse-sidx.js +32 -0
  129. package/dist/shop-minis-react/node_modules/.pnpm/mux.js@7.1.0/node_modules/mux.js/lib/tools/parse-sidx.js.map +1 -0
  130. package/dist/shop-minis-react/node_modules/.pnpm/mux.js@7.1.0/node_modules/mux.js/lib/utils/clock.js +34 -0
  131. package/dist/shop-minis-react/node_modules/.pnpm/mux.js@7.1.0/node_modules/mux.js/lib/utils/clock.js.map +1 -0
  132. package/dist/shop-minis-react/node_modules/.pnpm/mux.js@7.1.0/node_modules/mux.js/lib/utils/numbers.js +17 -0
  133. package/dist/shop-minis-react/node_modules/.pnpm/mux.js@7.1.0/node_modules/mux.js/lib/utils/numbers.js.map +1 -0
  134. package/dist/shop-minis-react/node_modules/.pnpm/querystringify@2.2.0/node_modules/querystringify/index.js +1 -1
  135. package/dist/shop-minis-react/node_modules/.pnpm/simple-swizzle@0.2.2/node_modules/simple-swizzle/index.js +23 -0
  136. package/dist/shop-minis-react/node_modules/.pnpm/simple-swizzle@0.2.2/node_modules/simple-swizzle/index.js.map +1 -0
  137. package/dist/shop-minis-react/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.1.0/node_modules/use-sync-external-store/shim/index.js +1 -1
  138. package/dist/shop-minis-react/node_modules/.pnpm/video.js@8.23.3/node_modules/video.js/dist/video.es.js +27824 -0
  139. package/dist/shop-minis-react/node_modules/.pnpm/video.js@8.23.3/node_modules/video.js/dist/video.es.js.map +1 -0
  140. package/dist/shop-minis-react/node_modules/.pnpm/videojs-vtt.js@0.15.5/node_modules/videojs-vtt.js/lib/browser-index.js +26 -0
  141. package/dist/shop-minis-react/node_modules/.pnpm/videojs-vtt.js@0.15.5/node_modules/videojs-vtt.js/lib/browser-index.js.map +1 -0
  142. package/dist/shop-minis-react/node_modules/.pnpm/videojs-vtt.js@0.15.5/node_modules/videojs-vtt.js/lib/vtt.js +802 -0
  143. package/dist/shop-minis-react/node_modules/.pnpm/videojs-vtt.js@0.15.5/node_modules/videojs-vtt.js/lib/vtt.js.map +1 -0
  144. package/dist/shop-minis-react/node_modules/.pnpm/videojs-vtt.js@0.15.5/node_modules/videojs-vtt.js/lib/vttcue.js +188 -0
  145. package/dist/shop-minis-react/node_modules/.pnpm/videojs-vtt.js@0.15.5/node_modules/videojs-vtt.js/lib/vttcue.js.map +1 -0
  146. package/dist/shop-minis-react/node_modules/.pnpm/videojs-vtt.js@0.15.5/node_modules/videojs-vtt.js/lib/vttregion.js +104 -0
  147. package/dist/shop-minis-react/node_modules/.pnpm/videojs-vtt.js@0.15.5/node_modules/videojs-vtt.js/lib/vttregion.js.map +1 -0
  148. package/dist/shop-minis-react.css +1 -1
  149. package/dist/utils/colors.js +6 -0
  150. package/dist/utils/colors.js.map +1 -0
  151. package/dist/utils/merchant-card.js +44 -0
  152. package/dist/utils/merchant-card.js.map +1 -0
  153. package/package.json +5 -1
  154. package/src/components/atoms/video-player.tsx +213 -0
  155. package/src/components/commerce/merchant-card.tsx +219 -49
  156. package/src/components/index.ts +1 -0
  157. package/src/mocks.ts +148 -16
  158. package/src/stories/MerchantCard.stories.tsx +63 -9
  159. package/src/utils/colors.ts +5 -0
  160. package/src/utils/index.ts +1 -0
  161. package/src/utils/merchant-card.ts +99 -0
  162. package/src/hooks/navigation/useCloseMini.doc.ts +0 -32
  163. package/src/hooks/navigation/useCloseMini.example.tsx +0 -7
  164. package/src/hooks/navigation/useDeeplink.doc.ts +0 -32
  165. package/src/hooks/navigation/useDeeplink.example.tsx +0 -7
  166. package/src/hooks/navigation/useShopNavigation.doc.ts +0 -32
  167. package/src/hooks/navigation/useShopNavigation.example.tsx +0 -32
  168. package/src/hooks/product/useCuratedProducts.doc.ts +0 -32
  169. package/src/hooks/product/useCuratedProducts.example.tsx +0 -10
  170. package/src/hooks/product/useProductList.doc.ts +0 -32
  171. package/src/hooks/product/useProductList.example.tsx +0 -9
  172. package/src/hooks/product/useProductListActions.doc.ts +0 -32
  173. package/src/hooks/product/useProductListActions.example.tsx +0 -60
  174. package/src/hooks/product/useProductLists.doc.ts +0 -32
  175. package/src/hooks/product/useProductLists.example.tsx +0 -9
  176. package/src/hooks/product/useProductSearch.doc.ts +0 -32
  177. package/src/hooks/product/useProductSearch.example.tsx +0 -13
  178. package/src/hooks/product/useRecommendedProducts.doc.ts +0 -32
  179. package/src/hooks/product/useRecommendedProducts.example.tsx +0 -7
  180. package/src/hooks/shop/useRecommendedShops.doc.ts +0 -32
  181. package/src/hooks/shop/useRecommendedShops.example.tsx +0 -7
  182. package/src/hooks/shop/useShop.doc.ts +0 -31
  183. package/src/hooks/shop/useShop.example.tsx +0 -7
  184. package/src/hooks/shop/useShopCartActions.doc.ts +0 -32
  185. package/src/hooks/shop/useShopCartActions.example.tsx +0 -28
  186. package/src/hooks/storage/useAsyncStorage.doc.ts +0 -32
  187. package/src/hooks/storage/useAsyncStorage.example.tsx +0 -30
  188. package/src/hooks/storage/useImageUpload.doc.ts +0 -32
  189. package/src/hooks/storage/useImageUpload.example.tsx +0 -20
  190. package/src/hooks/storage/useSecureStorage.doc.ts +0 -32
  191. package/src/hooks/storage/useSecureStorage.example.tsx +0 -23
  192. package/src/hooks/user/useBuyerAttributes.doc.ts +0 -32
  193. package/src/hooks/user/useBuyerAttributes.example.tsx +0 -14
  194. package/src/hooks/user/useCurrentUser.doc.ts +0 -31
  195. package/src/hooks/user/useCurrentUser.example.tsx +0 -7
  196. package/src/hooks/user/useFollowedShopsActions.doc.ts +0 -32
  197. package/src/hooks/user/useFollowedShopsActions.example.tsx +0 -16
  198. package/src/hooks/user/useOrders.doc.ts +0 -32
  199. package/src/hooks/user/useOrders.example.tsx +0 -7
  200. package/src/hooks/user/useRecentProducts.doc.ts +0 -32
  201. package/src/hooks/user/useRecentProducts.example.tsx +0 -13
  202. package/src/hooks/user/useSavedProducts.doc.ts +0 -32
  203. package/src/hooks/user/useSavedProducts.example.tsx +0 -13
  204. package/src/hooks/user/useSavedProductsActions.doc.ts +0 -32
  205. package/src/hooks/user/useSavedProductsActions.example.tsx +0 -32
  206. package/src/hooks/util/useErrorScreen.doc.ts +0 -32
  207. package/src/hooks/util/useErrorScreen.example.tsx +0 -15
  208. package/src/hooks/util/useErrorToast.doc.ts +0 -32
  209. package/src/hooks/util/useErrorToast.example.tsx +0 -15
  210. package/src/hooks/util/useImagePicker.example.tsx +0 -77
package/src/mocks.ts CHANGED
@@ -15,27 +15,145 @@ export const createProduct = (
15
15
  compareAtPrice: {amount: compareAtPrice, currencyCode: 'USD'},
16
16
  }),
17
17
  reviewAnalytics: {averageRating: 4.5, reviewCount: 10},
18
- shop: {id: 'shop1', name: 'Mock Shop'},
18
+ shop: createShop('shop1', 'Mock Shop'),
19
19
  defaultVariantId: `variant-${id}`,
20
20
  isFavorited: false,
21
- featuredImage: {url: `https://picsum.photos/400/400`, altText: title},
22
- })
23
-
24
- export const createShop = (id: string, name: string) => ({
25
- id,
26
- name,
27
- isFollowing: false,
28
- primaryDomain: {
29
- url: `https://${name.toLowerCase().replace(/\s+/g, '-')}.com`,
30
- },
31
- reviewAnalytics: {averageRating: 4.3, reviewCount: 50},
32
- visualTheme: {
33
- id: 'visual-theme-1',
34
- featuredImages: [{url: `https://picsum.photos/400/400`, sensitive: false}],
35
- logoImage: {url: `https://picsum.photos/100/400`, sensitive: false},
21
+ featuredImage: {
22
+ url: `https://cdn.shopify.com/s/files/1/0621/0463/3599/files/61ChhrRjK9L._AC_SL1000_1639abe8-4cd3-4bee-9867-73f26b0acf0a.jpg?v=1702559955`,
23
+ altText: title,
36
24
  },
37
25
  })
38
26
 
27
+ export const createShop = (
28
+ id: string,
29
+ name: string,
30
+ options?: {
31
+ themeType?: 'coverImage' | 'brandColor' | 'logoColor' | 'none'
32
+ withBrandSettings?: boolean
33
+ primaryColor?: string
34
+ logoDominantColor?: string
35
+ logoAverageColor?: string
36
+ coverDominantColor?: string
37
+ wordmarkUrl?: string
38
+ coverImageUrl?: string
39
+ featuredImagesLimit?: number
40
+ }
41
+ ) => {
42
+ // Determine theme configuration
43
+ const themeType = options?.themeType || 'none'
44
+ const shouldHaveBrandSettings =
45
+ options?.withBrandSettings || themeType !== 'none'
46
+
47
+ // Generate featured images
48
+ const featuredImagesCount = options?.featuredImagesLimit || 3
49
+ const featuredImages = Array.from({length: featuredImagesCount}, (_, i) => ({
50
+ url: `https://picsum.photos/400/400?random=${id}-${i}`,
51
+ sensitive: false,
52
+ altText: `${name} featured image ${i + 1}`,
53
+ }))
54
+
55
+ // Configure colors based on theme type
56
+ const getThemeColors = () => {
57
+ switch (themeType) {
58
+ case 'coverImage':
59
+ return {
60
+ primary: options?.primaryColor,
61
+ logoDominant: options?.logoDominantColor,
62
+ logoAverage: options?.logoAverageColor,
63
+ coverDominant: options?.coverDominantColor || '#FF6B35',
64
+ }
65
+ case 'brandColor':
66
+ return {
67
+ primary: options?.primaryColor || '#27AE60',
68
+ logoDominant: options?.logoDominantColor,
69
+ logoAverage: options?.logoAverageColor,
70
+ coverDominant: options?.coverDominantColor,
71
+ }
72
+ case 'logoColor':
73
+ return {
74
+ primary: options?.primaryColor,
75
+ logoDominant: options?.logoDominantColor || '#E74C3C',
76
+ logoAverage: options?.logoAverageColor,
77
+ coverDominant: options?.coverDominantColor,
78
+ }
79
+ default:
80
+ return {
81
+ primary: options?.primaryColor,
82
+ logoDominant: options?.logoDominantColor,
83
+ logoAverage: options?.logoAverageColor,
84
+ coverDominant: options?.coverDominantColor,
85
+ }
86
+ }
87
+ }
88
+
89
+ // Configure header theme
90
+ const createHeaderTheme = () => {
91
+ if (themeType === 'coverImage' || options?.coverImageUrl) {
92
+ return {
93
+ id: `header-theme-${id}`,
94
+ coverImage: {
95
+ url:
96
+ options?.coverImageUrl ||
97
+ 'https://images.unsplash.com/photo-1441986300917-64674bd600d8?w=800&h=400&fit=crop',
98
+ altText: `${name} cover image`,
99
+ sensitive: false,
100
+ thumbhash: 'k9oGHQRnh493V4dIeHeXh4h3iIeI',
101
+ },
102
+ wordmark:
103
+ options?.wordmarkUrl || themeType === 'coverImage'
104
+ ? {
105
+ url:
106
+ options?.wordmarkUrl ||
107
+ 'https://merrypeople.com/cdn/shop/files/Transparent_Background_1.png?v=1696465429&width=1024',
108
+ altText: `${name} wordmark`,
109
+ sensitive: false,
110
+ }
111
+ : undefined,
112
+ }
113
+ }
114
+
115
+ if (options?.wordmarkUrl) {
116
+ return {
117
+ id: `header-theme-${id}`,
118
+ wordmark: {
119
+ url: options.wordmarkUrl,
120
+ altText: `${name} wordmark`,
121
+ sensitive: false,
122
+ },
123
+ }
124
+ }
125
+
126
+ return undefined
127
+ }
128
+
129
+ return {
130
+ id,
131
+ name,
132
+ primaryDomain: {
133
+ url: `https://${name.toLowerCase().replace(/\s+/g, '-')}.com`,
134
+ },
135
+ reviewAnalytics: {averageRating: 4.3, reviewCount: 50},
136
+ visualTheme: {
137
+ id: `visual-theme-${id}`,
138
+ featuredImages,
139
+ logoImage: {
140
+ url: `https://picsum.photos/100/100?random=${id}`,
141
+ sensitive: false,
142
+ },
143
+ brandSettings: shouldHaveBrandSettings
144
+ ? {
145
+ id: `brand-settings-${id}`,
146
+ colors: {
147
+ id: `colors-${id}`,
148
+ ...getThemeColors(),
149
+ },
150
+ headerTheme: createHeaderTheme(),
151
+ }
152
+ : undefined,
153
+ },
154
+ }
155
+ }
156
+
39
157
  const createPagination = (hasNext = false) => ({
40
158
  hasNextPage: hasNext,
41
159
  endCursor: hasNext ? 'cursor123' : null,
@@ -162,6 +280,13 @@ function makeMockActions(): ShopActions {
162
280
  data: [
163
281
  createProduct('rec-1', 'Recommended Product 1', '79.99'),
164
282
  createProduct('rec-2', 'Recommended Product 2', '129.99'),
283
+ createProduct('rec-3', 'Recommended Product 3', '129.99'),
284
+ createProduct('rec-4', 'Recommended Product 4', '29.99'),
285
+ createProduct('rec-5', 'Recommended Product 5', '39.99'),
286
+ createProduct('rec-6', 'Recommended Product 6', '49.99'),
287
+ createProduct('rec-7', 'Recommended Product 7', '59.99'),
288
+ createProduct('rec-8', 'Recommended Product 8', '69.99'),
289
+ createProduct('rec-9', 'Recommended Product 9', '129.99'),
165
290
  ],
166
291
  pageInfo: createPagination(),
167
292
  },
@@ -212,6 +337,13 @@ function makeMockActions(): ShopActions {
212
337
  createProduct('pop-1', 'The Hero Snowboard', '702.95'),
213
338
  createProduct('pop-2', 'Snow Jacket', '605.95', '702.00'),
214
339
  createProduct('pop-3', 'Winter Gloves', '89.95'),
340
+ createProduct('pop-4', 'Summer Gloves', '89.95'),
341
+ createProduct('pop-5', 'Spring Gloves', '89.95'),
342
+ createProduct('pop-6', 'Playstation 5', '499.95'),
343
+ createProduct('pop-7', 'Xbox Series X', '499.95'),
344
+ createProduct('pop-8', 'Nintendo Switch', '299.95'),
345
+ createProduct('pop-9', 'Playstation 4', '299.95'),
346
+ createProduct('pop-10', 'Nintendo 3DS', '89.95'),
215
347
  ],
216
348
  pageInfo: createPagination(),
217
349
  },
@@ -15,9 +15,11 @@ const meta = {
15
15
  touchable: {
16
16
  control: 'boolean',
17
17
  },
18
- variant: {
19
- control: 'radio',
20
- options: ['default', 'compact'],
18
+ fixedHeight: {
19
+ control: 'boolean',
20
+ },
21
+ featuredImagesLimit: {
22
+ control: 'number',
21
23
  },
22
24
  },
23
25
  tags: ['autodocs'],
@@ -34,18 +36,70 @@ export const Default: Story = {
34
36
  ...createShop('shop1', 'Amazing Store'),
35
37
  reviewAnalytics: {averageRating: 4.8, reviewCount: 1250},
36
38
  },
37
- variant: 'default',
39
+ },
40
+ }
41
+
42
+ export const CoverImageDark: Story = {
43
+ name: 'Cover Image',
44
+ args: {
45
+ shop: createShop('cover3', 'Midnight Store', {
46
+ themeType: 'coverImage',
47
+ coverDominantColor: '#2C3E50',
48
+ }),
49
+ },
50
+ }
51
+
52
+ export const BrandColorWordmark: Story = {
53
+ name: 'Brand Color + Wordmark',
54
+ args: {
55
+ shop: createShop('brand2', 'Amazing Store', {
56
+ themeType: 'brandColor',
57
+ wordmarkUrl:
58
+ 'https://merrypeople.com/cdn/shop/files/Transparent_Background_1.png?v=1696465429&width=1024',
59
+ primaryColor: '#E3F2FD',
60
+ }),
38
61
  },
39
62
  }
40
63
 
41
64
  export const Grid: Story = {
42
65
  decorators: [
43
- Story => (
66
+ () => (
44
67
  <div className="grid grid-cols-2 gap-4">
45
- <Story />
46
- <Story />
47
- <Story />
48
- <Story />
68
+ {/* Default */}
69
+ <MerchantCard
70
+ shop={{
71
+ ...createShop('shop1', 'Amazing Store'),
72
+ reviewAnalytics: {averageRating: 4.8, reviewCount: 1250},
73
+ }}
74
+ />
75
+
76
+ {/* Cover Image (Dark) */}
77
+ <MerchantCard
78
+ shop={createShop('cover3', 'Amazing Store', {
79
+ themeType: 'coverImage',
80
+ coverDominantColor: '#2C3E50',
81
+ })}
82
+ />
83
+
84
+ {/* Brand Color + Wordmark (Light) */}
85
+ <MerchantCard
86
+ shop={createShop('brand2', 'Amazing Store', {
87
+ themeType: 'brandColor',
88
+ wordmarkUrl:
89
+ 'https://merrypeople.com/cdn/shop/files/Transparent_Background_1.png?v=1696465429&width=1024',
90
+ primaryColor: '#E3F2FD',
91
+ })}
92
+ />
93
+
94
+ {/* Brand Color + Wordmark (Dark) */}
95
+ <MerchantCard
96
+ shop={createShop('brand4', 'Amazing Store', {
97
+ themeType: 'brandColor',
98
+ wordmarkUrl:
99
+ 'https://merrypeople.com/cdn/shop/files/Transparent_Background_1.png?v=1696465429&width=1024',
100
+ primaryColor: '#808080',
101
+ })}
102
+ />
49
103
  </div>
50
104
  ),
51
105
  ],
@@ -0,0 +1,5 @@
1
+ import Color from 'color'
2
+
3
+ export const isDarkColor = (color: string): boolean => {
4
+ return Color(color).darken(0.2).isDark()
5
+ }
@@ -1,2 +1,3 @@
1
1
  export * from './errors'
2
+ export * from './merchant-card'
2
3
  export * from './parseUrl'
@@ -0,0 +1,99 @@
1
+ import {type Shop, type BrandSettings} from '@shopify/shop-minis-platform'
2
+
3
+ export type ExtractedBrandTheme =
4
+ | {
5
+ type: 'coverImage'
6
+ coverImageUrl: string
7
+ coverImageThumbhash?: string
8
+ backgroundColor: string
9
+ }
10
+ | {
11
+ type: 'brandColor'
12
+ backgroundColor: string
13
+ }
14
+ | {
15
+ type: 'logoColor'
16
+ backgroundColor: string
17
+ }
18
+ | {
19
+ type: 'default'
20
+ backgroundColor: string
21
+ }
22
+
23
+ export function formatReviewCount(count: number): string {
24
+ if (count >= 1000000) {
25
+ return `${Math.floor(count / 100000) / 10}M`
26
+ }
27
+ if (count >= 1000) {
28
+ return `${Math.floor(count / 1000)}K`
29
+ }
30
+ return count.toString()
31
+ }
32
+
33
+ export function normalizeRating(rating: number): number {
34
+ return Math.round(rating * 10) / 10
35
+ }
36
+
37
+ export function extractBrandTheme(
38
+ brandSettings?: BrandSettings | null
39
+ ): ExtractedBrandTheme {
40
+ if (!brandSettings) {
41
+ return {
42
+ type: 'default',
43
+ backgroundColor: 'white',
44
+ }
45
+ }
46
+
47
+ if (brandSettings.headerTheme) {
48
+ const coverImageUrl =
49
+ brandSettings.headerTheme.coverImage?.url ??
50
+ brandSettings.headerTheme.thumbnailImage?.url
51
+ const coverImageThumbhash =
52
+ brandSettings.headerTheme.coverImage?.thumbhash ??
53
+ brandSettings.headerTheme.thumbnailImage?.thumbhash ??
54
+ undefined
55
+ const coverImageColor = brandSettings.colors?.coverDominant
56
+
57
+ if (coverImageUrl && coverImageColor) {
58
+ return {
59
+ type: 'coverImage',
60
+ coverImageUrl,
61
+ coverImageThumbhash,
62
+ backgroundColor: coverImageColor,
63
+ }
64
+ }
65
+ }
66
+
67
+ if (brandSettings.colors?.primary) {
68
+ return {
69
+ type: 'brandColor',
70
+ backgroundColor: brandSettings.colors.primary,
71
+ }
72
+ }
73
+
74
+ if (brandSettings.colors?.logoDominant) {
75
+ return {
76
+ type: 'logoColor',
77
+ backgroundColor: brandSettings.colors.logoDominant,
78
+ }
79
+ }
80
+
81
+ return {
82
+ type: 'default',
83
+ backgroundColor: 'white',
84
+ }
85
+ }
86
+
87
+ export function getFeaturedImages(visualTheme: Shop['visualTheme'], limit = 4) {
88
+ const images = visualTheme?.featuredImages.slice(0, limit)
89
+
90
+ if (!images) {
91
+ return []
92
+ }
93
+
94
+ if (images.length === 3) {
95
+ return visualTheme?.featuredImages.slice(0, 2)
96
+ }
97
+
98
+ return images
99
+ }
@@ -1,32 +0,0 @@
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
@@ -1,7 +0,0 @@
1
- import {useCloseMini, Button} from '@shopify/shop-minis-react'
2
-
3
- export function Example() {
4
- const {closeMini} = useCloseMini()
5
-
6
- return <Button onClick={closeMini}>Close Mini</Button>
7
- }
@@ -1,32 +0,0 @@
1
- import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs'
2
-
3
- const data: ReferenceEntityTemplateSchema = {
4
- name: 'useDeeplink',
5
- category: 'hooks',
6
- subCategory: 'navigation',
7
- isVisualComponent: false,
8
- related: [],
9
- description:
10
- 'The `useDeeplink` hook returns the path, query parameters, and hash parameters of the deep link URL that opened the Mini.',
11
- type: 'hook',
12
- defaultExample: {
13
- codeblock: {
14
- tabs: [
15
- {
16
- code: './useDeeplink.example.tsx',
17
- language: 'tsx',
18
- },
19
- ],
20
- title: 'Example code',
21
- },
22
- },
23
- definitions: [
24
- {
25
- title: '',
26
- type: 'UseDeeplinkGeneratedType',
27
- description: '',
28
- },
29
- ],
30
- }
31
-
32
- export default data
@@ -1,7 +0,0 @@
1
- import {useDeeplink} from '@shopify/shop-minis-react'
2
-
3
- export default function MyComponent() {
4
- const {path, queryParams, hash} = useDeeplink()
5
-
6
- console.log({path, queryParams, hash})
7
- }
@@ -1,32 +0,0 @@
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
@@ -1,32 +0,0 @@
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
- onClick={() =>
11
- navigateToProduct({productId: 'gid://shopify/Product/123'})
12
- }
13
- >
14
- View Product
15
- </Button>
16
- <Button
17
- onClick={() =>
18
- navigateToShop({
19
- shopId: 'gid://shopify/Shop/123',
20
- })
21
- }
22
- >
23
- Go to Shop
24
- </Button>
25
- <Button
26
- onClick={() => navigateToOrder({orderId: 'gid://shopify/Order/123'})}
27
- >
28
- View Order
29
- </Button>
30
- </>
31
- )
32
- }
@@ -1,32 +0,0 @@
1
- import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs'
2
-
3
- const data: ReferenceEntityTemplateSchema = {
4
- name: 'useCuratedProducts',
5
- category: 'hooks',
6
- subCategory: 'product',
7
- isVisualComponent: false,
8
- related: [],
9
- description:
10
- 'The `useCuratedProducts` hook enables fetching lists of products curated by the Shop team.',
11
- type: 'hook',
12
- defaultExample: {
13
- codeblock: {
14
- tabs: [
15
- {
16
- code: './useCuratedProducts.example.tsx',
17
- language: 'tsx',
18
- },
19
- ],
20
- title: 'Example code',
21
- },
22
- },
23
- definitions: [
24
- {
25
- title: '',
26
- type: 'UseCuratedProductsGeneratedType',
27
- description: '',
28
- },
29
- ],
30
- }
31
-
32
- export default data
@@ -1,10 +0,0 @@
1
- import {useCuratedProducts} from '@shopify/shop-minis-react'
2
-
3
- export default function MyComponent() {
4
- const {products, loading, error} = useCuratedProducts({
5
- handle: 'ar-models',
6
- requiredTags: ['furniture'],
7
- })
8
-
9
- console.log({products, loading, error})
10
- }
@@ -1,32 +0,0 @@
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
@@ -1,9 +0,0 @@
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
- }
@@ -1,32 +0,0 @@
1
- import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs'
2
-
3
- const data: ReferenceEntityTemplateSchema = {
4
- name: 'useProductListActions',
5
- category: 'hooks',
6
- subCategory: 'product',
7
- isVisualComponent: false,
8
- related: [],
9
- description:
10
- 'The `useProductListActions` returns a set of actions for managing product lists.',
11
- type: 'hook',
12
- defaultExample: {
13
- codeblock: {
14
- tabs: [
15
- {
16
- code: './useProductListActions.example.tsx',
17
- language: 'tsx',
18
- },
19
- ],
20
- title: 'Example code',
21
- },
22
- },
23
- definitions: [
24
- {
25
- title: '',
26
- type: 'UseProductListActionsGeneratedType',
27
- description: '',
28
- },
29
- ],
30
- }
31
-
32
- export default data