@fayz-ai/forms 0.0.0-stage → 0.1.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.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +34 -2
  3. package/dist/chunk-2KVTEW7I.js +211 -0
  4. package/dist/chunk-2KVTEW7I.js.map +1 -0
  5. package/dist/chunk-JO4REIZC.js +429 -0
  6. package/dist/chunk-JO4REIZC.js.map +1 -0
  7. package/dist/chunk-L2KPTYH4.js +11 -0
  8. package/dist/chunk-L2KPTYH4.js.map +1 -0
  9. package/dist/chunk-LQJONAVT.js +25 -0
  10. package/dist/chunk-LQJONAVT.js.map +1 -0
  11. package/dist/data/mock.d.ts +3 -0
  12. package/dist/data/mock.d.ts.map +1 -0
  13. package/dist/data/mock.js +4 -0
  14. package/dist/data/mock.js.map +1 -0
  15. package/dist/data/provider.d.ts +55 -0
  16. package/dist/data/provider.d.ts.map +1 -0
  17. package/dist/data/provider.js +3 -0
  18. package/dist/data/provider.js.map +1 -0
  19. package/dist/data/supabase.d.ts +6 -0
  20. package/dist/data/supabase.d.ts.map +1 -0
  21. package/dist/data/supabase.js +4 -0
  22. package/dist/data/supabase.js.map +1 -0
  23. package/dist/data/tables.d.ts +7 -0
  24. package/dist/data/tables.d.ts.map +1 -0
  25. package/dist/data/tables.js +3 -0
  26. package/dist/data/tables.js.map +1 -0
  27. package/dist/domain/document.d.ts +84 -0
  28. package/dist/domain/document.d.ts.map +1 -0
  29. package/dist/domain/document.js +3 -0
  30. package/dist/domain/document.js.map +1 -0
  31. package/dist/domain/requirement.d.ts +27 -0
  32. package/dist/domain/requirement.d.ts.map +1 -0
  33. package/dist/domain/requirement.js +3 -0
  34. package/dist/domain/requirement.js.map +1 -0
  35. package/dist/domain/template.d.ts +135 -0
  36. package/dist/domain/template.d.ts.map +1 -0
  37. package/dist/domain/template.js +3 -0
  38. package/dist/domain/template.js.map +1 -0
  39. package/dist/store.d.ts +37 -0
  40. package/dist/store.d.ts.map +1 -0
  41. package/dist/store.js +138 -0
  42. package/dist/store.js.map +1 -0
  43. package/dist/views/zones.d.ts +75 -0
  44. package/dist/views/zones.d.ts.map +1 -0
  45. package/dist/views/zones.js +11 -0
  46. package/dist/views/zones.js.map +1 -0
  47. package/package.json +48 -3
