@planning-inspectorate/dynamic-forms 3.3.3 → 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.
Files changed (272) hide show
  1. package/.azure/pipelines/azure-pipelines-pr.yml +4 -0
  2. package/.azure/pipelines/release.yml +4 -0
  3. package/.gitattributes +2 -0
  4. package/README.md +20 -9
  5. package/package.json +13 -5
  6. package/src/components/address/question.js +1 -10
  7. package/src/components/boolean/question.js +1 -1
  8. package/src/components/checkbox/question.js +2 -6
  9. package/src/components/date/question.js +1 -8
  10. package/src/components/date-period/question.js +1 -8
  11. package/src/components/email/question.js +4 -4
  12. package/src/components/manage-list/question.test.js +4 -19
  13. package/src/components/multi-field-input/question.js +3 -3
  14. package/src/components/multi-field-input/question.test.js +1 -1
  15. package/src/components/number-entry/question.js +1 -5
  16. package/src/components/radio/question.js +1 -1
  17. package/src/components/select/question.js +1 -1
  18. package/src/components/single-line-input/question.js +0 -8
  19. package/src/components/text-entry/question.js +4 -4
  20. package/src/components/text-entry-redact/index.njk +15 -11
  21. package/src/components/text-entry-redact/question.js +6 -16
  22. package/src/components/unit-option-entry/question.js +4 -11
  23. package/src/components/utils/component-types.js +18 -0
  24. package/src/index.js +72 -25
  25. package/src/middleware/redirect-to-unanswered-question.test.js +1 -1
  26. package/src/questions/options-question.js +5 -12
  27. package/src/questions/question-types.d.ts +3 -3
  28. package/src/questions/question.js +6 -6
  29. package/src/questions/questions.js +1 -1
  30. package/test/check-your-answers.test.js +3 -8
  31. package/test/conditional-journey.test.js +431 -0
  32. package/test/questions.test.js +15 -28
  33. package/test/snapshots/secret-wish.html +15 -11
  34. package/test/utils/question-test-utils.js +52 -4
  35. package/test/utils/test-server.js +1 -0
  36. package/test/utils/utils.js +16 -1
  37. package/tsconfig.json +9 -1
  38. package/types/commitlint.config.d.ts +7 -0
  39. package/types/commitlint.config.d.ts.map +1 -0
  40. package/types/eslint.config.d.ts +95 -0
  41. package/types/eslint.config.d.ts.map +1 -0
  42. package/types/src/components/address/question.d.ts +31 -0
  43. package/types/src/components/address/question.d.ts.map +1 -0
  44. package/types/src/components/address/question.test.d.ts +2 -0
  45. package/types/src/components/address/question.test.d.ts.map +1 -0
  46. package/types/src/components/boolean/question.d.ts +47 -0
  47. package/types/src/components/boolean/question.d.ts.map +1 -0
  48. package/types/src/components/boolean/question.test.d.ts +2 -0
  49. package/types/src/components/boolean/question.test.d.ts.map +1 -0
  50. package/types/src/components/checkbox/question.d.ts +49 -0
  51. package/types/src/components/checkbox/question.d.ts.map +1 -0
  52. package/types/src/components/checkbox/question.test.d.ts +2 -0
  53. package/types/src/components/checkbox/question.test.d.ts.map +1 -0
  54. package/types/src/components/date/question.d.ts +22 -0
  55. package/types/src/components/date/question.d.ts.map +1 -0
  56. package/types/src/components/date/question.test.d.ts +2 -0
  57. package/types/src/components/date/question.test.d.ts.map +1 -0
  58. package/types/src/components/date-period/question.d.ts +29 -0
  59. package/types/src/components/date-period/question.d.ts.map +1 -0
  60. package/types/src/components/date-period/question.test.d.ts +2 -0
  61. package/types/src/components/date-period/question.test.d.ts.map +1 -0
  62. package/types/src/components/date-time/question.d.ts +24 -0
  63. package/types/src/components/date-time/question.d.ts.map +1 -0
  64. package/types/src/components/date-time/question.test.d.ts +2 -0
  65. package/types/src/components/date-time/question.test.d.ts.map +1 -0
  66. package/types/src/components/email/question.d.ts +30 -0
  67. package/types/src/components/email/question.d.ts.map +1 -0
  68. package/types/src/components/email/question.test.d.ts +2 -0
  69. package/types/src/components/email/question.test.d.ts.map +1 -0
  70. package/types/src/components/identifier/question.d.ts +15 -0
  71. package/types/src/components/identifier/question.d.ts.map +1 -0
  72. package/types/src/components/identifier/question.test.d.ts +2 -0
  73. package/types/src/components/identifier/question.test.d.ts.map +1 -0
  74. package/types/src/components/manage-list/manage-list-section.d.ts +16 -0
  75. package/types/src/components/manage-list/manage-list-section.d.ts.map +1 -0
  76. package/types/src/components/manage-list/manage-list-section.test.d.ts +2 -0
  77. package/types/src/components/manage-list/manage-list-section.test.d.ts.map +1 -0
  78. package/types/src/components/manage-list/question.d.ts +41 -0
  79. package/types/src/components/manage-list/question.d.ts.map +1 -0
  80. package/types/src/components/manage-list/question.test.d.ts +2 -0
  81. package/types/src/components/manage-list/question.test.d.ts.map +1 -0
  82. package/types/src/components/manage-list/utils.d.ts +18 -0
  83. package/types/src/components/manage-list/utils.d.ts.map +1 -0
  84. package/types/src/components/manage-list/utils.test.d.ts +2 -0
  85. package/types/src/components/manage-list/utils.test.d.ts.map +1 -0
  86. package/types/src/components/multi-field-input/question.d.ts +106 -0
  87. package/types/src/components/multi-field-input/question.d.ts.map +1 -0
  88. package/types/src/components/multi-field-input/question.test.d.ts +2 -0
  89. package/types/src/components/multi-field-input/question.test.d.ts.map +1 -0
  90. package/types/src/components/number-entry/question.d.ts +37 -0
  91. package/types/src/components/number-entry/question.d.ts.map +1 -0
  92. package/types/src/components/radio/question.d.ts +53 -0
  93. package/types/src/components/radio/question.d.ts.map +1 -0
  94. package/types/src/components/radio/question.test.d.ts +2 -0
  95. package/types/src/components/radio/question.test.d.ts.map +1 -0
  96. package/types/src/components/select/question.d.ts +51 -0
  97. package/types/src/components/select/question.d.ts.map +1 -0
  98. package/types/src/components/select/question.test.d.ts +2 -0
  99. package/types/src/components/select/question.test.d.ts.map +1 -0
  100. package/types/src/components/single-line-input/question.d.ts +18 -0
  101. package/types/src/components/single-line-input/question.d.ts.map +1 -0
  102. package/types/src/components/single-line-input/question.test.d.ts +2 -0
  103. package/types/src/components/single-line-input/question.test.d.ts.map +1 -0
  104. package/types/src/components/text-entry/question.d.ts +34 -0
  105. package/types/src/components/text-entry/question.d.ts.map +1 -0
  106. package/types/src/components/text-entry/question.test.d.ts +2 -0
  107. package/types/src/components/text-entry/question.test.d.ts.map +1 -0
  108. package/types/src/components/text-entry-redact/question.d.ts +42 -0
  109. package/types/src/components/text-entry-redact/question.d.ts.map +1 -0
  110. package/types/src/components/text-entry-redact/question.test.d.ts +2 -0
  111. package/types/src/components/text-entry-redact/question.test.d.ts.map +1 -0
  112. package/types/src/components/unit-option-entry/question.d.ts +83 -0
  113. package/types/src/components/unit-option-entry/question.d.ts.map +1 -0
  114. package/types/src/components/unit-option-entry/question.test.d.ts +2 -0
  115. package/types/src/components/unit-option-entry/question.test.d.ts.map +1 -0
  116. package/types/src/components/utils/component-types.d.ts +19 -0
  117. package/types/src/components/utils/component-types.d.ts.map +1 -0
  118. package/types/src/components/utils/persisted-number-answer.d.ts +2 -0
  119. package/types/src/components/utils/persisted-number-answer.d.ts.map +1 -0
  120. package/types/src/components/utils/question-has-answer.d.ts +17 -0
  121. package/types/src/components/utils/question-has-answer.d.ts.map +1 -0
  122. package/types/src/components/utils/question-has-answer.test.d.ts +2 -0
  123. package/types/src/components/utils/question-has-answer.test.d.ts.map +1 -0
  124. package/types/src/components/utils/question-utils.d.ts +15 -0
  125. package/types/src/components/utils/question-utils.d.ts.map +1 -0
  126. package/types/src/components/utils/question-utils.test.d.ts +2 -0
  127. package/types/src/components/utils/question-utils.test.d.ts.map +1 -0
  128. package/types/src/controller.d.ts +78 -0
  129. package/types/src/controller.d.ts.map +1 -0
  130. package/types/src/controller.test.d.ts +2 -0
  131. package/types/src/controller.test.d.ts.map +1 -0
  132. package/types/src/index.d.ts +54 -0
  133. package/types/src/index.d.ts.map +1 -0
  134. package/types/src/journey/journey-response.d.ts +32 -0
  135. package/types/src/journey/journey-response.d.ts.map +1 -0
  136. package/types/src/journey/journey-response.test.d.ts +2 -0
  137. package/types/src/journey/journey-response.test.d.ts.map +1 -0
  138. package/types/src/journey/journey.d.ts +144 -0
  139. package/types/src/journey/journey.d.ts.map +1 -0
  140. package/types/src/journey/journey.test.d.ts +2 -0
  141. package/types/src/journey/journey.test.d.ts.map +1 -0
  142. package/types/src/lib/address-utils.d.ts +6 -0
  143. package/types/src/lib/address-utils.d.ts.map +1 -0
  144. package/types/src/lib/address-utils.test.d.ts +2 -0
  145. package/types/src/lib/address-utils.test.d.ts.map +1 -0
  146. package/types/src/lib/address.d.ts +43 -0
  147. package/types/src/lib/address.d.ts.map +1 -0
  148. package/types/src/lib/address.test.d.ts +2 -0
  149. package/types/src/lib/address.test.d.ts.map +1 -0
  150. package/types/src/lib/date-utils.d.ts +60 -0
  151. package/types/src/lib/date-utils.d.ts.map +1 -0
  152. package/types/src/lib/date-utils.test.d.ts +2 -0
  153. package/types/src/lib/date-utils.test.d.ts.map +1 -0
  154. package/types/src/lib/session-answer-store.d.ts +84 -0
  155. package/types/src/lib/session-answer-store.d.ts.map +1 -0
  156. package/types/src/lib/session-answer-store.test.d.ts +2 -0
  157. package/types/src/lib/session-answer-store.test.d.ts.map +1 -0
  158. package/types/src/lib/utils.d.ts +19 -0
  159. package/types/src/lib/utils.d.ts.map +1 -0
  160. package/types/src/lib/utils.test.d.ts +2 -0
  161. package/types/src/lib/utils.test.d.ts.map +1 -0
  162. package/types/src/lib/uuid.d.ts +7 -0
  163. package/types/src/lib/uuid.d.ts.map +1 -0
  164. package/types/src/lib/uuid.test.d.ts +2 -0
  165. package/types/src/lib/uuid.test.d.ts.map +1 -0
  166. package/types/src/middleware/build-get-journey.d.ts +6 -0
  167. package/types/src/middleware/build-get-journey.d.ts.map +1 -0
  168. package/types/src/middleware/redirect-to-unanswered-question.d.ts +12 -0
  169. package/types/src/middleware/redirect-to-unanswered-question.d.ts.map +1 -0
  170. package/types/src/middleware/redirect-to-unanswered-question.test.d.ts +2 -0
  171. package/types/src/middleware/redirect-to-unanswered-question.test.d.ts.map +1 -0
  172. package/types/src/questions/create-questions.d.ts +21 -0
  173. package/types/src/questions/create-questions.d.ts.map +1 -0
  174. package/types/src/questions/options-question.d.ts +74 -0
  175. package/types/src/questions/options-question.d.ts.map +1 -0
  176. package/types/src/questions/options-question.test.d.ts +2 -0
  177. package/types/src/questions/options-question.test.d.ts.map +1 -0
  178. package/types/src/questions/question.d.ts +274 -0
  179. package/types/src/questions/question.d.ts.map +1 -0
  180. package/types/src/questions/question.test.d.ts +2 -0
  181. package/types/src/questions/question.test.d.ts.map +1 -0
  182. package/types/src/questions/questions.d.ts +3 -0
  183. package/types/src/questions/questions.d.ts.map +1 -0
  184. package/types/src/section.d.ts +107 -0
  185. package/types/src/section.d.ts.map +1 -0
  186. package/types/src/section.test.d.ts +2 -0
  187. package/types/src/section.test.d.ts.map +1 -0
  188. package/types/src/validator/address-validator.d.ts +41 -0
  189. package/types/src/validator/address-validator.d.ts.map +1 -0
  190. package/types/src/validator/address-validator.test.d.ts +2 -0
  191. package/types/src/validator/address-validator.test.d.ts.map +1 -0
  192. package/types/src/validator/base-validator.d.ts +11 -0
  193. package/types/src/validator/base-validator.d.ts.map +1 -0
  194. package/types/src/validator/base-validator.test.d.ts +2 -0
  195. package/types/src/validator/base-validator.test.d.ts.map +1 -0
  196. package/types/src/validator/conditional-required-validator.d.ts +24 -0
  197. package/types/src/validator/conditional-required-validator.d.ts.map +1 -0
  198. package/types/src/validator/conditional-required-validator.test.d.ts +2 -0
  199. package/types/src/validator/conditional-required-validator.test.d.ts.map +1 -0
  200. package/types/src/validator/confirmation-checkbox-validator.d.ts +27 -0
  201. package/types/src/validator/confirmation-checkbox-validator.d.ts.map +1 -0
  202. package/types/src/validator/confirmation-checkbox-validator.test.d.ts +2 -0
  203. package/types/src/validator/confirmation-checkbox-validator.test.d.ts.map +1 -0
  204. package/types/src/validator/coordinates-validator.d.ts +22 -0
  205. package/types/src/validator/coordinates-validator.d.ts.map +1 -0
  206. package/types/src/validator/coordinates-validator.test.d.ts +2 -0
  207. package/types/src/validator/coordinates-validator.test.d.ts.map +1 -0
  208. package/types/src/validator/date-period-validator.d.ts +63 -0
  209. package/types/src/validator/date-period-validator.d.ts.map +1 -0
  210. package/types/src/validator/date-period-validator.test.d.ts +2 -0
  211. package/types/src/validator/date-period-validator.test.d.ts.map +1 -0
  212. package/types/src/validator/date-time-validator.d.ts +26 -0
  213. package/types/src/validator/date-time-validator.d.ts.map +1 -0
  214. package/types/src/validator/date-time-validator.test.d.ts +2 -0
  215. package/types/src/validator/date-time-validator.test.d.ts.map +1 -0
  216. package/types/src/validator/date-validator.d.ts +48 -0
  217. package/types/src/validator/date-validator.d.ts.map +1 -0
  218. package/types/src/validator/date-validator.test.d.ts +2 -0
  219. package/types/src/validator/date-validator.test.d.ts.map +1 -0
  220. package/types/src/validator/document-upload-validator.d.ts +10 -0
  221. package/types/src/validator/document-upload-validator.d.ts.map +1 -0
  222. package/types/src/validator/document-upload-validator.test.d.ts +2 -0
  223. package/types/src/validator/document-upload-validator.test.d.ts.map +1 -0
  224. package/types/src/validator/email-validator.d.ts +73 -0
  225. package/types/src/validator/email-validator.d.ts.map +1 -0
  226. package/types/src/validator/email-validator.test.d.ts +2 -0
  227. package/types/src/validator/email-validator.test.d.ts.map +1 -0
  228. package/types/src/validator/multi-field-input-validator.d.ts +70 -0
  229. package/types/src/validator/multi-field-input-validator.d.ts.map +1 -0
  230. package/types/src/validator/multi-field-input-validator.test.d.ts +2 -0
  231. package/types/src/validator/multi-field-input-validator.test.d.ts.map +1 -0
  232. package/types/src/validator/numeric-validator.d.ts +49 -0
  233. package/types/src/validator/numeric-validator.d.ts.map +1 -0
  234. package/types/src/validator/numeric-validator.test.d.ts +2 -0
  235. package/types/src/validator/numeric-validator.test.d.ts.map +1 -0
  236. package/types/src/validator/required-validator.d.ts +22 -0
  237. package/types/src/validator/required-validator.d.ts.map +1 -0
  238. package/types/src/validator/required-validator.test.d.ts +2 -0
  239. package/types/src/validator/required-validator.test.d.ts.map +1 -0
  240. package/types/src/validator/same-answer-validator.d.ts +18 -0
  241. package/types/src/validator/same-answer-validator.d.ts.map +1 -0
  242. package/types/src/validator/same-answer-validator.test.d.ts +2 -0
  243. package/types/src/validator/same-answer-validator.test.d.ts.map +1 -0
  244. package/types/src/validator/string-validator.d.ts +58 -0
  245. package/types/src/validator/string-validator.d.ts.map +1 -0
  246. package/types/src/validator/string-validator.test.d.ts +2 -0
  247. package/types/src/validator/string-validator.test.d.ts.map +1 -0
  248. package/types/src/validator/unit-option-entry-validator.d.ts +40 -0
  249. package/types/src/validator/unit-option-entry-validator.d.ts.map +1 -0
  250. package/types/src/validator/unit-option-entry-validator.test.d.ts +2 -0
  251. package/types/src/validator/unit-option-entry-validator.test.d.ts.map +1 -0
  252. package/types/src/validator/valid-option-validator.d.ts +22 -0
  253. package/types/src/validator/valid-option-validator.d.ts.map +1 -0
  254. package/types/src/validator/valid-option-validator.test.d.ts +2 -0
  255. package/types/src/validator/valid-option-validator.test.d.ts.map +1 -0
  256. package/types/src/validator/validation-error-handler.d.ts +20 -0
  257. package/types/src/validator/validation-error-handler.d.ts.map +1 -0
  258. package/types/src/validator/validation-error-handler.test.d.ts +2 -0
  259. package/types/src/validator/validation-error-handler.test.d.ts.map +1 -0
  260. package/types/src/validator/validator.d.ts +5 -0
  261. package/types/src/validator/validator.d.ts.map +1 -0
  262. package/types/src/validator/validator.test.d.ts +2 -0
  263. package/types/src/validator/validator.test.d.ts.map +1 -0
  264. package/types/test/mock/journey.d.ts +3 -0
  265. package/types/test/mock/journey.d.ts.map +1 -0
  266. package/types/test/mock/uuid.d.ts +7 -0
  267. package/types/test/mock/uuid.d.ts.map +1 -0
  268. package/types/test/utils/nunjucks.d.ts +2 -0
  269. package/types/test/utils/nunjucks.d.ts.map +1 -0
  270. package/types/test/utils/utils.d.ts +32 -0
  271. package/types/test/utils/utils.d.ts.map +1 -0
  272. package/src/lib/address.d.ts +0 -7
