@defra-fish/gafl-webapp-service 1.58.0-rc.8 → 1.58.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/package.json +4 -4
- package/src/pages/contact/contact/contact.njk +3 -1
- package/src/pages/contact/digital-licence/check-confirmation-contact/check-confirmation-contact.njk +13 -3
- package/src/pages/order-complete/order-complete/__tests__/order-complete.spec.js +12 -11
- package/src/pages/order-complete/order-complete/route.js +2 -2
- package/src/pages/summary/contact-summary/__tests__/__snapshots__/route.spec.js.snap +85 -18
- package/src/pages/summary/contact-summary/__tests__/route.spec.js +59 -10
- package/src/pages/summary/contact-summary/route.js +65 -38
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defra-fish/gafl-webapp-service",
|
|
3
|
-
"version": "1.58.0
|
|
3
|
+
"version": "1.58.0",
|
|
4
4
|
"description": "The websales frontend for the GAFL service",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"prepare": "gulp --gulpfile build/gulpfile.cjs"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@defra-fish/business-rules-lib": "1.58.0
|
|
40
|
-
"@defra-fish/connectors-lib": "1.58.0
|
|
39
|
+
"@defra-fish/business-rules-lib": "1.58.0",
|
|
40
|
+
"@defra-fish/connectors-lib": "1.58.0",
|
|
41
41
|
"@defra/hapi-gapi": "^2.0.0",
|
|
42
42
|
"@hapi/boom": "^9.1.2",
|
|
43
43
|
"@hapi/catbox-redis": "^6.0.2",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"./gafl-jest-matchers.js"
|
|
81
81
|
]
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "4d2c2ef1bf3016fa38140a1bd78bf26ba5adb68d"
|
|
84
84
|
}
|
|
@@ -81,7 +81,9 @@
|
|
|
81
81
|
</div>
|
|
82
82
|
<div id="text-ro" class="govuk-body-m initially-hidden">
|
|
83
83
|
{{ mssgs.important_info_contact_input_mobile_note }}</br>
|
|
84
|
-
|
|
84
|
+
<meta name="format-detection" content="telephone=no">
|
|
85
|
+
<span class="govuk-body-m govuk-!-font-weight-bold">{{ data.licensee.mobilePhone }}
|
|
86
|
+
</meta>
|
|
85
87
|
</span>
|
|
86
88
|
</div>
|
|
87
89
|
{% endset -%}
|
package/src/pages/contact/digital-licence/check-confirmation-contact/check-confirmation-contact.njk
CHANGED
|
@@ -21,9 +21,19 @@
|
|
|
21
21
|
{{ title }}
|
|
22
22
|
</h1>
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
|
|
25
|
+
{% if data.licensee.preferredMethodOfConfirmation == 'Email' %}
|
|
26
|
+
<p class="govuk-body contact-scroll" id="contact-information" aria-labelledby="contact-information">
|
|
27
|
+
{{ contactInfo }}
|
|
28
|
+
</p>
|
|
29
|
+
{% else %}
|
|
30
|
+
<meta name="format-detection" content="telephone=no">
|
|
31
|
+
<p class="govuk-body contact-scroll" id="contact-information" aria-labelledby="contact-information">
|
|
32
|
+
{{ contactInfo }}
|
|
33
|
+
</p>
|
|
34
|
+
</meta>
|
|
35
|
+
{% endif %}
|
|
36
|
+
|
|
27
37
|
|
|
28
38
|
<p class="govuk-body govuk-!-margin-bottom-6">
|
|
29
39
|
<a class="govuk-link" href="{{ data.uri.change }}">
|
|
@@ -105,7 +105,8 @@ const getSampleRequest = ({
|
|
|
105
105
|
statusSet = () => {},
|
|
106
106
|
statusSetCurrentPermission = () => {},
|
|
107
107
|
transactionCost = 1,
|
|
108
|
-
messages = getMessages()
|
|
108
|
+
messages = getMessages(),
|
|
109
|
+
agreementId
|
|
109
110
|
} = {}) => ({
|
|
110
111
|
cache: () => ({
|
|
111
112
|
helpers: {
|
|
@@ -116,7 +117,8 @@ const getSampleRequest = ({
|
|
|
116
117
|
},
|
|
117
118
|
transaction: {
|
|
118
119
|
get: async () => ({
|
|
119
|
-
cost: transactionCost
|
|
120
|
+
cost: transactionCost,
|
|
121
|
+
agreementId
|
|
120
122
|
}),
|
|
121
123
|
getCurrentPermission: () => permission
|
|
122
124
|
}
|
|
@@ -205,17 +207,16 @@ describe('The order completion handler', () => {
|
|
|
205
207
|
})
|
|
206
208
|
|
|
207
209
|
it.each`
|
|
208
|
-
show |
|
|
209
|
-
${true} | ${
|
|
210
|
-
${true} | ${
|
|
211
|
-
${false} | ${
|
|
212
|
-
${false} | ${
|
|
210
|
+
show | agreementId | expected
|
|
211
|
+
${true} | ${'foo123'} | ${true}
|
|
212
|
+
${true} | ${undefined} | ${false}
|
|
213
|
+
${false} | ${'foo123'} | ${false}
|
|
214
|
+
${false} | ${undefined} | ${false}
|
|
213
215
|
`(
|
|
214
|
-
'recurringPayment returns $expected when SHOW_RECURRING_PAYMENTS is $show and the
|
|
215
|
-
async ({ show,
|
|
216
|
+
'recurringPayment returns $expected when SHOW_RECURRING_PAYMENTS is $show and the transaction agreementId is $agreementId',
|
|
217
|
+
async ({ show, agreementId, expected }) => {
|
|
216
218
|
process.env.SHOW_RECURRING_PAYMENTS = show
|
|
217
|
-
const
|
|
218
|
-
const request = getSampleRequest({ permission })
|
|
219
|
+
const request = getSampleRequest({ agreementId })
|
|
219
220
|
const { recurringPayment } = await getData(request)
|
|
220
221
|
|
|
221
222
|
expect(recurringPayment).toBe(expected)
|
|
@@ -41,7 +41,7 @@ export const getData = async request => {
|
|
|
41
41
|
digitalConfirmation: digital && permission.licensee.postalFulfilment,
|
|
42
42
|
digitalLicence: digital && !permission.licensee.postalFulfilment,
|
|
43
43
|
postalLicence: permission.licensee.postalFulfilment,
|
|
44
|
-
recurringPayment: isRecurringPayment(
|
|
44
|
+
recurringPayment: isRecurringPayment(transaction),
|
|
45
45
|
uri: {
|
|
46
46
|
feedback: process.env.FEEDBACK_URI || FEEDBACK_URI_DEFAULT,
|
|
47
47
|
licenceDetails: addLanguageCodeToUri(request, LICENCE_DETAILS.uri),
|
|
@@ -58,7 +58,7 @@ const postalFulfilment = permission => {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
const isRecurringPayment =
|
|
61
|
+
const isRecurringPayment = transaction => process.env.SHOW_RECURRING_PAYMENTS?.toLowerCase() === 'true' && !!transaction.agreementId
|
|
62
62
|
|
|
63
63
|
const digitalConfirmation = permission =>
|
|
64
64
|
permission.licensee.preferredMethodOfConfirmation === HOW_CONTACTED.email ||
|
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
+
exports[`contact-summary > route generateContactRow should generate a contact row with meta tag when includeMeta is true 1`] = `
|
|
4
|
+
Object {
|
|
5
|
+
"actions": Object {
|
|
6
|
+
"items": Array [
|
|
7
|
+
Object {
|
|
8
|
+
"attributes": Object {
|
|
9
|
+
"id": "change-licence-confirmation-option",
|
|
10
|
+
},
|
|
11
|
+
"href": Symbol(decoratedUri),
|
|
12
|
+
"text": "contact-summary-change",
|
|
13
|
+
"visuallyHiddenText": Symbol(contact-summary-hidden-licence-confirmation),
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
"key": Object {
|
|
18
|
+
"text": Symbol(contact-summary-row-contact),
|
|
19
|
+
},
|
|
20
|
+
"value": Object {
|
|
21
|
+
"meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
|
|
22
|
+
"text": "Text message-contact-summary-text-sngl07123432817",
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
exports[`contact-summary > route generateContactRow should generate a contact row without meta tag when includeMeta is false 1`] = `
|
|
28
|
+
Object {
|
|
29
|
+
"actions": Object {
|
|
30
|
+
"items": Array [
|
|
31
|
+
Object {
|
|
32
|
+
"attributes": Object {
|
|
33
|
+
"id": "change-licence-confirmation-option",
|
|
34
|
+
},
|
|
35
|
+
"href": Symbol(decoratedUri),
|
|
36
|
+
"text": "contact-summary-change",
|
|
37
|
+
"visuallyHiddenText": Symbol(contact-summary-hidden-licence-confirmation),
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
"key": Object {
|
|
42
|
+
"text": Symbol(contact-summary-row-contact),
|
|
43
|
+
},
|
|
44
|
+
"value": Object {
|
|
45
|
+
"text": "contact-summary-emailtest@example.com",
|
|
46
|
+
},
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
49
|
+
|
|
3
50
|
exports[`contact-summary > route getLicenseeDetailsSummaryRows when purchasing a 1 or 8 day should display the Licence as Email Me and Newsletter as Please not contact moi 1`] = `
|
|
4
51
|
Array [
|
|
5
52
|
Object {
|
|
@@ -299,6 +346,7 @@ Array [
|
|
|
299
346
|
"text": Symbol(contact-summary-row-licence-details),
|
|
300
347
|
},
|
|
301
348
|
"value": Object {
|
|
349
|
+
"meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
|
|
302
350
|
"text": "contact-summary-license-non-physical",
|
|
303
351
|
},
|
|
304
352
|
},
|
|
@@ -364,6 +412,7 @@ Array [
|
|
|
364
412
|
"text": Symbol(contact-summary-row-licence-details),
|
|
365
413
|
},
|
|
366
414
|
"value": Object {
|
|
415
|
+
"meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
|
|
367
416
|
"text": "contact-summary-license-non-physical",
|
|
368
417
|
},
|
|
369
418
|
},
|
|
@@ -849,7 +898,8 @@ Array [
|
|
|
849
898
|
"text": Symbol(contact-summary-row-contact),
|
|
850
899
|
},
|
|
851
900
|
"value": Object {
|
|
852
|
-
"
|
|
901
|
+
"meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
|
|
902
|
+
"text": "Text messages-contact-summary-text-plrl01234567890",
|
|
853
903
|
},
|
|
854
904
|
},
|
|
855
905
|
Object {
|
|
@@ -934,7 +984,8 @@ Array [
|
|
|
934
984
|
"text": Symbol(contact-summary-row-contact),
|
|
935
985
|
},
|
|
936
986
|
"value": Object {
|
|
937
|
-
"
|
|
987
|
+
"meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
|
|
988
|
+
"text": "Text messages-contact-summary-text-plrl01234567890",
|
|
938
989
|
},
|
|
939
990
|
},
|
|
940
991
|
Object {
|
|
@@ -1039,7 +1090,8 @@ Array [
|
|
|
1039
1090
|
"text": Symbol(contact-summary-row-contact),
|
|
1040
1091
|
},
|
|
1041
1092
|
"value": Object {
|
|
1042
|
-
"
|
|
1093
|
+
"meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
|
|
1094
|
+
"text": "Text messages-contact-summary-text-plrl01234567890",
|
|
1043
1095
|
},
|
|
1044
1096
|
},
|
|
1045
1097
|
Object {
|
|
@@ -1124,7 +1176,8 @@ Array [
|
|
|
1124
1176
|
"text": Symbol(contact-summary-row-contact),
|
|
1125
1177
|
},
|
|
1126
1178
|
"value": Object {
|
|
1127
|
-
"
|
|
1179
|
+
"meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
|
|
1180
|
+
"text": "Text messages-contact-summary-text-plrl01234567890",
|
|
1128
1181
|
},
|
|
1129
1182
|
},
|
|
1130
1183
|
Object {
|
|
@@ -1649,7 +1702,8 @@ Array [
|
|
|
1649
1702
|
"text": Symbol(contact-summary-row-contact),
|
|
1650
1703
|
},
|
|
1651
1704
|
"value": Object {
|
|
1652
|
-
"
|
|
1705
|
+
"meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
|
|
1706
|
+
"text": "Text messages-contact-summary-text-plrl01234567890",
|
|
1653
1707
|
},
|
|
1654
1708
|
},
|
|
1655
1709
|
Object {
|
|
@@ -1754,7 +1808,8 @@ Array [
|
|
|
1754
1808
|
"text": Symbol(contact-summary-row-contact),
|
|
1755
1809
|
},
|
|
1756
1810
|
"value": Object {
|
|
1757
|
-
"
|
|
1811
|
+
"meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
|
|
1812
|
+
"text": "Text messages-contact-summary-text-plrl01234567890",
|
|
1758
1813
|
},
|
|
1759
1814
|
},
|
|
1760
1815
|
Object {
|
|
@@ -1839,7 +1894,8 @@ Array [
|
|
|
1839
1894
|
"text": Symbol(contact-summary-row-licence-conf),
|
|
1840
1895
|
},
|
|
1841
1896
|
"value": Object {
|
|
1842
|
-
"
|
|
1897
|
+
"meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
|
|
1898
|
+
"text": "Text message-contact-summary-text-sngl01234567890",
|
|
1843
1899
|
},
|
|
1844
1900
|
},
|
|
1845
1901
|
Object {
|
|
@@ -1924,7 +1980,8 @@ Array [
|
|
|
1924
1980
|
"text": Symbol(contact-summary-row-licence),
|
|
1925
1981
|
},
|
|
1926
1982
|
"value": Object {
|
|
1927
|
-
"
|
|
1983
|
+
"meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
|
|
1984
|
+
"text": "Text message-contact-summary-text-sngl01234567890",
|
|
1928
1985
|
},
|
|
1929
1986
|
},
|
|
1930
1987
|
Object {
|
|
@@ -2029,7 +2086,8 @@ Array [
|
|
|
2029
2086
|
"text": Symbol(contact-summary-row-licence-conf),
|
|
2030
2087
|
},
|
|
2031
2088
|
"value": Object {
|
|
2032
|
-
"
|
|
2089
|
+
"meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
|
|
2090
|
+
"text": "Text message-contact-summary-text-sngl01234567890",
|
|
2033
2091
|
},
|
|
2034
2092
|
},
|
|
2035
2093
|
Object {
|
|
@@ -2114,7 +2172,8 @@ Array [
|
|
|
2114
2172
|
"text": Symbol(contact-summary-row-licence),
|
|
2115
2173
|
},
|
|
2116
2174
|
"value": Object {
|
|
2117
|
-
"
|
|
2175
|
+
"meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
|
|
2176
|
+
"text": "Text message-contact-summary-text-sngl01234567890",
|
|
2118
2177
|
},
|
|
2119
2178
|
},
|
|
2120
2179
|
Object {
|
|
@@ -2219,7 +2278,8 @@ Array [
|
|
|
2219
2278
|
"text": Symbol(contact-summary-row-licence-conf),
|
|
2220
2279
|
},
|
|
2221
2280
|
"value": Object {
|
|
2222
|
-
"
|
|
2281
|
+
"meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
|
|
2282
|
+
"text": "Text message-contact-summary-text-sngl01234567890",
|
|
2223
2283
|
},
|
|
2224
2284
|
},
|
|
2225
2285
|
Object {
|
|
@@ -2239,7 +2299,8 @@ Array [
|
|
|
2239
2299
|
"text": Symbol(contact-summary-row-contact),
|
|
2240
2300
|
},
|
|
2241
2301
|
"value": Object {
|
|
2242
|
-
"
|
|
2302
|
+
"meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
|
|
2303
|
+
"text": "Text messages-contact-summary-text-plrl01234567890",
|
|
2243
2304
|
},
|
|
2244
2305
|
},
|
|
2245
2306
|
Object {
|
|
@@ -2304,7 +2365,8 @@ Array [
|
|
|
2304
2365
|
"text": Symbol(contact-summary-row-licence),
|
|
2305
2366
|
},
|
|
2306
2367
|
"value": Object {
|
|
2307
|
-
"
|
|
2368
|
+
"meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
|
|
2369
|
+
"text": "Text message-contact-summary-text-sngl01234567890",
|
|
2308
2370
|
},
|
|
2309
2371
|
},
|
|
2310
2372
|
Object {
|
|
@@ -2324,7 +2386,8 @@ Array [
|
|
|
2324
2386
|
"text": Symbol(contact-summary-row-contact),
|
|
2325
2387
|
},
|
|
2326
2388
|
"value": Object {
|
|
2327
|
-
"
|
|
2389
|
+
"meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
|
|
2390
|
+
"text": "Text messages-contact-summary-text-plrl01234567890",
|
|
2328
2391
|
},
|
|
2329
2392
|
},
|
|
2330
2393
|
Object {
|
|
@@ -2409,7 +2472,8 @@ Array [
|
|
|
2409
2472
|
"text": Symbol(contact-summary-row-licence-conf),
|
|
2410
2473
|
},
|
|
2411
2474
|
"value": Object {
|
|
2412
|
-
"
|
|
2475
|
+
"meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
|
|
2476
|
+
"text": "Text message-contact-summary-text-sngl01234567890",
|
|
2413
2477
|
},
|
|
2414
2478
|
},
|
|
2415
2479
|
Object {
|
|
@@ -2429,7 +2493,8 @@ Array [
|
|
|
2429
2493
|
"text": Symbol(contact-summary-row-contact),
|
|
2430
2494
|
},
|
|
2431
2495
|
"value": Object {
|
|
2432
|
-
"
|
|
2496
|
+
"meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
|
|
2497
|
+
"text": "Text messages-contact-summary-text-plrl01234567890",
|
|
2433
2498
|
},
|
|
2434
2499
|
},
|
|
2435
2500
|
Object {
|
|
@@ -2494,7 +2559,8 @@ Array [
|
|
|
2494
2559
|
"text": Symbol(contact-summary-row-licence),
|
|
2495
2560
|
},
|
|
2496
2561
|
"value": Object {
|
|
2497
|
-
"
|
|
2562
|
+
"meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
|
|
2563
|
+
"text": "Text message-contact-summary-text-sngl01234567890",
|
|
2498
2564
|
},
|
|
2499
2565
|
},
|
|
2500
2566
|
Object {
|
|
@@ -2514,7 +2580,8 @@ Array [
|
|
|
2514
2580
|
"text": Symbol(contact-summary-row-contact),
|
|
2515
2581
|
},
|
|
2516
2582
|
"value": Object {
|
|
2517
|
-
"
|
|
2583
|
+
"meta": "<meta name=\\"format-detection\\" content=\\"telephone=no\\">",
|
|
2584
|
+
"text": "Text messages-contact-summary-text-plrl01234567890",
|
|
2518
2585
|
},
|
|
2519
2586
|
},
|
|
2520
2587
|
Object {
|
|
@@ -38,9 +38,8 @@ jest.mock('../../../../processors/licence-type-display.js', () => ({
|
|
|
38
38
|
isPhysical: jest.fn(() => true)
|
|
39
39
|
}))
|
|
40
40
|
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
jest.mock('../../../../routes/page-route.js', () => jest.fn(() => mockRoute))
|
|
41
|
+
const route = require('../route.js')
|
|
42
|
+
jest.mock('../../../../routes/page-route.js')
|
|
44
43
|
const getData = pageRoute.mock.calls[1][4]
|
|
45
44
|
|
|
46
45
|
const getMockCatalog = overrides => ({
|
|
@@ -62,8 +61,8 @@ const getMockCatalog = overrides => ({
|
|
|
62
61
|
contact_summary_row_contact: Symbol('contact-summary-row-contact'),
|
|
63
62
|
contact_summary_row_licence_details: Symbol('contact-summary-row-licence-details'),
|
|
64
63
|
contact_summary_row_newsletter: Symbol('contact-summary-row-newsletter'),
|
|
65
|
-
contact_summary_text_sngl: 'contact-summary-text-sngl',
|
|
66
|
-
contact_summary_text_plrl: 'contact-summary-text-plrl',
|
|
64
|
+
contact_summary_text_sngl: 'Text message-contact-summary-text-sngl',
|
|
65
|
+
contact_summary_text_plrl: 'Text messages-contact-summary-text-plrl',
|
|
67
66
|
contact_summary_title: Symbol('contact-summary-title'),
|
|
68
67
|
no: 'negative, Ghost Rider',
|
|
69
68
|
yes: 'aye',
|
|
@@ -125,10 +124,6 @@ const getRequestMock = ({
|
|
|
125
124
|
})
|
|
126
125
|
|
|
127
126
|
describe('contact-summary > route', () => {
|
|
128
|
-
it('should return result of pageRoute call', () => {
|
|
129
|
-
expect(route).toEqual(mockRoute)
|
|
130
|
-
})
|
|
131
|
-
|
|
132
127
|
it('should set status.fromSummary to seen', async () => {
|
|
133
128
|
const mockPermission = jest.fn()
|
|
134
129
|
const mockRequest = getRequestMock({ setStatusPermission: mockPermission })
|
|
@@ -169,7 +164,6 @@ describe('contact-summary > route', () => {
|
|
|
169
164
|
const mssgCatalog = getMockCatalog({
|
|
170
165
|
[mssgKey]: mssg
|
|
171
166
|
})
|
|
172
|
-
console.log('mssgcat: ', mssgCatalog.yes)
|
|
173
167
|
const samplePermission = getMockPermission({
|
|
174
168
|
preferredMethodOfNewsletter
|
|
175
169
|
})
|
|
@@ -336,4 +330,59 @@ describe('contact-summary > route', () => {
|
|
|
336
330
|
await expect(() => getData(mockRequest)).rejects.toThrowRedirectTo(LICENCE_CONFIRMATION_METHOD.uri)
|
|
337
331
|
})
|
|
338
332
|
})
|
|
333
|
+
|
|
334
|
+
describe('generateContactRow', () => {
|
|
335
|
+
it('should generate a contact row with meta tag when includeMeta is true', () => {
|
|
336
|
+
const permission = {
|
|
337
|
+
licensee: {
|
|
338
|
+
preferredMethodOfReminder: 'Text Me',
|
|
339
|
+
preferredMethodOfConfirmation: 'Text Me',
|
|
340
|
+
mobilePhone: '07123432817'
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
const rowGenerator = new route.RowGenerator(getRequestMock(), permission)
|
|
344
|
+
const decoratedUri = Symbol('decoratedUri')
|
|
345
|
+
addLanguageCodeToUri.mockReturnValue(decoratedUri)
|
|
346
|
+
const row = rowGenerator.generateContactRow({
|
|
347
|
+
label: 'contact_summary_row_contact',
|
|
348
|
+
href: LICENCE_CONFIRMATION_METHOD.uri,
|
|
349
|
+
visuallyHiddenText: 'contact_summary_hidden_licence_confirmation',
|
|
350
|
+
id: 'change-licence-confirmation-option',
|
|
351
|
+
contactTextSpec: {
|
|
352
|
+
EMAIL: 'contact_summary_email',
|
|
353
|
+
TEXT: 'contact_summary_text_sngl',
|
|
354
|
+
DEFAULT: 'contact_summary_default'
|
|
355
|
+
},
|
|
356
|
+
includeMeta: true
|
|
357
|
+
})
|
|
358
|
+
|
|
359
|
+
expect(row).toMatchSnapshot()
|
|
360
|
+
})
|
|
361
|
+
|
|
362
|
+
it('should generate a contact row without meta tag when includeMeta is false', async () => {
|
|
363
|
+
const permission = {
|
|
364
|
+
licensee: {
|
|
365
|
+
preferredMethodOfReminder: 'Email Me',
|
|
366
|
+
preferredMethodOfConfirmation: 'Email Me',
|
|
367
|
+
email: 'test@example.com'
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
const rowGenerator = new route.RowGenerator(getRequestMock(), permission)
|
|
371
|
+
const decoratedUri = Symbol('decoratedUri')
|
|
372
|
+
addLanguageCodeToUri.mockReturnValue(decoratedUri)
|
|
373
|
+
const row = rowGenerator.generateContactRow({
|
|
374
|
+
label: 'contact_summary_row_contact',
|
|
375
|
+
href: LICENCE_CONFIRMATION_METHOD.uri,
|
|
376
|
+
visuallyHiddenText: 'contact_summary_hidden_licence_confirmation',
|
|
377
|
+
id: 'change-licence-confirmation-option',
|
|
378
|
+
contactTextSpec: {
|
|
379
|
+
EMAIL: 'contact_summary_email',
|
|
380
|
+
TEXT: 'contact_summary_text_sngl',
|
|
381
|
+
DEFAULT: 'contact_summary_default'
|
|
382
|
+
}
|
|
383
|
+
})
|
|
384
|
+
|
|
385
|
+
expect(row).toMatchSnapshot()
|
|
386
|
+
})
|
|
387
|
+
})
|
|
339
388
|
})
|
|
@@ -39,7 +39,9 @@ const CONTACT_TEXT_PHYSICAL = {
|
|
|
39
39
|
|
|
40
40
|
const CHANGE_CONTACT = 'change-contact'
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
const META_TAG_TELEPHONE_NO = '<meta name="format-detection" content="telephone=no">'
|
|
43
|
+
|
|
44
|
+
export class RowGenerator {
|
|
43
45
|
constructor (request, permission) {
|
|
44
46
|
this.request = request
|
|
45
47
|
this.permission = permission
|
|
@@ -68,9 +70,9 @@ class RowGenerator {
|
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
72
|
|
|
71
|
-
_generateRow (label, text, rawHref, visuallyHiddenText, id) {
|
|
73
|
+
_generateRow ({ label, text, rawHref, visuallyHiddenText, id, includeMeta = false }) {
|
|
72
74
|
const href = addLanguageCodeToUri(this.request, rawHref)
|
|
73
|
-
|
|
75
|
+
const row = {
|
|
74
76
|
key: {
|
|
75
77
|
text: label
|
|
76
78
|
},
|
|
@@ -90,10 +92,22 @@ class RowGenerator {
|
|
|
90
92
|
}
|
|
91
93
|
})
|
|
92
94
|
}
|
|
95
|
+
|
|
96
|
+
if (includeMeta) {
|
|
97
|
+
row.value.meta = META_TAG_TELEPHONE_NO
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return row
|
|
93
101
|
}
|
|
94
102
|
|
|
95
103
|
generateStandardRow (label, text, rawHref, visuallyHiddenText, id) {
|
|
96
|
-
return this._generateRow(
|
|
104
|
+
return this._generateRow({
|
|
105
|
+
label: this.labels[label],
|
|
106
|
+
text: this.labels[text],
|
|
107
|
+
rawHref,
|
|
108
|
+
visuallyHiddenText: this.labels[visuallyHiddenText],
|
|
109
|
+
id
|
|
110
|
+
})
|
|
97
111
|
}
|
|
98
112
|
|
|
99
113
|
generateAddressRow (countryName) {
|
|
@@ -102,21 +116,28 @@ class RowGenerator {
|
|
|
102
116
|
.filter(Boolean)
|
|
103
117
|
.join(', ')
|
|
104
118
|
|
|
105
|
-
return this._generateRow(
|
|
106
|
-
this.labels.contact_summary_row_address,
|
|
119
|
+
return this._generateRow({
|
|
120
|
+
label: this.labels.contact_summary_row_address,
|
|
107
121
|
text,
|
|
108
|
-
ADDRESS_LOOKUP.uri,
|
|
109
|
-
this.labels.contact_summary_hidden_address,
|
|
110
|
-
'change-address'
|
|
111
|
-
)
|
|
122
|
+
rawHref: ADDRESS_LOOKUP.uri,
|
|
123
|
+
visuallyHiddenText: this.labels.contact_summary_hidden_address,
|
|
124
|
+
id: 'change-address'
|
|
125
|
+
})
|
|
112
126
|
}
|
|
113
127
|
|
|
114
|
-
generateContactRow (label, href, visuallyHiddenText, id, contactTextSpec = CONTACT_TEXT_DEFAULT) {
|
|
128
|
+
generateContactRow ({ label, href, visuallyHiddenText, id, contactTextSpec = CONTACT_TEXT_DEFAULT, includeMeta = false }) {
|
|
115
129
|
const contactText =
|
|
116
130
|
label === 'contact_summary_row_contact'
|
|
117
131
|
? this._getPreferredMethodOfReminderText(contactTextSpec)
|
|
118
132
|
: this._getPreferredMethodOfConfirmation(contactTextSpec)
|
|
119
|
-
return this._generateRow(
|
|
133
|
+
return this._generateRow({
|
|
134
|
+
label: this.labels[label],
|
|
135
|
+
text: contactText,
|
|
136
|
+
rawHref: href,
|
|
137
|
+
visuallyHiddenText: this.labels[visuallyHiddenText],
|
|
138
|
+
id,
|
|
139
|
+
includeMeta
|
|
140
|
+
})
|
|
120
141
|
}
|
|
121
142
|
}
|
|
122
143
|
|
|
@@ -145,6 +166,8 @@ const getLicenseeDetailsSummaryRows = (permission, countryName, request) => {
|
|
|
145
166
|
const rowGenerator = new RowGenerator(request, permission)
|
|
146
167
|
|
|
147
168
|
const licenseeSummaryArray = [rowGenerator.generateAddressRow(countryName)]
|
|
169
|
+
const confirmationText = permission.licensee.preferredMethodOfConfirmation === HOW_CONTACTED.text
|
|
170
|
+
const reminderText = permission.licensee.preferredMethodOfReminder === HOW_CONTACTED.text
|
|
148
171
|
if (isPhysical(permission)) {
|
|
149
172
|
if (permission.licensee.postalFulfilment) {
|
|
150
173
|
licenseeSummaryArray.push(
|
|
@@ -155,42 +178,46 @@ const getLicenseeDetailsSummaryRows = (permission, countryName, request) => {
|
|
|
155
178
|
'contact_summary_hidden_licence_fulfilment',
|
|
156
179
|
'change-licence-fulfilment-option'
|
|
157
180
|
),
|
|
158
|
-
rowGenerator.generateContactRow(
|
|
159
|
-
'contact_summary_row_licence_conf',
|
|
160
|
-
LICENCE_CONFIRMATION_METHOD.uri,
|
|
161
|
-
'contact_summary_hidden_licence_confirmation',
|
|
162
|
-
'change-licence-confirmation-option'
|
|
163
|
-
|
|
181
|
+
rowGenerator.generateContactRow({
|
|
182
|
+
label: 'contact_summary_row_licence_conf',
|
|
183
|
+
href: LICENCE_CONFIRMATION_METHOD.uri,
|
|
184
|
+
visuallyHiddenText: 'contact_summary_hidden_licence_confirmation',
|
|
185
|
+
id: 'change-licence-confirmation-option',
|
|
186
|
+
includeMeta: confirmationText
|
|
187
|
+
})
|
|
164
188
|
)
|
|
165
189
|
} else {
|
|
166
190
|
licenseeSummaryArray.push(
|
|
167
|
-
rowGenerator.generateContactRow(
|
|
168
|
-
'contact_summary_row_licence',
|
|
169
|
-
LICENCE_FULFILMENT.uri,
|
|
170
|
-
'contact_summary_hidden_licence_confirmation',
|
|
171
|
-
'change-licence-confirmation-option'
|
|
172
|
-
|
|
191
|
+
rowGenerator.generateContactRow({
|
|
192
|
+
label: 'contact_summary_row_licence',
|
|
193
|
+
href: LICENCE_FULFILMENT.uri,
|
|
194
|
+
visuallyHiddenText: 'contact_summary_hidden_licence_confirmation',
|
|
195
|
+
id: 'change-licence-confirmation-option',
|
|
196
|
+
includeMeta: confirmationText
|
|
197
|
+
})
|
|
173
198
|
)
|
|
174
199
|
}
|
|
175
200
|
|
|
176
201
|
licenseeSummaryArray.push(
|
|
177
|
-
rowGenerator.generateContactRow(
|
|
178
|
-
'contact_summary_row_contact',
|
|
179
|
-
CONTACT.uri,
|
|
180
|
-
'contact_summary_hidden_contact',
|
|
181
|
-
CHANGE_CONTACT,
|
|
182
|
-
CONTACT_TEXT_PHYSICAL
|
|
183
|
-
|
|
202
|
+
rowGenerator.generateContactRow({
|
|
203
|
+
label: 'contact_summary_row_contact',
|
|
204
|
+
href: CONTACT.uri,
|
|
205
|
+
visuallyHiddenText: 'contact_summary_hidden_contact',
|
|
206
|
+
id: CHANGE_CONTACT,
|
|
207
|
+
contactTextSpec: CONTACT_TEXT_PHYSICAL,
|
|
208
|
+
includeMeta: reminderText
|
|
209
|
+
})
|
|
184
210
|
)
|
|
185
211
|
} else {
|
|
186
212
|
licenseeSummaryArray.push(
|
|
187
|
-
rowGenerator.generateContactRow(
|
|
188
|
-
'contact_summary_row_licence_details',
|
|
189
|
-
CONTACT.uri,
|
|
190
|
-
'contact_summary_hidden_contact',
|
|
191
|
-
CHANGE_CONTACT,
|
|
192
|
-
CONTACT_TEXT_NON_PHYSICAL
|
|
193
|
-
|
|
213
|
+
rowGenerator.generateContactRow({
|
|
214
|
+
label: 'contact_summary_row_licence_details',
|
|
215
|
+
href: CONTACT.uri,
|
|
216
|
+
visuallyHiddenText: 'contact_summary_hidden_contact',
|
|
217
|
+
id: CHANGE_CONTACT,
|
|
218
|
+
contactTextSpec: CONTACT_TEXT_NON_PHYSICAL,
|
|
219
|
+
includeMeta: reminderText
|
|
220
|
+
})
|
|
194
221
|
)
|
|
195
222
|
}
|
|
196
223
|
|