@defra/forms-engine-plugin 4.7.2 → 4.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/.public/javascripts/shared.min.js +1 -1
- package/.public/javascripts/shared.min.js.map +1 -1
- package/.server/client/javascripts/geospatial-map.d.ts +6 -6
- package/.server/client/javascripts/geospatial-map.js +3 -3
- package/.server/client/javascripts/location-map.d.ts +1 -1
- package/.server/client/javascripts/location-map.js +1 -1
- package/.server/client/javascripts/map.d.ts +5 -1
- package/.server/client/javascripts/map.js +10 -2
- package/.server/client/javascripts/map.js.map +1 -1
- package/.server/client/javascripts/shared.d.ts +7 -7
- package/.server/server/index.d.ts +1 -1
- package/.server/server/plugins/crumb.d.ts +1 -1
- package/.server/server/plugins/engine/beta/form-context.d.ts +6 -6
- package/.server/server/plugins/engine/components/AutocompleteField.d.ts +4 -4
- package/.server/server/plugins/engine/components/CheckboxesField.d.ts +2 -2
- package/.server/server/plugins/engine/components/CheckboxesField.js +2 -2
- package/.server/server/plugins/engine/components/CheckboxesField.js.map +1 -1
- package/.server/server/plugins/engine/components/ComponentBase.d.ts +5 -5
- package/.server/server/plugins/engine/components/ComponentCollection.d.ts +8 -8
- package/.server/server/plugins/engine/components/DatePartsField.d.ts +11 -11
- package/.server/server/plugins/engine/components/DeclarationField.d.ts +3 -3
- package/.server/server/plugins/engine/components/Details.d.ts +1 -1
- package/.server/server/plugins/engine/components/EastingNorthingField.d.ts +22 -22
- package/.server/server/plugins/engine/components/EmailAddressField.d.ts +4 -4
- package/.server/server/plugins/engine/components/FileUploadField.d.ts +3 -3
- package/.server/server/plugins/engine/components/FormComponent.d.ts +10 -10
- package/.server/server/plugins/engine/components/GeospatialField.d.ts +6 -6
- package/.server/server/plugins/engine/components/HiddenField.d.ts +2 -2
- package/.server/server/plugins/engine/components/Html.d.ts +1 -1
- package/.server/server/plugins/engine/components/InsetText.d.ts +1 -1
- package/.server/server/plugins/engine/components/LatLongField.d.ts +22 -22
- package/.server/server/plugins/engine/components/List.d.ts +8 -8
- package/.server/server/plugins/engine/components/ListFormComponent.d.ts +10 -10
- package/.server/server/plugins/engine/components/LocationFieldBase.d.ts +6 -6
- package/.server/server/plugins/engine/components/LocationFieldHelpers.d.ts +14 -14
- package/.server/server/plugins/engine/components/Markdown.d.ts +1 -1
- package/.server/server/plugins/engine/components/MonthYearField.d.ts +11 -11
- package/.server/server/plugins/engine/components/MultilineTextField.d.ts +5 -5
- package/.server/server/plugins/engine/components/NationalGridFieldNumberField.d.ts +1 -1
- package/.server/server/plugins/engine/components/NumberField.d.ts +3 -3
- package/.server/server/plugins/engine/components/OsGridRefField.d.ts +1 -1
- package/.server/server/plugins/engine/components/PaymentField.d.ts +12 -12
- package/.server/server/plugins/engine/components/RadiosField.d.ts +1 -1
- package/.server/server/plugins/engine/components/SelectField.d.ts +4 -4
- package/.server/server/plugins/engine/components/SelectionControlField.d.ts +10 -10
- package/.server/server/plugins/engine/components/TelephoneNumberField.d.ts +4 -4
- package/.server/server/plugins/engine/components/TextField.d.ts +2 -2
- package/.server/server/plugins/engine/components/UkAddressField.d.ts +11 -11
- package/.server/server/plugins/engine/components/YesNoField.d.ts +2 -2
- package/.server/server/plugins/engine/components/helpers/__stubs__/geospatial.d.ts +1 -1
- package/.server/server/plugins/engine/components/helpers/components.d.ts +5 -5
- package/.server/server/plugins/engine/components/helpers/geospatial.d.ts +1 -1
- package/.server/server/plugins/engine/components/index.d.ts +27 -27
- package/.server/server/plugins/engine/components/types.d.ts +1 -1
- package/.server/server/plugins/engine/configureEnginePlugin.d.ts +4 -4
- package/.server/server/plugins/engine/date-helper.d.ts +1 -1
- package/.server/server/plugins/engine/helpers.d.ts +8 -8
- package/.server/server/plugins/engine/index.d.ts +5 -5
- package/.server/server/plugins/engine/models/FormModel.d.ts +6 -6
- package/.server/server/plugins/engine/models/SummaryViewModel.d.ts +6 -6
- package/.server/server/plugins/engine/models/index.d.ts +2 -2
- package/.server/server/plugins/engine/models/types.d.ts +4 -4
- package/.server/server/plugins/engine/options.d.ts +1 -1
- package/.server/server/plugins/engine/options.js +1 -1
- package/.server/server/plugins/engine/options.test.js +1 -1
- package/.server/server/plugins/engine/outputFormatters/adapter/v1.d.ts +4 -4
- package/.server/server/plugins/engine/outputFormatters/human/v1.d.ts +4 -4
- package/.server/server/plugins/engine/outputFormatters/index.d.ts +5 -5
- package/.server/server/plugins/engine/outputFormatters/machine/v1.d.ts +4 -4
- package/.server/server/plugins/engine/outputFormatters/machine/v2.d.ts +4 -4
- package/.server/server/plugins/engine/pageControllers/FileUploadPageController.d.ts +8 -8
- package/.server/server/plugins/engine/pageControllers/PageController.d.ts +6 -6
- package/.server/server/plugins/engine/pageControllers/QuestionPageController.d.ts +8 -8
- package/.server/server/plugins/engine/pageControllers/RepeatPageController.d.ts +5 -5
- package/.server/server/plugins/engine/pageControllers/StartPageController.d.ts +4 -4
- package/.server/server/plugins/engine/pageControllers/StatusPageController.d.ts +4 -4
- package/.server/server/plugins/engine/pageControllers/SummaryPageController.d.ts +5 -5
- package/.server/server/plugins/engine/pageControllers/TerminalPageController.d.ts +3 -3
- package/.server/server/plugins/engine/pageControllers/__stubs__/request.d.ts +2 -2
- package/.server/server/plugins/engine/pageControllers/errors.d.ts +1 -1
- package/.server/server/plugins/engine/pageControllers/helpers/pages.d.ts +2 -2
- package/.server/server/plugins/engine/pageControllers/helpers/state.d.ts +5 -5
- package/.server/server/plugins/engine/pageControllers/helpers/state.js +1 -1
- package/.server/server/plugins/engine/pageControllers/helpers/state.js.map +1 -1
- package/.server/server/plugins/engine/pageControllers/helpers/submission.d.ts +1 -1
- package/.server/server/plugins/engine/pageControllers/index.d.ts +7 -7
- package/.server/server/plugins/engine/plugin.d.ts +1 -1
- package/.server/server/plugins/engine/routes/file-upload.d.ts +1 -1
- package/.server/server/plugins/engine/routes/index.d.ts +3 -3
- package/.server/server/plugins/engine/routes/payment-helper.d.ts +3 -3
- package/.server/server/plugins/engine/routes/payment-helper.js +2 -2
- package/.server/server/plugins/engine/routes/payment.js +5 -5
- package/.server/server/plugins/engine/routes/payment.test.js +1 -1
- package/.server/server/plugins/engine/routes/questions.d.ts +2 -2
- package/.server/server/plugins/engine/routes/repeaters/item-delete.d.ts +2 -2
- package/.server/server/plugins/engine/routes/repeaters/summary.d.ts +2 -2
- package/.server/server/plugins/engine/services/index.d.ts +3 -3
- package/.server/server/plugins/engine/services/notifyService.d.ts +4 -4
- package/.server/server/plugins/engine/services/uploadService.d.ts +2 -2
- package/.server/server/plugins/engine/services/uploadService.js +1 -1
- package/.server/server/plugins/engine/types/index.d.ts +10 -10
- package/.server/server/plugins/engine/types/schema.d.ts +1 -1
- package/.server/server/plugins/engine/types.d.ts +25 -16
- package/.server/server/plugins/engine/types.js.map +1 -1
- package/.server/server/plugins/engine/validationHelpers.d.ts +2 -2
- package/.server/server/plugins/engine/vision.d.ts +1 -1
- package/.server/server/plugins/map/index.d.ts +1 -1
- package/.server/server/plugins/map/index.js +1 -1
- package/.server/server/plugins/map/routes/get-os-token.d.ts +11 -1
- package/.server/server/plugins/map/routes/get-os-token.js +12 -2
- package/.server/server/plugins/map/routes/get-os-token.js.map +1 -1
- package/.server/server/plugins/map/routes/index.d.ts +4 -4
- package/.server/server/plugins/map/routes/index.js +3 -2
- package/.server/server/plugins/map/routes/index.js.map +1 -1
- package/.server/server/plugins/map/routes/vts/esri-aerial.json +23 -0
- package/.server/server/plugins/map/service.d.ts +1 -1
- package/.server/server/plugins/map/service.js +5 -2
- package/.server/server/plugins/map/service.js.map +1 -1
- package/.server/server/plugins/map/test/__stubs__/find.d.ts +1 -1
- package/.server/server/plugins/map/test/__stubs__/find.js +1 -1
- package/.server/server/plugins/nunjucks/context.d.ts +2 -2
- package/.server/server/plugins/nunjucks/context.js +2 -2
- package/.server/server/plugins/nunjucks/context.test.js +1 -1
- package/.server/server/plugins/nunjucks/enviroment.test.js +1 -1
- package/.server/server/plugins/nunjucks/environment.d.ts +3 -3
- package/.server/server/plugins/nunjucks/environment.js +3 -3
- package/.server/server/plugins/nunjucks/filters/answer.d.ts +1 -1
- package/.server/server/plugins/nunjucks/filters/answer.js +2 -2
- package/.server/server/plugins/nunjucks/filters/answer.test.js +1 -1
- package/.server/server/plugins/nunjucks/filters/evaluate.d.ts +1 -1
- package/.server/server/plugins/nunjucks/filters/evaluate.js +1 -1
- package/.server/server/plugins/nunjucks/filters/field.d.ts +1 -1
- package/.server/server/plugins/nunjucks/filters/field.js +1 -1
- package/.server/server/plugins/nunjucks/filters/field.test.js +1 -1
- package/.server/server/plugins/nunjucks/filters/href.d.ts +1 -1
- package/.server/server/plugins/nunjucks/filters/href.js +1 -1
- package/.server/server/plugins/nunjucks/filters/href.test.js +1 -1
- package/.server/server/plugins/nunjucks/filters/index.d.ts +8 -8
- package/.server/server/plugins/nunjucks/filters/page.d.ts +1 -1
- package/.server/server/plugins/nunjucks/filters/page.js +1 -1
- package/.server/server/plugins/nunjucks/filters/page.test.js +1 -1
- package/.server/server/plugins/nunjucks/index.d.ts +3 -3
- package/.server/server/plugins/nunjucks/render.d.ts +2 -2
- package/.server/server/plugins/nunjucks/render.js +1 -1
- package/.server/server/plugins/nunjucks/types.d.ts +1 -1
- package/.server/server/plugins/nunjucks/types.js +1 -1
- package/.server/server/plugins/payment/helper.d.ts +2 -2
- package/.server/server/plugins/payment/helper.js +1 -1
- package/.server/server/plugins/payment/service.d.ts +3 -3
- package/.server/server/plugins/payment/service.js +1 -1
- package/.server/server/plugins/postcode-lookup/index.d.ts +1 -1
- package/.server/server/plugins/postcode-lookup/index.js +1 -1
- package/.server/server/plugins/postcode-lookup/models/index.d.ts +6 -6
- package/.server/server/plugins/postcode-lookup/models/index.js +1 -1
- package/.server/server/plugins/postcode-lookup/routes/index.d.ts +6 -6
- package/.server/server/plugins/postcode-lookup/routes/index.js +15 -15
- package/.server/server/plugins/postcode-lookup/routes/index.js.map +1 -1
- package/.server/server/plugins/postcode-lookup/service.d.ts +1 -1
- package/.server/server/plugins/postcode-lookup/service.js +5 -2
- package/.server/server/plugins/postcode-lookup/service.js.map +1 -1
- package/.server/server/plugins/postcode-lookup/types.js +1 -1
- package/.server/server/routes/index.d.ts +2 -2
- package/.server/server/routes/types.d.ts +1 -1
- package/.server/server/schemas/index.d.ts +2 -2
- package/.server/server/services/cacheService.d.ts +8 -8
- package/.server/server/services/cacheService.js +2 -5
- package/.server/server/services/cacheService.js.map +1 -1
- package/.server/server/services/httpService.test.js +1 -1
- package/.server/server/services/index.d.ts +1 -1
- package/.server/server/types.d.ts +7 -7
- package/.server/server/utils/file-form-service.d.ts +2 -2
- package/.server/server/utils/file-form-service.js +1 -1
- package/package.json +8 -4
- package/src/client/javascripts/application.js +1 -1
- package/src/client/javascripts/geospatial-map.js +4 -4
- package/src/client/javascripts/location-map.js +2 -2
- package/src/client/javascripts/map.js +13 -4
- package/src/client/javascripts/shared.js +7 -7
- package/src/index.ts +3 -3
- package/src/server/common/helpers/logging/logger-options.ts +1 -1
- package/src/server/common/helpers/logging/logger.ts +1 -1
- package/src/server/common/helpers/logging/request-logger.ts +1 -1
- package/src/server/common/helpers/logging/request-tracing.js +1 -1
- package/src/server/common/helpers/redis-client.js +2 -2
- package/src/server/index.ts +13 -13
- package/src/server/plugins/crumb.ts +2 -2
- package/src/server/plugins/engine/beta/form-context.ts +9 -9
- package/src/server/plugins/engine/components/AutocompleteField.ts +3 -3
- package/src/server/plugins/engine/components/CheckboxesField.ts +7 -8
- package/src/server/plugins/engine/components/ComponentBase.ts +5 -5
- package/src/server/plugins/engine/components/ComponentCollection.ts +9 -9
- package/src/server/plugins/engine/components/DatePartsField.ts +8 -8
- package/src/server/plugins/engine/components/DeclarationField.ts +3 -3
- package/src/server/plugins/engine/components/Details.ts +1 -1
- package/src/server/plugins/engine/components/EastingNorthingField.ts +9 -9
- package/src/server/plugins/engine/components/EmailAddressField.ts +3 -3
- package/src/server/plugins/engine/components/FileUploadField.ts +6 -6
- package/src/server/plugins/engine/components/FormComponent.ts +4 -4
- package/src/server/plugins/engine/components/GeospatialField.ts +5 -5
- package/src/server/plugins/engine/components/HiddenField.ts +4 -4
- package/src/server/plugins/engine/components/Html.ts +1 -1
- package/src/server/plugins/engine/components/InsetText.ts +1 -1
- package/src/server/plugins/engine/components/LatLongField.ts +9 -9
- package/src/server/plugins/engine/components/List.ts +2 -2
- package/src/server/plugins/engine/components/ListFormComponent.ts +4 -4
- package/src/server/plugins/engine/components/LocationFieldBase.ts +5 -5
- package/src/server/plugins/engine/components/LocationFieldHelpers.ts +5 -5
- package/src/server/plugins/engine/components/Markdown.ts +1 -1
- package/src/server/plugins/engine/components/MonthYearField.ts +8 -8
- package/src/server/plugins/engine/components/MultilineTextField.ts +4 -4
- package/src/server/plugins/engine/components/NationalGridFieldNumberField.ts +2 -2
- package/src/server/plugins/engine/components/NumberField.ts +3 -3
- package/src/server/plugins/engine/components/OsGridRefField.ts +2 -2
- package/src/server/plugins/engine/components/PaymentField.ts +8 -8
- package/src/server/plugins/engine/components/RadiosField.ts +1 -1
- package/src/server/plugins/engine/components/SelectField.ts +2 -2
- package/src/server/plugins/engine/components/SelectionControlField.ts +4 -4
- package/src/server/plugins/engine/components/TelephoneNumberField.ts +4 -4
- package/src/server/plugins/engine/components/TextField.ts +3 -3
- package/src/server/plugins/engine/components/UkAddressField.ts +7 -7
- package/src/server/plugins/engine/components/YesNoField.ts +5 -5
- package/src/server/plugins/engine/components/helpers/__stubs__/geospatial.ts +1 -1
- package/src/server/plugins/engine/components/helpers/components.ts +8 -8
- package/src/server/plugins/engine/components/helpers/geospatial.ts +1 -1
- package/src/server/plugins/engine/components/index.ts +27 -27
- package/src/server/plugins/engine/components/types.ts +1 -1
- package/src/server/plugins/engine/configureEnginePlugin.ts +10 -10
- package/src/server/plugins/engine/date-helper.ts +1 -1
- package/src/server/plugins/engine/helpers.ts +8 -8
- package/src/server/plugins/engine/index.ts +8 -8
- package/src/server/plugins/engine/models/FormModel.ts +15 -15
- package/src/server/plugins/engine/models/SummaryViewModel.ts +10 -10
- package/src/server/plugins/engine/models/index.ts +2 -2
- package/src/server/plugins/engine/models/types.ts +4 -4
- package/src/server/plugins/engine/options.js +3 -3
- package/src/server/plugins/engine/outputFormatters/adapter/v1.ts +6 -6
- package/src/server/plugins/engine/outputFormatters/human/v1.ts +9 -9
- package/src/server/plugins/engine/outputFormatters/index.ts +8 -8
- package/src/server/plugins/engine/outputFormatters/machine/v1.ts +7 -7
- package/src/server/plugins/engine/outputFormatters/machine/v2.ts +6 -6
- package/src/server/plugins/engine/pageControllers/FileUploadPageController.ts +9 -9
- package/src/server/plugins/engine/pageControllers/PageController.ts +7 -7
- package/src/server/plugins/engine/pageControllers/QuestionPageController.ts +13 -13
- package/src/server/plugins/engine/pageControllers/RepeatPageController.ts +6 -6
- package/src/server/plugins/engine/pageControllers/StartPageController.ts +3 -3
- package/src/server/plugins/engine/pageControllers/StatusPageController.ts +5 -5
- package/src/server/plugins/engine/pageControllers/SummaryPageController.ts +12 -12
- package/src/server/plugins/engine/pageControllers/TerminalPageController.ts +3 -3
- package/src/server/plugins/engine/pageControllers/__stubs__/request.ts +3 -3
- package/src/server/plugins/engine/pageControllers/__stubs__/server.ts +2 -2
- package/src/server/plugins/engine/pageControllers/errors.ts +1 -1
- package/src/server/plugins/engine/pageControllers/helpers/pages.ts +2 -2
- package/src/server/plugins/engine/pageControllers/helpers/state.ts +9 -9
- package/src/server/plugins/engine/pageControllers/helpers/submission.ts +5 -5
- package/src/server/plugins/engine/pageControllers/index.ts +7 -7
- package/src/server/plugins/engine/pageControllers/validationOptions.ts +1 -1
- package/src/server/plugins/engine/plugin.ts +14 -14
- package/src/server/plugins/engine/routes/file-upload.ts +2 -2
- package/src/server/plugins/engine/routes/index.ts +10 -10
- package/src/server/plugins/engine/routes/payment-helper.js +4 -4
- package/src/server/plugins/engine/routes/payment.js +9 -9
- package/src/server/plugins/engine/routes/questions.ts +10 -10
- package/src/server/plugins/engine/routes/repeaters/item-delete.ts +6 -6
- package/src/server/plugins/engine/routes/repeaters/summary.ts +5 -5
- package/src/server/plugins/engine/services/formSubmissionService.js +2 -2
- package/src/server/plugins/engine/services/index.js +3 -3
- package/src/server/plugins/engine/services/localFormsService.js +2 -2
- package/src/server/plugins/engine/services/notifyService.ts +9 -9
- package/src/server/plugins/engine/services/uploadService.js +3 -3
- package/src/server/plugins/engine/types/index.ts +10 -10
- package/src/server/plugins/engine/types/schema.ts +2 -2
- package/src/server/plugins/engine/types.ts +22 -17
- package/src/server/plugins/engine/validationHelpers.ts +3 -3
- package/src/server/plugins/engine/vision.ts +3 -3
- package/src/server/plugins/map/index.js +2 -2
- package/src/server/plugins/map/routes/get-os-token.js +15 -3
- package/src/server/plugins/map/routes/index.js +7 -5
- package/src/server/plugins/map/routes/vts/esri-aerial.json +23 -0
- package/src/server/plugins/map/service.js +7 -4
- package/src/server/plugins/map/test/__stubs__/find.js +1 -1
- package/src/server/plugins/nunjucks/context.js +5 -5
- package/src/server/plugins/nunjucks/environment.js +6 -6
- package/src/server/plugins/nunjucks/filters/answer.js +3 -3
- package/src/server/plugins/nunjucks/filters/evaluate.js +2 -2
- package/src/server/plugins/nunjucks/filters/field.js +1 -1
- package/src/server/plugins/nunjucks/filters/href.js +2 -2
- package/src/server/plugins/nunjucks/filters/index.js +8 -8
- package/src/server/plugins/nunjucks/filters/page.js +1 -1
- package/src/server/plugins/nunjucks/index.js +3 -3
- package/src/server/plugins/nunjucks/plugin.js +3 -3
- package/src/server/plugins/nunjucks/render.js +2 -2
- package/src/server/plugins/nunjucks/types.js +1 -1
- package/src/server/plugins/payment/helper.js +2 -2
- package/src/server/plugins/payment/service.js +4 -4
- package/src/server/plugins/postcode-lookup/index.js +2 -2
- package/src/server/plugins/postcode-lookup/models/index.js +3 -3
- package/src/server/plugins/postcode-lookup/routes/index.js +24 -14
- package/src/server/plugins/postcode-lookup/service.js +7 -4
- package/src/server/plugins/postcode-lookup/types.js +1 -1
- package/src/server/plugins/session.ts +1 -1
- package/src/server/routes/index.ts +2 -2
- package/src/server/routes/public.ts +1 -1
- package/src/server/routes/types.ts +1 -1
- package/src/server/schemas/index.ts +2 -2
- package/src/server/secure-context.js +1 -1
- package/src/server/services/cacheService.ts +13 -18
- package/src/server/services/httpService.ts +1 -1
- package/src/server/services/index.ts +1 -1
- package/src/server/types.ts +7 -7
- package/src/server/utils/notify.ts +2 -2
- package/src/server/utils/utils.js +1 -1
- package/src/typings/hapi/index.d.ts +4 -4
- package/src/typings/joi/index.d.ts +1 -1
- package/src/server/common/helpers/logging/logger-options.test.ts +0 -50
- package/src/server/index.test.ts +0 -644
- package/src/server/plugins/engine/beta/form-context.test.ts +0 -373
- package/src/server/plugins/engine/components/AutocompleteField.test.ts +0 -362
- package/src/server/plugins/engine/components/CheckboxesField.test.ts +0 -486
- package/src/server/plugins/engine/components/DatePartsField.test.ts +0 -927
- package/src/server/plugins/engine/components/DeclarationField.test.ts +0 -560
- package/src/server/plugins/engine/components/Details.test.ts +0 -49
- package/src/server/plugins/engine/components/EastingNorthingField.test.ts +0 -727
- package/src/server/plugins/engine/components/EmailAddressField.test.ts +0 -445
- package/src/server/plugins/engine/components/FileUploadField.test.ts +0 -1079
- package/src/server/plugins/engine/components/GeospatialField.test.ts +0 -380
- package/src/server/plugins/engine/components/HiddenField.test.ts +0 -188
- package/src/server/plugins/engine/components/Html.test.ts +0 -48
- package/src/server/plugins/engine/components/InsetText.test.ts +0 -48
- package/src/server/plugins/engine/components/LatLongField.test.ts +0 -898
- package/src/server/plugins/engine/components/List.test.ts +0 -79
- package/src/server/plugins/engine/components/LocationFieldBase.test.ts +0 -253
- package/src/server/plugins/engine/components/LocationFieldHelpers.test.ts +0 -743
- package/src/server/plugins/engine/components/Markdown.test.ts +0 -48
- package/src/server/plugins/engine/components/MonthYearField.test.ts +0 -617
- package/src/server/plugins/engine/components/MultilineTextField.test.ts +0 -647
- package/src/server/plugins/engine/components/NationalGridFieldNumberField.test.ts +0 -449
- package/src/server/plugins/engine/components/NumberField.test.ts +0 -723
- package/src/server/plugins/engine/components/OsGridRefField.test.ts +0 -460
- package/src/server/plugins/engine/components/PaymentField.test.ts +0 -745
- package/src/server/plugins/engine/components/RadiosField.test.ts +0 -297
- package/src/server/plugins/engine/components/SelectField.test.ts +0 -289
- package/src/server/plugins/engine/components/TelephoneNumberField.test.ts +0 -384
- package/src/server/plugins/engine/components/TextField.test.ts +0 -521
- package/src/server/plugins/engine/components/UkAddressField.test.ts +0 -806
- package/src/server/plugins/engine/components/YesNoField.test.ts +0 -256
- package/src/server/plugins/engine/components/helpers/components.test.ts +0 -399
- package/src/server/plugins/engine/components/helpers/geospatial.test.js +0 -55
- package/src/server/plugins/engine/components/helpers/helpers.test.ts +0 -219
- package/src/server/plugins/engine/date-helper.test.ts +0 -47
- package/src/server/plugins/engine/helpers.test.ts +0 -868
- package/src/server/plugins/engine/models/FormModel.test.ts +0 -725
- package/src/server/plugins/engine/models/SummaryViewModel.test.ts +0 -472
- package/src/server/plugins/engine/options.test.js +0 -63
- package/src/server/plugins/engine/outputFormatters/adapter/v1.location.test.ts +0 -356
- package/src/server/plugins/engine/outputFormatters/adapter/v1.test.ts +0 -871
- package/src/server/plugins/engine/outputFormatters/human/v1.payment.test.ts +0 -147
- package/src/server/plugins/engine/outputFormatters/human/v1.test.ts +0 -145
- package/src/server/plugins/engine/outputFormatters/index.test.ts +0 -17
- package/src/server/plugins/engine/outputFormatters/machine/v1.test.ts +0 -268
- package/src/server/plugins/engine/outputFormatters/machine/v2.location.test.ts +0 -341
- package/src/server/plugins/engine/outputFormatters/machine/v2.payment.test.ts +0 -115
- package/src/server/plugins/engine/outputFormatters/machine/v2.test.ts +0 -311
- package/src/server/plugins/engine/pageControllers/FileUploadPageController.test.ts +0 -1372
- package/src/server/plugins/engine/pageControllers/PageController.test.ts +0 -246
- package/src/server/plugins/engine/pageControllers/QuestionPageController.test.ts +0 -1686
- package/src/server/plugins/engine/pageControllers/RepeatPageController.test.ts +0 -279
- package/src/server/plugins/engine/pageControllers/StartPageController.test.ts +0 -32
- package/src/server/plugins/engine/pageControllers/StatusPageController.test.ts +0 -32
- package/src/server/plugins/engine/pageControllers/SummaryPageController.test.ts +0 -89
- package/src/server/plugins/engine/pageControllers/TerminalController.test.ts +0 -37
- package/src/server/plugins/engine/pageControllers/errors.test.ts +0 -78
- package/src/server/plugins/engine/pageControllers/helpers/helpers.test.ts +0 -182
- package/src/server/plugins/engine/pageControllers/helpers/state.test.ts +0 -359
- package/src/server/plugins/engine/pageControllers/helpers/submission.test.ts +0 -373
- package/src/server/plugins/engine/referenceNumbers.test.ts +0 -74
- package/src/server/plugins/engine/routes/index.test.ts +0 -332
- package/src/server/plugins/engine/routes/payment-helper.test.js +0 -136
- package/src/server/plugins/engine/routes/payment.test.js +0 -180
- package/src/server/plugins/engine/routes/questions.test.ts +0 -502
- package/src/server/plugins/engine/routes/repeaters/item-delete.test.ts +0 -83
- package/src/server/plugins/engine/routes/repeaters/summary.test.ts +0 -75
- package/src/server/plugins/engine/services/formsService.test.js +0 -26
- package/src/server/plugins/engine/services/notifyService.test.ts +0 -310
- package/src/server/plugins/engine/types/schema.test.ts +0 -234
- package/src/server/plugins/engine/views/components/service-banner/template.test.js +0 -43
- package/src/server/plugins/engine/views/components/tag-env/template.test.js +0 -28
- package/src/server/plugins/engine/views/partials/preview-banner.test.js +0 -122
- package/src/server/plugins/map/routes/get-os-token.test.js +0 -55
- package/src/server/plugins/map/service.test.js +0 -144
- package/src/server/plugins/nunjucks/context.test.js +0 -109
- package/src/server/plugins/nunjucks/enviroment.test.js +0 -207
- package/src/server/plugins/nunjucks/filters/answer.test.js +0 -92
- package/src/server/plugins/nunjucks/filters/field.test.js +0 -75
- package/src/server/plugins/nunjucks/filters/href.test.js +0 -80
- package/src/server/plugins/nunjucks/filters/merge.test.js +0 -15
- package/src/server/plugins/nunjucks/filters/page.test.js +0 -65
- package/src/server/plugins/payment/helper.test.js +0 -29
- package/src/server/plugins/payment/service.test.js +0 -218
- package/src/server/plugins/postcode-lookup/service.test.js +0 -177
- package/src/server/postcode-lookup.test.ts +0 -64
- package/src/server/routes/dummy-api.test.ts +0 -97
- package/src/server/services/cacheService.test.ts +0 -308
- package/src/server/services/httpService.test.js +0 -491
- package/src/server/utils/file-form-service.test.js +0 -127
- package/src/server/utils/notify.test.ts +0 -37
- package/src/server/utils/secure-context/get-trust-store-certs.test.js +0 -19
- package/src/server/utils/utils.test.js +0 -69
|
@@ -191,9 +191,9 @@ export type Context = {
|
|
|
191
191
|
*/
|
|
192
192
|
drawPlugin: any;
|
|
193
193
|
};
|
|
194
|
-
import type { MapsEnvironmentConfig } from '
|
|
195
|
-
import type { Feature } from '
|
|
196
|
-
import type { InteractiveMap } from '
|
|
197
|
-
import type { FeatureCollection } from '
|
|
198
|
-
import type { MapLibreMap } from '
|
|
199
|
-
import type { Geometry } from '
|
|
194
|
+
import type { MapsEnvironmentConfig } from '../../client/javascripts/map.js';
|
|
195
|
+
import type { Feature } from '../../server/plugins/engine/types.js';
|
|
196
|
+
import type { InteractiveMap } from '../../client/javascripts/map.js';
|
|
197
|
+
import type { FeatureCollection } from '../../server/plugins/engine/types.js';
|
|
198
|
+
import type { MapLibreMap } from '../../client/javascripts/map.js';
|
|
199
|
+
import type { Geometry } from '../../server/plugins/engine/types.js';
|
|
@@ -967,11 +967,11 @@ function onListElKeydownFactory() {
|
|
|
967
967
|
}
|
|
968
968
|
|
|
969
969
|
/**
|
|
970
|
-
* @import { MapsEnvironmentConfig, InteractiveMap } from '
|
|
970
|
+
* @import { MapsEnvironmentConfig, InteractiveMap } from '../../client/javascripts/map.js'
|
|
971
971
|
*/
|
|
972
972
|
|
|
973
973
|
/**
|
|
974
|
-
* @import { Geometry, FeatureCollection, Feature, Coordinates } from '
|
|
974
|
+
* @import { Geometry, FeatureCollection, Feature, Coordinates } from '../../server/plugins/engine/types.js'
|
|
975
975
|
*/
|
|
976
976
|
|
|
977
977
|
/**
|
|
@@ -1095,6 +1095,6 @@ function onListElKeydownFactory() {
|
|
|
1095
1095
|
*/
|
|
1096
1096
|
|
|
1097
1097
|
/**
|
|
1098
|
-
* @import { MapLibreMap } from '
|
|
1098
|
+
* @import { MapLibreMap } from '../../client/javascripts/map.js'
|
|
1099
1099
|
*/
|
|
1100
1100
|
//# sourceMappingURL=geospatial-map.js.map
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* @param {number} index - the 0-based index
|
|
6
6
|
*/
|
|
7
7
|
export function processLocation(config: MapsEnvironmentConfig, location: Element, index: number): void;
|
|
8
|
-
import type { MapsEnvironmentConfig } from '
|
|
8
|
+
import type { MapsEnvironmentConfig } from '../../client/javascripts/map.js';
|
|
@@ -437,6 +437,6 @@ export function processLocation(config, location, index) {
|
|
|
437
437
|
}
|
|
438
438
|
|
|
439
439
|
/**
|
|
440
|
-
* @import { InteractiveMap, InteractiveMapInitConfig, MapCenter, MapLibreMap, MapsEnvironmentConfig } from '
|
|
440
|
+
* @import { InteractiveMap, InteractiveMapInitConfig, MapCenter, MapLibreMap, MapsEnvironmentConfig } from '../../client/javascripts/map.js'
|
|
441
441
|
*/
|
|
442
442
|
//# sourceMappingURL=location-map.js.map
|
|
@@ -187,6 +187,10 @@ export type TileData = {
|
|
|
187
187
|
* - the black and white tile URL
|
|
188
188
|
*/
|
|
189
189
|
VTS_BLACK_AND_WHITE_URL: string;
|
|
190
|
+
/**
|
|
191
|
+
* - the aerial tile URL
|
|
192
|
+
*/
|
|
193
|
+
VTS_AERIAL_URL: string;
|
|
190
194
|
};
|
|
191
195
|
export type MapsEnvironmentConfig = {
|
|
192
196
|
/**
|
|
@@ -202,4 +206,4 @@ export type MapsEnvironmentConfig = {
|
|
|
202
206
|
*/
|
|
203
207
|
data: TileData;
|
|
204
208
|
};
|
|
205
|
-
import type { Feature } from '
|
|
209
|
+
import type { Feature } from '../../server/plugins/engine/types.js';
|
|
@@ -11,7 +11,8 @@ const COMPANY_SYMBOL_CODE = 169;
|
|
|
11
11
|
const defaultData = {
|
|
12
12
|
VTS_OUTDOOR_URL: '/api/maps/vts/OS_VTS_3857_Outdoor.json',
|
|
13
13
|
VTS_DARK_URL: '/api/maps/vts/OS_VTS_3857_Dark.json',
|
|
14
|
-
VTS_BLACK_AND_WHITE_URL: '/api/maps/vts/OS_VTS_3857_Black_and_White.json'
|
|
14
|
+
VTS_BLACK_AND_WHITE_URL: '/api/maps/vts/OS_VTS_3857_Black_and_White.json',
|
|
15
|
+
VTS_AERIAL_URL: '/api/maps/vts/esri-aerial.json'
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
/**
|
|
@@ -315,6 +316,12 @@ export function createMap(mapId, initConfig, mapsConfig) {
|
|
|
315
316
|
logo: `${assetPath}/interactive-map/assets/images/os-logo-black.svg`,
|
|
316
317
|
logoAltText,
|
|
317
318
|
attribution: `Contains OS data ${String.fromCodePoint(COMPANY_SYMBOL_CODE)} Crown copyright and database rights ${new Date().getFullYear()}`
|
|
319
|
+
}, {
|
|
320
|
+
id: 'aerial',
|
|
321
|
+
label: 'Aerial',
|
|
322
|
+
url: data.VTS_AERIAL_URL,
|
|
323
|
+
thumbnail: `${assetPath}/interactive-map/assets/images/aerial-map-thumb.jpg`,
|
|
324
|
+
attribution: `Tiles ${String.fromCodePoint(COMPANY_SYMBOL_CODE)} Esri — Source: Esri, Maxar, Earthstar Geographics, and the GIS User Community ${new Date().getFullYear()}`
|
|
318
325
|
}]
|
|
319
326
|
}), interactPlugin, defra.searchPlugin({
|
|
320
327
|
transformRequest: transformGeocodeRequest,
|
|
@@ -382,6 +389,7 @@ export function centerMap(map, mapProvider, center) {
|
|
|
382
389
|
* @property {string} VTS_OUTDOOR_URL - the outdoor tile URL
|
|
383
390
|
* @property {string} VTS_DARK_URL - the dark tile URL
|
|
384
391
|
* @property {string} VTS_BLACK_AND_WHITE_URL - the black and white tile URL
|
|
392
|
+
* @property {string} VTS_AERIAL_URL - the aerial tile URL
|
|
385
393
|
*/
|
|
386
394
|
|
|
387
395
|
/**
|
|
@@ -392,6 +400,6 @@ export function centerMap(map, mapProvider, center) {
|
|
|
392
400
|
*/
|
|
393
401
|
|
|
394
402
|
/**
|
|
395
|
-
* @import { Feature } from '
|
|
403
|
+
* @import { Feature } from '../../server/plugins/engine/types.js'
|
|
396
404
|
*/
|
|
397
405
|
//# sourceMappingURL=map.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map.js","names":["centroid","OsGridRef","LatLon","processGeospatial","processLocation","DEFAULT_LAT","DEFAULT_LONG","COMPANY_SYMBOL_CODE","defaultData","VTS_OUTDOOR_URL","VTS_DARK_URL","VTS_BLACK_AND_WHITE_URL","latLongToEastingNorthing","lat","long","point","toOsGrid","eastingNorthingToLatLong","easting","northing","latLong","toLatLon","latitude","longitude","latLongToOsGridRef","toString","osGridRefToLatLong","osGridRef","parse","getCoordinateGridRef","feature","geometry","type","coordinates","getCentroidGridRef","centre","defaultConfig","zoom","center","EVENTS","mapReady","interactMarkerChange","drawReady","drawCreated","drawEdited","drawCancelled","formSubmitFactory","buttons","onFormSubmit","e","submitter","HTMLButtonElement","includes","preventDefault","initMaps","config","assetPath","apiPath","data","locations","document","querySelectorAll","geospatials","length","form","closest","Array","from","addEventListener","forEach","location","index","geospatial","makeTileRequestTransformer","transformTileRequest","url","resourceType","startsWith","replace","window","origin","headers","encodeURIComponent","spritesPath","path","substring","transformGeocodeRequest","request","URL","Request","options","createMap","mapId","initConfig","mapsConfig","logoAltText","defra","interactPlugin","markerColor","outdoor","dark","interactionMode","multiSelect","map","InteractiveMap","enableFullscreen","autoColorScheme","mapProvider","maplibreProvider","reverseGeocodeProvider","openNamesProvider","behaviour","minZoom","maxZoom","containerHeight","enableZoomControls","transformRequest","plugins","mapStylesPlugin","mapStyles","id","label","thumbnail","logo","attribution","String","fromCodePoint","Date","getFullYear","backgroundColor","mapColorScheme","appColorScheme","searchPlugin","osNamesURL","width","showMarker","scaleBarPlugin","units","centerMap","addMarker","flyTo","essential"],"sources":["../../../src/client/javascripts/map.js"],"sourcesContent":["import { centroid } from '@turf/centroid'\n// @ts-expect-error - no types\nimport OsGridRef, { LatLon } from 'geodesy/osgridref.js'\n\nimport { processGeospatial } from '~/src/client/javascripts/geospatial-map.js'\nimport { processLocation } from '~/src/client/javascripts/location-map.js'\n\n// Center of UK\nconst DEFAULT_LAT = 53.825564\nconst DEFAULT_LONG = -2.421975\nconst COMPANY_SYMBOL_CODE = 169\n\nconst defaultData = {\n VTS_OUTDOOR_URL: '/api/maps/vts/OS_VTS_3857_Outdoor.json',\n VTS_DARK_URL: '/api/maps/vts/OS_VTS_3857_Dark.json',\n VTS_BLACK_AND_WHITE_URL: '/api/maps/vts/OS_VTS_3857_Black_and_White.json'\n}\n\n/**\n * Converts lat long to easting and northing\n * @param {object} param\n * @param {number} param.lat\n * @param {number} param.long\n * @returns {{ easting: number, northing: number }}\n */\nexport function latLongToEastingNorthing({ lat, long }) {\n const point = new LatLon(lat, long)\n\n return point.toOsGrid()\n}\n\n/**\n * Converts easting and northing to lat long\n * @param {object} param\n * @param {number} param.easting\n * @param {number} param.northing\n * @returns {{ lat: number, long: number }}\n */\nexport function eastingNorthingToLatLong({ easting, northing }) {\n const point = new OsGridRef(easting, northing)\n const latLong = point.toLatLon()\n\n return { lat: latLong.latitude, long: latLong.longitude }\n}\n\n/**\n * Converts lat long to an ordnance survey grid reference\n * @param {object} param\n * @param {number} param.lat\n * @param {number} param.long\n * @returns {string}\n */\nexport function latLongToOsGridRef({ lat, long }) {\n const point = new LatLon(lat, long)\n\n return point.toOsGrid().toString()\n}\n\n/**\n * Converts an ordnance survey grid reference to lat long\n * @param {string} osGridRef\n * @returns {{ lat: number, long: number }}\n */\nexport function osGridRefToLatLong(osGridRef) {\n const point = OsGridRef.parse(osGridRef)\n const latLong = point.toLatLon()\n\n return { lat: latLong.latitude, long: latLong.longitude }\n}\n\n/**\n * Get the grid ref from the first coordinate of a long/lat feature\n * @param {Feature} feature\n */\nexport function getCoordinateGridRef(feature) {\n if (feature.geometry.type === 'Point') {\n const [long, lat] = feature.geometry.coordinates\n const point = new LatLon(lat, long)\n\n return point.toOsGrid().toString()\n } else if (feature.geometry.type === 'LineString') {\n const [long, lat] = feature.geometry.coordinates[0]\n const point = new LatLon(lat, long)\n\n return point.toOsGrid().toString()\n } else {\n const [long, lat] = feature.geometry.coordinates[0][0]\n const point = new LatLon(lat, long)\n\n return point.toOsGrid().toString()\n }\n}\n\n/**\n * Get the centroid grid ref from a long/lat feature\n * @param {Feature} feature\n */\nexport function getCentroidGridRef(feature) {\n if (feature.geometry.type === 'Point') {\n const [long, lat] = feature.geometry.coordinates\n const point = new LatLon(lat, long)\n\n return point.toOsGrid().toString()\n } else {\n const centre = centroid(feature)\n const [long, lat] = centre.geometry.coordinates\n const point = new LatLon(lat, long)\n\n return point.toOsGrid().toString()\n }\n}\n\n/** @type {InteractiveMapInitConfig} */\nexport const defaultConfig = {\n zoom: '6',\n center: [DEFAULT_LONG, DEFAULT_LAT]\n}\n\nexport const EVENTS = {\n mapReady: 'map:ready',\n interactMarkerChange: 'interact:markerchange',\n drawReady: 'draw:ready',\n drawCreated: 'draw:created',\n drawEdited: 'draw:edited',\n drawCancelled: 'draw:cancelled'\n}\n\n/**\n * Make a form submit handler that only allows submissions from allowed buttons\n * @param {HTMLButtonElement[]} buttons - the form buttons to allow submissions\n */\nexport function formSubmitFactory(buttons) {\n /**\n * The submit handler\n * @param {SubmitEvent} e\n */\n const onFormSubmit = function (e) {\n if (\n !(e.submitter instanceof HTMLButtonElement) ||\n !buttons.includes(e.submitter)\n ) {\n e.preventDefault()\n }\n }\n\n return onFormSubmit\n}\n\n/**\n * Initialise location maps\n * @param {Partial<MapsEnvironmentConfig>} config - the map configuration\n */\nexport function initMaps(config = {}) {\n const {\n assetPath = '/assets',\n apiPath = '/form/api',\n data = defaultData\n } = config\n const locations = document.querySelectorAll('.app-location-field')\n const geospatials = document.querySelectorAll('.app-geospatial-field')\n\n // TODO: Fix this in `interactive-map`\n // If there are location components on the page fix up the main form submit\n // handler so it doesn't fire when using the integrated map search feature\n if (locations.length) {\n const form = locations[0].closest('form')\n\n if (form === null) {\n return\n }\n\n const buttons = Array.from(form.querySelectorAll('button'))\n form.addEventListener('submit', formSubmitFactory(buttons), false)\n }\n\n if (geospatials.length) {\n const form = geospatials[0].closest('form')\n\n if (form === null) {\n return\n }\n\n const buttons = Array.from(form.querySelectorAll('button'))\n form.addEventListener('submit', formSubmitFactory(buttons), false)\n }\n\n locations.forEach((location, index) => {\n processLocation({ assetPath, apiPath, data }, location, index)\n })\n\n geospatials.forEach((geospatial, index) => {\n processGeospatial({ assetPath, apiPath, data }, geospatial, index)\n })\n}\n\n/**\n * OS API request proxy factory\n * @param {string} apiPath - the root API path\n */\nexport function makeTileRequestTransformer(apiPath) {\n /**\n * Proxy OS API requests via our server\n * @param {string} url - the request URL\n * @param {string} resourceType - the resource type\n */\n return function transformTileRequest(url, resourceType) {\n if (url.startsWith('https://api.os.uk')) {\n if (resourceType === 'Tile') {\n return {\n url: url.replace(\n 'https://api.os.uk/maps/vector/v1/vts',\n `${window.location.origin}${apiPath}`\n ),\n headers: {}\n }\n }\n\n if (resourceType !== 'Style') {\n return {\n url: `${apiPath}/map-proxy?url=${encodeURIComponent(url)}`,\n headers: {}\n }\n }\n }\n\n const spritesPath =\n 'https://raw.githubusercontent.com/OrdnanceSurvey/OS-Vector-Tile-API-Stylesheets/main'\n\n // Proxy sprite requests\n if (url.startsWith(spritesPath)) {\n const path = url.substring(spritesPath.length)\n return {\n url: `${apiPath}/maps/vts${path}`,\n headers: {}\n }\n }\n\n return { url, headers: {} }\n }\n}\n\n/**\n * Temporary transform request function to transform geocode requests. Fixed in v0.0.18 of interactive map so this is not needed when we upgrade.\n * @param {object} request\n * @param {string} request.url\n * @param {{ method: 'get' }} request.options\n * @returns {Request}\n */\nexport const transformGeocodeRequest = (request) => {\n const url = new URL(request.url, window.location.origin)\n return new Request(url.toString(), request.options)\n}\n\n/**\n * Create a Defra map instance\n * @param {string} mapId - the map id\n * @param {InteractiveMapInitConfig} initConfig - the map initial configuration\n * @param {MapsEnvironmentConfig} mapsConfig - the map environment params\n */\nexport function createMap(mapId, initConfig, mapsConfig) {\n const { assetPath, apiPath, data = defaultData } = mapsConfig\n const logoAltText = 'Ordnance survey logo'\n\n // @ts-expect-error - Defra namespace currently comes from UMD support files\n const defra = window.defra\n\n const interactPlugin = defra.interactPlugin({\n markerColor: { outdoor: '#ff0000', dark: '#00ff00' },\n interactionMode: 'marker',\n multiSelect: false\n })\n\n /** @type {InteractiveMap} */\n const map = new defra.InteractiveMap(mapId, {\n enableFullscreen: true,\n autoColorScheme: false,\n mapProvider: defra.maplibreProvider(),\n reverseGeocodeProvider: defra.openNamesProvider({\n url: `${apiPath}/reverse-geocode-proxy?easting={easting}&northing={northing}`\n }),\n behaviour: 'inline',\n minZoom: 6,\n maxZoom: 18,\n containerHeight: '400px',\n enableZoomControls: true,\n transformRequest: makeTileRequestTransformer(apiPath),\n ...initConfig,\n plugins: [\n defra.mapStylesPlugin({\n mapStyles: [\n {\n id: 'outdoor',\n label: 'Outdoor',\n url: data.VTS_OUTDOOR_URL,\n thumbnail: `${assetPath}/interactive-map/assets/images/outdoor-map-thumb.jpg`,\n logo: `${assetPath}/interactive-map/assets/images/os-logo.svg`,\n logoAltText,\n attribution: `Contains OS data ${String.fromCodePoint(COMPANY_SYMBOL_CODE)} Crown copyright and database rights ${new Date().getFullYear()}`,\n backgroundColor: '#f5f5f0'\n },\n {\n id: 'dark',\n label: 'Dark',\n url: data.VTS_DARK_URL,\n mapColorScheme: 'dark',\n appColorScheme: 'dark',\n thumbnail: `${assetPath}/interactive-map/assets/images/dark-map-thumb.jpg`,\n logo: `${assetPath}/interactive-map/assets/images/os-logo-white.svg`,\n logoAltText,\n attribution: `Contains OS data ${String.fromCodePoint(COMPANY_SYMBOL_CODE)} Crown copyright and database rights ${new Date().getFullYear()}`\n },\n {\n id: 'black-and-white',\n label: 'Black/White',\n url: data.VTS_BLACK_AND_WHITE_URL,\n thumbnail: `${assetPath}/interactive-map/assets/images/black-and-white-map-thumb.jpg`,\n logo: `${assetPath}/interactive-map/assets/images/os-logo-black.svg`,\n logoAltText,\n attribution: `Contains OS data ${String.fromCodePoint(COMPANY_SYMBOL_CODE)} Crown copyright and database rights ${new Date().getFullYear()}`\n }\n ]\n }),\n interactPlugin,\n defra.searchPlugin({\n transformRequest: transformGeocodeRequest,\n osNamesURL: `${apiPath}/geocode-proxy?query={query}`,\n width: '300px',\n showMarker: false\n }),\n defra.scaleBarPlugin({\n units: 'metric'\n }),\n ...(initConfig.plugins ?? [])\n ]\n })\n\n return { map, interactPlugin }\n}\n\n/**\n * Updates the marker position and moves the map view port the new location\n * @param {InteractiveMap} map - the map component instance (of InteractiveMap)\n * @param {MapLibreMap} mapProvider - the map provider instance (of MapLibreMap)\n * @param {MapCenter} center - the point\n */\nexport function centerMap(map, mapProvider, center) {\n // Move the 'location' marker to the new point\n map.addMarker('location', center)\n\n // Pan & zoom the map to the new valid location\n mapProvider.flyTo({\n center,\n zoom: 14,\n essential: true\n })\n}\n\n/**\n * @typedef {object} InteractiveMap - an instance of a InteractiveMap\n * @property {Function} on - register callback listeners to map events\n * @property {Function} addPanel - adds a new panel to the map\n * @property {Function} addMarker - adds/updates a marker\n * @property {Function} removeMarker - removes a marker\n * @property {Function} addButton - adds/updates a button\n * @property {Function} toggleButtonState - toggle the state of a button\n */\n\n/**\n * @typedef {object} MapLibreMap\n * @property {Function} flyTo - pans/zooms to a new location\n * @property {Function} fitBounds - fits the my to the new bounds\n */\n\n/**\n * @typedef {[number, number]} MapCenter - Map center point as [long, lat]\n */\n\n/**\n * @typedef {object} InteractiveMapInitConfig - additional config that can be provided to InteractiveMap\n * @property {string} zoom - the zoom level of the map\n * @property {MapCenter} center - the center point of the map\n * @property {{ id: string, coords: MapCenter }[]} [markers] - the markers to add to the map\n * @property {any[]} [plugins] - additional plugins\n */\n\n/**\n * @typedef {object} TileData\n * @property {string} VTS_OUTDOOR_URL - the outdoor tile URL\n * @property {string} VTS_DARK_URL - the dark tile URL\n * @property {string} VTS_BLACK_AND_WHITE_URL - the black and white tile URL\n */\n\n/**\n * @typedef {object} MapsEnvironmentConfig\n * @property {string} assetPath - the root asset path\n * @property {string} apiPath - the root API path\n * @property {TileData} data - the tile data config\n */\n\n/**\n * @import { Feature } from '~/src/server/plugins/engine/types.js'\n */\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,gBAAgB;AACzC;AACA,OAAOC,SAAS,IAAIC,MAAM,QAAQ,sBAAsB;AAExD,SAASC,iBAAiB;AAC1B,SAASC,eAAe;;AAExB;AACA,MAAMC,WAAW,GAAG,SAAS;AAC7B,MAAMC,YAAY,GAAG,CAAC,QAAQ;AAC9B,MAAMC,mBAAmB,GAAG,GAAG;AAE/B,MAAMC,WAAW,GAAG;EAClBC,eAAe,EAAE,wCAAwC;EACzDC,YAAY,EAAE,qCAAqC;EACnDC,uBAAuB,EAAE;AAC3B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,wBAAwBA,CAAC;EAAEC,GAAG;EAAEC;AAAK,CAAC,EAAE;EACtD,MAAMC,KAAK,GAAG,IAAIb,MAAM,CAACW,GAAG,EAAEC,IAAI,CAAC;EAEnC,OAAOC,KAAK,CAACC,QAAQ,CAAC,CAAC;AACzB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,wBAAwBA,CAAC;EAAEC,OAAO;EAAEC;AAAS,CAAC,EAAE;EAC9D,MAAMJ,KAAK,GAAG,IAAId,SAAS,CAACiB,OAAO,EAAEC,QAAQ,CAAC;EAC9C,MAAMC,OAAO,GAAGL,KAAK,CAACM,QAAQ,CAAC,CAAC;EAEhC,OAAO;IAAER,GAAG,EAAEO,OAAO,CAACE,QAAQ;IAAER,IAAI,EAAEM,OAAO,CAACG;EAAU,CAAC;AAC3D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAAC;EAAEX,GAAG;EAAEC;AAAK,CAAC,EA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;QACpEuC,WAAW;QACX6B,WAAW,EAAE,oBAAoBC,MAAM,CAACC,aAAa,CAACvH,mBAAmB,CAAC,wCAAwC,IAAIwH,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC;MAC5I,CAAC;IAEL,CAAC,CAAC,EACF/B,cAAc,EACdD,KAAK,CAACoC,YAAY,CAAC;MACjBhB,gBAAgB,EAAE9B,uBAAuB;MACzC+C,UAAU,EAAE,GAAG5E,OAAO,8BAA8B;MACpD6E,KAAK,EAAE,OAAO;MACdC,UAAU,EAAE;IACd,CAAC,CAAC,EACFvC,KAAK,CAACwC,cAAc,CAAC;MACnBC,KAAK,EAAE;IACT,CAAC,CAAC,EACF,IAAI5C,UAAU,CAACwB,OAAO,IAAI,EAAE,CAAC;EAEjC,CAAC,CAAC;EAEF,OAAO;IAAEd,GAAG;IAAEN;EAAe,CAAC;AAChC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASyC,SAASA,CAACnC,GAAG,EAAEI,WAAW,EAAErE,MAAM,EAAE;EAClD;EACAiE,GAAG,CAACoC,SAAS,CAAC,UAAU,EAAErG,MAAM,CAAC;;EAEjC;EACAqE,WAAW,CAACiC,KAAK,CAAC;IAChBtG,MAAM;IACND,IAAI,EAAE,EAAE;IACRwG,SAAS,EAAE;EACb,CAAC,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"map.js","names":["centroid","OsGridRef","LatLon","processGeospatial","processLocation","DEFAULT_LAT","DEFAULT_LONG","COMPANY_SYMBOL_CODE","defaultData","VTS_OUTDOOR_URL","VTS_DARK_URL","VTS_BLACK_AND_WHITE_URL","VTS_AERIAL_URL","latLongToEastingNorthing","lat","long","point","toOsGrid","eastingNorthingToLatLong","easting","northing","latLong","toLatLon","latitude","longitude","latLongToOsGridRef","toString","osGridRefToLatLong","osGridRef","parse","getCoordinateGridRef","feature","geometry","type","coordinates","getCentroidGridRef","centre","defaultConfig","zoom","center","EVENTS","mapReady","interactMarkerChange","drawReady","drawCreated","drawEdited","drawCancelled","formSubmitFactory","buttons","onFormSubmit","e","submitter","HTMLButtonElement","includes","preventDefault","initMaps","config","assetPath","apiPath","data","locations","document","querySelectorAll","geospatials","length","form","closest","Array","from","addEventListener","forEach","location","index","geospatial","makeTileRequestTransformer","transformTileRequest","url","resourceType","startsWith","replace","window","origin","headers","encodeURIComponent","spritesPath","path","substring","transformGeocodeRequest","request","URL","Request","options","createMap","mapId","initConfig","mapsConfig","logoAltText","defra","interactPlugin","markerColor","outdoor","dark","interactionMode","multiSelect","map","InteractiveMap","enableFullscreen","autoColorScheme","mapProvider","maplibreProvider","reverseGeocodeProvider","openNamesProvider","behaviour","minZoom","maxZoom","containerHeight","enableZoomControls","transformRequest","plugins","mapStylesPlugin","mapStyles","id","label","thumbnail","logo","attribution","String","fromCodePoint","Date","getFullYear","backgroundColor","mapColorScheme","appColorScheme","searchPlugin","osNamesURL","width","showMarker","scaleBarPlugin","units","centerMap","addMarker","flyTo","essential"],"sources":["../../../src/client/javascripts/map.js"],"sourcesContent":["import { centroid } from '@turf/centroid'\n// @ts-expect-error - no types\nimport OsGridRef, { LatLon } from 'geodesy/osgridref.js'\n\nimport { processGeospatial } from '~/src/client/javascripts/geospatial-map.js'\nimport { processLocation } from '~/src/client/javascripts/location-map.js'\n\n// Center of UK\nconst DEFAULT_LAT = 53.825564\nconst DEFAULT_LONG = -2.421975\nconst COMPANY_SYMBOL_CODE = 169\n\nconst defaultData = {\n VTS_OUTDOOR_URL: '/api/maps/vts/OS_VTS_3857_Outdoor.json',\n VTS_DARK_URL: '/api/maps/vts/OS_VTS_3857_Dark.json',\n VTS_BLACK_AND_WHITE_URL: '/api/maps/vts/OS_VTS_3857_Black_and_White.json',\n VTS_AERIAL_URL: '/api/maps/vts/esri-aerial.json'\n}\n\n/**\n * Converts lat long to easting and northing\n * @param {object} param\n * @param {number} param.lat\n * @param {number} param.long\n * @returns {{ easting: number, northing: number }}\n */\nexport function latLongToEastingNorthing({ lat, long }) {\n const point = new LatLon(lat, long)\n\n return point.toOsGrid()\n}\n\n/**\n * Converts easting and northing to lat long\n * @param {object} param\n * @param {number} param.easting\n * @param {number} param.northing\n * @returns {{ lat: number, long: number }}\n */\nexport function eastingNorthingToLatLong({ easting, northing }) {\n const point = new OsGridRef(easting, northing)\n const latLong = point.toLatLon()\n\n return { lat: latLong.latitude, long: latLong.longitude }\n}\n\n/**\n * Converts lat long to an ordnance survey grid reference\n * @param {object} param\n * @param {number} param.lat\n * @param {number} param.long\n * @returns {string}\n */\nexport function latLongToOsGridRef({ lat, long }) {\n const point = new LatLon(lat, long)\n\n return point.toOsGrid().toString()\n}\n\n/**\n * Converts an ordnance survey grid reference to lat long\n * @param {string} osGridRef\n * @returns {{ lat: number, long: number }}\n */\nexport function osGridRefToLatLong(osGridRef) {\n const point = OsGridRef.parse(osGridRef)\n const latLong = point.toLatLon()\n\n return { lat: latLong.latitude, long: latLong.longitude }\n}\n\n/**\n * Get the grid ref from the first coordinate of a long/lat feature\n * @param {Feature} feature\n */\nexport function getCoordinateGridRef(feature) {\n if (feature.geometry.type === 'Point') {\n const [long, lat] = feature.geometry.coordinates\n const point = new LatLon(lat, long)\n\n return point.toOsGrid().toString()\n } else if (feature.geometry.type === 'LineString') {\n const [long, lat] = feature.geometry.coordinates[0]\n const point = new LatLon(lat, long)\n\n return point.toOsGrid().toString()\n } else {\n const [long, lat] = feature.geometry.coordinates[0][0]\n const point = new LatLon(lat, long)\n\n return point.toOsGrid().toString()\n }\n}\n\n/**\n * Get the centroid grid ref from a long/lat feature\n * @param {Feature} feature\n */\nexport function getCentroidGridRef(feature) {\n if (feature.geometry.type === 'Point') {\n const [long, lat] = feature.geometry.coordinates\n const point = new LatLon(lat, long)\n\n return point.toOsGrid().toString()\n } else {\n const centre = centroid(feature)\n const [long, lat] = centre.geometry.coordinates\n const point = new LatLon(lat, long)\n\n return point.toOsGrid().toString()\n }\n}\n\n/** @type {InteractiveMapInitConfig} */\nexport const defaultConfig = {\n zoom: '6',\n center: [DEFAULT_LONG, DEFAULT_LAT]\n}\n\nexport const EVENTS = {\n mapReady: 'map:ready',\n interactMarkerChange: 'interact:markerchange',\n drawReady: 'draw:ready',\n drawCreated: 'draw:created',\n drawEdited: 'draw:edited',\n drawCancelled: 'draw:cancelled'\n}\n\n/**\n * Make a form submit handler that only allows submissions from allowed buttons\n * @param {HTMLButtonElement[]} buttons - the form buttons to allow submissions\n */\nexport function formSubmitFactory(buttons) {\n /**\n * The submit handler\n * @param {SubmitEvent} e\n */\n const onFormSubmit = function (e) {\n if (\n !(e.submitter instanceof HTMLButtonElement) ||\n !buttons.includes(e.submitter)\n ) {\n e.preventDefault()\n }\n }\n\n return onFormSubmit\n}\n\n/**\n * Initialise location maps\n * @param {Partial<MapsEnvironmentConfig>} config - the map configuration\n */\nexport function initMaps(config = {}) {\n const {\n assetPath = '/assets',\n apiPath = '/form/api',\n data = defaultData\n } = config\n const locations = document.querySelectorAll('.app-location-field')\n const geospatials = document.querySelectorAll('.app-geospatial-field')\n\n // TODO: Fix this in `interactive-map`\n // If there are location components on the page fix up the main form submit\n // handler so it doesn't fire when using the integrated map search feature\n if (locations.length) {\n const form = locations[0].closest('form')\n\n if (form === null) {\n return\n }\n\n const buttons = Array.from(form.querySelectorAll('button'))\n form.addEventListener('submit', formSubmitFactory(buttons), false)\n }\n\n if (geospatials.length) {\n const form = geospatials[0].closest('form')\n\n if (form === null) {\n return\n }\n\n const buttons = Array.from(form.querySelectorAll('button'))\n form.addEventListener('submit', formSubmitFactory(buttons), false)\n }\n\n locations.forEach((location, index) => {\n processLocation({ assetPath, apiPath, data }, location, index)\n })\n\n geospatials.forEach((geospatial, index) => {\n processGeospatial({ assetPath, apiPath, data }, geospatial, index)\n })\n}\n\n/**\n * OS API request proxy factory\n * @param {string} apiPath - the root API path\n */\nexport function makeTileRequestTransformer(apiPath) {\n /**\n * Proxy OS API requests via our server\n * @param {string} url - the request URL\n * @param {string} resourceType - the resource type\n */\n return function transformTileRequest(url, resourceType) {\n if (url.startsWith('https://api.os.uk')) {\n if (resourceType === 'Tile') {\n return {\n url: url.replace(\n 'https://api.os.uk/maps/vector/v1/vts',\n `${window.location.origin}${apiPath}`\n ),\n headers: {}\n }\n }\n\n if (resourceType !== 'Style') {\n return {\n url: `${apiPath}/map-proxy?url=${encodeURIComponent(url)}`,\n headers: {}\n }\n }\n }\n\n const spritesPath =\n 'https://raw.githubusercontent.com/OrdnanceSurvey/OS-Vector-Tile-API-Stylesheets/main'\n\n // Proxy sprite requests\n if (url.startsWith(spritesPath)) {\n const path = url.substring(spritesPath.length)\n return {\n url: `${apiPath}/maps/vts${path}`,\n headers: {}\n }\n }\n\n return { url, headers: {} }\n }\n}\n\n/**\n * Temporary transform request function to transform geocode requests. Fixed in v0.0.18 of interactive map so this is not needed when we upgrade.\n * @param {object} request\n * @param {string} request.url\n * @param {{ method: 'get' }} request.options\n * @returns {Request}\n */\nexport const transformGeocodeRequest = (request) => {\n const url = new URL(request.url, window.location.origin)\n return new Request(url.toString(), request.options)\n}\n\n/**\n * Create a Defra map instance\n * @param {string} mapId - the map id\n * @param {InteractiveMapInitConfig} initConfig - the map initial configuration\n * @param {MapsEnvironmentConfig} mapsConfig - the map environment params\n */\nexport function createMap(mapId, initConfig, mapsConfig) {\n const { assetPath, apiPath, data = defaultData } = mapsConfig\n const logoAltText = 'Ordnance survey logo'\n\n // @ts-expect-error - Defra namespace currently comes from UMD support files\n const defra = window.defra\n\n const interactPlugin = defra.interactPlugin({\n markerColor: { outdoor: '#ff0000', dark: '#00ff00' },\n interactionMode: 'marker',\n multiSelect: false\n })\n\n /** @type {InteractiveMap} */\n const map = new defra.InteractiveMap(mapId, {\n enableFullscreen: true,\n autoColorScheme: false,\n mapProvider: defra.maplibreProvider(),\n reverseGeocodeProvider: defra.openNamesProvider({\n url: `${apiPath}/reverse-geocode-proxy?easting={easting}&northing={northing}`\n }),\n behaviour: 'inline',\n minZoom: 6,\n maxZoom: 18,\n containerHeight: '400px',\n enableZoomControls: true,\n transformRequest: makeTileRequestTransformer(apiPath),\n ...initConfig,\n plugins: [\n defra.mapStylesPlugin({\n mapStyles: [\n {\n id: 'outdoor',\n label: 'Outdoor',\n url: data.VTS_OUTDOOR_URL,\n thumbnail: `${assetPath}/interactive-map/assets/images/outdoor-map-thumb.jpg`,\n logo: `${assetPath}/interactive-map/assets/images/os-logo.svg`,\n logoAltText,\n attribution: `Contains OS data ${String.fromCodePoint(COMPANY_SYMBOL_CODE)} Crown copyright and database rights ${new Date().getFullYear()}`,\n backgroundColor: '#f5f5f0'\n },\n {\n id: 'dark',\n label: 'Dark',\n url: data.VTS_DARK_URL,\n mapColorScheme: 'dark',\n appColorScheme: 'dark',\n thumbnail: `${assetPath}/interactive-map/assets/images/dark-map-thumb.jpg`,\n logo: `${assetPath}/interactive-map/assets/images/os-logo-white.svg`,\n logoAltText,\n attribution: `Contains OS data ${String.fromCodePoint(COMPANY_SYMBOL_CODE)} Crown copyright and database rights ${new Date().getFullYear()}`\n },\n {\n id: 'black-and-white',\n label: 'Black/White',\n url: data.VTS_BLACK_AND_WHITE_URL,\n thumbnail: `${assetPath}/interactive-map/assets/images/black-and-white-map-thumb.jpg`,\n logo: `${assetPath}/interactive-map/assets/images/os-logo-black.svg`,\n logoAltText,\n attribution: `Contains OS data ${String.fromCodePoint(COMPANY_SYMBOL_CODE)} Crown copyright and database rights ${new Date().getFullYear()}`\n },\n {\n id: 'aerial',\n label: 'Aerial',\n url: data.VTS_AERIAL_URL,\n thumbnail: `${assetPath}/interactive-map/assets/images/aerial-map-thumb.jpg`,\n attribution: `Tiles ${String.fromCodePoint(COMPANY_SYMBOL_CODE)} Esri — Source: Esri, Maxar, Earthstar Geographics, and the GIS User Community ${new Date().getFullYear()}`\n }\n ]\n }),\n interactPlugin,\n defra.searchPlugin({\n transformRequest: transformGeocodeRequest,\n osNamesURL: `${apiPath}/geocode-proxy?query={query}`,\n width: '300px',\n showMarker: false\n }),\n defra.scaleBarPlugin({\n units: 'metric'\n }),\n ...(initConfig.plugins ?? [])\n ]\n })\n\n return { map, interactPlugin }\n}\n\n/**\n * Updates the marker position and moves the map view port the new location\n * @param {InteractiveMap} map - the map component instance (of InteractiveMap)\n * @param {MapLibreMap} mapProvider - the map provider instance (of MapLibreMap)\n * @param {MapCenter} center - the point\n */\nexport function centerMap(map, mapProvider, center) {\n // Move the 'location' marker to the new point\n map.addMarker('location', center)\n\n // Pan & zoom the map to the new valid location\n mapProvider.flyTo({\n center,\n zoom: 14,\n essential: true\n })\n}\n\n/**\n * @typedef {object} InteractiveMap - an instance of a InteractiveMap\n * @property {Function} on - register callback listeners to map events\n * @property {Function} addPanel - adds a new panel to the map\n * @property {Function} addMarker - adds/updates a marker\n * @property {Function} removeMarker - removes a marker\n * @property {Function} addButton - adds/updates a button\n * @property {Function} toggleButtonState - toggle the state of a button\n */\n\n/**\n * @typedef {object} MapLibreMap\n * @property {Function} flyTo - pans/zooms to a new location\n * @property {Function} fitBounds - fits the my to the new bounds\n */\n\n/**\n * @typedef {[number, number]} MapCenter - Map center point as [long, lat]\n */\n\n/**\n * @typedef {object} InteractiveMapInitConfig - additional config that can be provided to InteractiveMap\n * @property {string} zoom - the zoom level of the map\n * @property {MapCenter} center - the center point of the map\n * @property {{ id: string, coords: MapCenter }[]} [markers] - the markers to add to the map\n * @property {any[]} [plugins] - additional plugins\n */\n\n/**\n * @typedef {object} TileData\n * @property {string} VTS_OUTDOOR_URL - the outdoor tile URL\n * @property {string} VTS_DARK_URL - the dark tile URL\n * @property {string} VTS_BLACK_AND_WHITE_URL - the black and white tile URL\n * @property {string} VTS_AERIAL_URL - the aerial tile URL\n */\n\n/**\n * @typedef {object} MapsEnvironmentConfig\n * @property {string} assetPath - the root asset path\n * @property {string} apiPath - the root API path\n * @property {TileData} data - the tile data config\n */\n\n/**\n * @import { Feature } from '~/src/server/plugins/engine/types.js'\n */\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,gBAAgB;AACzC;AACA,OAAOC,SAAS,IAAIC,MAAM,QAAQ,sBAAsB;AAExD,SAASC,iBAAiB;AAC1B,SAASC,eAAe;;AAExB;AACA,MAAMC,WAAW,GAAG,SAAS;AAC7B,MAAMC,YAAY,GAAG,CAAC,QAAQ;AAC9B,MAAMC,mBAAmB,GAAG,GAAG;AAE/B,MAAMC,WAAW,GAAG;EAClBC,eAAe,EAAE,wCAAwC;EACzDC,YAAY,EAAE,qCAAqC;EACnDC,uBAAuB,EAAE,gDAAgD;EACzEC,cAAc,EAAE;AAClB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,wBAAwBA,CAAC;EAAEC,GAAG;EAAEC;AAAK,CAAC,EAAE;EACtD,MAAMC,KAAK,GAAG,IAAId,MAAM,CAACY,GAAG,EAAEC,IAAI,CAAC;EAEnC,OAAOC,KAAK,CAACC,QAAQ,CAAC,CAAC;AACzB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,wBAAwBA,CAAC;EAAEC,OAAO;EAAEC;AAAS,CAAC,EAAE;EAC9D,MAAMJ,KAAK,GAAG,IAAIf,SAAS,CAACkB,OAAO,EAAEC,QAAQ,CAAC;EAC9C,MAAMC,OAAO,GAAGL,KAAK,CAACM,QAAQ,CAAC,CAAC;EAEhC,OAAO;IAAER,GAAG,EAAEO,OAAO,CAACE,QAAQ;IAAER,IAAI,EAAEM,OAAO,CAACG;EAAU,CAAC;AAC3D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAAC;EAAEX,GAAG;EAAEC;AAAK,CAAC,EAAE;EAChD,MAAMC,KAAK,GAAG,IAAId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EA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA","ignoreList":[]}
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* Initialise all clientside components (but not maps as this will be an opt-in for now given the additional UMD assets that are required)
|
|
3
3
|
*/
|
|
4
4
|
export function initAll(): void;
|
|
5
|
-
export { initMaps } from "
|
|
6
|
-
export * as map from "
|
|
7
|
-
export * as geospatialMap from "
|
|
5
|
+
export { initMaps } from "../../client/javascripts/map.js";
|
|
6
|
+
export * as map from "../../client/javascripts/map.js";
|
|
7
|
+
export * as geospatialMap from "../../client/javascripts/geospatial-map.js";
|
|
8
8
|
export const initAllGovuk: typeof initAllGovukImp;
|
|
9
9
|
export const initAllAutocomplete: typeof initAllAutocompleteImp;
|
|
10
10
|
export const initFileUpload: typeof initFileUploadImp;
|
|
11
11
|
export const initPreviewCloseLink: typeof initPreviewCloseLinkImp;
|
|
12
|
-
import { initAllGovuk as initAllGovukImp } from '
|
|
13
|
-
import { initAllAutocomplete as initAllAutocompleteImp } from '
|
|
14
|
-
import { initFileUpload as initFileUploadImp } from '
|
|
15
|
-
import { initPreviewCloseLink as initPreviewCloseLinkImp } from '
|
|
12
|
+
import { initAllGovuk as initAllGovukImp } from '../../client/javascripts/govuk.js';
|
|
13
|
+
import { initAllAutocomplete as initAllAutocompleteImp } from '../../client/javascripts/autocomplete.js';
|
|
14
|
+
import { initFileUpload as initFileUploadImp } from '../../client/javascripts/file-upload.js';
|
|
15
|
+
import { initPreviewCloseLink as initPreviewCloseLinkImp } from '../../client/javascripts/preview-close-link.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type RegisterOptions } from '@hapi/crumb';
|
|
2
2
|
import { type ServerRegisterPluginObject } from '@hapi/hapi';
|
|
3
|
-
import { type RouteConfig } from '
|
|
3
|
+
import { type RouteConfig } from '../../server/types.js';
|
|
4
4
|
export declare const configureCrumbPlugin: (routeConfig?: RouteConfig) => ServerRegisterPluginObject<RegisterOptions>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type Request, type Server } from '@hapi/hapi';
|
|
2
|
-
import { FormModel } from '
|
|
3
|
-
import { type PageController } from '
|
|
4
|
-
import { type FormContext, type FormSubmissionError } from '
|
|
5
|
-
import { FormStatus } from '
|
|
6
|
-
import { type Services } from '
|
|
2
|
+
import { FormModel } from '../../../../server/plugins/engine/models/index.js';
|
|
3
|
+
import { type PageController } from '../../../../server/plugins/engine/pageControllers/PageController.js';
|
|
4
|
+
import { type FormContext, type FormSubmissionError } from '../../../../server/plugins/engine/types.js';
|
|
5
|
+
import { FormStatus } from '../../../../server/routes/types.js';
|
|
6
|
+
import { type Services } from '../../../../server/types.js';
|
|
7
7
|
type JourneyState = FormStatus | 'preview';
|
|
8
8
|
export interface FormModelOptions {
|
|
9
9
|
services?: Services;
|
|
@@ -20,5 +20,5 @@ export interface FormContextOptions extends FormModelOptions {
|
|
|
20
20
|
export declare function getFormModel(slug: string, state: JourneyState, options?: FormModelOptions): Promise<FormModel>;
|
|
21
21
|
export declare function getFormContext({ server, yar }: Pick<Request, 'server' | 'yar'>, slug: string, state?: JourneyState, options?: FormContextOptions): Promise<FormContext>;
|
|
22
22
|
export declare function resolveFormModel(server: Server, slug: string, state: JourneyState, options?: FormModelOptions): Promise<FormModel>;
|
|
23
|
-
export declare function getFirstJourneyPage(context?: Pick<FormContext, 'relevantPages'>): import("
|
|
23
|
+
export declare function getFirstJourneyPage(context?: Pick<FormContext, 'relevantPages'>): import("../../../../server/plugins/engine/pageControllers/index.js").StartPageController | import("../../../../server/plugins/engine/pageControllers/index.js").QuestionPageController | import("../../../../server/plugins/engine/pageControllers/index.js").RepeatPageController | undefined;
|
|
24
24
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type AutocompleteFieldComponent } from '@defra/forms-model';
|
|
2
|
-
import { SelectField } from '
|
|
3
|
-
import { type FormPayload, type FormSubmissionError } from '
|
|
2
|
+
import { SelectField } from '../../../../server/plugins/engine/components/SelectField.js';
|
|
3
|
+
import { type FormPayload, type FormSubmissionError } from '../../../../server/plugins/engine/types.js';
|
|
4
4
|
export declare class AutocompleteField extends SelectField {
|
|
5
5
|
options: AutocompleteFieldComponent['options'];
|
|
6
6
|
constructor(def: AutocompleteFieldComponent, props: ConstructorParameters<typeof SelectField>[1]);
|
|
@@ -15,7 +15,7 @@ export declare class AutocompleteField extends SelectField {
|
|
|
15
15
|
};
|
|
16
16
|
id: string;
|
|
17
17
|
name: string;
|
|
18
|
-
value: import("
|
|
18
|
+
value: import("../../../../server/plugins/engine/types.js").FormValue;
|
|
19
19
|
type?: string;
|
|
20
20
|
hint?: {
|
|
21
21
|
id?: string;
|
|
@@ -50,7 +50,7 @@ export declare class AutocompleteField extends SelectField {
|
|
|
50
50
|
components?: import("./types.js").ComponentViewModel[];
|
|
51
51
|
upload?: {
|
|
52
52
|
count: number;
|
|
53
|
-
summaryList: import("
|
|
53
|
+
summaryList: import("../../../../server/plugins/engine/types.js").SummaryList;
|
|
54
54
|
};
|
|
55
55
|
};
|
|
56
56
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type CheckboxesFieldComponent, type Item } from '@defra/forms-model';
|
|
2
2
|
import { type ArraySchema } from 'joi';
|
|
3
|
-
import { SelectionControlField } from '
|
|
4
|
-
import { type ErrorMessageTemplateList, type FormState, type FormStateValue, type FormSubmissionState } from '
|
|
3
|
+
import { SelectionControlField } from '../../../../server/plugins/engine/components/SelectionControlField.js';
|
|
4
|
+
import { type ErrorMessageTemplateList, type FormState, type FormStateValue, type FormSubmissionState } from '../../../../server/plugins/engine/types.js';
|
|
5
5
|
export declare class CheckboxesField extends SelectionControlField {
|
|
6
6
|
options: CheckboxesFieldComponent['options'];
|
|
7
7
|
schema: CheckboxesFieldComponent['schema'];
|
|
@@ -9,9 +9,9 @@ export class CheckboxesField extends SelectionControlField {
|
|
|
9
9
|
listType: type
|
|
10
10
|
} = this;
|
|
11
11
|
const {
|
|
12
|
-
options
|
|
12
|
+
options,
|
|
13
|
+
schema
|
|
13
14
|
} = def;
|
|
14
|
-
const schema = 'schema' in def ? def.schema : {};
|
|
15
15
|
let formSchema = type === 'string' ? joi.array() : joi.array();
|
|
16
16
|
const itemsSchema = joi[type]().valid(...this.values).label(this.label);
|
|
17
17
|
formSchema = formSchema.items(itemsSchema).single().label(this.label).required().messages({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxesField.js","names":["joi","isFormValue","SelectionControlField","messageTemplate","CheckboxesField","constructor","def","props","listType","type","options","schema","formSchema","array","itemsSchema","valid","values","label","items","single","required","messages","optional","length","min","max","default","stateSchema","allow","getFormValueFromState","state","name","getFormValue","selected","filter","item","includes","value","map","undefined","isValue","getDisplayStringFromFormValue","text","join","getContextValueFromFormValue","getDisplayStringFromState","getContextValueFromState","getAllPossibleErrors","parentErrors","advancedSettingsErrors","template","arrayMin","arrayMax","arrayLength","Array","isArray","every"],"sources":["../../../../../src/server/plugins/engine/components/CheckboxesField.ts"],"sourcesContent":["import { type CheckboxesFieldComponent, type Item } from '@defra/forms-model'\nimport joi, { type ArraySchema } from 'joi'\n\nimport { isFormValue } from '~/src/server/plugins/engine/components/FormComponent.js'\nimport { SelectionControlField } from '~/src/server/plugins/engine/components/SelectionControlField.js'\nimport { type FormModel } from '~/src/server/plugins/engine/models/FormModel.js'\nimport { type QuestionPageController } from '~/src/server/plugins/engine/pageControllers/QuestionPageController.js'\nimport { messageTemplate } from '~/src/server/plugins/engine/pageControllers/validationOptions.js'\nimport {\n type ErrorMessageTemplateList,\n type FormState,\n type FormStateValue,\n type FormSubmissionState\n} from '~/src/server/plugins/engine/types.js'\n\nexport class CheckboxesField extends SelectionControlField {\n declare options: CheckboxesFieldComponent['options']\n declare schema: CheckboxesFieldComponent['schema']\n declare formSchema: ArraySchema<string> | ArraySchema<number>\n declare stateSchema: ArraySchema<string> | ArraySchema<number>\n\n constructor(\n def: CheckboxesFieldComponent,\n props: ConstructorParameters<typeof SelectionControlField>[1]\n ) {\n super(def, props)\n\n const { listType: type } = this\n const { options } = def\n
|
|
1
|
+
{"version":3,"file":"CheckboxesField.js","names":["joi","isFormValue","SelectionControlField","messageTemplate","CheckboxesField","constructor","def","props","listType","type","options","schema","formSchema","array","itemsSchema","valid","values","label","items","single","required","messages","optional","length","min","max","default","stateSchema","allow","getFormValueFromState","state","name","getFormValue","selected","filter","item","includes","value","map","undefined","isValue","getDisplayStringFromFormValue","text","join","getContextValueFromFormValue","getDisplayStringFromState","getContextValueFromState","getAllPossibleErrors","parentErrors","advancedSettingsErrors","template","arrayMin","arrayMax","arrayLength","Array","isArray","every"],"sources":["../../../../../src/server/plugins/engine/components/CheckboxesField.ts"],"sourcesContent":["import { type CheckboxesFieldComponent, type Item } from '@defra/forms-model'\nimport joi, { type ArraySchema } from 'joi'\n\nimport { isFormValue } from '~/src/server/plugins/engine/components/FormComponent.js'\nimport { SelectionControlField } from '~/src/server/plugins/engine/components/SelectionControlField.js'\nimport { type FormModel } from '~/src/server/plugins/engine/models/FormModel.js'\nimport { type QuestionPageController } from '~/src/server/plugins/engine/pageControllers/QuestionPageController.js'\nimport { messageTemplate } from '~/src/server/plugins/engine/pageControllers/validationOptions.js'\nimport {\n type ErrorMessageTemplateList,\n type FormState,\n type FormStateValue,\n type FormSubmissionState\n} from '~/src/server/plugins/engine/types.js'\n\nexport class CheckboxesField extends SelectionControlField {\n declare options: CheckboxesFieldComponent['options']\n declare schema: CheckboxesFieldComponent['schema']\n declare formSchema: ArraySchema<string> | ArraySchema<number>\n declare stateSchema: ArraySchema<string> | ArraySchema<number>\n\n constructor(\n def: CheckboxesFieldComponent,\n props: ConstructorParameters<typeof SelectionControlField>[1]\n ) {\n super(def, props)\n\n const { listType: type } = this\n const { options, schema } = def\n\n let formSchema =\n type === 'string' ? joi.array<string>() : joi.array<number>()\n\n const itemsSchema = joi[type]()\n .valid(...this.values)\n .label(this.label)\n\n formSchema = formSchema\n .items(itemsSchema)\n .single()\n .label(this.label)\n .required()\n .messages({\n 'array.min': 'Select at least {{#limit}} options from the list',\n 'array.max': 'Only {{#limit}} can be selected from the list',\n 'array.length': 'Select only {{#limit}} options from the list'\n })\n\n if (options.required === false) {\n formSchema = formSchema.optional()\n }\n\n if (typeof schema?.length === 'number') {\n formSchema = formSchema.length(schema.length)\n } else {\n if (typeof schema?.min === 'number') {\n formSchema = formSchema.min(schema.min)\n }\n\n if (typeof schema?.max === 'number') {\n formSchema = formSchema.max(schema.max)\n }\n }\n\n this.formSchema = formSchema.default([])\n this.stateSchema = formSchema.default(null).allow(null)\n this.options = options\n }\n\n getFormValueFromState(state: FormSubmissionState) {\n const { items, name } = this\n\n // State checkbox values\n const values = this.getFormValue(state[name]) ?? []\n\n // Map (or discard) state values to item values\n const selected = items\n .filter((item) => values.includes(item.value))\n .map((item) => item.value)\n\n return selected.length ? selected : undefined\n }\n\n getFormValue(value?: FormStateValue | FormState) {\n return this.isValue(value) ? value : undefined\n }\n\n getDisplayStringFromFormValue(\n selected: (string | number | boolean)[] | undefined\n ) {\n const { items } = this\n\n if (!selected) {\n return ''\n }\n\n // Map selected values to text\n return items\n .filter((item) => selected.includes(item.value))\n .map((item) => item.text)\n .join(', ')\n }\n\n getContextValueFromFormValue(\n values: (string | number | boolean)[] | undefined\n ): (string | number | boolean)[] {\n /**\n * For evaluation context purposes, optional {@link CheckboxesField}\n * with an undefined value (i.e. nothing selected) should default to [].\n * This way conditions are not evaluated against `undefined` which throws errors.\n * Currently these errors are caught and the evaluation returns default `false`.\n * @see {@link QuestionPageController.getNextPath} for `undefined` return value\n * @see {@link FormModel.makeCondition} for try/catch block with default `false`\n * For negative conditions this is a problem because E.g.\n * The condition: 'selectedchecks' does not contain 'someval'\n * should return true IF 'selectedchecks' is undefined, not throw and return false.\n */\n return values ?? []\n }\n\n getDisplayStringFromState(state: FormSubmissionState) {\n // Selected checkbox values\n const selected = this.getFormValueFromState(state) ?? []\n\n // Map selected values to text\n return this.getDisplayStringFromFormValue(selected)\n }\n\n getContextValueFromState(state: FormSubmissionState) {\n const values = this.getFormValueFromState(state)\n\n return this.getContextValueFromFormValue(values)\n }\n\n /**\n * For error preview page that shows all possible errors on a component\n */\n getAllPossibleErrors(): ErrorMessageTemplateList {\n return CheckboxesField.getAllPossibleErrors()\n }\n\n /**\n * Static version of getAllPossibleErrors that doesn't require a component instance.\n */\n static getAllPossibleErrors(): ErrorMessageTemplateList {\n const parentErrors = SelectionControlField.getAllPossibleErrors()\n\n return {\n ...parentErrors,\n advancedSettingsErrors: [\n ...parentErrors.advancedSettingsErrors,\n { type: 'array.min', template: messageTemplate.arrayMin },\n { type: 'array.max', template: messageTemplate.arrayMax },\n { type: 'array.length', template: messageTemplate.arrayLength }\n ]\n }\n }\n\n isValue(value?: FormStateValue | FormState): value is Item['value'][] {\n if (!Array.isArray(value)) {\n return false\n }\n\n // Skip checks when empty\n if (!value.length) {\n return true\n }\n\n return value.every(isFormValue)\n }\n}\n"],"mappings":"AACA,OAAOA,GAAG,MAA4B,KAAK;AAE3C,SAASC,WAAW;AACpB,SAASC,qBAAqB;AAG9B,SAASC,eAAe;AAQxB,OAAO,MAAMC,eAAe,SAASF,qBAAqB,CAAC;EAMzDG,WAAWA,CACTC,GAA6B,EAC7BC,KAA6D,EAC7D;IACA,KAAK,CAACD,GAAG,EAAEC,KAAK,CAAC;IAEjB,MAAM;MAAEC,QAAQ,EAAEC;IAAK,CAAC,GAAG,IAAI;IAC/B,MAAM;MAAEC,OAAO;MAAEC;IAAO,CAAC,GAAGL,GAAG;IAE/B,IAAIM,UAAU,GACZH,IAAI,KAAK,QAAQ,GAAGT,GAAG,CAACa,KAAK,CAAS,CAAC,GAAGb,GAAG,CAACa,KAAK,CAAS,CAAC;IAE/D,MAAMC,WAAW,GAAGd,GAAG,CAACS,IAAI,CAAC,CAAC,CAAC,CAC5BM,KAAK,CAAC,GAAG,IAAI,CAACC,MAAM,CAAC,CACrBC,KAAK,CAAC,IAAI,CAACA,KAAK,CAAC;IAEpBL,UAAU,GA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CAAC,CAAC;EAC/C;;EAEA;AACF;AACA;EACE,OAAOA,oBAAoBA,CAAA,EAA6B;IACtD,MAAMC,YAAY,GAAG9C,qBAAqB,CAAC6C,oBAAoB,CAAC,CAAC;IAEjE,OAAO;MACL,GAAGC,YAAY;MACfC,sBAAsB,EAAE,CACtB,GAAGD,YAAY,CAACC,sBAAsB,EACtC;QAAExC,IAAI,EAAE,WAAW;QAAEyC,QAAQ,EAAE/C,eAAe,CAACgD;MAAS,CAAC,EACzD;QAAE1C,IAAI,EAAE,WAAW;QAAEyC,QAAQ,EAAE/C,eAAe,CAACiD;MAAS,CAAC,EACzD;QAAE3C,IAAI,EAAE,cAAc;QAAEyC,QAAQ,EAAE/C,eAAe,CAACkD;MAAY,CAAC;IAEnE,CAAC;EACH;EAEAb,OAAOA,CAACH,KAAkC,EAA4B;IACpE,IAAI,CAACiB,KAAK,CAACC,OAAO,CAAClB,KAAK,CAAC,EAAE;MACzB,OAAO,KAAK;IACd;;IAEA;IACA,IAAI,CAACA,KAAK,CAACd,MAAM,EAAE;MACjB,OAAO,IAAI;IACb;IAEA,OAAOc,KAAK,CAACmB,KAAK,CAACvD,WAAW,CAAC;EACjC;AACF","ignoreList":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type ComponentDef } from '@defra/forms-model';
|
|
2
2
|
import { type ArraySchema, type BooleanSchema, type DateSchema, type NumberSchema, type ObjectSchema, type StringSchema } from 'joi';
|
|
3
|
-
import { type ComponentCollection } from '
|
|
4
|
-
import { type Component } from '
|
|
5
|
-
import { type ViewModel } from '
|
|
6
|
-
import { type FormModel } from '
|
|
7
|
-
import { type PageControllerClass } from '
|
|
3
|
+
import { type ComponentCollection } from '../../../../server/plugins/engine/components/ComponentCollection.js';
|
|
4
|
+
import { type Component } from '../../../../server/plugins/engine/components/helpers/components.js';
|
|
5
|
+
import { type ViewModel } from '../../../../server/plugins/engine/components/types.js';
|
|
6
|
+
import { type FormModel } from '../../../../server/plugins/engine/models/index.js';
|
|
7
|
+
import { type PageControllerClass } from '../../../../server/plugins/engine/pageControllers/helpers/pages.js';
|
|
8
8
|
export declare class ComponentBase {
|
|
9
9
|
id?: string;
|
|
10
10
|
page?: PageControllerClass;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type ComponentDef } from '@defra/forms-model';
|
|
2
2
|
import { type CustomValidator, type ErrorReportCollection, type ObjectSchema } from 'joi';
|
|
3
|
-
import { type Component, type Field, type Guidance } from '
|
|
4
|
-
import { type ComponentViewModel } from '
|
|
5
|
-
import { type FormModel } from '
|
|
6
|
-
import { type PageControllerClass } from '
|
|
7
|
-
import { type FormPayload, type FormSubmissionError, type FormSubmissionState, type FormValidationResult } from '
|
|
8
|
-
import { type FormQuery } from '
|
|
3
|
+
import { type Component, type Field, type Guidance } from '../../../../server/plugins/engine/components/helpers/components.js';
|
|
4
|
+
import { type ComponentViewModel } from '../../../../server/plugins/engine/components/types.js';
|
|
5
|
+
import { type FormModel } from '../../../../server/plugins/engine/models/index.js';
|
|
6
|
+
import { type PageControllerClass } from '../../../../server/plugins/engine/pageControllers/helpers/pages.js';
|
|
7
|
+
import { type FormPayload, type FormSubmissionError, type FormSubmissionState, type FormValidationResult } from '../../../../server/plugins/engine/types.js';
|
|
8
|
+
import { type FormQuery } from '../../../../server/routes/types.js';
|
|
9
9
|
export declare class ComponentCollection {
|
|
10
10
|
page?: PageControllerClass;
|
|
11
11
|
parent?: Component;
|
|
@@ -32,8 +32,8 @@ export declare class ComponentCollection {
|
|
|
32
32
|
get keys(): string[];
|
|
33
33
|
getFormDataFromState(state: FormSubmissionState): FormPayload;
|
|
34
34
|
getFormValueFromState(state: FormSubmissionState): FormPayload;
|
|
35
|
-
getStateFromValidForm(payload: FormPayload): Partial<Record<string, import("
|
|
36
|
-
getContextValueFromState(state: FormSubmissionState): Partial<Record<string, import("
|
|
35
|
+
getStateFromValidForm(payload: FormPayload): Partial<Record<string, import("../../../../server/plugins/engine/types.js").FormStateValue>>;
|
|
36
|
+
getContextValueFromState(state: FormSubmissionState): Partial<Record<string, import("../../../../server/plugins/engine/types.js").FormStateValue>>;
|
|
37
37
|
/**
|
|
38
38
|
* Get all errors for all fields in this collection
|
|
39
39
|
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type DatePartsFieldComponent } from '@defra/forms-model';
|
|
2
2
|
import { type CustomValidator, type ObjectSchema } from 'joi';
|
|
3
|
-
import { ComponentCollection } from '
|
|
4
|
-
import { FormComponent } from '
|
|
5
|
-
import { type DateInputItem, type DatePartsState } from '
|
|
6
|
-
import { type ErrorMessageTemplateList, type FormPayload, type FormState, type FormStateValue, type FormSubmissionError, type FormSubmissionState } from '
|
|
3
|
+
import { ComponentCollection } from '../../../../server/plugins/engine/components/ComponentCollection.js';
|
|
4
|
+
import { FormComponent } from '../../../../server/plugins/engine/components/FormComponent.js';
|
|
5
|
+
import { type DateInputItem, type DatePartsState } from '../../../../server/plugins/engine/components/types.js';
|
|
6
|
+
import { type ErrorMessageTemplateList, type FormPayload, type FormState, type FormStateValue, type FormSubmissionError, type FormSubmissionState } from '../../../../server/plugins/engine/types.js';
|
|
7
7
|
export declare class DatePartsField extends FormComponent {
|
|
8
8
|
options: DatePartsFieldComponent['options'];
|
|
9
9
|
formSchema: ObjectSchema<FormPayload>;
|
|
@@ -18,7 +18,7 @@ export declare class DatePartsField extends FormComponent {
|
|
|
18
18
|
getViewModel(payload: FormPayload, errors?: FormSubmissionError[]): {
|
|
19
19
|
fieldset: {
|
|
20
20
|
attributes?: string | Record<string, string>;
|
|
21
|
-
legend?: import("
|
|
21
|
+
legend?: import("../../../../server/plugins/engine/components/types.js").Label;
|
|
22
22
|
};
|
|
23
23
|
items: DateInputItem[];
|
|
24
24
|
label: {
|
|
@@ -26,14 +26,14 @@ export declare class DatePartsField extends FormComponent {
|
|
|
26
26
|
};
|
|
27
27
|
id: string;
|
|
28
28
|
name: string;
|
|
29
|
-
value: import("
|
|
29
|
+
value: import("../../../../server/plugins/engine/types.js").FormValue;
|
|
30
30
|
type?: string;
|
|
31
31
|
hint?: {
|
|
32
32
|
id?: string;
|
|
33
33
|
text: string;
|
|
34
34
|
};
|
|
35
|
-
prefix?: import("
|
|
36
|
-
suffix?: import("
|
|
35
|
+
prefix?: import("../../../../server/plugins/engine/components/types.js").ComponentText;
|
|
36
|
+
suffix?: import("../../../../server/plugins/engine/components/types.js").ComponentText;
|
|
37
37
|
classes?: string;
|
|
38
38
|
condition?: string;
|
|
39
39
|
errors?: FormSubmissionError[];
|
|
@@ -49,7 +49,7 @@ export declare class DatePartsField extends FormComponent {
|
|
|
49
49
|
accept?: string;
|
|
50
50
|
inputmode?: string;
|
|
51
51
|
};
|
|
52
|
-
content?: import("
|
|
52
|
+
content?: import("../../../../server/plugins/engine/components/types.js").Content | import("../../../../server/plugins/engine/components/types.js").Content[] | string;
|
|
53
53
|
maxlength?: number;
|
|
54
54
|
maxwords?: number;
|
|
55
55
|
rows?: number;
|
|
@@ -58,10 +58,10 @@ export declare class DatePartsField extends FormComponent {
|
|
|
58
58
|
attributes?: string | Record<string, string>;
|
|
59
59
|
};
|
|
60
60
|
showFieldsetError?: boolean;
|
|
61
|
-
components?: import("
|
|
61
|
+
components?: import("../../../../server/plugins/engine/components/types.js").ComponentViewModel[];
|
|
62
62
|
upload?: {
|
|
63
63
|
count: number;
|
|
64
|
-
summaryList: import("
|
|
64
|
+
summaryList: import("../../../../server/plugins/engine/types.js").SummaryList;
|
|
65
65
|
};
|
|
66
66
|
};
|
|
67
67
|
isState(value?: FormStateValue | FormState): value is DatePartsState;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type DeclarationFieldComponent, type Item } from '@defra/forms-model';
|
|
2
2
|
import { type ArraySchema, type BooleanSchema, type StringSchema } from 'joi';
|
|
3
|
-
import { FormComponent } from '
|
|
4
|
-
import { type ErrorMessageTemplateList, type FormPayload, type FormState, type FormStateValue, type FormSubmissionError, type FormSubmissionState, type FormValue } from '
|
|
3
|
+
import { FormComponent } from '../../../../server/plugins/engine/components/FormComponent.js';
|
|
4
|
+
import { type ErrorMessageTemplateList, type FormPayload, type FormState, type FormStateValue, type FormSubmissionError, type FormSubmissionState, type FormValue } from '../../../../server/plugins/engine/types.js';
|
|
5
5
|
export declare class DeclarationField extends FormComponent {
|
|
6
6
|
private readonly DEFAULT_DECLARATION_LABEL;
|
|
7
7
|
options: DeclarationFieldComponent['options'];
|
|
@@ -67,7 +67,7 @@ export declare class DeclarationField extends FormComponent {
|
|
|
67
67
|
components?: import("./types.js").ComponentViewModel[];
|
|
68
68
|
upload?: {
|
|
69
69
|
count: number;
|
|
70
|
-
summaryList: import("
|
|
70
|
+
summaryList: import("../../../../server/plugins/engine/types.js").SummaryList;
|
|
71
71
|
};
|
|
72
72
|
};
|
|
73
73
|
isValue(value?: FormStateValue | FormState): value is Item['value'][];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DetailsComponent } from '@defra/forms-model';
|
|
2
|
-
import { ComponentBase } from '
|
|
2
|
+
import { ComponentBase } from '../../../../server/plugins/engine/components/ComponentBase.js';
|
|
3
3
|
export declare class Details extends ComponentBase {
|
|
4
4
|
options: DetailsComponent['options'];
|
|
5
5
|
content: DetailsComponent['content'];
|