@usefillo/dom 0.10.0 → 0.12.0

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/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Field, FieldValue, FormSchema, FilloClient, ResponseData, FormStatus as FormStatus$1, FormPage, Block, FilloRespondent, CodeForm, FormTheme, FieldKind, FilloError, FormControllerOptions, FormController } from '@usefillo/core';
1
+ import { Field, FieldValue, FormSchema, FilloClient, ResponseData, FormStatus as FormStatus$1, FormPage, Block, FilloRespondent, CodeForm, FormTheme, ChallengeConfig, FieldKind, FilloError, FormControllerOptions, FormController } from '@usefillo/core';
2
2
  export { CodeForm, Field, FieldKind, FieldValue, FileValue, FilloClient, FilloClientOptions, FilloError, FormController, FormControllerOptions, FormControllerState, FormSchema, FormTheme, ProvisionWorkspaceResult, ResponseData, createClient, defineForm, provisionWorkspace } from '@usefillo/core';
3
3
 
4
4
  type FormStatus = FormStatus$1 | "loading" | "closed";
@@ -34,7 +34,6 @@ interface FieldRenderContext {
34
34
  uploadFiles?: (field: Extract<Field, {
35
35
  kind: "file_upload";
36
36
  }>, files: File[]) => Promise<void>;
37
- uploadProgress?: Map<string, number>;
38
37
  }
39
38
  interface FilloDomFieldIds {
40
39
  inputId: string;
@@ -44,10 +43,7 @@ interface FilloDomFieldIds {
44
43
  name: string;
45
44
  }
46
45
  type FieldRenderer = (context: FieldRenderContext) => HTMLElement | null;
47
- interface RenderFormOptions {
48
- form?: FormSchema | CodeForm;
49
- client?: FilloClient;
50
- formId?: string;
46
+ interface RenderFormBaseOptions {
51
47
  theme?: FormTheme;
52
48
  initialData?: ResponseData;
53
49
  /**
@@ -56,6 +52,13 @@ interface RenderFormOptions {
56
52
  * unverified claim. Late-bind with setRespondent() once a session loads.
57
53
  */
58
54
  respondent?: FilloRespondent;
55
+ /**
56
+ * Human-verification challenge config (public site key + provider). Normally
57
+ * read from the form fetch/sync automatically; pass it explicitly only when
58
+ * rendering an inline `form` schema and still wanting the widget (Fillo's
59
+ * hosted page does this). Wins over anything the server delivers.
60
+ */
61
+ challenge?: ChallengeConfig;
59
62
  className?: string;
60
63
  components?: Partial<Record<FieldKind, FieldRenderer>>;
61
64
  customComponents?: Record<string, FieldRenderer>;
@@ -80,6 +83,32 @@ interface RenderFormOptions {
80
83
  renderSuccess?: (api: FilloDomApi) => HTMLElement;
81
84
  renderError?: (error: FilloError) => HTMLElement;
82
85
  }
86
+ type HostedRenderFormOptions = RenderFormBaseOptions & {
87
+ formId: string;
88
+ form?: undefined;
89
+ client?: FilloClient;
90
+ renderOnly?: false;
91
+ };
92
+ type InlineTargetedRenderFormOptions = RenderFormBaseOptions & {
93
+ form: FormSchema | CodeForm;
94
+ formId: string;
95
+ client?: FilloClient;
96
+ renderOnly?: false;
97
+ };
98
+ type CodeBackedRenderFormOptions = RenderFormBaseOptions & {
99
+ form: CodeForm;
100
+ client: FilloClient;
101
+ formId?: undefined;
102
+ renderOnly?: false;
103
+ };
104
+ type RenderOnlyFormOptions = RenderFormBaseOptions & {
105
+ form: FormSchema | CodeForm;
106
+ client?: FilloClient;
107
+ formId?: string;
108
+ /** Explicit local preview: submission, uploads, and saved progress are disabled. */
109
+ renderOnly: true;
110
+ };
111
+ type RenderFormOptions = HostedRenderFormOptions | InlineTargetedRenderFormOptions | CodeBackedRenderFormOptions | RenderOnlyFormOptions;
83
112
  interface FilloDomForm {
84
113
  readonly element: HTMLElement;
85
114
  readonly status: FormStatus;
@@ -127,6 +156,8 @@ declare class FilloFormElement extends HTMLElementBase {
127
156
  * them, and a stringified `false` must never enable dev chrome for real
128
157
  * respondents. Disable by removing the attribute or setting it to "false". */
129
158
  private previewAttrEnabled;
159
+ /** Explicit local-preview mode for custom-element integrations. */
160
+ private renderOnlyAttrEnabled;
130
161
  private mount;
131
162
  }
132
163
  declare function registerFilloElement(name?: string): void;