@defra/forms-model 3.0.686 → 3.0.688
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/dist/module/__stubs__/examples.js +185 -0
- package/dist/module/__stubs__/examples.js.map +1 -0
- package/dist/module/components/helpers.js +4 -0
- package/dist/module/components/helpers.js.map +1 -1
- package/dist/module/components/types.js.map +1 -1
- package/dist/module/form/form-definition/index.js +6 -0
- package/dist/module/form/form-definition/index.js.map +1 -1
- package/dist/module/form/form-editor/index.js +2 -0
- package/dist/module/form/form-editor/index.js.map +1 -1
- package/dist/module/form/form-editor/translations/translations-config.js +168 -0
- package/dist/module/form/form-editor/translations/translations-config.js.map +1 -0
- package/dist/module/form/form-editor/translations/translations-overview.js +93 -0
- package/dist/module/form/form-editor/translations/translations-overview.js.map +1 -0
- package/dist/module/form/form-editor/translations/translations.js +214 -0
- package/dist/module/form/form-editor/translations/translations.js.map +1 -0
- package/dist/module/form/form-editor/types.js.map +1 -1
- package/dist/module/form/utils/list.js +23 -0
- package/dist/module/form/utils/list.js.map +1 -1
- package/dist/module/form/utils/numbering.js +43 -0
- package/dist/module/form/utils/numbering.js.map +1 -0
- package/dist/module/index.js +2 -0
- package/dist/module/index.js.map +1 -1
- package/dist/types/__stubs__/examples.d.ts +9 -0
- package/dist/types/__stubs__/examples.d.ts.map +1 -0
- package/dist/types/components/helpers.d.ts +2 -1
- package/dist/types/components/helpers.d.ts.map +1 -1
- package/dist/types/components/types.d.ts +8 -0
- package/dist/types/components/types.d.ts.map +1 -1
- package/dist/types/form/form-definition/index.d.ts.map +1 -1
- package/dist/types/form/form-editor/index.d.ts +2 -0
- package/dist/types/form/form-editor/index.d.ts.map +1 -1
- package/dist/types/form/form-editor/translations/translations-config.d.ts +95 -0
- package/dist/types/form/form-editor/translations/translations-config.d.ts.map +1 -0
- package/dist/types/form/form-editor/translations/translations-overview.d.ts +14 -0
- package/dist/types/form/form-editor/translations/translations-overview.d.ts.map +1 -0
- package/dist/types/form/form-editor/translations/translations.d.ts +16 -0
- package/dist/types/form/form-editor/translations/translations.d.ts.map +1 -0
- package/dist/types/form/form-editor/types.d.ts +5 -1
- package/dist/types/form/form-editor/types.d.ts.map +1 -1
- package/dist/types/form/utils/list.d.ts +8 -1
- package/dist/types/form/utils/list.d.ts.map +1 -1
- package/dist/types/form/utils/numbering.d.ts +18 -0
- package/dist/types/form/utils/numbering.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/schemas/component-schema-v2.json +13 -0
- package/schemas/component-schema.json +13 -0
- package/schemas/form-definition-schema.json +39 -0
- package/schemas/form-definition-v2-schema.json +65 -0
- package/schemas/list-schema-v2.json +26 -0
- package/schemas/list-schema.json +26 -0
- package/schemas/page-schema-v2.json +39 -0
- package/schemas/page-schema.json +13 -0
- package/src/__stubs__/examples.js +231 -0
- package/src/components/helpers.ts +14 -0
- package/src/components/types.ts +15 -0
- package/src/form/form-definition/index.ts +19 -0
- package/src/form/form-editor/index.ts +6 -0
- package/src/form/form-editor/translations/translations-config.js +186 -0
- package/src/form/form-editor/translations/translations-overview.js +137 -0
- package/src/form/form-editor/translations/translations.js +297 -0
- package/src/form/form-editor/types.ts +6 -0
- package/src/form/utils/list.ts +34 -1
- package/src/form/utils/numbering.js +47 -0
- package/src/index.ts +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["JoiDate","JoiBase","rtrimOnly","ComponentType","GeospatialFieldGeometryTypesEnum","GeospatialFieldOptionsCountryEnum","TelephoneNumberFieldOptionsFormatEnum","MAX_NUMBER_OF_REPEAT_ITEMS","MIN_NUMBER_OF_REPEAT_ITEMS","preventUnicodeInEmail","Joi","extend","emailAddressNoUnicodeSchema","string","trim","email","tlds","allow","custom","value","helpers","description","UNICODE_EMAIL_ERROR_MESSAGE","QuestionTypeSubGroup","pageTypeSchema","required","valid","questionTypeSchema","WrittenAnswerSubGroup","DateSubGroup","LocationSubGroup","UkAddressField","TelephoneNumberField","FileUploadField","EmailAddressField","DeclarationField","ListSubGroup","YesNoField","CheckboxesField","RadiosField","AutocompleteField","PaymentField","GeospatialField","questionTypeFullSchema","TextField","MultilineTextField","NumberField","DatePartsField","MonthYearField","SelectField","EastingNorthingField","OsGridRefField","NationalGridFieldNumberField","LatLongField","writtenAnswerSubSchema","dateSubSchema","listSubSchema","locationSubSchema","nameSchema","questionSchema","hintTextSchema","optional","instructionTextSchema","questionOptionalSchema","listForQuestionSchema","listItemCountSchema","number","listItemsDataSchema","exactFilesSchema","empty","integer","min","max","minFilesSchema","maxFilesSchema","fileTypesSchema","array","items","single","default","documentTypesSchema","imageTypesSchema","tabularDataTypesSchema","enhancedActionSchema","radioIdSchema","radioTextSchema","radioHintSchema","radioValueSchema","shortDescriptionSchema","errorDescriptionSchema","pageHeadingAndGuidanceSchema","pageHeadingSchema","guidanceTextSchema","exitPageSchema","boolean","repeaterSchema","minItemsSchema","maxItemsSchema","questionSetNameSchema","needDeclarationSchema","declarationTextSchema","disableConfirmationEmailSchema","enableReferenceNumberSchema","disableUserFeedbackSchema","minSchema","maxSchema","minLengthSchema","maxLengthSchema","maxFutureSchema","maxPastSchema","precisionSchema","prefixSchema","regexSchema","rowsSchema","suffixSchema","classesSchema","jsEnabledSchema","usePostcodeLookupSchema","paymentDescriptionSchema","paymentAmountSchema","paymentApiKeySchema","exactChecksSchema","minChecksSchema","maxChecksSchema","countriesSchema","Object","values","exactFeaturesSchema","minFeaturesSchema","maxFeaturesSchema","geometryTypesSchema","telephoneNumberFormatSchema","customValidator","joi","type","base","messages","coerce","from","method","rowSeparatorRule","schema","$_getRule","colSeparatorRule","keysRule","rowSeparator","args","rows","split","map","v","filter","Boolean","colSeparator","keys","coercedValue","row","reduce","acc","col","idx","_err","console","error","errors","rules","convert","alias","$_addRule","name","ref","assert","RegExp","message","Array","isArray","every","k","autoCompleteOptionsSchema","dsv","object","text","disallow","parent","unique","ignoreUndefined","questionDetailsFullSchema","formEditorInputPageKeys","pageType","questionType","formEditorInputPageSchema","formEditorInputCheckAnswersSettingsKeys","declarationText","formEditorInputCheckAnswersSettingSchema","formEditorInputQuestionKeys","question","shortDescription","errorDescription","hintText","questionOptional","formEditorInputQuestionSchema","formEditorInputPageSettingsKeys","pageHeadingAndGuidance","pageHeading","guidanceText","formEditorInputPageSettingsSchema","govukFieldValueIsString","govukField","includes","govukFieldIsChecked","checkedValue","checked","allowedErrorTemplateFunctions"],"sources":["../../../../src/form/form-editor/index.ts"],"sourcesContent":["import JoiDate from '@joi/date'\nimport JoiBase, { type ArraySchema, type GetRuleOptions } from 'joi'\n\nimport { rtrimOnly } from '~/src/common/rtrim-only.js'\nimport {\n ComponentType,\n GeospatialFieldGeometryTypesEnum,\n GeospatialFieldOptionsCountryEnum,\n TelephoneNumberFieldOptionsFormatEnum\n} from '~/src/components/enums.js'\nimport {\n MAX_NUMBER_OF_REPEAT_ITEMS,\n MIN_NUMBER_OF_REPEAT_ITEMS\n} from '~/src/form/form-definition/constants.js'\nimport {\n type FormEditorInputCheckAnswersSettings,\n type FormEditorInputPage,\n type FormEditorInputPageSettings,\n type FormEditorInputQuestion,\n type GovukField,\n type GovukFieldQuestionOptional,\n type GovukFieldUsePostcodeLookup,\n type GovukStringField\n} from '~/src/form/form-editor/types.js'\nimport { preventUnicodeInEmail } from '~/src/form/utils/prevent-unicode.js'\n\nconst Joi = JoiBase.extend(JoiDate) as JoiBase.Root\n\nexport const emailAddressNoUnicodeSchema = Joi.string()\n .trim()\n .email({ tlds: { allow: false } })\n .custom((value, helpers) => preventUnicodeInEmail(value, helpers))\n .description('Email address preventing unicode characters')\n\nexport const UNICODE_EMAIL_ERROR_MESSAGE =\n 'The email address you entered includes invalid characters, for example, long dashes'\n\nexport enum QuestionTypeSubGroup {\n WrittenAnswerSubGroup = 'writtenAnswerSub',\n DateSubGroup = 'dateSub',\n ListSubGroup = 'listSub',\n LocationSubGroup = 'locationSub'\n}\n\nexport const pageTypeSchema = Joi.string()\n .required()\n .valid('question', 'guidance')\n .description('Type of page - either a question page or guidance page')\n\nexport const questionTypeSchema = Joi.string()\n .required()\n .valid(\n QuestionTypeSubGroup.WrittenAnswerSubGroup,\n QuestionTypeSubGroup.DateSubGroup,\n QuestionTypeSubGroup.LocationSubGroup,\n ComponentType.UkAddressField,\n ComponentType.TelephoneNumberField,\n ComponentType.FileUploadField,\n ComponentType.EmailAddressField,\n ComponentType.DeclarationField,\n QuestionTypeSubGroup.ListSubGroup,\n ComponentType.YesNoField,\n ComponentType.CheckboxesField,\n ComponentType.RadiosField,\n ComponentType.AutocompleteField,\n ComponentType.PaymentField,\n ComponentType.GeospatialField\n )\n .description('The high-level type of question, including grouped types')\n\nexport const questionTypeFullSchema = Joi.string()\n .required()\n .valid(\n ComponentType.TextField,\n ComponentType.MultilineTextField,\n ComponentType.NumberField,\n ComponentType.DatePartsField,\n ComponentType.MonthYearField,\n ComponentType.UkAddressField,\n ComponentType.TelephoneNumberField,\n ComponentType.FileUploadField,\n ComponentType.EmailAddressField,\n ComponentType.DeclarationField,\n ComponentType.YesNoField,\n ComponentType.CheckboxesField,\n ComponentType.RadiosField,\n ComponentType.AutocompleteField,\n ComponentType.SelectField,\n ComponentType.EastingNorthingField,\n ComponentType.OsGridRefField,\n ComponentType.NationalGridFieldNumberField,\n ComponentType.LatLongField,\n ComponentType.PaymentField,\n ComponentType.GeospatialField\n )\n .description('The specific component type to use for this question')\n\nexport const writtenAnswerSubSchema = Joi.string()\n .required()\n .valid(\n ComponentType.TextField,\n ComponentType.MultilineTextField,\n ComponentType.NumberField\n )\n .description('Subtype for written answer questions')\n\nexport const dateSubSchema = Joi.string()\n .required()\n .valid(ComponentType.DatePartsField, ComponentType.MonthYearField)\n .description('Subtype for date-related questions')\n\nexport const listSubSchema = Joi.string()\n .required()\n .valid(\n ComponentType.YesNoField,\n ComponentType.CheckboxesField,\n ComponentType.RadiosField,\n ComponentType.AutocompleteField,\n ComponentType.SelectField\n )\n .description('Subtype for list-related questions')\n\nexport const locationSubSchema = Joi.string()\n .required()\n .valid(\n ComponentType.UkAddressField,\n ComponentType.EastingNorthingField,\n ComponentType.OsGridRefField,\n ComponentType.NationalGridFieldNumberField,\n ComponentType.LatLongField,\n ComponentType.GeospatialField\n )\n .description('Subtype for location-related questions')\n\nexport const nameSchema = Joi.string()\n .trim()\n .required()\n .description('Unique identifier for the field')\n\nexport const questionSchema = Joi.string()\n .trim()\n .required()\n .description('The question text displayed to the user')\n\nexport const hintTextSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Optional guidance text displayed below the question')\n\nexport const instructionTextSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description(\n 'Optional instruction text with markdown support to help users answer the question'\n )\n\nexport const questionOptionalSchema = Joi.string()\n .trim()\n .optional()\n .valid('', 'true')\n .description(\n 'Indicates whether a question is optional. Empty string or \"true\" values are accepted.'\n )\n\nexport const listForQuestionSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Unique identifier for the list used by the field')\n\nexport const listItemCountSchema = Joi.number()\n .optional()\n .description('Number of list items in the list used by the field')\n\nexport const listItemsDataSchema = Joi.string()\n .allow('')\n .description('List items in JSON format, such as for radios or checkboxes.')\n\nexport const exactFilesSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .max(25)\n .description(\n 'Specifies the exact number of files required for upload. Must be between 1 and 25.'\n )\n\nexport const minFilesSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .max(25)\n .description(\n 'Minimum number of files required for upload. Must be between 1 and 25.'\n )\n\nexport const maxFilesSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .max(25)\n .description(\n 'Maximum number of files allowed for upload. Must be between 1 and 25.'\n )\n\nexport const fileTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\n .description(\n 'Array of allowed file types. Can be provided as a single value or an array.'\n )\n\nexport const documentTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\n .description(\n 'Array of allowed document types. Can be provided as a single value or an array.'\n )\n\nexport const imageTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\n .description(\n 'Array of allowed image types. Can be provided as a single value or an array.'\n )\n\nexport const tabularDataTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\n\nexport const enhancedActionSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Action field that can include enhanced functionality')\n\nexport const radioIdSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Unique identifier for radio options')\n\nexport const radioTextSchema = Joi.string()\n .trim()\n .required()\n .description('The visible text shown next to radio options')\n\nexport const radioHintSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description(\n 'Optional hint text displayed with radio buttons to provide additional guidance'\n )\n\nexport const radioValueSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description(\n 'Array of allowed tabular data types. Can be provided as a single value or an array.'\n )\n\nexport const shortDescriptionSchema = Joi.string()\n .custom(rtrimOnly)\n .required()\n .description('Brief description of the question for internal use')\n\nexport const errorDescriptionSchema = Joi.string()\n .custom(rtrimOnly)\n .allow('')\n .optional()\n .description('Description that will be displayed in error messages')\n\nexport const pageHeadingAndGuidanceSchema = Joi.string()\n .trim()\n .optional()\n .description('Combined heading and guidance for the page')\n\nexport const pageHeadingSchema = Joi.string()\n .trim()\n .required()\n .description('Main heading displayed at the top of the page')\n\nexport const guidanceTextSchema = Joi.string()\n .trim()\n .description('Guidance text to assist users in completing the page')\n\nexport const exitPageSchema = Joi.boolean()\n .default(false)\n .optional()\n .description('Determines if page is set as an Exit Page')\n\nexport const repeaterSchema = Joi.string()\n .trim()\n .optional()\n .description(\n 'Combined min/max items and question set name for the repeater page'\n )\n\nexport const minItemsSchema = Joi.number()\n .empty('')\n .min(MIN_NUMBER_OF_REPEAT_ITEMS)\n .description('The minimum number of repeater items')\n\nexport const maxItemsSchema = Joi.number()\n .empty('')\n .max(MAX_NUMBER_OF_REPEAT_ITEMS)\n .description('The maximum number of repeater items')\n\nexport const questionSetNameSchema = Joi.string()\n .trim()\n .description('The repeater question set name')\n\nexport const needDeclarationSchema = Joi.string()\n .trim()\n .required()\n .description('Whether a declaration is needed')\n\nexport const declarationTextSchema = Joi.string()\n .trim()\n .required()\n .description('Text of the declaration that users must agree to')\n\nexport const disableConfirmationEmailSchema = Joi.boolean()\n .valid(true)\n .description('Whether confirmation emails should be disabled')\n\nexport const enableReferenceNumberSchema = Joi.boolean()\n .valid(true)\n .description('Whether reference number should be enabled')\n\nexport const disableUserFeedbackSchema = Joi.boolean()\n .valid(true)\n .description('Whether user feedback should be disabled')\n\nexport const minSchema = Joi.number()\n .empty('')\n .integer()\n .description('Minimum value for numeric inputs')\n\nexport const maxSchema = Joi.number()\n .empty('')\n .integer()\n .description('Maximum value for numeric inputs')\n\nexport const minLengthSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .description('Minimum character length for text inputs')\n\nexport const maxLengthSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .description('Maximum character length for text inputs')\n\nexport const maxFutureSchema = Joi.number()\n .empty('')\n .integer()\n .min(0)\n .description('Maximum days in the future allowed for date inputs')\n\nexport const maxPastSchema = Joi.number()\n .empty('')\n .integer()\n .min(0)\n .description('Maximum days in the past allowed for date inputs')\n\nexport const precisionSchema = Joi.number()\n .empty('')\n .integer()\n .min(0)\n .description('Decimal precision for numeric inputs')\n\nexport const prefixSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Text to display before the input (e.g., £)')\n\nexport const regexSchema = Joi.string()\n .optional()\n .allow('')\n .description('Regular expression pattern for validation')\n\nexport const rowsSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .description('Number of rows for multiline text fields')\n\nexport const suffixSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Text to display after the input (e.g., kg)')\n\nexport const classesSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Custom CSS classes to apply to the component')\n\nexport const jsEnabledSchema = Joi.string()\n .trim()\n .optional()\n .allow('false', 'true')\n .description('Flag to show if Javascript is enabled or not')\n\nexport const usePostcodeLookupSchema = Joi.string()\n .trim()\n .optional()\n .valid('', 'true')\n .description(\n 'Indicates whether a UK address component supports postcode lookup. Empty string or \"true\" values are accepted.'\n )\n\nexport const paymentDescriptionSchema = Joi.string()\n .trim()\n .max(230)\n .required()\n .description('Description of payment - appears in payment providers pages')\n\nexport const paymentAmountSchema = Joi.number()\n .empty('')\n .min(0)\n .max(100000)\n .description('Amount of payment in pounds')\n\nexport const paymentApiKeySchema = Joi.string()\n .trim()\n .description('API key for payment configuration')\n\nexport const exactChecksSchema = Joi.number()\n .empty('')\n .integer()\n .min(2)\n .description('Specifies the exact number of items required to be selected.')\n\nexport const minChecksSchema = Joi.number()\n .empty('')\n .integer()\n .min(2)\n .description('Minimum number of items required to be selected.')\n\nexport const maxChecksSchema = Joi.number()\n .empty('')\n .integer()\n .min(2)\n .description('Maximum number of items allowed to be selected.')\n\nexport const countriesSchema = Joi.array()\n .items(\n Joi.string().valid(\n ...Object.values(GeospatialFieldOptionsCountryEnum),\n 'any'\n )\n )\n .single()\n .description('The country to be included in a geospatial field')\n\nexport const exactFeaturesSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .description('Specifies the exact number of features required to be defined.')\n\nexport const minFeaturesSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .description('Minimum number of features required to be defined.')\n\nexport const maxFeaturesSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .description('Maximum number of features allowed to be defined.')\n\nexport const geometryTypesSchema = Joi.array()\n .items(Joi.string().valid(...Object.values(GeospatialFieldGeometryTypesEnum)))\n .single()\n .description('The geometry types allowed in a geospatial field')\n\nexport const telephoneNumberFormatSchema = Joi.string()\n .valid(...Object.values(TelephoneNumberFieldOptionsFormatEnum), 'any')\n .description('The format for the telephone number field')\n\ntype GenericRuleOptions<K extends string, T> = Omit<GetRuleOptions, 'args'> & {\n args: Record<K, T>\n}\n\ninterface DSLSchema<\n TSchema = Record<string, unknown>[]\n> extends ArraySchema<TSchema> {\n rowSeparator: (rowSep: string | RegExp) => DSLSchema<TSchema>\n row: (rowSep: string | RegExp) => DSLSchema<TSchema>\n colSeparator: (colSep: string | RegExp) => DSLSchema<TSchema>\n col: (colSep: string | RegExp) => DSLSchema<TSchema>\n keys: (keys: string[]) => DSLSchema<TSchema>\n}\n\ninterface CustomValidator extends JoiBase.Root {\n dsv<TSchema>(): DSLSchema<TSchema>\n}\n\nexport const customValidator = Joi.extend((joi: JoiBase.Root) => {\n return {\n type: 'dsv',\n base: joi.array(),\n messages: {\n 'dsv.invalid': 'Invalid parse string'\n },\n coerce: {\n from: 'string',\n method(value: string, helpers) {\n try {\n // Only called when prefs.convert is true\n // Rules\n const rowSeparatorRule = helpers.schema.$_getRule('rowSeparator') as\n | undefined\n | GenericRuleOptions<'rowSeparator', string | RegExp>\n const colSeparatorRule = helpers.schema.$_getRule('colSeparator') as\n | undefined\n | GenericRuleOptions<'colSeparator', string | RegExp>\n const keysRule = helpers.schema.$_getRule('keys') as\n | undefined\n | GenericRuleOptions<'keys', string[]>\n\n // Rows\n const rowSeparator = rowSeparatorRule?.args.rowSeparator ?? /\\r?\\n/\n const rows = value\n .split(rowSeparator)\n .map((v) => v.trim())\n .filter(Boolean)\n\n // Columns\n const colSeparator = colSeparatorRule?.args.colSeparator ?? ','\n const keys = keysRule?.args.keys ?? ['key', 'value']\n\n const coercedValue = rows.map((row) => {\n return row\n .split(colSeparator)\n .reduce<Record<string, string>>((acc, col, idx) => {\n return {\n ...acc,\n [keys[idx]]: col.trim()\n }\n }, {})\n })\n return { value: coercedValue }\n } catch (_err) {\n // eslint-disable-next-line no-console\n console.error(_err)\n return { value, errors: [helpers.error('dsv.invalid')] }\n }\n }\n },\n rules: {\n rowSeparator: {\n convert: true,\n alias: 'row',\n method(rowSeparator: string) {\n return this.$_addRule({\n name: 'rowSeparator',\n args: { rowSeparator }\n })\n },\n args: [\n {\n name: 'rowSeparator',\n ref: true,\n assert: (value) =>\n typeof value === 'string' || value instanceof RegExp,\n message: 'must be a string or regex'\n }\n ]\n },\n colSeparator: {\n convert: true,\n alias: 'col',\n method(colSeparator: string) {\n return this.$_addRule({\n name: 'colSeparator',\n args: { colSeparator }\n })\n },\n args: [\n {\n name: 'colSeparator',\n ref: true,\n assert: (value) =>\n typeof value === 'string' || value instanceof RegExp,\n message: 'must be a string or regex'\n }\n ]\n },\n keys: {\n convert: true,\n method(keys: string[]) {\n return this.$_addRule({ name: 'keys', args: { keys } })\n },\n args: [\n {\n name: 'keys',\n ref: true,\n assert: (value) =>\n Array.isArray(value) && value.every((k) => typeof k === 'string'),\n message: 'must be an array of strings'\n }\n ]\n }\n }\n }\n}) as CustomValidator\n\nexport const autoCompleteOptionsSchema = customValidator\n .dsv<{ text: string; value: string }[]>()\n .row(/\\r?\\n/)\n .col(':')\n .keys(['text', 'value'])\n .items(\n customValidator.object({\n text: customValidator.string().min(1).disallow('').required(),\n value: customValidator\n .string()\n .default((parent: { text: string; value?: string }) => parent.text)\n .min(1)\n .disallow('')\n })\n )\n .min(1)\n .unique('text')\n .unique('value', { ignoreUndefined: true })\n .required()\n\nexport const questionDetailsFullSchema = {\n autoCompleteOptionsSchema,\n classesSchema,\n declarationTextSchema,\n documentTypesSchema,\n enhancedActionSchema,\n exactFilesSchema,\n fileTypesSchema,\n hintTextSchema,\n imageTypesSchema,\n instructionTextSchema,\n jsEnabledSchema,\n listForQuestionSchema,\n listItemCountSchema,\n listItemsDataSchema,\n maxFilesSchema,\n maxFutureSchema,\n maxLengthSchema,\n maxPastSchema,\n maxSchema,\n minFilesSchema,\n minLengthSchema,\n minSchema,\n nameSchema,\n paymentAmountSchema,\n paymentApiKeySchema,\n paymentDescriptionSchema,\n precisionSchema,\n prefixSchema,\n questionOptionalSchema,\n questionSchema,\n questionTypeFullSchema,\n radioHintSchema,\n radioIdSchema,\n radioTextSchema,\n radioValueSchema,\n regexSchema,\n rowsSchema,\n shortDescriptionSchema,\n errorDescriptionSchema,\n suffixSchema,\n tabularDataTypesSchema,\n usePostcodeLookupSchema,\n minChecksSchema,\n maxChecksSchema,\n exactChecksSchema,\n countriesSchema,\n minFeaturesSchema,\n maxFeaturesSchema,\n exactFeaturesSchema,\n geometryTypesSchema,\n telephoneNumberFormatSchema\n}\n\nexport const formEditorInputPageKeys = {\n pageType: pageTypeSchema,\n questionType: questionTypeSchema\n}\n\n/**\n * Joi schema for `FormEditorInputPage` interface\n * @see {@link FormEditorInputPage}\n */\nexport const formEditorInputPageSchema = Joi.object<FormEditorInputPage>()\n .keys(formEditorInputPageKeys)\n .required()\n .description('Input schema for creating a new page in the form editor')\n\nexport const formEditorInputCheckAnswersSettingsKeys = {\n declarationText: shortDescriptionSchema\n}\n\n/**\n * Joi schema for `FormEditorInputCheckAnswersSettings` interface\n * @see {@link FormEditorInputCheckAnswersSettings}\n */\nexport const formEditorInputCheckAnswersSettingSchema =\n Joi.object<FormEditorInputCheckAnswersSettings>()\n .keys(formEditorInputCheckAnswersSettingsKeys)\n .required()\n .description('Configuration for the check-answers page')\n\nexport const formEditorInputQuestionKeys = {\n question: questionSchema,\n shortDescription: shortDescriptionSchema,\n errorDescription: errorDescriptionSchema,\n hintText: hintTextSchema,\n questionOptional: questionOptionalSchema\n}\n\n/**\n * Joi schema for `FormEditorInputQuestion` interface\n * @see {@link FormEditorInputQuestion}\n */\nexport const formEditorInputQuestionSchema =\n Joi.object<FormEditorInputQuestion>()\n .keys(formEditorInputQuestionKeys)\n .required()\n .description(\n 'Input schema for creating or updating a question in the form editor'\n )\n\nexport const formEditorInputPageSettingsKeys = {\n pageHeadingAndGuidance: pageHeadingAndGuidanceSchema,\n pageHeading: pageHeadingSchema,\n guidanceText: guidanceTextSchema\n}\n\n/**\n * Joi schema for `FormEditorInputPageSettings` interface\n * @see {@link FormEditorInputPageSettings}\n */\nexport const formEditorInputPageSettingsSchema =\n Joi.object<FormEditorInputPageSettings>()\n .keys(formEditorInputPageSettingsKeys)\n .required()\n .description('Settings for page content and display in the form editor')\n\nexport function govukFieldValueIsString(\n govukField: GovukField\n): govukField is GovukStringField {\n return [\n 'question',\n 'hintText',\n 'shortDescription',\n 'errorDescription',\n 'autoCompleteOptions',\n 'classes',\n 'prefix',\n 'suffix',\n 'paymentAmount',\n 'paymentDescription'\n ].includes(`${govukField.name}`)\n}\n\nexport function govukFieldIsChecked(\n govukField: GovukField\n): govukField is GovukFieldQuestionOptional | GovukFieldUsePostcodeLookup {\n if (\n govukField.name !== 'questionOptional' &&\n govukField.name !== 'usePostcodeLookup'\n ) {\n return false\n }\n const checkedValue = govukField.items?.[0].checked\n return typeof checkedValue === 'boolean'\n}\n\n// A list of allowed template funtions for use within error message templates\nexport const allowedErrorTemplateFunctions = ['lowerFirst', 'capitalise']\n"],"mappings":"AAAA,OAAOA,OAAO,MAAM,WAAW;AAC/B,OAAOC,OAAO,MAAiD,KAAK;AAEpE,SAASC,SAAS;AAClB,SACEC,aAAa,EACbC,gCAAgC,EAChCC,iCAAiC,EACjCC,qCAAqC;AAEvC,SACEC,0BAA0B,EAC1BC,0BAA0B;AAY5B,SAASC,qBAAqB;AAE9B,MAAMC,GAAG,GAAGT,OAAO,CAACU,MAAM,CAACX,OAAO,CAAiB;AAEnD,OAAO,MAAMY,2BAA2B,GAAGF,GAAG,CAACG,MAAM,CAAC,CAAC,CACpDC,IAAI,CAAC,CAAC,CACNC,KAAK,CAAC;EAAEC,IAAI,EAAE;IAAEC,KAAK,EAAE;EAAM;AAAE,CAAC,CAAC,CACjCC,MAAM,CAAC,CAACC,KAAK,EAAEC,OAAO,KAAKX,qBAAqB,CAACU,KAAK,EAAEC,OAAO,CAAC,CAAC,CACjEC,WAAW,CAAC,6CAA6C,CAAC;AAE7D,OAAO,MAAMC,2BAA2B,GACtC,qFAAqF;AAEvF,WAAYC,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB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AAK,GAAG,CAAC,CAAC,CAACsI,OAAO;EAClD,OAAO,OAAOD,YAAY,KAAK,SAAS;AAC1C;;AAEA;AACA,OAAO,MAAME,6BAA6B,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["JoiDate","JoiBase","rtrimOnly","ComponentType","GeospatialFieldGeometryTypesEnum","GeospatialFieldOptionsCountryEnum","TelephoneNumberFieldOptionsFormatEnum","MAX_NUMBER_OF_REPEAT_ITEMS","MIN_NUMBER_OF_REPEAT_ITEMS","preventUnicodeInEmail","Joi","extend","emailAddressNoUnicodeSchema","string","trim","email","tlds","allow","custom","value","helpers","description","UNICODE_EMAIL_ERROR_MESSAGE","QuestionTypeSubGroup","pageTypeSchema","required","valid","questionTypeSchema","WrittenAnswerSubGroup","DateSubGroup","LocationSubGroup","UkAddressField","TelephoneNumberField","FileUploadField","EmailAddressField","DeclarationField","ListSubGroup","YesNoField","CheckboxesField","RadiosField","AutocompleteField","PaymentField","GeospatialField","questionTypeFullSchema","TextField","MultilineTextField","NumberField","DatePartsField","MonthYearField","SelectField","EastingNorthingField","OsGridRefField","NationalGridFieldNumberField","LatLongField","writtenAnswerSubSchema","dateSubSchema","listSubSchema","locationSubSchema","nameSchema","questionSchema","hintTextSchema","optional","instructionTextSchema","questionOptionalSchema","listForQuestionSchema","listItemCountSchema","number","listItemsDataSchema","exactFilesSchema","empty","integer","min","max","minFilesSchema","maxFilesSchema","fileTypesSchema","array","items","single","default","documentTypesSchema","imageTypesSchema","tabularDataTypesSchema","enhancedActionSchema","radioIdSchema","radioTextSchema","radioHintSchema","radioValueSchema","shortDescriptionSchema","errorDescriptionSchema","pageHeadingAndGuidanceSchema","pageHeadingSchema","guidanceTextSchema","exitPageSchema","boolean","repeaterSchema","minItemsSchema","maxItemsSchema","questionSetNameSchema","needDeclarationSchema","declarationTextSchema","disableConfirmationEmailSchema","enableReferenceNumberSchema","disableUserFeedbackSchema","minSchema","maxSchema","minLengthSchema","maxLengthSchema","maxFutureSchema","maxPastSchema","precisionSchema","prefixSchema","regexSchema","rowsSchema","suffixSchema","classesSchema","jsEnabledSchema","usePostcodeLookupSchema","paymentDescriptionSchema","paymentAmountSchema","paymentApiKeySchema","exactChecksSchema","minChecksSchema","maxChecksSchema","countriesSchema","Object","values","mapLayersSchema","exactFeaturesSchema","minFeaturesSchema","maxFeaturesSchema","geometryTypesSchema","telephoneNumberFormatSchema","customValidator","joi","type","base","messages","coerce","from","method","rowSeparatorRule","schema","$_getRule","colSeparatorRule","keysRule","rowSeparator","args","rows","split","map","v","filter","Boolean","colSeparator","keys","coercedValue","row","reduce","acc","col","idx","_err","console","error","errors","rules","convert","alias","$_addRule","name","ref","assert","RegExp","message","Array","isArray","every","k","autoCompleteOptionsSchema","dsv","object","text","disallow","parent","unique","ignoreUndefined","questionDetailsFullSchema","formEditorInputPageKeys","pageType","questionType","formEditorInputPageSchema","formEditorInputCheckAnswersSettingsKeys","declarationText","formEditorInputCheckAnswersSettingSchema","formEditorInputQuestionKeys","question","shortDescription","errorDescription","hintText","questionOptional","formEditorInputQuestionSchema","formEditorInputPageSettingsKeys","pageHeadingAndGuidance","pageHeading","guidanceText","formEditorInputPageSettingsSchema","govukFieldValueIsString","govukField","includes","govukFieldIsChecked","checkedValue","checked","allowedErrorTemplateFunctions"],"sources":["../../../../src/form/form-editor/index.ts"],"sourcesContent":["import JoiDate from '@joi/date'\nimport JoiBase, { type ArraySchema, type GetRuleOptions } from 'joi'\n\nimport { rtrimOnly } from '~/src/common/rtrim-only.js'\nimport {\n ComponentType,\n GeospatialFieldGeometryTypesEnum,\n GeospatialFieldOptionsCountryEnum,\n TelephoneNumberFieldOptionsFormatEnum\n} from '~/src/components/enums.js'\nimport {\n MAX_NUMBER_OF_REPEAT_ITEMS,\n MIN_NUMBER_OF_REPEAT_ITEMS\n} from '~/src/form/form-definition/constants.js'\nimport {\n type FormEditorInputCheckAnswersSettings,\n type FormEditorInputPage,\n type FormEditorInputPageSettings,\n type FormEditorInputQuestion,\n type GovukField,\n type GovukFieldQuestionOptional,\n type GovukFieldUsePostcodeLookup,\n type GovukStringField\n} from '~/src/form/form-editor/types.js'\nimport { preventUnicodeInEmail } from '~/src/form/utils/prevent-unicode.js'\n\nconst Joi = JoiBase.extend(JoiDate) as JoiBase.Root\n\nexport const emailAddressNoUnicodeSchema = Joi.string()\n .trim()\n .email({ tlds: { allow: false } })\n .custom((value, helpers) => preventUnicodeInEmail(value, helpers))\n .description('Email address preventing unicode characters')\n\nexport const UNICODE_EMAIL_ERROR_MESSAGE =\n 'The email address you entered includes invalid characters, for example, long dashes'\n\nexport enum QuestionTypeSubGroup {\n WrittenAnswerSubGroup = 'writtenAnswerSub',\n DateSubGroup = 'dateSub',\n ListSubGroup = 'listSub',\n LocationSubGroup = 'locationSub'\n}\n\nexport const pageTypeSchema = Joi.string()\n .required()\n .valid('question', 'guidance')\n .description('Type of page - either a question page or guidance page')\n\nexport const questionTypeSchema = Joi.string()\n .required()\n .valid(\n QuestionTypeSubGroup.WrittenAnswerSubGroup,\n QuestionTypeSubGroup.DateSubGroup,\n QuestionTypeSubGroup.LocationSubGroup,\n ComponentType.UkAddressField,\n ComponentType.TelephoneNumberField,\n ComponentType.FileUploadField,\n ComponentType.EmailAddressField,\n ComponentType.DeclarationField,\n QuestionTypeSubGroup.ListSubGroup,\n ComponentType.YesNoField,\n ComponentType.CheckboxesField,\n ComponentType.RadiosField,\n ComponentType.AutocompleteField,\n ComponentType.PaymentField,\n ComponentType.GeospatialField\n )\n .description('The high-level type of question, including grouped types')\n\nexport const questionTypeFullSchema = Joi.string()\n .required()\n .valid(\n ComponentType.TextField,\n ComponentType.MultilineTextField,\n ComponentType.NumberField,\n ComponentType.DatePartsField,\n ComponentType.MonthYearField,\n ComponentType.UkAddressField,\n ComponentType.TelephoneNumberField,\n ComponentType.FileUploadField,\n ComponentType.EmailAddressField,\n ComponentType.DeclarationField,\n ComponentType.YesNoField,\n ComponentType.CheckboxesField,\n ComponentType.RadiosField,\n ComponentType.AutocompleteField,\n ComponentType.SelectField,\n ComponentType.EastingNorthingField,\n ComponentType.OsGridRefField,\n ComponentType.NationalGridFieldNumberField,\n ComponentType.LatLongField,\n ComponentType.PaymentField,\n ComponentType.GeospatialField\n )\n .description('The specific component type to use for this question')\n\nexport const writtenAnswerSubSchema = Joi.string()\n .required()\n .valid(\n ComponentType.TextField,\n ComponentType.MultilineTextField,\n ComponentType.NumberField\n )\n .description('Subtype for written answer questions')\n\nexport const dateSubSchema = Joi.string()\n .required()\n .valid(ComponentType.DatePartsField, ComponentType.MonthYearField)\n .description('Subtype for date-related questions')\n\nexport const listSubSchema = Joi.string()\n .required()\n .valid(\n ComponentType.YesNoField,\n ComponentType.CheckboxesField,\n ComponentType.RadiosField,\n ComponentType.AutocompleteField,\n ComponentType.SelectField\n )\n .description('Subtype for list-related questions')\n\nexport const locationSubSchema = Joi.string()\n .required()\n .valid(\n ComponentType.UkAddressField,\n ComponentType.EastingNorthingField,\n ComponentType.OsGridRefField,\n ComponentType.NationalGridFieldNumberField,\n ComponentType.LatLongField,\n ComponentType.GeospatialField\n )\n .description('Subtype for location-related questions')\n\nexport const nameSchema = Joi.string()\n .trim()\n .required()\n .description('Unique identifier for the field')\n\nexport const questionSchema = Joi.string()\n .trim()\n .required()\n .description('The question text displayed to the user')\n\nexport const hintTextSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Optional guidance text displayed below the question')\n\nexport const instructionTextSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description(\n 'Optional instruction text with markdown support to help users answer the question'\n )\n\nexport const questionOptionalSchema = Joi.string()\n .trim()\n .optional()\n .valid('', 'true')\n .description(\n 'Indicates whether a question is optional. Empty string or \"true\" values are accepted.'\n )\n\nexport const listForQuestionSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Unique identifier for the list used by the field')\n\nexport const listItemCountSchema = Joi.number()\n .optional()\n .description('Number of list items in the list used by the field')\n\nexport const listItemsDataSchema = Joi.string()\n .allow('')\n .description('List items in JSON format, such as for radios or checkboxes.')\n\nexport const exactFilesSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .max(25)\n .description(\n 'Specifies the exact number of files required for upload. Must be between 1 and 25.'\n )\n\nexport const minFilesSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .max(25)\n .description(\n 'Minimum number of files required for upload. Must be between 1 and 25.'\n )\n\nexport const maxFilesSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .max(25)\n .description(\n 'Maximum number of files allowed for upload. Must be between 1 and 25.'\n )\n\nexport const fileTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\n .description(\n 'Array of allowed file types. Can be provided as a single value or an array.'\n )\n\nexport const documentTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\n .description(\n 'Array of allowed document types. Can be provided as a single value or an array.'\n )\n\nexport const imageTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\n .description(\n 'Array of allowed image types. Can be provided as a single value or an array.'\n )\n\nexport const tabularDataTypesSchema = Joi.array()\n .items(Joi.string())\n .single()\n .empty(null)\n .default([])\n\nexport const enhancedActionSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Action field that can include enhanced functionality')\n\nexport const radioIdSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Unique identifier for radio options')\n\nexport const radioTextSchema = Joi.string()\n .trim()\n .required()\n .description('The visible text shown next to radio options')\n\nexport const radioHintSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description(\n 'Optional hint text displayed with radio buttons to provide additional guidance'\n )\n\nexport const radioValueSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description(\n 'Array of allowed tabular data types. Can be provided as a single value or an array.'\n )\n\nexport const shortDescriptionSchema = Joi.string()\n .custom(rtrimOnly)\n .required()\n .description('Brief description of the question for internal use')\n\nexport const errorDescriptionSchema = Joi.string()\n .custom(rtrimOnly)\n .allow('')\n .optional()\n .description('Description that will be displayed in error messages')\n\nexport const pageHeadingAndGuidanceSchema = Joi.string()\n .trim()\n .optional()\n .description('Combined heading and guidance for the page')\n\nexport const pageHeadingSchema = Joi.string()\n .trim()\n .required()\n .description('Main heading displayed at the top of the page')\n\nexport const guidanceTextSchema = Joi.string()\n .trim()\n .description('Guidance text to assist users in completing the page')\n\nexport const exitPageSchema = Joi.boolean()\n .default(false)\n .optional()\n .description('Determines if page is set as an Exit Page')\n\nexport const repeaterSchema = Joi.string()\n .trim()\n .optional()\n .description(\n 'Combined min/max items and question set name for the repeater page'\n )\n\nexport const minItemsSchema = Joi.number()\n .empty('')\n .min(MIN_NUMBER_OF_REPEAT_ITEMS)\n .description('The minimum number of repeater items')\n\nexport const maxItemsSchema = Joi.number()\n .empty('')\n .max(MAX_NUMBER_OF_REPEAT_ITEMS)\n .description('The maximum number of repeater items')\n\nexport const questionSetNameSchema = Joi.string()\n .trim()\n .description('The repeater question set name')\n\nexport const needDeclarationSchema = Joi.string()\n .trim()\n .required()\n .description('Whether a declaration is needed')\n\nexport const declarationTextSchema = Joi.string()\n .trim()\n .required()\n .description('Text of the declaration that users must agree to')\n\nexport const disableConfirmationEmailSchema = Joi.boolean()\n .valid(true)\n .description('Whether confirmation emails should be disabled')\n\nexport const enableReferenceNumberSchema = Joi.boolean()\n .valid(true)\n .description('Whether reference number should be enabled')\n\nexport const disableUserFeedbackSchema = Joi.boolean()\n .valid(true)\n .description('Whether user feedback should be disabled')\n\nexport const minSchema = Joi.number()\n .empty('')\n .integer()\n .description('Minimum value for numeric inputs')\n\nexport const maxSchema = Joi.number()\n .empty('')\n .integer()\n .description('Maximum value for numeric inputs')\n\nexport const minLengthSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .description('Minimum character length for text inputs')\n\nexport const maxLengthSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .description('Maximum character length for text inputs')\n\nexport const maxFutureSchema = Joi.number()\n .empty('')\n .integer()\n .min(0)\n .description('Maximum days in the future allowed for date inputs')\n\nexport const maxPastSchema = Joi.number()\n .empty('')\n .integer()\n .min(0)\n .description('Maximum days in the past allowed for date inputs')\n\nexport const precisionSchema = Joi.number()\n .empty('')\n .integer()\n .min(0)\n .description('Decimal precision for numeric inputs')\n\nexport const prefixSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Text to display before the input (e.g., £)')\n\nexport const regexSchema = Joi.string()\n .optional()\n .allow('')\n .description('Regular expression pattern for validation')\n\nexport const rowsSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .description('Number of rows for multiline text fields')\n\nexport const suffixSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Text to display after the input (e.g., kg)')\n\nexport const classesSchema = Joi.string()\n .trim()\n .optional()\n .allow('')\n .description('Custom CSS classes to apply to the component')\n\nexport const jsEnabledSchema = Joi.string()\n .trim()\n .optional()\n .allow('false', 'true')\n .description('Flag to show if Javascript is enabled or not')\n\nexport const usePostcodeLookupSchema = Joi.string()\n .trim()\n .optional()\n .valid('', 'true')\n .description(\n 'Indicates whether a UK address component supports postcode lookup. Empty string or \"true\" values are accepted.'\n )\n\nexport const paymentDescriptionSchema = Joi.string()\n .trim()\n .max(230)\n .required()\n .description('Description of payment - appears in payment providers pages')\n\nexport const paymentAmountSchema = Joi.number()\n .empty('')\n .min(0)\n .max(100000)\n .description('Amount of payment in pounds')\n\nexport const paymentApiKeySchema = Joi.string()\n .trim()\n .description('API key for payment configuration')\n\nexport const exactChecksSchema = Joi.number()\n .empty('')\n .integer()\n .min(2)\n .description('Specifies the exact number of items required to be selected.')\n\nexport const minChecksSchema = Joi.number()\n .empty('')\n .integer()\n .min(2)\n .description('Minimum number of items required to be selected.')\n\nexport const maxChecksSchema = Joi.number()\n .empty('')\n .integer()\n .min(2)\n .description('Maximum number of items allowed to be selected.')\n\nexport const countriesSchema = Joi.array()\n .items(\n Joi.string().valid(\n ...Object.values(GeospatialFieldOptionsCountryEnum),\n 'any'\n )\n )\n .single()\n .description('The country to be included in a geospatial field')\n\nexport const mapLayersSchema = Joi.array()\n .items(Joi.string().valid('sssi'))\n .single()\n .description('The map layers to be displayed')\n\nexport const exactFeaturesSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .description('Specifies the exact number of features required to be defined.')\n\nexport const minFeaturesSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .description('Minimum number of features required to be defined.')\n\nexport const maxFeaturesSchema = Joi.number()\n .empty('')\n .integer()\n .min(1)\n .description('Maximum number of features allowed to be defined.')\n\nexport const geometryTypesSchema = Joi.array()\n .items(Joi.string().valid(...Object.values(GeospatialFieldGeometryTypesEnum)))\n .single()\n .description('The geometry types allowed in a geospatial field')\n\nexport const telephoneNumberFormatSchema = Joi.string()\n .valid(...Object.values(TelephoneNumberFieldOptionsFormatEnum), 'any')\n .description('The format for the telephone number field')\n\ntype GenericRuleOptions<K extends string, T> = Omit<GetRuleOptions, 'args'> & {\n args: Record<K, T>\n}\n\ninterface DSLSchema<\n TSchema = Record<string, unknown>[]\n> extends ArraySchema<TSchema> {\n rowSeparator: (rowSep: string | RegExp) => DSLSchema<TSchema>\n row: (rowSep: string | RegExp) => DSLSchema<TSchema>\n colSeparator: (colSep: string | RegExp) => DSLSchema<TSchema>\n col: (colSep: string | RegExp) => DSLSchema<TSchema>\n keys: (keys: string[]) => DSLSchema<TSchema>\n}\n\ninterface CustomValidator extends JoiBase.Root {\n dsv<TSchema>(): DSLSchema<TSchema>\n}\n\nexport const customValidator = Joi.extend((joi: JoiBase.Root) => {\n return {\n type: 'dsv',\n base: joi.array(),\n messages: {\n 'dsv.invalid': 'Invalid parse string'\n },\n coerce: {\n from: 'string',\n method(value: string, helpers) {\n try {\n // Only called when prefs.convert is true\n // Rules\n const rowSeparatorRule = helpers.schema.$_getRule('rowSeparator') as\n | undefined\n | GenericRuleOptions<'rowSeparator', string | RegExp>\n const colSeparatorRule = helpers.schema.$_getRule('colSeparator') as\n | undefined\n | GenericRuleOptions<'colSeparator', string | RegExp>\n const keysRule = helpers.schema.$_getRule('keys') as\n | undefined\n | GenericRuleOptions<'keys', string[]>\n\n // Rows\n const rowSeparator = rowSeparatorRule?.args.rowSeparator ?? /\\r?\\n/\n const rows = value\n .split(rowSeparator)\n .map((v) => v.trim())\n .filter(Boolean)\n\n // Columns\n const colSeparator = colSeparatorRule?.args.colSeparator ?? ','\n const keys = keysRule?.args.keys ?? ['key', 'value']\n\n const coercedValue = rows.map((row) => {\n return row\n .split(colSeparator)\n .reduce<Record<string, string>>((acc, col, idx) => {\n return {\n ...acc,\n [keys[idx]]: col.trim()\n }\n }, {})\n })\n return { value: coercedValue }\n } catch (_err) {\n // eslint-disable-next-line no-console\n console.error(_err)\n return { value, errors: [helpers.error('dsv.invalid')] }\n }\n }\n },\n rules: {\n rowSeparator: {\n convert: true,\n alias: 'row',\n method(rowSeparator: string) {\n return this.$_addRule({\n name: 'rowSeparator',\n args: { rowSeparator }\n })\n },\n args: [\n {\n name: 'rowSeparator',\n ref: true,\n assert: (value) =>\n typeof value === 'string' || value instanceof RegExp,\n message: 'must be a string or regex'\n }\n ]\n },\n colSeparator: {\n convert: true,\n alias: 'col',\n method(colSeparator: string) {\n return this.$_addRule({\n name: 'colSeparator',\n args: { colSeparator }\n })\n },\n args: [\n {\n name: 'colSeparator',\n ref: true,\n assert: (value) =>\n typeof value === 'string' || value instanceof RegExp,\n message: 'must be a string or regex'\n }\n ]\n },\n keys: {\n convert: true,\n method(keys: string[]) {\n return this.$_addRule({ name: 'keys', args: { keys } })\n },\n args: [\n {\n name: 'keys',\n ref: true,\n assert: (value) =>\n Array.isArray(value) && value.every((k) => typeof k === 'string'),\n message: 'must be an array of strings'\n }\n ]\n }\n }\n }\n}) as CustomValidator\n\nexport const autoCompleteOptionsSchema = customValidator\n .dsv<{ text: string; value: string }[]>()\n .row(/\\r?\\n/)\n .col(':')\n .keys(['text', 'value'])\n .items(\n customValidator.object({\n text: customValidator.string().min(1).disallow('').required(),\n value: customValidator\n .string()\n .default((parent: { text: string; value?: string }) => parent.text)\n .min(1)\n .disallow('')\n })\n )\n .min(1)\n .unique('text')\n .unique('value', { ignoreUndefined: true })\n .required()\n\nexport const questionDetailsFullSchema = {\n autoCompleteOptionsSchema,\n classesSchema,\n declarationTextSchema,\n documentTypesSchema,\n enhancedActionSchema,\n exactFilesSchema,\n fileTypesSchema,\n hintTextSchema,\n imageTypesSchema,\n instructionTextSchema,\n jsEnabledSchema,\n listForQuestionSchema,\n listItemCountSchema,\n listItemsDataSchema,\n maxFilesSchema,\n maxFutureSchema,\n maxLengthSchema,\n maxPastSchema,\n maxSchema,\n minFilesSchema,\n minLengthSchema,\n minSchema,\n nameSchema,\n paymentAmountSchema,\n paymentApiKeySchema,\n paymentDescriptionSchema,\n precisionSchema,\n prefixSchema,\n questionOptionalSchema,\n questionSchema,\n questionTypeFullSchema,\n radioHintSchema,\n radioIdSchema,\n radioTextSchema,\n radioValueSchema,\n regexSchema,\n rowsSchema,\n shortDescriptionSchema,\n errorDescriptionSchema,\n suffixSchema,\n tabularDataTypesSchema,\n usePostcodeLookupSchema,\n minChecksSchema,\n maxChecksSchema,\n exactChecksSchema,\n countriesSchema,\n mapLayersSchema,\n minFeaturesSchema,\n maxFeaturesSchema,\n exactFeaturesSchema,\n geometryTypesSchema,\n telephoneNumberFormatSchema\n}\n\nexport const formEditorInputPageKeys = {\n pageType: pageTypeSchema,\n questionType: questionTypeSchema\n}\n\n/**\n * Joi schema for `FormEditorInputPage` interface\n * @see {@link FormEditorInputPage}\n */\nexport const formEditorInputPageSchema = Joi.object<FormEditorInputPage>()\n .keys(formEditorInputPageKeys)\n .required()\n .description('Input schema for creating a new page in the form editor')\n\nexport const formEditorInputCheckAnswersSettingsKeys = {\n declarationText: shortDescriptionSchema\n}\n\n/**\n * Joi schema for `FormEditorInputCheckAnswersSettings` interface\n * @see {@link FormEditorInputCheckAnswersSettings}\n */\nexport const formEditorInputCheckAnswersSettingSchema =\n Joi.object<FormEditorInputCheckAnswersSettings>()\n .keys(formEditorInputCheckAnswersSettingsKeys)\n .required()\n .description('Configuration for the check-answers page')\n\nexport const formEditorInputQuestionKeys = {\n question: questionSchema,\n shortDescription: shortDescriptionSchema,\n errorDescription: errorDescriptionSchema,\n hintText: hintTextSchema,\n questionOptional: questionOptionalSchema\n}\n\n/**\n * Joi schema for `FormEditorInputQuestion` interface\n * @see {@link FormEditorInputQuestion}\n */\nexport const formEditorInputQuestionSchema =\n Joi.object<FormEditorInputQuestion>()\n .keys(formEditorInputQuestionKeys)\n .required()\n .description(\n 'Input schema for creating or updating a question in the form editor'\n )\n\nexport const formEditorInputPageSettingsKeys = {\n pageHeadingAndGuidance: pageHeadingAndGuidanceSchema,\n pageHeading: pageHeadingSchema,\n guidanceText: guidanceTextSchema\n}\n\n/**\n * Joi schema for `FormEditorInputPageSettings` interface\n * @see {@link FormEditorInputPageSettings}\n */\nexport const formEditorInputPageSettingsSchema =\n Joi.object<FormEditorInputPageSettings>()\n .keys(formEditorInputPageSettingsKeys)\n .required()\n .description('Settings for page content and display in the form editor')\n\nexport function govukFieldValueIsString(\n govukField: GovukField\n): govukField is GovukStringField {\n return [\n 'question',\n 'hintText',\n 'shortDescription',\n 'errorDescription',\n 'autoCompleteOptions',\n 'classes',\n 'prefix',\n 'suffix',\n 'paymentAmount',\n 'paymentDescription'\n ].includes(`${govukField.name}`)\n}\n\nexport function govukFieldIsChecked(\n govukField: GovukField\n): govukField is GovukFieldQuestionOptional | GovukFieldUsePostcodeLookup {\n if (\n govukField.name !== 'questionOptional' &&\n govukField.name !== 'usePostcodeLookup'\n ) {\n return false\n }\n const checkedValue = govukField.items?.[0].checked\n return typeof checkedValue === 'boolean'\n}\n\n// A list of allowed template funtions for use within error message templates\nexport const allowedErrorTemplateFunctions = ['lowerFirst', 'capitalise']\n"],"mappings":"AAAA,OAAOA,OAAO,MAAM,WAAW;AAC/B,OAAOC,OAAO,MAAiD,KAAK;AAEpE,S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CAAC,CACjC1K,QAAQ,CAAC,CAAC,CACVJ,WAAW,CACV,qEACF,CAAC;AAEL,OAAO,MAAMqL,+BAA+B,GAAG;EAC7CC,sBAAsB,EAAEjH,4BAA4B;EACpDkH,WAAW,EAAEjH,iBAAiB;EAC9BkH,YAAY,EAAEjH;AAChB,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMkH,iCAAiC,GAC5CpM,GAAG,CAAC2K,MAAM,CAA8B,CAAC,CACtC1B,IAAI,CAAC+C,+BAA+B,CAAC,CACrCjL,QAAQ,CAAC,CAAC,CACVJ,WAAW,CAAC,0DAA0D,CAAC;AAE5E,OAAO,SAAS0L,uBAAuBA,CACrCC,UAAsB,EACU;EAChC,OAAO,CACL,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,oBAAoB,CACrB,CAACC,QAAQ,CAAC,GAAGD,UAAU,CAACtC,IAAI,EAAE,CAAC;AAClC;AAEA,OAAO,SAASwC,mBAAmBA,CACjCF,UAAsB,EACkD;EACxE,IACEA,UAAU,CAACtC,IAAI,KAAK,kBAAkB,IACtCsC,UAAU,CAACtC,IAAI,KAAK,mBAAmB,EACvC;IACA,OAAO,KAAK;EACd;EACA,MAAMyC,YAAY,GAAGH,UAAU,CAACnI,KAAK,GAAG,CAAC,CAAC,CAACuI,OAAO;EAClD,OAAO,OAAOD,YAAY,KAAK,SAAS;AAC1C;;AAEA;AACA,OAAO,MAAME,6BAA6B,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { ComponentType } from "../../../components/enums.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {object} TranslationRow
|
|
5
|
+
* @property {string} name - the key name
|
|
6
|
+
* @property {string} [type] - type of text
|
|
7
|
+
* @property {string | undefined} englishContent - English text
|
|
8
|
+
* @property {string | undefined} welshContent - Welsh text
|
|
9
|
+
* @property {number} [pageNum] - page number
|
|
10
|
+
* @property {number} [questionNum] - question number
|
|
11
|
+
* @property {number} [itemNum] - list item number
|
|
12
|
+
* @property {string} [label] - label for field
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {{ text: string, href?: string }} ErrorDetailsItem
|
|
17
|
+
* @typedef {Record<string, ErrorDetailsItem>} ErrorDetails
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @template {object} [Schema=object]
|
|
22
|
+
* @typedef {object} ValidationFailure
|
|
23
|
+
* @property {ErrorDetails} formErrors - Formatted errors for error summary
|
|
24
|
+
* @property {Schema} formValues - Form POST payload from Hapi request
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
export const TranslationRowTypes = {
|
|
28
|
+
PageHeading: 'PageHeading',
|
|
29
|
+
PageGuidance: 'PageGuidance',
|
|
30
|
+
RepeatTitle: 'RepeatTitle',
|
|
31
|
+
QuestionText: 'QuestionText',
|
|
32
|
+
QuestionHint: 'QuestionHint',
|
|
33
|
+
ShortDescription: 'ShortDescription',
|
|
34
|
+
ErrorDescription: 'ErrorDescription',
|
|
35
|
+
ListItemText: 'ListItemText',
|
|
36
|
+
ListItemHint: 'ListItemHint',
|
|
37
|
+
InstructionText: 'InstructionText',
|
|
38
|
+
DeclarationBody: 'DeclarationBody',
|
|
39
|
+
PaymentDescription: 'PaymentDescription'
|
|
40
|
+
};
|
|
41
|
+
export const TEXTAREA_3_ROWS = 'textarea3';
|
|
42
|
+
export const TEXTAREA_5_ROWS = 'textarea5';
|
|
43
|
+
export const TEXTAREA_12_ROWS_WITH_MARKDOWN = 'textarea12markdown';
|
|
44
|
+
export const LIST_ITEM_HINT = 'listitemhint';
|
|
45
|
+
export const LIST_ITEM_WITH_HINT_FOLLOWING = 'listoptionwithhintfollowing';
|
|
46
|
+
|
|
47
|
+
/** @type {Record<string, { jsonPrefix: string, jsonSuffix: string, displayName: string, getLabel: (pageNum: number, questionNum?: number, itemNum?: number) => string }>} */
|
|
48
|
+
export const keyConfig = {
|
|
49
|
+
[TranslationRowTypes.QuestionText]: {
|
|
50
|
+
jsonPrefix: 'components',
|
|
51
|
+
jsonSuffix: 'title',
|
|
52
|
+
displayName: 'Question text',
|
|
53
|
+
getLabel: (pageNum, questionNum) => `Welsh question text - Page ${pageNum}, question ${questionNum}`
|
|
54
|
+
},
|
|
55
|
+
[TranslationRowTypes.QuestionHint]: {
|
|
56
|
+
jsonPrefix: 'components',
|
|
57
|
+
jsonSuffix: 'hint',
|
|
58
|
+
displayName: 'Hint',
|
|
59
|
+
getLabel: (pageNum, questionNum) => `Welsh hint - Page ${pageNum}, question ${questionNum}`
|
|
60
|
+
},
|
|
61
|
+
[TranslationRowTypes.ShortDescription]: {
|
|
62
|
+
jsonPrefix: 'components',
|
|
63
|
+
jsonSuffix: 'shortDescription',
|
|
64
|
+
displayName: 'Short description',
|
|
65
|
+
getLabel: (pageNum, questionNum) => `Welsh short description - Page ${pageNum}, question ${questionNum}`
|
|
66
|
+
},
|
|
67
|
+
[TranslationRowTypes.InstructionText]: {
|
|
68
|
+
jsonPrefix: 'components',
|
|
69
|
+
jsonSuffix: 'instructionText',
|
|
70
|
+
displayName: 'Instruction text',
|
|
71
|
+
getLabel: (pageNum, questionNum) => `Welsh instruction text - Page ${pageNum}, question ${questionNum}`
|
|
72
|
+
},
|
|
73
|
+
[TranslationRowTypes.DeclarationBody]: {
|
|
74
|
+
jsonPrefix: 'components',
|
|
75
|
+
jsonSuffix: 'content',
|
|
76
|
+
displayName: 'Declaration body',
|
|
77
|
+
getLabel: (pageNum, questionNum) => `Welsh declaration body - Page ${pageNum}, question ${questionNum}`
|
|
78
|
+
},
|
|
79
|
+
[TranslationRowTypes.PaymentDescription]: {
|
|
80
|
+
jsonPrefix: 'components',
|
|
81
|
+
jsonSuffix: 'paymentDescription',
|
|
82
|
+
displayName: 'Payment description',
|
|
83
|
+
getLabel: (pageNum, questionNum) => `Welsh payment description - Page ${pageNum}, question ${questionNum}`
|
|
84
|
+
},
|
|
85
|
+
[TranslationRowTypes.ListItemText]: {
|
|
86
|
+
jsonPrefix: 'listItems',
|
|
87
|
+
jsonSuffix: 'text',
|
|
88
|
+
displayName: 'Option',
|
|
89
|
+
getLabel: (pageNum, questionNum, itemNum) => `Welsh option ${itemNum} - Page ${pageNum}, question ${questionNum}`
|
|
90
|
+
},
|
|
91
|
+
[TranslationRowTypes.ListItemHint]: {
|
|
92
|
+
jsonPrefix: 'listItems',
|
|
93
|
+
jsonSuffix: 'hint',
|
|
94
|
+
displayName: 'Option hint',
|
|
95
|
+
getLabel: (pageNum, questionNum, itemNum) => `Welsh hint for option ${itemNum} - Page ${pageNum}, question ${questionNum}`
|
|
96
|
+
},
|
|
97
|
+
[TranslationRowTypes.PageGuidance]: {
|
|
98
|
+
jsonPrefix: 'components',
|
|
99
|
+
jsonSuffix: 'content',
|
|
100
|
+
displayName: 'Guidance text',
|
|
101
|
+
getLabel: pageNum => `Welsh guidance text (markdown) - page ${pageNum}`
|
|
102
|
+
},
|
|
103
|
+
[TranslationRowTypes.PageHeading]: {
|
|
104
|
+
jsonPrefix: 'pages',
|
|
105
|
+
jsonSuffix: 'title',
|
|
106
|
+
displayName: 'Page heading',
|
|
107
|
+
getLabel: pageNum => `Welsh page heading - page ${pageNum}`
|
|
108
|
+
},
|
|
109
|
+
[TranslationRowTypes.RepeatTitle]: {
|
|
110
|
+
jsonPrefix: 'pages',
|
|
111
|
+
jsonSuffix: 'repeatTitle',
|
|
112
|
+
displayName: 'Repeat name',
|
|
113
|
+
getLabel: pageNum => `Welsh repeat name - page ${pageNum}`
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
export const IGNORE_FIELDS = [ComponentType.Details, ComponentType.Html, ComponentType.InsetText, ComponentType.HiddenField];
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Lookup a translation from a list of translation records.
|
|
120
|
+
* @param {string} key - The translation key to look up.
|
|
121
|
+
* @param {Record<string, string> | undefined} translations - The translation values to search.
|
|
122
|
+
*/
|
|
123
|
+
export function lookupTranslation(key, translations) {
|
|
124
|
+
if (!translations) {
|
|
125
|
+
return '';
|
|
126
|
+
}
|
|
127
|
+
return translations[key] ?? '';
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Resolve the underlying content for a translation row from an entity.
|
|
132
|
+
* Involves using the appropriate child properties if necessary.
|
|
133
|
+
* @param {string} keyType - The translation row type being resolved.
|
|
134
|
+
* @param {ComponentDef | Page | Item} entity - The entity that may contain the content to translate.
|
|
135
|
+
* @param {string} jsonSuffix - The property name to read from the entity.
|
|
136
|
+
*/
|
|
137
|
+
export function drillDown(keyType, entity, jsonSuffix) {
|
|
138
|
+
/** @type {Partial<Record<string, (entity: ComponentDef | Page | Item) => string>>} */
|
|
139
|
+
const resolveData = {
|
|
140
|
+
[TranslationRowTypes.InstructionText]: () =>
|
|
141
|
+
// @ts-expect-error - dynamic property lookup
|
|
142
|
+
'options' in entity ? entity.options?.instructionText : '',
|
|
143
|
+
[TranslationRowTypes.ListItemHint]: () =>
|
|
144
|
+
// @ts-expect-error - dynamic property lookup
|
|
145
|
+
'hint' in entity ? entity.hint.text : '',
|
|
146
|
+
[TranslationRowTypes.DeclarationBody]: () => 'content' in entity ? entity.content : '',
|
|
147
|
+
[TranslationRowTypes.PaymentDescription]: () =>
|
|
148
|
+
// @ts-expect-error - dynamic property lookup
|
|
149
|
+
'options' in entity ? entity.options?.description : ''
|
|
150
|
+
};
|
|
151
|
+
const func = resolveData[keyType];
|
|
152
|
+
if (func) {
|
|
153
|
+
return func(entity);
|
|
154
|
+
} else {
|
|
155
|
+
const entityWithDynamicProperties = /** @type {Record<string, unknown>} */
|
|
156
|
+
/** @type {unknown} */entity;
|
|
157
|
+
if (typeof entity === 'object') {
|
|
158
|
+
return jsonSuffix in entityWithDynamicProperties ? (/** @type {string} */entityWithDynamicProperties[jsonSuffix]) : '';
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return entity;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* @import { ComponentDef } from '~/src/components/types.js'
|
|
166
|
+
* @import { Item, Page } from '~/src/form/form-definition/types.js'
|
|
167
|
+
*/
|
|
168
|
+
//# sourceMappingURL=translations-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translations-config.js","names":["ComponentType","TranslationRowTypes","PageHeading","PageGuidance","RepeatTitle","QuestionText","QuestionHint","ShortDescription","ErrorDescription","ListItemText","ListItemHint","InstructionText","DeclarationBody","PaymentDescription","TEXTAREA_3_ROWS","TEXTAREA_5_ROWS","TEXTAREA_12_ROWS_WITH_MARKDOWN","LIST_ITEM_HINT","LIST_ITEM_WITH_HINT_FOLLOWING","keyConfig","jsonPrefix","jsonSuffix","displayName","getLabel","pageNum","questionNum","itemNum","IGNORE_FIELDS","Details","Html","InsetText","HiddenField","lookupTranslation","key","translations","drillDown","keyType","entity","resolveData","options","instructionText","hint","text","content","description","func","entityWithDynamicProperties"],"sources":["../../../../../src/form/form-editor/translations/translations-config.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\n\n/**\n * @typedef {object} TranslationRow\n * @property {string} name - the key name\n * @property {string} [type] - type of text\n * @property {string | undefined} englishContent - English text\n * @property {string | undefined} welshContent - Welsh text\n * @property {number} [pageNum] - page number\n * @property {number} [questionNum] - question number\n * @property {number} [itemNum] - list item number\n * @property {string} [label] - label for field\n */\n\n/**\n * @typedef {{ text: string, href?: string }} ErrorDetailsItem\n * @typedef {Record<string, ErrorDetailsItem>} ErrorDetails\n */\n\n/**\n * @template {object} [Schema=object]\n * @typedef {object} ValidationFailure\n * @property {ErrorDetails} formErrors - Formatted errors for error summary\n * @property {Schema} formValues - Form POST payload from Hapi request\n */\n\nexport const TranslationRowTypes = {\n PageHeading: 'PageHeading',\n PageGuidance: 'PageGuidance',\n RepeatTitle: 'RepeatTitle',\n QuestionText: 'QuestionText',\n QuestionHint: 'QuestionHint',\n ShortDescription: 'ShortDescription',\n ErrorDescription: 'ErrorDescription',\n ListItemText: 'ListItemText',\n ListItemHint: 'ListItemHint',\n InstructionText: 'InstructionText',\n DeclarationBody: 'DeclarationBody',\n PaymentDescription: 'PaymentDescription'\n}\n\nexport const TEXTAREA_3_ROWS = 'textarea3'\nexport const TEXTAREA_5_ROWS = 'textarea5'\nexport const TEXTAREA_12_ROWS_WITH_MARKDOWN = 'textarea12markdown'\nexport const LIST_ITEM_HINT = 'listitemhint'\nexport const LIST_ITEM_WITH_HINT_FOLLOWING = 'listoptionwithhintfollowing'\n\n/** @type {Record<string, { jsonPrefix: string, jsonSuffix: string, displayName: string, getLabel: (pageNum: number, questionNum?: number, itemNum?: number) => string }>} */\nexport const keyConfig = {\n [TranslationRowTypes.QuestionText]: {\n jsonPrefix: 'components',\n jsonSuffix: 'title',\n displayName: 'Question text',\n getLabel: (pageNum, questionNum) =>\n `Welsh question text - Page ${pageNum}, question ${questionNum}`\n },\n [TranslationRowTypes.QuestionHint]: {\n jsonPrefix: 'components',\n jsonSuffix: 'hint',\n displayName: 'Hint',\n getLabel: (pageNum, questionNum) =>\n `Welsh hint - Page ${pageNum}, question ${questionNum}`\n },\n [TranslationRowTypes.ShortDescription]: {\n jsonPrefix: 'components',\n jsonSuffix: 'shortDescription',\n displayName: 'Short description',\n getLabel: (pageNum, questionNum) =>\n `Welsh short description - Page ${pageNum}, question ${questionNum}`\n },\n [TranslationRowTypes.InstructionText]: {\n jsonPrefix: 'components',\n jsonSuffix: 'instructionText',\n displayName: 'Instruction text',\n getLabel: (pageNum, questionNum) =>\n `Welsh instruction text - Page ${pageNum}, question ${questionNum}`\n },\n [TranslationRowTypes.DeclarationBody]: {\n jsonPrefix: 'components',\n jsonSuffix: 'content',\n displayName: 'Declaration body',\n getLabel: (pageNum, questionNum) =>\n `Welsh declaration body - Page ${pageNum}, question ${questionNum}`\n },\n [TranslationRowTypes.PaymentDescription]: {\n jsonPrefix: 'components',\n jsonSuffix: 'paymentDescription',\n displayName: 'Payment description',\n getLabel: (pageNum, questionNum) =>\n `Welsh payment description - Page ${pageNum}, question ${questionNum}`\n },\n [TranslationRowTypes.ListItemText]: {\n jsonPrefix: 'listItems',\n jsonSuffix: 'text',\n displayName: 'Option',\n getLabel: (pageNum, questionNum, itemNum) =>\n `Welsh option ${itemNum} - Page ${pageNum}, question ${questionNum}`\n },\n [TranslationRowTypes.ListItemHint]: {\n jsonPrefix: 'listItems',\n jsonSuffix: 'hint',\n displayName: 'Option hint',\n getLabel: (pageNum, questionNum, itemNum) =>\n `Welsh hint for option ${itemNum} - Page ${pageNum}, question ${questionNum}`\n },\n [TranslationRowTypes.PageGuidance]: {\n jsonPrefix: 'components',\n jsonSuffix: 'content',\n displayName: 'Guidance text',\n getLabel: (pageNum) => `Welsh guidance text (markdown) - page ${pageNum}`\n },\n [TranslationRowTypes.PageHeading]: {\n jsonPrefix: 'pages',\n jsonSuffix: 'title',\n displayName: 'Page heading',\n getLabel: (pageNum) => `Welsh page heading - page ${pageNum}`\n },\n [TranslationRowTypes.RepeatTitle]: {\n jsonPrefix: 'pages',\n jsonSuffix: 'repeatTitle',\n displayName: 'Repeat name',\n getLabel: (pageNum) => `Welsh repeat name - page ${pageNum}`\n }\n}\n\nexport const IGNORE_FIELDS = [\n ComponentType.Details,\n ComponentType.Html,\n ComponentType.InsetText,\n ComponentType.HiddenField\n]\n\n/**\n * Lookup a translation from a list of translation records.\n * @param {string} key - The translation key to look up.\n * @param {Record<string, string> | undefined} translations - The translation values to search.\n */\nexport function lookupTranslation(key, translations) {\n if (!translations) {\n return ''\n }\n return translations[key] ?? ''\n}\n\n/**\n * Resolve the underlying content for a translation row from an entity.\n * Involves using the appropriate child properties if necessary.\n * @param {string} keyType - The translation row type being resolved.\n * @param {ComponentDef | Page | Item} entity - The entity that may contain the content to translate.\n * @param {string} jsonSuffix - The property name to read from the entity.\n */\nexport function drillDown(keyType, entity, jsonSuffix) {\n /** @type {Partial<Record<string, (entity: ComponentDef | Page | Item) => string>>} */\n const resolveData = {\n [TranslationRowTypes.InstructionText]: () =>\n // @ts-expect-error - dynamic property lookup\n 'options' in entity ? entity.options?.instructionText : '',\n [TranslationRowTypes.ListItemHint]: () =>\n // @ts-expect-error - dynamic property lookup\n 'hint' in entity ? entity.hint.text : '',\n [TranslationRowTypes.DeclarationBody]: () =>\n 'content' in entity ? entity.content : '',\n [TranslationRowTypes.PaymentDescription]: () =>\n // @ts-expect-error - dynamic property lookup\n 'options' in entity ? entity.options?.description : ''\n }\n const func = resolveData[keyType]\n if (func) {\n return func(entity)\n } else {\n const entityWithDynamicProperties = /** @type {Record<string, unknown>} */ (\n /** @type {unknown} */ (entity)\n )\n if (typeof entity === 'object') {\n return jsonSuffix in entityWithDynamicProperties\n ? /** @type {string} */ (entityWithDynamicProperties[jsonSuffix])\n : ''\n }\n }\n return entity\n}\n\n/**\n * @import { ComponentDef } from '~/src/components/types.js'\n * @import { Item, Page } from '~/src/form/form-definition/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMC,mBAAmB,GAAG;EACjCC,WAAW,EAAE,aAAa;EAC1BC,YAAY,EAAE,cAAc;EAC5BC,WAAW,EAAE,aAAa;EAC1BC,YAAY,EAAE,cAAc;EAC5BC,YAAY,EAAE,cAAc;EAC5BC,gBAAgB,EAAE,kBAAkB;EACpCC,gBAAgB,EAAE,kBAAkB;EACpCC,YAAY,EAAE,cAAc;EAC5BC,YAAY,EAAE,cAAc;EAC5BC,eAAe,EAAE,iBAAiB;EAClCC,eAAe,EAAE,iBAAiB;EAClCC,kBAAkB,EAAE;AACtB,CAAC;AAED,OAAO,MAAMC,eAAe,GAAG,WAAW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hB,UAAU,IAAIyB,2BAA2B,IAC5C,qBAAuBA,2BAA2B,CAACzB,UAAU,CAAC,IAC9D,EAAE;IACR;EACF;EACA,OAAOgB,MAAM;AACf;;AAEA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { lookupTranslation } from "./translations-config.js";
|
|
2
|
+
const formNameKey = 'form.title';
|
|
3
|
+
const contactEmailAddressKey = 'form.contact.email.address';
|
|
4
|
+
const contactEmailResponseKey = 'form.contact.email.responseTime';
|
|
5
|
+
const contactOnlineUrlKey = 'form.contact.online.url';
|
|
6
|
+
const contactOnlineTextKey = 'form.contact.online.text';
|
|
7
|
+
const contactPhoneKey = 'form.contact.phone';
|
|
8
|
+
const submissionGuidanceKey = 'form.submissionGuidance';
|
|
9
|
+
const privacyNoticeUrlKey = 'form.privacyNoticeUrl';
|
|
10
|
+
const privacyNoticeTextKey = 'form.privacyNoticeText';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Determine a field value, either from the user-entered payload (validation) or from a translation lookup
|
|
14
|
+
* @param {string} key
|
|
15
|
+
* @param {Record<string, string>} translations
|
|
16
|
+
* @param {ValidationFailure<any>} [validation]
|
|
17
|
+
* @returns { string | undefined }
|
|
18
|
+
*/
|
|
19
|
+
function getTranslation(key, translations, validation) {
|
|
20
|
+
return validation?.formValues[key] ?? lookupTranslation(key, translations);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Build all translation rows in the form overview section (metatdata values).
|
|
25
|
+
* @param {FormMetadata} metadata
|
|
26
|
+
* @param {FormDefinition} definition
|
|
27
|
+
* @param {Record<string, string>} translations
|
|
28
|
+
* @param {ValidationFailure<any>} [validation]
|
|
29
|
+
* @returns {TranslationRow[]}
|
|
30
|
+
*/
|
|
31
|
+
export function buildOverviewSection(metadata, definition, translations, validation) {
|
|
32
|
+
/** @type {TranslationRow[]} */
|
|
33
|
+
const rows = [];
|
|
34
|
+
rows.push({
|
|
35
|
+
name: formNameKey,
|
|
36
|
+
englishContent: definition.name,
|
|
37
|
+
welshContent: getTranslation(formNameKey, translations, validation),
|
|
38
|
+
label: 'Welsh form name'
|
|
39
|
+
}, {
|
|
40
|
+
name: contactEmailAddressKey,
|
|
41
|
+
englishContent: metadata.contact?.email?.address ?? 'Not set',
|
|
42
|
+
welshContent: getTranslation(contactEmailAddressKey, translations, validation),
|
|
43
|
+
label: 'Welsh support email address'
|
|
44
|
+
}, {
|
|
45
|
+
name: contactEmailResponseKey,
|
|
46
|
+
englishContent: metadata.contact?.email?.responseTime ?? '--',
|
|
47
|
+
welshContent: getTranslation(contactEmailResponseKey, translations, validation),
|
|
48
|
+
label: 'Welsh response time message'
|
|
49
|
+
}, {
|
|
50
|
+
name: contactOnlineUrlKey,
|
|
51
|
+
englishContent: metadata.contact?.online?.url ?? 'Not set',
|
|
52
|
+
welshContent: getTranslation(contactOnlineUrlKey, translations, validation),
|
|
53
|
+
label: 'Welsh contact link URL'
|
|
54
|
+
}, {
|
|
55
|
+
name: contactOnlineTextKey,
|
|
56
|
+
englishContent: metadata.contact?.online?.text ?? '--',
|
|
57
|
+
welshContent: getTranslation(contactOnlineTextKey, translations, validation),
|
|
58
|
+
label: 'Welsh text for the contact link'
|
|
59
|
+
}, {
|
|
60
|
+
name: contactPhoneKey,
|
|
61
|
+
englishContent: metadata.contact?.phone ?? 'Not set',
|
|
62
|
+
welshContent: getTranslation(contactPhoneKey, translations, validation),
|
|
63
|
+
label: 'Welsh phone number and opening times'
|
|
64
|
+
}, {
|
|
65
|
+
name: submissionGuidanceKey,
|
|
66
|
+
englishContent: metadata.submissionGuidance ?? 'Not set',
|
|
67
|
+
welshContent: getTranslation(submissionGuidanceKey, translations, validation),
|
|
68
|
+
label: 'Welsh information about what happens next'
|
|
69
|
+
});
|
|
70
|
+
if (metadata.privacyNoticeType === 'link') {
|
|
71
|
+
rows.push({
|
|
72
|
+
name: privacyNoticeUrlKey,
|
|
73
|
+
englishContent: metadata.privacyNoticeUrl ?? 'Not set',
|
|
74
|
+
welshContent: getTranslation(privacyNoticeUrlKey, translations, validation),
|
|
75
|
+
label: 'Welsh privacy notice URL'
|
|
76
|
+
});
|
|
77
|
+
} else {
|
|
78
|
+
rows.push({
|
|
79
|
+
name: privacyNoticeTextKey,
|
|
80
|
+
englishContent: metadata.privacyNoticeText ?? 'Not set',
|
|
81
|
+
welshContent: getTranslation(privacyNoticeTextKey, translations, validation),
|
|
82
|
+
label: 'Welsh privacy notice text'
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return /** @type {TranslationRow[]} */rows;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @import { FormMetadata } from '~/src/form/form-metadata/types.js'
|
|
90
|
+
* @import { FormDefinition } from '~/src/form/form-definition/types.js'
|
|
91
|
+
* @import { TranslationRow, ValidationFailure} from '~/src/form/form-editor/translations/translations-config.js'
|
|
92
|
+
*/
|
|
93
|
+
//# sourceMappingURL=translations-overview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translations-overview.js","names":["lookupTranslation","formNameKey","contactEmailAddressKey","contactEmailResponseKey","contactOnlineUrlKey","contactOnlineTextKey","contactPhoneKey","submissionGuidanceKey","privacyNoticeUrlKey","privacyNoticeTextKey","getTranslation","key","translations","validation","formValues","buildOverviewSection","metadata","definition","rows","push","name","englishContent","welshContent","label","contact","email","address","responseTime","online","url","text","phone","submissionGuidance","privacyNoticeType","privacyNoticeUrl","privacyNoticeText"],"sources":["../../../../../src/form/form-editor/translations/translations-overview.js"],"sourcesContent":["import { lookupTranslation } from '~/src/form/form-editor/translations/translations-config.js'\n\nconst formNameKey = 'form.title'\nconst contactEmailAddressKey = 'form.contact.email.address'\nconst contactEmailResponseKey = 'form.contact.email.responseTime'\nconst contactOnlineUrlKey = 'form.contact.online.url'\nconst contactOnlineTextKey = 'form.contact.online.text'\nconst contactPhoneKey = 'form.contact.phone'\nconst submissionGuidanceKey = 'form.submissionGuidance'\nconst privacyNoticeUrlKey = 'form.privacyNoticeUrl'\nconst privacyNoticeTextKey = 'form.privacyNoticeText'\n\n/**\n * Determine a field value, either from the user-entered payload (validation) or from a translation lookup\n * @param {string} key\n * @param {Record<string, string>} translations\n * @param {ValidationFailure<any>} [validation]\n * @returns { string | undefined }\n */\nfunction getTranslation(key, translations, validation) {\n return validation?.formValues[key] ?? lookupTranslation(key, translations)\n}\n\n/**\n * Build all translation rows in the form overview section (metatdata values).\n * @param {FormMetadata} metadata\n * @param {FormDefinition} definition\n * @param {Record<string, string>} translations\n * @param {ValidationFailure<any>} [validation]\n * @returns {TranslationRow[]}\n */\nexport function buildOverviewSection(\n metadata,\n definition,\n translations,\n validation\n) {\n /** @type {TranslationRow[]} */\n const rows = []\n\n rows.push(\n {\n name: formNameKey,\n englishContent: definition.name,\n welshContent: getTranslation(formNameKey, translations, validation),\n label: 'Welsh form name'\n },\n {\n name: contactEmailAddressKey,\n englishContent: metadata.contact?.email?.address ?? 'Not set',\n welshContent: getTranslation(\n contactEmailAddressKey,\n translations,\n validation\n ),\n label: 'Welsh support email address'\n },\n {\n name: contactEmailResponseKey,\n englishContent: metadata.contact?.email?.responseTime ?? '--',\n welshContent: getTranslation(\n contactEmailResponseKey,\n translations,\n validation\n ),\n label: 'Welsh response time message'\n },\n {\n name: contactOnlineUrlKey,\n englishContent: metadata.contact?.online?.url ?? 'Not set',\n welshContent: getTranslation(\n contactOnlineUrlKey,\n translations,\n validation\n ),\n label: 'Welsh contact link URL'\n },\n {\n name: contactOnlineTextKey,\n englishContent: metadata.contact?.online?.text ?? '--',\n welshContent: getTranslation(\n contactOnlineTextKey,\n translations,\n validation\n ),\n label: 'Welsh text for the contact link'\n },\n {\n name: contactPhoneKey,\n englishContent: metadata.contact?.phone ?? 'Not set',\n welshContent: getTranslation(contactPhoneKey, translations, validation),\n label: 'Welsh phone number and opening times'\n },\n {\n name: submissionGuidanceKey,\n englishContent: metadata.submissionGuidance ?? 'Not set',\n welshContent: getTranslation(\n submissionGuidanceKey,\n translations,\n validation\n ),\n label: 'Welsh information about what happens next'\n }\n )\n\n if (metadata.privacyNoticeType === 'link') {\n rows.push({\n name: privacyNoticeUrlKey,\n englishContent: metadata.privacyNoticeUrl ?? 'Not set',\n welshContent: getTranslation(\n privacyNoticeUrlKey,\n translations,\n validation\n ),\n label: 'Welsh privacy notice URL'\n })\n } else {\n rows.push({\n name: privacyNoticeTextKey,\n englishContent: metadata.privacyNoticeText ?? 'Not set',\n welshContent: getTranslation(\n privacyNoticeTextKey,\n translations,\n validation\n ),\n label: 'Welsh privacy notice text'\n })\n }\n\n return /** @type {TranslationRow[]} */ (rows)\n}\n\n/**\n * @import { FormMetadata } from '~/src/form/form-metadata/types.js'\n * @import { FormDefinition } from '~/src/form/form-definition/types.js'\n * @import { TranslationRow, ValidationFailure} from '~/src/form/form-editor/translations/translations-config.js'\n */\n"],"mappings":"AAAA,SAASA,iBAAiB;AAE1B,MAAMC,WAAW,GAAG,YAAY;AAChC,MAAMC,sBAAsB,GAAG,4BAA4B;AAC3D,MAAMC,uBAAuB,GAAG,iCAAiC;AACjE,MAAMC,mBAAmB,GAAG,yBAAyB;AACrD,MAAMC,oBAAoB,GAAG,0BAA0B;AACvD,MAAMC,eAAe,GAAG,oBAAoB;AAC5C,MAAMC,qBAAqB,GAAG,yBAAyB;AACvD,MAAMC,mBAAmB,GAAG,uBAAuB;AACnD,MAAMC,oBAAoB,GAAG,wBAAwB;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,cAAcA,CAACC,GAAG,EAAEC,YAAY,EAAEC,UAAU,EAAE;EACrD,OAAOA,UAAU,EAAEC,UAAU,CAACH,GAAG,CAAC,IAAIX,iBAAiB,CAACW,GAAG,EAAEC,YAAY,CAAC;AAC5E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,oBAAoBA,CAClCC,QAAQ,EACRC,UAAU,EACVL,YAAY,EAC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