import {useCallback} from 'react' import {useShopIntent} from '../../internal/useShopIntent' import type { CreateUserImageParams, CreateUserImageResponse, IntentResult, } from '@shopify/shop-minis-platform/actions' /** * Hook for minis to create a user image via the host app's * camera or photo library. */ export function useUserImagePicker() { const {invokeQuery} = useShopIntent() const pickImage = useCallback( async ( options: CreateUserImageParams ): Promise> => { const result = await invokeQuery({ action: 'create', type: 'shop/UserImage', data: options, }) // The bridge returns untyped data; the host handler guarantees // the shape matches CreateUserImageResponse for this action+type. return result as IntentResult }, [invokeQuery] ) return {pickImage} }