@planning-inspectorate/dynamic-forms 3.10.9 → 3.10.10
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/move-types.js +6 -8
- package/package.json +1 -1
- package/src/components/boolean/question.js +1 -1
- package/src/components/manage-list/utils.js +4 -4
- package/src/components/radio/question.js +1 -1
- package/src/index.js +1 -0
- package/src/journey/journey-response.js +2 -2
- package/src/journey/journey-types.js +1 -0
- package/src/journey/journey.js +17 -23
- package/src/questions/create-questions.js +1 -1
- package/src/questions/options-question.js +7 -3
- package/src/questions/question-types.d.ts +6 -0
- package/src/questions/question.js +18 -21
- package/src/validator/valid-option-validator.js +1 -5
- package/tsconfig.json +1 -1
- package/types/commitlint.config.d.ts +0 -7
- package/types/commitlint.config.d.ts.map +0 -1
- package/types/eslint.config.d.ts +0 -95
- package/types/eslint.config.d.ts.map +0 -1
- package/types/move-types.d.ts +0 -2
- package/types/move-types.d.ts.map +0 -1
- package/types/src/components/address/question.d.ts +0 -36
- package/types/src/components/address/question.d.ts.map +0 -1
- package/types/src/components/address/question.test.d.ts +0 -2
- package/types/src/components/address/question.test.d.ts.map +0 -1
- package/types/src/components/boolean/question.d.ts +0 -50
- package/types/src/components/boolean/question.d.ts.map +0 -1
- package/types/src/components/boolean/question.test.d.ts +0 -2
- package/types/src/components/boolean/question.test.d.ts.map +0 -1
- package/types/src/components/checkbox/question.d.ts +0 -52
- package/types/src/components/checkbox/question.d.ts.map +0 -1
- package/types/src/components/checkbox/question.test.d.ts +0 -2
- package/types/src/components/checkbox/question.test.d.ts.map +0 -1
- package/types/src/components/date/question.d.ts +0 -23
- package/types/src/components/date/question.d.ts.map +0 -1
- package/types/src/components/date/question.test.d.ts +0 -2
- package/types/src/components/date/question.test.d.ts.map +0 -1
- package/types/src/components/date-period/question.d.ts +0 -35
- package/types/src/components/date-period/question.d.ts.map +0 -1
- package/types/src/components/date-period/question.test.d.ts +0 -2
- package/types/src/components/date-period/question.test.d.ts.map +0 -1
- package/types/src/components/date-time/question.d.ts +0 -25
- package/types/src/components/date-time/question.d.ts.map +0 -1
- package/types/src/components/date-time/question.test.d.ts +0 -2
- package/types/src/components/date-time/question.test.d.ts.map +0 -1
- package/types/src/components/email/question.d.ts +0 -31
- package/types/src/components/email/question.d.ts.map +0 -1
- package/types/src/components/email/question.test.d.ts +0 -2
- package/types/src/components/email/question.test.d.ts.map +0 -1
- package/types/src/components/identifier/question.d.ts +0 -16
- package/types/src/components/identifier/question.d.ts.map +0 -1
- package/types/src/components/identifier/question.test.d.ts +0 -2
- package/types/src/components/identifier/question.test.d.ts.map +0 -1
- package/types/src/components/manage-list/manage-list-actions.d.ts +0 -10
- package/types/src/components/manage-list/manage-list-actions.d.ts.map +0 -1
- package/types/src/components/manage-list/manage-list-section.d.ts +0 -16
- package/types/src/components/manage-list/manage-list-section.d.ts.map +0 -1
- package/types/src/components/manage-list/manage-list-section.test.d.ts +0 -2
- package/types/src/components/manage-list/manage-list-section.test.d.ts.map +0 -1
- package/types/src/components/manage-list/question.d.ts +0 -49
- package/types/src/components/manage-list/question.d.ts.map +0 -1
- package/types/src/components/manage-list/question.test.d.ts +0 -2
- package/types/src/components/manage-list/question.test.d.ts.map +0 -1
- package/types/src/components/manage-list/utils.d.ts +0 -18
- package/types/src/components/manage-list/utils.d.ts.map +0 -1
- package/types/src/components/manage-list/utils.test.d.ts +0 -2
- package/types/src/components/manage-list/utils.test.d.ts.map +0 -1
- package/types/src/components/multi-field-input/question.d.ts +0 -61
- package/types/src/components/multi-field-input/question.d.ts.map +0 -1
- package/types/src/components/multi-field-input/question.test.d.ts +0 -2
- package/types/src/components/multi-field-input/question.test.d.ts.map +0 -1
- package/types/src/components/number-entry/question.d.ts +0 -38
- package/types/src/components/number-entry/question.d.ts.map +0 -1
- package/types/src/components/radio/question.d.ts +0 -54
- package/types/src/components/radio/question.d.ts.map +0 -1
- package/types/src/components/radio/question.test.d.ts +0 -2
- package/types/src/components/radio/question.test.d.ts.map +0 -1
- package/types/src/components/select/question.d.ts +0 -55
- package/types/src/components/select/question.d.ts.map +0 -1
- package/types/src/components/select/question.test.d.ts +0 -2
- package/types/src/components/select/question.test.d.ts.map +0 -1
- package/types/src/components/single-line-input/question.d.ts +0 -19
- package/types/src/components/single-line-input/question.d.ts.map +0 -1
- package/types/src/components/single-line-input/question.test.d.ts +0 -2
- package/types/src/components/single-line-input/question.test.d.ts.map +0 -1
- package/types/src/components/text-entry/question.d.ts +0 -35
- package/types/src/components/text-entry/question.d.ts.map +0 -1
- package/types/src/components/text-entry/question.test.d.ts +0 -2
- package/types/src/components/text-entry/question.test.d.ts.map +0 -1
- package/types/src/components/text-entry-redact/question.d.ts +0 -35
- package/types/src/components/text-entry-redact/question.d.ts.map +0 -1
- package/types/src/components/text-entry-redact/question.test.d.ts +0 -2
- package/types/src/components/text-entry-redact/question.test.d.ts.map +0 -1
- package/types/src/components/unit-option-entry/question.d.ts +0 -84
- package/types/src/components/unit-option-entry/question.d.ts.map +0 -1
- package/types/src/components/unit-option-entry/question.test.d.ts +0 -2
- package/types/src/components/unit-option-entry/question.test.d.ts.map +0 -1
- package/types/src/components/utils/component-types.d.ts +0 -19
- package/types/src/components/utils/component-types.d.ts.map +0 -1
- package/types/src/components/utils/persisted-number-answer.d.ts +0 -2
- package/types/src/components/utils/persisted-number-answer.d.ts.map +0 -1
- package/types/src/components/utils/question-has-answer.d.ts +0 -17
- package/types/src/components/utils/question-has-answer.d.ts.map +0 -1
- package/types/src/components/utils/question-has-answer.test.d.ts +0 -2
- package/types/src/components/utils/question-has-answer.test.d.ts.map +0 -1
- package/types/src/components/utils/question-utils.d.ts +0 -15
- package/types/src/components/utils/question-utils.d.ts.map +0 -1
- package/types/src/components/utils/question-utils.test.d.ts +0 -2
- package/types/src/components/utils/question-utils.test.d.ts.map +0 -1
- package/types/src/controller.d.ts +0 -75
- package/types/src/controller.d.ts.map +0 -1
- package/types/src/controller.test.d.ts +0 -2
- package/types/src/controller.test.d.ts.map +0 -1
- package/types/src/index.d.ts +0 -58
- package/types/src/index.d.ts.map +0 -1
- package/types/src/index.test.d.ts +0 -2
- package/types/src/index.test.d.ts.map +0 -1
- package/types/src/journey/journey-response.d.ts +0 -32
- package/types/src/journey/journey-response.d.ts.map +0 -1
- package/types/src/journey/journey-response.test.d.ts +0 -2
- package/types/src/journey/journey-response.test.d.ts.map +0 -1
- package/types/src/journey/journey.d.ts +0 -144
- package/types/src/journey/journey.d.ts.map +0 -1
- package/types/src/journey/journey.test.d.ts +0 -2
- package/types/src/journey/journey.test.d.ts.map +0 -1
- package/types/src/lib/address-utils.d.ts +0 -6
- package/types/src/lib/address-utils.d.ts.map +0 -1
- package/types/src/lib/address-utils.test.d.ts +0 -2
- package/types/src/lib/address-utils.test.d.ts.map +0 -1
- package/types/src/lib/address.d.ts +0 -43
- package/types/src/lib/address.d.ts.map +0 -1
- package/types/src/lib/address.test.d.ts +0 -2
- package/types/src/lib/address.test.d.ts.map +0 -1
- package/types/src/lib/date-utils.d.ts +0 -60
- package/types/src/lib/date-utils.d.ts.map +0 -1
- package/types/src/lib/date-utils.test.d.ts +0 -2
- package/types/src/lib/date-utils.test.d.ts.map +0 -1
- package/types/src/lib/session-answer-store.d.ts +0 -88
- package/types/src/lib/session-answer-store.d.ts.map +0 -1
- package/types/src/lib/session-answer-store.test.d.ts +0 -2
- package/types/src/lib/session-answer-store.test.d.ts.map +0 -1
- package/types/src/lib/utils.d.ts +0 -26
- package/types/src/lib/utils.d.ts.map +0 -1
- package/types/src/lib/utils.test.d.ts +0 -2
- package/types/src/lib/utils.test.d.ts.map +0 -1
- package/types/src/lib/uuid.d.ts +0 -7
- package/types/src/lib/uuid.d.ts.map +0 -1
- package/types/src/lib/uuid.test.d.ts +0 -2
- package/types/src/lib/uuid.test.d.ts.map +0 -1
- package/types/src/middleware/build-get-journey.d.ts +0 -6
- package/types/src/middleware/build-get-journey.d.ts.map +0 -1
- package/types/src/middleware/redirect-to-unanswered-question.d.ts +0 -12
- package/types/src/middleware/redirect-to-unanswered-question.d.ts.map +0 -1
- package/types/src/middleware/redirect-to-unanswered-question.test.d.ts +0 -2
- package/types/src/middleware/redirect-to-unanswered-question.test.d.ts.map +0 -1
- package/types/src/questions/create-questions.d.ts +0 -21
- package/types/src/questions/create-questions.d.ts.map +0 -1
- package/types/src/questions/options-question.d.ts +0 -74
- package/types/src/questions/options-question.d.ts.map +0 -1
- package/types/src/questions/options-question.test.d.ts +0 -2
- package/types/src/questions/options-question.test.d.ts.map +0 -1
- package/types/src/questions/question-props.d.ts +0 -182
- package/types/src/questions/question-props.d.ts.map +0 -1
- package/types/src/questions/question-types.d.ts +0 -80
- package/types/src/questions/question-types.d.ts.map +0 -1
- package/types/src/questions/question.d.ts +0 -278
- package/types/src/questions/question.d.ts.map +0 -1
- package/types/src/questions/question.test.d.ts +0 -2
- package/types/src/questions/question.test.d.ts.map +0 -1
- package/types/src/questions/questions.d.ts +0 -3
- package/types/src/questions/questions.d.ts.map +0 -1
- package/types/src/section.d.ts +0 -107
- package/types/src/section.d.ts.map +0 -1
- package/types/src/section.test.d.ts +0 -2
- package/types/src/section.test.d.ts.map +0 -1
- package/types/src/validator/address-validator.d.ts +0 -48
- package/types/src/validator/address-validator.d.ts.map +0 -1
- package/types/src/validator/address-validator.test.d.ts +0 -2
- package/types/src/validator/address-validator.test.d.ts.map +0 -1
- package/types/src/validator/base-validator.d.ts +0 -12
- package/types/src/validator/base-validator.d.ts.map +0 -1
- package/types/src/validator/base-validator.test.d.ts +0 -2
- package/types/src/validator/base-validator.test.d.ts.map +0 -1
- package/types/src/validator/conditional-required-validator.d.ts +0 -25
- package/types/src/validator/conditional-required-validator.d.ts.map +0 -1
- package/types/src/validator/conditional-required-validator.test.d.ts +0 -2
- package/types/src/validator/conditional-required-validator.test.d.ts.map +0 -1
- package/types/src/validator/confirmation-checkbox-validator.d.ts +0 -28
- package/types/src/validator/confirmation-checkbox-validator.d.ts.map +0 -1
- package/types/src/validator/confirmation-checkbox-validator.test.d.ts +0 -2
- package/types/src/validator/confirmation-checkbox-validator.test.d.ts.map +0 -1
- package/types/src/validator/coordinates-validator.d.ts +0 -23
- package/types/src/validator/coordinates-validator.d.ts.map +0 -1
- package/types/src/validator/coordinates-validator.test.d.ts +0 -2
- package/types/src/validator/coordinates-validator.test.d.ts.map +0 -1
- package/types/src/validator/date-period-validator.d.ts +0 -64
- package/types/src/validator/date-period-validator.d.ts.map +0 -1
- package/types/src/validator/date-period-validator.test.d.ts +0 -2
- package/types/src/validator/date-period-validator.test.d.ts.map +0 -1
- package/types/src/validator/date-time-validator.d.ts +0 -27
- package/types/src/validator/date-time-validator.d.ts.map +0 -1
- package/types/src/validator/date-time-validator.test.d.ts +0 -2
- package/types/src/validator/date-time-validator.test.d.ts.map +0 -1
- package/types/src/validator/date-validator.d.ts +0 -49
- package/types/src/validator/date-validator.d.ts.map +0 -1
- package/types/src/validator/date-validator.test.d.ts +0 -2
- package/types/src/validator/date-validator.test.d.ts.map +0 -1
- package/types/src/validator/document-upload-validator.d.ts +0 -12
- package/types/src/validator/document-upload-validator.d.ts.map +0 -1
- package/types/src/validator/document-upload-validator.test.d.ts +0 -2
- package/types/src/validator/document-upload-validator.test.d.ts.map +0 -1
- package/types/src/validator/email-validator.d.ts +0 -74
- package/types/src/validator/email-validator.d.ts.map +0 -1
- package/types/src/validator/email-validator.test.d.ts +0 -2
- package/types/src/validator/email-validator.test.d.ts.map +0 -1
- package/types/src/validator/multi-field-input-validator.d.ts +0 -91
- package/types/src/validator/multi-field-input-validator.d.ts.map +0 -1
- package/types/src/validator/multi-field-input-validator.test.d.ts +0 -2
- package/types/src/validator/multi-field-input-validator.test.d.ts.map +0 -1
- package/types/src/validator/numeric-validator.d.ts +0 -50
- package/types/src/validator/numeric-validator.d.ts.map +0 -1
- package/types/src/validator/numeric-validator.test.d.ts +0 -2
- package/types/src/validator/numeric-validator.test.d.ts.map +0 -1
- package/types/src/validator/required-validator.d.ts +0 -23
- package/types/src/validator/required-validator.d.ts.map +0 -1
- package/types/src/validator/required-validator.test.d.ts +0 -2
- package/types/src/validator/required-validator.test.d.ts.map +0 -1
- package/types/src/validator/same-answer-validator.d.ts +0 -19
- package/types/src/validator/same-answer-validator.d.ts.map +0 -1
- package/types/src/validator/same-answer-validator.test.d.ts +0 -2
- package/types/src/validator/same-answer-validator.test.d.ts.map +0 -1
- package/types/src/validator/string-validator.d.ts +0 -59
- package/types/src/validator/string-validator.d.ts.map +0 -1
- package/types/src/validator/string-validator.test.d.ts +0 -2
- package/types/src/validator/string-validator.test.d.ts.map +0 -1
- package/types/src/validator/unit-option-entry-validator.d.ts +0 -41
- package/types/src/validator/unit-option-entry-validator.d.ts.map +0 -1
- package/types/src/validator/unit-option-entry-validator.test.d.ts +0 -2
- package/types/src/validator/unit-option-entry-validator.test.d.ts.map +0 -1
- package/types/src/validator/valid-option-validator.d.ts +0 -23
- package/types/src/validator/valid-option-validator.d.ts.map +0 -1
- package/types/src/validator/valid-option-validator.test.d.ts +0 -2
- package/types/src/validator/valid-option-validator.test.d.ts.map +0 -1
- package/types/src/validator/validation-error-handler.d.ts +0 -20
- package/types/src/validator/validation-error-handler.d.ts.map +0 -1
- package/types/src/validator/validation-error-handler.test.d.ts +0 -2
- package/types/src/validator/validation-error-handler.test.d.ts.map +0 -1
- package/types/src/validator/validator.d.ts +0 -5
- package/types/src/validator/validator.d.ts.map +0 -1
- package/types/src/validator/validator.test.d.ts +0 -2
- package/types/src/validator/validator.test.d.ts.map +0 -1
- package/types/test/mock/journey.d.ts +0 -3
- package/types/test/mock/journey.d.ts.map +0 -1
- package/types/test/mock/uuid.d.ts +0 -7
- package/types/test/mock/uuid.d.ts.map +0 -1
- package/types/test/utils/nunjucks.d.ts +0 -2
- package/types/test/utils/nunjucks.d.ts.map +0 -1
- package/types/test/utils/utils.d.ts +0 -32
- package/types/test/utils/utils.d.ts.map +0 -1
package/move-types.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { copyFile } from 'node:fs/promises';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const filesToCopy = ['questions/question-props.d.ts', 'questions/question-types.d.ts', 'journey/journey-types.d.ts'];
|
|
5
|
+
|
|
6
|
+
// copy some of the type definition files to the types output that are not automatically included
|
|
7
|
+
for (const file of filesToCopy) {
|
|
8
|
+
const src = path.join(import.meta.dirname, 'src', file);
|
|
9
|
+
const dest = path.join(import.meta.dirname, 'types', 'src', file);
|
|
5
10
|
await copyFile(src, dest);
|
|
6
11
|
console.log(`Copied ${src} to ${dest}`);
|
|
7
12
|
}
|
|
8
|
-
|
|
9
|
-
const srcDir = path.join(import.meta.dirname, 'src', 'questions');
|
|
10
|
-
const typesDir = path.join(import.meta.dirname, 'types', 'src', 'questions');
|
|
11
|
-
|
|
12
|
-
// copy some of the type definition files to the types output that are not automatically included
|
|
13
|
-
copyAndOverwrite(path.join(srcDir, 'question-props.d.ts'), path.join(typesDir, 'question-props.d.ts'));
|
|
14
|
-
copyAndOverwrite(path.join(srcDir, 'question-types.d.ts'), path.join(typesDir, 'question-types.d.ts'));
|
package/package.json
CHANGED
|
@@ -103,7 +103,7 @@ export class BooleanQuestion extends RadioQuestion {
|
|
|
103
103
|
* Get the data to save from the request, returns an object of answers
|
|
104
104
|
* @param {import('express').Request} req
|
|
105
105
|
* @param {JourneyResponse} journeyResponse - current journey response, modified with the new answers
|
|
106
|
-
* @returns {Promise
|
|
106
|
+
* @returns {Promise<{ answers: Record<string, unknown> }>}
|
|
107
107
|
*/ //eslint-disable-next-line no-unused-vars -- journeyResponse kept for other questions to use
|
|
108
108
|
async getDataToSave(req, journeyResponse) {
|
|
109
109
|
const answers = {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
*
|
|
3
|
-
* @param {import('
|
|
3
|
+
* @param {import('../../journey/journey-response.js').JourneyResponse} response
|
|
4
4
|
* @param {import('./question.js')} manageListQuestion
|
|
5
5
|
* @param {string} manageListItemId
|
|
6
6
|
* @returns {Record<string, unknown>}
|
|
@@ -16,10 +16,10 @@ export function answerObjectForManageList(response, manageListQuestion, manageLi
|
|
|
16
16
|
/**
|
|
17
17
|
* Similar to answerObjectForManageList but will edit response and add a new array entry if not found
|
|
18
18
|
*
|
|
19
|
-
* @param {import('
|
|
19
|
+
* @param {import('../../journey/journey-response.js').JourneyResponse} response
|
|
20
20
|
* @param {import('./question.js')} manageListQuestion
|
|
21
|
-
* @param {import('
|
|
22
|
-
* @returns {import('
|
|
21
|
+
* @param {import('../../journey/journey-types.js').RouteParams} params
|
|
22
|
+
* @returns {import('../../journey/journey-types.js').ManageListAnswers}
|
|
23
23
|
*/
|
|
24
24
|
export function answerObjectForManageListSaving(response, manageListQuestion, params) {
|
|
25
25
|
const answersList =
|
|
@@ -72,7 +72,7 @@ export class RadioQuestion extends OptionsQuestion {
|
|
|
72
72
|
* @param {Object} answer
|
|
73
73
|
* @param {Journey} journey
|
|
74
74
|
* @param {String} sectionSegment
|
|
75
|
-
* @returns {Array
|
|
75
|
+
* @returns {Array<{ key: string; value: string | Object; action?: ActionView | ActionView[] | undefined; }>}
|
|
76
76
|
*/
|
|
77
77
|
formatAnswerForSummary(sectionSegment, journey, answer) {
|
|
78
78
|
if (answer?.conditional) {
|
package/src/index.js
CHANGED
|
@@ -28,6 +28,7 @@ export * from './controller.js';
|
|
|
28
28
|
// Journey
|
|
29
29
|
export { Journey } from './journey/journey.js';
|
|
30
30
|
export { JourneyResponse } from './journey/journey-response.js';
|
|
31
|
+
export * from './journey/journey-types.js';
|
|
31
32
|
|
|
32
33
|
// lib
|
|
33
34
|
export * from './lib/address.js';
|
|
@@ -18,7 +18,7 @@ export class JourneyResponse {
|
|
|
18
18
|
journeyId;
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* @type {import('./journey-types.
|
|
21
|
+
* @type {import('./journey-types.js').JourneyAnswers} - answers to the journey
|
|
22
22
|
*/
|
|
23
23
|
answers;
|
|
24
24
|
|
|
@@ -26,7 +26,7 @@ export class JourneyResponse {
|
|
|
26
26
|
* creates an instance of a JourneyResponse
|
|
27
27
|
* @param {JourneyType} journeyId
|
|
28
28
|
* @param {string} referenceId
|
|
29
|
-
* @param {import('./journey-types.
|
|
29
|
+
* @param {import('./journey-types.js').JourneyAnswers | null} answers
|
|
30
30
|
* @param {string} [lpaCode]
|
|
31
31
|
*/
|
|
32
32
|
constructor(journeyId, referenceId, answers, lpaCode) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// empty source file to go with .d.ts file
|
package/src/journey/journey.js
CHANGED
|
@@ -6,12 +6,6 @@
|
|
|
6
6
|
import { END_OF_SECTION } from '#src/section.js';
|
|
7
7
|
import { MANAGE_LIST_ACTIONS } from '#src/components/manage-list/manage-list-actions.js';
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* @typedef {import('./journey-response').JourneyResponse} JourneyResponse
|
|
11
|
-
* @typedef {import('../section').Section} Section
|
|
12
|
-
* @typedef {import('../questions/question').Question} Question
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
9
|
/**
|
|
16
10
|
* A journey (An entire set of questions required for a completion of a submission)
|
|
17
11
|
* @class
|
|
@@ -19,13 +13,13 @@ import { MANAGE_LIST_ACTIONS } from '#src/components/manage-list/manage-list-act
|
|
|
19
13
|
export class Journey {
|
|
20
14
|
/** @type {string} journeyId - a unique, human-readable id for this journey */
|
|
21
15
|
journeyId;
|
|
22
|
-
/** @type {Array.<Section>} sections - sections within the journey */
|
|
16
|
+
/** @type {Array.<import('../section.js').Section>} sections - sections within the journey */
|
|
23
17
|
sections = [];
|
|
24
|
-
/** @type {JourneyResponse} response - the user's response to the journey so far */
|
|
18
|
+
/** @type {import('./journey-response.js').JourneyResponse} response - the user's response to the journey so far */
|
|
25
19
|
response;
|
|
26
20
|
/** @type {string} baseUrl - base url of the journey, gets prepended to question urls */
|
|
27
21
|
baseUrl = '';
|
|
28
|
-
/** @type {(journeyResponse: JourneyResponse) => string}
|
|
22
|
+
/** @type {(journeyResponse: import('./journey-response.js').JourneyResponse) => string} makeBaseUrl - function to generate base url of the journey */
|
|
29
23
|
makeBaseUrl = () => '';
|
|
30
24
|
/** @type {string} taskListUrl - url that renders the task list */
|
|
31
25
|
taskListUrl = '';
|
|
@@ -44,15 +38,15 @@ export class Journey {
|
|
|
44
38
|
* creates an instance of a journey
|
|
45
39
|
* @param {object} options
|
|
46
40
|
* @param {string} options.journeyId - a unique, human-readable id for this journey
|
|
47
|
-
* @param {(response: JourneyResponse) => string} options.makeBaseUrl - base url of journey
|
|
41
|
+
* @param {(response: import('./journey-response.js').JourneyResponse) => string} options.makeBaseUrl - base url of journey
|
|
48
42
|
* @param {string} [options.taskListUrl] - task list url - added to base url, can be left undefined
|
|
49
|
-
* @param {JourneyResponse} options.response - user's response
|
|
43
|
+
* @param {import('./journey-response.js').JourneyResponse} options.response - user's response
|
|
50
44
|
* @param {string} options.journeyTemplate - template used for all views
|
|
51
45
|
* @param {string} options.taskListTemplate - path to njk view for listing page
|
|
52
46
|
* @param {string} [options.informationPageViewPath] - path to njk view for pdf summary page
|
|
53
47
|
* @param {string} options.journeyTitle - part of the title in the njk view
|
|
54
48
|
* @param {boolean} [options.returnToListing] - defines how the next/previous question handles end of sections
|
|
55
|
-
* @param {Section[]} options.sections
|
|
49
|
+
* @param {import('../section.js').Section[]} options.sections
|
|
56
50
|
* @param {string} [options.initialBackLink] - back link when on the first question
|
|
57
51
|
*/
|
|
58
52
|
constructor({
|
|
@@ -137,7 +131,7 @@ export class Journey {
|
|
|
137
131
|
|
|
138
132
|
/**
|
|
139
133
|
* utility function to build up a url to a question
|
|
140
|
-
* @param {import('./journey-types.
|
|
134
|
+
* @param {import('./journey-types.js').RouteParams} params
|
|
141
135
|
* @returns {string} url for a question
|
|
142
136
|
*/
|
|
143
137
|
#buildQuestionUrl(params) {
|
|
@@ -151,7 +145,7 @@ export class Journey {
|
|
|
151
145
|
/**
|
|
152
146
|
* Gets section based on segment
|
|
153
147
|
* @param {string} sectionSegment
|
|
154
|
-
* @returns {Section | undefined}
|
|
148
|
+
* @returns {import('../section.js').Section | undefined}
|
|
155
149
|
*/
|
|
156
150
|
getSection(sectionSegment) {
|
|
157
151
|
return this.sections.find((s) => {
|
|
@@ -161,10 +155,10 @@ export class Journey {
|
|
|
161
155
|
|
|
162
156
|
/**
|
|
163
157
|
* Get question within a section
|
|
164
|
-
* @param {Section} section
|
|
158
|
+
* @param {import('../section.js').Section} section
|
|
165
159
|
* @param {string} questionSegment
|
|
166
160
|
* @param {{action: string, itemId: string, question: string}} [manageListParams]
|
|
167
|
-
* @returns {Question | undefined} question if it belongs in the given section
|
|
161
|
+
* @returns {import('../questions/question.js').Question | undefined} question if it belongs in the given section
|
|
168
162
|
*/
|
|
169
163
|
#getQuestion(section, questionSegment, manageListParams) {
|
|
170
164
|
const matchQuestion = (q, toMatch) => {
|
|
@@ -189,8 +183,8 @@ export class Journey {
|
|
|
189
183
|
|
|
190
184
|
/**
|
|
191
185
|
* gets a question from the object's sections based on a section + question names
|
|
192
|
-
* @param {import('./journey-types.
|
|
193
|
-
* @returns {Question | undefined} question found by lookup
|
|
186
|
+
* @param {import('./journey-types.js').RouteParams} params
|
|
187
|
+
* @returns {import('../questions/question.js').Question | undefined} question found by lookup
|
|
194
188
|
*/
|
|
195
189
|
getQuestionByParams(params) {
|
|
196
190
|
const section = this.getSection(params.section);
|
|
@@ -213,7 +207,7 @@ export class Journey {
|
|
|
213
207
|
* Get the back link for the journey - e.g. the previous question
|
|
214
208
|
*
|
|
215
209
|
* @param {Object} options
|
|
216
|
-
* @param {import('./journey-types.
|
|
210
|
+
* @param {import('./journey-types.js').RouteParams} options.params
|
|
217
211
|
* @param {import('#src/components/manage-list/question.js')} [options.manageListQuestion]
|
|
218
212
|
* @returns {string|null} url for the next question, or null if unmatched
|
|
219
213
|
*/
|
|
@@ -233,7 +227,7 @@ export class Journey {
|
|
|
233
227
|
* Used after question post/saving
|
|
234
228
|
*
|
|
235
229
|
* @param {import('express').Response} res
|
|
236
|
-
* @param {import('./journey-types.
|
|
230
|
+
* @param {import('./journey-types.js').RouteParams} params
|
|
237
231
|
* @param {import('#src/components/manage-list/question.js')} [manageListQuestion]
|
|
238
232
|
* @returns {void}
|
|
239
233
|
*/
|
|
@@ -245,7 +239,7 @@ export class Journey {
|
|
|
245
239
|
/**
|
|
246
240
|
* Get url for the next question in the journey
|
|
247
241
|
*
|
|
248
|
-
* @param {import('./journey-types.
|
|
242
|
+
* @param {import('./journey-types.js').RouteParams} params
|
|
249
243
|
* @param {Object} options
|
|
250
244
|
* @param {boolean} [options.reverse] - if passed in this will get the previous question
|
|
251
245
|
* @param {import('#src/components/manage-list/question.js')} [options.manageListQuestion]
|
|
@@ -299,7 +293,7 @@ export class Journey {
|
|
|
299
293
|
* don't include other params which may be set (e.g. manageList* params), as we may now be
|
|
300
294
|
* redirecting to a non-manage list question, having previously been on a manage list question
|
|
301
295
|
*
|
|
302
|
-
* @type {import('./journey-types.
|
|
296
|
+
* @type {import('./journey-types.js').RouteParams}
|
|
303
297
|
*/
|
|
304
298
|
let newParams = {
|
|
305
299
|
section: currentSection.segment,
|
|
@@ -399,7 +393,7 @@ export class Journey {
|
|
|
399
393
|
}
|
|
400
394
|
|
|
401
395
|
/**
|
|
402
|
-
* @param {JourneyResponse} journeyResponse
|
|
396
|
+
* @param {import('./journey-response.js').JourneyResponse} journeyResponse
|
|
403
397
|
*/
|
|
404
398
|
setResponse(journeyResponse) {
|
|
405
399
|
this.response = journeyResponse;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @param {{[questionName: string]: QuestionProps}} questionPropsRecord
|
|
5
|
-
* @param {Record<string,
|
|
5
|
+
* @param {Record<string, import('./question-types.js').QuestionClass>} questionClasses
|
|
6
6
|
* @param {{[questionType: string]: Record<string, Function>}} questionMethodOverrides
|
|
7
7
|
* @param {{notStartedText?: string, continueButtonText?: string, changeActionText?: string, answerActionText?: string}} [textOverrides] - customise question text
|
|
8
8
|
*/
|
|
@@ -33,14 +33,16 @@ const defaultOptionJoinString = ',';
|
|
|
33
33
|
/**
|
|
34
34
|
* @typedef {import('./question').QuestionViewModel & { question: { options: Option[] } }} OptionsViewModel
|
|
35
35
|
*/
|
|
36
|
+
/**
|
|
37
|
+
* @typedef {import('#question-types').QuestionParameters & { options: Array<Option> }} OptionsQuestionParameters
|
|
38
|
+
*/
|
|
36
39
|
|
|
37
|
-
export
|
|
40
|
+
export class OptionsQuestion extends Question {
|
|
38
41
|
/** @type {Array<Option>} */
|
|
39
42
|
options;
|
|
40
43
|
|
|
41
44
|
/**
|
|
42
|
-
* @param {
|
|
43
|
-
* @param {Array<Option>} params.options
|
|
45
|
+
* @param {OptionsQuestionParameters} params
|
|
44
46
|
*/
|
|
45
47
|
constructor(params) {
|
|
46
48
|
// add default valid options validator to all options questions
|
|
@@ -150,3 +152,5 @@ export default class OptionsQuestion extends Question {
|
|
|
150
152
|
return { answers };
|
|
151
153
|
}
|
|
152
154
|
}
|
|
155
|
+
|
|
156
|
+
export default OptionsQuestion;
|
|
@@ -78,3 +78,9 @@ export interface PrepQuestionForRenderingOptions {
|
|
|
78
78
|
params: RouteParams;
|
|
79
79
|
manageListQuestion?: ManageListQuestion;
|
|
80
80
|
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Define a question class type so that projects downstream can extend the
|
|
84
|
+
* Question class and still pass them to the createQuestions function.
|
|
85
|
+
*/
|
|
86
|
+
export type QuestionClass<TQuestion extends Question = Question> = new (...args: never[]) => TQuestion;
|
|
@@ -7,9 +7,6 @@ import { answerObjectForManageList } from '#src/components/manage-list/utils.js'
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @import {BaseValidator} from "#base-validator"
|
|
10
|
-
* @import {Journey} from "#journey"
|
|
11
|
-
* @import {JourneyResponse} from "#journey-response"
|
|
12
|
-
* @import {Section} from "#section"
|
|
13
10
|
* @import {ActionView} from "../controller.js"
|
|
14
11
|
* @import {ActionLink} from "./question-types.js"
|
|
15
12
|
*/
|
|
@@ -83,7 +80,7 @@ export class Question {
|
|
|
83
80
|
addActionText = 'Add';
|
|
84
81
|
|
|
85
82
|
/**
|
|
86
|
-
* @param {JourneyResponse} [response]
|
|
83
|
+
* @param {import('../journey/journey-response.js').JourneyResponse} [response]
|
|
87
84
|
* @returns {boolean}
|
|
88
85
|
*/
|
|
89
86
|
shouldDisplay = () => true;
|
|
@@ -193,10 +190,10 @@ export class Question {
|
|
|
193
190
|
* that prepQuestionForRendering doesn't need
|
|
194
191
|
*
|
|
195
192
|
* @param {Object} options
|
|
196
|
-
* @param {import('
|
|
197
|
-
* @param {import('
|
|
198
|
-
* @param {Section} options.section - the current section
|
|
199
|
-
* @param {Journey} options.journey - the journey we are in
|
|
193
|
+
* @param {import('../journey/journey-types.js').RouteParams} options.params
|
|
194
|
+
* @param {import('../components/manage-list/question.js')} [options.manageListQuestion]
|
|
195
|
+
* @param {import('../section.js').Section} options.section - the current section
|
|
196
|
+
* @param {import('../journey/journey.js').Journey} options.journey - the journey we are in
|
|
200
197
|
* @param {Record<string, unknown>} [options.customViewData] additional data to send to view
|
|
201
198
|
* @param {unknown} [options.payload]
|
|
202
199
|
* @returns {QuestionViewModel}
|
|
@@ -213,8 +210,8 @@ export class Question {
|
|
|
213
210
|
/**
|
|
214
211
|
* gets the base view model for this question
|
|
215
212
|
*
|
|
216
|
-
* @param {Section} section - the current section
|
|
217
|
-
* @param {Journey} journey - the journey we are in
|
|
213
|
+
* @param {import('../section.js').Section} section - the current section
|
|
214
|
+
* @param {import('../journey/journey.js').Journey} journey - the journey we are in
|
|
218
215
|
* @param {Record<string, unknown>} [customViewData] additional data to send to view
|
|
219
216
|
* @param {unknown} [payload]
|
|
220
217
|
* @param {import('#question-types').PrepQuestionForRenderingOptions} [options] - required to support manage list question
|
|
@@ -284,7 +281,7 @@ export class Question {
|
|
|
284
281
|
/**
|
|
285
282
|
* Get the answers object from the journey response, which may be nested in an array for manage list questions
|
|
286
283
|
*
|
|
287
|
-
* @param {JourneyResponse} response
|
|
284
|
+
* @param {import('../journey/journey-response.js').JourneyResponse} response
|
|
288
285
|
* @param {import('#question-types').PrepQuestionForRenderingOptions} [options]
|
|
289
286
|
* @returns {Record<string, any>}
|
|
290
287
|
*/
|
|
@@ -320,9 +317,9 @@ export class Question {
|
|
|
320
317
|
/**
|
|
321
318
|
* check for validation errors
|
|
322
319
|
* @param {import('express').Request} req
|
|
323
|
-
* @param {Journey} journey
|
|
324
|
-
* @param {Section} section
|
|
325
|
-
* @param {import('
|
|
320
|
+
* @param {import('../journey/journey.js').Journey} journey
|
|
321
|
+
* @param {import('../section.js').Section} section
|
|
322
|
+
* @param {import('../components/manage-list/question.js')} [manageListQuestion]
|
|
326
323
|
* @returns {QuestionViewModel|undefined} returns the view model for displaying the error or undefined if there are no errors
|
|
327
324
|
*/
|
|
328
325
|
checkForValidationErrors(req, section, journey, manageListQuestion) {
|
|
@@ -348,7 +345,7 @@ export class Question {
|
|
|
348
345
|
* Get the data to save from the request, returns an object of answers
|
|
349
346
|
*
|
|
350
347
|
* @param {import('express').Request} req
|
|
351
|
-
* @param {JourneyResponse} journeyResponse - current journey response
|
|
348
|
+
* @param {import('../journey/journey-response.js').JourneyResponse} journeyResponse - current journey response
|
|
352
349
|
* @returns {Promise<{ answers: Record<string, unknown> }>}
|
|
353
350
|
*/ //eslint-disable-next-line no-unused-vars -- journeyResponse kept for other questions to use
|
|
354
351
|
async getDataToSave(req, journeyResponse) {
|
|
@@ -368,8 +365,8 @@ export class Question {
|
|
|
368
365
|
/**
|
|
369
366
|
* check for errors after saving, by default this does nothing
|
|
370
367
|
* @param {import('express').Request} req
|
|
371
|
-
* @param {Journey} journey
|
|
372
|
-
* @param {Section} sectionObj
|
|
368
|
+
* @param {import('../journey/journey.js').Journey} journey
|
|
369
|
+
* @param {import('../section.js').Section} sectionObj
|
|
373
370
|
* @returns {QuestionViewModel | undefined} returns the view model for displaying the error or undefined if there are no errors
|
|
374
371
|
*/ //eslint-disable-next-line no-unused-vars
|
|
375
372
|
checkForSavingErrors(req, sectionObj, journey) {
|
|
@@ -380,7 +377,7 @@ export class Question {
|
|
|
380
377
|
* Handles redirect after saving. Kept around for backwards compatibility.
|
|
381
378
|
*
|
|
382
379
|
* @param {import('express').Response} res
|
|
383
|
-
* @param {Journey} journey
|
|
380
|
+
* @param {import('../journey/journey.js').Journey} journey
|
|
384
381
|
* @param {string} sectionSegment
|
|
385
382
|
* @param {string} questionSegment
|
|
386
383
|
* @returns {void}
|
|
@@ -396,7 +393,7 @@ export class Question {
|
|
|
396
393
|
/**
|
|
397
394
|
* returns the formatted answers values to be used to build task list elements
|
|
398
395
|
* @param {String} sectionSegment
|
|
399
|
-
* @param {Journey} journey
|
|
396
|
+
* @param {import('../journey/journey.js').Journey} journey
|
|
400
397
|
* @param {Object} answer
|
|
401
398
|
* @returns {Array<{
|
|
402
399
|
* key: string;
|
|
@@ -420,7 +417,7 @@ export class Question {
|
|
|
420
417
|
/**
|
|
421
418
|
* Returns the action link for the question
|
|
422
419
|
* @param {Object} answer
|
|
423
|
-
* @param {Journey} journey
|
|
420
|
+
* @param {import('../journey/journey.js').Journey} journey
|
|
424
421
|
* @param {String} sectionSegment
|
|
425
422
|
* @returns {ActionView|ActionView[]|undefined}
|
|
426
423
|
*/
|
|
@@ -475,7 +472,7 @@ export class Question {
|
|
|
475
472
|
}
|
|
476
473
|
|
|
477
474
|
/**
|
|
478
|
-
* @param {JourneyResponse} journeyResponse
|
|
475
|
+
* @param {import('../journey/journey-response.js').JourneyResponse} journeyResponse
|
|
479
476
|
* @param {string} [fieldName] optional fieldname for multi field input questions
|
|
480
477
|
* @returns {boolean}
|
|
481
478
|
*/
|
|
@@ -3,10 +3,6 @@ import { body } from 'express-validator';
|
|
|
3
3
|
import BaseValidator from './base-validator.js';
|
|
4
4
|
import { toArray } from '#src/lib/utils.js';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* @typedef {import('../questions/options-question.js')} OptionsQuestion
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
6
|
/**
|
|
11
7
|
* enforces a field is within the question's predefined list of options
|
|
12
8
|
* @class
|
|
@@ -28,7 +24,7 @@ export class ValidOptionValidator extends BaseValidator {
|
|
|
28
24
|
|
|
29
25
|
/**
|
|
30
26
|
* validates the response body, checking the value sent for the questionObj's fieldname is within the predefined list of options
|
|
31
|
-
* @param {
|
|
27
|
+
* @param {import('../questions/options-question.js').default} questionObj
|
|
32
28
|
*/
|
|
33
29
|
validate(questionObj) {
|
|
34
30
|
return body(questionObj.fieldName)
|
package/tsconfig.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"include": ["**/*.ts", "**/*.js"],
|
|
3
|
-
"exclude": ["node_modules", "packages/database/src/client/**", "**/*.test.ts", "test/**"],
|
|
3
|
+
"exclude": ["node_modules", "packages/database/src/client/**", "**/*.test.ts", "**/*.test.js", "test/**"],
|
|
4
4
|
"compilerOptions": {
|
|
5
5
|
"allowImportingTsExtensions": true,
|
|
6
6
|
"allowJs": true,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commitlint.config.d.ts","sourceRoot":"","sources":["../commitlint.config.js"],"names":[],"mappings":""}
|
package/types/eslint.config.d.ts
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
declare const _default: ({
|
|
2
|
-
readonly rules: Readonly<import("eslint").Linter.RulesRecord>;
|
|
3
|
-
} | {
|
|
4
|
-
ignores: string[];
|
|
5
|
-
languageOptions: {
|
|
6
|
-
ecmaVersion: number;
|
|
7
|
-
sourceType: string;
|
|
8
|
-
globals: {
|
|
9
|
-
__dirname: false;
|
|
10
|
-
__filename: false;
|
|
11
|
-
AbortController: false;
|
|
12
|
-
AbortSignal: false;
|
|
13
|
-
AsyncDisposableStack: false;
|
|
14
|
-
atob: false;
|
|
15
|
-
Blob: false;
|
|
16
|
-
BroadcastChannel: false;
|
|
17
|
-
btoa: false;
|
|
18
|
-
Buffer: false;
|
|
19
|
-
ByteLengthQueuingStrategy: false;
|
|
20
|
-
clearImmediate: false;
|
|
21
|
-
clearInterval: false;
|
|
22
|
-
clearTimeout: false;
|
|
23
|
-
CloseEvent: false;
|
|
24
|
-
CompressionStream: false;
|
|
25
|
-
console: false;
|
|
26
|
-
CountQueuingStrategy: false;
|
|
27
|
-
crypto: false;
|
|
28
|
-
Crypto: false;
|
|
29
|
-
CryptoKey: false;
|
|
30
|
-
CustomEvent: false;
|
|
31
|
-
DecompressionStream: false;
|
|
32
|
-
DisposableStack: false;
|
|
33
|
-
DOMException: false;
|
|
34
|
-
ErrorEvent: false;
|
|
35
|
-
Event: false;
|
|
36
|
-
EventTarget: false;
|
|
37
|
-
exports: true;
|
|
38
|
-
fetch: false;
|
|
39
|
-
File: false;
|
|
40
|
-
FormData: false;
|
|
41
|
-
global: false;
|
|
42
|
-
Headers: false;
|
|
43
|
-
localStorage: false;
|
|
44
|
-
MessageChannel: false;
|
|
45
|
-
MessageEvent: false;
|
|
46
|
-
MessagePort: false;
|
|
47
|
-
module: false;
|
|
48
|
-
navigator: false;
|
|
49
|
-
Navigator: false;
|
|
50
|
-
performance: false;
|
|
51
|
-
Performance: false;
|
|
52
|
-
PerformanceEntry: false;
|
|
53
|
-
PerformanceMark: false;
|
|
54
|
-
PerformanceMeasure: false;
|
|
55
|
-
PerformanceObserver: false;
|
|
56
|
-
PerformanceObserverEntryList: false;
|
|
57
|
-
PerformanceResourceTiming: false;
|
|
58
|
-
process: false;
|
|
59
|
-
queueMicrotask: false;
|
|
60
|
-
ReadableByteStreamController: false;
|
|
61
|
-
ReadableStream: false;
|
|
62
|
-
ReadableStreamBYOBReader: false;
|
|
63
|
-
ReadableStreamBYOBRequest: false;
|
|
64
|
-
ReadableStreamDefaultController: false;
|
|
65
|
-
ReadableStreamDefaultReader: false;
|
|
66
|
-
Request: false;
|
|
67
|
-
require: false;
|
|
68
|
-
Response: false;
|
|
69
|
-
sessionStorage: false;
|
|
70
|
-
setImmediate: false;
|
|
71
|
-
setInterval: false;
|
|
72
|
-
setTimeout: false;
|
|
73
|
-
Storage: false;
|
|
74
|
-
structuredClone: false;
|
|
75
|
-
SubtleCrypto: false;
|
|
76
|
-
SuppressedError: false;
|
|
77
|
-
TextDecoder: false;
|
|
78
|
-
TextDecoderStream: false;
|
|
79
|
-
TextEncoder: false;
|
|
80
|
-
TextEncoderStream: false;
|
|
81
|
-
TransformStream: false;
|
|
82
|
-
TransformStreamDefaultController: false;
|
|
83
|
-
URL: false;
|
|
84
|
-
URLPattern: false;
|
|
85
|
-
URLSearchParams: false;
|
|
86
|
-
WebAssembly: false;
|
|
87
|
-
WebSocket: false;
|
|
88
|
-
WritableStream: false;
|
|
89
|
-
WritableStreamDefaultController: false;
|
|
90
|
-
WritableStreamDefaultWriter: false;
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
})[];
|
|
94
|
-
export default _default;
|
|
95
|
-
//# sourceMappingURL=eslint.config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"eslint.config.d.ts","sourceRoot":"","sources":["../eslint.config.js"],"names":[],"mappings":""}
|
package/types/move-types.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"move-types.d.ts","sourceRoot":"","sources":["../move-types.js"],"names":[],"mappings":""}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export class AddressQuestion extends Question {
|
|
2
|
-
/**
|
|
3
|
-
* @param {import('#question-types').QuestionParameters} params
|
|
4
|
-
*/
|
|
5
|
-
constructor(params: import("#question-types").QuestionParameters);
|
|
6
|
-
requiredFields: {
|
|
7
|
-
addressLine1: boolean;
|
|
8
|
-
addressLine2: boolean;
|
|
9
|
-
townCity: boolean;
|
|
10
|
-
county: boolean;
|
|
11
|
-
postcode: boolean;
|
|
12
|
-
} | undefined;
|
|
13
|
-
addressLabels: {
|
|
14
|
-
addressLine1: string;
|
|
15
|
-
addressLine2: string;
|
|
16
|
-
townCity: string;
|
|
17
|
-
county: string;
|
|
18
|
-
postcode: string;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* @param {Record<string, any>} answers
|
|
22
|
-
* @returns {*|string}
|
|
23
|
-
*/
|
|
24
|
-
answerForViewModel(answers: Record<string, any>): any | string;
|
|
25
|
-
/**
|
|
26
|
-
* @param {Object<string, any>} answer
|
|
27
|
-
* @returns The formatted address to be presented in the UI
|
|
28
|
-
*/
|
|
29
|
-
format(answer: {
|
|
30
|
-
[x: string]: any;
|
|
31
|
-
}): string;
|
|
32
|
-
formatLabelFromRequiredFields(fieldName: any): "" | " (optional)";
|
|
33
|
-
}
|
|
34
|
-
export default AddressQuestion;
|
|
35
|
-
import { Question } from '#question';
|
|
36
|
-
//# sourceMappingURL=question.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/address/question.js"],"names":[],"mappings":"AAOA;IACC;;OAEG;IACH,oBAFW,OAAO,iBAAiB,EAAE,kBAAkB,EAqBtD;IAXE;;;;;;kBAA8C;IAIhD;;;;;;MAMC;IAGF;;;OAGG;IACH,4BAHW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACjB,GAAC,GAAC,MAAM,CAqBpB;IAqCD;;;OAGG;IACH;;eAUC;IAuBD,kEAMC;CACD;;yBAxIwB,WAAW"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"question.test.d.ts","sourceRoot":"","sources":["../../../../src/components/address/question.test.js"],"names":[],"mappings":""}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
export const BOOLEAN_OPTIONS: Readonly<{
|
|
2
|
-
YES: "yes";
|
|
3
|
-
NO: "no";
|
|
4
|
-
}>;
|
|
5
|
-
export function yesNoToBoolean(value: string | any): boolean;
|
|
6
|
-
export function booleanToYesNoValue(value: any): "yes" | "no";
|
|
7
|
-
export function booleanToYesNoOrNull(value: boolean | null): string | null;
|
|
8
|
-
export class BooleanQuestion extends RadioQuestion {
|
|
9
|
-
/**
|
|
10
|
-
* @param {Object} params
|
|
11
|
-
* @param {string} params.title
|
|
12
|
-
* @param {string} params.question
|
|
13
|
-
* @param {string} params.fieldName
|
|
14
|
-
* @param {string} [params.url]
|
|
15
|
-
* @param {string} [params.hint]
|
|
16
|
-
* @param {string} [params.pageTitle]
|
|
17
|
-
* @param {string} [params.description]
|
|
18
|
-
* @param {string} [params.html]
|
|
19
|
-
* @param {string} [params.interfaceType]
|
|
20
|
-
* @param {Array.<import('../../questions/options-question.js').Option>} [params.options]
|
|
21
|
-
* @param {Array.<import('#base-validator').BaseValidator>} [params.validators]
|
|
22
|
-
* @param {boolean} [params.editable]
|
|
23
|
-
* @param {import('#question-types').QuestionParameters['viewData']} [params.viewData]
|
|
24
|
-
*/
|
|
25
|
-
constructor({ title, question, fieldName, url, hint, pageTitle, description, html, validators, interfaceType, options, editable, viewData }: {
|
|
26
|
-
title: string;
|
|
27
|
-
question: string;
|
|
28
|
-
fieldName: string;
|
|
29
|
-
url?: string | undefined;
|
|
30
|
-
hint?: string | undefined;
|
|
31
|
-
pageTitle?: string | undefined;
|
|
32
|
-
description?: string | undefined;
|
|
33
|
-
html?: string | undefined;
|
|
34
|
-
interfaceType?: string | undefined;
|
|
35
|
-
options?: import("../../questions/options-question.js").Option[] | undefined;
|
|
36
|
-
validators?: import("#base-validator").BaseValidator[] | undefined;
|
|
37
|
-
editable?: boolean | undefined;
|
|
38
|
-
viewData?: import("#question-types").QuestionParameters["viewData"];
|
|
39
|
-
});
|
|
40
|
-
interfaceType: string;
|
|
41
|
-
/**
|
|
42
|
-
* Get the data to save from the request, returns an object of answers
|
|
43
|
-
* @param {import('express').Request} req
|
|
44
|
-
* @param {JourneyResponse} journeyResponse - current journey response, modified with the new answers
|
|
45
|
-
* @returns {Promise.<Object>}
|
|
46
|
-
*/ getDataToSave(req: import("express").Request, journeyResponse: JourneyResponse): Promise<Object>;
|
|
47
|
-
}
|
|
48
|
-
export default BooleanQuestion;
|
|
49
|
-
import RadioQuestion from '../radio/question.js';
|
|
50
|
-
//# sourceMappingURL=question.d.ts.map
|