@burdenoff/microfe-govcitizenhub 2026.720.3 → 2026.720.5

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 (26) hide show
  1. package/dist/govcitizenhub/components/DynamicFormFields.d.ts +17 -0
  2. package/dist/govcitizenhub/components/DynamicFormFields.d.ts.map +1 -0
  3. package/dist/govcitizenhub/components/DynamicFormFields.js +101 -0
  4. package/dist/govcitizenhub/components/DynamicFormFields.js.map +1 -0
  5. package/dist/govcitizenhub/components/mobile/BottomTabNav.d.ts.map +1 -1
  6. package/dist/govcitizenhub/components/mobile/BottomTabNav.js +11 -8
  7. package/dist/govcitizenhub/components/mobile/BottomTabNav.js.map +1 -1
  8. package/dist/govcitizenhub/pages/applications/ApplicationsPage.d.ts.map +1 -1
  9. package/dist/govcitizenhub/pages/applications/ApplicationsPage.js +170 -150
  10. package/dist/govcitizenhub/pages/applications/ApplicationsPage.js.map +1 -1
  11. package/dist/govcitizenhub/pages/applications/NewApplicationPage.d.ts +9 -5
  12. package/dist/govcitizenhub/pages/applications/NewApplicationPage.d.ts.map +1 -1
  13. package/dist/govcitizenhub/pages/applications/NewApplicationPage.js +148 -244
  14. package/dist/govcitizenhub/pages/applications/NewApplicationPage.js.map +1 -1
  15. package/dist/govcitizenhub/pages/services/FormFieldBuilder.d.ts +7 -28
  16. package/dist/govcitizenhub/pages/services/FormFieldBuilder.d.ts.map +1 -1
  17. package/dist/govcitizenhub/pages/services/FormFieldBuilder.js +203 -136
  18. package/dist/govcitizenhub/pages/services/FormFieldBuilder.js.map +1 -1
  19. package/dist/govcitizenhub/pages/services/ServiceFormDialog.d.ts.map +1 -1
  20. package/dist/govcitizenhub/pages/services/ServiceFormDialog.js +156 -114
  21. package/dist/govcitizenhub/pages/services/ServiceFormDialog.js.map +1 -1
  22. package/dist/govcitizenhub/utils/dynamicForm.d.ts +46 -0
  23. package/dist/govcitizenhub/utils/dynamicForm.d.ts.map +1 -0
  24. package/dist/govcitizenhub/utils/dynamicForm.js +59 -0
  25. package/dist/govcitizenhub/utils/dynamicForm.js.map +1 -0
  26. package/package.json +1 -1
