import { CheckPermissionParams, CheckPermissionResponse, } from '@shopify/shop-minis-platform/actions' import {useHandleAction} from '../../internal/useHandleAction' import {useShopActions} from '../../internal/useShopActions' export interface UseCheckPermissionsReturns { /** * Check the current status of a native device permission without prompting the user. * * Returns a {@link PermissionStatus} describing the combined state of the Mini's in-app * consent decision and the OS-level permission. Safe to call at any time — never triggers * the permission dialog or OS prompt. */ checkPermission: ( params: CheckPermissionParams ) => Promise } export const useCheckPermissions = (): UseCheckPermissionsReturns => { const {checkPermission} = useShopActions() return { checkPermission: useHandleAction(checkPermission), } } /** * The `useCheckPermissions` hook provides a function to read the current status of a native device permission for the Mini **without prompting the user**. * * Use it to branch UI on permission state — for example, showing a welcome/onboarding screen only when the user has never seen the consent dialog (`undetermined`), sending the user to system Settings when the permission is `blocked`, or skipping straight to the main flow when the permission is already `granted`. * * Returns one of: `'granted' | 'denied' | 'blocked' | 'undetermined' | 'unavailable'`. * * > Note: Before using this hook, add the required permissions to your Mini's manifest file: `"permissions": ["CAMERA"]`. * @publicDocs */ export type UseCheckPermissionsGeneratedType = () => UseCheckPermissionsReturns