@defra/fcp-sfd-frontend-engine 0.14.0 → 0.15.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
@@ -98,6 +98,7 @@ var MONTH_MAP = {
98
98
 
99
99
  // src/constants/success-messages.js
100
100
  var BUSINESS_EMAIL_ADDRESS = "You have updated your business email address";
101
+ var BUSINESS_NAME = "You have updated your business name";
101
102
 
102
103
  // src/constants/index.js
103
104
  var constants = {
@@ -133,7 +134,8 @@ var constants = {
133
134
  },
134
135
  monthMap: MONTH_MAP,
135
136
  successMessages: {
136
- BUSINESS_EMAIL_ADDRESS
137
+ BUSINESS_EMAIL_ADDRESS,
138
+ BUSINESS_NAME
137
139
  }
138
140
  };
139
141
 
@@ -246,6 +248,20 @@ var updateBusinessEmailMutation = `
246
248
  }
247
249
  `;
248
250
 
251
+ // src/mutations/business/update-business-name.js
252
+ var updateBusinessNameMutation = `
253
+ mutation UpdateBusinessName($input: UpdateBusinessNameInput!) {
254
+ updateBusinessName(input: $input) {
255
+ business {
256
+ info {
257
+ name
258
+ }
259
+ }
260
+ success
261
+ }
262
+ }
263
+ `;
264
+
249
265
  // src/mutations/personal/update-customer-name.js
250
266
  var updateCustomerNameMutation = `
251
267
  mutation UpdateCustomerName($input: UpdateCustomerNameInput!) {
@@ -297,6 +313,7 @@ var updateCustomerPhoneMutation = `
297
313
  // src/mutations/mutations.js
298
314
  var mutations = {
299
315
  updateBusinessEmail: updateBusinessEmailMutation,
316
+ updateBusinessName: updateBusinessNameMutation,
300
317
  updateCustomerName: updateCustomerNameMutation,
301
318
  updateCustomerEmail: updateCustomerEmailMutation,
302
319
  updateCustomerPhone: updateCustomerPhoneMutation
@@ -915,11 +932,17 @@ var buildUpdateBusinessEmailVariables = (email, sbi) => {
915
932
  return { input: { email: { address: email }, sbi } };
916
933
  };
917
934
 
935
+ // src/utils/build-update-business-name-variables.js
936
+ var buildUpdateBusinessNameVariables = (name, sbi) => {
937
+ return { input: { name, sbi } };
938
+ };
939
+
918
940
  // src/utils/utils.js
919
941
  var utils = {
920
942
  formatFullName,
921
943
  formatValidationErrors,
922
- buildUpdateBusinessEmailVariables
944
+ buildUpdateBusinessEmailVariables,
945
+ buildUpdateBusinessNameVariables
923
946
  };
924
947
  // Annotate the CommonJS export names for ESM import in node:
925
948
  0 && (module.exports = {
package/dist/index.js CHANGED
@@ -58,6 +58,7 @@ var MONTH_MAP = {
58
58
 
59
59
  // src/constants/success-messages.js
60
60
  var BUSINESS_EMAIL_ADDRESS = "You have updated your business email address";
61
+ var BUSINESS_NAME = "You have updated your business name";
61
62
 
62
63
  // src/constants/index.js
63
64
  var constants = {
@@ -93,7 +94,8 @@ var constants = {
93
94
  },
94
95
  monthMap: MONTH_MAP,
95
96
  successMessages: {
96
- BUSINESS_EMAIL_ADDRESS
97
+ BUSINESS_EMAIL_ADDRESS,
98
+ BUSINESS_NAME
97
99
  }
98
100
  };
99
101
 
@@ -206,6 +208,20 @@ var updateBusinessEmailMutation = `
206
208
  }
207
209
  `;
208
210
 
211
+ // src/mutations/business/update-business-name.js
212
+ var updateBusinessNameMutation = `
213
+ mutation UpdateBusinessName($input: UpdateBusinessNameInput!) {
214
+ updateBusinessName(input: $input) {
215
+ business {
216
+ info {
217
+ name
218
+ }
219
+ }
220
+ success
221
+ }
222
+ }
223
+ `;
224
+
209
225
  // src/mutations/personal/update-customer-name.js
210
226
  var updateCustomerNameMutation = `
211
227
  mutation UpdateCustomerName($input: UpdateCustomerNameInput!) {
@@ -257,6 +273,7 @@ var updateCustomerPhoneMutation = `
257
273
  // src/mutations/mutations.js
258
274
  var mutations = {
259
275
  updateBusinessEmail: updateBusinessEmailMutation,
276
+ updateBusinessName: updateBusinessNameMutation,
260
277
  updateCustomerName: updateCustomerNameMutation,
261
278
  updateCustomerEmail: updateCustomerEmailMutation,
262
279
  updateCustomerPhone: updateCustomerPhoneMutation
@@ -875,11 +892,17 @@ var buildUpdateBusinessEmailVariables = (email, sbi) => {
875
892
  return { input: { email: { address: email }, sbi } };
876
893
  };
877
894
 
895
+ // src/utils/build-update-business-name-variables.js
896
+ var buildUpdateBusinessNameVariables = (name, sbi) => {
897
+ return { input: { name, sbi } };
898
+ };
899
+
878
900
  // src/utils/utils.js
879
901
  var utils = {
880
902
  formatFullName,
881
903
  formatValidationErrors,
882
- buildUpdateBusinessEmailVariables
904
+ buildUpdateBusinessEmailVariables,
905
+ buildUpdateBusinessNameVariables
883
906
  };
884
907
  export {
885
908
  constants,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/fcp-sfd-frontend-engine",
3
- "version": "0.14.0",
3
+ "version": "0.15.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": {
@@ -33,7 +33,7 @@ import { PHONE_NUMBER_PATTERN, NO_CONTROL_CHARS_PATTERN } from './patterns.js'
33
33
  import { MONTH_MAP } from './month-map.js'
34
34
 
35
35
  // Success messages
36
- import { BUSINESS_EMAIL_ADDRESS } from './success-messages.js'
36
+ import { BUSINESS_EMAIL_ADDRESS, BUSINESS_NAME } from './success-messages.js'
37
37
 
38
38
  export const constants = {
39
39
  statusCodes: {
@@ -68,6 +68,7 @@ export const constants = {
68
68
  },
69
69
  monthMap: MONTH_MAP,
70
70
  successMessages: {
71
- BUSINESS_EMAIL_ADDRESS
71
+ BUSINESS_EMAIL_ADDRESS,
72
+ BUSINESS_NAME
72
73
  }
73
74
  }
@@ -1 +1,2 @@
1
1
  export const BUSINESS_EMAIL_ADDRESS = 'You have updated your business email address'
2
+ export const BUSINESS_NAME = 'You have updated your business name'
@@ -0,0 +1,12 @@
1
+ export const updateBusinessNameMutation = `
2
+ mutation UpdateBusinessName($input: UpdateBusinessNameInput!) {
3
+ updateBusinessName(input: $input) {
4
+ business {
5
+ info {
6
+ name
7
+ }
8
+ }
9
+ success
10
+ }
11
+ }
12
+ `
@@ -1,10 +1,12 @@
1
1
  import { updateBusinessEmailMutation } from './business/update-business-email.js'
2
+ import { updateBusinessNameMutation } from './business/update-business-name.js'
2
3
  import { updateCustomerNameMutation } from './personal/update-customer-name.js'
3
4
  import { updateCustomerEmailMutation } from './personal/update-customer-email.js'
4
5
  import { updateCustomerPhoneMutation } from './personal/update-customer-phone.js'
5
6
 
6
7
  export const mutations = {
7
8
  updateBusinessEmail: updateBusinessEmailMutation,
9
+ updateBusinessName: updateBusinessNameMutation,
8
10
  updateCustomerName: updateCustomerNameMutation,
9
11
  updateCustomerEmail: updateCustomerEmailMutation,
10
12
  updateCustomerPhone: updateCustomerPhoneMutation
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Builds the GraphQL variables for the `updateBusinessName` mutation.
3
+ *
4
+ * @param {string} name - The new business name
5
+ * @param {string} sbi - The Single Business Identifier of the business being updated
6
+ * @returns {object} The mutation variables in the shape `{ input: { name, sbi } }`
7
+ */
8
+ export const buildUpdateBusinessNameVariables = (name, sbi) => {
9
+ return { input: { name, sbi } }
10
+ }
@@ -1,9 +1,11 @@
1
1
  import { formatFullName } from './format-full-name.js'
2
2
  import { formatValidationErrors } from './format-validation-errors.js'
3
3
  import { buildUpdateBusinessEmailVariables } from './build-update-business-email-variables.js'
4
+ import { buildUpdateBusinessNameVariables } from './build-update-business-name-variables.js'
4
5
 
5
6
  export const utils = {
6
7
  formatFullName,
7
8
  formatValidationErrors,
8
- buildUpdateBusinessEmailVariables
9
+ buildUpdateBusinessEmailVariables,
10
+ buildUpdateBusinessNameVariables
9
11
  }