@planning-inspectorate/dynamic-forms 3.3.4 → 3.4.0
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/.azure/pipelines/azure-pipelines-pr.yml +4 -0
- package/.azure/pipelines/release.yml +4 -0
- package/README.md +20 -9
- package/package.json +9 -3
- package/src/components/address/question.js +1 -10
- package/src/components/boolean/question.js +1 -1
- package/src/components/checkbox/question.js +2 -6
- package/src/components/date/question.js +1 -8
- package/src/components/date-period/question.js +1 -8
- package/src/components/email/question.js +4 -4
- package/src/components/multi-field-input/question.js +3 -3
- package/src/components/multi-field-input/question.test.js +1 -1
- package/src/components/number-entry/question.js +1 -5
- package/src/components/radio/question.js +1 -1
- package/src/components/select/question.js +1 -1
- package/src/components/single-line-input/question.js +0 -8
- package/src/components/text-entry/question.js +4 -4
- package/src/components/text-entry-redact/question.js +6 -16
- package/src/components/unit-option-entry/question.js +4 -11
- package/src/components/utils/component-types.js +18 -0
- package/src/index.js +72 -25
- package/src/middleware/redirect-to-unanswered-question.test.js +1 -1
- package/src/questions/options-question.js +5 -12
- package/src/questions/question-types.d.ts +3 -3
- package/src/questions/question.js +6 -6
- package/src/questions/questions.js +1 -1
- package/tsconfig.json +9 -1
- package/types/commitlint.config.d.ts +7 -0
- package/types/commitlint.config.d.ts.map +1 -0
- package/types/eslint.config.d.ts +95 -0
- package/types/eslint.config.d.ts.map +1 -0
- package/types/src/components/address/question.d.ts +31 -0
- package/types/src/components/address/question.d.ts.map +1 -0
- package/types/src/components/address/question.test.d.ts +2 -0
- package/types/src/components/address/question.test.d.ts.map +1 -0
- package/types/src/components/boolean/question.d.ts +47 -0
- package/types/src/components/boolean/question.d.ts.map +1 -0
- package/types/src/components/boolean/question.test.d.ts +2 -0
- package/types/src/components/boolean/question.test.d.ts.map +1 -0
- package/types/src/components/checkbox/question.d.ts +49 -0
- package/types/src/components/checkbox/question.d.ts.map +1 -0
- package/types/src/components/checkbox/question.test.d.ts +2 -0
- package/types/src/components/checkbox/question.test.d.ts.map +1 -0
- package/types/src/components/date/question.d.ts +22 -0
- package/types/src/components/date/question.d.ts.map +1 -0
- package/types/src/components/date/question.test.d.ts +2 -0
- package/types/src/components/date/question.test.d.ts.map +1 -0
- package/types/src/components/date-period/question.d.ts +29 -0
- package/types/src/components/date-period/question.d.ts.map +1 -0
- package/types/src/components/date-period/question.test.d.ts +2 -0
- package/types/src/components/date-period/question.test.d.ts.map +1 -0
- package/types/src/components/date-time/question.d.ts +24 -0
- package/types/src/components/date-time/question.d.ts.map +1 -0
- package/types/src/components/date-time/question.test.d.ts +2 -0
- package/types/src/components/date-time/question.test.d.ts.map +1 -0
- package/types/src/components/email/question.d.ts +30 -0
- package/types/src/components/email/question.d.ts.map +1 -0
- package/types/src/components/email/question.test.d.ts +2 -0
- package/types/src/components/email/question.test.d.ts.map +1 -0
- package/types/src/components/identifier/question.d.ts +15 -0
- package/types/src/components/identifier/question.d.ts.map +1 -0
- package/types/src/components/identifier/question.test.d.ts +2 -0
- package/types/src/components/identifier/question.test.d.ts.map +1 -0
- package/types/src/components/manage-list/manage-list-section.d.ts +16 -0
- package/types/src/components/manage-list/manage-list-section.d.ts.map +1 -0
- package/types/src/components/manage-list/manage-list-section.test.d.ts +2 -0
- package/types/src/components/manage-list/manage-list-section.test.d.ts.map +1 -0
- package/types/src/components/manage-list/question.d.ts +41 -0
- package/types/src/components/manage-list/question.d.ts.map +1 -0
- package/types/src/components/manage-list/question.test.d.ts +2 -0
- package/types/src/components/manage-list/question.test.d.ts.map +1 -0
- package/types/src/components/manage-list/utils.d.ts +18 -0
- package/types/src/components/manage-list/utils.d.ts.map +1 -0
- package/types/src/components/manage-list/utils.test.d.ts +2 -0
- package/types/src/components/manage-list/utils.test.d.ts.map +1 -0
- package/types/src/components/multi-field-input/question.d.ts +106 -0
- package/types/src/components/multi-field-input/question.d.ts.map +1 -0
- package/types/src/components/multi-field-input/question.test.d.ts +2 -0
- package/types/src/components/multi-field-input/question.test.d.ts.map +1 -0
- package/types/src/components/number-entry/question.d.ts +37 -0
- package/types/src/components/number-entry/question.d.ts.map +1 -0
- package/types/src/components/radio/question.d.ts +53 -0
- package/types/src/components/radio/question.d.ts.map +1 -0
- package/types/src/components/radio/question.test.d.ts +2 -0
- package/types/src/components/radio/question.test.d.ts.map +1 -0
- package/types/src/components/select/question.d.ts +51 -0
- package/types/src/components/select/question.d.ts.map +1 -0
- package/types/src/components/select/question.test.d.ts +2 -0
- package/types/src/components/select/question.test.d.ts.map +1 -0
- package/types/src/components/single-line-input/question.d.ts +18 -0
- package/types/src/components/single-line-input/question.d.ts.map +1 -0
- package/types/src/components/single-line-input/question.test.d.ts +2 -0
- package/types/src/components/single-line-input/question.test.d.ts.map +1 -0
- package/types/src/components/text-entry/question.d.ts +34 -0
- package/types/src/components/text-entry/question.d.ts.map +1 -0
- package/types/src/components/text-entry/question.test.d.ts +2 -0
- package/types/src/components/text-entry/question.test.d.ts.map +1 -0
- package/types/src/components/text-entry-redact/question.d.ts +42 -0
- package/types/src/components/text-entry-redact/question.d.ts.map +1 -0
- package/types/src/components/text-entry-redact/question.test.d.ts +2 -0
- package/types/src/components/text-entry-redact/question.test.d.ts.map +1 -0
- package/types/src/components/unit-option-entry/question.d.ts +83 -0
- package/types/src/components/unit-option-entry/question.d.ts.map +1 -0
- package/types/src/components/unit-option-entry/question.test.d.ts +2 -0
- package/types/src/components/unit-option-entry/question.test.d.ts.map +1 -0
- package/types/src/components/utils/component-types.d.ts +19 -0
- package/types/src/components/utils/component-types.d.ts.map +1 -0
- package/types/src/components/utils/persisted-number-answer.d.ts +2 -0
- package/types/src/components/utils/persisted-number-answer.d.ts.map +1 -0
- package/types/src/components/utils/question-has-answer.d.ts +17 -0
- package/types/src/components/utils/question-has-answer.d.ts.map +1 -0
- package/types/src/components/utils/question-has-answer.test.d.ts +2 -0
- package/types/src/components/utils/question-has-answer.test.d.ts.map +1 -0
- package/types/src/components/utils/question-utils.d.ts +15 -0
- package/types/src/components/utils/question-utils.d.ts.map +1 -0
- package/types/src/components/utils/question-utils.test.d.ts +2 -0
- package/types/src/components/utils/question-utils.test.d.ts.map +1 -0
- package/types/src/controller.d.ts +78 -0
- package/types/src/controller.d.ts.map +1 -0
- package/types/src/controller.test.d.ts +2 -0
- package/types/src/controller.test.d.ts.map +1 -0
- package/types/src/index.d.ts +54 -0
- package/types/src/index.d.ts.map +1 -0
- package/types/src/journey/journey-response.d.ts +32 -0
- package/types/src/journey/journey-response.d.ts.map +1 -0
- package/types/src/journey/journey-response.test.d.ts +2 -0
- package/types/src/journey/journey-response.test.d.ts.map +1 -0
- package/types/src/journey/journey.d.ts +144 -0
- package/types/src/journey/journey.d.ts.map +1 -0
- package/types/src/journey/journey.test.d.ts +2 -0
- package/types/src/journey/journey.test.d.ts.map +1 -0
- package/types/src/lib/address-utils.d.ts +6 -0
- package/types/src/lib/address-utils.d.ts.map +1 -0
- package/types/src/lib/address-utils.test.d.ts +2 -0
- package/types/src/lib/address-utils.test.d.ts.map +1 -0
- package/types/src/lib/address.d.ts +43 -0
- package/types/src/lib/address.d.ts.map +1 -0
- package/types/src/lib/address.test.d.ts +2 -0
- package/types/src/lib/address.test.d.ts.map +1 -0
- package/types/src/lib/date-utils.d.ts +60 -0
- package/types/src/lib/date-utils.d.ts.map +1 -0
- package/types/src/lib/date-utils.test.d.ts +2 -0
- package/types/src/lib/date-utils.test.d.ts.map +1 -0
- package/types/src/lib/session-answer-store.d.ts +84 -0
- package/types/src/lib/session-answer-store.d.ts.map +1 -0
- package/types/src/lib/session-answer-store.test.d.ts +2 -0
- package/types/src/lib/session-answer-store.test.d.ts.map +1 -0
- package/types/src/lib/utils.d.ts +19 -0
- package/types/src/lib/utils.d.ts.map +1 -0
- package/types/src/lib/utils.test.d.ts +2 -0
- package/types/src/lib/utils.test.d.ts.map +1 -0
- package/types/src/lib/uuid.d.ts +7 -0
- package/types/src/lib/uuid.d.ts.map +1 -0
- package/types/src/lib/uuid.test.d.ts +2 -0
- package/types/src/lib/uuid.test.d.ts.map +1 -0
- package/types/src/middleware/build-get-journey.d.ts +6 -0
- package/types/src/middleware/build-get-journey.d.ts.map +1 -0
- package/types/src/middleware/redirect-to-unanswered-question.d.ts +12 -0
- package/types/src/middleware/redirect-to-unanswered-question.d.ts.map +1 -0
- package/types/src/middleware/redirect-to-unanswered-question.test.d.ts +2 -0
- package/types/src/middleware/redirect-to-unanswered-question.test.d.ts.map +1 -0
- package/types/src/questions/create-questions.d.ts +21 -0
- package/types/src/questions/create-questions.d.ts.map +1 -0
- package/types/src/questions/options-question.d.ts +74 -0
- package/types/src/questions/options-question.d.ts.map +1 -0
- package/types/src/questions/options-question.test.d.ts +2 -0
- package/types/src/questions/options-question.test.d.ts.map +1 -0
- package/types/src/questions/question.d.ts +274 -0
- package/types/src/questions/question.d.ts.map +1 -0
- package/types/src/questions/question.test.d.ts +2 -0
- package/types/src/questions/question.test.d.ts.map +1 -0
- package/types/src/questions/questions.d.ts +3 -0
- package/types/src/questions/questions.d.ts.map +1 -0
- package/types/src/section.d.ts +107 -0
- package/types/src/section.d.ts.map +1 -0
- package/types/src/section.test.d.ts +2 -0
- package/types/src/section.test.d.ts.map +1 -0
- package/types/src/validator/address-validator.d.ts +41 -0
- package/types/src/validator/address-validator.d.ts.map +1 -0
- package/types/src/validator/address-validator.test.d.ts +2 -0
- package/types/src/validator/address-validator.test.d.ts.map +1 -0
- package/types/src/validator/base-validator.d.ts +11 -0
- package/types/src/validator/base-validator.d.ts.map +1 -0
- package/types/src/validator/base-validator.test.d.ts +2 -0
- package/types/src/validator/base-validator.test.d.ts.map +1 -0
- package/types/src/validator/conditional-required-validator.d.ts +24 -0
- package/types/src/validator/conditional-required-validator.d.ts.map +1 -0
- package/types/src/validator/conditional-required-validator.test.d.ts +2 -0
- package/types/src/validator/conditional-required-validator.test.d.ts.map +1 -0
- package/types/src/validator/confirmation-checkbox-validator.d.ts +27 -0
- package/types/src/validator/confirmation-checkbox-validator.d.ts.map +1 -0
- package/types/src/validator/confirmation-checkbox-validator.test.d.ts +2 -0
- package/types/src/validator/confirmation-checkbox-validator.test.d.ts.map +1 -0
- package/types/src/validator/coordinates-validator.d.ts +22 -0
- package/types/src/validator/coordinates-validator.d.ts.map +1 -0
- package/types/src/validator/coordinates-validator.test.d.ts +2 -0
- package/types/src/validator/coordinates-validator.test.d.ts.map +1 -0
- package/types/src/validator/date-period-validator.d.ts +63 -0
- package/types/src/validator/date-period-validator.d.ts.map +1 -0
- package/types/src/validator/date-period-validator.test.d.ts +2 -0
- package/types/src/validator/date-period-validator.test.d.ts.map +1 -0
- package/types/src/validator/date-time-validator.d.ts +26 -0
- package/types/src/validator/date-time-validator.d.ts.map +1 -0
- package/types/src/validator/date-time-validator.test.d.ts +2 -0
- package/types/src/validator/date-time-validator.test.d.ts.map +1 -0
- package/types/src/validator/date-validator.d.ts +48 -0
- package/types/src/validator/date-validator.d.ts.map +1 -0
- package/types/src/validator/date-validator.test.d.ts +2 -0
- package/types/src/validator/date-validator.test.d.ts.map +1 -0
- package/types/src/validator/document-upload-validator.d.ts +10 -0
- package/types/src/validator/document-upload-validator.d.ts.map +1 -0
- package/types/src/validator/document-upload-validator.test.d.ts +2 -0
- package/types/src/validator/document-upload-validator.test.d.ts.map +1 -0
- package/types/src/validator/email-validator.d.ts +73 -0
- package/types/src/validator/email-validator.d.ts.map +1 -0
- package/types/src/validator/email-validator.test.d.ts +2 -0
- package/types/src/validator/email-validator.test.d.ts.map +1 -0
- package/types/src/validator/multi-field-input-validator.d.ts +70 -0
- package/types/src/validator/multi-field-input-validator.d.ts.map +1 -0
- package/types/src/validator/multi-field-input-validator.test.d.ts +2 -0
- package/types/src/validator/multi-field-input-validator.test.d.ts.map +1 -0
- package/types/src/validator/numeric-validator.d.ts +49 -0
- package/types/src/validator/numeric-validator.d.ts.map +1 -0
- package/types/src/validator/numeric-validator.test.d.ts +2 -0
- package/types/src/validator/numeric-validator.test.d.ts.map +1 -0
- package/types/src/validator/required-validator.d.ts +22 -0
- package/types/src/validator/required-validator.d.ts.map +1 -0
- package/types/src/validator/required-validator.test.d.ts +2 -0
- package/types/src/validator/required-validator.test.d.ts.map +1 -0
- package/types/src/validator/same-answer-validator.d.ts +18 -0
- package/types/src/validator/same-answer-validator.d.ts.map +1 -0
- package/types/src/validator/same-answer-validator.test.d.ts +2 -0
- package/types/src/validator/same-answer-validator.test.d.ts.map +1 -0
- package/types/src/validator/string-validator.d.ts +58 -0
- package/types/src/validator/string-validator.d.ts.map +1 -0
- package/types/src/validator/string-validator.test.d.ts +2 -0
- package/types/src/validator/string-validator.test.d.ts.map +1 -0
- package/types/src/validator/unit-option-entry-validator.d.ts +40 -0
- package/types/src/validator/unit-option-entry-validator.d.ts.map +1 -0
- package/types/src/validator/unit-option-entry-validator.test.d.ts +2 -0
- package/types/src/validator/unit-option-entry-validator.test.d.ts.map +1 -0
- package/types/src/validator/valid-option-validator.d.ts +22 -0
- package/types/src/validator/valid-option-validator.d.ts.map +1 -0
- package/types/src/validator/valid-option-validator.test.d.ts +2 -0
- package/types/src/validator/valid-option-validator.test.d.ts.map +1 -0
- package/types/src/validator/validation-error-handler.d.ts +20 -0
- package/types/src/validator/validation-error-handler.d.ts.map +1 -0
- package/types/src/validator/validation-error-handler.test.d.ts +2 -0
- package/types/src/validator/validation-error-handler.test.d.ts.map +1 -0
- package/types/src/validator/validator.d.ts +5 -0
- package/types/src/validator/validator.d.ts.map +1 -0
- package/types/src/validator/validator.test.d.ts +2 -0
- package/types/src/validator/validator.test.d.ts.map +1 -0
- package/types/test/mock/journey.d.ts +3 -0
- package/types/test/mock/journey.d.ts.map +1 -0
- package/types/test/mock/uuid.d.ts +7 -0
- package/types/test/mock/uuid.d.ts.map +1 -0
- package/types/test/utils/nunjucks.d.ts +2 -0
- package/types/test/utils/nunjucks.d.ts.map +1 -0
- package/types/test/utils/utils.d.ts +32 -0
- package/types/test/utils/utils.d.ts.map +1 -0
- package/src/lib/address.d.ts +0 -7
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {object} [viewData]
|
|
3
|
+
* @returns {import('express').Handler}
|
|
4
|
+
*/
|
|
5
|
+
export function buildList(viewData?: object): any;
|
|
6
|
+
/**
|
|
7
|
+
* @param {import('express').Request} req
|
|
8
|
+
* @param {import('express').Response} res
|
|
9
|
+
* @param {string} pageCaption
|
|
10
|
+
* @param {object} viewData
|
|
11
|
+
*/
|
|
12
|
+
export function list(req: any, res: any, pageCaption: string, viewData: object): Promise<any>;
|
|
13
|
+
/**
|
|
14
|
+
* Render an individual question
|
|
15
|
+
*
|
|
16
|
+
* @type {import('express').Handler}
|
|
17
|
+
*/
|
|
18
|
+
export function question(req: any, res: any): Promise<any>;
|
|
19
|
+
/**
|
|
20
|
+
* @typedef {Object} SaveParams
|
|
21
|
+
* @property {import('express').Request} req
|
|
22
|
+
* @property {import('express').Response} res
|
|
23
|
+
* @property {string} journeyId
|
|
24
|
+
* @property {string} referenceId
|
|
25
|
+
* @property {boolean} isManageListItem
|
|
26
|
+
* @property {string} [manageListQuestionFieldName]
|
|
27
|
+
* @property {Object<string, any>} data
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* @typedef {(params: SaveParams) => Promise<void>} SaveDataFn
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* @param {SaveDataFn} saveData
|
|
34
|
+
* @param {boolean} [redirectToTaskListOnSuccess] - optionally redirect to the task list after save instead of next question
|
|
35
|
+
* @returns {import('express').Handler}
|
|
36
|
+
*/
|
|
37
|
+
export function buildSave(saveData: SaveDataFn, redirectToTaskListOnSuccess?: boolean): any;
|
|
38
|
+
export type Journey = import("./journey/journey.js").Journey;
|
|
39
|
+
export type Question = import("./questions/question.js").Question;
|
|
40
|
+
export type Section = any;
|
|
41
|
+
export type SectionView = {
|
|
42
|
+
heading: string;
|
|
43
|
+
status: string;
|
|
44
|
+
list: {
|
|
45
|
+
rows: Array<RowView>;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export type RowView = {
|
|
49
|
+
key: {
|
|
50
|
+
text: string;
|
|
51
|
+
};
|
|
52
|
+
value: {
|
|
53
|
+
text: string;
|
|
54
|
+
} | {
|
|
55
|
+
html: string;
|
|
56
|
+
};
|
|
57
|
+
actions?: {
|
|
58
|
+
items: ActionView[];
|
|
59
|
+
} | undefined;
|
|
60
|
+
};
|
|
61
|
+
export type ActionView = {
|
|
62
|
+
href: string;
|
|
63
|
+
text: string;
|
|
64
|
+
visuallyHiddenText?: string | undefined;
|
|
65
|
+
};
|
|
66
|
+
export type SaveParams = {
|
|
67
|
+
req: any;
|
|
68
|
+
res: any;
|
|
69
|
+
journeyId: string;
|
|
70
|
+
referenceId: string;
|
|
71
|
+
isManageListItem: boolean;
|
|
72
|
+
manageListQuestionFieldName?: string | undefined;
|
|
73
|
+
data: {
|
|
74
|
+
[x: string]: any;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
export type SaveDataFn = (params: SaveParams) => Promise<void>;
|
|
78
|
+
//# sourceMappingURL=controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/controller.js"],"names":[],"mappings":"AAsEA;;;GAGG;AACH,qCAHW,MAAM,OAKhB;AAED;;;;;GAKG;AACH,sDAHW,MAAM,YACN,MAAM,gBA8DhB;AAED;;;;GAIG;AACH,2DA6BC;AAED;;;;;;;;;GASG;AAEH;;GAEG;AAEH;;;;GAIG;AACH,oCAJW,UAAU,gCACV,OAAO,OAsFjB;sBAvRY,OAAO,sBAAsB,EAAE,OAAO;uBACtC,OAAO,yBAAyB,EAAE,QAAQ;;;aAMzC,MAAM;YACN,MAAM;UAEjB;QAAiC,IAAI,EAA1B,KAAK,CAAE,OAAO,CAAC;KAC5B;;;SAIa;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;WAChB;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;;eAC1B,UAAU,EAAE;;;;UAKrB,MAAM;UACN,MAAM;;;;;;eA6JN,MAAM;iBACN,MAAM;sBACN,OAAO;;;;;;yBAMR,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller.test.d.ts","sourceRoot":"","sources":["../../src/controller.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export * from "./components/boolean/question.js";
|
|
2
|
+
export * from "./components/checkbox/question.js";
|
|
3
|
+
export * from "./components/date/question.js";
|
|
4
|
+
export * from "./components/date-period/question.js";
|
|
5
|
+
export * from "./components/multi-field-input/question.js";
|
|
6
|
+
export * from "./components/number-entry/question.js";
|
|
7
|
+
export * from "./components/radio/question.js";
|
|
8
|
+
export * from "./components/select/question.js";
|
|
9
|
+
export * from "./components/single-line-input/question.js";
|
|
10
|
+
export * from "./components/text-entry/question.js";
|
|
11
|
+
export * from "./components/text-entry-redact/question.js";
|
|
12
|
+
export * from "./components/unit-option-entry/question.js";
|
|
13
|
+
export * from "./components/utils/persisted-number-answer.js";
|
|
14
|
+
export * from "./components/utils/question-has-answer.js";
|
|
15
|
+
export * from "./components/utils/question-utils.js";
|
|
16
|
+
export * from "./components/utils/component-types.js";
|
|
17
|
+
export * from "./controller.js";
|
|
18
|
+
export * from "./lib/address.js";
|
|
19
|
+
export * from "./lib/address-utils.js";
|
|
20
|
+
export * from "./lib/date-utils.js";
|
|
21
|
+
export * from "./lib/session-answer-store.js";
|
|
22
|
+
export * from "./lib/utils.js";
|
|
23
|
+
export * from "./middleware/build-get-journey.js";
|
|
24
|
+
export * from "./middleware/redirect-to-unanswered-question.js";
|
|
25
|
+
export * from "./questions/options-question.js";
|
|
26
|
+
export * from "./validator/address-validator.js";
|
|
27
|
+
export * from "./validator/base-validator.js";
|
|
28
|
+
export * from "./validator/conditional-required-validator.js";
|
|
29
|
+
export * from "./validator/confirmation-checkbox-validator.js";
|
|
30
|
+
export * from "./validator/coordinates-validator.js";
|
|
31
|
+
export * from "./validator/date-period-validator.js";
|
|
32
|
+
export * from "./validator/date-time-validator.js";
|
|
33
|
+
export * from "./validator/document-upload-validator.js";
|
|
34
|
+
export * from "./validator/multi-field-input-validator.js";
|
|
35
|
+
export * from "./validator/numeric-validator.js";
|
|
36
|
+
export * from "./validator/same-answer-validator.js";
|
|
37
|
+
export * from "./validator/unit-option-entry-validator.js";
|
|
38
|
+
export * from "./validator/valid-option-validator.js";
|
|
39
|
+
export * from "./validator/validation-error-handler.js";
|
|
40
|
+
export * from "./validator/validator.js";
|
|
41
|
+
export { Journey } from "./journey/journey.js";
|
|
42
|
+
export { JourneyResponse } from "./journey/journey-response.js";
|
|
43
|
+
export { Question } from "./questions/question.js";
|
|
44
|
+
export { createQuestions } from "./questions/create-questions.js";
|
|
45
|
+
export { questionClasses } from "./questions/questions.js";
|
|
46
|
+
export { Section } from "./section.js";
|
|
47
|
+
export { default as RequiredValidator } from "./validator/required-validator.js";
|
|
48
|
+
export { default as validate } from "./validator/validator.js";
|
|
49
|
+
import AddressQuestion from './components/address/question.js';
|
|
50
|
+
import DateValidator from './validator/date-validator.js';
|
|
51
|
+
import EmailValidator from './validator/email-validator.js';
|
|
52
|
+
import StringValidator from './validator/string-validator.js';
|
|
53
|
+
export { AddressQuestion, DateValidator, EmailValidator, StringValidator };
|
|
54
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAC4B,kCAAkC;0BACpC,+BAA+B;2BAC9B,gCAAgC;4BAC/B,iCAAiC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('./journey-factory').JourneyType} JourneyType
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Defines a response to a journey, a set of Answers to the questions
|
|
6
|
+
* @class
|
|
7
|
+
*/
|
|
8
|
+
export class JourneyResponse {
|
|
9
|
+
/**
|
|
10
|
+
* creates an instance of a JourneyResponse
|
|
11
|
+
* @param {JourneyType} journeyId
|
|
12
|
+
* @param {string} referenceId
|
|
13
|
+
* @param {import('./journey-types.d.ts').JourneyAnswers | null} answers
|
|
14
|
+
* @param {string} [lpaCode]
|
|
15
|
+
*/
|
|
16
|
+
constructor(journeyId: JourneyType, referenceId: string, answers: import("./journey-types.d.ts").JourneyAnswers | null, lpaCode?: string);
|
|
17
|
+
/**
|
|
18
|
+
* @type {string} - reference id used in the url for the journey e.g. appeal id - provides a unique lookup for responses in combination with formId
|
|
19
|
+
*/
|
|
20
|
+
referenceId: string;
|
|
21
|
+
/**
|
|
22
|
+
* @type {JourneyType} - a reference to the journey type e.g. has-questionnaire - provides a unique lookup for responses in combination with referenceId
|
|
23
|
+
*/
|
|
24
|
+
journeyId: JourneyType;
|
|
25
|
+
/**
|
|
26
|
+
* @type {import('./journey-types.d.ts').JourneyAnswers} - answers to the journey
|
|
27
|
+
*/
|
|
28
|
+
answers: import("./journey-types.d.ts").JourneyAnswers;
|
|
29
|
+
LPACode: string | undefined;
|
|
30
|
+
}
|
|
31
|
+
export type JourneyType = any;
|
|
32
|
+
//# sourceMappingURL=journey-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"journey-response.d.ts","sourceRoot":"","sources":["../../../src/journey/journey-response.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH;IAgBC;;;;;;OAMG;IACH,uBALW,WAAW,eACX,MAAM,WACN,OAAO,sBAAsB,EAAE,cAAc,GAAG,IAAI,YACpD,MAAM,EAWhB;IA/BD;;OAEG;IACH,aAFU,MAAM,CAEJ;IAEZ;;OAEG;IACH,WAFU,WAAW,CAEX;IAEV;;OAEG;IACH,SAFU,OAAO,sBAAsB,EAAE,cAAc,CAE/C;IAiBP,4BAAsB;CAEvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"journey-response.test.d.ts","sourceRoot":"","sources":["../../../src/journey/journey-response.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('./journey-response').JourneyResponse} JourneyResponse
|
|
3
|
+
* @typedef {import('../section').Section} Section
|
|
4
|
+
* @typedef {import('../questions/question').Question} Question
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* A journey (An entire set of questions required for a completion of a submission)
|
|
8
|
+
* @class
|
|
9
|
+
*/
|
|
10
|
+
export class Journey {
|
|
11
|
+
/**
|
|
12
|
+
* creates an instance of a journey
|
|
13
|
+
* @param {object} options
|
|
14
|
+
* @param {string} options.journeyId - a unique, human-readable id for this journey
|
|
15
|
+
* @param {(response: JourneyResponse) => string} options.makeBaseUrl - base url of journey
|
|
16
|
+
* @param {string} [options.taskListUrl] - task list url - added to base url, can be left undefined
|
|
17
|
+
* @param {JourneyResponse} options.response - user's response
|
|
18
|
+
* @param {string} options.journeyTemplate - template used for all views
|
|
19
|
+
* @param {string} options.taskListTemplate - path to njk view for listing page
|
|
20
|
+
* @param {string} [options.informationPageViewPath] - path to njk view for pdf summary page
|
|
21
|
+
* @param {string} options.journeyTitle - part of the title in the njk view
|
|
22
|
+
* @param {boolean} [options.returnToListing] - defines how the next/previous question handles end of sections
|
|
23
|
+
* @param {Section[]} options.sections
|
|
24
|
+
* @param {string} [options.initialBackLink] - back link when on the first question
|
|
25
|
+
*/
|
|
26
|
+
constructor({ journeyId, makeBaseUrl, taskListUrl, response, journeyTemplate, taskListTemplate, informationPageViewPath, journeyTitle, returnToListing, sections, initialBackLink }: {
|
|
27
|
+
journeyId: string;
|
|
28
|
+
makeBaseUrl: (response: JourneyResponse) => string;
|
|
29
|
+
taskListUrl?: string | undefined;
|
|
30
|
+
response: JourneyResponse;
|
|
31
|
+
journeyTemplate: string;
|
|
32
|
+
taskListTemplate: string;
|
|
33
|
+
informationPageViewPath?: string | undefined;
|
|
34
|
+
journeyTitle: string;
|
|
35
|
+
returnToListing?: boolean | undefined;
|
|
36
|
+
sections: Section[];
|
|
37
|
+
initialBackLink?: string | undefined;
|
|
38
|
+
});
|
|
39
|
+
/** @type {string} journeyId - a unique, human-readable id for this journey */
|
|
40
|
+
journeyId: string;
|
|
41
|
+
/** @type {Array.<Section>} sections - sections within the journey */
|
|
42
|
+
sections: Array<Section>;
|
|
43
|
+
/** @type {JourneyResponse} response - the user's response to the journey so far */
|
|
44
|
+
response: JourneyResponse;
|
|
45
|
+
/** @type {string} baseUrl - base url of the journey, gets prepended to question urls */
|
|
46
|
+
baseUrl: string;
|
|
47
|
+
/** @type {(journeyResponse: JourneyResponse) => string} baseUrl - base url of the journey, gets prepended to question urls */
|
|
48
|
+
makeBaseUrl: (journeyResponse: JourneyResponse) => string;
|
|
49
|
+
/** @type {string} taskListUrl - url that renders the task list */
|
|
50
|
+
taskListUrl: string;
|
|
51
|
+
/** @type {string} journeyTemplate - nunjucks template file used for */
|
|
52
|
+
journeyTemplate: string;
|
|
53
|
+
/** @type {string} taskListTemplate - nunjucks template file used for listing page */
|
|
54
|
+
taskListTemplate: string;
|
|
55
|
+
/** @type {string} informationPageViewPath - nunjucks template file used for pdf summary information page */
|
|
56
|
+
informationPageViewPath: string;
|
|
57
|
+
/** @type {boolean} defines how the next/previous question handles end of sections */
|
|
58
|
+
returnToListing: boolean;
|
|
59
|
+
/**@type {string} used as part of the overall page title */
|
|
60
|
+
journeyTitle: string;
|
|
61
|
+
initialBackLink: string | null;
|
|
62
|
+
/**
|
|
63
|
+
* Gets section based on segment
|
|
64
|
+
* @param {string} sectionSegment
|
|
65
|
+
* @returns {Section | undefined}
|
|
66
|
+
*/
|
|
67
|
+
getSection(sectionSegment: string): Section | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* gets a question from the object's sections based on a section + question names
|
|
70
|
+
* @param {import('./journey-types.d.ts').RouteParams} params
|
|
71
|
+
* @returns {Question | undefined} question found by lookup
|
|
72
|
+
*/
|
|
73
|
+
getQuestionByParams(params: import("./journey-types.d.ts").RouteParams): Question | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Get the back link for the journey - e.g. the previous question
|
|
76
|
+
*
|
|
77
|
+
* @param {Object} options
|
|
78
|
+
* @param {import('./journey-types.d.ts').RouteParams} options.params
|
|
79
|
+
* @param {import('#src/components/manage-list/question.js')} [options.manageListQuestion]
|
|
80
|
+
* @returns {string|null} url for the next question, or null if unmatched
|
|
81
|
+
*/
|
|
82
|
+
getBackLink({ params, manageListQuestion }: {
|
|
83
|
+
params: import("./journey-types.d.ts").RouteParams;
|
|
84
|
+
manageListQuestion?: typeof import("#src/components/manage-list/question.js") | undefined;
|
|
85
|
+
}): string | null;
|
|
86
|
+
/**
|
|
87
|
+
* Handles redirect to the next question in the journey
|
|
88
|
+
* Used after question post/saving
|
|
89
|
+
*
|
|
90
|
+
* @param {import('express').Response} res
|
|
91
|
+
* @param {import('./journey-types.d.ts').RouteParams} params
|
|
92
|
+
* @param {import('#src/components/manage-list/question.js')} [manageListQuestion]
|
|
93
|
+
* @returns {void}
|
|
94
|
+
*/
|
|
95
|
+
redirectToNextQuestion(res: any, params: import("./journey-types.d.ts").RouteParams, manageListQuestion?: typeof import("#src/components/manage-list/question.js")): void;
|
|
96
|
+
/**
|
|
97
|
+
* Get url for the next question in the journey
|
|
98
|
+
*
|
|
99
|
+
* @param {import('./journey-types.d.ts').RouteParams} params
|
|
100
|
+
* @param {Object} options
|
|
101
|
+
* @param {boolean} [options.reverse] - if passed in this will get the previous question
|
|
102
|
+
* @param {import('#src/components/manage-list/question.js')} [options.manageListQuestion]
|
|
103
|
+
* @returns {string|null} url for the next question, or null if unmatched
|
|
104
|
+
*/
|
|
105
|
+
getNextQuestionUrl(params: import("./journey-types.d.ts").RouteParams, { reverse, manageListQuestion }?: {
|
|
106
|
+
reverse?: boolean | undefined;
|
|
107
|
+
manageListQuestion?: typeof import("#src/components/manage-list/question.js") | undefined;
|
|
108
|
+
}): string | null;
|
|
109
|
+
/**
|
|
110
|
+
* Gets the url for the current question
|
|
111
|
+
* @param {string} sectionSegment - section segment name
|
|
112
|
+
* @param {string} questionSegment - question segment name
|
|
113
|
+
* @returns {string} url for the current question
|
|
114
|
+
*/
|
|
115
|
+
getCurrentQuestionUrl: (sectionSegment: string, questionSegment: string) => string;
|
|
116
|
+
/**
|
|
117
|
+
* Gets the url for the current question
|
|
118
|
+
* @param {string} questionSegment - question segment name
|
|
119
|
+
* @returns {string} url for the current question
|
|
120
|
+
*/
|
|
121
|
+
getCurrentQuestionUrlWithoutSection: (questionSegment: string) => string;
|
|
122
|
+
/**
|
|
123
|
+
* Gets the url for the current question
|
|
124
|
+
* @param {string} sectionSegment - section segment name
|
|
125
|
+
* @param {string} questionSegment - question segment name
|
|
126
|
+
* @param {string} addition - question segment name
|
|
127
|
+
* @returns {string} url for the current question
|
|
128
|
+
*/
|
|
129
|
+
addToCurrentQuestionUrl: (sectionSegment: string, questionSegment: string, addition: string) => string;
|
|
130
|
+
/**
|
|
131
|
+
* Gets the overall completeness status of a journey based on the response associated with it and the complete state of each section.
|
|
132
|
+
* @returns {boolean} Boolean indicating if a journey response is complete
|
|
133
|
+
*/
|
|
134
|
+
isComplete(): boolean;
|
|
135
|
+
/**
|
|
136
|
+
* @param {JourneyResponse} journeyResponse
|
|
137
|
+
*/
|
|
138
|
+
setResponse(journeyResponse: JourneyResponse): void;
|
|
139
|
+
#private;
|
|
140
|
+
}
|
|
141
|
+
export type JourneyResponse = any;
|
|
142
|
+
export type Section = any;
|
|
143
|
+
export type Question = any;
|
|
144
|
+
//# sourceMappingURL=journey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"journey.d.ts","sourceRoot":"","sources":["../../../src/journey/journey.js"],"names":[],"mappings":"AAOA;;;;GAIG;AAEH;;;GAGG;AACH;IAwBC;;;;;;;;;;;;;;OAcG;IACH,qLAZG;QAAwB,SAAS,EAAzB,MAAM;QACyC,WAAW,EAA1D,CAAC,QAAQ,EAAE,eAAe,KAAK,MAAM;QACpB,WAAW;QACH,QAAQ,EAAjC,eAAe;QACC,eAAe,EAA/B,MAAM;QACU,gBAAgB,EAAhC,MAAM;QACW,uBAAuB;QACxB,YAAY,EAA5B,MAAM;QACY,eAAe;QACd,QAAQ,EAA3B,OAAO,EAAE;QACQ,eAAe;KAC1C,EAoDA;IAzFD,8EAA8E;IAC9E,WADW,MAAM,CACP;IACV,qEAAqE;IACrE,UADW,KAAK,CAAE,OAAO,CAAC,CACZ;IACd,mFAAmF;IACnF,UADW,eAAe,CACjB;IACT,wFAAwF;IACxF,SADW,MAAM,CACJ;IACb,8HAA8H;IAC9H,aADW,CAAC,eAAe,EAAE,eAAe,KAAK,MAAM,CAChC;IACvB,kEAAkE;IAClE,aADW,MAAM,CACA;IACjB,uEAAuE;IACvE,iBADW,MAAM,CACI;IACrB,qFAAqF;IACrF,kBADW,MAAM,CACK;IACtB,4GAA4G;IAC5G,yBADW,MAAM,CACY;IAC7B,qFAAqF;IACrF,iBADW,OAAO,CACM;IACxB,2DAA2D;IAC3D,cADU,MAAM,CACH;IAmEZ,+BAA8C;IA2C/C;;;;OAIG;IACH,2BAHW,MAAM,GACJ,OAAO,GAAG,SAAS,CAM/B;IAuBD;;;;OAIG;IACH,4BAHW,OAAO,sBAAsB,EAAE,WAAW,GACxC,QAAQ,GAAG,SAAS,CAiBhC;IAED;;;;;;;OAOG;IACH,4CAJG;QAA4D,MAAM,EAA1D,OAAO,sBAAsB,EAAE,WAAW;QACkB,kBAAkB;KACtF,GAAU,MAAM,GAAC,IAAI,CAWvB;IAED;;;;;;;;OAQG;IACH,yCAJW,OAAO,sBAAsB,EAAE,WAAW,kFAExC,IAAI,CAKhB;IAED;;;;;;;;OAQG;IACH,2BANW,OAAO,sBAAsB,EAAE,WAAW,oCAElD;QAA0B,OAAO;QACmC,kBAAkB;KACtF,GAAU,MAAM,GAAC,IAAI,CA8DvB;IAED;;;;;OAKG;IACH,wBAAyB,gBAJd,MAI4B,EAAE,iBAH9B,MAG6C,KAF3C,MAAM,CAqBjB;IAEF;;;;OAIG;IACH,sCAAuC,iBAH5B,MAG2C,KAFzC,MAAM,CAIjB;IAEF;;;;;;OAMG;IACH,0BAA2B,gBALhB,MAK8B,EAAE,iBAJhC,MAI+C,EAAE,UAHjD,MAGyD,KAFvD,MAAM,CAuBjB;IAEF;;;OAGG;IACH,cAFa,OAAO,CAInB;IAED;;OAEG;IACH,6BAFW,eAAe,QAKzB;;CACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"journey.test.d.ts","sourceRoot":"","sources":["../../../src/journey/journey.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/address-utils.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH,kDAFa,MAAM,CAKlB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address-utils.test.d.ts","sourceRoot":"","sources":["../../../src/lib/address-utils.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines the shape of an address object
|
|
3
|
+
* @class
|
|
4
|
+
*/
|
|
5
|
+
export class Address {
|
|
6
|
+
/**
|
|
7
|
+
* creates an instance of an address
|
|
8
|
+
* @param {Object} params
|
|
9
|
+
* @param {string} params.addressLine1
|
|
10
|
+
* @param {string} params.addressLine2
|
|
11
|
+
* @param {string} params.townCity
|
|
12
|
+
* @param {string} params.county
|
|
13
|
+
* @param {string} params.postcode
|
|
14
|
+
*/
|
|
15
|
+
constructor({ addressLine1, addressLine2, townCity, county, postcode }: {
|
|
16
|
+
addressLine1: string;
|
|
17
|
+
addressLine2: string;
|
|
18
|
+
townCity: string;
|
|
19
|
+
county: string;
|
|
20
|
+
postcode: string;
|
|
21
|
+
});
|
|
22
|
+
/**
|
|
23
|
+
* @type {string} - the first line of the address
|
|
24
|
+
*/
|
|
25
|
+
addressLine1: string;
|
|
26
|
+
/**
|
|
27
|
+
* @type {string} - the second line of the address
|
|
28
|
+
*/
|
|
29
|
+
addressLine2: string;
|
|
30
|
+
/**
|
|
31
|
+
* @type {string} - the name of the town, city or other settlement
|
|
32
|
+
*/
|
|
33
|
+
townCity: string;
|
|
34
|
+
/**
|
|
35
|
+
* @type {string} - the name of the town, city or other settlement
|
|
36
|
+
*/
|
|
37
|
+
county: string;
|
|
38
|
+
/**
|
|
39
|
+
* @type {string} - the postcode
|
|
40
|
+
*/
|
|
41
|
+
postcode: string;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=address.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../../src/lib/address.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH;IA0BC;;;;;;;;OAQG;IACH,wEANG;QAAuB,YAAY,EAA3B,MAAM;QACS,YAAY,EAA3B,MAAM;QACS,QAAQ,EAAvB,MAAM;QACS,MAAM,EAArB,MAAM;QACS,QAAQ,EAAvB,MAAM;KAChB,EAOA;IAxCD;;OAEG;IACH,cAFU,MAAM,CAEH;IAEb;;OAEG;IACH,cAFU,MAAM,CAEH;IAEb;;OAEG;IACH,UAFU,MAAM,CAEP;IAET;;OAEG;IACH,QAFU,MAAM,CAET;IAEP;;OAEG;IACH,UAFU,MAAM,CAEP;CAkBT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address.test.d.ts","sourceRoot":"","sources":["../../../src/lib/address.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Display the date in Europe/London
|
|
3
|
+
* @param {Date|string} [date]
|
|
4
|
+
* @param {Object} [options]
|
|
5
|
+
* @param {string} [options.format] date formatting string
|
|
6
|
+
* @returns {string} formatted date string or empty string if invalid value passed in
|
|
7
|
+
*/
|
|
8
|
+
export function formatDateForDisplay(date?: Date | string, { format }?: {
|
|
9
|
+
format?: string | undefined;
|
|
10
|
+
}): string;
|
|
11
|
+
/**
|
|
12
|
+
* @typedef {Object} DateTimeParams
|
|
13
|
+
* @property {number} year
|
|
14
|
+
* @property {number} month
|
|
15
|
+
* @property {number} day
|
|
16
|
+
* @property {number} [hour]
|
|
17
|
+
* @property {number} [minute]
|
|
18
|
+
* @property {number} [second]
|
|
19
|
+
* @property {boolean} [convertToUTC]
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Parse the date and time parameters provided by a user
|
|
23
|
+
* @param {DateTimeParams} params
|
|
24
|
+
* @returns {Date}
|
|
25
|
+
*/
|
|
26
|
+
export function parseDateInput({ year, month, day, hour, minute, second }: DateTimeParams): Date;
|
|
27
|
+
/**
|
|
28
|
+
* Start of the day in UK time zone
|
|
29
|
+
*/
|
|
30
|
+
export function startOfDay(): Date;
|
|
31
|
+
/**
|
|
32
|
+
* End of the day in UK time zone
|
|
33
|
+
*/
|
|
34
|
+
export function endOfDay(): Date;
|
|
35
|
+
/**
|
|
36
|
+
* Check if today is within the date range inclusive (start <= now <= end)
|
|
37
|
+
* @param {Date} startDate
|
|
38
|
+
* @param {Date} endDate
|
|
39
|
+
* @returns {boolean}
|
|
40
|
+
*/
|
|
41
|
+
export function nowIsWithinRange(startDate: Date, endDate: Date): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Check if today is on or after the start date
|
|
44
|
+
* @param {Date} startDate
|
|
45
|
+
* @returns {boolean}
|
|
46
|
+
*/
|
|
47
|
+
export function isNowAfterStartDate(startDate: Date): boolean;
|
|
48
|
+
export function dateIsAfterToday(date: Date): boolean;
|
|
49
|
+
export function dateIsBeforeToday(date: Date): boolean;
|
|
50
|
+
export function dateIsToday(date: Date): boolean;
|
|
51
|
+
export type DateTimeParams = {
|
|
52
|
+
year: number;
|
|
53
|
+
month: number;
|
|
54
|
+
day: number;
|
|
55
|
+
hour?: number | undefined;
|
|
56
|
+
minute?: number | undefined;
|
|
57
|
+
second?: number | undefined;
|
|
58
|
+
convertToUTC?: boolean | undefined;
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=date-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/date-utils.js"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,4CALW,IAAI,GAAC,MAAM,eAEnB;IAAyB,MAAM;CAC/B,GAAU,MAAM,CAMlB;AAED;;;;;;;;;GASG;AAEH;;;;GAIG;AACH,2EAHW,cAAc,GACZ,IAAI,CAMhB;AAED;;GAEG;AACH,mCAWC;AAED;;GAEG;AACH,iCAWC;AAqCD;;;;;GAKG;AACH,4CAJW,IAAI,WACJ,IAAI,GACF,OAAO,CASnB;AAED;;;;GAIG;AACH,+CAHW,IAAI,GACF,OAAO,CASnB;AA/CM,uCAHI,IAAI,GACF,OAAO,CAInB;AAMM,wCAHI,IAAI,GACF,OAAO,CAInB;AAMM,kCAHI,IAAI,GACF,OAAO,CAInB;;UArFa,MAAM;WACN,MAAM;SACN,MAAM"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-utils.test.d.ts","sourceRoot":"","sources":["../../../src/lib/date-utils.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A `SaveDataFn` implementation that saves answers to the session.
|
|
3
|
+
* Answers are saved into a forms object, keyed by the journeyId, and optionally by a request parameter
|
|
4
|
+
* @example
|
|
5
|
+
* req: {
|
|
6
|
+
* session: {
|
|
7
|
+
* forms: {
|
|
8
|
+
* 'journey-id-1': {
|
|
9
|
+
* questionOne: 'my answer'
|
|
10
|
+
* // ...
|
|
11
|
+
* }
|
|
12
|
+
* }
|
|
13
|
+
* }
|
|
14
|
+
* }
|
|
15
|
+
*
|
|
16
|
+
* or when keyed by a req parameter:
|
|
17
|
+
* @example
|
|
18
|
+
* req: {
|
|
19
|
+
* session: {
|
|
20
|
+
* forms: {
|
|
21
|
+
* 'some-req-param': {
|
|
22
|
+
* 'journey-id-1': {
|
|
23
|
+
* questionOne: 'my answer'
|
|
24
|
+
* // ...
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
* }
|
|
28
|
+
* }
|
|
29
|
+
* }
|
|
30
|
+
*
|
|
31
|
+
*
|
|
32
|
+
* @param {Object} opts
|
|
33
|
+
* @param {string} [opts.reqParam]
|
|
34
|
+
* - optional request parameter to use as a key
|
|
35
|
+
* @returns {import('../controller').SaveDataFn}
|
|
36
|
+
*/
|
|
37
|
+
export function buildSaveDataToSession({ reqParam }?: {
|
|
38
|
+
reqParam?: string | undefined;
|
|
39
|
+
}): any;
|
|
40
|
+
/**
|
|
41
|
+
* A function to clear journey answers from the session
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* req: {
|
|
45
|
+
* session: {
|
|
46
|
+
* forms: {
|
|
47
|
+
* 'journey-id-1': {
|
|
48
|
+
* questionOne: 'my answer'
|
|
49
|
+
* // ...
|
|
50
|
+
* }
|
|
51
|
+
* }
|
|
52
|
+
* }
|
|
53
|
+
* }
|
|
54
|
+
*
|
|
55
|
+
* @param {Object} params
|
|
56
|
+
* @param {import('express').Request} params.req
|
|
57
|
+
* @param {string} params.journeyId
|
|
58
|
+
* @param {Object<string, any>} [params.replaceWith] - optional data to replace the form answers with
|
|
59
|
+
* @param {string} [params.reqParam] - optional request parameter used as a key
|
|
60
|
+
* @returns {void}
|
|
61
|
+
*/
|
|
62
|
+
export function clearDataFromSession({ req, journeyId, replaceWith, reqParam }: {
|
|
63
|
+
req: any;
|
|
64
|
+
journeyId: string;
|
|
65
|
+
replaceWith?: {
|
|
66
|
+
[x: string]: any;
|
|
67
|
+
} | undefined;
|
|
68
|
+
reqParam?: string | undefined;
|
|
69
|
+
}): void;
|
|
70
|
+
/**
|
|
71
|
+
* Fetch session answers from the session
|
|
72
|
+
*
|
|
73
|
+
* @param {string} journeyId
|
|
74
|
+
* @param {string} [reqParam] - optional request parameter used as a key
|
|
75
|
+
* @returns {import('express').Handler}
|
|
76
|
+
*/
|
|
77
|
+
export function buildGetJourneyResponseFromSession(journeyId: string, reqParam?: string): any;
|
|
78
|
+
/**
|
|
79
|
+
* Default save-to-session function with no request parameter
|
|
80
|
+
*
|
|
81
|
+
* @type {import('../controller').SaveDataFn}
|
|
82
|
+
*/
|
|
83
|
+
export const saveDataToSession: any;
|
|
84
|
+
//# sourceMappingURL=session-answer-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-answer-store.d.ts","sourceRoot":"","sources":["../../../src/lib/session-answer-store.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,sDAJG;IAAsB,QAAQ;CAE9B,OA4BF;AASD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,gFANG;IAA0C,GAAG,EAArC,GAAyB;IACV,SAAS,EAAxB,MAAM;IACuB,WAAW;;;IACxB,QAAQ;CAChC,GAAU,IAAI,CAkBhB;AAED;;;;;;GAMG;AACH,8DAJW,MAAM,aACN,MAAM,OA4BhB;AA/ED;;;;GAIG;AACH,oCAA0D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-answer-store.test.d.ts","sourceRoot":"","sources":["../../../src/lib/session-answer-store.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* replaces new line chars with a <br>
|
|
3
|
+
* @param {string} [value]
|
|
4
|
+
* @returns {string}
|
|
5
|
+
*/
|
|
6
|
+
export function nl2br(value?: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* @param {string|any} str
|
|
9
|
+
* @returns {string}
|
|
10
|
+
*/
|
|
11
|
+
export function capitalize(str: string | any): string;
|
|
12
|
+
/**
|
|
13
|
+
* Trim a trailing slash if present
|
|
14
|
+
*
|
|
15
|
+
* @param {string} [str]
|
|
16
|
+
* @returns {string}
|
|
17
|
+
*/
|
|
18
|
+
export function trimTrailingSlash(str?: string): string;
|
|
19
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,8BAHW,MAAM,GACJ,MAAM,CAMlB;AAED;;;GAGG;AACH,gCAHW,MAAM,GAAC,GAAG,GACR,MAAM,CAKlB;AAED;;;;;GAKG;AACH,wCAHW,MAAM,GACJ,MAAM,CAKlB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.test.d.ts","sourceRoot":"","sources":["../../../src/lib/utils.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../../../src/lib/uuid.js"],"names":[],"mappings":"AAEA;;GAEG;AACH;IACC,yEAEC;CACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uuid.test.d.ts","sourceRoot":"","sources":["../../../src/lib/uuid.test.js"],"names":[],"mappings":""}
|