@defra/fcp-sfd-frontend-engine 0.12.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
@@ -887,10 +893,16 @@ var formatValidationErrors = (errors) => {
887
893
  return formattedErrors;
888
894
  };
889
895
 
896
+ // src/utils/build-update-business-email-variables.js
897
+ var buildUpdateBusinessEmailVariables = (email, sbi) => {
898
+ return { input: { email: { address: email }, sbi } };
899
+ };
900
+
890
901
  // src/utils/utils.js
891
902
  var utils = {
892
903
  formatFullName,
893
- formatValidationErrors
904
+ formatValidationErrors,
905
+ buildUpdateBusinessEmailVariables
894
906
  };
895
907
  // Annotate the CommonJS export names for ESM import in node:
896
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
@@ -847,10 +853,16 @@ var formatValidationErrors = (errors) => {
847
853
  return formattedErrors;
848
854
  };
849
855
 
856
+ // src/utils/build-update-business-email-variables.js
857
+ var buildUpdateBusinessEmailVariables = (email, sbi) => {
858
+ return { input: { email: { address: email }, sbi } };
859
+ };
860
+
850
861
  // src/utils/utils.js
851
862
  var utils = {
852
863
  formatFullName,
853
- formatValidationErrors
864
+ formatValidationErrors,
865
+ buildUpdateBusinessEmailVariables
854
866
  };
855
867
  export {
856
868
  constants,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/fcp-sfd-frontend-engine",
3
- "version": "0.12.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'
@@ -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
  }