@financial-times/n-conversion-forms 41.0.5 → 41.2.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/.toolkitstate/ci.json +3 -3
- package/README.md +15 -1
- package/components/__snapshots__/payment-type.spec.js.snap +150 -0
- package/components/__snapshots__/year-of-birth.spec.js.snap +200 -0
- package/components/index.js +3 -0
- package/components/payment-type.jsx +8 -0
- package/components/payment-type.stories.js +1 -0
- package/components/proceed-with-payment-link.jsx +47 -0
- package/components/proceed-with-payment-link.stories.js +31 -0
- package/components/subscription-confirmation-with-payment-link.jsx +60 -0
- package/components/subscription-confirmation-with-payment-link.stories.js +65 -0
- package/components/year-of-birth.jsx +75 -0
- package/components/year-of-birth.spec.js +53 -0
- package/components/year-of-birth.stories.js +15 -0
- package/dist/index.js +22 -1
- package/dist/payment-type.jsx +11 -3
- package/dist/proceed-with-payment-link.jsx +51 -0
- package/dist/subscription-confirmation-with-payment-link.jsx +51 -0
- package/dist/year-of-birth.jsx +82 -0
- package/main.scss +2 -0
- package/package.json +1 -1
- package/styles/proceed-with-payment-link.scss +69 -0
- package/styles/subscription-confirmation-with-payment-link.scss +86 -0
- package/utils/payment-type.js +4 -0
- package/utils/submit.js +14 -0
- package/utils/subscription-confirmation-with-payment-link.js +78 -0
- package/utils/subscription-confirmation-with-payment-link.spec.js +117 -0
- package/utils/validation.js +36 -16
- package/utils/year-of-birth.js +24 -0
package/.toolkitstate/ci.json
CHANGED
package/README.md
CHANGED
|
@@ -345,7 +345,7 @@ You can add some custom validation functionality as follows:
|
|
|
345
345
|
|
|
346
346
|
```js
|
|
347
347
|
validation.addCustomValidation({
|
|
348
|
-
errorMessage: 'Custom error message here.',
|
|
348
|
+
errorMessage: 'Custom error message here.', // can be a string or a function return that returns a string
|
|
349
349
|
field: domElementToValidate,
|
|
350
350
|
validator: () => {
|
|
351
351
|
// Custom validation code here. *Must* return truthy or falsey.
|
|
@@ -355,6 +355,20 @@ validation.addCustomValidation({
|
|
|
355
355
|
|
|
356
356
|
If the validation fails, the field will look like it usually does when validation fails with your specified message displayed underneath.
|
|
357
357
|
|
|
358
|
+
### YearOfBirth
|
|
359
|
+
|
|
360
|
+
The Year of Birth utility provides a more friendly way to get the value in the input field and add event listener on blur.
|
|
361
|
+
|
|
362
|
+
```js
|
|
363
|
+
const yearOfBirth = new YearOfBirth(document));
|
|
364
|
+
// Get the value in the input field
|
|
365
|
+
const yearOfBirthInputValue = yearOfBirth.getYearOfBirth();
|
|
366
|
+
// add event listener to the input field on blur
|
|
367
|
+
yearOfBirth.handleYearOfBirthBlur(() => {
|
|
368
|
+
doSomething();
|
|
369
|
+
});
|
|
370
|
+
```
|
|
371
|
+
|
|
358
372
|
### Zuora
|
|
359
373
|
|
|
360
374
|
The Zuora utility aims to wrap the Zuora client side library to make it more user friendly.
|
|
@@ -82,6 +82,21 @@ exports[`PaymentType can initialise with the loader visible 1`] = `
|
|
|
82
82
|
</span>
|
|
83
83
|
</label>
|
|
84
84
|
</div>
|
|
85
|
+
<div class="o-forms-input--radio-box__container ncf__payment-type ncf__payment-type--zuorapaymentlink ncf__hidden">
|
|
86
|
+
<label for="zuorapaymentlink">
|
|
87
|
+
<input type="radio"
|
|
88
|
+
name="paymentType"
|
|
89
|
+
value="zuorapaymentlink"
|
|
90
|
+
id="zuorapaymentlink"
|
|
91
|
+
aria-label="Zuora Payment"
|
|
92
|
+
>
|
|
93
|
+
<span class="o-forms-input__label"
|
|
94
|
+
aria-hidden="true"
|
|
95
|
+
>
|
|
96
|
+
Zuora Payment
|
|
97
|
+
</span>
|
|
98
|
+
</label>
|
|
99
|
+
</div>
|
|
85
100
|
</div>
|
|
86
101
|
<div class="o-forms-input__error">
|
|
87
102
|
Please enter a valid payment type
|
|
@@ -173,6 +188,21 @@ exports[`PaymentType render with default props 1`] = `
|
|
|
173
188
|
</span>
|
|
174
189
|
</label>
|
|
175
190
|
</div>
|
|
191
|
+
<div class="o-forms-input--radio-box__container ncf__payment-type ncf__payment-type--zuorapaymentlink ncf__hidden">
|
|
192
|
+
<label for="zuorapaymentlink">
|
|
193
|
+
<input type="radio"
|
|
194
|
+
name="paymentType"
|
|
195
|
+
value="zuorapaymentlink"
|
|
196
|
+
id="zuorapaymentlink"
|
|
197
|
+
aria-label="Zuora Payment"
|
|
198
|
+
>
|
|
199
|
+
<span class="o-forms-input__label"
|
|
200
|
+
aria-hidden="true"
|
|
201
|
+
>
|
|
202
|
+
Zuora Payment
|
|
203
|
+
</span>
|
|
204
|
+
</label>
|
|
205
|
+
</div>
|
|
176
206
|
</div>
|
|
177
207
|
<div class="o-forms-input__error">
|
|
178
208
|
Please enter a valid payment type
|
|
@@ -264,6 +294,21 @@ exports[`PaymentType render with enableApplepay 1`] = `
|
|
|
264
294
|
</span>
|
|
265
295
|
</label>
|
|
266
296
|
</div>
|
|
297
|
+
<div class="o-forms-input--radio-box__container ncf__payment-type ncf__payment-type--zuorapaymentlink ncf__hidden">
|
|
298
|
+
<label for="zuorapaymentlink">
|
|
299
|
+
<input type="radio"
|
|
300
|
+
name="paymentType"
|
|
301
|
+
value="zuorapaymentlink"
|
|
302
|
+
id="zuorapaymentlink"
|
|
303
|
+
aria-label="Zuora Payment"
|
|
304
|
+
>
|
|
305
|
+
<span class="o-forms-input__label"
|
|
306
|
+
aria-hidden="true"
|
|
307
|
+
>
|
|
308
|
+
Zuora Payment
|
|
309
|
+
</span>
|
|
310
|
+
</label>
|
|
311
|
+
</div>
|
|
267
312
|
</div>
|
|
268
313
|
<div class="o-forms-input__error">
|
|
269
314
|
Please enter a valid payment type
|
|
@@ -355,6 +400,21 @@ exports[`PaymentType render with enableBankTransfer 1`] = `
|
|
|
355
400
|
</span>
|
|
356
401
|
</label>
|
|
357
402
|
</div>
|
|
403
|
+
<div class="o-forms-input--radio-box__container ncf__payment-type ncf__payment-type--zuorapaymentlink ncf__hidden">
|
|
404
|
+
<label for="zuorapaymentlink">
|
|
405
|
+
<input type="radio"
|
|
406
|
+
name="paymentType"
|
|
407
|
+
value="zuorapaymentlink"
|
|
408
|
+
id="zuorapaymentlink"
|
|
409
|
+
aria-label="Zuora Payment"
|
|
410
|
+
>
|
|
411
|
+
<span class="o-forms-input__label"
|
|
412
|
+
aria-hidden="true"
|
|
413
|
+
>
|
|
414
|
+
Zuora Payment
|
|
415
|
+
</span>
|
|
416
|
+
</label>
|
|
417
|
+
</div>
|
|
358
418
|
</div>
|
|
359
419
|
<div class="o-forms-input__error">
|
|
360
420
|
Please enter a valid payment type
|
|
@@ -446,6 +506,21 @@ exports[`PaymentType render with enableCreditcard 1`] = `
|
|
|
446
506
|
</span>
|
|
447
507
|
</label>
|
|
448
508
|
</div>
|
|
509
|
+
<div class="o-forms-input--radio-box__container ncf__payment-type ncf__payment-type--zuorapaymentlink ncf__hidden">
|
|
510
|
+
<label for="zuorapaymentlink">
|
|
511
|
+
<input type="radio"
|
|
512
|
+
name="paymentType"
|
|
513
|
+
value="zuorapaymentlink"
|
|
514
|
+
id="zuorapaymentlink"
|
|
515
|
+
aria-label="Zuora Payment"
|
|
516
|
+
>
|
|
517
|
+
<span class="o-forms-input__label"
|
|
518
|
+
aria-hidden="true"
|
|
519
|
+
>
|
|
520
|
+
Zuora Payment
|
|
521
|
+
</span>
|
|
522
|
+
</label>
|
|
523
|
+
</div>
|
|
449
524
|
</div>
|
|
450
525
|
<div class="o-forms-input__error">
|
|
451
526
|
Please enter a valid payment type
|
|
@@ -556,6 +631,21 @@ exports[`PaymentType render with enableDirectdebit 1`] = `
|
|
|
556
631
|
</span>
|
|
557
632
|
</label>
|
|
558
633
|
</div>
|
|
634
|
+
<div class="o-forms-input--radio-box__container ncf__payment-type ncf__payment-type--zuorapaymentlink ncf__hidden">
|
|
635
|
+
<label for="zuorapaymentlink">
|
|
636
|
+
<input type="radio"
|
|
637
|
+
name="paymentType"
|
|
638
|
+
value="zuorapaymentlink"
|
|
639
|
+
id="zuorapaymentlink"
|
|
640
|
+
aria-label="Zuora Payment"
|
|
641
|
+
>
|
|
642
|
+
<span class="o-forms-input__label"
|
|
643
|
+
aria-hidden="true"
|
|
644
|
+
>
|
|
645
|
+
Zuora Payment
|
|
646
|
+
</span>
|
|
647
|
+
</label>
|
|
648
|
+
</div>
|
|
559
649
|
</div>
|
|
560
650
|
<div class="o-forms-input__error">
|
|
561
651
|
Please enter a valid payment type
|
|
@@ -705,6 +795,21 @@ exports[`PaymentType render with enablePaypal 1`] = `
|
|
|
705
795
|
</span>
|
|
706
796
|
</label>
|
|
707
797
|
</div>
|
|
798
|
+
<div class="o-forms-input--radio-box__container ncf__payment-type ncf__payment-type--zuorapaymentlink ncf__hidden">
|
|
799
|
+
<label for="zuorapaymentlink">
|
|
800
|
+
<input type="radio"
|
|
801
|
+
name="paymentType"
|
|
802
|
+
value="zuorapaymentlink"
|
|
803
|
+
id="zuorapaymentlink"
|
|
804
|
+
aria-label="Zuora Payment"
|
|
805
|
+
>
|
|
806
|
+
<span class="o-forms-input__label"
|
|
807
|
+
aria-hidden="true"
|
|
808
|
+
>
|
|
809
|
+
Zuora Payment
|
|
810
|
+
</span>
|
|
811
|
+
</label>
|
|
812
|
+
</div>
|
|
708
813
|
</div>
|
|
709
814
|
<div class="o-forms-input__error">
|
|
710
815
|
Please enter a valid payment type
|
|
@@ -796,6 +901,21 @@ exports[`PaymentType render with isSingleTerm 1`] = `
|
|
|
796
901
|
</span>
|
|
797
902
|
</label>
|
|
798
903
|
</div>
|
|
904
|
+
<div class="o-forms-input--radio-box__container ncf__payment-type ncf__payment-type--zuorapaymentlink ncf__hidden">
|
|
905
|
+
<label for="zuorapaymentlink">
|
|
906
|
+
<input type="radio"
|
|
907
|
+
name="paymentType"
|
|
908
|
+
value="zuorapaymentlink"
|
|
909
|
+
id="zuorapaymentlink"
|
|
910
|
+
aria-label="Zuora Payment"
|
|
911
|
+
>
|
|
912
|
+
<span class="o-forms-input__label"
|
|
913
|
+
aria-hidden="true"
|
|
914
|
+
>
|
|
915
|
+
Zuora Payment
|
|
916
|
+
</span>
|
|
917
|
+
</label>
|
|
918
|
+
</div>
|
|
799
919
|
</div>
|
|
800
920
|
<div class="o-forms-input__error">
|
|
801
921
|
Please enter a valid payment type
|
|
@@ -900,6 +1020,21 @@ exports[`PaymentType render with isSingleTermChecked 1`] = `
|
|
|
900
1020
|
</span>
|
|
901
1021
|
</label>
|
|
902
1022
|
</div>
|
|
1023
|
+
<div class="o-forms-input--radio-box__container ncf__payment-type ncf__payment-type--zuorapaymentlink ncf__hidden">
|
|
1024
|
+
<label for="zuorapaymentlink">
|
|
1025
|
+
<input type="radio"
|
|
1026
|
+
name="paymentType"
|
|
1027
|
+
value="zuorapaymentlink"
|
|
1028
|
+
id="zuorapaymentlink"
|
|
1029
|
+
aria-label="Zuora Payment"
|
|
1030
|
+
>
|
|
1031
|
+
<span class="o-forms-input__label"
|
|
1032
|
+
aria-hidden="true"
|
|
1033
|
+
>
|
|
1034
|
+
Zuora Payment
|
|
1035
|
+
</span>
|
|
1036
|
+
</label>
|
|
1037
|
+
</div>
|
|
903
1038
|
</div>
|
|
904
1039
|
<div class="o-forms-input__error">
|
|
905
1040
|
Please enter a valid payment type
|
|
@@ -1005,6 +1140,21 @@ exports[`PaymentType render with value 1`] = `
|
|
|
1005
1140
|
</span>
|
|
1006
1141
|
</label>
|
|
1007
1142
|
</div>
|
|
1143
|
+
<div class="o-forms-input--radio-box__container ncf__payment-type ncf__payment-type--zuorapaymentlink ncf__hidden">
|
|
1144
|
+
<label for="zuorapaymentlink">
|
|
1145
|
+
<input type="radio"
|
|
1146
|
+
name="paymentType"
|
|
1147
|
+
value="zuorapaymentlink"
|
|
1148
|
+
id="zuorapaymentlink"
|
|
1149
|
+
aria-label="Zuora Payment"
|
|
1150
|
+
>
|
|
1151
|
+
<span class="o-forms-input__label"
|
|
1152
|
+
aria-hidden="true"
|
|
1153
|
+
>
|
|
1154
|
+
Zuora Payment
|
|
1155
|
+
</span>
|
|
1156
|
+
</label>
|
|
1157
|
+
</div>
|
|
1008
1158
|
</div>
|
|
1009
1159
|
<div class="o-forms-input__error">
|
|
1010
1160
|
Please enter a valid payment type
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`YearOfBirth render a year of birth input with default value 1`] = `
|
|
4
|
+
<label id="yearOfBirthField"
|
|
5
|
+
for="yearOfBirth"
|
|
6
|
+
class="o-forms-field ncf__validation-error"
|
|
7
|
+
data-validate="required,number"
|
|
8
|
+
>
|
|
9
|
+
<span class="o-forms-title">
|
|
10
|
+
<span class="o-forms-title__main">
|
|
11
|
+
Year of birth
|
|
12
|
+
</span>
|
|
13
|
+
<span class="o-forms-title__prompt">
|
|
14
|
+
</span>
|
|
15
|
+
</span>
|
|
16
|
+
<span class="o-forms-input o-forms-input--text">
|
|
17
|
+
<input type="number"
|
|
18
|
+
id="yearOfBirth"
|
|
19
|
+
name="yearOfBirth"
|
|
20
|
+
placeholder="YYYY"
|
|
21
|
+
autocomplete="bday-year"
|
|
22
|
+
minlength="4"
|
|
23
|
+
maxlength="4"
|
|
24
|
+
data-trackable="year-of-birth"
|
|
25
|
+
aria-required="true"
|
|
26
|
+
required
|
|
27
|
+
value="2001"
|
|
28
|
+
>
|
|
29
|
+
<span class="o-forms-input__error">
|
|
30
|
+
Please enter a valid year of birth
|
|
31
|
+
</span>
|
|
32
|
+
</span>
|
|
33
|
+
</label>
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
exports[`YearOfBirth render a year of birth input with disabled field 1`] = `
|
|
37
|
+
<label id="yearOfBirthField"
|
|
38
|
+
for="yearOfBirth"
|
|
39
|
+
class="o-forms-field ncf__validation-error"
|
|
40
|
+
data-validate="required,number"
|
|
41
|
+
>
|
|
42
|
+
<span class="o-forms-title">
|
|
43
|
+
<span class="o-forms-title__main">
|
|
44
|
+
Year of birth
|
|
45
|
+
</span>
|
|
46
|
+
<span class="o-forms-title__prompt">
|
|
47
|
+
</span>
|
|
48
|
+
</span>
|
|
49
|
+
<span class="o-forms-input o-forms-input--text">
|
|
50
|
+
<input type="number"
|
|
51
|
+
id="yearOfBirth"
|
|
52
|
+
name="yearOfBirth"
|
|
53
|
+
placeholder="YYYY"
|
|
54
|
+
autocomplete="bday-year"
|
|
55
|
+
minlength="4"
|
|
56
|
+
maxlength="4"
|
|
57
|
+
data-trackable="year-of-birth"
|
|
58
|
+
aria-required="true"
|
|
59
|
+
required
|
|
60
|
+
disabled
|
|
61
|
+
value="2001"
|
|
62
|
+
>
|
|
63
|
+
<span class="o-forms-input__error">
|
|
64
|
+
Please enter a valid year of birth
|
|
65
|
+
</span>
|
|
66
|
+
</span>
|
|
67
|
+
</label>
|
|
68
|
+
`;
|
|
69
|
+
|
|
70
|
+
exports[`YearOfBirth renders a year of birth input with custom prompt 1`] = `
|
|
71
|
+
<label id="yearOfBirthField"
|
|
72
|
+
for="yearOfBirth"
|
|
73
|
+
class="o-forms-field ncf__validation-error"
|
|
74
|
+
data-validate="required,number"
|
|
75
|
+
>
|
|
76
|
+
<span class="o-forms-title">
|
|
77
|
+
<span class="o-forms-title__main">
|
|
78
|
+
Year of birth
|
|
79
|
+
</span>
|
|
80
|
+
<span class="o-forms-title__prompt">
|
|
81
|
+
This helps us ensure people of all ages find value in the FT
|
|
82
|
+
</span>
|
|
83
|
+
</span>
|
|
84
|
+
<span class="o-forms-input o-forms-input--text">
|
|
85
|
+
<input type="number"
|
|
86
|
+
id="yearOfBirth"
|
|
87
|
+
name="yearOfBirth"
|
|
88
|
+
placeholder="YYYY"
|
|
89
|
+
autocomplete="bday-year"
|
|
90
|
+
minlength="4"
|
|
91
|
+
maxlength="4"
|
|
92
|
+
data-trackable="year-of-birth"
|
|
93
|
+
aria-required="true"
|
|
94
|
+
required
|
|
95
|
+
value
|
|
96
|
+
>
|
|
97
|
+
<span class="o-forms-input__error">
|
|
98
|
+
Please enter a valid year of birth
|
|
99
|
+
</span>
|
|
100
|
+
</span>
|
|
101
|
+
</label>
|
|
102
|
+
`;
|
|
103
|
+
|
|
104
|
+
exports[`YearOfBirth renders a year of birth input with default error message 1`] = `
|
|
105
|
+
<label id="yearOfBirthField"
|
|
106
|
+
for="yearOfBirth"
|
|
107
|
+
class="o-forms-field ncf__validation-error"
|
|
108
|
+
data-validate="required,number"
|
|
109
|
+
>
|
|
110
|
+
<span class="o-forms-title">
|
|
111
|
+
<span class="o-forms-title__main">
|
|
112
|
+
Year of birth
|
|
113
|
+
</span>
|
|
114
|
+
<span class="o-forms-title__prompt">
|
|
115
|
+
</span>
|
|
116
|
+
</span>
|
|
117
|
+
<span class="o-forms-input o-forms-input--text o-forms-input--invalid">
|
|
118
|
+
<input type="number"
|
|
119
|
+
id="yearOfBirth"
|
|
120
|
+
name="yearOfBirth"
|
|
121
|
+
placeholder="YYYY"
|
|
122
|
+
autocomplete="bday-year"
|
|
123
|
+
minlength="4"
|
|
124
|
+
maxlength="4"
|
|
125
|
+
data-trackable="year-of-birth"
|
|
126
|
+
aria-required="true"
|
|
127
|
+
required
|
|
128
|
+
value
|
|
129
|
+
>
|
|
130
|
+
<span class="o-forms-input__error">
|
|
131
|
+
Please enter a valid year of birth
|
|
132
|
+
</span>
|
|
133
|
+
</span>
|
|
134
|
+
</label>
|
|
135
|
+
`;
|
|
136
|
+
|
|
137
|
+
exports[`YearOfBirth renders a year of birth input with default params 1`] = `
|
|
138
|
+
<label id="yearOfBirthField"
|
|
139
|
+
for="yearOfBirth"
|
|
140
|
+
class="o-forms-field ncf__validation-error"
|
|
141
|
+
data-validate="required,number"
|
|
142
|
+
>
|
|
143
|
+
<span class="o-forms-title">
|
|
144
|
+
<span class="o-forms-title__main">
|
|
145
|
+
Year of birth
|
|
146
|
+
</span>
|
|
147
|
+
<span class="o-forms-title__prompt">
|
|
148
|
+
</span>
|
|
149
|
+
</span>
|
|
150
|
+
<span class="o-forms-input o-forms-input--text">
|
|
151
|
+
<input type="number"
|
|
152
|
+
id="yearOfBirth"
|
|
153
|
+
name="yearOfBirth"
|
|
154
|
+
placeholder="YYYY"
|
|
155
|
+
autocomplete="bday-year"
|
|
156
|
+
minlength="4"
|
|
157
|
+
maxlength="4"
|
|
158
|
+
data-trackable="year-of-birth"
|
|
159
|
+
aria-required="true"
|
|
160
|
+
required
|
|
161
|
+
value
|
|
162
|
+
>
|
|
163
|
+
<span class="o-forms-input__error">
|
|
164
|
+
Please enter a valid year of birth
|
|
165
|
+
</span>
|
|
166
|
+
</span>
|
|
167
|
+
</label>
|
|
168
|
+
`;
|
|
169
|
+
|
|
170
|
+
exports[`YearOfBirth renders an optional year of birth input 1`] = `
|
|
171
|
+
<label id="yearOfBirthField"
|
|
172
|
+
for="yearOfBirth"
|
|
173
|
+
class="o-forms-field ncf__validation-error"
|
|
174
|
+
data-validate="required,number"
|
|
175
|
+
>
|
|
176
|
+
<span class="o-forms-title o-forms-field--optional">
|
|
177
|
+
<span class="o-forms-title__main">
|
|
178
|
+
Year of birth
|
|
179
|
+
</span>
|
|
180
|
+
<span class="o-forms-title__prompt">
|
|
181
|
+
</span>
|
|
182
|
+
</span>
|
|
183
|
+
<span class="o-forms-input o-forms-input--text">
|
|
184
|
+
<input type="number"
|
|
185
|
+
id="yearOfBirth"
|
|
186
|
+
name="yearOfBirth"
|
|
187
|
+
placeholder="YYYY"
|
|
188
|
+
autocomplete="bday-year"
|
|
189
|
+
minlength="4"
|
|
190
|
+
maxlength="4"
|
|
191
|
+
data-trackable="year-of-birth"
|
|
192
|
+
aria-required="false"
|
|
193
|
+
value
|
|
194
|
+
>
|
|
195
|
+
<span class="o-forms-input__error">
|
|
196
|
+
Please enter a valid year of birth
|
|
197
|
+
</span>
|
|
198
|
+
</span>
|
|
199
|
+
</label>
|
|
200
|
+
`;
|
package/components/index.js
CHANGED
|
@@ -57,3 +57,6 @@ export { GraduationDate } from './graduation-date';
|
|
|
57
57
|
export { GoogleSignIn } from './google-sign-in';
|
|
58
58
|
export { TextInput } from './text-input';
|
|
59
59
|
export { DeferredBillingTerms } from './deferred-billing-terms';
|
|
60
|
+
export { YearOfBirth } from './year-of-birth';
|
|
61
|
+
export { ProceedWithPaymentLink } from './proceed-with-payment-link';
|
|
62
|
+
export { SubscriptionConfirmationWithPaymentLink } from './subscription-confirmation-with-payment-link';
|
|
@@ -42,6 +42,7 @@ export function PaymentType({
|
|
|
42
42
|
value,
|
|
43
43
|
isSingleTerm = false,
|
|
44
44
|
isSingleTermChecked = false,
|
|
45
|
+
enableZuoraPaymentLink = false,
|
|
45
46
|
}) {
|
|
46
47
|
const createSecuritySeal = () => {
|
|
47
48
|
return (
|
|
@@ -95,6 +96,11 @@ export function PaymentType({
|
|
|
95
96
|
hide: !enableBankTransfer,
|
|
96
97
|
};
|
|
97
98
|
|
|
99
|
+
const zuoraPaymentLink = {
|
|
100
|
+
id: 'zuorapaymentlink',
|
|
101
|
+
label: 'Zuora Payment',
|
|
102
|
+
hide: !enableZuoraPaymentLink,
|
|
103
|
+
};
|
|
98
104
|
const createPaymentTypes = () => {
|
|
99
105
|
const paymentTypes = [
|
|
100
106
|
paymentTypeCreditCard,
|
|
@@ -102,6 +108,7 @@ export function PaymentType({
|
|
|
102
108
|
paymentTypeDirectDebit,
|
|
103
109
|
paymentTypeApplePay,
|
|
104
110
|
paymentTypeBankTransfer,
|
|
111
|
+
zuoraPaymentLink,
|
|
105
112
|
].filter(Boolean);
|
|
106
113
|
|
|
107
114
|
return paymentTypes.map((type) => {
|
|
@@ -284,4 +291,5 @@ PaymentType.propTypes = {
|
|
|
284
291
|
value: PropTypes.string,
|
|
285
292
|
isSingleTerm: PropTypes.bool,
|
|
286
293
|
isSingleTermChecked: PropTypes.bool,
|
|
294
|
+
enableZuoraPaymentLink: PropTypes.bool,
|
|
287
295
|
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
export function ProceedWithPaymentLink({
|
|
5
|
+
id = 'proceedWithPaymentLink',
|
|
6
|
+
title = `By proceeding now, you're:`,
|
|
7
|
+
description,
|
|
8
|
+
listItems = [],
|
|
9
|
+
children = (
|
|
10
|
+
<button className="proceed-with-payment-link__button">Proceed</button>
|
|
11
|
+
),
|
|
12
|
+
}) {
|
|
13
|
+
return (
|
|
14
|
+
<div id={id} className="proceed-with-payment-link o-forms-field">
|
|
15
|
+
{title && <h2 className="proceed-with-payment-link__heading">{title}</h2>}
|
|
16
|
+
{description && (
|
|
17
|
+
<p className="proceed-with-payment-link__description">{description}</p>
|
|
18
|
+
)}
|
|
19
|
+
{listItems.length > 0 && (
|
|
20
|
+
<ul className="proceed-with-payment-link__list">
|
|
21
|
+
{listItems.map((item, index) => (
|
|
22
|
+
<li key={index} className="proceed-with-payment-link__list-item">
|
|
23
|
+
<span
|
|
24
|
+
className="proceed-with-payment-link__icon"
|
|
25
|
+
aria-hidden="true"
|
|
26
|
+
></span>
|
|
27
|
+
<span className="proceed-with-payment-link__list-item-text">
|
|
28
|
+
{item}
|
|
29
|
+
</span>
|
|
30
|
+
</li>
|
|
31
|
+
))}
|
|
32
|
+
</ul>
|
|
33
|
+
)}
|
|
34
|
+
{children && (
|
|
35
|
+
<div className="proceed-with-payment-link__actions">{children}</div>
|
|
36
|
+
)}
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
ProceedWithPaymentLink.propTypes = {
|
|
42
|
+
id: PropTypes.string,
|
|
43
|
+
title: PropTypes.string,
|
|
44
|
+
description: PropTypes.string,
|
|
45
|
+
listItems: PropTypes.arrayOf(PropTypes.string),
|
|
46
|
+
children: PropTypes.node,
|
|
47
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ProceedWithPaymentLink } from './proceed-with-payment-link';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Proceed With Payment Link',
|
|
6
|
+
component: ProceedWithPaymentLink,
|
|
7
|
+
argTypes: {
|
|
8
|
+
id: { control: 'text' },
|
|
9
|
+
title: { control: 'text' },
|
|
10
|
+
description: { control: 'text' },
|
|
11
|
+
listItems: { control: 'array' },
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const Basic = (args) => (
|
|
16
|
+
<ProceedWithPaymentLink {...args}>
|
|
17
|
+
<button className="proceed-with-payment-link__button">
|
|
18
|
+
{args.buttonText}
|
|
19
|
+
</button>
|
|
20
|
+
</ProceedWithPaymentLink>
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
Basic.args = {
|
|
24
|
+
id: 'payment-section',
|
|
25
|
+
title: `By proceeding now, you're:`,
|
|
26
|
+
listItems: [
|
|
27
|
+
'Activating the customer’s subscription',
|
|
28
|
+
'Creating a payment link for the customer to complete their payment on Zuora, which they must do within 24 hours',
|
|
29
|
+
],
|
|
30
|
+
buttonText: 'Proceed now',
|
|
31
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
export function SubscriptionConfirmationWithPaymentLink({
|
|
5
|
+
id = 'subscriptionConfirmationWithPaymentLink',
|
|
6
|
+
header = 'The subscription is now active',
|
|
7
|
+
body,
|
|
8
|
+
paymentLink,
|
|
9
|
+
}) {
|
|
10
|
+
return (
|
|
11
|
+
<div id={id} className="subscription-active-with-payment-link">
|
|
12
|
+
{/* Header */}
|
|
13
|
+
{header && (
|
|
14
|
+
<div className="subscription-active-with-payment-link__header">
|
|
15
|
+
<div className="subscription-active-with-payment-link__icon-container">
|
|
16
|
+
<span className="subscription-active-with-payment-link__icon"></span>
|
|
17
|
+
</div>
|
|
18
|
+
<h3 className="subscription-active-with-payment-link__title">
|
|
19
|
+
{header}
|
|
20
|
+
</h3>
|
|
21
|
+
</div>
|
|
22
|
+
)}
|
|
23
|
+
|
|
24
|
+
{/* Body */}
|
|
25
|
+
{body && (
|
|
26
|
+
<p
|
|
27
|
+
className="subscription-active-with-payment-link__description"
|
|
28
|
+
dangerouslySetInnerHTML={{ __html: body }}
|
|
29
|
+
/>
|
|
30
|
+
)}
|
|
31
|
+
|
|
32
|
+
{/* Payment Link Section */}
|
|
33
|
+
{paymentLink && (
|
|
34
|
+
<>
|
|
35
|
+
<label className="subscription-active-with-payment-link__label">
|
|
36
|
+
Zuora Payment Link
|
|
37
|
+
</label>
|
|
38
|
+
<div className="subscription-active-with-payment-link__payment-box">
|
|
39
|
+
<input
|
|
40
|
+
type="text"
|
|
41
|
+
value={paymentLink}
|
|
42
|
+
readOnly
|
|
43
|
+
className="subscription-active-with-payment-link__input"
|
|
44
|
+
/>
|
|
45
|
+
<button className="subscription-active-with-payment-link__button">
|
|
46
|
+
Copy
|
|
47
|
+
</button>
|
|
48
|
+
</div>
|
|
49
|
+
</>
|
|
50
|
+
)}
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
SubscriptionConfirmationWithPaymentLink.propTypes = {
|
|
56
|
+
id: PropTypes.string,
|
|
57
|
+
header: PropTypes.string,
|
|
58
|
+
body: PropTypes.string,
|
|
59
|
+
paymentLink: PropTypes.string,
|
|
60
|
+
};
|