UNPKG

@documedis/react-components

Version:

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

78 lines (77 loc) 2.81 kB
import { DomainError, Environment } from '../..'; interface PrescriptionSignReactProps { accessToken: string; environment: Environment; chmed: string; sessionToken?: string; generatePdf?: boolean; } /** * Props for the usePrescriptionSign hook */ export type UsePrescriptionSigningProps = { /** * 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; /** Access token for authenticating with the backend service */ accessToken: string; /** * Optional existing session token to reuse authentication state. * If provided, the hook 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 hook instances. */ onSessionTokenUpdate?: (token: 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; /** * Flag to generate PDF after signing. */ generatePdf: boolean; }; /** * Props for the PrescriptionSign React component * Uses camelCase (React convention) - internally converted to kebab-case for web component */ export interface PrescriptionSignProps extends PrescriptionSignReactProps { /** Optional additional CSS class names to apply to the component */ className?: 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. */ 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; } export {};