@defra/forms-model 3.0.604 → 3.0.606

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/module/components/component-types.js +6 -0
  2. package/dist/module/components/component-types.js.map +1 -1
  3. package/dist/module/components/enums.js +1 -0
  4. package/dist/module/components/enums.js.map +1 -1
  5. package/dist/module/components/types.js.map +1 -1
  6. package/dist/module/form/form-audit/consolidation.js +3 -3
  7. package/dist/module/form/form-audit/consolidation.js.map +1 -1
  8. package/dist/module/form/form-definition/index.js +9 -1
  9. package/dist/module/form/form-definition/index.js.map +1 -1
  10. package/dist/types/components/component-types.d.ts.map +1 -1
  11. package/dist/types/components/enums.d.ts +2 -1
  12. package/dist/types/components/enums.d.ts.map +1 -1
  13. package/dist/types/components/types.d.ts +9 -2
  14. package/dist/types/components/types.d.ts.map +1 -1
  15. package/dist/types/form/form-audit/consolidation.d.ts +1 -1
  16. package/dist/types/form/form-audit/consolidation.d.ts.map +1 -1
  17. package/dist/types/form/form-definition/index.d.ts.map +1 -1
  18. package/package.json +1 -1
  19. package/schemas/component-schema-v2.json +13 -0
  20. package/schemas/component-schema.json +13 -0
  21. package/schemas/form-definition-schema.json +39 -0
  22. package/schemas/form-definition-v2-schema.json +65 -0
  23. package/schemas/list-schema-v2.json +26 -0
  24. package/schemas/list-schema.json +26 -0
  25. package/schemas/page-schema-v2.json +39 -0
  26. package/schemas/page-schema.json +13 -0
  27. package/src/components/component-types.ts +7 -0
  28. package/src/components/enums.ts +2 -1
  29. package/src/components/types.ts +10 -0
  30. package/src/form/form-audit/consolidation.ts +9 -3
  31. package/src/form/form-definition/index.ts +16 -1
@@ -206,6 +206,19 @@
206
206
  "properties": {},
207
207
  "additionalProperties": true,
208
208
  "title": "Custom Validation Messages"
209
+ },
210
+ "amount": {
211
+ "type": "number",
212
+ "description": "Payment amount in GBP (£0.30 - £100,000)",
213
+ "minimum": 0.3,
214
+ "maximum": 100000,
215
+ "title": "Amount"
216
+ },
217
+ "description": {
218
+ "type": "string",
219
+ "description": "Payment description (max 230 chars)",
220
+ "maxLength": 230,
221
+ "title": "Description"
209
222
  }
210
223
  },
211
224
  "additionalProperties": true,
@@ -929,6 +942,19 @@
929
942
  "properties": {},
930
943
  "additionalProperties": true,
931
944
  "title": "Custom Validation Messages"
945
+ },
946
+ "amount": {
947
+ "type": "number",
948
+ "description": "Payment amount in GBP (£0.30 - £100,000)",
949
+ "minimum": 0.3,
950
+ "maximum": 100000,
951
+ "title": "Amount"
952
+ },
953
+ "description": {
954
+ "type": "string",
955
+ "description": "Payment description (max 230 chars)",
956
+ "maxLength": 230,
957
+ "title": "Description"
932
958
  }
933
959
  },
934
960
  "additionalProperties": true,
@@ -1195,6 +1221,19 @@
1195
1221
  "properties": {},
1196
1222
  "additionalProperties": true,
1197
1223
  "title": "Custom Validation Messages"
1224
+ },
1225
+ "amount": {
1226
+ "type": "number",
1227
+ "description": "Payment amount in GBP (£0.30 - £100,000)",
1228
+ "minimum": 0.3,
1229
+ "maximum": 100000,
1230
+ "title": "Amount"
1231
+ },
1232
+ "description": {
1233
+ "type": "string",
1234
+ "description": "Payment description (max 230 chars)",
1235
+ "maxLength": 230,
1236
+ "title": "Description"
1198
1237
  }
1199
1238
  },
1200
1239
  "additionalProperties": true,
@@ -481,6 +481,19 @@
481
481
  "properties": {},
482
482
  "additionalProperties": true,
483
483
  "title": "Custom Validation Messages"
