@defra/forms-model 3.0.645 → 3.0.646
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/components/component-types.js +2 -1
- package/dist/module/components/component-types.js.map +1 -1
- package/dist/module/components/types.js.map +1 -1
- package/dist/module/form/form-definition/index.js +13 -2
- package/dist/module/form/form-definition/index.js.map +1 -1
- package/dist/types/components/component-types.d.ts.map +1 -1
- package/dist/types/components/types.d.ts +5 -0
- package/dist/types/components/types.d.ts.map +1 -1
- package/dist/types/form/form-definition/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/schemas/component-schema-v2.json +35 -2
- package/schemas/component-schema.json +35 -2
- package/schemas/form-definition-schema.json +105 -6
- package/schemas/form-definition-v2-schema.json +175 -10
- package/schemas/list-schema-v2.json +70 -4
- package/schemas/list-schema.json +70 -4
- package/schemas/page-schema-v2.json +105 -6
- package/schemas/page-schema.json +35 -2
- package/src/components/component-types.ts +2 -1
- package/src/components/types.ts +5 -0
- package/src/form/form-definition/index.ts +31 -3
package/schemas/list-schema.json
CHANGED
|
@@ -191,8 +191,8 @@
|
|
|
191
191
|
},
|
|
192
192
|
"amount": {
|
|
193
193
|
"type": "number",
|
|
194
|
-
"description": "Payment amount in GBP (£0
|
|
195
|
-
"minimum": 0
|
|
194
|
+
"description": "Payment amount in GBP (£0 - £100,000)",
|
|
195
|
+
"minimum": 0,
|
|
196
196
|
"maximum": 100000,
|
|
197
197
|
"title": "Amount"
|
|
198
198
|
},
|
|
@@ -201,6 +201,39 @@
|
|
|
201
201
|
"description": "Payment description (max 230 chars)",
|
|
202
202
|
"maxLength": 230,
|
|
203
203
|
"title": "Description"
|
|
204
|
+
},
|
|
205
|
+
"conditionalAmounts": {
|
|
206
|
+
"type": "array",
|
|
207
|
+
"description": "Conditional payment amounts evaluated in order",
|
|
208
|
+
"items": {
|
|
209
|
+
"type": "object",
|
|
210
|
+
"properties": {
|
|
211
|
+
"condition": {
|
|
212
|
+
"type": "string",
|
|
213
|
+
"description": "Condition ID for this amount",
|
|
214
|
+
"title": "Condition"
|
|
215
|
+
},
|
|
216
|
+
"amount": {
|
|
217
|
+
"type": "number",
|
|
218
|
+
"description": "Amount in GBP when condition is true (min £0.30)",
|
|
219
|
+
"minimum": 0.3,
|
|
220
|
+
"maximum": 100000,
|
|
221
|
+
"title": "Amount"
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
"required": [
|
|
225
|
+
"condition",
|
|
226
|
+
"amount"
|
|
227
|
+
],
|
|
228
|
+
"additionalProperties": false,
|
|
229
|
+
"title": "Conditional Amounts Item"
|
|
230
|
+
},
|
|
231
|
+
"title": "Conditional Amounts"
|
|
232
|
+
},
|
|
233
|
+
"emailField": {
|
|
234
|
+
"type": "string",
|
|
235
|
+
"description": "Name of EmailAddressField to prepopulate GOV.UK Pay email",
|
|
236
|
+
"title": "Email Field"
|
|
204
237
|
}
|
|
205
238
|
},
|
|
206
239
|
"additionalProperties": true,
|
|
@@ -470,8 +503,8 @@
|
|
|
470
503
|
},
|
|
471
504
|
"amount": {
|
|
472
505
|
"type": "number",
|
|
473
|
-
"description": "Payment amount in GBP (£0
|
|
474
|
-
"minimum": 0
|
|
506
|
+
"description": "Payment amount in GBP (£0 - £100,000)",
|
|
507
|
+
"minimum": 0,
|
|
475
508
|
"maximum": 100000,
|
|
476
509
|
"title": "Amount"
|
|
477
510
|
},
|
|
@@ -480,6 +513,39 @@
|
|
|
480
513
|
"description": "Payment description (max 230 chars)",
|
|
481
514
|
"maxLength": 230,
|
|
482
515
|
"title": "Description"
|
|
516
|
+
},
|
|
517
|
+
"conditionalAmounts": {
|
|
518
|
+
"type": "array",
|
|
519
|
+
"description": "Conditional payment amounts evaluated in order",
|
|
520
|
+
"items": {
|
|
521
|
+
"type": "object",
|
|
522
|
+
"properties": {
|
|
523
|
+
"condition": {
|
|
524
|
+
"type": "string",
|
|
525
|
+
"description": "Condition ID for this amount",
|
|
526
|
+
"title": "Condition"
|
|
527
|
+
},
|
|
528
|
+
"amount": {
|
|
529
|
+
"type": "number",
|
|
530
|
+
"description": "Amount in GBP when condition is true (min £0.30)",
|
|
531
|
+
"minimum": 0.3,
|
|
532
|
+
"maximum": 100000,
|
|
533
|
+
"title": "Amount"
|
|
534
|
+
}
|
|
535
|
+
},
|
|
536
|
+
"required": [
|
|
537
|
+
"condition",
|
|
538
|
+
"amount"
|
|
539
|
+
],
|
|
540
|
+
"additionalProperties": false,
|
|
541
|
+
"title": "Conditional Amounts Item"
|
|
542
|
+
},
|
|
543
|
+
"title": "Conditional Amounts"
|
|
544
|
+
},
|
|
545
|
+
"emailField": {
|
|
546
|
+
"type": "string",
|
|
547
|
+
"description": "Name of EmailAddressField to prepopulate GOV.UK Pay email",
|
|
548
|
+
"title": "Email Field"
|
|
483
549
|
}
|
|
484
550
|
},
|
|
485
551
|
"additionalProperties": true,
|
|
@@ -297,8 +297,8 @@
|
|
|
297
297
|
},
|
|
298
298
|
"amount": {
|
|
299
299
|
"type": "number",
|
|
300
|
-
"description": "Payment amount in GBP (£0
|
|
301
|
-
"minimum": 0
|
|
300
|
+
"description": "Payment amount in GBP (£0 - £100,000)",
|
|
301
|
+
"minimum": 0,
|
|
302
302
|
"maximum": 100000,
|
|
303
303
|
"title": "Amount"
|
|
304
304
|
},
|
|
@@ -307,6 +307,39 @@
|
|
|
307
307
|
"description": "Payment description (max 230 chars)",
|
|
308
308
|
"maxLength": 230,
|
|
309
309
|
"title": "Description"
|
|
310
|
+
},
|
|
311
|
+
"conditionalAmounts": {
|
|
312
|
+
"type": "array",
|
|
313
|
+
"description": "Conditional payment amounts evaluated in order",
|
|
314
|
+
"items": {
|
|
315
|
+
"type": "object",
|
|
316
|
+
"properties": {
|
|
317
|
+
"condition": {
|
|
318
|
+
"type": "string",
|
|
319
|
+
"description": "Condition ID for this amount",
|
|
320
|
+
"title": "Condition"
|
|
321
|
+
},
|
|
322
|
+
"amount": {
|
|
323
|
+
"type": "number",
|
|
324
|
+
"description": "Amount in GBP when condition is true (min £0.30)",
|
|
325
|
+
"minimum": 0.3,
|
|
326
|
+
"maximum": 100000,
|
|
327
|
+
"title": "Amount"
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
"required": [
|
|
331
|
+
"condition",
|
|
332
|
+
"amount"
|
|
333
|
+
],
|
|
334
|
+
"additionalProperties": false,
|
|
335
|
+
"title": "Conditional Amounts Item"
|
|
336
|
+
},
|
|
337
|
+
"title": "Conditional Amounts"
|
|
338
|
+
},
|
|
339
|
+
"emailField": {
|
|
340
|
+
"type": "string",
|
|
341
|
+
"description": "Name of EmailAddressField to prepopulate GOV.UK Pay email",
|
|
342
|
+
"title": "Email Field"
|
|
310
343
|
}
|
|
311
344
|
},
|
|
312
345
|
"additionalProperties": true,
|
|
@@ -506,8 +539,8 @@
|
|
|
506
539
|
},
|
|
507
540
|
"amount": {
|
|
508
541
|
"type": "number",
|
|
509
|
-
"description": "Payment amount in GBP (£0
|
|
510
|
-
"minimum": 0
|
|
542
|
+
"description": "Payment amount in GBP (£0 - £100,000)",
|
|
543
|
+
"minimum": 0,
|
|
511
544
|
"maximum": 100000,
|
|
512
545
|
"title": "Amount"
|
|
513
546
|
},
|
|
@@ -516,6 +549,39 @@
|
|
|
516
549
|
"description": "Payment description (max 230 chars)",
|
|
517
550
|
"maxLength": 230,
|
|
518
551
|
"title": "Description"
|
|
552
|
+
},
|
|
553
|
+
"conditionalAmounts": {
|
|
554
|
+
"type": "array",
|
|
555
|
+
"description": "Conditional payment amounts evaluated in order",
|
|
556
|
+
"items": {
|
|
557
|
+
"type": "object",
|
|
558
|
+
"properties": {
|
|
559
|
+
"condition": {
|
|
560
|
+
"type": "string",
|
|
561
|
+
"description": "Condition ID for this amount",
|
|
562
|
+
"title": "Condition"
|
|
563
|
+
},
|
|
564
|
+
"amount": {
|
|
565
|
+
"type": "number",
|
|
566
|
+
"description": "Amount in GBP when condition is true (min £0.30)",
|
|
567
|
+
"minimum": 0.3,
|
|
568
|
+
"maximum": 100000,
|
|
569
|
+
"title": "Amount"
|
|
570
|
+
}
|
|
571
|
+
},
|
|
572
|
+
"required": [
|
|
573
|
+
"condition",
|
|
574
|
+
"amount"
|
|
575
|
+
],
|
|
576
|
+
"additionalProperties": false,
|
|
577
|
+
"title": "Conditional Amounts Item"
|
|
578
|
+
},
|
|
579
|
+
"title": "Conditional Amounts"
|
|
580
|
+
},
|
|
581
|
+
"emailField": {
|
|
582
|
+
"type": "string",
|
|
583
|
+
"description": "Name of EmailAddressField to prepopulate GOV.UK Pay email",
|
|
584
|
+
"title": "Email Field"
|
|
519
585
|
}
|
|
520
586
|
},
|
|
521
587
|
"additionalProperties": true,
|
|
@@ -798,8 +864,8 @@
|
|
|
798
864
|
},
|
|
799
865
|
"amount": {
|
|
800
866
|
"type": "number",
|
|
801
|
-
"description": "Payment amount in GBP (£0
|
|
802
|
-
"minimum": 0
|
|
867
|
+
"description": "Payment amount in GBP (£0 - £100,000)",
|
|
868
|
+
"minimum": 0,
|
|
803
869
|
"maximum": 100000,
|
|
804
870
|
"title": "Amount"
|
|
805
871
|
},
|
|
@@ -808,6 +874,39 @@
|
|
|
808
874
|
"description": "Payment description (max 230 chars)",
|
|
809
875
|
"maxLength": 230,
|
|
810
876
|
"title": "Description"
|
|
877
|
+
},
|
|
878
|
+
"conditionalAmounts": {
|
|
879
|
+
"type": "array",
|
|
880
|
+
"description": "Conditional payment amounts evaluated in order",
|
|
881
|
+
"items": {
|
|
882
|
+
"type": "object",
|
|
883
|
+
"properties": {
|
|
884
|
+
"condition": {
|
|
885
|
+
"type": "string",
|
|
886
|
+
"description": "Condition ID for this amount",
|
|
887
|
+
"title": "Condition"
|
|
888
|
+
},
|
|
889
|
+
"amount": {
|
|
890
|
+
"type": "number",
|
|
891
|
+
"description": "Amount in GBP when condition is true (min £0.30)",
|
|
892
|
+
"minimum": 0.3,
|
|
893
|
+
"maximum": 100000,
|
|
894
|
+
"title": "Amount"
|
|
895
|
+
}
|
|
896
|
+
},
|
|
897
|
+
"required": [
|
|
898
|
+
"condition",
|
|
899
|
+
"amount"
|
|
900
|
+
],
|
|
901
|
+
"additionalProperties": false,
|
|
902
|
+
"title": "Conditional Amounts Item"
|
|
903
|
+
},
|
|
904
|
+
"title": "Conditional Amounts"
|
|
905
|
+
},
|
|
906
|
+
"emailField": {
|
|
907
|
+
"type": "string",
|
|
908
|
+
"description": "Name of EmailAddressField to prepopulate GOV.UK Pay email",
|
|
909
|
+
"title": "Email Field"
|
|
811
910
|
}
|
|
812
911
|
},
|
|
813
912
|
"additionalProperties": true,
|
package/schemas/page-schema.json
CHANGED
|
@@ -160,8 +160,8 @@
|
|
|
160
160
|
},
|
|
161
161
|
"amount": {
|
|
162
162
|
"type": "number",
|
|
163
|
-
"description": "Payment amount in GBP (£0
|
|
164
|
-
"minimum": 0
|
|
163
|
+
"description": "Payment amount in GBP (£0 - £100,000)",
|
|
164
|
+
"minimum": 0,
|
|
165
165
|
"maximum": 100000,
|
|
166
166
|
"title": "Amount"
|
|
167
167
|
},
|
|
@@ -170,6 +170,39 @@
|
|
|
170
170
|
"description": "Payment description (max 230 chars)",
|
|
171
171
|
"maxLength": 230,
|
|
172
172
|
"title": "Description"
|
|
173
|
+
},
|
|
174
|
+
"conditionalAmounts": {
|
|
175
|
+
"type": "array",
|
|
176
|
+
"description": "Conditional payment amounts evaluated in order",
|
|
177
|
+
"items": {
|
|
178
|
+
"type": "object",
|
|
179
|
+
"properties": {
|
|
180
|
+
"condition": {
|
|
181
|
+
"type": "string",
|
|
182
|
+
"description": "Condition ID for this amount",
|
|
183
|
+
"title": "Condition"
|
|
184
|
+
},
|
|
185
|
+
"amount": {
|
|
186
|
+
"type": "number",
|
|
187
|
+
"description": "Amount in GBP when condition is true (min £0.30)",
|
|
188
|
+
"minimum": 0.3,
|
|
189
|
+
"maximum": 100000,
|
|
190
|
+
"title": "Amount"
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
"required": [
|
|
194
|
+
"condition",
|
|
195
|
+
"amount"
|
|
196
|
+
],
|
|
197
|
+
"additionalProperties": false,
|
|
198
|
+
"title": "Conditional Amounts Item"
|
|
199
|
+
},
|
|
200
|
+
"title": "Conditional Amounts"
|
|
201
|
+
},
|
|
202
|
+
"emailField": {
|
|
203
|
+
"type": "string",
|
|
204
|
+
"description": "Name of EmailAddressField to prepopulate GOV.UK Pay email",
|
|
205
|
+
"title": "Email Field"
|
|
173
206
|
}
|
|
174
207
|
},
|
|
175
208
|
"additionalProperties": true,
|
|
@@ -198,7 +198,8 @@ export const ComponentTypes: readonly ComponentDef[] = Object.freeze([
|
|
|
198
198
|
hint: '',
|
|
199
199
|
options: {
|
|
200
200
|
amount: 1,
|
|
201
|
-
description: 'payment desc'
|
|
201
|
+
description: 'payment desc',
|
|
202
|
+
conditionalAmounts: []
|
|
202
203
|
}
|
|
203
204
|
} as PaymentFieldComponent,
|
|
204
205
|
{
|
package/src/components/types.ts
CHANGED
|
@@ -260,6 +260,11 @@ export interface PaymentFieldComponent extends FormFieldBase {
|
|
|
260
260
|
options: FormFieldBase['options'] & {
|
|
261
261
|
amount: number
|
|
262
262
|
description: string
|
|
263
|
+
conditionalAmounts?: {
|
|
264
|
+
condition: string
|
|
265
|
+
amount: number
|
|
266
|
+
}[]
|
|
267
|
+
emailField?: string
|
|
263
268
|
}
|
|
264
269
|
}
|
|
265
270
|
|
|
@@ -580,10 +580,10 @@ export const componentSchema = Joi.object<ComponentDef>()
|
|
|
580
580
|
amount: Joi.when('type', {
|
|
581
581
|
is: Joi.string().trim().valid(ComponentType.PaymentField).required(),
|
|
582
582
|
then: Joi.number()
|
|
583
|
-
.min(0
|
|
583
|
+
.min(0)
|
|
584
584
|
.max(100000)
|
|
585
585
|
.required()
|
|
586
|
-
.description('Payment amount in GBP (£0
|
|
586
|
+
.description('Payment amount in GBP (£0 - £100,000)')
|
|
587
587
|
}).description('Payment amount - for PaymentField only'),
|
|
588
588
|
description: Joi.when('type', {
|
|
589
589
|
is: Joi.string().trim().valid(ComponentType.PaymentField).required(),
|
|
@@ -591,7 +591,35 @@ export const componentSchema = Joi.object<ComponentDef>()
|
|
|
591
591
|
.max(230)
|
|
592
592
|
.required()
|
|
593
593
|
.description('Payment description (max 230 chars)')
|
|
594
|
-
}).description('Payment description - for PaymentField only')
|
|
594
|
+
}).description('Payment description - for PaymentField only'),
|
|
595
|
+
conditionalAmounts: Joi.when('type', {
|
|
596
|
+
is: Joi.string().trim().valid(ComponentType.PaymentField).required(),
|
|
597
|
+
then: Joi.array()
|
|
598
|
+
.items(
|
|
599
|
+
Joi.object({
|
|
600
|
+
condition: Joi.string()
|
|
601
|
+
.trim()
|
|
602
|
+
.required()
|
|
603
|
+
.description('Condition ID for this amount'),
|
|
604
|
+
amount: Joi.number()
|
|
605
|
+
.min(0.3)
|
|
606
|
+
.max(100000)
|
|
607
|
+
.required()
|
|
608
|
+
.description('Amount in GBP when condition is true (min £0.30)')
|
|
609
|
+
})
|
|
610
|
+
)
|
|
611
|
+
.optional()
|
|
612
|
+
.description('Conditional payment amounts evaluated in order')
|
|
613
|
+
}).description('Conditional amounts - for PaymentField only'),
|
|
614
|
+
emailField: Joi.when('type', {
|
|
615
|
+
is: Joi.string().trim().valid(ComponentType.PaymentField).required(),
|
|
616
|
+
then: Joi.string()
|
|
617
|
+
.trim()
|
|
618
|
+
.optional()
|
|
619
|
+
.description(
|
|
620
|
+
'Name of EmailAddressField to prepopulate GOV.UK Pay email'
|
|
621
|
+
)
|
|
622
|
+
}).description('Email field reference - for PaymentField only')
|
|
595
623
|
})
|
|
596
624
|
.default({})
|
|
597
625
|
.unknown(true)
|