@defra/fcp-sfd-frontend-engine 0.11.0 → 0.13.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/dist/index.cjs CHANGED
@@ -96,6 +96,9 @@ var MONTH_MAP = {
96
96
  dec: 12
97
97
  };
98
98
 
99
+ // src/constants/success-messages.js
100
+ var BUSINESS_EMAIL_ADDRESS = "You have updated your business email address";
101
+
99
102
  // src/constants/index.js
100
103
  var constants = {
101
104
  statusCodes: {
@@ -128,7 +131,10 @@ var constants = {
128
131
  PHONE_NUMBER_PATTERN,
129
132
  NO_CONTROL_CHARS_PATTERN
130
133
  },
131
- monthMap: MONTH_MAP
134
+ monthMap: MONTH_MAP,
135
+ successMessages: {
136
+ BUSINESS_EMAIL_ADDRESS
137
+ }
132
138
  };
133
139
 
134
140
  // src/mappers/personal-business-details-mapper.js
@@ -257,10 +263,26 @@ var updateCustomerNameMutation = `
257
263
  }
258
264
  `;
259
265
 
266
+ // src/mutations/personal/update-customer-email.js
267
+ var updateCustomerEmailMutation = `
268
+ mutation UpdateCustomerEmail($input: UpdateCustomerEmailInput!) {
269
+ updateCustomerEmail(input: $input) {
270
+ customer {
271
+ info {
272
+ email {
273
+ address
274
+ }
275
+ }
276
+ }
277
+ }
278
+ }
279
+ `;
280
+
260
281
  // src/mutations/mutations.js
261
282
  var mutations = {
262
283
  updateBusinessEmail: updateBusinessEmailMutation,
263
- updateCustomerName: updateCustomerNameMutation
284
+ updateCustomerName: updateCustomerNameMutation,
285
+ updateCustomerEmail: updateCustomerEmailMutation
264
286
  };
265
287
 
266
288
  // src/presenters/base-presenter.js
@@ -871,10 +893,16 @@ var formatValidationErrors = (errors) => {
871
893
  return formattedErrors;
872
894
  };
873
895
 
896
+ // src/utils/build-update-business-email-variables.js
897
+ var buildUpdateBusinessEmailVariables = (email, sbi) => {
898
+ return { input: { email: { address: email }, sbi } };
899
+ };
900
+
874
901
  // src/utils/utils.js
875
902
  var utils = {
876
903
  formatFullName,
877
- formatValidationErrors
904
+ formatValidationErrors,
905
+ buildUpdateBusinessEmailVariables
878
906
  };
879
907
  // Annotate the CommonJS export names for ESM import in node:
880
908
  0 && (module.exports = {
package/dist/index.js CHANGED
@@ -56,6 +56,9 @@ var MONTH_MAP = {
56
56
  dec: 12
57
57
  };
58
58
 
59
+ // src/constants/success-messages.js
60
+ var BUSINESS_EMAIL_ADDRESS = "You have updated your business email address";
61
+
59
62
  // src/constants/index.js
60
63
  var constants = {
61
64
  statusCodes: {
@@ -88,7 +91,10 @@ var constants = {
88
91
  PHONE_NUMBER_PATTERN,
89
92
  NO_CONTROL_CHARS_PATTERN
90
93
  },
91
- monthMap: MONTH_MAP
94
+ monthMap: MONTH_MAP,
95
+ successMessages: {
96
+ BUSINESS_EMAIL_ADDRESS
97
+ }
92
98
  };
93
99
 
94
100
  // src/mappers/personal-business-details-mapper.js
@@ -217,10 +223,26 @@ var updateCustomerNameMutation = `
217
223
  }
218
224
  `;
219
225
 
226
+ // src/mutations/personal/update-customer-email.js
227
+ var updateCustomerEmailMutation = `
228
+ mutation UpdateCustomerEmail($input: UpdateCustomerEmailInput!) {
229
+ updateCustomerEmail(input: $input) {
230
+ customer {
231
+ info {
232
+ email {
233
+ address
234
+ }
235
+ }
236
+ }
237
+ }
238
+ }
239
+ `;
240
+
220
241
  // src/mutations/mutations.js
221
242
  var mutations = {
222
243
  updateBusinessEmail: updateBusinessEmailMutation,
223
- updateCustomerName: updateCustomerNameMutation
244
+ updateCustomerName: updateCustomerNameMutation,
245
+ updateCustomerEmail: updateCustomerEmailMutation
224
246
  };
225
247
 
226
248
  // src/presenters/base-presenter.js
@@ -831,10 +853,16 @@ var formatValidationErrors = (errors) => {
831
853
  return formattedErrors;
832
854
  };
833
855
 
856
+ // src/utils/build-update-business-email-variables.js
857
+ var buildUpdateBusinessEmailVariables = (email, sbi) => {
858
+ return { input: { email: { address: email }, sbi } };
859
+ };
860
+
834
861
  // src/utils/utils.js
835
862
  var utils = {
836
863
  formatFullName,
837
- formatValidationErrors
864
+ formatValidationErrors,
865
+ buildUpdateBusinessEmailVariables
838
866
  };
839
867
  export {
840
868
  constants,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/fcp-sfd-frontend-engine",
3
- "version": "0.11.0",
3
+ "version": "0.13.0",
4
4
  "description": "Shared frontend engine used by both the internal and external frontend applications.",
5
5
  "main": "./dist/index.cjs",
6
6
  "exports": {
@@ -32,6 +32,9 @@ import {
32
32
  import { PHONE_NUMBER_PATTERN, NO_CONTROL_CHARS_PATTERN } from './patterns.js'
33
33
  import { MONTH_MAP } from './month-map.js'
34
34
 
35
+ // Success messages
36
+ import { BUSINESS_EMAIL_ADDRESS } from './success-messages.js'
37
+
35
38
  export const constants = {
36
39
  statusCodes: {
37
40
  BAD_REQUEST,
@@ -63,5 +66,8 @@ export const constants = {
63
66
  PHONE_NUMBER_PATTERN,
64
67
  NO_CONTROL_CHARS_PATTERN
65
68
  },
66
- monthMap: MONTH_MAP
69
+ monthMap: MONTH_MAP,
70
+ successMessages: {
71
+ BUSINESS_EMAIL_ADDRESS
72
+ }
67
73
  }
@@ -0,0 +1 @@
1
+ export const BUSINESS_EMAIL_ADDRESS = 'You have updated your business email address'
@@ -1,7 +1,9 @@
1
1
  import { updateBusinessEmailMutation } from './business/update-business-email.js'
2
2
  import { updateCustomerNameMutation } from './personal/update-customer-name.js'
3
+ import { updateCustomerEmailMutation } from './personal/update-customer-email.js'
3
4
 
4
5
  export const mutations = {
5
6
  updateBusinessEmail: updateBusinessEmailMutation,
6
- updateCustomerName: updateCustomerNameMutation
7
+ updateCustomerName: updateCustomerNameMutation,
8
+ updateCustomerEmail: updateCustomerEmailMutation
7
9
  }
@@ -0,0 +1,13 @@
1
+ export const updateCustomerEmailMutation = `
2
+ mutation UpdateCustomerEmail($input: UpdateCustomerEmailInput!) {
3
+ updateCustomerEmail(input: $input) {
4
+ customer {
5
+ info {
6
+ email {
7
+ address
8
+ }
9
+ }
10
+ }
11
+ }
12
+ }
13
+ `
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Builds the GraphQL variables for the `updateBusinessEmail` mutation.
3
+ *
4
+ * @param {string} email - The new business email address
5
+ * @param {string} sbi - The Single Business Identifier of the business being updated
6
+ * @returns {object} The mutation variables in the shape `{ input: { email: { address }, sbi } }`
7
+ */
8
+ export const buildUpdateBusinessEmailVariables = (email, sbi) => {
9
+ return { input: { email: { address: email }, sbi } }
10
+ }
@@ -1,7 +1,9 @@
1
1
  import { formatFullName } from './format-full-name.js'
2
- import { formatValidationErrors } from './format-validation-errors'
2
+ import { formatValidationErrors } from './format-validation-errors.js'
3
+ import { buildUpdateBusinessEmailVariables } from './build-update-business-email-variables.js'
3
4
 
4
5
  export const utils = {
5
6
  formatFullName,
6
- formatValidationErrors
7
+ formatValidationErrors,
8
+ buildUpdateBusinessEmailVariables
7
9
  }