484
+ },
485
+ "amount": {
486
+ "type": "number",
487
+ "description": "Payment amount in GBP (£0.30 - £100,000)",
488
+ "minimum": 0.3,
489
+ "maximum": 100000,
490
+ "title": "Amount"
491
+ },
492
+ "description": {
493
+ "type": "string",
494
+ "description": "Payment description (max 230 chars)",
495
+ "maxLength": 230,
496
+ "title": "Description"
484
497
  }
485
498
  },
486
499
  "additionalProperties": true,
@@ -677,6 +690,19 @@
677
690
  "properties": {},
678
691
  "additionalProperties": true,
679
692
  "title": "Custom Validation Messages"
693
+ },
694
+ "amount": {
695
+ "type": "number",
696
+ "description": "Payment amount in GBP (£0.30 - £100,000)",
697
+ "minimum": 0.3,
698
+ "maximum": 100000,
699
+ "title": "Amount"
700
+ },
701
+ "description": {
702
+ "type": "string",
703
+ "description": "Payment description (max 230 chars)",
704
+ "maxLength": 230,
705
+ "title": "Description"
680
706
  }
681
707
  },
682
708
  "additionalProperties": true,
@@ -956,6 +982,19 @@
956
982
  "properties": {},
957
983
  "additionalProperties": true,
958
984
  "title": "Custom Validation Messages"
985
+ },
986
+ "amount": {
987
+ "type": "number",
988
+ "description": "Payment amount in GBP (£0.30 - £100,000)",
989
+ "minimum": 0.3,
990
+ "maximum": 100000,
991
+ "title": "Amount"
992
+ },
993
+ "description": {
994
+ "type": "string",
995
+ "description": "Payment description (max 230 chars)",
996
+ "maxLength": 230,
997
+ "title": "Description"
959
998
  }
960
999
  },
961
1000
  "additionalProperties": true,
@@ -1261,6 +1300,19 @@
1261
1300
  "properties": {},
1262
1301
  "additionalProperties": true,
1263
1302
  "title": "Custom Validation Messages"
1303
+ },
1304
+ "amount": {
1305
+ "type": "number",
1306
+ "description": "Payment amount in GBP (£0.30 - £100,000)",
1307
+ "minimum": 0.3,
1308
+ "maximum": 100000,
1309
+ "title": "Amount"
1310
+ },
1311
+ "description": {
1312
+ "type": "string",
1313
+ "description": "Payment description (max 230 chars)",
1314
+ "maxLength": 230,
1315
+ "title": "Description"
1264
1316
  }
1265
1317
  },
1266
1318
  "additionalProperties": true,
@@ -1527,6 +1579,19 @@
1527
1579
  "properties": {},
1528
1580
  "additionalProperties": true,
1529
1581
  "title": "Custom Validation Messages"
1582
+ },
1583
+ "amount": {
1584
+ "type": "number",
1585
+ "description": "Payment amount in GBP (£0.30 - £100,000)",
1586
+ "minimum": 0.3,
1587
+ "maximum": 100000,
1588
+ "title": "Amount"
1589
+ },
1590
+ "description": {
1591
+ "type": "string",
1592
+ "description": "Payment description (max 230 chars)",
1593
+ "maxLength": 230,
1594
+ "title": "Description"
1530
1595
  }
1531
1596
  },
1532
1597
  "additionalProperties": true,
@@ -182,6 +182,19 @@
182
182
  "properties": {},
183
183
  "additionalProperties": true,
184
184
  "title": "Custom Validation Messages"
185
+ },
186
+ "amount": {
187
+ "type": "number",
188
+ "description": "Payment amount in GBP (£0.30 - £100,000)",
189
+ "minimum": 0.3,
190
+ "maximum": 100000,
191
+ "title": "Amount"
192
+ },
193
+ "description": {
194
+ "type": "string",
195
+ "description": "Payment description (max 230 chars)",
196
+ "maxLength": 230,
197
+ "title": "Description"
185
198
  }
186
199
  },
187
200
  "additionalProperties": true,
@@ -448,6 +461,19 @@
448
461
  "properties": {},
449
462
  "additionalProperties": true,
450
463
  "title": "Custom Validation Messages"
464
+ },
465
+ "amount": {
466
+ "type": "number",
467
+ "description": "Payment amount in GBP (£0.30 - £100,000)",
468
+ "minimum": 0.3,
469
+ "maximum": 100000,
470
+ "title": "Amount"
471
+ },
472
+ "description": {
473
+ "type": "string",
474
+ "description": "Payment description (max 230 chars)",
475
+ "maxLength": 230,
476
+ "title": "Description"
451
477
  }
