@shopify/shop-minis-react
Version:
React component library for Shopify Shop Minis with Tailwind CSS v4 support (source-only, requires TypeScript)
22 lines (17 loc) • 775 B
text/typescript
import {PreviewProductInARParams} from '@shopify/shop-minis-platform/actions'
import {useHandleAction} from '../../internal/useHandleAction'
import {useShopActions} from '../../internal/useShopActions'
interface UseARPreviewReturns {
/**
* Previews a product in AR. Fetches the product's 3D model and launches the native AR viewer.
* @param params - The parameters for the AR preview, including the product ID.
* @throws Error if the product has no 3D model or if the model sources are missing.
*/
previewProductInAR: (params: PreviewProductInARParams) => Promise<void>
}
export const useARPreview = (): UseARPreviewReturns => {
const {previewProductInAR} = useShopActions()
return {
previewProductInAR: useHandleAction(previewProductInAR),
}
}