@defra/fcp-sfd-frontend-engine 0.12.0 → 0.14.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 +32 -3
- package/dist/index.js +32 -3
- package/package.json +1 -1
- package/src/constants/index.js +7 -1
- package/src/constants/success-messages.js +1 -0
- package/src/mutations/mutations.js +3 -1
- package/src/mutations/personal/update-customer-phone.js +14 -0
- package/src/utils/build-update-business-email-variables.js +10 -0
- package/src/utils/utils.js +4 -2
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
|
|
@@ -272,11 +278,28 @@ var updateCustomerEmailMutation = `
|
|
|
272
278
|
}
|
|
273
279
|
`;
|
|
274
280
|
|
|
281
|
+
// src/mutations/personal/update-customer-phone.js
|
|
282
|
+
var updateCustomerPhoneMutation = `
|
|
283
|
+
mutation UpdateCustomerPhone($input: UpdateCustomerPhoneInput!) {
|
|
284
|
+
updateCustomerPhone(input: $input) {
|
|
285
|
+
customer {
|
|
286
|
+
info {
|
|
287
|
+
phone {
|
|
288
|
+
landline
|
|
289
|
+
mobile
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
`;
|
|
296
|
+
|
|
275
297
|
// src/mutations/mutations.js
|
|
276
298
|
var mutations = {
|
|
277
299
|
updateBusinessEmail: updateBusinessEmailMutation,
|
|
278
300
|
updateCustomerName: updateCustomerNameMutation,
|
|
279
|
-
updateCustomerEmail: updateCustomerEmailMutation
|
|
301
|
+
updateCustomerEmail: updateCustomerEmailMutation,
|
|
302
|
+
updateCustomerPhone: updateCustomerPhoneMutation
|
|
280
303
|
};
|
|
281
304
|
|
|
282
305
|
// src/presenters/base-presenter.js
|
|
@@ -887,10 +910,16 @@ var formatValidationErrors = (errors) => {
|
|
|
887
910
|
return formattedErrors;
|
|
888
911
|
};
|
|
889
912
|
|
|
913
|
+
// src/utils/build-update-business-email-variables.js
|
|
914
|
+
var buildUpdateBusinessEmailVariables = (email, sbi) => {
|
|
915
|
+
return { input: { email: { address: email }, sbi } };
|
|
916
|
+
};
|
|
917
|
+
|
|
890
918
|
// src/utils/utils.js
|
|
891
919
|
var utils = {
|
|
892
920
|
formatFullName,
|
|
893
|
-
formatValidationErrors
|
|
921
|
+
formatValidationErrors,
|
|
922
|
+
buildUpdateBusinessEmailVariables
|
|
894
923
|
};
|
|
895
924
|
// Annotate the CommonJS export names for ESM import in node:
|
|
896
925
|
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
|
|
@@ -232,11 +238,28 @@ var updateCustomerEmailMutation = `
|
|
|
232
238
|
}
|
|
233
239
|
`;
|
|
234
240
|
|
|
241
|
+
// src/mutations/personal/update-customer-phone.js
|
|
242
|
+
var updateCustomerPhoneMutation = `
|
|
243
|
+
mutation UpdateCustomerPhone($input: UpdateCustomerPhoneInput!) {
|
|
244
|
+
updateCustomerPhone(input: $input) {
|
|
245
|
+
customer {
|
|
246
|
+
info {
|
|
247
|
+
phone {
|
|
248
|
+
landline
|
|
249
|
+
mobile
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
`;
|
|
256
|
+
|
|
235
257
|
// src/mutations/mutations.js
|
|
236
258
|
var mutations = {
|
|
237
259
|
updateBusinessEmail: updateBusinessEmailMutation,
|
|
238
260
|
updateCustomerName: updateCustomerNameMutation,
|
|
239
|
-
updateCustomerEmail: updateCustomerEmailMutation
|
|
261
|
+
updateCustomerEmail: updateCustomerEmailMutation,
|
|
262
|
+
updateCustomerPhone: updateCustomerPhoneMutation
|
|
240
263
|
};
|
|
241
264
|
|
|
242
265
|
// src/presenters/base-presenter.js
|
|
@@ -847,10 +870,16 @@ var formatValidationErrors = (errors) => {
|
|
|
847
870
|
return formattedErrors;
|
|
848
871
|
};
|
|
849
872
|
|
|
873
|
+
// src/utils/build-update-business-email-variables.js
|
|
874
|
+
var buildUpdateBusinessEmailVariables = (email, sbi) => {
|
|
875
|
+
return { input: { email: { address: email }, sbi } };
|
|
876
|
+
};
|
|
877
|
+
|
|
850
878
|
// src/utils/utils.js
|
|
851
879
|
var utils = {
|
|
852
880
|
formatFullName,
|
|
853
|
-
formatValidationErrors
|
|
881
|
+
formatValidationErrors,
|
|
882
|
+
buildUpdateBusinessEmailVariables
|
|
854
883
|
};
|
|
855
884
|
export {
|
|
856
885
|
constants,
|
package/package.json
CHANGED
package/src/constants/index.js
CHANGED
|
@@ -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,9 +1,11 @@
|
|
|
1
1
|
import { updateBusinessEmailMutation } from './business/update-business-email.js'
|
|
2
2
|
import { updateCustomerNameMutation } from './personal/update-customer-name.js'
|
|
3
3
|
import { updateCustomerEmailMutation } from './personal/update-customer-email.js'
|
|
4
|
+
import { updateCustomerPhoneMutation } from './personal/update-customer-phone.js'
|
|
4
5
|
|
|
5
6
|
export const mutations = {
|
|
6
7
|
updateBusinessEmail: updateBusinessEmailMutation,
|
|
7
8
|
updateCustomerName: updateCustomerNameMutation,
|
|
8
|
-
updateCustomerEmail: updateCustomerEmailMutation
|
|
9
|
+
updateCustomerEmail: updateCustomerEmailMutation,
|
|
10
|
+
updateCustomerPhone: updateCustomerPhoneMutation
|
|
9
11
|
}
|
|
@@ -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
|
+
}
|
package/src/utils/utils.js
CHANGED
|
@@ -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
|
}
|