@defra/forms-model 3.0.52 → 3.0.54

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 (66) hide show
  1. package/dist/module/data-model/conditions-wrapper.js.map +1 -1
  2. package/dist/module/data-model/helpers.js.map +1 -1
  3. package/dist/module/data-model/input-wrapper.js.map +1 -1
  4. package/dist/module/form/{form-configuration.js → form-configuration/index.js} +1 -1
  5. package/dist/module/form/form-configuration/index.js.map +1 -0
  6. package/dist/module/form/form-definition/index.js +243 -0
  7. package/dist/module/form/form-definition/index.js.map +1 -0
  8. package/dist/module/form/form-definition/types.js.map +1 -0
  9. package/dist/module/form/form-metadata/index.js +12 -0
  10. package/dist/module/form/form-metadata/index.js.map +1 -0
  11. package/dist/module/form/form-metadata/types.js +2 -0
  12. package/dist/module/form/form-metadata/types.js.map +1 -0
  13. package/dist/module/form/index.js +3 -1
  14. package/dist/module/form/index.js.map +1 -1
  15. package/dist/module/form/types.js +2 -0
  16. package/dist/module/form/types.js.map +1 -0
  17. package/dist/module/index.js +0 -1
  18. package/dist/module/index.js.map +1 -1
  19. package/dist/types/data-model/conditions-wrapper.d.ts +1 -1
  20. package/dist/types/data-model/conditions-wrapper.d.ts.map +1 -1
  21. package/dist/types/data-model/helpers.d.ts +1 -1
  22. package/dist/types/data-model/helpers.d.ts.map +1 -1
  23. package/dist/types/data-model/input-wrapper.d.ts +1 -1
  24. package/dist/types/data-model/input-wrapper.d.ts.map +1 -1
  25. package/dist/types/form/{form-configuration.d.ts → form-configuration/index.d.ts} +1 -1
  26. package/dist/types/form/form-configuration/index.d.ts.map +1 -0
  27. package/dist/types/{schema/schema.d.ts → form/form-definition/index.d.ts} +9 -4
  28. package/dist/types/form/form-definition/index.d.ts.map +1 -0
  29. package/dist/types/{data-model → form/form-definition}/types.d.ts +5 -4
  30. package/dist/types/form/form-definition/types.d.ts.map +1 -0
  31. package/dist/types/form/form-metadata/index.d.ts +7 -0
  32. package/dist/types/form/form-metadata/index.d.ts.map +1 -0
  33. package/dist/types/form/form-metadata/types.d.ts +34 -0
  34. package/dist/types/form/form-metadata/types.d.ts.map +1 -0
  35. package/dist/types/form/index.d.ts +3 -1
  36. package/dist/types/form/index.d.ts.map +1 -1
  37. package/dist/types/form/types.d.ts +3 -0
  38. package/dist/types/form/types.d.ts.map +1 -0
  39. package/dist/types/index.d.ts +1 -2
  40. package/dist/types/index.d.ts.map +1 -1
  41. package/package.json +1 -1
  42. package/src/data-model/conditions-wrapper.ts +1 -1
  43. package/src/data-model/helpers.ts +1 -1
  44. package/src/data-model/input-wrapper.ts +1 -1
  45. package/src/form/form-definition/index.ts +300 -0
  46. package/src/{data-model → form/form-definition}/types.ts +4 -1
  47. package/src/form/form-metadata/index.ts +16 -0
  48. package/src/form/form-metadata/types.ts +41 -0
  49. package/src/form/index.ts +3 -1
  50. package/src/form/types.ts +2 -0
  51. package/src/index.ts +1 -2
  52. package/dist/module/data-model/types.js.map +0 -1
  53. package/dist/module/form/form-configuration.js.map +0 -1
  54. package/dist/module/schema/index.js +0 -2
  55. package/dist/module/schema/index.js.map +0 -1
  56. package/dist/module/schema/schema.js +0 -235
  57. package/dist/module/schema/schema.js.map +0 -1
  58. package/dist/types/data-model/types.d.ts.map +0 -1
  59. package/dist/types/form/form-configuration.d.ts.map +0 -1
  60. package/dist/types/schema/index.d.ts +0 -2
  61. package/dist/types/schema/index.d.ts.map +0 -1
  62. package/dist/types/schema/schema.d.ts.map +0 -1
  63. package/src/schema/index.ts +0 -1
  64. package/src/schema/schema.ts +0 -300
  65. /package/dist/module/{data-model → form/form-definition}/types.js +0 -0
  66. /package/src/form/{form-configuration.ts → form-configuration/index.ts} +0 -0
