1
1
import { css } from '@emotion/react' ;
2
2
import {
3
- brand ,
4
3
from ,
5
4
headline ,
6
- neutral ,
5
+ palette ,
7
6
space ,
8
7
textSans ,
9
8
until ,
@@ -17,23 +16,20 @@ import {
17
16
import type { ChangeEvent , Dispatch , FormEvent , SetStateAction } from 'react' ;
18
17
import { useContext , useState } from 'react' ;
19
18
import { Link , useLocation , useNavigate } from 'react-router-dom' ;
20
- import type { DeliveryAddress } from '../../../../../shared/productResponse' ;
21
- import type {
22
- ProductType ,
23
- WithProductType ,
24
- } from '../../../../../shared/productTypes' ;
25
- import { GROUPED_PRODUCT_TYPES } from '../../../../../shared/productTypes' ;
26
- import { addressChangeAffectedInfo } from '../../../../utilities/deliveryAddress' ;
27
- import { flattenEquivalent } from '../../../../utilities/utils' ;
19
+ import { addressChangeAffectedInfo } from '@/client/utilities/deliveryAddress' ;
20
+ import { flattenEquivalent } from '@/client/utilities/utils' ;
21
+ import type { DeliveryAddress } from '@/shared/productResponse' ;
22
+ import type { ProductType , WithProductType } from '@/shared/productTypes' ;
23
+ import { GROUPED_PRODUCT_TYPES } from '@/shared/productTypes' ;
28
24
import { CallCentreEmailAndNumbers } from '../../../shared/CallCenterEmailAndNumbers' ;
29
25
import { CallCentreNumbers } from '../../../shared/CallCentreNumbers' ;
30
26
import { Input } from '../../../shared/Input' ;
31
27
import { NAV_LINKS } from '../../../shared/nav/NavConfig' ;
32
28
import { COUNTRIES } from '../../identity/models' ;
33
29
import { InfoIconDark } from '../../shared/assets/InfoIconDark' ;
34
30
import { InfoSection } from '../../shared/InfoSection' ;
35
- import { ProductDescriptionListTable } from '../../shared/ProductDescriptionListTable' ;
36
31
import type { ProductDescriptionListKeyValue } from '../../shared/ProductDescriptionListTable' ;
32
+ import { ProductDescriptionListTable } from '../../shared/ProductDescriptionListTable' ;
37
33
import { ProgressIndicator } from '../../shared/ProgressIndicator' ;
38
34
import type { AddressSetStateObject } from './DeliveryAddressFormContext' ;
39
35
import {
@@ -142,7 +138,7 @@ const Form = (props: FormProps) => {
142
138
< form action = "#" onSubmit = { handleFormSubmit } >
143
139
< fieldset
144
140
css = { {
145
- border : `1px solid ${ neutral [ '86' ] } ` ,
141
+ border : `1px solid ${ palette . neutral [ '86' ] } ` ,
146
142
padding : '48px 14px 14px' ,
147
143
position : 'relative' ,
148
144
marginBottom : `${ space [ 5 ] } px` ,
@@ -161,8 +157,8 @@ const Form = (props: FormProps) => {
161
157
${ textSans . medium ( ) } ;
162
158
font- weight: bold;
163
159
line-height: 48px;
164
- background- color : ${ neutral [ '97' ] } ;
165
- bor der- botto m: 1px solid ${ neutral [ '86' ] } ;
160
+ background- color : ${ palette . neutral [ '97' ] } ;
161
+ bor der- botto m: 1px solid ${ palette . neutral [ '86' ] } ;
166
162
` }
167
163
>
168
164
Delivery address
@@ -242,7 +238,7 @@ const Form = (props: FormProps) => {
242
238
< label
243
239
css = { css `
244
240
dis play: block;
245
- color : ${ neutral [ '7' ] } ;
241
+ color : ${ palette . neutral [ '7' ] } ;
246
242
${ textSans . medium ( ) } ;
247
243
font- weight: bold;
248
244
` }
@@ -276,7 +272,8 @@ const Form = (props: FormProps) => {
276
272
} }
277
273
css = { css `
278
274
width: 100%;
279
- bor der: 2px solid ${ neutral [ '60' ] } ;
275
+ bor der: 2px solid
276
+ ${ palette . neutral [ '60' ] } ;
280
277
padding: 12px;
281
278
resize: vertical;
282
279
${ textSans . medium ( ) } ;
@@ -287,7 +284,7 @@ const Form = (props: FormProps) => {
287
284
dis play: block;
288
285
text- align: right;
289
286
${ textSans . small ( ) } ;
290
- color : ${ neutral [ 46 ] } ;
287
+ color : ${ palette . neutral [ 46 ] } ;
291
288
` }
292
289
>
293
290
{ instructionsRemainingCharacters } { ' ' }
@@ -298,7 +295,7 @@ const Form = (props: FormProps) => {
298
295
css = { css `
299
296
dis play: block;
300
297
${ textSans . medium ( ) } ;
301
- bor der: 4px solid ${ brand [ 500 ] } ;
298
+ bor der: 4px solid ${ palette . brand [ 500 ] } ;
302
299
padding: ${ space [ 5 ] } px ${ space [ 5 ] } px
303
300
${ space [ 5 ] } px 49px;
304
301
margin: ${ space [ 3 ] } px 0;
@@ -324,7 +321,9 @@ const Form = (props: FormProps) => {
324
321
left: ${ space [ 5 ] } px;
325
322
` }
326
323
>
327
- < InfoIconDark fillColor = { brand [ 500 ] } />
324
+ < InfoIconDark
325
+ fillColor = { palette . brand [ 500 ] }
326
+ />
328
327
</ i >
329
328
Delivery instructions are only applicable
330
329
for newspaper deliveries. They do not apply
@@ -376,7 +375,7 @@ const Form = (props: FormProps) => {
376
375
${ textSans . medium ( ) } ;
377
376
font- weight: bold;
378
377
margin- left: 22px;
379
- color : ${ brand [ 400 ] } ;
378
+ color : ${ palette . brand [ 400 ] } ;
380
379
` }
381
380
>
382
381
Cancel
@@ -389,15 +388,15 @@ const Form = (props: FormProps) => {
389
388
css = { css `
390
389
${ textSans . medium ( ) } ;
391
390
margin: ${ space [ 12 ] } px 0 0;
392
- color : ${ neutral [ 46 ] } ;
391
+ color : ${ palette . neutral [ 46 ] } ;
393
392
` }
394
393
>
395
394
If you need separate delivery addresses for each of your
396
395
subscriptions, please{ ' ' }
397
396
< span
398
397
css = { css `
399
398
cursor : pointer;
400
- color : ${ brand [ 500 ] } ;
399
+ color : ${ palette . brand [ 500 ] } ;
401
400
text- decor ation: underline;
402
401
` }
403
402
onClick = { ( ) =>
@@ -421,9 +420,11 @@ export const DeliveryAddressUpdate = (props: WithProductType<ProductType>) => {
421
420
const [ formErrors , setFormErrors ] = useState ( { isValid : false } ) ;
422
421
const contactIdToArrayOfProductDetailAndProductType =
423
422
useContext ( ContactIdContext ) ;
423
+ const [ showTopCallCentreNumbers , setTopCallCentreNumbersVisibility ] =
424
+ useState < boolean > ( false ) ;
424
425
425
426
const subHeadingCss = `
426
- border-top: 1px solid ${ neutral [ '86' ] } ;
427
+ border-top: 1px solid ${ palette . neutral [ '86' ] } ;
427
428
${ headline . small ( ) } ;
428
429
font-weight: bold;
429
430
margin-top: 50px;
@@ -433,6 +434,67 @@ export const DeliveryAddressUpdate = (props: WithProductType<ProductType>) => {
433
434
};
434
435
` ;
435
436
437
+ const hasNationalDelivery = Object . values (
438
+ contactIdToArrayOfProductDetailAndProductType ,
439
+ )
440
+ . flatMap ( flattenEquivalent )
441
+ . some ( ( { productDetail } ) => {
442
+ return GROUPED_PRODUCT_TYPES . subscriptions
443
+ . mapGroupedToSpecific ( productDetail )
444
+ . productType === 'nationaldelivery' ;
445
+ } ) ;
446
+
447
+ if ( hasNationalDelivery ) {
448
+ return (
449
+ < >
450
+ < p
451
+ css = { css `
452
+ dis play: block;
453
+ ${ textSans . medium ( ) } ;
454
+ bor der: 4px solid ${ palette . brand [ '500' ] } ;
455
+ padding: ${ space [ 5 ] } px ${ space [ 5 ] } px ${ space [ 5 ] } px 49px;
456
+ margin- to p: 12px;
457
+ position: relative;
458
+ ${ from . tablet } {
459
+ dis play: inline-block;
460
+ vertical- align: to p;
461
+ width: calc(100% - (30ch + ${ space [ 3 ] } px + 2px));
462
+ }
463
+ ` }
464
+ >
465
+ < i
466
+ css = { css `
467
+ width: 17px;
468
+ height: 17px;
469
+ position: absolute;
470
+ to p: ${ space [ 5 ] } px;
471
+ left: ${ space [ 5 ] } px;
472
+ ` }
473
+ >
474
+ < InfoIconDark fillColor = { palette . brand [ 500 ] } />
475
+ </ i >
476
+ Changed address? Please{ ' ' }
477
+ < span
478
+ css = { css `
479
+ cursor : pointer;
480
+ color : ${ palette . brand [ 500 ] } ;
481
+ text- decor ation: underline;
482
+ ` }
483
+ onClick = { ( ) =>
484
+ setTopCallCentreNumbersVisibility (
485
+ ! showTopCallCentreNumbers ,
486
+ )
487
+ }
488
+ >
489
+ call our customer support team
490
+ </ span > { ' ' }
491
+ to update your delivery details.
492
+ </ p >
493
+ { showTopCallCentreNumbers && < CallCentreEmailAndNumbers /> }
494
+ </ >
495
+ ) ;
496
+ }
497
+
436
498
return (
437
499
< >
438
500
< ProgressIndicator
0 commit comments