@@ -0,0 +1,83 @@
1
+ /**
2
+ * UnitOptions are the options displayed in the radio format - in this case the value
3
+ * represents the unit.
4
+ * Conditionals must be used to capture the relevant quantity.
5
+ * Each conditional must have a fieldName which uses the conditionalFieldName from the
6
+ * UnitOptionEntryQuestion object as a base, followed by an underscore and unit reference
7
+ * eg 'siteAreaSquareMetres_hectares' - this is required for validation and saving to the DB
8
+ * @typedef {{
9
+ * text: string;
10
+ * value: string;
11
+ * hint?: object;
12
+ * checked?: boolean | undefined;
13
+ * attributes?: Record<string, string>;
14
+ * behaviour?: 'exclusive';
15
+ * conditional: {
16
+ * fieldName: string;
17
+ * suffix: string;
18
+ * value?: unknown;
19
+ * label?: string;
20
+ * hint?: string;
21
+ * conversionFactor?: number;
22
+ * }
23
+ *}} UnitOption
24
+ */
25
+ export default class UnitOptionEntryQuestion extends Question {
26
+ /** @type {Array<UnitOption>} */
27
+ options: Array<UnitOption>;
28
+ conditionalFieldName: any;
29
+ label: any;
30
+ optionJoinString: string;
31
+ /**
32
+ * gets the view model for this question
33
+ * @param {import('../../section').Section} section - the current section
34
+ * @param {import('#journey').Journey} journey - the journey we are in
35
+ * @param {Record<string, unknown>} [customViewData] additional data to send to view
36
+ * @param {Record<string, unknown>} [payload]
37
+ * @param {import('#src/questions/question-types.d.ts').PrepQuestionForRenderingOptions} options
38
+ * @returns {import('#question').QuestionViewModel & {
39
+ * question: import('#question').QuestionViewModel['question'] & {
40
+ * options:UnitOption[]
41
+ * }
42
+ * }}
43
+ */
44
+ prepQuestionForRendering(section: any, journey: import("#journey").Journey, customViewData?: Record<string, unknown>, payload?: Record<string, unknown>, options: import("#src/questions/question-types.d.ts").PrepQuestionForRenderingOptions): import("#question").QuestionViewModel & {
45
+ question: import("#question").QuestionViewModel["question"] & {
46
+ options: UnitOption[];
47
+ };
48
+ };
49
+ /**
50
+ * Get the data to save from the request, returns an object of answers
51
+ * @param {import('express').Request} req
52
+ * @param {JourneyResponse} journeyResponse - current journey response, modified with the new answers
53
+ * @returns {Promise<{ answers: Record<string, unknown> }>}
54
+ */ getDataToSave(req: any, journeyResponse: JourneyResponse): Promise<{
55
+ answers: Record<string, unknown>;
56
+ }>;
57
+ }
58
+ /**
59
+ * UnitOptions are the options displayed in the radio format - in this case the value
60
+ * represents the unit.
61
+ * Conditionals must be used to capture the relevant quantity.
62
+ * Each conditional must have a fieldName which uses the conditionalFieldName from the
63
+ * UnitOptionEntryQuestion object as a base, followed by an underscore and unit reference
64
+ * eg 'siteAreaSquareMetres_hectares' - this is required for validation and saving to the DB
65
+ */
66
+ export type UnitOption = {
67
+ text: string;
68
+ value: string;
69
+ hint?: object;
70
+ checked?: boolean | undefined;
71
+ attributes?: Record<string, string>;
72
+ behaviour?: "exclusive";
73
+ conditional: {
74
+ fieldName: string;
75
+ suffix: string;
76
+ value?: unknown;
77
+ label?: string;
78
+ hint?: string;
79
+ conversionFactor?: number;
80
+ };
81
+ };
82
+ import { Question } from '../../questions/question.js';
83
+ //# sourceMappingURL=question.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/unit-option-entry/question.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH;IACC,gCAAgC;IAChC,SADW,KAAK,CAAC,UAAU,CAAC,CACpB;IAqBP,0BAAgD;IAEhD,WAAkB;IAClB,yBAA+C;IAGhD;;;;;;;;;;;;OAYG;IACH,gDAVW,OAAO,UAAU,EAAE,OAAO,mBAC1B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YACvB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,WACvB,OAAO,oCAAoC,EAAE,+BAA+B,GAC1E,OAAO,WAAW,EAAE,iBAAiB,GAAG;QAChD,QAAQ,EAAE,OAAO,WAAW,EAAE,iBAAiB,CAAC,UAAU,CAAC,GAAG;YAC5D,OAAO,EAAC,UAAU,EAAE,CAAA;SACrB,CAAA;KACF,CAmDH;IAED;;;;;OAKG,CACH,yCAHW,eAAe,GACb,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CAgCzD;CAoBD;;;;;;;;;yBAvKY;IACR,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,WAAW,EAAE;QACX,SAAS,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACnB,KAAK,CAAC,EAAE,OAAO,CAAC;QACZ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B,CAAA;CACH;yBA3BsB,6BAA6B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=question.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"question.test.d.ts","sourceRoot":"","sources":["../../../../src/components/unit-option-entry/question.test.js"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ export const COMPONENT_TYPES: Readonly<{
2
+ CHECKBOX: "checkbox";
3
+ BOOLEAN: "boolean";
4
+ RADIO: "radio";
5
+ DATE: "date";
6
+ DATE_PERIOD: "date-period";
7
+ DATE_TIME: "date-time";
8
+ TEXT_ENTRY: "text-entry";
9
+ TEXT_ENTRY_REDACT: "text-entry-redact";
10
+ SELECT: "select";
11
+ SINGLE_LINE_INPUT: "single-line-input";
12
+ MULTI_FIELD_INPUT: "multi-field-input";
13
+ NUMBER: "number";
14
+ ADDRESS: "site-address";
15
+ UNIT_OPTION: "unit-option";
16
+ EMAIL: "email";
17
+ MANAGE_LIST: "manage-list";
18
+ }>;
19
+ //# sourceMappingURL=component-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-types.d.ts","sourceRoot":"","sources":["../../../../src/components/utils/component-types.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG"}
@@ -0,0 +1,2 @@
1
+ export function getPersistedNumberAnswer(answer: number): string | number;
2
+ //# sourceMappingURL=persisted-number-answer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"persisted-number-answer.d.ts","sourceRoot":"","sources":["../../../../src/components/utils/persisted-number-answer.js"],"names":[],"mappings":"AAGO,iDAFI,MAAM,mBAYhB"}
@@ -0,0 +1,17 @@
1
+ export function logicalCombinations(response: import("#src/journey/journey-response.js").JourneyResponse): {
2
+ and: CombinationFunc;
3
+ or: CombinationFunc;
4
+ };
5
+ export function whenQuestionHasAnswer(question: import("#question").Question, expectedValue: unknown): import("#src/section.js").QuestionCondition;
6
+ export function questionHasAnswer(response: import("#src/journey/journey-response.js").JourneyResponse, question: import("#question").Question | {
7
+ optionJoinString: string;
8
+ }, expectedValue: unknown): boolean;
9
+ export function questionArrayMeetsCondition(response: JourneyResponse, question: any, conditionFn?: (item: any) => boolean): boolean;
10
+ export function questionsHaveAnswers(response: import("#src/journey/journey-response.js").JourneyResponse, questionKeyTuples: QuestionKeyTuples, { logicalCombinator }?: {
11
+ logicalCombinator: "and" | "or";
12
+ }): boolean;
13
+ export function questionHasNonEmptyStringAnswer(response: import("#src/journey/journey-response.js").JourneyResponse, question: import("#question").Question): boolean;
14
+ export function questionHasNonEmptyNumberAnswer(response: import("#src/journey/journey-response.js").JourneyResponse, question: import("#question").Question): boolean;
15
+ export type QuestionKeyTuples = [any, unknown][];
16
+ export type CombinationFunc = (questionKeyTuples: QuestionKeyTuples) => boolean;
17
+ //# sourceMappingURL=question-has-answer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"question-has-answer.d.ts","sourceRoot":"","sources":["../../../../src/components/utils/question-has-answer.js"],"names":[],"mappings":"AAOO,8CAHI,OAAO,kCAAkC,EAAE,eAAe,GACxD;IAAC,GAAG,EAAE,eAAe,CAAC;IAAC,EAAE,EAAE,eAAe,CAAA;CAAC,CAOtD;AAYK,gDAJI,OAAO,WAAW,EAAE,QAAQ,iBAC5B,OAAO,GACL,OAAO,iBAAiB,EAAE,iBAAiB,CAIvD;AAUM,4CALI,OAAO,kCAAkC,EAAE,eAAe,YAC1D,OAAO,WAAW,EAAE,QAAQ,GAAC;IAAC,gBAAgB,EAAE,MAAM,CAAA;CAAC,iBACvD,OAAO,GACL,OAAO,CAgBnB;AAUM,sDALI,eAAe,YACf,GAAG,gBACH,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,GACpB,OAAO,CAWnB;AASM,+CANI,OAAO,kCAAkC,EAAE,eAAe,qBAC1D,iBAAiB,0BAEzB;IAA8B,iBAAiB,EAAvC,KAAK,GAAG,IAAI;CACpB,GAAU,OAAO,CAUnB;AAOM,0DAJI,OAAO,kCAAkC,EAAE,eAAe,YAC1D,OAAO,WAAW,EAAE,QAAQ,GAC1B,OAAO,CAMnB;AAOM,0DAJI,OAAO,kCAAkC,EAAE,eAAe,YAC1D,OAAO,WAAW,EAAE,QAAQ,GAC1B,OAAO,CAMnB;gCA5Ga,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE;8BAChB,CAAC,iBAAiB,EAAE,iBAAiB,KAAK,OAAO"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=question-has-answer.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"question-has-answer.test.d.ts","sourceRoot":"","sources":["../../../../src/components/utils/question-has-answer.test.js"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ export function getConditionalFieldName(parentField: any, conditionalField: any): string;
2
+ export function getConditionalAnswer(answers: any, question: any, answer: any): any;
3
+ /**
4
+ * @param {unknown} conditional
5
+ * @returns {conditional is {html: string}}
6
+ */
7
+ export function conditionalIsJustHTML(conditional: unknown): conditional is {
8
+ html: string;
9
+ };
10
+ declare namespace _default {
11
+ export { getConditionalAnswer };
12
+ export { getConditionalFieldName };
13
+ }
14
+ export default _default;
15
+ //# sourceMappingURL=question-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"question-utils.d.ts","sourceRoot":"","sources":["../../../../src/components/utils/question-utils.js"],"names":[],"mappings":"AAAA,yFAEC;AAED,oFAGC;AAED;;;GAGG;AACH,mDAHW,OAAO,GACL,WAAW,IAAI;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,CAIzC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=question-utils.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"question-utils.test.d.ts","sourceRoot":"","sources":["../../../../src/components/utils/question-utils.test.js"],"names":[],"mappings":""}
@@ -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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=controller.test.d.ts.map
@@ -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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=journey-response.test.d.ts.map
@@ -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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=journey.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"journey.test.d.ts","sourceRoot":"","sources":["../../../src/journey/journey.test.js"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @param {import('@prisma/client').Prisma.AddressGetPayload<{}>} address
3
+ * @returns {string}
4
+ */
5
+ export function addressToViewModel(address: any): string;
6
+ //# sourceMappingURL=address-utils.d.ts.map
@@ -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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=address-utils.test.d.ts.map
@@ -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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=address.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address.test.d.ts","sourceRoot":"","sources":["../../../src/lib/address.test.js"],"names":[],"mappings":""}