UNPKG

@documedis/react-components

Version:

React components for Documedis healthcare applications - prescription signing, pharmacy selection, and more

47 lines (46 loc) 2 kB
import { UsePrescriptionSigningProps } from './types'; /** * Return type for the usePrescriptionSign hook */ export interface UsePrescriptionSignReturn { /** Function to initiate the signing process with CHMED data */ start: (encodedCHMED: string, generatePdf: boolean) => void; /** Function to terminate the signing process at any time */ interrupt: () => void; /** Raw XState machine state (for advanced usage) */ state: any; /** True when ready to start signing (initial state) */ isIdle: boolean; /** True when actively processing (excludes error/success states) */ isActive: boolean; /** True when in error state (persists until retry) */ isError: boolean; /** True when signing completed successfully */ isSuccess: boolean; /** True during the actual signature operation */ isSigning: boolean; /** The signed prescription data (available after success) */ signedCHMED: string | undefined; } /** * Hook to manage the ePrescription signature process * * This is a standalone hook that can be shipped in a library. * It handles the complete HIN authentication and signing flow. * * Required peer dependencies: * - next-auth/react (for session management) * - xstate and @xstate/react * * @returns Object containing: * - start: Function to initiate the signing process with CHMED data * - interrupt: Function to terminate the signing process at any time * - state: Raw XState machine state (for advanced usage) * - isIdle: true when ready to start signing (initial state) * - isActive: true when actively processing (excludes error/success states) * - isError: true when in error state (persists until retry) * - isSuccess: true when signing completed successfully * - isSigning: true during the actual signature operation * - signedCHMED: The signed prescription data (available after success) */ export declare function usePrescriptionSign(props: UsePrescriptionSigningProps): UsePrescriptionSignReturn;