@defra/fcp-sfd-frontend-engine 0.13.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!) {
@@ -278,11 +294,29 @@ var updateCustomerEmailMutation = `
278
294
  }
279
295
  `;
280
296
 
297
+ // src/mutations/personal/update-customer-phone.js
298
+ var updateCustomerPhoneMutation = `
299
+ mutation UpdateCustomerPhone($input: UpdateCustomerPhoneInput!) {
300
+ updateCustomerPhone(input: $input) {
301
+ customer {
302
+ info {
303
+ phone {
304
+ landline
305
+ mobile
306
+ }
307
+ }
308
+ }
309
+ }
310
+ }
311
+ `;
312
+
281
313
  // src/mutations/mutations.js
282
314
  var mutations = {
283
315
  updateBusinessEmail: updateBusinessEmailMutation,
316
+ updateBusinessName: updateBusinessNameMutation,
284
317
  updateCustomerName: updateCustomerNameMutation,
285
- updateCustomerEmail: updateCustomerEmailMutation
318
+ updateCustomerEmail: updateCustomerEmailMutation,
319
+ updateCustomerPhone: updateCustomerPhoneMutation
286
320
  };
287
321
 
288
322
  // src/presenters/base-presenter.js
@@ -898,11 +932,17 @@ var buildUpdateBusinessEmailVariables = (email, sbi) => {
898
932
  return { input: { email: { address: email }, sbi } };
899
933
  };
900
934
 
935
+ // src/utils/build-update-business-name-variables.js
936
+ var buildUpdateBusinessNameVariables = (name, sbi) => {
937
+ return { input: { name, sbi } };
938
+ };
939
+
901
940
  // src/utils/utils.js
902
941
  var utils = {
903
942
  formatFullName,
904
943
  formatValidationErrors,
905
- buildUpdateBusinessEmailVariables
944
+ buildUpdateBusinessEmailVariables,
945
+ buildUpdateBusinessNameVariables
906
946
  };
907
947
  // Annotate the CommonJS export names for ESM import in node:
908
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!) {
@@ -238,11 +254,29 @@ var updateCustomerEmailMutation = `
238
254
  }
239
255
  `;
240
256
 
257
+ // src/mutations/personal/update-customer-phone.js
258
+ var updateCustomerPhoneMutation = `
259
+ mutation UpdateCustomerPhone($input: UpdateCustomerPhoneInput!) {
260
+ updateCustomerPhone(input: $input) {
261
+ customer {
262
+ info {
263
+ phone {
264
+ landline
265
+ mobile
266
+ }
267
+ }
268
+ }
269
+ }
270
+ }
271
+ `;
272
+
241
273
  // src/mutations/mutations.js
242
274
  var mutations = {
243
275
  updateBusinessEmail: updateBusinessEmailMutation,
276
+ updateBusinessName: updateBusinessNameMutation,
244
277
  updateCustomerName: updateCustomerNameMutation,
245
- updateCustomerEmail: updateCustomerEmailMutation
278
+ updateCustomerEmail: updateCustomerEmailMutation,
279
+ updateCustomerPhone: updateCustomerPhoneMutation
246
280
  };
247
281
 
248
282
  // src/presenters/base-presenter.js
@@ -858,11 +892,17 @@ var buildUpdateBusinessEmailVariables = (email, sbi) => {
858
892
  return { input: { email: { address: email }, sbi } };
859
893
  };
860
894
 
895
+ // src/utils/build-update-business-name-variables.js
896
+ var buildUpdateBusinessNameVariables = (name, sbi) => {
897
+ return { input: { name, sbi } };
898
+ };
899
+
861
900
  // src/utils/utils.js
862
901
  var utils = {
863
902
  formatFullName,
864
903
  formatValidationErrors,
865
- buildUpdateBusinessEmailVariables
904
+ buildUpdateBusinessEmailVariables,
905
+ buildUpdateBusinessNameVariables
866
906
  };
867
907
  export {
868
908
  constants,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/fcp-sfd-frontend-engine",
3
- "version": "0.13.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,9 +1,13 @@
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'
5
+ import { updateCustomerPhoneMutation } from './personal/update-customer-phone.js'
4
6
 
5
7
  export const mutations = {
6
8
  updateBusinessEmail: updateBusinessEmailMutation,
9
+ updateBusinessName: updateBusinessNameMutation,
7
10
  updateCustomerName: updateCustomerNameMutation,
8
- updateCustomerEmail: updateCustomerEmailMutation
11
+ updateCustomerEmail: updateCustomerEmailMutation,
12
+ updateCustomerPhone: updateCustomerPhoneMutation
9
13
  }
@@ -0,0 +1,14 @@
1
+ export const updateCustomerPhoneMutation = `
2
+ mutation UpdateCustomerPhone($input: UpdateCustomerPhoneInput!) {
3
+ updateCustomerPhone(input: $input) {
4
+ customer {
5
+ info {
6
+ phone {
7
+ landline
8
+ mobile
9
+ }
10
+ }
11
+ }
12
+ }
13
+ }
14
+ `
@@ -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
  }