@usefillo/dom 0.6.2 → 0.8.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/README.md +8 -5
- package/dist/index.d.ts +14 -1
- package/dist/index.js +593 -136
- package/dist/standalone.global.js +1 -1
- package/dist/styles.css +37 -0
- package/dist/styles.unlayered.css +37 -0
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ npm i @usefillo/dom
|
|
|
12
12
|
import { renderForm } from "@usefillo/dom";
|
|
13
13
|
import "@usefillo/dom/styles.css"; // optional default theme — or bring your own
|
|
14
14
|
|
|
15
|
-
renderForm(
|
|
15
|
+
renderForm("#fillo-form", {
|
|
16
16
|
formId: "cust-feedback",
|
|
17
17
|
onSubmitted: (id) => console.log("response", id),
|
|
18
18
|
});
|
|
@@ -32,7 +32,7 @@ const form = defineForm({
|
|
|
32
32
|
] }],
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
renderForm(
|
|
35
|
+
renderForm("#fillo-form", {
|
|
36
36
|
form,
|
|
37
37
|
client,
|
|
38
38
|
onSubmitted: (id) => console.log("response", id),
|
|
@@ -47,15 +47,18 @@ Or drop it in with a single script tag — the bundle exposes a global `Fillo`:
|
|
|
47
47
|
<script>
|
|
48
48
|
const client = Fillo.createClient({ key: "pk_…" });
|
|
49
49
|
const form = Fillo.defineForm({ id: "cust-feedback", pages: [/* … */] });
|
|
50
|
-
Fillo.renderForm(
|
|
50
|
+
Fillo.renderForm("#fillo-form", { form, client });
|
|
51
51
|
</script>
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
For tiny feedback widgets, set `settings.submitMode: "auto"` on a select/rating/checkbox/dropdown/linear scale form. The default renderer hides the first submit button, submits after a complete discrete answer, and brings the submit button back if that answer opens a text or upload follow-up. Add `
|
|
54
|
+
For tiny feedback widgets, set `settings.submitMode: "auto"` on a select/rating/checkbox/dropdown/linear scale form. The default renderer hides the first submit button, submits after a complete discrete answer, and brings the submit button back if that answer opens a text or upload follow-up. Add `responseLimit: { by: "browser", onRepeat: "keep" }` for browser-scoped one-response feedback.
|
|
55
55
|
|
|
56
56
|
The default stylesheet follows system dark mode for unthemed embeds. Pass `theme: { colorScheme: "dark" }` or `"light"` when the host surface is known.
|
|
57
57
|
|
|
58
|
-
Re-exports the core
|
|
58
|
+
Re-exports the core pieces used by DOM integrations from
|
|
59
|
+
[`@usefillo/core`](https://www.npmjs.com/package/@usefillo/core), including
|
|
60
|
+
`createClient`, `defineForm`, `FilloClient`, `createFormController`, and the
|
|
61
|
+
schema/value types.
|
|
59
62
|
|
|
60
63
|
## Links
|
|
61
64
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Field, FieldValue, FormSchema, FilloClient, ResponseData, FormStatus as FormStatus$1, FormPage, Block, 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, 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";
|
|
@@ -50,6 +50,12 @@ interface RenderFormOptions {
|
|
|
50
50
|
formId?: string;
|
|
51
51
|
theme?: FormTheme;
|
|
52
52
|
initialData?: ResponseData;
|
|
53
|
+
/**
|
|
54
|
+
* identify(): the host app's account context for the person filling the
|
|
55
|
+
* form ({ id, email?, name?, traits? }). Recorded with the response as an
|
|
56
|
+
* unverified claim. Late-bind with setRespondent() once a session loads.
|
|
57
|
+
*/
|
|
58
|
+
respondent?: FilloRespondent;
|
|
53
59
|
className?: string;
|
|
54
60
|
components?: Partial<Record<FieldKind, FieldRenderer>>;
|
|
55
61
|
customComponents?: Record<string, FieldRenderer>;
|
|
@@ -68,6 +74,13 @@ interface FilloDomForm {
|
|
|
68
74
|
next(): void;
|
|
69
75
|
back(): void;
|
|
70
76
|
submit(): Promise<void>;
|
|
77
|
+
/** Late-bind identify() context once the host session loads. */
|
|
78
|
+
setRespondent(respondent: FilloRespondent | undefined): void;
|
|
79
|
+
/** Persist unsaved saved-progress answers now (settings.saveProgress forms).
|
|
80
|
+
* The renderer already flushes on pagehide/visibility-hidden. */
|
|
81
|
+
flushDraft(): void;
|
|
82
|
+
/** Discard the saved draft and reset to a fresh fill ("Start over"). */
|
|
83
|
+
resetDraft(): void;
|
|
71
84
|
destroy(): void;
|
|
72
85
|
}
|
|
73
86
|
declare function renderForm(target: HTMLElement | string, options: RenderFormOptions): FilloDomForm;
|