@dwp/govuk-casa 8.3.0 → 8.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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [8.4.0](https://github.com/dwp/govuk-casa/compare/8.3.0...8.4.0) (2022-07-19)
6
+
7
+
8
+ ### Features
9
+
10
+ * clone field ([916f2f2](https://github.com/dwp/govuk-casa/commit/916f2f2497c4e8177a5a3b33b9b3e70aa9cd5dd1))
11
+
5
12
  ## [8.3.0](https://github.com/dwp/govuk-casa/compare/8.2.8...8.3.0) (2022-06-30)
6
13
 
7
14
 
@@ -31,6 +31,12 @@ export class PageField {
31
31
  optional?: boolean | undefined;
32
32
  persist?: boolean | undefined;
33
33
  });
34
+ /**
35
+ * Clone this field.
36
+ *
37
+ * @returns {PageField} Cloned field
38
+ */
39
+ clone(): PageField;
34
40
  /**
35
41
  * Extract this field's value from the given object.
36
42
  *
package/dist/lib/field.js CHANGED
@@ -100,6 +100,27 @@ class PageField {
100
100
  // Apply name
101
101
  this.rename(name);
102
102
  }
103
+ /**
104
+ * Clone this field.
105
+ *
106
+ * @returns {PageField} Cloned field
107
+ */
108
+ clone() {
109
+ const clone = new PageField(__classPrivateFieldGet(this, _PageField_name, "f"), {
110
+ optional: __classPrivateFieldGet(this, _PageField_meta, "f").optional,
111
+ persist: __classPrivateFieldGet(this, _PageField_meta, "f").persist,
112
+ });
113
+ if (this.validators()) {
114
+ clone.validators(this.validators());
115
+ }
116
+ if (this.conditions()) {
117
+ clone.conditions(this.conditions());
118
+ }
119
+ if (this.processors()) {
120
+ clone.processors(this.processors());
121
+ }
122
+ return clone;
123
+ }
103
124
  /**
104
125
  * Extract this field's value from the given object.
105
126
  *
@@ -1,6 +1,15 @@
1
1
  /**
2
2
  * Generate a URL pointing at a particular waypoint.
3
3
  *
4
+ * @example
5
+ * // generates: /path/details?edit&editorigin=%2Fsomewhere%2Felse
6
+ * waypointUrl({
7
+ * mountUrl: '/path/',
8
+ * waypoint: 'details',
9
+ * edit: true,
10
+ * editOrigin: '/somewhere/else'
11
+ * })
12
+ *
4
13
  * @memberof module:@dwp/govuk-casa
5
14
  * @param {object} obj Options
6
15
  * @param {string} obj.waypoint Waypoint
@@ -17,6 +17,15 @@ const sanitiseWaypoint = (w) => w.replace(/[^/a-z0-9_-]/ig, '').replace(/\/+/g,
17
17
  /**
18
18
  * Generate a URL pointing at a particular waypoint.
19
19
  *
20
+ * @example
21
+ * // generates: /path/details?edit&editorigin=%2Fsomewhere%2Felse
22
+ * waypointUrl({
23
+ * mountUrl: '/path/',
24
+ * waypoint: 'details',
25
+ * edit: true,
26
+ * editOrigin: '/somewhere/else'
27
+ * })
28
+ *
20
29
  * @memberof module:@dwp/govuk-casa
21
30
  * @param {object} obj Options
22
31
  * @param {string} obj.waypoint Waypoint
@@ -57,7 +57,13 @@ exports.default = ({ waypoint, plan, }) => [
57
57
  startWaypoint: waypoint,
58
58
  stopCondition: () => (true), // stop at the first one
59
59
  });
60
- res.locals.casa.journeyPreviousUrl = prevRoute.target ? (0, waypoint_url_js_1.default)({ mountUrl, waypoint: prevRoute.target, routeName: 'prev' }) : undefined;
60
+ res.locals.casa.journeyPreviousUrl = prevRoute.target ? (0, waypoint_url_js_1.default)({
61
+ mountUrl,
62
+ waypoint: prevRoute.target,
63
+ routeName: 'prev',
64
+ edit: req.casa.editMode,
65
+ editOrigin: req.casa.editOrigin,
66
+ }) : undefined;
61
67
  return next();
62
68
  },
63
69
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dwp/govuk-casa",
3
- "version": "8.3.0",
3
+ "version": "8.4.0",
4
4
  "description": "A framework for building GOVUK Collect-And-Submit-Applications",
5
5
  "repository": {
6
6
  "type": "git",
@@ -51,23 +51,23 @@
51
51
  "govuk-frontend": "4.2.0",
52
52
  "graphlib": "2.1.8",
53
53
  "helmet": "5.1.0",
54
- "i18next": "21.8.11",
54
+ "i18next": "21.8.14",
55
55
  "i18next-http-middleware": "3.2.1",
56
56
  "js-yaml": "4.1.0",
57
57
  "lodash": "4.17.21",
58
- "luxon": "2.4.0",
58
+ "luxon": "2.5.0",
59
59
  "nunjucks": "3.2.3",
60
60
  "path-to-regexp": "6.2.1",
61
61
  "uuid": "8.3.2",
62
62
  "validator": "13.7.0"
63
63
  },
64
64
  "devDependencies": {
65
- "@babel/core": "7.18.6",
66
- "@babel/eslint-parser": "7.18.2",
67
- "@babel/preset-env": "7.18.6",
68
- "@ckeditor/jsdoc-plugins": "30.3.1",
65
+ "@babel/core": "7.18.9",
66
+ "@babel/eslint-parser": "7.18.9",
67
+ "@babel/preset-env": "7.18.9",
68
+ "@ckeditor/jsdoc-plugins": "30.3.2",
69
69
  "@commitlint/config-conventional": "17.0.3",
70
- "@dwp/casa-spiderplan": "2.4.0",
70
+ "@dwp/casa-spiderplan": "2.4.1",
71
71
  "@dwp/casa-spiderplan-a11y-plugin": "0.1.4",
72
72
  "@dwp/casa-spiderplan-zap-plugin": "0.1.1",
73
73
  "@dwp/eslint-config-base": "6.0.0",
@@ -80,7 +80,7 @@
80
80
  "cheerio": "1.0.0-rc.12",
81
81
  "commitlint": "17.0.3",
82
82
  "docdash": "1.2.0",
83
- "eslint": "8.18.0",
83
+ "eslint": "8.20.0",
84
84
  "eslint-plugin-no-unsafe-regex": "1.0.0",
85
85
  "eslint-plugin-security": "1.5.0",
86
86
  "eslint-plugin-sonarjs": "0.13.0",
@@ -93,7 +93,7 @@
93
93
  "sinon": "14.0.0",
94
94
  "sinon-chai": "3.7.0",
95
95
  "standard-version": "9.5.0",
96
- "supertest": "6.2.3",
96
+ "supertest": "6.2.4",
97
97
  "typescript": "4.7.4"
98
98
  }
99
99
  }