452
478
  },
453
479
  "additionalProperties": true,
@@ -188,6 +188,19 @@
188
188
  "properties": {},
189
189
  "additionalProperties": true,
190
190
  "title": "Custom Validation Messages"
191
+ },
192
+ "amount": {
193
+ "type": "number",
194
+ "description": "Payment amount in GBP (£0.30 - £100,000)",
195
+ "minimum": 0.3,
196
+ "maximum": 100000,
197
+ "title": "Amount"
198
+ },
199
+ "description": {
200
+ "type": "string",
201
+ "description": "Payment description (max 230 chars)",
202
+ "maxLength": 230,
203
+ "title": "Description"
191
204
  }
192
205
  },
193
206
  "additionalProperties": true,
@@ -454,6 +467,19 @@
454
467
  "properties": {},
455
468
  "additionalProperties": true,
456
469
  "title": "Custom Validation Messages"
470
+ },
471
+ "amount": {
472
+ "type": "number",
473
+ "description": "Payment amount in GBP (£0.30 - £100,000)",
474
+ "minimum": 0.3,
475
+ "maximum": 100000,
476
+ "title": "Amount"
477
+ },
478
+ "description": {
479
+ "type": "string",
480
+ "description": "Payment description (max 230 chars)",
481
+ "maxLength": 230,
482
+ "title": "Description"
457
483
  }
458
484
  },
459
485
  "additionalProperties": true,
@@ -294,6 +294,19 @@
294
294
  "properties": {},
295
295
  "additionalProperties": true,
296
296
  "title": "Custom Validation Messages"
297
+ },
298
+ "amount": {
299
+ "type": "number",
300
+ "description": "Payment amount in GBP (£0.30 - £100,000)",
301
+ "minimum": 0.3,
302
+ "maximum": 100000,
303
+ "title": "Amount"
304
+ },
305
+ "description": {
306
+ "type": "string",
307
+ "description": "Payment description (max 230 chars)",
308
+ "maxLength": 230,
309
+ "title": "Description"
297
310
  }
298
311
  },
299
312
  "additionalProperties": true,
@@ -490,6 +503,19 @@
490
503
  "properties": {},
491
504
  "additionalProperties": true,
492
505
  "title": "Custom Validation Messages"
506
+ },
507
+ "amount": {
508
+ "type": "number",
509
+ "description": "Payment amount in GBP (£0.30 - £100,000)",
510
+ "minimum": 0.3,
511
+ "maximum": 100000,
512
+ "title": "Amount"
513
+ },
514
+ "description": {
515
+ "type": "string",
516
+ "description": "Payment description (max 230 chars)",
517
+ "maxLength": 230,
518
+ "title": "Description"
493
519
  }
494
520
  },
495
521
  "additionalProperties": true,
@@ -769,6 +795,19 @@
769
795
  "properties": {},
770
796
  "additionalProperties": true,
771
797
  "title": "Custom Validation Messages"
798
+ },
799
+ "amount": {
800
+ "type": "number",
801
+ "description": "Payment amount in GBP (£0.30 - £100,000)",
802
+ "minimum": 0.3,
803
+ "maximum": 100000,
804
+ "title": "Amount"
805
+ },
806
+ "description": {
807
+ "type": "string",
808
+ "description": "Payment description (max 230 chars)",
809
+ "maxLength": 230,
810
+ "title": "Description"
772
811
  }
773
812
  },
774
813
  "additionalProperties": true,
@@ -157,6 +157,19 @@
157
157
  "properties": {},
158
158
  "additionalProperties": true,
159
159
  "title": "Custom Validation Messages"
160
+ },
161
+ "amount": {
162
+ "type": "number",
163
+ "description": "Payment amount in GBP (£0.30 - £100,000)",
164
+ "minimum": 0.3,
165
+ "maximum": 100000,
166
+ "title": "Amount"
167
+ },
168
+ "description": {
169
+ "type": "string",
170
+ "description": "Payment description (max 230 chars)",
171
+ "maxLength": 230,
172
+ "title": "Description"
160
173
  }
161
174
  },
162
175
  "additionalProperties": true,
@@ -187,5 +187,12 @@ export const ComponentTypes: readonly ComponentDef[] = Object.freeze([
187
187
  hint: '',
188
188
  options: {},
189
189
  schema: {}
190
+ },
191
+ {
192
+ name: 'PaymentField',
193
+ title: 'Payment field',
194
+ type: ComponentType.PaymentField,
195
+ hint: '',
196
+ options: {}
190
197
  }
191
198
  ])
