import { type HTMLAttributes, type ReactNode } from 'react'; /** The fields of the step, in the order they appear. */ export declare const WORKFLOW_WEBHOOK_ACTION_FIELDS: readonly ["url", "secret", "legalBasisConfirmed", "parameters"]; export type WorkflowWebhookActionField = (typeof WORKFLOW_WEBHOOK_ACTION_FIELDS)[number]; /** One parameter value as the platform stores it: a flat scalar. */ export type WorkflowWebhookParameterValue = string | number | boolean | null; /** What the step holds now. Mirrors the platform's * `SendHttpRequestWorkflowActionDto`. */ export interface WorkflowWebhookActionValues { /** Where the message goes: platform `url`. */ url: string; /** * A new signing secret: platform `secret`, stored encrypted as * `encryptedSecret`. Empty means "keep the saved one". The server never * sends a saved secret back. */ secret: string; /** The extra parameters: platform `parameters`, a flat map of scalars. */ parameters: Record; /** The consent box: platform `legalBasisConfirmed`. */ legalBasisConfirmed: boolean; } /** Values to show when the fields open. There is no secret here, on * purpose: a saved secret is never sent back to the browser. */ export type WorkflowWebhookActionInitialValues = Partial>; /** Messages from the server, already translated, one per field. */ export type WorkflowWebhookActionErrors = Partial>; /** The host's own form field names, for a native form post. */ export type WorkflowWebhookActionFieldNames = Record; /** A variable the user can insert into a parameter value. */ export interface WorkflowWebhookActionPlaceholder { /** The code the server replaces, such as `[[NOME]]`. */ value: string; /** What the user reads, translated, such as "First name". */ label: string; } /** * What a test message got back, as the host's server saw it. * `answered`: the app replied with this HTTP status. `unreachable`: no * reply at all (the address does not resolve, refuses, times out or has * no valid certificate). `message` replaces the fields' own words, already * translated, when the server knows better. */ export type WorkflowWebhookTestResult = { outcome: 'answered'; status: number; message?: string; } | { outcome: 'unreachable'; message?: string; }; export interface WorkflowWebhookActionProps extends Omit, 'children' | 'onChange'> { /** * Host content above the fields, such as the plan notice ("Included in * the trial and the Elite plans"). Nothing in it is posted. */ children?: ReactNode; /** * Values to show when the fields open. Read once. Parameters keep the * order and the names they are given; a number beyond * `Number.MAX_SAFE_INTEGER` has already lost precision by the time it * arrives here. */ initialValues?: WorkflowWebhookActionInitialValues; /** * True when the step already has a secret. The secret field is then * optional: left empty, the saved secret stays. */ hasSavedSecret?: boolean; /** * Messages from the server, already translated. A field's message shows * until the user changes that field; when the fields open with * messages, focus goes to the first one. A message on `parameters` * opens the Advanced section. * * A React host keeps `errors` in state: each new object is a new answer * from the server, shown even when its words match the last one. */ errors?: WorkflowWebhookActionErrors; /** * For a native form post: the host's own field names. The parameters * post as one JSON object, or an empty string when there are none. The * consent box posts `1` when ticked and nothing when not. The fields * must sit inside the host's `
`. */ fieldNames?: WorkflowWebhookActionFieldNames; /** * The variables the user can insert into a parameter value, listed in * Advanced with a copy button each. Default: the three the platform * replaces in a webhook step (salutation, first name, last name), with * the kit's own labels. An empty list hides the menu and the list. */ placeholders?: ReadonlyArray; /** * Shows "Send test". Called with the values when the user asks for a * test, once the address and the secret pass their checks; the host's * server sends a sample message (invented IDs, no patient data, marked * as a test) signed with that secret, or with the saved one when * `secret` is empty, and resolves with what came back. A rejected * promise reads as "the test could not be sent". Without it, no button. */ onSendTest?: (values: WorkflowWebhookActionValues) => Promise; /** For React hosts: called with the values after each change. */ onValueChange?: (values: WorkflowWebhookActionValues) => void; /** * How the "What Alfadocs sends" card lays out the message body and its * headers. `two-column` (default): side by side once the fields are * 720px wide; narrower, as on a phone, one above the other. * `one-column`: always one above the other, for a narrow card or a side * panel. */ layout?: 'two-column' | 'one-column'; } /** * The fields of a workflow's webhook step. Mount it inside the host's * form, between the page title and the Save button. */ export declare const WorkflowWebhookAction: import("react").ForwardRefExoticComponent>; //# sourceMappingURL=workflow-webhook-action.d.ts.map