@shopify/shop-minis-react 0.0.20 → 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.
- package/dist/_virtual/___vite-browser-external.js +7 -0
- package/dist/_virtual/___vite-browser-external.js.map +1 -0
- package/dist/_virtual/__vite-browser-external.js +5 -0
- package/dist/_virtual/__vite-browser-external.js.map +1 -0
- package/dist/_virtual/_commonjsHelpers.js +24 -4
- package/dist/_virtual/_commonjsHelpers.js.map +1 -1
- package/dist/_virtual/browser-index.js +8 -0
- package/dist/_virtual/browser-index.js.map +1 -0
- package/dist/_virtual/browser-index2.js +5 -0
- package/dist/_virtual/browser-index2.js.map +1 -0
- package/dist/_virtual/clock.js +6 -0
- package/dist/_virtual/clock.js.map +1 -0
- package/dist/_virtual/conventions.js +5 -0
- package/dist/_virtual/conventions.js.map +1 -0
- package/dist/_virtual/document.js +8 -0
- package/dist/_virtual/document.js.map +1 -0
- package/dist/_virtual/dom-parser.js +5 -0
- package/dist/_virtual/dom-parser.js.map +1 -0
- package/dist/_virtual/dom.js +5 -0
- package/dist/_virtual/dom.js.map +1 -0
- package/dist/_virtual/entities.js +5 -0
- package/dist/_virtual/entities.js.map +1 -0
- package/dist/_virtual/extends.js +5 -0
- package/dist/_virtual/extends.js.map +1 -0
- package/dist/_virtual/index10.js +5 -0
- package/dist/_virtual/index10.js.map +1 -0
- package/dist/_virtual/index11.js +5 -0
- package/dist/_virtual/index11.js.map +1 -0
- package/dist/_virtual/index2.js +5 -2
- package/dist/_virtual/index2.js.map +1 -1
- package/dist/_virtual/index3.js +5 -3
- package/dist/_virtual/index3.js.map +1 -1
- package/dist/_virtual/index5.js +6 -0
- package/dist/_virtual/index5.js.map +1 -0
- package/dist/_virtual/index6.js +6 -0
- package/dist/_virtual/index6.js.map +1 -0
- package/dist/_virtual/index7.js +5 -0
- package/dist/_virtual/index7.js.map +1 -0
- package/dist/_virtual/index8.js +5 -0
- package/dist/_virtual/index8.js.map +1 -0
- package/dist/_virtual/index9.js +5 -0
- package/dist/_virtual/index9.js.map +1 -0
- package/dist/_virtual/parse-sidx.js +8 -0
- package/dist/_virtual/parse-sidx.js.map +1 -0
- package/dist/_virtual/sax.js +5 -0
- package/dist/_virtual/sax.js.map +1 -0
- package/dist/_virtual/window.js +8 -0
- package/dist/_virtual/window.js.map +1 -0
- package/dist/components/atoms/video-player.js +121 -0
- package/dist/components/atoms/video-player.js.map +1 -0
- package/dist/components/commerce/merchant-card.js +236 -106
- package/dist/components/commerce/merchant-card.js.map +1 -1
- package/dist/hooks/storage/useImageUpload.js.map +1 -1
- package/dist/hooks/util/useErrorScreen.js.map +1 -1
- package/dist/hooks/util/useErrorToast.js.map +1 -1
- package/dist/index.js +205 -195
- package/dist/index.js.map +1 -1
- package/dist/mocks.js +114 -87
- package/dist/mocks.js.map +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/extends.js +20 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/extends.js.map +1 -0
- 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
- 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
- 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
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/codecs.js +102 -0
- 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
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/containers.js +149 -0
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_vhs-utils@4.1.1/node_modules/@videojs/vhs-utils/es/stream.js +33 -0
- 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
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/http-handler.js +42 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/http-handler.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/index.js +169 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/index.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/interceptors.js +75 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/interceptors.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/retry.js +70 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/retry.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/conventions.js +124 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/conventions.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/dom-parser.js +151 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/dom-parser.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/dom.js +993 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/dom.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/entities.js +2146 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/entities.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/index.js +14 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/index.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/sax.js +346 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/sax.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js +308 -0
- package/dist/shop-minis-react/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/index.js +41 -0
- package/dist/shop-minis-react/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/index.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/route.js +53 -0
- package/dist/shop-minis-react/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/route.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js +157 -0
- package/dist/shop-minis-react/node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/color-string@1.9.1/node_modules/color-string/index.js +103 -0
- package/dist/shop-minis-react/node_modules/.pnpm/color-string@1.9.1/node_modules/color-string/index.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/color@4.2.3/node_modules/color/index.js +269 -0
- package/dist/shop-minis-react/node_modules/.pnpm/color@4.2.3/node_modules/color/index.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/global@4.4.0/node_modules/global/document.js +13 -0
- package/dist/shop-minis-react/node_modules/.pnpm/global@4.4.0/node_modules/global/document.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/global@4.4.0/node_modules/global/window.js +12 -0
- package/dist/shop-minis-react/node_modules/.pnpm/global@4.4.0/node_modules/global/window.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/is-arrayish@0.3.2/node_modules/is-arrayish/index.js +10 -0
- package/dist/shop-minis-react/node_modules/.pnpm/is-arrayish@0.3.2/node_modules/is-arrayish/index.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/is-function@1.0.2/node_modules/is-function/index.js +18 -0
- package/dist/shop-minis-react/node_modules/.pnpm/is-function@1.0.2/node_modules/is-function/index.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/m3u8-parser@7.2.0/node_modules/m3u8-parser/dist/m3u8-parser.es.js +855 -0
- 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
- package/dist/shop-minis-react/node_modules/.pnpm/mpd-parser@1.3.1/node_modules/mpd-parser/dist/mpd-parser.es.js +1102 -0
- 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
- package/dist/shop-minis-react/node_modules/.pnpm/mux.js@7.1.0/node_modules/mux.js/lib/tools/parse-sidx.js +32 -0
- 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
- package/dist/shop-minis-react/node_modules/.pnpm/mux.js@7.1.0/node_modules/mux.js/lib/utils/clock.js +34 -0
- package/dist/shop-minis-react/node_modules/.pnpm/mux.js@7.1.0/node_modules/mux.js/lib/utils/clock.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/mux.js@7.1.0/node_modules/mux.js/lib/utils/numbers.js +17 -0
- package/dist/shop-minis-react/node_modules/.pnpm/mux.js@7.1.0/node_modules/mux.js/lib/utils/numbers.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/querystringify@2.2.0/node_modules/querystringify/index.js +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/simple-swizzle@0.2.2/node_modules/simple-swizzle/index.js +23 -0
- package/dist/shop-minis-react/node_modules/.pnpm/simple-swizzle@0.2.2/node_modules/simple-swizzle/index.js.map +1 -0
- 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
- package/dist/shop-minis-react/node_modules/.pnpm/video.js@8.23.3/node_modules/video.js/dist/video.es.js +27824 -0
- package/dist/shop-minis-react/node_modules/.pnpm/video.js@8.23.3/node_modules/video.js/dist/video.es.js.map +1 -0
- 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
- 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
- package/dist/shop-minis-react/node_modules/.pnpm/videojs-vtt.js@0.15.5/node_modules/videojs-vtt.js/lib/vtt.js +802 -0
- 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
- package/dist/shop-minis-react/node_modules/.pnpm/videojs-vtt.js@0.15.5/node_modules/videojs-vtt.js/lib/vttcue.js +188 -0
- 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
- package/dist/shop-minis-react/node_modules/.pnpm/videojs-vtt.js@0.15.5/node_modules/videojs-vtt.js/lib/vttregion.js +104 -0
- 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
- package/dist/shop-minis-react.css +1 -1
- package/dist/utils/colors.js +6 -0
- package/dist/utils/colors.js.map +1 -0
- package/dist/utils/merchant-card.js +44 -0
- package/dist/utils/merchant-card.js.map +1 -0
- package/package.json +6 -2
- package/src/components/atoms/video-player.tsx +213 -0
- package/src/components/commerce/merchant-card.tsx +219 -49
- package/src/components/index.ts +2 -0
- package/src/hooks/storage/useImageUpload.ts +3 -2
- package/src/hooks/util/useErrorScreen.ts +2 -1
- package/src/hooks/util/useErrorToast.ts +2 -1
- package/src/mocks.ts +148 -16
- package/src/stories/MerchantCard.stories.tsx +63 -9
- package/src/utils/colors.ts +5 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/merchant-card.ts +99 -0
- package/src/hooks/navigation/useCloseMini.doc.ts +0 -32
- package/src/hooks/navigation/useCloseMini.example.tsx +0 -7
- package/src/hooks/navigation/useDeeplink.doc.ts +0 -32
- package/src/hooks/navigation/useDeeplink.example.tsx +0 -7
- package/src/hooks/navigation/useShopNavigation.doc.ts +0 -32
- package/src/hooks/navigation/useShopNavigation.example.tsx +0 -29
- package/src/hooks/product/useCuratedProducts.doc.ts +0 -32
- package/src/hooks/product/useCuratedProducts.example.tsx +0 -10
- package/src/hooks/product/useProductList.doc.ts +0 -32
- package/src/hooks/product/useProductList.example.tsx +0 -9
- package/src/hooks/product/useProductListActions.doc.ts +0 -32
- package/src/hooks/product/useProductListActions.example.tsx +0 -57
- package/src/hooks/product/useProductLists.doc.ts +0 -32
- package/src/hooks/product/useProductLists.example.tsx +0 -9
- package/src/hooks/product/useProductSearch.doc.ts +0 -32
- package/src/hooks/product/useProductSearch.example.tsx +0 -13
- package/src/hooks/product/useRecommendedProducts.doc.ts +0 -32
- package/src/hooks/product/useRecommendedProducts.example.tsx +0 -7
- package/src/hooks/shop/useRecommendedShops.doc.ts +0 -32
- package/src/hooks/shop/useRecommendedShops.example.tsx +0 -7
- package/src/hooks/shop/useShop.doc.ts +0 -31
- package/src/hooks/shop/useShop.example.tsx +0 -7
- package/src/hooks/shop/useShopCartActions.doc.ts +0 -32
- package/src/hooks/shop/useShopCartActions.example.tsx +0 -28
- package/src/hooks/storage/useAsyncStorage.doc.ts +0 -32
- package/src/hooks/storage/useAsyncStorage.example.tsx +0 -30
- package/src/hooks/storage/useImageUpload.doc.ts +0 -32
- package/src/hooks/storage/useImageUpload.example.tsx +0 -20
- package/src/hooks/storage/useSecureStorage.doc.ts +0 -32
- package/src/hooks/storage/useSecureStorage.example.tsx +0 -23
- package/src/hooks/user/useBuyerAttributes.doc.ts +0 -32
- package/src/hooks/user/useBuyerAttributes.example.tsx +0 -14
- package/src/hooks/user/useCurrentUser.doc.ts +0 -31
- package/src/hooks/user/useCurrentUser.example.tsx +0 -7
- package/src/hooks/user/useFollowedShopsActions.doc.ts +0 -32
- package/src/hooks/user/useFollowedShopsActions.example.tsx +0 -18
- package/src/hooks/user/useOrders.doc.ts +0 -32
- package/src/hooks/user/useOrders.example.tsx +0 -7
- package/src/hooks/user/useRecentProducts.doc.ts +0 -32
- package/src/hooks/user/useRecentProducts.example.tsx +0 -13
- package/src/hooks/user/useSavedProducts.doc.ts +0 -32
- package/src/hooks/user/useSavedProducts.example.tsx +0 -13
- package/src/hooks/user/useSavedProductsActions.doc.ts +0 -32
- package/src/hooks/user/useSavedProductsActions.example.tsx +0 -30
- package/src/hooks/util/useErrorScreen.doc.ts +0 -32
- package/src/hooks/util/useErrorScreen.example.tsx +0 -16
- package/src/hooks/util/useErrorToast.doc.ts +0 -32
- package/src/hooks/util/useErrorToast.example.tsx +0 -15
- package/src/hooks/util/useImagePicker.example.tsx +0 -85
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {useCallback} from 'react'
|
|
2
2
|
|
|
3
3
|
import {useShopActions} from '../../internal/useShopActions'
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
import type {UploadTarget} from '@shopify/shop-minis-platform/actions'
|
|
5
6
|
|
|
6
7
|
export interface UploadImageParams {
|
|
7
8
|
/**
|
|
@@ -45,7 +46,7 @@ const uploadFileToGCS = async (
|
|
|
45
46
|
target: UploadTarget
|
|
46
47
|
) => {
|
|
47
48
|
const formData = new FormData()
|
|
48
|
-
target.parameters.forEach(({name, value}) => {
|
|
49
|
+
target.parameters.forEach(({name, value}: {name: string; value: string}) => {
|
|
49
50
|
formData.append(name, value)
|
|
50
51
|
})
|
|
51
52
|
// Append the actual file data last
|
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:
|
|
18
|
+
shop: createShop('shop1', 'Mock Shop'),
|
|
19
19
|
defaultVariantId: `variant-${id}`,
|
|
20
20
|
isFavorited: false,
|
|
21
|
-
featuredImage: {
|
|
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
|
-
|
|
19
|
-
control: '
|
|
20
|
-
|
|
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
|
-
|
|
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
|
-
|
|
66
|
+
() => (
|
|
44
67
|
<div className="grid grid-cols-2 gap-4">
|
|
45
|
-
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
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
|
],
|
package/src/utils/index.ts
CHANGED
|
@@ -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,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,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,29 +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
|
-
onPress={() =>
|
|
11
|
-
navigateToProduct({productId: 'gid://shopify/Product/123'})
|
|
12
|
-
}
|
|
13
|
-
text="View Product"
|
|
14
|
-
/>
|
|
15
|
-
<Button
|
|
16
|
-
onPress={() =>
|
|
17
|
-
navigateToShop({
|
|
18
|
-
shopId: 'gid://shopify/Shop/123',
|
|
19
|
-
})
|
|
20
|
-
}
|
|
21
|
-
text="Go to Shop"
|
|
22
|
-
/>
|
|
23
|
-
<Button
|
|
24
|
-
onPress={() => navigateToOrder({orderId: 'gid://shopify/Order/123'})}
|
|
25
|
-
text="View Order"
|
|
26
|
-
/>
|
|
27
|
-
</>
|
|
28
|
-
)
|
|
29
|
-
}
|
|
@@ -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
|