UNPKG

@documedis-components/prescription-sign

Version:

React component for signing electronic prescriptions with HIN authentication

49 lines (48 loc) 2.1 kB
import { Environment } from '../../../../../core/src/infrastructure/shared'; import { DomainError } from '../../../../../core/src/errors/index.ts'; export type PrescriptionSignProps = { /** * Environment configuration for the prescription service * - 'local': Development environment (localhost:52247) * - 'dev': Development Azure Container Apps * - 'int': Integration Azure Container Apps * - 'prod': Production Azure Container Apps */ environment: Environment; /** Base64-encoded CHMED prescription data to be signed */ chmed: string; /** Access token for authenticating with the backend service */ accessToken: string; /** * Optional existing session token to reuse authentication state. * If provided, the component will attempt to use existing authentication. */ sessionToken?: string; /** * Optional callback invoked when the session token is updated. * Use this to persist the session token for reuse across components. */ onSessionTokenUpdate?: (sessionToken: string) => void; /** * Optional callback invoked when prescription signing succeeds. * Receives the signed CHMED data as a base64-encoded string. * Optionally receives the generatedPdf if the option * generatePdf is set to true. * * @see generatePdf */ onSuccess?: (signedCHMED: string, generatedPdf?: string) => void; /** * Optional callback invoked when prescription signing fails. * Receives a specific error type indicating what went wrong. */ onError?: (error: DomainError) => void; /** Optional additional CSS class names to apply to the component */ className?: string; /** * Optional flag to generate PDF after signing. * Defaults to false, meaning only CHMED data is returned. */ generatePdf?: boolean; }; export declare function PrescriptionSign({ environment, accessToken, chmed, sessionToken, onSessionTokenUpdate, onSuccess, onError, className, generatePdf, }: PrescriptionSignProps): import("react/jsx-runtime").JSX.Element;