@@ -1,4 +1,3 @@
1
- export * from './schema/index.js';
2
1
  export * from './data-model/index.js';
3
2
  export * from './utils/logger.js';
4
3
  export * from './form/index.js';
@@ -8,5 +7,5 @@ export * from './utils/helpers.js';
8
7
  export * from './migration/index.js';
9
8
  export type * from './components/types.js';
10
9
  export type * from './conditions/types.js';
11
- export type * from './data-model/types.js';
10
+ export type * from './form/types.js';
12
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA;AACnC,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,mBAAmB,2BAA2B,CAAA;AAC9C,mBAAmB,2BAA2B,CAAA;AAC9C,mBAAmB,2BAA2B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA;AACnC,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,mBAAmB,2BAA2B,CAAA;AAC9C,mBAAmB,2BAA2B,CAAA;AAC9C,mBAAmB,qBAAqB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/forms-model",
3
- "version": "3.0.52",
3
+ "version": "3.0.54",
4
4
  "description": "A hapi plugin providing the model for Defra forms",
5
5
  "homepage": "https://github.com/DEFRA/forms-designer/tree/main/model#readme",
6
6
  "repository": {
@@ -2,7 +2,7 @@ import { ConditionsModel } from '~/src/conditions/condition-model.js'
2
2
  import {
3
3
  type ConditionRawData,
4
4
  type ConditionWrapperValue
5
- } from '~/src/data-model/types.js'
5
+ } from '~/src/form/types.js'
6
6
 