@@ -23,7 +23,8 @@ export enum ComponentType {
23
23
  OsGridRefField = 'OsGridRefField',
24
24
  NationalGridFieldNumberField = 'NationalGridFieldNumberField',
25
25
  LatLongField = 'LatLongField',
26
- HiddenField = 'HiddenField'
26
+ HiddenField = 'HiddenField',
27
+ PaymentField = 'PaymentField'
27
28
  }
28
29
 
29
30
  export const PreviewTypeEnum = {
@@ -255,6 +255,14 @@ export interface MonthYearFieldComponent extends DateFieldBase {
255
255
  }
256
256
  }
257
257
 
258
+ export interface PaymentFieldComponent extends FormFieldBase {
259
+ type: ComponentType.PaymentField
260
+ options: FormFieldBase['options'] & {
261
+ amount?: number
262
+ description?: string
263
+ }
264
+ }
265
+
258
266
  // Content Fields
259
267
  export interface DetailsComponent extends ContentFieldBase {
260
268
  type: ComponentType.Details
@@ -352,6 +360,7 @@ export type InputFieldsComponentsDef =
352
360
  | NationalGridFieldNumberFieldComponent
353
361
  | LatLongFieldComponent
354
362
  | HiddenFieldComponent
363
+ | PaymentFieldComponent
355
364
 
356
365
  // Components that render content
357
366
  export type ContentComponentsDef =
@@ -382,6 +391,7 @@ export type ConditionalComponentsDef = Exclude<
382
391
  | MonthYearFieldComponent
383
392
  | UkAddressFieldComponent
384
393
  | FileUploadFieldComponent
394
+ | PaymentFieldComponent
385
395
  >
386
396
 
387
397
  export type PreviewType = keyof typeof PreviewTypeEnum
@@ -118,7 +118,9 @@ export const fieldConfigs: Record<string, FieldConfig> = {
118
118
  export const supportContactFields: SupportContactFieldConfig[] = [
119
119
  createSupportContactField('phone number', 'phone'),
120
120
  createSupportContactField('email address', 'email.address'),
121
- createSupportContactField('online contact link', 'online.url')
121
+ createSupportContactField('email response time', 'email.responseTime'),
122
+ createSupportContactField('online contact link', 'online.url'),
123
+ createSupportContactField('online contact text', 'online.text')
122
124
  ]
123
125
 
124
126
  /**
@@ -141,10 +143,14 @@ export const alwaysValidEvents = new Set<string>([
141
143
  /**
142
144
  * Type guard to check if an audit record is consolidated.
143
145
  * @param record - The audit record to check
144
- * @returns True if the record has consolidation metadata
146
+ * @returns True if the record has consolidation metadata with count > 1
145
147
  */
146
148
  export function isConsolidatedRecord(
147
149
  record: AuditRecord | ConsolidatedAuditRecord
148
150
  ): record is ConsolidatedAuditRecord {
149
- return 'consolidatedCount' in record && record.consolidatedCount > 1
151
+ return (
152
+ 'consolidatedCount' in record &&
153
+ typeof record.consolidatedCount === 'number' &&
154
+ record.consolidatedCount > 1
155
+ )
150
156
  }
@@ -574,7 +574,22 @@ export const componentSchema = Joi.object<ComponentDef>()
574
574
  customValidationMessages: Joi.object<LanguageMessages>()
575
575
  .unknown(true)
576
576
  .optional()
577
- .description('Custom error messages keyed by validation rule name')
577
+ .description('Custom error messages keyed by validation rule name'),
578
+ amount: Joi.when('type', {
579
+ is: Joi.string().trim().valid(ComponentType.PaymentField).required(),
580
+ then: Joi.number()
581
+ .min(0.3)
582
+ .max(100000)
583
+ .required()
584
+ .description('Payment amount in GBP (£0.30 - £100,000)')
585
+ }).description('Payment amount - for PaymentField only'),
586
+ description: Joi.when('type', {
587
+ is: Joi.string().trim().valid(ComponentType.PaymentField).required(),
588
+ then: Joi.string()
589
+ .max(230)
590
+ .required()
591
+ .description('Payment description (max 230 chars)')
592
+ }).description('Payment description - for PaymentField only')
578
593
  })
579
594
  .default({})
580
595
  .unknown(true)