@@ -0,0 +1,59 @@
1
+ //#region src/govcitizenhub/utils/dynamicForm.ts
2
+ function e(e, t) {
3
+ let n = String(e ?? "").toLowerCase();
4
+ return t || n === "select" || n === "choice" || n === "enum" ? "select" : n.includes("area") || n === "textarea" || n === "multiline" || n === "paragraph" ? "textarea" : n === "number" || n === "integer" || n === "float" ? "number" : n === "date" || n === "datetime" ? "date" : n === "file" || n === "upload" ? "file" : "text";
5
+ }
6
+ function t(e) {
7
+ if (!e || typeof e != "object") return;
8
+ let t = e, n = typeof t.fieldKey == "string" ? t.fieldKey : void 0, r = typeof t.equals == "string" ? t.equals : void 0;
9
+ if (!(!n || r === void 0)) return {
10
+ fieldKey: n,
11
+ equals: r
12
+ };
13
+ }
14
+ function n(n, r) {
15
+ if (!n || typeof n != "object") return null;
16
+ let i = n, a = String(i.label ?? i.title ?? i.name ?? i.key ?? r), o = String(i.key ?? i.name ?? i.id ?? r), s = Array.isArray(i.options) ? i.options.map((e) => String(e)) : Array.isArray(i.enum) ? i.enum.map((e) => String(e)) : void 0, c = e(i.type, !!(s && s.length)), l = t(i.showIf);
17
+ return {
18
+ key: o,
19
+ label: a,
20
+ type: c,
21
+ required: !!i.required,
22
+ ...c === "select" ? { options: s ?? [] } : {},
23
+ ...l ? { showIf: l } : {}
24
+ };
25
+ }
26
+ function r(e) {
27
+ if (Array.isArray(e)) return e.map((e, t) => n(e, `field_${t + 1}`)).filter((e) => !!e);
28
+ if (e && typeof e == "object") {
29
+ let t = e;
30
+ if (Array.isArray(t.fields)) return t.fields.map((e, t) => n(e, `field_${t + 1}`)).filter((e) => !!e);
31
+ if (t.properties && typeof t.properties == "object") return Object.entries(t.properties).map(([e, t]) => n({
32
+ ...t,
33
+ key: e
34
+ }, e)).filter((e) => !!e);
35
+ }
36
+ return [];
37
+ }
38
+ function i(e) {
39
+ return e.length === 0 ? null : e.map((e) => ({
40
+ key: e.key,
41
+ label: e.label,
42
+ type: e.type,
43
+ required: e.required,
44
+ ...e.type === "select" ? { options: e.options ?? [] } : {},
45
+ ...e.showIf ? { showIf: e.showIf } : {}
46
+ }));
47
+ }
48
+ function a(e, t, n, r = /* @__PURE__ */ new Set()) {
49
+ let i = e.showIf;
50
+ if (!i || r.has(e.key)) return !0;
51
+ let o = n.find((e) => e.key === i.fieldKey);
52
+ if (!o) return !0;
53
+ let s = new Set(r);
54
+ return s.add(e.key), a(o, t, n, s) ? (t[i.fieldKey] ?? "") === i.equals : !0;
55
+ }
56
+ //#endregion
57
+ export { a as isFieldVisible, r as parseFormFields, i as serializeFormFields };
58
+
59
+ //# sourceMappingURL=dynamicForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamicForm.js","names":[],"sources":["../../../src/govcitizenhub/utils/dynamicForm.ts"],"sourcesContent":["/**\n * Shared dynamic-form parsing/visibility logic for a service's `formSchema`.\n * @module govcitizenhub/utils/dynamicForm\n *\n * Single source of truth for the array `formSchema` shape produced by the\n * no-code service builder (`FormFieldBuilder`) and consumed by the citizen\n * application form (`NewApplicationPage`) and the builder's own live preview\n * (`DynamicFormFields` used inside `ServiceFormDialog`). Keeping the parse +\n * visibility logic in one place (rather than duplicated per page, as it was\n * before BOFF-4540) means the builder's preview can never drift from what a\n * citizen actually sees.\n */\n\nexport type DynamicFieldType = 'text' | 'textarea' | 'number' | 'date' | 'select' | 'file';\n\n/** A field is only rendered/required when the referenced earlier field equals this value. */\nexport interface DynamicFieldCondition {\n fieldKey: string;\n equals: string;\n}\n\nexport interface DynamicFormField {\n key: string;\n label: string;\n type: DynamicFieldType;\n required: boolean;\n options?: string[];\n showIf?: DynamicFieldCondition;\n}\n\nfunction coerceType(raw: unknown, hasOptions: boolean): DynamicFieldType {\n const t = String(raw ?? '').toLowerCase();\n if (hasOptions || t === 'select' || t === 'choice' || t === 'enum') return 'select';\n if (t.includes('area') || t === 'textarea' || t === 'multiline' || t === 'paragraph')\n return 'textarea';\n if (t === 'number' || t === 'integer' || t === 'float') return 'number';\n if (t === 'date' || t === 'datetime') return 'date';\n if (t === 'file' || t === 'upload') return 'file';\n return 'text';\n}\n\nfunction coerceCondition(raw: unknown): DynamicFieldCondition | undefined {\n if (!raw || typeof raw !== 'object') return undefined;\n const r = raw as Record<string, unknown>;\n const fieldKey = typeof r.fieldKey === 'string' ? r.fieldKey : undefined;\n const equals = typeof r.equals === 'string' ? r.equals : undefined;\n if (!fieldKey || equals === undefined) return undefined;\n return { fieldKey, equals };\n}\n\nfunction toField(raw: unknown, fallbackKey: string): DynamicFormField | null {\n if (!raw || typeof raw !== 'object') return null;\n const r = raw as Record<string, unknown>;\n const label = String(r.label ?? r.title ?? r.name ?? r.key ?? fallbackKey);\n const key = String(r.key ?? r.name ?? r.id ?? fallbackKey);\n const options = Array.isArray(r.options)\n ? r.options.map((o) => String(o))\n : Array.isArray(r.enum)\n ? r.enum.map((o) => String(o))\n : undefined;\n const type = coerceType(r.type, Boolean(options && options.length));\n const showIf = coerceCondition(r.showIf);\n return {\n key,\n label,\n type,\n required: Boolean(r.required),\n ...(type === 'select' ? { options: options ?? [] } : {}),\n ...(showIf ? { showIf } : {}),\n };\n}\n\n/**\n * Coerce an opaque `formSchema` JSON into the canonical DynamicFormField[] shape.\n * Kept tolerant so a schema authored elsewhere (bare array, `{ fields }`, or a\n * json-schema-ish `{ properties }`) still parses.\n */\nexport function parseFormFields(schema: unknown): DynamicFormField[] {\n if (Array.isArray(schema)) {\n return schema\n .map((f, i) => toField(f, `field_${i + 1}`))\n .filter((f): f is DynamicFormField => !!f);\n }\n if (schema && typeof schema === 'object') {\n const obj = schema as Record<string, unknown>;\n if (Array.isArray(obj.fields)) {\n return obj.fields\n .map((f, i) => toField(f, `field_${i + 1}`))\n .filter((f): f is DynamicFormField => !!f);\n }\n if (obj.properties && typeof obj.properties === 'object') {\n return Object.entries(obj.properties as Record<string, unknown>)\n .map(([key, v]) => toField({ ...(v as object), key }, key))\n .filter((f): f is DynamicFormField => !!f);\n }\n }\n return [];\n}\n\n/** Serialise DynamicFormField[] back to the array `formSchema` payload (or null when empty). */\nexport function serializeFormFields(fields: DynamicFormField[]): DynamicFormField[] | null {\n if (fields.length === 0) return null;\n return fields.map((f) => ({\n key: f.key,\n label: f.label,\n type: f.type,\n required: f.required,\n ...(f.type === 'select' ? { options: f.options ?? [] } : {}),\n ...(f.showIf ? { showIf: f.showIf } : {}),\n }));\n}\n\n/**\n * Whether `field` should be shown/required given the current answer set.\n * A field with no `showIf` is always visible. A field whose condition\n * references a field that is itself hidden, missing, or was removed from the\n * schema is treated as visible (fail-open) so authoring mistakes never trap a\n * citizen behind an invisible required field. `seen` guards against a cyclic\n * `showIf` chain (e.g. two fields conditionally depending on each other after\n * being reordered in the builder) — a cycle is also treated as visible\n * (fail-open) rather than recursing forever.\n */\nexport function isFieldVisible(\n field: DynamicFormField,\n values: Record<string, string>,\n allFields: DynamicFormField[],\n seen: ReadonlySet<string> = new Set()\n): boolean {\n const condition = field.showIf;\n if (!condition) return true;\n if (seen.has(field.key)) return true;\n const source = allFields.find((f) => f.key === condition.fieldKey);\n if (!source) return true;\n const nextSeen = new Set(seen);\n nextSeen.add(field.key);\n if (!isFieldVisible(source, values, allFields, nextSeen)) return true;\n return (values[condition.fieldKey] ?? '') === condition.equals;\n}\n"],"mappings":";AA8BA,SAAS,EAAW,GAAc,GAAuC;CACvE,IAAM,IAAI,OAAO,KAAO,EAAE,EAAE,YAAY;CAOxC,OANI,KAAc,MAAM,YAAY,MAAM,YAAY,MAAM,SAAe,WACvE,EAAE,SAAS,MAAM,KAAK,MAAM,cAAc,MAAM,eAAe,MAAM,cAChE,aACL,MAAM,YAAY,MAAM,aAAa,MAAM,UAAgB,WAC3D,MAAM,UAAU,MAAM,aAAmB,SACzC,MAAM,UAAU,MAAM,WAAiB,SACpC;AACT;AAEA,SAAS,EAAgB,GAAiD;CACxE,IAAI,CAAC,KAAO,OAAO,K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1C,QAAQ,MAA6B,CAAC,CAAC,CAAC;EAE7C,IAAI,EAAI,cAAc,OAAO,EAAI,cAAe,UAC9C,OAAO,OAAO,QAAQ,EAAI,UAAqC,EAC5D,KAAK,CAAC,GAAK,OAAO,EAAQ;GAAE,GAAI;GAAc;EAAI,GAAG,CAAG,CAAC,EACzD,QAAQ,MAA6B,CAAC,CAAC,CAAC;CAE/C;CACA,OAAO,CAAC;AACV;AAGA,SAAgB,EAAoB,GAAuD;CAEzF,OADI,EAAO,WAAW,IAAU,OACzB,EAAO,KAAK,OAAO;EACxB,KAAK,EAAE;EACP,OAAO,EAAE;EACT,MAAM,EAAE;EACR,UAAU,EAAE;EACZ,GAAI,EAAE,SAAS,WAAW,EAAE,SAAS,EAAE,WAAW,CAAC,EAAE,IAAI,CAAC;EAC1D,GAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,IAAI,CAAC;CACzC,EAAE;AACJ;AAYA,SAAgB,EACd,GACA,GACA,GACA,oBAA4B,IAAI,IAAI,GAC3B;CACT,IAAM,IAAY,EAAM;CAExB,IADI,CAAC,KACD,EAAK,IAAI,EAAM,GAAG,GAAG,OAAO;CAChC,IAAM,IAAS,EAAU,MAAM,MAAM,EAAE,QAAQ,EAAU,QAAQ;CACjE,IAAI,CAAC,GAAQ,OAAO;CACpB,IAAM,IAAW,IAAI,IAAI,CAAI;CAG7B,OAFA,EAAS,IAAI,EAAM,GAAG,GACjB,EAAe,GAAQ,GAAQ,GAAW,CAAQ,KAC/C,EAAO,EAAU,aAAa,QAAQ,EAAU,SADS;AAEnE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-govcitizenhub",
3
- "version": "2026.720.3",
3
+ "version": "2026.720.5",
4
4
  "description": "Burdenoff GovCitizenHub Microfrontend",
5
5
  "type": "module",
6
6
  "files": [