7
7
  export class ConditionsWrapper {
8
8
  name: string
@@ -1,4 +1,4 @@
1
- import { type MultipleApiKeys } from '~/src/data-model/types.js'
1
+ import { type MultipleApiKeys } from '~/src/form/types.js'
2
2
 
3
3
  export function isMultipleApiKey(
4
4
  payApiKey: string | MultipleApiKeys | undefined
@@ -1,5 +1,5 @@
1
1
  import { type ComponentDef } from '~/src/components/types.js'
2
- import { type Page } from '~/src/data-model/types.js'
2
+ import { type Page } from '~/src/form/types.js'
3
3
  import { clone } from '~/src/utils/helpers.js'
4
4
 
5
5
  export class InputWrapper {
@@ -0,0 +1,300 @@
1
+ import Joi from 'joi'
2
+
3
+ import { type FormDefinition } from '~/src/form/form-definition/types.js'
4
+
5
+ /**
6
+ * If an optional key is added, CURRENT_VERSION does not need to be incremented.
7
+ * Only breaking changes will require an increment, as well as a migration script.
8
+ */
9
+ export const CURRENT_VERSION = 2
10
+
11
+ const sectionsSchema = Joi.object().keys({
12
+ name: Joi.string().required(),
13
+ title: Joi.string().required(),
14
+ hideTitle: Joi.boolean().default(false)
15
+ })
16
+
17
+ const conditionFieldSchema = Joi.object().keys({
18
+ name: Joi.string().required(),
19
+ type: Joi.string().required(),
20
+ display: Joi.string().required()
21
+ })
22
+
23
+ const conditionValueSchema = Joi.object().keys({
24
+ type: Joi.string().required(),
25
+ value: Joi.string().required(),
26
+ display: Joi.string().required()
27
+ })
28
+
29
+ const relativeTimeValueSchema = Joi.object().keys({
30
+ type: Joi.string().required(),
31
+ timePeriod: Joi.string().required(),
32
+ timeUnit: Joi.string().required(),
33
+ direction: Joi.string().required(),
34
+ timeOnly: Joi.boolean().required()
35
+ })
36
+
37
+ const conditionRefSchema = Joi.object().keys({
38
+ conditionName: Joi.string().required(),
39
+ conditionDisplayName: Joi.string().required(),
40
+ coordinator: Joi.string().optional()
41
+ })
42
+
43
+ const conditionSchema = Joi.object().keys({
44
+ field: conditionFieldSchema,
45
+ operator: Joi.string().required(),
46
+ value: Joi.alternatives().try(conditionValueSchema, relativeTimeValueSchema),
47
+ coordinator: Joi.string().optional()
48
+ })
49
+
50
+ const conditionGroupSchema = Joi.object().keys({
51
+ conditions: Joi.array().items(
52
+ Joi.alternatives().try(
53
+ conditionSchema,
54
+ conditionRefSchema,
55
+ Joi.any() /** Should be a joi.link('#conditionGroupSchema') */
56
+ )
57
+ )
58
+ })
59
+
60
+ const conditionsModelSchema = Joi.object().keys({
61
+ name: Joi.string().required(),
62
+ conditions: Joi.array().items(
63
+ Joi.alternatives().try(
64
+ conditionSchema,
65
+ conditionRefSchema,
66
+ conditionGroupSchema
67
+ )
68
+ )
69
+ })
70
+
71
+ const conditionsSchema = Joi.object().keys({
72
+ name: Joi.string().required(),
73
+ displayName: Joi.string(),
74
+ value: Joi.alternatives().try(Joi.string(), conditionsModelSchema).required()
75
+ })
76
+
77
+ const localisedString = Joi.alternatives().try(
78
+ Joi.object({ a: Joi.any() }).unknown(),
79
+ Joi.string().allow('')
80
+ )
81
+
82
+ export const componentSchema = Joi.object()
83
+ .keys({
84
+ type: Joi.string().required(),
85
+ name: Joi.string(),
86
+ title: localisedString,
87
+ hint: localisedString.optional(),
88
+ options: Joi.object().default({}),
89
+ schema: Joi.object({ min: Joi.number(), max: Joi.number() })
90
+ .unknown(true)
91
+ .default({}),
92
+ list: Joi.string().optional()
93
+ })
94
+ .unknown(true)
95
+
96
+ const nextSchema = Joi.object().keys({
97
+ path: Joi.string().required(),
98
+ condition: Joi.string().allow('').optional(),
99
+ redirect: Joi.string().uri().optional()
100
+ })
101
+
102
+ /**
103
+ * `/status` is a special route for providing a user's application status.
104
+ * It should not be configured via the designer.
105
+ */
106
+ const pageSchema = Joi.object().keys({
107
+ path: Joi.string().required().disallow('/status'),
108
+ title: localisedString,
109
+ section: Joi.string(),
110
+ controller: Joi.string(),
111
+ components: Joi.array().items(componentSchema),
112
+ next: Joi.array().items(nextSchema),
113
+ repeatField: Joi.string().optional(),
114
+ options: Joi.object().optional(),
115
+ backLinkFallback: Joi.string().optional()
116
+ })
117
+
118
+ const toggleableString = Joi.alternatives().try(Joi.boolean(), Joi.string())
119
+
120
+ const confirmationPageSchema = Joi.object({
121
+ customText: Joi.object({
122
+ title: Joi.string().default('Application complete'),
123
+ paymentSkipped: toggleableString.default(
124
+ 'Someone will be in touch to make a payment.'
125
+ ),
126
+ nextSteps: toggleableString.default(
127
+ 'You will receive an email with details with the next steps.'
128
+ )
129
+ }).default(),
130
+ components: Joi.array().items(componentSchema)
131
+ })
132
+
133
+ const paymentSkippedWarningPage = Joi.object({
134
+ customText: Joi.object({
135
+ title: Joi.string().default('Pay for your application').optional(),
136
+ caption: Joi.string().default('Payment').optional(),
137
+ body: Joi.string().default('').optional()
138
+ })
139
+ })
140
+
141
+ const specialPagesSchema = Joi.object().keys({
142
+ confirmationPage: confirmationPageSchema.optional(),
143
+ paymentSkippedWarningPage: paymentSkippedWarningPage.optional()
144
+ })
145
+
146
+ const listItemSchema = Joi.object().keys({
147
+ text: localisedString,
148
+ value: Joi.alternatives().try(Joi.number(), Joi.string()),
149
+ description: localisedString.optional(),
150
+ conditional: Joi.object()
151
+ .keys({
152
+ components: Joi.array()
153
+ .required()
154
+ .items(componentSchema.unknown(true))
155
+ .unique('name')
156
+ })
157
+ .allow(null)
158
+ .optional(),
159
+ condition: Joi.string().allow(null, '').optional()
160
+ })
161
+
162
+ const listSchema = Joi.object().keys({
163
+ name: Joi.string().required(),
164
+ title: localisedString,
165
+ type: Joi.string().required().valid('string', 'number'),
166
+ items: Joi.array().items(listItemSchema)
167
+ })
168
+
169
+ const feeSchema = Joi.object().keys({
170
+ description: Joi.string().required(),
171
+ amount: Joi.number().required(),
172
+ multiplier: Joi.string().optional(),
173
+ condition: Joi.string().optional(),
174
+ prefix: Joi.string().optional()
175
+ })
176
+
177
+ const multiApiKeySchema = Joi.object({
178
+ test: Joi.string().optional(),
179
+ production: Joi.string().optional()
180
+ })
181
+
182
+ const replyToConfigurationSchema = Joi.object({
183
+ emailReplyToId: Joi.string(),
184
+ condition: Joi.string().allow('').optional()
185
+ })
186
+
187
+ const notifySchema = Joi.object().keys({
188
+ apiKey: [Joi.string().allow('').optional(), multiApiKeySchema],
189
+ templateId: Joi.string(),
190
+ emailField: Joi.string(),
191
+ personalisation: Joi.array().items(Joi.string()),
192
+ personalisationFieldCustomisation: Joi.object()
193
+ .pattern(/./, Joi.array().items(Joi.string()))
194
+ .optional(),
195
+ addReferencesToPersonalisation: Joi.boolean().optional(),
196
+ emailReplyToIdConfiguration: Joi.array().items(replyToConfigurationSchema)
197
+ })
198
+
199
+ const emailSchema = Joi.object().keys({
200
+ emailAddress: Joi.string()
201
+ })
202
+
203
+ const webhookSchema = Joi.object().keys({
204
+ url: Joi.string(),
205
+ allowRetry: Joi.boolean().default(true)
206
+ })
207
+
208
+ const outputSchema = Joi.object().keys({
209
+ name: Joi.string(),
210
+ title: Joi.string().optional(),
211
+ type: Joi.string().allow('notify', 'email', 'webhook', 'sheets'),
212
+ outputConfiguration: Joi.alternatives().try(
213
+ notifySchema,
214
+ emailSchema,
215
+ webhookSchema
216
+ )
217
+ })
218
+
219
+ const feedbackSchema = Joi.object().keys({
220
+ feedbackForm: Joi.boolean().default(false),
221
+ url: Joi.when('feedbackForm', {
222
+ is: Joi.boolean().valid(false),
223
+ then: Joi.string().optional().allow('')
224
+ }),
225
+ emailAddress: Joi.string()
226
+ .email({
227
+ tlds: {
228
+ allow: false
229
+ }
230
+ })
231
+ .optional()
232
+ })
233
+
234
+ const phaseBannerSchema = Joi.object().keys({
235
+ phase: Joi.string().valid('alpha', 'beta')
236
+ })
237
+
238
+ const feeOptionSchema = Joi.object()
239
+ .keys({
240
+ payApiKey: [Joi.string().allow('').optional(), multiApiKeySchema],
241
+ paymentReferenceFormat: [Joi.string().optional()],
242
+ payReturnUrl: Joi.string().optional(),
243
+ allowSubmissionWithoutPayment: Joi.boolean().optional().default(true),
244
+ maxAttempts: Joi.number().optional().default(3),
245
+ customPayErrorMessage: Joi.string().optional(),
246
+ showPaymentSkippedWarningPage: Joi.when('allowSubmissionWithoutPayment', {
247
+ is: true,
248
+ then: Joi.boolean().valid(true, false).default(false),
249
+ otherwise: Joi.boolean().valid(false).default(false)
250
+ })
251
+ })
252
+ .default(({ payApiKey, paymentReferenceFormat }) => {
253
+ return {
254
+ ...(payApiKey && { payApiKey }),
255
+ ...(paymentReferenceFormat && { paymentReferenceFormat })
256
+ }
257
+ })
258
+
259
+ /**
260
+ * Joi schema for `FormDefinition` interface
261
+ * @see {@link FormDefinition}
262
+ */
263
+ export const formDefinitionSchema = Joi.object()
264
+ .required()
265
+ .keys({
266
+ name: localisedString.optional(),
267
+ feedback: feedbackSchema,
268
+ startPage: Joi.string().required(),
269
+ pages: Joi.array().required().items(pageSchema).unique('path'),
270
+ sections: Joi.array().items(sectionsSchema).unique('name').required(),
271
+ conditions: Joi.array().items(conditionsSchema).unique('name'),
272
+ lists: Joi.array().items(listSchema).unique('name'),
273
+ fees: Joi.array().items(feeSchema).optional(),
274
+ paymentReferenceFormat: Joi.string().optional(),
275
+ metadata: Joi.object({ a: Joi.any() }).unknown().optional(),
276
+ declaration: Joi.string().allow('').optional(),
277
+ outputs: Joi.array().items(outputSchema),
278
+ payApiKey: [Joi.string().allow('').optional(), multiApiKeySchema],
279
+ skipSummary: Joi.boolean().default(false),
280
+ version: Joi.number().default(CURRENT_VERSION),
281
+ phaseBanner: phaseBannerSchema,
282
+ specialPages: specialPagesSchema.optional(),
283
+ feeOptions: feeOptionSchema
284
+ })
285
+
286
+ // Maintain compatibility with legacy named export
287
+ // E.g. `import { Schema } from '@defra/forms-model'`
288
+ export const Schema = formDefinitionSchema
289
+
290
+ /**
291
+ * Schema versions:
292
+ * Undefined / 0 - initial version as at 28/8/20. Conditions may be in object structure or string form.
293
+ * 1 - Relevant components (radio, checkbox, select, autocomplete) now contain
294
+ * options as 'values' rather than referencing a data list
295
+ * 2 - Reverse v1. Values populating radio, checkboxes, select, autocomplete are defined in Lists only.
296
+ * TODO:- merge fees and paymentReferenceFormat
297
+ * 2 - 2023-05-04 `feeOptions` has been introduced. paymentReferenceFormat and payApiKey can be configured in top level or feeOptions. feeOptions will take precedent.
298
+ * if feeOptions are empty, it will pull values from the top level keys.
299
+ * WARN: Fee/GOV.UK pay configurations (apart from fees) should no longer be stored in the top level, always within feeOptions.
300
+ */
@@ -1,6 +1,7 @@
1
1
  import { type ComponentDef } from '~/src/components/types.js'
2
2
  import { type Condition } from '~/src/conditions/condition.js'
3
3
  import { type OutputType } from '~/src/data-model/enums.js'
4
+ import { formDefinitionSchema } from '~/src/form/form-definition/index.js'
4
5
 
5
6
  type Toggleable<T> = boolean | T
6
7
 
@@ -8,6 +9,7 @@ export interface Next {
8
9
  path: string
9
10
  condition?: string
10
11
  }
12
+
11
13
  export type Link = Next
12
14
 
13
15
  export interface Page {
@@ -155,7 +157,8 @@ export interface ConditionRawData {
155
157
  }
156
158
 
157
159
  /**
158
- * `FormDefinition` is a typescript representation of `Schema`
160
+ * Interface for `formDefinitionSchema` Joi schema
161
+ * @see {@link formDefinitionSchema}
159
162
  */
160
163
  export interface FormDefinition {
161
164
  pages: (Page | RepeatingFieldPage)[]
@@ -0,0 +1,16 @@
1
+ import Joi from 'joi'
2
+
3
+ import { type FormMetadata } from '~/src/form/form-metadata/types.js'
4
+
5
+ /**
6
+ * Joi schema for `FormMetadata` interface
7
+ * @see {@link FormMetadata}
8
+ */
9
+ export const formMetadataSchema = Joi.object()
10
+ .keys({
11
+ title: Joi.string().max(250).trim().required(),
12
+ organisation: Joi.string().max(100).trim().required(),
13
+ teamName: Joi.string().max(100).trim().required(),
14
+ teamEmail: Joi.string().email().trim().required()
15
+ })
16
+ .required()
@@ -0,0 +1,41 @@
1
+ import { formMetadataSchema } from '~/src/form/form-metadata/index.js'
2
+
3
+ /**
4
+ * Interface for `formMetadataSchema` Joi schema
5
+ * @see {@link formMetadataSchema}
6
+ */
7
+ export interface FormMetadata {
8
+ /**
9
+ * The id of the form
10
+ */
11
+ id: string
12
+
13
+ /**
14
+ * The human-readable slug id of the form
15
+ */
16
+ slug: string
17
+
18
+ /**
19
+ * The human-readable title of the form
20
+ */
21
+ title: string
22
+
23
+ /**
24
+ * The organisation this form belongs to
25
+ */
26
+ organisation: string
27
+
28
+ /**
29
+ * The name of the team who own this form
30
+ */
31
+ teamName: string
32
+
33
+ /**
34
+ * The email of the team who own this form
35
+ */
36
+ teamEmail: string
37
+ }
38
+
39
+ export type FormByIdInput = Pick<FormMetadata, 'id'>
40
+ export type FormMetadataDocument = Omit<FormMetadata, 'id'>
41
+ export type FormMetadataInput = Omit<FormMetadata, 'id' | 'slug'>
package/src/form/index.ts CHANGED
@@ -1 +1,3 @@
1
- export { FormConfiguration } from '~/src/form/form-configuration.js'
1
+ export * from '~/src/form/form-configuration/index.js'
2
+ export * from '~/src/form/form-definition/index.js'
3
+ export * from '~/src/form/form-metadata/index.js'
@@ -0,0 +1,2 @@
1
+ export type * from '~/src/form/form-definition/types.js'
2
+ export type * from '~/src/form/form-metadata/types.js'
package/src/index.ts CHANGED
@@ -1,4 +1,3 @@
1
- export * from '~/src/schema/index.js'
2
1
  export * from '~/src/data-model/index.js'
3
2
  export * from '~/src/utils/logger.js'
4
3
  export * from '~/src/form/index.js'
@@ -8,4 +7,4 @@ export * from '~/src/utils/helpers.js'
8
7
  export * from '~/src/migration/index.js'
9
8
  export type * from '~/src/components/types.js'
10
9
  export type * from '~/src/conditions/types.js'
11
- export type * from '~/src/data-model/types.js'
10
+ export type * from '~/src/form/types.js'
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/data-model/types.ts"],"sourcesContent":["import { type ComponentDef } from '~/src/components/types.js'\nimport { type Condition } from '~/src/conditions/condition.js'\nimport { type OutputType } from '~/src/data-model/enums.js'\n\ntype Toggleable<T> = boolean | T\n\nexport interface Next {\n path: string\n condition?: string\n}\nexport type Link = Next\n\nexport interface Page {\n title: string\n path: string\n controller: string\n components?: ComponentDef[]\n section: string // the section ID\n next?: { path: string; condition?: string }[]\n}\n\nexport interface RepeatingFieldPage extends Page {\n controller: 'RepeatingFieldPageController'\n options: {\n summaryDisplayMode?: {\n samePage?: boolean\n separatePage?: boolean\n hideRowTitles?: boolean\n }\n customText?: {\n separatePageTitle?: string\n }\n }\n}\n\nexport interface Section {\n name: string\n title: string\n hideTitle: boolean\n}\n\nexport interface Item {\n text: string\n value: string | number | boolean\n description?: string\n condition?: string\n}\n\nexport interface List {\n name: string\n title: string\n type: 'string' | 'number' | 'boolean'\n items: Item[]\n}\n\nexport interface Feedback {\n feedbackForm?: boolean\n url?: string\n emailAddress?: string\n}\n\nexport interface PhaseBanner {\n phase?: 'alpha' | 'beta'\n feedbackUrl?: string\n}\n\nexport interface MultipleApiKeys {\n test?: string\n production?: string\n}\n\nexport interface EmailOutputConfiguration {\n emailAddress: string\n}\n\nexport interface NotifyOutputConfiguration {\n apiKey: string\n templateId: string\n emailField: string\n personalisation: string[]\n personalisationFieldCustomisation?: Record<string, string[]>\n addReferencesToPersonalisation?: boolean\n emailReplyToIdConfiguration?: {\n emailReplyToId: string\n condition?: string | undefined\n }[]\n}\n\nexport interface WebhookOutputConfiguration {\n url: string\n}\n\nexport type OutputConfiguration =\n | EmailOutputConfiguration\n | NotifyOutputConfiguration\n | WebhookOutputConfiguration\n\nexport interface Output {\n name: string\n title: string\n type: OutputType\n outputConfiguration: OutputConfiguration\n}\n\nexport interface ConfirmationPage {\n customText: {\n title: string\n paymentSkipped: Toggleable<string>\n nextSteps: Toggleable<string>\n }\n components: ComponentDef[]\n}\n\nexport interface PaymentSkippedWarningPage {\n customText: {\n title: string\n caption: string\n body: string\n }\n}\n\nexport interface SpecialPages {\n confirmationPage?: ConfirmationPage\n paymentSkippedWarningPage?: PaymentSkippedWarningPage\n}\n\nexport interface Fee {\n description: string\n amount: number\n multiplier?: string\n condition?: string\n prefix?: string\n}\n\nexport interface FeeOptions {\n paymentReferenceFormat?: string\n payReturnUrl?: string\n allowSubmissionWithoutPayment: boolean\n maxAttempts: number\n customPayErrorMessage?: string\n showPaymentSkippedWarningPage: boolean\n}\n\nexport type ConditionWrapperValue =\n | string\n | {\n name: string\n conditions: Condition[]\n }\n\nexport interface ConditionRawData {\n name: string\n displayName: string\n value: ConditionWrapperValue\n}\n\n/**\n * `FormDefinition` is a typescript representation of `Schema`\n */\nexport interface FormDefinition {\n pages: (Page | RepeatingFieldPage)[]\n conditions: ConditionRawData[]\n lists: List[]\n sections: Section[]\n startPage?: Page['path'] | undefined\n name?: string | undefined\n feedback?: Feedback\n phaseBanner?: PhaseBanner\n fees: Fee[]\n skipSummary?: boolean | undefined\n outputs: Output[]\n declaration?: string | undefined\n metadata?: Record<string, unknown>\n payApiKey?: string | MultipleApiKeys | undefined\n specialPages?: SpecialPages\n paymentReferenceFormat?: string\n feeOptions: FeeOptions\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"form-configuration.js","names":["FormConfiguration","constructor","Key","DisplayName","LastModified","feedbackForm","Error"],"sources":["../../../src/form/form-configuration.ts"],"sourcesContent":["export class FormConfiguration {\n Key: string\n DisplayName: string\n LastModified: string | undefined\n feedbackForm: boolean | undefined\n\n constructor(\n Key: string,\n DisplayName?: string,\n LastModified?: string,\n feedbackForm?: boolean\n ) {\n if (!Key) {\n throw Error('Form configuration must have a key')\n }\n this.Key = Key\n this.DisplayName = DisplayName || Key\n this.LastModified = LastModified\n this.feedbackForm = feedbackForm || false\n }\n}\n"],"mappings":"AAAA,OAAO,MAAMA,iBAAiB,CAAC;EAM7BC,WAAWA,CACTC,GAAW,EACXC,WAAoB,EACpBC,YAAqB,EACrBC,YAAsB,EACtB;IACA,IAAI,CAACH,GAAG,EAAE;MACR,MAAMI,KAAK,CAAC,oCAAoC,CAAC;IACnD;IACA,IAAI,CAACJ,GAAG,GAAGA,GAAG;IACd,IAAI,CAACC,WAAW,GAAGA,WAAW,IAAID,GAAG;IACrC,IAAI,CAACE,YAAY,GAAGA,YAAY;IAChC,IAAI,CAACC,YAAY,GAAGA,YAAY,IAAI,KAAK;EAC3C;AACF","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- export { Schema, componentSchema } from "./schema.js";
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["Schema","componentSchema"],"sources":["../../../src/schema/index.ts"],"sourcesContent":["export { Schema, componentSchema } from '~/src/schema/schema.js'\n"],"mappings":"AAAA,SAASA,MAAM,EAAEC,eAAe","ignoreList":[]}