@schema-engine/forms 0.0.0-stage → 0.5.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/LICENSE +21 -0
- package/README.md +69 -2
- package/dist/actions/index.d.ts +3 -0
- package/dist/actions/index.js +50 -0
- package/dist/actions/index.js.map +7 -0
- package/dist/actions/plugins/auto-save.plugin.d.ts +39 -0
- package/dist/actions/plugins/auto-save.plugin.js +10 -0
- package/dist/actions/plugins/auto-save.plugin.js.map +7 -0
- package/dist/actions/plugins/form-reset.plugin.d.ts +23 -0
- package/dist/actions/plugins/form-reset.plugin.js +9 -0
- package/dist/actions/plugins/form-reset.plugin.js.map +7 -0
- package/dist/actions/plugins/form-submit.plugin.d.ts +31 -0
- package/dist/actions/plugins/form-submit.plugin.js +9 -0
- package/dist/actions/plugins/form-submit.plugin.js.map +7 -0
- package/dist/actions/plugins/form-submit.registration.d.ts +22 -0
- package/dist/actions/plugins/form-submit.registration.js +8 -0
- package/dist/actions/plugins/form-submit.registration.js.map +7 -0
- package/dist/actions/plugins/gtm.plugin.d.ts +30 -0
- package/dist/actions/plugins/gtm.plugin.js +8 -0
- package/dist/actions/plugins/gtm.plugin.js.map +7 -0
- package/dist/actions/plugins/index.d.ts +16 -0
- package/dist/actions/plugins/index.js +45 -0
- package/dist/actions/plugins/index.js.map +7 -0
- package/dist/actions/plugins/notification.plugin.d.ts +32 -0
- package/dist/actions/plugins/notification.plugin.js +9 -0
- package/dist/actions/plugins/notification.plugin.js.map +7 -0
- package/dist/actions/plugins/notification.registration.d.ts +22 -0
- package/dist/actions/plugins/notification.registration.js +8 -0
- package/dist/actions/plugins/notification.registration.js.map +7 -0
- package/dist/actions/plugins/registrations.d.ts +17 -0
- package/dist/actions/plugins/registrations.js +14 -0
- package/dist/actions/plugins/registrations.js.map +7 -0
- package/dist/actions/triggers.d.ts +42 -0
- package/dist/actions/triggers.js +6 -0
- package/dist/actions/triggers.js.map +7 -0
- package/dist/actions/types.d.ts +16 -0
- package/dist/actions/types.js +1 -0
- package/dist/actions/types.js.map +7 -0
- package/dist/agent-tool/index.d.ts +54 -0
- package/dist/agent-tool/index.js +128 -0
- package/dist/agent-tool/index.js.map +7 -0
- package/dist/browser/action-registrations.d.ts +46 -0
- package/dist/browser/action-registrations.js +19 -0
- package/dist/browser/action-registrations.js.map +7 -0
- package/dist/browser/index.d.ts +4 -0
- package/dist/browser/index.js +36 -0
- package/dist/browser/index.js.map +7 -0
- package/dist/browser/tools/auto-save-storage.d.ts +20 -0
- package/dist/browser/tools/auto-save-storage.js +12 -0
- package/dist/browser/tools/auto-save-storage.js.map +7 -0
- package/dist/browser/tools/gdpr-consent.d.ts +32 -0
- package/dist/browser/tools/gdpr-consent.js +11 -0
- package/dist/browser/tools/gdpr-consent.js.map +7 -0
- package/dist/browser/tools/gtm-tracker.d.ts +7 -0
- package/dist/browser/tools/gtm-tracker.js +7 -0
- package/dist/browser/tools/gtm-tracker.js.map +7 -0
- package/dist/builder/form-authoring.d.ts +159 -0
- package/dist/builder/form-authoring.js +1 -0
- package/dist/builder/form-authoring.js.map +7 -0
- package/dist/builder/form-values.d.ts +158 -0
- package/dist/builder/form-values.js +0 -0
- package/dist/builder/form-values.js.map +7 -0
- package/dist/builder/index.d.ts +5 -0
- package/dist/builder/index.js +2 -0
- package/dist/builder/index.js.map +7 -0
- package/dist/builder/types.utils.d.ts +137 -0
- package/dist/builder/types.utils.js +1 -0
- package/dist/builder/types.utils.js.map +7 -0
- package/dist/chunk-237BHPDH.js +88 -0
- package/dist/chunk-237BHPDH.js.map +7 -0
- package/dist/chunk-25PLQDKN.js +45 -0
- package/dist/chunk-25PLQDKN.js.map +7 -0
- package/dist/chunk-2PTM54FQ.js +51 -0
- package/dist/chunk-2PTM54FQ.js.map +7 -0
- package/dist/chunk-2VKEOE2L.js +907 -0
- package/dist/chunk-2VKEOE2L.js.map +7 -0
- package/dist/chunk-2XWISGGM.js +8 -0
- package/dist/chunk-2XWISGGM.js.map +7 -0
- package/dist/chunk-2YKQAVI2.js +8 -0
- package/dist/chunk-2YKQAVI2.js.map +7 -0
- package/dist/chunk-3B7CJOF6.js +18 -0
- package/dist/chunk-3B7CJOF6.js.map +7 -0
- package/dist/chunk-3YLRJVVN.js +17 -0
- package/dist/chunk-3YLRJVVN.js.map +7 -0
- package/dist/chunk-4CUGHU36.js +58 -0
- package/dist/chunk-4CUGHU36.js.map +7 -0
- package/dist/chunk-4FELFUCD.js +0 -0
- package/dist/chunk-4FELFUCD.js.map +7 -0
- package/dist/chunk-4XPLSYTK.js +82 -0
- package/dist/chunk-4XPLSYTK.js.map +7 -0
- package/dist/chunk-56CJ2UZ7.js +55 -0
- package/dist/chunk-56CJ2UZ7.js.map +7 -0
- package/dist/chunk-5QXT7YAJ.js +87 -0
- package/dist/chunk-5QXT7YAJ.js.map +7 -0
- package/dist/chunk-5Y6U3MR3.js +54 -0
- package/dist/chunk-5Y6U3MR3.js.map +7 -0
- package/dist/chunk-6BAJHAGL.js +29 -0
- package/dist/chunk-6BAJHAGL.js.map +7 -0
- package/dist/chunk-6FUGK5HQ.js +26 -0
- package/dist/chunk-6FUGK5HQ.js.map +7 -0
- package/dist/chunk-6IZYNHZ3.js +118 -0
- package/dist/chunk-6IZYNHZ3.js.map +7 -0
- package/dist/chunk-6NV2JDGI.js +8 -0
- package/dist/chunk-6NV2JDGI.js.map +7 -0
- package/dist/chunk-6R2MBQPL.js +19 -0
- package/dist/chunk-6R2MBQPL.js.map +7 -0
- package/dist/chunk-7EQJUI5N.js +40 -0
- package/dist/chunk-7EQJUI5N.js.map +7 -0
- package/dist/chunk-AUZ45XPE.js +27 -0
- package/dist/chunk-AUZ45XPE.js.map +7 -0
- package/dist/chunk-BIHEIJG3.js +0 -0
- package/dist/chunk-BIHEIJG3.js.map +7 -0
- package/dist/chunk-BKNWW4PK.js +0 -0
- package/dist/chunk-BKNWW4PK.js.map +7 -0
- package/dist/chunk-BLFLCSG3.js +71 -0
- package/dist/chunk-BLFLCSG3.js.map +7 -0
- package/dist/chunk-BYYGAGNH.js +0 -0
- package/dist/chunk-BYYGAGNH.js.map +7 -0
- package/dist/chunk-CAZPWBQ4.js +18 -0
- package/dist/chunk-CAZPWBQ4.js.map +7 -0
- package/dist/chunk-CMPOBBRV.js +10 -0
- package/dist/chunk-CMPOBBRV.js.map +7 -0
- package/dist/chunk-CRQWKC67.js +118 -0
- package/dist/chunk-CRQWKC67.js.map +7 -0
- package/dist/chunk-CRVXBWSY.js +70 -0
- package/dist/chunk-CRVXBWSY.js.map +7 -0
- package/dist/chunk-D6ZHV6AT.js +0 -0
- package/dist/chunk-D6ZHV6AT.js.map +7 -0
- package/dist/chunk-DVDKPY2A.js +12 -0
- package/dist/chunk-DVDKPY2A.js.map +7 -0
- package/dist/chunk-E4VONSLO.js +15 -0
- package/dist/chunk-E4VONSLO.js.map +7 -0
- package/dist/chunk-EEYGPPLU.js +185 -0
- package/dist/chunk-EEYGPPLU.js.map +7 -0
- package/dist/chunk-EI5TMJDC.js +56 -0
- package/dist/chunk-EI5TMJDC.js.map +7 -0
- package/dist/chunk-EQ5AIF3T.js +117 -0
- package/dist/chunk-EQ5AIF3T.js.map +7 -0
- package/dist/chunk-EZZHO6DQ.js +26 -0
- package/dist/chunk-EZZHO6DQ.js.map +7 -0
- package/dist/chunk-FUHLRG3M.js +130 -0
- package/dist/chunk-FUHLRG3M.js.map +7 -0
- package/dist/chunk-FVOL3ZOJ.js +101 -0
- package/dist/chunk-FVOL3ZOJ.js.map +7 -0
- package/dist/chunk-G33EUV7N.js +288 -0
- package/dist/chunk-G33EUV7N.js.map +7 -0
- package/dist/chunk-GH34XFCC.js +56 -0
- package/dist/chunk-GH34XFCC.js.map +7 -0
- package/dist/chunk-GKWRJ6H4.js +27 -0
- package/dist/chunk-GKWRJ6H4.js.map +7 -0
- package/dist/chunk-GRZU6F7Q.js +80 -0
- package/dist/chunk-GRZU6F7Q.js.map +7 -0
- package/dist/chunk-GT2LARKT.js +107 -0
- package/dist/chunk-GT2LARKT.js.map +7 -0
- package/dist/chunk-GY657L56.js +206 -0
- package/dist/chunk-GY657L56.js.map +7 -0
- package/dist/chunk-H4ABGAAG.js +60 -0
- package/dist/chunk-H4ABGAAG.js.map +7 -0
- package/dist/chunk-H63UHX42.js +93 -0
- package/dist/chunk-H63UHX42.js.map +7 -0
- package/dist/chunk-HEAKWS27.js +2730 -0
- package/dist/chunk-HEAKWS27.js.map +7 -0
- package/dist/chunk-HIS4MGIR.js +8 -0
- package/dist/chunk-HIS4MGIR.js.map +7 -0
- package/dist/chunk-HPPFSWIV.js +213 -0
- package/dist/chunk-HPPFSWIV.js.map +7 -0
- package/dist/chunk-J2FC5K4B.js +87 -0
- package/dist/chunk-J2FC5K4B.js.map +7 -0
- package/dist/chunk-J5BSFDVK.js +123 -0
- package/dist/chunk-J5BSFDVK.js.map +7 -0
- package/dist/chunk-J7GSNWXT.js +151 -0
- package/dist/chunk-J7GSNWXT.js.map +7 -0
- package/dist/chunk-K22S7IZR.js +12 -0
- package/dist/chunk-K22S7IZR.js.map +7 -0
- package/dist/chunk-K5TMXCMY.js +139 -0
- package/dist/chunk-K5TMXCMY.js.map +7 -0
- package/dist/chunk-KE53GN4Q.js +246 -0
- package/dist/chunk-KE53GN4Q.js.map +7 -0
- package/dist/chunk-KFQEDSYI.js +24 -0
- package/dist/chunk-KFQEDSYI.js.map +7 -0
- package/dist/chunk-KLATKWUA.js +116 -0
- package/dist/chunk-KLATKWUA.js.map +7 -0
- package/dist/chunk-KSKWSUOB.js +17 -0
- package/dist/chunk-KSKWSUOB.js.map +7 -0
- package/dist/chunk-LFWEJXWE.js +68 -0
- package/dist/chunk-LFWEJXWE.js.map +7 -0
- package/dist/chunk-LMWJAD3B.js +24 -0
- package/dist/chunk-LMWJAD3B.js.map +7 -0
- package/dist/chunk-MD23VADH.js +92 -0
- package/dist/chunk-MD23VADH.js.map +7 -0
- package/dist/chunk-MKMJT3XR.js +0 -0
- package/dist/chunk-MKMJT3XR.js.map +7 -0
- package/dist/chunk-NJTLBSTR.js +82 -0
- package/dist/chunk-NJTLBSTR.js.map +7 -0
- package/dist/chunk-NJXKMF67.js +182 -0
- package/dist/chunk-NJXKMF67.js.map +7 -0
- package/dist/chunk-OBQBIOGN.js +16 -0
- package/dist/chunk-OBQBIOGN.js.map +7 -0
- package/dist/chunk-OLYHNFKC.js +82 -0
- package/dist/chunk-OLYHNFKC.js.map +7 -0
- package/dist/chunk-OR2L7EKO.js +33 -0
- package/dist/chunk-OR2L7EKO.js.map +7 -0
- package/dist/chunk-OUF57UZ7.js +28 -0
- package/dist/chunk-OUF57UZ7.js.map +7 -0
- package/dist/chunk-PBMM2N77.js +56 -0
- package/dist/chunk-PBMM2N77.js.map +7 -0
- package/dist/chunk-PH3LWLYN.js +49 -0
- package/dist/chunk-PH3LWLYN.js.map +7 -0
- package/dist/chunk-PHNMDWSK.js +9 -0
- package/dist/chunk-PHNMDWSK.js.map +7 -0
- package/dist/chunk-PN5EH6DM.js +36 -0
- package/dist/chunk-PN5EH6DM.js.map +7 -0
- package/dist/chunk-POCAINUE.js +42 -0
- package/dist/chunk-POCAINUE.js.map +7 -0
- package/dist/chunk-PXWVKJGF.js +6 -0
- package/dist/chunk-PXWVKJGF.js.map +7 -0
- package/dist/chunk-Q5LEK7CI.js +64 -0
- package/dist/chunk-Q5LEK7CI.js.map +7 -0
- package/dist/chunk-QH7VW7IY.js +0 -0
- package/dist/chunk-QH7VW7IY.js.map +7 -0
- package/dist/chunk-QLGM2AZW.js +173 -0
- package/dist/chunk-QLGM2AZW.js.map +7 -0
- package/dist/chunk-QT3EYUL5.js +85 -0
- package/dist/chunk-QT3EYUL5.js.map +7 -0
- package/dist/chunk-QYHOFLRX.js +43 -0
- package/dist/chunk-QYHOFLRX.js.map +7 -0
- package/dist/chunk-R3MBVWVI.js +127 -0
- package/dist/chunk-R3MBVWVI.js.map +7 -0
- package/dist/chunk-R6V3LH7F.js +67 -0
- package/dist/chunk-R6V3LH7F.js.map +7 -0
- package/dist/chunk-RB22U6HI.js +64 -0
- package/dist/chunk-RB22U6HI.js.map +7 -0
- package/dist/chunk-RQRQYYTB.js +34 -0
- package/dist/chunk-RQRQYYTB.js.map +7 -0
- package/dist/chunk-S5D2QE4G.js +53 -0
- package/dist/chunk-S5D2QE4G.js.map +7 -0
- package/dist/chunk-S7I76ISM.js +245 -0
- package/dist/chunk-S7I76ISM.js.map +7 -0
- package/dist/chunk-TBDZOQ2C.js +66 -0
- package/dist/chunk-TBDZOQ2C.js.map +7 -0
- package/dist/chunk-U2X3IYSD.js +23 -0
- package/dist/chunk-U2X3IYSD.js.map +7 -0
- package/dist/chunk-UGL3KNOT.js +42 -0
- package/dist/chunk-UGL3KNOT.js.map +7 -0
- package/dist/chunk-UN3DARLG.js +35 -0
- package/dist/chunk-UN3DARLG.js.map +7 -0
- package/dist/chunk-VGGERKV2.js +7 -0
- package/dist/chunk-VGGERKV2.js.map +7 -0
- package/dist/chunk-VVFXYY65.js +0 -0
- package/dist/chunk-VVFXYY65.js.map +7 -0
- package/dist/chunk-WLDCYUN6.js +161 -0
- package/dist/chunk-WLDCYUN6.js.map +7 -0
- package/dist/chunk-WMDTQS36.js +0 -0
- package/dist/chunk-WMDTQS36.js.map +7 -0
- package/dist/chunk-WS7SLVXL.js +550 -0
- package/dist/chunk-WS7SLVXL.js.map +7 -0
- package/dist/chunk-WUTGZYP4.js +290 -0
- package/dist/chunk-WUTGZYP4.js.map +7 -0
- package/dist/chunk-XKN3WWK3.js +0 -0
- package/dist/chunk-XKN3WWK3.js.map +7 -0
- package/dist/chunk-XPQRHO5E.js +587 -0
- package/dist/chunk-XPQRHO5E.js.map +7 -0
- package/dist/chunk-XQ5VJ4QO.js +62 -0
- package/dist/chunk-XQ5VJ4QO.js.map +7 -0
- package/dist/chunk-XQVKX47O.js +174 -0
- package/dist/chunk-XQVKX47O.js.map +7 -0
- package/dist/chunk-Y5CNB57V.js +22 -0
- package/dist/chunk-Y5CNB57V.js.map +7 -0
- package/dist/chunk-YDGH7DTL.js +18 -0
- package/dist/chunk-YDGH7DTL.js.map +7 -0
- package/dist/chunk-YIFUBPJ3.js +0 -0
- package/dist/chunk-YIFUBPJ3.js.map +7 -0
- package/dist/chunk-YUUDXRBW.js +212 -0
- package/dist/chunk-YUUDXRBW.js.map +7 -0
- package/dist/chunk-Z6DQLJS2.js +23 -0
- package/dist/chunk-Z6DQLJS2.js.map +7 -0
- package/dist/chunk-ZDEZ2FOC.js +81 -0
- package/dist/chunk-ZDEZ2FOC.js.map +7 -0
- package/dist/chunk-ZUYSGCEH.js +65 -0
- package/dist/chunk-ZUYSGCEH.js.map +7 -0
- package/dist/chunk-ZYP3MIH3.js +115 -0
- package/dist/chunk-ZYP3MIH3.js.map +7 -0
- package/dist/constraints/constraint-evaluator.d.ts +57 -0
- package/dist/constraints/constraint-evaluator.js +17 -0
- package/dist/constraints/constraint-evaluator.js.map +7 -0
- package/dist/constraints/index.d.ts +1 -0
- package/dist/constraints/index.js +17 -0
- package/dist/constraints/index.js.map +7 -0
- package/dist/csrf/index.d.ts +43 -0
- package/dist/csrf/index.js +43 -0
- package/dist/csrf/index.js.map +7 -0
- package/dist/engine/build-form-engine.d.ts +27 -0
- package/dist/engine/build-form-engine.js +58 -0
- package/dist/engine/build-form-engine.js.map +7 -0
- package/dist/engine/component-type.d.ts +19 -0
- package/dist/engine/component-type.js +6 -0
- package/dist/engine/component-type.js.map +7 -0
- package/dist/engine/create-form-engine.d.ts +100 -0
- package/dist/engine/create-form-engine.js +59 -0
- package/dist/engine/create-form-engine.js.map +7 -0
- package/dist/engine/form-action-context.d.ts +70 -0
- package/dist/engine/form-action-context.js +10 -0
- package/dist/engine/form-action-context.js.map +7 -0
- package/dist/engine/form-engine.d.ts +236 -0
- package/dist/engine/form-engine.js +61 -0
- package/dist/engine/form-engine.js.map +7 -0
- package/dist/engine/index.d.ts +12 -0
- package/dist/engine/index.js +124 -0
- package/dist/engine/index.js.map +7 -0
- package/dist/engine/schema-artifacts.d.ts +87 -0
- package/dist/engine/schema-artifacts.js +14 -0
- package/dist/engine/schema-artifacts.js.map +7 -0
- package/dist/engine/schema-metadata-catalog.d.ts +41 -0
- package/dist/engine/schema-metadata-catalog.js +6 -0
- package/dist/engine/schema-metadata-catalog.js.map +7 -0
- package/dist/engine/step-machine.d.ts +59 -0
- package/dist/engine/step-machine.js +32 -0
- package/dist/engine/step-machine.js.map +7 -0
- package/dist/engine/submission-schema.d.ts +53 -0
- package/dist/engine/submission-schema.js +22 -0
- package/dist/engine/submission-schema.js.map +7 -0
- package/dist/engine/value-validation.d.ts +237 -0
- package/dist/engine/value-validation.js +39 -0
- package/dist/engine/value-validation.js.map +7 -0
- package/dist/index.d.ts +76 -0
- package/dist/index.js +283 -0
- package/dist/index.js.map +7 -0
- package/dist/lib/authoring-catalog.d.ts +5 -0
- package/dist/lib/authoring-catalog.js +11 -0
- package/dist/lib/authoring-catalog.js.map +7 -0
- package/dist/lib/container-kind-of.d.ts +5 -0
- package/dist/lib/container-kind-of.js +6 -0
- package/dist/lib/container-kind-of.js.map +7 -0
- package/dist/lib/debounce.d.ts +19 -0
- package/dist/lib/debounce.js +6 -0
- package/dist/lib/debounce.js.map +7 -0
- package/dist/lib/deep-readonly.d.ts +12 -0
- package/dist/lib/deep-readonly.js +0 -0
- package/dist/lib/deep-readonly.js.map +7 -0
- package/dist/lib/element-children.d.ts +35 -0
- package/dist/lib/element-children.js +16 -0
- package/dist/lib/element-children.js.map +7 -0
- package/dist/lib/exported-action-envelope.d.ts +11 -0
- package/dist/lib/exported-action-envelope.js +7 -0
- package/dist/lib/exported-action-envelope.js.map +7 -0
- package/dist/lib/exported-rules.d.ts +14 -0
- package/dist/lib/exported-rules.js +6 -0
- package/dist/lib/exported-rules.js.map +7 -0
- package/dist/lib/field-ref.d.ts +13 -0
- package/dist/lib/field-ref.js +6 -0
- package/dist/lib/field-ref.js.map +7 -0
- package/dist/lib/field-scope.d.ts +121 -0
- package/dist/lib/field-scope.js +41 -0
- package/dist/lib/field-scope.js.map +7 -0
- package/dist/lib/form-fetch.d.ts +36 -0
- package/dist/lib/form-fetch.js +10 -0
- package/dist/lib/form-fetch.js.map +7 -0
- package/dist/lib/form-view.d.ts +33 -0
- package/dist/lib/form-view.js +12 -0
- package/dist/lib/form-view.js.map +7 -0
- package/dist/lib/frozen-copy.d.ts +9 -0
- package/dist/lib/frozen-copy.js +7 -0
- package/dist/lib/frozen-copy.js.map +7 -0
- package/dist/lib/is-plain-object.d.ts +2 -0
- package/dist/lib/is-plain-object.js +6 -0
- package/dist/lib/is-plain-object.js.map +7 -0
- package/dist/lib/logger.d.ts +2 -0
- package/dist/lib/logger.js +6 -0
- package/dist/lib/logger.js.map +7 -0
- package/dist/lib/normalized-form-config.d.ts +106 -0
- package/dist/lib/normalized-form-config.js +19 -0
- package/dist/lib/normalized-form-config.js.map +7 -0
- package/dist/lib/omit-paths.d.ts +11 -0
- package/dist/lib/omit-paths.js +7 -0
- package/dist/lib/omit-paths.js.map +7 -0
- package/dist/lib/path-values.d.ts +47 -0
- package/dist/lib/path-values.js +22 -0
- package/dist/lib/path-values.js.map +7 -0
- package/dist/lib/renderer-data-attributes.d.ts +10 -0
- package/dist/lib/renderer-data-attributes.js +6 -0
- package/dist/lib/renderer-data-attributes.js.map +7 -0
- package/dist/lib/reserved-path-keys.d.ts +10 -0
- package/dist/lib/reserved-path-keys.js +10 -0
- package/dist/lib/reserved-path-keys.js.map +7 -0
- package/dist/lib/resolve-appearance.d.ts +48 -0
- package/dist/lib/resolve-appearance.js +10 -0
- package/dist/lib/resolve-appearance.js.map +7 -0
- package/dist/lib/standard-json-schema.d.ts +27 -0
- package/dist/lib/standard-json-schema.js +8 -0
- package/dist/lib/standard-json-schema.js.map +7 -0
- package/dist/lib/standard-schema.d.ts +19 -0
- package/dist/lib/standard-schema.js +8 -0
- package/dist/lib/standard-schema.js.map +7 -0
- package/dist/lib/submission-shape.d.ts +60 -0
- package/dist/lib/submission-shape.js +14 -0
- package/dist/lib/submission-shape.js.map +7 -0
- package/dist/lib/validate-form/grid-checks.d.ts +57 -0
- package/dist/lib/validate-form/grid-checks.js +16 -0
- package/dist/lib/validate-form/grid-checks.js.map +7 -0
- package/dist/lib/validate-form/issues.d.ts +43 -0
- package/dist/lib/validate-form/issues.js +13 -0
- package/dist/lib/validate-form/issues.js.map +7 -0
- package/dist/lib/validate-form/options.d.ts +22 -0
- package/dist/lib/validate-form/options.js +0 -0
- package/dist/lib/validate-form/options.js.map +7 -0
- package/dist/lib/validate-form/parse-elements.d.ts +23 -0
- package/dist/lib/validate-form/parse-elements.js +21 -0
- package/dist/lib/validate-form/parse-elements.js.map +7 -0
- package/dist/lib/validate-form/parse-owner-actions.d.ts +14 -0
- package/dist/lib/validate-form/parse-owner-actions.js +10 -0
- package/dist/lib/validate-form/parse-owner-actions.js.map +7 -0
- package/dist/lib/validate-form/parse-view.d.ts +11 -0
- package/dist/lib/validate-form/parse-view.js +11 -0
- package/dist/lib/validate-form/parse-view.js.map +7 -0
- package/dist/lib/validate-form/schema-issues.d.ts +16 -0
- package/dist/lib/validate-form/schema-issues.js +8 -0
- package/dist/lib/validate-form/schema-issues.js.map +7 -0
- package/dist/lib/validate-form/step-checks.d.ts +18 -0
- package/dist/lib/validate-form/step-checks.js +15 -0
- package/dist/lib/validate-form/step-checks.js.map +7 -0
- package/dist/lib/validate-form/validation-error.d.ts +26 -0
- package/dist/lib/validate-form/validation-error.js +8 -0
- package/dist/lib/validate-form/validation-error.js.map +7 -0
- package/dist/lib/validate-form.d.ts +34 -0
- package/dist/lib/validate-form.js +62 -0
- package/dist/lib/validate-form.js.map +7 -0
- package/dist/lib/zod-json-schema.d.ts +33 -0
- package/dist/lib/zod-json-schema.js +10 -0
- package/dist/lib/zod-json-schema.js.map +7 -0
- package/dist/recipes/built-in-specs.d.ts +1832 -0
- package/dist/recipes/built-in-specs.js +28 -0
- package/dist/recipes/built-in-specs.js.map +7 -0
- package/dist/recipes/built-in.d.ts +2 -0
- package/dist/recipes/built-in.js +49 -0
- package/dist/recipes/built-in.js.map +7 -0
- package/dist/recipes/define-form-recipe.d.ts +10 -0
- package/dist/recipes/define-form-recipe.js +6 -0
- package/dist/recipes/define-form-recipe.js.map +7 -0
- package/dist/recipes/define-recipe-spec.d.ts +13 -0
- package/dist/recipes/define-recipe-spec.js +8 -0
- package/dist/recipes/define-recipe-spec.js.map +7 -0
- package/dist/recipes/index.d.ts +6 -0
- package/dist/recipes/index.js +43 -0
- package/dist/recipes/index.js.map +7 -0
- package/dist/recipes/protocol.d.ts +24 -0
- package/dist/recipes/protocol.js +11 -0
- package/dist/recipes/protocol.js.map +7 -0
- package/dist/recipes/slot-schemas.d.ts +128 -0
- package/dist/recipes/slot-schemas.js +24 -0
- package/dist/recipes/slot-schemas.js.map +7 -0
- package/dist/recipes/types.d.ts +55 -0
- package/dist/recipes/types.js +1 -0
- package/dist/recipes/types.js.map +7 -0
- package/dist/recipes/view-model.d.ts +93 -0
- package/dist/recipes/view-model.js +29 -0
- package/dist/recipes/view-model.js.map +7 -0
- package/dist/registries/index.d.ts +8 -0
- package/dist/registries/index.js +0 -0
- package/dist/registries/index.js.map +7 -0
- package/dist/runtime/create-form-runtime.d.ts +43 -0
- package/dist/runtime/create-form-runtime.js +41 -0
- package/dist/runtime/create-form-runtime.js.map +7 -0
- package/dist/runtime/index.d.ts +3 -0
- package/dist/runtime/index.js +44 -0
- package/dist/runtime/index.js.map +7 -0
- package/dist/runtime/submission-lifecycle.d.ts +65 -0
- package/dist/runtime/submission-lifecycle.js +6 -0
- package/dist/runtime/submission-lifecycle.js.map +7 -0
- package/dist/runtime/types.d.ts +172 -0
- package/dist/runtime/types.js +6 -0
- package/dist/runtime/types.js.map +7 -0
- package/dist/schemas/base-field.d.ts +450 -0
- package/dist/schemas/base-field.js +36 -0
- package/dist/schemas/base-field.js.map +7 -0
- package/dist/schemas/field-config.d.ts +36 -0
- package/dist/schemas/field-config.js +1 -0
- package/dist/schemas/field-config.js.map +7 -0
- package/dist/schemas/form-config-shape.d.ts +763 -0
- package/dist/schemas/form-config-shape.js +35 -0
- package/dist/schemas/form-config-shape.js.map +7 -0
- package/dist/schemas/form-config.d.ts +1288 -0
- package/dist/schemas/form-config.js +41 -0
- package/dist/schemas/form-config.js.map +7 -0
- package/dist/schemas/html-attributes.d.ts +12 -0
- package/dist/schemas/html-attributes.js +12 -0
- package/dist/schemas/html-attributes.js.map +7 -0
- package/dist/schemas/index.d.ts +5 -0
- package/dist/schemas/index.js +165 -0
- package/dist/schemas/index.js.map +7 -0
- package/dist/schemas/validation/async/cache.d.ts +39 -0
- package/dist/schemas/validation/async/cache.js +6 -0
- package/dist/schemas/validation/async/cache.js.map +7 -0
- package/dist/schemas/validation/async/handler.d.ts +21 -0
- package/dist/schemas/validation/async/handler.js +11 -0
- package/dist/schemas/validation/async/handler.js.map +7 -0
- package/dist/schemas/validation/async/index.d.ts +8 -0
- package/dist/schemas/validation/async/index.js +14 -0
- package/dist/schemas/validation/async/index.js.map +7 -0
- package/dist/schemas/validation/defaults.d.ts +6 -0
- package/dist/schemas/validation/defaults.js +12 -0
- package/dist/schemas/validation/defaults.js.map +7 -0
- package/dist/schemas/validation/dependencies.d.ts +52 -0
- package/dist/schemas/validation/dependencies.js +17 -0
- package/dist/schemas/validation/dependencies.js.map +7 -0
- package/dist/schemas/validation/empty.d.ts +1 -0
- package/dist/schemas/validation/empty.js +6 -0
- package/dist/schemas/validation/empty.js.map +7 -0
- package/dist/schemas/validation/errors.d.ts +44 -0
- package/dist/schemas/validation/errors.js +12 -0
- package/dist/schemas/validation/errors.js.map +7 -0
- package/dist/schemas/validation/index.d.ts +9 -0
- package/dist/schemas/validation/index.js +130 -0
- package/dist/schemas/validation/index.js.map +7 -0
- package/dist/schemas/validation/presets.d.ts +66 -0
- package/dist/schemas/validation/presets.js +6 -0
- package/dist/schemas/validation/presets.js.map +7 -0
- package/dist/schemas/validation/relations.d.ts +12 -0
- package/dist/schemas/validation/relations.js +8 -0
- package/dist/schemas/validation/relations.js.map +7 -0
- package/dist/schemas/validation/types.d.ts +817 -0
- package/dist/schemas/validation/types.js +64 -0
- package/dist/schemas/validation/types.js.map +7 -0
- package/dist/schemas/validation/utils.d.ts +76 -0
- package/dist/schemas/validation/utils.js +24 -0
- package/dist/schemas/validation/utils.js.map +7 -0
- package/dist/schemas/validation/validation-registry.d.ts +124 -0
- package/dist/schemas/validation/validation-registry.js +27 -0
- package/dist/schemas/validation/validation-registry.js.map +7 -0
- package/dist/server-errors/from-json-api-errors.d.ts +13 -0
- package/dist/server-errors/from-json-api-errors.js +10 -0
- package/dist/server-errors/from-json-api-errors.js.map +7 -0
- package/dist/server-errors/from-problem-details.d.ts +15 -0
- package/dist/server-errors/from-problem-details.js +10 -0
- package/dist/server-errors/from-problem-details.js.map +7 -0
- package/dist/server-errors/index.d.ts +8 -0
- package/dist/server-errors/index.js +17 -0
- package/dist/server-errors/index.js.map +7 -0
- package/dist/server-errors/shared.d.ts +34 -0
- package/dist/server-errors/shared.js +23 -0
- package/dist/server-errors/shared.js.map +7 -0
- package/dist/state-container/create-form-state-container.d.ts +17 -0
- package/dist/state-container/create-form-state-container.js +31 -0
- package/dist/state-container/create-form-state-container.js.map +7 -0
- package/dist/state-container/dirty.d.ts +11 -0
- package/dist/state-container/dirty.js +9 -0
- package/dist/state-container/dirty.js.map +7 -0
- package/dist/state-container/field-array.d.ts +41 -0
- package/dist/state-container/field-array.js +8 -0
- package/dist/state-container/field-array.js.map +7 -0
- package/dist/state-container/hydration.d.ts +21 -0
- package/dist/state-container/hydration.js +11 -0
- package/dist/state-container/hydration.js.map +7 -0
- package/dist/state-container/index.d.ts +16 -0
- package/dist/state-container/index.js +51 -0
- package/dist/state-container/index.js.map +7 -0
- package/dist/state-container/issue-text.d.ts +11 -0
- package/dist/state-container/issue-text.js +6 -0
- package/dist/state-container/issue-text.js.map +7 -0
- package/dist/state-container/row-ids.d.ts +34 -0
- package/dist/state-container/row-ids.js +19 -0
- package/dist/state-container/row-ids.js.map +7 -0
- package/dist/state-container/selectors.d.ts +33 -0
- package/dist/state-container/selectors.js +22 -0
- package/dist/state-container/selectors.js.map +7 -0
- package/dist/state-container/stale-results.d.ts +28 -0
- package/dist/state-container/stale-results.js +9 -0
- package/dist/state-container/stale-results.js.map +7 -0
- package/dist/state-container/state-tree.d.ts +56 -0
- package/dist/state-container/state-tree.js +33 -0
- package/dist/state-container/state-tree.js.map +7 -0
- package/dist/state-container/submission.d.ts +45 -0
- package/dist/state-container/submission.js +26 -0
- package/dist/state-container/submission.js.map +7 -0
- package/dist/state-container/types.d.ts +404 -0
- package/dist/state-container/types.js +6 -0
- package/dist/state-container/types.js.map +7 -0
- package/dist/state-container/value-tree.d.ts +56 -0
- package/dist/state-container/value-tree.js +34 -0
- package/dist/state-container/value-tree.js.map +7 -0
- package/dist/testing/form-state-container-conformance.d.ts +51 -0
- package/dist/testing/form-state-container-conformance.js +43 -0
- package/dist/testing/form-state-container-conformance.js.map +7 -0
- package/dist/testing/index.d.ts +7 -0
- package/dist/testing/index.js +35 -0
- package/dist/testing/index.js.map +7 -0
- package/dist/types/actions.d.ts +75 -0
- package/dist/types/actions.js +1 -0
- package/dist/types/actions.js.map +7 -0
- package/dist/types/categories.d.ts +21 -0
- package/dist/types/categories.js +8 -0
- package/dist/types/categories.js.map +7 -0
- package/dist/types/define-element.d.ts +73 -0
- package/dist/types/define-element.js +8 -0
- package/dist/types/define-element.js.map +7 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.js +17 -0
- package/dist/types/index.js.map +7 -0
- package/dist/types/metadata.d.ts +14 -0
- package/dist/types/metadata.js +1 -0
- package/dist/types/metadata.js.map +7 -0
- package/dist/types/registration.d.ts +142 -0
- package/dist/types/registration.js +1 -0
- package/dist/types/registration.js.map +7 -0
- package/package.json +119 -3
- package/skill/SKILL.md +79 -0
- package/skill/reference/forms-actions.md +51 -0
- package/skill/reference/forms-submission.md +44 -0
- package/skill/reference/forms-validation.md +91 -0
- package/skill/reference/forms.md +179 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
/**
|
|
3
|
+
* Action Triggers
|
|
4
|
+
*
|
|
5
|
+
* Events that can trigger action execution.
|
|
6
|
+
* Actions can respond to one or more triggers, and some triggers form lifecycle chains.
|
|
7
|
+
*
|
|
8
|
+
* Lifecycle Chains:
|
|
9
|
+
* - Submit: form_submit_start → form_submit → form_submit_success/form_submit_error → form_submit_complete
|
|
10
|
+
* - Step: step_leave → step_change → step_enter
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* The step triggers fire only when the current step changes: by `next`, `back` or `goTo`, by the move to the
|
|
14
|
+
* first step with an error after a failed or server-rejected submission, and by the move off a step that
|
|
15
|
+
* became skipped. A reset fires none. Step actions cannot block a move; their failures are reported through
|
|
16
|
+
* `onActionResults`. `step_leave` runs while the step being left is current and `step_change` and
|
|
17
|
+
* `step_enter` once the new step is.
|
|
18
|
+
*
|
|
19
|
+
* @form_mount - When the form's runtime mounts, once
|
|
20
|
+
* @form_change - When the form's values change
|
|
21
|
+
* @form_submit - When the submit actions run, after validation passed
|
|
22
|
+
* @step_change - When the current step has changed
|
|
23
|
+
* @step_enter - When a step has become the current step
|
|
24
|
+
* @step_leave - When the current step is about to change
|
|
25
|
+
* @form_submit_start - When submit process begins (after validation, before the submit actions)
|
|
26
|
+
* @form_submit_success - When submit completes successfully (internal lifecycle)
|
|
27
|
+
* @form_submit_error - When submit fails (internal lifecycle)
|
|
28
|
+
* @form_submit_complete - When submit process finishes, regardless of outcome (internal lifecycle)
|
|
29
|
+
*/
|
|
30
|
+
export declare const FormActionTriggerSchema: z.ZodMiniEnum<{
|
|
31
|
+
form_mount: "form_mount";
|
|
32
|
+
form_change: "form_change";
|
|
33
|
+
form_submit: "form_submit";
|
|
34
|
+
form_submit_start: "form_submit_start";
|
|
35
|
+
form_submit_success: "form_submit_success";
|
|
36
|
+
form_submit_error: "form_submit_error";
|
|
37
|
+
form_submit_complete: "form_submit_complete";
|
|
38
|
+
step_change: "step_change";
|
|
39
|
+
step_enter: "step_enter";
|
|
40
|
+
step_leave: "step_leave";
|
|
41
|
+
}>;
|
|
42
|
+
export type FormActionTrigger = z.infer<typeof FormActionTriggerSchema>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ActionConfigBase, ActionExecutionResult as GenericActionExecutionResult } from '@schema-engine/actions';
|
|
2
|
+
import type { ActionArguments } from '../types/registration.js';
|
|
3
|
+
/** Action configs accepted by an engine's registered action map. */
|
|
4
|
+
export type FormActionConfig<TActions extends Record<string, unknown> = Record<string, unknown>> = string extends keyof TActions ? ActionConfigBase<string> & {
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
} : [keyof TActions] extends [never] ? never : {
|
|
7
|
+
[K in keyof TActions & string]: {
|
|
8
|
+
readonly $type: K;
|
|
9
|
+
} & ActionArguments<TActions[K]> & ActionConfigBase<K> & {
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
};
|
|
12
|
+
}[keyof TActions & string];
|
|
13
|
+
/** Form actions may request browser navigation after completion. */
|
|
14
|
+
export interface ActionExecutionResult<TData = unknown> extends GenericActionExecutionResult<TData> {
|
|
15
|
+
redirectUrl?: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "../chunk-4FELFUCD.js";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { FormRuntime } from '../runtime/index.js';
|
|
2
|
+
import type { FormStateIssue, FormSubmissionIssue } from '../state-container/types.js';
|
|
3
|
+
/** The MCP shape of a tool result: what the agent reads. */
|
|
4
|
+
export interface FormAgentToolResult {
|
|
5
|
+
readonly content: readonly [{
|
|
6
|
+
readonly type: 'text';
|
|
7
|
+
readonly text: string;
|
|
8
|
+
}];
|
|
9
|
+
}
|
|
10
|
+
/** The text of an issue for the form at `field.path`; `undefined` or an empty text says nothing worth showing. */
|
|
11
|
+
export type FormAgentIssueFormatter = (issue: FormStateIssue | FormSubmissionIssue, field: {
|
|
12
|
+
readonly path: string;
|
|
13
|
+
}) => string | undefined;
|
|
14
|
+
/** What {@link registerFormAgentTool} registers a form with. */
|
|
15
|
+
export interface FormAgentToolOptions {
|
|
16
|
+
/** Unique among the page's tools; the browser rejects a duplicate. */
|
|
17
|
+
name: string;
|
|
18
|
+
description: string;
|
|
19
|
+
/**
|
|
20
|
+
* Submits the form after filling it, for a form that only reads or changes something low risk and reversible.
|
|
21
|
+
*
|
|
22
|
+
* @remarks Without it the tool fills the form and reports that it waits for the user to submit, so a person confirms. Default: `false`.
|
|
23
|
+
*/
|
|
24
|
+
autoSubmit?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* The form's own issue formatter, such as the one `useFormContext()` or `FormController` gives.
|
|
27
|
+
*
|
|
28
|
+
* @remarks Default: the engine's. An issue with no text from either is reported by its own `message`, then its `type` and its `params`.
|
|
29
|
+
*/
|
|
30
|
+
formatIssue?: FormAgentIssueFormatter;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Registers a rendered form as a WebMCP tool, so a browser agent can fill it and, when the page allows, submit it.
|
|
34
|
+
*
|
|
35
|
+
* @param runtime - The form's runtime, which the renderer binding hands over (`useFormRuntime()` in React, `FormController` in Radiant).
|
|
36
|
+
* @returns The function that unregisters the tool, by aborting the signal it registered with. Calling it again does nothing.
|
|
37
|
+
* @experimental
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* WebMCP is an Origin Trial and its API may change. Nothing else in the package imports this entry.
|
|
41
|
+
* It does nothing on the server and where the browser has no `document.modelContext`.
|
|
42
|
+
*
|
|
43
|
+
* The input schema is the JSON Schema of the runtime's `submissionSchema`, which describes each field by its label and
|
|
44
|
+
* help text, and it throws when a value schema has no JSON Schema. `execute` first checks the input
|
|
45
|
+
* against the same schema without requiring any key, so a value of the wrong type is refused before it reaches the form. It then writes the values into
|
|
46
|
+
* the form's container, the way a person's edits arrive, and, when `autoSubmit` is set, runs `runtime.submit()`: the same
|
|
47
|
+
* validation, constraints, value check, actions and `onSubmit` as a human submit. In a wizard it submits again after each
|
|
48
|
+
* step it moves past, so the answers fill the steps they make active and a skipped step's values are not submitted.
|
|
49
|
+
* A refused submission returns its issues as text, worded by the form's formatter, so the agent can retry.
|
|
50
|
+
*
|
|
51
|
+
* A call whose signal is aborted before it writes changes nothing. One aborted while it submits puts back the values and the
|
|
52
|
+
* step the user had, unless the form was already submitted; errors the submission recorded stay.
|
|
53
|
+
*/
|
|
54
|
+
export declare function registerFormAgentTool(runtime: FormRuntime, options: FormAgentToolOptions): () => void;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import {
|
|
2
|
+
issueText
|
|
3
|
+
} from "../chunk-HIS4MGIR.js";
|
|
4
|
+
import {
|
|
5
|
+
buildSubmissionShape
|
|
6
|
+
} from "../chunk-NJTLBSTR.js";
|
|
7
|
+
import {
|
|
8
|
+
logger
|
|
9
|
+
} from "../chunk-VGGERKV2.js";
|
|
10
|
+
import "../chunk-S7I76ISM.js";
|
|
11
|
+
import "../chunk-CRQWKC67.js";
|
|
12
|
+
import "../chunk-QLGM2AZW.js";
|
|
13
|
+
import "../chunk-ZUYSGCEH.js";
|
|
14
|
+
import {
|
|
15
|
+
FORM_ROOT
|
|
16
|
+
} from "../chunk-PXWVKJGF.js";
|
|
17
|
+
import "../chunk-3YLRJVVN.js";
|
|
18
|
+
import {
|
|
19
|
+
isPlainObject
|
|
20
|
+
} from "../chunk-CMPOBBRV.js";
|
|
21
|
+
|
|
22
|
+
// src/agent-tool/index.ts
|
|
23
|
+
var text = (value) => ({ content: [{ type: "text", text: value }] });
|
|
24
|
+
function collectWrites(shape, value, path, writes) {
|
|
25
|
+
if (shape.kind === "object") {
|
|
26
|
+
if (!isPlainObject(value)) return;
|
|
27
|
+
for (const [key, child] of Object.entries(shape.fields)) {
|
|
28
|
+
if (Object.hasOwn(value, key) && value[key] !== void 0) {
|
|
29
|
+
collectWrites(child, value[key], path === "" ? key : `${path}.${key}`, writes);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
writes.push({ path, kind: shape.kind === "array" ? "rows" : "value", value });
|
|
35
|
+
}
|
|
36
|
+
function writeTo(container, { path, kind, value }) {
|
|
37
|
+
if (kind === "rows" && Array.isArray(value)) container.fieldArray(path).replace([...value]);
|
|
38
|
+
else container.setValue(path, value);
|
|
39
|
+
}
|
|
40
|
+
function agentIssueText(issue, path, formatIssue) {
|
|
41
|
+
const text2 = issueText(issue, path, formatIssue);
|
|
42
|
+
if (text2) return text2;
|
|
43
|
+
return issue.params && Object.keys(issue.params).length > 0 ? `${issue.type} ${JSON.stringify(issue.params)}` : issue.type;
|
|
44
|
+
}
|
|
45
|
+
function describeErrors(runtime, formatIssue) {
|
|
46
|
+
const lines = Object.entries(runtime.container.getSnapshot().errors).map(([path, error]) => {
|
|
47
|
+
const reasons = [...new Set(error.all.map((issue) => agentIssueText(issue, path, formatIssue)))];
|
|
48
|
+
return `- ${path === FORM_ROOT ? "form" : path}: ${reasons.join("; ")}`;
|
|
49
|
+
});
|
|
50
|
+
for (const failure of runtime.getSnapshot().submission.failures) {
|
|
51
|
+
lines.push(`- form: ${agentIssueText(failure, FORM_ROOT, formatIssue)}`);
|
|
52
|
+
}
|
|
53
|
+
return lines;
|
|
54
|
+
}
|
|
55
|
+
function reportOutcome(outcome, runtime, formatIssue) {
|
|
56
|
+
switch (outcome) {
|
|
57
|
+
case "submitted":
|
|
58
|
+
return "The form was submitted.";
|
|
59
|
+
case "invalid":
|
|
60
|
+
case "failed": {
|
|
61
|
+
const lines = describeErrors(runtime, formatIssue);
|
|
62
|
+
return `The form was not submitted. Fix these and call the tool again:
|
|
63
|
+
${lines.join("\n")}`;
|
|
64
|
+
}
|
|
65
|
+
case "overtaken":
|
|
66
|
+
return "The form changed while it was checked, so it was not submitted. Call the tool again.";
|
|
67
|
+
case "busy":
|
|
68
|
+
return "The form is busy with another submission. Call the tool again in a moment.";
|
|
69
|
+
default:
|
|
70
|
+
return `The form could not be submitted (${outcome}). The values were filled in.`;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function registerFormAgentTool(runtime, options) {
|
|
74
|
+
if (typeof document === "undefined") return () => {
|
|
75
|
+
};
|
|
76
|
+
const modelContext = document.modelContext;
|
|
77
|
+
if (!modelContext) return () => {
|
|
78
|
+
};
|
|
79
|
+
const { name, description, autoSubmit = false } = options;
|
|
80
|
+
const formatIssue = options.formatIssue ?? runtime.formatIssue;
|
|
81
|
+
const submission = runtime.submissionSchema;
|
|
82
|
+
const shape = buildSubmissionShape(runtime.config.steps);
|
|
83
|
+
const inputSchema = { ...submission["~standard"].jsonSchema.input({ target: "draft-2020-12" }) };
|
|
84
|
+
const execute = async (input, { signal }) => {
|
|
85
|
+
if (signal.aborted) return text("The call was cancelled before the form was changed.");
|
|
86
|
+
const checked = submission.partial["~standard"].validate(input);
|
|
87
|
+
if (checked.issues) {
|
|
88
|
+
const lines = checked.issues.map(
|
|
89
|
+
(issue) => `- ${(issue.path ?? []).map((segment) => String(typeof segment === "object" ? segment.key : segment)).join(".") || "input"}: ${issue.message}`
|
|
90
|
+
);
|
|
91
|
+
return text(`The input does not match the form, so nothing was filled in:
|
|
92
|
+
${lines.join("\n")}`);
|
|
93
|
+
}
|
|
94
|
+
const { container } = runtime;
|
|
95
|
+
const startStep = runtime.getSnapshot().current;
|
|
96
|
+
const writes = [];
|
|
97
|
+
collectWrites(shape, checked.value, "", writes);
|
|
98
|
+
const before = writes.map((write) => ({ ...write, value: container.getValue(write.path) }));
|
|
99
|
+
for (const write of writes) writeTo(container, write);
|
|
100
|
+
if (!autoSubmit) {
|
|
101
|
+
return text("The form is filled in and waits for the user to review and submit it.");
|
|
102
|
+
}
|
|
103
|
+
let outcome = "refused";
|
|
104
|
+
for (let step = 0; step <= runtime.getSnapshot().steps.length; step += 1) {
|
|
105
|
+
outcome = await runtime.submit();
|
|
106
|
+
if (outcome !== "moved") break;
|
|
107
|
+
if (signal.aborted) break;
|
|
108
|
+
}
|
|
109
|
+
if (signal.aborted && outcome !== "submitted") {
|
|
110
|
+
for (const write of before.toReversed()) writeTo(container, write);
|
|
111
|
+
await runtime.goTo(startStep);
|
|
112
|
+
return text("The call was cancelled, so the form was put back as the user had it.");
|
|
113
|
+
}
|
|
114
|
+
return text(reportOutcome(outcome, runtime, formatIssue));
|
|
115
|
+
};
|
|
116
|
+
const controller = new AbortController();
|
|
117
|
+
void (async () => {
|
|
118
|
+
try {
|
|
119
|
+
await modelContext.registerTool({ name, description, inputSchema, execute }, { signal: controller.signal });
|
|
120
|
+
} catch (error) {
|
|
121
|
+
if (!controller.signal.aborted) logger.error(`Could not register the agent tool "${name}".`, { error });
|
|
122
|
+
}
|
|
123
|
+
})();
|
|
124
|
+
return () => controller.abort();
|
|
125
|
+
}
|
|
126
|
+
export {
|
|
127
|
+
registerFormAgentTool
|
|
128
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/agent-tool/index.ts"],
|
|
4
|
+
"sourcesContent": ["import { logger } from '@/lib/logger';\nimport { isPlainObject } from '@/lib/is-plain-object';\nimport { buildSubmissionShape, type SubmissionShape } from '@/lib/submission-shape';\nimport type { JSONSchemaObject } from '@/lib/standard-json-schema';\nimport type { FormRuntime, SubmitOutcome } from '@/runtime';\nimport { issueText } from '@/state-container/issue-text';\nimport { FORM_ROOT } from '@/state-container/types';\nimport type { FormStateIssue, FormSubmissionIssue } from '@/state-container/types';\n\n/** What the page hands `execute` besides the input. */\ninterface AgentToolExecuteOptions {\n\t/** Aborted when the agent cancels the call. */\n\treadonly signal: AbortSignal;\n}\n\n/** The MCP shape of a tool result: what the agent reads. */\nexport interface FormAgentToolResult {\n\treadonly content: readonly [{ readonly type: 'text'; readonly text: string }];\n}\n\ninterface ModelContext {\n\tregisterTool(\n\t\ttool: {\n\t\t\tname: string;\n\t\t\tdescription: string;\n\t\t\tinputSchema: JSONSchemaObject;\n\t\t\texecute(input: unknown, options: AgentToolExecuteOptions): Promise<FormAgentToolResult>;\n\t\t},\n\t\toptions: { signal: AbortSignal },\n\t): unknown;\n}\n\n/** The text of an issue for the form at `field.path`; `undefined` or an empty text says nothing worth showing. */\nexport type FormAgentIssueFormatter = (\n\tissue: FormStateIssue | FormSubmissionIssue,\n\tfield: { readonly path: string },\n) => string | undefined;\n\n/** What {@link registerFormAgentTool} registers a form with. */\nexport interface FormAgentToolOptions {\n\t/** Unique among the page's tools; the browser rejects a duplicate. */\n\tname: string;\n\tdescription: string;\n\t/**\n\t * Submits the form after filling it, for a form that only reads or changes something low risk and reversible.\n\t *\n\t * @remarks Without it the tool fills the form and reports that it waits for the user to submit, so a person confirms. Default: `false`.\n\t */\n\tautoSubmit?: boolean;\n\t/**\n\t * The form's own issue formatter, such as the one `useFormContext()` or `FormController` gives.\n\t *\n\t * @remarks Default: the engine's. An issue with no text from either is reported by its own `message`, then its `type` and its `params`.\n\t */\n\tformatIssue?: FormAgentIssueFormatter;\n}\n\nconst text = (value: string): FormAgentToolResult => ({ content: [{ type: 'text', text: value }] });\n\ninterface Write {\n\treadonly path: string;\n\treadonly kind: 'value' | 'rows';\n\treadonly value: unknown;\n}\n\n/** The writes that put `value` into the container: a leaf field takes its whole value, a list its whole rows. */\nfunction collectWrites(shape: SubmissionShape, value: unknown, path: string, writes: Write[]): void {\n\tif (shape.kind === 'object') {\n\t\tif (!isPlainObject(value)) return;\n\t\tfor (const [key, child] of Object.entries(shape.fields)) {\n\t\t\tif (Object.hasOwn(value, key) && value[key] !== undefined) {\n\t\t\t\tcollectWrites(child, value[key], path === '' ? key : `${path}.${key}`, writes);\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\twrites.push({ path, kind: shape.kind === 'array' ? 'rows' : 'value', value });\n}\n\n/** Puts `value` at the path: a list writes its rows, and a value that is no list, as `undefined` for a list the form never had, is written as it is. */\nfunction writeTo(container: FormRuntime['container'], { path, kind, value }: Write): void {\n\tif (kind === 'rows' && Array.isArray(value)) container.fieldArray(path).replace([...value]);\n\telse container.setValue(path, value);\n}\n\n/** The text of one issue: what {@link issueText} gives, else the issue's type and params, which an agent can still act on. */\nfunction agentIssueText(\n\tissue: FormStateIssue | FormSubmissionIssue,\n\tpath: string,\n\tformatIssue: FormAgentIssueFormatter | undefined,\n): string {\n\tconst text = issueText(issue, path, formatIssue);\n\tif (text) return text;\n\treturn issue.params && Object.keys(issue.params).length > 0\n\t\t? `${issue.type} ${JSON.stringify(issue.params)}`\n\t\t: issue.type;\n}\n\nfunction describeErrors(runtime: FormRuntime, formatIssue: FormAgentIssueFormatter | undefined): string[] {\n\tconst lines = Object.entries(runtime.container.getSnapshot().errors).map(([path, error]) => {\n\t\tconst reasons = [...new Set(error.all.map((issue) => agentIssueText(issue, path, formatIssue)))];\n\t\treturn `- ${path === FORM_ROOT ? 'form' : path}: ${reasons.join('; ')}`;\n\t});\n\tfor (const failure of runtime.getSnapshot().submission.failures) {\n\t\tlines.push(`- form: ${agentIssueText(failure, FORM_ROOT, formatIssue)}`);\n\t}\n\treturn lines;\n}\n\nfunction reportOutcome(\n\toutcome: SubmitOutcome,\n\truntime: FormRuntime,\n\tformatIssue: FormAgentIssueFormatter | undefined,\n): string {\n\tswitch (outcome) {\n\t\tcase 'submitted':\n\t\t\treturn 'The form was submitted.';\n\t\tcase 'invalid':\n\t\tcase 'failed': {\n\t\t\tconst lines = describeErrors(runtime, formatIssue);\n\t\t\treturn `The form was not submitted. Fix these and call the tool again:\\n${lines.join('\\n')}`;\n\t\t}\n\t\tcase 'overtaken':\n\t\t\treturn 'The form changed while it was checked, so it was not submitted. Call the tool again.';\n\t\tcase 'busy':\n\t\t\treturn 'The form is busy with another submission. Call the tool again in a moment.';\n\t\tdefault:\n\t\t\treturn `The form could not be submitted (${outcome}). The values were filled in.`;\n\t}\n}\n\n/**\n * Registers a rendered form as a WebMCP tool, so a browser agent can fill it and, when the page allows, submit it.\n *\n * @param runtime - The form's runtime, which the renderer binding hands over (`useFormRuntime()` in React, `FormController` in Radiant).\n * @returns The function that unregisters the tool, by aborting the signal it registered with. Calling it again does nothing.\n * @experimental\n *\n * @remarks\n * WebMCP is an Origin Trial and its API may change. Nothing else in the package imports this entry.\n * It does nothing on the server and where the browser has no `document.modelContext`.\n *\n * The input schema is the JSON Schema of the runtime's `submissionSchema`, which describes each field by its label and\n * help text, and it throws when a value schema has no JSON Schema. `execute` first checks the input\n * against the same schema without requiring any key, so a value of the wrong type is refused before it reaches the form. It then writes the values into\n * the form's container, the way a person's edits arrive, and, when `autoSubmit` is set, runs `runtime.submit()`: the same\n * validation, constraints, value check, actions and `onSubmit` as a human submit. In a wizard it submits again after each\n * step it moves past, so the answers fill the steps they make active and a skipped step's values are not submitted.\n * A refused submission returns its issues as text, worded by the form's formatter, so the agent can retry.\n *\n * A call whose signal is aborted before it writes changes nothing. One aborted while it submits puts back the values and the\n * step the user had, unless the form was already submitted; errors the submission recorded stay.\n */\nexport function registerFormAgentTool(runtime: FormRuntime, options: FormAgentToolOptions): () => void {\n\tif (typeof document === 'undefined') return () => {};\n\tconst modelContext = (document as Document & { modelContext?: ModelContext }).modelContext;\n\tif (!modelContext) return () => {};\n\n\tconst { name, description, autoSubmit = false } = options;\n\tconst formatIssue = options.formatIssue ?? runtime.formatIssue;\n\tconst submission = runtime.submissionSchema;\n\tconst shape = buildSubmissionShape(runtime.config.steps);\n\tconst inputSchema = { ...submission['~standard'].jsonSchema.input({ target: 'draft-2020-12' }) };\n\n\tconst execute = async (input: unknown, { signal }: AgentToolExecuteOptions): Promise<FormAgentToolResult> => {\n\t\tif (signal.aborted) return text('The call was cancelled before the form was changed.');\n\n\t\tconst checked = submission.partial['~standard'].validate(input);\n\t\tif (checked.issues) {\n\t\t\tconst lines = checked.issues.map(\n\t\t\t\t(issue) =>\n\t\t\t\t\t`- ${(issue.path ?? []).map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.') || 'input'}: ${issue.message}`,\n\t\t\t);\n\t\t\treturn text(`The input does not match the form, so nothing was filled in:\\n${lines.join('\\n')}`);\n\t\t}\n\n\t\tconst { container } = runtime;\n\t\tconst startStep = runtime.getSnapshot().current;\n\t\tconst writes: Write[] = [];\n\t\tcollectWrites(shape, checked.value, '', writes);\n\t\tconst before = writes.map((write) => ({ ...write, value: container.getValue(write.path) }));\n\t\tfor (const write of writes) writeTo(container, write);\n\n\t\tif (!autoSubmit) {\n\t\t\treturn text('The form is filled in and waits for the user to review and submit it.');\n\t\t}\n\n\t\tlet outcome: SubmitOutcome = 'refused';\n\t\tfor (let step = 0; step <= runtime.getSnapshot().steps.length; step += 1) {\n\t\t\toutcome = await runtime.submit();\n\t\t\tif (outcome !== 'moved') break;\n\t\t\tif (signal.aborted) break;\n\t\t}\n\t\tif (signal.aborted && outcome !== 'submitted') {\n\t\t\tfor (const write of before.toReversed()) writeTo(container, write);\n\t\t\tawait runtime.goTo(startStep);\n\t\t\treturn text('The call was cancelled, so the form was put back as the user had it.');\n\t\t}\n\t\treturn text(reportOutcome(outcome, runtime, formatIssue));\n\t};\n\n\tconst controller = new AbortController();\n\tvoid (async () => {\n\t\ttry {\n\t\t\tawait modelContext.registerTool({ name, description, inputSchema, execute }, { signal: controller.signal });\n\t\t} catch (error) {\n\t\t\tif (!controller.signal.aborted) logger.error(`Could not register the agent tool \"${name}\".`, { error });\n\t\t}\n\t})();\n\treturn () => controller.abort();\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["text"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type AutoSaveStorage } from '../actions/plugins/auto-save.plugin';
|
|
2
|
+
import type { BuilderActionRegistration } from '../types/index.js';
|
|
3
|
+
import { type GDPRConsentTool } from './tools/gdpr-consent';
|
|
4
|
+
export interface BrowserActionRegistrationsOptions {
|
|
5
|
+
storage?: AutoSaveStorage;
|
|
6
|
+
consent?: Pick<GDPRConsentTool, 'hasConsent'>;
|
|
7
|
+
confirm?: (message: string) => boolean | Promise<boolean>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Creates browser-oriented action registrations with injectable browser ports.
|
|
11
|
+
*
|
|
12
|
+
* @remarks Auto-save is consent-gated by default. Supplying a consent tool lets
|
|
13
|
+
* tests and hosts use an isolated consent store.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createBrowserActionRegistrations({ storage, consent, confirm, }?: BrowserActionRegistrationsOptions): {
|
|
16
|
+
AutoSaveActionRegistration: BuilderActionRegistration<"auto_save", import("zod/mini").ZodMiniObject<{
|
|
17
|
+
description: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniString<string>>;
|
|
18
|
+
storageKey: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniString<string>>;
|
|
19
|
+
includeSensitive: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniDefault<import("zod/mini").ZodMiniBoolean<boolean>>>;
|
|
20
|
+
}, import("zod/v4/core").$strip>>;
|
|
21
|
+
ResetActionRegistration: BuilderActionRegistration<"reset", import("zod/mini").ZodMiniObject<{
|
|
22
|
+
description: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniString<string>>;
|
|
23
|
+
confirmMessage: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniString<string>>;
|
|
24
|
+
resetToDefaults: import("zod/mini").ZodMiniDefault<import("zod/mini").ZodMiniBoolean<boolean>>;
|
|
25
|
+
}, import("zod/v4/core").$strip>>;
|
|
26
|
+
GTMActionRegistration: BuilderActionRegistration<"gtm_event", import("zod/mini").ZodMiniObject<{
|
|
27
|
+
description: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniString<string>>;
|
|
28
|
+
eventName: import("zod/mini").ZodMiniString<string>;
|
|
29
|
+
eventData: import("zod/mini").ZodMiniDefault<import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniRecord<import("zod/mini").ZodMiniString<string>, import("zod/mini").ZodMiniUnknown>>>;
|
|
30
|
+
includeFormData: import("zod/mini").ZodMiniDefault<import("zod/mini").ZodMiniUnion<readonly [import("zod/mini").ZodMiniBoolean<boolean>, import("zod/mini").ZodMiniArray<import("zod/mini").ZodMiniString<string>>]>>;
|
|
31
|
+
}, import("zod/v4/core").$strip>>;
|
|
32
|
+
};
|
|
33
|
+
export declare const AutoSaveActionRegistration: BuilderActionRegistration<"auto_save", import("zod/mini").ZodMiniObject<{
|
|
34
|
+
description: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniString<string>>;
|
|
35
|
+
storageKey: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniString<string>>;
|
|
36
|
+
includeSensitive: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniDefault<import("zod/mini").ZodMiniBoolean<boolean>>>;
|
|
37
|
+
}, import("zod/v4/core").$strip>>, ResetActionRegistration: BuilderActionRegistration<"reset", import("zod/mini").ZodMiniObject<{
|
|
38
|
+
description: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniString<string>>;
|
|
39
|
+
confirmMessage: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniString<string>>;
|
|
40
|
+
resetToDefaults: import("zod/mini").ZodMiniDefault<import("zod/mini").ZodMiniBoolean<boolean>>;
|
|
41
|
+
}, import("zod/v4/core").$strip>>, GTMActionRegistration: BuilderActionRegistration<"gtm_event", import("zod/mini").ZodMiniObject<{
|
|
42
|
+
description: import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniString<string>>;
|
|
43
|
+
eventName: import("zod/mini").ZodMiniString<string>;
|
|
44
|
+
eventData: import("zod/mini").ZodMiniDefault<import("zod/mini").ZodMiniOptional<import("zod/mini").ZodMiniRecord<import("zod/mini").ZodMiniString<string>, import("zod/mini").ZodMiniUnknown>>>;
|
|
45
|
+
includeFormData: import("zod/mini").ZodMiniDefault<import("zod/mini").ZodMiniUnion<readonly [import("zod/mini").ZodMiniBoolean<boolean>, import("zod/mini").ZodMiniArray<import("zod/mini").ZodMiniString<string>>]>>;
|
|
46
|
+
}, import("zod/v4/core").$strip>>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AutoSaveActionRegistration,
|
|
3
|
+
GTMActionRegistration,
|
|
4
|
+
ResetActionRegistration,
|
|
5
|
+
createBrowserActionRegistrations
|
|
6
|
+
} from "../chunk-R6V3LH7F.js";
|
|
7
|
+
import "../chunk-FUHLRG3M.js";
|
|
8
|
+
import "../chunk-TBDZOQ2C.js";
|
|
9
|
+
import "../chunk-H4ABGAAG.js";
|
|
10
|
+
import "../chunk-LFWEJXWE.js";
|
|
11
|
+
import "../chunk-ZDEZ2FOC.js";
|
|
12
|
+
import "../chunk-4XPLSYTK.js";
|
|
13
|
+
import "../chunk-VGGERKV2.js";
|
|
14
|
+
export {
|
|
15
|
+
AutoSaveActionRegistration,
|
|
16
|
+
GTMActionRegistration,
|
|
17
|
+
ResetActionRegistration,
|
|
18
|
+
createBrowserActionRegistrations
|
|
19
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AutoSaveActionRegistration,
|
|
3
|
+
GTMActionRegistration,
|
|
4
|
+
ResetActionRegistration,
|
|
5
|
+
createBrowserActionRegistrations
|
|
6
|
+
} from "../chunk-R6V3LH7F.js";
|
|
7
|
+
import {
|
|
8
|
+
GDPRConsent,
|
|
9
|
+
createGDPRConsent
|
|
10
|
+
} from "../chunk-FUHLRG3M.js";
|
|
11
|
+
import {
|
|
12
|
+
clearTrackedAutoSaveDrafts,
|
|
13
|
+
createLocalStorageAutoSaveStorage,
|
|
14
|
+
localStorageAutoSaveStorage,
|
|
15
|
+
removeTrackedAutoSaveDraftKey
|
|
16
|
+
} from "../chunk-TBDZOQ2C.js";
|
|
17
|
+
import {
|
|
18
|
+
GTMTracker
|
|
19
|
+
} from "../chunk-H4ABGAAG.js";
|
|
20
|
+
import "../chunk-LFWEJXWE.js";
|
|
21
|
+
import "../chunk-ZDEZ2FOC.js";
|
|
22
|
+
import "../chunk-4XPLSYTK.js";
|
|
23
|
+
import "../chunk-VGGERKV2.js";
|
|
24
|
+
export {
|
|
25
|
+
AutoSaveActionRegistration,
|
|
26
|
+
GDPRConsent,
|
|
27
|
+
GTMActionRegistration,
|
|
28
|
+
GTMTracker,
|
|
29
|
+
ResetActionRegistration,
|
|
30
|
+
clearTrackedAutoSaveDrafts,
|
|
31
|
+
createBrowserActionRegistrations,
|
|
32
|
+
createGDPRConsent,
|
|
33
|
+
createLocalStorageAutoSaveStorage,
|
|
34
|
+
localStorageAutoSaveStorage,
|
|
35
|
+
removeTrackedAutoSaveDraftKey
|
|
36
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { AutoSaveStorage } from '../../actions/plugins/auto-save.plugin';
|
|
2
|
+
import type { BrowserStorage } from './gdpr-consent';
|
|
3
|
+
/** Removes all tracked draft keys and their storage metadata. */
|
|
4
|
+
export declare function clearTrackedAutoSaveDrafts(storage: BrowserStorage): void;
|
|
5
|
+
/** Removes a draft key and stops tracking it for consent revocation. */
|
|
6
|
+
export declare function removeTrackedAutoSaveDraftKey(storage: BrowserStorage, key: string): void;
|
|
7
|
+
/**
|
|
8
|
+
* Adapts a Web Storage implementation to the engine's auto-save storage port.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* The adapter is synchronous, so callers that need a result in the same tick,
|
|
12
|
+
* such as the consent tool's drafts, can use it without awaiting.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createLocalStorageAutoSaveStorage(storage: BrowserStorage): {
|
|
15
|
+
save: (key: string, data: unknown) => void;
|
|
16
|
+
load: (key: string) => unknown;
|
|
17
|
+
remove: (key: string) => void;
|
|
18
|
+
};
|
|
19
|
+
/** Browser localStorage adapter used by browser action registrations. */
|
|
20
|
+
export declare const localStorageAutoSaveStorage: AutoSaveStorage;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
clearTrackedAutoSaveDrafts,
|
|
3
|
+
createLocalStorageAutoSaveStorage,
|
|
4
|
+
localStorageAutoSaveStorage,
|
|
5
|
+
removeTrackedAutoSaveDraftKey
|
|
6
|
+
} from "../../chunk-TBDZOQ2C.js";
|
|
7
|
+
export {
|
|
8
|
+
clearTrackedAutoSaveDrafts,
|
|
9
|
+
createLocalStorageAutoSaveStorage,
|
|
10
|
+
localStorageAutoSaveStorage,
|
|
11
|
+
removeTrackedAutoSaveDraftKey
|
|
12
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface BrowserStorage {
|
|
2
|
+
getItem: (key: string) => string | null;
|
|
3
|
+
removeItem: (key: string) => void;
|
|
4
|
+
setItem: (key: string, value: string) => void;
|
|
5
|
+
}
|
|
6
|
+
export interface GDPRConsentStatus {
|
|
7
|
+
granted: boolean;
|
|
8
|
+
version: string;
|
|
9
|
+
timestamp: string;
|
|
10
|
+
}
|
|
11
|
+
export interface GDPRConsentTool {
|
|
12
|
+
isLocalStorageAvailable: () => boolean;
|
|
13
|
+
getConsent: () => GDPRConsentStatus | null;
|
|
14
|
+
hasConsent: () => boolean;
|
|
15
|
+
grantConsent: () => void;
|
|
16
|
+
revokeConsent: () => void;
|
|
17
|
+
needsConsentUpdate: () => boolean;
|
|
18
|
+
saveDraft: (formId: string, data: Record<string, unknown>) => boolean;
|
|
19
|
+
loadDraft: (formId: string) => Record<string, unknown> | null;
|
|
20
|
+
clearDraft: (formId: string) => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Creates consent and draft tools backed by browser storage.
|
|
24
|
+
*
|
|
25
|
+
* @remarks Supplying a storage adapter keeps consent behavior testable without
|
|
26
|
+
* a browser and lets hosts provide an isolated storage instance. Drafts go
|
|
27
|
+
* through the same tracked adapter as the auto-save action, so revoking consent
|
|
28
|
+
* clears both.
|
|
29
|
+
*/
|
|
30
|
+
export declare function createGDPRConsent(storage?: BrowserStorage | undefined): GDPRConsentTool;
|
|
31
|
+
/** Consent and draft tools backed by the browser's `localStorage`. */
|
|
32
|
+
export declare const GDPRConsent: GDPRConsentTool;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Pushes form analytics events to the browser's Google Tag Manager data layer. */
|
|
2
|
+
export declare class GTMTracker {
|
|
3
|
+
static isAvailable(): boolean;
|
|
4
|
+
static push(event: string, data?: Record<string, unknown>): void;
|
|
5
|
+
static pushFormEvent(eventType: 'form_mount' | 'form_step_complete' | 'form_submit' | 'form_abandon', formData?: Record<string, unknown>, metadata?: Record<string, unknown>): void;
|
|
6
|
+
static initialize(containerId: string): void;
|
|
7
|
+
}
|