@documedis/react-components 1.0.0-RC.4 → 1.0.0-RC.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@documedis/react-components",
3
- "version": "1.0.0-RC.4",
3
+ "version": "1.0.0-RC.6",
4
4
  "description": "React components for Documedis healthcare applications - prescription signing, pharmacy selection, and more",
5
5
  "keywords": [
6
6
  "react",
@@ -35,7 +35,7 @@
35
35
  "publishConfig": {
36
36
  "access": "public",
37
37
  "registry": "https://registry.npmjs.org/",
38
- "tag": "next"
38
+ "tag": "beta"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "react": ">=18.0.0"
@@ -1,9 +0,0 @@
1
- import { Environment, Pharmacy } from '../..';
2
- export interface PharmacySelectorProps {
3
- accessToken: string;
4
- environment: Environment;
5
- enabledGalenicaChains?: string[];
6
- className?: string;
7
- onPharmacySelected: (pharmacy: Pharmacy | null) => void;
8
- }
9
- export declare const PharmacySelector: ({ accessToken, environment, enabledGalenicaChains, onPharmacySelected, className, }: PharmacySelectorProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +0,0 @@
1
- export { PharmacySelector } from './PharmacySelector';
2
- export type { PharmacySelectorProps } from './PharmacySelector';
3
- export { usePharmacySelector } from './usePharmacySelector';
4
- export type { UsePharmacySelectorConfig, UsePharmacySelectorReturn, } from './usePharmacySelector';
@@ -1,14 +0,0 @@
1
- import { Environment, Pharmacy } from '../..';
2
- export interface UsePharmacySelectorConfig {
3
- accessToken: string;
4
- environment: Environment;
5
- enabledGalenicaChains?: string[];
6
- }
7
- export interface UsePharmacySelectorReturn {
8
- onQueryChange: (input: string) => void;
9
- queriedPharmacies: Pharmacy[];
10
- selectPharmacy: (pharmacy: Pharmacy) => void;
11
- selectedPharmacy: Pharmacy | null;
12
- isLoading: boolean;
13
- }
14
- export declare const usePharmacySelector: (config: UsePharmacySelectorConfig) => UsePharmacySelectorReturn;
@@ -1,2 +0,0 @@
1
- import { PrescriptionSignProps } from './types';
2
- export declare const PrescriptionSign: ({ onSuccess, onError, onSessionTokenUpdate, className, ...props }: PrescriptionSignProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +0,0 @@
1
- export { PrescriptionSign } from './PrescriptionSign';
2
- export type { PrescriptionSignProps, UsePrescriptionSigningProps, } from './types';
3
- export { usePrescriptionSign } from './usePrescriptionSign';
4
- export type { UsePrescriptionSignReturn } from './usePrescriptionSign';
@@ -1,77 +0,0 @@
1
- import { DomainError, Environment } from '../..';
2
- interface PrescriptionSignReactProps {
3
- accessToken: string;
4
- environment: Environment;
5
- chmed: string;
6
- sessionToken?: string;
7
- generatePdf?: boolean;
8
- }
9
- /**
10
- * Props for the usePrescriptionSign hook
11
- */
12
- export type UsePrescriptionSigningProps = {
13
- /**
14
- * Environment configuration for the prescription service
15
- * - 'local': Development environment (localhost:52247)
16
- * - 'dev': Development Azure Container Apps
17
- * - 'int': Integration Azure Container Apps
18
- * - 'prod': Production Azure Container Apps
19
- */
20
- environment: Environment;
21
- /** Access token for authenticating with the backend service */
22
- accessToken: string;
23
- /**
24
- * Optional existing session token to reuse authentication state.
25
- * If provided, the hook will attempt to use existing authentication.
26
- */
27
- sessionToken?: string;
28
- /**
29
- * Optional callback invoked when the session token is updated.
30
- * Use this to persist the session token for reuse across hook instances.
31
- */
32
- onSessionTokenUpdate?: (token: string) => void;
33
- /**
34
- * Optional callback invoked when prescription signing succeeds.
35
- * Receives the signed CHMED data as a base64-encoded string.
36
- * Optionally receives the generatedPdf if the option
37
- * generatePdf is set to true.
38
- *
39
- * @see generatePdf
40
- */
41
- onSuccess?: (signedCHMED: string, generatedPdf?: string) => void;
42
- /**
43
- * Optional callback invoked when prescription signing fails.
44
- * Receives a specific error type indicating what went wrong.
45
- */
46
- onError?: (error: DomainError) => void;
47
- /**
48
- * Flag to generate PDF after signing.
49
- */
50
- generatePdf: boolean;
51
- };
52
- /**
53
- * Props for the PrescriptionSign React component
54
- * Uses camelCase (React convention) - internally converted to kebab-case for web component
55
- */
56
- export interface PrescriptionSignProps extends PrescriptionSignReactProps {
57
- /** Optional additional CSS class names to apply to the component */
58
- className?: string;
59
- /**
60
- * Optional callback invoked when the session token is updated.
61
- * Use this to persist the session token for reuse across components.
62
- */
63
- onSessionTokenUpdate?: (sessionToken: string) => void;
64
- /**
65
- * Optional callback invoked when prescription signing succeeds.
66
- * Receives the signed CHMED data as a base64-encoded string.
67
- * Optionally receives the generatedPdf if the option
68
- * generatePdf is set to true.
69
- */
70
- onSuccess?: (signedCHMED: string, generatedPdf?: string) => void;
71
- /**
72
- * Optional callback invoked when prescription signing fails.
73
- * Receives a specific error type indicating what went wrong.
74
- */
75
- onError?: (error: DomainError) => void;
76
- }
77
- export {};
@@ -1 +0,0 @@
1
- export declare function useDocumentEvent<T>(eventType: string, handler: ((detail: T) => void) | undefined): void;
@@ -1,46 +0,0 @@
1
- import { UsePrescriptionSigningProps } from './types';
2
- /**
3
- * Return type for the usePrescriptionSign hook
4
- */
5
- export interface UsePrescriptionSignReturn {
6
- /** Function to initiate the signing process with CHMED data */
7
- start: (encodedCHMED: string, generatePdf: boolean) => void;
8
- /** Function to terminate the signing process at any time */
9
- interrupt: () => void;
10
- /** Raw XState machine state (for advanced usage) */
11
- state: any;
12
- /** True when ready to start signing (initial state) */
13
- isIdle: boolean;
14
- /** True when actively processing (excludes error/success states) */
15
- isActive: boolean;
16
- /** True when in error state (persists until retry) */
17
- isError: boolean;
18
- /** True when signing completed successfully */
19
- isSuccess: boolean;
20
- /** True during the actual signature operation */
21
- isSigning: boolean;
22
- /** The signed prescription data (available after success) */
23
- signedCHMED: string | undefined;
24
- }
25
- /**
26
- * Hook to manage the ePrescription signature process
27
- *
28
- * This is a standalone hook that can be shipped in a library.
29
- * It handles the complete HIN authentication and signing flow.
30
- *
31
- * Required peer dependencies:
32
- * - next-auth/react (for session management)
33
- * - xstate and @xstate/react
34
- *
35
- * @returns Object containing:
36
- * - start: Function to initiate the signing process with CHMED data
37
- * - interrupt: Function to terminate the signing process at any time
38
- * - state: Raw XState machine state (for advanced usage)
39
- * - isIdle: true when ready to start signing (initial state)
40
- * - isActive: true when actively processing (excludes error/success states)
41
- * - isError: true when in error state (persists until retry)
42
- * - isSuccess: true when signing completed successfully
43
- * - isSigning: true during the actual signature operation
44
- * - signedCHMED: The signed prescription data (available after success)
45
- */
46
- export declare function usePrescriptionSign(props: UsePrescriptionSigningProps): UsePrescriptionSignReturn;