@@ -0,0 +1,75 @@
1
+ import type { FormTemplate, RecommendationLine } from '../domain/template';
2
+ /**
3
+ * Widget zones other surfaces render with a `WidgetSlot` to show a forms screen in place.
4
+ * The forms plugin fills them; a host whose app mounts no forms manifest gets an empty zone.
5
+ */
6
+ export declare const FORMS_ZONES: {
7
+ /** The person's checklist: required forms plus the host's own items. Props: {@link PersonChecklistSlotProps}. */
8
+ readonly personChecklist: "forms.person-checklist";
9
+ /** Fill one form for a person. Props: {@link FormFillSlotProps}. */
10
+ readonly formFill: "forms.form-fill";
11
+ };
12
+ /** One checklist line, the same shape for a form, a task or a notice. */
13
+ export interface PersonChecklistItem {
14
+ id: string;
15
+ label: string;
16
+ /** `late` is what expired. */
17
+ state: 'done' | 'todo' | 'late';
18
+ /** "válido até …", "venceu em …", "nunca preenchido". */
19
+ detail?: string;
20
+ action?: {
21
+ label: string;
22
+ onClick: () => void;
23
+ };
24
+ }
25
+ export interface PersonChecklistSlotProps {
26
+ personId: string | null | undefined;
27
+ /** Open a form to fill now; without it the checklist only informs. */
28
+ onFill?: (templateId: string) => void;
29
+ /** Bump after a save so the list re-reads. */
30
+ version?: number;
31
+ /** The host's own checks, listed with the forms. */
32
+ extras?: PersonChecklistItem[];
33
+ /** Labels still open, so the host can hold its confirm button and say why. */
34
+ onPending?: (labels: string[]) => void;
35
+ /**
36
+ * The QR / WhatsApp link for the patient to fill the forms at home. Opt-in per host; `'soon'`
37
+ * shows the entry point disabled until the public link exists (FAY-1613).
38
+ */
39
+ sendLink?: 'soon' | (() => void);
40
+ className?: string;
41
+ }
42
+ /** What a fill hands back: the saved answer and every `recommendation` line in it. */
43
+ export interface FormFillResult {
44
+ documentId: string;
45
+ template: FormTemplate;
46
+ data: Record<string, unknown>;
47
+ recommendations: RecommendationLine[];
48
+ }
49
+ /** A service the host offers as a one-tap line in a `recommendation` field. */
50
+ export interface RecommendationShortcut {
51
+ serviceId: string;
52
+ name: string;
53
+ unitPrice: number;
54
+ hint?: string;
55
+ }
56
+ export interface FormFillSlotProps {
57
+ templateId: string;
58
+ personId: string;
59
+ personName?: string | null;
60
+ /** After saving — the attendance ruler re-reads and the step closes itself. */
61
+ onSaved?: (saved: FormFillResult) => void | Promise<void>;
62
+ /** What the answer hangs on (the attendance ruler passes the appointment). */
63
+ subject?: {
64
+ type: string;
65
+ id: string;
66
+ };
67
+ /** The service a service-scoped form refers to. */
68
+ productId?: string | null;
69
+ professionalId?: string | null;
70
+ recommendationShortcuts?: RecommendationShortcut[];
71
+ onClose: () => void;
72
+ /** `inline` renders only the form, for a host that frames it itself. */
73
+ frame?: 'modal' | 'inline';
74
+ }
75
+ //# sourceMappingURL=zones.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zones.d.ts","sourceRoot":"","sources":["../../src/views/zones.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAE1E;;;GAGG;AACH,eAAO,MAAM,WAAW;IACtB,iHAAiH;;IAEjH,oEAAoE;;CAE5D,CAAA;AAEV,yEAAyE;AACzE,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,8BAA8B;IAC9B,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;IAC/B,yDAAyD;IACzD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,IAAI,CAAA;KAAE,CAAA;CAChD;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,MAA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AA;IACzB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,uBAAuB,CAAC,EAAE,sBAAsB,EAAE,CAAA;IAClD,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,wEAAwE;IACxE,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;CAC3B"}
@@ -0,0 +1,11 @@
1
+ // src/views/zones.ts
2
+ var FORMS_ZONES = {
3
+ /** The person's checklist: required forms plus the host's own items. Props: {@link PersonChecklistSlotProps}. */
4
+ personChecklist: "forms.person-checklist",
5
+ /** Fill one form for a person. Props: {@link FormFillSlotProps}. */
6
+ formFill: "forms.form-fill"
7
+ };
8
+
9
+ export { FORMS_ZONES };
10
+ //# sourceMappingURL=zones.js.map
11
+ //# sourceMappingURL=zones.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/views/zones.ts"],"names":[],"mappings":";AAMO,IAAM,WAAA,GAAc;AAAA;AAAA,EAEzB,eAAA,EAAiB,wBAAA;AAAA;AAAA,EAEjB,QAAA,EAAU;AACZ","file":"zones.js","sourcesContent":["import type { FormTemplate, RecommendationLine } from '../domain/template'\n\n/**\n * Widget zones other surfaces render with a `WidgetSlot` to show a forms screen in place.\n * The forms plugin fills them; a host whose app mounts no forms manifest gets an empty zone.\n */\nexport const FORMS_ZONES = {\n /** The person's checklist: required forms plus the host's own items. Props: {@link PersonChecklistSlotProps}. */\n personChecklist: 'forms.person-checklist',\n /** Fill one form for a person. Props: {@link FormFillSlotProps}. */\n formFill: 'forms.form-fill',\n} as const\n\n/** One checklist line, the same shape for a form, a task or a notice. */\nexport interface PersonChecklistItem {\n id: string\n label: string\n /** `late` is what expired. */\n state: 'done' | 'todo' | 'late'\n /** \"válido até …\", \"venceu em …\", \"nunca preenchido\". */\n detail?: string\n action?: { label: string; onClick: () => void }\n}\n\nexport interface PersonChecklistSlotProps {\n personId: string | null | undefined\n /** Open a form to fill now; without it the checklist only informs. */\n onFill?: (templateId: string) => void\n /** Bump after a save so the list re-reads. */\n version?: number\n /** The host's own checks, listed with the forms. */\n extras?: PersonChecklistItem[]\n /** Labels still open, so the host can hold its confirm button and say why. */\n onPending?: (labels: string[]) => void\n /**\n * The QR / WhatsApp link for the patient to fill the forms at home. Opt-in per host; `'soon'`\n * shows the entry point disabled until the public link exists (FAY-1613).\n */\n sendLink?: 'soon' | (() => void)\n className?: string\n}\n\n/** What a fill hands back: the saved answer and every `recommendation` line in it. */\nexport interface FormFillResult {\n documentId: string\n template: FormTemplate\n data: Record<string, unknown>\n recommendations: RecommendationLine[]\n}\n\n/** A service the host offers as a one-tap line in a `recommendation` field. */\nexport interface RecommendationShortcut {\n serviceId: string\n name: string\n unitPrice: number\n hint?: string\n}\n\nexport interface FormFillSlotProps {\n templateId: string\n personId: string\n personName?: string | null\n /** After saving — the attendance ruler re-reads and the step closes itself. */\n onSaved?: (saved: FormFillResult) => void | Promise<void>\n /** What the answer hangs on (the attendance ruler passes the appointment). */\n subject?: { type: string; id: string }\n /** The service a service-scoped form refers to. */\n productId?: string | null\n professionalId?: string | null\n recommendationShortcuts?: RecommendationShortcut[]\n onClose: () => void\n /** `inline` renders only the form, for a host that frames it itself. */\n frame?: 'modal' | 'inline'\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,51 @@
1
1
  {
2
2
  "name": "@fayz-ai/forms",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "fayz": {
4
+ "status": "beta"
5
+ },
6
+ "version": "0.1.0",
7
+ "description": "Fayz SDK forms context — templates, filled documents and the forms a person must have: the domain rules, the repository port and its adapters, the store, and the widget zones other plugins render",
8
+ "type": "module",
9
+ "sideEffects": false,
10
+ "exports": {
11
+ "./*": {
12
+ "types": "./dist/*.d.ts",
13
+ "import": "./dist/*.js"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "peerDependencies": {
20
+ "@supabase/supabase-js": "^2.45.0",
21
+ "react": "^18.0.0 || ^19.0.0",
22
+ "zustand": "^4.5.0 || ^5.0.0"
23
+ },
24
+ "dependencies": {
25
+ "@fayz-ai/core": "^0.48.0"
26
+ },
27
+ "devDependencies": {
28
+ "@supabase/supabase-js": "^2.45.0",
29
+ "@types/react": "^18.3.0",
30
+ "react": "^18.3.0",
31
+ "tsup": "^8.2.0",
32
+ "typescript": "^5.5.0",
33
+ "vitest": "^4.1.5",
34
+ "zustand": "^4.5.0"
35
+ },
36
+ "license": "MIT",
37
+ "keywords": [
38
+ "fayz",
39
+ "forms"
40
+ ],
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "scripts": {
45
+ "build": "tsup && tsc -b --force",
46
+ "dev": "tsup --watch",
47
+ "typecheck": "tsc -b tsconfig.test.json",
48
+ "test": "vitest run",
49
+ "clean": "rm -rf dist .tsbuildinfo"
50
+ }
6
51
  }