import { A as StateMachine, C as StateValue, D as PromiseActorLogic, a as ActorRefFromLogic, b as RequiredActorOptions, c as AnyEventObject, d as DoneActorEvent, f as ErrorActorEvent, g as IsNotNever, h as InputFrom, i as ActorRefFrom, k as MachineSnapshot, m as GetConcreteByKey, o as AnyActorLogic, p as EventObject, r as ActorRef, s as AnyActorRef, t as ActionFunction, u as ConditionalRequired, v as MetaObject, w as Values, x as RequiredLogicInput, y as NonReducibleUnknown } from "./spawn-D9jgw9pW.js"; import "./StateMachine-EDpYWy0i.js"; import { t as Manager } from "./Manager-CQQ99QOI.js"; import "./Actor-iTq7YY48.js"; import { a as ElectronicSignatureConfig, c as ElectronicSignatureFileDataHolder, i as ConsentKey, l as ElectronicSignatureInput, m as UnsignedDocsResponse, o as ElectronicSignatureContext, p as SignedDocument, r as ConsentChecks, s as ElectronicSignatureDocument, u as ElectronicSignatureVariant } from "./types-DVmXIdzW.js"; //#region src/modules/electronic-signature/electronicSignatureStateMachine.d.ts declare const electronicSignatureMachine: StateMachine> | ActorRefFromLogic> | ActorRefFromLogic> | ActorRefFromLogic> | undefined; }, Values<{ fetchUnsignedDocs: { src: "fetchUnsignedDocs"; logic: PromiseActorLogic; id: string | undefined; }; signDocuments: { src: "signDocuments"; logic: PromiseActorLogic; id: string | undefined; }; generateUploadUrl: { src: "generateUploadUrl"; logic: PromiseActorLogic<{ preSignedUrl: string; }, void, EventObject>; id: string | undefined; }; uploadFile: { src: "uploadFile"; logic: PromiseActorLogic; id: string | undefined; }; }>, Values<{ setDocuments: { type: "setDocuments"; params: NonReducibleUnknown; }; setSignedDocuments: { type: "setSignedDocuments"; params: NonReducibleUnknown; }; setFile: { type: "setFile"; params: NonReducibleUnknown; }; setUploadUrl: { type: "setUploadUrl"; params: NonReducibleUnknown; }; updateConsent: { type: "updateConsent"; params: NonReducibleUnknown; }; setViewingDocument: { type: "setViewingDocument"; params: NonReducibleUnknown; }; clearViewingDocument: { type: "clearViewingDocument"; params: NonReducibleUnknown; }; }>, Values<{ errorFromUpload: { type: "errorFromUpload"; params: unknown; }; shouldUpload: { type: "shouldUpload"; params: unknown; }; hasUploadUrl: { type: "hasUploadUrl"; params: unknown; }; allConsented: { type: "allConsented"; params: unknown; }; hasDocuments: { type: "hasDocuments"; params: unknown; }; allSigned: { type: "allSigned"; params: unknown; }; allSignedAndDownload: { type: "allSignedAndDownload"; params: unknown; }; }>, never, "error" | "signing" | "idle" | "uploading" | "fetchingDocs" | "reviewing" | "closed" | "uploadingFile" | "generatingUploadUrl" | "processing" | "successDownload" | "success" | "signError" | "finished", string, { config: ElectronicSignatureConfig; fileDataHolder: ElectronicSignatureFileDataHolder; getFileData?: never; } | { config: ElectronicSignatureConfig; getFileData: () => ArrayBuffer | null; fileDataHolder?: never; }, NonReducibleUnknown, EventObject, MetaObject, { readonly id: "electronicSignature"; readonly initial: "idle"; readonly context: ({ input }: { spawn: { (logic: TSrc, ...[options]: ({ src: "fetchUnsignedDocs"; logic: PromiseActorLogic; id: string | undefined; } extends (infer T) ? T extends { src: "fetchUnsignedDocs"; logic: PromiseActorLogic; id: string | undefined; } ? T extends { src: TSrc; } ? ConditionalRequired<[options?: ({ id?: T["id"] | undefined; systemId?: string; input?: InputFrom | undefined; syncSnapshot?: boolean; } & { [K in RequiredActorOptions]: unknown; }) | undefined], IsNotNever>> : never : never : never) | ({ src: "signDocuments"; logic: PromiseActorLogic; id: string | undefined; } extends (infer T_1) ? T_1 extends { src: "signDocuments"; logic: PromiseActorLogic; id: string | undefined; } ? T_1 extends { src: TSrc; } ? ConditionalRequired<[options?: ({ id?: T_1["id"] | undefined; systemId?: string; input?: InputFrom | undefined; syncSnapshot?: boolean; } & { [K_1 in RequiredActorOptions]: unknown; }) | undefined], IsNotNever>> : never : never : never) | ({ src: "generateUploadUrl"; logic: PromiseActorLogic<{ preSignedUrl: string; }, void, EventObject>; id: string | undefined; } extends (infer T_2) ? T_2 extends { src: "generateUploadUrl"; logic: PromiseActorLogic<{ preSignedUrl: string; }, void, EventObject>; id: string | undefined; } ? T_2 extends { src: TSrc; } ? ConditionalRequired<[options?: ({ id?: T_2["id"] | undefined; systemId?: string; input?: InputFrom | undefined; syncSnapshot?: boolean; } & { [K_2 in RequiredActorOptions]: unknown; }) | undefined], IsNotNever>> : never : never : never) | ({ src: "uploadFile"; logic: PromiseActorLogic; id: string | undefined; } extends (infer T_3) ? T_3 extends { src: "uploadFile"; logic: PromiseActorLogic; id: string | undefined; } ? T_3 extends { src: TSrc; } ? ConditionalRequired<[options?: ({ id?: T_3["id"] | undefined; systemId?: string; input?: InputFrom | undefined; syncSnapshot?: boolean; } & { [K_3 in RequiredActorOptions]: unknown; }) | undefined], IsNotNever>> : never : never : never)): ActorRefFromLogic; id: string | undefined; }; signDocuments: { src: "signDocuments"; logic: PromiseActorLogic; id: string | undefined; }; generateUploadUrl: { src: "generateUploadUrl"; logic: PromiseActorLogic<{ preSignedUrl: string; }, void, EventObject>; id: string | undefined; }; uploadFile: { src: "uploadFile"; logic: PromiseActorLogic; id: string | undefined; }; }>, "src", TSrc>["logic"]>; (src: TLogic, ...[options]: ConditionalRequired<[options?: ({ id?: never; systemId?: string; input?: InputFrom | undefined; syncSnapshot?: boolean; } & { [K in RequiredLogicInput]: unknown; }) | undefined], IsNotNever>>): ActorRefFromLogic; }; input: { config: ElectronicSignatureConfig; fileDataHolder: ElectronicSignatureFileDataHolder; getFileData?: never; } | { config: ElectronicSignatureConfig; getFileData: () => ArrayBuffer | null; fileDataHolder?: never; }; self: ActorRef, StateValue, string, unknown, any, any>, { type: "LOAD"; } | { type: "SELECT_FILE"; fileName: string; fileSize: number; fileUrl: string; } | { type: "REPLACE_FILE"; } | { type: "CONFIRM_FILE"; } | { type: "SET_CONSENT"; name: ConsentKey; checked: boolean; } | { type: "VIEW_DOCUMENT"; url: string; } | { type: "CLOSE_DOCUMENT_VIEW"; } | { type: "SIGN"; } | { type: "FINISH"; } | { type: "RETRY"; } | { type: "CLOSE"; }, AnyEventObject>; }) => { config: ElectronicSignatureConfig; fileDataHolder: ElectronicSignatureFileDataHolder; documents: never[]; signedDocuments: never[]; fileName: null; fileSize: null; fileUrl: null; preSignedUrl: null; consentChecks: Partial>; viewingDocumentUrl: null; errorMessage: string; errorSource: null; }; readonly states: { readonly idle: { readonly on: { readonly LOAD: readonly [{ readonly target: "uploading"; readonly guard: "shouldUpload"; }, { readonly target: "fetchingDocs"; }]; }; }; readonly uploading: { readonly on: { readonly SELECT_FILE: { readonly target: "reviewing"; readonly actions: "setFile"; }; readonly CLOSE: { readonly target: "closed"; }; }; }; readonly reviewing: { readonly on: { readonly REPLACE_FILE: { readonly target: "uploading"; readonly actions: ActionFunction; id: string | undefined; }; signDocuments: { src: "signDocuments"; logic: PromiseActorLogic; id: string | undefined; }; generateUploadUrl: { src: "generateUploadUrl"; logic: PromiseActorLogic<{ preSignedUrl: string; }, void, EventObject>; id: string | undefined; }; uploadFile: { src: "uploadFile"; logic: PromiseActorLogic; id: string | undefined; }; }>, never, never, never, never>; }; readonly CONFIRM_FILE: readonly [{ readonly target: "uploadingFile"; readonly guard: "hasUploadUrl"; }, { readonly target: "generatingUploadUrl"; }]; readonly CLOSE: { readonly target: "closed"; }; }; }; readonly generatingUploadUrl: { readonly invoke: { readonly id: "generateUploadUrl"; readonly src: "generateUploadUrl"; readonly onDone: { readonly target: "uploadingFile"; readonly actions: "setUploadUrl"; }; readonly onError: { readonly target: "error"; readonly actions: ActionFunction, { type: "LOAD"; } | { type: "SELECT_FILE"; fileName: string; fileSize: number; fileUrl: string; } | { type: "REPLACE_FILE"; } | { type: "CONFIRM_FILE"; } | { type: "SET_CONSENT"; name: ConsentKey; checked: boolean; } | { type: "VIEW_DOCUMENT"; url: string; } | { type: "CLOSE_DOCUMENT_VIEW"; } | { type: "SIGN"; } | { type: "FINISH"; } | { type: "RETRY"; } | { type: "CLOSE"; }, undefined, Values<{ fetchUnsignedDocs: { src: "fetchUnsignedDocs"; logic: PromiseActorLogic; id: string | undefined; }; signDocuments: { src: "signDocuments"; logic: PromiseActorLogic; id: string | undefined; }; generateUploadUrl: { src: "generateUploadUrl"; logic: PromiseActorLogic<{ preSignedUrl: string; }, void, EventObject>; id: string | undefined; }; uploadFile: { src: "uploadFile"; logic: PromiseActorLogic; id: string | undefined; }; }>, never, never, never, never>; }; }; }; readonly uploadingFile: { readonly invoke: { readonly id: "uploadFile"; readonly src: "uploadFile"; readonly input: ({ context }: { context: ElectronicSignatureContext; event: { type: "LOAD"; } | { type: "SELECT_FILE"; fileName: string; fileSize: number; fileUrl: string; } | { type: "REPLACE_FILE"; } | { type: "CONFIRM_FILE"; } | { type: "SET_CONSENT"; name: ConsentKey; checked: boolean; } | { type: "VIEW_DOCUMENT"; url: string; } | { type: "CLOSE_DOCUMENT_VIEW"; } | { type: "SIGN"; } | { type: "FINISH"; } | { type: "RETRY"; } | { type: "CLOSE"; }; self: ActorRef, StateValue, string, unknown, any, any>, { type: "LOAD"; } | { type: "SELECT_FILE"; fileName: string; fileSize: number; fileUrl: string; } | { type: "REPLACE_FILE"; } | { type: "CONFIRM_FILE"; } | { type: "SET_CONSENT"; name: ConsentKey; checked: boolean; } | { type: "VIEW_DOCUMENT"; url: string; } | { type: "CLOSE_DOCUMENT_VIEW"; } | { type: "SIGN"; } | { type: "FINISH"; } | { type: "RETRY"; } | { type: "CLOSE"; }, AnyEventObject>; }) => { preSignedUrl: string; fileDataHolder: ElectronicSignatureFileDataHolder; }; readonly onDone: { readonly target: "fetchingDocs"; }; readonly onError: { readonly target: "error"; readonly actions: ActionFunction, { type: "LOAD"; } | { type: "SELECT_FILE"; fileName: string; fileSize: number; fileUrl: string; } | { type: "REPLACE_FILE"; } | { type: "CONFIRM_FILE"; } | { type: "SET_CONSENT"; name: ConsentKey; checked: boolean; } | { type: "VIEW_DOCUMENT"; url: string; } | { type: "CLOSE_DOCUMENT_VIEW"; } | { type: "SIGN"; } | { type: "FINISH"; } | { type: "RETRY"; } | { type: "CLOSE"; }, undefined, Values<{ fetchUnsignedDocs: { src: "fetchUnsignedDocs"; logic: PromiseActorLogic; id: string | undefined; }; signDocuments: { src: "signDocuments"; logic: PromiseActorLogic; id: string | undefined; }; generateUploadUrl: { src: "generateUploadUrl"; logic: PromiseActorLogic<{ preSignedUrl: string; }, void, EventObject>; id: string | undefined; }; uploadFile: { src: "uploadFile"; logic: PromiseActorLogic; id: string | undefined; }; }>, never, never, never, never>; }; }; }; readonly fetchingDocs: { readonly invoke: { readonly id: "fetchUnsignedDocs"; readonly src: "fetchUnsignedDocs"; readonly onDone: readonly [{ readonly target: "signing"; readonly guard: "hasDocuments"; readonly actions: "setDocuments"; }, { readonly target: "error"; readonly actions: ActionFunction, { type: "LOAD"; } | { type: "SELECT_FILE"; fileName: string; fileSize: number; fileUrl: string; } | { type: "REPLACE_FILE"; } | { type: "CONFIRM_FILE"; } | { type: "SET_CONSENT"; name: ConsentKey; checked: boolean; } | { type: "VIEW_DOCUMENT"; url: string; } | { type: "CLOSE_DOCUMENT_VIEW"; } | { type: "SIGN"; } | { type: "FINISH"; } | { type: "RETRY"; } | { type: "CLOSE"; }, undefined, Values<{ fetchUnsignedDocs: { src: "fetchUnsignedDocs"; logic: PromiseActorLogic; id: string | undefined; }; signDocuments: { src: "signDocuments"; logic: PromiseActorLogic; id: string | undefined; }; generateUploadUrl: { src: "generateUploadUrl"; logic: PromiseActorLogic<{ preSignedUrl: string; }, void, EventObject>; id: string | undefined; }; uploadFile: { src: "uploadFile"; logic: PromiseActorLogic; id: string | undefined; }; }>, never, never, never, never>; }]; readonly onError: { readonly target: "error"; readonly actions: ActionFunction, { type: "LOAD"; } | { type: "SELECT_FILE"; fileName: string; fileSize: number; fileUrl: string; } | { type: "REPLACE_FILE"; } | { type: "CONFIRM_FILE"; } | { type: "SET_CONSENT"; name: ConsentKey; checked: boolean; } | { type: "VIEW_DOCUMENT"; url: string; } | { type: "CLOSE_DOCUMENT_VIEW"; } | { type: "SIGN"; } | { type: "FINISH"; } | { type: "RETRY"; } | { type: "CLOSE"; }, undefined, Values<{ fetchUnsignedDocs: { src: "fetchUnsignedDocs"; logic: PromiseActorLogic; id: string | undefined; }; signDocuments: { src: "signDocuments"; logic: PromiseActorLogic; id: string | undefined; }; generateUploadUrl: { src: "generateUploadUrl"; logic: PromiseActorLogic<{ preSignedUrl: string; }, void, EventObject>; id: string | undefined; }; uploadFile: { src: "uploadFile"; logic: PromiseActorLogic; id: string | undefined; }; }>, never, never, never, never>; }; }; }; readonly signing: { readonly on: { readonly SET_CONSENT: { readonly actions: "updateConsent"; }; readonly VIEW_DOCUMENT: { readonly actions: "setViewingDocument"; }; readonly CLOSE_DOCUMENT_VIEW: { readonly actions: "clearViewingDocument"; }; readonly SIGN: { readonly target: "processing"; readonly guard: "allConsented"; }; readonly CLOSE: { readonly target: "closed"; }; }; }; readonly processing: { readonly invoke: { readonly id: "signDocuments"; readonly src: "signDocuments"; readonly input: ({ context }: { context: ElectronicSignatureContext; event: { type: "LOAD"; } | { type: "SELECT_FILE"; fileName: string; fileSize: number; fileUrl: string; } | { type: "REPLACE_FILE"; } | { type: "CONFIRM_FILE"; } | { type: "SET_CONSENT"; name: ConsentKey; checked: boolean; } | { type: "VIEW_DOCUMENT"; url: string; } | { type: "CLOSE_DOCUMENT_VIEW"; } | { type: "SIGN"; } | { type: "FINISH"; } | { type: "RETRY"; } | { type: "CLOSE"; }; self: ActorRef, StateValue, string, unknown, any, any>, { type: "LOAD"; } | { type: "SELECT_FILE"; fileName: string; fileSize: number; fileUrl: string; } | { type: "REPLACE_FILE"; } | { type: "CONFIRM_FILE"; } | { type: "SET_CONSENT"; name: ConsentKey; checked: boolean; } | { type: "VIEW_DOCUMENT"; url: string; } | { type: "CLOSE_DOCUMENT_VIEW"; } | { type: "SIGN"; } | { type: "FINISH"; } | { type: "RETRY"; } | { type: "CLOSE"; }, AnyEventObject>; }) => { documents: ElectronicSignatureDocument[]; variant: ElectronicSignatureVariant; }; readonly onDone: readonly [{ readonly target: "successDownload"; readonly guard: "allSignedAndDownload"; readonly actions: "setSignedDocuments"; }, { readonly target: "success"; readonly guard: "allSigned"; readonly actions: "setSignedDocuments"; }, { readonly target: "signError"; readonly actions: ActionFunction, { type: "LOAD"; } | { type: "SELECT_FILE"; fileName: string; fileSize: number; fileUrl: string; } | { type: "REPLACE_FILE"; } | { type: "CONFIRM_FILE"; } | { type: "SET_CONSENT"; name: ConsentKey; checked: boolean; } | { type: "VIEW_DOCUMENT"; url: string; } | { type: "CLOSE_DOCUMENT_VIEW"; } | { type: "SIGN"; } | { type: "FINISH"; } | { type: "RETRY"; } | { type: "CLOSE"; }, undefined, Values<{ fetchUnsignedDocs: { src: "fetchUnsignedDocs"; logic: PromiseActorLogic; id: string | undefined; }; signDocuments: { src: "signDocuments"; logic: PromiseActorLogic; id: string | undefined; }; generateUploadUrl: { src: "generateUploadUrl"; logic: PromiseActorLogic<{ preSignedUrl: string; }, void, EventObject>; id: string | undefined; }; uploadFile: { src: "uploadFile"; logic: PromiseActorLogic; id: string | undefined; }; }>, never, never, never, never>; }]; readonly onError: { readonly target: "signError"; readonly actions: ActionFunction, { type: "LOAD"; } | { type: "SELECT_FILE"; fileName: string; fileSize: number; fileUrl: string; } | { type: "REPLACE_FILE"; } | { type: "CONFIRM_FILE"; } | { type: "SET_CONSENT"; name: ConsentKey; checked: boolean; } | { type: "VIEW_DOCUMENT"; url: string; } | { type: "CLOSE_DOCUMENT_VIEW"; } | { type: "SIGN"; } | { type: "FINISH"; } | { type: "RETRY"; } | { type: "CLOSE"; }, undefined, Values<{ fetchUnsignedDocs: { src: "fetchUnsignedDocs"; logic: PromiseActorLogic; id: string | undefined; }; signDocuments: { src: "signDocuments"; logic: PromiseActorLogic; id: string | undefined; }; generateUploadUrl: { src: "generateUploadUrl"; logic: PromiseActorLogic<{ preSignedUrl: string; }, void, EventObject>; id: string | undefined; }; uploadFile: { src: "uploadFile"; logic: PromiseActorLogic; id: string | undefined; }; }>, never, never, never, never>; }; }; }; readonly success: { readonly after: { readonly 3000: "finished"; }; }; readonly successDownload: { readonly on: { readonly FINISH: { readonly target: "finished"; }; readonly CLOSE: { readonly target: "closed"; }; }; }; readonly signError: { readonly after: { readonly 3000: "finished"; }; }; readonly error: { readonly on: { readonly RETRY: readonly [{ readonly target: "uploading"; readonly guard: "errorFromUpload"; readonly actions: ActionFunction; id: string | undefined; }; signDocuments: { src: "signDocuments"; logic: PromiseActorLogic; id: string | undefined; }; generateUploadUrl: { src: "generateUploadUrl"; logic: PromiseActorLogic<{ preSignedUrl: string; }, void, EventObject>; id: string | undefined; }; uploadFile: { src: "uploadFile"; logic: PromiseActorLogic; id: string | undefined; }; }>, never, never, never, never>; }, { readonly target: "fetchingDocs"; readonly actions: ActionFunction; id: string | undefined; }; signDocuments: { src: "signDocuments"; logic: PromiseActorLogic; id: string | undefined; }; generateUploadUrl: { src: "generateUploadUrl"; logic: PromiseActorLogic<{ preSignedUrl: string; }, void, EventObject>; id: string | undefined; }; uploadFile: { src: "uploadFile"; logic: PromiseActorLogic; id: string | undefined; }; }>, never, never, never, never>; }]; readonly CLOSE: { readonly target: "closed"; }; }; }; readonly finished: { readonly type: "final"; }; readonly closed: { readonly type: "final"; }; }; }>; type ElectronicSignatureMachine = typeof electronicSignatureMachine; //#endregion //#region src/modules/electronic-signature/electronicSignatureActor.d.ts type ElectronicSignatureActor = ActorRefFrom; type CreateElectronicSignatureActorOptions = ElectronicSignatureInput; //#endregion //#region src/modules/electronic-signature/electronicSignatureManager.d.ts type ElectronicSignatureLoadingState = { status: 'loading'; }; type ElectronicSignatureUploadingState = { status: 'uploading'; fileName: string | null; }; type ElectronicSignatureReviewingState = { status: 'reviewing'; fileName: string; fileUrl: string; }; type ElectronicSignatureSigningState = { status: 'signing'; variant: ElectronicSignatureVariant; documents: ElectronicSignatureDocument[]; consentChecks: ConsentChecks; allConsented: boolean; viewingDocumentUrl: string | null; }; type ElectronicSignatureProcessingState = { status: 'processing'; }; type ElectronicSignatureSuccessState = { status: 'success'; signedDocuments: SignedDocument[]; downloadDocument: boolean; }; /** Recoverable: SDK shows Try Again; `onError` does NOT fire. */ type ElectronicSignatureErrorState = { status: 'error'; errorMessage: string; }; /** Signing failed: SDK shows error screen for 3s then auto-finishes. */ type ElectronicSignatureSignErrorState = { status: 'signError'; errorMessage: string; }; type ElectronicSignatureFinishedState = { status: 'finished'; }; type ElectronicSignatureClosedState = { status: 'closed'; }; type ElectronicSignatureState = ElectronicSignatureLoadingState | ElectronicSignatureUploadingState | ElectronicSignatureReviewingState | ElectronicSignatureSigningState | ElectronicSignatureProcessingState | ElectronicSignatureSuccessState | ElectronicSignatureErrorState | ElectronicSignatureSignErrorState | ElectronicSignatureFinishedState | ElectronicSignatureClosedState; /** * Creates an electronic-signature manager around a pre-built actor. * * The manager reads the file-data holder from the actor's input-derived * context, guaranteeing that `selectFile()` and the upload actor use the same * in-memory bytes. This supports actors created from `.provide()` machine * variants without exposing the actor through the manager. */ declare function createElectronicSignatureManagerFromActor(actor: ElectronicSignatureActor): Manager & { load(): void; setConsent(name: ConsentKey, checked: boolean): void; selectFile(fileName: string, fileData: ArrayBuffer, fileUrl: string): void; replaceFile(): void; confirmFile(): void; viewDocument(url: string): void; closeDocumentView(): void; sign(): void; finish(): void; retry(): void; close(): void; }; declare function createElectronicSignatureManager(options: { config: CreateElectronicSignatureActorOptions['config']; }): Manager & { load(): void; setConsent(name: ConsentKey, checked: boolean): void; selectFile(fileName: string, fileData: ArrayBuffer, fileUrl: string): void; replaceFile(): void; confirmFile(): void; viewDocument(url: string): void; closeDocumentView(): void; sign(): void; finish(): void; retry(): void; close(): void; }; type ElectronicSignatureManager = ReturnType; //#endregion export { ElectronicSignatureActor as a, createElectronicSignatureManagerFromActor as i, ElectronicSignatureState as n, electronicSignatureMachine as o, createElectronicSignatureManager as r, ElectronicSignatureManager as t };